Files
deepseek-harness/packages/api/job-controller/tests/built-lib.e2e.ts
T
Yichen Jiang 6e41857b2e Merge remote-tracking branch 'origin/master' into worktree/jobs-api-review-3052
# Conflicts:
#	docs/event-producer-consumer.i18n.yaml
#	docs/event-producer-consumer.md
#	docs/event-producer-consumer.zh.md
#	packages/api/remotes/src/client/index.ts
#	packages/api/session-controller/README.i18n.yaml
#	packages/api/session-controller/README.md
#	packages/api/session-controller/README.zh.md
#	packages/api/session-controller/src/client/sessions/manager.ts
#	packages/api/session-controller/src/control.ts
#	packages/api/session-controller/src/types.ts
#	packages/api/session-controller/tests/client-apply.client.spec.ts
#	packages/api/session-controller/tests/manager.client.spec.ts
#	packages/api/session-controller/tests/projection-store.client.spec.ts
#	packages/api/session-controller/tests/queue-store.client.spec.ts
#	packages/api/session-controller/tests/sessions-service.client.spec.ts
#	packages/api/session-controller/tests/transport.client.spec.ts
#	packages/client/ui-jobs/package.json
#	packages/client/ui-primitives/src/TerminalBlock.module.css
#	packages/client/ui-primitives/src/TerminalBlock.tsx
#	packages/client/ui-primitives/tests/terminal-block.client.spec.tsx
#	packages/extensions/tool-cordis/src/api-catalog.ts
#	packages/test-support/client-runtime/src/assembly/remote-default-responses.ts
2026-09-16 16:05:59 +08:00

43 lines
1.8 KiB
TypeScript

import { existsSync } from 'node:fs'
import { join } from 'node:path'
import { fileURLToPath, pathToFileURL } from 'node:url'
import { describe, expect, it } from 'vitest'
/**
* Built-artifact smoke for the generated job Remote codecs. This package's
* program compiles only the `JobKindMap` merges it can see (`bash`,
* `subagent`), while the Host registers `pwsh`, `pty-send`, and every other
* producer kind, so the wire projection's `kind` must reach the codec as an
* open string rather than the literal union this program observes.
*/
const artifact = join(fileURLToPath(new URL('..', import.meta.url)), 'lib/typert.host.js')
interface BuiltInvocation {
readonly method: string
readonly result: { create(): { safeParse(value: unknown): { success: boolean } } }
}
const row = {
id: 'pty-send-1',
kind: 'pty-send',
label: 'send',
status: 'running',
startedAt: 1,
output: { total: 0, earliest: 0 },
}
describe.skipIf(!existsSync(artifact))('job Remote built codecs', () => {
it('accept a row whose kind this program never compiled, and still reject a status outside the lifecycle', async () => {
const { TYPERT } = await import(pathToFileURL(artifact).href) as { TYPERT: { invocations: readonly BuiltInvocation[] } }
const schemaOf = (method: string): ReturnType<BuiltInvocation['result']['create']> => {
const invocation = TYPERT.invocations.find(candidate => candidate.method === method)
if (invocation === undefined) throw new Error(`no generated job.${method} invocation`)
return invocation.result.create()
}
expect(schemaOf('list').safeParse({ type: 'rows', jobs: [row] }).success).toBe(true)
expect(schemaOf('follow').safeParse({ type: 'opened', job: row, from: 0 }).success).toBe(true)
expect(schemaOf('follow').safeParse({ type: 'status', job: { ...row, status: 'paused' } }).success).toBe(false)
})
})