Sync master and move the Files upload upgrade guide to v0.2.2-rc.3

This commit is contained in:
creatixchu committed 2026-11-13 15:54:14 +08:00
commit 17280dfe22
505 files changed
+1433 -1071

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh",
"description": "dsh CLI: profile launch, plugin management, and configuration inspection",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+2 -3
View File
@@ -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')
@@ -3,7 +3,7 @@
* @module subagent-settlement-fence
*/
import type { Context } from '@deepseek-ai/cordis'
import { Context } from '@deepseek-ai/cordis'
import type {} from '@deepseek-ai/dsh-agent-loop'
import type {} from '@deepseek-ai/dsh-subagent'
@@ -24,12 +24,12 @@ export function apply(ctx: Context): void {
let hasDelivered = false
ctx.effect(() => {
const disposeInbox = ctx.root.on('agent/inbox/inserted', ({ agent, message }) => {
const disposeInbox = ctx[Context.root].on('agent/inbox/inserted', ({ agent, message }) => {
if (agent.session.header.parentSession !== undefined || message.source.kind !== 'subagent-settled') return
hasDelivered = true
delivered.resolve(undefined)
})
const disposeStep = ctx.root.on('agent/pre-step', async ({ agent, turn, step }, next) => {
const disposeStep = ctx[Context.root].on('agent/pre-step', async ({ agent, turn, step }, next) => {
if (agent.session.header.parentSession === undefined && turn === 1 && step === 2 && !hasDelivered) {
await delivered.promise
}
@@ -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 }] },
]))
+2 -3
View File
@@ -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)
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-desktop-host",
"description": "Private Node-mode host process for the Electron desktop application",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"private": true,
"license": "MIT",
"type": "module",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@deepseek-ai/dsh-desktop-publisher",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"description": "Private Desktop release metadata, rollout and website publisher",
"private": true,
"type": "module",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-desktop",
"description": "Electron desktop shell for a bundled dsh runtime and external plugins",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"private": true,
"license": "MIT",
"author": {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-plugin-market-generator",
"description": "Reference generator of plugin market index files from a list of npm packages and Git repositories",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"private": true,
"type": "module",
"scripts": {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-web-frontend",
"description": "Web application entry: vite build over the @deepseek-ai/dsh-client-web shell library; dist/ served by apps/cli's dsh web",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+2 -3
View File
@@ -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
}
+4 -4
View File
@@ -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()
@@ -83,7 +83,8 @@ it('activates the actual default Client registry without experimental packages',
// Capture the first real root and immediately restore the registry method.
prototype.plugin = function (...args: Parameters<RegistryService['plugin']>) {
prototype.plugin = plugin
observation.ctx = this.ctx.root
// This init script runs in the page, where the test's `Context` import is unavailable.
observation.ctx = this.ctx[Symbol.for('cordis.root') as typeof Context.root]
return plugin.apply(this, args)
}
try {
+2 -3
View File
@@ -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)
+3 -4
View File
@@ -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
}
+2 -2
View File
@@ -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')
+2 -3
View File
@@ -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)
+19 -19
View File
@@ -9,17 +9,14 @@
en: fc6fd9ae25b8e9e5
zh: 1a2407d299404ace
/context/ctx-extend-meta:
en: 2c407cb9589b001f
zh: 70dc8650250cd4c5
en: 18c7f34127f5c5fc
zh: fa37a391e9c49f24
/context/ctx-isolate-name-label:
en: ab77052c3bf31e2b
zh: 686ca829ea5b8170
en: 4b61ce02474b983b
zh: 5ab2948ddcff2687
/context/ctx-intercept-name-config:
en: 1bd1e349f5c8687d
zh: 7634b27d2c9bade4
/context/ctx-root:
en: eb89a7f0d2bc1753
zh: 263219126a310d3b
en: 7efc60c71ddc4a6e
zh: 58dd647c41c10897
/context/ctx-baseurl:
en: 29c28e7558cea0ad
zh: 9b591e449c1bfd72
@@ -38,21 +35,24 @@
/context/static-members:
en: ceb197529207a8ed
zh: 7d444c03f8be0f0d
/context/static-members/context-root:
en: 7616dd841e4f04cb
zh: 2f1a3bdb9ed1f6f7
/context/static-members/context-effect:
en: 19f4aaef44a7e8eb
zh: 2179cf28a7ee3f6a
en: 6c3b77ace7d4fda3
zh: 470c685819275d5f
/context/static-members/context-filter:
en: e8ca384b9a1ea98b
zh: 82189892bf0afcb0
en: 1c97248eeabea2d0
zh: 08eadac6a0871429
/context/static-members/context-isolate:
en: b8673b719837ce51
zh: 83892f9f96c3ac28
en: 6c490ac1293b0315
zh: 51d371b38de7773a
/context/static-members/context-intercept:
en: f3ebe6568cc9a863
zh: bb51ab61a4e47d33
en: d3f44b89b641a11b
zh: b88177e0a59ef9a5
/context/static-members/context-is-value:
en: 7425e0ee4bc1ada7
zh: 93dee27133ded9e0
en: 0ef94fa412edfe17
zh: 30b64cd2fbb2d12e
/context/service-store-and-mixins:
en: 9f7ca8a6a0f80512
zh: 05e8cbc30e5709fc
+38 -34
View File
@@ -34,7 +34,7 @@ The child prototypally inherits every property of this context; own properties o
**Returns** a child context inheriting from this one.
[Source](../../vendor/cordis/src/context.ts#L99)
[Source](../../vendor/cordis/src/context.ts#L101)
### ctx.isolate(name, label?)
@@ -46,6 +46,9 @@ The child prototypally inherits every property of this context; own properties o
* resolve against the new label instead of the parent's, so a different
* implementation can be provided without affecting the parent scope.
* Passing the same `label` to two `isolate()` calls joins their scopes.
* The returned context and plugins started below it never fall back to the
* enclosing plugin's injected `name`, even when `label` equals the parent's
* label; until a provider in the new scope supplies `name`, reading it throws.
*
* @param name — the service name to isolate.
* @param label — scope label to join; defaults to a fresh unique symbol.
@@ -56,55 +59,45 @@ isolate(name: string, label?: symbol)
Create a child context with an independent service scope for `name`.
Below the returned context, reads and writes of the service `name` resolve against the new label instead of the parent's, so a different implementation can be provided without affecting the parent scope. Passing the same `label` to two `isolate()` calls joins their scopes.
Below the returned context, reads and writes of the service `name` resolve against the new label instead of the parent's, so a different implementation can be provided without affecting the parent scope. Passing the same `label` to two `isolate()` calls joins their scopes. The returned context and plugins started below it never fall back to the enclosing plugin's injected `name`, even when `label` equals the parent's label; until a provider in the new scope supplies `name`, reading it throws.
- `name` — the service name to isolate.
- `label` — scope label to join; defaults to a fresh unique symbol.
**Returns** a child context whose `name` service resolves in the new scope.
[Source](../../vendor/cordis/src/context.ts#L121)
[Source](../../vendor/cordis/src/context.ts#L126)
### ctx.intercept(name, config)
```ts cordis-catalog
/**
* Add service-specific intercept config for plugins started below this
* Add service-specific intercept metadata for plugins started below this
* context.
*
* Plugins loaded under the returned context see `config` merged into the
* service's resolved config (ancestor entries first; see
* `Service[symbols.resolveConfig]`). The parent context is not affected.
* service's resolved intercept metadata (injected metadata first, then
* ancestor intercepts; see `Service[symbols.resolveIntercept]`). The parent
* context is not affected.
*
* @param name — the service name whose config to intercept.
* @param config — the intercept config to merge for that service.
* @param name — the service name whose metadata to intercept.
* @param config — the intercept metadata to merge for that service.
* @returns a child context carrying the additional intercept entry.
*/
intercept<K extends InjectKey>(name: K, config: Context[K] extends { [symbols.config]: infer T } ? T : never): this
intercept<K extends InjectKey>(name: K, config: Context[K] extends { [symbols.metadata]: infer T } ? T : never): this
intercept(name: string, config: any): this
```
Add service-specific intercept config for plugins started below this context.
Add service-specific intercept metadata for plugins started below this context.
Plugins loaded under the returned context see `config` merged into the service's resolved config (ancestor entries first; see `Service[symbols.resolveConfig]`). The parent context is not affected.
Plugins loaded under the returned context see `config` merged into the service's resolved intercept metadata (injected metadata first, then ancestor intercepts; see `Service[symbols.resolveIntercept]`). The parent context is not affected.
- `name` — the service name whose config to intercept.
- `config` — the intercept config to merge for that service.
- `name` — the service name whose metadata to intercept.
- `config` — the intercept metadata to merge for that service.
**Returns** a child context carrying the additional intercept entry.
[Source](../../vendor/cordis/src/context.ts#L139)
### ctx.root
```ts cordis-catalog
/** The root context of the application (every child context shares it). @experimental */
root: this
```
The root context of the application (every child context shares it). @experimental
[Source](../../vendor/cordis/src/context.ts#L22)
[Source](../../vendor/cordis/src/context.ts#L145)
### ctx.baseUrl
@@ -163,6 +156,17 @@ The plugin registry. Its methods are mixed onto `ctx` (`ctx.plugin`, `ctx.inject
## Static members
### Context.root
```ts cordis-catalog
/** Symbol key of the root context: `ctx[Context.root]` is the application's root context, shared by every child context. */
static readonly root: unique symbol
```
Symbol key of the root context: `ctx[Context.root]` is the application's root context, shared by every child context.
[Source](../../vendor/cordis/src/context.ts#L44)
### Context.effect
```ts cordis-catalog
@@ -172,7 +176,7 @@ static readonly effect: unique symbol
Symbol key under which a disposer exposes its EffectMeta diagnostics tree.
[Source](../../vendor/cordis/src/context.ts#L44)
[Source](../../vendor/cordis/src/context.ts#L46)
### Context.filter
@@ -183,29 +187,29 @@ static readonly filter: unique symbol
Symbol key for a context's listener filter, consulted on every event dispatch.
[Source](../../vendor/cordis/src/context.ts#L46)
[Source](../../vendor/cordis/src/context.ts#L48)
### Context.isolate
```ts cordis-catalog
/** Symbol key of the isolation map (see the `Context[symbols.isolate]` property). */
/** Symbol key of the isolation map: `ctx[Context.isolate]` maps each service name to its scope label. */
static readonly isolate: unique symbol
```
Symbol key of the isolation map (see the `Context[symbols.isolate]` property).
Symbol key of the isolation map: `ctx[Context.isolate]` maps each service name to its scope label.
[Source](../../vendor/cordis/src/context.ts#L48)
[Source](../../vendor/cordis/src/context.ts#L50)
### Context.intercept
```ts cordis-catalog
/** Symbol key of the intercept map (see the `Context[symbols.intercept]` property). */
/** Symbol key of the intercept map: `ctx[Context.intercept]` maps each service name to its intercept metadata. */
static readonly intercept: unique symbol
```
Symbol key of the intercept map (see the `Context[symbols.intercept]` property).
Symbol key of the intercept map: `ctx[Context.intercept]` maps each service name to its intercept metadata.
[Source](../../vendor/cordis/src/context.ts#L50)
[Source](../../vendor/cordis/src/context.ts#L52)
### Context.is(value)
@@ -230,7 +234,7 @@ Works across realms and across multiple copies of cordis, because the brand is k
**Returns** `true` if `value` is a Cordis context, narrowing its type.
[Source](../../vendor/cordis/src/context.ts#L61)
[Source](../../vendor/cordis/src/context.ts#L63)
## Service store and mixins
+38 -34
View File
@@ -36,7 +36,7 @@ extend(meta = {}): this
**返回**继承自当前上下文的子上下文。
[源码](../../vendor/cordis/src/context.ts#L99)
[源码](../../vendor/cordis/src/context.ts#L101)
### ctx.isolate(name, label?)
@@ -48,6 +48,9 @@ extend(meta = {}): this
* resolve against the new label instead of the parent's, so a different
* implementation can be provided without affecting the parent scope.
* Passing the same `label` to two `isolate()` calls joins their scopes.
* The returned context and plugins started below it never fall back to the
* enclosing plugin's injected `name`, even when `label` equals the parent's
* label; until a provider in the new scope supplies `name`, reading it throws.
*
* @param name — the service name to isolate.
* @param label — scope label to join; defaults to a fresh unique symbol.
@@ -58,55 +61,45 @@ isolate(name: string, label?: symbol)
创建一个子上下文,使 `name` 拥有独立的服务作用域。
在返回的上下文之下,对服务 `name` 的读写会根据新标签解析,而不再根据父上下文的标签解析,因此可以提供不同的实现而不影响父作用域。将同一个 `label` 传给两次 `isolate()` 调用,可使二者加入同一作用域。
在返回的上下文之下,对服务 `name` 的读写会根据新标签解析,而不再根据父上下文的标签解析,因此可以提供不同的实现而不影响父作用域。将同一个 `label` 传给两次 `isolate()` 调用,可使二者加入同一作用域。返回的上下文及在其下启动的插件都不会回退到外层插件注入的 `name`,即使 `label` 与父上下文的标签相同也是如此;在新作用域中有提供者提供 `name` 之前,读取它会抛出错误。
- `name`:要隔离的服务名称。
- `label`:要加入的作用域标签;默认为一个新建的唯一 symbol。
**返回**一个子上下文,其 `name` 服务在新作用域中解析。
[源码](../../vendor/cordis/src/context.ts#L121)
[源码](../../vendor/cordis/src/context.ts#L126)
### ctx.intercept(name, config)
```ts cordis-catalog
/**
* Add service-specific intercept config for plugins started below this
* Add service-specific intercept metadata for plugins started below this
* context.
*
* Plugins loaded under the returned context see `config` merged into the
* service's resolved config (ancestor entries first; see
* `Service[symbols.resolveConfig]`). The parent context is not affected.
* service's resolved intercept metadata (injected metadata first, then
* ancestor intercepts; see `Service[symbols.resolveIntercept]`). The parent
* context is not affected.
*
* @param name — the service name whose config to intercept.
* @param config — the intercept config to merge for that service.
* @param name — the service name whose metadata to intercept.
* @param config — the intercept metadata to merge for that service.
* @returns a child context carrying the additional intercept entry.
*/
intercept<K extends InjectKey>(name: K, config: Context[K] extends { [symbols.config]: infer T } ? T : never): this
intercept<K extends InjectKey>(name: K, config: Context[K] extends { [symbols.metadata]: infer T } ? T : never): this
intercept(name: string, config: any): this
```
为在此上下文之下启动的插件添加服务专属的拦截配置。
为在此上下文之下启动的插件添加服务专属的拦截元数据。
在返回的上下文下加载的插件会看到 `config` 已合并到服务解析后的配置中(祖先条目在前;见 `Service[symbols.resolveConfig]`)。父上下文不受影响。
在返回的上下文下加载的插件会看到 `config` 已合并到服务解析后的拦截元数据中(注入的元数据在前,其后是祖先上下文的拦截;见 `Service[symbols.resolveIntercept]`)。父上下文不受影响。
- `name`:要拦截其配置的服务名称。
- `config`:要为该服务合并的拦截配置。
- `name`:要拦截其元数据的服务名称。
- `config`:要为该服务合并的拦截元数据。
**返回**一个携带额外拦截条目的子上下文。
[源码](../../vendor/cordis/src/context.ts#L139)
### ctx.root
```ts cordis-catalog
/** The root context of the application (every child context shares it). @experimental */
root: this
```
应用的根上下文,所有子上下文均共享它。@experimental
[源码](../../vendor/cordis/src/context.ts#L22)
[源码](../../vendor/cordis/src/context.ts#L145)
### ctx.baseUrl
@@ -165,6 +158,17 @@ registry: RegistryService
## 静态成员
### Context.root
```ts cordis-catalog
/** Symbol key of the root context: `ctx[Context.root]` is the application's root context, shared by every child context. */
static readonly root: unique symbol
```
根上下文的 symbol 键:`ctx[Context.root]` 是应用的根上下文,所有子上下文共享它。
[源码](../../vendor/cordis/src/context.ts#L44)
### Context.effect
```ts cordis-catalog
@@ -174,7 +178,7 @@ static readonly effect: unique symbol
资源释放函数用于公开其 EffectMeta 诊断树的 symbol 键。
[源码](../../vendor/cordis/src/context.ts#L44)
[源码](../../vendor/cordis/src/context.ts#L46)
### Context.filter
@@ -185,29 +189,29 @@ static readonly filter: unique symbol
上下文监听器过滤器的 symbol 键,每次分派事件时都会查询该过滤器。
[源码](../../vendor/cordis/src/context.ts#L46)
[源码](../../vendor/cordis/src/context.ts#L48)
### Context.isolate
```ts cordis-catalog
/** Symbol key of the isolation map (see the `Context[symbols.isolate]` property). */
/** Symbol key of the isolation map: `ctx[Context.isolate]` maps each service name to its scope label. */
static readonly isolate: unique symbol
```
隔离映射的 symbol 键(见 `Context[symbols.isolate]` 属性)。
隔离映射的 symbol 键:`ctx[Context.isolate]` 将每个服务名称映射到其作用域标签。
[源码](../../vendor/cordis/src/context.ts#L48)
[源码](../../vendor/cordis/src/context.ts#L50)
### Context.intercept
```ts cordis-catalog
/** Symbol key of the intercept map (see the `Context[symbols.intercept]` property). */
/** Symbol key of the intercept map: `ctx[Context.intercept]` maps each service name to its intercept metadata. */
static readonly intercept: unique symbol
```
拦截映射的 symbol 键(见 `Context[symbols.intercept]` 属性)。
拦截映射的 symbol 键:`ctx[Context.intercept]` 将每个服务名称映射到其拦截元数据。
[源码](../../vendor/cordis/src/context.ts#L50)
[源码](../../vendor/cordis/src/context.ts#L52)
### Context.is(value)
@@ -232,7 +236,7 @@ static is(value: any): value is Context
**返回** `true` 时,`value` 是 Cordis 上下文,并会收窄其类型。
[源码](../../vendor/cordis/src/context.ts#L61)
[源码](../../vendor/cordis/src/context.ts#L63)
## 服务存储与混入
+48 -48
View File
@@ -9,80 +9,80 @@
en: b5b3510f4b6dd13a
zh: a0c70471b6d779b5
/fiber/ctx-effect-execute-label:
en: 38bab93cf931eec1
zh: 50fed09622da4926
en: c3c64f4a17982e02
zh: 556d9d0892554636
/fiber/ctx-fiber:
en: a10e38bf26b4ecfe
zh: 7c91817984c95c99
/fiber/the-fiber-class:
en: 31ca1205552db9ef
zh: 5fa2e5b9a7396576
en: 0995b41083780a7f
zh: c1d6edd8c955ce73
/fiber/the-fiber-class/fiber-uid:
en: 2f0eb3658bb8497e
zh: 65d3c17ca8bd4f95
en: 97907b9b47f628e3
zh: afc3fd8bcf51fb06
/fiber/the-fiber-class/fiber-ctx:
en: 1b527d85759324f9
zh: 54aa40db2705b95c
en: 8393cd12c6f87ea4
zh: 788ec6d0567eafee
/fiber/the-fiber-class/fiber-config:
en: 73b05dc38761b681
zh: d663668f3e8fd33f
en: d24f74b8de157f3c
zh: f66c1ebcc87795ac
/fiber/the-fiber-class/fiber-state:
en: eda419fecddc4dc8
zh: 1a1b90f405cf3cbc
en: 024ffba980d93975
zh: 4aad0bca3d30329a
/fiber/the-fiber-class/fiber-dispose:
en: 43f4ad79a728a492
zh: 71b216695d0afb22
en: d73833a8055509c9
zh: 1f3be8f3f4233f97
/fiber/the-fiber-class/fiber-committed:
en: 0485c9d782bf90da
zh: 74304cd05e9c0796
en: 3bc72a323e4d548f
zh: 1c78f016d1a4f352
/fiber/the-fiber-class/fiber-provisions:
en: 1cf8235d0ca54124
zh: 3d2e39064853165f
en: dc529104da1e8423
zh: 021c26945c90996f
/fiber/the-fiber-class/fiber-inertia:
en: 2a3b1d3bc37bf986
zh: 83bd257ee685d38b
en: 19d756b6040508e1
zh: ad3ad8e3d97207f9
/fiber/the-fiber-class/fiber-name:
en: cdc0677ce1d83361
zh: a58305521a0626de
en: 0e3641a74c588380
zh: eacf740caf8f4680
/fiber/the-fiber-class/fiber-assertactive:
en: 0c3e8008ff2d69e2
zh: 7b454626d3e3a3b6
en: 0f848c17287d271e
zh: 3fbe6481321dacc9
/fiber/the-fiber-class/fiber-effect-execute-label:
en: 0e905aa798ce3830
zh: bbd0b0c537097d37
en: 20310a727bc5dce8
zh: 08296354bc91b457
/fiber/the-fiber-class/fiber-geteffects:
en: 729a1000bda8ee36
zh: 5bfc19df3addab80
en: 758fea501aa3ca1a
zh: a726b56da80bdbc7
/fiber/the-fiber-class/fiber-rawconfig:
en: 80d4007e42bd8b47
zh: 14c11dc09c6402ce
en: 06d5cba285f2ea40
zh: f5dea5faaefb1386
/fiber/the-fiber-class/fiber-effectiveconfig:
en: 8e9fcdcf458c8bde
zh: 36d21cafbf4f0198
en: 15bd2af0334d92c0
zh: 660b3421904532e6
/fiber/the-fiber-class/fiber-resolveconfig-config:
en: f8a9ca27b288bd4c
zh: 03ce360b5200fbdb
en: 4bffc7a79cad2f90
zh: 243a9ff94e7c9a39
/fiber/the-fiber-class/fiber-await:
en: 3f228c1861466386
zh: 43b3f3acfc3d314b
en: dce389b292d469e7
zh: 634fa390a1f4555c
/fiber/the-fiber-class/fiber-restart:
en: 152116f669f52e95
zh: 11d3cd941ce32d88
en: 7be06221fd6f0a12
zh: a2416eb6c313f8ce
/fiber/the-fiber-class/fiber-update-config-nosave:
en: a4f711258eb70e47
zh: fff4d880d820de10
en: d3b17d7ab1a3135e
zh: ba9167a3b8426036
/fiber/effect:
en: 007d5b214e8a8610
zh: d74c26fbb1b8aeb6
en: bf5ff8b45417829e
zh: 17b384d7375575ef
/fiber/disposable:
en: 56e4218392fa7234
zh: 8fea671180cacf6f
en: b405f69de650c34d
zh: 5dd7995aaccb5d87
/fiber/effectmeta:
en: 849aa91b8e67809f
zh: 4b31d7e2acd2a008
en: cf8a5328f613b1d6
zh: a4f37a82c132f0ed
/fiber/cordiserror:
en: d276771958d3c05f
zh: 0141656ade938d55
en: a32c8ed4338f6f7c
zh: 573e2a686eecf1f0
/fiber/validationerror:
en: 178782124cc15210
zh: 2b226f43f48af555
+49 -25
View File
@@ -34,7 +34,7 @@ Register a cleanup-aware effect on this fiber.
**Returns** a disposer that tears the effect down and settles once done.
[Source](../../vendor/cordis/src/fiber.ts#L421)
[Source](../../vendor/cordis/src/fiber.ts#L443)
### ctx.fiber
@@ -53,7 +53,7 @@ Runtime instance of one plugin application.
A fiber tracks dependency state, raw and effective config, lifecycle effects, and cleanup for the plugin context returned by `ctx.plugin()`.
[Source](../../vendor/cordis/src/fiber.ts#L184)
[Source](../../vendor/cordis/src/fiber.ts#L214)
### fiber.uid
@@ -64,7 +64,7 @@ public uid: number | null
Unique id within the registry; 0 for the root fiber, `null` once disposed.
[Source](../../vendor/cordis/src/fiber.ts#L186)
[Source](../../vendor/cordis/src/fiber.ts#L216)
### fiber.ctx
@@ -75,7 +75,7 @@ public readonly ctx: Context
The context this fiber's plugin runs in (extends the parent context).
[Source](../../vendor/cordis/src/fiber.ts#L188)
[Source](../../vendor/cordis/src/fiber.ts#L218)
### fiber.config
@@ -86,7 +86,7 @@ public config: any
Raw plugin input retained for the next activation.
[Source](../../vendor/cordis/src/fiber.ts#L190)
[Source](../../vendor/cordis/src/fiber.ts#L220)
### fiber.state
@@ -97,7 +97,7 @@ public state
Current lifecycle state; transitions emit `internal/status`.
[Source](../../vendor/cordis/src/fiber.ts#L192)
[Source](../../vendor/cordis/src/fiber.ts#L222)
### fiber.dispose
@@ -108,7 +108,7 @@ public readonly dispose: () => Promise<void>
Dispose this fiber: unload the plugin, then settle once cleanup finished.
[Source](../../vendor/cordis/src/fiber.ts#L194)
[Source](../../vendor/cordis/src/fiber.ts#L224)
### fiber.committed
@@ -119,7 +119,7 @@ public committed: Readonly<Dict<Impl>> | undefined
Required implementations retained through dependent teardown.
[Source](../../vendor/cordis/src/fiber.ts#L196)
[Source](../../vendor/cordis/src/fiber.ts#L226)
### fiber.provisions
@@ -130,7 +130,7 @@ public readonly provisions: Set<Impl>
Service implementations owned by this fiber, including isolated provisions.
[Source](../../vendor/cordis/src/fiber.ts#L198)
[Source](../../vendor/cordis/src/fiber.ts#L228)
### fiber.inertia
@@ -141,7 +141,7 @@ public inertia: Promise<void> | undefined
The in-flight load/unload transition, if one is currently running.
[Source](../../vendor/cordis/src/fiber.ts#L200)
[Source](../../vendor/cordis/src/fiber.ts#L230)
### fiber.name
@@ -152,7 +152,7 @@ get name()
The plugin's display name, inherited from the nearest named ancestor, else `'root'`.
[Source](../../vendor/cordis/src/fiber.ts#L342)
[Source](../../vendor/cordis/src/fiber.ts#L364)
### fiber.assertActive()
@@ -170,7 +170,7 @@ Throw if the fiber has already been disposed.
**Returns** nothing when the fiber is still active.
[Source](../../vendor/cordis/src/fiber.ts#L357)
[Source](../../vendor/cordis/src/fiber.ts#L379)
### fiber.effect(execute, label?)
@@ -201,7 +201,7 @@ Register a cleanup-aware effect on this fiber.
**Returns** a disposer that tears the effect down and settles once done.
[Source](../../vendor/cordis/src/fiber.ts#L421)
[Source](../../vendor/cordis/src/fiber.ts#L443)
### fiber.getEffects()
@@ -218,7 +218,7 @@ Return metadata for currently registered effects.
**Returns** one `EffectMeta` tree per labeled live effect.
[Source](../../vendor/cordis/src/fiber.ts#L574)
[Source](../../vendor/cordis/src/fiber.ts#L596)
### fiber.rawConfig
@@ -229,7 +229,7 @@ get rawConfig(): unknown
Raw input retained for the next activation, without evaluating expressions or validating it.
[Source](../../vendor/cordis/src/fiber.ts#L649)
[Source](../../vendor/cordis/src/fiber.ts#L671)
### fiber.effectiveConfig
@@ -244,7 +244,7 @@ get effectiveConfig(): unknown
The object passed to plugin activation or the latest successful update that retained the instance. Candidate resolution does not publish it; volatile updates retain its references. Undefined before activation and readable after unload; callers requiring a live instance check `state`.
[Source](../../vendor/cordis/src/fiber.ts#L664)
[Source](../../vendor/cordis/src/fiber.ts#L686)
### fiber.resolveConfig(config)
@@ -266,7 +266,7 @@ Evaluate and validate a candidate using this fiber's `internal/config` hooks and
**Returns** The candidate's resolved config, retaining the schema's result identity.
[Source](../../vendor/cordis/src/fiber.ts#L676)
[Source](../../vendor/cordis/src/fiber.ts#L698)
### fiber.await()
@@ -284,7 +284,7 @@ Wait for current lifecycle work and rethrow startup errors.
**Returns** this fiber, once it has settled into a stable state.
[Source](../../vendor/cordis/src/fiber.ts#L754)
[Source](../../vendor/cordis/src/fiber.ts#L776)
### fiber.restart()
@@ -302,7 +302,7 @@ Dispose and immediately reload this plugin with its current config.
**Returns** a promise resolving once the reload settled.
[Source](../../vendor/cordis/src/fiber.ts#L768)
[Source](../../vendor/cordis/src/fiber.ts#L790)
### fiber.update(config, noSave?)
@@ -324,7 +324,7 @@ Resolve a candidate, retain its raw config and apply it through the update water
**Returns** The awaited update/restart result, or undefined when a synchronous listener handles it.
[Source](../../vendor/cordis/src/fiber.ts#L783)
[Source](../../vendor/cordis/src/fiber.ts#L805)
## Effect
@@ -345,7 +345,7 @@ type Effect<T = any> =
| AsyncEffect<T>
```
[Source](../../vendor/cordis/src/fiber.ts#L83)
[Source](../../vendor/cordis/src/fiber.ts#L113)
## Disposable
@@ -363,7 +363,7 @@ Disposers run in reverse registration order when the owning fiber unloads; they
type Disposable<T = any> = () => T
```
[Source](../../vendor/cordis/src/fiber.ts#L74)
[Source](../../vendor/cordis/src/fiber.ts#L104)
## EffectMeta
@@ -379,7 +379,7 @@ interface EffectMeta {
}
```
[Source](../../vendor/cordis/src/fiber.ts#L96)
[Source](../../vendor/cordis/src/fiber.ts#L126)
## CordisError
@@ -405,7 +405,7 @@ namespace CordisError {
}
```
[Source](../../vendor/cordis/src/fiber.ts#L157)
[Source](../../vendor/cordis/src/fiber.ts#L187)
## ValidationError
@@ -421,7 +421,31 @@ class ValidationError extends TypeError {
*
* @param issues — the standard-schema issues, one message line each.
*/
constructor(issues: readonly StandardSchemaV1.Issue[])
constructor(public issues: readonly StandardSchemaV1.Issue[])
/**
* Test whether a value is a config `ValidationError`, including one from another copy of Cordis.
*
* @param error — the value to test.
* @returns `true` if `error` carries the global validation-error brand.
*/
static is(error: unknown): error is ValidationError
/**
* Convert an issue path to plain property keys.
*
* @param path — the standard-schema issue path; segments may be `{ key }` objects.
* @returns the property keys, or an empty array when the issue has no path.
*/
static normalizePath(path: StandardSchemaV1.Issue['path'] = [])
/**
* Format an issue path as a dotted string.
*
* @param path — the standard-schema issue path.
* @returns the keys joined with `.`.
*/
static formatPath(path: StandardSchemaV1.Issue['path'])
}
```
+49 -25
View File
@@ -36,7 +36,7 @@ effect(execute: () => Effect, label?: string): AsyncDisposable<Promise<void>>
**返回**一个用于撤销该作用的清理函数,并在清理完成后结算。
[源码](../../vendor/cordis/src/fiber.ts#L421)
[源码](../../vendor/cordis/src/fiber.ts#L443)
### ctx.fiber
@@ -55,7 +55,7 @@ fiber: Fiber
fiber 会跟踪 `ctx.plugin()` 返回的插件上下文所对应的依赖状态、原始配置与有效配置、生命周期作用和清理操作。
[源码](../../vendor/cordis/src/fiber.ts#L184)
[源码](../../vendor/cordis/src/fiber.ts#L214)
### fiber.uid
@@ -66,7 +66,7 @@ public uid: number | null
在注册表中的唯一 id;根 fiber 的 id 为 0,dispose 后为 `null`。
[源码](../../vendor/cordis/src/fiber.ts#L186)
[源码](../../vendor/cordis/src/fiber.ts#L216)
### fiber.ctx
@@ -77,7 +77,7 @@ public readonly ctx: Context
此 fiber 的插件运行所在的上下文(扩展自父上下文)。
[源码](../../vendor/cordis/src/fiber.ts#L188)
[源码](../../vendor/cordis/src/fiber.ts#L218)
### fiber.config
@@ -88,7 +88,7 @@ public config: any
为下次激活保留的原始插件输入。
[源码](../../vendor/cordis/src/fiber.ts#L190)
[源码](../../vendor/cordis/src/fiber.ts#L220)
### fiber.state
@@ -99,7 +99,7 @@ public state
当前生命周期状态;状态转换会发出 `internal/status`。
[源码](../../vendor/cordis/src/fiber.ts#L192)
[源码](../../vendor/cordis/src/fiber.ts#L222)
### fiber.dispose
@@ -110,7 +110,7 @@ public readonly dispose: () => Promise<void>
dispose 此 fiber:卸载插件,并在清理完成后结算。
[源码](../../vendor/cordis/src/fiber.ts#L194)
[源码](../../vendor/cordis/src/fiber.ts#L224)
### fiber.committed
@@ -121,7 +121,7 @@ public committed: Readonly<Dict<Impl>> | undefined
在依赖方清理完成前保留的所需服务实现。
[源码](../../vendor/cordis/src/fiber.ts#L196)
[源码](../../vendor/cordis/src/fiber.ts#L226)
### fiber.provisions
@@ -132,7 +132,7 @@ public readonly provisions: Set<Impl>
此 fiber 拥有的服务实现,包括隔离域中的服务。
[源码](../../vendor/cordis/src/fiber.ts#L198)
[源码](../../vendor/cordis/src/fiber.ts#L228)
### fiber.inertia
@@ -143,7 +143,7 @@ public inertia: Promise<void> | undefined
当前正在进行的加载或卸载转换;如果没有此类转换,则为 undefined。
[源码](../../vendor/cordis/src/fiber.ts#L200)
[源码](../../vendor/cordis/src/fiber.ts#L230)
### fiber.name
@@ -154,7 +154,7 @@ get name()
插件的显示名称,继承自最近的具名祖先;如果不存在,则为 `'root'`。
[源码](../../vendor/cordis/src/fiber.ts#L342)
[源码](../../vendor/cordis/src/fiber.ts#L364)
### fiber.assertActive()
@@ -172,7 +172,7 @@ assertActive()
**返回**:fiber 仍处于活动状态时不返回任何内容。
[源码](../../vendor/cordis/src/fiber.ts#L357)
[源码](../../vendor/cordis/src/fiber.ts#L379)
### fiber.effect(execute, label?)
@@ -203,7 +203,7 @@ effect(execute: () => Effect, label?: string): AsyncDisposable<Promise<void>>
**返回**一个用于撤销该作用的清理函数,并在清理完成后结算。
[源码](../../vendor/cordis/src/fiber.ts#L421)
[源码](../../vendor/cordis/src/fiber.ts#L443)
### fiber.getEffects()
@@ -220,7 +220,7 @@ getEffects()
**返回**:每个带标签的活动作用对应一棵 `EffectMeta` 树。
[源码](../../vendor/cordis/src/fiber.ts#L574)
[源码](../../vendor/cordis/src/fiber.ts#L596)
### fiber.rawConfig
@@ -232,7 +232,7 @@ get rawConfig(): unknown
保留供下次激活使用的原始输入,不执行表达式求值或验证。
[源码](../../vendor/cordis/src/fiber.ts#L649)
[源码](../../vendor/cordis/src/fiber.ts#L671)
### fiber.effectiveConfig
@@ -247,7 +247,7 @@ get effectiveConfig(): unknown
传给插件激活过程或最近一次成功保留实例的更新的对象。候选配置求值不发布结果;volatile 更新保留其中的引用。激活前为 undefined,卸载后仍可读取;需要运行中实例的调用方还应检查 `state`。
[源码](../../vendor/cordis/src/fiber.ts#L664)
[源码](../../vendor/cordis/src/fiber.ts#L686)
### fiber.resolveConfig(config)
@@ -270,7 +270,7 @@ resolveConfig(config: unknown): unknown
**返回**候选配置的解析结果,保留 schema 返回对象的身份。
[源码](../../vendor/cordis/src/fiber.ts#L676)
[源码](../../vendor/cordis/src/fiber.ts#L698)
### fiber.await()
@@ -288,7 +288,7 @@ async await()
**返回**:进入稳定状态后的此 fiber。
[源码](../../vendor/cordis/src/fiber.ts#L754)
[源码](../../vendor/cordis/src/fiber.ts#L776)
### fiber.restart()
@@ -306,7 +306,7 @@ dispose 此插件,并立即使用其当前配置重新加载。
**返回**一个在重新加载完成后兑现的 promise。
[源码](../../vendor/cordis/src/fiber.ts#L768)
[源码](../../vendor/cordis/src/fiber.ts#L790)
### fiber.update(config, noSave?)
@@ -328,7 +328,7 @@ update(config: any, noSave = false): Awaitable<void>
**返回** 可等待的更新或重启结果;同步监听器处理更新时为 undefined。
[源码](../../vendor/cordis/src/fiber.ts#L783)
[源码](../../vendor/cordis/src/fiber.ts#L805)
## Effect
@@ -349,7 +349,7 @@ type Effect<T = any> =
| AsyncEffect<T>
```
[源码](../../vendor/cordis/src/fiber.ts#L83)
[源码](../../vendor/cordis/src/fiber.ts#L113)
## Disposable
@@ -367,7 +367,7 @@ type Effect<T = any> =
type Disposable<T = any> = () => T
```
[源码](../../vendor/cordis/src/fiber.ts#L74)
[源码](../../vendor/cordis/src/fiber.ts#L104)
## EffectMeta
@@ -383,7 +383,7 @@ interface EffectMeta {
}
```
[源码](../../vendor/cordis/src/fiber.ts#L96)
[源码](../../vendor/cordis/src/fiber.ts#L126)
## CordisError
@@ -409,7 +409,7 @@ namespace CordisError {
}
```
[源码](../../vendor/cordis/src/fiber.ts#L157)
[源码](../../vendor/cordis/src/fiber.ts#L187)
## ValidationError
@@ -425,7 +425,31 @@ class ValidationError extends TypeError {
*
* @param issues — the standard-schema issues, one message line each.
*/
constructor(issues: readonly StandardSchemaV1.Issue[])
constructor(public issues: readonly StandardSchemaV1.Issue[])
/**
* Test whether a value is a config `ValidationError`, including one from another copy of Cordis.
*
* @param error — the value to test.
* @returns `true` if `error` carries the global validation-error brand.
*/
static is(error: unknown): error is ValidationError
/**
* Convert an issue path to plain property keys.
*
* @param path — the standard-schema issue path; segments may be `{ key }` objects.
* @returns the property keys, or an empty array when the issue has no path.
*/
static normalizePath(path: StandardSchemaV1.Issue['path'] = [])
/**
* Format an issue path as a dotted string.
*
* @param path — the standard-schema issue path.
* @returns the keys joined with `.`.
*/
static formatPath(path: StandardSchemaV1.Issue['path'])
}
```
+1 -1
View File
@@ -15,7 +15,7 @@ This file is GENERATED from source (`scripts/gen-cordis-catalog.ts`) and verifie
- `ctx.effect` — Register a disposable side effect tied to the fiber. ([`vendor/cordis/src/fiber.ts:9`](../../vendor/cordis/src/fiber.ts))
- `ctx.get / ctx.set / ctx.provide / ctx.accessor / ctx.mixin` — Low-level service-store access and binding. ([`vendor/cordis/src/reflect.ts:7`](../../vendor/cordis/src/reflect.ts))
- `ctx.extend / ctx.isolate / ctx.intercept` — Derive a child context (scoped services / isolation / interception). ([`vendor/cordis/src/context.ts:42`](../../vendor/cordis/src/context.ts))
- `ctx.root / ctx.fiber / ctx.registry / ctx.reflect / ctx.events / ctx.logger` — Ambient handles onto the running context graph. ([`vendor/cordis/src/context.ts:16`](../../vendor/cordis/src/context.ts))
- `ctx[Context.root] / ctx.fiber / ctx.registry / ctx.reflect / ctx.events / ctx.logger` — Ambient handles onto the running context graph. ([`vendor/cordis/src/context.ts:16`](../../vendor/cordis/src/context.ts))
- `ctx.timer (+ interval / timeout / throttle / debounce)` — Disposable timer helpers. The `timer` key is provided at runtime; the four supported helpers are mixed onto ctx directly (declared via Pick). ([`vendor/timer/src/index.ts:4`](../../vendor/timer/src/index.ts))
- `ctx.loader` — The config Loader that booted the app (present under the loader). ([`vendor/loader/src/index.ts:30`](../../vendor/loader/src/index.ts))
+23 -20
View File
@@ -6,32 +6,35 @@
en: d2c0c5bce430d1be
zh: 124ab2656ea6d044
/service:
en: a163fe605c4a8045
zh: 060a6f4ce086c5c2
en: 7a6f25d41ad5192b
zh: 2792165d3c31015e
/service/service-name:
en: 32a75e66b17c0b79
zh: 0a5ff9fc45b3bea0
en: 1bd1a435be60580f
zh: cb8b96113cac2ed8
/service/static-members:
en: ceb197529207a8ed
zh: 7d444c03f8be0f0d
/service/static-members/service-init:
en: ade1a1c4543fac8c
zh: b7a4b616ee930b5b
en: a0740625ccc443b1
zh: 1efa474f255783ee
/service/static-members/service-check:
en: 111351ada5972a9a
zh: 1537da7793a6a02c
/service/static-members/service-config:
en: 93d8ff69722f9b46
zh: 9ba1532d164c2231
en: 699de9371410a4c0
zh: 32343701e1c3fb5a
/service/static-members/service-invoke:
en: 6d87f35f8cf52b05
zh: 278dbce6025b2834
en: 24ec894223f0958f
zh: 81b7615fc897f318
/service/static-members/service-metadata:
en: 735840e221643d61
zh: 1c2ce2f18786e0c6
/service/static-members/service-extend:
en: 5b78b68d8de8cef9
zh: 6df27f37da11a104
en: fa797364cccc8cc3
zh: 8fa77ae99efee25e
/service/static-members/service-tracker:
en: 52071ebded7ec026
zh: 4647fa3f989b5deb
/service/static-members/service-resolveconfig:
en: ad62f59468d1a765
zh: 4a31b52f61e1af6e
en: f59cdcca1f9b972a
zh: b50793b1114cff35
/service/static-members/service-mergeintercept:
en: af31055b96f4834f
zh: 27b22f17ba6329c0
/service/static-members/service-resolveintercept:
en: 72a73af9a6c877db
zh: 41cf10059ebf51ee
+34 -23
View File
@@ -9,7 +9,7 @@ Base class for services that expose a named API on `ctx`.
Subclasses call `super(ctx, name)` from their constructor. The service is registered immediately and is automatically removed with the owning fiber.
[Source](../../vendor/cordis/src/service.ts#L11)
[Source](../../vendor/cordis/src/service.ts#L12)
### service.name
@@ -20,7 +20,7 @@ public name!: string
The service name this instance is registered under.
[Source](../../vendor/cordis/src/service.ts#L30)
[Source](../../vendor/cordis/src/service.ts#L33)
## Static members
@@ -33,7 +33,7 @@ static readonly init: unique symbol
Symbol key of an instance method run after construction (class plugins).
[Source](../../vendor/cordis/src/service.ts#L13)
[Source](../../vendor/cordis/src/service.ts#L14)
### Service.check
@@ -44,18 +44,7 @@ static readonly check: unique symbol
Symbol key of the availability predicate passed to `ctx.provide()`.
[Source](../../vendor/cordis/src/service.ts#L15)
### Service.config
```ts cordis-catalog
/** Symbol key of the phantom intercept-config type parameter. */
static readonly config: unique symbol
```
Symbol key of the phantom intercept-config type parameter.
[Source](../../vendor/cordis/src/service.ts#L17)
[Source](../../vendor/cordis/src/service.ts#L16)
### Service.invoke
@@ -66,7 +55,18 @@ static readonly invoke: unique symbol
Symbol key of the call body making a service callable (e.g. `ctx.logger()`).
[Source](../../vendor/cordis/src/service.ts#L19)
[Source](../../vendor/cordis/src/service.ts#L18)
### Service.metadata
```ts cordis-catalog
/** Symbol key of the phantom intercept-metadata type parameter. */
static readonly metadata: unique symbol
```
Symbol key of the phantom intercept-metadata type parameter.
[Source](../../vendor/cordis/src/service.ts#L20)
### Service.extend
@@ -77,7 +77,7 @@ static readonly extend: unique symbol
Symbol key of the helper deriving an extended service instance.
[Source](../../vendor/cordis/src/service.ts#L21)
[Source](../../vendor/cordis/src/service.ts#L22)
### Service.tracker
@@ -88,15 +88,26 @@ static readonly tracker: unique symbol
Symbol key of the tracker metadata used for context tracing.
[Source](../../vendor/cordis/src/service.ts#L23)
[Source](../../vendor/cordis/src/service.ts#L24)
### Service.resolveConfig
### Service.mergeIntercept
```ts cordis-catalog
/** Symbol key of the intercept-config resolution helper below. */
static readonly resolveConfig: unique symbol
/** Symbol key of the intercept-metadata merge hook below. */
static readonly mergeIntercept: unique symbol
```
Symbol key of the intercept-config resolution helper below.
Symbol key of the intercept-metadata merge hook below.
[Source](../../vendor/cordis/src/service.ts#L25)
[Source](../../vendor/cordis/src/service.ts#L26)
### Service.resolveIntercept
```ts cordis-catalog
/** Symbol key of the intercept-metadata resolution helper below. */
static readonly resolveIntercept: unique symbol
```
Symbol key of the intercept-metadata resolution helper below.
[Source](../../vendor/cordis/src/service.ts#L28)
+34 -23
View File
@@ -11,7 +11,7 @@
子类在构造函数中调用 `super(ctx, name)`。服务会立即注册,并随所属 fiber 自动移除。
[源码](../../vendor/cordis/src/service.ts#L11)
[源码](../../vendor/cordis/src/service.ts#L12)
### service.name
@@ -22,7 +22,7 @@ public name!: string
此实例注册时使用的服务名称。
[源码](../../vendor/cordis/src/service.ts#L30)
[源码](../../vendor/cordis/src/service.ts#L33)
## 静态成员
@@ -35,7 +35,7 @@ static readonly init: unique symbol
构造完成后运行的实例方法所使用的符号键(类插件)。
[源码](../../vendor/cordis/src/service.ts#L13)
[源码](../../vendor/cordis/src/service.ts#L14)
### Service.check
@@ -46,18 +46,7 @@ static readonly check: unique symbol
传给 `ctx.provide()` 的可用性谓词所使用的符号键。
[源码](../../vendor/cordis/src/service.ts#L15)
### Service.config
```ts cordis-catalog
/** Symbol key of the phantom intercept-config type parameter. */
static readonly config: unique symbol
```
虚设拦截配置类型参数所使用的符号键。
[源码](../../vendor/cordis/src/service.ts#L17)
[源码](../../vendor/cordis/src/service.ts#L16)
### Service.invoke
@@ -68,7 +57,18 @@ static readonly invoke: unique symbol
使服务可被调用的调用体所使用的符号键(例如 `ctx.logger()`)。
[源码](../../vendor/cordis/src/service.ts#L19)
[源码](../../vendor/cordis/src/service.ts#L18)
### Service.metadata
```ts cordis-catalog
/** Symbol key of the phantom intercept-metadata type parameter. */
static readonly metadata: unique symbol
```
虚设拦截元数据类型参数所使用的符号键。
[源码](../../vendor/cordis/src/service.ts#L20)
### Service.extend
@@ -79,7 +79,7 @@ static readonly extend: unique symbol
用于派生扩展服务实例的辅助方法所使用的符号键。
[源码](../../vendor/cordis/src/service.ts#L21)
[源码](../../vendor/cordis/src/service.ts#L22)
### Service.tracker
@@ -90,15 +90,26 @@ static readonly tracker: unique symbol
上下文追踪所用跟踪器元数据的符号键。
[源码](../../vendor/cordis/src/service.ts#L23)
[源码](../../vendor/cordis/src/service.ts#L24)
### Service.resolveConfig
### Service.mergeIntercept
```ts cordis-catalog
/** Symbol key of the intercept-config resolution helper below. */
static readonly resolveConfig: unique symbol
/** Symbol key of the intercept-metadata merge hook below. */
static readonly mergeIntercept: unique symbol
```
下述拦截配置解析辅助方法所使用的符号键。
下述拦截元数据合并钩子所使用的符号键。
[源码](../../vendor/cordis/src/service.ts#L25)
[源码](../../vendor/cordis/src/service.ts#L26)
### Service.resolveIntercept
```ts cordis-catalog
/** Symbol key of the intercept-metadata resolution helper below. */
static readonly resolveIntercept: unique symbol
```
下述拦截元数据解析辅助方法所使用的符号键。
[源码](../../vendor/cordis/src/service.ts#L28)
+1 -1
View File
@@ -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` |
+1 -1
View File
@@ -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` |
+2 -2
View File
@@ -6,8 +6,8 @@
en: c8aa4d3384ea1306
zh: 5aa030587d5b634d
/vendored-package-rescope/name-mapping:
en: 50a68b9b3724eff8
zh: 9facad930deeb014
en: 8d86dcb4f884fb2e
zh: 4886ccf670df1b01
/vendored-package-rescope/what-the-rename-does-not-touch:
en: 9bb7d09f8cccf695
zh: 2a8f3f60ae5116f3
+1 -1
View File
@@ -8,7 +8,7 @@ The Cordis framework and its foundation libraries are vendored under [`vendor/`]
| Directory | Upstream name | Published name | Upstream version | Role |
|---|---|---|---|---|
| `vendor/cordis/` | `cordis` | `@deepseek-ai/cordis` | 4.0.0-rc.11 | Framework core: `Context`, `Service`, `Fiber`, events |
| `vendor/cordis/` | `cordis` | `@deepseek-ai/cordis` | 4.0.0-rc.12 | Framework core: `Context`, `Service`, `Fiber`, events |
| `vendor/cosmokit/` | `cosmokit` | `@deepseek-ai/cosmokit` | 1.8.1 | Shared utilities the framework and Schemastery build on |
| `vendor/schemastery/` | `schemastery` | `@deepseek-ai/schemastery` | 3.18.0 | Config schemas (`Schema`) behind every plugin's `Config` |
| `vendor/loader/` | `@cordisjs/plugin-loader` | `@deepseek-ai/cordis-plugin-loader` | 1.0.0-rc.8 | `cordis.yml` loading, plugin resolution, repository cache |
+1 -1
View File
@@ -8,7 +8,7 @@ Cordis 框架及其基础库以源码形式 vendored 在 [`vendor/`](../vendor/R
| 目录 | 上游名 | 发布名 | 上游版本 | 角色 |
|---|---|---|---|---|
| `vendor/cordis/` | `cordis` | `@deepseek-ai/cordis` | 4.0.0-rc.11 | 框架核心:`Context`、`Service`、`Fiber`、事件 |
| `vendor/cordis/` | `cordis` | `@deepseek-ai/cordis` | 4.0.0-rc.12 | 框架核心:`Context`、`Service`、`Fiber`、事件 |
| `vendor/cosmokit/` | `cosmokit` | `@deepseek-ai/cosmokit` | 1.8.1 | 框架与 Schemastery 共用的基础工具 |
| `vendor/schemastery/` | `schemastery` | `@deepseek-ai/schemastery` | 3.18.0 | 配置 schema(`Schema`),每个插件的 `Config` 都基于它 |
| `vendor/loader/` | `@cordisjs/plugin-loader` | `@deepseek-ai/cordis-plugin-loader` | 1.0.0-rc.8 | `cordis.yml` 装载、插件解析、repository 缓存 |
@@ -0,0 +1,16 @@
# Bilingual-pair consistency record for guide.md (docs/i18n/README.md): per heading
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/upgrade-guide/v0.2.2-rc.2/cordis-root-and-intercept-metadata/guide.md
/:
en: 4de1e21e06e1c67a
zh: f3195026d93e8127
/ctx-context-root-replaces-ctx-root-and-service-intercept-metadata-is-renamed:
en: 3ecaed868843b9fe
zh: 827999ad27256e8e
/ctx-context-root-replaces-ctx-root-and-service-intercept-metadata-is-renamed/change:
en: 84337d9923efc3c6
zh: e294b792081c7989
/ctx-context-root-replaces-ctx-root-and-service-intercept-metadata-is-renamed/migration:
en: adec35b8052efcd3
zh: 56c53d6089761976
@@ -0,0 +1,31 @@
---
kind: upgrade-guide
description: "Cordis 4.0.0-rc.12 replaces ctx.root with ctx[Context.root] and renames the service intercept-metadata API."
---
# `ctx[Context.root]` replaces `ctx.root`, and service intercept metadata is renamed
English | [中文](guide.zh.md)
## Change
`@deepseek-ai/cordis` now carries upstream Cordis 4.0.0-rc.12. Third-party plugins and services written against the previous release are affected:
- `ctx.root` no longer exists. The root context is `ctx[Context.root]`; `Context.root` is a symbol exported on the `Context` class. Inside a plugin, reading `ctx.root` throws `cannot get property "root" without inject`.
- `Service.config` becomes `Service.metadata`. A service declares its intercept type with `declare [Service.metadata]: T`.
- `[Service.resolveConfig](base?, head?)` becomes `[Service.resolveIntercept]()`, which takes no arguments.
- The global symbol `Symbol.for('cordis.metadata')` now keys `Service.metadata`. The method metadata that decorators such as `@Inject()` store moved to `symbols.decorator` (`Symbol.for('cordis.decorator')`).
- A service's `Config.merge` hook is no longer called. Override `[Service.mergeIntercept](...values)` instead; it receives the values in increasing precedence.
- Metadata a plugin declares in object-form `inject` now has the lowest precedence. Intercepts added with `ctx.intercept()` override it; previously the injected value overrode them.
- A context created with `ctx.isolate(name)` no longer falls back to the enclosing plugin's injected `name`. Plugins started under it, and reads after its own provision is withdrawn, throw `cannot get property "<name>" without inject`.
- A failed `ctx.parallel()` throws an `AggregateError` whose message names the event, and a fiber disposed while it was not active, such as a failed one, now settles to `FiberState.DISPOSED`.
## Migration
1. Replace every `ctx.root` with `ctx[Context.root]`, importing `Context` as a value from `@deepseek-ai/cordis`. Plain JavaScript without the import can read `ctx[Symbol.for('cordis.root')]`.
2. In service classes, rename `declare [Service.config]` to `declare [Service.metadata]` and calls of `[Service.resolveConfig]()` to `[Service.resolveIntercept]()`. Replace `base` and `head` arguments by declaring the base value in `inject` and adding the override with `ctx.intercept()`.
3. Where code reads or writes decorator method metadata through `symbols.metadata` or `Symbol.for('cordis.metadata')`, use `symbols.decorator` instead.
4. Move a `Config.merge` implementation to a `[Service.mergeIntercept](...values)` method on the service class.
5. Where a plugin relied on its `inject` metadata overriding an ancestor `ctx.intercept()`, set the value with `ctx.intercept()` at the plugin's context instead.
6. Where code under `ctx.isolate(name)` needs the enclosing plugin's service, provide that service inside the isolated context or start the code from a context that is not isolated.
7. Run your TypeScript build: references to `ctx.root`, `Service.config` and `Service.resolveConfig` fail to compile. Start the plugin and confirm that services resolve and logs keep their names.
@@ -0,0 +1,31 @@
---
kind: upgrade-guide
description: "Cordis 4.0.0-rc.12 用 ctx[Context.root] 取代 ctx.root,并重命名服务拦截元数据 API。"
---
# `ctx[Context.root]` 取代 `ctx.root`,服务拦截元数据 API 重命名
[English](guide.md) | 中文
## 变更
`@deepseek-ai/cordis` 现在包含上游 Cordis 4.0.0-rc.12。针对上一版本编写的第三方插件和服务会受到以下影响:
- `ctx.root` 不再存在。根上下文改为 `ctx[Context.root]`;`Context.root` 是 `Context` 类上导出的 symbol。在插件内读取 `ctx.root` 会抛出 `cannot get property "root" without inject`。
- `Service.config` 改为 `Service.metadata`。服务用 `declare [Service.metadata]: T` 声明其拦截类型。
- `[Service.resolveConfig](base?, head?)` 改为不带参数的 `[Service.resolveIntercept]()`。
- 全局 symbol `Symbol.for('cordis.metadata')` 现在对应 `Service.metadata`。`@Inject()` 等装饰器存储的方法元数据改用 `symbols.decorator`(`Symbol.for('cordis.decorator')`)。
- 服务的 `Config.merge` 钩子不再被调用。改为重写 `[Service.mergeIntercept](...values)`;它按优先级从低到高接收各个值。
- 插件在对象形式的 `inject` 中声明的元数据现在优先级最低,用 `ctx.intercept()` 添加的拦截会覆盖它;此前是注入的值覆盖拦截。
- 用 `ctx.isolate(name)` 创建的上下文不再回退到外层插件注入的 `name`。在其下启动的插件,以及在其自身提供撤回后的读取,都会抛出 `cannot get property "<name>" without inject`。
- `ctx.parallel()` 失败时抛出的 `AggregateError` 的消息会注明事件名;在非活动状态下被销毁的 fiber(例如失败的 fiber)现在会进入 `FiberState.DISPOSED`。
## 迁移
1. 将所有 `ctx.root` 替换为 `ctx[Context.root]`,并从 `@deepseek-ai/cordis` 以值的形式导入 `Context`。无法导入的纯 JavaScript 可以读取 `ctx[Symbol.for('cordis.root')]`。
2. 在服务类中,将 `declare [Service.config]` 改为 `declare [Service.metadata]`,将对 `[Service.resolveConfig]()` 的调用改为 `[Service.resolveIntercept]()`。原来的 `base` 参数改为在 `inject` 中声明,`head` 参数改为用 `ctx.intercept()` 添加。
3. 如果代码通过 `symbols.metadata` 或 `Symbol.for('cordis.metadata')` 读写装饰器的方法元数据,改用 `symbols.decorator`。
4. 将 `Config.merge` 的实现移到服务类的 `[Service.mergeIntercept](...values)` 方法中。
5. 如果插件依赖其 `inject` 元数据覆盖祖先的 `ctx.intercept()`,改为在该插件的上下文上用 `ctx.intercept()` 设置该值。
6. 如果 `ctx.isolate(name)` 之下的代码需要外层插件的服务,在隔离的上下文中提供该服务,或从未隔离的上下文启动这段代码。
7. 运行 TypeScript 构建:引用 `ctx.root`、`Service.config` 和 `Service.resolveConfig` 的代码会编译失败。启动插件,确认服务可以解析,日志名称保持不变。
@@ -1,13 +1,13 @@
# Bilingual-pair consistency record for guide.md (docs/i18n/README.md): per heading
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/upgrade-guide/v0.2.2-rc.2/deepseek-file-policy/guide.md
# pnpm run verify-translation-pairing --write docs/upgrade-guide/v0.2.2-rc.3/deepseek-file-policy/guide.md
/:
en: a63d2d172b0f3536
zh: e5c370889a1b4e7b
/resolve-the-file-policy-for-deepseekfilestore:
en: a27c476b947fc36b
zh: e5da712c4f097bfd
en: d51f1bd3ffe80469
zh: 5c507e956ded97d7
/resolve-the-file-policy-for-deepseekfilestore/change:
en: ec9035d819d611a0
zh: ab2b7518ee3a15d8
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@deepseek-ai/dsh-root",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"license": "MIT",
"private": true,
"type": "module",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-acp",
"description": "Automation-only Agent Client Protocol server for driving DeepSeek Harness agents over JSON-RPC stdio",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-api-gateway",
"description": "Typert Remote Host dispatcher and Client API endpoint",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
@@ -1,4 +1,4 @@
import type { Context } from '@deepseek-ai/cordis'
import { Context } from '@deepseek-ai/cordis'
import type { IncomingMessage, ServerResponse } from 'node:http'
import * as Token from '@deepseek-ai/dsh-host-authentication-token'
import { BrowserAuth } from '@deepseek-ai/dsh-host-authentication-token/src/browser-auth.ts'
@@ -30,7 +30,7 @@ export async function browserCookie(ctx: Context): Promise<string> {
const existing = browserCookies.get(ctx)
if (existing !== undefined) return existing
await ctx.plugin(Token, { cookieMaxAgeDays: 30 }).await()
const auth = await BrowserAuth.create(ctx.root, ctx.credentials, 30)
const auth = await BrowserAuth.create(ctx[Context.root], ctx.credentials, 30)
const target = new URL(auth.authenticatedUrl(`http://127.0.0.1:${String(ctx.webServer.port)}`))
let setCookie: string | undefined
const request = {
@@ -191,7 +191,7 @@ async function serveRoute(ctx: Context, route: WebRoute): Promise<{ readonly ori
/** Exchange the token plugin's launch URL for the separate HTTP fixture's origin. */
async function browserCookie(ctx: Context, origin: string): Promise<string> {
await ctx.plugin(Token, { cookieMaxAgeDays: 30 }).await()
const auth = await BrowserAuth.create(ctx.root, ctx.credentials, 30)
const auth = await BrowserAuth.create(ctx[Context.root], ctx.credentials, 30)
const target = new URL(auth.authenticatedUrl(origin))
let setCookie: string | undefined
const request = {
@@ -479,7 +479,7 @@ async function boot(): Promise<Host> {
}
async function exchange(host: Host, mode: 'html' | 'none' | 'answer'): Promise<string> {
const auth = await BrowserAuth.create(host.ctx.root, host.ctx.credentials, 30)
const auth = await BrowserAuth.create(host.ctx[Context.root], host.ctx.credentials, 30)
const target = new URL(auth.authenticatedUrl(`${host.origin}${mode === 'html' ? '/' : '/connect'}`))
if (mode !== 'html') target.searchParams.set('interactions', mode)
const response = await fetch(target, { redirect: 'manual', headers: { accept: mode === 'html' ? 'text/html' : 'application/json' } })
+5 -5
View File
@@ -1,5 +1,5 @@
/** Owner Peers for Gateway specs: every in-process call names its Peer explicitly. */
import type { Context } from '@deepseek-ai/cordis'
import { Context } from '@deepseek-ai/cordis'
import { Peer } from '@deepseek-ai/dsh-client-connection'
import type { PeerScope, Principal } from '@deepseek-ai/dsh-typert-protocol'
@@ -11,10 +11,10 @@ const owners = new WeakMap<Context, PeerScope>()
* @returns the tree's shared owner Peer.
*/
export function ownerPeer(ctx: Context): PeerScope {
let peer = owners.get(ctx.root)
let peer = owners.get(ctx[Context.root])
if (peer === undefined) {
peer = new Peer(ctx.root, { principal: { kind: 'owner' } })
owners.set(ctx.root, peer)
peer = new Peer(ctx[Context.root], { principal: { kind: 'owner' } })
owners.set(ctx[Context.root], peer)
}
return peer
}
@@ -26,5 +26,5 @@ export function ownerPeer(ctx: Context): PeerScope {
* @returns an independent Peer.
*/
export function peerFor(ctx: Context, principal: Principal): PeerScope {
return new Peer(ctx.root, { principal })
return new Peer(ctx[Context.root], { principal })
}
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-api-job-controller",
"description": "Job Remote observation stream and the reference-counted client job-output service",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-api-remote-access",
"description": "Method-level Remote access control for non-owner Peers and the per-Peer access snapshot",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-api-remotes",
"description": "Remote BFF assembly for application-selected Host capabilities",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-api-session-controller",
"description": "Session Remote commands, cold reads, and live control transport",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
@@ -86,7 +86,7 @@ function controllers(
history: HistoryController
web: WebController
} {
roots.add(ctx.root)
roots.add(ctx[Context.root])
installSessionReadTestServices(ctx)
const history = new HistoryController(ctx)
return { history, web: new WebController(ctx, history, promote) }
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-api-settings-controller",
"description": "Remote owner for the configuration surfaces over the settings-domain seams",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-api-terminal-controller",
"description": "Session-owned interactive terminals with shell discovery, screen recovery and typed Remote control",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-api-workspace-controller",
"description": "Workspace Remote commands and reconnect-safe state transport",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-api-workspace-files",
"description": "Workspace file service and Client resource provider: bounded reads, directory listing, and live metadata over the workspaceFiles Remote namespace",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-attachment-local",
"description": "Private content-addressed DSH_HOME attachment storage",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-attachment",
"description": "Durable immutable attachment storage seam for the DeepSeek Harness",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+1 -3
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-app-boot",
"description": "Shared boot glue for the app bins: .env loading, fail-loud Loader guards, snapshot-aware config resolution, and the Loader boot sequence",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
@@ -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}`)
}
}
+4 -12
View File
@@ -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) {
@@ -1108,7 +1108,7 @@ describe('boot', () => {
writeFileSync(join(dir, 'exiting.mjs'), [
'export const name = "exiting"',
'export function apply(ctx) {',
' void ctx.root.fiber.dispose()',
' void ctx[Symbol.for("cordis.root")].fiber.dispose()',
'}',
'',
].join('\n'))
@@ -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')
})
@@ -293,7 +293,7 @@ describe('shipped builtins', () => {
// implementation is stored under that symbol, so the root realm cannot
// resolve the service and a second composition mounting the same rows
// cannot collide with this one.
const rootKey = ctx.root[Context.isolate].demoRealmSvc
const rootKey = ctx[Context.root][Context.isolate].demoRealmSvc
expect(rootKey).toBeDefined()
expect(ctx.reflect.store[rootKey!]).toBeUndefined()
} finally {
@@ -343,7 +343,7 @@ describe('Schemastery input projection', () => {
expect(accepts(result, { children: [{ children: [] }] })).toBe(true)
expect(result.limitations.join(' ')).toContain('recursive default')
expect(result.definitions.testRecursive0).not.toHaveProperty('anyOf')
expect(accepts(result, { __jsExpr: 'ctx.root' })).toBe(true)
expect(accepts(result, { __jsExpr: 'ctx[Symbol.for("cordis.root")]' })).toBe(true)
expect(accepts(result, { children: [{ __jsExpr: 'ctx.child' }] })).toBe(true)
expect(accepts(result, { children: [3] })).toBe(false)
expect(JSON.stringify(result)).not.toContain('"uid"')
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-cmdline",
"description": "Immutable command-line handoff from a dsh launcher to any app plugin that injects cmdlineArgs",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+2 -4
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-config-editor",
"description": "Persist plugin configuration through profile patches and Loader reconciliation",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
@@ -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": {
+5 -6
View File
@@ -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'
@@ -93,7 +92,7 @@ export class ConfigEditor extends Service {
await withFileLock(join(this.ownerContext.profileContext.dir, 'package.json'), async () => {
if (!this.entries().includes(entry) || entry.fiber === undefined) throw new Error('Configuration entry is no longer available')
const beforePatches = readProfilePatches('dsh', this.ownerContext.profileContext)
await reconcileProfilePatches(this.ownerContext.root, beforePatches, 'dsh')
await reconcileProfilePatches(this.ownerContext[Context.root], beforePatches, 'dsh')
if (!this.entries().includes(entry)) throw new Error('Configuration entry changed during reload')
const current = structuredClone((entry.options.config ?? {}) as Record<string, unknown>)
const inherited = this.inherited(entry, loadProfileDirectory('dsh', this.ownerContext.profileContext.dir, this.ownerContext.profileContext.installAnchor))
@@ -133,17 +132,17 @@ 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`)
}
await writeFileAtomic(path, String(document), { mode: 0o600 })
try {
await reconcileProfilePatches(this.ownerContext.root, patches, 'dsh', [entry.options.id])
await reconcileProfilePatches(this.ownerContext[Context.root], patches, 'dsh', [entry.options.id])
} catch (error) {
await writeFileAtomic(path, before, { mode: 0o600 })
await reconcileProfilePatches(this.ownerContext.root, beforePatches, 'dsh')
await reconcileProfilePatches(this.ownerContext[Context.root], beforePatches, 'dsh')
throw error
}
})
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-hmr",
"description": "Coordinated module and profile configuration hot reload",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+1 -1
View File
@@ -971,7 +971,7 @@ class Hmr extends Service {
return job !== undefined && namespaceOf(job) === undefined
}))
}, undefined)
const result = await recomposeProfile(this.ownerContext.root, patches, 'dsh', { requiredIds, running })
const result = await recomposeProfile(this.ownerContext[Context.root], patches, 'dsh', { requiredIds, running })
const restartReason = compared === undefined || unavailable ? 'module-comparison' : result.restartReason
return { warnings: result.warnings, pending, ...restartReason === undefined ? {} : { restartReason } }
} finally {
@@ -348,7 +348,7 @@ it('reports a stopped entry that no recomposition started again by its fiber sta
f.ctx.registry.delete(plugin)
await Promise.all(fibers.map(fiber => fiber.await()))
// Applying the same patches leaves the unchanged Include's rows alone.
const warnings = await f.ctx.hmr.runExclusive(() => reconcileProfilePatches(f.ctx.root, readProfilePatches('test', f.profile), 'test'))
const warnings = await f.ctx.hmr.runExclusive(() => reconcileProfilePatches(f.ctx[Context.root], readProfilePatches('test', f.profile), 'test'))
expect(warnings).toEqual([expect.stringMatching(/^addon \(addon\): fiber state 4/u)])
})
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-plugin-manager",
"description": "Current-profile plugin and bundle management shared by dsh CLI, Web and agent tools",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-plugin-market",
"description": "Configured plugin market indexes for the Web Discover page and the plugin_market agent tool",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-browser-use",
"description": "Exclusive named browser-use provider registration",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-acp-app",
"description": "The dsh ACP profile bundle: automation-only JSON-RPC stdio and process lifecycle over dsh-base",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
@@ -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 }>
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-base",
"description": "The shared dsh core as a profile bundle: the first patch layer of base-backed profiles, inserting core rows over the empty profile root",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+3 -10
View File
@@ -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
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-headless",
"description": "The dsh one-shot bundle: a direct core Agent/Session runner over dsh-base with no Host, HTTP, or browser layer",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-sdk-app",
"description": "The dsh SDK profile bundle: stdio JSON-RPC serving and process lifecycle over dsh-base",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
@@ -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 })
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-sdk-minimal",
"description": "The standalone minimal SDK profile bundle: JSON-RPC, one DeepSeek adapter, persistent shell, and JSONL sessions",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
@@ -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([
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-web-app",
"description": "The dsh browser-surface bundle: the web patch layer over dsh-base plus the runtime glue plugin (frontend dist serving, bash runtime variables, URL line)",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+4 -4
View File
@@ -15,7 +15,7 @@
import { spawn, type ChildProcess } from 'node:child_process'
import { createRequire } from 'node:module'
import { dirname, join } from 'node:path'
import type { Context } from '@deepseek-ai/cordis'
import { Context } from '@deepseek-ai/cordis'
import z from '@deepseek-ai/schemastery'
import { auditStartupEntries } from '@deepseek-ai/dsh-app-boot'
import type {} from '@deepseek-ai/dsh-client-connection'
@@ -233,10 +233,10 @@ export function apply(ctx: Context, config: Config): void {
await opening
}, 'web-app: startup handoff')
const announceReady = (): void => {
if (lifetime.signal.aborted || ctx.get('webServer') === undefined || ANNOUNCED_ROOTS.has(ctx.root)) return
if (lifetime.signal.aborted || ctx.get('webServer') === undefined || ANNOUNCED_ROOTS.has(ctx[Context.root])) return
const entries: WebEntryUrl[] = []
ctx.emit(ctx.webServer, 'webserver/entry-url', appRootUrl(), entries)
ANNOUNCED_ROOTS.add(ctx.root)
ANNOUNCED_ROOTS.add(ctx[Context.root])
if (config.printUrl) {
for (const entry of entries) console.log(`${entry.label}: ${entry.url}`)
}
@@ -255,7 +255,7 @@ export function apply(ctx: Context, config: Config): void {
else {
void settled.then(async () => {
if (lifetime.signal.aborted) return
await auditStartupEntries(ctx.root, 'dsh web', () => {})
await auditStartupEntries(ctx[Context.root], 'dsh web', () => {})
announceReady()
}).catch(() => {
// The Loader/startup audit owns failure diagnostics; failed startup remains unpublished.
@@ -72,7 +72,7 @@ it('opens its tokenized URL only after the complete authenticated page is reacha
})
await ctx.loader.create({ name: 'cordis:include', config: { path: pathToFileURL(config).href } })
await ctx.loader.await()
await auditStartupEntries(ctx.root, 'browser-open fixture', () => {})
await auditStartupEntries(ctx[Context.root], 'browser-open fixture', () => {})
const entries: WebEntryUrl[] = []
ctx.emit(ctx.webServer, 'webserver/entry-url', ctx.webServer.getOrigin(), entries)
expect(entries).toHaveLength(1)
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-client-connection",
"description": "Authenticated RPC transport and generation lifecycle",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
@@ -160,7 +160,7 @@ async function mounted(
/** Read the test root's token implementation without a production URL service. */
async function loginUrl(ctx: Context, base: string): Promise<URL> {
const auth = await BrowserAuth.create(ctx.root, ctx.credentials, 30)
const auth = await BrowserAuth.create(ctx[Context.root], ctx.credentials, 30)
return new URL(auth.authenticatedUrl(base))
}
@@ -287,7 +287,7 @@ describe('connection node half', () => {
try {
await fiber.await()
const connection = ctx.get('connection') as HostConnectionHandle
const auth = await BrowserAuth.create(ctx.root, ctx.credentials, 30)
const auth = await BrowserAuth.create(ctx[Context.root], ctx.credentials, 30)
const exchange = fakeResponse()
auth.authorizeIndex(fakeRequest({ host: 'localhost' }, auth.authenticatedUrl('http://localhost/')), exchange.response)
const cookie = exchange.state.headers?.['set-cookie']?.split(';', 1)[0]
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-client-file-upload",
"description": "Agent-scoped browser file upload, streaming intake, and staged receipt service",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-client-hmr",
"description": "Web client graph synchronization and rebuilt-bundle reload transport",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-client-locale",
"description": "Locale plugin: Host-backed preference, extensible language catalog, browser fallback, and typed built-in dictionaries",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-client-modules",
"description": "Client module system, dual-face: node half composes the __DSH_BOOT__ entry graph (incremental dsh.client scan, bundle route, index tap, webPlugins service); browser half is the lazy-CJS module table the vendored cordis Loader consumes as its internal seam",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-client-product-analytics",
"description": "Desktop product event collection and authenticated Host reporting",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-client-resources",
"description": "Unified client resource model: protocol-registered providers turn URL addresses into live values, consumed through the useResource global standard hook",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-client-script-realm-iframe",
"description": "Optional iframe ScriptRealm provider",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-client-script-realm",
"description": "Direct-reference script environments and Cordis-owned provider registration",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-client-shortcuts",
"description": "Application keyboard command registry and physical-key routing",
"version": "0.2.2-rc.2",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
Loaded 100 of 505 files, more files were not shown because too many files have changed in this diff. Show more