mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-08-29 04:26:38 +00:00
refactor(connection): own RPC transport contracts
This commit is contained in:
@@ -119,19 +119,19 @@ async function stopWeb(running: RunningWeb): Promise<void> {
|
||||
clearTimeout(forced)
|
||||
}
|
||||
|
||||
/** POST one real API Proxy envelope while controlling the wire Host header. */
|
||||
function describeHost(port: number, host: string, cookie?: string): Promise<HttpResult> {
|
||||
/** POST one real Remote envelope while controlling the wire Host header. */
|
||||
function describeSettings(port: number, host: string, cookie?: string): Promise<HttpResult> {
|
||||
const body = JSON.stringify({
|
||||
type: 'client-request',
|
||||
rpcId: 'web-auth-real-cli',
|
||||
method: 'host.describe',
|
||||
payload: {},
|
||||
method: 'settings/describe',
|
||||
payload: { args: {} },
|
||||
})
|
||||
return new Promise((resolve, reject) => {
|
||||
const req = httpRequest({
|
||||
hostname: '127.0.0.1',
|
||||
port,
|
||||
path: '/api/host.describe',
|
||||
path: '/api/settings/describe',
|
||||
method: 'POST',
|
||||
headers: {
|
||||
host,
|
||||
@@ -165,7 +165,7 @@ describe('dsh web authentication through the real CLI', () => {
|
||||
expect(firstUrl.pathname).toBe('/')
|
||||
expect(firstUrl.searchParams.get('token')).toMatch(/^[A-Za-z0-9_-]{43}$/u)
|
||||
|
||||
expect(await describeHost(port, `localhost:${String(port)}`)).toEqual({
|
||||
expect(await describeSettings(port, `localhost:${String(port)}`)).toEqual({
|
||||
status: 401,
|
||||
body: 'unauthorized',
|
||||
})
|
||||
@@ -180,13 +180,13 @@ describe('dsh web authentication through the real CLI', () => {
|
||||
expect(setCookie).not.toContain('Secure')
|
||||
const cookie = setCookie.split(';', 1)[0]!
|
||||
|
||||
const authenticated = await describeHost(port, firstUrl.host, cookie)
|
||||
const authenticated = await describeSettings(port, firstUrl.host, cookie)
|
||||
expect(authenticated.status).toBe(200)
|
||||
const authenticatedBody = JSON.parse(authenticated.body) as unknown
|
||||
expect(authenticatedBody).toMatchObject({
|
||||
type: 'server-response',
|
||||
rpcId: 'web-auth-real-cli',
|
||||
result: { ok: true, value: { version: expect.any(String) as unknown } },
|
||||
result: { ok: true, value: { namespaces: expect.any(Array) as unknown } },
|
||||
})
|
||||
|
||||
await stopWeb(first)
|
||||
@@ -194,7 +194,7 @@ describe('dsh web authentication through the real CLI', () => {
|
||||
second = await startWeb(root, dshHome, port)
|
||||
const secondUrl = new URL(second.launchUrl)
|
||||
expect(secondUrl.searchParams.get('token')).not.toBe(firstUrl.searchParams.get('token'))
|
||||
expect((await describeHost(port, secondUrl.host, cookie)).status).toBe(200)
|
||||
expect((await describeSettings(port, secondUrl.host, cookie)).status).toBe(200)
|
||||
|
||||
const credentialMode = (await stat(join(dshHome, '.credentials.yaml'))).mode & 0o777
|
||||
expect(credentialMode).toBe(0o600)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Shared scaffolding for the assembled-jsdom snapshots: the real built
|
||||
// workspace `lib/client.js` artifacts booted through AppWebEntry's
|
||||
// ModuleLoader path (loadBundle) against the keyless FixtureApiClient
|
||||
// ModuleLoader path (loadBundle) against the keyless fixture Connection RPC
|
||||
// transport. Every file that mounts this graph needs the same boot entry list,
|
||||
// the same bundle map, the same jsdom globals, and the same mount call, and
|
||||
// differs only in what it asserts afterwards, so the scaffolding lives here.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// reach a surface only the built bundles expose; this one asserts that the
|
||||
// graph assembles at all — staged activation across the immediately tier and
|
||||
// the inject layers, per-plugin CSS injection, and a rendered journey reaching
|
||||
// chat content from the keyless FixtureApiClient transport.
|
||||
// chat content from the keyless fixture Connection RPC.
|
||||
//
|
||||
// Component behavior remains owned by per-package suites (SlotTestRuntime
|
||||
// benches over src). This smoke additionally pins the resident interaction
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @vitest-environment jsdom
|
||||
// The command image-attachment envelope over the BUILT client graph (real
|
||||
// bundles via AppWebEntry, keyless FixtureApiClient transport): an enter
|
||||
// bundles via AppWebEntry, keyless fixture Connection RPC): an enter
|
||||
// submission carrying composer images resolves only through a command whose
|
||||
// descriptor declares `input.images`. A non-declaring command refuses with
|
||||
// one composer error banner and everything retained; a declaring command
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Keyless assembled-browser coverage for the goal bar over the shipped Web
|
||||
// bundles and FixtureApiClient wire. The command creates a real projected
|
||||
// bundles and the fixture Connection RPC. The command creates a real projected
|
||||
// goal in the fixture session; the golden pins the active strip, while the
|
||||
// clear gesture proves the acknowledged tombstone leaves neither stale chrome
|
||||
// nor a duplicate-mutation error.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @vitest-environment jsdom
|
||||
// Multimodal image surfaces over the BUILT client graph (the code-mode-fixture
|
||||
// idiom: real bundles via AppWebEntry, keyless FixtureApiClient transport).
|
||||
// idiom: real bundles via AppWebEntry, keyless fixture Connection RPC).
|
||||
// Opens the fixture history session whose turn 73 carries an image in BOTH a
|
||||
// user message and an assistant message, and pins the product surfaces: the
|
||||
// history ImageGallery loading real fixture bytes through the authorized
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// @vitest-environment jsdom
|
||||
// Assembled max-tokens snapshot: boots the real built `packages/client/*/lib/
|
||||
// client.js` bundles through AppWebEntry's ModuleLoader path against the
|
||||
// keyless FixtureApiClient transport, opens the fixture session, and pins the
|
||||
// keyless fixture Connection RPC, opens the fixture session, and pins the
|
||||
// surface its max-tokens turn (72) reaches — the turn-end notice row that a
|
||||
// provider output-cap truncation must render instead of ending silently.
|
||||
//
|
||||
|
||||
@@ -200,7 +200,7 @@ describe('web e2e: fresh round trip through the real assembly', () => {
|
||||
it.skipIf(MODE === 'record')('expands and collapses the reasoning fold from its click target', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-round-trip-think'))
|
||||
// Interaction over the REAL wire-delivered transcript (the fixture-client
|
||||
// tier pins the same gesture against FixtureApiClient; this one runs on
|
||||
// tier pins the same gesture against the fixture Connection RPC; this one runs on
|
||||
// follow-stream-fed state). Runs after the golden capture so the committed
|
||||
// aria surface stays the untouched settled state.
|
||||
await expandTurnProcesses(page)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// @vitest-environment jsdom
|
||||
// Assembled search-card snapshot: boots the real built workspace client bundles
|
||||
// through AppWebEntry's ModuleLoader path against the keyless
|
||||
// FixtureApiClient transport (no API key, no model round), opens the fixture
|
||||
// fixture Connection RPC (no API key, no model round), opens the fixture
|
||||
// session, and pins the search card the `grep` turn (fixture turn 67) renders in
|
||||
// the assembled application. The built-boot smoke proves the graph boots but
|
||||
// intentionally carries no behavior assertions; this is the assembled-output check
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// @vitest-environment jsdom
|
||||
// Local submission echo over the BUILT client graph (keyless FixtureApiClient
|
||||
// Local submission echo over the BUILT client graph (keyless fixture Connection RPC
|
||||
// transport): a text-plus-image send paints its echo bubble synchronously on
|
||||
// the submit keystroke — before serialization, transport, or the fixture's
|
||||
// durable admission — with the composer already cleared and editable, and the
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// @vitest-environment jsdom
|
||||
// Assembled todo snapshot: boots the real built `packages/client/*/lib/
|
||||
// client.js` bundles through AppWebEntry's ModuleLoader path against the
|
||||
// keyless FixtureApiClient transport, opens the fixture session, and pins the
|
||||
// keyless fixture Connection RPC, opens the fixture session, and pins the
|
||||
// two surfaces the fixture's parallel plan (turn 74, two items `in_progress`)
|
||||
// reaches — the `todo_write` tool row and the dock's plan strip.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @vitest-environment jsdom
|
||||
// Trajectory image surfaces over the BUILT client graph (the code-mode-fixture
|
||||
// idiom: real bundles via AppWebEntry, keyless FixtureApiClient transport).
|
||||
// idiom: real bundles via AppWebEntry, keyless fixture Connection RPC).
|
||||
// Opens the fixture history session whose turn 73 carries an image in BOTH a
|
||||
// user message and an assistant message, and pins the Trajectory surfaces:
|
||||
// selecting the ledger record renders the shared ui-attachment gallery from
|
||||
|
||||
Reference in New Issue
Block a user