Merge master and reconcile declarative presets with activations

This commit is contained in:
Dudu-0223 committed 2026-09-21 16:41:53 +08:00
commit 307c75011b
297 files changed
+4130 -11916

No files matched your search

+2 -2
View File
@@ -168,8 +168,8 @@ const packageFileExtras: Readonly<Record<string, readonly string[]>> = {
'@deepseek-ai/dsh-ptc-runtime-node': ['lib/process.js'],
// The Host entry starts its sibling Worker by URL rather than a package export.
'@deepseek-ai/dsh-experimental-inspector': ['lib/worker.js'],
// The shipped preset compositions travel inside the roster package.
'@deepseek-ai/dsh-agent-presets': ['presets'],
// Creator's composition guidance travels with the declaration package.
'@deepseek-ai/dsh-agent-preset': ['skills'],
// The Web Host mounts the default-off settings owner independently of each
// Agent-scoped delegation-tool instance.
'@deepseek-ai/dsh-tool-subagent': ['lib/model-selection-settings.js'],
+24
View File
@@ -52,3 +52,27 @@ export function isCordisGroupEntry(value: unknown): value is Record<string, unkn
&& ((value as Record<string, unknown>).group === true
|| (value as Record<string, unknown>).name === '@deepseek-ai/cordis-plugin-group')
}
/** Test whether an entry declares an Agent preset with a child plugin list.
* @param value Parsed Loader entry.
* @returns Whether config.plugins contains nested entries owned by a preset.
*/
export function isAgentPresetEntry(value: unknown): value is Record<string, unknown> & { config: { id: string; plugins: unknown[] } } {
if (typeof value !== 'object' || value === null) return false
const row = value as Record<string, unknown>
if (row.name !== '@deepseek-ai/dsh-agent-preset' || typeof row.config !== 'object' || row.config === null) return false
const config = row.config as Record<string, unknown>
return typeof config.id === 'string' && Array.isArray(config.plugins)
}
/** Read preset definitions nested in ordinary groups and patch insertions.
* @param value Parsed Cordis YAML.
* @returns Declared identities and child configurations in document order.
*/
export function presetDefinitions(value: unknown): { id: string; plugins: unknown[] }[] {
if (Array.isArray(value)) return value.flatMap(presetDefinitions)
if (isAgentPresetEntry(value)) return [value.config]
if (typeof value !== 'object' || value === null) return []
const row = value as Record<string, unknown>
return [...presetDefinitions(row.insert), ...(isCordisGroupEntry(row) ? presetDefinitions(row.config) : [])]
}
+12 -12
View File
@@ -809,9 +809,9 @@
"@deepseek-ai/dsh-tools": "^0.1.5-rc.2"
}
},
"node_modules/@deepseek-ai/dsh-agent-presets": {
"node_modules/@deepseek-ai/dsh-agent-preset-registry": {
"version": "0.1.5-rc.2",
"resolved": "https://registry.npmjs.org/@deepseek-ai/dsh-agent-presets/-/dsh-agent-presets-0.1.5-rc.2.tgz",
"resolved": "https://registry.npmjs.org/@deepseek-ai/dsh-agent-preset-registry/-/dsh-agent-presets-0.1.5-rc.2.tgz",
"integrity": "sha512-h0j7IfuHPYh/oJR7SDxh6pzSgUeaHwaaAIg5X0RNL6Z2oQrq0oUmjtArCVVw7nkgt48DjdBwx4EwJ9IdNrHxug==",
"license": "MIT",
"dependencies": {
@@ -908,7 +908,7 @@
"@deepseek-ai/cordis": "^4.0.2",
"@deepseek-ai/dsh-agent": "^0.1.5-rc.2",
"@deepseek-ai/dsh-agent-default-model": "^0.1.5-rc.2",
"@deepseek-ai/dsh-agent-presets": "^0.1.5-rc.2",
"@deepseek-ai/dsh-agent-preset-registry": "^0.1.5-rc.2",
"@deepseek-ai/dsh-api-gateway": "^0.1.5-rc.2",
"@deepseek-ai/dsh-attachment": "^0.1.5-rc.2",
"@deepseek-ai/dsh-client-connection": "^0.1.5-rc.2",
@@ -958,7 +958,7 @@
},
"peerDependencies": {
"@deepseek-ai/cordis": "^4.0.2",
"@deepseek-ai/dsh-agent-presets": "^0.1.5-rc.2",
"@deepseek-ai/dsh-agent-preset-registry": "^0.1.5-rc.2",
"@deepseek-ai/dsh-credentials": "^0.1.5-rc.2",
"@deepseek-ai/dsh-native-command": "^0.1.5-rc.2",
"@deepseek-ai/dsh-session": "^0.1.5-rc.2",
@@ -2196,12 +2196,12 @@
"peerDependencies": {
"@deepseek-ai/cordis": "^4.0.2",
"@deepseek-ai/cordis-plugin-loader": "^1.0.3",
"@deepseek-ai/dsh-agent-presets": "^0.1.5-rc.2",
"@deepseek-ai/dsh-agent-preset-registry": "^0.1.5-rc.2",
"@deepseek-ai/dsh-brand": "^0.1.5-rc.2",
"@deepseek-ai/dsh-typert-protocol": "^0.1.5-rc.2"
},
"peerDependenciesMeta": {
"@deepseek-ai/dsh-agent-presets": {
"@deepseek-ai/dsh-agent-preset-registry": {
"optional": true
}
}
@@ -2511,12 +2511,12 @@
"@deepseek-ai/cordis": "^4.0.2",
"@deepseek-ai/cordis-plugin-loader": "^1.0.3",
"@deepseek-ai/dsh-agent": "^0.1.5-rc.2",
"@deepseek-ai/dsh-agent-presets": "^0.1.5-rc.2",
"@deepseek-ai/dsh-agent-preset-registry": "^0.1.5-rc.2",
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "^0.1.5-rc.2",
"@deepseek-ai/dsh-session": "^0.1.5-rc.2"
},
"peerDependenciesMeta": {
"@deepseek-ai/dsh-agent-presets": {
"@deepseek-ai/dsh-agent-preset-registry": {
"optional": true
}
}
@@ -3376,7 +3376,7 @@
"peerDependencies": {
"@deepseek-ai/cordis": "^4.0.2",
"@deepseek-ai/dsh-agent": "^0.1.5-rc.2",
"@deepseek-ai/dsh-agent-presets": "^0.1.5-rc.2",
"@deepseek-ai/dsh-agent-preset-registry": "^0.1.5-rc.2",
"@deepseek-ai/dsh-attachment": "^0.1.5-rc.2",
"@deepseek-ai/dsh-invariants": "^0.1.5-rc.2",
"@deepseek-ai/dsh-jobs": "^0.1.5-rc.2",
@@ -3396,7 +3396,7 @@
"@deepseek-ai/dsh-util-time": "^0.1.5-rc.2"
},
"peerDependenciesMeta": {
"@deepseek-ai/dsh-agent-presets": {
"@deepseek-ai/dsh-agent-preset-registry": {
"optional": true
},
"@deepseek-ai/dsh-jobs": {
@@ -4118,7 +4118,7 @@
"integrity": "sha512-Ng7YVDt9txh2BlLmu6B+V677c1bihbh/rq3EOtZK4b0JWtgdNgYb1KPIED8+aK2i+FghrCrIy6X60AyJ45eOvw==",
"license": "MIT",
"dependencies": {
"@deepseek-ai/dsh-agent-presets": "^0.1.5-rc.2",
"@deepseek-ai/dsh-agent-preset-registry": "^0.1.5-rc.2",
"@deepseek-ai/dsh-api-remotes": "^0.1.5-rc.2",
"@deepseek-ai/dsh-api-session-controller": "^0.1.5-rc.2",
"@deepseek-ai/dsh-api-settings-controller": "^0.1.5-rc.2",
@@ -4260,7 +4260,7 @@
"@deepseek-ai/cordis": "^4.0.2",
"@deepseek-ai/dsh-agent": "^0.1.5-rc.2",
"@deepseek-ai/dsh-agent-default-model": "^0.1.5-rc.2",
"@deepseek-ai/dsh-agent-presets": "^0.1.5-rc.2",
"@deepseek-ai/dsh-agent-preset-registry": "^0.1.5-rc.2",
"@deepseek-ai/dsh-invariants": "^0.1.5-rc.2",
"@deepseek-ai/dsh-llm": "^0.1.5-rc.2",
"@deepseek-ai/dsh-permission-presets": "^0.1.5-rc.2",
+7 -5
View File
@@ -805,11 +805,13 @@ export const TYPE_LINK_EXEMPTIONS: Readonly<Record<string, string>> = {
ConsumeTokenRequest: 'event-local request contract is owned by packages/client/ui-input-trigger/src/types.ts',
InsertTextRequest: 'event-local request contract is owned by packages/client/ui-input-trigger/src/types.ts',
AgentHandle: 'agent ownership handle is owned by packages/core/agent/README.md',
AgentPreset: 'discovered preset record is owned by packages/preset/agent-presets/README.md',
AgentPresetRoster: 'path-free preset roster is owned by packages/preset/agent-presets/README.md',
AgentPresetDocument: 'preset composition view is owned by packages/preset/agent-presets/README.md',
AgentPresetComposition: 'flattened composition rows are owned by packages/preset/agent-presets/README.md',
PresetMetadata: 'preset display text is owned by packages/preset/agent-presets/README.md',
AgentPreset: 'discovered preset record is owned by packages/preset/agent-preset-registry/README.md',
AgentPresetRoster: 'path-free preset roster is owned by packages/preset/agent-preset-registry/README.md',
PresetDefinition: 'declarative configuration is owned by packages/preset/agent-preset/README.md',
AsyncDisposable: 'TypeScript explicit resource management interface',
AgentPresetDocument: 'preset composition view is owned by packages/preset/agent-preset-registry/README.md',
AgentPresetComposition: 'flattened composition rows are owned by packages/preset/agent-preset-registry/README.md',
PresetMetadata: 'preset display text is owned by packages/preset/agent-preset-registry/README.md',
BashEnvContributor: 'service-local extension type is owned by packages/shell/tool-bash/src/index.ts',
BashEnvVariableInfo: 'service-local metadata type is owned by packages/shell/tool-bash/src/index.ts',
CompactionAgentContext: 'compaction service input is owned by packages/compaction/compaction/src/index.ts',
+2 -2
View File
@@ -487,10 +487,10 @@ const SERVICE_ROLES: ServiceRole[] = [
},
{
key: 'agentPresets',
pkg: 'agent-presets',
pkg: 'agent-preset-registry',
title: 'Per-session agent composition',
mode: 'core',
note: 'Discovers preset directories over trusted and user-authored roots and mounts one preset cordis.yml under an agent scope during creation, rejecting a row that never activates or that publishes into the root service realm.',
note: 'Eagerly mounts YAML-declared preset revisions, binds Agents and cold readers to scoped contributions, and retains retired revisions until their last user releases them.',
},
{
key: 'commands',
+7 -22
View File
@@ -312,10 +312,7 @@
"dc2f3b946d1994a23ad82426c87326a6c50a477719f9ae1b4687087522d9571b": 1
},
"packages/api/settings-controller/tests/settings-controller.host.spec.ts": {
"078036e2d4c406a7566edc7e7679a7acf05576e3a54324bca6fc55740f4715ac": 1,
"378e52325f972299c6e61e0393a39b49090f20d350a8030c32ae17b0c2360bbc": 1,
"5855fa729ec1c783472f8a842ed103e826af49a2804fa354965dd0e217802ba1": 1,
"ca53e010b333d3647e44212c1c86176d08215216696a7e6c0396431af06634f1": 1
"378e52325f972299c6e61e0393a39b49090f20d350a8030c32ae17b0c2360bbc": 1
},
"packages/api/terminal-controller/src/index.ts": {
"04bc8a44533574365dfedf563e2356458bcf95f990a00906938c977c1d683356": 2
@@ -464,21 +461,18 @@
},
"packages/client/ui-agent-preset/tests/apply.client.spec.ts": {
"5c8c41ba658c0576bea6c34b1226c27e7b0328c03c9eea0d6c920f940c9d8f5b": 1,
"b2fb53c6878d75d54e2d39be30f77cd5e08810261e513fe15f3d687e2313fbd7": 2,
"b2fb53c6878d75d54e2d39be30f77cd5e08810261e513fe15f3d687e2313fbd7": 1,
"c2369bc12a9476816900a58b06dd52c2f53bc92658559a076cdd70ae3d15f30b": 9,
"c595e4648d474f3a9538ab1e2140c25255bb4675c6e7bae8043adf9158915b69": 13,
"c595e4648d474f3a9538ab1e2140c25255bb4675c6e7bae8043adf9158915b69": 10,
"ddca8a18cd7755688ea48674c48c3c8a6107186815ea91f516424bbed0e1c518": 1
},
"packages/client/ui-agent-preset/tests/components.client.spec.tsx": {
"0df95ae2a37a0b3403599b7478d4d59fa2611cb1189b67e8b3fd0f4fcbf500e1": 1,
"6c63f71c0aeb1a9a97ec28a3242f77eef021ecfcee48238f17592eb2f1040c09": 1
},
"packages/client/ui-agent-preset/tests/section-store.client.spec.ts": {
"23e04af2a900d7a905ff7657de842e9833384a2d4c4afba33964477e43d8ba52": 1
},
"packages/client/ui-agent-preset/tests/settings-store.client.spec.ts": {
"c0e852e6b0e2a8a040b65723f8ab1d650d9cb06c26be7f3a0709ddb9f7525595": 1,
"d6a04d954aef7a8edd403910851015c0ce1597f6f300292b5158a8bf993fc1d8": 1
"74d9d12b6f146dcd600e84c9fde4d8e9e3d4e66aa485cc598ef4e763188b0eac": 1,
"8dc4dd33a728f8be87bedb987dacefe36155443f0d2e0cc58da9716947d85920": 1
},
"packages/client/ui-approval/tests/ui-approval.client.spec.tsx": {
"3e392ff0165a51a6ac716515b99af35ec152f89607cff72080cb9afbcff63f46": 1,
@@ -690,9 +684,9 @@
"85f4d0d762126e709ae2178ca656f586dac1ba425eb1d8dd402cb5577d6e8225": 1
},
"packages/client/ui-settings-plugin-inventory/tests/components.client.spec.tsx": {
"3b5c341b13167d33532f21cc09380de90c5c488a3d3869f91b6381fee5394134": 1,
"0d78ec7c8ca39f70a4033ff4d330f8ef26832bb89932f98d1c87d76b4ce16d00": 1,
"79c53da50aa08004e201cebca842267ae2650a543b435a7906960f6492c2398b": 1,
"cce779b3f60ebbadd524376047258bfbcbf362abab0496f65306b0835026dc89": 1
"a3c1509d552d0102e118f3071a234002a5c83c30ca6923f8a87e9e3733ce0dcf": 1
},
"packages/client/ui-settings-plugins/tests/apply.client.spec.ts": {
"3d455f54ba188122f29085e9d462bebbca24c517057052f346229efd175e6e3c": 1
@@ -1587,15 +1581,6 @@
"d2c3345795169400442563b4923671c090a724eacaaae7f0c190297b967c1c4d": 1,
"dfa30a521aae411e70eee81fc4c0511178589d0656dea01c1c97131bfe097793": 1
},
"packages/preset/agent-presets/tests/composition-inventory.spec.ts": {
"d605b1b21956ba1f53673edb27c22a40631b6d1af18286ae1d0cf81c5ce1ea8b": 1
},
"packages/preset/agent-presets/tests/mount.spec.ts": {
"92cb9ce1fc5e337381501a17571425bff9c50e31b92c9a8c2460976b652d6283": 3
},
"packages/preset/agent-presets/tests/user-root.spec.ts": {
"4b091634b70445a68ff23a94065070b1c0b75a68712b1813bf417120a174422d": 1
},
"packages/ptc-runtime/ptc-runtime-node/tests/host-failures.spec.ts": {
"aa5de2d4958ec64219565d53ec5a9d7f40f1f60037a2d52d1a9c3c65db034d73": 1,
"be027af1ef5cb3bfe41eeb19b54dbb176ec7c23ae367d709059839f9851833d5": 1
+3 -10
View File
@@ -82,12 +82,11 @@ const GENERIC_SKIPS: readonly GenericSkip[] = [
{ file: 'vendor/loader/src/config/diff.ts', upstream: ['schemastery'] },
// Asserts the vendored-manifest table, which gains an upstream-name column.
{ file: 'scripts/gen-third-party-notices.spec.ts', upstream: RENAMES.map(rename => rename.upstream) },
// `cordis` is also an agent-preset id — the directory name under
// packages/preset/agent-presets/presets/ — so in these files the bare name is
// `cordis` is also an agent-preset id, so in these files the bare name is
// product data, not a package reference. Renaming it changed which preset
// the creator flow stages and which id the roster reports.
{ file: 'packages/client/ui-agent-preset/src/client/AgentPresetSection.tsx', upstream: ['cordis'] },
{ file: 'packages/preset/agent-presets/tests/shipped-root.spec.ts', upstream: ['cordis'] },
{ file: 'packages/client/ui-agent-preset/src/client/PresetGuideDialog.tsx', upstream: ['cordis'] },
{ file: 'packages/client/ui-agent-preset/src/client/index.ts', upstream: ['cordis'] },
{ file: 'packages/client/ui-agent-preset/tests/apply.client.spec.ts', upstream: ['cordis'] },
{ file: 'packages/client/ui-agent-preset/tests/locales.client.spec.ts', upstream: ['cordis'] },
@@ -95,11 +94,7 @@ 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: 'packages/preset/agent-presets/tests/session.spec.ts', upstream: ['cordis'] },
// The preset's own composition: its header comment and its system prompt name
// the preset a model mounts, so the scoped name would send the model after an
// id no roster reports.
{ file: 'packages/preset/agent-presets/presets/cordis/agent.cordis.yml', upstream: ['cordis'] },
{ file: 'packages/preset/agent-preset-registry/tests/session.spec.ts', upstream: ['cordis'] },
// The preset-roster loop names the `cordis` preset id, not a package.
{ file: 'apps/cli/tests/windows-shell.spec.ts', upstream: ['cordis'] },
// GROUP_ORDER holds `packages/<group>/` directory names, not package names.
@@ -164,8 +159,6 @@ const POSTCONDITIONS: readonly PostCondition[] = [
// The preset ids in this table are product data, not package names.
{ file: 'packages/client/ui-agent-preset/tests/locales.client.spec.ts', text: '[\'cordis\', \'presetCordisName\'', count: 1 },
// The preset id the shipped composition documents to its own model.
{ file: 'packages/preset/agent-presets/presets/cordis/agent.cordis.yml', text: 'The `cordis` agent preset', count: 1 },
{ file: 'packages/preset/agent-presets/presets/cordis/agent.cordis.yml', text: 'corrupting the `cordis` preset', count: 1 },
]
/**
@@ -14,6 +14,7 @@ const SHIPPED_CONFIG_GLOBS = [
'apps/*/config/**/*.yml',
// Bundle identity comes from the package manifest, not the domain directory.
'packages/*/*/cordis.patch.yml',
'packages/*/*/presets/*.patch.yml',
// The Python runtime ships its own default composition inside the wheel.
'python/*/src/**/cordis.yml',
]
+30 -19
View File
@@ -15,9 +15,9 @@ import { dirname, relative, resolve } from 'node:path'
import { Script } from 'node:vm'
import ts from 'typescript'
import type { DshBundleManifest } from '../packages/util/package-manifest/src/types.ts'
import { bundlePatchPaths } from '../packages/boot/app-boot/src/profile.ts'
import { bundlePatchFiles, bundlePatchPaths } from '../packages/boot/app-boot/src/profile.ts'
import { cordisConfigFiles } from './cordis-config-files.ts'
import { isCordisGroupEntry, isJsExpr, loadCordisYaml } from './cordis-yaml.ts'
import { isAgentPresetEntry, presetDefinitions, isCordisGroupEntry, isJsExpr, loadCordisYaml } from './cordis-yaml.ts'
export interface PackageManifest {
name?: string
@@ -138,25 +138,28 @@ function validateClientHalvesDeclared(): string[] {
*/
function validatePresetPlaneSeparation(): string[] {
const problems: string[] = []
// The shipped Web surface is two bundle patch layers over an empty root.
// The shipped Web surface is two bundle layers over an empty root; the web
// layer is its host patch followed by one patch file per shipped preset.
const hostFile = 'packages/bundle/base/cordis.patch.yml'
const overlayFile = 'packages/bundle/web-app/cordis.patch.yml'
const hostRows = rowIds(hostFile)
const overlay = loadEntries(overlayFile)
const overlayDir = 'packages/bundle/web-app'
const overlayManifest = JSON.parse(readFileSync(resolve(root, overlayDir, 'package.json'), 'utf8')) as { dsh: { bundle: DshBundleManifest } }
const overlayFiles = bundlePatchFiles(overlayManifest.dsh.bundle).map(file => `${overlayDir}/${file.replace(/^\.\//, '')}`)
const disabled = new Set<string>()
for (const entry of overlay) {
if (!isRecord(entry)) continue
if (entry.disabled === true && typeof entry.id === 'string') disabled.add(entry.id)
const overlayRows = new Set<string>()
for (const file of overlayFiles) {
for (const entry of loadEntries(file)) {
if (!isRecord(entry)) continue
if (entry.disabled === true && typeof entry.id === 'string') disabled.add(entry.id)
}
for (const id of rowIds(file)) overlayRows.add(id)
}
// The overlay's own inserts are host-plane too; its disables take them back out.
const active = new Set([...hostRows, ...rowIds(overlayFile)].filter(id => !disabled.has(id)))
for (const file of globSync('packages/preset/agent-presets/presets/*/agent.cordis.yml', { cwd: root })) {
for (const id of rowIds(file)) {
if (!active.has(id)) continue
problems.push(
`${file}: row "${id}" is also active in the host composition; `
+ 'a row belongs to exactly one plane',
)
const active = new Set([...rowIds(hostFile), ...overlayRows].filter(id => !disabled.has(id)))
for (const file of overlayFiles) {
for (const definition of presetDefinitions(loadEntries(file))) {
for (const id of collectRowIds(definition.plugins)) {
if (active.has(id)) problems.push(`${file}#${definition.id}: row "${id}" is also active in the host composition; a row belongs to exactly one plane`)
}
}
}
return problems
@@ -175,6 +178,10 @@ function loadEntries(file: string): unknown[] {
* @returns the declared ids.
*/
function rowIds(file: string): Set<string> {
return collectRowIds(loadEntries(file))
}
function collectRowIds(rows: unknown): Set<string> {
const ids = new Set<string>()
const walk = (value: unknown): void => {
if (isUnknownArray(value)) {
@@ -183,9 +190,10 @@ function rowIds(file: string): Set<string> {
}
if (!isRecord(value)) return
if (typeof value.id === 'string' && typeof value.name === 'string') ids.add(value.id)
for (const child of Object.values(value)) walk(child)
walk(value.insert)
if (isCordisGroupEntry(value)) walk(value.config)
}
walk(loadEntries(file))
walk(rows)
return ids
}
@@ -201,6 +209,9 @@ function validateEntry(value: unknown, file: string, path: string): void {
validateEntry(value.config[index], file, `${path}.config[${index}]`)
}
}
if (isAgentPresetEntry(value)) {
for (let index = 0; index < value.config.plugins.length; index++) validateEntry(value.config.plugins[index], file, `${path}.config.plugins[${index}]`)
}
if (isUnknownArray(value.insert)) {
for (let index = 0; index < value.insert.length; index++) {
validateEntry(value.insert[index], file, `${path}.insert[${index}]`)
@@ -12,7 +12,7 @@ const experimental = '@deepseek-ai/dsh-experimental-prototype'
const core = '@deepseek-ai/dsh-core'
const base = '@deepseek-ai/dsh-base'
const profile = 'packages/boot/app-boot/src/profile.ts'
const preset = 'packages/preset/agent-presets/presets/standard/agent.cordis.yml'
const preset = 'packages/bundle/web-app/presets/standard.patch.yml'
const patch = 'packages/bundle/base/cordis.patch.yml'
function write(root: string, path: string, value: unknown): void {
@@ -39,7 +39,8 @@ function fixture(): string {
write(root, 'packages/core/core/src/index.ts', 'export {}\n')
write(root, 'packages/bundle/base/package.json', { name: base, dsh: { bundle: { patch: './cordis.patch.yml' } } })
write(root, patch, [{ insert: [{ name: core }] }])
write(root, preset, [{ name: core }])
write(root, preset, [{ insert: [{ name: '@deepseek-ai/dsh-agent-preset', config: { id: 'standard', plugins: [{ name: core }] } }] }])
write(root, 'packages/preset/agent-preset/package.json', { name: '@deepseek-ai/dsh-agent-preset' })
write(root, profile, `export const PROFILE_TEMPLATES = { web: { bundles: ['${base}'] } }\n`
+ `export const DEFAULT_PROFILE_BUNDLES = ['${base}']\n`)
write(root, 'packages/experimental/prototype/package.json', { name: experimental })
@@ -79,7 +80,7 @@ describe('default product isolation', () => {
write(root, 'apps/web/src/preview.ts', `import '${experimental}'\n`)
write(root, 'packages/experimental/prototype/cordis.patch.yml', [{ name: experimental }])
expect(verifyDefaultProductIsolation(root)).toMatchObject({ failures: [], packageCount: 5, configCount: 2 })
expect(verifyDefaultProductIsolation(root)).toMatchObject({ failures: [], packageCount: 6, configCount: 2 })
})
it('ignores dependency trees and directories whose names end in a source extension', () => {
@@ -101,7 +102,7 @@ describe('default product isolation', () => {
write(root, profile, `export const PROFILE_TEMPLATES = { web: { bundles: ['${base}'] } }\n`
+ `export const DEFAULT_PROFILE_BUNDLES = ['${base}']\n`
+ `export const OPTIONAL_BUNDLES = ['${layer}']\n`)
expect(verifyDefaultProductIsolation(root)).toMatchObject({ failures: [], packageCount: 5 })
expect(verifyDefaultProductIsolation(root)).toMatchObject({ failures: [], packageCount: 6 })
// The exception covers the dependency edge alone: a runtime import or a default template still names the product.
write(root, 'apps/cli/src/bin.ts', `import '${layer}'\n`)
+3 -2
View File
@@ -14,7 +14,7 @@ import type { EntryOptions } from '@deepseek-ai/cordis-plugin-loader'
import { loadOverlayPatches } from '../packages/boot/app-boot/src/index.ts'
import { bundlePatchPaths, composeEntries } from '../packages/boot/app-boot/src/profile.ts'
import type { DshBundleManifest } from '../packages/util/package-manifest/src/types.ts'
import { isCordisGroupEntry, loadCordisYaml } from './cordis-yaml.ts'
import { isAgentPresetEntry, isCordisGroupEntry, loadCordisYaml } from './cordis-yaml.ts'
import {
collectRuntimeLocalSourceSpecifiers,
collectRuntimeSourceSpecifiers,
@@ -24,7 +24,7 @@ const EXPERIMENTAL_PREFIX = '@deepseek-ai/dsh-experimental-'
// The independently published entry package owns platform-engine dependencies.
const EXTERNAL_KIT_PACKAGES = new Set(['@deepseek-ai/libreoffice-kit'])
const PROFILE_SOURCE = 'packages/boot/app-boot/src/profile.ts'
const PRESET_PATTERN = 'packages/preset/agent-presets/presets/*/agent.cordis.yml'
const PRESET_PATTERN = 'packages/bundle/web-app/presets/*.patch.yml'
const RUNTIME_SECTIONS = ['dependencies', 'optionalDependencies', 'peerDependencies'] as const
interface Manifest {
@@ -186,6 +186,7 @@ export function verifyDefaultProductIsolation(root: string): ProductIsolationRes
if (isCordisGroupEntry(entry) || entry.name === 'cordis:group' && Array.isArray(entry.config)) {
(entry.config as unknown[]).forEach(visit)
}
if (isAgentPresetEntry(entry)) entry.config.plugins.forEach(visit)
if (Array.isArray(entry.insert)) entry.insert.forEach(visit)
if ((entry.name === '@deepseek-ai/cordis-plugin-include' || entry.name === 'cordis:include') && isRecord(entry.config)) {
if (!composedWeb && Array.isArray(entry.config.patches)) entry.config.patches.forEach(visit)
@@ -80,7 +80,7 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
'packages/util/time': { kind: 'indirect', reason: 'Pure zone validation; the consumer that records a canonical zone owns the model-visible line derived from it.' },
'packages/core/agent-default-model': { kind: 'indirect', reason: 'The service supplies a ModelSelection; request assembly and adapters own the model-visible request.' },
'packages/llm/deepseek-llm-api-extensions': { kind: 'indirect', reason: 'The registry contributes model-hidden provider fields; dsh-llm-deepseek owns their wire placement.' },
'packages/preset/agent-presets': { kind: 'indirect', reason: 'The mount installs a preset\'s own plugins, which own every model-facing registration it makes visible.' },
'packages/preset/agent-preset': { kind: 'indirect', reason: 'The declaration selects plugins that own model-visible contributions.' },
'packages/typert/registry': { kind: 'none', reason: 'Runtime type registry; consumers (cordis_inspect, wire faces, gates) own any model-visible projection of registry contents.' },
'packages/typert/loader': { kind: 'none', reason: 'Loader integration only registers generated artifacts; consumers own any model-visible projection.' },
'packages/util/http-proxy': { kind: 'none', reason: 'Transport policy only: it changes how bytes reach the network and registers no prompt, schema, or result text.' },
+11 -9
View File
@@ -2,6 +2,7 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { dirname, join } from 'node:path'
import { afterEach, describe, expect, it } from 'vitest'
import { loadCordisYaml } from './cordis-yaml.ts'
import { verifyRuntimeClosure } from './verify-runtime-closure.ts'
const roots: string[] = []
@@ -10,9 +11,10 @@ function fixture(files: Record<string, string | Record<string, unknown>>): strin
const root = mkdtempSync(join(tmpdir(), 'dsh-runtime-closure-'))
roots.push(root)
for (const [relative, value] of Object.entries(files)) {
const path = join(root, relative)
const preset = /^preset:(.+)$/.exec(relative)
const path = join(root, preset === null ? relative : `packages/bundle/web-app/presets/${preset[1]}.patch.yml`)
mkdirSync(dirname(path), { recursive: true })
writeFileSync(path, typeof value === 'string' ? value : `${JSON.stringify(value, null, 2)}\n`)
writeFileSync(path, preset === null ? (typeof value === 'string' ? value : `${JSON.stringify(value, null, 2)}\n`) : JSON.stringify([{ insert: [{ name: '@deepseek-ai/dsh-agent-preset', config: { id: preset[1], plugins: typeof value === 'string' ? loadCordisYaml(value) : value } }] }]))
}
return root
}
@@ -41,7 +43,7 @@ describe('verifyRuntimeClosure', () => {
const root = fixture({
'python/sdk-runtime/package.json': { name: 'runtime', dependencies: { '@scope/shared': 'workspace:^' } },
'python/sdk-runtime/platforms.json': platforms,
'packages/preset/agent-presets/presets/standard/agent.cordis.yml': `
'preset:standard': `
- id: tools
name: cordis:group
group: true
@@ -74,7 +76,7 @@ describe('verifyRuntimeClosure', () => {
const root = fixture({
'python/sdk-runtime/package.json': { name: 'runtime', dependencies: {} },
'python/sdk-runtime/platforms.json': platforms,
'packages/preset/agent-presets/presets/standard/agent.cordis.yml': `
'preset:standard': `
- id: conditional
name: '@scope/conditional'
disabled: !!js process.env.DSH_DISABLE_CONDITIONAL === '1'
@@ -92,7 +94,7 @@ describe('verifyRuntimeClosure', () => {
const root = fixture({
'python/sdk-runtime/package.json': { name: 'runtime', dependencies: { '@scope/plugin': 'workspace:^' } },
'python/sdk-runtime/platforms.json': platforms,
'packages/preset/agent-presets/presets/standard/agent.cordis.yml': `
'preset:standard': `
- id: plugin
name: '@scope/plugin'
config:
@@ -109,7 +111,7 @@ describe('verifyRuntimeClosure', () => {
const root = fixture({
'python/sdk-runtime/package.json': { name: 'runtime', dependencies: { '@scope/plugin': '1.2.3' } },
'python/sdk-runtime/platforms.json': platforms,
'packages/preset/agent-presets/presets/standard/agent.cordis.yml': `
'preset:standard': `
- id: plugin
name: '@scope/plugin'
`,
@@ -132,7 +134,7 @@ describe('verifyRuntimeClosure', () => {
expect(result.presetCount).toBe(0)
expect(result.failures).toEqual([
'no agent presets matched packages/preset/agent-presets/presets/*/agent.cordis.yml',
'no agent presets matched packages/bundle/web-app/presets/*.patch.yml',
])
})
@@ -140,7 +142,7 @@ describe('verifyRuntimeClosure', () => {
const root = fixture({
'python/sdk-runtime/package.json': { name: 'runtime', dependencies: {} },
'python/sdk-runtime/platforms.json': {},
'packages/preset/agent-presets/presets/standard/agent.cordis.yml': '[]\n',
'preset:standard': '[]\n',
})
const result = await verifyRuntimeClosure(root)
@@ -154,7 +156,7 @@ describe('verifyRuntimeClosure', () => {
const root = fixture({
'python/sdk-runtime/package.json': { name: 'runtime', dependencies: { '@scope/root': 'workspace:^' } },
'python/sdk-runtime/platforms.json': platforms,
'packages/preset/agent-presets/presets/minimal/agent.cordis.yml': '[]\n',
'preset:minimal': '[]\n',
})
workspace(root, '@scope/root', {
peerDependencies: { '@scope/required': 'workspace:^', '@scope/optional': 'workspace:^' },
+19 -17
View File
@@ -6,9 +6,9 @@
*/
import { globSync } from 'node:fs'
import { readFile } from 'node:fs/promises'
import { basename, dirname, resolve } from 'node:path'
import { resolve } from 'node:path'
import { parseArgs } from 'node:util'
import { isCordisGroupEntry, loadCordisYaml } from './cordis-yaml.ts'
import { isCordisGroupEntry, loadCordisYaml, presetDefinitions } from './cordis-yaml.ts'
interface PackageManifest {
name?: string
@@ -30,7 +30,7 @@ interface RuntimePlatform {
type RuntimePlatformManifest = Record<string, RuntimePlatform>
const AGENT_PRESET_GLOB = 'packages/preset/agent-presets/presets/*/agent.cordis.yml'
const AGENT_PRESET_GLOB = 'packages/bundle/web-app/presets/*.patch.yml'
export interface RuntimeClosureResult {
failures: string[]
@@ -93,7 +93,7 @@ export async function verifyRuntimeClosure(
return {
failures,
presetCount: presetPaths.length,
presetCount: (await Promise.all(presetPaths.map(async path => presetDefinitions(loadCordisYaml(await readFile(resolve(root, path), 'utf8'))).length))).reduce((a, b) => a + b, 0),
workspacePackageCount: queue.length,
}
}
@@ -130,19 +130,21 @@ async function missingPresetPlugins(
failures.push(`${presetPath}: preset root must be a Loader entry array`)
continue
}
for (const target of targets) {
const processPlatform = processPlatformForTarget(target)
for (const plugin of activeBarePluginPackages(document, processPlatform)) {
const version = runtimeDependencies[plugin]
if (version?.startsWith('workspace:') === true) continue
const preset = basename(dirname(presetPath))
const declaration = version === undefined
? ''
: ` [runtime dependency is ${JSON.stringify(version)}; expected workspace:]`
const key = `${preset} preset -> ${plugin}${declaration}`
const targets = missing.get(key) ?? new Set<string>()
targets.add(target)
missing.set(key, targets)
for (const definition of presetDefinitions(document)) {
for (const target of targets) {
const processPlatform = processPlatformForTarget(target)
for (const plugin of activeBarePluginPackages(definition.plugins, processPlatform)) {
const version = runtimeDependencies[plugin]
if (version?.startsWith('workspace:') === true) continue
const preset = definition.id
const declaration = version === undefined
? ''
: ` [runtime dependency is ${JSON.stringify(version)}; expected workspace:]`
const key = `${preset} preset -> ${plugin}${declaration}`
const targets = missing.get(key) ?? new Set<string>()
targets.add(target)
missing.set(key, targets)
}
}
}
}