Merge origin/master into xtr/runtime-context-reminders
This commit is contained in:
commit
beb5186e36
1948 files changed
+34090
-11121
No files matched your search
@@ -26,5 +26,7 @@ describe('Python runtime executable assets', () => {
|
||||
expect(result.stdout).not.toContain('skill-badge/assets/**/*')
|
||||
expect(result.stdout).toContain('node_modules/@deepseek-ai/dsh-sandbox-windows-acl/assets/**/*')
|
||||
expect(result.stdout).not.toContain('node_modules/**/*.py')
|
||||
// skill-office reads its SKILL.md files from the package's assets directory.
|
||||
expect(result.stdout).toContain('"node_modules/**/*.md"')
|
||||
})
|
||||
})
|
||||
@@ -179,7 +179,8 @@ describe('Python runtime executable builder CLI', () => {
|
||||
expect(result.stdout).toContain('exec pkg')
|
||||
expect(result.stdout).toContain('--sea --compress Brotli --targets node24-macos-x64')
|
||||
expect(result.stdout).toContain('keep only node-pty prebuilds darwin-x64')
|
||||
expect(result.stdout).toContain('lock optional resource downloads and copy Office skills')
|
||||
expect(result.stdout).toContain(`lock optional resource downloads in ${join(root, 'dist-exe', 'macos-x64')}`)
|
||||
expect(result.stdout).not.toContain('office-skills')
|
||||
expect(result.stdout).toContain(join(root, 'dist-exe', 'macos-x64'))
|
||||
})
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ import { resolveLinuxNodePtyAddon, resolveWindowsNodePtyAddons } from './executa
|
||||
import { officeSidecarArchives, runtimeNpmArchive, OFFICE_ASSET_IGNORES } from './build-exe-for-python-sdk-office.ts'
|
||||
import { syncPythonRuntimeProduct } from './build-exe-for-python-sdk-resources.ts'
|
||||
import { deduplicateStagedWorkspacePackages, materializeStagedLinks } from './build-exe-for-python-sdk-staging.ts'
|
||||
import { prepareOfficeSkillAssets } from './primary-runtime/prepare.ts'
|
||||
import primaryLock from './primary-runtime/lock.json' with { type: 'json' }
|
||||
|
||||
const root = resolve(import.meta.dirname, '..')
|
||||
@@ -71,6 +70,13 @@ const ASSET_GLOBS = [
|
||||
'node_modules/@deepseek-ai/dsh-sandbox-windows-acl/assets/**/*',
|
||||
]
|
||||
|
||||
/** Published source and documentation: types and maps already describe the runtime, so no load path needs them. */
|
||||
const PUBLISHED_PAYLOAD_IGNORES = [
|
||||
'**/node_modules/@deepseek-ai/dsh/src/**',
|
||||
'**/node_modules/@deepseek-ai/dsh-*/src/**',
|
||||
'**/node_modules/@deepseek-ai/dsh/docs/**',
|
||||
]
|
||||
|
||||
const PLATFORMS = ['linux', 'macos', 'win'] as const
|
||||
const ARCHES = ['x64', 'arm64'] as const
|
||||
type Platform = (typeof PLATFORMS)[number]
|
||||
@@ -342,6 +348,7 @@ class SingleExeBuild {
|
||||
const sourceModules = join(root, 'node_modules').replaceAll('\\', '/')
|
||||
const patch = { bin: ENTRY_BIN, pkg: { assets: ASSET_GLOBS, ignore: [
|
||||
...OFFICE_ASSET_IGNORES,
|
||||
...PUBLISHED_PAYLOAD_IGNORES,
|
||||
`${sourceModules}/**`, `${sourceModules}/.pnpm/**`,
|
||||
...['packages', 'apps', 'vendor', 'native', 'scripts'].map(directory => `${join(root, directory).replaceAll('\\', '/')}/**`),
|
||||
`${root.replaceAll('\\', '/')}/tsconfig*.json`,
|
||||
@@ -412,7 +419,7 @@ class SingleExeBuild {
|
||||
const ripgrep = await this.copyRipgrepSidecar(target, product)
|
||||
const resources = join(this.outDir, `${target.platform}-${target.arch}`)
|
||||
if (this.cli.dryRun) {
|
||||
console.log(`build-exe-for-python-sdk: [dry-run] lock optional resource downloads and copy Office skills to ${resources}`)
|
||||
console.log(`build-exe-for-python-sdk: [dry-run] lock optional resource downloads in ${resources}`)
|
||||
} else {
|
||||
await rm(resources, { recursive: true, force: true })
|
||||
await mkdir(resources, { recursive: true })
|
||||
@@ -422,7 +429,6 @@ class SingleExeBuild {
|
||||
const inputs = { version, target: `${target.platform === 'macos' ? 'mac' : target.platform}-${target.arch}`, office, pnpm }
|
||||
const identity = createHash('sha256').update(JSON.stringify({ ...inputs, primaryLock })).digest('hex')
|
||||
await writeFile(join(resources, 'downloads.json'), JSON.stringify({ ...inputs, identity }, undefined, 2) + '\n')
|
||||
await prepareOfficeSkillAssets(join(this.staging, 'node_modules/@deepseek-ai/dsh-skill-office/assets'), join(resources, 'office-skills'))
|
||||
}
|
||||
if (target.platform !== 'macos') return [product, ripgrep, resources]
|
||||
const spawnHelper = `${product}-spawn-helper`
|
||||
|
||||
@@ -313,16 +313,16 @@ describe('package payload constraints', () => {
|
||||
[{ import: './art/icon.svg', default: './art/fallback.svg' }, ['art/icon.svg', 'art/fallback.svg']],
|
||||
[['./art/icon.svg', './art/icon.svg'], ['art/icon.svg']],
|
||||
] as const)('includes exported icon targets in the canonical payload: %j', (icon, expected) => {
|
||||
expect(expectedDshPackageFiles({ exports: { './icon': icon } })).toEqual([...expected, 'lib/index.js', 'lib/types/**/*.d.ts'])
|
||||
expect(expectedDshPackageFiles({ exports: { './icon': icon } })).toEqual([...expected, 'lib/index.js', 'lib/types/**/*.d.ts', 'lib/types/**/*.d.ts.map', 'lib/**/*.js.map', 'src'])
|
||||
})
|
||||
|
||||
it.each(['icon.svg', './icon.svg'])('includes and deduplicates manifest icon %s', (icon) => {
|
||||
expect(expectedDshPackageFiles({ icon, exports: { './icon': './icon.svg' } })).toEqual(['icon.svg', 'lib/index.js', 'lib/types/**/*.d.ts'])
|
||||
expect(expectedDshPackageFiles({ icon, exports: { './icon': './icon.svg' } })).toEqual(['icon.svg', 'lib/index.js', 'lib/types/**/*.d.ts', 'lib/types/**/*.d.ts.map', 'lib/**/*.js.map', 'src'])
|
||||
})
|
||||
|
||||
it('includes manifest, root, and subpath icon targets', () => {
|
||||
expect(expectedDshPackageFiles({ icon: './legacy.svg', exports: { './icon': './fallback.svg', './search/icon': './search.svg' } })).toEqual([
|
||||
'legacy.svg', 'fallback.svg', 'search.svg', 'lib/index.js', 'lib/types/**/*.d.ts',
|
||||
'legacy.svg', 'fallback.svg', 'search.svg', 'lib/index.js', 'lib/types/**/*.d.ts', 'lib/types/**/*.d.ts.map', 'lib/**/*.js.map', 'src',
|
||||
])
|
||||
})
|
||||
|
||||
@@ -343,7 +343,7 @@ describe('package payload constraints', () => {
|
||||
{ exports: { './search/locale/*.json': './z/*.json', './locale/*.json': './a/*.json' }, resources: ['a/*.json', 'z/*.json'] },
|
||||
])('includes declared locale resources in the canonical payload: $exports', ({ exports, resources }) => {
|
||||
expect(expectedDshPackageFiles({ name: '@deepseek-ai/dsh-localized', exports })).toEqual([
|
||||
...resources, 'lib/index.js', 'lib/types/**/*.d.ts',
|
||||
...resources, 'lib/index.js', 'lib/types/**/*.d.ts', 'lib/types/**/*.d.ts.map', 'lib/**/*.js.map', 'src',
|
||||
])
|
||||
})
|
||||
|
||||
@@ -381,7 +381,7 @@ describe('package payload constraints', () => {
|
||||
const detailFiles = detailDocumentFiles(dir)
|
||||
expect(detailFiles).toEqual(['docs'])
|
||||
expect(expectedDshPackageFiles({ exports: { './locale/*.json': './locale/*.json' } }, detailFiles)).toEqual([
|
||||
'locale/*.json', 'docs', 'lib/index.js', 'lib/types/**/*.d.ts',
|
||||
'locale/*.json', 'docs', 'lib/index.js', 'lib/types/**/*.d.ts', 'lib/types/**/*.d.ts.map', 'lib/**/*.js.map', 'src',
|
||||
])
|
||||
})
|
||||
|
||||
@@ -422,7 +422,7 @@ describe('package payload constraints', () => {
|
||||
'./locale/zh.json': null,
|
||||
'./locale/fr.json': { types: './locale/fr.d.ts' },
|
||||
},
|
||||
})).toEqual(['lib/index.js', 'lib/types/**/*.d.ts'])
|
||||
})).toEqual(['lib/index.js', 'lib/types/**/*.d.ts', 'lib/types/**/*.d.ts.map', 'lib/**/*.js.map', 'src'])
|
||||
})
|
||||
|
||||
it.each(['team/agent-team', 'experimental/voice-input-bundle', 'experimental/auto-review', 'client/ui-agent-team', 'team/tool-agent-team'])(
|
||||
@@ -460,6 +460,9 @@ describe('package payload constraints', () => {
|
||||
'lib/index.js',
|
||||
'cordis.patch.yml',
|
||||
'lib/types/**/*.d.ts',
|
||||
'lib/types/**/*.d.ts.map',
|
||||
'lib/**/*.js.map',
|
||||
'src',
|
||||
])
|
||||
expect(expectedDshPackageFiles({
|
||||
name: '@deepseek-ai/dsh-private-profile',
|
||||
@@ -469,6 +472,9 @@ describe('package payload constraints', () => {
|
||||
'cordis.patch.yml',
|
||||
'layers/web.patch.yml',
|
||||
'lib/types/**/*.d.ts',
|
||||
'lib/types/**/*.d.ts.map',
|
||||
'lib/**/*.js.map',
|
||||
'src',
|
||||
])
|
||||
})
|
||||
|
||||
@@ -492,6 +498,7 @@ describe('package payload constraints', () => {
|
||||
},
|
||||
})).toEqual([
|
||||
'lib/index.js', 'lib/client.js', 'lib/client.node.js', 'lib/assets', 'lib/loader.js', 'lib/types/**/*.d.ts',
|
||||
'lib/types/**/*.d.ts.map', 'lib/**/*.js.map', 'src',
|
||||
])
|
||||
})
|
||||
|
||||
@@ -502,7 +509,7 @@ describe('package payload constraints', () => {
|
||||
{ './assets/extra': './lib/assets/*' },
|
||||
])('does not publish package assets without the exact asset export target: %j', (assets) => {
|
||||
expect(expectedDshPackageFiles({ exports: { './client': './lib/client.js', ...assets } }))
|
||||
.toEqual(['lib/index.js', 'lib/client.js', 'lib/types/**/*.d.ts'])
|
||||
.toEqual(['lib/index.js', 'lib/client.js', 'lib/types/**/*.d.ts', 'lib/types/**/*.d.ts.map', 'lib/**/*.js.map', 'src'])
|
||||
})
|
||||
|
||||
it('rejects a package-asset export whose payload omits the built assets', () => {
|
||||
@@ -517,7 +524,7 @@ describe('package payload constraints', () => {
|
||||
'./client': { types: './lib/types/client/index.d.ts', default: './lib/client.js' },
|
||||
'./assets/*': './lib/assets/*',
|
||||
},
|
||||
files: ['lib/index.js', 'lib/client.js', 'lib/assets', 'lib/types/**/*.d.ts'],
|
||||
files: ['lib/index.js', 'lib/client.js', 'lib/assets', 'lib/types/**/*.d.ts', 'lib/types/**/*.d.ts.map', 'lib/**/*.js.map', 'src'],
|
||||
peerDependencies: { '@deepseek-ai/cordis': 'workspace:~' },
|
||||
devDependencies: { '@deepseek-ai/cordis': 'workspace:~' },
|
||||
} satisfies WorkspaceManifest['manifest']
|
||||
@@ -526,7 +533,7 @@ describe('package payload constraints', () => {
|
||||
expect(payloadErrors(manifest)).toEqual([])
|
||||
expect(payloadErrors({ ...manifest, files: manifest.files.filter(file => file !== 'lib/assets') })).toEqual([
|
||||
expect.stringContaining('@deepseek-ai/dsh-client-probe: package.json files must be '
|
||||
+ '["lib/index.js","lib/client.js","lib/assets","lib/types/**/*.d.ts"]'),
|
||||
+ '["lib/index.js","lib/client.js","lib/assets","lib/types/**/*.d.ts","lib/types/**/*.d.ts.map","lib/**/*.js.map","src"]'),
|
||||
])
|
||||
})
|
||||
|
||||
@@ -546,7 +553,7 @@ it('publishes CLI runtime declarations and rejects a payload that omits them', (
|
||||
const manifest = JSON.parse(readFileSync(new URL('../apps/cli/package.json', import.meta.url), 'utf8')) as WorkspaceManifest['manifest']
|
||||
expect(checkWorkspaceManifest({ dir: 'apps/cli', manifest })).toEqual([])
|
||||
expect(checkWorkspaceManifest({ dir: 'apps/cli', manifest: { ...manifest, files: ['lib/*.js'] } }))
|
||||
.toEqual([expect.stringContaining('@deepseek-ai/dsh: package.json files must be ["lib/*.js","lib/types/*.d.ts"]')])
|
||||
.toEqual([expect.stringContaining('@deepseek-ai/dsh: package.json files must be ["lib/*.js","lib/*.js.map","lib/types/*.d.ts","lib/types/*.d.ts.map","docs","src"]')])
|
||||
})
|
||||
|
||||
it('requires the shared Web injection entry in the published payload', () => {
|
||||
@@ -626,7 +633,7 @@ it('requires the OAR license while rejecting unrelated payload files', () => {
|
||||
const manifest = JSON.parse(readFileSync(new URL(`../${dir}/package.json`, import.meta.url), 'utf8')) as WorkspaceManifest['manifest']
|
||||
const files = [
|
||||
'icon.svg', 'locale/*.json', 'lib/index.js',
|
||||
'LICENSE-OAR', 'lib/types/**/*.d.ts',
|
||||
'LICENSE-OAR', 'lib/types/**/*.d.ts', 'lib/types/**/*.d.ts.map', 'lib/**/*.js.map', 'src',
|
||||
]
|
||||
expect(expectedDshPackageFiles(manifest)).toEqual(files)
|
||||
expect(checkWorkspaceManifest({ dir, manifest })).toEqual([])
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
LEGACY_PREFIXED_EXPERIMENTAL_PACKAGE_DIRECTORIES,
|
||||
PRIVATE_EXPERIMENTAL_PACKAGE_DIRECTORIES,
|
||||
} from './experimental-package-policy.ts'
|
||||
import { hasTypertRemoteNavigation, isForbiddenPublicationFile } from './publication-payload.ts'
|
||||
import { hasTypertRemoteNavigation } 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 { bundlePatchFiles } from '../packages/boot/app-boot/src/profile.ts'
|
||||
@@ -57,10 +57,6 @@ const publicNativePackages = new Set([
|
||||
'@deepseek-ai/node-addon-system-linux-arm64',
|
||||
'@deepseek-ai/node-addon-system-linux-x64',
|
||||
])
|
||||
/** Deliberate source payloads whose exact bytes are part of the package's audit surface. */
|
||||
const publicationSourceAllowlist: Readonly<Record<string, readonly string[]>> = {
|
||||
'@deepseek-ai/node-addon-system': ['src/main.c', 'src/flock.c'],
|
||||
}
|
||||
/** Public source home recorded in maintained package manifests. */
|
||||
const publishedRepositoryUrl = 'git+https://github.com/deepseek-ai/deepseek-harness.git'
|
||||
/** Packages that participate in the experimental policy. */
|
||||
@@ -79,14 +75,15 @@ const standardReleaseMemberDirectory = new RegExp(
|
||||
const desktopApplicationDirectory = 'apps/desktop'
|
||||
const localArtifactDirs = new Set(['node_modules'])
|
||||
const appPackageFiles: Readonly<Record<string, readonly string[]>> = {
|
||||
'@deepseek-ai/dsh': ['lib/*.js', 'lib/types/*.d.ts'],
|
||||
// Only `prepack` stages `docs`; every other reader of this directory sees
|
||||
// whatever the checkout holds.
|
||||
'@deepseek-ai/dsh': ['lib/*.js', 'lib/*.js.map', 'lib/types/*.d.ts', 'lib/types/*.d.ts.map', 'docs', 'src'],
|
||||
'@deepseek-ai/dsh-desktop-host': [
|
||||
'lib/index.js', 'lib/cli.js',
|
||||
],
|
||||
// Sourcemaps stay out by payload policy; the worker-preview surface
|
||||
// (dist/preview.html and dist/preview/) backs opt-in experimental
|
||||
// packages and is not published.
|
||||
'@deepseek-ai/dsh-web-frontend': ['dist', '!dist/**/*.map', '!dist/preview.html', '!dist/preview'],
|
||||
// The worker-preview surface (dist/preview.html and dist/preview/) backs
|
||||
// opt-in experimental packages and is not published.
|
||||
'@deepseek-ai/dsh-web-frontend': ['dist', '!dist/preview.html', '!dist/preview', 'src'],
|
||||
}
|
||||
|
||||
/** The subset of package.json fields this constraint check cares about. */
|
||||
@@ -364,6 +361,13 @@ export function expectedDshPackageFiles(manifest: PackageManifest, detailFiles:
|
||||
// declarations.
|
||||
...usesEmittedTreeDefaults(manifest) ? ['lib/types/**/*.js'] : [],
|
||||
'lib/types/**/*.d.ts',
|
||||
// A published declaration map plus `src` lets a consumer editor open the
|
||||
// implementation behind an exported declaration, and lets a plugin author
|
||||
// read it without a repository checkout.
|
||||
'lib/types/**/*.d.ts.map',
|
||||
// Every emitted map ships beside the JavaScript it describes, so a stack
|
||||
// frame or a debugger session resolves into the published `src`.
|
||||
'lib/**/*.js.map',
|
||||
...hasExportPair(manifest, './typert', './lib/typert.host.d.ts', './lib/typert.host.js')
|
||||
? ['lib/typert.host.js', 'lib/typert.host.d.ts']
|
||||
: [],
|
||||
@@ -371,8 +375,11 @@ export function expectedDshPackageFiles(manifest: PackageManifest, detailFiles:
|
||||
? ['lib/typert.client.js', 'lib/typert.client.d.ts']
|
||||
: [],
|
||||
...hasTypertRemoteNavigation(manifest)
|
||||
? ['lib/typert.remote-client.js', 'lib/typert.remote-client.d.ts']
|
||||
// The generated Remote declaration carries a `sourceMappingURL` its map
|
||||
// resolves, and that map resolves the Host method through `src`.
|
||||
? ['lib/typert.remote-client.js', 'lib/typert.remote-client.d.ts', 'lib/typert.remote-client.d.ts.map']
|
||||
: [],
|
||||
'src',
|
||||
]
|
||||
}
|
||||
|
||||
@@ -551,15 +558,6 @@ export function checkWorkspaceManifest({ dir, manifest }: WorkspaceManifest): st
|
||||
return errors
|
||||
}
|
||||
|
||||
if (manifest.name?.startsWith('@deepseek-ai/')) {
|
||||
const allowedSources = publicationSourceAllowlist[manifest.name] ?? []
|
||||
for (const file of manifest.files ?? []) {
|
||||
if (isForbiddenPublicationFile(file) && !allowedSources.includes(file)) {
|
||||
errors.push(`${label}: package.json files must not publish ${JSON.stringify(file)}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dir.startsWith('apps/') && dir !== desktopApplicationDirectory && dir !== pluginMarketGeneratorDirectory && manifest.name?.startsWith('@deepseek-ai/')) {
|
||||
const expectedFiles = appPackageFiles[manifest.name]
|
||||
if (expectedFiles === undefined) {
|
||||
|
||||
@@ -106,6 +106,8 @@ export class RepositoryCleaner {
|
||||
|
||||
await this.addIfPresent(targets, join(this.root, '.dsh-build'), canonicalRoot)
|
||||
await this.addIfPresent(targets, join(this.root, 'apps/desktop/.desktop-build'), canonicalRoot)
|
||||
// The CLI package's documentation copy: `prepack` writes it, `postpack` removes it.
|
||||
await this.addIfPresent(targets, join(this.root, 'apps/cli/docs'), canonicalRoot)
|
||||
|
||||
// These checks cover legacy root-level incremental state emitted by older configs.
|
||||
await this.addIfPresent(targets, join(this.root, '.typecheck'), canonicalRoot)
|
||||
|
||||
@@ -260,9 +260,10 @@ describe('client bundle package asset imports', () => {
|
||||
})
|
||||
const output = builds.flatMap(bundle => bundle.chunks).find(chunk => chunk.type === 'chunk' && chunk.fileName === 'client.js')
|
||||
const code = output?.type === 'chunk' ? output.code : ''
|
||||
expect(code).toContain(`require.asset(${JSON.stringify(WHALE_URL)})`)
|
||||
// The minifier may print either string quote.
|
||||
expect(code).toMatch(new RegExp(`require\\.asset\\(["\`]${WHALE_URL.replaceAll('.', '\\.')}["\`]\\)`))
|
||||
expect(code).not.toContain('__dshPackageAsset_')
|
||||
expect(code).toContain('"__dshPackageAsset("')
|
||||
expect(code).toMatch(/["`]__dshPackageAsset\(["`]/)
|
||||
} finally {
|
||||
for (const bundle of builds) await bundle[Symbol.asyncDispose]()
|
||||
}
|
||||
|
||||
@@ -206,8 +206,9 @@ describe('client bundle dynamic imports', () => {
|
||||
if (config === undefined) throw new Error('client config missing')
|
||||
|
||||
const output = await clientChunkOutput(root, config, 'client.js')
|
||||
expect(output).toContain('require.async("./client.terminal.js")')
|
||||
expect(output).not.toContain('Promise.resolve().then(() => require("./client.terminal.js"))')
|
||||
// The compressor rewrites string literals, so the quotes are not part of the contract.
|
||||
expect(output).toMatch(/require\.async\((["'`])\.\/client\.terminal\.js\1\)/)
|
||||
expect(output).not.toMatch(/Promise\.resolve\(\)\.then\(\(\)\s*=>\s*require\((["'`])\.\/client\.terminal\.js\1\)\)/)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -626,7 +627,7 @@ describe('client bundle debug artifacts', () => {
|
||||
const resolved = new URL(workspaceSource, 'https://dsh.test/plugins/@deepseek-ai/dsh-client-connection/client.js.map')
|
||||
expect(resolved.pathname).toBe('/packages/client/connection/src/rpc.ts')
|
||||
|
||||
const dependencySource = '../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/index.js'
|
||||
const dependencySource = '../../../../node_modules/.pnpm/zod@4.6.6/node_modules/zod/index.js'
|
||||
expect(transform(dependencySource, sourceMapPath)).toBe(dependencySource)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -48,6 +48,11 @@ export const coverageExemptHeavySuites: readonly CoverageExemptSuite[] = [
|
||||
{ filter: 'scripts/install-lefthook.spec.ts', exclude: 'scripts/install-lefthook.spec.ts' },
|
||||
{ filter: 'scripts/oxlint-contract.spec.ts', exclude: 'scripts/oxlint-contract.spec.ts' },
|
||||
{ filter: 'scripts/change-scope.spec.ts', exclude: 'scripts/change-scope.spec.ts' },
|
||||
// Repository compiler scans measure scripts/ sources only. The epoch-header
|
||||
// suite also calls the v3-to-v4 admission guard, covered by its package tests.
|
||||
{ filter: 'scripts/persistence-schema.spec.ts', exclude: 'scripts/persistence-schema.spec.ts' },
|
||||
{ filter: 'scripts/persistence-epoch-header.spec.ts', exclude: 'scripts/persistence-epoch-header.spec.ts' },
|
||||
{ filter: 'scripts/gen-client-catalog.spec.ts', exclude: 'scripts/gen-client-catalog.spec.ts' },
|
||||
// Built-artifact proof. Packer/runtime src is threshold-excluded, and the
|
||||
// suite self-skips on unbuilt checkouts; the serial-windows complete
|
||||
// reference still starts this uninstrumented gate after its build gate, so
|
||||
|
||||
@@ -19,9 +19,10 @@ export function expectDesktopArchive<S extends { uses?: string; with?: Record<st
|
||||
const uploads = job.steps.filter(step => step.uses?.startsWith('actions/upload-artifact@'))
|
||||
expect(uploads).toHaveLength(count)
|
||||
for (const step of uploads) {
|
||||
expect(step.with?.name).toContain('${{ needs.package.outputs.version }}')
|
||||
expect(step.with?.name).toContain('${{ needs.package.outputs.attempt }}')
|
||||
expect(step.with?.name).not.toContain('github.run_attempt')
|
||||
expect(step.with?.name).toBe('${{ env.DESKTOP_ARCHIVE_NAME }}')
|
||||
expect(job.env.DESKTOP_ARCHIVE_NAME).toContain('${{ needs.package.outputs.version }}')
|
||||
expect(job.env.DESKTOP_ARCHIVE_NAME).toContain('${{ needs.package.outputs.attempt }}')
|
||||
expect(job.env.DESKTOP_ARCHIVE_NAME).not.toContain('github.run_attempt')
|
||||
}
|
||||
return uploads
|
||||
}
|
||||
@@ -1,29 +1,24 @@
|
||||
/** Exercise the wheel's Office API and model-shell commands from a shipped profile. */
|
||||
import { readFile, writeFile } from 'node:fs/promises'
|
||||
import { execFile } from 'node:child_process'
|
||||
import { promisify } from 'node:util'
|
||||
/** Exercise the downloaded sidecar's Kit through the Host Office kit and directly from a shipped profile. */
|
||||
import { copyFile, readFile, writeFile } from 'node:fs/promises'
|
||||
import { createConverter } from '@deepseek-ai/libreoffice-kit'
|
||||
|
||||
export const name = 'python-sdk-office-smoke'
|
||||
|
||||
export async function apply(ctx, config) {
|
||||
const skill = await ctx.skills.get('office-export-pdf')
|
||||
const json = skill?.content.match(/\n(\{\n[\s\S]+)$/u)?.[1]
|
||||
if (json === undefined) throw new Error('Office skill did not supply CLI paths')
|
||||
const { libreofficeKit: { node, cli: entry } } = JSON.parse(json)
|
||||
async function cli(args) {
|
||||
const result = await promisify(execFile)(node, [entry, ...args], { timeout: 120_000, env: { ...process.env, PATH: '' } })
|
||||
return JSON.parse(result.stdout)
|
||||
}
|
||||
const capabilities = await cli(['capabilities', '--json'])
|
||||
await cli(['convert', '--input', config.input, '--output', config.output + '.cli.pdf'])
|
||||
const pdf = await readFile(config.output + '.cli.pdf')
|
||||
if (pdf.subarray(0, 5).toString() !== '%PDF-') throw new Error('Office shell command did not create a PDF')
|
||||
const bytes = await readFile(config.input)
|
||||
const converted = await ctx.officeKit.convertTo({
|
||||
extension: 'docx', format: 'pdf', priority: 'foreground',
|
||||
source: { key: 'python-sdk-office-smoke', version: 'fixture', bytes: bytes.length, async read() { return { bytes, version: 'fixture' } } },
|
||||
output: { owner: 'python-sdk-office-smoke', name: 'service.pdf' },
|
||||
})
|
||||
await copyFile(converted.path, config.output + '.service.pdf')
|
||||
const pdf = await readFile(config.output + '.service.pdf')
|
||||
if (pdf.subarray(0, 5).toString() !== '%PDF-') throw new Error('Office kit service did not create a PDF')
|
||||
const converter = await createConverter({ timeoutMs: 120_000 })
|
||||
try {
|
||||
const result = await converter.render({ inputPath: config.input, outputPath: config.output })
|
||||
const images = await converter.renderImages({ inputPath: config.imageInput, outputDir: config.imageOutput, pages: [1], dpi: 72 })
|
||||
await writeFile(config.result, JSON.stringify({ ...result, images, capabilities, moduleUrl: import.meta.resolve('@deepseek-ai/libreoffice-kit') }))
|
||||
await writeFile(config.result, JSON.stringify({ ...result, images, moduleUrl: import.meta.resolve('@deepseek-ai/libreoffice-kit') }))
|
||||
} finally {
|
||||
await converter.dispose()
|
||||
}
|
||||
|
||||
@@ -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 125.
|
||||
* global and Session access seats and one occupant line per keyed tool view) sets the current 127.
|
||||
*/
|
||||
const MAX_ENTRY_LINES = 125
|
||||
const MAX_ENTRY_LINES = 127
|
||||
|
||||
/** One register-call option as the catalog teaches it. */
|
||||
interface OptionDoc {
|
||||
|
||||
@@ -74,7 +74,7 @@ export const SERVICE_PAGE: Record<string, string> = {
|
||||
agentPresets: 'core.md',
|
||||
agents: 'core.md',
|
||||
approval: 'approval.md',
|
||||
officeToPdf: 'office-to-pdf.md',
|
||||
officeKit: 'office-kit.md',
|
||||
attachments: 'attachment.md',
|
||||
shell: 'shell.md',
|
||||
shellEnv: 'shell.md',
|
||||
@@ -356,11 +356,16 @@ export const LINK_MAP: Readonly<Record<string, string>> = {
|
||||
CuaApplicationState: 'computer-use.md',
|
||||
CuaSystemPermission: 'computer-use.md',
|
||||
CuaSystemPermissionState: 'computer-use.md',
|
||||
RenderedDocumentBytes: 'office-to-pdf.md',
|
||||
OfficeToPdfRequest: 'office-to-pdf.md',
|
||||
OfficeToPdfResult: 'office-to-pdf.md',
|
||||
OfficeToPdfPriority: 'office-to-pdf.md',
|
||||
OfficeToPdfGeneration: 'office-to-pdf.md',
|
||||
RenderedDocumentBytes: 'office-kit.md',
|
||||
OfficeKitRequest: 'office-kit.md',
|
||||
OfficeKitResult: 'office-kit.md',
|
||||
OfficeImagesRequest: 'office-kit.md',
|
||||
OfficeImagesResult: 'office-kit.md',
|
||||
OfficeConversionRequest: 'office-kit.md',
|
||||
OfficeRecalculationRequest: 'office-kit.md',
|
||||
OfficeFileResult: 'office-kit.md',
|
||||
OfficeKitPriority: 'office-kit.md',
|
||||
OfficeKitGeneration: 'office-kit.md',
|
||||
CreatedShare: 'liveshare.md',
|
||||
CreateShareRequest: 'liveshare.md',
|
||||
OwnerIdentityRequest: 'liveshare.md',
|
||||
@@ -743,6 +748,7 @@ export const LINK_MAP: Readonly<Record<string, string>> = {
|
||||
SubagentInterruptAuthority: 'subagent.md',
|
||||
SubagentInterruptReceipt: 'subagent.md',
|
||||
SubagentListEntry: 'subagent.md',
|
||||
SubagentMemberNames: 'subagent.md',
|
||||
SubagentPromptReceipt: 'subagent.md',
|
||||
SubagentPromptRequest: 'subagent.md',
|
||||
SubagentProvider: 'subagent.md',
|
||||
|
||||
@@ -269,9 +269,9 @@ const SERVICE_ROLES: ServiceRole[] = [
|
||||
note: 'The native provider owns application consent and cancellation; the optional Client page queries and changes those decisions through its Remote.',
|
||||
},
|
||||
{
|
||||
key: 'officeToPdf', pkg: 'office-to-pdf', title: 'Office to PDF conversion',
|
||||
mode: 'core', consumers: ['client-ui-sidebar-documentpreview'],
|
||||
note: 'Authorized Office bytes are converted on the Host using the declared native target engine, or Node WASM when no native target is declared.',
|
||||
key: 'officeKit', pkg: 'office-kit', title: 'Office rendering, conversion, and recalculation',
|
||||
mode: 'core', consumers: ['client-ui-sidebar-documentpreview', 'tool-office'],
|
||||
note: 'Authorized Office bytes are rendered as PDFs or images, converted, or recalculated on the Host using the declared native target engine, or Node WASM when no native target is declared.',
|
||||
},
|
||||
{
|
||||
key: 'attachments',
|
||||
|
||||
@@ -13,6 +13,7 @@ import LlmRuntime from '@deepseek-ai/dsh-llm'
|
||||
import type { ToolSchema } from '@deepseek-ai/dsh-llm'
|
||||
import AgentRegistry from '@deepseek-ai/dsh-agent'
|
||||
import type { Agent } from '@deepseek-ai/dsh-agent'
|
||||
import type OfficeKit from '@deepseek-ai/dsh-office-kit'
|
||||
import { createScope } from '@deepseek-ai/dsh-scope'
|
||||
import SessionStore, { SessionId } from '@deepseek-ai/dsh-session'
|
||||
import SessionPersistence from '@deepseek-ai/dsh-session-persistence'
|
||||
@@ -56,6 +57,7 @@ import * as ToolPwshPersistent from '@deepseek-ai/dsh-tool-pwsh-persistent'
|
||||
import CordisHostRunner from '@deepseek-ai/dsh-cordis-host-runner'
|
||||
import * as ToolCordis from '@deepseek-ai/dsh-tool-cordis'
|
||||
import * as ToolPresent from '@deepseek-ai/dsh-tool-present'
|
||||
import * as ToolOffice from '@deepseek-ai/dsh-tool-office'
|
||||
import * as ToolFs from '@deepseek-ai/dsh-tool-fs'
|
||||
import * as ToolFsSearch from '@deepseek-ai/dsh-tool-fs-search'
|
||||
import * as ToolStrReplaceEditor from '@deepseek-ai/dsh-tool-str-replace-editor'
|
||||
@@ -329,6 +331,20 @@ const TOOL_PACKAGES: ToolPackage[] = [
|
||||
note:
|
||||
'The bash tool is the model-facing consumer of the bash executor seam. With a job registry composed every call registers with the generic `ctx.jobs` runtime as it starts, collected/stopped through the `job_*` tools from `@deepseek-ai/dsh-tool-jobs`; without one, or with `enableRunInBackground: false`, the tool registers a foreground-only schema without the `run_in_background` parameter.',
|
||||
},
|
||||
{
|
||||
pkg: '@deepseek-ai/dsh-tool-office',
|
||||
dir: 'tool-office',
|
||||
source: 'packages/document/tool-office/src/index.ts',
|
||||
requires: ['ctx.workingDirectory', 'ctx.tools', 'ctx.fs', 'ctx.agents', 'ctx.officeKit', 'ctx.attachments and ctx.llm for office_render'],
|
||||
writes: ['tool/call', 'tool/result with rendered image attachments', 'temporary converted files in the Office kit output store'],
|
||||
async mount(ctx) {
|
||||
// Schema harvest never renders or converts a document.
|
||||
ctx.provide('officeKit', {} as OfficeKit)
|
||||
await ctx.plugin(AgentRegistry)
|
||||
await ctx.plugin(ToolOffice)
|
||||
},
|
||||
note: 'Declared to an Agent from the step after it successfully loads an Office skill, and kept while the previous request header declares an Office tool. Admitted calls fail with the Office service\'s unavailable error when LibreOffice Kit is not installed.',
|
||||
},
|
||||
{
|
||||
pkg: '@deepseek-ai/dsh-tool-present',
|
||||
dir: 'tool-present',
|
||||
@@ -583,7 +599,7 @@ const TOOL_PACKAGES: ToolPackage[] = [
|
||||
await ctx.plugin(ToolSubagent, { provider: 'mock', modelDiscovery: true })
|
||||
},
|
||||
note:
|
||||
'The load-time `toolName` selects the delegation name (default `subagent`); `modelSelection` adds optional route fields. `modelDiscovery` defaults off and registers shared discovery on one instance per scope. Web and Desktop presets enable spawn discovery and route fields and leave `subagent_fork` route fields disabled. The Host settings service records authorization for each new top-level Session; child Sessions inherit it. Without a recorded policy, discovery and explicit selection permit only the current parent route. Every delegation returns a child id promptly; local children accept follow-ups, while external backends report their single execution automatically.',
|
||||
'The load-time `toolName` selects the delegation name (default `subagent`); `modelSelection` adds optional route fields. `modelDiscovery` defaults off and registers shared discovery on one instance per scope. Web and Desktop presets enable spawn discovery and route fields and leave `subagent_fork` route fields disabled. The Host settings service records authorization for each new top-level Session; child Sessions inherit it. Without a recorded policy, discovery and explicit selection permit only the current parent route. Every delegation returns the child\'s name promptly; local children accept follow-ups, while external backends report their single execution automatically.',
|
||||
},
|
||||
{
|
||||
pkg: '@deepseek-ai/dsh-tool-subagent-control',
|
||||
|
||||
@@ -33,6 +33,8 @@ describe.each(['arm64', 'x64'])('macOS %s packaging', (arch) => {
|
||||
|
||||
it('confines signed Mac packaging to manual dispatch and a dedicated Apple Silicon runner', () => {
|
||||
expect(Object.keys(workflow.on)).toEqual(['workflow_dispatch'])
|
||||
expect(workflow.jobs.package!.env.PACKAGE_VERSION_MODE).toBe("${{ inputs.version_mode == 'follow-dsh' && 'product' || inputs.version_mode == 'build-number' && 'auto' || inputs.version_mode }}")
|
||||
expect(workflow.on.workflow_dispatch).toMatchObject({ inputs: { version_mode: { default: 'default', options: ['default', 'follow-dsh', 'build-number', 'manual'] } } })
|
||||
expect(workflow.jobs.package).not.toHaveProperty('name')
|
||||
expect(workflow.on.workflow_dispatch).toMatchObject({ inputs: { test_release_id: { type: 'string', default: '', required: false } } })
|
||||
expect(workflow.on.workflow_dispatch).not.toHaveProperty('inputs.publish')
|
||||
@@ -49,8 +51,8 @@ describe.each(['arm64', 'x64'])('macOS %s packaging', (arch) => {
|
||||
const installer = archive.steps.find(step => step.uses?.startsWith('actions/upload-artifact@'))!
|
||||
expect(uploads[0]?.if).toBe("always() && steps.checkout.outcome == 'success'")
|
||||
expect(installer.if).toBe('success()')
|
||||
expect(installer.with?.path).toBe('${{ needs.package.outputs.directory }}/*')
|
||||
expect(installer.with?.['compression-level']).toBe(0)
|
||||
expect(installer.with?.path).toBe('${{ steps.archive.outputs.path }}')
|
||||
expect(installer.with).toMatchObject({ archive: false, overwrite: true, name: '${{ env.DESKTOP_ARCHIVE_NAME }}' })
|
||||
})
|
||||
|
||||
it('defaults to notarization and labels the explicit debugging option', () => {
|
||||
@@ -60,7 +62,6 @@ describe.each(['arm64', 'x64'])('macOS %s packaging', (arch) => {
|
||||
} } })
|
||||
const steps = workflow.jobs.package!.steps
|
||||
expect(steps.filter(step => step.run?.includes('args+=(--skip-notarization)'))).toHaveLength(2)
|
||||
expect(workflow.jobs['upload-artifact']!.steps.find(step => step.name === 'Retain installers for the selected mode')?.with?.name).toContain('${{ needs.package.outputs.mode }}')
|
||||
})
|
||||
|
||||
it('retains build inputs outside checkout and run-specific pnpm installations', () => {
|
||||
@@ -95,14 +96,15 @@ describe.each(['arm64', 'x64'])('macOS %s packaging', (arch) => {
|
||||
})
|
||||
|
||||
it('passes the same target to preparation, packaging and retention', () => {
|
||||
expectDesktopArchive(workflow.jobs['upload-artifact']!, 1)
|
||||
const archive = workflow.jobs['upload-artifact']!
|
||||
expectDesktopArchive(archive, 1)
|
||||
const job = workflow.jobs.package!
|
||||
expect(job.env.DSH_DESKTOP_TARGET_PLATFORM).toBe('darwin')
|
||||
expect(job.env.DSH_DESKTOP_TARGET_ARCH).toBe(arch)
|
||||
const builds = job.steps.filter(step => step.run?.includes('pnpm run package:desktop:mac:'))
|
||||
expect(builds).toHaveLength(2)
|
||||
for (const step of builds) expect(step.run).toContain(`package:desktop:mac:${arch}`)
|
||||
expect(workflow.jobs['upload-artifact']!.steps.find(step => step.name === 'Retain installers for the selected mode')?.with?.name).toContain(`macos-${arch}-`)
|
||||
expect(archive.env.DESKTOP_ARCHIVE_NAME).toBe('macos-' + arch + '-${{ needs.package.outputs.mode }}-${{ needs.package.outputs.version }}-${{ github.run_id }}-${{ needs.package.outputs.attempt }}.zip')
|
||||
if (arch === 'x64') {
|
||||
const rosetta = job.steps.findIndex(step => step.run === 'arch -x86_64 /usr/bin/true')
|
||||
expect(rosetta).toBeGreaterThan(-1)
|
||||
|
||||
@@ -20,9 +20,6 @@
|
||||
"apps/cli/tests/web-auth.e2e.ts": {
|
||||
"a2b9a35fdf6552ba148d15436c9b3f98ed5763a2b91a95f579b951fd6613e75c": 1
|
||||
},
|
||||
"apps/desktop-host/tests/office.spec.ts": {
|
||||
"3f8653cd87f99ebd70765379dae51ab308ed9c280e831d39e1abd469bfcdc6e3": 1
|
||||
},
|
||||
"apps/desktop/scripts/installed-update-qualification.ts": {
|
||||
"5a8270cf9b1e554ae0cff6eaf7086e44c22f61a08e5f91dc7e1397eccaa726a5": 2
|
||||
},
|
||||
@@ -350,7 +347,7 @@
|
||||
"2e78263d16d54ccfd8d322bcdf1bf738bd8134e15c24063ece9a1d1b52f4ebd9": 1
|
||||
},
|
||||
"packages/bundle/web-app/tests/document-conversion.e2e.ts": {
|
||||
"743a7488a765c578e607d08ba6bdcf6f2f2971f67b05a42d5097aad2458134a1": 1
|
||||
"95057a87f4a7358284982d7c73febfe26aed9f37a4ceb5b8df724f2b6bc1084c": 1
|
||||
},
|
||||
"packages/bundle/web-app/tests/document-preview.spec.ts": {
|
||||
"154da39139a0074bad3d13a624e5fa62d1f7ce19dc8b9c28a73af3263cd7f10e": 1
|
||||
@@ -964,7 +961,7 @@
|
||||
"packages/deliverables/workspace-changes/tests/loader-composition.spec.ts": {
|
||||
"59c63f734e8bba862325f776e3fcbebd78a84cfb4161f8df41c216950d9bf351": 1
|
||||
},
|
||||
"packages/document/office-to-pdf/tests/queue.spec.ts": {
|
||||
"packages/document/office-kit/tests/queue.spec.ts": {
|
||||
"bbe31b89b81048bb47c7158e78670deec5f2973286f9abc591290a8fdd851cf1": 1
|
||||
},
|
||||
"packages/experimental/browser-use-runtime/src/index.ts": {
|
||||
@@ -1449,9 +1446,6 @@
|
||||
"746ebc5aade01a50cc9a74fc07b1023addf021aef80b62c069a437ac140c9e64": 1,
|
||||
"c920d88f6eb309ef5991608642a1ab0fd972690538b33c34d86c68d07ddd6edf": 1
|
||||
},
|
||||
"packages/session-query/session-log-export/tests/dialog.client.spec.tsx": {
|
||||
"a9b1969d76db0b05f87c862956f8ff45c52f1f4a5b32a206339de0c9fee99a77": 1
|
||||
},
|
||||
"packages/session-query/session-log-export/tests/loader-composition.host.spec.ts": {
|
||||
"59c63f734e8bba862325f776e3fcbebd78a84cfb4161f8df41c216950d9bf351": 1,
|
||||
"e12d49327a6708ae3ace371e28ed0deb471dc8895c584ba94a86af344c15cec3": 1
|
||||
|
||||
@@ -1,17 +1,46 @@
|
||||
/**
|
||||
* Executable lint checks use private copies of repository sources and configuration.
|
||||
* Process-spawning cases set Vitest's case timeout to 90 seconds, including
|
||||
* plain local runs without a CI override. Configuration-only cases keep the default.
|
||||
*/
|
||||
import { spawnSync } from 'node:child_process'
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import { existsSync } from 'node:fs'
|
||||
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises'
|
||||
import { join, relative } from 'node:path'
|
||||
import { existsSync, globSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { cp, lstat, mkdir, mkdtemp, readFile, realpath, rm, symlink, writeFile } from 'node:fs/promises'
|
||||
import { basename, join, relative } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { flattenDiagnosticMessageText, parseConfigFileTextToJson } from 'typescript'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
|
||||
|
||||
const repositoryRoot = fileURLToPath(new URL('..', import.meta.url))
|
||||
const sourceRepositoryRoot = fileURLToPath(new URL('..', import.meta.url))
|
||||
let repositoryRoot = ''
|
||||
|
||||
// Probes belong to a private copy: repository compiler scans run in other workers and processes.
|
||||
beforeAll(async () => {
|
||||
repositoryRoot = await mkdtemp(join(tmpdir(), 'dsh-oxlint-contract-'))
|
||||
repositoryRoot = await realpath(repositoryRoot)
|
||||
const files = [
|
||||
...globSync('tsconfig*.json', { cwd: sourceRepositoryRoot }),
|
||||
'.oxlintrc.json', '.oxlintrc.staged.json', 'package.json', 'lefthook.yml',
|
||||
'apps', 'native', 'packages', 'python', 'scripts', 'vendor', 'website',
|
||||
]
|
||||
for (const path of files) {
|
||||
await cp(join(sourceRepositoryRoot, path), join(repositoryRoot, path), {
|
||||
recursive: true,
|
||||
async filter(source) {
|
||||
if (['node_modules', 'lib', '.typecheck'].includes(basename(source))) return false
|
||||
return (await lstat(source)).isDirectory() || /\.(?:json|[cm]?[jt]sx?)$/u.test(source) || source.endsWith('lefthook.yml')
|
||||
},
|
||||
})
|
||||
}
|
||||
await symlink(join(sourceRepositoryRoot, 'node_modules'), join(repositoryRoot, 'node_modules'),
|
||||
process.platform === 'win32' ? 'junction' : 'dir')
|
||||
}, 90_000)
|
||||
|
||||
afterAll(async () => {
|
||||
if (repositoryRoot !== '') await rm(repositoryRoot, { recursive: true, force: true })
|
||||
}, 90_000)
|
||||
const oxlintCli = fileURLToPath(new URL('../node_modules/oxlint/bin/oxlint', import.meta.url))
|
||||
const tsxCli = fileURLToPath(new URL('../node_modules/tsx/dist/cli.mjs', import.meta.url))
|
||||
|
||||
@@ -24,7 +53,7 @@ function isUnknownArray(value: unknown): value is unknown[] {
|
||||
}
|
||||
|
||||
function runRepositoryOxlint(args: readonly string[], env: NodeJS.ProcessEnv = {}) {
|
||||
return spawnSync(process.execPath, [tsxCli, 'scripts/run-oxlint.ts', ...args], {
|
||||
return spawnSync(process.execPath, [tsxCli, join(sourceRepositoryRoot, 'scripts/run-oxlint.ts'), ...args], {
|
||||
cwd: repositoryRoot,
|
||||
encoding: 'utf8',
|
||||
env: { ...process.env, NO_COLOR: '1', ...env },
|
||||
@@ -76,6 +105,7 @@ probePromise()
|
||||
const path = join(repositoryRoot, parent, `oxlint-contract-${suffix}${extension}`)
|
||||
await writeFile(path, source)
|
||||
paths.push([label, relative(repositoryRoot, path), tsconfig])
|
||||
expect(existsSync(join(sourceRepositoryRoot, relative(repositoryRoot, path)))).toBe(false)
|
||||
}
|
||||
const clientScript = 'scripts/client-bundle-purity.spec.ts'
|
||||
|
||||
@@ -223,7 +253,7 @@ export const longProbe = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 +
|
||||
)
|
||||
expect(packageJson.devDependencies).not.toHaveProperty('eslint')
|
||||
expect(packageJson.devDependencies).not.toHaveProperty('@typescript-eslint/parser')
|
||||
expect(existsSync(join(repositoryRoot, 'eslint.format.config.mjs'))).toBe(false)
|
||||
expect(existsSync(join(sourceRepositoryRoot, 'eslint.format.config.mjs'))).toBe(false)
|
||||
|
||||
const lefthook = await readFile(join(repositoryRoot, 'lefthook.yml'), 'utf8')
|
||||
expect(lefthook).toContain('scripts/run-oxlint.ts --config .oxlintrc.staged.json --fix')
|
||||
|
||||
@@ -42,12 +42,14 @@ describe('pre-merge check', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('checks the versions before it installs, and installs before the builds', () => {
|
||||
const steps = preMergeSteps('/repo')
|
||||
expect(steps.map(step => step.name)).toEqual(['versions', 'install', 'host contracts', 'client'])
|
||||
it('checks the versions before it installs, and installs before the upgrade guides, which need the merged base commit, and the builds', () => {
|
||||
expect(preMergeSteps('/repo').map(step => step.name)).toEqual(['versions', 'install', 'host contracts', 'client'])
|
||||
const steps = preMergeSteps('/repo', 'b'.repeat(40))
|
||||
expect(steps.map(step => step.name)).toEqual(['versions', 'install', 'upgrade guides', 'host contracts', 'client'])
|
||||
expect(steps[0]).toEqual({ name: 'versions', command: process.execPath, args: [join('/repo', 'scripts', 'verify-version-sync.ts'), '/repo'] })
|
||||
expect(steps[1]).toEqual({ name: 'install', command: 'pnpm', args: ['install', '--frozen-lockfile'] })
|
||||
expect(steps[3]?.args).toEqual(['exec', 'tsx', 'scripts/compile-referenced-projects.ts', 'client'])
|
||||
expect(steps[2]?.args).toEqual(['run', 'verify-upgrade-guides', '--base', 'b'.repeat(40)])
|
||||
expect(steps[4]?.args).toEqual(['exec', 'tsx', 'scripts/compile-referenced-projects.ts', 'client'])
|
||||
})
|
||||
|
||||
it('annotates a failure as a warning and passes in report mode', () => {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* Validate the tree a pull request produces once merged with its base branch: the version
|
||||
* synchronization of the released manifests, the install, and the Host and Client builds.
|
||||
* synchronization of the released manifests, the install, the version directories of added upgrade
|
||||
* guides, and the Host and Client builds.
|
||||
*
|
||||
* The `Policy / Pre-Merge Check` job runs this file with `node`, and knows nothing else about the
|
||||
* merged tree, so what that tree needs changes here without touching the check. The file runs under
|
||||
@@ -23,13 +24,17 @@ export interface PreMergeStep {
|
||||
/**
|
||||
* The steps that check the merged tree, in order. The versions come first because reading the
|
||||
* manifests needs no install, so a mistyped release stops the check before anything is built.
|
||||
* The upgrade-guide step compares with the base-branch commit the job merged, so a release published
|
||||
* after the pull request was written rejects its stale guides; without that commit the step is left out.
|
||||
* @param root - Repository root.
|
||||
* @param base - Base-branch commit merged into the pull request; the job sets it as `BASE_SHA`.
|
||||
* @returns Steps in run order.
|
||||
*/
|
||||
export function preMergeSteps(root: string): PreMergeStep[] {
|
||||
export function preMergeSteps(root: string, base?: string): PreMergeStep[] {
|
||||
return [
|
||||
{ name: 'versions', command: process.execPath, args: [join(root, 'scripts', 'verify-version-sync.ts'), root] },
|
||||
{ name: 'install', command: 'pnpm', args: ['install', '--frozen-lockfile'] },
|
||||
...base === undefined ? [] : [{ name: 'upgrade guides', command: 'pnpm', args: ['run', 'verify-upgrade-guides', '--base', base] }],
|
||||
{ name: 'host contracts', command: 'pnpm', args: ['exec', 'tsx', 'scripts/compile-referenced-projects.ts', 'host-contracts'] },
|
||||
{ name: 'client', command: 'pnpm', args: ['exec', 'tsx', 'scripts/compile-referenced-projects.ts', 'client'] },
|
||||
]
|
||||
@@ -120,7 +125,11 @@ export async function preMergeCheck(root: string, options: PreMergeOptions = {})
|
||||
const invokedPath = process.argv[1]
|
||||
const isMain = invokedPath !== undefined && import.meta.url === pathToFileURL(resolve(invokedPath)).href
|
||||
if (isMain) {
|
||||
const outcome = await preMergeCheck(resolve(import.meta.dirname, '..'))
|
||||
const root = resolve(import.meta.dirname, '..')
|
||||
// A job definition older than this file sets no BASE_SHA.
|
||||
const base = process.env.BASE_SHA || undefined
|
||||
if (base === undefined) process.stdout.write('pre-merge-check: BASE_SHA is not set, so added upgrade guides are not checked\n')
|
||||
const outcome = await preMergeCheck(root, { steps: preMergeSteps(root, base) })
|
||||
if (outcome.ok) {
|
||||
process.stdout.write('pre-merge-check: passed\n')
|
||||
} else {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { tmpdir } from 'node:os'
|
||||
import { basename, join } from 'node:path'
|
||||
import { zipSync } from 'fflate'
|
||||
import { expect, it } from 'vitest'
|
||||
import { downloadPrimaryRuntimeAsset, prepareOfficeSkillAssets, primaryRuntimePayloadDigest, prunePnpmForeignNativePackages, smokePrimaryRuntime, unpackPrimaryRuntimeWheel } from './prepare.ts'
|
||||
import { downloadPrimaryRuntimeAsset, primaryRuntimePayloadDigest, prunePnpmForeignNativePackages, smokePrimaryRuntime, unpackPrimaryRuntimeWheel } from './prepare.ts'
|
||||
import lock from './lock.json' with { type: 'json' }
|
||||
|
||||
it('covers every SDK wheel target with the shared interpreter lock', () => {
|
||||
@@ -132,26 +132,6 @@ it('rejects library files requiring an unsupported installation scheme', async (
|
||||
}
|
||||
})
|
||||
|
||||
it('copies complete Office resources outside the application archive and removes obsolete assets', async () => {
|
||||
const root = await mkdtemp(join(tmpdir(), 'desktop-office-assets-'))
|
||||
try {
|
||||
const source = join(root, 'package', 'assets')
|
||||
const destination = join(root, 'Contents', 'Resources', 'runtime', 'office-skills')
|
||||
await mkdir(source, { recursive: true })
|
||||
for (const name of ['office-docx', 'office-pptx', 'office-xlsx']) {
|
||||
await mkdir(join(source, name))
|
||||
await writeFile(join(source, name, 'SKILL.md'), `# ${name}\n`)
|
||||
}
|
||||
await prepareOfficeSkillAssets(source, destination)
|
||||
await writeFile(join(destination, 'obsolete.py'), 'old helper')
|
||||
await prepareOfficeSkillAssets(source, destination)
|
||||
for (const name of ['office-docx', 'office-pptx', 'office-xlsx']) {
|
||||
expect(await readFile(join(destination, name, 'SKILL.md'), 'utf8')).toBe(`# ${name}\n`)
|
||||
}
|
||||
await expect(readFile(join(destination, 'obsolete.py'))).rejects.toMatchObject({ code: 'ENOENT' })
|
||||
} finally { await rm(root, { recursive: true, force: true }) }
|
||||
})
|
||||
|
||||
it('gives Python-only payloads a distinct identity', () => {
|
||||
expect(primaryRuntimePayloadDigest('linux-x64', lock, undefined)).not.toBe(primaryRuntimePayloadDigest('linux-x64', lock, '11.7.0'))
|
||||
})
|
||||
|
||||
@@ -172,17 +172,6 @@ export function prunePnpmForeignNativePackages(pnpm: string, platform: NodeJS.Pl
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the skill package's complete asset tree to ordinary filesystem resources.
|
||||
* @param source - The package's assets directory.
|
||||
* @param destination - External Office skill resource directory.
|
||||
* @returns Resolves after replacing the external assets with the complete package tree.
|
||||
*/
|
||||
export async function prepareOfficeSkillAssets(source: string, destination: string): Promise<void> {
|
||||
rmSync(destination, { recursive: true, force: true })
|
||||
await cp(source, destination, { recursive: true, dereference: true })
|
||||
}
|
||||
|
||||
/** A locked interpreter and wheel target. */
|
||||
export type PrimaryRuntimeTarget = keyof typeof lock.targets
|
||||
|
||||
@@ -190,7 +179,7 @@ export type PrimaryRuntimeTarget = keyof typeof lock.targets
|
||||
export interface PreparePrimaryRuntimeOptions {
|
||||
/** Target whose archives and wheels are downloaded. */
|
||||
readonly target: PrimaryRuntimeTarget
|
||||
/** Resource directory receiving primary-runtime/ and office-skills/. */
|
||||
/** Resource directory receiving primary-runtime/. */
|
||||
readonly output: string
|
||||
/** SHA-256-addressed archive cache. */
|
||||
readonly cache: string
|
||||
@@ -198,16 +187,14 @@ export interface PreparePrimaryRuntimeOptions {
|
||||
readonly version: string
|
||||
/** Locked npm pnpm tarball for installed carriers; build hosts otherwise copy their installed pnpm. */
|
||||
readonly pnpmArchive?: RuntimeNpmArchive
|
||||
/** Ordinary filesystem Office assets; build hosts otherwise resolve the workspace package. */
|
||||
readonly skillSource?: string
|
||||
/** Omit Node.js and pnpm for carriers providing only Python. */
|
||||
readonly pythonOnly?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Materialize locked interpreters, libraries and Office resources without executing target code.
|
||||
* Materialize locked interpreters and libraries without executing target code.
|
||||
* @param options - Explicit target and carrier-owned output locations.
|
||||
* @returns Resolves after the complete payload and skills have been copied to the output directory.
|
||||
* @returns Resolves after the complete payload has been copied to the output directory.
|
||||
*/
|
||||
export async function preparePrimaryRuntime(options: PreparePrimaryRuntimeOptions): Promise<void> {
|
||||
const { target } = options
|
||||
@@ -259,9 +246,6 @@ export async function preparePrimaryRuntime(options: PreparePrimaryRuntimeOption
|
||||
} finally {
|
||||
rmSync(staging, { recursive: true, force: true })
|
||||
}
|
||||
const assets = options.skillSource ?? join(dirname(createRequire(import.meta.url).resolve('@deepseek-ai/dsh-skill-office/package.json')), 'assets')
|
||||
await prepareOfficeSkillAssets(assets,
|
||||
join(paths.runtime, 'office-skills'))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,72 +1,7 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
hasTypertRemoteNavigation,
|
||||
isForbiddenPublicationFile,
|
||||
validateTarballPayload,
|
||||
} from './publication-payload.ts'
|
||||
|
||||
function validateFixtureTarball(files: readonly string[]): () => void {
|
||||
return () => {
|
||||
validateTarballPayload(files, 'fixture.tgz')
|
||||
}
|
||||
}
|
||||
|
||||
describe('publication payload policy', () => {
|
||||
it.each([
|
||||
'lib/index.js',
|
||||
'lib/types/index.d.ts',
|
||||
'lib/styles/base.css',
|
||||
])('accepts %s', (file) => {
|
||||
expect(isForbiddenPublicationFile(file)).toBe(false)
|
||||
})
|
||||
|
||||
it.each([
|
||||
'src',
|
||||
'./src',
|
||||
'src/',
|
||||
'src/index.ts',
|
||||
'./src/index.ts',
|
||||
String.raw`src\index.ts`,
|
||||
'lib/types/index.d.ts.map',
|
||||
'./lib/types/index.d.ts.map',
|
||||
'lib/typert.remote-client.d.ts.map',
|
||||
'lib/client.js.map',
|
||||
'./lib/client.js.map',
|
||||
])('rejects static manifest path %s', (file) => {
|
||||
expect(isForbiddenPublicationFile(file)).toBe(true)
|
||||
})
|
||||
|
||||
it('rejects source members in packed tarballs', () => {
|
||||
expect(validateFixtureTarball([
|
||||
'package/package.json',
|
||||
'package/src/index.ts',
|
||||
])).toThrow('fixture.tgz publishes source file package/src/index.ts')
|
||||
})
|
||||
|
||||
it('rejects source maps in packed tarballs', () => {
|
||||
expect(validateFixtureTarball([
|
||||
'package/package.json',
|
||||
'package/lib/types/index.d.ts.map',
|
||||
])).toThrow('fixture.tgz publishes source map package/lib/types/index.d.ts.map')
|
||||
expect(validateFixtureTarball([
|
||||
'package/package.json',
|
||||
'package/lib/typert.remote-client.d.ts.map',
|
||||
])).toThrow('fixture.tgz publishes source map package/lib/typert.remote-client.d.ts.map')
|
||||
expect(validateFixtureTarball([
|
||||
'package/package.json',
|
||||
'package/lib/client.js.map',
|
||||
])).toThrow('fixture.tgz publishes source map package/lib/client.js.map')
|
||||
})
|
||||
|
||||
it('accepts a clean packed tarball', () => {
|
||||
expect(validateFixtureTarball([
|
||||
'package/package.json',
|
||||
'package/lib/index.js',
|
||||
'package/lib/types/index.d.ts',
|
||||
'package/lib/styles/base.css',
|
||||
])).not.toThrow()
|
||||
})
|
||||
import { hasTypertRemoteNavigation } from './publication-payload.ts'
|
||||
|
||||
describe('publication payload facts', () => {
|
||||
it('recognizes only the canonical Host-for-Client export pair', () => {
|
||||
expect(hasTypertRemoteNavigation({
|
||||
exports: {
|
||||
@@ -77,5 +12,7 @@ describe('publication payload policy', () => {
|
||||
},
|
||||
})).toBe(true)
|
||||
expect(hasTypertRemoteNavigation({ exports: { './remote': './lib/remote.js' } })).toBe(false)
|
||||
expect(hasTypertRemoteNavigation({ exports: { './remote': { types: './lib/typert.remote-client.d.ts' } } })).toBe(false)
|
||||
expect(hasTypertRemoteNavigation(undefined)).toBe(false)
|
||||
})
|
||||
})
|
||||
@@ -1,4 +1,4 @@
|
||||
/** Publication payload policy shared by static manifests and packed tarballs. */
|
||||
/** Publication payload facts shared by static manifests and packed tarballs. */
|
||||
|
||||
/**
|
||||
* Whether a package manifest exports generated Host-for-Client metadata.
|
||||
@@ -15,41 +15,3 @@ export function hasTypertRemoteNavigation(manifest: unknown): boolean {
|
||||
return entry.types === './lib/typert.remote-client.d.ts'
|
||||
&& entry.default === './lib/typert.remote-client.js'
|
||||
}
|
||||
|
||||
/** Normalize a package manifest path or npm tarball member to its payload-relative path. */
|
||||
function payloadPath(file: string): string {
|
||||
const normalized = file.replaceAll('\\', '/').replace(/^\.\/+/, '').replace(/\/+$/, '')
|
||||
return normalized.startsWith('package/') ? normalized.slice('package/'.length) : normalized
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a package payload path exposes source or map intermediates. Maps
|
||||
* serve editor navigation during development, where a workspace consumer
|
||||
* resolves their source through the package link; a published map resolves
|
||||
* nothing, so no payload publishes one.
|
||||
* @param file - manifest path or tarball member to classify.
|
||||
* @returns whether publishing this path is forbidden.
|
||||
*/
|
||||
export function isForbiddenPublicationFile(file: string): boolean {
|
||||
const normalized = payloadPath(file)
|
||||
return normalized === 'src'
|
||||
|| normalized.startsWith('src/')
|
||||
|| normalized.endsWith('.d.ts.map')
|
||||
|| normalized.endsWith('.js.map')
|
||||
}
|
||||
|
||||
/**
|
||||
* Reject source and map members in a packed npm tarball.
|
||||
* @param files - tarball members to validate.
|
||||
* @param context - tarball identity named in the failure.
|
||||
*/
|
||||
export function validateTarballPayload(files: readonly string[], context: string): void {
|
||||
for (const file of files) {
|
||||
if (!isForbiddenPublicationFile(file)) continue
|
||||
const normalized = payloadPath(file)
|
||||
if (normalized === 'src' || normalized.startsWith('src/')) {
|
||||
throw new Error(`${context} publishes source file ${file}`)
|
||||
}
|
||||
throw new Error(`${context} publishes source map ${file}`)
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,6 @@ import { createInterface } from 'node:readline/promises'
|
||||
import { pathToFileURL } from 'node:url'
|
||||
import { parseArgs } from 'node:util'
|
||||
import { discoverNpmBaselineManifests } from './npm-baseline-packages.ts'
|
||||
import { validateTarballPayload } from './publication-payload.ts'
|
||||
|
||||
const DEFAULT_REGISTRY = 'https://registry.npm.harnessment.com'
|
||||
const DEFAULT_OUTPUT_DIRECTORY = '.artifacts/npm-baseline'
|
||||
@@ -317,9 +316,6 @@ class ReleaseBundle {
|
||||
if (expected === undefined || !missingNames.delete(artifact.name)) {
|
||||
throw new Error(`unexpected or duplicate packed package: ${artifact.name}`)
|
||||
}
|
||||
if (expected.origin === 'harness') {
|
||||
validateTarballPayload(artifact.files, tarball)
|
||||
}
|
||||
if (artifact.version !== version) {
|
||||
throw new Error(`${tarball} has version ${artifact.version}; expected ${version}`)
|
||||
}
|
||||
@@ -393,9 +389,6 @@ class ReleaseBundle {
|
||||
throw new Error(`tarball checksum mismatch: ${pkg.tarball}`)
|
||||
}
|
||||
const artifact = inspectTarball(path, runner)
|
||||
if (pkg.origin === 'harness') {
|
||||
validateTarballPayload(artifact.files, pkg.tarball)
|
||||
}
|
||||
if (artifact.name !== pkg.name || artifact.version !== this.manifest.version) {
|
||||
throw new Error(`tarball identity mismatch: ${pkg.tarball}`)
|
||||
}
|
||||
|
||||
@@ -26,7 +26,9 @@ async function fixture() {
|
||||
await file(join(root, 'node/node_modules/@deepseek-ai/dsh/lib/bin.js'), `
|
||||
export async function runCli(options = {}) {
|
||||
const result = process.argv[2] ? { argv: process.argv.slice(2) }
|
||||
: { primary: process.env.DSH_BUNDLED_PRIMARY_RUNTIME, office: process.env.DSH_BUNDLED_OFFICE_CLI };
|
||||
: { primary: process.env.DSH_PRIMARY_RUNTIME };
|
||||
const office = Object.keys(process.env).filter(name => /^DSH_BUNDLED_OFFICE_(?:CLI|NODE)$/.test(name));
|
||||
if (office.length > 0) result.office = office;
|
||||
if (options.packageManager) Object.assign(result, { packageManager: options.packageManager, hostPath: process.env.PATH });
|
||||
console.log(JSON.stringify(result));
|
||||
}
|
||||
@@ -74,8 +76,8 @@ async function fixture() {
|
||||
`)
|
||||
function run(resource?: string, extra: NodeJS.ProcessEnv = {}, args: string[] = []) {
|
||||
const child = spawn(process.execPath, [bootstrap, ...args], {
|
||||
env: { ...process.env, DSH_RESOURCE_CACHE: cache, DSH_RUNTIME_DOWNLOAD: resource, DSH_BUNDLED_PRIMARY_RUNTIME: undefined,
|
||||
DSH_PRIMARY_RUNTIME: undefined, DSH_OFFICE_SIDECAR: undefined, DSH_BUNDLED_OFFICE_CLI: undefined, ...extra },
|
||||
env: { ...process.env, DSH_RESOURCE_CACHE: cache, DSH_RUNTIME_DOWNLOAD: resource,
|
||||
DSH_PRIMARY_RUNTIME: undefined, DSH_OFFICE_SIDECAR: undefined, ...extra },
|
||||
stdio: ['pipe', 'pipe', 'pipe'],
|
||||
})
|
||||
let stdout = '', stderr = ''
|
||||
@@ -146,6 +148,10 @@ it('starts without downloading, independently downloads either resource, and reu
|
||||
const location = JSON.parse(office.stdout) as string
|
||||
expect(await readFile(join(location, 'node_modules/@deepseek-ai/libreoffice-kit/lib/cli.js'), 'utf8')).toBe('cli')
|
||||
expect(await run('office', { DSH_FIXTURE_FAIL: '1' }).done).toMatchObject({ code: 0, stdout: office.stdout })
|
||||
// A cached sidecar only redirects Kit resolution; the CLI process receives no Office executable paths.
|
||||
const started = await run().done
|
||||
expect(started.code, started.stderr).toBe(0)
|
||||
expect(JSON.parse(started.stdout)).toEqual({ primary: join(cache, 'a'.repeat(64), 'primary', 'primary-runtime') })
|
||||
} finally { await rm(root, { recursive: true, force: true }) }
|
||||
})
|
||||
|
||||
|
||||
@@ -398,18 +398,32 @@ describe('release families', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('applies the harness payload policy to dsh and keeps upstream payloads for vendored packages', () => {
|
||||
it('accepts the harness payload and keeps upstream payloads for vendored packages', () => {
|
||||
const dsh = releaseFamily('dsh')
|
||||
const vendor = releaseFamily('vendor')
|
||||
const harness = member('packages/a/library', '@deepseek-ai/dsh-library')
|
||||
const vendored = member('vendor/cordis', '@deepseek-ai/cordis')
|
||||
|
||||
expect(() => { dsh.validatePayload(harness, ['package/lib/index.js', 'package/src/index.ts']) })
|
||||
.toThrow(/publishes source file/)
|
||||
expect(() => { dsh.validatePayload(harness, ['package/lib/index.js', 'package/lib/index.js.map', 'package/src/index.ts']) }).not.toThrow()
|
||||
expect(() => { vendor.validatePayload(vendored, ['package/lib/index.js', 'package/src/index.ts']) }).not.toThrow()
|
||||
expect(() => { vendor.validatePayload(vendored, []) }).toThrow(/empty tarball/)
|
||||
})
|
||||
|
||||
it('requires the installed package payload the staging hook supplies', () => {
|
||||
const dsh = releaseFamily('dsh')
|
||||
const installed = member('apps/cli', '@deepseek-ai/dsh')
|
||||
|
||||
expect(() => { dsh.validatePayload(installed, ['package/lib/index.js', 'package/src/bin.ts']) })
|
||||
.toThrow(/@deepseek-ai\/dsh packed no documentation/)
|
||||
expect(() => { dsh.validatePayload(installed, ['package/lib/index.js', 'package/docs/guide.md', 'package/src/bin.ts']) })
|
||||
.toThrow(/@deepseek-ai\/dsh packed no upgrade guide index/)
|
||||
const docs = ['package/docs/guide.md', 'package/docs/upgrade-guide/README.md']
|
||||
expect(() => { dsh.validatePayload(installed, ['package/lib/index.js', ...docs]) })
|
||||
.toThrow(/@deepseek-ai\/dsh packed no source/)
|
||||
expect(() => { dsh.validatePayload(installed, ['package/lib/index.js', ...docs, 'package/src/bin.ts']) })
|
||||
.not.toThrow()
|
||||
})
|
||||
|
||||
it('drives the installed entry only for the family that publishes one', () => {
|
||||
expect(releaseFamily('dsh').installedEntry).toEqual({ packageName: '@deepseek-ai/dsh', binPath: 'lib/bin.js' })
|
||||
expect(releaseFamily('vendor').installedEntry).toBeUndefined()
|
||||
|
||||
+19
-10
@@ -15,7 +15,6 @@ import {
|
||||
officialClientBuildEnvironment,
|
||||
readClientBuildRecord,
|
||||
} from '../client-build-environment.ts'
|
||||
import { validateTarballPayload } from '../publication-payload.ts'
|
||||
import { ON_DEMAND_BUNDLES } from '../../packages/util/official-bundles/src/bundles.ts'
|
||||
|
||||
/**
|
||||
@@ -387,12 +386,24 @@ class DshFamily extends ReleaseFamily {
|
||||
}
|
||||
|
||||
/**
|
||||
* Reject source and declaration-map members, the repository's publication policy.
|
||||
* Require the installed package to carry the documentation and source its
|
||||
* manifest promises. `docs` exists only because `prepack` stages it, and a
|
||||
* stale tree in the checkout would satisfy a weaker check, so the staged
|
||||
* copy must be complete for the pack that publishes it.
|
||||
* @param member - the packed member.
|
||||
* @param files - every path inside its tarball.
|
||||
*/
|
||||
validatePayload(member: ReleaseMember, files: readonly string[]): void {
|
||||
validateTarballPayload(files, member.name)
|
||||
if (member.name !== this.installedEntry.packageName) return
|
||||
if (!files.some(file => file.startsWith('package/docs/') && file.endsWith('.md'))) {
|
||||
throw new Error(`${member.name} packed no documentation`)
|
||||
}
|
||||
if (!files.includes('package/docs/upgrade-guide/README.md')) {
|
||||
throw new Error(`${member.name} packed no upgrade guide index`)
|
||||
}
|
||||
if (!files.some(file => file.startsWith('package/src/') && file.endsWith('.ts'))) {
|
||||
throw new Error(`${member.name} packed no source`)
|
||||
}
|
||||
}
|
||||
|
||||
/** Publish every advertised on-demand package before the installation that offers it. */
|
||||
@@ -446,14 +457,12 @@ class VendorFamily extends ReleaseFamily {
|
||||
}
|
||||
|
||||
/**
|
||||
* Require the payload the vendored manifest declares, including upstream's
|
||||
* `src` tree and declaration maps.
|
||||
* Accept upstream's payload.
|
||||
*
|
||||
* The harness policy that rejects both does not apply here: these manifests
|
||||
* export `./src/*` for source navigation, so dropping `src` would publish a
|
||||
* package whose export map points at absent files. What must hold instead is
|
||||
* that every path the manifest selects is present, which `files` already
|
||||
* decides and `pnpm pack` already enforces.
|
||||
* Upstream's manifest owns that payload, so this family enforces no shape of
|
||||
* its own beyond a nonempty tarball. What must hold is that every path the
|
||||
* manifest selects is present, which `files` already decides and `pnpm pack`
|
||||
* already enforces.
|
||||
* @param member - the packed member.
|
||||
* @param files - every path inside its tarball.
|
||||
*/
|
||||
|
||||
@@ -307,16 +307,18 @@ describe('release pack CLI', () => {
|
||||
it('validates every parallel tarball before recording the publish order', async () => {
|
||||
const root = fixture()
|
||||
packageFixture(root, 'packages/util/alpha', '@deepseek-ai/alpha')
|
||||
packageFixture(root, 'packages/util/zebra', '@deepseek-ai/zebra', { files: ['lib/index.js', 'src/index.ts'] })
|
||||
write(join(root, 'packages/util/zebra/src/index.ts'), 'export const source = 1\n')
|
||||
packageFixture(root, 'apps/cli', '@deepseek-ai/dsh', { files: ['lib/index.js', 'src/bin.ts'] })
|
||||
packageFixture(root, 'packages/subagent/subagent-claude-code', '@deepseek-ai/dsh-subagent-claude-code')
|
||||
packageFixture(root, 'packages/subagent/subagent-codex', '@deepseek-ai/dsh-subagent-codex')
|
||||
write(join(root, 'apps/cli/src/bin.ts'), 'export const bin = 1\n')
|
||||
write(join(root, 'apps/web/dist/index.html'), '<main></main>')
|
||||
writeClientBuildRecord(root, officialClientBuildEnvironment(root, { DSH_CLIENT_COMMIT_HASH: commit }))
|
||||
|
||||
const result = await runPack(root, ['--family', 'dsh', '--concurrency', '8'])
|
||||
|
||||
expect(result.status).not.toBe(0)
|
||||
expect(result.stderr).toContain('@deepseek-ai/zebra publishes source file package/src/index.ts')
|
||||
expect(readdirSync(join(root, 'packed')).filter(name => name.endsWith('.tgz'))).toHaveLength(2)
|
||||
expect(result.stderr).toContain('@deepseek-ai/dsh packed no documentation')
|
||||
expect(readdirSync(join(root, 'packed')).filter(name => name.endsWith('.tgz'))).toHaveLength(4)
|
||||
expect(existsSync(join(root, 'packed', PUBLISH_ORDER_FILE))).toBe(false)
|
||||
})
|
||||
|
||||
|
||||
@@ -1004,6 +1004,7 @@ describe('Node 24 lane ownership', () => {
|
||||
expect.arrayContaining([
|
||||
'apps/cli/tests/profiles/headless/tests/source-tool.built.e2e.ts',
|
||||
'apps/desktop/tests/acl-skill.built.e2e.ts',
|
||||
'apps/desktop/tests/installed-docs-asar.built.e2e.ts',
|
||||
'packages/subprocess/subprocess-local/tests/spawn-runner-built.e2e.ts',
|
||||
'packages/subagent/subagent-codex/tests/loader-composition.e2e.ts',
|
||||
'packages/subagent/subagent-claude-code/tests/loader-composition.e2e.ts',
|
||||
|
||||
@@ -911,6 +911,7 @@ function builtBinSmokeGate(needs: string[] = ['build']): Gate {
|
||||
'apps/cli/tests/profiles/headless/tests/source-tool.built.e2e.ts',
|
||||
'apps/cli/tests/built-bin.e2e.ts',
|
||||
'apps/desktop/tests/acl-skill.built.e2e.ts',
|
||||
'apps/desktop/tests/installed-docs-asar.built.e2e.ts',
|
||||
'packages/host/directory-picker-native/tests/built-worker.e2e.ts',
|
||||
'packages/sdk/server/tests/built-scope-carrier.e2e.ts',
|
||||
'packages/deliverables/tool-present/tests/built-errors.e2e.ts',
|
||||
|
||||
@@ -93,6 +93,7 @@ LEGACY_CUSTOM_DISABLED_ROWS = (
|
||||
"tool-fs",
|
||||
"tool-fs-search",
|
||||
"tool-goal",
|
||||
"tool-office",
|
||||
"tool-plugin-manager",
|
||||
"tool-schedule",
|
||||
"tool-skill",
|
||||
@@ -995,9 +996,8 @@ def _smoke_sdk_authoring_cached(base_url: str, executable: Path, update_snapshot
|
||||
assert len(requests) == 2, requests
|
||||
prompt = json.dumps(requests[0], ensure_ascii=False)
|
||||
assert ("- `office`:" in prompt) == (mode != "disabled"), mode
|
||||
for name in ("office-docx", "office-pptx", "office-xlsx", "office-render", "office-recalculate", "office-export-pdf"):
|
||||
for name in ("office-docx", "office-pptx", "office-xlsx"):
|
||||
assert (name in prompt) == (mode != "disabled"), (mode, name)
|
||||
assert "render --input" not in prompt and "libreofficeKit" not in prompt, mode
|
||||
assert ("CUSTOM_OFFICE_DOCX" in prompt) == (mode == "replacement"), mode
|
||||
tool_result = next(block for message in requests[1]["messages"]
|
||||
for block in message.get("content", [])
|
||||
@@ -1155,7 +1155,7 @@ def smoke_sdk_office(executable: Path) -> None:
|
||||
patch = root / f"{mode}.patch.yml"
|
||||
patch.write_text(json.dumps([{"insert": [{
|
||||
"id": "python-sdk-office-smoke",
|
||||
"inject": ["skills"],
|
||||
"inject": ["officeKit"],
|
||||
"name": plugin.as_uri(),
|
||||
"config": {"input": str(document), "output": str(output), "result": str(result_path),
|
||||
"imageInput": str(documents["pptx"]), "imageOutput": str(root / "node-pptx")},
|
||||
|
||||
@@ -890,11 +890,12 @@
|
||||
"seq": 37,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"version": 0,
|
||||
"version": 3,
|
||||
"childId": "{{child-1}}",
|
||||
"childCreatedAt": 0,
|
||||
"mode": "continuable",
|
||||
"label": "Check direct child"
|
||||
"label": "Check direct child",
|
||||
"name": "agent-1"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -914,7 +915,7 @@
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "started subagent {{child-1}}"
|
||||
"text": "started subagent agent-1"
|
||||
}
|
||||
],
|
||||
"isError": false,
|
||||
@@ -922,7 +923,7 @@
|
||||
},
|
||||
"meta": {
|
||||
"kind": "activation",
|
||||
"subagentId": "{{child-1}}"
|
||||
"name": "agent-1"
|
||||
}
|
||||
},
|
||||
"sourceEventSeqs": [
|
||||
@@ -970,7 +971,7 @@
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "Background subagent {{child-1}} finished and will do no further work unless you send it more."
|
||||
"text": "Background subagent agent-1 finished and will do no further work unless you send it more."
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
@@ -984,7 +985,7 @@
|
||||
"source": {
|
||||
"kind": "subagent-settled",
|
||||
"form": "notice",
|
||||
"summary": "Background subagent {{child-1}} finished and will do no further work unless you send it more.",
|
||||
"summary": "Background subagent agent-1 finished and will do no further work unless you send it more.",
|
||||
"stopReason": "completed",
|
||||
"senderSessionId": "{{child-1}}"
|
||||
},
|
||||
@@ -1144,11 +1145,12 @@
|
||||
"seq": 46,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"version": 0,
|
||||
"version": 3,
|
||||
"childId": "{{child-2}}",
|
||||
"childCreatedAt": 0,
|
||||
"mode": "continuable",
|
||||
"label": "advanced-exe-snapshot child 1"
|
||||
"label": "advanced-exe-snapshot child 1",
|
||||
"name": "agent-2"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1248,7 +1250,7 @@
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "Background subagent {{child-1}} finished and will do no further work unless you send it more."
|
||||
"text": "Background subagent agent-1 finished and will do no further work unless you send it more."
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
@@ -1262,7 +1264,7 @@
|
||||
"source": {
|
||||
"kind": "subagent-settled",
|
||||
"form": "notice",
|
||||
"summary": "Background subagent {{child-1}} finished and will do no further work unless you send it more.",
|
||||
"summary": "Background subagent agent-1 finished and will do no further work unless you send it more.",
|
||||
"stopReason": "completed",
|
||||
"senderSessionId": "{{child-1}}"
|
||||
},
|
||||
@@ -2778,11 +2780,12 @@
|
||||
"seq": 37,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"version": 0,
|
||||
"version": 3,
|
||||
"childId": "{{child-1}}",
|
||||
"childCreatedAt": 0,
|
||||
"mode": "continuable",
|
||||
"label": "Check direct child"
|
||||
"label": "Check direct child",
|
||||
"name": "agent-1"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2808,7 +2811,7 @@
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "started subagent {{child-1}}"
|
||||
"text": "started subagent agent-1"
|
||||
}
|
||||
],
|
||||
"isError": false,
|
||||
@@ -2816,7 +2819,7 @@
|
||||
},
|
||||
"meta": {
|
||||
"kind": "activation",
|
||||
"subagentId": "{{child-1}}"
|
||||
"name": "agent-1"
|
||||
}
|
||||
},
|
||||
"sourceEventSeqs": [
|
||||
@@ -3275,7 +3278,7 @@
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "Background subagent {{child-1}} finished and will do no further work unless you send it more."
|
||||
"text": "Background subagent agent-1 finished and will do no further work unless you send it more."
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
@@ -3289,7 +3292,7 @@
|
||||
"source": {
|
||||
"kind": "subagent-settled",
|
||||
"form": "notice",
|
||||
"summary": "Background subagent {{child-1}} finished and will do no further work unless you send it more.",
|
||||
"summary": "Background subagent agent-1 finished and will do no further work unless you send it more.",
|
||||
"stopReason": "completed",
|
||||
"senderSessionId": "{{child-1}}"
|
||||
},
|
||||
@@ -3676,11 +3679,12 @@
|
||||
"seq": 46,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"version": 0,
|
||||
"version": 3,
|
||||
"childId": "{{child-2}}",
|
||||
"childCreatedAt": 0,
|
||||
"mode": "continuable",
|
||||
"label": "advanced-exe-snapshot child 1"
|
||||
"label": "advanced-exe-snapshot child 1",
|
||||
"name": "agent-2"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4228,7 +4232,7 @@
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "Background subagent {{child-1}} finished and will do no further work unless you send it more."
|
||||
"text": "Background subagent agent-1 finished and will do no further work unless you send it more."
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
@@ -4242,7 +4246,7 @@
|
||||
"source": {
|
||||
"kind": "subagent-settled",
|
||||
"form": "notice",
|
||||
"summary": "Background subagent {{child-1}} finished and will do no further work unless you send it more.",
|
||||
"summary": "Background subagent agent-1 finished and will do no further work unless you send it more.",
|
||||
"stopReason": "completed",
|
||||
"senderSessionId": "{{child-1}}"
|
||||
},
|
||||
|
||||
@@ -36,16 +36,16 @@
|
||||
{"type":"session-log-deepseek/delivery-accepted","data":{"sessionId":"{{parent}}","sessionFormatVersion":4,"throughSeq":33}}
|
||||
{"type":"assistant/message","data":{"turn":1,"step":3,"message":{"role":"assistant","content":[{"type":"tool-call","id":"advanced-direct-child","name":"subagent","arguments":"{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"}]}},"id":"{{messageId}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"advanced-direct-child","name":"subagent","args":[""]},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"advanced-direct-child","args":["{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"advanced-direct-child","name":"subagent","arguments":"{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"}]}}}]},"surfaceOp":"append"}
|
||||
{"type":"tool/call","data":{"turn":1,"step":3,"callId":"advanced-direct-child","name":"subagent","arguments":"{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}"}}
|
||||
{"type":"subagent/catalog","data":{"version":0,"childId":"{{child-1}}","childCreatedAt":0,"mode":"continuable","label":"Check direct child"}}
|
||||
{"type":"tool/result","data":{"turn":1,"step":3,"message":{"role":"tool","source":{"kind":"tool","callId":"advanced-direct-child"},"toolCallId":"advanced-direct-child","content":[{"type":"text","text":"started subagent {{child-1}}"}],"isError":false,"id":"{{messageId}}"},"meta":{"kind":"activation","subagentId":"{{child-1}}"}},"sourceEventSeqs":[36],"surfaceOp":"append"}
|
||||
{"type":"subagent/catalog","data":{"version":3,"childId":"{{child-1}}","childCreatedAt":0,"mode":"continuable","label":"Check direct child","name":"agent-1"}}
|
||||
{"type":"tool/result","data":{"turn":1,"step":3,"message":{"role":"tool","source":{"kind":"tool","callId":"advanced-direct-child"},"toolCallId":"advanced-direct-child","content":[{"type":"text","text":"started subagent agent-1"}],"isError":false,"id":"{{messageId}}"},"meta":{"kind":"activation","name":"agent-1"}},"sourceEventSeqs":[36],"surfaceOp":"append"}
|
||||
{"type":"step/end","data":{"turn":1,"step":3}}
|
||||
{"type":"step/start","data":{"turn":1,"step":4}}
|
||||
{"type":"session-log-deepseek/delivery-accepted","data":{"sessionId":"{{parent}}","sessionFormatVersion":4,"throughSeq":40}}
|
||||
{"type":"agent/inbox/spliced","data":{"target":"next-step","start":0,"inserted":[{"content":[{"type":"text","text":"Background subagent {{child-1}} finished and will do no further work unless you send it more."},{"type":"text","text":"Its closing message:"},{"type":"text","text":"DIRECT_CHILD_OK"}],"source":{"kind":"subagent-settled","form":"notice","summary":"Background subagent {{child-1}} finished and will do no further work unless you send it more.","stopReason":"completed","senderSessionId":"{{child-1}}"},"role":"user","id":"{{messageId}}"}]}}
|
||||
{"type":"agent/inbox/spliced","data":{"target":"next-step","start":0,"inserted":[{"content":[{"type":"text","text":"Background subagent agent-1 finished and will do no further work unless you send it more."},{"type":"text","text":"Its closing message:"},{"type":"text","text":"DIRECT_CHILD_OK"}],"source":{"kind":"subagent-settled","form":"notice","summary":"Background subagent agent-1 finished and will do no further work unless you send it more.","stopReason":"completed","senderSessionId":"{{child-1}}"},"role":"user","id":"{{messageId}}"}]}}
|
||||
{"type":"assistant/message","data":{"turn":1,"step":4,"message":{"role":"assistant","content":[{"type":"tool-call","id":"advanced-workflow","name":"workflow","arguments":"{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"}]}},"id":"{{messageId}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"advanced-workflow","name":"workflow","args":[""]},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"advanced-workflow","args":["{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"advanced-workflow","name":"workflow","arguments":"{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"}]}}}]},"surfaceOp":"append"}
|
||||
{"type":"tool/call","data":{"turn":1,"step":4,"callId":"advanced-workflow","name":"workflow","arguments":"{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}"}}
|
||||
{"type":"tool-workflow/run-start","data":{"runId":"{{workflow-run}}","name":"advanced-exe-snapshot"}}
|
||||
{"type":"subagent/catalog","data":{"version":0,"childId":"{{child-2}}","childCreatedAt":0,"mode":"continuable","label":"advanced-exe-snapshot child 1"}}
|
||||
{"type":"subagent/catalog","data":{"version":3,"childId":"{{child-2}}","childCreatedAt":0,"mode":"continuable","label":"advanced-exe-snapshot child 1","name":"agent-2"}}
|
||||
{"type":"tool-workflow/agent-start","data":{"runId":"{{workflow-run}}","seq":1,"label":"workflow-child","phase":"Delegate","childId":"{{child-2}}"}}
|
||||
{"type":"tool-workflow/agent-end","data":{"runId":"{{workflow-run}}","seq":1,"outcome":"completed"}}
|
||||
{"type":"tool-workflow/run-end","data":{"runId":"{{workflow-run}}","stopReason":"completed"}}
|
||||
@@ -53,7 +53,7 @@
|
||||
{"type":"step/end","data":{"turn":1,"step":4}}
|
||||
{"type":"agent/inbox/spliced","data":{"target":"next-step","start":0,"removedCount":1,"inserted":[]}}
|
||||
{"type":"step/start","data":{"turn":1,"step":5}}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"Background subagent {{child-1}} finished and will do no further work unless you send it more."},{"type":"text","text":"Its closing message:"},{"type":"text","text":"DIRECT_CHILD_OK"}],"source":{"kind":"subagent-settled","form":"notice","summary":"Background subagent {{child-1}} finished and will do no further work unless you send it more.","stopReason":"completed","senderSessionId":"{{child-1}}"},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"Background subagent agent-1 finished and will do no further work unless you send it more."},{"type":"text","text":"Its closing message:"},{"type":"text","text":"DIRECT_CHILD_OK"}],"source":{"kind":"subagent-settled","form":"notice","summary":"Background subagent agent-1 finished and will do no further work unless you send it more.","stopReason":"completed","senderSessionId":"{{child-1}}"},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"session-log-deepseek/delivery-accepted","data":{"sessionId":"{{parent}}","sessionFormatVersion":4,"throughSeq":54}}
|
||||
{"type":"assistant/message","data":{"turn":1,"step":5,"message":{"role":"assistant","content":[{"type":"text","text":"ADVANCED_EXECUTABLE_OK"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"text"}]}},"id":"{{message:1}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":0,"dt":[],"texts":["ADVANCED_EXECUTABLE_OK"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"ADVANCED_EXECUTABLE_OK"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"text"}]}}}]},"surfaceOp":"append"}
|
||||
{"type":"step/end","data":{"turn":1,"step":5}}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
}
|
||||
},
|
||||
"catalogs": [
|
||||
"Query the packaged Python environment for Office authoring.<system-reminder>\nThe following information describes your current session:\n\nCurrent working directory: \"{{cwd}}\".\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).\n\nYou are the root agent. Your agent id is \"authoring\".\n\nTo message other agents, use send_message({ agent_id: \"<agent-id>\", message: \"...\" }).\nUse list_agents({}) to find your collaborator agents and their ids.\n</system-reminder><system-reminder>\nA skill is a reusable set of task-specific instructions. The following skills are available in this session:\n\n<available_skills>\n- `office`: Create, edit, inspect, or convert Office documents, spreadsheets, presentations, and PDFs. Load to choose the relevant workflow.\n- `office-docx`: Create, read, edit, and validate Word documents (.docx).\n- `office-export-pdf`: Convert an Office document to a requested PDF with LibreOffice Kit.\n- `office-pptx`: Create, read, edit, and validate PowerPoint presentations (.pptx).\n- `office-recalculate`: Refresh spreadsheet formula caches and verify calculated values with LibreOffice Kit.\n- `office-render`: Render requested document images or inspect visual layout with LibreOffice Kit.\n- `office-xlsx`: Read, create, edit, and validate Excel workbooks, data, and formulas (.xlsx).\n</available_skills>\n\nIf the user names a skill, or the task clearly matches a skill's description, call the `skill` tool with the exact skill name before taking task actions. Load all applicable skills, then follow their full instructions. This catalog contains summaries only; do not infer or follow a skill's instructions until it has been loaded.\nA user may also invoke a skill directly; its <skill_content> block then appears in this conversation. Follow it, and do not call the `skill` tool again for that skill.\n</system-reminder>Time sampled while preparing turn 1, step 1: 2026-10-16T00:00:00+00:00[UTC]\nBrowser time zone for this request: unavailable. Ask the user to clarify otherwise-unqualified dates and times.\nElapsed since the preceding model-visible message: unavailable."
|
||||
"Query the packaged Python environment for Office authoring.<system-reminder>\nThe following information describes your current session:\n\nCurrent working directory: \"{{cwd}}\".\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).\n\nYou are the root agent. Your name is \"lead\".\n\nTo message other agents, use send_message({ agent: \"<agent-name>\", message: \"...\" }).\nUse list_agents({}) to find your collaborator agents and their names.\n</system-reminder><system-reminder>\nA skill is a reusable set of task-specific instructions. The following skills are available in this session:\n\n<available_skills>\n- `office`: Create or edit Office files; inspect Office files and PDFs. Load before rendering, conversion, or recalculation to enable office_render, office_convert, and office_recalculate next step.\n- `office-docx`: Create, read, edit, and validate Word documents (.docx).\n- `office-pptx`: Create, read, edit, and validate PowerPoint presentations (.pptx).\n- `office-xlsx`: Read, create, edit, and validate Excel workbooks, data, and formulas (.xlsx).\n</available_skills>\n\nIf the user names a skill, or the task clearly matches a skill's description, call the `skill` tool with the exact skill name before taking task actions. Load all applicable skills, then follow their full instructions. This catalog contains summaries only; do not infer or follow a skill's instructions until it has been loaded.\nA user may also invoke a skill directly; its <skill_content> block then appears in this conversation. Follow it, and do not call the `skill` tool again for that skill.\n</system-reminder>Time sampled while preparing turn 1, step 1: 2026-10-16T00:00:00+00:00[UTC]\nBrowser time zone for this request: unavailable. Ask the user to clarify otherwise-unqualified dates and times.\nElapsed since the preceding model-visible message: unavailable."
|
||||
],
|
||||
"result": {
|
||||
"python": "{{python}}",
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
}
|
||||
},
|
||||
"catalogs": [
|
||||
"Query the packaged Python environment for Office authoring.<system-reminder>\nThe following information describes your current session:\n\nCurrent working directory: \"{{cwd}}\".\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).\n\nYou are the root agent. Your agent id is \"authoring\".\n\nTo message other agents, use send_message({ agent_id: \"<agent-id>\", message: \"...\" }).\nUse list_agents({}) to find your collaborator agents and their ids.\n</system-reminder><system-reminder>\nA skill is a reusable set of task-specific instructions. The following skills are available in this session:\n\n<available_skills>\n- `diagnose-windows-sandbox-acl`: Use on Windows for unexpected DSH sandbox access denials: workspace writes or listing fail, or an ordinarily readable path cannot be read. One bundled command inspects the path and every ancestor and repairs the ACL problems it proves in that same run. Expected confinement denials need no ACL repair.\n- `office`: Create, edit, inspect, or convert Office documents, spreadsheets, presentations, and PDFs. Load to choose the relevant workflow.\n- `office-docx`: Create, read, edit, and validate Word documents (.docx).\n- `office-export-pdf`: Convert an Office document to a requested PDF with LibreOffice Kit.\n- `office-pptx`: Create, read, edit, and validate PowerPoint presentations (.pptx).\n- `office-recalculate`: Refresh spreadsheet formula caches and verify calculated values with LibreOffice Kit.\n- `office-render`: Render requested document images or inspect visual layout with LibreOffice Kit.\n- `office-xlsx`: Read, create, edit, and validate Excel workbooks, data, and formulas (.xlsx).\n</available_skills>\n\nIf the user names a skill, or the task clearly matches a skill's description, call the `skill` tool with the exact skill name before taking task actions. Load all applicable skills, then follow their full instructions. This catalog contains summaries only; do not infer or follow a skill's instructions until it has been loaded.\nA user may also invoke a skill directly; its <skill_content> block then appears in this conversation. Follow it, and do not call the `skill` tool again for that skill.\n</system-reminder>Time sampled while preparing turn 1, step 1: 2026-10-16T00:00:00+00:00[UTC]\nBrowser time zone for this request: unavailable. Ask the user to clarify otherwise-unqualified dates and times.\nElapsed since the preceding model-visible message: unavailable."
|
||||
"Query the packaged Python environment for Office authoring.<system-reminder>\nThe following information describes your current session:\n\nCurrent working directory: \"{{cwd}}\".\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).\n\nYou are the root agent. Your name is \"lead\".\n\nTo message other agents, use send_message({ agent: \"<agent-name>\", message: \"...\" }).\nUse list_agents({}) to find your collaborator agents and their names.\n</system-reminder><system-reminder>\nA skill is a reusable set of task-specific instructions. The following skills are available in this session:\n\n<available_skills>\n- `diagnose-windows-sandbox-acl`: Use on Windows for unexpected DSH sandbox access denials: workspace writes or listing fail, or an ordinarily readable path cannot be read. One bundled command inspects the path and every ancestor and repairs the ACL problems it proves in that same run. Expected confinement denials need no ACL repair.\n- `office`: Create or edit Office files; inspect Office files and PDFs. Load before rendering, conversion, or recalculation to enable office_render, office_convert, and office_recalculate next step.\n- `office-docx`: Create, read, edit, and validate Word documents (.docx).\n- `office-pptx`: Create, read, edit, and validate PowerPoint presentations (.pptx).\n- `office-xlsx`: Read, create, edit, and validate Excel workbooks, data, and formulas (.xlsx).\n</available_skills>\n\nIf the user names a skill, or the task clearly matches a skill's description, call the `skill` tool with the exact skill name before taking task actions. Load all applicable skills, then follow their full instructions. This catalog contains summaries only; do not infer or follow a skill's instructions until it has been loaded.\nA user may also invoke a skill directly; its <skill_content> block then appears in this conversation. Follow it, and do not call the `skill` tool again for that skill.\n</system-reminder>Time sampled while preparing turn 1, step 1: 2026-10-16T00:00:00+00:00[UTC]\nBrowser time zone for this request: unavailable. Ask the user to clarify otherwise-unqualified dates and times.\nElapsed since the preceding model-visible message: unavailable."
|
||||
],
|
||||
"result": {
|
||||
"python": "{{python}}",
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
import { existsSync, mkdtempSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { cleanStagedDshDocs, publishedDocuments, stageDshDocs } from './stage-dsh-docs.ts'
|
||||
|
||||
const roots: string[] = []
|
||||
|
||||
function temporaryRoot(): string {
|
||||
const root = mkdtempSync(join(tmpdir(), 'dsh-stage-docs-'))
|
||||
roots.push(root)
|
||||
return root
|
||||
}
|
||||
|
||||
function write(root: string, path: string, contents = '# fixture\n'): void {
|
||||
const target = join(root, path)
|
||||
mkdirSync(join(target, '..'), { recursive: true })
|
||||
writeFileSync(target, contents)
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true })
|
||||
})
|
||||
|
||||
describe('documentation staging', () => {
|
||||
it('copies published pages, assets, and upgrade guides without the internal trees', async () => {
|
||||
const source = join(temporaryRoot(), 'docs')
|
||||
const destination = join(temporaryRoot(), 'cli', 'docs')
|
||||
const published = new Set(['guide/index.md', 'guide/index.zh.md'])
|
||||
write(source, 'guide/index.md')
|
||||
write(source, 'guide/index.zh.md')
|
||||
write(source, 'guide/index.i18n.yaml')
|
||||
write(source, 'images/diagram.png', 'png')
|
||||
write(source, 'upgrade-guide/v0.1.0/change/guide.md', '---\ndescription: "Change."\n---\n# Change\n')
|
||||
write(source, 'upgrade-guide/v0.1.0/change/guide.zh.md', '---\ndescription: "变更。"\n---\n# 变更\n')
|
||||
write(source, 'upgrade-guide/v0.1.0/change/guide.i18n.yaml')
|
||||
write(source, 'postmortem/incident.md')
|
||||
write(source, 'AGENTS.md')
|
||||
write(source, 'persistence-changes/v1/changes.md')
|
||||
write(source, 'i18n/terminology.md')
|
||||
|
||||
await stageDshDocs(source, destination, published)
|
||||
|
||||
for (const copied of [
|
||||
'guide/index.md', 'guide/index.zh.md', 'images/diagram.png',
|
||||
'upgrade-guide/v0.1.0/change/guide.md', 'upgrade-guide/v0.1.0/change/guide.zh.md', 'upgrade-guide/README.md',
|
||||
]) {
|
||||
expect(existsSync(join(destination, copied)), copied).toBe(true)
|
||||
}
|
||||
for (const excluded of [
|
||||
'guide/index.i18n.yaml', 'upgrade-guide/v0.1.0/change/guide.i18n.yaml',
|
||||
'postmortem', 'AGENTS.md', 'persistence-changes', 'i18n',
|
||||
]) {
|
||||
expect(existsSync(join(destination, excluded)), excluded).toBe(false)
|
||||
}
|
||||
})
|
||||
|
||||
it('indexes every staged upgrade guide by the release it upgrades from, newest first', async () => {
|
||||
const source = join(temporaryRoot(), 'docs')
|
||||
const destination = join(temporaryRoot(), 'cli', 'docs')
|
||||
const guide = (description: string, title: string): string => `---\nkind: upgrade-guide\ndescription: "${description}"\n---\n# ${title}\n`
|
||||
write(source, 'upgrade-guide/v0.2.0-rc.1/b-item/guide.md', '---\r\n# note\r\nkind: upgrade-guide\r\ndescription: >\r\n Second | change\r\n across lines.\r\n---\r\n# Second\r\n')
|
||||
write(source, 'upgrade-guide/v0.2.0-rc.1/b-item/guide.zh.md', guide('第二项。', '第二'))
|
||||
write(source, 'upgrade-guide/v0.2.0-rc.1/a-item/guide.md', guide('First change.', 'First'))
|
||||
write(source, 'upgrade-guide/v0.2.0-rc.1/a-item/guide.zh.md', guide('第一项。', '第一'))
|
||||
write(source, 'upgrade-guide/v0.10.0/c-item/guide.md', guide('Later change.', 'Later'))
|
||||
write(source, 'upgrade-guide/v0.10.0/c-item/guide.zh.md', guide('后续变更。', '后续'))
|
||||
|
||||
await stageDshDocs(source, destination, new Set())
|
||||
const index = readFileSync(join(destination, 'upgrade-guide/README.md'), 'utf8')
|
||||
await stageDshDocs(source, destination, new Set())
|
||||
|
||||
expect(readFileSync(join(destination, 'upgrade-guide/README.md'), 'utf8')).toBe(index)
|
||||
expect(index).toContain('upgrading from release vT to the release after it; vT is the release being left, not the target')
|
||||
const sections = index.split('\n## ').slice(1).map(section => section.split('\n').filter(line => line.startsWith('| ') && !line.startsWith('| Item') && !line.startsWith('| ---')))
|
||||
expect(index.match(/^## .+$/gmu)).toEqual(['## v0.10.0', '## v0.2.0-rc.1'])
|
||||
expect(sections).toEqual([
|
||||
['| Later | Later change. | 后续变更。 | [v0.10.0/c-item/guide.md](v0.10.0/c-item/guide.md) | [v0.10.0/c-item/guide.zh.md](v0.10.0/c-item/guide.zh.md) |'],
|
||||
[
|
||||
'| First | First change. | 第一项。 | [v0.2.0-rc.1/a-item/guide.md](v0.2.0-rc.1/a-item/guide.md) | [v0.2.0-rc.1/a-item/guide.zh.md](v0.2.0-rc.1/a-item/guide.zh.md) |',
|
||||
'| Second | Second \\| change across lines. | 第二项。 | [v0.2.0-rc.1/b-item/guide.md](v0.2.0-rc.1/b-item/guide.md) | [v0.2.0-rc.1/b-item/guide.zh.md](v0.2.0-rc.1/b-item/guide.zh.md) |',
|
||||
],
|
||||
])
|
||||
})
|
||||
|
||||
it('writes a preamble-only index without guides and rejects a guide the index cannot describe', async () => {
|
||||
const source = join(temporaryRoot(), 'docs')
|
||||
const destination = join(temporaryRoot(), 'cli', 'docs')
|
||||
write(source, 'kept.md')
|
||||
await stageDshDocs(source, destination, new Set(['kept.md']))
|
||||
expect(readFileSync(join(destination, 'upgrade-guide/README.md'), 'utf8')).not.toContain('## ')
|
||||
|
||||
write(source, 'upgrade-guide/v0.1.0/change/guide.md', '# Untitled summary\n')
|
||||
write(source, 'upgrade-guide/v0.1.0/change/guide.zh.md', '# 无摘要\n')
|
||||
await expect(stageDshDocs(source, destination, new Set())).rejects.toThrow(/needs a frontmatter description and a level-one title/)
|
||||
})
|
||||
|
||||
it('publishes the generated index for the repository guides', async () => {
|
||||
const destination = join(temporaryRoot(), 'cli', 'docs')
|
||||
await stageDshDocs(join(import.meta.dirname, '..', 'docs'), destination)
|
||||
const index = readFileSync(join(destination, 'upgrade-guide/README.md'), 'utf8')
|
||||
for (const file of readdirSync(join(import.meta.dirname, '..', 'docs/upgrade-guide'), { recursive: true, encoding: 'utf8' })) {
|
||||
if (file.endsWith('guide.md')) expect(index).toContain(`](${file.split('\\').join('/')})`)
|
||||
}
|
||||
})
|
||||
|
||||
it('replaces a previous copy instead of merging into it', async () => {
|
||||
const source = join(temporaryRoot(), 'docs')
|
||||
const destination = join(temporaryRoot(), 'cli', 'docs')
|
||||
write(source, 'kept.md')
|
||||
write(destination, 'removed.md')
|
||||
|
||||
await stageDshDocs(source, destination, new Set(['kept.md']))
|
||||
|
||||
expect(existsSync(join(destination, 'kept.md'))).toBe(true)
|
||||
expect(existsSync(join(destination, 'removed.md'))).toBe(false)
|
||||
})
|
||||
|
||||
it('removes a staged copy', async () => {
|
||||
const destination = join(temporaryRoot(), 'cli', 'docs')
|
||||
write(destination, 'architecture.md')
|
||||
|
||||
await cleanStagedDshDocs(destination)
|
||||
|
||||
expect(existsSync(destination)).toBe(false)
|
||||
})
|
||||
|
||||
it('publishes the website manifest pages and no internal document', () => {
|
||||
const published = publishedDocuments()
|
||||
|
||||
expect(published.has('architecture.md')).toBe(true)
|
||||
expect(published.has('architecture.zh.md')).toBe(true)
|
||||
for (const excluded of ['AGENTS.md', 'testing.md', 'postmortem/README.md', 'persistence-changes/README.md', 'i18n/README.md']) {
|
||||
expect(published.has(excluded)).toBe(false)
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,185 @@
|
||||
/** Stage the published documentation inside the published `dsh` package. */
|
||||
|
||||
import { cp, mkdir, readdir, readFile, rm, writeFile } from 'node:fs/promises'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { JSON_SCHEMA, load as loadYaml } from 'js-yaml'
|
||||
import { rcompare } from 'semver'
|
||||
import { docsPages } from '../website/docs.ts'
|
||||
|
||||
/** Repository root, resolved from this script rather than the invoking directory. */
|
||||
const REPOSITORY_ROOT = fileURLToPath(new URL('..', import.meta.url))
|
||||
|
||||
/** Directory whose contents are published, and the package directory that receives them. */
|
||||
const DOCS_DIRECTORY = join(REPOSITORY_ROOT, 'docs')
|
||||
const STAGED_DIRECTORY = join(REPOSITORY_ROOT, 'apps', 'cli', 'docs')
|
||||
|
||||
/** Generated migration records and the translation guidelines: maintainer material no reader in an installed package needs. */
|
||||
const EXCLUDED_DIRECTORIES = ['persistence-changes', 'i18n'] as const
|
||||
|
||||
/** Translation alignment records the documentation gates own. */
|
||||
const EXCLUDED_SUFFIX = '.i18n.yaml'
|
||||
|
||||
/** Upgrade guides reach an installed reader and are not on the website. */
|
||||
const ALWAYS_PUBLISHED_DIRECTORY = 'upgrade-guide'
|
||||
|
||||
/** Generated index of the staged upgrade guides; the repository tree has none. */
|
||||
const UPGRADE_GUIDE_INDEX = `${ALWAYS_PUBLISHED_DIRECTORY}/README.md`
|
||||
|
||||
/**
|
||||
* Source-relative Markdown paths the documentation website publishes.
|
||||
*
|
||||
* The npm payload carries the same pages plus the upgrade guides, so a new
|
||||
* internal document under `docs/` reaches neither surface until the manifest
|
||||
* adopts it.
|
||||
* @returns every manifest source and alias, relative to the documentation root.
|
||||
*/
|
||||
export function publishedDocuments(): ReadonlySet<string> {
|
||||
const published = new Set<string>()
|
||||
for (const page of docsPages) {
|
||||
for (const file of [page.source, ...page.sourceAliases ?? []]) {
|
||||
if (file.startsWith('docs/')) published.add(file.slice('docs/'.length))
|
||||
}
|
||||
}
|
||||
return published
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace a package's `docs` directory with the documentation a reader needs.
|
||||
*
|
||||
* The copy follows the working tree, so a pack publishes the `docs/` contents
|
||||
* the checkout holds rather than the committed tree. Runs from the `prepack`
|
||||
* lifecycle of `@deepseek-ai/dsh`, so packing the package and packing the
|
||||
* release set both publish the same files.
|
||||
* @param source - Documentation root to copy; defaults to the repository `docs`.
|
||||
* @param destination - Package directory to replace; defaults to `apps/cli/docs`.
|
||||
* @param published - Source-relative Markdown paths to keep; defaults to the website manifest.
|
||||
* @returns Resolves after the destination holds the filtered copy.
|
||||
*/
|
||||
export async function stageDshDocs(
|
||||
source: string = DOCS_DIRECTORY,
|
||||
destination: string = STAGED_DIRECTORY,
|
||||
published: ReadonlySet<string> = publishedDocuments(),
|
||||
): Promise<void> {
|
||||
await rm(destination, { recursive: true, force: true })
|
||||
const files = await stagedFiles(source, published)
|
||||
for (const file of files) {
|
||||
const target = join(destination, file)
|
||||
await mkdir(dirname(target), { recursive: true })
|
||||
await cp(join(source, file), target)
|
||||
}
|
||||
await mkdir(join(destination, ALWAYS_PUBLISHED_DIRECTORY), { recursive: true })
|
||||
await writeFile(join(destination, UPGRADE_GUIDE_INDEX), await upgradeGuideIndex(source, files))
|
||||
}
|
||||
|
||||
/** One upgrade guide pair as the generated index lists it. */
|
||||
interface IndexedGuide {
|
||||
readonly item: string
|
||||
readonly title: string
|
||||
readonly summary: string
|
||||
readonly summaryZh: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the index of every staged upgrade guide, grouped by the release it upgrades from.
|
||||
* @param source - Documentation root holding the guides.
|
||||
* @param files - Staged source-relative paths.
|
||||
* @returns the index Markdown; without staged guides it holds only the preamble.
|
||||
* @throws When a guide lacks its Chinese counterpart, a `description`, or a level-one title.
|
||||
*/
|
||||
async function upgradeGuideIndex(source: string, files: readonly string[]): Promise<string> {
|
||||
const versions = new Map<string, IndexedGuide[]>()
|
||||
for (const file of files) {
|
||||
const match = /^upgrade-guide\/v(?<version>[^/]+)\/(?<item>[^/]+)\/guide\.md$/u.exec(file)?.groups
|
||||
if (match?.version === undefined || match.item === undefined) continue
|
||||
const { version, item } = match
|
||||
const english = await guideHeading(join(source, file))
|
||||
const chinese = await guideHeading(join(source, file.replace(/\.md$/u, '.zh.md')))
|
||||
const guides = versions.get(version) ?? []
|
||||
guides.push({ item, title: english.title, summary: english.description, summaryZh: chinese.description })
|
||||
versions.set(version, guides)
|
||||
}
|
||||
const cell = (text: string): string => text.replace(/\s+/gu, ' ').trim().replaceAll('|', '\\|')
|
||||
const lines = [
|
||||
'# Upgrade guides',
|
||||
'',
|
||||
'Generated when `@deepseek-ai/dsh` is packed. A `v<T>` section lists what to change when upgrading from release vT to the release after it; vT is the release being left, not the target. Paths are relative to this file.',
|
||||
'',
|
||||
'打包 `@deepseek-ai/dsh` 时生成。`v<T>` 一节列出从 vT 版本升级到其下一个版本时需要做的修改;vT 是升级前的版本,不是目标版本。路径相对于本文件。',
|
||||
]
|
||||
for (const [version, guides] of [...versions].sort(([left], [right]) => rcompare(left, right))) {
|
||||
lines.push('', `## v${version}`, '', '| Item | Summary | 摘要 | English | 中文 |', '| --- | --- | --- | --- | --- |')
|
||||
for (const guide of guides) {
|
||||
const directory = `v${version}/${guide.item}`
|
||||
lines.push(`| ${cell(guide.title)} | ${cell(guide.summary)} | ${cell(guide.summaryZh)} | [${directory}/guide.md](${directory}/guide.md) | [${directory}/guide.zh.md](${directory}/guide.zh.md) |`)
|
||||
}
|
||||
}
|
||||
return `${lines.join('\n')}\n`
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the frontmatter description and level-one title of one guide.
|
||||
* @param path - Absolute guide path.
|
||||
* @returns the guide's one-sentence description and title.
|
||||
* @throws When the file is missing or lacks either field.
|
||||
*/
|
||||
async function guideHeading(path: string): Promise<{ readonly description: string; readonly title: string }> {
|
||||
const text = await readFile(path, 'utf8')
|
||||
// The same frontmatter rules as `verify-upgrade-guides`; the title is the first heading after it.
|
||||
const frontmatter = /^---\r?\n(?<yaml>[\s\S]*?)\r?\n---\r?\n/u.exec(text)
|
||||
const yaml = frontmatter?.groups?.yaml
|
||||
const metadata = yaml === undefined ? undefined : loadYaml(yaml, { schema: JSON_SCHEMA }) as { description?: unknown } | null
|
||||
const title = frontmatter === null ? undefined : /^# (?<title>.+?)\r?$/mu.exec(text.slice(frontmatter[0].length))?.groups?.title
|
||||
if (typeof metadata?.description !== 'string' || title === undefined) {
|
||||
throw new Error(`stage-dsh-docs: ${path} needs a frontmatter description and a level-one title`)
|
||||
}
|
||||
return { description: metadata.description, title }
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a staged copy, so no pack leaves a stale tree for the next one.
|
||||
* @param destination - Package directory to remove; defaults to `apps/cli/docs`.
|
||||
* @returns Resolves after the directory is absent.
|
||||
*/
|
||||
export async function cleanStagedDshDocs(destination: string = STAGED_DIRECTORY): Promise<void> {
|
||||
await rm(destination, { recursive: true, force: true })
|
||||
}
|
||||
|
||||
/**
|
||||
* List the files one stage publishes, in stable path order.
|
||||
* @param source - Documentation root to walk.
|
||||
* @param published - Source-relative Markdown paths to keep.
|
||||
* @returns source-relative POSIX paths of every published file.
|
||||
*/
|
||||
async function stagedFiles(source: string, published: ReadonlySet<string>): Promise<string[]> {
|
||||
const files: string[] = []
|
||||
const walk = async (directory: string): Promise<void> => {
|
||||
for (const entry of await readdir(join(source, directory), { withFileTypes: true })) {
|
||||
const path = directory === '' ? entry.name : `${directory}/${entry.name}`
|
||||
if (EXCLUDED_DIRECTORIES.some(excluded => path === excluded || path.startsWith(`${excluded}/`))) continue
|
||||
if (entry.isDirectory()) {
|
||||
await walk(path)
|
||||
continue
|
||||
}
|
||||
if (path.endsWith(EXCLUDED_SUFFIX)) continue
|
||||
if (path.endsWith('.md') && !published.has(path) && !isUpgradeGuide(path)) continue
|
||||
files.push(path)
|
||||
}
|
||||
}
|
||||
await walk('')
|
||||
return files.sort()
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether one path belongs to a shipped upgrade guide.
|
||||
* @param path - Source-relative documentation path.
|
||||
* @returns whether the path lives under the upgrade-guide tree.
|
||||
*/
|
||||
function isUpgradeGuide(path: string): boolean {
|
||||
return path.startsWith(`${ALWAYS_PUBLISHED_DIRECTORY}/`)
|
||||
}
|
||||
|
||||
if (import.meta.main) {
|
||||
if (process.argv.includes('--clean')) await cleanStagedDshDocs()
|
||||
else await stageDshDocs()
|
||||
}
|
||||
@@ -407,7 +407,6 @@ describe('translation scope discovery', () => {
|
||||
'coverage/report/README.md',
|
||||
'python/sdk-runtime/src/deepseek_harness_runtime/runtime/deepseek-harness-sdk-runtime-macos-arm64/README.md',
|
||||
'python/sdk-runtime/src/deepseek_harness_runtime/runtime/node/README.md',
|
||||
'python/sdk-runtime/src/deepseek_harness_runtime/runtime/macos-arm64/office-skills/office-docx/SKILL.md',
|
||||
])('excludes non-source or non-README path %s', (file) => {
|
||||
expect(isTranslationScopeFile(file)).toBe(false)
|
||||
})
|
||||
|
||||
@@ -142,6 +142,7 @@ export const TRANSLATION_SCOPE_GLOB_EXCLUDES = [
|
||||
'**/__pycache__/**',
|
||||
'**/.pytest_cache/**',
|
||||
'apps/web/dist/**',
|
||||
'apps/cli/docs/**',
|
||||
'.artifacts/**',
|
||||
'python/sdk-runtime/src/deepseek_harness_runtime/runtime/**',
|
||||
'vendor/**',
|
||||
@@ -154,6 +155,7 @@ function isTranslationSourceExcluded(file: string): boolean {
|
||||
|| segment.startsWith('.doc-typecheck-')
|
||||
|| segment.startsWith('.node-next-types-'))
|
||||
|| file.startsWith('apps/web/dist/')
|
||||
|| file.startsWith('apps/cli/docs/')
|
||||
|| file.startsWith('python/sdk-runtime/src/deepseek_harness_runtime/runtime/')
|
||||
}
|
||||
|
||||
|
||||
@@ -2382,6 +2382,11 @@
|
||||
"symbol": "SubagentActivation",
|
||||
"source": "packages/subagent/subagent/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/subagent.md",
|
||||
"symbol": "SubagentMemberNames",
|
||||
"source": "packages/subagent/subagent/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/product-telemetry.md",
|
||||
"symbol": "ProductTelemetryScalar",
|
||||
|
||||
@@ -85,7 +85,7 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
|
||||
'packages/browser-use/browser-use': { kind: 'none', reason: 'The registry only reserves a provider name; providers own browser tools and Session resources.' },
|
||||
'packages/experimental/browser-use-runtime': { kind: 'indirect', reason: 'Browser providers call the library to own resources and expose upstream MCP tools.' },
|
||||
'packages/computer-use/computer-use': { kind: 'none', reason: 'The registry only reserves provider names; providers own all model-facing tools and guidance.' },
|
||||
'packages/document/office-to-pdf': { kind: 'none', reason: 'The provider returns PDF bytes without constructing model input.' },
|
||||
'packages/document/office-kit': { kind: 'indirect', reason: 'The provider returns rendered and converted bytes; the Office tools own their model-visible results.' },
|
||||
|
||||
'packages/credentials/deepseek-account': { kind: 'none', reason: 'Account authorization registers no model context or tools; credentials affect HTTP authentication only.' },
|
||||
'packages/credentials/deepseek-account-platform': { kind: 'none', reason: 'Account authorization registers no model context or tools; credentials affect HTTP authentication only.' },
|
||||
@@ -148,7 +148,6 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
|
||||
'packages/client/ui-sidebar-right': { kind: 'none', reason: 'Browser-side UI plugin layer; registers nothing model-facing.' },
|
||||
'packages/client/ui-sidebar': { kind: 'none', reason: 'Browser-side UI plugin layer; registers nothing model-facing.' },
|
||||
'packages/client/ui-brand-official': { kind: 'none', reason: 'Browser-side presentation occupants; registers nothing model-facing.' },
|
||||
'packages/client/ui-conversation': { kind: 'none', reason: 'Browser-side UI plugin layer; registers nothing model-facing.' },
|
||||
'packages/client/ui-approval': { kind: 'none', reason: 'Browser-side approval presentation; registers nothing model-facing.' },
|
||||
'packages/client/ui-chat': { kind: 'none', reason: 'Browser-side Chat presentation; registers nothing model-facing.' },
|
||||
'packages/client/ui-message-feedback': { kind: 'none', reason: 'Browser-side controls over log-only message feedback; ratings and notes never enter model context or change model-input tokens.' },
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { execFileSync } from 'node:child_process'
|
||||
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { collectUpgradeGuideViolations } from './verify-upgrade-guides.ts'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { collectStaleUpgradeGuideAdditions, collectUpgradeGuideViolations } from './verify-upgrade-guides.ts'
|
||||
|
||||
const roots: string[] = []
|
||||
|
||||
@@ -39,17 +40,38 @@ const VALID_ZH = VALID
|
||||
.replace('## Change', '## 变更')
|
||||
.replace('## Migration', '## 迁移')
|
||||
|
||||
function fixtureRoot(files: Record<string, string>): string {
|
||||
const root = mkdtempSync(join(tmpdir(), 'dsh-upgrade-guides-'))
|
||||
roots.push(root)
|
||||
function writeGuides(root: string, files: Record<string, string>): void {
|
||||
for (const [file, source] of Object.entries(files)) {
|
||||
const path = join(root, 'docs/upgrade-guide', file)
|
||||
mkdirSync(dirname(path), { recursive: true })
|
||||
writeFileSync(path, source)
|
||||
}
|
||||
}
|
||||
|
||||
function fixtureRoot(files: Record<string, string>): string {
|
||||
const root = mkdtempSync(join(tmpdir(), 'dsh-upgrade-guides-'))
|
||||
roots.push(root)
|
||||
writeGuides(root, files)
|
||||
return root
|
||||
}
|
||||
|
||||
/** Run Git with an identity and no user or system configuration, so the fixture ignores the host's settings. */
|
||||
function git(cwd: string, ...args: string[]): string {
|
||||
return execFileSync('git', ['-c', 'user.name=t', '-c', '[email protected]', '-c', 'commit.gpgsign=false', '-c', 'init.defaultBranch=master', ...args], {
|
||||
cwd,
|
||||
encoding: 'utf8',
|
||||
env: { ...process.env, GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1' },
|
||||
})
|
||||
}
|
||||
|
||||
/** Commit `files` with the root version `version` on top of the current branch. */
|
||||
function commit(root: string, version: string, files: Record<string, string>): void {
|
||||
writeFileSync(join(root, 'package.json'), `${JSON.stringify({ version })}\n`)
|
||||
writeGuides(root, files)
|
||||
git(root, 'add', '-A')
|
||||
git(root, 'commit', '-q', '-m', version)
|
||||
}
|
||||
|
||||
describe('upgrade guide gate', () => {
|
||||
it('accepts an absent tree and conforming guide pairs, including prerelease versions and CRLF files', () => {
|
||||
expect(collectUpgradeGuideViolations(fixtureRoot({}))).toEqual([])
|
||||
@@ -127,4 +149,80 @@ describe('upgrade guide gate', () => {
|
||||
'v0.1.7/over-limit/guide.zh.md': `${VALID_ZH}${'词 '.repeat(600)}\n`,
|
||||
}))).toEqual(['docs/upgrade-guide/v0.1.7/over-limit/guide.md: 501 words exceeds the 500-word ceiling'])
|
||||
})
|
||||
|
||||
describe('added guide versions', () => {
|
||||
const MESSAGE = ': added outside the current version directory; the root version is 0.2.2-rc.1, so move the guide to docs/upgrade-guide/v0.2.2-rc.1/<item>/'
|
||||
|
||||
beforeEach(() => {
|
||||
vi.stubEnv('GIT_CONFIG_GLOBAL', '/dev/null')
|
||||
vi.stubEnv('GIT_CONFIG_NOSYSTEM', '1')
|
||||
})
|
||||
afterEach(() => {
|
||||
vi.unstubAllEnvs()
|
||||
})
|
||||
|
||||
/** An `origin` whose master holds released guides and whose `release/dsh-0.2.1` branch adds a backported one. */
|
||||
function originRoot(): string {
|
||||
const origin = fixtureRoot({})
|
||||
git(origin, 'init', '-q')
|
||||
commit(origin, '0.2.2-alpha.3', { 'v0.2.2-alpha.3/frozen/guide.md': VALID, 'v0.2.2-alpha.3/moving/guide.md': VALID })
|
||||
git(origin, 'checkout', '-q', '-b', 'release/dsh-0.2.1')
|
||||
commit(origin, '0.2.1-rc.4', { 'v0.2.1-rc.4/backport/guide.md': VALID })
|
||||
git(origin, 'checkout', '-q', 'master')
|
||||
return origin
|
||||
}
|
||||
|
||||
/** A clone of `origin`'s master whose index bumps the root version to 0.2.2-rc.1 and stages `files`. */
|
||||
function bumpedClone(origin: string, files: Record<string, string>, ...cloneArgs: string[]): string {
|
||||
const root = fixtureRoot({})
|
||||
git(root, 'clone', '-q', '--single-branch', ...cloneArgs, origin, '.')
|
||||
writeFileSync(join(root, 'package.json'), `${JSON.stringify({ version: '0.2.2-rc.1' })}\n`)
|
||||
writeGuides(root, files)
|
||||
git(root, 'add', '-A')
|
||||
return root
|
||||
}
|
||||
|
||||
it('accepts guides added in the current directory, edits of released guides, and moves out of a released directory', () => {
|
||||
const root = bumpedClone(originRoot(), { 'v0.2.2-rc.1/current/guide.md': VALID, 'v0.2.2-alpha.3/frozen/guide.md': `${VALID}edited\n` })
|
||||
git(root, 'mv', 'docs/upgrade-guide/v0.2.2-alpha.3/moving', 'docs/upgrade-guide/v0.2.2-rc.1/moving')
|
||||
expect(collectStaleUpgradeGuideAdditions(root, 'HEAD')).toEqual([])
|
||||
})
|
||||
|
||||
it('rejects guides added in a released directory unless the release branch of their line has them', () => {
|
||||
const root = bumpedClone(originRoot(), {
|
||||
'v0.2.2-alpha.3/stale/guide.md': VALID,
|
||||
'v0.2.1-rc.4/backport/guide.md': VALID,
|
||||
'v0.2.1-rc.4/backport/guide.zh.md': VALID_ZH,
|
||||
'v0.2.0-rc.2/no-branch/guide.md': VALID,
|
||||
'README.md': VALID,
|
||||
})
|
||||
expect(collectStaleUpgradeGuideAdditions(root, 'HEAD')).toEqual([
|
||||
'docs/upgrade-guide/v0.2.0-rc.2/no-branch/guide.md',
|
||||
'docs/upgrade-guide/v0.2.1-rc.4/backport/guide.zh.md',
|
||||
'docs/upgrade-guide/v0.2.2-alpha.3/stale/guide.md',
|
||||
].map(path => `${path}${MESSAGE}`))
|
||||
expect(git(root, 'for-each-ref', 'refs/remotes/origin/release')).toBe('')
|
||||
})
|
||||
|
||||
it('reads a release branch tip in a shallow clone, fetching it only when absent, without cutting the history it already has', () => {
|
||||
const origin = originRoot()
|
||||
git(origin, 'merge', '-q', '--no-edit', 'release/dsh-0.2.1')
|
||||
commit(origin, '0.2.2-alpha.3', { 'v0.2.2-alpha.3/later/guide.md': VALID })
|
||||
const root = bumpedClone(`file://${origin}`, { 'v0.2.1-rc.4/backport-again/guide.md': VALID }, '--depth=3')
|
||||
const history = git(root, 'rev-list', 'HEAD')
|
||||
expect(git(root, 'rev-parse', '--is-shallow-repository').trim()).toBe('true')
|
||||
expect(collectStaleUpgradeGuideAdditions(root, 'HEAD')).toEqual([`docs/upgrade-guide/v0.2.1-rc.4/backport-again/guide.md${MESSAGE}`])
|
||||
expect(git(root, 'rev-list', 'HEAD')).toBe(history)
|
||||
|
||||
git(origin, 'checkout', '-q', 'release/dsh-0.2.1')
|
||||
commit(origin, '0.2.1-rc.5', { 'v0.2.1-rc.4/backport-again/guide.md': VALID })
|
||||
expect(collectStaleUpgradeGuideAdditions(root, 'HEAD')).toEqual([])
|
||||
expect(git(root, 'rev-list', 'HEAD')).toBe(history)
|
||||
})
|
||||
|
||||
it('names the failing Git command for an unknown base', () => {
|
||||
const root = bumpedClone(originRoot(), {})
|
||||
expect(() => collectStaleUpgradeGuideAdditions(root, 'no-such-ref')).toThrow(/`git diff .* no-such-ref -- docs\/upgrade-guide` failed: /u)
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -1,12 +1,15 @@
|
||||
/**
|
||||
* Enforce the `docs/upgrade-guide/v<version>/<item>/guide.md` layout, metadata,
|
||||
* sections, and word ceiling defined by the `dsh-create-upgrade-guide` skill.
|
||||
* With `--base <ref>`, it also rejects guides added since that commit outside the root version's directory.
|
||||
* `verify-translation-pairing` owns the Chinese sibling's pairing record.
|
||||
* @module scripts/verify-upgrade-guides
|
||||
*/
|
||||
|
||||
import { execFileSync, spawnSync } from 'node:child_process'
|
||||
import { existsSync, readFileSync, readdirSync } from 'node:fs'
|
||||
import { join, resolve } from 'node:path'
|
||||
import { parseArgs } from 'node:util'
|
||||
import { JSON_SCHEMA, load } from 'js-yaml'
|
||||
import { fromMarkdown } from 'mdast-util-from-markdown'
|
||||
|
||||
@@ -74,8 +77,63 @@ export function collectUpgradeGuideViolations(root: string): string[] {
|
||||
return violations
|
||||
}
|
||||
|
||||
/**
|
||||
* Report tracked guides added since `base` outside `docs/upgrade-guide/v<version>/`, where `<version>` is the
|
||||
* root `package.json` version. A version directory is frozen once that version is released, so a guide that a
|
||||
* pull request wrote before a release must move to the new version's directory before it merges. A guide that
|
||||
* the tip of `origin`'s `release/dsh-<x.y.z>` branch for its version line already contains passes, because
|
||||
* merging a release branch forward carries guides that were current on it. The tip is fetched by commit id,
|
||||
* without updating any ref, only when such a guide exists and the commit is absent locally; a shallow
|
||||
* repository fetches only that commit.
|
||||
* @param root - Repository root: a Git working tree with an `origin` remote.
|
||||
* @param base - Commit the working tree is compared with: the base-branch commit a pull request merges.
|
||||
* @returns diagnostics prefixed by the repository-relative guide path.
|
||||
* @throws Error naming the Git command when Git fails, such as for an unknown `base` or an unreachable `origin`.
|
||||
*/
|
||||
export function collectStaleUpgradeGuideAdditions(root: string, base: string): string[] {
|
||||
const git = (args: readonly string[]): string => {
|
||||
try {
|
||||
return execFileSync('git', args, { cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] })
|
||||
} catch (error: unknown) {
|
||||
const stderr = (error as { stderr?: unknown }).stderr
|
||||
throw new Error(`\`git ${args.join(' ')}\` failed: ${typeof stderr === 'string' && stderr.trim() !== '' ? stderr.trim() : String(error)}`, { cause: error })
|
||||
}
|
||||
}
|
||||
const { version } = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')) as { version?: unknown }
|
||||
if (typeof version !== 'string') throw new Error('package.json: version must be a string')
|
||||
const current = `${GUIDE_ROOT}/v${version}/`
|
||||
const released = new Map<string, ReadonlySet<string>>()
|
||||
const releasedGuides = (line: string): ReadonlySet<string> => {
|
||||
const tip = git(['ls-remote', 'origin', `refs/heads/release/dsh-${line}`]).split('\t')[0]?.trim() ?? ''
|
||||
if (tip === '') return new Set()
|
||||
if (spawnSync('git', ['cat-file', '-e', `${tip}^{commit}`], { cwd: root, stdio: 'ignore' }).status !== 0) {
|
||||
// Fetching a commit already in a shallow repository with `--depth` would cut the history behind it.
|
||||
const shallow = git(['rev-parse', '--is-shallow-repository']).trim() === 'true'
|
||||
// A background maintenance run after a shallow fetch rewrites .git/shallow under later Git commands.
|
||||
git(['-c', 'maintenance.auto=false', '-c', 'gc.auto=0', 'fetch', '--quiet', '--no-tags', '--no-write-fetch-head', ...(shallow ? ['--depth=1', '--filter=blob:none'] : []), 'origin', tip])
|
||||
}
|
||||
return new Set(git(['ls-tree', '-r', '-z', '--name-only', tip, '--', GUIDE_ROOT]).split('\0').filter(Boolean))
|
||||
}
|
||||
return git(['diff', '-z', '--name-only', '--no-renames', '--diff-filter=A', base, '--', GUIDE_ROOT])
|
||||
.split('\0')
|
||||
.filter((path) => {
|
||||
const line = /^v(\d+\.\d+\.\d+)/u.exec(path.split('/')[2] ?? '')?.[1]
|
||||
// `collectUpgradeGuideViolations` reports a path outside any version directory.
|
||||
if (path === '' || path.startsWith(current) || line === undefined) return false
|
||||
if (!released.has(line)) released.set(line, releasedGuides(line))
|
||||
return released.get(line)?.has(path) !== true
|
||||
})
|
||||
.map(path => `${path}: added outside the current version directory; the root version is ${version}, so move the guide to ${current}<item>/`)
|
||||
}
|
||||
|
||||
if (process.argv[1] && import.meta.filename === resolve(process.argv[1])) {
|
||||
const { values } = parseArgs({ options: { base: { type: 'string' } } })
|
||||
const violations = collectUpgradeGuideViolations(ROOT)
|
||||
try {
|
||||
if (values.base !== undefined) violations.push(...collectStaleUpgradeGuideAdditions(ROOT, values.base))
|
||||
} catch (error: unknown) {
|
||||
violations.push(`cannot check guides added since ${values.base ?? ''}: ${error instanceof Error ? error.message : String(error)}`)
|
||||
}
|
||||
if (violations.length > 0) {
|
||||
process.stderr.write('verify-upgrade-guides: violations found (see .agents/skills/dsh-create-upgrade-guide/SKILL.md):\n')
|
||||
for (const violation of violations) process.stderr.write(` ${violation}\n`)
|
||||
|
||||
@@ -62,6 +62,7 @@ it.skipIf(process.platform !== 'win32')('resets only the allocated checkout with
|
||||
|
||||
it('routes manual packaging to the dedicated runner with explicit preset and signing selection', () => {
|
||||
expect(Object.keys(workflow.on)).toEqual(['workflow_dispatch'])
|
||||
expect(workflow.on.workflow_dispatch).toMatchObject({ inputs: { version_mode: { default: 'default', options: ['default', 'follow-dsh', 'build-number', 'manual'] } } })
|
||||
expect(workflow.jobs.package).not.toHaveProperty('name')
|
||||
expect(job['runs-on']).toBe('dsh-win-package-trial')
|
||||
expect(JSON.stringify(job.env)).not.toContain('runner.')
|
||||
@@ -79,7 +80,7 @@ it('routes manual packaging to the dedicated runner with explicit preset and sig
|
||||
expect(workflow.on.workflow_dispatch!.inputs.version_mode!.default).toBe('default')
|
||||
expect(workflow.on.workflow_dispatch!.inputs.source_ref!.default).toBe('master')
|
||||
expect(workflow.on.workflow_dispatch!.inputs.update_channel!.default).toBe('nightly')
|
||||
expect(job.env.PACKAGE_VERSION_MODE).toBe('${{ inputs.version_mode }}')
|
||||
expect(job.env.PACKAGE_VERSION_MODE).toBe("${{ inputs.version_mode == 'follow-dsh' && 'product' || inputs.version_mode == 'build-number' && 'auto' || inputs.version_mode }}")
|
||||
expect(job.env.PACKAGE_SOURCE_REF).toBe('${{ inputs.source_ref }}')
|
||||
expect(job.env.DSH_DESKTOP_UPDATE_CHANNEL).toBe('${{ inputs.update_channel }}')
|
||||
expect(job.env.DSH_PACKAGING_PRESET).toBe('${{ inputs.preset }}')
|
||||
@@ -108,16 +109,15 @@ it('validates before building and passes the same mode and version to checks and
|
||||
it('retains failure diagnostics and uploads only the selected successful installer', () => {
|
||||
const uploads = job.steps.filter(step => step.uses?.startsWith('actions/upload-artifact@'))
|
||||
expect(uploads).toHaveLength(1)
|
||||
const archival = expectDesktopArchive(workflow.jobs['upload-artifact']!, 2)
|
||||
const archive = workflow.jobs['upload-artifact']!
|
||||
const archival = expectDesktopArchive(archive, 1)
|
||||
expect(uploads[0]!.if).toBe("always() && steps.checkout.outcome == 'success'")
|
||||
expect(uploads[0]!.with).toMatchObject({
|
||||
path: '${{ github.workspace }}/apps/desktop/.desktop-build/packaging-runs/',
|
||||
'include-hidden-files': true,
|
||||
})
|
||||
for (const mode of ['unsigned', 'signed']) {
|
||||
const upload = archival.find(step => step.if === `success() && inputs.signing == '${mode}'`)!
|
||||
expect(upload.with).toMatchObject({ path: '${{ needs.package.outputs.directory }}/*', 'if-no-files-found': 'error', 'compression-level': 0 })
|
||||
}
|
||||
expect(archive.env.DESKTOP_ARCHIVE_NAME).toBe('windows-x64-${{ inputs.signing }}-${{ needs.package.outputs.version }}-${{ github.run_id }}-${{ needs.package.outputs.attempt }}.zip')
|
||||
expect(archival[0]!.with).toMatchObject({ path: '${{ steps.archive.outputs.path }}', 'if-no-files-found': 'error', archive: false, overwrite: true, name: '${{ env.DESKTOP_ARCHIVE_NAME }}' })
|
||||
})
|
||||
|
||||
it('normalizes priority in the dependency and packaging shells before launching their children', () => {
|
||||
|
||||
Reference in new issue
Block a user