Merge remote-tracking branch 'origin/master' into worktree/process-plugin-streaming-72f9b3

# Conflicts:
#	.agents/notes/archived/manifest.json
#	.agents/notes/implemented/architecture/2026-06-20-generic-long-running-tool-runtime.i18n.yaml
#	.agents/notes/implemented/architecture/2026-06-20-generic-long-running-tool-runtime.md
#	.agents/notes/implemented/architecture/2026-06-20-generic-long-running-tool-runtime.zh.md
#	.agents/notes/implemented/bug-fix/2026-09-05-nested-terminal-cards.i18n.yaml
#	.agents/notes/implemented/feature/2026-08-11-background-job-completion-wakes-an-idle-owner.i18n.yaml
#	.agents/notes/implemented/testing/2026-09-06-standard-hosted-benchmark-runner.i18n.yaml
#	docs/architecture.i18n.yaml
#	docs/capability-seams.i18n.yaml
#	docs/config-catalog.i18n.yaml
#	docs/cookbook/adding-a-tool.i18n.yaml
#	docs/event-producer-consumer.i18n.yaml
#	docs/module-graph.i18n.yaml
#	docs/persistence-catalog.i18n.yaml
#	docs/subsystems/shell.i18n.yaml
#	packages/client/ui-primitives/README.i18n.yaml
#	packages/jobs/jobs-local/README.i18n.yaml
#	packages/jobs/jobs/README.i18n.yaml
#	packages/jobs/jobs/README.md
#	packages/jobs/jobs/README.zh.md
#	packages/jobs/tool-jobs/README.i18n.yaml
#	packages/shell/tool-bash/README.i18n.yaml
#	packages/shell/tool-pwsh/README.i18n.yaml
This commit is contained in:
Yichen Jiang committed 2026-09-07 10:39:56 +08:00
commit bf91cd855e
3081 files changed
+23929 -12258

No files matched your search

+6 -4
View File
@@ -156,6 +156,9 @@ const packageFileExtras: Readonly<Record<string, readonly string[]>> = {
// The Web Host mounts the default-off settings owner independently of each
// Agent-scoped delegation-tool instance.
'@deepseek-ai/dsh-tool-subagent': ['lib/model-selection-settings.js'],
// The JSONL backend resolves its private verification Worker relative to
// import.meta.url; it is shipped without a public package subpath.
'@deepseek-ai/dsh-session-persistence-jsonl': ['lib/worker.cjs'],
// The argv-prefix runner entry ships beside the lib as its own bundle;
// sandbox-local resolves it through the package's ./runner export. tsdown
// also shares its generated FFI code through a hashed runtime chunk.
@@ -319,10 +322,9 @@ export function checkWorkspaceManifest({ dir, manifest }: WorkspaceManifest): st
//
// Access is per release sequence, not per scope: the vendored framework and
// the Landlock packages publish publicly because outside consumers install
// them, while the dsh family stays restricted until its own sequence goes
// public. A mixed scope is why no publish path passes `--access` — one flag
// cannot serve both, so each packed manifest decides
// ([rationale](../.agents/notes/implemented/process/2026-08-13-public-vendor-and-native-sequences.md)).
// them, and the dsh family published publicly with its own sequence on
// 2026-08-13. No publish path passes `--access`; each packed manifest declares
// it, and this gate requires every release member to be public.
if (manifest.private === true) {
errors.push(`${label}: release member must not set "private": true`)
}
+48 -2
View File
@@ -66,13 +66,14 @@ describe('CI workflow', () => {
|| !isRecord(workflow.jobs['windows-observational'])
|| !isRecord(workflow.jobs['node-24'])
|| !isRecord(workflow.jobs['node-24-coverage'])
|| !isRecord(workflow.jobs['node-24-bench'])
|| !isRecord(workflow.jobs['node-24-consumers'])
|| !isRecord(workflow.jobs['node-compat'])
|| !isRecord(workflow.jobs['all-checks-passed'])
|| !isRecord(masterWorkflow.jobs)
|| !isRecord(masterWorkflow.jobs['wine-apt-cache'])
|| !isRecord(masterWorkflow.jobs['serial-windows'])) {
throw new TypeError('CI workflow must define windows, windows-build, windows-coverage, windows-native-tests, windows-observational, node-24, node-24-coverage, node-24-consumers, node-compat, and all-checks-passed; ci-master must define wine-apt-cache and serial-windows')
throw new TypeError('CI workflow must define windows, windows-build, windows-coverage, windows-native-tests, windows-observational, node-24, node-24-coverage, node-24-bench, node-24-consumers, node-compat, and all-checks-passed; ci-master must define wine-apt-cache and serial-windows')
}
const windows = workflow.jobs.windows
@@ -84,6 +85,7 @@ describe('CI workflow', () => {
const serialWindows = masterWorkflow.jobs['serial-windows']
const node24 = workflow.jobs['node-24']
const node24Coverage = workflow.jobs['node-24-coverage']
const node24Bench = workflow.jobs['node-24-bench']
const node24Consumers = workflow.jobs['node-24-consumers']
const nodeCompat = workflow.jobs['node-compat']
const aggregate = workflow.jobs['all-checks-passed']
@@ -223,12 +225,17 @@ describe('CI workflow', () => {
// half-close tests are stabilized; observational stays out too.
expect(aggregate.needs).toContain('windows')
expect(aggregate.needs).toContain('windows-build')
// The benchmark lane is a required verdict input and runs alone so its
// wall-clock budgets never share a runner with a concurrent aggregate.
expect(aggregate.needs).toContain('node-24-bench')
expect(node24Bench.name).toBe('node 24 / benchmarks')
expect(node24Bench.env).toBeUndefined()
expect(aggregate.needs).not.toContain('windows-coverage')
expect(aggregate.needs).toContain('windows-native-tests')
expect(aggregate.needs).not.toContain('windows-observational')
expect(aggregate.needs).not.toContain('serial-windows')
// Linux failover is a separate switch: the three required Linux workers
// Linux failover is a separate switch: the three enterprise Linux workers
// and the verdict job resolve their pool through DSH_CI_FAILOVER_LINUX,
// never the Windows switch.
for (const [jobName, job] of [['node-24', node24], ['node-24-coverage', node24Coverage], ['node-24-consumers', node24Consumers]] as const) {
@@ -262,6 +269,45 @@ describe('CI workflow', () => {
expect(windowsObservational.env).not.toMatchObject({ DSH_GATE_FAIL_FAST: '1' })
})
it('runs required benchmarks on standard hosted Linux independently of failover', () => {
const workflow = loadWorkflow('.github/workflows/ci.yml')
const benchmark = workflowJob(workflow, 'node-24-bench')
const aggregate = workflowJob(workflow, 'all-checks-passed')
expect(benchmark['runs-on']).toBe('ubuntu-24.04')
expect(benchmark.if).toBe("github.event_name == 'pull_request'")
expect(benchmark.needs).toBeUndefined()
expect(benchmark['continue-on-error']).toBeUndefined()
expect(benchmark.env).toBeUndefined()
expect(aggregate.needs).toContain('node-24-bench')
})
it('always restores the hosted benchmark pnpm cache', () => {
const benchmark = workflowJob(loadWorkflow('.github/workflows/ci.yml'), 'node-24-bench')
if (!Array.isArray(benchmark.steps)) throw new TypeError('benchmark job must define steps')
const caches = benchmark.steps.filter(step => isRecord(step) && step.uses === 'actions/cache/restore@v4')
expect(caches).toHaveLength(1)
expect(caches[0]).not.toHaveProperty('if')
expect(caches[0]).toMatchObject({
with: {
path: '${{ steps.pnpm-store.outputs.path }}',
key: "${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}",
},
})
})
it('bounds the complete benchmark job to fifteen minutes', () => {
const benchmark = workflowJob(loadWorkflow('.github/workflows/ci.yml'), 'node-24-bench')
expect(benchmark['timeout-minutes']).toBe(15)
expect(benchmark.steps).toContainEqual({
name: 'Run performance benchmarks',
env: { DSH_GATE_VERBOSE: '1' },
run: 'pnpm run check:ci:bench',
})
})
it('gives the Wine Host TypeScript compile the repository heap budget', () => {
const wineGates = readFileSync(resolve(root, 'scripts/wine-windows-gates.sh'), 'utf8')
+7
View File
@@ -101,6 +101,13 @@ describe('client bundle purity gate', () => {
expect(() => resolveId('@deepseek-ai/dsh-token-meter/client/internal')).toThrow(/purity/)
})
it('admits only the pure spill notice entry, not its Host policy', () => {
expect(resolveId('@deepseek-ai/dsh-spill-policy/notice')).toBeNull()
expect(resolveId('@deepseek-ai/dsh-output-retention')).toBeNull()
expect(() => resolveId('@deepseek-ai/dsh-spill-policy')).toThrow(/purity/)
expect(() => resolveId('@deepseek-ai/dsh-spill-policy/notice/internal')).toThrow(/purity/)
})
it('lets exact generated Remote contributions inline without admitting their package implementation', () => {
expect(resolveId('@deepseek-ai/dsh-goal/remote')).toBeNull()
expect(() => resolveId('@deepseek-ai/dsh-goal')).toThrow(/purity/)
+1 -1
View File
@@ -4,7 +4,7 @@
"docs/architecture.md": 2400,
"docs/cordis-primer.md": 600,
"docs/defensive-patterns.md": 550,
"docs/testing.md": 1300,
"docs/testing.md": 1350,
"packages/AGENTS.md": 750,
"packages/README.md": 994
}
+1
View File
@@ -85,6 +85,7 @@ const PACKAGE_LIBRARIES: Readonly<Record<string, string>> = {
'packages/util/launch-environment': 'Zero-dependency environment resolver.',
'packages/util/native-command': 'Host-side subprocess runner utility.',
'packages/util/output-retention': 'Zero-dependency retention utility.',
'packages/util/package-manifest': 'Shared package manifest declarations with type-only exports.',
'packages/util/time': 'Zero-dependency time-zone canonicalization utility.',
'packages/util/timeout': 'Zero-dependency timeout utility.',
'packages/util/values': 'Stateless lossless-JSON and immutable-value helpers.',
+1
View File
@@ -205,6 +205,7 @@ export const EVENT_SCOPE_PAGE: Record<string, string> = {
'subagent': 'subagent.md',
'system-prompt': 'system-prompt.md',
'session-telemetry': 'session-telemetry.md',
'feedback': 'feedback.md',
'tools': 'tools.md',
'user-questions': 'user-questions.md',
'webserver': 'web-server.md',
+2 -2
View File
@@ -303,7 +303,7 @@ const SERVICE_ROLES: ServiceRole[] = [
pkg: 'storage-domain',
title: 'Domain data facility',
mode: 'core',
consumers: ['workspace', 'message-feedback'],
consumers: ['workspace'],
note: 'Waits for every configured backend, then publishes the domain form as one lifecycle-bound service for typed durable state.',
},
{
@@ -311,7 +311,7 @@ const SERVICE_ROLES: ServiceRole[] = [
pkg: 'message-feedback',
title: 'Lifecycle-bound message feedback',
mode: 'core',
note: 'Owns local per-assistant-message feedback, lifecycle and target validation, per-item compare-and-set, and the Host unary Remote contract without entering Session history or telemetry.',
note: 'Owns per-assistant-message feedback in the canonical Session log, target validation, per-item compare-and-set, and the Host unary Remote contract. Feedback stays outside model history; log export follows the consumer policy.',
},
{
key: 'workspaceRegistry',
+1 -1
View File
@@ -366,7 +366,7 @@ export function render(events: AnnotatedLogEventEntry[], envelopeTypes: EventEnv
'',
'Every event type that can appear in a session\'s durable event log: the complete persisted `SessionEvent` envelope and each member of the merge-extensible `SessionEventMap` — the owning vocabulary in `@deepseek-ai/dsh-session` plus every plugin declaration merge into `@deepseek-ai/dsh-session/types` in this repo — with source JSDoc, full payload declaration, surface badge, and declaration site. It complements [session.md](subsystems/session.md) (surface ordering and the `deriveMessages()` projection), [persistence.md](subsystems/persistence.md) (how the log is made durable), and the generated region of [session.md](subsystems/session.md#cordis-surface) (the live bus wiring — a log event is NOT a cordis event; it reaches listeners via the single `session/event` emit).',
'',
'This file is GENERATED from source (`scripts/gen-persistence-catalog.ts`) and verified fresh by `pnpm run verify-persistence-catalog` (part of `doc-sync`) — do not edit it by hand. Declaration blocks retain the source declaration and nested property JSDoc, removing only the indentation imposed by a containing interface/module, and use a `ts persistence-catalog` fence (skipped by doc-typecheck because declarations reference types from their owning modules). Type names in a payload link to the page that documents them. See [the persistence-log-catalog Agent Note](../.agents/notes/archived/process/2026-07-04-persistence-log-catalog.md).',
'This file is GENERATED from source (`scripts/gen-persistence-catalog.ts`) and verified fresh by `pnpm run verify-persistence-catalog` (part of `doc-sync`) — do not edit it by hand. Declaration blocks retain the source declaration and nested property JSDoc, removing only the indentation imposed by a containing interface/module, and use a `ts persistence-catalog` fence (skipped by doc-typecheck because declarations reference types from their owning modules). Type names in a payload link to the page that documents them. The archived [persistence-log-catalog record](../.agents/notes/archived/process/2026-07-04-persistence-log-catalog.md) documents the original catalog decision.',
'',
'The envelope declarations below compose each event\'s `type`, monotonic `seq`, epoch-ms `time`, `data`, the optional `ignorable` unknown-type skip marker, and the conditional `surfaceOp`/`sourceEventSeqs` fields. **surface** marks a `SurfaceEventType` member: it produces an LLM message and declares how it joins the surface list. **log-only** marks everything else: a durable, replayable record with no derived-history contribution. Every payload is JSON-serializable (enforced at `Session.append`). Current writers stamp `SESSION_FORMAT_VERSION`; supported historical artifacts reach this current vocabulary through the build-static adjacent migration catalog ([the version lifecycle](subsystems/persistence.md)). Scope: the packages in this repo; a downstream plugin can merge further current-version event types, which are outside this catalog by construction and require an explicit disposition at a later format edge.',
'',
+2 -1
View File
@@ -103,8 +103,9 @@ describe('session format catalog generator', () => {
expect(declarations.map(item => [item.from, item.to])).toEqual([[0, 1], [1, 2]])
expect(output).toContain("from '@deepseek-ai/dsh-session-format-v0-to-v1'")
expect(output).toContain('currentVersion: 2')
expect(output).toContain('encodeCurrentArtifact: artifact => releasedV2SessionFormatCodec.encodeArtifact(artifact)')
expect(output).toContain('currentEncoder: releasedV2SessionFormatCodec')
expect(output).toContain('restoreReleasedV2Artifact(artifact, KNOWN_SESSION_EVENT_TYPES)')
expect(output).toContain('restoreTransformedCurrent(artifact)')
expect(output).toContain('assertReleasedV2Header(header)')
expect(output).toContain('validateInstalledCurrentSessionHeader(header)')
expect(output).toContain("from '@deepseek-ai/dsh-session'")
+8 -11
View File
@@ -3,21 +3,15 @@
import { globSync, readFileSync, writeFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { pathToFileURL } from 'node:url'
import type { DshSessionFormatMigrationManifest } from '@deepseek-ai/dsh-package-manifest'
const root = resolve(import.meta.dirname, '..')
const OUT = 'packages/session/session-format-catalog/src/generated.ts'
/** One adjacent migration declaration read from a workspace manifest. */
export interface SessionFormatMigrationManifest {
/** Validated adjacent migration metadata with its resolved package import path. */
export interface SessionFormatMigrationManifest extends Readonly<Omit<DshSessionFormatMigrationManifest, 'export'>> {
readonly packageName: string
readonly importPath: string
readonly from: number
readonly to: number
readonly migration: string
readonly sourceCodec: string
readonly targetCodec: string
readonly targetHeaderValidator: string
readonly targetRestorer: string
}
interface RawManifest {
@@ -78,7 +72,7 @@ export function collectSessionFormatMigrations(
if (metadata === undefined) {
throw new Error(`gen-session-format-catalog: ${rel} lacks dsh.sessionFormatMigration`)
}
const allowed = new Set([
const allowed: ReadonlySet<string> = new Set<keyof DshSessionFormatMigrationManifest>([
'from', 'to', 'export', 'migration', 'sourceCodec', 'targetCodec',
'targetHeaderValidator', 'targetRestorer',
])
@@ -197,13 +191,16 @@ export function renderSessionFormatCatalog(
'export const sessionFormatCatalog = createSessionFormatCatalog({',
` currentVersion: ${currentVersion},`,
` codecs: [${codecs.join(', ')}],`,
` encodeCurrentArtifact: artifact => ${currentCodec}.encodeArtifact(artifact),`,
` currentEncoder: ${currentCodec},`,
` migrations: [${declarations.map(item => item.migration).join(', ')}],`,
' restoreCurrent(artifact) {',
` const restored = ${restorer}(artifact, KNOWN_SESSION_EVENT_TYPES)`,
' validateInstalledCurrentSessionArtifact(restored)',
' return restored',
' },',
' restoreTransformedCurrent(artifact) {',
` return ${restorer}(artifact, KNOWN_SESSION_EVENT_TYPES)`,
' },',
' restoreCurrentHeader(header) {',
` ${headerValidator}(header)`,
' validateInstalledCurrentSessionHeader(header)',
+3 -3
View File
@@ -2,8 +2,8 @@
* Generate `docs/tool-catalog.md` from schemas collected by booting each tool
* plugin. Runtime registration is the source of truth for computed schemas;
* the manifest is checked against every on-disk `tool-*` package. `--check`
* verifies the committed artifact. Rationale and ownership live in
* `.agents/notes/implemented/process/2026-07-02-tool-schema-catalog.md`.
* verifies the committed artifact. The original decision is recorded in
* `.agents/notes/archived/process/2026-07-02-tool-schema-catalog.md`.
*/
import { globSync, readFileSync, writeFileSync } from 'node:fs'
@@ -731,7 +731,7 @@ export function render(catalog: ToolCatalog): string {
'',
'Every model-facing tool a shipped plugin contributes to `ctx.tools`: the `name`, `description`, and JSON-Schema `parameters` the model receives via the system-prompt assembly. It complements the [subsystem pages](subsystems/core.md) (the types plus each page\'s generated Cordis API region) — this page is the *tools* the agent is offered.',
'',
'This file is GENERATED and verified fresh by `pnpm run verify-tool-catalog` (part of `doc-sync`) — do not edit it by hand. Unlike the cordis catalog (a pure source-AST pass), this generator BOOTS each tool plugin on a real context and reads `ctx.tools.schemas()`, because a tool schema is not statically knowable (runtime-spread enums, concatenated descriptions, config-driven names, raw-JSON-Schema MCP tools). A completeness guard globs `packages/*/tool-*` and fails if any package is missing from the generator\'s boot manifest, so a new tool cannot be silently undocumented. See [the tool-schema-catalog Agent Note](../.agents/notes/implemented/process/2026-07-02-tool-schema-catalog.md).',
'This file is GENERATED and verified fresh by `pnpm run verify-tool-catalog` (part of `doc-sync`) — do not edit it by hand. Unlike the cordis catalog (a pure source-AST pass), this generator BOOTS each tool plugin on a real context and reads `ctx.tools.schemas()`, because a tool schema is not statically knowable (runtime-spread enums, concatenated descriptions, config-driven names, raw-JSON-Schema MCP tools). A completeness guard globs `packages/*/tool-*` and fails if any package is missing from the generator\'s boot manifest, so a new tool cannot be silently undocumented.',
'',
'Scope: shipped product tools under `packages/*/tool-*`, each booted with its DEFAULT config, except where a Config field is REQUIRED with no default — there the generator must choose, and the per-package note records which branch this page shows. The registered tool NAME can be a load-time config (e.g. `tool-subagent`\'s `toolName`), so a deployment may expose a package under a different or additional name — a per-package note records those shipped aliases where they exist. The `examples/` demo tools (e.g. `echo`) are excluded, matching the cordis catalog\'s packages-only scope.',
'',
+1 -1
View File
@@ -215,7 +215,7 @@ function runInstaller(
// flag rather than yielding to it, so a smaller one here lowers what the lane
// grants every case in this file, none of which carries an allowance of its own.
// Rationale and the paired hook budget are in
// .agents/notes/implemented/testing/2026-08-29-windows-lane-hook-and-lefthook-budget.md.
// .agents/notes/archived/testing/2026-08-29-windows-lane-hook-and-lefthook-budget.md.
describe('worktree-local Lefthook installer', { timeout: 90_000 }, () => {
for (const [label, extraEnv] of [
['CI', { CI: 'true' }],
+4 -1
View File
@@ -39,11 +39,14 @@ const DUPLICATE_SAFE_PACKAGES: readonly string[] = [
/**
* Runtime exports whose values remain valid when npm installs another package copy.
* New entries are forbidden by default. Automated agents must not add an
* exception; every addition requires explicit human review and a dedicated,
* prominent heading in the pull request description.
*/
const SAFE_HOST_DEPENDENCY_EXPORTS = {
'@deepseek-ai/dsh-credentials': ['credentialKey'],
'@deepseek-ai/dsh-deque': ['Deque'],
'@deepseek-ai/dsh-llm': ['BlockAssembler', 'callConfigEquals', 'expandAssistantStream'],
'@deepseek-ai/dsh-llm': ['callConfigEquals'],
'@deepseek-ai/dsh-session-format': ['sessionFormatLogFilename'],
'@deepseek-ai/dsh-timeout': ['MAX_TIMER_DELAY_MS'],
'@deepseek-ai/schemastery': ['default'],
+63
View File
@@ -0,0 +1,63 @@
import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import * as yaml from 'js-yaml'
import { describe, expect, it } from 'vitest'
const workflow = yaml.load(readFileSync(resolve(import.meta.dirname, '../.github/workflows/build-preview-cloudflare.yml'), 'utf8')) as {
on: unknown
permissions: unknown
concurrency: unknown
env: Record<string, string>
jobs: Record<'preview', {
'runs-on': string
steps: Array<{ name?: string; uses?: string; run?: string; with?: Record<string, unknown>; env?: Record<string, string> }>
}>
}
const preview = workflow.jobs.preview
describe('PR preview workflow', () => {
it('keeps every PR author on the selected GitHub-hosted runner', () => {
expect(Object.keys(workflow.jobs)).toEqual(['preview'])
expect(preview['runs-on']).toBe('ubuntu-24.04')
expect(workflow.on).toEqual({ pull_request: { types: ['opened', 'synchronize', 'reopened'] } })
expect(workflow.permissions).toEqual({ contents: 'read', 'pull-requests': 'write' })
expect(preview.steps.find(step => step.uses === 'actions/checkout@v6')?.with).toEqual({ 'persist-credentials': false })
})
it('keeps the immutable full build and restore-only dependency cache', () => {
expect(workflow.env.PRIMARY_NODE_VERSION).toBe('24')
expect(workflow.env.DSH_TELEMETRY_DISABLED).toBe('1')
const commands = preview.steps.map(step => step.run)
expect(commands).toContain('pnpm install --frozen-lockfile')
expect(commands).toContain('pnpm run build')
expect(commands).toContain('pnpm --filter @deepseek-ai/dsh-web-frontend run build:preview')
expect(commands.indexOf('pnpm run build')).toBeLessThan(commands.indexOf('pnpm --filter @deepseek-ai/dsh-web-frontend run build:preview'))
expect(preview.steps.filter(step => step.uses?.startsWith('actions/cache'))).toHaveLength(1)
expect(preview.steps.find(step => step.uses === 'actions/cache/restore@v4')?.with).toMatchObject({
key: "${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}",
})
})
it('retains per-PR deployment, protected image verification, and idempotent URL comments', () => {
expect(workflow.concurrency).toEqual({
group: 'build-preview-cloudflare-${{ github.event.pull_request.number }}',
'cancel-in-progress': true,
})
expect(workflow.env.CF_PROJECT).toBe('dsh-build-preview')
const shape = preview.steps.find(step => step.name === 'Shape the upload')!
expect(shape.run).toContain("find apps/web/dist -name '*.map' -delete")
expect(shape.run).toContain('cp apps/web/dist/preview.html apps/web/dist/index.html')
const deploy = preview.steps.find(step => step.name === 'Upload to Cloudflare Pages')!
expect(deploy.run).toContain('npx --yes wrangler@4 pages deploy apps/web/dist')
expect(deploy.run).toContain('--branch "pr-${{ github.event.pull_request.number }}"')
const verify = preview.steps.find(step => step.name === 'Verify the protected deployment serves the image')!
expect(verify.run).toContain('/preview/vfs-image.tar.gz')
expect(verify.run).toContain('"$code" != "200"')
expect(verify.run).toContain('content-encoding:')
expect(verify.run).toContain('"$magic" != "1f8b"')
expect(verify.env?.CF_ACCESS_CLIENT_SECRET).toBe('${{ secrets.CF_ACCESS_CLIENT_SECRET }}')
const comment = preview.steps.find(step => step.name === 'Comment the preview URL')!
expect(comment.run).toContain('<!-- dsh-preview-url -->')
expect(comment.run).toContain('gh pr comment "$PR" --body-file -')
})
})
+3 -4
View File
@@ -103,10 +103,9 @@ async function publishTarball(
): Promise<void> {
const tagArgs = distTag === undefined ? [] : ['--tag', distTag]
for (let tries = 1; tries <= PUBLISH_ATTEMPTS; tries += 1) {
// No --access: the sequences do not share one access level, so a
// command-line flag could not serve both and would override the manifest
// that does. Each packed manifest decides, and
// check-workspace-constraints holds every manifest to its sequence's level.
// No --access: every release member declares its own publishConfig, and
// a command-line flag would override it. check-workspace-constraints
// requires a public access level on every release member.
const result = attemptEchoed('npm', ['publish', tarball, ...tagArgs])
const output = `${result.stdout}${result.stderr}`
if (result.status === 0) return
+1 -2
View File
@@ -3,8 +3,7 @@
* that rescope with `--reverse`. Every harness package declares `cordis` as a
* peer dependency, so publication carries this framework layer too; publishing
* it under the upstream names would squat them on the registry
* ([rationale](../.agents/notes/implemented/process/2026-08-10-vendor-package-rescope.md),
* [name mapping](../docs/rescope.md)).
* ([rationale and name mapping](../docs/rescope.md)).
*
* The generic pass rewrites ONLY delimited, complete package-name tokens:
* `'old'` / `"old"` / `` `old` `` / `'old/subpath'`, plus a YAML `name: old`
+1
View File
@@ -141,6 +141,7 @@ describe('gate graph validation', () => {
'ci-static',
'ci-lint-contracts-ready',
'ci-coverage',
'ci-bench',
'ci-snapshot',
'ci-artifacts',
'ci-consumers',
+6 -1
View File
@@ -27,6 +27,7 @@ export type Mode =
| 'ci-static'
| 'ci-lint-contracts-ready'
| 'ci-coverage'
| 'ci-bench'
| 'ci-snapshot'
| 'ci-artifacts'
| 'ci-consumers'
@@ -137,6 +138,7 @@ function parseMode(raw: string | undefined): Mode {
case 'ci-static':
case 'ci-lint-contracts-ready':
case 'ci-coverage':
case 'ci-bench':
case 'ci-snapshot':
case 'ci-artifacts':
case 'ci-consumers':
@@ -151,7 +153,7 @@ function parseMode(raw: string | undefined): Mode {
return raw
default:
throw new Error(
`run-gates: expected mode ci-primary | ci-linux-primary | ci-static | ci-lint-contracts-ready | ci-coverage | ci-snapshot | ci-artifacts | ci-consumers | ci-windows-blocking | ci-windows-complete | ci-windows-observational | node-compat | check-all | hygiene | doc-sync | doc-quick, got ${JSON.stringify(raw)}.`,
`run-gates: expected mode ci-primary | ci-linux-primary | ci-static | ci-lint-contracts-ready | ci-coverage | ci-bench | ci-snapshot | ci-artifacts | ci-consumers | ci-windows-blocking | ci-windows-complete | ci-windows-observational | node-compat | check-all | hygiene | doc-sync | doc-quick, got ${JSON.stringify(raw)}.`,
)
}
}
@@ -242,6 +244,8 @@ export function gatesForMode(selected: Mode): Gate[] {
]
case 'ci-coverage':
return coverageGates()
case 'ci-bench':
return [pnpmScript('bench', 'test:bench', { label: 'performance benchmarks' })]
case 'ci-snapshot':
return [ciBuildGate(), snapshotGate()]
case 'ci-artifacts':
@@ -787,6 +791,7 @@ function builtBinSmokeGate(needs: string[] = ['build']): Gate {
// unbuilt, so these files self-skip there.
'packages/workflow/workflow-worker-thread/tests/built-worker.e2e.ts',
'packages/code-runtime/code-runtime-worker-thread/tests/built-lib.e2e.ts',
'packages/session/session-persistence-jsonl/tests/built-migration-worker.e2e.ts',
'packages/lsp/lsp-stdio/tests/built-lib.e2e.ts',
], {
label: 'built-bin smoke',
+88 -6
View File
@@ -58,6 +58,51 @@ function validationHeader(value: unknown): unknown {
return header
}
function validationRow(source: Readonly<Record<string, unknown>>): Record<string, unknown> {
if (source.type !== 'request/header') return { ...source }
const data = source.data
if (data === null || typeof data !== 'object' || Array.isArray(data)) return { ...source }
const header = (data as Record<string, unknown>).header
if (header === null || typeof header !== 'object' || Array.isArray(header)) return { ...source }
if ((header as Record<string, unknown>).tools !== '{{tools}}') return { ...source }
return {
...source,
data: {
...data,
header: { ...header, tools: [] },
},
}
}
function restoreRequestHeaderTokens(
events: readonly SessionEvent[],
rows: readonly Readonly<Record<string, unknown>>[],
): SessionEvent[] {
const sources = rows.filter(row => row.type === 'request/header')
let sourceIndex = 0
return events.map((event) => {
if (event.type !== 'request/header') return event
const source = sources[sourceIndex]
sourceIndex += 1
const sourceData = source?.data
const sourceHeader = sourceData !== null && typeof sourceData === 'object' && !Array.isArray(sourceData)
? (sourceData as Record<string, unknown>).header
: undefined
if (sourceHeader === null || typeof sourceHeader !== 'object' || Array.isArray(sourceHeader)
|| (sourceHeader as Record<string, unknown>).tools !== '{{tools}}') return event
return {
...event,
data: {
...event.data,
header: {
...(event.data as unknown as { header: Record<string, unknown> }).header,
tools: '{{tools}}',
},
},
} as SessionEvent
})
}
function renderFixture(headerLine: string, events: readonly SessionEvent[]): string {
return [
headerLine,
@@ -95,6 +140,7 @@ function parseFixtureObjectLine(line: string, lineNumber: number): Record<string
function parseFixtureRows(content: string, headerValue: unknown): SessionEvent[] {
const rows: Record<string, unknown>[] = []
const rowLines: number[] = []
const eventLines: number[] = []
let nextSeq: SessionLogOffsetType = SessionLogOffset(0)
let headerSkipped = false
for (const [index, line] of content.split(/\r?\n/).entries()) {
@@ -113,7 +159,9 @@ function parseFixtureRows(content: string, headerValue: unknown): SessionEvent[]
if (!Object.hasOwn(record, timeKey)) record[timeKey] = 0
rows.push(record)
rowLines.push(index + 1)
nextSeq = SessionLogOffset(nextSeq + projectedRowCardinality(record))
const cardinality = projectedRowCardinality(record)
for (let offset = 0; offset < cardinality; offset += 1) eventLines.push(index + 1)
nextSeq = SessionLogOffset(nextSeq + cardinality)
}
// Versionless protocol fixtures and current projected snapshots use scalar
// event rows. Current snapshots may contain owner-restored scrub tokens such
@@ -143,18 +191,52 @@ function parseFixtureRows(content: string, headerValue: unknown): SessionEvent[]
}
})
}
let restore: ReturnType<typeof sessionFormatCatalog.createRestore>
try {
return [
...sessionFormatCatalog.decodeArtifact(validationHeader(headerValue), rows).events,
] as unknown as SessionEvent[]
restore = sessionFormatCatalog.createRestore(validationHeader(headerValue), {
recovery: 'strict',
validation: 'current',
})
} catch (error) {
const detail = error instanceof Error ? error.message : String(error)
const storedRow = /\brow (\d+)\b/.exec(detail)
const line = storedRow === null ? 1 : rowLines[Number(storedRow[1])] ?? 1
throw new Error(`session snapshot line 1: ${detail}`, { cause: error })
}
for (const [index, row] of rows.entries()) {
try {
restore.decodeRow(validationRow(row))
} catch (error) {
const detail = error instanceof Error ? error.message : String(error)
throw new Error(`session snapshot line ${rowLines[index] ?? 1}: ${detail}`, { cause: error })
}
}
try {
return restoreRequestHeaderTokens(
[...restore.finish().events] as unknown as SessionEvent[],
rows,
)
} catch (error) {
const detail = error instanceof Error ? error.message : String(error)
const line = fixtureDiagnosticLine(error, rowLines, eventLines)
throw new Error(`session snapshot line ${line}: ${detail}`, { cause: error })
}
}
function fixtureDiagnosticLine(
error: unknown,
rowLines: readonly number[],
eventLines: readonly number[],
): number {
const detail = error instanceof Error && error.cause instanceof Error
? error.cause.message
: error instanceof Error ? error.message : String(error)
const physicalRow = /^released Session row (\d+)/.exec(detail)
if (physicalRow !== null) return rowLines[Number(physicalRow[1])] ?? 1
const event = /Session event (\d+)/.exec(detail)
?? / at seq (\d+)/.exec(detail)
?? /inherited Session cut (\d+)/.exec(detail)
return event === null ? 1 : eventLines[Number(event[1])] ?? 1
}
function withoutEnvelope(events: readonly SessionEvent[]): Array<Omit<SessionEvent, 'seq' | 'time'>> {
return events.map((event) => {
const { seq: _seq, time: _time, ...projected } = event
+47 -2
View File
@@ -1227,6 +1227,7 @@ def smoke_sdk_profile_plugin(base_url: str) -> None:
if installed.returncode != 0:
raise AssertionError(
f"Python-installed dsh could not add the external profile plugin: "
f"returncode={installed.returncode} (0x{installed.returncode & 0xffffffff:08x}) "
f"stdout={installed.stdout!r} stderr={installed.stderr!r}"
)
manifest = json.loads((dsh_home / "profiles" / "sdk" / "package.json").read_text())
@@ -1269,13 +1270,20 @@ def smoke_sdk_snapshot(base_url: str, executable: Path, update_snapshots: bool)
dsh_home = root / "home"
sessions = dsh_home / "sessions"
patch = write_advanced_profile_patch(root, "snapshot.patch.yml", sessions)
feedback_patch = write_profile_patch(root, "feedback.patch.yml", sessions, [{"insert": [
{"id": "snapshot-message-feedback", "name": "@deepseek-ai/dsh-message-feedback",
"config": {"maxNoteBytes": 1024}},
{"id": "snapshot-feedback-producer", "name": (
Path(__file__).resolve().parent.parent / "snapshots/sdk/text-turn/feedback-producer.mjs"
).as_uri()},
]}])
with DeepSeekHarness(
provider="deepseek-official",
model="smoke-model",
cwd=str(root),
dsh_bin=str(executable),
dsh_home=str(dsh_home),
patches=(str(patch),),
patches=(str(patch), str(feedback_patch)),
env={
"DSH_PERMISSION_MODE": "danger-full-access",
"DSH_TELEMETRY_DISABLED": "1",
@@ -1287,6 +1295,10 @@ def smoke_sdk_snapshot(base_url: str, executable: Path, update_snapshots: bool)
result = harness.run(SNAPSHOT_PROMPT, session_id=SNAPSHOT_SESSION_ID)
assert result.final_response == SNAPSHOT_FINAL_TEXT, result.final_response
feedback_types = [event.get("type") for event in result.events
if str(event.get("type")).startswith("feedback/")]
if feedback_types != ["feedback/record", "feedback/message-put", "feedback/message-put", "feedback/message-delete"]:
raise AssertionError(f"advanced snapshot did not exercise all feedback mutations: {feedback_types}")
methods = [notification.method for notification in result.notifications]
if methods.count("subagent.started") != 2 or methods.count("subagent.finished") != 2:
raise AssertionError(f"advanced snapshot emitted unexpected subagent lifecycle: {methods}")
@@ -1725,6 +1737,30 @@ def build_snapshot_files(
replacements.append((child_id, f"{{{{child-{index}}}}}"))
agent_id = snapshot_agent_id(result, child_id)
replacements.append((agent_id, f"{{{{agent-{index}}}}}"))
command_index = 0
for record in logs[SNAPSHOT_SESSION_ID]:
data = record.get("data")
if record.get("type") == "command/run" and isinstance(data, dict):
command_index += 1
replacements.append((data["commandId"], f"{{{{command:{command_index}}}}}"))
if record.get("type") == "command/done" and isinstance(data, dict):
anonymous = re.search(r"Anonymous user: ([0-9a-f-]{36})", str(data.get("text")))
if anonymous is not None:
replacements.append((anonymous.group(1), "{{anonymous-user}}"))
feedback_targets = dict.fromkeys(
record["data"]["item"]["messageId"]
for record in logs[SNAPSHOT_SESSION_ID]
if record.get("type") == "feedback/message-put"
)
for index, message_id in enumerate(feedback_targets, start=1):
replacements.append((message_id, f"{{{{message:{index}}}}}"))
feedback_versions = dict.fromkeys(
record["data"]["item"]["version"]
for record in logs[SNAPSHOT_SESSION_ID]
if record.get("type") == "feedback/message-put"
)
for index, version in enumerate(feedback_versions, start=1):
replacements.append((version, f"{{{{feedback-version:{index}}}}}"))
replacements.sort(key=lambda pair: len(pair[0]), reverse=True)
result_value = {
@@ -1902,7 +1938,16 @@ def normalize_snapshot_value(
if isinstance(dt, list):
member["dt"] = [0] * len(dt)
if isinstance(normalized.get("id"), str) and normalized.get("role") in ("assistant", "user"):
normalized["id"] = "{{messageId}}"
if not normalized["id"].startswith("{{message:"):
normalized["id"] = "{{messageId}}"
if normalized.get("type") in ("feedback/message-put", "feedback/message-delete"):
data = normalized.get("data")
if isinstance(data, dict):
item = data.get("item") if normalized["type"] == "feedback/message-put" else data
if isinstance(item, dict):
if normalized["type"] == "feedback/message-put":
item["createdAt"] = 0
item["updatedAt"] = 0
scrub_snapshot_header(normalized)
return normalized
@@ -1335,7 +1335,7 @@
"provider": "deepseek-official",
"model": "smoke-model"
},
"id": "{{messageId}}"
"id": "{{message:1}}"
},
"usage": {
"inputTokens": 3,
@@ -1409,9 +1409,80 @@
}
},
{
"type": "turn/end",
"type": "command/run",
"seq": 59,
"time": 0,
"data": {
"commandId": "{{command:1}}",
"name": "feedback",
"source": {
"kind": "user"
}
}
},
{
"type": "feedback/record",
"seq": 60,
"time": 0,
"data": {
"text": "The session needs a clearer explanation."
}
},
{
"type": "command/done",
"seq": 61,
"time": 0,
"data": {
"commandId": "{{command:1}}",
"kind": "success",
"text": "Feedback recorded for session {{parent}}\nAnonymous user: {{anonymous-user}}."
}
},
{
"type": "feedback/message-put",
"seq": 62,
"time": 0,
"data": {
"sessionId": "{{parent}}",
"item": {
"messageId": "{{message:1}}",
"rating": "negative",
"note": "Explain the result.",
"version": "{{feedback-version:1}}",
"createdAt": 0,
"updatedAt": 0
}
}
},
{
"type": "feedback/message-put",
"seq": 63,
"time": 0,
"data": {
"sessionId": "{{parent}}",
"item": {
"messageId": "{{message:1}}",
"rating": "positive",
"note": "The explanation is clear now.",
"version": "{{feedback-version:2}}",
"createdAt": 0,
"updatedAt": 0
}
}
},
{
"type": "feedback/message-delete",
"seq": 64,
"time": 0,
"data": {
"sessionId": "{{parent}}",
"messageId": "{{message:1}}"
}
},
{
"type": "turn/end",
"seq": 65,
"time": 0,
"data": {
"turn": 1,
"reason": {
@@ -3942,7 +4013,7 @@
"provider": "deepseek-official",
"model": "smoke-model"
},
"id": "{{messageId}}"
"id": "{{message:1}}"
},
"usage": {
"inputTokens": 3,
@@ -4028,9 +4099,116 @@
"payload": {
"sessionId": "{{parent}}",
"event": {
"type": "turn/end",
"type": "command/run",
"seq": 59,
"time": 0,
"data": {
"commandId": "{{command:1}}",
"name": "feedback",
"source": {
"kind": "user"
}
}
}
}
},
{
"method": "session.event",
"payload": {
"sessionId": "{{parent}}",
"event": {
"type": "feedback/record",
"seq": 60,
"time": 0,
"data": {
"text": "The session needs a clearer explanation."
}
}
}
},
{
"method": "session.event",
"payload": {
"sessionId": "{{parent}}",
"event": {
"type": "command/done",
"seq": 61,
"time": 0,
"data": {
"commandId": "{{command:1}}",
"kind": "success",
"text": "Feedback recorded for session {{parent}}\nAnonymous user: {{anonymous-user}}."
}
}
}
},
{
"method": "session.event",
"payload": {
"sessionId": "{{parent}}",
"event": {
"type": "feedback/message-put",
"seq": 62,
"time": 0,
"data": {
"sessionId": "{{parent}}",
"item": {
"messageId": "{{message:1}}",
"rating": "negative",
"note": "Explain the result.",
"version": "{{feedback-version:1}}",
"createdAt": 0,
"updatedAt": 0
}
}
}
}
},
{
"method": "session.event",
"payload": {
"sessionId": "{{parent}}",
"event": {
"type": "feedback/message-put",
"seq": 63,
"time": 0,
"data": {
"sessionId": "{{parent}}",
"item": {
"messageId": "{{message:1}}",
"rating": "positive",
"note": "The explanation is clear now.",
"version": "{{feedback-version:2}}",
"createdAt": 0,
"updatedAt": 0
}
}
}
}
},
{
"method": "session.event",
"payload": {
"sessionId": "{{parent}}",
"event": {
"type": "feedback/message-delete",
"seq": 64,
"time": 0,
"data": {
"sessionId": "{{parent}}",
"messageId": "{{message:1}}"
}
}
}
},
{
"method": "session.event",
"payload": {
"sessionId": "{{parent}}",
"event": {
"type": "turn/end",
"seq": 65,
"time": 0,
"data": {
"turn": 1,
"reason": {
@@ -56,6 +56,12 @@
{"type":"step/start","data":{"turn":1,"step":7}}
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","maxTokens":256000,"reasoningEffort":"high"},"adapterDefaults":{"reasoningEffort":true,"maxTokens":true},"system":"{{system}}","tools":["cordis_define","cordis_inspect_list","cordis_inspect_query","cordis_inspect_self","cordis_run","cordis_stop","cordis_undefine","job_kill","job_list","job_output","run_code","subagent","workflow"]},"reason":"change"}}
{"type":"session-log-deepseek/delivery-accepted","data":{"sessionId":"{{parent}}","sessionFormatVersion":2,"throughSeq":55}}
{"type":"assistant/message","data":{"turn":1,"step":7,"message":{"role":"assistant","content":[{"type":"text","text":"ADVANCED_EXECUTABLE_OK"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model"},"id":"{{messageId}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":0,"dt":[],"texts":["ADVANCED_EXECUTABLE_OK"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"ADVANCED_EXECUTABLE_OK"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"}
{"type":"assistant/message","data":{"turn":1,"step":7,"message":{"role":"assistant","content":[{"type":"text","text":"ADVANCED_EXECUTABLE_OK"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model"},"id":"{{message:1}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":0,"dt":[],"texts":["ADVANCED_EXECUTABLE_OK"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"ADVANCED_EXECUTABLE_OK"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"}
{"type":"step/end","data":{"turn":1,"step":7}}
{"type":"command/run","data":{"commandId":"{{command:1}}","name":"feedback","source":{"kind":"user"}}}
{"type":"feedback/record","data":{"text":"The session needs a clearer explanation."}}
{"type":"command/done","data":{"commandId":"{{command:1}}","kind":"success","text":"Feedback recorded for session {{parent}}\nAnonymous user: {{anonymous-user}}."}}
{"type":"feedback/message-put","data":{"sessionId":"{{parent}}","item":{"messageId":"{{message:1}}","rating":"negative","note":"Explain the result.","version":"{{feedback-version:1}}","createdAt":0,"updatedAt":0}}}
{"type":"feedback/message-put","data":{"sessionId":"{{parent}}","item":{"messageId":"{{message:1}}","rating":"positive","note":"The explanation is clear now.","version":"{{feedback-version:2}}","createdAt":0,"updatedAt":0}}}
{"type":"feedback/message-delete","data":{"sessionId":"{{parent}}","messageId":"{{message:1}}"}}
{"type":"turn/end","data":{"turn":1,"reason":{"kind":"completed"}}}
+2 -1
View File
@@ -33,7 +33,8 @@ describe('ambient proxy environment', () => {
it('finds the configurations that declare a setup at all', () => {
// Guards the discovery itself: a glob that stopped matching would make every case below vacuous.
expect(declared.map(entry => entry.config)).toEqual([
'vitest.config.ts', 'vitest.e2e.config.ts', 'vitest.expected.config.ts', 'vitest.snapshot.config.ts',
'vitest.bench.config.ts', 'vitest.config.ts', 'vitest.e2e.config.ts', 'vitest.expected.config.ts',
'vitest.snapshot.config.ts',
])
})
+150
View File
@@ -0,0 +1,150 @@
/** Release rehearsal routing and persistent-runner isolation, without executing release builds. */
import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { runInNewContext } from 'node:vm'
import { load } from 'js-yaml'
import { describe, expect, it } from 'vitest'
const root = resolve(import.meta.dirname, '../..')
const repository = 'deepseek-harness/deepseek-harness'
const selfhosted = ['self-hosted', 'linux', 'x64', 'vm-backup']
const hosted = 'ubuntu-24.04'
interface Step {
name?: string
uses?: string
run?: string
if?: string
with?: Record<string, unknown>
}
interface Workflow {
on: Record<string, unknown>
permissions: Record<string, string>
concurrency?: Record<string, unknown>
jobs: Record<string, { name: string; 'runs-on': string; steps: Step[] }>
}
function workflow(file: string): Workflow {
return load(readFileSync(resolve(root, '.github/workflows', file), 'utf8')) as Workflow
}
// This canonical-case corpus has matching Actions/JavaScript comparison results.
// This is not an Actions interpreter: string case-folding and general coercion differ.
// Missing context properties use the Actions empty-string value.
function evaluate(expression: string, context: Record<string, string | boolean>): unknown {
const source = expression.trim().replace(/^\$\{\{|\}\}$/g, '')
.replace(/\b(?:github|vars|runner)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+/g,
key => JSON.stringify(context[key] ?? ''))
return runInNewContext(source, { fromJSON: JSON.parse }, { timeout: 1000 }) as unknown
}
const trustedPr = {
'vars.DSH_CI_FAILOVER_LINUX': 'selfhosted',
'github.repository': repository,
'github.actor': 'maintainer',
'github.event_name': 'pull_request',
'github.ref': 'refs/pull/42/merge',
'github.event.pull_request.head.repo.full_name': repository,
'github.event.pull_request.head.repo.fork': false,
'github.event.pull_request.user.login': 'contributor',
}
const trustedPush = {
'vars.DSH_CI_FAILOVER_LINUX': 'selfhosted',
'github.repository': repository,
'github.actor': 'maintainer',
'github.event_name': 'push',
'github.ref': 'refs/heads/master',
}
const fallbackCases: Array<[string, Record<string, string | boolean>]> = [
['unset switch', { ...trustedPr, 'vars.DSH_CI_FAILOVER_LINUX': '' }],
['hosted switch', { ...trustedPr, 'vars.DSH_CI_FAILOVER_LINUX': 'hosted' }],
['unknown switch', { ...trustedPr, 'vars.DSH_CI_FAILOVER_LINUX': 'true' }],
['fork PR', { ...trustedPr, 'github.event.pull_request.head.repo.full_name': 'outsider/fork', 'github.event.pull_request.head.repo.fork': true }],
['different head repository', { ...trustedPr, 'github.event.pull_request.head.repo.full_name': 'outsider/repo' }],
['fork flag', { ...trustedPr, 'github.event.pull_request.head.repo.fork': true }],
['Dependabot author rerun by maintainer', { ...trustedPr, 'github.event.pull_request.user.login': 'dependabot[bot]' }],
['Dependabot PR actor', { ...trustedPr, 'github.actor': 'dependabot[bot]' }],
['Dependabot push actor', { ...trustedPush, 'github.actor': 'dependabot[bot]' }],
['non-master push', { ...trustedPush, 'github.ref': 'refs/heads/topic' }],
['tag push', { ...trustedPush, 'github.ref': 'refs/tags/dsh-v1.0.0' }],
['push in another repository', { ...trustedPush, 'github.repository': 'outsider/fork' }],
['dispatch on master', { ...trustedPush, 'github.event_name': 'workflow_dispatch' }],
['dispatch on topic', { ...trustedPush, 'github.event_name': 'workflow_dispatch', 'github.ref': 'refs/heads/topic' }],
['dispatch on tag', { ...trustedPush, 'github.event_name': 'workflow_dispatch', 'github.ref': 'refs/tags/dsh-v1.0.0' }],
['pull_request_target', { ...trustedPr, 'github.event_name': 'pull_request_target' }],
['missing PR payload', { ...trustedPush, 'github.event_name': 'pull_request' }],
]
for (const [file, jobIds] of [['release.yml', ['dependencies', 'pack']], ['release-vendor.yml', ['pack']]] as const) {
describe(file, () => {
const release = workflow(file)
it('preserves the logical jobs, rehearsal events and read-only permission', () => {
expect(Object.keys(release.jobs)).toEqual(jobIds)
expect(release.on).toEqual({ pull_request: null, push: { branches: ['master'] }, workflow_dispatch: null })
expect(release.permissions).toEqual({ contents: 'read' })
expect(release.concurrency).toEqual({ group: '${{ github.workflow }}-${{ github.ref }}', 'cancel-in-progress': false })
})
for (const jobId of jobIds) {
describe(jobId, () => {
const job = release.jobs[jobId]!
it('routes trusted PRs and master pushes onto the existing Linux pool', () => {
expect(evaluate(job['runs-on'], trustedPr)).toEqual(selfhosted)
expect(evaluate(job['runs-on'], trustedPush)).toEqual(selfhosted)
expect(evaluate(job['runs-on'], { ...trustedPush, 'vars.DSH_CI_FAILOVER_LINUX': '' })).toBe(hosted)
})
it.each(fallbackCases)('keeps %s hosted', (_name, context) => {
expect(evaluate(job['runs-on'], context)).toBe(hosted)
})
it('cleans stale checkout output and isolates setup before any pnpm invocation', () => {
expect(job.steps[0]).toMatchObject({ uses: 'actions/checkout@v6', with: { clean: true, 'persist-credentials': false } })
const cacheIndex = job.steps.findIndex(step => step.run?.includes('NODE_COMPILE_CACHE='))
const pnpmIndex = job.steps.findIndex(step => step.uses?.startsWith('pnpm/') || /\bpnpm\b/.test(step.run ?? ''))
expect(cacheIndex).toBeGreaterThan(0)
expect(cacheIndex).toBeLessThan(pnpmIndex)
expect(job.steps[cacheIndex]?.run).toContain('echo "NODE_COMPILE_CACHE=${{ runner.temp }}/node-compile-cache" >> "$GITHUB_ENV"')
expect(job.steps[cacheIndex]?.run).toContain('echo "npm_config_devdir=${{ runner.temp }}/node-gyp" >> "$GITHUB_ENV"')
expect(job.steps[cacheIndex]?.run).toContain('echo "TMPDIR=${{ runner.temp }}" >> "$GITHUB_ENV"')
expect(job.steps.find(step => step.uses === 'pnpm/action-setup@v4')?.with?.dest)
.toBe('${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}')
expect(job.steps.find(step => step.name === 'Install (immutable)')?.run).toBe('pnpm install --frozen-lockfile')
})
it('uses the persistent store without remote cache reads or writes on self-hosted', () => {
expect(job.steps.find(step => step.name === 'Configure pnpm store path')?.run).toContain('store_root="$HOME/.local/share/pnpm/store"')
const caches = job.steps.filter(step => step.uses?.startsWith('actions/cache'))
expect(caches.map(step => step.uses)).toEqual(['actions/cache/restore@v4'])
for (const step of caches) {
expect(evaluate(step.if!, { 'runner.environment': 'self-hosted' })).toBe(false)
expect(evaluate(step.if!, { 'runner.environment': 'github-hosted' })).toBe(true)
}
const nodeSetup = job.steps.find(step => step.uses === 'actions/setup-node@v6')
expect(nodeSetup?.with?.cache).toBeUndefined()
expect(nodeSetup?.with?.['package-manager-cache']).toBe(false)
})
it('retains the dependency and pack verification commands', () => {
const commands = job.steps.flatMap(step => step.run === undefined ? [] : [step.run])
if (jobId === 'dependencies') {
expect(commands).toContain('pnpm run verify-package-dependencies')
expect(commands).toContain('pnpm run verify-npm-install-layout')
} else {
const family = file === 'release.yml' ? 'dsh' : 'vendor'
const output = family === 'dsh' ? 'dist/npm' : 'dist/npm-vendor'
expect(job.steps[0]?.with?.['fetch-depth']).toBe(0)
expect(commands).toContain('pnpm run release:verify --family ' + family)
expect(commands).toContain('pnpm run ' + (family === 'dsh' ? 'build:official' : 'build:lib:host'))
expect(commands).toContain('pnpm run release:pack --family ' + family + ' --out ' + output + ' --concurrency 8')
expect(commands).toContain('pnpm run release:verify-packed-install --family ' + family + ' --from ' + output
+ (family === 'dsh' ? ' --from dist/npm-vendor --from dist/npm-landlock' : ''))
expect(job.steps.at(-1)).toMatchObject({ uses: 'actions/upload-artifact@v4', with: { path: output + '/*', 'retention-days': 7 } })
}
expect(JSON.stringify(job)).not.toMatch(/secrets\.|release:publish|npm-publish/)
})
})
}
})
}
it.each(['release-publish.yml', 'release-vendor-publish.yml'])('keeps %s manual and entirely hosted', (file) => {
const publish = workflow(file)
expect(publish.on).toEqual({ workflow_dispatch: null })
for (const job of Object.values(publish.jobs)) expect(job['runs-on']).toBe(hosted)
})
+1 -1
View File
@@ -268,7 +268,7 @@ function expectMergedPair(fixture: Fixture): void {
// yielding to it, so a smaller one here lowers what the lane grants every case
// in this file, none of which carries an allowance of its own. Measurements and
// the rejected alternatives are in
// .agents/notes/implemented/testing/2026-08-27-translation-pairing-merge-budget.md.
// .agents/notes/archived/testing/2026-08-27-translation-pairing-merge-budget.md.
describe('translation pairing merge composition', { timeout: 90_000 }, () => {
it('rejects a pairing-record path outside the repository', () => {
const fixture = createFixture(false)
+30
View File
@@ -545,6 +545,11 @@
"source": "packages/core/session/src/index.ts",
"projection": "public-api"
},
{
"doc": "docs/subsystems/persistence.md",
"symbol": "SessionHandleReadResult",
"source": "packages/session/session-persistence/src/handle.ts"
},
{
"doc": "docs/subsystems/persistence.md",
"symbol": "SessionHandle",
@@ -560,6 +565,11 @@
"symbol": "CreateSessionOptions",
"source": "packages/core/session/src/types.ts"
},
{
"doc": "docs/subsystems/persistence.md",
"symbol": "SessionSeedEventState",
"source": "packages/core/session/src/types.ts"
},
{
"doc": "docs/subsystems/persistence.md",
"symbol": "RestoredSessionOptions",
@@ -1851,6 +1861,16 @@
"symbol": "ClientArtifactBaseline",
"source": "packages/client/modules/src/index.ts"
},
{
"doc": "docs/subsystems/session-telemetry.md",
"symbol": "SessionTelemetryCapture",
"source": "packages/session/session-telemetry/src/coordinator.ts"
},
{
"doc": "docs/subsystems/session-telemetry.md",
"symbol": "SessionTelemetryCaptureOptions",
"source": "packages/session/session-telemetry/src/coordinator.ts"
},
{
"doc": "docs/subsystems/session-telemetry.md",
"symbol": "SessionTelemetrySharingStatus",
@@ -1991,6 +2011,16 @@
"symbol": "MessageFeedbackItem",
"source": "packages/feedback/message-feedback/src/types.ts"
},
{
"doc": "docs/subsystems/feedback.md",
"symbol": "MessageFeedbackPut",
"source": "packages/feedback/message-feedback/src/types.ts"
},
{
"doc": "docs/subsystems/feedback.md",
"symbol": "MessageFeedbackDelete",
"source": "packages/feedback/message-feedback/src/types.ts"
},
{
"doc": "docs/subsystems/feedback.md",
"symbol": "MessageFeedbackListRequest",
+2 -1
View File
@@ -2,7 +2,8 @@
* Doc-sync gate for the canonical package-README limitations section. It scans
* package manifests, rejects missing or variant sections, and requires one
* top-level bullet; audited packages in {@link NO_LIMITATIONS} must omit it.
* See the [limitations Agent Note](../.agents/notes/implemented/process/2026-07-10-readme-known-limitations-gate.md).
* The archived [limitations gate record](../.agents/notes/archived/process/2026-07-10-readme-known-limitations-gate.md)
* documents the original decision.
*/
import { existsSync, globSync, readFileSync } from 'node:fs'
@@ -58,6 +58,7 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
'packages/client/ui-agent-preset': { kind: 'indirect', reason: 'Browser-side settings row; the preset it selects owns every model-facing effect.' },
'packages/util/crypto': { kind: 'indirect', reason: 'Pure identifier minting; the ids consumers mint with it never enter prompts as semantic content.' },
'packages/util/deque': { kind: 'none', reason: 'In-process collection primitive; registers nothing model-facing.' },
'packages/util/package-manifest': { kind: 'none', reason: 'Type declarations only; registers nothing model-facing.' },
'packages/util/time': { kind: 'indirect', reason: 'Pure zone validation; the consumer that records a canonical zone owns the model-visible line derived from it.' },
'packages/core/agent-default-model': { kind: 'indirect', reason: 'The service supplies a ModelSelection; request assembly and adapters own the model-visible request.' },
'packages/llm/deepseek-llm-api-extensions': { kind: 'indirect', reason: 'The registry contributes model-hidden provider fields; dsh-llm-deepseek owns their wire placement.' },
@@ -89,7 +90,7 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
'packages/client/ui-conversation': { kind: 'none', reason: 'Browser-side UI plugin layer; registers nothing model-facing.' },
'packages/client/ui-approval': { kind: 'none', reason: 'Browser-side approval presentation; registers nothing model-facing.' },
'packages/client/ui-chat': { kind: 'none', reason: 'Browser-side Chat presentation; registers nothing model-facing.' },
'packages/client/ui-message-feedback': { kind: 'none', reason: 'Browser-side controls over the message-feedback sidecar; ratings and notes never enter the Session log, model context, or telemetry.' },
'packages/client/ui-message-feedback': { kind: 'none', reason: 'Browser-side controls over log-only message feedback; ratings and notes never enter model context or change model-input tokens.' },
'packages/client/ui-tool': { kind: 'none', reason: 'Browser-side Tool presentation layer; renders logged calls without changing model context.' },
'packages/client/ui-schedule': { kind: 'none', reason: 'Browser-side read-only projection of active Schedule records; dsh-schedule owns the model-facing tools and delivery.' },
'packages/client/ui-workflow-run': { kind: 'none', reason: 'Browser-side UI plugin layer; renders durable workflow records without changing model context.' },