Merge pull request #7940 from deepseek-harness/refactor/cordis-include-yaml
refactor(cordis): route Include-dialect YAML through Include exports
This commit is contained in:
commit
94d9995755
55 files changed
+186
-237
No files matched your search
@@ -13,9 +13,8 @@ import {
|
||||
} from '@agentclientprotocol/sdk'
|
||||
import { withFileLock, writeFileAtomic } from '@deepseek-ai/dsh-atomic-write'
|
||||
import { startMockLlmServer } from '@deepseek-ai/dsh-llm-mock-server'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { execa } from 'execa'
|
||||
import * as yaml from 'js-yaml'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { testProfileResolution } from './profiles/headless/tests/profile-resolution.ts'
|
||||
|
||||
@@ -1259,7 +1258,7 @@ describe.skipIf(!existsSync(dshBin))('dsh BUILT bin (node lib/bin.js, no tsx)',
|
||||
)
|
||||
expect(code).toBe(0)
|
||||
expect(stderr).toBe('')
|
||||
const rows = yaml.load(stdout, { schema: entryListSchema }) as Array<{ id?: string; name?: string }>
|
||||
const rows = parseEntryYaml(stdout) as Array<{ id?: string; name?: string }>
|
||||
expect(rows.map(row => [row.id, row.name])).toEqual([
|
||||
['sdk-app-startup', '@deepseek-ai/dsh-sdk-app'],
|
||||
['sdk-jsonrpc-server', '@deepseek-ai/dsh-sdk-jsonrpc-server'],
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
import { existsSync, mkdtempSync, realpathSync } from 'node:fs'
|
||||
import { copyFile, mkdir, readFile, rm, writeFile } from 'node:fs/promises'
|
||||
import { Ajv2020 } from 'ajv/dist/2020.js'
|
||||
import * as yaml from 'js-yaml'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import type { ConfigSchemaDump } from '@deepseek-ai/dsh-app-boot'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
@@ -162,7 +161,7 @@ describe.skipIf(!builtArtifactsExist)('dsh --dump-config-schema assembled output
|
||||
const composed = await dump(fixture, [], '--dump-config')
|
||||
const validator = new Ajv2020({ strict: false, validateFormats: false })
|
||||
const validate = validator.compile(document)
|
||||
expect(validate(yaml.load(composed.stdout, { schema: entryListSchema })), JSON.stringify(validate.errors)).toBe(true)
|
||||
expect(validate(parseEntryYaml(composed.stdout)), JSON.stringify(validate.errors)).toBe(true)
|
||||
expect(validate([{ name: `${packageName}/namespace`, config: { attempts: 'wrong' } }])).toBe(false)
|
||||
const patch = validator.compile({ $schema: document.$schema, $defs: document.$defs, $ref: '#/$defs/patchList' })
|
||||
expect(patch([{ id: 'schema-class', config: { enabled: 'wrong' } }])).toBe(false)
|
||||
|
||||
@@ -15,7 +15,7 @@ import { mkdtemp, readFile, rm } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join, resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import yaml from 'js-yaml'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
const repoRoot = fileURLToPath(new URL('../../../', import.meta.url))
|
||||
@@ -37,12 +37,6 @@ interface PatchEntry extends ConfigRow {
|
||||
insert?: ConfigRow[]
|
||||
}
|
||||
|
||||
const jsExprType = new yaml.Type('tag:yaml.org,2002:js', {
|
||||
kind: 'scalar',
|
||||
construct: value => String(value),
|
||||
})
|
||||
const configSchema = yaml.JSON_SCHEMA.extend(jsExprType)
|
||||
|
||||
/** Boot the built Web CLI, wait for its settled URL, then dispose through SIGTERM. */
|
||||
function runBuiltWeb(cwd: string): Promise<{ stdout: string; stderr: string; code: number }> {
|
||||
return new Promise((resolveRun, rejectRun) => {
|
||||
@@ -103,9 +97,9 @@ describe.skipIf(!requireBuiltArtifacts)('built CLI lazy-search startup', () => {
|
||||
it('boots and disposes the shipped composition with full-text search off by default', async () => {
|
||||
expect(existsSync(builtBin), `missing built CLI ${resolve(builtBin)}; run pnpm build`).toBe(true)
|
||||
expect(existsSync(webDist), `missing Web dist ${resolve(webDist)}; run pnpm run build:web`).toBe(true)
|
||||
const baseRows = (yaml.load(await readFile(baseConfigPath, 'utf8'), { schema: configSchema }) as PatchEntry[])
|
||||
const baseRows = (parseEntryYaml(await readFile(baseConfigPath, 'utf8')) as PatchEntry[])
|
||||
.flatMap(entry => entry.insert ?? [entry])
|
||||
const webRows = (yaml.load(await readFile(webConfigPath, 'utf8'), { schema: configSchema }) as PatchEntry[])
|
||||
const webRows = (parseEntryYaml(await readFile(webConfigPath, 'utf8')) as PatchEntry[])
|
||||
.flatMap(entry => entry.insert ?? [entry])
|
||||
const baseRow = baseRows.find(row => row.id === 'session-query-sqlite')
|
||||
const webRow = webRows.find(row => row.id === 'session-query-sqlite')
|
||||
|
||||
@@ -5,8 +5,8 @@ import { join } from 'node:path'
|
||||
import { createInterface } from 'node:readline'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { execa } from 'execa'
|
||||
import yaml from 'js-yaml'
|
||||
import { expect, it, onTestFinished } from 'vitest'
|
||||
import { stringifyEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import type { BundleInfo, ChangeResult } from '@deepseek-ai/dsh-plugin-manager'
|
||||
import { getDshRuntimeVersion } from '../../../../packages/boot/app-boot/src/plugin-compatibility.ts'
|
||||
import { generateOfficialBundleCatalog } from '../../../../scripts/gen-official-bundle-catalog.ts'
|
||||
@@ -118,7 +118,7 @@ it.skipIf(!built)('installs the exported registry\'s local closure and switches
|
||||
const observer = join(temporary, 'official-installer-observer.mjs')
|
||||
await writeFile(observer, await readFile(new URL('./fixtures/official-installer-observer.mjs', import.meta.url), 'utf8'))
|
||||
const patch = join(temporary, 'official-installer.patch.yml')
|
||||
await writeFile(patch, yaml.dump([{ insert: [{ id: 'official-installer-observer', name: observer,
|
||||
await writeFile(patch, stringifyEntryYaml([{ insert: [{ id: 'official-installer-observer', name: observer,
|
||||
config: {
|
||||
registry: registry.url,
|
||||
profile,
|
||||
|
||||
@@ -7,6 +7,7 @@ import { fileURLToPath } from 'node:url'
|
||||
import { execa } from 'execa'
|
||||
import yaml from 'js-yaml'
|
||||
import { expect, it } from 'vitest'
|
||||
import { stringifyEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { assertInstalledTree, createPackedInstallation } from './packed-installation.ts'
|
||||
|
||||
const root = fileURLToPath(new URL('../../../..', import.meta.url))
|
||||
@@ -64,7 +65,7 @@ export function apply(ctx) {
|
||||
}
|
||||
`)
|
||||
const patch = join(temporary, 'test.patch.yml')
|
||||
await writeFile(patch, yaml.dump([
|
||||
await writeFile(patch, stringifyEntryYaml([
|
||||
{ id: 'session-telemetry-otel', disabled: true },
|
||||
{ id: 'github-webhook-ingress', insert: [{ id: 'observe-packed-ingress', name: observer }] },
|
||||
]))
|
||||
|
||||
@@ -15,8 +15,7 @@ import { mkdtempSync, rmSync, readFileSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import yaml from 'js-yaml'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { evaluate } from '@deepseek-ai/cordis-plugin-loader'
|
||||
import { bundlePatchPaths, composeEntries, initProfile, loadProfile, PROFILES_DIR } from '@deepseek-ai/dsh-app-boot'
|
||||
|
||||
@@ -104,7 +103,7 @@ describe('shipped agent presets gate both shell tools by platform', () => {
|
||||
const webBundle = fileURLToPath(new URL('../../../packages/bundle/web-app/', import.meta.url))
|
||||
const webManifest = JSON.parse(readFileSync(join(webBundle, 'package.json'), 'utf8')) as { dsh: { bundle: { patch: string[] } } }
|
||||
const presetRows = composeEntries([bundlePatchPaths(webBundle, webManifest.dsh.bundle).flatMap(file =>
|
||||
yaml.load(readFileSync(file, 'utf8'), { schema: entryListSchema }) as import('@deepseek-ai/cordis-plugin-include').PatchOptions[])])
|
||||
parseEntryYaml(readFileSync(file, 'utf8')) as import('@deepseek-ai/cordis-plugin-include').PatchOptions[])])
|
||||
|
||||
const definitions = presetRows.filter(row => row.name === '@deepseek-ai/dsh-agent-preset').map(row => row.config as import('@deepseek-ai/dsh-agent-preset-registry').PresetDefinition)
|
||||
|
||||
|
||||
@@ -7,8 +7,7 @@ import { readFileSync } from 'node:fs'
|
||||
import type { Browser, Page } from 'playwright'
|
||||
import { chromium } from 'playwright'
|
||||
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
|
||||
import * as yaml from 'js-yaml'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { brandString } from '@deepseek-ai/dsh-brand'
|
||||
import {
|
||||
createAssistantMessage, createMessage, createUserMessage, type ToolCallId,
|
||||
@@ -32,7 +31,7 @@ const MODE = webSnapshotMode()
|
||||
|
||||
/** Overlay layer entries, for the composition guard below. */
|
||||
function profileEntries(path: string): unknown[] {
|
||||
const parsed = yaml.load(readFileSync(path, 'utf8'), { schema: entryListSchema })
|
||||
const parsed = parseEntryYaml(readFileSync(path, 'utf8'))
|
||||
if (!Array.isArray(parsed)) throw new Error(`profile layer at ${path} must be a list`)
|
||||
return parsed
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { readProfileManifest } from '@deepseek-ai/dsh-app-boot'
|
||||
import type { SessionId } from '@deepseek-ai/dsh-session'
|
||||
import type {} from '@deepseek-ai/dsh-ptc-runtime'
|
||||
import type {} from '@deepseek-ai/dsh-agent-preset-registry'
|
||||
import { load } from 'js-yaml'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { expect, it, vi } from 'vitest'
|
||||
import { captureStableAria, compareOrRefreshGolden, launchWebScaffold, webSnapshotMode, type WebScaffold } from './scaffold.ts'
|
||||
import { connectFreshWorkspaceZh, ZH_BROWSER_LOCALE } from './support.ts'
|
||||
@@ -155,9 +155,9 @@ it.skipIf(process.platform !== 'darwin').each([
|
||||
expect(scaffold.ctx.settings.describe().find(row => row.ns === 'ui-settings')?.value).toMatchObject({ enabled: codingTools })
|
||||
expect(saved).not.toContain('executionMode:')
|
||||
if (selectedDefault === undefined) {
|
||||
expect(load(saved)).not.toEqual(expect.arrayContaining([expect.objectContaining({ id: 'agent-preset-registry' })]))
|
||||
expect(parseEntryYaml(saved)).not.toEqual(expect.arrayContaining([expect.objectContaining({ id: 'agent-preset-registry' })]))
|
||||
} else {
|
||||
expect(load(saved)).toEqual(expect.arrayContaining([
|
||||
expect(parseEntryYaml(saved)).toEqual(expect.arrayContaining([
|
||||
expect.objectContaining({ id: 'agent-preset-registry', config: { default: 'standard', selectedDefault } }),
|
||||
]))
|
||||
}
|
||||
@@ -263,7 +263,7 @@ it.skipIf(process.platform !== 'darwin').each([
|
||||
expect(scaffold.ctx.tools.schemas(ptcAgent).some(tool => tool.name === 'cua')).toBe(true)
|
||||
expect((await runtime.run(runtime.resolve({ program, bindings: [], stateOwner: owner }))).value).toBe(3)
|
||||
const confirmedSettings = await readFile(settingsPath, 'utf8')
|
||||
expect(load(confirmedSettings)).toEqual(expect.arrayContaining([
|
||||
expect(parseEntryYaml(confirmedSettings)).toEqual(expect.arrayContaining([
|
||||
expect.objectContaining({ id: 'agent-preset-registry', config: { default: 'standard', selectedDefault: 'ptc' } }),
|
||||
]))
|
||||
await toggle.click()
|
||||
|
||||
@@ -33,8 +33,7 @@ import { expect } from 'vitest'
|
||||
import { Context } from '@deepseek-ai/cordis'
|
||||
import { DSH_LAUNCH_ENVIRONMENT_KEY, type LaunchEnvironmentSnapshot } from '@deepseek-ai/dsh-launch-environment'
|
||||
import Loader from '@deepseek-ai/cordis-plugin-loader'
|
||||
import { entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import yaml from 'js-yaml'
|
||||
import { stringifyEntryYaml, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import {
|
||||
captureExpectedWorkspaceSnapshot,
|
||||
captureWorkspaceSnapshot,
|
||||
@@ -808,7 +807,7 @@ export async function launchWebScaffold(options: LaunchOptions = {}): Promise<We
|
||||
const fixtureDir = join(profileDir, 'node_modules', SCAFFOLD_DEFAULTS_BUNDLE)
|
||||
await mkdir(fixtureDir, { recursive: true })
|
||||
await writeFile(join(fixtureDir, 'package.json'), JSON.stringify({ name: SCAFFOLD_DEFAULTS_BUNDLE, version: '1.0.0', dsh: { bundle: { patch: 'cordis.patch.yml' } } }))
|
||||
await writeFile(join(fixtureDir, 'cordis.patch.yml'), yaml.dump(formDefaults, { schema: entryListSchema }))
|
||||
await writeFile(join(fixtureDir, 'cordis.patch.yml'), stringifyEntryYaml(formDefaults))
|
||||
bundles.push(SCAFFOLD_DEFAULTS_BUNDLE)
|
||||
dependencies[SCAFFOLD_DEFAULTS_BUNDLE] = `file:${fixtureDir}`
|
||||
initProfile(profileDir, bundles)
|
||||
|
||||
@@ -8,10 +8,9 @@ import { tmpdir } from 'node:os'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import type { Browser, Page } from 'playwright'
|
||||
import { chromium } from 'playwright'
|
||||
import { dump } from 'js-yaml'
|
||||
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
|
||||
import type { Agent, AgentHandle } from '@deepseek-ai/dsh-agent'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { stringifyEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { bundlePatchPaths, composeEntries, loadOverlayPatches } from '@deepseek-ai/dsh-app-boot'
|
||||
import { brandString } from '@deepseek-ai/dsh-brand'
|
||||
import { type MessageId, type ToolCallId, createUserMessage, LlmAdapter } from '@deepseek-ai/dsh-llm'
|
||||
@@ -99,9 +98,9 @@ async function writeEveryStepOverlay(dir: string): Promise<string> {
|
||||
? { ...plugin, config: { refreshIntervalMs: 0 } }
|
||||
: plugin)
|
||||
const path = join(dir, 'time-context-every-step.patch.yml')
|
||||
await writeFile(path, dump([
|
||||
await writeFile(path, stringifyEntryYaml([
|
||||
{ id: 'preset-standard', config: { ...config, plugins } },
|
||||
], { schema: entryListSchema, noRefs: true, lineWidth: -1 }))
|
||||
], { lineWidth: -1 }))
|
||||
return path
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ import { mkdtemp, rm, writeFile, readFile } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { chromium } from 'playwright'
|
||||
import yaml from 'js-yaml'
|
||||
import { expect, it, onTestFinished } from 'vitest'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { credentialRef } from '@deepseek-ai/dsh-credentials'
|
||||
import { startMockLlmServer } from '@deepseek-ai/dsh-llm-mock-server'
|
||||
import { launchWebScaffold, webSnapshotMode } from './scaffold.ts'
|
||||
@@ -44,7 +44,7 @@ it.skipIf(webSnapshotMode() === 'record')('persists the upload switch and omits
|
||||
await toggle.click()
|
||||
await expect.poll(() => toggle.getAttribute('aria-checked')).toBe(String(enabled))
|
||||
await expect.poll(async () => {
|
||||
const patches = yaml.load(await readFile(join(scaffold.harnessHome, 'profiles/scaffold/cordis.patch.yml'), 'utf8')) as { id: string; config?: { enabled?: boolean } }[]
|
||||
const patches = parseEntryYaml(await readFile(join(scaffold.harnessHome, 'profiles/scaffold/cordis.patch.yml'), 'utf8')) as { id: string; config?: { enabled?: boolean } }[]
|
||||
return patches.find(patch => patch.id === 'session-log-deepseek')?.config?.enabled ?? true
|
||||
}).toBe(enabled)
|
||||
await page.keyboard.press('Escape')
|
||||
|
||||
@@ -5,8 +5,7 @@ import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { chromium } from 'playwright'
|
||||
import { expect, it } from 'vitest'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import yaml from 'js-yaml'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { WELCOME_NOTICE_VERSION, launchWebScaffold, watchConsole } from './scaffold.ts'
|
||||
import { ZH_BROWSER_LOCALE } from './support.ts'
|
||||
|
||||
@@ -24,7 +23,7 @@ it('imports settings.yaml into the profile once and applies the imported values'
|
||||
const patchPath = join(harnessHome, 'profiles', 'scaffold', 'cordis.patch.yml')
|
||||
type Row = { id?: string; config?: Record<string, unknown> }
|
||||
const config = (id: string): Record<string, unknown> | undefined =>
|
||||
(yaml.load(readFileSync(patchPath, 'utf8'), { schema: entryListSchema }) as Row[]).find(row => row.id === id)?.config
|
||||
(parseEntryYaml(readFileSync(patchPath, 'utf8')) as Row[]).find(row => row.id === id)?.config
|
||||
await expect.poll(() => config('ui-theme')?.['fontSize'], { timeout: 10_000 }).toBe(16)
|
||||
expect(config('ui-settings')?.['enabled']).toBe(false)
|
||||
expect(config('ui-settings-general')?.['welcomeNoticeVersion']).toBe(WELCOME_NOTICE_VERSION)
|
||||
|
||||
@@ -28,7 +28,7 @@ Application listeners are outside this package matrix. Desktop Host subscribes t
|
||||
| `api-session/error` | `emit` | [`packages/api/session-controller/src/types.ts:712`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
|
||||
| `api-session/removed` | `emit` | [`packages/api/session-controller/src/types.ts:691`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
|
||||
| `api-session/status` | `emit` | [`packages/api/session-controller/src/types.ts:698`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
|
||||
| `app-boot/config-reload` | `emit` | [`packages/boot/app-boot/src/index.ts:57`](../packages/boot/app-boot/src/index.ts) | [`app-boot`](../packages/boot/app-boot) (`emit`) | [`settings`](../packages/settings/settings) |
|
||||
| `app-boot/config-reload` | `emit` | [`packages/boot/app-boot/src/index.ts:56`](../packages/boot/app-boot/src/index.ts) | [`app-boot`](../packages/boot/app-boot) (`emit`) | [`settings`](../packages/settings/settings) |
|
||||
| `approval/request` | `waterfall` | [`packages/interaction/user-approval/src/types.ts:87`](../packages/interaction/user-approval/src/types.ts) | [`user-approval`](../packages/interaction/user-approval) (`waterfall`) | [`acp`](../packages/acp/acp), `remotes`, `server` |
|
||||
| `authorization/settled` | `emit` | [`packages/credentials/authorization/src/index.ts:57`](../packages/credentials/authorization/src/index.ts) | [`authorization`](../packages/credentials/authorization) (`events.dispatch`) | - |
|
||||
| `commands/change` | `emit` | [`packages/interaction/commands/src/types.ts:89`](../packages/interaction/commands/src/types.ts) | [`commands`](../packages/interaction/commands) (`events.dispatch`) | `remotes` |
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
| `api-session/error` | `emit` | [`packages/api/session-controller/src/types.ts:712`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
|
||||
| `api-session/removed` | `emit` | [`packages/api/session-controller/src/types.ts:691`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
|
||||
| `api-session/status` | `emit` | [`packages/api/session-controller/src/types.ts:698`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
|
||||
| `app-boot/config-reload` | `emit` | [`packages/boot/app-boot/src/index.ts:57`](../packages/boot/app-boot/src/index.ts) | [`app-boot`](../packages/boot/app-boot) (`emit`) | [`settings`](../packages/settings/settings) |
|
||||
| `app-boot/config-reload` | `emit` | [`packages/boot/app-boot/src/index.ts:56`](../packages/boot/app-boot/src/index.ts) | [`app-boot`](../packages/boot/app-boot) (`emit`) | [`settings`](../packages/settings/settings) |
|
||||
| `approval/request` | `waterfall` | [`packages/interaction/user-approval/src/types.ts:87`](../packages/interaction/user-approval/src/types.ts) | [`user-approval`](../packages/interaction/user-approval) (`waterfall`) | [`acp`](../packages/acp/acp), `remotes`, `server` |
|
||||
| `authorization/settled` | `emit` | [`packages/credentials/authorization/src/index.ts:57`](../packages/credentials/authorization/src/index.ts) | [`authorization`](../packages/credentials/authorization) (`events.dispatch`) | - |
|
||||
| `commands/change` | `emit` | [`packages/interaction/commands/src/types.ts:89`](../packages/interaction/commands/src/types.ts) | [`commands`](../packages/interaction/commands) (`events.dispatch`) | `remotes` |
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
"@deepseek-ai/dsh-package-manifest": "workspace:*",
|
||||
"@eslint-community/regexpp": "^4.12.2",
|
||||
"ajv": "^8.20.0",
|
||||
"js-yaml": "^4.3.2",
|
||||
"node-addon-require-builtin": "^0.1.9",
|
||||
"resolve.exports": "^2.0.3",
|
||||
"semver": "^7.8.5",
|
||||
@@ -63,7 +62,6 @@
|
||||
"@deepseek-ai/dsh-launch-environment": "workspace:*",
|
||||
"@deepseek-ai/dsh-home-paths": "workspace:*",
|
||||
"@deepseek-ai/dsh-system-prompt": "workspace:*",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/semver": "^7.8.0",
|
||||
"@deepseek-ai/cordis": "workspace:~"
|
||||
}
|
||||
|
||||
@@ -5,8 +5,7 @@ import { dirname, extname, isAbsolute, join } from 'node:path'
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url'
|
||||
import type { Context } from '@deepseek-ai/cordis'
|
||||
import type { EntryOptions } from '@deepseek-ai/cordis-plugin-loader'
|
||||
import { applyEntryPatches, entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { load } from 'js-yaml'
|
||||
import { applyEntryPatches, parseEntryYaml, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { resolvePluginResource } from './package-meta.ts'
|
||||
import { barePackageName } from './profile-resolution/resolver.ts'
|
||||
import type {} from './profile-resolution/service.ts'
|
||||
@@ -151,7 +150,7 @@ function preflight(
|
||||
includes.add(filename)
|
||||
try {
|
||||
let data: unknown
|
||||
try { data = load(readFileSync(filename, 'utf8'), { schema: entryListSchema }) }
|
||||
try { data = parseEntryYaml(readFileSync(filename, 'utf8')) }
|
||||
catch (error) {
|
||||
if ((error as NodeJS.ErrnoException).code !== 'ENOENT' || config.initial === undefined) return undefined
|
||||
data = config.initial
|
||||
|
||||
@@ -3,10 +3,9 @@
|
||||
import { readFile, realpath } from 'node:fs/promises'
|
||||
import { extname, join } from 'node:path'
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url'
|
||||
import * as yaml from 'js-yaml'
|
||||
import Loader, { EntryGroup, ModuleLoader, isJsExpr, type EntryOptions } from '@deepseek-ai/cordis-plugin-loader'
|
||||
import Group from '@deepseek-ai/cordis-plugin-group'
|
||||
import Include, { applyEntryPatches, entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import Include, { applyEntryPatches, entryYamlErrorPosition, parseEntryYaml, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import type { Profile, RuntimeResolution } from '../profile.ts'
|
||||
import { installRuntimeInterception } from '../profile-resolution/resolver.ts'
|
||||
import { buildConfigSchemaDocument } from './document.ts'
|
||||
@@ -148,10 +147,11 @@ export async function collectConfigSchemas(
|
||||
}
|
||||
if (content !== undefined) {
|
||||
try {
|
||||
source = extension === '.json' ? JSON.parse(content) : yaml.load(content, { schema: entryListSchema })
|
||||
source = extension === '.json' ? JSON.parse(content) : parseEntryYaml(content)
|
||||
} catch (error) {
|
||||
// Parser messages can quote configuration values; retain only the file and location.
|
||||
const at = error instanceof yaml.YAMLException ? ` at line ${error.mark.line + 1}, column ${error.mark.column + 1}` : ''
|
||||
const position = entryYamlErrorPosition(error)
|
||||
const at = position === undefined ? '' : ` at line ${position.line}, column ${position.column}`
|
||||
throw new Error(`invalid ${extension === '.json' ? 'JSON' : 'YAML'} include ${filename}${at}`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,9 @@ import { inspect, parseEnv } from 'node:util'
|
||||
import { captureStartupComposition, type StartupCompositionDiagnostic } from './startup-diagnostics.ts'
|
||||
export type { StartupCompositionDiagnostic, StartupPluginState, StartupServiceState } from './startup-diagnostics.ts'
|
||||
import { basename, dirname, isAbsolute, resolve } from 'node:path'
|
||||
import * as yaml from 'js-yaml'
|
||||
import { Context, type Fiber, type FiberState } from '@deepseek-ai/cordis'
|
||||
import Loader, { type Entry, type EntryGroup, type EntryOptions } from '@deepseek-ai/cordis-plugin-loader'
|
||||
import Include, { applyEntryPatches, entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import Include, { applyEntryPatches, parseEntryYaml, stringifyEntryYaml, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import Group from '@deepseek-ai/cordis-plugin-group'
|
||||
import { dshHomePath, dshPath, resolveDshHome } from '@deepseek-ai/dsh-home-paths'
|
||||
import { createLaunchEnvironmentSnapshot, type LaunchEnvironmentSnapshot } from '@deepseek-ai/dsh-launch-environment'
|
||||
@@ -280,13 +279,6 @@ export function loadLayeredEnv(
|
||||
|
||||
const bootstrapIncludes = new WeakMap<Context, Entry>()
|
||||
|
||||
// The include's YAML dialect (`!!js` scalars become expression nodes the
|
||||
// Loader interpolates against each entry's injection-ready context), imported
|
||||
// from the include itself so patch parsing and config dumping can never drift
|
||||
// from what the include mounts. User patch layers share it so they may
|
||||
// reference `process.env`.
|
||||
const userPatchesSchema = entryListSchema
|
||||
|
||||
/** What a caller of {@link recomposeProfile} already did and requires. */
|
||||
export interface ProfileRecompositionOptions {
|
||||
/** Explicit enablement targets whose existing failures also reject the recomposition. */
|
||||
@@ -595,7 +587,7 @@ function parsePatchList(
|
||||
): PatchOptions[] {
|
||||
let parsed: unknown
|
||||
try {
|
||||
parsed = yaml.load(content, { schema: userPatchesSchema })
|
||||
parsed = parseEntryYaml(content)
|
||||
} catch (error) {
|
||||
throw new Error(`${binName}: failed to parse ${label} ${file}: ${String(error)}`)
|
||||
}
|
||||
@@ -664,7 +656,7 @@ export function renderConfigDump(
|
||||
}
|
||||
let parsed: unknown
|
||||
try {
|
||||
parsed = yaml.load(content, { schema: entryListSchema })
|
||||
parsed = parseEntryYaml(content)
|
||||
} catch (error) {
|
||||
throw new Error(`${binName}: failed to parse config ${absoluteConfigPath}: ${String(error)}`)
|
||||
}
|
||||
@@ -725,7 +717,7 @@ function groupedDump(
|
||||
const flush = (): void => {
|
||||
if (currentLabel === undefined || group.length === 0) return
|
||||
lines.push(`# == ${currentLabel}`)
|
||||
lines.push(yaml.dump(group, { schema: entryListSchema, noRefs: true }).trimEnd())
|
||||
lines.push(stringifyEntryYaml(group).trimEnd())
|
||||
group = []
|
||||
}
|
||||
for (let index = 0; index < composed.length; index += 1) {
|
||||
|
||||
@@ -4,9 +4,8 @@ import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { pathToFileURL } from 'node:url'
|
||||
import { Context } from '@deepseek-ai/cordis'
|
||||
import { entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { parseEntryYaml, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import type { EntryOptions } from '@deepseek-ai/cordis-plugin-loader'
|
||||
import { load } from 'js-yaml'
|
||||
import { describe, expect, it, onTestFinished, vi } from 'vitest'
|
||||
import {
|
||||
PROFILE_COMPATIBILITY_FILENAME, PluginPackages, boot, getDshRuntimeVersion,
|
||||
@@ -358,7 +357,7 @@ it('reuses the documented literal Include dialect when reading included entries'
|
||||
f.plugin('allowed-plugin')
|
||||
const list = join(f.dir, 'nested.cordis.yml')
|
||||
writeFileSync(list, '- id: nested\n name: allowed-plugin\n')
|
||||
expect(load(readFileSync(list, 'utf8'), { schema: entryListSchema })).toEqual([{ id: 'nested', name: 'allowed-plugin' }])
|
||||
expect(parseEntryYaml(readFileSync(list, 'utf8'))).toEqual([{ id: 'nested', name: 'allowed-plugin' }])
|
||||
// The launcher mounts an Include with a file URL, which a Windows path cannot stand in for: `C:` reads as a scheme.
|
||||
expect(await f.run([{ insert: [{ id: 'outer', name: 'cordis:include', config: { path: pathToFileURL(list).href } }] }]))
|
||||
.toEqual(['import:allowed-plugin', 'apply:allowed-plugin'])
|
||||
|
||||
@@ -12,8 +12,7 @@ import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { pathToFileURL } from 'node:url'
|
||||
import { afterAll, describe, expect, it, vi } from 'vitest'
|
||||
import * as yaml from 'js-yaml'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { loadOverlayPatches, renderConfigDump } from '../src/index.ts'
|
||||
|
||||
const NAME = 'dsh-test-bin'
|
||||
@@ -73,7 +72,7 @@ describe('renderConfigDump', () => {
|
||||
], () => {})
|
||||
// Comments do not break loadability: the dump parses as one document
|
||||
// equal to what boot() would mount.
|
||||
const parsed = yaml.load(dump, { schema: entryListSchema }) as {
|
||||
const parsed = parseEntryYaml(dump) as {
|
||||
id: string
|
||||
config?: Record<string, unknown>
|
||||
}[]
|
||||
@@ -140,7 +139,7 @@ describe('renderConfigDump', () => {
|
||||
{ label: 'b.yml', patches: [{ id: 'child', config: { v: 2 } }] },
|
||||
], line => void warnings.push(line))
|
||||
expect(warnings).toEqual([`${NAME}: [b.yml] patch: entry "child" not found`])
|
||||
const parsed = yaml.load(dump, { schema: entryListSchema }) as {
|
||||
const parsed = parseEntryYaml(dump) as {
|
||||
config?: { config?: { v?: number } }[]
|
||||
}[]
|
||||
expect(parsed[0]?.config?.[0]?.config?.v).toBe(1)
|
||||
@@ -169,7 +168,7 @@ describe('renderConfigDump', () => {
|
||||
line => void warnings.push(line),
|
||||
)
|
||||
expect(warnings).toEqual([`${NAME}: [overlay.yml] patch: entry "only-on-another-surface" not found`])
|
||||
const parsed = yaml.load(dump, { schema: entryListSchema }) as { config?: { value?: string } }[]
|
||||
const parsed = parseEntryYaml(dump) as { config?: { value?: string } }[]
|
||||
expect(parsed[0]?.config?.value).toBe('patched')
|
||||
})
|
||||
|
||||
|
||||
@@ -40,15 +40,13 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@deepseek-ai/dsh-atomic-write": "workspace:*",
|
||||
"yaml": "^2.8.1",
|
||||
"js-yaml": "^4.3.2"
|
||||
"yaml": "^2.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@deepseek-ai/cordis": "workspace:~",
|
||||
"@deepseek-ai/cordis-plugin-loader": "workspace:~",
|
||||
"@deepseek-ai/dsh-hmr": "workspace:*",
|
||||
"@deepseek-ai/cordis-plugin-include": "workspace:~",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@deepseek-ai/dsh-app-boot": "workspace:*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
|
||||
@@ -3,8 +3,7 @@ import { readFile } from 'node:fs/promises'
|
||||
import { join } from 'node:path'
|
||||
import { isDeepStrictEqual } from 'node:util'
|
||||
import { Context, FiberState, Service } from '@deepseek-ai/cordis'
|
||||
import { entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import yaml from 'js-yaml'
|
||||
import { parseEntryYaml, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import type { Entry, EntryOptions } from '@deepseek-ai/cordis-plugin-loader'
|
||||
import type {} from '@deepseek-ai/dsh-hmr'
|
||||
import { composeEntries, loadProfileDirectory, readProfilePatches, reconcileProfilePatches } from '@deepseek-ai/dsh-app-boot'
|
||||
@@ -133,7 +132,7 @@ export class ConfigEditor extends Service {
|
||||
} })
|
||||
const profile = this.ownerContext.profileContext
|
||||
const loaded = loadProfileDirectory('dsh', profile.dir, profile.installAnchor)
|
||||
const patches = readProfilePatches('dsh', profile, { ...loaded, patches: yaml.load(String(document), { schema: entryListSchema }) as PatchOptions[] })
|
||||
const patches = readProfilePatches('dsh', profile, { ...loaded, patches: parseEntryYaml(String(document)) as PatchOptions[] })
|
||||
const effective = flatten(composeEntries([patches])).find(row => row.id === entry.options.id)
|
||||
if (!isDeepStrictEqual(effective?.config ?? {}, next)) {
|
||||
throw new Error(`Configuration for "${entry.options.id}" is overridden by a home patch or command-line overlay`)
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import * as yaml from 'js-yaml'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
|
||||
describe('dsh-acp-app bundle', () => {
|
||||
it('declares startup-gated ACP serving without overriding base HMR policy', () => {
|
||||
@@ -16,10 +15,7 @@ describe('dsh-acp-app bundle', () => {
|
||||
}
|
||||
expect(manifest.dsh?.bundle?.patch).toBe('./cordis.patch.yml')
|
||||
expect(manifest.dependencies).toHaveProperty('@deepseek-ai/dsh-acp')
|
||||
const patches = yaml.load(
|
||||
readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8'),
|
||||
{ schema: entryListSchema },
|
||||
) as Array<{
|
||||
const patches = parseEntryYaml(readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8')) as Array<{
|
||||
id?: string
|
||||
disabled?: boolean
|
||||
insert?: Array<{ config?: { model?: string; provider?: string }; id?: string; inject?: string[]; name?: string }>
|
||||
|
||||
@@ -7,8 +7,7 @@ import { existsSync, readFileSync } from 'node:fs'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { resolve } from 'node:path'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import * as yaml from 'js-yaml'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { evaluate } from '@deepseek-ai/cordis-plugin-loader'
|
||||
|
||||
describe('dsh-base bundle', () => {
|
||||
@@ -21,10 +20,7 @@ describe('dsh-base bundle', () => {
|
||||
dsh?: { bundle?: { patch?: string } }
|
||||
}
|
||||
expect(manifest.dsh?.bundle?.patch).toBe('./cordis.patch.yml')
|
||||
const parsed = yaml.load(
|
||||
readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8'),
|
||||
{ schema: entryListSchema },
|
||||
)
|
||||
const parsed = parseEntryYaml(readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8'))
|
||||
expect(Array.isArray(parsed)).toBe(true)
|
||||
// The base layer is one insert list over the empty profile root.
|
||||
const rows = (parsed as { insert?: { id?: string; config?: Record<string, unknown>; disabled?: boolean }[] }[]).flatMap(
|
||||
@@ -57,10 +53,7 @@ describe('dsh-base bundle', () => {
|
||||
|
||||
it('gates each shell stack by platform with a symmetric disabled expression', () => {
|
||||
const root = fileURLToPath(new URL('..', import.meta.url))
|
||||
const parsed = yaml.load(
|
||||
readFileSync(resolve(root, 'cordis.patch.yml'), 'utf8'),
|
||||
{ schema: entryListSchema },
|
||||
)
|
||||
const parsed = parseEntryYaml(readFileSync(resolve(root, 'cordis.patch.yml'), 'utf8'))
|
||||
if (!Array.isArray(parsed)) throw new TypeError('base patch must parse to a patch list')
|
||||
const rows = parsed.flatMap((patch): Record<string, unknown>[] =>
|
||||
typeof patch === 'object' && patch !== null
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import * as yaml from 'js-yaml'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
|
||||
describe('dsh-sdk-app bundle', () => {
|
||||
it('enables plugin management while keeping JSON-RPC dependencies stable until restart', () => {
|
||||
@@ -16,10 +15,7 @@ describe('dsh-sdk-app bundle', () => {
|
||||
}
|
||||
expect(manifest.dsh?.bundle?.patch).toBe('./cordis.patch.yml')
|
||||
expect(manifest.dependencies).toHaveProperty('@deepseek-ai/dsh-sdk-jsonrpc-server')
|
||||
const patches = yaml.load(
|
||||
readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8'),
|
||||
{ schema: entryListSchema },
|
||||
) as Array<{ id?: string; disabled?: boolean; insert?: Array<{ id?: string; inject?: string[]; name?: string }> }>
|
||||
const patches = parseEntryYaml(readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8')) as Array<{ id?: string; disabled?: boolean; insert?: Array<{ id?: string; inject?: string[]; name?: string }> }>
|
||||
expect(patches.find(patch => patch.id === 'hmr')).toMatchObject({ disabled: true })
|
||||
expect(patches.find(patch => patch.id === 'tool-plugin-manager')).toMatchObject({ disabled: false })
|
||||
expect(patches.find(patch => patch.id === 'session-title-llm')).toMatchObject({ disabled: true })
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import * as yaml from 'js-yaml'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
|
||||
function packageName(specifier: string): string {
|
||||
return specifier.startsWith('@') ? specifier.split('/').slice(0, 2).join('/') : specifier.split('/')[0]!
|
||||
@@ -19,10 +18,7 @@ describe('dsh-sdk-minimal bundle', () => {
|
||||
dsh?: { bundle?: { patch?: string } }
|
||||
}
|
||||
expect(manifest.dsh?.bundle?.patch).toBe('./cordis.patch.yml')
|
||||
const patches = yaml.load(
|
||||
readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8'),
|
||||
{ schema: entryListSchema },
|
||||
) as Array<{ insert?: Array<{ id?: string; inject?: string[]; name?: string; config?: Record<string, unknown>; disabled?: unknown }> }>
|
||||
const patches = parseEntryYaml(readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8')) as Array<{ insert?: Array<{ id?: string; inject?: string[]; name?: string; config?: Record<string, unknown>; disabled?: unknown }> }>
|
||||
expect(patches).toHaveLength(1)
|
||||
const rows = patches[0]?.insert ?? []
|
||||
expect(rows.map(row => [row.id, row.name])).toEqual([
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
"devDependencies": {
|
||||
"@deepseek-ai/cordis": "workspace:~",
|
||||
"@deepseek-ai/cordis-plugin-include": "workspace:~",
|
||||
"js-yaml": "^4.2.0",
|
||||
"@deepseek-ai/cordis-plugin-loader": "workspace:~"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
|
||||
@@ -2,14 +2,11 @@
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import { Context } from '@deepseek-ai/cordis'
|
||||
import Loader, { interpolate, type EntryOptions } from '@deepseek-ai/cordis-plugin-loader'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { load } from 'js-yaml'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { expect, it, vi } from 'vitest'
|
||||
|
||||
it.each(['darwin', 'win32', 'linux'])('loads the exported patch directly on %s and selects its native provider', async (platform) => {
|
||||
const patch = load(await readFile(new URL('../cordis.patch.yml', import.meta.url), 'utf8'), {
|
||||
schema: entryListSchema,
|
||||
}) as { insert: EntryOptions[] }[]
|
||||
const patch = parseEntryYaml(await readFile(new URL('../cordis.patch.yml', import.meta.url), 'utf8')) as { insert: EntryOptions[] }[]
|
||||
for (const id of ['cua-macos', 'cua-windows']) {
|
||||
expect(patch[0]!.insert.find(row => row.id === id)?.name).toBe(`@deepseek-ai/dsh-${id}`)
|
||||
}
|
||||
|
||||
@@ -88,7 +88,6 @@
|
||||
"@deepseek-ai/dsh-attachment": "workspace:*",
|
||||
"@deepseek-ai/dsh-fs-local": "workspace:*",
|
||||
"@deepseek-ai/dsh-ptc-runtime-node": "workspace:*",
|
||||
"@modelcontextprotocol/client": "2.2.0",
|
||||
"js-yaml": "^4.3.2"
|
||||
"@modelcontextprotocol/client": "2.2.0"
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,9 @@
|
||||
import { readFileSync, readdirSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import type { EntryOptions } from '@deepseek-ai/cordis-plugin-loader'
|
||||
import { interpolate } from '@deepseek-ai/cordis-plugin-loader'
|
||||
import { load } from 'js-yaml'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
const root = fileURLToPath(new URL('..', import.meta.url))
|
||||
@@ -21,7 +20,7 @@ interface Manifest {
|
||||
}
|
||||
|
||||
const manifest = JSON.parse(readFileSync(resolve(root, 'package.json'), 'utf8')) as Manifest
|
||||
const patches = load(readFileSync(resolve(root, manifest.dsh.bundle.patch), 'utf8'), { schema: entryListSchema }) as Array<
|
||||
const patches = parseEntryYaml(readFileSync(resolve(root, manifest.dsh.bundle.patch), 'utf8')) as Array<
|
||||
{ id?: string; disabled?: unknown; insert?: EntryOptions[] }
|
||||
>
|
||||
const inserted = patches.flatMap(patch => patch.insert ?? [])
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@deepseek-ai/cordis": "workspace:~",
|
||||
"@deepseek-ai/cordis-plugin-include": "workspace:~",
|
||||
"js-yaml": "^4.3.2"
|
||||
"@deepseek-ai/cordis-plugin-include": "workspace:~"
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import * as yaml from 'js-yaml'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
|
||||
describe('Inspector profile bundle', () => {
|
||||
it('publishes one layer containing both inspectors and the Statistics view', () => {
|
||||
@@ -19,9 +18,7 @@ describe('Inspector profile bundle', () => {
|
||||
'@deepseek-ai/dsh-experimental-inspector': 'workspace:*',
|
||||
'@deepseek-ai/dsh-experimental-session-inspector': 'workspace:*',
|
||||
})
|
||||
expect(yaml.load(readFileSync(new URL(`../${manifest.dsh.bundle.patch}`, import.meta.url), 'utf8'), {
|
||||
schema: entryListSchema,
|
||||
})).toEqual([{ insert: [
|
||||
expect(parseEntryYaml(readFileSync(new URL(`../${manifest.dsh.bundle.patch}`, import.meta.url), 'utf8'))).toEqual([{ insert: [
|
||||
{
|
||||
id: 'experimental-inspector', name: '@deepseek-ai/dsh-experimental-inspector',
|
||||
disabled: false, config: { captureFetch: true },
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
"devDependencies": {
|
||||
"@deepseek-ai/cordis": "workspace:~",
|
||||
"@deepseek-ai/cordis-plugin-include": "workspace:~",
|
||||
"js-yaml": "^4.3.2",
|
||||
"@deepseek-ai/cordis-plugin-timer": "workspace:~",
|
||||
"@deepseek-ai/dsh-agent": "workspace:*",
|
||||
"@deepseek-ai/dsh-api-remote-access": "workspace:*",
|
||||
|
||||
@@ -4,9 +4,8 @@ import { mkdtemp, mkdir, readFile, rm, writeFile } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { expect, it, onTestFinished } from 'vitest'
|
||||
import * as yaml from 'js-yaml'
|
||||
import type { Context } from '@deepseek-ai/cordis'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import Timer from '@deepseek-ai/cordis-plugin-timer'
|
||||
import { boot, initProfile, loadProfileDirectory, readProfilePatches, type ProfileContext } from '@deepseek-ai/dsh-app-boot'
|
||||
import Hmr from '@deepseek-ai/dsh-hmr'
|
||||
@@ -32,9 +31,7 @@ const manifest = JSON.parse(readFileSync(new URL('../package.json', import.meta.
|
||||
dependencies: Record<string, string>
|
||||
dsh: { bundle: { patch: string } }
|
||||
}
|
||||
const patch = yaml.load(readFileSync(new URL(`../${manifest.dsh.bundle.patch}`, import.meta.url), 'utf8'), {
|
||||
schema: entryListSchema,
|
||||
}) as { insert: Row[] }[]
|
||||
const patch = parseEntryYaml(readFileSync(new URL(`../${manifest.dsh.bundle.patch}`, import.meta.url), 'utf8')) as { insert: Row[] }[]
|
||||
const rows = patch[0]?.insert ?? []
|
||||
|
||||
/** A browser row's Host entry is an empty `apply`; its contribution loads in the Client. */
|
||||
@@ -133,7 +130,7 @@ it('addresses every row through its own id and switches the shared card service
|
||||
await toggle('action-cards', false)
|
||||
expect(ctx.get('actionCards')).toBeUndefined()
|
||||
expect(await skills()).toEqual([])
|
||||
expect(yaml.load(await readFile(profile.patchPath, 'utf8'))).toEqual([
|
||||
expect(parseEntryYaml(await readFile(profile.patchPath, 'utf8'))).toEqual([
|
||||
{ id: 'creation-recommendations', disabled: true }, { id: 'action-cards', disabled: true },
|
||||
])
|
||||
await toggle('action-cards', true)
|
||||
@@ -144,5 +141,5 @@ it('addresses every row through its own id and switches the shared card service
|
||||
expect(await skills()).toEqual(['personalized-pages'])
|
||||
await toggle('plugin-recommendations', true)
|
||||
expect(await skills()).toEqual(['official-plugins', 'personalized-pages'])
|
||||
expect(yaml.load(await readFile(profile.patchPath, 'utf8'))).toEqual([])
|
||||
expect(parseEntryYaml(await readFile(profile.patchPath, 'utf8'))).toEqual([])
|
||||
}, 30_000)
|
||||
@@ -43,12 +43,10 @@
|
||||
"@deepseek-ai/dsh-session-format": "workspace:*",
|
||||
"@deepseek-ai/dsh-session-format-catalog": "workspace:*",
|
||||
"@deepseek-ai/dsh-session-format-v3-to-v4": "workspace:*",
|
||||
"js-yaml": "^4.3.2",
|
||||
"picomatch": "^4.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@deepseek-ai/cordis": "workspace:~",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/picomatch": "^4.0.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -28,8 +28,7 @@ import {
|
||||
type ImageLazyArchive, type ImageManifest,
|
||||
} from '@deepseek-ai/dsh-experimental-webworker-runtime'
|
||||
import picomatch from 'picomatch'
|
||||
import yaml from 'js-yaml'
|
||||
import { entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { parseEntryYaml, stringifyEntryYaml, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { PROFILE_PATCH_FILENAME } from '@deepseek-ai/dsh-app-boot'
|
||||
import { WRAPPER_CONTRACT, type ImageFiles, type TransformOutcome } from './transform-image.ts'
|
||||
import { EXCLUDE, EXCLUDE_WORKSPACE, IMAGE_ENTRY_SEEDS, PAGE_ASSETS } from './rules.ts'
|
||||
@@ -207,7 +206,7 @@ function treeRosterOf(root: string): string[] {
|
||||
continue
|
||||
}
|
||||
if (!entry.name.endsWith('.yml') && !entry.name.endsWith('.yaml')) continue
|
||||
collectModuleNames(yaml.load(readFileSync(absolute, 'utf8'), { schema: entryListSchema }), names)
|
||||
collectModuleNames(parseEntryYaml(readFileSync(absolute, 'utf8')), names)
|
||||
}
|
||||
}
|
||||
walk(root)
|
||||
@@ -697,7 +696,7 @@ export function packVfsImage(options: PackOptions): PackResult {
|
||||
files[`node_modules/${installation.name}/package.json`] = readFileSync(installation.manifest)
|
||||
}
|
||||
if (options.homePatch !== undefined && options.homePatch.length > 0) {
|
||||
files[HOME_PATCH_PATH] = encoder.encode(yaml.dump(options.homePatch, { schema: entryListSchema, noRefs: true }))
|
||||
files[HOME_PATCH_PATH] = encoder.encode(stringifyEntryYaml(options.homePatch))
|
||||
}
|
||||
|
||||
for (const tree of configTrees) collectTree(tree.directory, files, tree.mount, relativePath => !excluded(relativePath))
|
||||
|
||||
@@ -10,8 +10,7 @@ import { join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { describe, expect, it, type TestContext } from 'vitest'
|
||||
import { OPTIONAL_BUNDLES, PROFILE_TEMPLATES } from '@deepseek-ai/dsh-official-bundles'
|
||||
import yaml from 'js-yaml'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { HOME_PATCH_PATH, MANIFEST_PATH, packVfsImage } from '../src/pack.ts'
|
||||
import { installationManifest, platformHomePatch, profileRoster } from '../src/repository.ts'
|
||||
|
||||
@@ -93,7 +92,7 @@ describe('image layout', () => {
|
||||
expect(HOME_PATCH_PATH).toBe('home/cordis.patch.yml')
|
||||
const text = new TextDecoder().decode(result.files[HOME_PATCH_PATH])
|
||||
expect(text).toContain("!!js dshHomePath('sessions')")
|
||||
expect(yaml.load(text, { schema: entryListSchema })).toEqual(homePatch)
|
||||
expect(parseEntryYaml(text)).toEqual(homePatch)
|
||||
})
|
||||
|
||||
it('refuses an installation that is also a roster package', (test) => {
|
||||
|
||||
@@ -69,8 +69,7 @@
|
||||
"dependencies": {
|
||||
"@deepseek-ai/dsh-app-boot": "workspace:*",
|
||||
"@deepseek-ai/schemastery": "workspace:~",
|
||||
"zod": "4.6.6",
|
||||
"js-yaml": "^4.3.2"
|
||||
"zod": "4.6.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@deepseek-ai/dsh-brand": "workspace:*",
|
||||
@@ -99,7 +98,6 @@
|
||||
"@deepseek-ai/dsh-sandbox-policy": "workspace:*",
|
||||
"@deepseek-ai/dsh-user-approval": "workspace:*",
|
||||
"@deepseek-ai/dsh-agent-preset": "workspace:*",
|
||||
"@deepseek-ai/dsh-working-directory": "workspace:*",
|
||||
"@types/js-yaml": "^4.0.9"
|
||||
"@deepseek-ai/dsh-working-directory": "workspace:*"
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,7 @@ import { Context, Service } from '@deepseek-ai/cordis'
|
||||
import z from '@deepseek-ai/schemastery'
|
||||
import { Remote, RemoteError, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol'
|
||||
import { bindScopeParent, createScope, scopeOf, scopeParentOf, type Scope, type ScopeKey, type ScopeParentBinding } from '@deepseek-ai/dsh-scope'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { dump } from 'js-yaml'
|
||||
import { stringifyEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import type { Agent } from '@deepseek-ai/dsh-agent'
|
||||
import type { Session } from '@deepseek-ai/dsh-session'
|
||||
// Type-only: the optional `settings` service this registry keeps off the generated pages.
|
||||
@@ -239,7 +238,7 @@ export class AgentPresetRegistry extends TypertRemoteService {
|
||||
}
|
||||
const { id, name, description, plugins } = record.config
|
||||
// The Loader's own dialect, so `!!js` conditions read as declared rather than as expression objects.
|
||||
const content = dump(plugins, { schema: entryListSchema, noRefs: true, lineWidth: -1 })
|
||||
const content = stringifyEntryYaml(plugins, { lineWidth: -1 })
|
||||
return Promise.resolve({
|
||||
agentPreset: id, content, ...(name === undefined ? {} : { name }), ...(description === undefined ? {} : { description }),
|
||||
})
|
||||
|
||||
@@ -49,8 +49,6 @@
|
||||
"@deepseek-ai/dsh-plugin-detail": "workspace:*",
|
||||
"@deepseek-ai/dsh-skill": "workspace:*",
|
||||
"@deepseek-ai/dsh-skill-filesystem": "workspace:*",
|
||||
"@deepseek-ai/schemastery": "workspace:~",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"js-yaml": "^4.3.2"
|
||||
"@deepseek-ai/schemastery": "workspace:~"
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,7 @@ import { tmpdir } from 'node:os'
|
||||
import { dirname, join, resolve, sep } from 'node:path'
|
||||
import { Context } from '@deepseek-ai/cordis'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import * as yaml from 'js-yaml'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { codePointLength } from '@deepseek-ai/dsh-compaction-tool-result-pruner'
|
||||
import { detailImage, languageChain, localFiles, readPackageDocument } from '@deepseek-ai/dsh-plugin-detail'
|
||||
import SkillRegistry, { renderSkillContent } from '@deepseek-ai/dsh-skill'
|
||||
@@ -89,7 +88,7 @@ describe('the shipped dsh-doc skill', () => {
|
||||
for (const name of readdirSync(templates)) {
|
||||
const dir = join(templates, name)
|
||||
const manifest = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8')) as { dsh: { bundle: { patch: string } } }
|
||||
const patch = yaml.load(readFileSync(join(dir, manifest.dsh.bundle.patch), 'utf8'), { schema: entryListSchema })
|
||||
const patch = parseEntryYaml(readFileSync(join(dir, manifest.dsh.bundle.patch), 'utf8'))
|
||||
expect(Array.isArray(patch)).toBe(true)
|
||||
for (const file of readdirSync(dir).filter(entry => entry.endsWith('.js'))) {
|
||||
execFileSync(process.execPath, ['--check', join(dir, file)])
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/** Mount source modules through a real profile, patch file, and reload coordinator. */
|
||||
import { mkdir, readFile, writeFile } from 'node:fs/promises'
|
||||
import { join } from 'node:path'
|
||||
import yaml from 'js-yaml'
|
||||
import type { Context } from '@deepseek-ai/cordis'
|
||||
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { parseEntryYaml, stringifyEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import type { EntryOptions } from '@deepseek-ai/cordis-plugin-loader'
|
||||
import Timer from '@deepseek-ai/cordis-plugin-timer'
|
||||
import { initProfile, mountRootInclude, readProfilePatches, type ProfileContext } from '@deepseek-ai/dsh-app-boot'
|
||||
@@ -19,9 +18,9 @@ export async function profileComposition(ctx: Context, home: string, baseFile: s
|
||||
await mkdir(bundle, { recursive: true })
|
||||
await writeFile(join(home, 'package.json'), '{"name":"test-installation"}\n')
|
||||
await writeFile(join(bundle, 'package.json'), JSON.stringify({ name: 'test-profile-bundle', version: '1.0.0', dsh: { bundle: { patch: 'cordis.patch.yml' } } }))
|
||||
const rows = yaml.load(await readFile(baseFile, 'utf8'), { schema: entryListSchema }) as EntryOptions[]
|
||||
const rows = parseEntryYaml(await readFile(baseFile, 'utf8')) as EntryOptions[]
|
||||
for (const row of rows) row.id ??= row.name.replace('@deepseek-ai/dsh-', '')
|
||||
await writeFile(join(bundle, 'cordis.patch.yml'), yaml.dump([{ insert: rows }], { schema: entryListSchema }))
|
||||
await writeFile(join(bundle, 'cordis.patch.yml'), stringifyEntryYaml([{ insert: rows }]))
|
||||
await writeFile(join(dir, 'cordis.yml'), '[]\n')
|
||||
const profile: ProfileContext = {
|
||||
name: 'test', startedBundles: ['test-profile-bundle'], dir, patchPath: join(dir, 'cordis.patch.yml'),
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@deepseek-ai/cordis": "workspace:~",
|
||||
"@deepseek-ai/cordis-plugin-include": "workspace:~",
|
||||
"@deepseek-ai/dsh-agent": "workspace:*",
|
||||
"@deepseek-ai/dsh-app-boot": "workspace:*",
|
||||
"@deepseek-ai/dsh-llm": "workspace:*",
|
||||
|
||||
@@ -15,7 +15,7 @@ import type {
|
||||
} from '@anthropic-ai/claude-agent-sdk'
|
||||
import { Context } from '@deepseek-ai/cordis'
|
||||
import Loader from '@deepseek-ai/cordis-plugin-loader'
|
||||
import * as yaml from 'js-yaml'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import {
|
||||
afterEach,
|
||||
beforeEach,
|
||||
@@ -392,7 +392,7 @@ describe('task admission and package contracts', () => {
|
||||
)
|
||||
}
|
||||
|
||||
const parsed = yaml.load(readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8'))
|
||||
const parsed = parseEntryYaml(readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8'))
|
||||
expect(parsed).toEqual([{ insert: [
|
||||
{ id: 'subagent-claude-code', name: '@deepseek-ai/dsh-subagent-claude-code' },
|
||||
{ id: 'tool-subagent-claude-code', name: '@deepseek-ai/dsh-tool-subagent', config: {
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@deepseek-ai/cordis": "workspace:~",
|
||||
"@deepseek-ai/cordis-plugin-include": "workspace:~",
|
||||
"@deepseek-ai/cordis-plugin-loader": "workspace:~",
|
||||
"@deepseek-ai/dsh-agent": "workspace:*",
|
||||
"@deepseek-ai/dsh-app-boot": "workspace:*",
|
||||
|
||||
@@ -7,7 +7,7 @@ import { PassThrough } from 'node:stream'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { Context } from '@deepseek-ai/cordis'
|
||||
import Loader from '@deepseek-ai/cordis-plugin-loader'
|
||||
import * as yaml from 'js-yaml'
|
||||
import { parseEntryYaml } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import type { Agent } from '@deepseek-ai/dsh-agent'
|
||||
import type { ContentBlock } from '@deepseek-ai/dsh-llm'
|
||||
@@ -405,7 +405,7 @@ describe('task admission and package contracts', () => {
|
||||
)
|
||||
}
|
||||
|
||||
const parsed = yaml.load(readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8'))
|
||||
const parsed = parseEntryYaml(readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8'))
|
||||
expect(parsed).toEqual([{ insert: [
|
||||
{ id: 'subagent-codex', name: '@deepseek-ai/dsh-subagent-codex' },
|
||||
{ id: 'tool-subagent-codex', name: '@deepseek-ai/dsh-tool-subagent', config: {
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
"dependencies": {
|
||||
"@testing-library/dom": "^10.4.1",
|
||||
"@testing-library/react": "^16.3.3",
|
||||
"js-yaml": "^4.3.2",
|
||||
"vitest": "^4.1.11"
|
||||
},
|
||||
"peerDependencies": {
|
||||
@@ -89,7 +88,6 @@
|
||||
"@deepseek-ai/dsh-subagent": "workspace:*",
|
||||
"@deepseek-ai/dsh-typert-protocol": "workspace:*",
|
||||
"@deepseek-ai/dsh-web-app": "workspace:*",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"@deepseek-ai/dsh-client-ui-context-menu": "workspace:*"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* The browser roster of a `dsh --profile`, read from its bundle patch files
|
||||
* the way the launcher composes them: each bundle's `dsh.bundle.patch` file list is
|
||||
* parsed with the include plugin's YAML dialect (`entryListSchema`) and
|
||||
* parsed with the include plugin's `parseEntryYaml` and
|
||||
* composed by its `applyEntryPatches`; every enabled row whose package
|
||||
* declares `dsh.client.platform === 'web'` becomes a roster row carrying that
|
||||
* declaration's `inject` and `immediately`; rows nested in Loader groups count
|
||||
@@ -18,9 +18,8 @@ import { createRequire } from 'node:module'
|
||||
import { basename, dirname, join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { evaluate, isJsExpr, type EntryOptions } from '@deepseek-ai/cordis-plugin-loader'
|
||||
import { applyEntryPatches, entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { applyEntryPatches, parseEntryYaml, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { exactPackageSpecifier, parseDshClient } from '@deepseek-ai/dsh-client-modules/client'
|
||||
import * as yaml from 'js-yaml'
|
||||
import { ClientRoster, type ClientRosterRow } from './roster.ts'
|
||||
|
||||
/**
|
||||
@@ -96,7 +95,7 @@ function readLayer(bundle: string, anchor: string): BundleLayer {
|
||||
}
|
||||
const patches = files.flatMap((patch) => {
|
||||
const file = join(dirname(manifestPath), patch)
|
||||
const parsed: unknown = yaml.load(readFileSync(file, 'utf8'), { schema: entryListSchema })
|
||||
const parsed: unknown = parseEntryYaml(readFileSync(file, 'utf8'))
|
||||
if (!Array.isArray(parsed)) throw new Error(`client-test-runtime: ${file} must be a top-level list of patches`)
|
||||
return parsed as PatchOptions[]
|
||||
})
|
||||
|
||||
@@ -13,7 +13,6 @@ import { createRequire } from 'node:module'
|
||||
import { basename, dirname, join, resolve } from 'node:path'
|
||||
import { Readable, Writable } from 'node:stream'
|
||||
import { pathToFileURL } from 'node:url'
|
||||
import * as yaml from 'js-yaml'
|
||||
import {
|
||||
client as createAcpClientApp,
|
||||
methods,
|
||||
@@ -37,7 +36,7 @@ import {
|
||||
type SetSessionConfigOptionResponse,
|
||||
type SessionNotification,
|
||||
} from '@agentclientprotocol/sdk'
|
||||
import { entryListSchema, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { parseEntryYaml, stringifyEntryYaml, type PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import { resolveExampleLaunch } from '@deepseek-ai/dsh-loader-smoke'
|
||||
|
||||
const EXIT_MARKER_GRACE_MS = 250
|
||||
@@ -417,7 +416,7 @@ function linkProfilePackage(source: string, cwd: string, profile: string, packag
|
||||
export function materializeProfilePatch(
|
||||
source: string, cwd: string, profile: string, targetDir: string, index: number,
|
||||
): string {
|
||||
const parsed = yaml.load(readFileSync(source, 'utf8'), { schema: entryListSchema })
|
||||
const parsed = parseEntryYaml(readFileSync(source, 'utf8'))
|
||||
if (!Array.isArray(parsed)) throw new Error(`snapshot profile patch must be a top-level array: ${source}`)
|
||||
const patches = parsed as PatchOptions[]
|
||||
const baseDir = dirname(source)
|
||||
@@ -439,7 +438,7 @@ export function materializeProfilePatch(
|
||||
for (const entry of patch.insert ?? []) visitEntry(entry)
|
||||
}
|
||||
const target = join(targetDir, `${String(index)}-${basename(source)}`)
|
||||
writeFileSync(target, yaml.dump(patches, { schema: entryListSchema, lineWidth: -1, noRefs: true }))
|
||||
writeFileSync(target, stringifyEntryYaml(patches, { lineWidth: -1 }))
|
||||
return target
|
||||
}
|
||||
|
||||
|
||||
Generated
+6
-48
@@ -2103,9 +2103,6 @@ importers:
|
||||
ajv:
|
||||
specifier: ^8.20.0
|
||||
version: 8.20.0
|
||||
js-yaml:
|
||||
specifier: ^4.3.2
|
||||
version: 4.3.2
|
||||
node-addon-require-builtin:
|
||||
specifier: ^0.1.9
|
||||
version: 0.1.9
|
||||
@@ -2143,9 +2140,6 @@ importers:
|
||||
'@deepseek-ai/schemastery':
|
||||
specifier: link:../../../vendor/schemastery
|
||||
version: link:../../../vendor/schemastery
|
||||
'@types/js-yaml':
|
||||
specifier: ^4.0.9
|
||||
version: 4.0.9
|
||||
'@types/semver':
|
||||
specifier: ^7.8.0
|
||||
version: 7.8.0
|
||||
@@ -2170,9 +2164,6 @@ importers:
|
||||
'@deepseek-ai/dsh-atomic-write':
|
||||
specifier: workspace:*
|
||||
version: link:../../util/atomic-write
|
||||
js-yaml:
|
||||
specifier: ^4.3.2
|
||||
version: 4.3.2
|
||||
yaml:
|
||||
specifier: ^2.8.1
|
||||
version: 2.9.0
|
||||
@@ -2192,9 +2183,6 @@ importers:
|
||||
'@deepseek-ai/dsh-hmr':
|
||||
specifier: workspace:*
|
||||
version: link:../hmr
|
||||
'@types/js-yaml':
|
||||
specifier: ^4.0.9
|
||||
version: 4.0.9
|
||||
|
||||
packages/boot/hmr:
|
||||
dependencies:
|
||||
@@ -10422,9 +10410,6 @@ importers:
|
||||
'@deepseek-ai/cordis-plugin-loader':
|
||||
specifier: workspace:~
|
||||
version: link:../../../vendor/loader
|
||||
js-yaml:
|
||||
specifier: ^4.2.0
|
||||
version: 4.3.2
|
||||
optionalDependencies:
|
||||
'@deepseek-ai/dsh-cua-macos':
|
||||
specifier: workspace:*
|
||||
@@ -10674,9 +10659,6 @@ importers:
|
||||
'@modelcontextprotocol/client':
|
||||
specifier: 2.2.0
|
||||
version: 2.2.0
|
||||
js-yaml:
|
||||
specifier: ^4.3.2
|
||||
version: 4.3.2
|
||||
optionalDependencies:
|
||||
'@deepseek-ai/dsh-cua-macos':
|
||||
specifier: workspace:*
|
||||
@@ -11333,9 +11315,6 @@ importers:
|
||||
'@deepseek-ai/cordis-plugin-include':
|
||||
specifier: workspace:~
|
||||
version: link:../../../vendor/include
|
||||
js-yaml:
|
||||
specifier: ^4.3.2
|
||||
version: 4.3.2
|
||||
|
||||
packages/experimental/liveshare:
|
||||
dependencies:
|
||||
@@ -11669,9 +11648,6 @@ importers:
|
||||
'@deepseek-ai/dsh-tools':
|
||||
specifier: workspace:*
|
||||
version: link:../../core/tools
|
||||
js-yaml:
|
||||
specifier: ^4.3.2
|
||||
version: 4.3.2
|
||||
|
||||
packages/experimental/plugin-market-bundle:
|
||||
dependencies:
|
||||
@@ -12716,9 +12692,6 @@ importers:
|
||||
'@deepseek-ai/dsh-session-format-v3-to-v4':
|
||||
specifier: workspace:*
|
||||
version: link:../../session/session-format-v3-to-v4
|
||||
js-yaml:
|
||||
specifier: ^4.3.2
|
||||
version: 4.3.2
|
||||
picomatch:
|
||||
specifier: ^4.0.7
|
||||
version: 4.0.7
|
||||
@@ -12726,9 +12699,6 @@ importers:
|
||||
'@deepseek-ai/cordis':
|
||||
specifier: workspace:~
|
||||
version: link:../../../vendor/cordis
|
||||
'@types/js-yaml':
|
||||
specifier: ^4.0.9
|
||||
version: 4.0.9
|
||||
'@types/picomatch':
|
||||
specifier: ^4.0.3
|
||||
version: 4.0.3
|
||||
@@ -15108,12 +15078,6 @@ importers:
|
||||
'@deepseek-ai/dsh-skill-filesystem':
|
||||
specifier: workspace:*
|
||||
version: link:../../skill/skill-filesystem
|
||||
'@types/js-yaml':
|
||||
specifier: ^4.0.9
|
||||
version: 4.0.9
|
||||
js-yaml:
|
||||
specifier: ^4.3.2
|
||||
version: 4.3.2
|
||||
|
||||
packages/preset/agent-preset-registry:
|
||||
dependencies:
|
||||
@@ -15123,9 +15087,6 @@ importers:
|
||||
'@deepseek-ai/schemastery':
|
||||
specifier: link:../../../vendor/schemastery
|
||||
version: link:../../../vendor/schemastery
|
||||
js-yaml:
|
||||
specifier: ^4.3.2
|
||||
version: 4.3.2
|
||||
zod:
|
||||
specifier: 4.6.6
|
||||
version: 4.6.6
|
||||
@@ -15211,9 +15172,6 @@ importers:
|
||||
'@deepseek-ai/dsh-working-directory':
|
||||
specifier: workspace:*
|
||||
version: link:../../session/working-directory
|
||||
'@types/js-yaml':
|
||||
specifier: ^4.0.9
|
||||
version: 4.0.9
|
||||
|
||||
packages/preset/persona:
|
||||
dependencies:
|
||||
@@ -17854,6 +17812,9 @@ importers:
|
||||
'@deepseek-ai/cordis':
|
||||
specifier: workspace:~
|
||||
version: link:../../../vendor/cordis
|
||||
'@deepseek-ai/cordis-plugin-include':
|
||||
specifier: workspace:~
|
||||
version: link:../../../vendor/include
|
||||
'@deepseek-ai/dsh-agent':
|
||||
specifier: workspace:*
|
||||
version: link:../../core/agent
|
||||
@@ -17924,6 +17885,9 @@ importers:
|
||||
'@deepseek-ai/cordis':
|
||||
specifier: workspace:~
|
||||
version: link:../../../vendor/cordis
|
||||
'@deepseek-ai/cordis-plugin-include':
|
||||
specifier: workspace:~
|
||||
version: link:../../../vendor/include
|
||||
'@deepseek-ai/cordis-plugin-loader':
|
||||
specifier: workspace:~
|
||||
version: link:../../../vendor/loader
|
||||
@@ -18606,9 +18570,6 @@ importers:
|
||||
'@testing-library/react':
|
||||
specifier: ^16.3.3
|
||||
version: 16.3.3(@testing-library/[email protected])(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
|
||||
js-yaml:
|
||||
specifier: ^4.3.2
|
||||
version: 4.3.2
|
||||
vitest:
|
||||
specifier: ^4.1.11
|
||||
version: 4.1.11(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
|
||||
@@ -18712,9 +18673,6 @@ importers:
|
||||
'@deepseek-ai/dsh-web-app':
|
||||
specifier: workspace:*
|
||||
version: link:../../bundle/web-app
|
||||
'@types/js-yaml':
|
||||
specifier: ^4.0.9
|
||||
version: 4.0.9
|
||||
react:
|
||||
specifier: ^18.2.0
|
||||
version: 18.3.1
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/** 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 binary integers as numbers and dates as strings', () => {
|
||||
expect(parseEntryYaml('- 0b101\n- 2001-01-01\n- ~\n')).toEqual([5, '2001-01-01', null])
|
||||
expect(parseEntryYaml('')).toBeUndefined()
|
||||
})
|
||||
|
||||
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()
|
||||
})
|
||||
})
|
||||
+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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+1
-1
@@ -37,7 +37,7 @@ Keep this log exhaustive — every divergence from upstream must be listed. Each
|
||||
- **V7 · JSDoc enrichment**: added `@param`/`@returns` tags and contract documentation (disposal semantics, waterfall veto, bail conditions, error cases) across the public plugin-author surface — `Context` (class, statics, the `isolate()` rule that isolated scopes never fall back to an injected view, and the `Context` interface properties incl. `[Context.root]`), module re-exports, shared utility helpers, `EventsService`, `Fiber`, `ValidationError` and its path helpers, `RegistryService`, `ReflectService`, `Service` and its intercept-metadata members, `LoggerService` and their `declare module './context.ts'` overloads. The upstream line comment on `reflect.ts`'s exported `locate()` is rewritten as JSDoc. Loader documentation covers `loader/src/{index,internal,config/entry,config/group,config/isolate,config/tree,config/utils}.ts`, including entry ownership, tree mutation methods, and the `!!js` discriminator. The upstream `EventsService.dispatch()` deprecation annotation is omitted: DSH enumerates callbacks to contain each observer failure independently, which the typed dispatch methods do not provide. Timer retains its local class and helper summaries; its README is local documentation because the upstream package has none. Cosmokit and Schemastery add summaries to their exported helpers, types and namespaces, logger-console to its exporters and config namespace, and HMR to its build-failure logger in `hmr/src/error.ts`. Comment-only; no code changes. Motivation: the website API-reference generator renders these docs and hard-errors on undocumented members. Retire this entry when the enrichment is upstreamed.
|
||||
- **V9 · `hmr/src/index.ts` module-watcher readiness and native paths**: realpath the existing watch base, classify framework modules and attach listeners before reporting readiness, and compare config paths using both canonical and configured spellings. This preserves Node module-cache identity across Windows short-name paths and filesystem aliases. The main watcher uses `ignoreInitial: true` so startup reads do not trigger another refresh; exact profile patch watching is owned by `packages/boot/hmr/src/watch-config.ts`. The Include change listener logs a rejected `Include.refresh()` instead of leaving the rejection unhandled; the rejection reports unsaved runtime changes while Include keeps its running tree. Covered by `packages/boot/hmr/tests/watch-config.spec.ts` and `scripts/cordis-vendor-hmr-include.spec.ts`.
|
||||
- **V10 · Vendored Node-compatible TypeScript**: marked erased imports explicitly across `cordis`, `loader`, `include`, `hmr`, and `schemastery` so Node's native TypeScript transform does not request types as runtime exports. Schemastery's source uses an ESM default export and its package declares `type: module`. Conditional exports select `.mjs` for import and `.cjs` for require; without them, concurrent imports under module-hook hosts reach the CJS entry and can race its require of ESM Cosmokit (`ERR_REQUIRE_ESM_RACE_CONDITION`).
|
||||
- **V11 · Include patch and YAML exports**: `include/src/index.ts` exports upstream `applyPatches` as `applyEntryPatches` and the `!!js` YAML dialect as `entryListSchema`, so `dsh --dump-config` composes entries with the same algorithm that mounting uses. Covered by `packages/boot/app-boot/tests/config-reload.spec.ts` and `scripts/cordis-entry-commit.spec.ts`.
|
||||
- **V11 · Include patch and YAML exports**: `include/src/index.ts` exports upstream `applyPatches` as `applyEntryPatches`, so `dsh --dump-config` composes entries with the same algorithm that mounting uses. It also exports `parseEntryYaml`, `stringifyEntryYaml` and `entryYamlErrorPosition` over the `!!js` YAML dialect, and `_read()` parses through `parseEntryYaml`, so every DSH reader and writer of Include-dialect YAML uses Include's parser; `stringifyEntryYaml` always writes with `noRefs` and offers no option to emit aliases, while Include's own writer keeps upstream's options. Covered by `packages/boot/app-boot/tests/config-reload.spec.ts`, `scripts/cordis-entry-commit.spec.ts` and `scripts/cordis-entry-yaml.spec.ts`.
|
||||
- **V14 · Include persistence results**: `include/src/index.ts` keeps an error for unsaved journal changes. `flush()` retries pending writes and rejects while changes remain unsaved; `stop()` returns the same result and always stops the child tree; a later successful flush clears previous errors. A failed `refresh()` can also reject while runtime changes remain unsaved. Patch-owned changes route to the parent Include, so callers that need them persisted must flush that parent too. The constructor omits upstream's `ctx.hmr.watch(this.filename, () => this.refresh())` registration because neither HMR provider exposes `watch()`; both find each Include by scanning loader entries for its `filename` and call `refresh()`. Ordinary Fiber teardown keeps its error containment. Covered by `scripts/cordis-include-journal.spec.ts` and `packages/host/directory-picker-auto/tests/loader-composition.spec.ts`.
|
||||
- **V15 · Configuration access across Core, Loader, Include and HMR**: rc.11 Core owns raw `Fiber.config`, `internal/config(fiber, next)`, `internal/commit` and awaited `internal/update(config, next)`. Root-fiber candidate resolution remains available without a plugin schema. Local `rawConfig`, `resolveConfig(candidate)` and `effectiveConfig` accessors retain the DSH consumer API. Fiber caches the object passed to activation or a successful update that keeps the instance; candidate resolution is pure, failed or superseded updates cannot replace the cache, and volatile updates retain references. Loader resolves only entry roots and excludes Group/Include tree carriers, so nested `!!js` expressions wait for their own injections. Include retains its tree-carrier marker and public patch exports, and HMR transfers raw config through the accessors. Covered by `scripts/cordis-config-access.spec.ts`, `scripts/cordis-core-lifecycle.spec.ts` and the boot/HMR suites.
|
||||
- **V16 · `cordis/package.json` publishes `src`**: added `src` to the `files` list, joining the other eight vendored packages. Cordis declares `"./src/*": "./src/*"` in its exports, so a tarball without `src` publishes an export map pointing at absent files; the release change judgement also reads `files` to decide whether a diff reaches the payload, and a package whose only published paths are build output has no tracked path to match.
|
||||
|
||||
Vendored
+1
-1
@@ -44,7 +44,7 @@ Patches can insert entries or override fields on entries with a matching `id`.
|
||||
|
||||
## Patch composition and persistence
|
||||
|
||||
`applyEntryPatches(data, patches, warn)` uses the same upstream algorithm as mounting. It clones file entries even without patches and clones inserted entry lists before indexing them, so later patches can address inserted rows without mutating those input lists. `entryListSchema` exposes Include’s YAML dialect to configuration tools. Nested entry expressions remain literal until their owning Loader entry evaluates them.
|
||||
`applyEntryPatches(data, patches, warn)` uses the same upstream algorithm as mounting. It clones file entries even without patches and clones inserted entry lists before indexing them, so later patches can address inserted rows without mutating those input lists. `parseEntryYaml(content)` and `stringifyEntryYaml(value, options)` read and write Include’s YAML dialect for configuration tools, and `entryYamlErrorPosition(error)` locates a parse error. `stringifyEntryYaml` writes repeated references in full instead of as aliases. Nested entry expressions remain literal until their owning Loader entry evaluates them.
|
||||
|
||||
Tree mutations arrive through `commit(change)` and enter a journal. Include merges them with the latest file before writing; file edits win conflicts on the same fields and produce a diagnostic. Patch-owned fields and inserted entries update the parent Include’s patches instead of the included file. Invalid, missing or read-only files leave unsaved changes in memory.
|
||||
|
||||
|
||||
Vendored
+40
-4
@@ -21,9 +21,45 @@ const JsExpr = new yaml.Type('tag:yaml.org,2002:js', {
|
||||
represent: (data) => data['__jsExpr'],
|
||||
})
|
||||
|
||||
/** YAML dialect preserving child-owned JavaScript expression nodes. */
|
||||
export const entryListSchema = yaml.JSON_SCHEMA.extend(JsExpr)
|
||||
const schema = entryListSchema
|
||||
const schema = yaml.JSON_SCHEMA.extend(JsExpr)
|
||||
|
||||
/** Options for {@link stringifyEntryYaml}. */
|
||||
export interface EntryYamlStringifyOptions {
|
||||
/** Column at which long scalars are folded; `-1` disables folding. Defaults to 80. */
|
||||
lineWidth?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse text in Include's YAML dialect. A `!!js` scalar becomes a child-owned JavaScript expression node that stays
|
||||
* literal until its owning Loader entry evaluates it.
|
||||
* @param content - YAML source text.
|
||||
* @returns the parsed value, or `undefined` for an empty document.
|
||||
* @throws the parser's syntax error; {@link entryYamlErrorPosition} reads its location.
|
||||
*/
|
||||
export function parseEntryYaml(content: string): unknown {
|
||||
return yaml.load(content, { schema })
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize a value in Include's YAML dialect. JavaScript expression nodes are written as `!!js` scalars. The output
|
||||
* never contains anchors or aliases: repeated object references are written out in full, and no option changes this.
|
||||
* @param value - entry list, patch list, or entry fragment to serialize.
|
||||
* @param options - output formatting.
|
||||
* @returns YAML text ending with a newline.
|
||||
*/
|
||||
export function stringifyEntryYaml(value: unknown, options: EntryYamlStringifyOptions = {}): string {
|
||||
return yaml.dump(value, { schema, noRefs: true, lineWidth: options.lineWidth ?? 80 })
|
||||
}
|
||||
|
||||
/**
|
||||
* Locate a syntax error thrown by {@link parseEntryYaml}.
|
||||
* @param error - any caught value; only a parse error thrown by {@link parseEntryYaml} yields a position.
|
||||
* @returns the one-based line and column of the error, or `undefined` when the error carries no source location.
|
||||
*/
|
||||
export function entryYamlErrorPosition(error: unknown): { line: number; column: number } | undefined {
|
||||
if (!(error instanceof yaml.YAMLException) || !error.mark) return undefined
|
||||
return { line: error.mark.line + 1, column: error.mark.column + 1 }
|
||||
}
|
||||
|
||||
const types: Record<string, string> = {
|
||||
'.json': 'application/json',
|
||||
@@ -255,7 +291,7 @@ export class Include extends EntryTree {
|
||||
let data: any
|
||||
try {
|
||||
data = this.type === 'application/yaml'
|
||||
? yaml.load(content, { schema })
|
||||
? parseEntryYaml(content)
|
||||
: JSON.parse(content)
|
||||
} catch (error) {
|
||||
throw new ConfigFileError('parse', this.filename, error)
|
||||
|
||||
Reference in new issue
Block a user