Merge branch 'feat/upstream-skills' into feat/wecom-plugin
This commit is contained in:
commit
4c7c1933bd
3267 files changed
+118001
-29842
No files matched your search
@@ -2,6 +2,7 @@ import { existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync,
|
||||
import { createRequire } from 'node:module'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { dirname, join, resolve } from 'node:path'
|
||||
import { pathToFileURL } from 'node:url'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { browserBundledExternals, browserPackageOfFile, browserSourceAliases } from './browser-bundled-externals.ts'
|
||||
|
||||
@@ -82,6 +83,56 @@ describe('browser dependency discovery', () => {
|
||||
expect(existsSync(join(root, 'packages/client/dynamic/lib'))).toBe(false)
|
||||
})
|
||||
|
||||
it.each([false, true])('preserves source Client output hooks without writing artifacts (styles: %s)', async (styles) => {
|
||||
const root = fixture()
|
||||
library(root, 'browser-lib')
|
||||
dynamicPlugin(root, [
|
||||
'import { value } from "browser-lib"',
|
||||
...(styles ? ['import "./theme.css"'] : []),
|
||||
'export const output = value',
|
||||
].join('\n'))
|
||||
if (styles) write(root, 'packages/client/dynamic/src/client/theme.css', '.fixture { color: red }')
|
||||
write(root, 'packages/client/dynamic/tsdown.config.ts', `
|
||||
import { clientBundle } from ${JSON.stringify(pathToFileURL(resolve(repositoryRoot, 'packages/client/tsdown.client.ts')).href)}
|
||||
export default async (...args) => {
|
||||
const configs = await clientBundle(import.meta.dirname, ['src/index.ts'], {
|
||||
clientBanner: () => '/* fixture-client-banner */',
|
||||
})(...args)
|
||||
const client = configs.find(config => config.name === '@fixture/dynamic/client')
|
||||
client.plugins.push({
|
||||
name: 'fixture-client-output',
|
||||
generateBundle(_options, bundle) {
|
||||
const output = bundle['client.js']
|
||||
if (output?.type !== 'chunk') throw new Error('missing configured Client filename')
|
||||
for (const text of ['fixture-client-banner', 'window.__ModuleLoader__.load', 'return module.exports', 'var module =']) {
|
||||
if (!output.code.includes(text)) throw new Error('missing Client output hook: ' + text)
|
||||
}
|
||||
if (output.code.includes('__dshChunkStyles_')) throw new Error('unexpanded metadata marker')
|
||||
if (output.code.includes('stylesheets:') !== ${JSON.stringify(styles)}) throw new Error('unexpected stylesheet metadata')
|
||||
if (output.code.includes('text:') !== ${JSON.stringify(styles)}) throw new Error('unexpected stylesheet text producer')
|
||||
},
|
||||
})
|
||||
return configs
|
||||
}
|
||||
`)
|
||||
|
||||
expect(await browserBundledExternals(root)).toEqual(new Set(['browser-lib']))
|
||||
expect(existsSync(join(root, 'packages/client/dynamic/lib'))).toBe(false)
|
||||
})
|
||||
|
||||
it('rejects unresolved Client output options before walking the build', async () => {
|
||||
const root = fixture()
|
||||
dynamicPlugin(root, 'export const output = 1')
|
||||
write(root, 'packages/client/dynamic/tsdown.config.ts', `
|
||||
export default {
|
||||
name: '@fixture/dynamic/client', entry: 'src/client/index.ts',
|
||||
outputOptions: () => ({}),
|
||||
}
|
||||
`)
|
||||
await expect(browserBundledExternals(root)).rejects.toThrow('needs resolved output options')
|
||||
expect(existsSync(join(root, 'packages/client/dynamic/lib'))).toBe(false)
|
||||
})
|
||||
|
||||
it('rejects an unresolved runtime library', async () => {
|
||||
const root = fixture()
|
||||
dynamicPlugin(root, 'export { value } from "missing-browser-lib"')
|
||||
|
||||
@@ -96,6 +96,7 @@ async function collectClientBundles(
|
||||
const client = configs.find(config => config.name === `${manifest.name}/client`)
|
||||
if (client === undefined) throw new Error(`browser notices: ${manifest.name} has no browser build config`)
|
||||
if (typeof client.inputOptions === 'function') throw new Error(`browser notices: ${manifest.name} needs resolved input options`)
|
||||
if (typeof client.outputOptions === 'function') throw new Error(`browser notices: ${manifest.name} needs resolved output options`)
|
||||
const bundle = await Rolldown.rolldown({
|
||||
...client.inputOptions,
|
||||
cwd: dir,
|
||||
@@ -106,7 +107,7 @@ async function collectClientBundles(
|
||||
tsconfig: resolve(root, 'tsconfig.base.client.json'),
|
||||
})
|
||||
try {
|
||||
await bundle.generate({ format: 'cjs', sourcemap: false })
|
||||
await bundle.generate({ format: 'cjs', ...client.outputOptions, sourcemap: false })
|
||||
} finally {
|
||||
await bundle.close()
|
||||
}
|
||||
|
||||
@@ -453,8 +453,7 @@ describe('package payload constraints', () => {
|
||||
},
|
||||
)
|
||||
|
||||
it('exempts the private plugin market generator from release rules in its own directory only', () => {
|
||||
const dir = 'apps/plugin-market-generator'
|
||||
it.each(['apps/plugin-market-generator', 'apps/desktop-publisher'])('exempts private tool %s from release rules in its own directory only', (dir) => {
|
||||
const manifest = JSON.parse(readFileSync(new URL(`../${dir}/package.json`, import.meta.url), 'utf8')) as WorkspaceManifest['manifest']
|
||||
expect(checkWorkspaceManifest({ dir, manifest })).toEqual([])
|
||||
expect(checkWorkspaceManifest({ dir: 'apps/other-tool', manifest })).not.toEqual([])
|
||||
|
||||
@@ -63,12 +63,14 @@ const publishedRepositoryUrl = 'git+https://github.com/deepseek-ai/deepseek-harn
|
||||
const experimentalPackageDirectory = /^packages\/experimental\/[^/]+$/
|
||||
/** Private reference tool run from the repository; it publishes no files. */
|
||||
const pluginMarketGeneratorDirectory = 'apps/plugin-market-generator'
|
||||
/** Source-only private release tool, sharing the Desktop version. */
|
||||
const desktopPublisherDirectory = 'apps/desktop-publisher'
|
||||
/**
|
||||
* Ordinary directories whose packages this repository publishes: one release member each. The reference plugin
|
||||
* market generator is a private repository tool, not a published application.
|
||||
*/
|
||||
const standardReleaseMemberDirectory = new RegExp(
|
||||
`^(?:packages/(?!experimental/)[^/]+/[^/]+|apps/(?!desktop(?:-host)?$|${pluginMarketGeneratorDirectory.slice('apps/'.length)}$)[^/]+|vendor/[^/]+)$`,
|
||||
`^(?:packages/(?!experimental/)[^/]+/[^/]+|apps/(?!desktop(?:-host)?$|${pluginMarketGeneratorDirectory.slice('apps/'.length)}$|${desktopPublisherDirectory.slice('apps/'.length)}$)[^/]+|vendor/[^/]+)$`,
|
||||
'u',
|
||||
)
|
||||
/** Installable application assembled by electron-builder rather than published to npm. */
|
||||
@@ -560,7 +562,7 @@ export function checkWorkspaceManifest({ dir, manifest }: WorkspaceManifest): st
|
||||
return errors
|
||||
}
|
||||
|
||||
if (dir.startsWith('apps/') && dir !== desktopApplicationDirectory && dir !== pluginMarketGeneratorDirectory && manifest.name?.startsWith('@deepseek-ai/')) {
|
||||
if (dir.startsWith('apps/') && dir !== desktopApplicationDirectory && dir !== pluginMarketGeneratorDirectory && dir !== desktopPublisherDirectory && manifest.name?.startsWith('@deepseek-ai/')) {
|
||||
const expectedFiles = appPackageFiles[manifest.name]
|
||||
if (expectedFiles === undefined) {
|
||||
errors.push(`${label}: app package has no publication files policy`)
|
||||
|
||||
@@ -108,7 +108,11 @@ describe('Node compatibility self-hosted routing', () => {
|
||||
)
|
||||
}
|
||||
expect(job.steps[0]?.with).toEqual({ 'persist-credentials': false })
|
||||
expect(job.steps.some(step => step.uses?.startsWith('actions/cache/'))).toBe(false)
|
||||
// The verified bubblewrap archive is the one remote cache this job restores
|
||||
// and saves; it must stay excluded from the persistent self-hosted pool.
|
||||
const remoteCaches = job.steps.filter(step => step.uses?.startsWith('actions/cache/'))
|
||||
expect(remoteCaches.length).toBeGreaterThan(0)
|
||||
for (const step of remoteCaches) expect(step.if).toContain("vars.DSH_CI_FAILOVER_LINUX != 'selfhosted'")
|
||||
})
|
||||
|
||||
it('overrides runner exports inside setup-node without affecting later Node processes', () => {
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
# shellcheck shell=bash
|
||||
# Sourced by CI preparation scripts; defines functions only.
|
||||
|
||||
# Prints the SHA-256 digest of <file>.
|
||||
#
|
||||
# CI runners do not all provide the same tool: GNU coreutils ships `sha256sum`,
|
||||
# while macOS ships `shasum -a 256`. Probing both keeps a missing tool from
|
||||
# being reported as a digest mismatch, which would discard a verified cached
|
||||
# archive and send the next run back to a possibly unavailable download host.
|
||||
sha256_digest() {
|
||||
local output
|
||||
if command -v sha256sum >/dev/null 2>&1; then
|
||||
output="$(sha256sum < "$1")"
|
||||
elif command -v shasum >/dev/null 2>&1; then
|
||||
output="$(shasum -a 256 < "$1")"
|
||||
else
|
||||
echo 'No SHA-256 tool found: need sha256sum or shasum -a 256' >&2
|
||||
return 2
|
||||
fi
|
||||
printf '%s\n' "${output%% *}"
|
||||
}
|
||||
|
||||
# Succeeds when <file> has the SHA-256 digest <sha256>. Returns 2, reporting the
|
||||
# missing tool on stderr, when neither digest tool exists.
|
||||
#
|
||||
# Usage: verified_sha256 <sha256> <file>
|
||||
verified_sha256() {
|
||||
local actual status=0
|
||||
actual="$(sha256_digest "$2")" || status=$?
|
||||
if (( status != 0 )); then
|
||||
return "$status"
|
||||
fi
|
||||
[[ "$actual" == "$1" ]]
|
||||
}
|
||||
|
||||
# Leaves a copy of <url> whose SHA-256 digest is <sha256> at <cache-file>.
|
||||
#
|
||||
# A cached file with the expected digest is used without network access, so a
|
||||
# restored Actions cache keeps CI independent of the download host. A cached
|
||||
# file with any other digest is discarded. A download is verified before it
|
||||
# replaces <cache-file> atomically, so the cache only ever holds a verified
|
||||
# payload. A failed download or verification leaves nothing at <cache-file> and
|
||||
# reports the URL on stderr. A missing SHA-256 tool returns 2 instead of
|
||||
# treating the payload as mismatched. Each attempt is bounded so a stalled host
|
||||
# fails within minutes.
|
||||
#
|
||||
# Usage: acquire_verified_archive <url> <sha256> <cache-file>
|
||||
acquire_verified_archive() {
|
||||
local url="$1" sha256="$2" cache_file="$3" cache_dir
|
||||
cache_dir="$(dirname -- "$cache_file")"
|
||||
|
||||
# Probe before the network work: a runner without a digest tool must fail
|
||||
# immediately instead of downloading a payload it cannot verify.
|
||||
sha256_digest /dev/null >/dev/null
|
||||
|
||||
if [[ -f "$cache_file" ]]; then
|
||||
local cache_status=0
|
||||
verified_sha256 "$sha256" "$cache_file" || cache_status=$?
|
||||
if (( cache_status == 0 )); then
|
||||
echo "Using verified cached archive $cache_file"
|
||||
return 0
|
||||
fi
|
||||
if (( cache_status != 1 )); then
|
||||
return "$cache_status"
|
||||
fi
|
||||
echo "Discarding cached archive $cache_file: SHA-256 mismatch" >&2
|
||||
rm -f -- "$cache_file"
|
||||
fi
|
||||
|
||||
if ! mkdir -p -- "$cache_dir"; then
|
||||
echo "Failed to create $cache_dir while preparing $url" >&2
|
||||
return 1
|
||||
fi
|
||||
local partial
|
||||
if ! partial="$(mktemp "${cache_file}.partial.XXXXXX")"; then
|
||||
echo "Failed to create a temporary file in $cache_dir while preparing $url" >&2
|
||||
return 1
|
||||
fi
|
||||
# A cancelled job must not leave a partial payload in the directory that
|
||||
# actions/cache/save uploads.
|
||||
trap 'rm -f -- "$partial"' EXIT
|
||||
|
||||
if ! curl --fail --silent --show-error --location \
|
||||
--connect-timeout 15 --max-time 60 \
|
||||
--retry 8 --retry-all-errors --retry-max-time 240 \
|
||||
--output "$partial" "$url"; then
|
||||
rm -f -- "$partial"
|
||||
trap - EXIT
|
||||
echo "Failed to download $url and no verified cached copy exists at $cache_file" >&2
|
||||
return 1
|
||||
fi
|
||||
local download_status=0
|
||||
verified_sha256 "$sha256" "$partial" || download_status=$?
|
||||
if (( download_status != 0 )); then
|
||||
rm -f -- "$partial"
|
||||
trap - EXIT
|
||||
if (( download_status != 1 )); then
|
||||
return "$download_status"
|
||||
fi
|
||||
echo "Downloaded $url does not have SHA-256 $sha256" >&2
|
||||
return 1
|
||||
fi
|
||||
mv -f -- "$partial" "$cache_file"
|
||||
trap - EXIT
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
import { spawnSync } from 'node:child_process'
|
||||
import { createHash } from 'node:crypto'
|
||||
import {
|
||||
chmodSync, existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, symlinkSync, writeFileSync,
|
||||
} from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { delimiter, join, resolve } from 'node:path'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
|
||||
const library = resolve(import.meta.dirname, 'ci-verified-download.sh')
|
||||
const url = 'https://downloads.invalid/payload.deb'
|
||||
const payload = Buffer.from('verified payload\n')
|
||||
const payloadSha256 = createHash('sha256').update(payload).digest('hex')
|
||||
const bash = ['/bin/bash', '/usr/bin/bash'].find(candidate => existsSync(candidate)) ?? 'bash'
|
||||
|
||||
// Records each invocation, then copies FAKE_CURL_SOURCE to the --output path
|
||||
// or fails as curl does for an HTTP error when no source is configured.
|
||||
const fakeCurl = `#!/usr/bin/env bash
|
||||
printf '%s\\n' "$*" >> "$FAKE_CURL_LOG"
|
||||
output=''
|
||||
while (( $# > 0 )); do
|
||||
if [[ "$1" == --output ]]; then output="$2"; shift; fi
|
||||
shift
|
||||
done
|
||||
if [[ -z "\${FAKE_CURL_SOURCE:-}" ]]; then
|
||||
echo 'curl: (22) The requested URL returned error: 503' >&2
|
||||
exit 22
|
||||
fi
|
||||
cp "$FAKE_CURL_SOURCE" "$output"
|
||||
`
|
||||
|
||||
interface Fixture {
|
||||
readonly root: string
|
||||
readonly cacheDir: string
|
||||
readonly cacheFile: string
|
||||
readonly curlLog: string
|
||||
readonly env: NodeJS.ProcessEnv
|
||||
}
|
||||
|
||||
const fixtureRoots: string[] = []
|
||||
|
||||
afterEach(() => {
|
||||
for (const root of fixtureRoots.splice(0)) rmSync(root, { recursive: true, force: true })
|
||||
})
|
||||
|
||||
function createFixture(served?: Buffer): Fixture {
|
||||
const root = mkdtempSync(join(tmpdir(), 'dsh-ci-verified-download-'))
|
||||
fixtureRoots.push(root)
|
||||
const bin = join(root, 'bin')
|
||||
mkdirSync(bin)
|
||||
writeFileSync(join(bin, 'curl'), fakeCurl)
|
||||
chmodSync(join(bin, 'curl'), 0o755)
|
||||
const curlLog = join(root, 'curl.log')
|
||||
writeFileSync(curlLog, '')
|
||||
const env: NodeJS.ProcessEnv = { ...process.env, PATH: bin + delimiter + (process.env.PATH ?? ''), FAKE_CURL_LOG: curlLog }
|
||||
delete env.FAKE_CURL_SOURCE
|
||||
if (served !== undefined) {
|
||||
const source = join(root, 'served.deb')
|
||||
writeFileSync(source, served)
|
||||
env.FAKE_CURL_SOURCE = source
|
||||
}
|
||||
const cacheDir = join(root, 'cache', 'bubblewrap')
|
||||
return { root, cacheDir, cacheFile: join(cacheDir, 'payload.deb'), curlLog, env }
|
||||
}
|
||||
|
||||
interface AcquireResult {
|
||||
readonly status: number | null
|
||||
readonly signal: NodeJS.Signals | null
|
||||
readonly stderr: string
|
||||
}
|
||||
|
||||
function acquire(fixture: Fixture, env: NodeJS.ProcessEnv = fixture.env): AcquireResult {
|
||||
const result = spawnSync(
|
||||
bash,
|
||||
['-c', 'set -euo pipefail; source "$1"; acquire_verified_archive "$2" "$3" "$4"', 'acquire', library, url, payloadSha256, fixture.cacheFile],
|
||||
{ encoding: 'utf8', env, timeout: 30_000 },
|
||||
)
|
||||
return { status: result.status, signal: result.signal, stderr: result.stderr }
|
||||
}
|
||||
|
||||
function curlCalls(fixture: Fixture): string[] {
|
||||
return readFileSync(fixture.curlLog, 'utf8').split('\n').filter(line => line !== '')
|
||||
}
|
||||
|
||||
function seedCache(fixture: Fixture, content: Buffer): void {
|
||||
mkdirSync(fixture.cacheDir, { recursive: true })
|
||||
writeFileSync(fixture.cacheFile, content)
|
||||
}
|
||||
|
||||
// Builds a PATH that reaches only the named executables plus the fixture's fake
|
||||
// curl, so a child can run on a host that provides a SHA-256 tool but see none.
|
||||
function restrictedPath(fixture: Fixture, names: readonly string[]): string {
|
||||
const bin = join(fixture.root, 'restricted-bin')
|
||||
mkdirSync(bin, { recursive: true })
|
||||
for (const name of names) {
|
||||
const resolved = spawnSync('sh', ['-c', `command -v ${name}`], { encoding: 'utf8' }).stdout.trim()
|
||||
if (resolved === '') throw new Error(`the test host does not provide ${name}`)
|
||||
symlinkSync(resolved, join(bin, name))
|
||||
}
|
||||
return [bin, join(fixture.root, 'bin')].join(delimiter)
|
||||
}
|
||||
|
||||
function hasDigestTool(): boolean {
|
||||
return spawnSync('sh', ['-c', 'command -v sha256sum || command -v shasum'], { stdio: 'ignore' }).status === 0
|
||||
}
|
||||
|
||||
// The library targets Linux CI runners; the suite needs bash and a SHA-256 tool
|
||||
// (sha256sum or shasum -a 256) and skips elsewhere.
|
||||
describe.skipIf(process.platform === 'win32' || !hasDigestTool())('acquire_verified_archive', () => {
|
||||
it('uses a verified cached archive without contacting the download host', () => {
|
||||
const fixture = createFixture()
|
||||
seedCache(fixture, payload)
|
||||
|
||||
const result = acquire(fixture)
|
||||
|
||||
expect(result.signal).toBeNull()
|
||||
expect(result.status).toBe(0)
|
||||
expect(curlCalls(fixture)).toEqual([])
|
||||
expect(readFileSync(fixture.cacheFile)).toEqual(payload)
|
||||
})
|
||||
|
||||
it('fails with the URL when the download fails and no cached archive exists', () => {
|
||||
const fixture = createFixture()
|
||||
|
||||
const result = acquire(fixture)
|
||||
|
||||
expect(result.signal).toBeNull()
|
||||
expect(result.status).toBe(1)
|
||||
expect(result.stderr).toContain(`Failed to download ${url} and no verified cached copy exists at ${fixture.cacheFile}`)
|
||||
expect(curlCalls(fixture)).toHaveLength(1)
|
||||
expect(readdirSync(fixture.cacheDir)).toEqual([])
|
||||
})
|
||||
|
||||
it('bounds every download attempt and the retry window', () => {
|
||||
const fixture = createFixture(payload)
|
||||
|
||||
expect(acquire(fixture).status).toBe(0)
|
||||
|
||||
const [call] = curlCalls(fixture)
|
||||
expect(call).toContain('--connect-timeout 15 ')
|
||||
expect(call).toContain('--max-time 60 ')
|
||||
expect(call).toContain('--retry 8 ')
|
||||
// The last attempt may still run for its full --max-time, so the bounded
|
||||
// failure time is this window plus 60 seconds.
|
||||
expect(call).toContain('--retry-max-time 240 ')
|
||||
expect(call).toContain(url)
|
||||
})
|
||||
|
||||
it('fails immediately and reports the missing tool instead of a digest mismatch', () => {
|
||||
const fixture = createFixture(payload)
|
||||
const env = { ...fixture.env, PATH: restrictedPath(fixture, ['bash', 'dirname', 'mkdir', 'mktemp', 'mv', 'rm']) }
|
||||
|
||||
const result = acquire(fixture, env)
|
||||
|
||||
expect(result.signal).toBeNull()
|
||||
expect(result.status).toBe(2)
|
||||
expect(result.stderr).toContain('No SHA-256 tool found')
|
||||
expect(curlCalls(fixture)).toEqual([])
|
||||
expect(existsSync(fixture.cacheFile)).toBe(false)
|
||||
})
|
||||
|
||||
it('replaces a cached archive whose digest does not match with a verified download', () => {
|
||||
const fixture = createFixture(payload)
|
||||
seedCache(fixture, Buffer.from('corrupted payload\n'))
|
||||
|
||||
const result = acquire(fixture)
|
||||
|
||||
expect(result.signal).toBeNull()
|
||||
expect(result.status).toBe(0)
|
||||
expect(result.stderr).toContain('SHA-256 mismatch')
|
||||
expect(curlCalls(fixture)).toHaveLength(1)
|
||||
expect(readdirSync(fixture.cacheDir)).toEqual(['payload.deb'])
|
||||
expect(readFileSync(fixture.cacheFile)).toEqual(payload)
|
||||
})
|
||||
|
||||
it('rejects a downloaded archive whose digest does not match without caching it', () => {
|
||||
const fixture = createFixture(Buffer.from('tampered payload\n'))
|
||||
|
||||
const result = acquire(fixture)
|
||||
|
||||
expect(result.signal).toBeNull()
|
||||
expect(result.status).toBe(1)
|
||||
expect(result.stderr).toContain(`Downloaded ${url} does not have SHA-256 ${payloadSha256}`)
|
||||
expect(existsSync(fixture.cacheFile)).toBe(false)
|
||||
expect(readdirSync(fixture.cacheDir)).toEqual([])
|
||||
})
|
||||
})
|
||||
@@ -41,12 +41,17 @@ describe('CI workflow', () => {
|
||||
})
|
||||
expect(workflowJob(ci, 'all-checks-passed').needs).toContain('node-compat')
|
||||
const ordinaryJobs = Object.entries(ci.jobs)
|
||||
.filter(([name]) => !['node-compat', 'all-checks-passed'].includes(name))
|
||||
.filter(([name]) => !['node-compat', 'all-checks-passed', 'publisher-isolated'].includes(name))
|
||||
for (const [name, job] of ordinaryJobs) {
|
||||
if (!isRecord(job)) throw new TypeError(`${name} must define a job`)
|
||||
expect(job).not.toHaveProperty('strategy')
|
||||
expect(job).not.toHaveProperty('uses')
|
||||
}
|
||||
// Publisher smoke reuses the compatibility/build concurrency slots before those jobs start.
|
||||
expect(compatibility.needs).toBe('publisher-isolated')
|
||||
expect(workflowJob(ci, 'publisher-isolated').strategy).toMatchObject({ 'max-parallel': 1, matrix: { os: ['linux', 'macos'] } })
|
||||
expect(workflowJob(ciWindows, 'windows-build').needs).toBe('windows-publisher')
|
||||
expect(workflowJob(ciWindows, 'windows-publisher').defaults).toEqual({ run: { shell: 'pwsh' } })
|
||||
// Python reports its own required verdict, so neither its jobs nor a
|
||||
// reusable workflow caller remain in the Linux or Windows workflow.
|
||||
expect(Object.keys(ci.jobs).filter(name => name.startsWith('python'))).toEqual([])
|
||||
@@ -60,7 +65,7 @@ describe('CI workflow', () => {
|
||||
expect(runtime.with).toMatchObject({ targets: 'node24-linux-x64,node24-win-x64' })
|
||||
expect(runtime.uses).toBe('./.github/workflows/build-exe-for-python-sdk.yml')
|
||||
const windowsJobs = Object.entries(ciWindows.jobs)
|
||||
.filter(([name]) => name !== 'windows-checks-passed')
|
||||
.filter(([name]) => !['windows-checks-passed', 'windows-publisher'].includes(name))
|
||||
for (const [name, job] of windowsJobs) {
|
||||
if (!isRecord(job)) throw new TypeError(`${name} must define a job`)
|
||||
expect(job).not.toHaveProperty('strategy')
|
||||
@@ -95,7 +100,7 @@ describe('CI workflow', () => {
|
||||
expect(afterSdk).toBeLessThanOrEqual(11)
|
||||
})
|
||||
|
||||
it('keeps the union of required PR verdicts equal to the pre-split blocking set', () => {
|
||||
it('keeps required PR verdicts covering runtime and publisher jobs', () => {
|
||||
const verdicts = [
|
||||
['ci.yml', 'all-checks-passed'],
|
||||
['ci-windows.yml', 'windows-checks-passed'],
|
||||
@@ -112,9 +117,7 @@ describe('CI workflow', () => {
|
||||
expect(verdict.needs.every(id => typeof id === 'string' && id in jobs)).toBe(true)
|
||||
blocking.push(...(verdict.needs as string[]))
|
||||
}
|
||||
// Splitting the workflows only moves jobs between verdicts; the blocking
|
||||
// set itself must stay identical, or branch protection would accept a
|
||||
// failure it rejected before the split.
|
||||
// Every blocking lane must contribute to a branch-protection verdict.
|
||||
expect(blocking.sort()).toEqual([
|
||||
'node-24',
|
||||
'node-24-bench',
|
||||
@@ -122,10 +125,12 @@ describe('CI workflow', () => {
|
||||
'node-24-coverage',
|
||||
'node-24-lint',
|
||||
'node-compat',
|
||||
'publisher-isolated',
|
||||
'python-runtime',
|
||||
'python-sdk',
|
||||
'windows-build',
|
||||
'windows-native-tests',
|
||||
'windows-publisher',
|
||||
])
|
||||
})
|
||||
|
||||
@@ -547,7 +552,7 @@ describe('CI workflow', () => {
|
||||
expect(aggregate.needs).not.toContain('windows')
|
||||
// windows-coverage is temporarily non-blocking while Windows ACP
|
||||
// half-close tests are stabilized; observational stays out too.
|
||||
expect(windowsAggregate.needs).toEqual(['windows-build', 'windows-native-tests'])
|
||||
expect(windowsAggregate.needs).toEqual(['windows-publisher', 'windows-build', 'windows-native-tests'])
|
||||
expect(windowsAggregate.name).toBe('windows checks passed')
|
||||
expect(windowsAggregate['runs-on']).toBe(aggregate['runs-on'])
|
||||
expect(windowsAggregate.if).toBe(aggregate.if)
|
||||
@@ -1112,6 +1117,76 @@ describe('bubblewrap preparation script', () => {
|
||||
// Ubuntu removes superseded versions from its live package pool.
|
||||
expect(script).not.toMatch(/https?:\/\/[^/'"\s]+\/ubuntu(?:-ports)?\/pool\//u)
|
||||
})
|
||||
|
||||
it('verifies the archive against the pinned digest', () => {
|
||||
const script = readFileSync(resolve(root, 'scripts/prepare-ci-bubblewrap.sh'), 'utf8')
|
||||
|
||||
expect(script).toMatch(/^readonly BUBBLEWRAP_SHA256='[0-9a-f]{64}'$/mu)
|
||||
expect(script).toContain('acquire_verified_archive "$BUBBLEWRAP_URL" "$BUBBLEWRAP_SHA256" "$archive"')
|
||||
})
|
||||
|
||||
// Ephemeral runners share a `~` layout: GitHub-hosted runners and Blacksmith
|
||||
// (whose runners register as self-hosted but keep /home/runner as HOME). The
|
||||
// in-house `vm-backup` pool keeps `~/.cache` on a different, persistent
|
||||
// layout, so lanes that can select it must not restore or save this cache.
|
||||
// `ci-master.yml` prepares bubblewrap only on lanes that can select the
|
||||
// persistent runners, and the manual benchmark matrix includes their 64/96-core
|
||||
// rows, so neither carries cache steps.
|
||||
const hostedOnly = "vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'"
|
||||
const cachedJobs = new Map<string, string | undefined>([
|
||||
['ci.yml:node-24-coverage', hostedOnly],
|
||||
['ci.yml:node-24-consumers', hostedOnly],
|
||||
['ci.yml:node-compat', hostedOnly],
|
||||
['e2e.yml:e2e', undefined],
|
||||
])
|
||||
|
||||
it.each(['ci.yml', 'ci-master.yml', 'e2e.yml'])(
|
||||
'%s caches the verified archive only on the lanes that run on ephemeral runners',
|
||||
(name) => {
|
||||
const script = readFileSync(resolve(root, 'scripts/prepare-ci-bubblewrap.sh'), 'utf8')
|
||||
expect(script).toContain('readonly BUBBLEWRAP_CACHE_DIR="${HOME}/.cache/dsh-ci/bubblewrap"')
|
||||
const cache = {
|
||||
path: '~/.cache/dsh-ci/bubblewrap',
|
||||
key: "bubblewrap-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/prepare-ci-bubblewrap.sh') }}",
|
||||
}
|
||||
const workflow = loadWorkflow('.github/workflows/' + name)
|
||||
if (!isRecord(workflow.jobs)) throw new TypeError(`${name} must define jobs`)
|
||||
|
||||
let preparations = 0
|
||||
for (const [jobName, job] of Object.entries(workflow.jobs)) {
|
||||
if (!isRecord(job) || !Array.isArray(job.steps)) continue
|
||||
const steps = job.steps.filter(isRecord)
|
||||
const preparation = steps.findIndex(step =>
|
||||
typeof step.run === 'string' && step.run.includes('bash scripts/prepare-ci-bubblewrap.sh'))
|
||||
if (preparation < 0) continue
|
||||
preparations += 1
|
||||
const key = `${name}:${jobName}`
|
||||
if (!cachedJobs.has(key)) {
|
||||
expect(
|
||||
steps.filter(step => typeof step.uses === 'string' && step.uses.startsWith('actions/cache/')),
|
||||
key,
|
||||
).toEqual([])
|
||||
continue
|
||||
}
|
||||
const guard = cachedJobs.get(key)
|
||||
const cacheHit = "steps.bubblewrap-cache.outputs.cache-hit != 'true'"
|
||||
expect(steps[preparation - 1]).toEqual({
|
||||
name: 'Restore verified bubblewrap archive',
|
||||
id: 'bubblewrap-cache',
|
||||
...(guard === undefined ? {} : { if: guard }),
|
||||
uses: 'actions/cache/[email protected]',
|
||||
with: cache,
|
||||
})
|
||||
expect(steps[preparation + 1]).toEqual({
|
||||
name: 'Save verified bubblewrap archive',
|
||||
if: guard === undefined ? cacheHit : `(${guard}) && ${cacheHit}`,
|
||||
uses: 'actions/cache/[email protected]',
|
||||
with: cache,
|
||||
})
|
||||
}
|
||||
expect(preparations).toBeGreaterThan(0)
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
describe('DeepSeek e2e workflow', () => {
|
||||
|
||||
@@ -9,7 +9,8 @@ import { existsSync } from 'node:fs'
|
||||
import { mkdir, mkdtemp, realpath, rm, writeFile } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { build, type TsdownBundle, type UserConfig } from 'tsdown'
|
||||
import { build, type Rolldown, type TsdownBundle, type UserConfig } from 'tsdown'
|
||||
import type { DshClientModuleManifest } from '@deepseek-ai/dsh-package-manifest'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { packageAssetRevision } from '../packages/client/modules/src/assets.ts'
|
||||
import { clientBundle } from '../packages/client/tsdown.client.ts'
|
||||
@@ -26,11 +27,14 @@ interface PluginContext {
|
||||
addWatchFile(id: string): void
|
||||
}
|
||||
|
||||
type LoadedModule = string | { code: string; moduleSideEffects: string } | null
|
||||
|
||||
interface BundlePlugin {
|
||||
name: string
|
||||
buildStart?: (this: PluginContext) => void
|
||||
resolveId?: (source: string, importer?: string) => string | null
|
||||
load?: (this: PluginContext, id: string) => string | null | Promise<string | null>
|
||||
load?: (this: PluginContext, id: string) => LoadedModule | Promise<LoadedModule>
|
||||
stylesheetBundle?: (code: string, id: string) => string
|
||||
writeBundle?: (this: { meta: { watchMode: boolean } }, outputOptions: { dir?: string }, bundle: Record<string, unknown>) => Promise<void>
|
||||
renderChunk?: (code: string, chunk: unknown, outputOptions: { format: string }) => { toString(): string } | null
|
||||
}
|
||||
@@ -47,7 +51,8 @@ const WHALE_URL = `plugins/@deepseek-ai/dsh-client-asset-fixture/assets/whale-${
|
||||
const RESOLVER_CALL = /__dshPackageAsset_[0-9a-f]{12}(?=\()/u
|
||||
|
||||
/** Read the resolver call identifier from one compiled module. */
|
||||
function resolverCall(output: string | null): string {
|
||||
function resolverCall(output: string | { code: string } | null): string {
|
||||
if (output !== null && typeof output !== 'string') output = output.code
|
||||
const call = RESOLVER_CALL.exec(output ?? '')?.[0]
|
||||
if (call === undefined) throw new Error('compiled module carries no resolver call')
|
||||
return call
|
||||
@@ -61,13 +66,27 @@ function resolverCall(output: string | null): string {
|
||||
*/
|
||||
function stylesheetText(output: string | null, resolve: (reference: string) => string): string {
|
||||
if (output === null) throw new Error('stylesheet module was not emitted')
|
||||
if (output.startsWith('window.__ModuleLoader__.load(')) {
|
||||
const stylesheets = stylesheetManifest(output).meta?.().stylesheets
|
||||
if (stylesheets === undefined) throw new Error('compiled stylesheet metadata missing')
|
||||
const descriptors = Object.values(stylesheets)
|
||||
if (descriptors.length !== 1) throw new Error('expected exactly one compiled stylesheet')
|
||||
return descriptors[0]!.text({ asset: resolve })
|
||||
}
|
||||
const call = RESOLVER_CALL.exec(output)?.[0]
|
||||
const body = output
|
||||
.replace(/^export default (.*);$/mu, 'return typeof css === "undefined" ? $1 : css;')
|
||||
.replace(/^export \{\};$/mu, 'return css;')
|
||||
const body = output.replace(/^export default (.*);$/mu, 'return $1;')
|
||||
return runInNewContext(`(() => {\n${body}\n})()`, { ...call === undefined ? {} : { [call]: resolve }, document: undefined }) as string
|
||||
}
|
||||
|
||||
/** Capture the actual manifest emitted by the stylesheet render hook. */
|
||||
function stylesheetManifest(code: string | null): DshClientModuleManifest {
|
||||
if (code === null) throw new Error('stylesheet module was not emitted')
|
||||
let manifest: DshClientModuleManifest | undefined
|
||||
runInNewContext(code, { window: { __ModuleLoader__: { load(value: DshClientModuleManifest) { manifest = value } } } })
|
||||
if (manifest === undefined) throw new Error('stylesheet manifest was not registered')
|
||||
return manifest
|
||||
}
|
||||
|
||||
const temporaryRoots: string[] = []
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -113,7 +132,23 @@ function configPlugin(config: UserConfig | undefined, name: string): BundlePlugi
|
||||
/** Look up plugins of one browser config, so stylesheet and asset plugins share its per-build state. */
|
||||
function browserPlugins(packageDir: string): (name: PluginName) => BundlePlugin {
|
||||
const client = clientFaceConfigs(packageDir).find(config => config.platform === 'browser')
|
||||
return name => configPlugin(client, name)
|
||||
if (client === undefined || typeof client.outputOptions !== 'object') throw new Error('browser output options missing')
|
||||
const { banner, footer } = client.outputOptions
|
||||
if (typeof banner !== 'function' || typeof footer !== 'string') throw new Error('browser manifest wrapper missing')
|
||||
const styles = configPlugin(client, 'dsh-client-style-factory')
|
||||
return name => ({
|
||||
...configPlugin(client, name),
|
||||
stylesheetBundle(code, id) {
|
||||
const chunk = { isEntry: true, fileName: 'client.js', modules: { [id]: {} } }
|
||||
const body = code.replace(/^export default (.*);$/mu, 'module.exports = $1;').replace(/^export \{\};$/mu, '')
|
||||
const prefix = banner(chunk as Rolldown.RenderedChunk)
|
||||
if (typeof prefix !== 'string') throw new Error('expected a synchronous manifest banner')
|
||||
const wrapped = `${prefix}\nvar module = { exports: {} };\n${body}\n${footer}`
|
||||
const rendered = styles.renderChunk?.(wrapped, chunk, { format: 'cjs' })
|
||||
if (rendered === undefined || rendered === null) throw new Error('stylesheet metadata was not rendered')
|
||||
return rendered.toString()
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function bundlePlugin(name: PluginName): BundlePlugin {
|
||||
@@ -154,34 +189,47 @@ async function loadImport(plugin: BundlePlugin, context: PluginContext, source:
|
||||
const { resolveId, load } = hooks(plugin)
|
||||
const id = resolveId(source, importer)
|
||||
if (typeof id !== 'string') throw new Error(`${plugin.name} did not resolve ${source}`)
|
||||
return await load.call(context, id)
|
||||
const output = await load.call(context, id)
|
||||
if (output === null || typeof output === 'string') return output
|
||||
if (plugin.stylesheetBundle === undefined) throw new Error('stylesheet manifest renderer missing')
|
||||
expect(output.moduleSideEffects).toBe('no-treeshake')
|
||||
return plugin.stylesheetBundle(output.code, id)
|
||||
}
|
||||
|
||||
describe('client bundle CSS Modules', () => {
|
||||
it('registers the source stylesheet as a watch dependency', async () => {
|
||||
const root = await temporaryDirectory('dsh-client-css-watch-')
|
||||
const root = await assetPackage({})
|
||||
const stylesheet = join(root, 'Fixture.module.css')
|
||||
await writeFile(stylesheet, '.root { color: red; }\n')
|
||||
const context = recordingContext()
|
||||
|
||||
const output = await loadImport(bundlePlugin('dsh-css-modules-inline'), context, './Fixture.module.css', join(root, 'index.ts'))
|
||||
const output = await loadImport(browserPlugins(root)('dsh-css-modules-inline'), context, './Fixture.module.css', join(root, 'index.ts'))
|
||||
|
||||
expect(context.watched).toEqual([stylesheet])
|
||||
expect(output).toContain('data-plugin-css')
|
||||
expect(output).not.toContain('data-plugin-css')
|
||||
const manifest = stylesheetManifest(output)
|
||||
const require = Object.assign(() => { throw new Error('stylesheet has no JavaScript dependencies') }, {
|
||||
async: async () => { throw new Error('stylesheet has no asynchronous dependencies') },
|
||||
asset: (reference: string) => reference,
|
||||
})
|
||||
const classMap = manifest.factory(require)
|
||||
expect(Object.keys(classMap)).toEqual(['root'])
|
||||
expect(classMap['root']).toMatch(/_root$/u)
|
||||
expect(stylesheetText(output, reference => reference)).toContain(`.${String(classMap['root'])}{color:red}`)
|
||||
})
|
||||
})
|
||||
|
||||
describe('client bundle global CSS', () => {
|
||||
it('compiles a side-effect stylesheet into a watched style injector', async () => {
|
||||
const root = await temporaryDirectory('dsh-client-global-css-watch-')
|
||||
it('compiles a side-effect stylesheet into watched metadata', async () => {
|
||||
const root = await assetPackage({})
|
||||
const stylesheet = join(root, 'base.css')
|
||||
await writeFile(stylesheet, 'body { color: red; }\n')
|
||||
const context = recordingContext()
|
||||
|
||||
const output = await loadImport(bundlePlugin('dsh-css-global-inline'), context, './base.css', join(root, 'index.ts'))
|
||||
const output = await loadImport(browserPlugins(root)('dsh-css-global-inline'), context, './base.css', join(root, 'index.ts'))
|
||||
|
||||
expect(context.watched).toEqual([stylesheet])
|
||||
expect(output).toContain('data-plugin-css')
|
||||
expect(output).not.toContain('data-plugin-css')
|
||||
expect(output).toContain('body{color:red}')
|
||||
})
|
||||
|
||||
@@ -437,7 +485,7 @@ describe('client bundle stylesheet url()', () => {
|
||||
|
||||
const output = await loadImport(browserPlugins(root)('dsh-css-modules-inline'), context, './View.module.css', join(root, 'src/client/index.ts'))
|
||||
|
||||
expect(output).toContain(`url(" + ${resolverCall(output)}(${JSON.stringify(WHALE_URL)}) + ")`)
|
||||
expect(output).toContain(`context.asset(${JSON.stringify(WHALE_URL)})`)
|
||||
const css = stylesheetText(output, reference => `resolved:${reference}`)
|
||||
expect(css).toContain(`url(resolved:${WHALE_URL})`)
|
||||
for (const preserved of ['(mask-image:url(\'\'))', 'background:url()', 'url(data:image/svg+xml,%3Csvg%3E)', 'url(#mask)', 'url(/static/a.png)', 'url(https://example.com/a.png)']) {
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
* Pins shared client-bundle preset rules: build modes, module-edge purity,
|
||||
* source-map chaining, and physical watch dependencies hidden behind virtual CSS Modules.
|
||||
*/
|
||||
import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
|
||||
import { existsSync, mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { dirname, join, relative } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { runInNewContext } from 'node:vm'
|
||||
import { build, type Rolldown, type TsdownBundle, type UserConfig } from 'tsdown'
|
||||
import { describe, expect, it, onTestFinished, vi } from 'vitest'
|
||||
import { clientBundle, requestedExternals, staticLinked } from '../packages/client/tsdown.client.ts'
|
||||
import { STATIC_MODULE_MANIFEST_EXPORT } from '../packages/client/web/src/platform.ts'
|
||||
import type { DshClientModuleManifest } from '@deepseek-ai/dsh-package-manifest'
|
||||
|
||||
type ResolveId = (source: string) => null | { id: string; external: boolean }
|
||||
|
||||
@@ -125,6 +128,24 @@ async function clientChunkOutput(root: string, config: UserConfig, fileName: str
|
||||
}
|
||||
}
|
||||
|
||||
/** A built `staticLinked` index module. */
|
||||
type StaticArtifact = { readonly [STATIC_MODULE_MANIFEST_EXPORT]: DshClientModuleManifest }
|
||||
|
||||
/** Exports of the counter fixture library. */
|
||||
interface CounterExports {
|
||||
count: number
|
||||
increment: () => void
|
||||
renamed: number
|
||||
}
|
||||
|
||||
/** A static library's manifest factory resolves nothing through the module table. */
|
||||
const unusedRequire = Object.assign((specifier: string): never => {
|
||||
throw new Error(`unexpected static fixture dependency: ${specifier}`)
|
||||
}, {
|
||||
async: async (specifier: string): Promise<never> => { throw new Error(`unexpected static fixture chunk: ${specifier}`) },
|
||||
asset: (reference: string): string => reference,
|
||||
})
|
||||
|
||||
describe('statically linked client build modes', () => {
|
||||
it.each([
|
||||
{ label: 'defaults to production', mode: undefined, expectedMode: 'production', frozen: false },
|
||||
@@ -156,16 +177,148 @@ describe('statically linked client build modes', () => {
|
||||
if (config === undefined) throw new Error('static client config missing')
|
||||
|
||||
const output = await clientChunkOutput(root, config, 'index.js')
|
||||
const emitted = await import(`data:text/javascript,${encodeURIComponent(output)}`) as {
|
||||
mode: string
|
||||
snapshot: { value: number }
|
||||
}
|
||||
const artifact = await import(`data:text/javascript,${encodeURIComponent(output)}`) as StaticArtifact & { mode: string }
|
||||
const manifest = artifact[STATIC_MODULE_MANIFEST_EXPORT]
|
||||
const emitted = manifest.factory(unusedRequire) as { mode: string; snapshot: { value: number } }
|
||||
expect(manifest.id).toBe(REQUESTING_PACKAGE)
|
||||
expect(Object.hasOwn(manifest, 'meta')).toBe(false)
|
||||
expect(artifact.mode).toBe(expectedMode)
|
||||
expect(emitted.mode).toBe(expectedMode)
|
||||
expect(emitted.snapshot).toEqual({ value: 1 })
|
||||
expect(Object.isFrozen(emitted.snapshot)).toBe(frozen)
|
||||
})
|
||||
})
|
||||
|
||||
describe('static Client dependency delivery', () => {
|
||||
function fixture(source: string): string {
|
||||
const root = mkdtempSync(join(tmpdir(), 'dsh-static-delivery-'))
|
||||
onTestFinished(() => { rmSync(root, { recursive: true, force: true }) })
|
||||
mkdirSync(join(root, 'lib/types'), { recursive: true })
|
||||
writeFileSync(join(root, 'package.json'), JSON.stringify({ name: REQUESTING_PACKAGE, type: 'module' }))
|
||||
writeFileSync(join(root, 'lib/types/index.js'), source)
|
||||
return root
|
||||
}
|
||||
|
||||
function config(root: string): UserConfig {
|
||||
const result = staticLinked(root, ['lib/types/index.js'])({ env: { DSH_BUILD_FACE: 'client' } })[0]
|
||||
if (result === undefined) throw new Error('static client config missing')
|
||||
return result
|
||||
}
|
||||
|
||||
it('leaves third-party imports and lazy imports external for the final shell build', async () => {
|
||||
const root = fixture([
|
||||
'import { marker } from "ordinary-library"',
|
||||
'export { marker }',
|
||||
'export const load = () => import("ordinary-library/lazy")',
|
||||
].join('\n'))
|
||||
const builds = await build({
|
||||
...config(root), cwd: root, config: false, tsconfig: false,
|
||||
write: false, clean: false, exports: false, report: false, logLevel: 'silent',
|
||||
})
|
||||
try {
|
||||
const chunks = builds.flatMap(bundle => bundle.chunks).filter(chunk => chunk.type === 'chunk')
|
||||
expect(chunks.map(chunk => chunk.fileName)).toEqual(['index.js'])
|
||||
const output = chunks[0]!.code
|
||||
expect(output).toMatch(/import\s[^;]*from\s*["']ordinary-library["']/)
|
||||
expect(output).toMatch(/import\(["']ordinary-library\/lazy["']\)/)
|
||||
expect(output).not.toMatch(/require(?:\.async)?\(["']ordinary-library/)
|
||||
} finally {
|
||||
for (const bundle of builds) await bundle[Symbol.asyncDispose]()
|
||||
}
|
||||
})
|
||||
|
||||
it('keeps shared Client library imports as ordinary imports and requires them from the manifest factory', async () => {
|
||||
const dependencies = [
|
||||
'@deepseek-ai/dsh-client-store', '@deepseek-ai/dsh-client-ui-slots',
|
||||
'@deepseek-ai/dsh-client-ui-primitives', '@deepseek-ai/dsh-client-ui-dockkit',
|
||||
]
|
||||
const root = fixture([
|
||||
...dependencies.map((id, index) => `import * as dependency${index} from ${JSON.stringify(id)}`),
|
||||
`export const dependencies = [${dependencies.map((_id, index) => `dependency${index}`).join(', ')}]`,
|
||||
].join('\n'))
|
||||
const output = await clientChunkOutput(root, config(root), 'index.js')
|
||||
for (const id of dependencies) expect(output).toMatch(new RegExp(`import\\s[^;]*from\\s*["']${id}["']`))
|
||||
// The manifest factory requires each module-table import once, in import order, so Modules records the dependencies.
|
||||
const factory = output.slice(output.indexOf(`${STATIC_MODULE_MANIFEST_EXPORT} =`))
|
||||
expect([...factory.matchAll(/require\("([^"]+)"\)/gu)].map(match => match[1])).toEqual(dependencies)
|
||||
})
|
||||
|
||||
it('exports the library as ordinary ESM and returns live views of the same exports from the manifest factory', async () => {
|
||||
const root = fixture([
|
||||
'export let count = 0',
|
||||
'export function increment() { count++ }',
|
||||
'const hidden = 1',
|
||||
'export { hidden as renamed }',
|
||||
].join('\n'))
|
||||
const output = await clientChunkOutput(root, config(root), 'index.js')
|
||||
const artifact = await import(`data:text/javascript,${encodeURIComponent(output)}`) as StaticArtifact & CounterExports
|
||||
expect(Object.keys(artifact).sort()).toEqual([STATIC_MODULE_MANIFEST_EXPORT, 'count', 'increment', 'renamed'].sort())
|
||||
const exports = artifact[STATIC_MODULE_MANIFEST_EXPORT].factory(unusedRequire)
|
||||
expect(Object.keys(exports).sort()).toEqual(['count', 'increment', 'renamed'])
|
||||
expect(exports.increment).toBe(artifact.increment)
|
||||
expect(exports.renamed).toBe(1)
|
||||
artifact.increment()
|
||||
expect(artifact.count).toBe(1)
|
||||
expect(exports.count).toBe(1)
|
||||
expect(typeof Object.getOwnPropertyDescriptor(exports, 'count')?.get).toBe('function')
|
||||
})
|
||||
|
||||
it('rejects a library export that takes the manifest name', async () => {
|
||||
const root = fixture(`export const ${STATIC_MODULE_MANIFEST_EXPORT} = 1\n`)
|
||||
await expect(clientChunkOutput(root, config(root), 'index.js')).rejects.toThrow(`${STATIC_MODULE_MANIFEST_EXPORT} is reserved`)
|
||||
})
|
||||
|
||||
it('leaves a third-party stylesheet import to the shell build', async () => {
|
||||
const root = fixture('import "ordinary-library/dist/theme.css"\nexport const ready = true\n')
|
||||
const output = await clientChunkOutput(root, config(root), 'index.js')
|
||||
expect(output).toMatch(/import\s*["']ordinary-library\/dist\/theme\.css["']/)
|
||||
expect(output).not.toMatch(/\?url["']/)
|
||||
expect(output).not.toMatch(/\bmeta:/)
|
||||
})
|
||||
|
||||
it('describes local styles in metadata without installing DOM styles', async () => {
|
||||
const root = fixture('import classes from "./Panel.module.css"\nimport "./global.css"\nexport { classes }\n')
|
||||
mkdirSync(join(root, 'src'), { recursive: true })
|
||||
writeFileSync(join(root, 'src/Panel.module.css'), '.panel { display: flex; }\n')
|
||||
writeFileSync(join(root, 'src/global.css'), '.overlay { position: fixed; }\n')
|
||||
const output = await clientChunkOutput(root, config(root), 'index.js')
|
||||
expect(output).not.toMatch(/document\.(?:head|createElement|querySelector)/)
|
||||
const artifact = await import(`data:text/javascript,${encodeURIComponent(output)}`) as StaticArtifact
|
||||
const require = unusedRequire
|
||||
const exports = artifact[STATIC_MODULE_MANIFEST_EXPORT].factory(require) as { classes: { panel: string } }
|
||||
const meta = artifact[STATIC_MODULE_MANIFEST_EXPORT].meta
|
||||
if (meta === undefined) throw new Error('static CSS metadata missing')
|
||||
const stylesheets = meta().stylesheets
|
||||
expect(stylesheets).toBeDefined()
|
||||
expect(Object.keys(stylesheets!).sort()).toEqual([
|
||||
'src/Panel.module.css', 'src/global.css',
|
||||
])
|
||||
expect(stylesheets!['src/Panel.module.css']!.text(require))
|
||||
.toContain(`.${exports.classes.panel}{display:flex}`)
|
||||
expect(stylesheets!['src/global.css']!.text(require))
|
||||
.toContain('.overlay{position:fixed}')
|
||||
})
|
||||
|
||||
it('names local styles below the package when the package directory is a symbolic link', async () => {
|
||||
const root = fixture('import classes from "./Panel.module.css"\nexport { classes }\n')
|
||||
mkdirSync(join(root, 'src'), { recursive: true })
|
||||
writeFileSync(join(root, 'src/Panel.module.css'), '.panel { display: flex; }\n')
|
||||
const linked = join(root, 'linked')
|
||||
symlinkSync(root, linked, process.platform === 'win32' ? 'junction' : 'dir')
|
||||
|
||||
const output = await clientChunkOutput(linked, config(linked), 'index.js')
|
||||
const artifact = await import(`data:text/javascript,${encodeURIComponent(output)}`) as StaticArtifact
|
||||
const manifest = artifact[STATIC_MODULE_MANIFEST_EXPORT]
|
||||
const meta = manifest.meta
|
||||
if (meta === undefined) throw new Error('static CSS metadata missing')
|
||||
const stylesheets = meta().stylesheets
|
||||
expect(Object.keys(stylesheets ?? {})).toEqual(['src/Panel.module.css'])
|
||||
const exports = manifest.factory(unusedRequire) as { classes: { panel: string } }
|
||||
expect(stylesheets?.['src/Panel.module.css']?.text(unusedRequire))
|
||||
.toContain(`.${exports.classes.panel}{display:flex}`)
|
||||
})
|
||||
})
|
||||
|
||||
function dynamicImportFixture(prefix: string): string {
|
||||
const root = mkdtempSync(join(tmpdir(), prefix))
|
||||
onTestFinished(() => { rmSync(root, { recursive: true, force: true }) })
|
||||
@@ -178,6 +331,45 @@ function dynamicImportFixture(prefix: string): string {
|
||||
}
|
||||
|
||||
describe('client bundle dynamic imports', () => {
|
||||
it.each([false, true])('emits metadata only for chunks containing styles (styles=%s)', async (withStyles) => {
|
||||
const root = dynamicImportFixture('dsh-client-optional-meta-')
|
||||
if (withStyles) {
|
||||
mkdirSync(join(root, 'src/client'), { recursive: true })
|
||||
writeFileSync(join(root, 'src/client/global.css'), '.fixture { display: flex; }\n')
|
||||
writeFileSync(join(root, 'lib/types/client/index.js'), 'import "./global.css"\nexport const load = () => import("./terminal.js")\n')
|
||||
}
|
||||
const config = clientConfigs(root)[0]
|
||||
if (config === undefined) throw new Error('client config missing')
|
||||
const builds = await build({
|
||||
...config, cwd: root, config: false, tsconfig: false,
|
||||
write: false, clean: false, exports: false, report: false, logLevel: 'silent',
|
||||
})
|
||||
try {
|
||||
const registrations: DshClientModuleManifest[] = []
|
||||
const target = { __ModuleLoader__: { load: (manifest: DshClientModuleManifest) => { registrations.push(manifest) } } }
|
||||
for (const bundle of builds) for (const chunk of bundle.chunks) {
|
||||
if (chunk.type !== 'chunk') continue
|
||||
expect(chunk.code).not.toContain('__dshChunkStyles_')
|
||||
runInNewContext(chunk.code, { window: target })
|
||||
}
|
||||
expect(registrations).toHaveLength(2)
|
||||
const entry = registrations.find(registration => registration.chunk === undefined)
|
||||
const lazy = registrations.find(registration => registration.chunk === 'client.terminal.js')
|
||||
if (entry === undefined || lazy === undefined) throw new Error('dynamic fixture registrations missing')
|
||||
expect(Object.hasOwn(lazy, 'meta')).toBe(false)
|
||||
expect(Object.hasOwn(entry, 'meta')).toBe(withStyles)
|
||||
if (withStyles) {
|
||||
if (entry.meta === undefined) throw new Error('dynamic CSS metadata missing')
|
||||
const stylesheets = entry.meta().stylesheets
|
||||
expect(Object.keys(stylesheets ?? {})).toEqual(['src/client/global.css'])
|
||||
expect(stylesheets?.['src/client/global.css']?.text({ asset: reference => reference }))
|
||||
.toContain('.fixture{display:flex}')
|
||||
}
|
||||
} finally {
|
||||
for (const bundle of builds) await bundle[Symbol.asyncDispose]()
|
||||
}
|
||||
})
|
||||
|
||||
it('keeps a dual Client browser chunk disjoint from its Node output', async () => {
|
||||
const root = dynamicImportFixture('dsh-dual-client-chunk-')
|
||||
const configs = clientBundle(root, ['lib/types/index.js'], { dualClient: true })(
|
||||
@@ -304,6 +496,12 @@ describe('client bundle purity gate', () => {
|
||||
expect(() => resolveId('@deepseek-ai/dsh-spill-policy/notice/internal')).toThrow(/purity/)
|
||||
})
|
||||
|
||||
it('inlines only the plugin market index source address entry', () => {
|
||||
expect(resolveId('@deepseek-ai/dsh-plugin-market-index/source')).toBeNull()
|
||||
expect(() => resolveId('@deepseek-ai/dsh-plugin-market-index')).toThrow(/purity/)
|
||||
expect(() => resolveId('@deepseek-ai/dsh-plugin-market-index/source/internal')).toThrow(/purity/)
|
||||
})
|
||||
|
||||
it.each(['file-drag'])('inlines the stateless %s entry without admitting its subpaths or UI plugin', (name) => {
|
||||
expect(resolveId(`@deepseek-ai/dsh-util-${name}`)).toBeNull()
|
||||
expect(() => resolveId(`@deepseek-ai/dsh-util-${name}/internal`)).toThrow(/purity/)
|
||||
@@ -333,6 +531,7 @@ describe('client bundle purity gate', () => {
|
||||
it('throws on any other @deepseek-ai leak', () => {
|
||||
expect(() => resolveId('@deepseek-ai/dsh-agent')).toThrow(/purity/)
|
||||
expect(() => resolveId('@deepseek-ai/dsh-client-web')).toThrow(/purity/)
|
||||
expect(() => resolveId('@deepseek-ai/dsh-util-code-language')).toThrow(/purity/)
|
||||
})
|
||||
|
||||
it('throws on cross-plugin value imports — bare plugin names and /client subpaths alike', () => {
|
||||
@@ -455,10 +654,13 @@ describe('client bundle experimental input isolation', () => {
|
||||
writeFileSync(entry, `export { marker } from ${JSON.stringify(importPath(entry, prototype))}\n`)
|
||||
const guarded = config('static')
|
||||
const plugins = guarded.plugins as Array<{ name: string }>
|
||||
if (typeof guarded.outputOptions === 'function') throw new Error('expected static output options')
|
||||
const outputOptions = { ...guarded.outputOptions, sourcemapExcludeSources: false }
|
||||
delete outputOptions.sourcemapPathTransform
|
||||
const unguarded: UserConfig = {
|
||||
...guarded,
|
||||
plugins: plugins.filter(plugin => plugin.name !== 'dsh-client-input-isolation'),
|
||||
outputOptions: { sourcemapExcludeSources: false },
|
||||
outputOptions,
|
||||
}
|
||||
|
||||
await expect(bundle(owner, unguarded)).resolves.toContain('experimental sentinel')
|
||||
@@ -495,7 +697,7 @@ describe('client bundle experimental input isolation', () => {
|
||||
const { owner, entry } = fixture()
|
||||
writeFileSync(entry, `export * from ${JSON.stringify(experimental)}\n`)
|
||||
|
||||
await expect(bundle(owner, config('static'))).rejects.toThrow(/client bundle isolation.*experimental/)
|
||||
await expect(bundle(owner, config('static', owner))).rejects.toThrow(/client bundle isolation.*experimental/)
|
||||
})
|
||||
|
||||
it.each([false, true])('checks omitted source-map files against their package owner (experimental: %s)', async (experimentalSource) => {
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('Cordis core API generation', () => {
|
||||
expect(pages.get('docs/cordis-api/events.md')).toContain('## DispatchMode')
|
||||
expect(pages.get('docs/cordis-api/fiber.md')).toContain('## EffectMeta')
|
||||
expect(pages.get('docs/cordis-api/registry.md')).toContain('## Plugin')
|
||||
expect(pages.get('docs/cordis-api/service.md')).toContain('### Service.resolveConfig')
|
||||
expect(pages.get('docs/cordis-api/service.md')).toContain('### Service.resolveIntercept')
|
||||
|
||||
const fiber = pages.get('docs/cordis-api/fiber.md') ?? ''
|
||||
expect(fiber).toContain('```\n\nRegister a cleanup-aware effect on this fiber.')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/** Cordis rc.11 updates retain dependency ownership and publish only current configuration. */
|
||||
/** Cordis lifecycle since rc.11 (vendored Core): updates retain dependency ownership and publish only current configuration. */
|
||||
import type { Awaitable } from '@deepseek-ai/cosmokit'
|
||||
import { Context, FiberState } from '@deepseek-ai/cordis'
|
||||
import { describe, expect, it, onTestFinished, vi } from 'vitest'
|
||||
@@ -110,7 +110,8 @@ describe('Cordis rc.11 lifecycle', () => {
|
||||
await isolated.plugin((child) => { expect(child.rc11View).toBe('inner') })
|
||||
await withdraw()
|
||||
expect(owner.rc11View).toBe('outer')
|
||||
expect(isolated.rc11View).toBe('outer')
|
||||
// Since rc.12, the isolated context does not fall back to the injected view once its own provision is withdrawn.
|
||||
expect(() => isolated.rc11View).toThrow('without inject')
|
||||
})
|
||||
await ctx.plugin((owner) => {
|
||||
owner.isolate('rc11Private').provide('rc11Private', true)
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
/** Cordis rc.12 root access, intercept metadata, isolation, disposal and event errors. */
|
||||
import { Context, FiberState, Service, ValidationError } from '@deepseek-ai/cordis'
|
||||
import { describe, expect, it, onTestFinished } from 'vitest'
|
||||
|
||||
interface Metadata {
|
||||
a?: number
|
||||
b?: number
|
||||
c?: number
|
||||
tags?: string[]
|
||||
}
|
||||
|
||||
declare module '@deepseek-ai/cordis' {
|
||||
interface Context {
|
||||
rc12Meta: MetadataService
|
||||
rc12View: string
|
||||
}
|
||||
}
|
||||
|
||||
class MetadataService extends Service<Metadata> {
|
||||
constructor(ctx: Context) {
|
||||
super(ctx, 'rc12Meta')
|
||||
}
|
||||
|
||||
read(): Metadata {
|
||||
return this[Service.resolveIntercept]()
|
||||
}
|
||||
}
|
||||
|
||||
function root() {
|
||||
const ctx = new Context()
|
||||
onTestFinished(() => ctx.fiber.dispose())
|
||||
return ctx
|
||||
}
|
||||
|
||||
describe('Cordis rc.12 core', () => {
|
||||
it('exposes the root context through Context.root only', async () => {
|
||||
const ctx = root()
|
||||
const seen: unknown[] = []
|
||||
await ctx.plugin((child: Context) => {
|
||||
seen.push(child[Context.root])
|
||||
seen.push(child[Symbol.for('cordis.root') as typeof Context.root])
|
||||
expect(() => { Reflect.get(child, 'root') }).toThrow('cannot get property "root" without inject')
|
||||
})
|
||||
expect(seen).toEqual([ctx, ctx])
|
||||
})
|
||||
|
||||
it('merges injected metadata under context intercepts', async () => {
|
||||
const ctx = root()
|
||||
await ctx.plugin(MetadataService)
|
||||
let metadata!: Metadata
|
||||
await ctx.intercept('rc12Meta', { b: 2 }).inject({ rc12Meta: { a: 1, b: 1 } }, (child) => {
|
||||
metadata = child.intercept('rc12Meta', { c: 3 }).rc12Meta.read()
|
||||
})
|
||||
expect(metadata).toEqual({ a: 1, b: 2, c: 3 })
|
||||
})
|
||||
|
||||
it('merges through an overridden mergeIntercept in increasing precedence', async () => {
|
||||
class Tagged extends MetadataService {
|
||||
override [Service.mergeIntercept](...values: Metadata[]): Metadata {
|
||||
return { tags: values.flatMap(value => value.tags ?? []) }
|
||||
}
|
||||
}
|
||||
const ctx = root()
|
||||
await ctx.plugin(Tagged)
|
||||
let metadata!: Metadata
|
||||
await ctx.intercept('rc12Meta', { tags: ['outer'] }).inject({ rc12Meta: { tags: ['inject'] } }, (child) => {
|
||||
metadata = child.intercept('rc12Meta', { tags: ['inner'] }).rc12Meta.read()
|
||||
})
|
||||
expect(metadata).toEqual({ tags: ['inject', 'outer', 'inner'] })
|
||||
})
|
||||
|
||||
it('does not inherit the injected view across an isolation boundary', async () => {
|
||||
const ctx = root()
|
||||
ctx.provide('rc12View', 'outer')
|
||||
const results: string[] = []
|
||||
const read = (child: Context) => {
|
||||
try {
|
||||
return child.rc12View
|
||||
} catch (error) {
|
||||
return error instanceof Error ? error.message : String(error)
|
||||
}
|
||||
}
|
||||
await ctx.inject(['rc12View'], async (owner) => {
|
||||
await owner.plugin((child) => { results.push(read(child)) })
|
||||
await owner.isolate('rc12View').plugin((child) => { results.push(read(child)) })
|
||||
})
|
||||
expect(results).toEqual(['outer', 'cannot get property "rc12View" without inject'])
|
||||
})
|
||||
|
||||
it('isolates a context pinned to its parent realm label from the injected view', async () => {
|
||||
const ctx = root()
|
||||
ctx.provide('rc12View', 'outer')
|
||||
let message = ''
|
||||
await ctx.inject(['rc12View'], async (owner) => {
|
||||
const pinned = owner.isolate('rc12View', owner[Context.isolate].rc12View)
|
||||
expect(() => pinned.rc12View).toThrow('cannot get property "rc12View" without inject')
|
||||
await pinned.plugin((child) => {
|
||||
try {
|
||||
void child.rc12View
|
||||
} catch (error) {
|
||||
message = error instanceof Error ? error.message : String(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
expect(message).toBe('cannot get property "rc12View" without inject')
|
||||
})
|
||||
|
||||
it('settles pending and failed fibers to DISPOSED', async () => {
|
||||
const ctx = root()
|
||||
const pending = ctx.inject(['rc12NeverProvided'], () => {})
|
||||
expect(pending.state).toBe(FiberState.PENDING)
|
||||
await pending.dispose()
|
||||
expect(pending.state).toBe(FiberState.DISPOSED)
|
||||
|
||||
const failed = ctx.plugin(() => { throw new Error('rc12 boom') })
|
||||
await expect(failed.await()).rejects.toThrow('rc12 boom')
|
||||
expect(ctx.logger.buffer.some(message => message.type === 'error' && message.args[0] instanceof Error && message.args[0].message === 'rc12 boom')).toBe(true)
|
||||
expect(failed.state).toBe(FiberState.FAILED)
|
||||
await failed.dispose()
|
||||
expect(failed.state).toBe(FiberState.DISPOSED)
|
||||
})
|
||||
|
||||
it('names the failing event in the parallel AggregateError', async () => {
|
||||
const ctx = root()
|
||||
ctx.on('rc12-parallel' as never, () => { throw new Error('listener failed') })
|
||||
const symbol = Symbol('rc12-symbol')
|
||||
ctx.on(symbol as never, () => { throw new Error('symbol listener failed') })
|
||||
await expect(ctx.parallel('rc12-parallel' as never)).rejects.toThrow('one or more listeners of event "rc12-parallel" failed')
|
||||
await expect(ctx.parallel(symbol as never)).rejects.toThrow('one or more listeners of event Symbol(rc12-symbol) failed')
|
||||
})
|
||||
|
||||
it('formats config validation paths with keyed segments', () => {
|
||||
const error = new ValidationError([{ message: 'bad', path: [{ key: 0 }, 'name'] }])
|
||||
expect(ValidationError.is(error)).toBe(true)
|
||||
expect(ValidationError.is(new TypeError('bad'))).toBe(false)
|
||||
expect(error.issues).toHaveLength(1)
|
||||
expect(error.message).toBe('invalid config:\n - bad (at 0.name)')
|
||||
expect(ValidationError.normalizePath([{ key: 'a' }, 1])).toEqual(['a', 1])
|
||||
expect(ValidationError.formatPath(undefined)).toBe('')
|
||||
expect(new ValidationError([{ message: 'bad', path: [] }]).message).toBe('invalid config:\n - bad')
|
||||
})
|
||||
|
||||
it('logs an AggregateError without members as itself', () => {
|
||||
const ctx = root()
|
||||
const aggregate = new AggregateError([], 'empty')
|
||||
ctx.logger.error(aggregate)
|
||||
expect(ctx.logger.buffer.at(-1)?.args[0]).toBe(aggregate)
|
||||
})
|
||||
})
|
||||
@@ -99,7 +99,7 @@ describe('Loader tree mutation reports', () => {
|
||||
describe('Include patch data ownership', () => {
|
||||
it('detaches file entries even with no patches', () => {
|
||||
const data: EntryOptions[] = [{ id: 'x', name: 'example', config: { value: 1 } }]
|
||||
const result = applyEntryPatches(data, undefined, vi.fn())
|
||||
const result = applyEntryPatches(data, undefined, vi.fn()).data
|
||||
result[0]!.disabled = true
|
||||
;(result[0]!.config as { value: number }).value = 2
|
||||
expect(data).toEqual([{ id: 'x', name: 'example', config: { value: 1 } }])
|
||||
@@ -109,7 +109,7 @@ describe('Include patch data ownership', () => {
|
||||
const insert: EntryOptions[] = [{ id: 'g', name: 'group', group: true,
|
||||
config: [{ id: 'x', name: 'example', config: { value: 1 } }] }]
|
||||
const warn = vi.fn()
|
||||
const result = applyEntryPatches([], [{ insert }, { id: 'x', disabled: true }], warn)
|
||||
const result = applyEntryPatches([], [{ insert }, { id: 'x', disabled: true }], warn).data
|
||||
const children = result[0]!.config as Array<{ disabled?: boolean; config: { value: number } }>
|
||||
expect(children[0]!.disabled).toBe(true)
|
||||
children[0]!.config.value = 2
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/** Include's YAML dialect exports used by DSH configuration tools. */
|
||||
import { entryYamlErrorPosition, parseEntryYaml, stringifyEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
describe('Include YAML dialect', () => {
|
||||
it('reads and writes !!js scalars as expression nodes', () => {
|
||||
const source = '- id: a\n name: example\n disabled: !!js process.env.OFF\n'
|
||||
const parsed = parseEntryYaml(source)
|
||||
expect(parsed).toEqual([{ id: 'a', name: 'example', disabled: { __jsExpr: 'process.env.OFF' } }])
|
||||
expect(stringifyEntryYaml(parsed)).toBe(source)
|
||||
})
|
||||
|
||||
it('reads scalars under the YAML 1.2 core schema', () => {
|
||||
expect(parseEntryYaml('- 0b101\n- 0o17\n- 0x1F\n- yes\n- 2001-01-01\n- ~\n')).toEqual(['0b101', 15, 31, 'yes', '2001-01-01', null])
|
||||
expect(parseEntryYaml('')).toBeUndefined()
|
||||
})
|
||||
|
||||
it('rejects unknown tags', () => {
|
||||
expect(() => parseEntryYaml('- !!binary aGVsbG8=\n- !custom value\n')).toThrow()
|
||||
})
|
||||
|
||||
it('writes repeated references in full', () => {
|
||||
const shared = { value: 1 }
|
||||
expect(stringifyEntryYaml([{ config: shared }, { config: shared }])).toBe('- config:\n value: 1\n- config:\n value: 1\n')
|
||||
})
|
||||
|
||||
it('folds long scalars at the requested line width', () => {
|
||||
const value = [{ text: Array.from({ length: 20 }, (_, index) => `word${String(index)}`).join(' ') }]
|
||||
expect(stringifyEntryYaml(value).split('\n').length).toBeGreaterThan(2)
|
||||
expect(stringifyEntryYaml(value, { lineWidth: -1 }).split('\n')).toHaveLength(2)
|
||||
})
|
||||
|
||||
it('locates parse errors', () => {
|
||||
let error: unknown
|
||||
try {
|
||||
parseEntryYaml('- id: a\n name: [\n')
|
||||
} catch (caught) {
|
||||
error = caught
|
||||
}
|
||||
expect(entryYamlErrorPosition(error)).toEqual({ line: 3, column: 1 })
|
||||
expect(entryYamlErrorPosition(new Error('other'))).toBeUndefined()
|
||||
let alias: unknown
|
||||
try {
|
||||
parseEntryYaml('- id: a\n config: *missing\n')
|
||||
} catch (caught) {
|
||||
alias = caught
|
||||
}
|
||||
expect(entryYamlErrorPosition(alias)).toEqual({ line: 2, column: 11 })
|
||||
expect(() => parseEntryYaml('- id: a\n config: *later\n- id: b\n config: &later {}\n')).toThrow('Alias *later must follow its anchor')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,129 @@
|
||||
/** Loader rc.9 and Include 1.2 entry validation, located config errors and module lookup failures. */
|
||||
import { mkdtemp, rm, writeFile } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { pathToFileURL } from 'node:url'
|
||||
import { Context, FiberState } from '@deepseek-ai/cordis'
|
||||
import Loader, { EntryValidationError, Group, ModuleNotFoundError, type EntryOptions } from '@deepseek-ai/cordis-plugin-loader'
|
||||
import Include, { ConfigFileError } from '@deepseek-ai/cordis-plugin-include'
|
||||
import Schema from '@deepseek-ai/schemastery'
|
||||
import { describe, expect, it, onTestFinished } from 'vitest'
|
||||
|
||||
const Typed = Object.assign((_ctx: Context, _config: { value: number }) => {}, {
|
||||
Config: Schema.object({ value: Schema.number().required() }),
|
||||
})
|
||||
|
||||
// `rows.yml` is the file the root Include reads; other files are reachable through nested includes.
|
||||
async function fixture(files: Record<string, string>) {
|
||||
const dir = await mkdtemp(join(tmpdir(), 'dsh-loader-rc9-'))
|
||||
const pathOf = (name: string) => join(dir, name)
|
||||
for (const [name, content] of Object.entries(files)) await writeFile(pathOf(name), content)
|
||||
const ctx = new Context()
|
||||
onTestFinished(async () => {
|
||||
await ctx.fiber.dispose()
|
||||
await rm(dir, { recursive: true, force: true, maxRetries: 3 })
|
||||
})
|
||||
const errors: unknown[] = []
|
||||
const warnings: unknown[] = []
|
||||
ctx.logger.exporter({
|
||||
export: ({ type, args }: { type: string; args: unknown[] }) => {
|
||||
if (type === 'error') errors.push(...args)
|
||||
if (type === 'warn') warnings.push(...args)
|
||||
},
|
||||
})
|
||||
ctx.baseUrl = pathToFileURL(dir).href + '/'
|
||||
await ctx.plugin(Loader)
|
||||
Object.assign(ctx.loader.builtins, { include: Include, group: Group, example: () => {}, typed: Typed })
|
||||
const id = await ctx.loader.create({ name: 'cordis:include', config: { path: './rows.yml' } })
|
||||
await ctx.loader.await()
|
||||
const entry = ctx.loader.resolve(id)
|
||||
return { ctx, path: pathOf('rows.yml'), pathOf, entry, include: entry.subtree as Include | undefined, errors, warnings }
|
||||
}
|
||||
|
||||
describe('Loader 1.0.0-rc.9 entry options', () => {
|
||||
it('rejects invalid options before a tree changes', async () => {
|
||||
const ctx = new Context()
|
||||
onTestFinished(() => ctx.fiber.dispose())
|
||||
await ctx.plugin(Loader)
|
||||
ctx.loader.builtins.example = () => {}
|
||||
// Options read from a file are untyped; set the invalid values past the compiler.
|
||||
const invalid = { name: 'cordis:example' } as EntryOptions
|
||||
Reflect.set(invalid, 'disabled', 'yes')
|
||||
Reflect.set(invalid, 'isolate', { svc: 1 })
|
||||
const error = await ctx.loader.create(invalid).catch((caught: unknown) => caught)
|
||||
expect(error).toBeInstanceOf(EntryValidationError)
|
||||
expect((error as EntryValidationError).issues).toEqual([
|
||||
{ message: 'disabled must be a boolean', path: ['disabled'] },
|
||||
{ message: 'isolate.svc must be true or a string', path: ['isolate', 'svc'] },
|
||||
])
|
||||
expect(ctx.loader.root.data).toEqual([])
|
||||
await expect(ctx.loader.create({ name: 'cordis:example', group: true })).rejects.toThrow('config is required')
|
||||
})
|
||||
|
||||
it('accepts explicit ids containing the separator from a file', async () => {
|
||||
const app = await fixture({ 'rows.yml': '- id: pkg:row\n name: cordis:example\n' })
|
||||
expect(app.include!.store['pkg:row']!.fiber!.state).toBe(FiberState.ACTIVE)
|
||||
})
|
||||
})
|
||||
|
||||
describe('Include 1.2.0 config files', () => {
|
||||
it('reports invalid entries and config values at their file positions', async () => {
|
||||
const app = await fixture({ 'rows.yml': [
|
||||
'- id: bad',
|
||||
' name: cordis:example',
|
||||
' disabled: 1',
|
||||
'- id: typed',
|
||||
' name: cordis:typed',
|
||||
' config:',
|
||||
' value: text',
|
||||
'',
|
||||
].join('\n') })
|
||||
const messages = app.errors.map(String).join('\n')
|
||||
expect(messages).toContain(`disabled must be a boolean (at disabled, ${app.path}:3:13)`)
|
||||
expect(messages).toContain(`${app.path}:7:12`)
|
||||
expect(app.include!.store['bad']).toBeUndefined()
|
||||
expect(app.include!.store['typed']!.fiber!.state).not.toBe(FiberState.ACTIVE)
|
||||
})
|
||||
|
||||
it('reports an unknown plugin module at its name position', async () => {
|
||||
const app = await fixture({ 'rows.yml': '- id: missing\n name: ./missing-plugin.js\n' })
|
||||
const error = app.errors.find(error => error instanceof ModuleNotFoundError)
|
||||
expect(error?.specifier).toBe('./missing-plugin.js')
|
||||
expect(error?.message).toContain(`(at name, ${app.path}:2:9)`)
|
||||
})
|
||||
|
||||
it('parses YAML 1.2 core scalars and locates syntax errors', async () => {
|
||||
const app = await fixture({ 'rows.yml': '- id: typed\n name: cordis:typed\n config:\n value: 0x10\n' })
|
||||
expect(app.include!.store['typed']!.fiber!.effectiveConfig).toEqual({ value: 16 })
|
||||
await writeFile(app.path, '- id: typed\n name: [\n')
|
||||
await app.include!.refresh()
|
||||
const error = app.warnings.find(warning => warning instanceof ConfigFileError)
|
||||
expect(error).toBeInstanceOf(ConfigFileError)
|
||||
expect((error as ConfigFileError).issues[0]!.location).toMatchObject({ filename: app.path, line: 3 })
|
||||
})
|
||||
|
||||
it('rejects a file with a non-mapping entry at its position', async () => {
|
||||
const app = await fixture({ 'rows.yml': '- id: ok\n name: cordis:example\n- id: g\n name: cordis:group\n group: true\n config:\n - plain\n' })
|
||||
const error = app.errors.find(error => error instanceof ConfigFileError)
|
||||
expect(error?.issues).toEqual([{ message: 'entry must be an object', location: { filename: app.path, line: 7, column: 7 } }])
|
||||
expect(app.entry.fiber!.state).not.toBe(FiberState.ACTIVE)
|
||||
})
|
||||
|
||||
it('locates an unresolved alias as a parse error', async () => {
|
||||
const app = await fixture({ 'rows.yml': '- id: typed\n name: cordis:typed\n config: *missing\n' })
|
||||
const error = app.errors.find(error => error instanceof ConfigFileError)
|
||||
expect(error?.stage).toBe('parse')
|
||||
expect(error?.issues[0]!.location).toEqual({ filename: app.path, line: 3, column: 11 })
|
||||
})
|
||||
|
||||
it.each([
|
||||
['an override', ' patches:\n - id: typed\n config:\n value: text\n', '- id: typed\n name: cordis:typed\n config:\n value: 1\n', 8],
|
||||
['an inserted entry', ' patches:\n - insert:\n - id: typed\n name: cordis:typed\n config:\n value: text\n', '[]\n', 10],
|
||||
])('locates a config value supplied by %s in the parent file', async (_kind, patches, inner, line) => {
|
||||
const app = await fixture({
|
||||
'rows.yml': `- id: inner\n name: cordis:include\n config:\n path: ./inner.yml\n${patches}`,
|
||||
'inner.yml': inner,
|
||||
})
|
||||
expect(app.errors.map(String).join('\n')).toContain(`(at value, ${app.path}:${String(line)}:`)
|
||||
})
|
||||
})
|
||||
@@ -84,15 +84,18 @@ describe('Loader project resolution', () => {
|
||||
await expect(tree.import('./missing.js')).rejects.toThrow()
|
||||
})
|
||||
|
||||
it('retains native import when helper creation is denied', async () => {
|
||||
it('retains native import while helper creation is denied and retries it later', async () => {
|
||||
const { root, baseUrl } = await fixture()
|
||||
const tree = await treeFor(baseUrl)
|
||||
const denied = vi.mocked(fs.mkdir).mockRejectedValueOnce(Object.assign(new Error('read-only project'), { code: 'EACCES' }))
|
||||
const denied = vi.mocked(fs.mkdir).mockRejectedValue(Object.assign(new Error('read-only project'), { code: 'EACCES' }))
|
||||
onTestFinished(() => { denied.mockReset() })
|
||||
expect(await createResolve(baseUrl)).toBeUndefined()
|
||||
expect(await tree.import('node:path')).toMatchObject({ join })
|
||||
await expect(tree.import('fixture-dep')).rejects.toThrow()
|
||||
expect(existsSync(join(root, '.cordis'))).toBe(false)
|
||||
denied.mockReset()
|
||||
expect(await tree.import('fixture-dep')).toMatchObject({ tag: 'bare-dep' })
|
||||
expect(existsSync(join(root, '.cordis', 'resolve.mjs'))).toBe(true)
|
||||
})
|
||||
|
||||
it('retains native import without a file-backed package scope', async () => {
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"apps/cli/tests/profiles/headless/tests/fixtures/subagent-settlement-fence.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 2
|
||||
},
|
||||
"apps/web/tests/default-product-isolation.e2e.ts": {
|
||||
"d0b9e422bcad4455b7450e6bef2d6fa774afc3f44cdc75bc1d480c11b9fd0214": 1
|
||||
},
|
||||
"packages/api/gateway/tests/browser-credentials.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 1
|
||||
},
|
||||
"packages/api/gateway/tests/gateway.host.spec.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 1
|
||||
},
|
||||
"packages/api/gateway/tests/operator-connect.host.spec.ts": {
|
||||
"a024beae6117bcaeaded2d59d0be04db10eae40e0d4b8ade0eb88fee7dfb9973": 1
|
||||
},
|
||||
"packages/api/gateway/tests/peer.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 4
|
||||
},
|
||||
"packages/api/session-controller/tests/transport.host.spec.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 1
|
||||
},
|
||||
"packages/boot/app-boot/tests/config-reload.spec.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 1
|
||||
},
|
||||
"packages/boot/config-editor/src/index.ts": {
|
||||
"2ef15140c5ddf0d1c87a5c80055760aaae1fd5ed86c986c69115c27cfa13ee51": 3
|
||||
},
|
||||
"packages/boot/hmr/src/index.ts": {
|
||||
"2ef15140c5ddf0d1c87a5c80055760aaae1fd5ed86c986c69115c27cfa13ee51": 1
|
||||
},
|
||||
"packages/boot/hmr/tests/package-reload.spec.ts": {
|
||||
"08185f8ef80468685cfa5affb086454f655c61ab83ecb9f8cde15c9a573bd1be": 1
|
||||
},
|
||||
"packages/bundle/web-app/src/index.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 3
|
||||
},
|
||||
"packages/bundle/web-app/tests/browser-open.host.spec.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 1
|
||||
},
|
||||
"packages/client/connection/tests/node-half.host.spec.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 2
|
||||
},
|
||||
"packages/experimental/auto-review/src/index.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 1
|
||||
},
|
||||
"packages/experimental/auto-review/tests/auto-review.spec.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 2
|
||||
},
|
||||
"packages/experimental/inspector/src/shared/cordis/observer.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 1
|
||||
},
|
||||
"packages/host/authentication-token/src/index.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 1
|
||||
},
|
||||
"packages/host/authentication-token/tests/loader.host.spec.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 2
|
||||
},
|
||||
"packages/host/authentication-token/tests/plugin.host.spec.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 1
|
||||
},
|
||||
"packages/host/frontend-static/tests/frontend-static.spec.ts": {
|
||||
"e9ced37d23b7f2f7af77caaa3c4ace319974f275186f14c1d32093f0658f73af": 1
|
||||
},
|
||||
"packages/mcp/mcp-client/src/index.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 1
|
||||
},
|
||||
"packages/preset/agent-preset-registry/src/mount.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 1
|
||||
},
|
||||
"packages/sdk/server/src/index.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 1
|
||||
},
|
||||
"packages/settings/settings/src/index.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 1
|
||||
},
|
||||
"packages/test-support/session-snapshot/tests/fixtures/subagent-send-message-fence.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 4
|
||||
},
|
||||
"packages/typert/protocol/src/index.ts": {
|
||||
"3755d2978651498c26c74bf7d3552cae5dd33d7f28e3c405cd282098e40a7c58": 2
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,8 @@ export function contextKeyMap(body: ts.ModuleBlock, sf: ts.SourceFile): Map<stri
|
||||
if (!ts.isInterfaceDeclaration(stmt) || stmt.name.text !== 'Context') continue
|
||||
for (const member of stmt.members) {
|
||||
if (!ts.isPropertySignature(member) || !member.type) continue
|
||||
keyToType.set(member.name.getText(sf), member.type.getText(sf))
|
||||
const key = ts.isStringLiteral(member.name) || ts.isIdentifier(member.name) ? member.name.text : member.name.getText(sf)
|
||||
keyToType.set(key, member.type.getText(sf))
|
||||
}
|
||||
}
|
||||
return keyToType
|
||||
|
||||
+2
-12
@@ -3,30 +3,20 @@
|
||||
* @module scripts/cordis-yaml
|
||||
*/
|
||||
|
||||
import * as yaml from 'js-yaml'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
|
||||
/** A Loader `!!js` expression preserved as data instead of executed. */
|
||||
export interface JsExpr {
|
||||
__jsExpr: string
|
||||
}
|
||||
|
||||
const jsExprType = new yaml.Type('tag:yaml.org,2002:js', {
|
||||
kind: 'scalar',
|
||||
resolve: data => typeof data === 'string',
|
||||
construct: (data: unknown): JsExpr => {
|
||||
if (typeof data !== 'string') throw new TypeError('!!js requires a scalar string')
|
||||
return { __jsExpr: data }
|
||||
},
|
||||
})
|
||||
const schema = yaml.JSON_SCHEMA.extend(jsExprType)
|
||||
|
||||
/**
|
||||
* Parse a Cordis config while preserving Loader `!!js` expressions as data.
|
||||
* @param source - Cordis YAML source text.
|
||||
* @returns the parsed YAML value.
|
||||
*/
|
||||
export function loadCordisYaml(source: string): unknown {
|
||||
return yaml.load(source, { schema })
|
||||
return parseEntryYaml(source)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { expect } from 'vitest'
|
||||
|
||||
/**
|
||||
* Require archival steps to retain the original machine, directory and build identity.
|
||||
* Require original-machine routing and build identity inputs; callers check each upload name.
|
||||
* @param job Parsed archival job from a packaging workflow.
|
||||
* @param count Expected number of artifact upload steps.
|
||||
* @returns The checked upload steps, preserving platform-specific fields.
|
||||
@@ -18,11 +18,8 @@ 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).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')
|
||||
}
|
||||
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
|
||||
}
|
||||
@@ -24,7 +24,7 @@ it('rejects debugging packages before dependency setup and pins the checked atte
|
||||
const preflight = steps.findIndex(step => step.id === 'preflight')
|
||||
expect(preflight).toBeGreaterThan(0)
|
||||
expect(preflight).toBeLessThan(steps.findIndex(step => step.uses?.startsWith('pnpm/')))
|
||||
expect(steps[preflight]?.run).toBe('node apps/desktop/scripts/preflight-desktop-publish.mjs')
|
||||
expect(steps[preflight]?.run).toBe('node apps/desktop-publisher/src/preflight-desktop-publish.mjs')
|
||||
expect(steps.find(step => step.id === 'route')?.env?.DESKTOP_PACKAGE_ATTEMPT).toBe('${{ steps.preflight.outputs.attempt }}')
|
||||
})
|
||||
|
||||
@@ -83,7 +83,7 @@ it('rejects non-master dispatch before scheduling a self-hosted job', () => {
|
||||
it('defaults to production website upload and separates cache-only recovery', () => {
|
||||
expect(workflow.on.workflow_dispatch).toMatchObject({ inputs: { upload_website: { type: 'boolean', default: true } } })
|
||||
expect(workflow.jobs.prepare!.env?.DESKTOP_UPLOAD_WEBSITE).toBe('${{ inputs.upload_website }}')
|
||||
expect(workflow.jobs.prepare!.env?.DOWNLOAD_PROD_EO_ZONE_ID).toBe('${{ vars.DOWNLOAD_PROD_EO_ZONE_ID }}')
|
||||
expect(JSON.stringify(workflow)).not.toContain('DOWNLOAD_PROD_EO_ZONE_ID')
|
||||
const upload = workflow.jobs['upload-website-installer']!
|
||||
const purge = workflow.jobs['purge-website-installer']!
|
||||
expect(purge.needs).toEqual(['route', 'prepare', 'upload-website-installer'])
|
||||
@@ -92,12 +92,12 @@ it('defaults to production website upload and separates cache-only recovery', ()
|
||||
for (const job of [upload, purge]) {
|
||||
expect(job.if).toBe("inputs.upload_website && needs.prepare.outputs.preset != 'test'")
|
||||
expect(job.environment).toBe('desktop-production')
|
||||
const preflight = job.steps.findIndex(step => step.run === 'node apps/desktop/scripts/preflight-desktop-publish-local.mjs')
|
||||
const preflight = job.steps.findIndex(step => step.run === 'node apps/desktop-publisher/src/preflight-desktop-publish-local.mjs')
|
||||
expect(preflight).toBeGreaterThan(-1)
|
||||
expect(preflight).toBeLessThan(job.steps.findIndex(step => step.run === 'pnpm install --frozen-lockfile'))
|
||||
expect(job.env?.DESKTOP_WEBSITE_APPROVAL).toBe('${{ needs.prepare.outputs.website-approval }}')
|
||||
}
|
||||
expect(upload.steps.find(step => step.id === 'website')?.run).toBe('node --import tsx apps/desktop/scripts/publish-website-ci.ts upload')
|
||||
expect(purge.steps.find(step => step.id === 'website')?.run).toBe('node --import tsx apps/desktop/scripts/publish-website-ci.ts purge')
|
||||
expect(upload.steps.find(step => step.id === 'website')?.run).toBe('node --import tsx apps/desktop-publisher/src/publish-website-ci.ts upload')
|
||||
expect(purge.steps.find(step => step.id === 'website')?.run).toBe('node --import tsx apps/desktop-publisher/src/publish-website-ci.ts purge')
|
||||
expect(purge.steps.some(step => step.run?.includes('publish-desktop-ci.ts'))).toBe(false)
|
||||
})
|
||||
@@ -5,5 +5,5 @@
|
||||
"docs/cordis-primer.md": 600,
|
||||
"docs/testing.md": 1350,
|
||||
"packages/AGENTS.md": 810,
|
||||
"packages/README.md": 994
|
||||
"packages/README.md": 1100
|
||||
}
|
||||
@@ -60,8 +60,6 @@ const PACKAGE_LIBRARIES: Readonly<Record<string, string>> = {
|
||||
'packages/boot/app-boot': 'Boot library the app bins import; plain helper exports.',
|
||||
'packages/boot/cmdline': 'Command-line library the app bins import; plain module exports.',
|
||||
'packages/util/official-bundles': 'Bundle-list data library the launcher and plugin manager import; plain constant exports.',
|
||||
'packages/connector/cli-account': 'Host library CLI app plugins import for commands, account operations, and the CLI path context; plain class and function exports.',
|
||||
'packages/connector/upstream-skills': 'Host library CLI app plugins import to download and list their upstream skills; plain function and schema exports.',
|
||||
'packages/client/store': 'Browser-side state primitives; plain function/type exports.',
|
||||
'packages/client/ui-primitives': 'Browser-side UI component library; plain component exports.',
|
||||
'packages/client/ui-slots': 'Browser-side slot-map declarations; plain type exports.',
|
||||
@@ -97,6 +95,7 @@ const PACKAGE_LIBRARIES: Readonly<Record<string, string>> = {
|
||||
'packages/util/brand': 'Stateless nominal-string and canonical-key constructors.',
|
||||
'packages/util/crypto': 'Zero-dependency identifier minting utility.',
|
||||
'packages/util/error': 'Zero-dependency HarnessError base class.',
|
||||
'packages/util/text-search': 'In-memory search filtering library.',
|
||||
'packages/util/deque': 'Zero-dependency circular deque utility.',
|
||||
'packages/util/chunked-list': 'Persistent collection operations and checkpoint validation without a plugin surface.',
|
||||
'packages/util/code-language': 'Zero-dependency file-extension to syntax-highlighting language table.',
|
||||
|
||||
@@ -1,286 +1 @@
|
||||
{
|
||||
"apps/cli/tests/built-bin.e2e.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"apps/desktop/scripts/desktop-publish.ts": {
|
||||
"d37e8639087921e2491d45d40d63b44e72b30a516ad3a5f3155f467c7f5c3ac7": 1
|
||||
},
|
||||
"apps/desktop/src/client/WelcomePage.tsx": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"apps/desktop/src/preload-platform-account.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"apps/web/tests/chat-scroll-contract.e2e.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"apps/web/tests/support.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/api/gateway/src/client/remote-stream.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/api/gateway/tests/gateway-stream.host.spec.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/api/workspace-files/src/client/change-feed.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/boot/app-boot/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/boot/plugin-manager/src/registry.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/boot/plugin-manager/tests/operations-process.spec.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 2
|
||||
},
|
||||
"packages/boot/plugin-market/src/repository-cache.ts": {
|
||||
"3d8f6e3468aecc6e006ee3e5f20a5c6c5277316636c8849756fc6d710e9d907b": 1
|
||||
},
|
||||
"packages/client/modules/src/index.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1,
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/client/store/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/client/ui-open-in-app/src/client/controller.ts": {
|
||||
"ea86beefffc83e1b3c38c7961e9dd8faf194c917ab229aac53c7716cb5b36687": 1
|
||||
},
|
||||
"packages/client/ui-open-in-app/src/client/open-path.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1,
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/client/ui-schedule/src/client/recent-time-zones.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/client/ui-sidebar-browser/src/client/browser/url.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/client/ui-sidebar-right/src/client/tab-inventory.ts": {
|
||||
"ee22b9dbd07fc0b76f0464bf59386efb6925dab82c4539a2772b909b944ee33c": 1
|
||||
},
|
||||
"packages/client/ui-skill/src/client/SkillRow.tsx": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/context/file-reference-local/tests/search.spec.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/credentials/deepseek-account/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/credentials/deepseek-account/src/logout.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/experimental/client-ui-forge/src/panel.ts": {
|
||||
"ea86beefffc83e1b3c38c7961e9dd8faf194c917ab229aac53c7716cb5b36687": 1
|
||||
},
|
||||
"packages/experimental/inspector/src/client/bridge/transport.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/inspector/src/client/cdp/console.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 2
|
||||
},
|
||||
"packages/experimental/inspector/src/client/inspection/realm.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1,
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 2
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/bridge/hub.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 2
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/bridge/runtime-rpc.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 4
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/bridge/session.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/cdp/domains/dom/model.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/cdp/realm-sessions.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/inspection/cordis-store.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/inspection/network-store.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 2
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/inspection/query-router.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/inspection/realm-store.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/realms/host/bridge.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 3
|
||||
},
|
||||
"packages/experimental/inspector/src/worker/realms/host/sources.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/liveshare/src/client/owner-login.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 3
|
||||
},
|
||||
"packages/experimental/liveshare/src/client/share-relay-address.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/experimental/liveshare/src/client/ShareEditPanel.tsx": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 2
|
||||
},
|
||||
"packages/experimental/liveshare/src/host/shareable-catalog.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 2
|
||||
},
|
||||
"packages/experimental/liveshare/src/host/tunnel-supervision.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/liveshare/src/host/viewer-dispatch.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/experimental/liveshare/tests/fixtures/base-llm.mjs": {
|
||||
"8b2766548472fe722af04dc7c95b06d303bb164fd12fbec87a07ea6eaae7146a": 1
|
||||
},
|
||||
"packages/experimental/webhook-github/src/handler.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/webworker-runtime/src/client/client.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/webworker-runtime/src/transport/tunnel.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/webworker-runtime/tests/compile/transform-corpus-check.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/experimental/webworker-runtime/tests/polyfill/als-shim.spec.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/host/directory-picker-browse/tests/service.spec.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/host/open-in-app/src/icons.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/host/open-in-app/src/resolver.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/identity/anonymous-user-id/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/llm/llm-deepseek/src/file-store.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/llm/llm-deepseek/src/files-api.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/llm/llm-pi-ai/src/replay.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/llm/llm/src/adapter-failure.ts": {
|
||||
"19186deef10a7178489ddf20fcaf6688a0baf38bf6d9933cb78fe65023f3280f": 1
|
||||
},
|
||||
"packages/lsp/lsp-stdio/src/instance.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/session-query/session-query-sqlite/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 2
|
||||
},
|
||||
"packages/session-query/session-query/src/cold-read.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/session/session-persistence-jsonl/src/generation.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/session/session-persistence-jsonl/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/session/session-persistence-jsonl/tests/zstd.spec.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/shell/bash-local/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/shell/pwsh-local/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/skill/skill-filesystem/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/skill/skill/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/spill/spill-local/src/cleanup.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/subagent/subagent-acp/src/run.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/subagent/subagent-claude-code/src/run.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/subagent/subagent-codex/src/run.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1,
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 2
|
||||
},
|
||||
"packages/subagent/subagent-dsh-sdk/src/index.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/subagent/subagent-dsh-sdk/src/run.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/subagent/subagent/src/out-of-process.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/subprocess/subprocess-local/src/index.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/subprocess/subprocess-local/src/linux-scope.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 5
|
||||
},
|
||||
"packages/subprocess/subprocess-local/src/output.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 2
|
||||
},
|
||||
"packages/subprocess/subprocess-local/src/runner-protocol.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/subprocess/subprocess-local/src/spawn-runner.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 2,
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 4
|
||||
},
|
||||
"packages/subprocess/subprocess-local/src/spawn.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 3
|
||||
},
|
||||
"packages/subprocess/subprocess-local/src/windows-job.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"packages/subprocess/subprocess-local/tests/native-containment.spec.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1,
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 2
|
||||
},
|
||||
"packages/subprocess/subprocess-local/tests/native-windows.spec.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"packages/subprocess/subprocess-local/tests/spawn.spec.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1,
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 5
|
||||
},
|
||||
"packages/test-support/client-runtime/src/assembly/test-client.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"scripts/gen-session-format-catalog.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"scripts/run-gates.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 2,
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"scripts/slot-walk.ts": {
|
||||
"10ea16f7e56fe8d9176f54f90b2c2137b20e2c60e3f5cb45d6dc09fe23c52eae": 1
|
||||
},
|
||||
"vitest.e2e.config.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
},
|
||||
"vitest.web.config.ts": {
|
||||
"cf101add035f69891416d7350e9a824c2de6c0d1b7a253de6a73da923023b073": 1
|
||||
}
|
||||
}
|
||||
{}
|
||||
@@ -9,7 +9,9 @@ export const EXPERIMENTAL_PACKAGE_NAME_EXCEPTIONS: Readonly<Record<string, strin
|
||||
'packages/experimental/cua': '@deepseek-ai/dsh-cua',
|
||||
'packages/experimental/cua-bundle': '@deepseek-ai/dsh-cua-bundle',
|
||||
'packages/experimental/cua-macos': '@deepseek-ai/dsh-cua-macos',
|
||||
'packages/experimental/cua-mcp': '@deepseek-ai/dsh-cua-mcp',
|
||||
'packages/experimental/cua-windows': '@deepseek-ai/dsh-cua-windows',
|
||||
'packages/experimental/timeline': '@deepseek-ai/dsh-timeline',
|
||||
'packages/experimental/tool-session-query': '@deepseek-ai/dsh-tool-session-query',
|
||||
'packages/experimental/session-title-all-prompts-llm': '@deepseek-ai/dsh-session-title-all-prompts-llm',
|
||||
'packages/experimental/tool-terminal': '@deepseek-ai/dsh-tool-terminal',
|
||||
@@ -28,6 +30,8 @@ export const EXPERIMENTAL_PACKAGE_NAME_EXCEPTIONS: Readonly<Record<string, strin
|
||||
'packages/experimental/plugin-recommendations': '@deepseek-ai/dsh-plugin-recommendations',
|
||||
'packages/experimental/client-ui-plugin-recommendations': '@deepseek-ai/dsh-client-ui-plugin-recommendations',
|
||||
'packages/experimental/personalized-recommendations': '@deepseek-ai/dsh-personalized-recommendations',
|
||||
'packages/experimental/forge-gitlab': '@deepseek-ai/dsh-forge-gitlab',
|
||||
'packages/experimental/deepseek-chat-import': '@deepseek-ai/dsh-deepseek-chat-import',
|
||||
} satisfies Record<`packages/experimental/${string}`, `@deepseek-ai/dsh-${string}`>
|
||||
|
||||
/** Legacy npm namespace, allowed only in `LEGACY_PREFIXED_EXPERIMENTAL_PACKAGE_DIRECTORIES`. */
|
||||
|
||||
@@ -187,7 +187,7 @@ describe('cordis-walk scan reach', () => {
|
||||
expect(events).toEqual(['second/changed'])
|
||||
})
|
||||
|
||||
it('reads string-literal and identifier member names from an Events merge', () => {
|
||||
it('reads string-literal and identifier service and event names', () => {
|
||||
const sf = ts.createSourceFile('x.ts', [
|
||||
"declare module '@deepseek-ai/cordis' {",
|
||||
' interface Events {',
|
||||
@@ -196,6 +196,8 @@ describe('cordis-walk scan reach', () => {
|
||||
' }',
|
||||
' interface Context {',
|
||||
' thing: ThingService',
|
||||
" 'connection.authentication': AuthenticationService",
|
||||
' "connection.other": OtherService',
|
||||
' }',
|
||||
'}',
|
||||
'',
|
||||
@@ -206,6 +208,10 @@ describe('cordis-walk scan reach', () => {
|
||||
: null
|
||||
if (!body) throw new Error('fixture did not parse to a module block')
|
||||
expect(eventNameList(body, sf)).toEqual(['scope/list', 'plain'])
|
||||
expect([...contextKeyMap(body, sf)]).toEqual([['thing', 'ThingService']])
|
||||
expect([...contextKeyMap(body, sf)]).toEqual([
|
||||
['thing', 'ThingService'],
|
||||
['connection.authentication', 'AuthenticationService'],
|
||||
['connection.other', 'OtherService'],
|
||||
])
|
||||
})
|
||||
})
|
||||
@@ -59,11 +59,13 @@ export const SERVICE_PAGE: Record<string, string> = {
|
||||
productTelemetry: 'product-telemetry.md',
|
||||
productAnalytics: 'product-telemetry.md',
|
||||
connection: 'web-server.md',
|
||||
'connection.authentication': 'web-server.md',
|
||||
pluginManager: 'boot.md',
|
||||
actionCards: 'boot.md',
|
||||
pluginRecommendations: 'boot.md',
|
||||
pluginMarket: 'boot.md',
|
||||
connectorAccounts: 'boot.md',
|
||||
cliAccounts: 'boot.md',
|
||||
pluginRegistryProbe: 'boot.md',
|
||||
configEditor: 'boot.md',
|
||||
profileContext: 'boot.md',
|
||||
@@ -84,11 +86,12 @@ export const SERVICE_PAGE: Record<string, string> = {
|
||||
browserUse: 'browser-use.md',
|
||||
computerUse: 'computer-use.md',
|
||||
cuaAccess: 'computer-use.md',
|
||||
cuaPrograms: 'computer-use.md',
|
||||
commands: 'commands.md',
|
||||
compaction: 'compaction.md',
|
||||
cordisInspect: 'extensions.md',
|
||||
authorization: 'credentials.md',
|
||||
deepseekAccount: 'credentials.md',
|
||||
deepseekAccount: 'account.md',
|
||||
credentials: 'credentials.md',
|
||||
credentialsController: 'credentials.md',
|
||||
settingsController: 'settings.md',
|
||||
@@ -114,6 +117,7 @@ export const SERVICE_PAGE: Record<string, string> = {
|
||||
sandboxPolicy: 'sandbox.md',
|
||||
ssh: 'ssh.md',
|
||||
sessionPersistence: 'persistence.md',
|
||||
deepseekChatImport: 'persistence.md',
|
||||
sessionQuery: 'session-query.md',
|
||||
sessionFileReferences: 'session-reference.md',
|
||||
sessionReferenceResolver: 'session-reference.md',
|
||||
@@ -125,12 +129,14 @@ export const SERVICE_PAGE: Record<string, string> = {
|
||||
forgePanel: 'forge.md',
|
||||
forgeSession: 'forge.md',
|
||||
sessionController: 'session.md',
|
||||
sessionStatus: 'web-client.md',
|
||||
sessionSkillCatalog: 'skills.md',
|
||||
sessions: 'session.md',
|
||||
sessionLogDeepSeek: 'session.md',
|
||||
settings: 'settings.md',
|
||||
sessionTitle: 'session-title.md',
|
||||
skills: 'skills.md',
|
||||
upstreamSkills: 'skills.md',
|
||||
spillStore: 'spill.md',
|
||||
storage: 'storage.md',
|
||||
storageDomain: 'storage.md',
|
||||
@@ -181,6 +187,7 @@ export const SERVICE_PAGE: Record<string, string> = {
|
||||
* to a model as `cordis_runtime_inspect what:"client"`).
|
||||
*/
|
||||
export const SERVICE_WALK_EXEMPTIONS: Record<string, string> = {
|
||||
timeline: 'experimental session data service internal to the bundle — packages/experimental/timeline/README.md owns its behavior',
|
||||
contextMenus: 'client-side interface-typed menu registry — packages/client/ui-context-menu/README.md owns the API',
|
||||
fileActions: 'client-side interface-typed file actions — packages/client/ui-file-actions/README.md owns the API',
|
||||
invocation: 'not a service: per-call accessor (RemoteInvocation | undefined) the Gateway derives for each Remote call — packages/api/gateway/README.md owns the contract',
|
||||
@@ -191,6 +198,7 @@ export const SERVICE_WALK_EXEMPTIONS: Record<string, string> = {
|
||||
configuredAgentIdentities: 'not a service: launcher-provided boot-context value (ConfiguredAgentIdentities | undefined) — packages/core/agent-loop/README.md owns this launcher contract',
|
||||
launcherSessionQueryPath: 'not a service: launcher-provided boot-context value (string | undefined) — packages/session-query/session-query-sqlite/README.md owns this launcher contract',
|
||||
dshHomePath: 'not a service: boot-provided root accessor function (typeof dshHomePath | undefined) for Loader !!js config expressions — packages/boot/app-boot/README.md owns the boot contract',
|
||||
dshPath: 'not a service: boot-provided root accessor function (typeof dshPath | undefined) for Loader !!js config expressions — packages/boot/app-boot/README.md owns the boot contract',
|
||||
launchEnvironment: 'not a service: launcher-provided root accessor value (LaunchEnvironmentSnapshot | undefined) — packages/util/launch-environment/README.md owns this launcher contract',
|
||||
pluginPackages: 'profile-boot-owned package resolver service used by optional consumers — packages/boot/app-boot/README.md owns this internal API',
|
||||
fileUpload: 'client-side browser upload service — packages/client/file-upload/README.md owns the API',
|
||||
@@ -214,6 +222,7 @@ export const SERVICE_WALK_EXEMPTIONS: Record<string, string> = {
|
||||
locale: 'client-side interface-typed browser service — packages/client/locale/README.md owns the API',
|
||||
modelDirectories: 'client-side interface-typed browser service — packages/client/ui-model-selection/README.md owns the API',
|
||||
modules: 'client-side interface-typed browser service — packages/client/modules/README.md owns the API',
|
||||
scriptRealms: 'client-side script-environment provider registry — packages/client/script-realm/README.md owns the API',
|
||||
remote: 'client-side interface-typed gateway accessor (ClientRemote) — packages/api/gateway/README.md owns the API',
|
||||
sessionLogDownload: 'client-side browser download controller — packages/session-query/session-log-export/README.md owns the API',
|
||||
inputTriggers: 'client-side interface-typed browser service — packages/client/ui-input-trigger/README.md owns the API',
|
||||
@@ -250,7 +259,7 @@ export const EVENT_SCOPE_PAGE: Record<string, string> = {
|
||||
'cordis': 'extensions.md',
|
||||
'authorization': 'credentials.md',
|
||||
'credentials': 'credentials.md',
|
||||
'deepseek-account': 'credentials.md',
|
||||
'deepseek-account': 'account.md',
|
||||
'domain': 'storage.md',
|
||||
'forge': 'forge.md',
|
||||
'fs': 'filesystem.md',
|
||||
@@ -261,6 +270,7 @@ export const EVENT_SCOPE_PAGE: Record<string, string> = {
|
||||
'mcp-manager': 'mcp.md',
|
||||
'permission-presets': 'permission-presets.md',
|
||||
'session': 'session.md',
|
||||
'timeline': 'session.md',
|
||||
'settings': 'settings.md',
|
||||
'skills': 'skills.md',
|
||||
'subagent': 'subagent.md',
|
||||
@@ -312,6 +322,8 @@ export const EVENT_WALK_EXEMPTIONS: Record<string, string> = {
|
||||
* appear on more than one page.
|
||||
*/
|
||||
export const LINK_MAP: Readonly<Record<string, string>> = {
|
||||
AuthenticationProvider: '../../packages/client/connection/README.md#browser-authentication-and-request-trust',
|
||||
PeerId: 'typert.md',
|
||||
Principal: 'typert.md',
|
||||
PrincipalMap: 'typert.md',
|
||||
RemoteAccessResource: 'typert.md',
|
||||
@@ -426,7 +438,9 @@ export const LINK_MAP: Readonly<Record<string, string>> = {
|
||||
ForgeReviewRequest: 'forge.md',
|
||||
ForgeReviewResult: 'forge.md',
|
||||
ForgeBaseBranches: 'forge.md',
|
||||
ForgeBranches: 'forge.md',
|
||||
ForgeRemoteBranches: 'forge.md',
|
||||
ForgeRemoteDefault: 'forge.md',
|
||||
ForgeWorktreeBases: 'forge.md',
|
||||
ForgeChangeRequestDiff: 'forge.md',
|
||||
ForgeCommit: 'forge.md',
|
||||
ForgeCommitList: 'forge.md',
|
||||
@@ -456,11 +470,13 @@ export const LINK_MAP: Readonly<Record<string, string>> = {
|
||||
ForgePanelState: 'forge.md',
|
||||
ForgeProvider: 'forge.md',
|
||||
ForgeReadiness: 'forge.md',
|
||||
ForgeDescription: 'forge.md',
|
||||
ForgeRepository: 'forge.md',
|
||||
MergeMethod: 'forge.md',
|
||||
MergeRequest: 'forge.md',
|
||||
SessionChangeRequest: 'forge.md',
|
||||
SessionChangeRequestsListener: 'forge.md',
|
||||
ForgeCommandRule: 'forge.md',
|
||||
GenerateOptions: 'llm-streaming.md',
|
||||
Inbox: 'core.md',
|
||||
InboxItem: 'core.md',
|
||||
@@ -482,6 +498,7 @@ export const LINK_MAP: Readonly<Record<string, string>> = {
|
||||
LlmResolvedModelInfo: 'llm-streaming.md',
|
||||
LlmFailure: 'llm-streaming.md',
|
||||
LlmImageRequestPricing: 'llm-streaming.md',
|
||||
ProviderCredential: 'llm-streaming.md',
|
||||
LlmModelInfo: 'llm-streaming.md',
|
||||
LlmProviderInfo: 'llm-streaming.md',
|
||||
LlmConfigurableProvider: 'llm-streaming.md',
|
||||
@@ -745,6 +762,7 @@ export const LINK_MAP: Readonly<Record<string, string>> = {
|
||||
SessionEventTraceRequest: 'session-query.md',
|
||||
SessionEventWindow: 'session-query.md',
|
||||
SessionLineageTrace: 'session-query.md',
|
||||
SessionListMetadata: 'session-query.md',
|
||||
SessionObservation: 'session-query.md',
|
||||
SessionObservationOptions: 'session-query.md',
|
||||
SessionRecord: 'session-query.md',
|
||||
@@ -755,6 +773,9 @@ export const LINK_MAP: Readonly<Record<string, string>> = {
|
||||
SessionSearchRequest: 'session-query.md',
|
||||
SessionTitleObservation: 'session-query.md',
|
||||
SessionTitleObservationResult: 'session-query.md',
|
||||
SessionReadState: 'web-client.md',
|
||||
SessionReadAction: 'web-client.md',
|
||||
SessionReadFrame: 'web-client.md',
|
||||
SessionTitleProvider: 'session-title.md',
|
||||
SessionTitleSnapshot: 'session-title.md',
|
||||
SkillCatalogSnapshot: 'skills.md',
|
||||
@@ -901,18 +922,19 @@ export const LINK_MAP: Readonly<Record<string, string>> = {
|
||||
AuthorizationMethod: 'credentials.md',
|
||||
AuthorizationNotice: 'credentials.md',
|
||||
AuthorizationOutcome: 'credentials.md',
|
||||
AccountView: 'credentials.md',
|
||||
AccountUpdate: 'credentials.md',
|
||||
AccountDetails: 'credentials.md',
|
||||
AccountClientMetadata: 'credentials.md',
|
||||
AccountNotificationBatch: 'credentials.md',
|
||||
AccountNotificationId: 'credentials.md',
|
||||
AccountNotification: 'credentials.md',
|
||||
AccountNotificationAction: 'credentials.md',
|
||||
AccountNotificationEvent: 'credentials.md',
|
||||
AccountUserId: 'credentials.md',
|
||||
PlatformSession: 'credentials.md',
|
||||
SignInAttemptId: 'credentials.md',
|
||||
AccountView: 'account.md',
|
||||
AccountUpdate: 'account.md',
|
||||
AccountDetails: 'account.md',
|
||||
AccountClientMetadata: 'account.md',
|
||||
AccountNotificationBatch: 'account.md',
|
||||
AccountNotificationId: 'account.md',
|
||||
AccountNotification: 'account.md',
|
||||
AccountNotificationAction: 'account.md',
|
||||
AccountNotificationEvent: 'account.md',
|
||||
AccountRequestCredential: 'account.md',
|
||||
AccountUserId: 'account.md',
|
||||
PlatformSession: 'account.md',
|
||||
SignInAttemptId: 'account.md',
|
||||
AuthorizationPrompt: 'credentials.md',
|
||||
AuthorizationRequest: 'credentials.md',
|
||||
AuthorizationSession: 'credentials.md',
|
||||
@@ -941,8 +963,16 @@ export const LINK_MAP: Readonly<Record<string, string>> = {
|
||||
VerifiedWebhookDelivery: 'webhook.md',
|
||||
WebhookRule: 'webhook.md',
|
||||
PermissionCatalog: 'permission-presets.md',
|
||||
PermissionPresetSetRequest: 'permission-presets.md',
|
||||
PermissionSelection: 'permission-presets.md',
|
||||
PresetOption: 'permission-presets.md',
|
||||
PresetSpec: 'permission-presets.md',
|
||||
WebEntryUrl: 'web-server.md',
|
||||
WebAdmission: 'web-server.md',
|
||||
WebAuthPolicy: 'web-server.md',
|
||||
WebAuthRequest: 'web-server.md',
|
||||
WebAuthenticationRule: 'web-server.md',
|
||||
WebFallback: 'web-server.md',
|
||||
WebRoute: 'web-server.md',
|
||||
WebResourceRoute: 'web-server.md',
|
||||
IndexInjection: 'web-server.md',
|
||||
@@ -1004,6 +1034,7 @@ export const FOUNDATION_TYPE_NAMES: ReadonlySet<string> = new Set([
|
||||
'Plugin',
|
||||
'AbortSignal',
|
||||
'Headers',
|
||||
'URL',
|
||||
'AsyncIterable',
|
||||
'Context',
|
||||
'Error',
|
||||
@@ -1024,6 +1055,8 @@ export const FOUNDATION_TYPE_NAMES: ReadonlySet<string> = new Set([
|
||||
'ReadonlySet',
|
||||
'Request',
|
||||
'Response',
|
||||
'Buffer',
|
||||
'Duplex',
|
||||
'IncomingMessage',
|
||||
'ServerResponse',
|
||||
'ReturnType',
|
||||
@@ -1036,25 +1069,26 @@ export const TYPE_LINK_EXEMPTIONS: Readonly<Record<string, string>> = {
|
||||
ConnectorAccountRegistration: 'Plugins page account registration is owned by packages/client/ui-connector-account/README.md',
|
||||
ConnectorAccountsView: 'registered account stream item is owned by packages/client/ui-connector-account/README.md',
|
||||
ConnectorOperationId: 'account operation id is owned by packages/client/ui-connector-account/README.md',
|
||||
CliAccountRegistration: 'vendor CLI and account registration is owned by packages/connector/cli-account/README.md',
|
||||
CliAccountHandle: 'registered account handle is owned by packages/connector/cli-account/README.md',
|
||||
UpstreamSkillsRegistration: 'entry skill and pinned upstream files registration is owned by packages/connector/upstream-skills/README.md',
|
||||
UpstreamSkillsHandle: 'registered upstream files handle is owned by packages/connector/upstream-skills/README.md',
|
||||
ActionCardDecision: 'packages/experimental/action-cards/README.md',
|
||||
ActionCardKind: 'packages/experimental/action-cards/README.md',
|
||||
ActionCardResult: 'packages/experimental/action-cards/README.md',
|
||||
ActionCardView: 'packages/experimental/action-cards/README.md',
|
||||
RecommendationDetails: 'packages/experimental/plugin-recommendations/README.md',
|
||||
DeepseekChatImportLimits: 'upload limits returned to the browser are owned by packages/experimental/deepseek-chat-import/src/types.ts',
|
||||
ProductEvent: 'Desktop event fields are owned by packages/client/product-analytics/README.md and src/events.ts',
|
||||
ConnectionFetchHandler: 'shared Fetch dispatch is owned by packages/client/connection/src/rpc.ts',
|
||||
ConnectionRequestRejection: 'transport rejection status is owned by packages/client/connection/src/rpc.ts',
|
||||
ConnectionTrustRequest: 'transport authentication input is owned by packages/client/connection/src/rpc.ts',
|
||||
PeerAdmission: 'Peer admission outcome is owned by packages/client/connection/src/rpc.ts',
|
||||
ConnectionAdmission: 'physical socket admission and release are owned by packages/client/connection/src/rpc.ts',
|
||||
PeerScope: 'Peer scope contract is owned by packages/typert/protocol/src/types.ts',
|
||||
RemoteAccessPolicy: 'access policy contract is owned by packages/api/remote-access/README.md',
|
||||
RemoteAccessRequest: 'Gateway decision requests are owned by packages/api/remote-access/README.md',
|
||||
RemoteAccessDecision: 'Gateway decisions are owned by packages/api/remote-access/README.md',
|
||||
RemoteAccessFrame: 'access snapshot frames are owned by packages/api/remote-access/README.md',
|
||||
RemoteAccessBaseline: 'access snapshot frames are owned by packages/api/remote-access/README.md',
|
||||
ConnectionIndexRequest: 'frontend authentication request is owned by packages/client/connection/src/rpc.ts',
|
||||
ConnectionIndexResponse: 'frontend authentication response is owned by packages/client/connection/src/rpc.ts',
|
||||
Profile: 'resolved profile layers are owned by packages/boot/app-boot/README.md',
|
||||
PatchOptions: 'Include patch entries are owned by vendor/include (vendored upstream)',
|
||||
McpResourceProvider: 'scoped resource provider is owned by packages/mcp/mcp-resources/README.md',
|
||||
@@ -1232,7 +1266,7 @@ export const CORDIS_CATALOG_POLICY: CordisCatalogPolicy = {
|
||||
{ name: 'ctx.effect', summary: 'Register a disposable side effect tied to the fiber.', source: 'vendor/cordis/src/fiber.ts:9' },
|
||||
{ name: 'ctx.get / ctx.set / ctx.provide / ctx.accessor / ctx.mixin', summary: 'Low-level service-store access and binding.', source: 'vendor/cordis/src/reflect.ts:7' },
|
||||
{ name: 'ctx.extend / ctx.isolate / ctx.intercept', summary: 'Derive a child context (scoped services / isolation / interception).', source: 'vendor/cordis/src/context.ts:42' },
|
||||
{ name: 'ctx.root / ctx.fiber / ctx.registry / ctx.reflect / ctx.events / ctx.logger', summary: 'Ambient handles onto the running context graph.', source: 'vendor/cordis/src/context.ts:16' },
|
||||
{ name: 'ctx[Context.root] / ctx.fiber / ctx.registry / ctx.reflect / ctx.events / ctx.logger', summary: 'Ambient handles onto the running context graph.', source: 'vendor/cordis/src/context.ts:16' },
|
||||
{ name: 'ctx.timer (+ interval / timeout / throttle / debounce)', summary: 'Disposable timer helpers. The `timer` key is provided at runtime; the four supported helpers are mixed onto ctx directly (declared via Pick).', source: 'vendor/timer/src/index.ts:4' },
|
||||
{ name: 'ctx.loader', summary: 'The config Loader that booted the app (present under the loader).', source: 'vendor/loader/src/index.ts:30' },
|
||||
],
|
||||
|
||||
@@ -27,7 +27,15 @@ const FIXTURE: Record<string, string> = {
|
||||
},
|
||||
include: ['vendor/**/*.ts', 'packages/**/*.ts'],
|
||||
}),
|
||||
'vendor/cordis/src/context.ts': 'export class Context { private brand!: void }\n',
|
||||
'vendor/cordis/src/context.ts': [
|
||||
'export class Context {',
|
||||
' private brand!: void',
|
||||
' bail(...args: unknown[]): void {}',
|
||||
' on(...args: unknown[]): void {}',
|
||||
' once(...args: unknown[]): void {}',
|
||||
'}',
|
||||
'',
|
||||
].join('\n'),
|
||||
'vendor/cordis/src/events.ts': [
|
||||
'export class EventsService {',
|
||||
' dispatch(type: string, args: unknown[]): unknown[] { return [type, args] }',
|
||||
@@ -63,6 +71,28 @@ const FIXTURE: Record<string, string> = {
|
||||
'packages/fix/pkgc/src/helper.ts':
|
||||
"function scriptFire(args: [string]): void { void gEvents.dispatch('emit', args) }\n",
|
||||
'packages/fix/pkgc/src/caller.ts': "scriptFire(['pkgc/script-event'])\n",
|
||||
'packages/fix/bailtypes/src/receiver.ts': [
|
||||
"import { Context } from '../../../../vendor/cordis/src/context.ts'",
|
||||
'export declare const application: Context',
|
||||
"export declare const event: 'bail/union-a' | 'bail/union-b'",
|
||||
'',
|
||||
].join('\n'),
|
||||
'packages/fix/bailcalls/src/index.ts': [
|
||||
"import { application as receiver, event } from '../../bailtypes/src/receiver.ts'",
|
||||
"receiver.bail('bail/direct')",
|
||||
"receiver.bail({}, 'bail/scoped')",
|
||||
'receiver.bail(event)',
|
||||
"receiver.on('bail/direct', () => {})",
|
||||
"receiver.once('bail/scoped', () => {})",
|
||||
'declare const widened: string',
|
||||
'receiver.bail(widened)',
|
||||
'const ctx = { bail(...args: unknown[]): void {} }',
|
||||
"ctx.bail('bail/unrelated')",
|
||||
'// An untyped receiver cannot establish event API ownership.',
|
||||
'declare const untyped: any',
|
||||
"untyped.bail('bail/untyped')",
|
||||
'',
|
||||
].join('\n'),
|
||||
}
|
||||
|
||||
const root = mkdtempSync(join(tmpdir(), 'gen-doc-graphs-'))
|
||||
@@ -99,6 +129,34 @@ describe('event relation call-site indexing', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('type-aware bail dispatch', () => {
|
||||
function collectBailRelations() {
|
||||
return new EventRelationCollector(project, sources.filter(source => source.pkg === 'bailcalls')).collect()
|
||||
}
|
||||
|
||||
it.each(['bail/direct', 'bail/scoped', 'bail/union-a', 'bail/union-b'])(
|
||||
'records %s from an imported Context receiver as a bail dispatcher',
|
||||
(event) => {
|
||||
expect(collectBailRelations().get(event)?.dispatchers).toEqual(new Map([
|
||||
['bailcalls', new Set(['bail'])],
|
||||
]))
|
||||
},
|
||||
)
|
||||
|
||||
it('keeps on and once registrations as listeners', () => {
|
||||
const relations = collectBailRelations()
|
||||
expect(relations.get('bail/direct')?.listeners).toEqual(new Set(['bailcalls']))
|
||||
expect(relations.get('bail/scoped')?.listeners).toEqual(new Set(['bailcalls']))
|
||||
expect(relations.get('bail/union-a')?.listeners.size).toBe(0)
|
||||
})
|
||||
|
||||
it('excludes unrelated and untyped receivers and widened event names', () => {
|
||||
expect([...collectBailRelations().keys()].sort()).toEqual([
|
||||
'bail/direct', 'bail/scoped', 'bail/union-a', 'bail/union-b',
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
describe('memoized filesystem probes', () => {
|
||||
function countingSystem(): { system: ts.System; calls: string[] } {
|
||||
const calls: string[] = []
|
||||
|
||||
+53
-10
@@ -123,6 +123,13 @@ const SERVICE_ROLES: ServiceRole[] = [
|
||||
consumers: ['client-ui-plugin-recommendations'],
|
||||
note: 'Reads the current catalog text of an official plugin card and enables the plugin through the profile plugin manager after a click.',
|
||||
},
|
||||
{
|
||||
key: 'deepseekChatImport',
|
||||
pkg: 'deepseek-chat-import',
|
||||
title: 'DeepSeek chat export import',
|
||||
mode: 'service',
|
||||
note: 'Serves the owner-only upload route that imports each conversation of a DeepSeek chat export as a Session, and the upload limits the browser checks first.',
|
||||
},
|
||||
{
|
||||
key: 'headlessStartup',
|
||||
pkg: 'headless',
|
||||
@@ -167,7 +174,7 @@ const SERVICE_ROLES: ServiceRole[] = [
|
||||
pkg: 'plugin-manager',
|
||||
title: 'Current-profile plugin and bundle management',
|
||||
mode: 'core',
|
||||
consumers: ['plugin-manager', 'ui-settings-plugin-inventory'],
|
||||
consumers: ['plugin-manager'],
|
||||
note: 'Shares profile package operations with the CLI and reports persisted and running state to Web and agent callers.',
|
||||
},
|
||||
{
|
||||
@@ -177,6 +184,13 @@ const SERVICE_ROLES: ServiceRole[] = [
|
||||
mode: 'service',
|
||||
note: 'Holds the accounts CLI app plugins and MCP connectors register and serves their Host-computed displays to the Plugins page through one Remote; authorization pages and notices stay in the browser that started the operation.',
|
||||
},
|
||||
{
|
||||
key: 'cliAccounts',
|
||||
pkg: 'cli-account',
|
||||
title: 'Vendor CLIs and accounts of CLI app plugins',
|
||||
mode: 'service',
|
||||
note: 'Holds what each CLI app plugin registers: adds the CLI\'s absolute path to required runtime context, runs the plugin\'s account operations one at a time through bounded commands, and registers the account with `ctx.connectorAccounts` while that registry is loaded.',
|
||||
},
|
||||
{
|
||||
key: 'pluginMarket',
|
||||
pkg: 'plugin-market',
|
||||
@@ -199,14 +213,23 @@ const SERVICE_ROLES: ServiceRole[] = [
|
||||
title: 'Authenticated browser transport',
|
||||
mode: 'core',
|
||||
consumers: ['api-gateway', 'host-frontend-static'],
|
||||
note: 'Owns browser authentication and shared HTTP request dispatch; API adapters register endpoints and streams.',
|
||||
note: 'Applies source policy and shared HTTP request dispatch; credential verification belongs to ConnectionAuthentication, and API adapters register endpoints and streams.',
|
||||
},
|
||||
{
|
||||
key: 'connection.authentication',
|
||||
pkg: 'client-connection',
|
||||
title: 'Connection authentication provider registry',
|
||||
mode: 'seam',
|
||||
implementations: ['host-authentication-token', 'host-authentication-desktop'],
|
||||
consumers: ['client-connection'],
|
||||
note: 'Tries scope-owned credential verifiers in registration order and returns the first live Peer; transport source policy and business authorization stay with their consumers.',
|
||||
},
|
||||
{
|
||||
key: 'forge',
|
||||
pkg: 'experimental-forge',
|
||||
title: 'Code host change requests',
|
||||
mode: 'seam',
|
||||
implementations: ['experimental-forge-github'],
|
||||
implementations: ['experimental-forge-github', 'forge-gitlab'],
|
||||
consumers: ['experimental-forge-session', 'experimental-client-ui-forge'],
|
||||
note: 'Providers map remote and change request URLs, look up change requests by head branch, and read status in batches; watchers of one change request share one polling loop.',
|
||||
},
|
||||
@@ -275,6 +298,11 @@ const SERVICE_ROLES: ServiceRole[] = [
|
||||
mode: 'core', consumers: ['cua'],
|
||||
note: 'The native provider owns application consent and cancellation; the optional Client page queries and changes those decisions through its Remote.',
|
||||
},
|
||||
{
|
||||
key: 'cuaPrograms', pkg: 'cua', title: 'Computer Use program environments',
|
||||
mode: 'core', consumers: ['cua-mcp'],
|
||||
note: 'The provider owns the retained cua_run_code runtime; a host without a model releases one Agent\'s environment and reads the configured screenshot request target through it.',
|
||||
},
|
||||
{
|
||||
key: 'officeKit', pkg: 'office-kit', title: 'Office rendering, conversion, and recalculation',
|
||||
mode: 'core', consumers: ['client-ui-sidebar-documentpreview', 'tool-office'],
|
||||
@@ -303,8 +331,8 @@ const SERVICE_ROLES: ServiceRole[] = [
|
||||
title: 'LLM adapter registry',
|
||||
mode: 'seam',
|
||||
implementations: ['llm-deepseek', 'llm-pi-ai', 'llm-replay'],
|
||||
consumers: ['agent-loop', 'compaction-basic'],
|
||||
note: 'Adapters register provider implementations; the loop and compaction call the provider-neutral stream service.',
|
||||
consumers: ['agent-loop', 'compaction-basic', 'web-deepseek-api', 'web-search-deepseek'],
|
||||
note: 'Adapters register provider implementations; the loop and compaction call the provider-neutral stream service, and the DeepSeek web providers read the credential a route publishes.',
|
||||
},
|
||||
{
|
||||
key: 'sessionLogDeepSeek',
|
||||
@@ -354,6 +382,14 @@ const SERVICE_ROLES: ServiceRole[] = [
|
||||
mode: 'core',
|
||||
note: 'Validates bounded browser audio before provider dispatch.',
|
||||
},
|
||||
{
|
||||
key: 'sessionStatus',
|
||||
pkg: 'client-ui-session-status',
|
||||
title: 'Host Session reading records',
|
||||
mode: 'core',
|
||||
consumers: ['client-ui-session-status'],
|
||||
note: 'Stores owner reading acknowledgements and manual unread marks outside Session history; its Client half follows committed changes over Remote, acknowledges loaded completions, and serves the Session status table.',
|
||||
},
|
||||
{
|
||||
key: 'sessionController',
|
||||
pkg: 'api-session-controller',
|
||||
@@ -493,7 +529,7 @@ const SERVICE_ROLES: ServiceRole[] = [
|
||||
title: 'Credential seam',
|
||||
mode: 'seam',
|
||||
implementations: ['credentials-local'],
|
||||
consumers: ['api-settings-controller', 'llm-deepseek', 'llm-pi-ai'],
|
||||
consumers: ['api-settings-controller', 'llm-deepseek-api-key', 'llm-pi-ai', 'web-deepseek-api', 'web-search-deepseek'],
|
||||
note: 'Configuration carries references to secrets; providers own the values. Consumers resolve per operation, so a rotated credential reaches the very next request; the settings controller exposes value-free views and write-only storage.',
|
||||
},
|
||||
{
|
||||
@@ -502,8 +538,8 @@ const SERVICE_ROLES: ServiceRole[] = [
|
||||
title: 'DeepSeek account',
|
||||
mode: 'service',
|
||||
implementations: [],
|
||||
consumers: ['llm-deepseek'],
|
||||
note: 'The Host owns browser authorization and local credentials; UI consumers receive state without tokens.',
|
||||
consumers: ['llm-deepseek-account', 'web-deepseek-api'],
|
||||
note: 'The Host owns browser authorization and local credentials and releases per-request credentials to the account model route and the web providers; UI consumers receive state without tokens.',
|
||||
},
|
||||
{
|
||||
key: 'authorization',
|
||||
@@ -688,6 +724,13 @@ const SERVICE_ROLES: ServiceRole[] = [
|
||||
consumers: ['tool-skill'],
|
||||
note: 'Merges provider skill catalogs; tool-skill renders the session-prefix catalog and loads complete skill bodies.',
|
||||
},
|
||||
{
|
||||
key: 'upstreamSkills',
|
||||
pkg: 'upstream-skills',
|
||||
title: 'Upstream skills of CLI app plugins',
|
||||
mode: 'service',
|
||||
note: 'Holds what each CLI app plugin registers: downloads the pinned upstream files its entry skill indexes from the vendor\'s GitHub repository, verifies and caches them, and lists the entry skill through `ctx.skills` once they are in place.',
|
||||
},
|
||||
{
|
||||
key: 'agents',
|
||||
pkg: 'agent',
|
||||
@@ -1172,7 +1215,7 @@ type CallSiteIndex = Map<ts.SignatureDeclaration | ts.JSDocSignature, ts.CallExp
|
||||
* must appear here — the prefilter drops non-members before any branch runs,
|
||||
* so a branch for an unlisted name is silently dead.
|
||||
*/
|
||||
const EVENT_API_METHODS = new Set(['on', 'once', 'emit', 'parallel', 'serial', 'waterfall', 'dispatch'])
|
||||
const EVENT_API_METHODS = new Set(['on', 'once', 'emit', 'parallel', 'serial', 'bail', 'waterfall', 'dispatch'])
|
||||
|
||||
/**
|
||||
* Collect event dispatch/listener relations from real cross-file receiver types.
|
||||
@@ -1330,7 +1373,7 @@ export class EventRelationCollector {
|
||||
const eventNames = this.eventNamesFromCall(node, receiverKind)
|
||||
if (method === 'on' || method === 'once') {
|
||||
for (const event of eventNames) this.ensure(event).listeners.add(source.pkg)
|
||||
} else if (method === 'emit' || method === 'parallel' || method === 'serial' || method === 'waterfall') {
|
||||
} else if (method === 'emit' || method === 'parallel' || method === 'serial' || method === 'bail' || method === 'waterfall') {
|
||||
for (const event of eventNames) this.addDispatcher(event, source.pkg, method)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ export function render(entries: readonly CatalogEntry[]): string {
|
||||
'',
|
||||
'This file is GENERATED from workspace manifests (`scripts/gen-plugin-packages.ts`) and verified fresh by `pnpm run verify-plugin-packages` (part of `doc-sync`); do not edit it by hand.',
|
||||
'',
|
||||
'Every package below exports a Cordis plugin that a bundle patch can name in a Loader row. `Config` marks packages whose row accepts a `config` mapping; read the mounted schema from `Config.listConfigs` through `cordis_inspect_query` (filter by `name`, then query the `entry` id) when available, otherwise from the package README. Packages under `experimental` are pre-stable.',
|
||||
'Every package below exports a Cordis plugin that a bundle patch can name in a Loader row. `Config` marks packages whose row accepts a `config` mapping; read the mounted schema from `Config.listConfigs` through `cordis_inspect` (filter by `name`, then query the `entry` id) when available, otherwise from the package README. Packages under `experimental` are pre-stable.',
|
||||
'',
|
||||
]
|
||||
let group = ''
|
||||
|
||||
@@ -245,7 +245,7 @@ function main(): void {
|
||||
const target = resolve(root, OUT)
|
||||
if (process.argv.includes('--check')) {
|
||||
let current = ''
|
||||
try { current = readFileSync(target, 'utf8') } catch { /* missing is stale */ }
|
||||
try { current = readFileSync(target, 'utf8') } catch (_catalogUnreadable) { /* A missing or unreadable catalog compares unequal and reports stale. */ }
|
||||
if (current !== output) {
|
||||
console.error(`gen-session-format-catalog: ${OUT} is stale; run pnpm run gen-session-format-catalog`)
|
||||
process.exitCode = 1
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import { globSync, readFileSync, writeFileSync } from 'node:fs'
|
||||
import { basename, dirname, resolve } from 'node:path'
|
||||
import { Context } from '@deepseek-ai/cordis'
|
||||
import { Context, Service } from '@deepseek-ai/cordis'
|
||||
import LlmRuntime from '@deepseek-ai/dsh-llm'
|
||||
import type { ToolSchema } from '@deepseek-ai/dsh-llm'
|
||||
import AgentRegistry from '@deepseek-ai/dsh-agent'
|
||||
@@ -71,6 +71,8 @@ import Lsp from '@deepseek-ai/dsh-lsp'
|
||||
import * as ToolLsp from '@deepseek-ai/dsh-tool-lsp'
|
||||
import * as ToolSkill from '@deepseek-ai/dsh-tool-skill'
|
||||
import * as ToolSessionQuery from '@deepseek-ai/dsh-tool-session-query'
|
||||
import * as ToolSessionList from '@deepseek-ai/dsh-tool-session-list'
|
||||
import WorkspaceRegistry from '@deepseek-ai/dsh-workspace'
|
||||
import * as ToolJobs from '@deepseek-ai/dsh-tool-jobs'
|
||||
import BrowserUseRegistry from '@deepseek-ai/dsh-browser-use'
|
||||
import * as StagehandBrowserTools from '@deepseek-ai/dsh-experimental-browser-use-stagehand-native'
|
||||
@@ -137,6 +139,13 @@ class CatalogSessionPersistence extends SessionPersistence {
|
||||
list = unavailableCatalogPersistence
|
||||
}
|
||||
|
||||
/** Schema collection does not read Workspace records or open their durable domain. */
|
||||
class CatalogWorkspaceRegistry extends WorkspaceRegistry {
|
||||
static override inject = []
|
||||
|
||||
protected override async [Service.init](): Promise<void> {}
|
||||
}
|
||||
|
||||
/** Storage operations are unreachable during schema collection. */
|
||||
function unavailableCatalogPersistence(): never {
|
||||
throw new Error('gen-tool-catalog: persistence access is unavailable during schema harvest')
|
||||
@@ -300,7 +309,7 @@ const TOOL_PACKAGES: ToolPackage[] = [
|
||||
await ctx.plugin(NodePtcRuntime)
|
||||
},
|
||||
note:
|
||||
'The PTC executor exposes only run_code to the model and declares other visible capabilities in a generated SDK in the runtime’s language. Program bindings enter the shared guarded tool pipeline in submission order; concurrency-safe bodies overlap up to maxParallelSubCalls, and nested results remain linked to the outer program. The resolved timeout and maxSubCallsPerMinute set the total call allowance; exceeding it terminates the program.',
|
||||
'The PTC executor exposes only run_code to the model and declares other visible capabilities in a generated TypeScript SDK. Program bindings enter the shared guarded tool pipeline in submission order; concurrency-safe bodies overlap up to maxParallelSubCalls, and nested results remain linked to the outer program. The resolved timeout and maxSubCallsPerMinute set the total call allowance; exceeding it terminates the program.',
|
||||
},
|
||||
{
|
||||
pkg: '@deepseek-ai/dsh-plan-mode',
|
||||
@@ -390,7 +399,7 @@ const TOOL_PACKAGES: ToolPackage[] = [
|
||||
await ctx.plugin(ToolCordis)
|
||||
},
|
||||
note:
|
||||
'Creator mode provides two read-only runtime inspection tools. The Cordis host runner supplies the inspection registry; Client queries require a connected page. Author persistent changes as bundles and install them with plugin_manager.',
|
||||
'Standard and Creator modes provide one read-only runtime inspection tool. Omit query for the provider directory; pass query to inspect a declared method. The Cordis host runner supplies the inspection registry; Client queries require a connected page. Author persistent changes as bundles and install them with plugin_manager.',
|
||||
},
|
||||
{
|
||||
pkg: '@deepseek-ai/dsh-tool-bash-persistent',
|
||||
@@ -571,6 +580,20 @@ const TOOL_PACKAGES: ToolPackage[] = [
|
||||
await ctx.plugin(ToolSkill)
|
||||
},
|
||||
},
|
||||
{
|
||||
pkg: '@deepseek-ai/dsh-tool-session-list',
|
||||
dir: 'tool-session-list',
|
||||
source: 'packages/session-query/tool-session-list/src/index.ts',
|
||||
requires: ['ctx.tools', 'ctx.sessions', 'ctx.sessionQuery', 'ctx.workspaceRegistry', 'ctx.sessionProjections'],
|
||||
writes: ['tool/call', 'tool/result'],
|
||||
async mount(ctx) {
|
||||
await ctx.plugin(SessionStore)
|
||||
await ctx.plugin(SqliteSessionQueryEngine, { path: ':memory:' })
|
||||
await ctx.plugin(CatalogWorkspaceRegistry)
|
||||
await ctx.plugin(ToolSessionList)
|
||||
},
|
||||
note: 'Opt-in access to all Workspace and Session list metadata in the mounted runtime. Cold titles and activity use the optional projection cache; absent values become null titles and creation-time recency. No Agent is activated.',
|
||||
},
|
||||
{
|
||||
pkg: '@deepseek-ai/dsh-tool-session-query',
|
||||
dir: 'tool-session-query',
|
||||
@@ -683,7 +706,7 @@ const TOOL_PACKAGES: ToolPackage[] = [
|
||||
},
|
||||
scope: ctx => catalogChildScopes.get(ctx) as Agent,
|
||||
note:
|
||||
'Four task-board tools share the subagent tree’s root Session. Enabling Team mode on the root Session adds task-board guidance alongside standard subagent delegation and control tools. Standard subagent controls provide required identity independently of Team mode.',
|
||||
'Four task-board tools share the subagent tree’s root Session. Enabling Team mode on the root Session adds task-board guidance alongside standard subagent delegation and control tools. Standard subagent controls provide required identity independently of Team mode; their result report instruction appears only while Team mode is off.',
|
||||
},
|
||||
{
|
||||
pkg: '@deepseek-ai/dsh-tool-todo',
|
||||
|
||||
@@ -50,9 +50,9 @@ describe.each(['arm64', 'x64'])('macOS %s packaging', (arch) => {
|
||||
expect(archive['runs-on']).toEqual(['self-hosted', '${{ needs.package.outputs.runner }}'])
|
||||
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('${{ steps.archive.outputs.path }}')
|
||||
expect(installer.with).toMatchObject({ archive: false, overwrite: true, name: '${{ env.DESKTOP_ARCHIVE_NAME }}' })
|
||||
expect(installer.if).toBe("${{ !cancelled() && steps.archive.outcome == 'success' }}")
|
||||
expect(installer.with?.path).toBe('${{ steps.archive.outputs.dmg-path }}')
|
||||
expect(installer.with).toMatchObject({ archive: false, overwrite: true, name: '${{ steps.archive.outputs.dmg-name }}' })
|
||||
})
|
||||
|
||||
it('defaults to notarization and labels the explicit debugging option', () => {
|
||||
@@ -97,7 +97,16 @@ describe.each(['arm64', 'x64'])('macOS %s packaging', (arch) => {
|
||||
|
||||
it('passes the same target to preparation, packaging and retention', () => {
|
||||
const archive = workflow.jobs['upload-artifact']!
|
||||
expectDesktopArchive(archive, 1)
|
||||
const uploads = expectDesktopArchive(archive, 3)
|
||||
expect(archive.steps.find(step => step.id === 'archive')?.run).toContain('archive-desktop-ci.ts --split-macos')
|
||||
for (const [index, kind] of ['dmg', 'update', 'metadata'].entries()) {
|
||||
expect(uploads[index]?.with).toMatchObject({
|
||||
name: '${{ steps.archive.outputs.' + kind + '-name }}',
|
||||
path: '${{ steps.archive.outputs.' + (kind + '-path') + ' }}',
|
||||
archive: false, overwrite: true, 'if-no-files-found': 'error', 'retention-days': 14,
|
||||
})
|
||||
expect(uploads[index]?.if).toBe("${{ !cancelled() && steps.archive.outcome == 'success' }}")
|
||||
}
|
||||
const job = workflow.jobs.package!
|
||||
expect(job.env.DSH_DESKTOP_TARGET_PLATFORM).toBe('darwin')
|
||||
expect(job.env.DSH_DESKTOP_TARGET_ARCH).toBe(arch)
|
||||
|
||||
@@ -340,9 +340,6 @@
|
||||
"packages/bundle/headless/tests/startup.spec.ts": {
|
||||
"2e78263d16d54ccfd8d322bcdf1bf738bd8134e15c24063ece9a1d1b52f4ebd9": 1
|
||||
},
|
||||
"packages/bundle/web-app/tests/browser-open.spec.ts": {
|
||||
"2e78263d16d54ccfd8d322bcdf1bf738bd8134e15c24063ece9a1d1b52f4ebd9": 1
|
||||
},
|
||||
"packages/bundle/web-app/tests/document-conversion.e2e.ts": {
|
||||
"95057a87f4a7358284982d7c73febfe26aed9f37a4ceb5b8df724f2b6bc1084c": 1
|
||||
},
|
||||
@@ -358,9 +355,6 @@
|
||||
"e19d423d382674b8b4611741351c82f91680ea99c1b5423045df49d8be15855c": 1,
|
||||
"fdc5fcade0ba1abbc426ccccb07a1ad4998253799b8561815047d95178441cdf": 1
|
||||
},
|
||||
"packages/client/connection/tests/browser-auth.host.spec.ts": {
|
||||
"d7dc9c349af8699fefcaffed26377443dd73ef95f1dc985f4de542ec133869f5": 1
|
||||
},
|
||||
"packages/client/connection/tests/browser-credentials.ts": {
|
||||
"df59c4c68576e18a532f9a917fb70176726a28c8600e8909501e42b990e12857": 1
|
||||
},
|
||||
@@ -570,15 +564,6 @@
|
||||
"packages/client/ui-settings-models/tests/store.client.spec.ts": {
|
||||
"6b8b0a920c558092d20bc17623b7050e0f7403f896fde7da17bb45677899b910": 1
|
||||
},
|
||||
"packages/client/ui-settings-plugin-inventory/tests/browser-plugin.client.spec.tsx": {
|
||||
"04984a2ce1486250236e638e0197da0a1a840855ed3975c59130a85358c7e5fe": 1,
|
||||
"85f4d0d762126e709ae2178ca656f586dac1ba425eb1d8dd402cb5577d6e8225": 1
|
||||
},
|
||||
"packages/client/ui-settings-plugin-inventory/tests/components.client.spec.tsx": {
|
||||
"0d78ec7c8ca39f70a4033ff4d330f8ef26832bb89932f98d1c87d76b4ce16d00": 1,
|
||||
"79c53da50aa08004e201cebca842267ae2650a543b435a7906960f6492c2398b": 1,
|
||||
"a3c1509d552d0102e118f3071a234002a5c83c30ca6923f8a87e9e3733ce0dcf": 1
|
||||
},
|
||||
"packages/client/ui-settings/tests/schema.client.spec.ts": {
|
||||
"0584be4cde4cd33049ef7c02e9d1562a30ec48ef2176f2f22b328b5be2903407": 1
|
||||
},
|
||||
@@ -882,17 +867,6 @@
|
||||
"packages/core/tool-executor-ptc/tests/ptc.spec.ts": {
|
||||
"52faf4558fcd91bd27dbdfa7e497843e8eeb75ea5f68ee231335018d5b3f2053": 1
|
||||
},
|
||||
"packages/core/tool-executor-ptc/tests/py-types.spec.ts": {
|
||||
"0d733b2c7c458f6a7c4d287ed741c321842339cbe5908a8720660883423474c0": 9,
|
||||
"23ebbf16be06365be256c1ceb77869576a026644f3514e1737030c4556849f4a": 1,
|
||||
"3ec1a0855f2cf4a5b3646725ea95c07addd33d5957ba6af530b944cd26f1ea8f": 1,
|
||||
"43155833aa226b066cf374829e013176403ddbd6acd313ccf90f6cfb92ceec06": 1,
|
||||
"5d1224b16a64bb138a708eb3e3e130df2ddf1f8f656617e3f1b3f2583250cf63": 1,
|
||||
"6aecd519658d0d2fb040f0289d6db823e3f6bbb26fcb2b118dc7f7f2c1d3eb06": 1,
|
||||
"9b2b04bd2ecde0c56b00ae050b721d56b3c29a1c834b982c9c2f6e62dbcd0a04": 1,
|
||||
"d334b0b55263b6cb2125317ce96b766155b11455d40d600590f5302f5e0543cc": 1,
|
||||
"d6650a0b52b5f7311afff190373b4a1cbd31ba44f9fa0dff09395f6f2901e32d": 1
|
||||
},
|
||||
"packages/core/tool-executor-ptc/tests/ts-types.spec.ts": {
|
||||
"054c87ca977d98749baf70bb5dcad1bb8d9e725d08a480b7804a181434633873": 1,
|
||||
"0d733b2c7c458f6a7c4d287ed741c321842339cbe5908a8720660883423474c0": 1,
|
||||
|
||||
@@ -10,6 +10,7 @@ import { loadOverlayPatches } from '../packages/boot/app-boot/src/index.ts'
|
||||
import { readPluginMeta } from '../packages/boot/app-boot/src/package-meta.ts'
|
||||
import { bundlePatchPaths, composeEntries, initProfile, readProfileManifest } from '../packages/boot/app-boot/src/profile.ts'
|
||||
import { OPTIONAL_BUNDLES, PROFILE_TEMPLATES } from '../packages/util/official-bundles/src/bundles.ts'
|
||||
import { HIDDEN_BUNDLES } from '../packages/util/official-bundles/src/plugin-manager.ts'
|
||||
import type { DshBundleManifest } from '../packages/util/package-manifest/src/types.ts'
|
||||
import { createPluginProfile } from '../apps/desktop/src/project-manager.ts'
|
||||
|
||||
@@ -31,6 +32,9 @@ function bundle(name: string): { dir: string; patches: ReturnType<typeof loadOve
|
||||
return { dir: entry.dir, patches: bundlePatchPaths(entry.dir, entry.manifest.dsh.bundle).flatMap(path => loadOverlayPatches('test', path)) }
|
||||
}
|
||||
|
||||
/** Optional bundles that compose a profile of their own; the plugin page hides them, the Host inventory still reports them. */
|
||||
const STANDALONE_PROFILE_BUNDLES: readonly string[] = ['@deepseek-ai/dsh-cua-mcp']
|
||||
|
||||
const lightweight = [
|
||||
'@deepseek-ai/dsh-experimental-session-search',
|
||||
'@deepseek-ai/dsh-experimental-ralph-bundle',
|
||||
@@ -105,7 +109,31 @@ describe('optional bundles', () => {
|
||||
expect(OPTIONAL_BUNDLES).not.toContain('@deepseek-ai/dsh-experimental-inspector')
|
||||
})
|
||||
|
||||
it.each(OPTIONAL_BUNDLES)('%s composes over the Web profile without a skipped patch', (name) => {
|
||||
it.each(['web', 'desktop'] as const)('requires explicit selection of Timeline on %s', (surface) => {
|
||||
const name = '@deepseek-ai/dsh-timeline'
|
||||
const layers = profileLayers(surface)
|
||||
expect(OPTIONAL_BUNDLES).toContain(name)
|
||||
expect(flattenRows(composeEntries(layers)).some(row => row.name === name)).toBe(false)
|
||||
expect(flattenRows(composeEntries([...layers, bundle(name).patches])))
|
||||
.toContainEqual(expect.objectContaining({ id: 'timeline-experimental', name }))
|
||||
})
|
||||
|
||||
// A bundle that composes a profile of its own is never layered over a GUI profile; HIDDEN_BUNDLES keeps it off the plugin page.
|
||||
const standalone = OPTIONAL_BUNDLES.filter(name => STANDALONE_PROFILE_BUNDLES.includes(name))
|
||||
const layered = OPTIONAL_BUNDLES.filter(name => !standalone.includes(name))
|
||||
|
||||
it.each(standalone)('%s composes its own profile alone over the empty root and stays off the plugin page', (name) => {
|
||||
const { patches } = bundle(name)
|
||||
const warnings: string[] = []
|
||||
const composed = composeEntries([patches], message => warnings.push(message))
|
||||
expect(warnings).toEqual([])
|
||||
const topLevelIds = composed.flatMap(entry => typeof entry.id === 'string' ? [entry.id] : [])
|
||||
expect(topLevelIds.length).toBeGreaterThan(0)
|
||||
expect(topLevelIds).toHaveLength(new Set(topLevelIds).size)
|
||||
expect(HIDDEN_BUNDLES).toContain(name)
|
||||
})
|
||||
|
||||
it.each(layered)('%s composes over the Web profile without a skipped patch', (name) => {
|
||||
const { patches } = bundle(name)
|
||||
const warnings: string[] = []
|
||||
const composed = composeEntries([...shipped, patches], message => warnings.push(message))
|
||||
@@ -152,6 +180,7 @@ describe('optional bundles', () => {
|
||||
for (const moduleName of [
|
||||
'@deepseek-ai/dsh-experimental-forge',
|
||||
'@deepseek-ai/dsh-experimental-forge-github',
|
||||
'@deepseek-ai/dsh-forge-gitlab',
|
||||
'@deepseek-ai/dsh-experimental-forge-session',
|
||||
'@deepseek-ai/dsh-experimental-client-ui-forge',
|
||||
'@deepseek-ai/dsh-experimental-tool-worktree',
|
||||
|
||||
@@ -41,6 +41,7 @@ const DUPLICATE_SAFE_PACKAGES: readonly string[] = [
|
||||
'@deepseek-ai/dsh-typert-protocol',
|
||||
'@deepseek-ai/dsh-util-code-language',
|
||||
'@deepseek-ai/dsh-util-crypto',
|
||||
'@deepseek-ai/dsh-util-text-search',
|
||||
'@deepseek-ai/dsh-util-values',
|
||||
]
|
||||
|
||||
@@ -52,7 +53,6 @@ const DUPLICATE_SAFE_PACKAGES: readonly string[] = [
|
||||
*/
|
||||
const SAFE_HOST_DEPENDENCY_EXPORTS = {
|
||||
'@deepseek-ai/dsh-atomic-write': ['withFileLock', 'writeFileAtomic'],
|
||||
'@deepseek-ai/dsh-credentials': ['credentialKey'],
|
||||
'@deepseek-ai/dsh-deque': ['Deque'],
|
||||
// Builds a dispatcher from the resolved proxy policy; the caller owns and closes it.
|
||||
'@deepseek-ai/dsh-http-proxy': ['createRouteDispatcher'],
|
||||
@@ -64,7 +64,8 @@ const SAFE_HOST_DEPENDENCY_EXPORTS = {
|
||||
],
|
||||
// The shipped profile templates are plain data; a consumer reads their bundle names only.
|
||||
'@deepseek-ai/dsh-official-bundles': ['PROFILE_TEMPLATES'],
|
||||
'@deepseek-ai/dsh-llm': ['callConfigEquals'],
|
||||
// Messages and assembled blocks are plain data. Each caller owns its assembler.
|
||||
'@deepseek-ai/dsh-llm': ['BlockAssembler', 'callConfigEquals', 'createUserMessage'],
|
||||
'@deepseek-ai/dsh-session-format': ['sessionFormatLogFilename'],
|
||||
'@deepseek-ai/dsh-storage-domain': ['defineDomain'],
|
||||
'@deepseek-ai/dsh-timeout': ['MAX_TIMER_DELAY_MS'],
|
||||
@@ -80,8 +81,9 @@ const PEER_REQUIRED_HOST_EXPORTS = {
|
||||
// CUA mounts the installed provider and shares executor error classes with PTC.
|
||||
'@deepseek-ai/dsh-ptc-runtime-node': ['default'],
|
||||
'@deepseek-ai/dsh-tool-executor-ptc/run-code': ['RunCodeConfig', 'createRunCodeTool'],
|
||||
// CUA checks UserQuestionError and preserves AttachmentError from image admission.
|
||||
'@deepseek-ai/dsh-attachment': ['admitEncodedImages'],
|
||||
// CUA checks UserQuestionError and preserves AttachmentError from image admission; longEdgeDimensions is pure
|
||||
// arithmetic that rides the same peer.
|
||||
'@deepseek-ai/dsh-attachment': ['admitEncodedImages', 'longEdgeDimensions'],
|
||||
'@deepseek-ai/dsh-user-questions': ['UserQuestionError'],
|
||||
// The tool registry and every subclass rely on `instanceof` against one HarnessError class.
|
||||
'@deepseek-ai/dsh-error': ['HarnessError'],
|
||||
@@ -92,12 +94,19 @@ const PEER_REQUIRED_HOST_EXPORTS = {
|
||||
'@deepseek-ai/dsh-experimental-worktree': ['generatedWorktreeName', 'CREATED_RECORD', 'createdWorktreeSchema'],
|
||||
// The forge panel matches ctx.fs failures with `instanceof FsError`.
|
||||
'@deepseek-ai/dsh-fs': ['FsError'],
|
||||
'@deepseek-ai/dsh-scope': ['carrierKeyOf', 'createScope', 'scopeOf', 'scopeTarget'],
|
||||
'@deepseek-ai/dsh-scope': ['carrierKeyOf', 'createScope', 'scopeOf', 'scopeParentOf', 'scopeTarget'],
|
||||
// appendPluginRecord writes through the Session class's private log; pluginRecordOf is stateless.
|
||||
'@deepseek-ai/dsh-session': ['SESSION_FORMAT_VERSION', 'appendPluginRecord', 'pluginRecordOf'],
|
||||
// The DeepSeek chat importer validates its seed with the installed Session class before storing it.
|
||||
'@deepseek-ai/dsh-session': ['SESSION_FORMAT_VERSION', 'Session', 'appendPluginRecord', 'pluginRecordOf'],
|
||||
'@deepseek-ai/dsh-session-persistence': ['SessionPersistenceNotFoundError'],
|
||||
// Imported titles follow the installed title service's normalization.
|
||||
'@deepseek-ai/dsh-session-title': ['normalizeSessionTitle'],
|
||||
// Error classes have instance identity; CUA and Liveshare throw the registry's own copy so `instanceof` against it matches.
|
||||
'@deepseek-ai/dsh-tools': ['defineTool', 'ToolArgsError', 'ToolContextUnavailableError'],
|
||||
// Readers recognize a deadline's TimeoutReason only by `instanceof` against their own copy.
|
||||
'@deepseek-ai/dsh-timeout': ['deadline', 'timeoutOf'],
|
||||
// Imported web tool results must render exactly like the installed web tools' results and cards.
|
||||
'@deepseek-ai/dsh-tool-web': ['fetchMetaFromValue', 'formatFetchOutput', 'formatSearchOutput', 'searchMetaFromValue'],
|
||||
} as const satisfies HostDependencyExports
|
||||
|
||||
/** Exact import specifier to reviewed runtime exports. */
|
||||
|
||||
@@ -101,8 +101,6 @@ export const EXISTING_PLUGIN_ENTRY_EXPORTS = {
|
||||
'projectToolUpdates', 'requestImageHandleText', 'requiredImageOffload', 'resolveImageAttachmentAccess',
|
||||
'resolveRetryPolicy', 'runFirstTokenTime', 'runFirstVisibleTime', 'textOnlyImageText', 'userAgent',
|
||||
],
|
||||
'@deepseek-ai/dsh-llm-deepseek-account': ['plainAccountOptions', 'resolveAccountOptions'],
|
||||
'@deepseek-ai/dsh-llm-deepseek-api-key': ['plainOptions', 'resolveAdapterOptions'],
|
||||
'@deepseek-ai/dsh-llm-pi-ai': ['PiAiAdapter', 'supportedProtocols'],
|
||||
'@deepseek-ai/dsh-llm-replay': [
|
||||
'deriveReplayScript', 'installLlmReplay', 'loadReplayScript', 'loadSessionScripts', 'parseSessionHeader',
|
||||
@@ -198,9 +196,7 @@ export const EXISTING_PLUGIN_ENTRY_EXPORTS = {
|
||||
'@deepseek-ai/dsh-terminal-panel': ['GUIDANCE'],
|
||||
'@deepseek-ai/dsh-tool-call-timeout-policy': ['TOOL_TIMEOUT'],
|
||||
'@deepseek-ai/dsh-tool-executor-native': ['NativeToolExecutor'],
|
||||
'@deepseek-ai/dsh-tool-executor-ptc': [
|
||||
'PtcExecutor', 'jsonSchemaToPy', 'jsonSchemaToTs', 'renderToolsSdk', 'renderToolsSdkPy',
|
||||
],
|
||||
'@deepseek-ai/dsh-tool-executor-ptc': ['PtcExecutor', 'jsonSchemaToTs', 'renderToolsSdk'],
|
||||
'@deepseek-ai/dsh-tool-fs-search': [
|
||||
'GLOB_MAX_RESULTS', 'GLOB_VCS_EXCLUDES', 'GREP_MAX_LINE_BYTES', 'GREP_MAX_MATCHES', 'RAW_OUTPUT_MAX_BYTES',
|
||||
'SEARCH_GRACE_MS', 'SEARCH_META_MAX_BYTES', 'SEARCH_STDERR_MAX_BYTES', 'SEARCH_TIMEOUT_MS', 'applyGlobTool',
|
||||
|
||||
@@ -9,6 +9,13 @@ readonly BUBBLEWRAP_VERSION='0.12.0-1'
|
||||
readonly BUBBLEWRAP_SHA256='db4d572a7927bfd34cc9b8e24b56983efa8e0483d03da6c810f6caae081dcc36'
|
||||
# The recorded build remains addressable after Ubuntu prunes its live package pool.
|
||||
readonly BUBBLEWRAP_URL="https://launchpad.net/ubuntu/+source/bubblewrap/${BUBBLEWRAP_VERSION}/+build/33546835/+files/bubblewrap_${BUBBLEWRAP_VERSION}_amd64.deb"
|
||||
# Workflows that run on ephemeral runners restore and save this directory as
|
||||
# `~/.cache/dsh-ci/bubblewrap` with actions/cache, so a warm cache needs no
|
||||
# Launchpad request; the persistent self-hosted pool keeps the directory itself.
|
||||
readonly BUBBLEWRAP_CACHE_DIR="${HOME}/.cache/dsh-ci/bubblewrap"
|
||||
|
||||
# shellcheck source=scripts/ci-verified-download.sh
|
||||
source "$(dirname -- "${BASH_SOURCE[0]}")/ci-verified-download.sh"
|
||||
|
||||
: "${RUNNER_TEMP:?prepare-ci-bubblewrap requires RUNNER_TEMP}"
|
||||
: "${GITHUB_PATH:?prepare-ci-bubblewrap requires GITHUB_PATH}"
|
||||
@@ -18,11 +25,10 @@ if [[ "$(uname -s)" != 'Linux' || "$(uname -m)" != 'x86_64' ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
archive="${RUNNER_TEMP}/bubblewrap_${BUBBLEWRAP_VERSION}_amd64.deb"
|
||||
archive="${BUBBLEWRAP_CACHE_DIR}/bubblewrap_${BUBBLEWRAP_VERSION}_amd64.deb"
|
||||
root="${RUNNER_TEMP}/dsh-bubblewrap"
|
||||
|
||||
curl --fail --silent --show-error --location --retry 3 --retry-all-errors --output "$archive" "$BUBBLEWRAP_URL"
|
||||
printf '%s %s\n' "$BUBBLEWRAP_SHA256" "$archive" | sha256sum --check --status
|
||||
acquire_verified_archive "$BUBBLEWRAP_URL" "$BUBBLEWRAP_SHA256" "$archive"
|
||||
mkdir -p "$root"
|
||||
dpkg-deb --extract "$archive" "$root"
|
||||
printf '%s\n' "$root/usr/bin" >> "$GITHUB_PATH"
|
||||
|
||||
@@ -16,7 +16,11 @@ export interface ProductPackagePolicy {
|
||||
* Optional integrations may be reached by an optional bundle without becoming default capabilities.
|
||||
*/
|
||||
export const PRODUCT_PACKAGE_POLICY: Readonly<Record<string, ProductPackagePolicy>> = {
|
||||
'packages/session-query/tool-session-list': { category: 'optional', reason: 'Explicitly grants model callers read access to runtime Workspace and Session metadata.' },
|
||||
'packages/host/authentication-desktop': { category: 'optional', reason: 'Mounted by the private Desktop Host with its parent-process credential, outside default Web profiles.' },
|
||||
'packages/core/agent-tool-presentation': { category: 'optional', reason: 'Deprecated selector retained for existing executor configurations.' },
|
||||
'packages/client/script-realm': { category: 'optional', reason: 'Script environment provider registry for explicitly selected Client integrations.' },
|
||||
'packages/client/script-realm-iframe': { category: 'optional', reason: 'Iframe execution provider registered only by an explicitly selected Client plugin.' },
|
||||
'packages/browser-use/browser-use': { category: 'optional', reason: 'Service definition used by explicitly selected browser providers.' },
|
||||
'packages/computer-use/computer-use': { category: 'optional', reason: 'Service definition used by explicitly selected computer providers.' },
|
||||
'packages/lsp/lsp': { category: 'optional', reason: 'Service definition for deployment-configured language servers.' },
|
||||
@@ -33,8 +37,6 @@ export const PRODUCT_PACKAGE_POLICY: Readonly<Record<string, ProductPackagePolic
|
||||
'packages/subagent/subagent-codex': { category: 'optional', reason: 'Separately installed native Codex agent integration.' },
|
||||
'packages/subagent/subagent-dsh-sdk': { category: 'optional', reason: 'Requires an explicitly configured external DSH home.' },
|
||||
'packages/connector/wecom': { category: 'optional', reason: 'Separately installed app plugin that requires wecom-cli and a user-authorized WeCom bot.' },
|
||||
'packages/connector/cli-account': { category: 'optional', reason: 'Host library imported by separately installed CLI app plugins.' },
|
||||
'packages/connector/upstream-skills': { category: 'optional', reason: 'Host library imported by separately installed CLI app plugins.' },
|
||||
'packages/context/tmux-context': { category: 'optional', reason: 'Context contribution requiring a tmux pane.' },
|
||||
'packages/fs/tool-str-replace-editor': { category: 'optional', reason: 'Explicit alternative to the default filesystem editing tools.' },
|
||||
'packages/fs/fs-observation-policy': { category: 'optional', reason: 'Read-before-mutation guard that a deployment enables on the disabled dsh-base row.' },
|
||||
|
||||
@@ -72,10 +72,13 @@ describe('release families', () => {
|
||||
'@deepseek-ai/dsh-creation-recommendations',
|
||||
'@deepseek-ai/dsh-cua-bundle',
|
||||
'@deepseek-ai/dsh-cua-macos',
|
||||
'@deepseek-ai/dsh-cua-mcp',
|
||||
'@deepseek-ai/dsh-cua-windows',
|
||||
'@deepseek-ai/dsh-cua',
|
||||
'@deepseek-ai/dsh-deepseek-chat-import',
|
||||
'@deepseek-ai/dsh-experimental-forge-bundle',
|
||||
'@deepseek-ai/dsh-experimental-forge-github',
|
||||
'@deepseek-ai/dsh-forge-gitlab',
|
||||
'@deepseek-ai/dsh-experimental-forge-session',
|
||||
'@deepseek-ai/dsh-experimental-forge',
|
||||
'@deepseek-ai/dsh-hook-protocol',
|
||||
@@ -99,6 +102,7 @@ describe('release families', () => {
|
||||
'@deepseek-ai/dsh-experimental-subagent-oar',
|
||||
'@deepseek-ai/dsh-experimental-terminal-bundle',
|
||||
'@deepseek-ai/dsh-terminal-panel',
|
||||
'@deepseek-ai/dsh-timeline',
|
||||
'@deepseek-ai/dsh-tool-ralph',
|
||||
'@deepseek-ai/dsh-tool-session-query',
|
||||
'@deepseek-ai/dsh-experimental-tool-subagent-oar',
|
||||
|
||||
@@ -87,6 +87,7 @@ describe('product identifiers', () => {
|
||||
it.each([
|
||||
'apps/cli/tests/optional-bundle-transitions.e2e.ts',
|
||||
'apps/web/tests/agent-preset-selection.e2e.ts',
|
||||
'apps/web/tests/creator-persona.e2e.ts',
|
||||
'apps/web/tests/developer-tools-settings.e2e.ts',
|
||||
'docs/subsystems/extensions.md',
|
||||
'docs/subsystems/extensions.zh.md',
|
||||
@@ -98,6 +99,8 @@ describe('product identifiers', () => {
|
||||
'docs/upgrade-guide/v0.2.1-alpha.1/subagent-preset-composition/guide.zh.md',
|
||||
'docs/upgrade-guide/v0.2.2-alpha.2/fs-observation-policy-default-off/guide.md',
|
||||
'docs/upgrade-guide/v0.2.2-alpha.2/fs-observation-policy-default-off/guide.zh.md',
|
||||
'docs/upgrade-guide/v0.2.2-rc.1/subagent-interrupt-default/guide.md',
|
||||
'docs/upgrade-guide/v0.2.2-rc.1/subagent-interrupt-default/guide.zh.md',
|
||||
'docs/user/guide/schedule.md',
|
||||
'docs/user/guide/schedule.zh.md',
|
||||
'packages/bundle/web-app/cordis.patch.yml',
|
||||
@@ -132,6 +135,17 @@ describe('product identifiers', () => {
|
||||
expect(rescopeText(scoped, file, true)).toEqual({ text, lines: 2 })
|
||||
})
|
||||
|
||||
it.each([
|
||||
'apps/web/tests/creator-persona.e2e.ts',
|
||||
'docs/upgrade-guide/v0.2.2-rc.1/subagent-interrupt-default/guide.md',
|
||||
'docs/upgrade-guide/v0.2.2-rc.1/subagent-interrupt-default/guide.zh.md',
|
||||
])('still rewrites package imports in %s', (file) => {
|
||||
const source = "const preset = 'cordis'\nimport { Context } from 'cordis'\n"
|
||||
const text = file.endsWith('.md') ? `The \`cordis\` preset.\n\`\`\`ts\n${source}\`\`\`\n` : source
|
||||
const scoped = text.replace("from 'cordis'", "from '@deepseek-ai/cordis'")
|
||||
expectRoundTrip(file, text, scoped, 1)
|
||||
})
|
||||
|
||||
it('keeps unlisted package references subject to residue detection', () => {
|
||||
const file = 'packages/example/src/index.ts'
|
||||
const text = "import { Context } from 'cordis'\nimport type Schema from 'schemastery'\n"
|
||||
|
||||
@@ -101,7 +101,9 @@ const GENERIC_SKIPS: readonly GenericSkip[] = [
|
||||
{ file: 'apps/cli/tests/web-agent-presets.e2e.ts', upstream: ['cordis'] },
|
||||
{ file: 'apps/cli/tests/profiles/web/tests/fixtures/creator-plugin-manager.mjs', upstream: ['cordis'] },
|
||||
{ file: 'apps/web/tests/agent-preset-authoring.e2e.ts', upstream: ['cordis'] },
|
||||
{ file: 'apps/web/tests/creator-persona.e2e.ts', upstream: ['cordis'] },
|
||||
{ file: 'packages/preset/agent-preset-registry/tests/session.spec.ts', upstream: ['cordis'] },
|
||||
{ file: 'packages/experimental/cua/tests/agent-scopes.spec.ts', upstream: ['cordis'] },
|
||||
{ file: 'packages/experimental/creation-recommendations/src/index.ts', upstream: ['cordis'] },
|
||||
{ file: 'packages/experimental/creation-recommendations/tests/creation.spec.ts', upstream: ['cordis'] },
|
||||
{ file: 'packages/experimental/creation-recommendations/tests/loader-composition.spec.ts', upstream: ['cordis'] },
|
||||
@@ -113,6 +115,8 @@ const GENERIC_SKIPS: readonly GenericSkip[] = [
|
||||
{ file: 'docs/tool-catalog.zh.md', upstream: ['cordis'] },
|
||||
{ file: 'docs/upgrade-guide/v0.2.2-alpha.2/fs-observation-policy-default-off/guide.md', upstream: ['cordis'] },
|
||||
{ file: 'docs/upgrade-guide/v0.2.2-alpha.2/fs-observation-policy-default-off/guide.zh.md', upstream: ['cordis'] },
|
||||
{ file: 'docs/upgrade-guide/v0.2.2-rc.1/subagent-interrupt-default/guide.md', upstream: ['cordis'] },
|
||||
{ file: 'docs/upgrade-guide/v0.2.2-rc.1/subagent-interrupt-default/guide.zh.md', upstream: ['cordis'] },
|
||||
{ file: 'scripts/gen-tool-catalog.ts', upstream: ['cordis'] },
|
||||
{ file: 'docs/upgrade-guide/v0.2.0-rc.2/schedule-bundle-retired/guide.md', upstream: ['cordis'] },
|
||||
{ file: 'docs/upgrade-guide/v0.2.0-rc.2/schedule-bundle-retired/guide.zh.md', upstream: ['cordis'] },
|
||||
@@ -169,7 +173,6 @@ const GENERIC_SKIPS: readonly GenericSkip[] = [
|
||||
{ file: 'packages/experimental/inspector/tests/plugin.client.spec.ts', upstream: ['cordis'] },
|
||||
{ file: 'scripts/gen-cordis-catalog.ts', upstream: ['cordis'] },
|
||||
// The UI locale namespace and input-trigger source id are product keys.
|
||||
{ file: 'packages/client/ui-settings-plugin-inventory/src/client/PluginInventorySettingsTab.tsx', upstream: ['cordis'] },
|
||||
{ file: 'packages/extensions/ui-cordis/src/client/CordisActionRow.tsx', upstream: ['cordis'] },
|
||||
{ file: 'packages/extensions/ui-cordis/src/client/CordisDefineRow.tsx', upstream: ['cordis'] },
|
||||
{ file: 'packages/extensions/ui-cordis/src/client/CordisPanel.tsx', upstream: ['cordis'] },
|
||||
|
||||
@@ -383,7 +383,7 @@ describe('gate graph validation', () => {
|
||||
'rescope-vendor', 'publint', 'constraints', 'default-product-isolation', 'product-use', 'official-bundle-catalog', 'provider-data', 'package-dependencies', 'application-entrypoints',
|
||||
'dsh-package-licenses', 'node-next-types',
|
||||
'optional-dependency-imports', 'client-packages', 'installer-locales', 'locale-metadata', 'client-ui-i18n', 'client-route-resolution', 'no-bare-dispatcher',
|
||||
'plugin-record-callers', 'no-unknown-casts', 'empty-catch', 'no-top-level-await', 'plugin-entry-exports',
|
||||
'plugin-record-callers', 'no-unknown-casts', 'empty-catch', 'cordis-root', 'no-top-level-await', 'plugin-entry-exports',
|
||||
'cordis-config', 'runtime-closure',
|
||||
])
|
||||
})
|
||||
@@ -459,6 +459,16 @@ describe('gate graph validation', () => {
|
||||
},
|
||||
)
|
||||
|
||||
it.each(['ci-primary', 'ci-static', 'check-all', 'hygiene'] as const)(
|
||||
'rejects new Cordis root reads in %s',
|
||||
(mode) => {
|
||||
const gate = withPnpmEntrypoint(() => gatesForMode(mode).find(subject => subject.id === 'cordis-root'))
|
||||
|
||||
expect(gate?.args).toContain('verify-cordis-root')
|
||||
expect(gate?.allowFailure).not.toBe(true)
|
||||
},
|
||||
)
|
||||
|
||||
it.each(['ci-primary', 'ci-static', 'check-all', 'hygiene'] as const)(
|
||||
'keeps package dependency enforcement in %s',
|
||||
(mode) => {
|
||||
|
||||
+29
-21
@@ -357,6 +357,7 @@ export function gatesForMode(selected: Mode): Gate[] {
|
||||
pnpmScript('test', 'test'),
|
||||
pnpmScript('approval-policy', 'test:approval-policy', { label: 'Weighted approval policy' }),
|
||||
pnpmScript('issue-management', 'test:issue-management', { label: 'Issue management policy' }),
|
||||
pnpmScript('stale-pull-requests', 'test:stale-pull-requests', { label: 'Stale pull-request reminders' }),
|
||||
pnpmScript('duplication', 'duplication'),
|
||||
snapshotGate(),
|
||||
expectedOutputGate(),
|
||||
@@ -401,6 +402,7 @@ function ciSharedStaticGates(): Gate[] {
|
||||
...sharedHygieneGates(),
|
||||
pnpmScript('approval-policy', 'test:approval-policy', { label: 'Weighted approval policy' }),
|
||||
pnpmScript('issue-management', 'test:issue-management', { label: 'Issue management policy' }),
|
||||
pnpmScript('stale-pull-requests', 'test:stale-pull-requests', { label: 'Stale pull-request reminders' }),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -425,6 +427,7 @@ function sharedHygieneGates(): Gate[] {
|
||||
pnpmScript('plugin-record-callers', 'verify-plugin-record-callers', { label: 'plugin record callers' }),
|
||||
pnpmScript('no-unknown-casts', 'verify-no-unknown-casts', { label: 'no new unknown casts' }),
|
||||
pnpmScript('empty-catch', 'verify-empty-catch', { label: 'no new silent catches' }),
|
||||
pnpmScript('cordis-root', 'verify-cordis-root', { label: 'no new Cordis root reads' }),
|
||||
pnpmScript('no-top-level-await', 'verify-no-top-level-await', { label: 'no module-scope await' }),
|
||||
pnpmScript('plugin-entry-exports', 'verify-plugin-entry-exports', { label: 'plugin entry exports' }),
|
||||
]
|
||||
@@ -1255,7 +1258,7 @@ export async function runGate(gate: Gate, signal?: AbortSignal): Promise<GateRes
|
||||
for (const descendantPid of descendants) {
|
||||
try {
|
||||
process.kill(descendantPid, signalToSend)
|
||||
} catch {
|
||||
} catch (_descendantExited) {
|
||||
// The descendant exited between the enumeration and the signal.
|
||||
}
|
||||
}
|
||||
@@ -1495,6 +1498,28 @@ function processAlive(pid: number): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the parsed `/proc/<pid>/stat` fields of every process listed in `/proc`.
|
||||
* @returns one row per process still present when its stat file is read.
|
||||
* @throws when `/proc` cannot be listed.
|
||||
*/
|
||||
function procStatRows(): { pid: number; fields: { state: string; ppid: number; pgrp: number } }[] {
|
||||
const rows: { pid: number; fields: { state: string; ppid: number; pgrp: number } }[] = []
|
||||
for (const entry of readdirSync('/proc')) {
|
||||
if (!/^\d+$/.test(entry)) continue
|
||||
let stat: string
|
||||
try {
|
||||
stat = readFileSync(`/proc/${entry}/stat`, 'utf8')
|
||||
} catch (_exitedMidScan) {
|
||||
// The process exited mid-scan; it is neither a live member nor a descendant.
|
||||
continue
|
||||
}
|
||||
const fields = procStatFields(stat)
|
||||
if (fields !== undefined) rows.push({ pid: Number(entry), fields })
|
||||
}
|
||||
return rows
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether any member of the child's POSIX process group is still executing.
|
||||
* Zombie entries (state `Z`) do not count: they are dead records awaiting
|
||||
@@ -1514,16 +1539,7 @@ function groupAlive(pid: number | undefined): boolean {
|
||||
return false
|
||||
}
|
||||
try {
|
||||
for (const entry of readdirSync('/proc')) {
|
||||
if (!/^\d+$/.test(entry)) continue
|
||||
try {
|
||||
const parsed = procStatFields(readFileSync(`/proc/${entry}/stat`, 'utf8'))
|
||||
if (parsed !== undefined && parsed.pgrp === pid && parsed.state !== 'Z') return true
|
||||
} catch {
|
||||
// The process exited mid-scan; it is not a live member.
|
||||
}
|
||||
}
|
||||
return false
|
||||
return procStatRows().some(({ fields }) => fields.pgrp === pid && fields.state !== 'Z')
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
@@ -1551,17 +1567,9 @@ function groupAlive(pid: number | undefined): boolean {
|
||||
function descendantPids(root: number): number[] {
|
||||
if (root <= 0) return []
|
||||
if (process.platform === 'linux') {
|
||||
const rows: Array<[number, number]> = []
|
||||
let rows: Array<[number, number]>
|
||||
try {
|
||||
for (const entry of readdirSync('/proc')) {
|
||||
if (!/^\d+$/.test(entry)) continue
|
||||
try {
|
||||
const parsed = procStatFields(readFileSync(`/proc/${entry}/stat`, 'utf8'))
|
||||
if (parsed !== undefined) rows.push([Number(entry), parsed.ppid])
|
||||
} catch {
|
||||
// The process exited mid-scan; skip it.
|
||||
}
|
||||
}
|
||||
rows = procStatRows().map(({ pid, fields }) => [pid, fields.ppid])
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
|
||||
@@ -316,14 +316,15 @@ function packageNameOf(scanRoot: string, rel: string, cache: Map<string, string>
|
||||
while (dir.length > scanRoot.length) {
|
||||
const cached = cache.get(dir)
|
||||
if (cached !== undefined) return cached
|
||||
let manifest: { name?: unknown } | null | undefined
|
||||
try {
|
||||
const manifest = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8')) as { name?: unknown }
|
||||
if (typeof manifest.name === 'string') {
|
||||
cache.set(dir, manifest.name)
|
||||
return manifest.name
|
||||
}
|
||||
} catch {
|
||||
// No manifest at this level: keep walking up to the owning package root.
|
||||
manifest = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8')) as { name?: unknown } | null
|
||||
} catch (_noManifest) {
|
||||
// No readable manifest at this level: keep walking up to the owning package root.
|
||||
}
|
||||
if (typeof manifest?.name === 'string') {
|
||||
cache.set(dir, manifest.name)
|
||||
return manifest.name
|
||||
}
|
||||
dir = dirname(dir)
|
||||
}
|
||||
|
||||
@@ -938,6 +938,7 @@ def main() -> None:
|
||||
smoke_sdk_scheduler_recovery(model.url, args.exe.resolve(), args.update_snapshots)
|
||||
if args.scenario in {"all", "sdk-restart"}:
|
||||
assert args.exe is not None
|
||||
smoke_sdk_v3_resume(model.url, args.exe.resolve())
|
||||
smoke_sdk_restart_snapshot(model.url, args.exe.resolve(), args.update_snapshots)
|
||||
if args.installed_wheel and args.scenario in {"all", "sdk-profile-plugin"}:
|
||||
smoke_sdk_profile_plugin(model.url)
|
||||
@@ -1888,6 +1889,63 @@ def smoke_sdk_snapshot_mode(
|
||||
)
|
||||
|
||||
|
||||
def smoke_sdk_v3_resume(base_url: str, executable: Path) -> None:
|
||||
"""Migrate persisted V3 history and reopen the published log in a fresh runtime."""
|
||||
from deepseek_harness import DeepSeekHarness
|
||||
|
||||
with tempfile.TemporaryDirectory(prefix="dsh-sdk-v3-resume-") as temporary:
|
||||
root = Path(temporary).resolve()
|
||||
sessions = root / "sessions"
|
||||
session_id = "v3-resume"
|
||||
directory = sessions / "_no-cwd" / session_id
|
||||
directory.mkdir(parents=True)
|
||||
source = directory / "session.v3.jsonl"
|
||||
header = {
|
||||
"type": "session", "version": 3, "id": session_id, "createdAt": 1,
|
||||
"isSeeded": False, "delegationDepth": 0,
|
||||
}
|
||||
message = {
|
||||
"id": "saved-message", "role": "user", "source": {"kind": "user"},
|
||||
"content": [{"type": "text", "text": "Saved V3 history"}],
|
||||
}
|
||||
events = [
|
||||
{"type": "turn/start", "data": {"turn": 1}},
|
||||
{"type": "user/message", "data": message, "surfaceOp": "append"},
|
||||
{"type": "turn/end", "data": {"turn": 1, "reason": {"kind": "completed"}}},
|
||||
]
|
||||
records = [header, *({**event, "seq": seq, "time": seq + 10} for seq, event in enumerate(events))]
|
||||
original = "".join(json.dumps(record) + "\n" for record in records).encode("utf-8")
|
||||
source.write_bytes(original)
|
||||
patch = write_profile_patch(root, "v3-resume.patch.yml", sessions, [])
|
||||
request_count = len(MockModelHandler.requests)
|
||||
|
||||
def connect() -> DeepSeekHarness:
|
||||
return DeepSeekHarness(
|
||||
provider="deepseek-official", model="smoke-model", cwd=str(root),
|
||||
dsh_bin=str(executable), dsh_home=str(root / "home"), patches=(str(patch),),
|
||||
env={"DSH_TELEMETRY_DISABLED": "1"}, api_key="sk-keyless-smoke", base_url=base_url,
|
||||
request_timeout_seconds=60,
|
||||
)
|
||||
|
||||
with connect() as harness:
|
||||
session = harness.resume_session(session_id)
|
||||
assert session.id == session_id, f"migration resumed {session.id!r}"
|
||||
logs = read_session_logs(sessions)
|
||||
assert set(logs) == {session_id}, f"unexpected persisted sessions: {list(logs)}"
|
||||
assert any(row.get("type") == "user/message" and row.get("data") == message for row in logs[session_id]), (
|
||||
"the migrated log lost the saved V3 user message"
|
||||
)
|
||||
(published,) = latest_persisted_session_paths(sessions)
|
||||
migrated = published.read_bytes()
|
||||
|
||||
with connect() as harness:
|
||||
session = harness.resume_session(session_id)
|
||||
assert session.id == session_id, f"restart resumed {session.id!r}"
|
||||
assert published.read_bytes().startswith(migrated), "restart rewrote the published session history"
|
||||
assert source.read_bytes() == original, "resuming changed the original V3 log"
|
||||
assert len(MockModelHandler.requests) == request_count, "resuming sent a model request"
|
||||
|
||||
|
||||
def smoke_sdk_restart_snapshot(base_url: str, executable: Path, update_snapshots: bool) -> None:
|
||||
"""Check isolated sessions and explicit history restoration across runtime restarts."""
|
||||
from deepseek_harness import DeepSeekHarness
|
||||
@@ -1952,7 +2010,7 @@ def smoke_sdk_restart_snapshot(base_url: str, executable: Path, update_snapshots
|
||||
)
|
||||
before_resume = logs[RESTART_FIRST_SESSION_ID]
|
||||
with connect("resumed-smoke-model") as harness:
|
||||
session = harness.resume_session(RESTART_FIRST_SESSION_ID)
|
||||
session = harness.resume_session(RESTART_FIRST_SESSION_ID, {"permission_mode": "read-only"})
|
||||
if session.id != RESTART_FIRST_SESSION_ID:
|
||||
raise AssertionError(f"resume changed the saved identity: {session.id}")
|
||||
if len(MockModelHandler.requests) != first_request + 2:
|
||||
@@ -2000,7 +2058,20 @@ def smoke_sdk_restart_snapshot(base_url: str, executable: Path, update_snapshots
|
||||
raise AssertionError(f"resume did not persist the initialized model: {selection_events}")
|
||||
if requests[0].get("model") != "resumed-smoke-model":
|
||||
raise AssertionError(f"resumed request ignored the initialized model: {requests[0]}")
|
||||
permission_events = [
|
||||
{"type": record["type"], "data": record["data"]}
|
||||
for record in restored[len(before_resume):]
|
||||
if record.get("type") in {"permission/preset", "sandbox/mode", "approval/policy"}
|
||||
]
|
||||
expected_permissions = [
|
||||
{"type": "permission/preset", "data": {"preset": "read-only"}},
|
||||
{"type": "sandbox/mode", "data": {"mode": "read-only"}},
|
||||
{"type": "approval/policy", "data": {"policy": "ask"}},
|
||||
]
|
||||
if permission_events != expected_permissions:
|
||||
raise AssertionError(f"resume did not persist the requested permissions: {permission_events}")
|
||||
files["resume.json"] = json.dumps({
|
||||
"permissionEvents": permission_events,
|
||||
"model": requests[0].get("model"),
|
||||
"final_response": resumed.final_response,
|
||||
"eventTypes": [event.get("type") for event in resumed.events],
|
||||
|
||||
@@ -202,8 +202,7 @@
|
||||
"maxTokens": true
|
||||
},
|
||||
"tools": [
|
||||
"cordis_inspect_list",
|
||||
"cordis_inspect_query",
|
||||
"cordis_inspect",
|
||||
"job_kill",
|
||||
"job_list",
|
||||
"job_output",
|
||||
@@ -298,8 +297,7 @@
|
||||
"maxTokens": true
|
||||
},
|
||||
"tools": [
|
||||
"cordis_inspect_list",
|
||||
"cordis_inspect_query",
|
||||
"cordis_inspect",
|
||||
"job_kill",
|
||||
"job_list",
|
||||
"job_output",
|
||||
@@ -1764,8 +1762,7 @@
|
||||
"maxTokens": true
|
||||
},
|
||||
"tools": [
|
||||
"cordis_inspect_list",
|
||||
"cordis_inspect_query",
|
||||
"cordis_inspect",
|
||||
"job_kill",
|
||||
"job_list",
|
||||
"job_output",
|
||||
@@ -1890,8 +1887,7 @@
|
||||
"maxTokens": true
|
||||
},
|
||||
"tools": [
|
||||
"cordis_inspect_list",
|
||||
"cordis_inspect_query",
|
||||
"cordis_inspect",
|
||||
"job_kill",
|
||||
"job_list",
|
||||
"job_output",
|
||||
@@ -3235,8 +3231,7 @@
|
||||
"maxTokens": true
|
||||
},
|
||||
"tools": [
|
||||
"cordis_inspect_list",
|
||||
"cordis_inspect_query",
|
||||
"cordis_inspect",
|
||||
"job_kill",
|
||||
"job_list",
|
||||
"job_output",
|
||||
@@ -4253,8 +4248,7 @@
|
||||
"maxTokens": true
|
||||
},
|
||||
"tools": [
|
||||
"cordis_inspect_list",
|
||||
"cordis_inspect_query",
|
||||
"cordis_inspect",
|
||||
"job_kill",
|
||||
"job_list",
|
||||
"job_output",
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
{"type":"user/message","data":{"id":"{{messageId}}","role":"user","content":[{"type":"text","text":"Serial agent creation completed."}],"source":{"kind":"plugin:serial-created-fixture"}},"surfaceOp":"append"}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"Reply with exactly DIRECT_CHILD_OK and nothing else."},{"type":"text","text":"Your final answer is delivered automatically if your parent is still online. Include the result and relevant evidence in that answer; the parent does not receive your full transcript, tool output, or reasoning. If your last action is a message to your parent, the completion notice omits your final answer; include the result and relevant evidence in that message."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"<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\nDelegation depth for `subagent`: current 1, maximum 1, remaining levels 0. Do not call `subagent` at this depth; carry out the work directly.\n\nYou are a delegated subagent: your permission scope was fixed when you were started and cannot be widened from inside this session — operations that require approval are rejected automatically. When the task needs access beyond that scope, do not retry the denied operation; state the limitation in your reply so the delegating agent can handle it.\n</system-reminder>"}],"source":{"kind":"runtime-context","form":"snapshot","sections":[{"name":"working-directory:current","text":"Current working directory: \"{{cwd}}\"."},{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."},{"name":"tool:subagent:depth","text":"Delegation depth for `subagent`: current 1, maximum 1, remaining levels 0. Do not call `subagent` at this depth; carry out the work directly."},{"name":"subagent:delegation","text":"You are a delegated subagent: your permission scope was fixed when you were started and cannot be widened from inside this session — operations that require approval are rejected automatically. When the task needs access beyond that scope, do not retry the denied operation; state the limitation in your reply so the delegating agent can handle it."}]},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","reasoningEffort":"high","maxTokens":256000},"adapterDefaults":{"maxTokens":true},"tools":["cordis_inspect_list","cordis_inspect_query","job_kill","job_list","job_output","snapshot_double","subagent","workflow","working_directory"]},"reason":"initial"}}
|
||||
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","reasoningEffort":"high","maxTokens":256000},"adapterDefaults":{"maxTokens":true},"tools":["cordis_inspect","job_kill","job_list","job_output","snapshot_double","subagent","workflow","working_directory"]},"reason":"initial"}}
|
||||
{"type":"request/context","data":{"provider":"deepseek-official","model":"smoke-model","contextWindow":1000000}}
|
||||
{"type":"session/title","data":{"title":"Reply with exactly DIRECT_CHILD_OK and","messageSeqs":[20],"source":{"kind":"fallback"}}}
|
||||
{"type":"session-log-deepseek/delivery-accepted","data":{"sessionId":"{{child-1}}","sessionFormatVersion":4,"throughSeq":24}}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
{"type":"user/message","data":{"id":"{{messageId}}","role":"user","content":[{"type":"text","text":"Serial agent creation completed."}],"source":{"kind":"plugin:serial-created-fixture"}},"surfaceOp":"append"}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"Reply with exactly WORKFLOW_CHILD_OK and nothing else."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"<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\nDelegation depth for `subagent`: current 1, maximum 1, remaining levels 0. Do not call `subagent` at this depth; carry out the work directly.\n\nYou are a delegated subagent: your permission scope was fixed when you were started and cannot be widened from inside this session — operations that require approval are rejected automatically. When the task needs access beyond that scope, do not retry the denied operation; state the limitation in your reply so the delegating agent can handle it.\n</system-reminder>"}],"source":{"kind":"runtime-context","form":"snapshot","sections":[{"name":"working-directory:current","text":"Current working directory: \"{{cwd}}\"."},{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."},{"name":"tool:subagent:depth","text":"Delegation depth for `subagent`: current 1, maximum 1, remaining levels 0. Do not call `subagent` at this depth; carry out the work directly."},{"name":"subagent:delegation","text":"You are a delegated subagent: your permission scope was fixed when you were started and cannot be widened from inside this session — operations that require approval are rejected automatically. When the task needs access beyond that scope, do not retry the denied operation; state the limitation in your reply so the delegating agent can handle it."}]},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","reasoningEffort":"high","maxTokens":256000},"adapterDefaults":{"maxTokens":true},"tools":["cordis_inspect_list","cordis_inspect_query","job_kill","job_list","job_output","snapshot_double","subagent","workflow","working_directory"]},"reason":"initial"}}
|
||||
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","reasoningEffort":"high","maxTokens":256000},"adapterDefaults":{"maxTokens":true},"tools":["cordis_inspect","job_kill","job_list","job_output","snapshot_double","subagent","workflow","working_directory"]},"reason":"initial"}}
|
||||
{"type":"request/context","data":{"provider":"deepseek-official","model":"smoke-model","contextWindow":1000000}}
|
||||
{"type":"session/title","data":{"title":"Reply with exactly WORKFLOW_CHILD_OK and","messageSeqs":[20],"source":{"kind":"fallback"}}}
|
||||
{"type":"session-log-deepseek/delivery-accepted","data":{"sessionId":"{{child-2}}","sessionFormatVersion":4,"throughSeq":24}}
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"Run the advanced packaged-runtime snapshot scenario."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"<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</system-reminder>"}],"source":{"kind":"runtime-context","form":"snapshot","sections":[{"name":"working-directory:current","text":"Current working directory: \"{{cwd}}\"."},{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}]},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"user/message","data":{"id":"{{messageId}}","role":"user","content":[{"type":"image","attachment":{"attachmentId":"sha256:b1ff9c8ea3a780bad09b346c423d2d0e46815926879b18e841d928376a946640","mediaType":"image/png","width":1,"height":1,"bytes":69}}],"source":{"kind":"python-snapshot-image-offload"}},"surfaceOp":"append"}
|
||||
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","maxTokens":256000,"reasoningEffort":"high"},"adapterDefaults":{"reasoningEffort":true,"maxTokens":true},"tools":["cordis_inspect_list","cordis_inspect_query","job_kill","job_list","job_output","snapshot_double","subagent","workflow","working_directory"]},"reason":"initial"}}
|
||||
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","maxTokens":256000,"reasoningEffort":"high"},"adapterDefaults":{"reasoningEffort":true,"maxTokens":true},"tools":["cordis_inspect","job_kill","job_list","job_output","snapshot_double","subagent","workflow","working_directory"]},"reason":"initial"}}
|
||||
{"type":"request/context","data":{"provider":"deepseek-official","model":"smoke-model","contextWindow":1000000}}
|
||||
{"type":"session/title","data":{"title":"Run the advanced packaged-runtime snapsh","messageSeqs":[11],"source":{"kind":"fallback"}}}
|
||||
{"type":"assistant/attempt","data":{"turn":1,"step":1,"stream":[{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"error","failure":{"code":"IMAGE_OFFLOAD_REQUIRED","message":"authored image budget failure","offloadImages":1}}}}]}}
|
||||
{"type":"image/offload","data":{"targets":[{"seq":13,"imageIndexes":[0]}]}}
|
||||
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","maxTokens":256000,"reasoningEffort":"high"},"adapterDefaults":{"reasoningEffort":true,"maxTokens":true},"tools":["cordis_inspect_list","cordis_inspect_query","job_kill","job_list","job_output","snapshot_double","subagent","workflow","working_directory"]},"reason":"series"}}
|
||||
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","maxTokens":256000,"reasoningEffort":"high"},"adapterDefaults":{"reasoningEffort":true,"maxTokens":true},"tools":["cordis_inspect","job_kill","job_list","job_output","snapshot_double","subagent","workflow","working_directory"]},"reason":"series"}}
|
||||
{"type":"session-log-deepseek/delivery-accepted","data":{"sessionId":"{{parent}}","sessionFormatVersion":4,"throughSeq":19}}
|
||||
{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"tool-call","id":"advanced-native","name":"snapshot_double","arguments":"{\"value\": 21}"}],"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-native","name":"snapshot_double","args":[""]},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"advanced-native","args":["{\"value\": 21}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"advanced-native","name":"snapshot_double","arguments":"{\"value\": 21}"}}},{"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":1,"callId":"advanced-native","name":"snapshot_double","arguments":"{\"value\": 21}"}}
|
||||
|
||||
@@ -18,8 +18,7 @@
|
||||
}
|
||||
],
|
||||
"toolNames": [
|
||||
"cordis_inspect_list",
|
||||
"cordis_inspect_query",
|
||||
"cordis_inspect",
|
||||
"job_kill",
|
||||
"job_list",
|
||||
"job_output",
|
||||
@@ -47,8 +46,7 @@
|
||||
}
|
||||
],
|
||||
"toolNames": [
|
||||
"cordis_inspect_list",
|
||||
"cordis_inspect_query",
|
||||
"cordis_inspect",
|
||||
"job_kill",
|
||||
"job_list",
|
||||
"job_output",
|
||||
|
||||
@@ -1,4 +1,24 @@
|
||||
{
|
||||
"permissionEvents": [
|
||||
{
|
||||
"type": "permission/preset",
|
||||
"data": {
|
||||
"preset": "read-only"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "sandbox/mode",
|
||||
"data": {
|
||||
"mode": "read-only"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "approval/policy",
|
||||
"data": {
|
||||
"policy": "ask"
|
||||
}
|
||||
}
|
||||
],
|
||||
"model": "resumed-smoke-model",
|
||||
"final_response": "RESUMED_PROCESS_OK",
|
||||
"eventTypes": [
|
||||
@@ -7,6 +27,7 @@
|
||||
"agent/inbox/spliced",
|
||||
"step/start",
|
||||
"user/message",
|
||||
"user/message",
|
||||
"request/header",
|
||||
"request/context",
|
||||
"session-log-deepseek/delivery-accepted",
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
{"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"system-prompt"},"id":"{{messageId}}"}},"surfaceOp":"append"}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"Complete the first isolated Python SDK process turn."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"<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</system-reminder>"}],"source":{"kind":"runtime-context","form":"snapshot","sections":[{"name":"working-directory:current","text":"Current working directory: \"{{cwd}}\"."},{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}]},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","maxTokens":256000,"reasoningEffort":"high"},"adapterDefaults":{"reasoningEffort":true,"maxTokens":true},"tools":["cordis_inspect_list","cordis_inspect_query","job_kill","job_list","job_output","subagent","workflow","working_directory"]},"reason":"initial"}}
|
||||
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","maxTokens":256000,"reasoningEffort":"high"},"adapterDefaults":{"reasoningEffort":true,"maxTokens":true},"tools":["cordis_inspect","job_kill","job_list","job_output","subagent","workflow","working_directory"]},"reason":"initial"}}
|
||||
{"type":"request/context","data":{"provider":"deepseek-official","model":"smoke-model","contextWindow":1000000}}
|
||||
{"type":"session/title","data":{"title":"Complete the first isolated Python","messageSeqs":[8],"source":{"kind":"fallback"}}}
|
||||
{"type":"session-log-deepseek/delivery-accepted","data":{"sessionId":"{{session-1}}","sessionFormatVersion":4,"throughSeq":12}}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
{"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"system-prompt"},"id":"{{messageId}}"}},"surfaceOp":"append"}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"Complete the second isolated Python SDK process turn."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"<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</system-reminder>"}],"source":{"kind":"runtime-context","form":"snapshot","sections":[{"name":"working-directory:current","text":"Current working directory: \"{{cwd}}\"."},{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}]},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","maxTokens":256000,"reasoningEffort":"high"},"adapterDefaults":{"reasoningEffort":true,"maxTokens":true},"tools":["cordis_inspect_list","cordis_inspect_query","job_kill","job_list","job_output","subagent","workflow","working_directory"]},"reason":"initial"}}
|
||||
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","maxTokens":256000,"reasoningEffort":"high"},"adapterDefaults":{"reasoningEffort":true,"maxTokens":true},"tools":["cordis_inspect","job_kill","job_list","job_output","subagent","workflow","working_directory"]},"reason":"initial"}}
|
||||
{"type":"request/context","data":{"provider":"deepseek-official","model":"smoke-model","contextWindow":1000000}}
|
||||
{"type":"session/title","data":{"title":"Complete the second isolated Python","messageSeqs":[8],"source":{"kind":"fallback"}}}
|
||||
{"type":"session-log-deepseek/delivery-accepted","data":{"sessionId":"{{session-2}}","sessionFormatVersion":4,"throughSeq":12}}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
{"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"system-prompt"},"id":"{{messageId}}"}},"surfaceOp":"append"}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"Run three todo updates; the scheduler will reject the second call."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"user/message","data":{"content":[{"type":"text","text":"<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</system-reminder>"}],"source":{"kind":"runtime-context","form":"snapshot","sections":[{"name":"working-directory:current","text":"Current working directory: \"{{cwd}}\"."},{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}]},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"}
|
||||
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","maxTokens":256000,"reasoningEffort":"high"},"adapterDefaults":{"reasoningEffort":true,"maxTokens":true},"tools":["cordis_inspect_list","cordis_inspect_query","job_kill","job_list","job_output","subagent","todo_write","workflow","working_directory"]},"reason":"initial"}}
|
||||
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","maxTokens":256000,"reasoningEffort":"high"},"adapterDefaults":{"reasoningEffort":true,"maxTokens":true},"tools":["cordis_inspect","job_kill","job_list","job_output","subagent","todo_write","workflow","working_directory"]},"reason":"initial"}}
|
||||
{"type":"request/context","data":{"provider":"deepseek-official","model":"smoke-model","contextWindow":1000000}}
|
||||
{"type":"session/title","data":{"title":"Run three todo updates; the","messageSeqs":[8],"source":{"kind":"fallback"}}}
|
||||
{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"tool-call","id":"scheduler-complete","name":"todo_write","arguments":"{\"todos\": []}"},{"type":"tool-call","id":"scheduler-fail","name":"todo_write","arguments":"{\"todos\": []}"},{"type":"tool-call","id":"scheduler-unstarted","name":"todo_write","arguments":"{\"todos\": []}"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"},{"type":"tool-call"},{"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":"scheduler-complete","name":"todo_write","args":[""]},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"scheduler-complete","args":["{\"todos\": []}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"scheduler-complete","name":"todo_write","arguments":"{\"todos\": []}"}}},{"type":"chunk","time":0,"chunk":{"type":"block-start","index":1,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":1,"dt":[],"id":"scheduler-fail","name":"todo_write","args":[""]},{"type":"tool-call-chunks","time0":0,"index":1,"dt":[],"id":"scheduler-fail","args":["{\"todos\": []}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":1,"block":{"type":"tool-call","id":"scheduler-fail","name":"todo_write","arguments":"{\"todos\": []}"}}},{"type":"chunk","time":0,"chunk":{"type":"block-start","index":2,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":2,"dt":[],"id":"scheduler-unstarted","name":"todo_write","args":[""]},{"type":"tool-call-chunks","time0":0,"index":2,"dt":[],"id":"scheduler-unstarted","args":["{\"todos\": []}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":2,"block":{"type":"tool-call","id":"scheduler-unstarted","name":"todo_write","arguments":"{\"todos\": []}"}}},{"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"},{"type":"tool-call"},{"type":"tool-call"}]}}}]},"surfaceOp":"append"}
|
||||
|
||||
@@ -1282,6 +1282,12 @@
|
||||
"source": "packages/ptc-runtime/ptc-runtime/src/image.ts",
|
||||
"projection": "public-api"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/ptc-runtime.md",
|
||||
"symbol": "PtcInspectableValue",
|
||||
"source": "packages/ptc-runtime/ptc-runtime/src/inspectable-value.ts",
|
||||
"projection": "public-api"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/ptc-runtime.md",
|
||||
"symbol": "PtcOutput",
|
||||
@@ -1842,6 +1848,16 @@
|
||||
"symbol": "LlmNativeAuth",
|
||||
"source": "packages/llm/llm/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/llm-streaming.md",
|
||||
"symbol": "ProviderCredentialGrant",
|
||||
"source": "packages/llm/llm/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/llm-streaming.md",
|
||||
"symbol": "ProviderCredential",
|
||||
"source": "packages/llm/llm/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/permission-presets.md",
|
||||
"symbol": "Config",
|
||||
@@ -2533,6 +2549,26 @@
|
||||
"symbol": "SessionChangeRequestsListener",
|
||||
"source": "packages/experimental/forge-session/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/forge.md",
|
||||
"symbol": "ForgeCommandRule",
|
||||
"source": "packages/experimental/forge-session/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/forge.md",
|
||||
"symbol": "ForgeCommandGroup",
|
||||
"source": "packages/experimental/forge-session/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/forge.md",
|
||||
"symbol": "ForgeCommandArguments",
|
||||
"source": "packages/experimental/forge-session/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/forge.md",
|
||||
"symbol": "ForgeCommandSelection",
|
||||
"source": "packages/experimental/forge-session/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/boot.md",
|
||||
"symbol": "ProfileReconciliation",
|
||||
@@ -2653,6 +2689,16 @@
|
||||
"symbol": "ForgeReadiness",
|
||||
"source": "packages/experimental/forge/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/forge.md",
|
||||
"symbol": "ChangeRequestNoun",
|
||||
"source": "packages/experimental/forge/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/forge.md",
|
||||
"symbol": "ForgeDescription",
|
||||
"source": "packages/experimental/forge/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/forge.md",
|
||||
"symbol": "ForgeActionFailure",
|
||||
@@ -2735,7 +2781,17 @@
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/forge.md",
|
||||
"symbol": "ForgeBranches",
|
||||
"symbol": "ForgeWorktreeBases",
|
||||
"source": "packages/experimental/client-ui-forge/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/forge.md",
|
||||
"symbol": "ForgeRemoteDefault",
|
||||
"source": "packages/experimental/client-ui-forge/src/types.ts"
|
||||
},
|
||||
{
|
||||
"doc": "docs/subsystems/forge.md",
|
||||
"symbol": "ForgeRemoteBranches",
|
||||
"source": "packages/experimental/client-ui-forge/src/types.ts"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -192,6 +192,34 @@ describe('package modes', () => {
|
||||
})
|
||||
|
||||
describe('module requests', () => {
|
||||
it('accepts the iframe provider registry edge without allowing other client feature edges', () => {
|
||||
const registry = declaration('script-realm')
|
||||
const specifier = registry.name + '/client'
|
||||
const provider = declaration('script-realm-iframe', {
|
||||
external: [specifier],
|
||||
runtimeSourceSpecifiers: { [specifier]: ['packages/client/script-realm-iframe/src/client/iframe.ts'] },
|
||||
})
|
||||
expect(collectClientPackageViolations(facts([], { declarations: [provider, registry] }))).toEqual([])
|
||||
const feature = declaration('feature', {
|
||||
external: [specifier],
|
||||
runtimeSourceSpecifiers: { [specifier]: ['packages/client/feature/src/client/index.ts'] },
|
||||
})
|
||||
expect(collectClientPackageViolations(facts([], { declarations: [feature, registry] })))
|
||||
.toContain(feature.manifest + ': client feature package requests runtime external '
|
||||
+ JSON.stringify(specifier) + '; request only rows under packages/api/'
|
||||
+ ', import shared types only, or call an injected Cordis service')
|
||||
const stale = { ...provider, runtimeSourceSpecifiers: {} }
|
||||
expect(collectClientPackageViolations(facts([], { declarations: [stale, registry] })))
|
||||
.toContain(provider.manifest + ': dsh.client.external ' + JSON.stringify(specifier)
|
||||
+ ' has no runtime import or re-export in production source; remove the stale declaration')
|
||||
const other = declaration('other')
|
||||
const unrelated = { ...provider, external: [other.name + '/client'] }
|
||||
expect(collectClientPackageViolations(facts([], { declarations: [unrelated, registry, other] })))
|
||||
.toContain(provider.manifest + ': client feature package requests runtime external '
|
||||
+ JSON.stringify(other.name + '/client') + '; request only rows under packages/api/'
|
||||
+ ', import shared types only, or call an injected Cordis service')
|
||||
})
|
||||
|
||||
it('rejects runtime requests from one client feature package to another dynamic row', () => {
|
||||
const ui = declaration('ui', {
|
||||
external: ['@deepseek-ai/dsh-client-slots/client'],
|
||||
@@ -202,7 +230,28 @@ describe('module requests', () => {
|
||||
const slots = declaration('slots')
|
||||
expect(collectClientPackageViolations(facts([], { declarations: [ui, slots] }))).toEqual([
|
||||
ui.manifest + ': client feature package requests runtime external '
|
||||
+ '"@deepseek-ai/dsh-client-slots/client"; import shared types only or call an injected Cordis service',
|
||||
+ '"@deepseek-ai/dsh-client-slots/client"; request only rows under packages/api/, import shared types only,'
|
||||
+ ' or call an injected Cordis service',
|
||||
])
|
||||
})
|
||||
|
||||
it('accepts a client feature runtime request to an infrastructure row and still rejects a stale one', () => {
|
||||
const gateway = {
|
||||
...declaration('@deepseek-ai/dsh-api-gateway'), manifest: 'packages/api/gateway/package.json',
|
||||
}
|
||||
const live = declaration('live', {
|
||||
external: ['@deepseek-ai/dsh-api-gateway/client'],
|
||||
runtimeSourceUses: {
|
||||
'@deepseek-ai/dsh-api-gateway': ['packages/client/live/src/client/index.ts'],
|
||||
},
|
||||
runtimeSourceSpecifiers: {
|
||||
'@deepseek-ai/dsh-api-gateway/client': ['packages/client/live/src/client/index.ts'],
|
||||
},
|
||||
})
|
||||
const stale = declaration('stale', { external: ['@deepseek-ai/dsh-api-gateway/client'] })
|
||||
expect(collectClientPackageViolations(facts([], { declarations: [gateway, live, stale] }))).toEqual([
|
||||
stale.manifest + ': dsh.client.external "@deepseek-ai/dsh-api-gateway/client"'
|
||||
+ ' has no runtime import or re-export in production source; remove the stale declaration',
|
||||
])
|
||||
})
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@ export {
|
||||
import { collectSourceFileUses } from './source-parse-uses.ts'
|
||||
const GATE = 'verify-client-packages'
|
||||
const CLIENT_MANIFEST_GLOB = 'packages/client/*/package.json'
|
||||
/** Manifest prefix of Client feature packages, which may request only infrastructure rows at runtime. */
|
||||
const CLIENT_FEATURE_PREFIX = 'packages/client/'
|
||||
/** Manifest prefix of the Remote API group, whose dynamic rows are infrastructure a Client feature may request. */
|
||||
const INFRASTRUCTURE_PREFIX = 'packages/api/'
|
||||
const MANIFEST_GLOBS = ['packages/*/*/package.json', 'apps/*/package.json', 'vendor/*/package.json']
|
||||
const CONFIG_GLOB = 'packages/*/*/tsdown.config.ts'
|
||||
const PLATFORM_SOURCE = 'packages/client/web/src/platform.ts'
|
||||
@@ -355,10 +359,14 @@ function collectModuleViolations(facts: ClientPackageFacts): string[] {
|
||||
if (supplier === pkg.name) {
|
||||
violations.push(pkg.manifest + ': dsh.client.external names its own row ' + JSON.stringify(specifier))
|
||||
} else if (supplier !== undefined) {
|
||||
if (pkg.manifest.startsWith('packages/client/')) {
|
||||
// The iframe provider shares the registry's Realm error identity; this is an infrastructure edge, not UI composition.
|
||||
const realmProvider = pkg.name === '@deepseek-ai/dsh-client-script-realm-iframe'
|
||||
&& specifier === '@deepseek-ai/dsh-client-script-realm/client'
|
||||
if (pkg.manifest.startsWith(CLIENT_FEATURE_PREFIX) && !isInfrastructureRow(byName.get(supplier)) && !realmProvider) {
|
||||
violations.push(
|
||||
pkg.manifest + ': client feature package requests runtime external ' + JSON.stringify(specifier)
|
||||
+ '; import shared types only or call an injected Cordis service',
|
||||
+ '; request only rows under ' + INFRASTRUCTURE_PREFIX + ', import shared types only,'
|
||||
+ ' or call an injected Cordis service',
|
||||
)
|
||||
continue
|
||||
}
|
||||
@@ -387,6 +395,15 @@ function collectModuleViolations(facts: ClientPackageFacts): string[] {
|
||||
return violations
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a supplier row belongs to the Remote API infrastructure group.
|
||||
* @param supplier - declaration that answers the requested specifier.
|
||||
* @returns true for a package whose manifest lies under `packages/api/`.
|
||||
*/
|
||||
function isInfrastructureRow(supplier: ClientDeclaration | undefined): boolean {
|
||||
return supplier !== undefined && supplier.manifest.startsWith(INFRASTRUCTURE_PREFIX)
|
||||
}
|
||||
|
||||
function collectModuleCycles(
|
||||
edges: readonly ModuleEdge[],
|
||||
byName: ReadonlyMap<string, ClientDeclaration>,
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
import { readFileSync, unlinkSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { createInventoryRepo, gitFixture as git, removeInventoryRepos, writeFixture as write } from './baseline-inventory.fixture.ts'
|
||||
import {
|
||||
CORDIS_ROOT_EXEMPTIONS,
|
||||
countCordisRootReads,
|
||||
findCordisRootReads,
|
||||
scanCordisRootReads,
|
||||
verifyCordisRoot,
|
||||
} from './verify-cordis-root.ts'
|
||||
|
||||
const baselinePath = 'scripts/cordis-root.baseline.json'
|
||||
const sourcePath = 'packages/example/src/index.ts'
|
||||
const header = "import { Context } from '@deepseek-ai/cordis'\n"
|
||||
const read = `${header}export const root = (ctx: Context) => ctx[Context.root]\n`
|
||||
const none = {}
|
||||
|
||||
afterEach(removeInventoryRepos)
|
||||
|
||||
function fixture(): string {
|
||||
return createInventoryRepo(baselinePath, 'export {}\n')
|
||||
}
|
||||
|
||||
function recordBaseline(root: string): string {
|
||||
const text = `${JSON.stringify(countCordisRootReads(scanCordisRootReads(root, none)), null, 2)}\n`
|
||||
write(root, baselinePath, text)
|
||||
return text
|
||||
}
|
||||
|
||||
describe('Cordis root read syntax', () => {
|
||||
it.each([
|
||||
['an element access', `${header}ctx[Context.root]`, 1],
|
||||
['a property chain through the root', `${header}ctx[Context.root].loader.await()`, 1],
|
||||
['a bare symbol read', `${header}const key = Context.root`, 1],
|
||||
['a parenthesized class', `${header}ctx[(Context).root]`, 1],
|
||||
['a string-keyed read', `${header}ctx[Context['root']]`, 1],
|
||||
['a destructured read', `${header}const { root } = Context`, 1],
|
||||
['a renamed destructured read', `${header}const { root: key } = Context`, 1],
|
||||
['a renamed import', "import { Context as CordisContext } from '@deepseek-ai/cordis'\nctx[CordisContext.root]", 1],
|
||||
['a namespace import', "import * as cordis from '@deepseek-ai/cordis'\nctx[cordis.Context.root]", 1],
|
||||
['a global symbol key', "ctx[Symbol.for('cordis.root')]", 1],
|
||||
['a template symbol key', 'ctx[Symbol.for(`cordis.root`)]', 1],
|
||||
['a symbol key held in a constant', "const key = 'cordis.root'", 1],
|
||||
['several reads', `${header}ctx[Context.root].on('a', f); ctx[Context.root].on('b', g)`, 2],
|
||||
['a TSX expression', `${header}export const view = <View ctx={ctx[Context.root]} />`, 1],
|
||||
['the symbols table', "import { symbols } from '@deepseek-ai/cordis'\nctx[symbols.root]", 1],
|
||||
['a renamed symbols table', "import { symbols as cordisSymbols } from '@deepseek-ai/cordis'\nctx[cordisSymbols['root']]", 1],
|
||||
['the symbols table of a namespace', "import * as cordis from '@deepseek-ai/cordis'\nctx[cordis.symbols.root]", 1],
|
||||
['root destructured from the symbols table', "import { symbols } from '@deepseek-ai/cordis'\nconst { root } = symbols", 1],
|
||||
['a subpath import', "import { Context } from '@deepseek-ai/cordis/src/index.ts'\nctx[Context.root]", 1],
|
||||
['a default import', "import cordis from '@deepseek-ai/cordis'\nctx[cordis.Context.root]", 1],
|
||||
['an import-equals namespace', "import cordis = require('@deepseek-ai/cordis')\nctx[cordis.Context.root]", 1],
|
||||
['a destructured dynamic import', "const { Context } = await import('@deepseek-ai/cordis')\nctx[Context.root]", 1],
|
||||
['a renamed destructured dynamic import', "const { Context: C } = await import('@deepseek-ai/cordis')\nctx[C.root]", 1],
|
||||
['a namespace dynamic import', "const cordis = await import('@deepseek-ai/cordis')\nctx[cordis.Context.root]", 1],
|
||||
['a destructured require', "const { Context } = require('@deepseek-ai/cordis')\nctx[Context.root]", 1],
|
||||
['a destructuring assignment', `${header}let key; ({ root: key } = Context)`, 1],
|
||||
['a shorthand destructuring assignment', `${header}let root; ({ root } = Context)`, 1],
|
||||
['a parameter default', `${header}function f({ root } = Context) { return root }`, 1],
|
||||
['a nested binding default', `${header}const { a: { root } = Context } = value`, 1],
|
||||
['a computed class member', `${header}class Holder { [Context.root] = undefined }`, 1],
|
||||
['a class extends clause', `${header}class Holder extends mixin(Context.root) {}`, 1],
|
||||
])('finds %s', (_name, text, count) => {
|
||||
expect(findCordisRootReads('input.tsx', text)).toHaveLength(count)
|
||||
})
|
||||
|
||||
it.each([
|
||||
['comments', `${header}// ctx[Context.root]\n/* Symbol.for('cordis.root') */`],
|
||||
['strings that mention the root', `${header}const text = 'ctx[Context.root]'`],
|
||||
['source text embedded in a template', "const code = `ctx[Symbol.for('cordis.root')]`"],
|
||||
['a type query', `${header}type Root = typeof Context.root`],
|
||||
['a literal type', "type Key = 'cordis.root'"],
|
||||
['a type-only import', "import type { Context } from '@deepseek-ai/cordis'\nctx[Context.root]"],
|
||||
['a type-only specifier', "import { type Context } from '@deepseek-ai/cordis'\nctx[Context.root]"],
|
||||
['a Context from another module', "import { Context } from './context.ts'\nctx[Context.root]"],
|
||||
['another static of Context', `${header}ctx[Context.isolate]`],
|
||||
['a root member of another value', `${header}const dir = project.root`],
|
||||
['a destructured root of another value', `${header}const { root } = project`],
|
||||
['a parameter that shadows the import', `${header}function f(Context: { root: string }) { return Context.root }`],
|
||||
['a local that shadows the import', `${header}{ const Context = project; Context.root }`],
|
||||
['a parameter that shadows a namespace', "import * as cordis from '@deepseek-ai/cordis'\nfunction f(cordis: any) { return cordis.Context.root }"],
|
||||
['an interface member', `${header}interface Holder { [Context.root]: Context }`],
|
||||
['a type literal member', `${header}type Holder = { [Context.root]: Context }`],
|
||||
['an ambient class member', `${header}declare class Holder { [Context.root]: Context }`],
|
||||
['an ambient module member', `${header}declare module 'x' { const key: typeof Context.root; export const value = Context.root }`],
|
||||
['an ambient class field', `${header}class Holder { declare [Context.root]: Context }`],
|
||||
['an implements clause', `${header}class Holder implements Base<typeof Context.root> {}`],
|
||||
['another member of the symbols table', "import { symbols } from '@deepseek-ai/cordis'\nctx[symbols.original]"],
|
||||
['a dynamic import of another module', "const { Context } = await import('./context.ts')\nctx[Context.root]"],
|
||||
['a destructuring assignment of another member', `${header}let isolate; ({ isolate } = Context)`],
|
||||
])('ignores %s', (_name, text) => {
|
||||
expect(findCordisRootReads('input.ts', text)).toEqual([])
|
||||
})
|
||||
|
||||
it('resolves bindings in JavaScript modules', () => {
|
||||
expect(findCordisRootReads('input.mjs', "const { Context } = await import('@deepseek-ai/cordis')\nctx[Context.root]")).toHaveLength(1)
|
||||
expect(findCordisRootReads('input.cjs', "const { symbols } = require('@deepseek-ai/cordis')\nfunction f(symbols) { return symbols.root }")).toEqual([])
|
||||
})
|
||||
|
||||
it('skips declaration files', () => {
|
||||
expect(findCordisRootReads('input.d.ts', `${header}export declare const key: typeof Context.root\nexport const value = Context.root`)).toEqual([])
|
||||
})
|
||||
|
||||
it('reports normalized paths and the read line', () => {
|
||||
const [found] = findCordisRootReads('packages\\example\\index.ts', `${header}\nctx[Context.root]`)
|
||||
expect(found).toMatchObject({ file: 'packages/example/index.ts', line: 3 })
|
||||
expect(found?.fingerprint).toMatch(/^[a-f0-9]{64}$/u)
|
||||
})
|
||||
|
||||
it('identifies a read by its receiver', () => {
|
||||
const fingerprint = (text: string): string | undefined => findCordisRootReads('input.ts', `${header}${text}`)[0]?.fingerprint
|
||||
expect(fingerprint('ctx[\n Context.root /* root */ ]')).toBe(fingerprint('ctx[Context.root]'))
|
||||
expect(fingerprint('ctx[Context.root].loader')).toBe(fingerprint('ctx[Context.root].fiber'))
|
||||
expect(fingerprint('other[Context.root]')).not.toBe(fingerprint('ctx[Context.root]'))
|
||||
expect(findCordisRootReads('input.ts', "other[Symbol.for('cordis.root')]")[0]?.fingerprint)
|
||||
.not.toBe(findCordisRootReads('input.ts', "ctx[Symbol.for('cordis.root')]")[0]?.fingerprint)
|
||||
})
|
||||
})
|
||||
|
||||
describe('Cordis root read inventory', () => {
|
||||
it('accepts a recorded read after formatting without rewriting the baseline', () => {
|
||||
const root = fixture()
|
||||
write(root, sourcePath, read)
|
||||
const baseline = recordBaseline(root)
|
||||
write(root, sourcePath, `${header}export const root = (ctx: Context) => ctx[\n Context.root\n]\n`)
|
||||
expect(verifyCordisRoot(root, false, none)).toBe(1)
|
||||
expect(verifyCordisRoot(root, true, none)).toBe(1)
|
||||
expect(readFileSync(join(root, baselinePath), 'utf8')).toBe(baseline)
|
||||
})
|
||||
|
||||
it.each([
|
||||
['another copy of a recorded read', `${read}export const again = (ctx: Context) => ctx[Context.root]\n`],
|
||||
['a read through another receiver', `${header}export const root = (other: Context) => other[Context.root]\n`],
|
||||
['a global symbol key read', "export const root = (ctx: object) => Reflect.get(ctx, Symbol.for('cordis.root'))\n"],
|
||||
])('rejects %s without changing the baseline', (_name, text) => {
|
||||
const root = fixture()
|
||||
write(root, sourcePath, read)
|
||||
const baseline = recordBaseline(root)
|
||||
write(root, sourcePath, text)
|
||||
expect(() => verifyCordisRoot(root, false, none)).toThrow(/verify-cordis-root: new reads of the Cordis root context/u)
|
||||
expect(() => verifyCordisRoot(root, true, none)).toThrow(/verify-cordis-root: new reads of the Cordis root context/u)
|
||||
expect(readFileSync(join(root, baselinePath), 'utf8')).toBe(baseline)
|
||||
})
|
||||
|
||||
it('rejects a new read when the inventory is empty', () => {
|
||||
const root = fixture()
|
||||
write(root, sourcePath, read)
|
||||
expect(() => verifyCordisRoot(root, false, none)).toThrow(`${sourcePath}:2`)
|
||||
})
|
||||
|
||||
it('requires pruning a fixed read', () => {
|
||||
const root = fixture()
|
||||
write(root, sourcePath, read)
|
||||
git(root, 'add', sourcePath)
|
||||
recordBaseline(root)
|
||||
write(root, sourcePath, 'export {}\n')
|
||||
expect(() => verifyCordisRoot(root, false, none)).toThrow(/remove retired baseline entries/u)
|
||||
expect(verifyCordisRoot(root, true, none)).toBe(0)
|
||||
expect(readFileSync(join(root, baselinePath), 'utf8')).toBe('{}\n')
|
||||
})
|
||||
|
||||
it('excludes vendored source', () => {
|
||||
const root = fixture()
|
||||
write(root, 'vendor/cordis/src/index.ts', read)
|
||||
git(root, 'add', '.')
|
||||
expect(verifyCordisRoot(root, false, none)).toBe(0)
|
||||
})
|
||||
})
|
||||
|
||||
describe('Cordis root read exemptions', () => {
|
||||
const exemptPath = 'scripts/root-contract.spec.ts'
|
||||
const exemptions = { [exemptPath]: 'pins the root contract' }
|
||||
|
||||
it('leaves an exempt file unscanned', () => {
|
||||
const root = fixture()
|
||||
write(root, exemptPath, read)
|
||||
expect(scanCordisRootReads(root, exemptions)).toEqual([])
|
||||
expect(verifyCordisRoot(root, false, exemptions)).toBe(0)
|
||||
})
|
||||
|
||||
it.each([
|
||||
['no longer reads the root', (root: string) => { write(root, exemptPath, 'export {}\n') }],
|
||||
['is deleted', (root: string) => { write(root, exemptPath, read); unlinkSync(join(root, exemptPath)) }],
|
||||
])('rejects an exemption whose file %s', (_name, change) => {
|
||||
const root = fixture()
|
||||
change(root)
|
||||
expect(() => verifyCordisRoot(root, false, exemptions))
|
||||
.toThrow(`verify-cordis-root: exempt file ${exemptPath} no longer reads the root context`)
|
||||
})
|
||||
|
||||
it('names only files that read the root in this repository', () => {
|
||||
const root = join(import.meta.dirname, '..')
|
||||
for (const file of Object.keys(CORDIS_ROOT_EXEMPTIONS)) {
|
||||
expect(findCordisRootReads(file, readFileSync(join(root, file), 'utf8')).length).toBeGreaterThan(0)
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,320 @@
|
||||
/**
|
||||
* Reject new reads of the Cordis root context, retiring the recorded existing reads.
|
||||
*
|
||||
* A read names the root symbol through a Cordis value binding: `Context.root` or `symbols.root`,
|
||||
* their `['root']` forms, or `root` destructured from either in a declaration, a parameter default,
|
||||
* or an assignment. A binding comes from `@deepseek-ai/cordis` or one of its subpaths through a
|
||||
* static import, including renamed and namespace imports, or through a destructured or namespace
|
||||
* `import()` or `require()` result. References resolve through the file's own scopes, so a local
|
||||
* that shadows the import is not a binding. Any string literal whose value is exactly `cordis.root`,
|
||||
* the global symbol key behind `Symbol.for('cordis.root')`, is also a read. Type positions,
|
||||
* interfaces, type aliases, and ambient declarations are erased and contain no reads.
|
||||
*
|
||||
* The check is syntactic: a root context reached through another value, such as a stored
|
||||
* reference, an alias of `Context`, a service that returns it, or source text assembled at run
|
||||
* time, is outside it.
|
||||
*
|
||||
* A finding's identity covers the syntax tokens of the access to the root: the element access whose
|
||||
* key is the root symbol when one encloses it, otherwise the read itself. Existing reads are
|
||||
* recorded in `scripts/cordis-root.baseline.json`; the files in {@link CORDIS_ROOT_EXEMPTIONS} pin
|
||||
* the root contract itself and are not scanned.
|
||||
*/
|
||||
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import ts from 'typescript'
|
||||
import {
|
||||
countInventory,
|
||||
listInventorySources,
|
||||
runInventoryGate,
|
||||
syntaxFingerprint,
|
||||
verifyInventory,
|
||||
type InventoryBaseline,
|
||||
type InventoryGate,
|
||||
} from './baseline-inventory.ts'
|
||||
|
||||
const root = resolve(import.meta.dirname, '..')
|
||||
|
||||
/** Package that exports the Cordis `Context` class and the `symbols` table. */
|
||||
const CORDIS_MODULE = '@deepseek-ai/cordis'
|
||||
|
||||
/** Global symbol key of `Context.root`. */
|
||||
const ROOT_SYMBOL_KEY = 'cordis.root'
|
||||
|
||||
/** Cordis exports that hold the root symbol as their `root` member. */
|
||||
const ROOT_HOLDERS = new Set(['Context', 'symbols'])
|
||||
|
||||
/**
|
||||
* Files that exercise the root context itself, keyed by repository path, with the reason each needs
|
||||
* it. A key whose file no longer reads the root fails the gate.
|
||||
*/
|
||||
export const CORDIS_ROOT_EXEMPTIONS: Readonly<Record<string, string>> = {
|
||||
'scripts/cordis-core-rc12.spec.ts': 'pins the vendored Cordis `Context.root` symbol and its `Symbol.for` key',
|
||||
'scripts/verify-cordis-root.ts': 'names the root symbol key this gate detects',
|
||||
}
|
||||
|
||||
/** Existing root-read counts, keyed by repository path and syntax fingerprint. */
|
||||
export type CordisRootBaseline = InventoryBaseline
|
||||
|
||||
/** One read of the Cordis root context in authored source. */
|
||||
export interface CordisRootRead {
|
||||
/** Repository-relative path with forward slashes. */
|
||||
file: string
|
||||
/** One-based source line. */
|
||||
line: number
|
||||
/** SHA-256 of the access's syntax tokens, excluding comments and whitespace. */
|
||||
fingerprint: string
|
||||
}
|
||||
|
||||
/** Declared symbols that refer to a Cordis root holder or to the Cordis module namespace. */
|
||||
interface CordisBindings {
|
||||
checker: ts.TypeChecker
|
||||
holders: Set<ts.Symbol>
|
||||
namespaces: Set<ts.Symbol>
|
||||
}
|
||||
|
||||
function isCordisSpecifier(node: ts.Node | undefined): boolean {
|
||||
return node !== undefined && ts.isStringLiteralLike(node)
|
||||
&& (node.text === CORDIS_MODULE || node.text.startsWith(`${CORDIS_MODULE}/`))
|
||||
}
|
||||
|
||||
/** Whether an initializer evaluates to the Cordis module: `import()`, `await import()`, or `require()`. */
|
||||
function loadsCordis(node: ts.Expression): boolean {
|
||||
if (ts.isParenthesizedExpression(node) || ts.isAwaitExpression(node)) return loadsCordis(node.expression)
|
||||
if (!ts.isCallExpression(node) || node.arguments.length === 0) return false
|
||||
const callee = node.expression
|
||||
const loader = callee.kind === ts.SyntaxKind.ImportKeyword || (ts.isIdentifier(callee) && callee.text === 'require')
|
||||
return loader && isCordisSpecifier(node.arguments[0])
|
||||
}
|
||||
|
||||
function propertyText(name: ts.PropertyName | ts.BindingName): string | undefined {
|
||||
if (ts.isIdentifier(name) || ts.isStringLiteralLike(name)) return name.text
|
||||
if (ts.isComputedPropertyName(name) && ts.isStringLiteralLike(name.expression)) return name.expression.text
|
||||
return undefined
|
||||
}
|
||||
|
||||
/** Type-check one file in isolation, so references resolve through its own scopes only. */
|
||||
function isolatedChecker(source: ts.SourceFile): ts.TypeChecker {
|
||||
const options: ts.CompilerOptions = { allowJs: true, noLib: true, noResolve: true, types: [] }
|
||||
const host: ts.CompilerHost = {
|
||||
getSourceFile: fileName => (fileName === source.fileName ? source : undefined),
|
||||
getDefaultLibFileName: () => 'lib.d.ts',
|
||||
writeFile: () => undefined,
|
||||
getCurrentDirectory: () => '/',
|
||||
getCanonicalFileName: fileName => fileName,
|
||||
useCaseSensitiveFileNames: () => true,
|
||||
getNewLine: () => '\n',
|
||||
fileExists: fileName => fileName === source.fileName,
|
||||
readFile: () => undefined,
|
||||
}
|
||||
return ts.createProgram({ rootNames: [source.fileName], options, host }).getTypeChecker()
|
||||
}
|
||||
|
||||
function cordisBindings(source: ts.SourceFile): CordisBindings | undefined {
|
||||
if (!source.text.includes(CORDIS_MODULE)) return undefined
|
||||
const checker = isolatedChecker(source)
|
||||
const bindings: CordisBindings = { checker, holders: new Set(), namespaces: new Set() }
|
||||
const add = (set: Set<ts.Symbol>, name: ts.Identifier): void => {
|
||||
const symbol = checker.getSymbolAtLocation(name)
|
||||
if (symbol !== undefined) set.add(symbol)
|
||||
}
|
||||
const visit = (node: ts.Node): void => {
|
||||
if (ts.isImportDeclaration(node) && isCordisSpecifier(node.moduleSpecifier)) {
|
||||
const clause = node.importClause
|
||||
if (clause === undefined || clause.phaseModifier === ts.SyntaxKind.TypeKeyword) return
|
||||
if (clause.name !== undefined) add(bindings.namespaces, clause.name)
|
||||
if (clause.namedBindings !== undefined && ts.isNamespaceImport(clause.namedBindings)) {
|
||||
add(bindings.namespaces, clause.namedBindings.name)
|
||||
} else {
|
||||
for (const element of clause.namedBindings?.elements ?? []) {
|
||||
if (!element.isTypeOnly && ROOT_HOLDERS.has((element.propertyName ?? element.name).text)) {
|
||||
add(bindings.holders, element.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
if (ts.isImportEqualsDeclaration(node) && !node.isTypeOnly && ts.isExternalModuleReference(node.moduleReference)
|
||||
&& isCordisSpecifier(node.moduleReference.expression)) {
|
||||
add(bindings.namespaces, node.name)
|
||||
return
|
||||
}
|
||||
if (ts.isVariableDeclaration(node) && node.initializer !== undefined && loadsCordis(node.initializer)) {
|
||||
if (ts.isIdentifier(node.name)) add(bindings.namespaces, node.name)
|
||||
else if (ts.isObjectBindingPattern(node.name)) {
|
||||
for (const element of node.name.elements) {
|
||||
const exported = propertyText(element.propertyName ?? element.name)
|
||||
if (exported !== undefined && ROOT_HOLDERS.has(exported) && ts.isIdentifier(element.name)) {
|
||||
add(bindings.holders, element.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ts.forEachChild(node, visit)
|
||||
}
|
||||
visit(source)
|
||||
return bindings.holders.size + bindings.namespaces.size === 0 ? undefined : bindings
|
||||
}
|
||||
|
||||
function refersTo(node: ts.Identifier, set: Set<ts.Symbol>, bindings: CordisBindings): boolean {
|
||||
const symbol = bindings.checker.getSymbolAtLocation(node)
|
||||
return symbol !== undefined && set.has(symbol)
|
||||
}
|
||||
|
||||
/** Whether an expression evaluates to `Context` or `symbols` from Cordis. */
|
||||
function isRootHolder(node: ts.Expression, bindings: CordisBindings): boolean {
|
||||
if (ts.isParenthesizedExpression(node)) return isRootHolder(node.expression, bindings)
|
||||
if (ts.isIdentifier(node)) return refersTo(node, bindings.holders, bindings)
|
||||
const member = ts.isPropertyAccessExpression(node) ? node.name.text
|
||||
: ts.isElementAccessExpression(node) && ts.isStringLiteralLike(node.argumentExpression) ? node.argumentExpression.text
|
||||
: undefined
|
||||
if (member === undefined || !ROOT_HOLDERS.has(member)) return false
|
||||
const namespace = (node as ts.PropertyAccessExpression | ts.ElementAccessExpression).expression
|
||||
return ts.isIdentifier(namespace) && refersTo(namespace, bindings.namespaces, bindings)
|
||||
}
|
||||
|
||||
function isRootKey(node: ts.Expression): boolean {
|
||||
return ts.isStringLiteralLike(node) && node.text === 'root'
|
||||
}
|
||||
|
||||
function bindsRoot(pattern: ts.ObjectBindingPattern): boolean {
|
||||
return pattern.elements.some(element => propertyText(element.propertyName ?? element.name) === 'root')
|
||||
}
|
||||
|
||||
function assignsRoot(pattern: ts.ObjectLiteralExpression): boolean {
|
||||
return pattern.properties.some((property) => {
|
||||
if (ts.isShorthandPropertyAssignment(property)) return property.name.text === 'root'
|
||||
return ts.isPropertyAssignment(property) && propertyText(property.name) === 'root'
|
||||
})
|
||||
}
|
||||
|
||||
function readsRoot(node: ts.Node, bindings: CordisBindings | undefined): boolean {
|
||||
if (ts.isStringLiteralLike(node)) return node.text === ROOT_SYMBOL_KEY
|
||||
if (bindings === undefined) return false
|
||||
if (ts.isPropertyAccessExpression(node)) return node.name.text === 'root' && isRootHolder(node.expression, bindings)
|
||||
if (ts.isElementAccessExpression(node)) return isRootKey(node.argumentExpression) && isRootHolder(node.expression, bindings)
|
||||
if (ts.isVariableDeclaration(node) || ts.isParameter(node) || ts.isBindingElement(node)) {
|
||||
return node.initializer !== undefined && ts.isObjectBindingPattern(node.name) && bindsRoot(node.name)
|
||||
&& isRootHolder(node.initializer, bindings)
|
||||
}
|
||||
return ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.EqualsToken
|
||||
&& ts.isObjectLiteralExpression(node.left) && assignsRoot(node.left) && isRootHolder(node.right, bindings)
|
||||
}
|
||||
|
||||
/** Whether a subtree is erased from the emitted program, so it contains no reads. */
|
||||
function isErased(node: ts.Node): boolean {
|
||||
if (ts.isSourceFile(node)) return node.isDeclarationFile
|
||||
if (ts.canHaveModifiers(node) && ts.getModifiers(node)?.some(modifier => modifier.kind === ts.SyntaxKind.DeclareKeyword)) {
|
||||
return true
|
||||
}
|
||||
if (ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node)) return true
|
||||
// A class `extends` clause evaluates its expression; every other type node is erased.
|
||||
if (ts.isExpressionWithTypeArguments(node)) {
|
||||
return !(ts.isHeritageClause(node.parent) && node.parent.token === ts.SyntaxKind.ExtendsKeyword
|
||||
&& ts.isClassLike(node.parent.parent))
|
||||
}
|
||||
return ts.isTypeNode(node)
|
||||
}
|
||||
|
||||
/** The expression whose tokens identify a read: an element access keyed by the root, or the read. */
|
||||
function accessOf(node: ts.Node): ts.Node {
|
||||
let current = node
|
||||
while (ts.isParenthesizedExpression(current.parent) || (ts.isCallExpression(current.parent)
|
||||
&& current.parent.arguments.length === 1 && current.parent.arguments[0] === current)) {
|
||||
current = current.parent
|
||||
}
|
||||
const parent = current.parent
|
||||
return ts.isElementAccessExpression(parent) && parent.argumentExpression === current ? parent : node
|
||||
}
|
||||
|
||||
/**
|
||||
* Find reads of the Cordis root context.
|
||||
* @param file - repository-relative source path; its extension selects TS or TSX parsing.
|
||||
* @param text - source contents.
|
||||
* @returns reads in AST traversal order; comments, erased type syntax, shadowed names, and strings
|
||||
* other than the exact root symbol key do not match.
|
||||
*/
|
||||
export function findCordisRootReads(file: string, text: string): CordisRootRead[] {
|
||||
const normalized = file.replaceAll('\\', '/')
|
||||
const source = ts.createSourceFile(`/${normalized}`, text, ts.ScriptTarget.Latest, true)
|
||||
const bindings = cordisBindings(source)
|
||||
const reads: CordisRootRead[] = []
|
||||
const record = (node: ts.Node): void => {
|
||||
reads.push({
|
||||
file: normalized,
|
||||
line: source.getLineAndCharacterOfPosition(node.getStart(source)).line + 1,
|
||||
fingerprint: syntaxFingerprint(accessOf(node), source),
|
||||
})
|
||||
}
|
||||
const visit = (node: ts.Node): void => {
|
||||
if (isErased(node)) return
|
||||
if (readsRoot(node, bindings)) record(node)
|
||||
ts.forEachChild(node, visit)
|
||||
}
|
||||
visit(source)
|
||||
return reads
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan tracked source and non-ignored new source, including tests and configuration files.
|
||||
* @param repoRoot - repository root containing the Git index.
|
||||
* @param exemptions - repository paths left unscanned, each of which must still read the root.
|
||||
* @returns every root read outside the exempt files.
|
||||
* @throws if discovery omits a required source area, an eligible path is a symlink, or an exempt
|
||||
* file is missing or no longer reads the root.
|
||||
*/
|
||||
export function scanCordisRootReads(
|
||||
repoRoot: string,
|
||||
exemptions: Readonly<Record<string, string>> = CORDIS_ROOT_EXEMPTIONS,
|
||||
): CordisRootRead[] {
|
||||
const files = listInventorySources(repoRoot, 'verify-cordis-root')
|
||||
const reads = files.flatMap(file => findCordisRootReads(file, readFileSync(resolve(repoRoot, file), 'utf8')))
|
||||
for (const file of Object.keys(exemptions)) {
|
||||
if (!reads.some(read => read.file === file)) {
|
||||
throw new Error(`verify-cordis-root: exempt file ${file} no longer reads the root context; remove its exemption`)
|
||||
}
|
||||
}
|
||||
return reads.filter(read => !Object.hasOwn(exemptions, read.file))
|
||||
}
|
||||
|
||||
function createGate(exemptions: Readonly<Record<string, string>>): InventoryGate<CordisRootRead> {
|
||||
return {
|
||||
name: 'verify-cordis-root',
|
||||
baselinePath: 'scripts/cordis-root.baseline.json',
|
||||
scan: repoRoot => scanCordisRootReads(repoRoot, exemptions),
|
||||
rejection: 'new reads of the Cordis root context are forbidden. Declare the service in `inject`,'
|
||||
+ ' register through the plugin context, or use `{ global: true }` for an unscoped listener'
|
||||
+ ' (see docs/defensive-patterns/general.md#plugins-do-not-read-the-cordis-root-context).',
|
||||
describe: read => `${read.file}:${String(read.line)} (${read.fingerprint})`,
|
||||
success: count => `verify-cordis-root: no new root reads; ${String(count)} recorded reads remain.`,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Count exact reads without granting a file-wide allowance.
|
||||
* @param reads - observed root reads.
|
||||
* @returns path and fingerprint counts in stable order for comparison and pruning.
|
||||
*/
|
||||
export function countCordisRootReads(reads: readonly CordisRootRead[]): CordisRootBaseline {
|
||||
return countInventory(reads)
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforce the recorded root-read inventory, optionally deleting retired allowances.
|
||||
* @param repoRoot - repository root to scan.
|
||||
* @param prune - remove stale entries only after establishing that no new read exists.
|
||||
* @param exemptions - repository paths left unscanned, each of which must still read the root.
|
||||
* @returns the number of recorded reads still present.
|
||||
* @throws for new reads, malformed inventories, stale entries without pruning, or stale exemptions.
|
||||
*/
|
||||
export function verifyCordisRoot(
|
||||
repoRoot: string,
|
||||
prune = false,
|
||||
exemptions: Readonly<Record<string, string>> = CORDIS_ROOT_EXEMPTIONS,
|
||||
): number {
|
||||
return verifyInventory(createGate(exemptions), repoRoot, prune)
|
||||
}
|
||||
|
||||
if (import.meta.filename === resolve(process.argv[1] ?? '')) {
|
||||
runInventoryGate(createGate(CORDIS_ROOT_EXEMPTIONS), root)
|
||||
}
|
||||
@@ -219,7 +219,7 @@ export function verifyDefaultProductIsolation(root: string): ProductIsolationRes
|
||||
failures.push(`${display(filename)}: included composition must contain an entry array`)
|
||||
return
|
||||
}
|
||||
const entries = applyEntryPatches(content as EntryOptions[], entry.config.patches as PatchOptions[] | undefined, () => {})
|
||||
const entries = applyEntryPatches(content as EntryOptions[], entry.config.patches as PatchOptions[] | undefined, () => {}).data
|
||||
scanEntries(entries, filename, true, nestedStack)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,6 +235,7 @@ describe('package dependency scope', () => {
|
||||
'@deepseek-ai/dsh-typert-protocol',
|
||||
'@deepseek-ai/dsh-util-code-language',
|
||||
'@deepseek-ai/dsh-util-crypto',
|
||||
'@deepseek-ai/dsh-util-text-search',
|
||||
'@deepseek-ai/dsh-util-values',
|
||||
])
|
||||
expect(PACKAGE_DEPENDENCY_POLICY.safeHostDependencyExports['@deepseek-ai/dsh-deque']).toEqual(['Deque'])
|
||||
@@ -242,7 +243,7 @@ describe('package dependency scope', () => {
|
||||
expect(PACKAGE_DEPENDENCY_POLICY.safeHostDependencyExports['@deepseek-ai/dsh-session/types']).toBeUndefined()
|
||||
expect(PACKAGE_DEPENDENCY_POLICY.safeHostDependencyExports['@deepseek-ai/dsh-typert-protocol']).toBeUndefined()
|
||||
expect(PACKAGE_DEPENDENCY_POLICY.peerRequiredHostExports['@deepseek-ai/dsh-scope']).toEqual([
|
||||
'carrierKeyOf', 'createScope', 'scopeOf', 'scopeTarget',
|
||||
'carrierKeyOf', 'createScope', 'scopeOf', 'scopeParentOf', 'scopeTarget',
|
||||
])
|
||||
expect(PACKAGE_DEPENDENCY_POLICY.peerRequiredHostExports['@deepseek-ai/dsh-typert-protocol']).toBeUndefined()
|
||||
expect(PACKAGE_DEPENDENCY_POLICY.peerRequiredHostExports['@deepseek-ai/dsh-experimental-translator'])
|
||||
@@ -253,7 +254,8 @@ describe('package dependency scope', () => {
|
||||
.toEqual(['generatedWorktreeName', 'CREATED_RECORD', 'createdWorktreeSchema'])
|
||||
expect(PACKAGE_DEPENDENCY_POLICY.peerRequiredHostExports['@deepseek-ai/dsh-fs']).toEqual(['FsError'])
|
||||
expect(PACKAGE_DEPENDENCY_POLICY.peerRequiredHostExports['@deepseek-ai/dsh-session'])
|
||||
.toEqual(['SESSION_FORMAT_VERSION', 'appendPluginRecord', 'pluginRecordOf'])
|
||||
.toEqual(['SESSION_FORMAT_VERSION', 'Session', 'appendPluginRecord', 'pluginRecordOf'])
|
||||
expect(PACKAGE_DEPENDENCY_POLICY.peerRequiredHostExports['@deepseek-ai/dsh-session-title']).toEqual(['normalizeSessionTitle'])
|
||||
expect(PACKAGE_DEPENDENCY_POLICY.peerRequiredHostExports['@deepseek-ai/dsh-timeout']).toEqual(['deadline', 'timeoutOf'])
|
||||
})
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@ const NO_MODEL_EXPERIENCE_SECTION: Readonly<Record<string, string>> = {
|
||||
* blocks. A package moves on or off this list with its context behavior.
|
||||
*/
|
||||
const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
|
||||
'packages/client/script-realm': { kind: 'none', reason: 'Optional browser execution-provider registration contributes no model input.' },
|
||||
'packages/client/script-realm-iframe': { kind: 'none', reason: 'Same-origin browser script environments contribute no model input.' },
|
||||
'packages/client/ui-context-menu': { kind: 'none', reason: 'Client menu presentation and contributed callbacks add no model input.' },
|
||||
'packages/client/ui-file-actions': { kind: 'none', reason: 'Explicit user file saves and clipboard operations add no model input.' },
|
||||
'packages/client/ui-entry-customization': { kind: 'none', reason: 'Controls browser launchers and prepares a reviewable Creator draft without submitting model input.' },
|
||||
@@ -69,11 +71,14 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
|
||||
'packages/experimental/voice-input-bundle': { kind: 'none', reason: 'Composes dictation and preparation plugins without adding any model-facing contribution.' },
|
||||
'packages/telemetry/otel': { kind: 'none', reason: 'The service delivers caller-selected records without changing model context.' },
|
||||
'packages/host/product-telemetry-otel': { kind: 'none', reason: 'The plugin exports explicit analytics records without contributing model context.' },
|
||||
'packages/host/authentication-token': { kind: 'none', reason: 'Launch-token exchange and Cookie verification authenticate HTTP callers without contributing model input.' },
|
||||
'packages/host/authentication-desktop': { kind: 'none', reason: 'Private Desktop credential verification authenticates HTTP callers without contributing model input.' },
|
||||
'packages/api/terminal-controller': { kind: 'indirect', reason: 'Working-directory recovery owns directory context; user terminal screens never enter model requests.' },
|
||||
'packages/client/ui-sidebar-terminal': { kind: 'none', reason: 'The browser renders user terminal screens without exposing them to the model.' },
|
||||
'packages/ssh/ssh-helper-runtime': { kind: 'none', reason: 'The private executable carrier registers no model-facing content; its providers and consumers own operation results.' },
|
||||
'packages/experimental/forge': { kind: 'none', reason: 'Providers and watchers exchange code host status without contributing model context.' },
|
||||
'packages/experimental/forge-github': { kind: 'none', reason: 'The provider reads pull request status for host-side watchers without contributing model context.' },
|
||||
'packages/experimental/forge-gitlab': { kind: 'none', reason: 'The provider reads merge request status for host-side watchers without contributing model context.' },
|
||||
'packages/experimental/client-ui-forge': { kind: 'indirect', reason: 'Switching a Session directory from the panel reaches the model through the working-directory notice; inspection and status stay on the host.' },
|
||||
'packages/experimental/forge-bundle': { kind: 'indirect', reason: 'The worktree tool and panel own the model-visible schemas, results, and directory notices selected by the bundle.' },
|
||||
'packages/experimental/forge-session': { kind: 'none', reason: 'Bindings, discovery records, and polled status stay on the host; binding records never enter model requests.' },
|
||||
@@ -88,7 +93,7 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
|
||||
'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-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/account/deepseek-account': { kind: 'none', reason: 'Account authorization registers no model context or tools; credentials affect HTTP authentication only.' },
|
||||
'packages/client/ui-settings-account': { kind: 'none', reason: 'Account authorization registers no model context or tools; credentials affect HTTP authentication only.' },
|
||||
'packages/client/ui-account-notifications': { kind: 'none', reason: 'Account notification presentation and polling add no model input or Session events.' },
|
||||
|
||||
@@ -96,6 +101,7 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
|
||||
'packages/attachment/attachment-local': { kind: 'indirect', reason: 'The local backend delegates model request rendering to provider adapters.' },
|
||||
'packages/mcp/mcp-manager': { kind: 'indirect', reason: 'The manager only mounts and disposes dsh-mcp-client instances; those instances own every model-facing tool and schema.' },
|
||||
'packages/client/ui-jobs': { kind: 'none', reason: 'Browser-side presentation of host-observed output; touches no prompt, message, schema, stream, or tool result.' },
|
||||
'packages/client/ui-session-panel': { kind: 'none', reason: 'Browser-side summary of Session facts the Client already holds; touches no prompt, message, schema, stream, or tool result.' },
|
||||
'packages/shell/shell': { kind: 'indirect', reason: 'The service interface delegates all model rendering to dsh-tool-bash.' },
|
||||
'packages/shell/shell-env': { kind: 'indirect', reason: 'The env service exposes managed DSH_* facts through the shell tools (dsh-tool-bash/dsh-tool-pwsh); it registers no prompt or schema of its own.' },
|
||||
'packages/shell/bash-local': { kind: 'indirect', reason: 'The executor backend delegates model rendering to dsh-tool-bash.' },
|
||||
@@ -104,6 +110,7 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
|
||||
'packages/core/agent-tool-presentation': { kind: 'indirect', reason: 'The row only selects between the two projections dsh-tools owns; it registers no prompt, schema, or result of its own.' },
|
||||
'packages/ptc-runtime/ptc-runtime-node': { kind: 'indirect', reason: 'The Node process backend delegates model rendering to PTC mode in dsh-tools.' },
|
||||
'packages/client/ui-agent-preset': { kind: 'indirect', reason: 'Browser-side settings row; the preset it selects owns every model-facing effect.' },
|
||||
'packages/util/text-search': { kind: 'none', reason: 'Filters caller-owned in-memory lists for UI search boxes; registers nothing model-facing.' },
|
||||
'packages/util/crypto': { kind: 'indirect', reason: 'Pure identifier minting; the ids consumers mint with it never enter prompts as semantic content.' },
|
||||
'packages/util/deque': { kind: 'none', reason: 'In-process collection primitive; registers nothing model-facing.' },
|
||||
'packages/deliverables/workspace-changes': { kind: 'none', reason: 'The recorder appends a log-only Session event that only clients read; it registers nothing model-facing.' },
|
||||
@@ -135,7 +142,7 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
|
||||
'packages/client/store': { kind: 'none', reason: 'Browser-side state primitives; register nothing model-facing.' },
|
||||
'packages/client/ui-renderer': { kind: 'none', reason: 'Browser-side render assembly; registers nothing model-facing.' },
|
||||
'packages/client/ui-session': { kind: 'none', reason: 'Browser-side Session adapter; registers nothing model-facing.' },
|
||||
'packages/client/ui-session-status': { kind: 'none', reason: 'Browser-side Session status table; registers nothing model-facing.' },
|
||||
'packages/client/ui-session-status': { kind: 'none', reason: 'Owner reading records and the Client Session status table add no tools, prompts, or Session events.' },
|
||||
'packages/client/connection': { kind: 'none', reason: 'Browser-side UI plugin layer; registers nothing model-facing.' },
|
||||
'packages/client/file-upload': { kind: 'none', reason: 'Browser-side request-body transport; registers nothing model-facing.' },
|
||||
'packages/api/remotes': { kind: 'none', reason: 'The Remote BFF selects business methods and forwarded events; selected services own any model-visible effect.' },
|
||||
@@ -163,7 +170,6 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
|
||||
'packages/client/ui-goal': { kind: 'indirect', reason: 'The strip verbs route goal.* mutations; the host GoalService owns the model-visible goal/change context message.' },
|
||||
'packages/extensions/ui-cordis': { kind: 'indirect', reason: 'The definition card drives the host dynamic run/stop verbs that the model\'s cordis_run/cordis_stop tools also reach; the runner owns any model-visible effect.' },
|
||||
'packages/client/ui-permission-presets': { kind: 'indirect', reason: 'The picker submits the host /permission command; the knob events it appends own the model-visible effect through the sandbox/approval consumers.' },
|
||||
'packages/client/ui-settings-plugins': { kind: 'none', reason: 'Browser-side settings surface; registers no model surface.' },
|
||||
'packages/client/ui-settings-shell': { kind: 'none', reason: 'Browser-side settings surface; registers no model surface.' },
|
||||
'packages/client/ui-settings-session-log': { kind: 'none', reason: 'Browser preference controls request metadata, not model input.' },
|
||||
'packages/client/ui-settings-agent-loop': { kind: 'none', reason: 'Browser-side settings surface; registers no model surface.' },
|
||||
@@ -185,7 +191,6 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
|
||||
'packages/client/ui-settings-models': { kind: 'none', reason: 'Browser-side UI plugin layer; registers nothing model-facing.' },
|
||||
'packages/client/ui-plugin-market': { kind: 'none', reason: 'Browser-side Discover tab; registers nothing model-facing.' },
|
||||
'packages/client/ui-plugin-manager': { kind: 'none', reason: 'Browser-side management surface; registers nothing model-facing.' },
|
||||
'packages/client/ui-settings-plugin-inventory': { kind: 'none', reason: 'Browser-side inventory projection; registers nothing model-facing.' },
|
||||
'packages/client/locale': { kind: 'none', reason: 'Browser-side UI plugin layer; registers nothing model-facing.' },
|
||||
'packages/client/web': { kind: 'none', reason: 'Browser-side UI plugin layer; registers nothing model-facing.' },
|
||||
'packages/context/file-reference': { kind: 'indirect', reason: 'The discovery seam and grammar delegate model guidance to the composed provider.' },
|
||||
|
||||
@@ -179,7 +179,7 @@ export function verifyProductUse(
|
||||
const content: unknown = existsSync(filename) ? loadCordisYaml(readFileSync(filename, 'utf8')) : row.config.initial
|
||||
configs.add(filename)
|
||||
if (!Array.isArray(content)) { failures.push(`${display(filename)}: Include requires an entry array or initial entries`); continue }
|
||||
const entries = applyEntryPatches(content as EntryOptions[], row.config.patches as PatchOptions[] | undefined, () => {})
|
||||
const entries = applyEntryPatches(content as EntryOptions[], row.config.patches as PatchOptions[] | undefined, () => {}).data
|
||||
scanEntries(entries, filename, reach, new Set([...stack, filename]))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { dirname, join, resolve } from 'node:path'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { loadCordisYaml } from './cordis-yaml.ts'
|
||||
import { verifyRuntimeClosure } from './verify-runtime-closure.ts'
|
||||
@@ -39,6 +39,11 @@ afterEach(() => {
|
||||
})
|
||||
|
||||
describe('verifyRuntimeClosure', () => {
|
||||
it('supplies required workspace peers of the Electron production dependency tree', async () => {
|
||||
const root = resolve(import.meta.dirname, '..')
|
||||
expect((await verifyRuntimeClosure(root, 'apps/desktop/package.json', false)).failures).toEqual([])
|
||||
})
|
||||
|
||||
it('checks a private worker closure without requiring application presets', async () => {
|
||||
const manifestPath = 'packages/ssh/ssh-helper-runtime/package.json'
|
||||
const root = fixture({ [manifestPath]: { name: 'helper', dependencies: { '@scope/worker': 'workspace:^' } } })
|
||||
|
||||
Reference in new issue
Block a user