Merge remote-tracking branch 'origin/worktree/composer-host-confirmed-echo' into worktree/forge-change-request-bindings
The parent branch now carries master through #6426. - The root manifest keeps the forge packages and master's action cards. - The event matrix and the experimental persistence catalog are regenerated, and the capability-seams and experimental README pairings are recorded again.
This commit is contained in:
commit
69e7682b6f
2982 files changed
+58746
-6184
No files matched your search
@@ -20,7 +20,8 @@ import {
|
||||
import { hasTypertRemoteNavigation, isForbiddenPublicationFile } from './publication-payload.ts'
|
||||
import type { DshBundleManifest } from '../packages/util/package-manifest/src/types.ts'
|
||||
import { detailPath } from '../packages/util/plugin-detail/src/document.ts'
|
||||
import { OPTIONAL_BUNDLES, bundlePatchFiles } from '../packages/boot/app-boot/src/profile.ts'
|
||||
import { bundlePatchFiles } from '../packages/boot/app-boot/src/profile.ts'
|
||||
import { OPTIONAL_BUNDLES } from '../packages/util/official-bundles/src/bundles.ts'
|
||||
import {
|
||||
PACKAGE_ASSET_EXPORT,
|
||||
PACKAGE_ASSET_EXPORT_TARGET,
|
||||
@@ -216,6 +217,10 @@ const packageFileExtras: Readonly<Record<string, readonly string[]>> = {
|
||||
'@deepseek-ai/dsh-experimental-inspector': ['lib/client.*.js', 'lib/worker.js', 'lib/devtools/**'],
|
||||
// Creator's composition guidance travels with the declaration package.
|
||||
'@deepseek-ai/dsh-agent-preset': ['skills'],
|
||||
// Personalized pages ship the location guidance used by their Creator.
|
||||
'@deepseek-ai/dsh-creation-recommendations': ['references/*.md', 'skills/*.md'],
|
||||
// Official-plugin recommendations ship the skill text their provider loads.
|
||||
'@deepseek-ai/dsh-plugin-recommendations': ['skills/*.md'],
|
||||
// The Web Host mounts the default-off settings owner independently of the
|
||||
// delegation-tool instances.
|
||||
'@deepseek-ai/dsh-tool-subagent': ['lib/model-selection-settings.js'],
|
||||
|
||||
@@ -25,7 +25,11 @@ interface CompatibilityJob {
|
||||
}
|
||||
|
||||
const workflow = yaml.load(readFileSync(resolve(import.meta.dirname, '../.github/workflows/ci.yml'), 'utf8')) as {
|
||||
jobs: { 'node-compat': CompatibilityJob; 'python-sdk': { 'runs-on': string } }
|
||||
jobs: { 'node-compat': CompatibilityJob }
|
||||
}
|
||||
// Python keeps its own required verdict in ci-python.yml.
|
||||
const pythonWorkflow = yaml.load(readFileSync(resolve(import.meta.dirname, '../.github/workflows/ci-python.yml'), 'utf8')) as {
|
||||
jobs: { 'python-sdk': { 'runs-on': string } }
|
||||
}
|
||||
const job = workflow.jobs['node-compat']
|
||||
const labels = ['self-hosted', 'linux', 'x64', 'vm-backup']
|
||||
@@ -86,7 +90,7 @@ describe('Node compatibility self-hosted routing', () => {
|
||||
expect(job.env.DSH_GATE_CONCURRENCY).toBe('${{ matrix.gate_concurrency }}')
|
||||
expect(job.steps.map(step => step.run)).toContain('pnpm run check:node-compat')
|
||||
expect(job.steps.map(step => step.run)).toContain('pnpm exec vitest run packages/boot/app-boot/tests/loader-shape.compat.spec.ts')
|
||||
expect(workflow.jobs['python-sdk']['runs-on']).toBe('ubuntu-latest')
|
||||
expect(pythonWorkflow.jobs['python-sdk']['runs-on']).toBe('ubuntu-latest')
|
||||
})
|
||||
|
||||
it('isolates version installs and enables hosted package caching only on hosted runners', () => {
|
||||
|
||||
+142
-47
@@ -14,12 +14,18 @@ const runnerPrivatePnpmDestination = /^\$\{\{ runner\.temp \}\}\/setup-pnpm-\$\{
|
||||
const nativeWindowsPnpmDestination = '${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}'
|
||||
|
||||
describe('CI workflow', () => {
|
||||
it('keeps at most ten worker jobs active while runtime targets follow the SDK suite', () => {
|
||||
it('keeps at most ten worker jobs active across PR workflows while Python runtime targets follow the SDK suite', () => {
|
||||
const ci = loadWorkflow('.github/workflows/ci.yml')
|
||||
const ciWindows = loadWorkflow('.github/workflows/ci-windows.yml')
|
||||
const ciPython = loadWorkflow('.github/workflows/ci-python.yml')
|
||||
const compatibility = workflowJob(ci, 'node-compat')
|
||||
const runtime = workflowJob(ci, 'python-runtime')
|
||||
if (!isRecord(ci.jobs) || !isRecord(compatibility.strategy) || !isRecord(runtime.with)) {
|
||||
throw new TypeError('CI must define jobs, compatibility scheduling, and runtime inputs')
|
||||
const runtime = workflowJob(ciPython, 'python-runtime')
|
||||
if (!isRecord(ci.jobs)
|
||||
|| !isRecord(ciWindows.jobs)
|
||||
|| !isRecord(ciPython.jobs)
|
||||
|| !isRecord(compatibility.strategy)
|
||||
|| !isRecord(runtime.with)) {
|
||||
throw new TypeError('CI, CI Windows, and CI Python must define jobs, compatibility scheduling, and runtime inputs')
|
||||
}
|
||||
const compatibilityLimit = compatibility.strategy['max-parallel']
|
||||
const targets = runtime.with.targets
|
||||
@@ -34,17 +40,31 @@ describe('CI workflow', () => {
|
||||
})
|
||||
expect(workflowJob(ci, 'all-checks-passed').needs).toContain('node-compat')
|
||||
const ordinaryJobs = Object.entries(ci.jobs)
|
||||
.filter(([name]) => !['node-compat', 'python-runtime', 'all-checks-passed'].includes(name))
|
||||
.filter(([name]) => !['node-compat', 'all-checks-passed'].includes(name))
|
||||
for (const [name, job] of ordinaryJobs) {
|
||||
if (!isRecord(job)) throw new TypeError(`${name} must define a job`)
|
||||
expect(job).not.toHaveProperty('strategy')
|
||||
expect(job).not.toHaveProperty('uses')
|
||||
}
|
||||
expect(ordinaryJobs.map(([name]) => name)).toContain('python-sdk')
|
||||
// Python reports its own required verdict, so neither its jobs nor a
|
||||
// reusable workflow caller remain in the Linux or Windows workflow.
|
||||
expect(Object.keys(ci.jobs).filter(name => name.startsWith('python'))).toEqual([])
|
||||
expect(Object.keys(ciWindows.jobs)).not.toContain('python-runtime')
|
||||
|
||||
const pythonSdk = workflowJob(ciPython, 'python-sdk')
|
||||
expect(pythonSdk).not.toHaveProperty('strategy')
|
||||
expect(pythonSdk).not.toHaveProperty('uses')
|
||||
expect(runtime.needs).toBe('python-sdk')
|
||||
expect(runtime.strategy).toBeUndefined()
|
||||
expect(runtime.with).toMatchObject({ targets: 'node24-linux-x64,node24-win-x64' })
|
||||
expect(runtime.uses).toBe('./.github/workflows/build-exe-for-python-sdk.yml')
|
||||
const windowsJobs = Object.entries(ciWindows.jobs)
|
||||
.filter(([name]) => name !== 'windows-checks-passed')
|
||||
for (const [name, job] of windowsJobs) {
|
||||
if (!isRecord(job)) throw new TypeError(`${name} must define a job`)
|
||||
expect(job).not.toHaveProperty('strategy')
|
||||
expect(job).not.toHaveProperty('uses')
|
||||
}
|
||||
|
||||
const builder = loadWorkflow('.github/workflows/build-exe-for-python-sdk.yml')
|
||||
if (!isRecord(builder.jobs)) throw new TypeError('Python runtime builder must define jobs')
|
||||
@@ -63,19 +83,54 @@ describe('CI workflow', () => {
|
||||
if (!isRecord(build.strategy)) throw new TypeError('Python runtime build must define its target matrix')
|
||||
expect(build.strategy.matrix).toEqual({ include: '${{ fromJSON(needs.plan.outputs.matrix) }}' })
|
||||
|
||||
const beforeSdk = ordinaryJobs.length + compatibilityLimit
|
||||
const afterSdk = ordinaryJobs.length - 1 + compatibilityLimit + Math.max(1, targets.split(',').length)
|
||||
// Python's runtime targets start only after the SDK suite; Windows starts
|
||||
// immediately. Plan and wheel stages precede the two-target matrix.
|
||||
const windowsActive = windowsJobs.length
|
||||
const beforeSdk = ordinaryJobs.length + compatibilityLimit + windowsActive + 1
|
||||
const afterSdk = ordinaryJobs.length + compatibilityLimit + windowsActive + Math.max(1, targets.split(',').length)
|
||||
expect(beforeSdk).toBeLessThanOrEqual(10)
|
||||
expect(afterSdk).toBeLessThanOrEqual(10)
|
||||
})
|
||||
|
||||
it('keeps the union of required PR verdicts equal to the pre-split blocking set', () => {
|
||||
const verdicts = [
|
||||
['ci.yml', 'all-checks-passed'],
|
||||
['ci-windows.yml', 'windows-checks-passed'],
|
||||
['ci-python.yml', 'python-checks-passed'],
|
||||
] as const
|
||||
const blocking: string[] = []
|
||||
for (const [file, name] of verdicts) {
|
||||
const workflow = loadWorkflow('.github/workflows/' + file)
|
||||
const verdict = workflowJob(workflow, name)
|
||||
if (!isRecord(workflow.jobs) || !Array.isArray(verdict.needs)) {
|
||||
throw new TypeError(`${file} must define jobs and the ${name} verdict needs`)
|
||||
}
|
||||
const jobs = workflow.jobs
|
||||
expect(verdict.needs.every(id => typeof id === 'string' && id in jobs)).toBe(true)
|
||||
blocking.push(...(verdict.needs as string[]))
|
||||
}
|
||||
// Splitting the workflows only moves jobs between verdicts; the blocking
|
||||
// set itself must stay identical, or branch protection would accept a
|
||||
// failure it rejected before the split.
|
||||
expect(blocking.sort()).toEqual([
|
||||
'node-24',
|
||||
'node-24-bench',
|
||||
'node-24-consumers',
|
||||
'node-24-coverage',
|
||||
'node-compat',
|
||||
'python-runtime',
|
||||
'python-sdk',
|
||||
'windows-build',
|
||||
'windows-native-tests',
|
||||
])
|
||||
})
|
||||
|
||||
it('retains aggregate diagnostics in required builds and protected publication', () => {
|
||||
const ci = loadWorkflow('.github/workflows/ci.yml')
|
||||
for (const [name, command] of [
|
||||
['node-24-consumers', 'pnpm run check:ci:consumers'],
|
||||
['windows-build', 'pnpm run check:ci:windows-blocking'],
|
||||
for (const [file, name, command] of [
|
||||
['ci.yml', 'node-24-consumers', 'pnpm run check:ci:consumers'],
|
||||
['ci-windows.yml', 'windows-build', 'pnpm run check:ci:windows-blocking'],
|
||||
] as const) {
|
||||
const job = workflowJob(ci, name)
|
||||
const job = workflowJob(loadWorkflow('.github/workflows/' + file), name)
|
||||
expect(job.steps).toContainEqual(expect.objectContaining({ run: command }))
|
||||
}
|
||||
for (const [file, command] of [
|
||||
@@ -182,7 +237,7 @@ describe('CI workflow', () => {
|
||||
})
|
||||
|
||||
it('skips coverage-history uploads on cancellation but retains Wine cleanup', () => {
|
||||
const coverage = workflowJob(loadWorkflow('.github/workflows/ci.yml'), 'windows-coverage')
|
||||
const coverage = workflowJob(loadWorkflow('.github/workflows/ci-windows.yml'), 'windows-coverage')
|
||||
const wine = workflowJob(loadWorkflow('.github/workflows/ci-master.yml'), 'windows')
|
||||
expect(coverage.steps).toContainEqual(expect.objectContaining({
|
||||
name: 'Save coverage duration history', if: '${{ !cancelled() }}',
|
||||
@@ -191,10 +246,10 @@ describe('CI workflow', () => {
|
||||
})
|
||||
|
||||
it.each([
|
||||
['node-24-coverage', 'Linux', 'LINUX', 'pnpm run check:ci:coverage'],
|
||||
['windows-coverage', 'Windows', 'WINDOWS', 'pnpm run check:ci:coverage'],
|
||||
])('reuses %s coverage timings only within its platform and runner pool', (jobName, platform, variable, command) => {
|
||||
const job = workflowJob(loadWorkflow('.github/workflows/ci.yml'), jobName)
|
||||
['node-24-coverage', 'ci.yml', 'Linux', 'LINUX', 'pnpm run check:ci:coverage'],
|
||||
['windows-coverage', 'ci-windows.yml', 'Windows', 'WINDOWS', 'pnpm run check:ci:coverage'],
|
||||
])('reuses %s coverage timings only within its platform and runner pool', (jobName, file, platform, variable, command) => {
|
||||
const job = workflowJob(loadWorkflow('.github/workflows/' + file), jobName)
|
||||
if (!Array.isArray(job.steps)) throw new TypeError(`${jobName} must define steps`)
|
||||
const steps = job.steps.filter(isRecord)
|
||||
const checkout = steps.findIndex(step => step.uses === 'actions/[email protected]')
|
||||
@@ -219,7 +274,7 @@ describe('CI workflow', () => {
|
||||
})
|
||||
|
||||
it('isolates every pnpm action setup destination per runner', () => {
|
||||
const files = ['.github/workflows/ci.yml', '.github/workflows/ci-master.yml']
|
||||
const files = ['.github/workflows/ci.yml', '.github/workflows/ci-windows.yml', '.github/workflows/ci-master.yml']
|
||||
const setups: Array<{ jobName: string; step: unknown }> = []
|
||||
for (const file of files) {
|
||||
const workflow: unknown = yaml.load(readFileSync(resolve(root, file), 'utf8'))
|
||||
@@ -304,13 +359,16 @@ describe('CI workflow', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('keeps split native Windows PR jobs with failover, plus a master-only standby', () => {
|
||||
it('keeps split native Windows PR jobs with failover in their own workflow, plus a master-only standby', () => {
|
||||
const workflow = loadWorkflow('.github/workflows/ci.yml')
|
||||
const windowsWorkflow = loadWorkflow('.github/workflows/ci-windows.yml')
|
||||
const masterWorkflow = loadWorkflow('.github/workflows/ci-master.yml')
|
||||
if (!isRecord(workflow.jobs)
|
||||
|| !isRecord(workflow.jobs['windows-build'])
|
||||
|| !isRecord(workflow.jobs['windows-coverage'])
|
||||
|| !isRecord(workflow.jobs['windows-native-tests'])
|
||||
|| !isRecord(windowsWorkflow.jobs)
|
||||
|| !isRecord(windowsWorkflow.jobs['windows-build'])
|
||||
|| !isRecord(windowsWorkflow.jobs['windows-coverage'])
|
||||
|| !isRecord(windowsWorkflow.jobs['windows-native-tests'])
|
||||
|| !isRecord(windowsWorkflow.jobs['windows-checks-passed'])
|
||||
|| !isRecord(workflow.jobs['node-24'])
|
||||
|| !isRecord(workflow.jobs['node-24-coverage'])
|
||||
|| !isRecord(workflow.jobs['node-24-bench'])
|
||||
@@ -319,12 +377,13 @@ describe('CI workflow', () => {
|
||||
|| !isRecord(workflow.jobs['all-checks-passed'])
|
||||
|| !isRecord(masterWorkflow.jobs)
|
||||
|| !isRecord(masterWorkflow.jobs['serial-windows'])) {
|
||||
throw new TypeError('CI workflow must define windows-build, windows-coverage, windows-native-tests, node-24, node-24-coverage, node-24-bench, node-24-consumers, node-compat, and all-checks-passed; ci-master must define serial-windows')
|
||||
throw new TypeError('CI workflow must define node-24, node-24-coverage, node-24-bench, node-24-consumers, node-compat, and all-checks-passed; CI Windows must define windows-build, windows-coverage, windows-native-tests, and windows-checks-passed; ci-master must define serial-windows')
|
||||
}
|
||||
|
||||
const windowsBuild = workflow.jobs['windows-build']
|
||||
const windowsCoverage = workflow.jobs['windows-coverage']
|
||||
const windowsNativeTests = workflow.jobs['windows-native-tests']
|
||||
const windowsBuild = windowsWorkflow.jobs['windows-build']
|
||||
const windowsCoverage = windowsWorkflow.jobs['windows-coverage']
|
||||
const windowsNativeTests = windowsWorkflow.jobs['windows-native-tests']
|
||||
const windowsAggregate = windowsWorkflow.jobs['windows-checks-passed']
|
||||
const serialWindows = masterWorkflow.jobs['serial-windows']
|
||||
const node24 = workflow.jobs['node-24']
|
||||
const node24Coverage = workflow.jobs['node-24-coverage']
|
||||
@@ -332,9 +391,10 @@ describe('CI workflow', () => {
|
||||
const node24Consumers = workflow.jobs['node-24-consumers']
|
||||
const nodeCompat = workflow.jobs['node-compat']
|
||||
const aggregate = workflow.jobs['all-checks-passed']
|
||||
if (!Array.isArray(aggregate.needs)) {
|
||||
throw new TypeError('CI aggregate must define needs')
|
||||
if (!Array.isArray(aggregate.needs) || !Array.isArray(windowsAggregate.needs)) {
|
||||
throw new TypeError('CI and CI Windows aggregates must define needs')
|
||||
}
|
||||
expect(Object.keys(workflow.jobs).filter(name => name.startsWith('windows'))).toEqual([])
|
||||
// The split native jobs all resolve their pool through the Windows switch.
|
||||
for (const [jobName, job] of [['windows-build', windowsBuild], ['windows-coverage', windowsCoverage], ['windows-native-tests', windowsNativeTests]] as const) {
|
||||
expect(typeof job['runs-on']).toBe('string')
|
||||
@@ -414,7 +474,7 @@ describe('CI workflow', () => {
|
||||
expect(nativeTestCommand).toContain('tool-pwsh/tests/loader.spec.ts')
|
||||
expect(nativeTestCommand).toContain('workflow-ptc.spec.ts')
|
||||
|
||||
expect(workflow.jobs['windows-observational']).toBeUndefined()
|
||||
expect(windowsWorkflow.jobs['windows-observational']).toBeUndefined()
|
||||
expect(windowsBuild['continue-on-error']).not.toBe(true)
|
||||
const observational = buildCommands.find(step => step.id === 'observational')
|
||||
expect(observational).toMatchObject({
|
||||
@@ -473,10 +533,13 @@ describe('CI workflow', () => {
|
||||
expect(serialGate).toBeDefined()
|
||||
expect(serialGate!.env).toMatchObject({ DSH_COVERAGE_TEST_TIMEOUT_MS: '90000' })
|
||||
|
||||
expect(aggregate.needs).not.toContain('windows')
|
||||
// windows-coverage is temporarily non-blocking while Windows ACP
|
||||
// half-close tests are stabilized; observational stays out too.
|
||||
expect(aggregate.needs).not.toContain('windows')
|
||||
expect(aggregate.needs).toContain('windows-build')
|
||||
expect(windowsAggregate.needs).toEqual(['windows-build', 'windows-native-tests'])
|
||||
expect(windowsAggregate.name).toBe('windows checks passed')
|
||||
expect(windowsAggregate['runs-on']).toBe(aggregate['runs-on'])
|
||||
expect(windowsAggregate.if).toBe(aggregate.if)
|
||||
// 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')
|
||||
@@ -492,10 +555,7 @@ describe('CI workflow', () => {
|
||||
env: { DSH_GATE_VERBOSE: '1' },
|
||||
run: 'pnpm run check:ci:bench',
|
||||
})
|
||||
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')
|
||||
expect(windowsAggregate.needs).not.toContain('serial-windows')
|
||||
|
||||
// Linux failover is a separate switch: the three enterprise Linux workers
|
||||
// and the verdict job resolve their pool through DSH_CI_FAILOVER_LINUX,
|
||||
@@ -712,6 +772,18 @@ describe('CI workflow', () => {
|
||||
}
|
||||
expect(Object.keys(workflow.on).sort()).toEqual(['push', 'workflow_dispatch'])
|
||||
expect(Object.keys(prWorkflow.on)).toEqual(['pull_request'])
|
||||
const windowsWorkflow = loadWorkflow('.github/workflows/ci-windows.yml')
|
||||
if (!isRecord(windowsWorkflow.on)) throw new TypeError('CI Windows workflow must define on')
|
||||
expect(Object.keys(windowsWorkflow.on)).toEqual(['pull_request'])
|
||||
expect(windowsWorkflow.concurrency).toEqual(workflow.concurrency)
|
||||
// Duplicated env must not drift: a Node bump on one lane only would run
|
||||
// Linux and Windows against different versions.
|
||||
expect(windowsWorkflow.env).toEqual(prWorkflow.env)
|
||||
const pythonWorkflow = loadWorkflow('.github/workflows/ci-python.yml')
|
||||
if (!isRecord(pythonWorkflow.on)) throw new TypeError('CI Python workflow must define on')
|
||||
expect(Object.keys(pythonWorkflow.on)).toEqual(['pull_request'])
|
||||
expect(pythonWorkflow.concurrency).toEqual(workflow.concurrency)
|
||||
expect(pythonWorkflow.env).toEqual(prWorkflow.env)
|
||||
|
||||
// Drills share the parent run’s supersession policy.
|
||||
for (const name of ['serial-linux-selfhosted', 'serial-windows']) {
|
||||
@@ -789,27 +861,29 @@ describe('CI workflow', () => {
|
||||
expect(config).not.toContain('packages/lsp/lsp-stdio/src/instance.ts')
|
||||
})
|
||||
|
||||
it('requires release-shaped Python runtime validation on Linux and Windows x64', () => {
|
||||
const workflow = loadWorkflow('.github/workflows/ci.yml')
|
||||
it('requires release-shaped Python runtime validation on Linux and Windows x64 in CI Python', () => {
|
||||
const workflow = loadWorkflow('.github/workflows/ci-python.yml')
|
||||
const pythonRuntime = workflowJob(workflow, 'python-runtime')
|
||||
const aggregate = workflowJob(workflow, 'all-checks-passed')
|
||||
const aggregate = workflowJob(workflow, 'python-checks-passed')
|
||||
if (!Array.isArray(aggregate.needs)) {
|
||||
throw new TypeError('CI aggregate must define required job dependencies')
|
||||
throw new TypeError('CI Python aggregate must define required job dependencies')
|
||||
}
|
||||
|
||||
expect(pythonRuntime).toMatchObject({
|
||||
if: "github.event_name == 'pull_request'",
|
||||
name: 'python runtime / release-shaped matrix',
|
||||
uses: './.github/workflows/build-exe-for-python-sdk.yml',
|
||||
with: {
|
||||
targets: 'node24-linux-x64,node24-win-x64',
|
||||
ci: true,
|
||||
},
|
||||
with: { targets: 'node24-linux-x64,node24-win-x64', ci: true },
|
||||
secrets: {
|
||||
DEEPSEEK_API_KEY_EXTERNAL: '${{ secrets.DEEPSEEK_API_KEY_EXTERNAL }}',
|
||||
},
|
||||
})
|
||||
expect(aggregate.needs).toContain('python-runtime')
|
||||
expect(aggregate.needs).toEqual(['python-sdk', 'python-runtime'])
|
||||
for (const file of ['ci.yml', 'ci-windows.yml']) {
|
||||
const other = loadWorkflow('.github/workflows/' + file)
|
||||
if (!isRecord(other.jobs)) throw new TypeError(`${file} must define jobs`)
|
||||
expect(other.jobs).not.toHaveProperty('python-runtime')
|
||||
}
|
||||
})
|
||||
|
||||
it('builds SSH executables only for explicit manual or release requests', () => {
|
||||
@@ -1297,6 +1371,27 @@ describe('Weighted approval workflow', () => {
|
||||
'persist-credentials': false,
|
||||
},
|
||||
})
|
||||
const token = steps.find(step => step.id === 'decision-token')
|
||||
expect(token).toMatchObject({
|
||||
'continue-on-error': true,
|
||||
uses: 'actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1',
|
||||
with: {
|
||||
'client-id': '${{ vars.DSH_APPROVAL_APP_CLIENT_ID }}',
|
||||
'private-key': '${{ secrets.DSH_APPROVAL_APP_PRIVATE_KEY }}',
|
||||
owner: 'deepseek-harness',
|
||||
repositories: 'deepseek-harness',
|
||||
'permission-checks': 'write',
|
||||
},
|
||||
})
|
||||
const tokenIndex = steps.indexOf(token!)
|
||||
expect(tokenIndex).toBeGreaterThan(steps.indexOf(checkout!))
|
||||
expect(tokenIndex).toBeLessThan(steps.findIndex(step => step.id === 'revoke'))
|
||||
for (const step of steps.filter(step => typeof step.run === 'string' && step.run.startsWith('node .github/review-ownership/check-approval.mjs'))) {
|
||||
expect(step.env).toMatchObject({
|
||||
DECISION_TOKEN: '${{ steps.decision-token.outputs.token }}',
|
||||
DECISION_APP_SLUG: '${{ vars.DSH_APPROVAL_APP_SLUG }}',
|
||||
})
|
||||
}
|
||||
const setupIndex = steps.findIndex(step => typeof step.uses === 'string' && step.uses.startsWith('actions/setup-python@'))
|
||||
expect(steps[setupIndex]?.if).toBe("steps.revoke.outputs.active == 'true'")
|
||||
expect(steps[setupIndex]?.uses).toBe('actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1')
|
||||
@@ -1308,7 +1403,7 @@ describe('Weighted approval workflow', () => {
|
||||
if: "failure() && steps.revoke.outputs.active == 'true'",
|
||||
run: 'node .github/review-ownership/check-approval.mjs error',
|
||||
})
|
||||
const pythonJob = workflowJob(loadWorkflow('.github/workflows/ci.yml'), 'python-sdk')
|
||||
const pythonJob = workflowJob(loadWorkflow('.github/workflows/ci-python.yml'), 'python-sdk')
|
||||
expect(pythonJob.steps).toContainEqual({
|
||||
name: 'Test production blame scoring',
|
||||
run: "uv run --python 3.10 --with-requirements .github/review-ownership/requirements.txt python -m unittest discover -s .github/review-ownership -p 'test_*.py'",
|
||||
@@ -1335,7 +1430,7 @@ describe('Weighted approval workflow', () => {
|
||||
expect(record?.run).toBe("echo 'Recorded a weighted approval review event.'")
|
||||
expect(recordSteps).toHaveLength(1)
|
||||
expect(JSON.stringify(publisher)).not.toContain('github.event.pull_request.head')
|
||||
expect(JSON.stringify(publisher)).not.toContain('secrets.')
|
||||
expect(JSON.stringify(publisher).match(/secrets\.[A-Za-z0-9_]+/gu)).toEqual(['secrets.DSH_APPROVAL_APP_PRIVATE_KEY'])
|
||||
expect(JSON.stringify(reviewEvent)).not.toContain('github.token')
|
||||
expect(JSON.stringify(reviewEvent)).not.toContain('secrets.')
|
||||
})
|
||||
|
||||
@@ -29,6 +29,8 @@ const roots: string[] = []
|
||||
const dshBuildWorkflows = [
|
||||
'build-exe-for-python-sdk.yml',
|
||||
'ci.yml',
|
||||
'ci-python.yml',
|
||||
'ci-windows.yml',
|
||||
'e2e.yml',
|
||||
'release.yml',
|
||||
'release-publish.yml',
|
||||
|
||||
@@ -9,7 +9,7 @@ import { describe, expect, it } from 'vitest'
|
||||
const root = fileURLToPath(new URL('..', import.meta.url))
|
||||
|
||||
function clientCssDeclarations(): string[] {
|
||||
const clientGroups = ['client', 'extensions']
|
||||
const clientGroups = ['client', 'extensions', 'experimental']
|
||||
return clientGroups.flatMap((group) => {
|
||||
const clientRoot = resolve(root, 'packages', group)
|
||||
return readdirSync(clientRoot, { withFileTypes: true })
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/** Loader resolves configuration imports in their project when Node internals are unavailable. */
|
||||
import { Context } from '@deepseek-ai/cordis'
|
||||
import Loader from '@deepseek-ai/cordis-plugin-loader'
|
||||
import { existsSync } from 'node:fs'
|
||||
import * as fs from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { pathToFileURL } from 'node:url'
|
||||
import { describe, expect, it, onTestFinished, vi } from 'vitest'
|
||||
import { createResolve } from '../vendor/loader/src/resolve.ts'
|
||||
|
||||
vi.mock('node:fs/promises', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('node:fs/promises')>()
|
||||
const mkdir = vi.fn(actual.mkdir)
|
||||
return { ...actual, mkdir, default: { ...actual, mkdir } }
|
||||
})
|
||||
|
||||
async function fixture() {
|
||||
const root = await fs.mkdtemp(join(tmpdir(), 'dsh-cordis-resolve-'))
|
||||
onTestFinished(() => fs.rm(root, { recursive: true, force: true }))
|
||||
await fs.writeFile(join(root, 'package.json'), JSON.stringify({
|
||||
name: 'fixture-app', type: 'module',
|
||||
imports: { '#local': './local.js' }, exports: { './sub': './sub.js' },
|
||||
}))
|
||||
await fs.writeFile(join(root, 'local.js'), 'export const tag = "subpath-import"\n')
|
||||
await fs.writeFile(join(root, 'sub.js'), 'export const tag = "self-reference"\n')
|
||||
const dep = join(root, 'node_modules', 'fixture-dep')
|
||||
await fs.mkdir(dep, { recursive: true })
|
||||
await fs.writeFile(join(dep, 'package.json'), JSON.stringify({
|
||||
name: 'fixture-dep', type: 'module',
|
||||
exports: { '.': { import: './index.js' }, './sub': { import: './sub.js' } },
|
||||
}))
|
||||
await fs.writeFile(join(dep, 'index.js'), 'export const tag = "bare-dep"\n')
|
||||
await fs.writeFile(join(dep, 'sub.js'), 'export const tag = "dependency-subpath"\n')
|
||||
await fs.mkdir(join(root, 'src'))
|
||||
await fs.writeFile(join(root, 'src', 'plugin.js'), 'export const tag = "relative"\n')
|
||||
return { root, baseUrl: pathToFileURL(join(root, 'src', 'cordis.yml')).href }
|
||||
}
|
||||
|
||||
async function treeFor(baseUrl: string) {
|
||||
const ctx = new Context()
|
||||
onTestFinished(() => ctx.fiber.dispose())
|
||||
await ctx.plugin(Loader, { baseUrl })
|
||||
ctx.loader.internal = undefined
|
||||
return ctx.loader.root.tree
|
||||
}
|
||||
|
||||
describe('Loader project resolution', () => {
|
||||
it('loads import-only dependencies, subpaths and package mappings from the config project', async () => {
|
||||
const { root, baseUrl } = await fixture()
|
||||
const tree = await treeFor(baseUrl)
|
||||
for (const [specifier, tag] of [
|
||||
['fixture-dep', 'bare-dep'], ['fixture-dep/sub', 'dependency-subpath'],
|
||||
['#local', 'subpath-import'], ['fixture-app/sub', 'self-reference'],
|
||||
] as const) {
|
||||
expect(await tree.import(specifier)).toMatchObject({ tag })
|
||||
}
|
||||
expect(existsSync(join(root, '.cordis', 'resolve.mjs'))).toBe(true)
|
||||
expect(existsSync(join(root, 'src', '.cordis'))).toBe(false)
|
||||
expect(await fs.readFile(join(root, '.cordis', '.gitignore'), 'utf8')).toContain('*')
|
||||
await expect(tree.import('fixture-dep/missing')).rejects.toThrow()
|
||||
})
|
||||
|
||||
it('keeps project scopes independent and shares concurrent resolution within one scope', async () => {
|
||||
const first = await fixture()
|
||||
const second = await fixture()
|
||||
const [a, b, c] = await Promise.all([
|
||||
createResolve(first.baseUrl),
|
||||
createResolve(pathToFileURL(join(first.root, 'cordis.yml')).href),
|
||||
createResolve(second.baseUrl),
|
||||
])
|
||||
expect(a).toBeTypeOf('function')
|
||||
expect(a).toBe(b)
|
||||
expect(a?.('fixture-dep')).not.toBe(c?.('fixture-dep'))
|
||||
})
|
||||
|
||||
it('imports relative, URL and builtin specifiers without changing their identity', async () => {
|
||||
const { root, baseUrl } = await fixture()
|
||||
const tree = await treeFor(baseUrl)
|
||||
expect(await tree.import('./plugin.js')).toMatchObject({ tag: 'relative' })
|
||||
expect(existsSync(join(root, '.cordis'))).toBe(false)
|
||||
expect(await tree.import(pathToFileURL(join(root, 'local.js')).href)).toMatchObject({ tag: 'subpath-import' })
|
||||
expect(await tree.import('node:path')).toMatchObject({ join })
|
||||
await expect(tree.import('./missing.js')).rejects.toThrow()
|
||||
})
|
||||
|
||||
it('retains native import when helper creation is denied', async () => {
|
||||
const { root, baseUrl } = await fixture()
|
||||
const tree = await treeFor(baseUrl)
|
||||
const denied = vi.mocked(fs.mkdir).mockRejectedValueOnce(Object.assign(new Error('read-only project'), { code: 'EACCES' }))
|
||||
onTestFinished(() => { denied.mockReset() })
|
||||
expect(await createResolve(baseUrl)).toBeUndefined()
|
||||
expect(await tree.import('node:path')).toMatchObject({ join })
|
||||
await expect(tree.import('fixture-dep')).rejects.toThrow()
|
||||
expect(existsSync(join(root, '.cordis'))).toBe(false)
|
||||
})
|
||||
|
||||
it('retains native import without a file-backed package scope', async () => {
|
||||
expect(await createResolve(undefined)).toBeUndefined()
|
||||
expect(await createResolve('https://example.com/cordis.yml')).toBeUndefined()
|
||||
const tree = await treeFor('https://example.com/cordis.yml')
|
||||
expect(await tree.import('node:path')).toMatchObject({ join })
|
||||
})
|
||||
})
|
||||
@@ -59,6 +59,7 @@ const PACKAGE_LIBRARIES: Readonly<Record<string, string>> = {
|
||||
'packages/experimental/browser-use-runtime': 'Provider-owned browser resource management and MCP integration helpers; no plugin entry.',
|
||||
'packages/boot/app-boot': 'Boot library the app bins import; plain helper exports.',
|
||||
'packages/boot/cmdline': 'Command-line library the app bins import; plain module exports.',
|
||||
'packages/util/official-bundles': 'Bundle-list data library the launcher and plugin manager import; plain constant exports.',
|
||||
'packages/client/store': 'Browser-side state primitives; plain function/type exports.',
|
||||
'packages/client/ui-primitives': 'Browser-side UI component library; plain component exports.',
|
||||
'packages/client/ui-slots': 'Browser-side slot-map declarations; plain type exports.',
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
/** Experimental package identities, publication policy, and retained npm names. */
|
||||
|
||||
/** Explicit npm identities retained across experimental classification and package-role moves. */
|
||||
/**
|
||||
* Experimental packages whose npm names omit the experimental prefix, by directory: identities retained across
|
||||
* experimental classification and package-role moves, and packages named without the prefix so that leaving
|
||||
* experimental status keeps their names.
|
||||
*/
|
||||
export const EXPERIMENTAL_PACKAGE_NAME_EXCEPTIONS: Readonly<Record<string, string>> = {
|
||||
'packages/experimental/cua': '@deepseek-ai/dsh-cua',
|
||||
'packages/experimental/cua-bundle': '@deepseek-ai/dsh-cua-bundle',
|
||||
@@ -14,6 +18,12 @@ export const EXPERIMENTAL_PACKAGE_NAME_EXCEPTIONS: Readonly<Record<string, strin
|
||||
'packages/experimental/hooks-codex': '@deepseek-ai/dsh-hooks-codex',
|
||||
'packages/experimental/webhook': '@deepseek-ai/dsh-webhook',
|
||||
'packages/experimental/webhook-github': '@deepseek-ai/dsh-webhook-github',
|
||||
'packages/experimental/action-cards': '@deepseek-ai/dsh-action-cards',
|
||||
'packages/experimental/client-ui-action-cards': '@deepseek-ai/dsh-client-ui-action-cards',
|
||||
'packages/experimental/creation-recommendations': '@deepseek-ai/dsh-creation-recommendations',
|
||||
'packages/experimental/client-ui-creation-recommendations': '@deepseek-ai/dsh-client-ui-creation-recommendations',
|
||||
'packages/experimental/plugin-recommendations': '@deepseek-ai/dsh-plugin-recommendations',
|
||||
'packages/experimental/client-ui-plugin-recommendations': '@deepseek-ai/dsh-client-ui-plugin-recommendations',
|
||||
} satisfies Record<`packages/experimental/${string}`, `@deepseek-ai/dsh-${string}`>
|
||||
|
||||
/** npm namespace for experimental packages without retained-name exceptions. */
|
||||
|
||||
@@ -5,7 +5,7 @@ import { existsSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join, resolve } from 'node:path'
|
||||
import { promisify } from 'node:util'
|
||||
import { PROFILE_TEMPLATES } from '@deepseek-ai/dsh-app-boot'
|
||||
import { PROFILE_TEMPLATES } from '@deepseek-ai/dsh-official-bundles'
|
||||
import {
|
||||
computeTranslationPairingRecord,
|
||||
renderTranslationPairingRecord,
|
||||
|
||||
@@ -48,9 +48,9 @@ const MAX_DECL_CHARS = 1200
|
||||
* share that hands down a subsystem instead of a share, and prose that grew
|
||||
* into a manual. Every report also lists one line per standard prop seat of its
|
||||
* scope, so the widest Session-scope slot (`tool.call.toolview`, with the
|
||||
* global and Session access seats) sets the current 122.
|
||||
* global and Session access seats) sets the current 123.
|
||||
*/
|
||||
const MAX_ENTRY_LINES = 122
|
||||
const MAX_ENTRY_LINES = 123
|
||||
|
||||
/** One register-call option as the catalog teaches it. */
|
||||
interface OptionDoc {
|
||||
|
||||
@@ -60,6 +60,8 @@ export const SERVICE_PAGE: Record<string, string> = {
|
||||
productAnalytics: 'product-telemetry.md',
|
||||
connection: 'web-server.md',
|
||||
pluginManager: 'boot.md',
|
||||
actionCards: 'boot.md',
|
||||
pluginRecommendations: 'boot.md',
|
||||
pluginMarket: 'boot.md',
|
||||
pluginRegistryProbe: 'boot.md',
|
||||
configEditor: 'boot.md',
|
||||
@@ -554,6 +556,7 @@ export const LINK_MAP: Readonly<Record<string, string>> = {
|
||||
ScheduleListRequest: 'schedule.md',
|
||||
ScheduleDeleteRequest: 'schedule.md',
|
||||
ScheduleDeleteResult: 'schedule.md',
|
||||
ScheduleDeleteInactiveResult: 'schedule.md',
|
||||
ScheduleTimingChange: 'schedule.md',
|
||||
ScheduleUpdateRequest: 'schedule.md',
|
||||
ScheduleUpdateResult: 'schedule.md',
|
||||
@@ -827,6 +830,7 @@ export const LINK_MAP: Readonly<Record<string, string>> = {
|
||||
PresetOption: 'permission-presets.md',
|
||||
PresetSpec: 'permission-presets.md',
|
||||
WebRoute: 'web-server.md',
|
||||
WebResourceRoute: 'web-server.md',
|
||||
IndexInjection: 'web-server.md',
|
||||
StorageBackend: 'storage.md',
|
||||
StorageForms: 'storage.md',
|
||||
@@ -912,6 +916,11 @@ export const FOUNDATION_TYPE_NAMES: ReadonlySet<string> = new Set([
|
||||
|
||||
/** Project types deliberately documented outside the subsystems catalog. */
|
||||
export const TYPE_LINK_EXEMPTIONS: Readonly<Record<string, string>> = {
|
||||
ActionCardDecision: 'packages/experimental/action-cards/README.md',
|
||||
ActionCardKind: 'packages/experimental/action-cards/README.md',
|
||||
ActionCardResult: 'packages/experimental/action-cards/README.md',
|
||||
ActionCardView: 'packages/experimental/action-cards/README.md',
|
||||
RecommendationDetails: 'packages/experimental/plugin-recommendations/README.md',
|
||||
ProductEvent: 'Desktop event fields are owned by packages/client/product-analytics/README.md and src/events.ts',
|
||||
ConnectionFetchHandler: 'shared Fetch dispatch is owned by packages/client/connection/src/rpc.ts',
|
||||
ConnectionRequestRejection: 'transport rejection status is owned by packages/client/connection/src/rpc.ts',
|
||||
|
||||
@@ -107,6 +107,22 @@ const GROUP_ORDER = [
|
||||
]
|
||||
|
||||
const SERVICE_ROLES: ServiceRole[] = [
|
||||
{
|
||||
key: 'actionCards',
|
||||
pkg: 'action-cards',
|
||||
title: 'Optional action cards',
|
||||
mode: 'service',
|
||||
consumers: ['creation-recommendations', 'client-ui-action-cards'],
|
||||
note: 'Owns the card tool, card state, user actions and status notices; card kinds register their actions and handlers.',
|
||||
},
|
||||
{
|
||||
key: 'pluginRecommendations',
|
||||
pkg: 'plugin-recommendations',
|
||||
title: 'Explicit-need plugin recommendations',
|
||||
mode: 'service',
|
||||
consumers: ['client-ui-plugin-recommendations'],
|
||||
note: 'Reads the current catalog text of an official plugin card and enables the plugin through the profile plugin manager after a click.',
|
||||
},
|
||||
{
|
||||
key: 'headlessStartup',
|
||||
pkg: 'headless',
|
||||
|
||||
@@ -4,11 +4,13 @@ import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, statSync, uti
|
||||
import { tmpdir } from 'node:os'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { ON_DEMAND_BUNDLES } from '../packages/boot/app-boot/src/official-bundles.ts'
|
||||
import { ON_DEMAND_BUNDLES } from '../packages/util/official-bundles/src/index.ts'
|
||||
import { generateOfficialBundleCatalog, renderOfficialBundleCatalog, syncOfficialBundleCatalog } from './gen-official-bundle-catalog.ts'
|
||||
|
||||
import { SHIPPED_LOCALE_IDS } from './shipped-locales.ts'
|
||||
|
||||
const roots: string[] = []
|
||||
const output = 'packages/boot/app-boot/src/official-bundles.generated.ts'
|
||||
const output = 'packages/util/official-bundles/src/catalog.generated.ts'
|
||||
|
||||
function write(root: string, path: string, content: unknown): void {
|
||||
mkdirSync(dirname(join(root, path)), { recursive: true })
|
||||
@@ -32,6 +34,7 @@ function fixture(): string {
|
||||
write(root, `${dir}/locale/en.json`, { meta: { title: 'Native agent', description: 'Delegate a task.' } })
|
||||
write(root, `${dir}/locale/zh.json`, { meta: { title: '原生智能体', description: '委派任务。' } })
|
||||
write(root, `${dir}/locale/ja.json`, { meta: { title: 'ネイティブエージェント', description: 'タスクを委派します。' } })
|
||||
for (const language of ['es', 'fr', 'de', 'ru', 'pt']) write(root, `${dir}/locale/${language}.json`, { meta: { title: 'Native agent', description: 'Delegate a task.' } })
|
||||
}
|
||||
write(root, output, '')
|
||||
return root
|
||||
@@ -50,8 +53,8 @@ describe('Official bundle catalog generation', () => {
|
||||
const entries = generateOfficialBundleCatalog(fixture())
|
||||
expect(entries.map(entry => entry.packageName)).toEqual(ON_DEMAND_BUNDLES)
|
||||
expect(entries[0]?.meta).toEqual({
|
||||
title: { en: 'Native agent', zh: '原生智能体', ja: 'ネイティブエージェント' },
|
||||
description: { en: 'Delegate a task.', zh: '委派任务。', ja: 'タスクを委派します。' },
|
||||
title: { en: 'Native agent', zh: '原生智能体', ja: 'ネイティブエージェント', ...Object.fromEntries(['es', 'fr', 'de', 'ru', 'pt'].map(id => [id, 'Native agent'])) },
|
||||
description: { en: 'Delegate a task.', zh: '委派任务。', ja: 'タスクを委派します。', ...Object.fromEntries(['es', 'fr', 'de', 'ru', 'pt'].map(id => [id, 'Delegate a task.'])) },
|
||||
icon: `data:image/svg+xml;base64,${Buffer.from('<svg xmlns="http://www.w3.org/2000/svg"/>').toString('base64')}`,
|
||||
})
|
||||
expect(renderOfficialBundleCatalog(entries)).not.toContain('1.2.3')
|
||||
@@ -81,14 +84,14 @@ describe('Official bundle catalog generation', () => {
|
||||
expect(() => generateOfficialBundleCatalog(root, [ON_DEMAND_BUNDLES[0]!, ON_DEMAND_BUNDLES[0]!])).toThrow('distinct package names')
|
||||
})
|
||||
|
||||
it.each(['icon', 'en', 'zh', 'ja'])('rejects missing %s metadata', (resource) => {
|
||||
it.each(['icon', ...SHIPPED_LOCALE_IDS])('rejects missing %s metadata', (resource) => {
|
||||
const root = fixture()
|
||||
const dir = directory(ON_DEMAND_BUNDLES[0]!)
|
||||
rmSync(join(root, dir, resource === 'icon' ? 'icon.svg' : `locale/${resource}.json`))
|
||||
expect(() => generateOfficialBundleCatalog(root)).toThrow()
|
||||
})
|
||||
|
||||
it.each(['en', 'zh', 'ja'])('requires explicit %s fields instead of metadata fallback text', (language) => {
|
||||
it.each(SHIPPED_LOCALE_IDS)('requires explicit %s fields instead of metadata fallback text', (language) => {
|
||||
const root = fixture()
|
||||
write(root, `${directory(ON_DEMAND_BUNDLES[0]!)}/locale/${language}.json`, { meta: { description: 'Only a description.' } })
|
||||
expect(() => generateOfficialBundleCatalog(root)).toThrow(`explicit ${language} title and description`)
|
||||
|
||||
@@ -5,11 +5,13 @@ import { resolve } from 'node:path'
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url'
|
||||
import ts from 'typescript'
|
||||
import type { LocalizedText } from '../packages/util/package-manifest/src/types.ts'
|
||||
import { ON_DEMAND_BUNDLES } from '../packages/boot/app-boot/src/official-bundle-packages.ts'
|
||||
import type { OfficialBundleCatalogEntry } from '../packages/boot/app-boot/src/official-bundles.ts'
|
||||
import { ON_DEMAND_BUNDLES } from '../packages/util/official-bundles/src/bundles.ts'
|
||||
import type { OfficialBundleCatalogEntry } from '../packages/util/official-bundles/src/index.ts'
|
||||
import { readPluginMeta, resolvePluginResource } from '../packages/boot/app-boot/src/package-meta.ts'
|
||||
|
||||
const OUTPUT = 'packages/boot/app-boot/src/official-bundles.generated.ts'
|
||||
import { SHIPPED_LOCALE_IDS } from './shipped-locales.ts'
|
||||
|
||||
const OUTPUT = 'packages/util/official-bundles/src/catalog.generated.ts'
|
||||
|
||||
/**
|
||||
* Read complete metadata without importing or activating any provider code.
|
||||
@@ -49,7 +51,7 @@ export function generateOfficialBundleCatalog(root: string, names: readonly stri
|
||||
throw new Error(`${packageName}: Official catalog entries must be public DSH bundle packages`)
|
||||
}
|
||||
const parentURL = pathToFileURL(resolve(root, entry.path)).href
|
||||
for (const language of ['en', 'zh', 'ja']) {
|
||||
for (const language of SHIPPED_LOCALE_IDS) {
|
||||
const file = resolvePluginResource(`${packageName}/locale/${language}.json`, parentURL)
|
||||
const dictionary = JSON.parse(readFileSync(file, 'utf8')) as { meta?: { title?: unknown; description?: unknown } }
|
||||
if (typeof dictionary.meta?.title !== 'string' || dictionary.meta.title.trim() === ''
|
||||
@@ -63,7 +65,7 @@ export function generateOfficialBundleCatalog(root: string, names: readonly stri
|
||||
throw new Error(`${packageName}: Official catalog entries require an icon and localized title and description`)
|
||||
}
|
||||
for (const value of [meta.title, meta.description]) {
|
||||
for (const language of ['en', 'zh', 'ja']) {
|
||||
for (const language of SHIPPED_LOCALE_IDS) {
|
||||
if (typeof value[language] !== 'string' || value[language].trim() === '') {
|
||||
throw new Error(`${packageName}: Official metadata requires ${language} text`)
|
||||
}
|
||||
@@ -76,11 +78,11 @@ export function generateOfficialBundleCatalog(root: string, names: readonly stri
|
||||
/**
|
||||
* Render a source-plane catalog with no package imports or pinned runtime version.
|
||||
* @param entries - Validated metadata in catalog order.
|
||||
* @returns Deterministic TypeScript source for app-boot's generated module.
|
||||
* @returns Deterministic TypeScript source for the official-bundles generated module.
|
||||
*/
|
||||
export function renderOfficialBundleCatalog(entries: readonly OfficialBundleCatalogEntry[]): string {
|
||||
return '/** Generated offline Official bundle metadata. Run pnpm gen-official-bundle-catalog; do not edit. */\n\n'
|
||||
+ "import type { OfficialBundleCatalogEntry } from './official-bundles.ts'\n\n"
|
||||
+ "import type { OfficialBundleCatalogEntry } from './index.ts'\n\n"
|
||||
+ '/** Official on-demand entries, independent of installed packages and registry availability. */\n'
|
||||
+ 'export const OFFICIAL_ON_DEMAND_CATALOG: readonly OfficialBundleCatalogEntry[] = [\n'
|
||||
+ entries.map(entry => ' {\n'
|
||||
|
||||
@@ -43,6 +43,8 @@ import SubagentRuntime from '@deepseek-ai/dsh-subagent'
|
||||
import type { SubagentProvider } from '@deepseek-ai/dsh-subagent'
|
||||
import * as ToolSubagentControl from '@deepseek-ai/dsh-tool-subagent-control'
|
||||
import SkillRegistry from '@deepseek-ai/dsh-skill'
|
||||
import ActionCards from '@deepseek-ai/dsh-action-cards'
|
||||
import RemoteAccess from '@deepseek-ai/dsh-api-remote-access'
|
||||
import * as SkillFileSystem from '@deepseek-ai/dsh-skill-filesystem'
|
||||
import LocalJobRegistry from '@deepseek-ai/dsh-jobs-local'
|
||||
import * as ToolAskUser from '@deepseek-ai/dsh-tool-ask-user'
|
||||
@@ -239,6 +241,19 @@ const TOOL_PACKAGES: ToolPackage[] = [
|
||||
})
|
||||
},
|
||||
},
|
||||
{
|
||||
pkg: '@deepseek-ai/dsh-action-cards',
|
||||
dir: 'action-cards',
|
||||
source: 'packages/experimental/action-cards/src/index.ts',
|
||||
requires: ['ctx.tools', 'ctx.agents', 'ctx.sessionProjections', 'ctx.remoteAccess'],
|
||||
writes: ['tool/call', 'tool/result', 'plugin:action-cards/decision', 'user/message'],
|
||||
async mount(ctx) {
|
||||
await ctx.plugin(AgentRegistry)
|
||||
await ctx.plugin(RemoteAccess)
|
||||
await ctx.plugin(ActionCards)
|
||||
},
|
||||
note: 'Declared only to an Agent that loaded the skill of a registered card kind; the kind packages register their actions, and the Personalized pages and Plugin recommendations bundles supply the shipped kinds.',
|
||||
},
|
||||
{
|
||||
pkg: '@deepseek-ai/dsh-tool-ask-user',
|
||||
dir: 'tool-ask-user',
|
||||
|
||||
@@ -8,7 +8,7 @@ import { join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { execa } from 'execa'
|
||||
import { describe, expect, it, onTestFinished } from 'vitest'
|
||||
import { ON_DEMAND_BUNDLES } from '../packages/boot/app-boot/src/official-bundle-packages.ts'
|
||||
import { ON_DEMAND_BUNDLES } from '../packages/util/official-bundles/src/bundles.ts'
|
||||
import { generateOfficialBundleCatalog } from './gen-official-bundle-catalog.ts'
|
||||
import {
|
||||
createRegistryManifest,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Gate for the invariant `FALLBACK_LOCALE` rests on: every shipped dictionary
|
||||
* declares the same keys in `zh`, `en`, and `ja`; Japanese dictionaries also
|
||||
* preserve the English literal-template placeholders.
|
||||
* declares the same keys in every shipped language; translations also
|
||||
* preserve the English placeholders, command examples, and API field names.
|
||||
*
|
||||
* The locale runtime resolves a key through the active locale, then through
|
||||
* the single fallback locale (`en`), then surfaces the key itself. With
|
||||
@@ -27,6 +27,8 @@ import { fileURLToPath } from 'node:url'
|
||||
import ts from 'typescript'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { SHIPPED_LOCALE_IDS, localeTokens, hasInvisibleLocaleCharacters, type ShippedLocaleId } from './shipped-locales.ts'
|
||||
|
||||
const root = fileURLToPath(new URL('..', import.meta.url))
|
||||
|
||||
/** Repo-relative path with `/` separators, so messages and suffix tests match on every OS. */
|
||||
@@ -101,7 +103,7 @@ function dictionariesIn(file: string): Dictionary[] {
|
||||
// before parsing — the silent narrowing this gate exists to prevent. A bare
|
||||
// `\b(zh|en)\b` misses `zhSettings`/`accessZh`, because `\b` does not hold
|
||||
// between `h` and an uppercase letter.
|
||||
if (!/\b(zh|en|ja)\b|\b(zh|en|ja)[A-Z]|(Zh|En|Ja)\b/.test(text)) return []
|
||||
if (!/\b(zh|en|ja|es|fr|de|ru|pt)\b|\b(zh|en|ja|es|fr|de|ru|pt)[A-Z]|(Zh|En|Ja|Es|Fr|De|Ru|Pt)\b/.test(text)) return []
|
||||
const source = ts.createSourceFile(file, text, ts.ScriptTarget.ESNext, true)
|
||||
const found: Dictionary[] = []
|
||||
const rel = relative(file)
|
||||
@@ -153,7 +155,7 @@ function dictionariesIn(file: string): Dictionary[] {
|
||||
if (name === 'register' && node.arguments.length >= 3) {
|
||||
const [ns, tag, dict] = node.arguments
|
||||
if (ns === undefined || tag === undefined || !ts.isStringLiteral(tag)) return
|
||||
if (tag.text !== 'zh' && tag.text !== 'en' && tag.text !== 'ja') return
|
||||
if (!SHIPPED_LOCALE_IDS.some(id => id === tag.text)) return
|
||||
const raw = unwrap(dict)
|
||||
const literal = raw !== undefined && ts.isIdentifier(raw)
|
||||
? (() => {
|
||||
@@ -185,7 +187,7 @@ function dictionariesIn(file: string): Dictionary[] {
|
||||
const literal = unwrap(dict)
|
||||
if (tag === undefined || !ts.isStringLiteral(tag)) continue
|
||||
if (literal === undefined || !ts.isObjectLiteralExpression(literal)) continue
|
||||
if (tag.text !== 'zh' && tag.text !== 'en' && tag.text !== 'ja') continue
|
||||
if (!SHIPPED_LOCALE_IDS.some(id => id === tag.text)) continue
|
||||
found.push({ file: rel, name: `${tag.text}@inline:${site}`, keys: keysOf(literal), templates: templatesOf(literal) })
|
||||
}
|
||||
}
|
||||
@@ -239,8 +241,8 @@ function unwrap(node: ts.Expression | undefined): ts.Expression | undefined {
|
||||
* @param name - export name or synthetic inline name.
|
||||
* @returns locale plus pair key, or undefined when the name names no locale.
|
||||
*/
|
||||
function localeOf(name: string): { locale: 'zh' | 'en' | 'ja'; pair: string } | undefined {
|
||||
for (const locale of ['zh', 'en', 'ja'] as const) {
|
||||
function localeOf(name: string): { locale: ShippedLocaleId; pair: string } | undefined {
|
||||
for (const locale of SHIPPED_LOCALE_IDS) {
|
||||
const other = locale[0]!.toUpperCase() + locale.slice(1)
|
||||
if (name === locale) return { locale, pair: '' }
|
||||
// Synthetic names for inline shapes carry their own pair key after the
|
||||
@@ -255,9 +257,9 @@ function localeOf(name: string): { locale: 'zh' | 'en' | 'ja'; pair: string } |
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that each object-form registration supplies its Japanese dictionary.
|
||||
* Check that each object-form registration supplies every shipped-language dictionary.
|
||||
* @param file - absolute source path.
|
||||
* @returns registration sites missing Japanese, or using an unresolved local identifier.
|
||||
* @returns registration sites missing a shipped language, or using an unresolved local identifier.
|
||||
*/
|
||||
function registrationProblems(file: string): string[] {
|
||||
const text = readFileSync(file, 'utf8')
|
||||
@@ -289,11 +291,13 @@ function registrationProblems(file: string): string[] {
|
||||
}
|
||||
}
|
||||
if (entries.has('zh') && entries.has('en')) {
|
||||
const ja = entries.get('ja')
|
||||
const site = `${relative(file)}:${source.getLineAndCharacterOfPosition(node.getStart(source)).line + 1}`
|
||||
if (ja === undefined) problems.push(`${site}: registration has no Japanese dictionary`)
|
||||
else if (ts.isIdentifier(ja) && !imported.has(ja.text) && !locals.has(ja.text)) {
|
||||
problems.push(`${site}: Japanese dictionary ${ja.text} is not imported or declared`)
|
||||
for (const language of SHIPPED_LOCALE_IDS) {
|
||||
const dictionary = entries.get(language)
|
||||
if (dictionary === undefined) problems.push(`${site}: registration has no ${language} dictionary`)
|
||||
else if (ts.isIdentifier(dictionary) && !imported.has(dictionary.text) && !locals.has(dictionary.text)) {
|
||||
problems.push(`${site}: ${language} dictionary ${dictionary.text} is not imported or declared`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -305,11 +309,11 @@ function registrationProblems(file: string): string[] {
|
||||
}
|
||||
|
||||
describe('shipped locale dictionaries', () => {
|
||||
it('registers Japanese alongside every object-form bilingual dictionary', () => {
|
||||
it('registers every shipped language alongside every object-form bilingual dictionary', () => {
|
||||
expect(sourceFiles().flatMap(registrationProblems)).toEqual([])
|
||||
})
|
||||
|
||||
it('keeps bilingual keys aligned and Japanese keys and placeholders complete', () => {
|
||||
it('keeps bilingual keys aligned and shipped-language keys and placeholders complete', () => {
|
||||
const files = sourceFiles()
|
||||
// Guard the discovery itself: an empty or narrowed sweep would pass every
|
||||
// assertion below while checking nothing.
|
||||
@@ -322,12 +326,18 @@ describe('shipped locale dictionaries', () => {
|
||||
const perFile = new Map<string, Dictionary[]>()
|
||||
for (const file of files) {
|
||||
const dicts = dictionariesIn(file)
|
||||
if (dicts.length > 0) perFile.set(relative(file), dicts)
|
||||
if (dicts.length > 0) {
|
||||
expect(hasInvisibleLocaleCharacters(readFileSync(file, 'utf8')), relative(file)).toBe(false)
|
||||
for (const dictionary of dicts) {
|
||||
for (const text of Object.values(dictionary.templates)) expect(hasInvisibleLocaleCharacters(text), relative(file)).toBe(false)
|
||||
}
|
||||
perFile.set(relative(file), dicts)
|
||||
}
|
||||
}
|
||||
|
||||
const groups = new Map<string, Map<'zh' | 'en' | 'ja', Dictionary>>()
|
||||
const place = (key: string, locale: 'zh' | 'en' | 'ja', dict: Dictionary): void => {
|
||||
const slot = groups.get(key) ?? new Map<'zh' | 'en' | 'ja', Dictionary>()
|
||||
const groups = new Map<string, Map<ShippedLocaleId, Dictionary>>()
|
||||
const place = (key: string, locale: ShippedLocaleId, dict: Dictionary): void => {
|
||||
const slot = groups.get(key) ?? new Map<ShippedLocaleId, Dictionary>()
|
||||
if (slot.has(locale)) {
|
||||
throw new Error(`two ${locale} dictionaries claim pair ${key}: ${slot.get(locale)?.file} and ${dict.file}`)
|
||||
}
|
||||
@@ -367,21 +377,23 @@ describe('shipped locale dictionaries', () => {
|
||||
const enOnly = en.keys.filter(k => !zh.keys.includes(k))
|
||||
if (zhOnly.length > 0) problems.push(`${zh.file} ${zh.name} has keys absent from ${en.name}: ${zhOnly.join(', ')}`)
|
||||
if (enOnly.length > 0) problems.push(`${en.file} ${en.name} has keys absent from ${zh.name}: ${enOnly.join(', ')}`)
|
||||
const ja = slot.get('ja')
|
||||
if (ja === undefined) {
|
||||
problems.push(`${key} has no Japanese dictionary`)
|
||||
} else {
|
||||
const missing = en.keys.filter(k => !ja.keys.includes(k))
|
||||
const extra = ja.keys.filter(k => !en.keys.includes(k))
|
||||
if (missing.length > 0 || extra.length > 0) {
|
||||
problems.push(`${ja.file} ${ja.name}: missing [${missing.join(', ')}], extra [${extra.join(', ')}]`)
|
||||
}
|
||||
for (const [name, text] of Object.entries(en.templates)) {
|
||||
const translated = ja.templates[name]
|
||||
if (translated === undefined) continue
|
||||
const placeholders = (value: string): string => (value.match(/\{\w+\}/gu) ?? []).sort().join(', ')
|
||||
if (placeholders(text) !== placeholders(translated)) {
|
||||
problems.push(`${ja.file} ${ja.name}.${name} changes placeholders from ${en.name}`)
|
||||
for (const language of SHIPPED_LOCALE_IDS.filter(id => id !== 'en' && id !== 'zh')) {
|
||||
const translatedDictionary = slot.get(language)
|
||||
if (translatedDictionary === undefined) {
|
||||
problems.push(`${key} has no ${language} dictionary`)
|
||||
} else {
|
||||
const missing = en.keys.filter(k => !translatedDictionary.keys.includes(k))
|
||||
const extra = translatedDictionary.keys.filter(k => !en.keys.includes(k))
|
||||
if (missing.length > 0 || extra.length > 0) {
|
||||
problems.push(`${translatedDictionary.file} ${translatedDictionary.name}: missing [${missing.join(', ')}], extra [${extra.join(', ')}]`)
|
||||
}
|
||||
for (const [name, text] of Object.entries(en.templates)) {
|
||||
const translated = translatedDictionary.templates[name]
|
||||
if (translated === undefined) continue
|
||||
const placeholders = (value: string): string => localeTokens(value).join(', ')
|
||||
if (placeholders(text) !== placeholders(translated)) {
|
||||
problems.push(`${translatedDictionary.file} ${translatedDictionary.name}.${name} changes placeholders or literal tokens from ${en.name}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,7 +405,6 @@
|
||||
"packages/client/modules/tests/node-half.client.spec.ts": {
|
||||
"621628e4e895b24171e82d1b3fa3ecb12970e8eb0dfccab8bacc8c5784188a28": 2,
|
||||
"6c4ace8d135ab45685d0152eefb0f8156bbf95f66cefedd9a1a8da081d3cb180": 1,
|
||||
"6d4d3e6035bfeaac7068a832f0d5c89f1112961164709c0eeb18dd8937d74cac": 1,
|
||||
"8eb8ea3592cbd4e828a33b2cbe2876089d3923738996fb2259ded563811a1a85": 1,
|
||||
"c4f0b7f87a16d26a1e4e7ef7a07991e789f0bbcfdbe2240a97fcd879668b5b3f": 1,
|
||||
"f549d88ac2b1db67fb33f18a024c116051ff83d3f8ad0433ba4ceedc679e9044": 2
|
||||
@@ -460,9 +459,6 @@
|
||||
"packages/client/ui-commands/tests/browser-plugin.client.spec.ts": {
|
||||
"04984a2ce1486250236e638e0197da0a1a840855ed3975c59130a85358c7e5fe": 1
|
||||
},
|
||||
"packages/client/ui-conversation/src/client/apply.ts": {
|
||||
"4c73f40f3ce989f285848573d7154fb295886bba707ad829e2c8c089e326aeea": 1
|
||||
},
|
||||
"packages/client/ui-conversation/src/client/conversation/location-index.ts": {
|
||||
"a7d8cc8d42e37ad5cc4882241492ac572ed8163c7fb8663180e893c7178e906f": 1
|
||||
},
|
||||
@@ -1279,11 +1275,8 @@
|
||||
"d423bbcd1caff7aab2e2de52564efbc9061e775620a530157805a43d851c6fe9": 1
|
||||
},
|
||||
"packages/interaction/user-approval/tests/approval.spec.ts": {
|
||||
"3261a2af17649cc35cf8698e3b7278101044ed1a07efce757615616e0f918d3a": 1,
|
||||
"4dd1f265ec710503bb27f057a582099a1e9d8b5db80fb45f148e32fd2afb5325": 2,
|
||||
"744b30e13b6390439c34f4970441a292a07f4ac3d26f25e9be75d1b5c18f4f33": 1,
|
||||
"971ec45a1146ab52f2fb13f75b782d5d35c0fb2ddba1fb9ccab14cc54f7291d5": 1,
|
||||
"a6a2f2761dfd14ff3624a7f8684b025d6aa733d41cac4381db7c83f2a38f0c35": 1,
|
||||
"f33c4a795e2cda267cb28d2937c632d56134b8e6438d21e4bf74da2735b1c154": 1
|
||||
},
|
||||
"packages/interaction/user-questions/tests/user-questions.spec.ts": {
|
||||
|
||||
@@ -8,7 +8,8 @@ import { describe, expect, it, onTestFinished } from 'vitest'
|
||||
import type { EntryOptions } from '@deepseek-ai/cordis-plugin-loader'
|
||||
import { loadOverlayPatches } from '../packages/boot/app-boot/src/index.ts'
|
||||
import { readPluginMeta } from '../packages/boot/app-boot/src/package-meta.ts'
|
||||
import { OPTIONAL_BUNDLES, PROFILE_TEMPLATES, bundlePatchPaths, composeEntries, initProfile, readProfileManifest } from '../packages/boot/app-boot/src/profile.ts'
|
||||
import { bundlePatchPaths, composeEntries, initProfile, readProfileManifest } from '../packages/boot/app-boot/src/profile.ts'
|
||||
import { OPTIONAL_BUNDLES, PROFILE_TEMPLATES } from '../packages/util/official-bundles/src/bundles.ts'
|
||||
import type { DshBundleManifest } from '../packages/util/package-manifest/src/types.ts'
|
||||
import { createPluginProfile } from '../apps/desktop/src/project-manager.ts'
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { tmpdir } from 'node:os'
|
||||
import { dirname, join, resolve } from 'node:path'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { officialClientBuildEnvironment, writeClientBuildRecord } from '../client-build-environment.ts'
|
||||
import { ON_DEMAND_BUNDLES } from '../../packages/boot/app-boot/src/official-bundles.ts'
|
||||
import { ON_DEMAND_BUNDLES } from '../../packages/util/official-bundles/src/bundles.ts'
|
||||
import { releaseFamily, type ReleaseMember } from './families.ts'
|
||||
import { compareVersions, nextVendorVersion, planShared, reachesPayload } from './bump.ts'
|
||||
|
||||
@@ -49,6 +49,7 @@ describe('release families', () => {
|
||||
expect(members
|
||||
.filter(member => member.directory.startsWith('packages/experimental/'))
|
||||
.map(member => member.name)).toEqual([
|
||||
'@deepseek-ai/dsh-action-cards',
|
||||
'@deepseek-ai/dsh-experimental-agent-team-profile',
|
||||
'@deepseek-ai/dsh-experimental-agent-team',
|
||||
'@deepseek-ai/dsh-experimental-api-speech-to-text',
|
||||
@@ -59,13 +60,17 @@ describe('release families', () => {
|
||||
'@deepseek-ai/dsh-experimental-browser-use-runtime',
|
||||
'@deepseek-ai/dsh-experimental-browser-use-stagehand-native',
|
||||
'@deepseek-ai/dsh-experimental-claude-code-mods',
|
||||
'@deepseek-ai/dsh-client-ui-action-cards',
|
||||
'@deepseek-ai/dsh-experimental-client-ui-agent-team',
|
||||
'@deepseek-ai/dsh-experimental-client-ui-claude-code-mods',
|
||||
'@deepseek-ai/dsh-experimental-client-ui-cot-translation',
|
||||
'@deepseek-ai/dsh-client-ui-creation-recommendations',
|
||||
'@deepseek-ai/dsh-client-ui-plugin-recommendations',
|
||||
'@deepseek-ai/dsh-experimental-client-ui-voice-input',
|
||||
'@deepseek-ai/dsh-experimental-computer-use-cua-driver-mcp',
|
||||
'@deepseek-ai/dsh-experimental-computer-use-cua-driver-native',
|
||||
'@deepseek-ai/dsh-experimental-cot-translation-bundle',
|
||||
'@deepseek-ai/dsh-creation-recommendations',
|
||||
'@deepseek-ai/dsh-cua-bundle',
|
||||
'@deepseek-ai/dsh-experimental-cua-macos',
|
||||
'@deepseek-ai/dsh-cua',
|
||||
@@ -78,6 +83,7 @@ describe('release families', () => {
|
||||
'@deepseek-ai/dsh-experimental-inspector-profile',
|
||||
'@deepseek-ai/dsh-experimental-inspector',
|
||||
'@deepseek-ai/dsh-experimental-plugin-market-bundle',
|
||||
'@deepseek-ai/dsh-plugin-recommendations',
|
||||
'@deepseek-ai/dsh-experimental-ptc-runtime-python',
|
||||
'@deepseek-ai/dsh-experimental-ralph-bundle',
|
||||
'@deepseek-ai/dsh-experimental-session-inspector',
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
readClientBuildRecord,
|
||||
} from '../client-build-environment.ts'
|
||||
import { validateTarballPayload } from '../publication-payload.ts'
|
||||
import { ON_DEMAND_BUNDLES } from '../../packages/boot/app-boot/src/official-bundle-packages.ts'
|
||||
import { ON_DEMAND_BUNDLES } from '../../packages/util/official-bundles/src/bundles.ts'
|
||||
|
||||
/**
|
||||
* Dependency sections a consumer must publish after, because npm resolves them
|
||||
|
||||
@@ -4,7 +4,7 @@ import { existsSync, readFileSync, realpathSync } from 'node:fs'
|
||||
import { createRequire } from 'node:module'
|
||||
import { join } from 'node:path'
|
||||
import { hasExperimentalPackageReference } from '../experimental-package-policy.ts'
|
||||
import { OPTIONAL_BUNDLES } from '../../packages/boot/app-boot/src/profile.ts'
|
||||
import { OPTIONAL_BUNDLES } from '../../packages/util/official-bundles/src/bundles.ts'
|
||||
|
||||
interface InstalledManifest {
|
||||
name: string
|
||||
|
||||
@@ -102,6 +102,9 @@ const GENERIC_SKIPS: readonly GenericSkip[] = [
|
||||
{ file: 'apps/cli/tests/profiles/web/tests/fixtures/creator-plugin-manager.mjs', upstream: ['cordis'] },
|
||||
{ file: 'apps/web/tests/agent-preset-authoring.e2e.ts', upstream: ['cordis'] },
|
||||
{ file: 'packages/preset/agent-preset-registry/tests/session.spec.ts', upstream: ['cordis'] },
|
||||
{ file: 'packages/experimental/creation-recommendations/src/index.ts', upstream: ['cordis'] },
|
||||
{ file: 'packages/experimental/creation-recommendations/tests/creation.spec.ts', upstream: ['cordis'] },
|
||||
{ file: 'packages/experimental/creation-recommendations/tests/loader-composition.spec.ts', upstream: ['cordis'] },
|
||||
// Preset selection, reminder policy and UI copy use the same product id.
|
||||
{ file: 'apps/cli/tests/optional-bundle-transitions.e2e.ts', upstream: ['cordis'] },
|
||||
{ file: 'apps/web/tests/agent-preset-selection.e2e.ts', upstream: ['cordis'] },
|
||||
|
||||
@@ -392,8 +392,8 @@ function ciSharedStaticGates(): Gate[] {
|
||||
function i18nGates(includeDictionaries: boolean): Gate[] {
|
||||
return [
|
||||
pnpmScript('installer-locales', 'verify-installer-locales', { label: 'Windows installer locales' }),
|
||||
pnpmScript('locale-metadata', 'verify-locale-metadata', { label: 'Japanese plugin metadata' }),
|
||||
...includeDictionaries ? [pnpmExec('locale-dictionaries', ['vitest', 'run', 'scripts/locale-dictionary-parity.spec.ts'], { label: 'locale dictionaries' })] : [],
|
||||
pnpmScript('locale-metadata', 'verify-locale-metadata', { label: 'plugin locale metadata' }),
|
||||
...includeDictionaries ? [pnpmExec('locale-dictionaries', ['vitest', 'run', 'scripts/locale-dictionary-parity.spec.ts', 'scripts/shipped-locales.spec.ts', 'packages/client/locale/tests/apply.client.spec.ts'], { label: 'locale dictionaries' })] : [],
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import * as desktop from '../apps/desktop/src/locale.ts'
|
||||
import { readInstallerLocales } from '../apps/desktop/scripts/installer-locales.mjs'
|
||||
/** Translations preserve executable command examples and named interpolation fields. */
|
||||
import { expect, it } from 'vitest'
|
||||
import { SHIPPED_LOCALE_IDS, localeTokens, hasInvisibleLocaleCharacters } from './shipped-locales.ts'
|
||||
|
||||
it('retains repeated placeholders, commands, and API identifiers', () => {
|
||||
expect(localeTokens('Use /plan off, /compact and /THEME=dark with {count}, {count} and reasoning_effort.'))
|
||||
.toEqual(['/THEME=dark', '/compact', '/plan off', 'reasoning_effort', '{count}', '{count}'])
|
||||
})
|
||||
|
||||
it('ignores translated prose and non-command slashes', () => {
|
||||
expect(localeTokens('Cmd/Ctrl+Enter · tok/s · https://example.test/v1')).toEqual([])
|
||||
expect(localeTokens('Используйте /plan off и {count}'))
|
||||
.toEqual(localeTokens('Use /plan off and {count}'))
|
||||
})
|
||||
|
||||
it.each([['/plan off', '/plan désactivé'], ['/THEME=light', '/THEME=claro'], ['reasoning_effort', 'Reasoning_effort'], ['{count}', '{other}']])('detects a change from %s to %s', (source, translated) => {
|
||||
expect(localeTokens(translated)).not.toEqual(localeTokens(source))
|
||||
})
|
||||
|
||||
it('recognizes commands at the start of copy or after CJK punctuation', () => {
|
||||
expect(localeTokens('/THEME=auto、/THEME=light')).toEqual(['/THEME=auto', '/THEME=light'])
|
||||
})
|
||||
|
||||
it.each(['\u200b', '\ufeff'])('rejects an invisible translation character', (character) => {
|
||||
expect(hasInvisibleLocaleCharacters(`text${character}text`)).toBe(true)
|
||||
expect(hasInvisibleLocaleCharacters('normal text')).toBe(false)
|
||||
})
|
||||
|
||||
it('matches Desktop dictionaries, resolution and installer resources to the shipped catalog', () => {
|
||||
const dictionaries = Object.keys(desktop).filter(name => /^[a-z]{2}$/u.test(name)).sort()
|
||||
expect(dictionaries).toEqual([...SHIPPED_LOCALE_IDS].sort())
|
||||
for (const id of SHIPPED_LOCALE_IDS) {
|
||||
expect(desktop.resolveDesktopLocale(id).id).toBe(id === 'zh' ? 'zh-CN' : id)
|
||||
expect(desktop.resolveDesktopStartupLocale(null, [id]).id).toBe(id === 'zh' ? 'zh-CN' : id)
|
||||
}
|
||||
expect(readInstallerLocales().map(locale => locale.id.split('_')[0]).sort()).toEqual(dictionaries)
|
||||
})
|
||||
|
||||
it('rejects invisible characters in the Desktop locale source', () => {
|
||||
expect(hasInvisibleLocaleCharacters(readFileSync(new URL('../apps/desktop/src/locale.ts', import.meta.url), 'utf8'))).toBe(false)
|
||||
})
|
||||
@@ -0,0 +1,23 @@
|
||||
/** Languages whose UI dictionaries and package metadata ship with Harness. */
|
||||
export const SHIPPED_LOCALE_IDS = ['en', 'zh', 'ja', 'es', 'fr', 'de', 'ru', 'pt'] as const
|
||||
|
||||
/** Locale id required by repository translation checks. */
|
||||
export type ShippedLocaleId = typeof SHIPPED_LOCALE_IDS[number]
|
||||
|
||||
/**
|
||||
* Extract copy tokens that translations must preserve verbatim.
|
||||
* @param text - Dictionary text containing placeholders, slash commands or API field names.
|
||||
* @returns Sorted tokens, retaining repeated occurrences.
|
||||
*/
|
||||
export function localeTokens(text: string): string[] {
|
||||
return (text.match(/\{\w+\}|(?<![A-Za-z0-9/])\/[A-Za-z][\w-]*(?:=[\w-]+| (?:on|off))?|\b[a-z]+_[a-z_]+\b/gu) ?? []).sort()
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect translation-service artifacts that must not enter locale resources.
|
||||
* @param text - Raw resource or localized text.
|
||||
* @returns Whether the text contains a zero-width space or byte-order mark.
|
||||
*/
|
||||
export function hasInvisibleLocaleCharacters(text: string): boolean {
|
||||
return /[\u200b\ufeff]/u.test(text)
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/** Unit suites cannot reach the official DeepSeek model listing unless they answer `fetch` themselves. */
|
||||
import { createServer } from 'node:http'
|
||||
import { afterEach, expect, it } from 'vitest'
|
||||
import type { Server } from 'node:http'
|
||||
|
||||
const servers: Server[] = []
|
||||
afterEach(async () => {
|
||||
await Promise.all(servers.splice(0).map(server => new Promise(resolve => server.close(resolve))))
|
||||
})
|
||||
|
||||
it.each([
|
||||
['string', () => fetch('https://api.deepseek.com/models')],
|
||||
['URL', () => fetch(new URL('https://api.deepseek.com/models'))],
|
||||
['Request', () => fetch(new Request('https://api.deepseek.com/models', { headers: { 'x-api-key': 'fixture-key' } }))],
|
||||
])('rejects the official model listing given as a %s', async (_kind, request) => {
|
||||
await expect(request()).rejects.toThrow('unit suites do not reach https://api.deepseek.com/models; answer it with a fetch stub')
|
||||
})
|
||||
|
||||
it('passes every other request to the ambient fetch', async () => {
|
||||
const server = createServer((_request, response) => { response.end('local') })
|
||||
servers.push(server)
|
||||
await new Promise<void>(resolve => server.listen(0, '127.0.0.1', resolve))
|
||||
const address = server.address()
|
||||
if (address === null || typeof address === 'string') throw new Error('no port')
|
||||
await expect((await fetch(`http://127.0.0.1:${address.port}/models`)).text()).resolves.toBe('local')
|
||||
})
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Keep unit suites from requesting the official DeepSeek model listing.
|
||||
*
|
||||
* The API-key and account routes request `GET https://api.deepseek.com/models` whenever they hold a
|
||||
* credential for the official endpoint, and suites routinely boot those routes with a dummy key or
|
||||
* inherit a developer's real one. Such a request would reach production and, on a network that never
|
||||
* answers, hold the route's first catalog access for its whole listing deadline. Here it fails at once,
|
||||
* so the route serves its built-in catalog; a suite that exercises the listing replaces `fetch` itself.
|
||||
* @module
|
||||
*/
|
||||
|
||||
/** The listing endpoint of the official DeepSeek API. */
|
||||
const OFFICIAL_LISTING = 'https://api.deepseek.com/models'
|
||||
|
||||
const ambientFetch = globalThis.fetch
|
||||
globalThis.fetch = (input, init) => {
|
||||
const url = input instanceof Request ? input.url : input instanceof URL ? input.href : input
|
||||
if (url === OFFICIAL_LISTING) {
|
||||
return Promise.reject(new TypeError(`unit suites do not reach ${OFFICIAL_LISTING}; answer it with a fetch stub`))
|
||||
}
|
||||
return ambientFetch(input, init)
|
||||
}
|
||||
@@ -49,10 +49,12 @@ function evaluateCondition(expression: string, cancelled: boolean, results: stri
|
||||
}, { timeout: 1000 }) as boolean
|
||||
}
|
||||
|
||||
const verdicts = [['ci.yml', 'all-checks-passed'], ['ci-windows.yml', 'windows-checks-passed'], ['ci-python.yml', 'python-checks-passed']] as const
|
||||
|
||||
describe('master-only platform scheduling', () => {
|
||||
it.each(['success', 'failure', 'skipped', 'cancelled'])(
|
||||
'reports %s dependencies in active runs but never starts a cancelled-run verdict', (result) => {
|
||||
const aggregate = workflow('ci.yml').jobs['all-checks-passed']!
|
||||
it.each(verdicts.flatMap(([file, job]) => ['success', 'failure', 'skipped', 'cancelled'].map(result => [file, job, result] as const)))(
|
||||
'%s %s reports %s dependencies in active runs but never starts a cancelled-run verdict', (file, job, result) => {
|
||||
const aggregate = workflow(file).jobs[job]!
|
||||
const results = aggregate.needs!.map(() => 'success')
|
||||
results[0] = result
|
||||
const condition = aggregate.if as string
|
||||
@@ -72,8 +74,8 @@ describe('master-only platform scheduling', () => {
|
||||
expect(evaluateCondition(workflow('ci.yml').jobs['all-checks-passed']!.if as string, true, ['success'])).toBe(false)
|
||||
})
|
||||
|
||||
it('keeps only Linux and Windows x64 runtimes in required PR CI', () => {
|
||||
const pr = workflow('ci.yml')
|
||||
it('keeps the required Python PR verdict and its two x64 targets in CI Python', () => {
|
||||
const pr = workflow('ci-python.yml')
|
||||
expect(Object.keys(pr.on)).toEqual(['pull_request'])
|
||||
expect(pr.jobs['python-runtime']).toMatchObject({
|
||||
if: "github.event_name == 'pull_request'",
|
||||
@@ -82,7 +84,7 @@ describe('master-only platform scheduling', () => {
|
||||
})
|
||||
expect(pr.jobs.windows).toBeUndefined()
|
||||
expect(JSON.stringify(pr.jobs)).not.toMatch(/wine-windows-gates|check:windows-wine/)
|
||||
const aggregate = pr.jobs['all-checks-passed']!
|
||||
const aggregate = pr.jobs['python-checks-passed']!
|
||||
expect(aggregate.needs).toContain('python-runtime')
|
||||
expect(aggregate.needs).not.toContain('windows')
|
||||
expect(aggregate.needs!.every(id => id in pr.jobs)).toBe(true)
|
||||
@@ -90,6 +92,9 @@ describe('master-only platform scheduling', () => {
|
||||
expect(aggregate.steps).toContainEqual(expect.objectContaining({
|
||||
if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')",
|
||||
}))
|
||||
for (const file of ['ci.yml', 'ci-windows.yml']) {
|
||||
expect(workflow(file).jobs['python-runtime']).toBeUndefined()
|
||||
}
|
||||
})
|
||||
|
||||
it('runs all three deferred carriers on master pushes with fail-loud API credentials', () => {
|
||||
|
||||
@@ -307,6 +307,11 @@
|
||||
"symbol": "LegacyScheduleRecord",
|
||||
"source": "packages/schedule/schedule/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/schedule.md",
|
||||
"symbol": "ScheduleDeleteInactiveResult",
|
||||
"source": "packages/schedule/schedule/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/schedule.md",
|
||||
"symbol": "LocalAtInput",
|
||||
@@ -1951,6 +1956,16 @@
|
||||
"symbol": "WebRoute",
|
||||
"source": "packages/host/webserver/src/index.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/web-server.md",
|
||||
"symbol": "WebResource",
|
||||
"source": "packages/host/webserver/src/index.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/web-server.md",
|
||||
"symbol": "WebResourceRoute",
|
||||
"source": "packages/host/webserver/src/index.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/web-server.md",
|
||||
"symbol": "Config",
|
||||
|
||||
@@ -50,7 +50,7 @@ export function findConcreteTermViolations(file: string, source: string): Concre
|
||||
}
|
||||
|
||||
function trackedFiles(repoRoot: string): string[] {
|
||||
const files = execFileSync('git', ['ls-files', '-z'], { cwd: repoRoot, encoding: 'utf8' })
|
||||
const files = execFileSync('git', ['ls-files', '-z'], { cwd: repoRoot, encoding: 'utf8', maxBuffer: 16 * 1024 * 1024 })
|
||||
.split('\0')
|
||||
.filter(file => file !== '')
|
||||
if (!files.includes('AGENTS.md')
|
||||
|
||||
@@ -13,7 +13,7 @@ const roots: string[] = []
|
||||
const experimental = '@deepseek-ai/dsh-experimental-prototype'
|
||||
const core = '@deepseek-ai/dsh-core'
|
||||
const base = '@deepseek-ai/dsh-base'
|
||||
const profile = 'packages/boot/app-boot/src/profile.ts'
|
||||
const profile = 'packages/util/official-bundles/src/bundles.ts'
|
||||
const preset = 'packages/bundle/web-app/presets/standard.patch.yml'
|
||||
const patch = 'packages/bundle/base/cordis.patch.yml'
|
||||
|
||||
@@ -488,6 +488,6 @@ describe('default product isolation', () => {
|
||||
])('rejects absent, empty, or uninspectable default profile definitions', (source) => {
|
||||
const root = fixture()
|
||||
write(root, profile, source)
|
||||
expect(() => verifyDefaultProductIsolation(root)).toThrow('profile')
|
||||
expect(() => verifyDefaultProductIsolation(root)).toThrow(`${profile}: `)
|
||||
})
|
||||
})
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
import { isExperimentalPackageName } from './experimental-package-policy.ts'
|
||||
// The independently published entry package owns platform-engine dependencies.
|
||||
const EXTERNAL_KIT_PACKAGES = new Set(['@deepseek-ai/libreoffice-kit'])
|
||||
const PROFILE_SOURCE = 'packages/boot/app-boot/src/profile.ts'
|
||||
const PROFILE_SOURCE = 'packages/util/official-bundles/src/bundles.ts'
|
||||
const PRESET_PATTERN = 'packages/bundle/web-app/presets/*.patch.yml'
|
||||
const RUNTIME_SECTIONS = ['dependencies', 'optionalDependencies', 'peerDependencies'] as const
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
/** Metadata coverage rejects missing translations through the same checker used by CI. */
|
||||
import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs'
|
||||
import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, rmSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { afterEach, expect, it } from 'vitest'
|
||||
import { localeMetadataProblems } from './verify-locale-metadata.ts'
|
||||
|
||||
import { SHIPPED_LOCALE_IDS } from './shipped-locales.ts'
|
||||
|
||||
const roots: string[] = []
|
||||
afterEach(() => { for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true }) })
|
||||
|
||||
@@ -16,6 +18,9 @@ function fixture(ja: unknown = { meta: { title: '名前 {name}', description: '
|
||||
writeFileSync(join(directory, 'en.json'), JSON.stringify({ meta: { title: 'Name {name}' } }))
|
||||
writeFileSync(join(directory, 'zh.json'), JSON.stringify({ meta: { title: '名称 {name}', description: '描述' } }))
|
||||
writeFileSync(join(directory, 'ja.json'), JSON.stringify(ja))
|
||||
for (const language of ['es', 'fr', 'de', 'ru', 'pt']) {
|
||||
writeFileSync(join(directory, `${language}.json`), JSON.stringify({ meta: { title: 'Name {name}', description: 'Localized description.' } }))
|
||||
}
|
||||
return root
|
||||
}
|
||||
|
||||
@@ -41,8 +46,8 @@ it.each([
|
||||
it('checks referenced detail documents', () => {
|
||||
const root = fixture()
|
||||
const directory = join(root, 'packages/demo/plugin/locale')
|
||||
const meta = { title: 'Name {name}', description: 'Description.', detail: 'docs/DETAIL.md' }
|
||||
for (const language of ['en', 'zh', 'ja']) writeFileSync(join(directory, `${language}.json`), JSON.stringify({ meta }))
|
||||
const meta = { title: 'Name {name}', detail: 'docs/DETAIL.md' }
|
||||
for (const language of SHIPPED_LOCALE_IDS) writeFileSync(join(directory, `${language}.json`), JSON.stringify({ meta }))
|
||||
expect(localeMetadataProblems(root).join('\n')).toContain('missing detail resource')
|
||||
mkdirSync(join(directory, '../docs'))
|
||||
writeFileSync(join(directory, '../docs/DETAIL.md'), '# Detail\n')
|
||||
@@ -84,6 +89,7 @@ it('checks nested subpath locale resources and package-relative detail files', (
|
||||
expect(localeMetadataProblems(root).join('\n')).toContain('locale/tools')
|
||||
expect(localeMetadataProblems(root).join('\n')).toContain('ja.json')
|
||||
writeFileSync(join(directory, 'ja.json'), JSON.stringify({ meta: { title: 'ツール', detail: 'docs/TOOLS.md' } }))
|
||||
for (const language of ['es', 'fr', 'de', 'ru', 'pt']) writeFileSync(join(directory, `${language}.json`), JSON.stringify({ meta: { title: 'Tools', detail: 'docs/TOOLS.md' } }))
|
||||
expect(localeMetadataProblems(root)).toEqual([])
|
||||
})
|
||||
|
||||
@@ -97,7 +103,7 @@ it('requires sentence punctuation for English descriptions', () => {
|
||||
const file = join(root, 'packages/demo/plugin/locale/en.json')
|
||||
writeFileSync(file, JSON.stringify({ meta: { title: 'Name {name}', description: 'Description' } }))
|
||||
expect(localeMetadataProblems(root).join('\n')).toContain('sentence punctuation')
|
||||
writeFileSync(file, JSON.stringify({ meta: { title: 'Name {name}', description: 'Description.' } }))
|
||||
writeFileSync(file, JSON.stringify({ meta: { title: 'Name {name}', description: 'English description.' } }))
|
||||
expect(localeMetadataProblems(root)).toEqual([])
|
||||
})
|
||||
|
||||
@@ -108,6 +114,7 @@ it('permits missing Chinese resources for loadable plugins', () => {
|
||||
writeFileSync(join(directory, 'src/index.ts'), 'export function apply() {}')
|
||||
writeFileSync(join(directory, 'package.json'), JSON.stringify({ name: '@deepseek-ai/dsh-demo' }))
|
||||
rmSync(join(directory, 'locale/zh.json'))
|
||||
for (const language of ['es', 'fr', 'de', 'ru', 'pt']) writeFileSync(join(directory, `locale/${language}.json`), JSON.stringify({ meta: { title: 'Name {name}' } }))
|
||||
expect(localeMetadataProblems(root)).toEqual([])
|
||||
})
|
||||
|
||||
@@ -119,3 +126,30 @@ it('excludes packages formally classified as test helpers', () => {
|
||||
writeFileSync(join(directory, 'package.json'), JSON.stringify({ name: '@deepseek-ai/dsh-llm-replay' }))
|
||||
expect(localeMetadataProblems(root)).toEqual([])
|
||||
})
|
||||
|
||||
it.each(['es', 'fr', 'de', 'ru', 'pt'])('rejects missing %s metadata', (language) => {
|
||||
const root = fixture()
|
||||
rmSync(join(root, `packages/demo/plugin/locale/${language}.json`))
|
||||
expect(localeMetadataProblems(root).join('\n')).toContain(`${language}.json`)
|
||||
})
|
||||
|
||||
it.each(['es', 'fr', 'de', 'ru', 'pt'])('rejects untranslated Chinese descriptions in %s metadata', (language) => {
|
||||
const root = fixture()
|
||||
writeFileSync(join(root, 'packages/demo/plugin/locale/en.json'), JSON.stringify({ meta: { title: 'Name {name}', description: 'English description.' } }))
|
||||
writeFileSync(join(root, `packages/demo/plugin/locale/${language}.json`), JSON.stringify({ meta: { title: 'Name {name}', description: '描述' } }))
|
||||
expect(localeMetadataProblems(root).join('\n')).toContain(`${language}.json: meta.description contains untranslated source text`)
|
||||
})
|
||||
|
||||
it.each(['es', 'fr', 'de', 'ru', 'pt'])('rejects copied English descriptions in %s metadata', (language) => {
|
||||
const root = fixture()
|
||||
writeFileSync(join(root, 'packages/demo/plugin/locale/en.json'), JSON.stringify({ meta: { title: 'Name {name}', description: 'English description.' } }))
|
||||
writeFileSync(join(root, `packages/demo/plugin/locale/${language}.json`), JSON.stringify({ meta: { title: 'Name {name}', description: 'English description.' } }))
|
||||
expect(localeMetadataProblems(root).join('\n')).toContain(`${language}.json: meta.description contains untranslated source text`)
|
||||
})
|
||||
|
||||
it.each(['\u200b', '\ufeff', String.raw`\u200b`, String.raw`\ufeff`])('rejects invisible characters in JSON resources', (character) => {
|
||||
const root = fixture()
|
||||
const file = join(root, 'packages/demo/plugin/locale/es.json')
|
||||
writeFileSync(file, readFileSync(file, 'utf8').replace('Localized description.', `Localized${character} description.`))
|
||||
expect(localeMetadataProblems(root).join('\n')).toContain('invisible locale character')
|
||||
})
|
||||
@@ -1,8 +1,9 @@
|
||||
/** Check Japanese coverage of package metadata and plugin templates without loading plugins. */
|
||||
/** Check shipped-language coverage of package metadata and plugin templates without loading plugins. */
|
||||
import { existsSync, globSync, readFileSync } from 'node:fs'
|
||||
import { basename, posix, join, resolve } from 'node:path'
|
||||
import { detailPath } from '../packages/util/plugin-detail/src/document.ts'
|
||||
import { PRODUCT_PACKAGE_POLICY } from './product-package-policy.ts'
|
||||
import { SHIPPED_LOCALE_IDS, localeTokens, hasInvisibleLocaleCharacters } from './shipped-locales.ts'
|
||||
import { collectConfigCatalog } from './gen-config-catalog.ts'
|
||||
|
||||
/** Flatten metadata strings and reject values that cannot be translated. */
|
||||
@@ -13,14 +14,14 @@ function strings(value: unknown, key = ''): Record<string, string> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare Japanese metadata with every field supplied by English or Chinese.
|
||||
* Compare shipped-language metadata with every field supplied by English or Chinese.
|
||||
* @param root - repository or fixture root.
|
||||
* @returns actionable missing-file, field, placeholder and resource diagnostics.
|
||||
*/
|
||||
export function localeMetadataProblems(root: string): string[] {
|
||||
const directories = new Set(globSync('packages/**/locale/**/*.json', {
|
||||
cwd: root, exclude: ['packages/**/node_modules/**', 'packages/**/lib/**', 'packages/**/tests/**'],
|
||||
}).map(file => file.replaceAll('\\', '/')).filter(file => ['en.json', 'zh.json', 'ja.json'].includes(basename(file))).map(file => posix.dirname(file)))
|
||||
}).map(file => file.replaceAll('\\', '/')).filter(file => SHIPPED_LOCALE_IDS.some(language => basename(file) === `${language}.json`)).map(file => posix.dirname(file)))
|
||||
for (const entry of collectConfigCatalog(root)) {
|
||||
const dir = entry.dir.replaceAll('\\', '/')
|
||||
if (PRODUCT_PACKAGE_POLICY[dir]?.category === 'test') continue
|
||||
@@ -34,7 +35,9 @@ export function localeMetadataProblems(root: string): string[] {
|
||||
try {
|
||||
const read = (language: string): Record<string, string> => {
|
||||
const file = join(root, directory, `${language}.json`)
|
||||
const value: unknown = JSON.parse(readFileSync(file, 'utf8'))
|
||||
const source = readFileSync(file, 'utf8')
|
||||
if (hasInvisibleLocaleCharacters(source) || /\\u(?:200b|feff)/iu.test(source)) throw new Error(`${language}.json: invisible locale character`)
|
||||
const value: unknown = JSON.parse(source)
|
||||
const dictionary = strings(value)
|
||||
const detail = detailPath(dictionary['meta.detail'], `${directory}/${language}.json: meta.detail`)
|
||||
const packageDir = directory.slice(0, directory.lastIndexOf('/locale'))
|
||||
@@ -47,14 +50,20 @@ export function localeMetadataProblems(root: string): string[] {
|
||||
const zh = existsSync(join(root, directory, 'zh.json')) ? read('zh') : {}
|
||||
const description = en['meta.description']
|
||||
if (description !== undefined && !/[.!?]$/u.test(description)) problems.push(`${directory}/en.json: meta.description must end with sentence punctuation`)
|
||||
const ja = read('ja')
|
||||
const expected = { ...zh, ...en }
|
||||
for (const key of new Set([...Object.keys(expected), ...Object.keys(ja)])) {
|
||||
if (ja[key] === undefined) problems.push(`${directory}/ja.json: missing ${key}`)
|
||||
else if (expected[key] === undefined) problems.push(`${directory}/ja.json: unexpected ${key}`)
|
||||
else {
|
||||
const placeholders = (text: string): string => (text.match(/\{\w+\}/gu) ?? []).sort().join(',')
|
||||
if (placeholders(ja[key]) !== placeholders(expected[key])) problems.push(`${directory}/ja.json: ${key} changes placeholders`)
|
||||
for (const language of SHIPPED_LOCALE_IDS.filter(id => id !== 'en' && id !== 'zh')) {
|
||||
const translated = read(language)
|
||||
for (const key of new Set([...Object.keys(expected), ...Object.keys(translated)])) {
|
||||
if (translated[key] === undefined) problems.push(`${directory}/${language}.json: missing ${key}`)
|
||||
else if (expected[key] === undefined) problems.push(`${directory}/${language}.json: unexpected ${key}`)
|
||||
else {
|
||||
if (language !== 'ja' && key === 'meta.description' && ((zh[key] !== undefined && /\p{Script=Han}/u.test(zh[key]) && translated[key] === zh[key])
|
||||
|| (en[key] !== undefined && translated[key] === en[key]))) {
|
||||
problems.push(`${directory}/${language}.json: ${key} contains untranslated source text`)
|
||||
}
|
||||
const placeholders = (text: string): string => localeTokens(text).join(',')
|
||||
if (placeholders(translated[key]) !== placeholders(expected[key])) problems.push(`${directory}/${language}.json: ${key} changes placeholders or literal tokens`)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -68,5 +77,5 @@ if (import.meta.filename === resolve(process.argv[1] ?? '')) {
|
||||
const problems = localeMetadataProblems(resolve(import.meta.dirname, '..'))
|
||||
for (const problem of problems) console.error(problem)
|
||||
if (problems.length > 0) process.exitCode = 1
|
||||
else console.log('verify-locale-metadata: all package and template metadata has complete Japanese translations.')
|
||||
else console.log('verify-locale-metadata: all package and template metadata has complete shipped-language translations.')
|
||||
}
|
||||
@@ -37,6 +37,7 @@ const NO_MODEL_EXPERIENCE_SECTION: Readonly<Record<string, string>> = {
|
||||
'packages/util/launch-environment': 'The package only resolves host environment values; model-facing consumers own any rendered use.',
|
||||
'packages/util/workspace-path': 'The package only formats Workspace paths for browser UI; it never constructs model input.',
|
||||
'packages/util/values': 'The package only validates, snapshots, compares, freezes, or rejects caller-owned values; consumers own every model-facing use.',
|
||||
'packages/util/official-bundles': 'The package only lists bundle package names and their display metadata; the loaded plugin tree owns model context.',
|
||||
'packages/util/code-language': 'The package only maps a filename suffix to a syntax-highlighting language id; the read consumer owns the persisted hint.',
|
||||
}
|
||||
|
||||
@@ -55,6 +56,9 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
|
||||
'packages/experimental/speech-to-text-sensevoice': { kind: 'none', reason: 'Local recognition returns transient text without modifying model context.' },
|
||||
'packages/experimental/client-ui-voice-input': { kind: 'none', reason: 'Inserts reviewable text into the unsent draft without submitting to the Agent.' },
|
||||
'packages/experimental/plugin-market-bundle': { kind: 'indirect', reason: 'Mounts the pluginMarket service, which lets the Creator preset register the plugin_market tool documented in packages/boot/plugin-market.' },
|
||||
'packages/experimental/client-ui-action-cards': { kind: 'indirect', reason: 'Card actions go to the Host card service, which owns the logged tool, decisions and status notice.' },
|
||||
'packages/experimental/client-ui-creation-recommendations': { kind: 'indirect', reason: 'The page card body starts a Creator through the Host page kind; the Host owns its logged task.' },
|
||||
'packages/experimental/client-ui-plugin-recommendations': { kind: 'indirect', reason: 'The plugin card body enables through the Host plugin kind; the Host card service owns the logged tool, decisions and status notice.' },
|
||||
'packages/experimental/voice-input-bundle': { kind: 'none', reason: 'Composes dictation and preparation plugins without adding any model-facing contribution.' },
|
||||
'packages/telemetry/otel': { kind: 'none', reason: 'The service delivers caller-selected records without changing model context.' },
|
||||
'packages/host/product-telemetry-otel': { kind: 'none', reason: 'The plugin exports explicit analytics records without contributing model context.' },
|
||||
|
||||
@@ -13,8 +13,7 @@ const base = '@deepseek-ai/dsh-base'
|
||||
const core = '@deepseek-ai/dsh-core'
|
||||
const candidate = '@deepseek-ai/dsh-candidate'
|
||||
const candidateDir = 'packages/core/candidate'
|
||||
const profile = 'packages/boot/app-boot/src/profile.ts'
|
||||
const catalog = 'packages/boot/app-boot/src/official-bundle-packages.ts'
|
||||
const profile = 'packages/util/official-bundles/src/bundles.ts'
|
||||
const patch = 'packages/bundle/base/cordis.patch.yml'
|
||||
|
||||
function pkg(root: string, directory: string, name: string, fields: Record<string, unknown> = {}): void {
|
||||
@@ -29,10 +28,10 @@ function pkg(root: string, directory: string, name: string, fields: Record<strin
|
||||
}
|
||||
|
||||
function profiles(root: string, optional: string[] = [], onDemand: string[] = []): void {
|
||||
write(root, catalog, `export const ON_DEMAND_BUNDLES = ${JSON.stringify(onDemand)}\n`)
|
||||
write(root, profile, `export const PROFILE_TEMPLATES = ${JSON.stringify(Object.fromEntries(
|
||||
['web', 'acp', 'headless', 'sdk', 'sdk-minimal'].map(name => [name, { bundles: [base] }]),
|
||||
))}\nexport const DEFAULT_PROFILE_BUNDLES = ['${base}']\nexport const OPTIONAL_BUNDLES = ${JSON.stringify(optional)}\n`)
|
||||
))}\nexport const DEFAULT_PROFILE_BUNDLES = ['${base}']\nexport const OPTIONAL_BUNDLES = ${JSON.stringify(optional)}\n`
|
||||
+ `export const ON_DEMAND_BUNDLES = ${JSON.stringify(onDemand)}\n`)
|
||||
}
|
||||
|
||||
function fixture(): string {
|
||||
@@ -142,7 +141,7 @@ describe('product package use', () => {
|
||||
const root = fixture()
|
||||
pkg(root, candidateDir, candidate)
|
||||
const children = [{ name: candidate }]
|
||||
if (!initial) write(root, 'packages/boot/app-boot/src/included.yml', children)
|
||||
if (!initial) write(root, 'packages/util/official-bundles/src/included.yml', children)
|
||||
write(root, patch, [{ insert: [{ name: core }, {
|
||||
name: 'cordis:include', disabled: true, config: { path: './included.yml', ...(initial ? { initial: children } : {}) },
|
||||
}] }])
|
||||
@@ -162,12 +161,12 @@ describe('product package use', () => {
|
||||
it('applies Include patches before collecting runtime mounts and uses files ahead of initial entries', () => {
|
||||
const root = fixture()
|
||||
pkg(root, candidateDir, candidate)
|
||||
write(root, 'packages/boot/app-boot/src/included.yml', [{ id: 'child', name: candidate }])
|
||||
write(root, 'packages/util/official-bundles/src/included.yml', [{ id: 'child', name: candidate }])
|
||||
write(root, patch, [{ insert: [{ name: core }, { name: 'cordis:include', config: {
|
||||
path: './included.yml', initial: [{ name: candidate }], patches: [{ id: 'child', disabled: true }],
|
||||
} }] }])
|
||||
expect(failures(root)).toContain('no product runtime use')
|
||||
write(root, 'packages/boot/app-boot/src/included.yml', [])
|
||||
write(root, 'packages/util/official-bundles/src/included.yml', [])
|
||||
expect(failures(root)).toContain('no product runtime use')
|
||||
})
|
||||
|
||||
|
||||
@@ -14,8 +14,7 @@ import { isAgentPresetEntry, isCordisGroupEntry, loadCordisYaml } from './cordis
|
||||
import { PRODUCT_PACKAGE_POLICY, type ProductPackagePolicy } from './product-package-policy.ts'
|
||||
import { collectRuntimeLocalSourceSpecifiers, collectRuntimeSourceSpecifiers } from './verify-client-packages.ts'
|
||||
|
||||
const PROFILE_SOURCE = 'packages/boot/app-boot/src/profile.ts'
|
||||
const ON_DEMAND_SOURCE = 'packages/boot/app-boot/src/official-bundle-packages.ts'
|
||||
const PROFILE_SOURCE = 'packages/util/official-bundles/src/bundles.ts'
|
||||
const PROFILES = ['acp', 'web', 'headless', 'sdk', 'sdk-minimal']
|
||||
const PICKER_SOURCE = 'packages/host/directory-picker-auto/src/index.ts'
|
||||
const DYNAMIC_MOUNTS: Readonly<Record<string, readonly string[]>> = {
|
||||
@@ -188,11 +187,9 @@ export function verifyProductUse(
|
||||
const profileFile = ts.createSourceFile(profilePath, readFileSync(profilePath, 'utf8'), ts.ScriptTarget.Latest, true)
|
||||
const templates = literalDeclaration(profileFile, 'PROFILE_TEMPLATES')
|
||||
const fallback = stringList(literalDeclaration(profileFile, 'DEFAULT_PROFILE_BUNDLES'), PROFILE_SOURCE)
|
||||
const catalogPath = resolve(root, ON_DEMAND_SOURCE)
|
||||
const catalogFile = ts.createSourceFile(catalogPath, readFileSync(catalogPath, 'utf8'), ts.ScriptTarget.Latest, true)
|
||||
const optionals = [
|
||||
...stringList(literalDeclaration(profileFile, 'OPTIONAL_BUNDLES'), PROFILE_SOURCE),
|
||||
...stringList(literalDeclaration(catalogFile, 'ON_DEMAND_BUNDLES'), ON_DEMAND_SOURCE),
|
||||
...stringList(literalDeclaration(profileFile, 'ON_DEMAND_BUNDLES'), PROFILE_SOURCE),
|
||||
]
|
||||
if (!isRecord(templates)) throw new Error(`${PROFILE_SOURCE}: PROFILE_TEMPLATES must be a literal object`)
|
||||
for (const name of PROFILES) if (!isRecord(templates[name])) failures.push(`${PROFILE_SOURCE}: missing shipped ${name} profile`)
|
||||
|
||||
@@ -66,7 +66,7 @@ export function findUnavailableRepositoryReferences(file: string, source: string
|
||||
}
|
||||
|
||||
function trackedFiles(repoRoot: string): string[] {
|
||||
return execFileSync('git', ['ls-files', '-z'], { cwd: repoRoot, encoding: 'utf8' })
|
||||
return execFileSync('git', ['ls-files', '-z'], { cwd: repoRoot, encoding: 'utf8', maxBuffer: 16 * 1024 * 1024 })
|
||||
.split('\0')
|
||||
.filter(file => file !== '')
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user