Merge branch 'master' into fix/forge-changes-view-feedback
This commit is contained in:
commit
d4d9756917
292 files changed
+3984
-1407
No files matched your search
+2
-2
@@ -9,8 +9,8 @@
|
||||
en: 44615a7a0939054e
|
||||
zh: b8efa721321ba0d7
|
||||
/agent-note-creator-mode-installs-persistent-plugin-bundles/decision:
|
||||
en: 38ecabc170c418c7
|
||||
zh: d380f53fa508328e
|
||||
en: 013a2088d8f8c435
|
||||
zh: 5491ff817716696b
|
||||
/agent-note-creator-mode-installs-persistent-plugin-bundles/alternatives-considered:
|
||||
en: af527d8aabdfd59c
|
||||
zh: 34388da992d2ab56
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ Creator mode enables the existing `plugin_manager` tool. Agents author packages
|
||||
|
||||
The default Standard mode enables the same tool under the same profile condition and approval gate. Without it, Standard sessions did not install plugins directly and spent extra turns and tokens working around the missing tool; the change also moves Standard and Creator toward one capability set. A full-access Standard session can therefore install Host code without a separate prompt, as its shell already can. PTC and Minimal keep the tool disabled.
|
||||
|
||||
The model sees two read-only Cordis inspection tools. Generated-code define/run/stop/undefine and dynamic self-inspection tool APIs are absent. Existing runtime and Client consumers retain their services; historical session cards remain readable. This supersedes only the model-facing mutation workflow in the [self-referential toolset reference](../../../../packages/extensions/cordis-host-runner/README.md); its runtime ownership and sandbox rationale remain independently relevant. The [profile transaction decision](2026-09-14-current-profile-plugin-management.md) continues to govern locking, package installation, and partial failures.
|
||||
Standard and Creator expose one read-only Cordis inspection tool, `cordis_inspect`. Omitting `query` discovers providers; supplying `query` reads one declared method. The shared entry keeps runtime discovery available in the default mode without duplicating tool descriptions. Generated-code define/run/stop/undefine and dynamic self-inspection tool APIs are absent. Existing runtime and Client consumers retain their services; historical session cards remain readable. This supersedes only the model-facing mutation workflow in the [self-referential toolset reference](../../../../packages/extensions/cordis-host-runner/README.md); its runtime ownership and sandbox rationale remain independently relevant. The [profile transaction decision](2026-09-14-current-profile-plugin-management.md) continues to govern locking, package installation, and partial failures.
|
||||
|
||||
Visual creation requests default to an installed Client plugin rendered in the current Web page unless the user names another destination. The development skill supplies a minimal package and effect-owned Client registration. Discovery ends when the required APIs are known; a working first version is installed before optional visual refinement. Verification uses the connected page where available. Browser authentication or operating-system setup is not a prerequisite for plugin installation, and a mock preview cannot establish an in-app result.
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ agent 需要安装能力并在同一段对话中使用。生成代码工具在
|
||||
|
||||
默认的标准模式以相同的 profile 条件和审批门槛启用同一工具。缺少该工具时,标准模式会话不会直接安装插件,而要额外花费轮次和 token 绕过;此改动也让标准模式和创造模式朝同一能力集收敛。因此,完整权限的标准模式会话无需单独审批即可安装 Host 代码,与其 shell 已有的能力一致。PTC 和 Minimal 仍禁用该工具。
|
||||
|
||||
模型可见两个只读 Cordis 检查工具,不再提供生成代码的 define/run/stop/undefine 和动态自省工具 API。现有运行时和 Client 消费者保留其服务;历史会话卡片仍然可读。这仅取代[自引用工具集参考](../../../../packages/extensions/cordis-host-runner/README.zh.md)中的模型侧变更流程;其运行时所有权和沙箱依据仍有独立价值。[profile 事务决策](2026-09-14-current-profile-plugin-management.zh.md)继续规定锁、包安装和部分失败行为。
|
||||
标准模式和创造模式提供一个只读 Cordis 检查工具 `cordis_inspect`。省略 `query` 以发现 provider;提供 `query` 以读取一个已声明的方法。共用此入口使默认模式能够进行运行时发现,同时避免重复的工具描述。不再提供生成代码的 define/run/stop/undefine 和动态自省工具 API。现有运行时和 Client 消费者保留其服务;历史会话卡片仍然可读。这仅取代[自引用工具集参考](../../../../packages/extensions/cordis-host-runner/README.zh.md)中的模型侧变更流程;其运行时所有权和沙箱依据仍有独立价值。[profile 事务决策](2026-09-14-current-profile-plugin-management.zh.md)继续规定锁、包安装和部分失败行为。
|
||||
|
||||
除非用户指定其他目标,视觉创建请求默认通过已安装的 Client 插件显示在当前 Web 页面。开发 skill 提供最小包和由 effect 管理的 Client 注册示例。已知所需 API 后结束探查,在可选视觉优化之前先安装能工作的初版。有条件时使用已连接页面验证。浏览器认证或操作系统设置不是安装插件的前提,mock 预览不能证明应用内结果。
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
en: cc03e6b75206661b
|
||||
zh: 99e41f4143198352
|
||||
/deepseek-ai-dsh/profiles:
|
||||
en: 523477a093beb0c2
|
||||
zh: f88ea21e5fbea969
|
||||
en: 85171337ac2fb2ff
|
||||
zh: 705a4eef97d9b519
|
||||
/deepseek-ai-dsh/optional-overlays:
|
||||
en: 3a40ddc44e55f79c
|
||||
zh: 8d3949132e1ef93c
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ dsh --help # the launcher's own help
|
||||
<a id="profiles"></a>
|
||||
## Profiles
|
||||
|
||||
A profile directory holds a `package.json` (out-of-tree plugin dependencies plus the profile manifest `dsh.profile` with its ordered `bundles` list) and a `cordis.patch.yml` (the user's own patch layer). `dsh-hmr`, when enabled in YAML, watches the profile manifest and both profile and home patch files, then recomposes all layers through one serialized reload. Without HMR, changes apply on restart. Edits arriving during watcher registration use the same nonfatal reload reporting as later edits. [Plugin Manager](../../packages/boot/plugin-manager/README.md) shares package operations and the profile write lock with `dsh plugin`; package updates retain disabled bundle selections. CLI package commands inherit authentication variables and terminal descriptors, including interactive build approval; service calls retain their scrubbed environment and captured diagnostics.
|
||||
A profile directory holds a `package.json` (out-of-tree plugin dependencies plus the profile manifest `dsh.profile` with its ordered `bundles` list) and a `cordis.patch.yml` (the user's own patch layer). `dsh-hmr`, when enabled in YAML, watches the profile manifest, the profile and home patch files, and every `--patch` overlay file, then recomposes all layers through one serialized reload. Without HMR, changes apply on restart, except that a Config Editor save applies the current contents of every patch and overlay file. Edits arriving during watcher registration use the same nonfatal reload reporting as later edits. [Plugin Manager](../../packages/boot/plugin-manager/README.md) shares package operations and the profile write lock with `dsh plugin`; package updates retain disabled bundle selections. CLI package commands inherit authentication variables and terminal descriptors, including interactive build approval; service calls retain their scrubbed environment and captured diagnostics.
|
||||
|
||||
Installation and profile startup enforce the declared `engines.dsh` range, or DSH peer ranges when it is absent, against the same runtime version shown by `dsh --version`. Incompatible plugins require an explicitly acknowledged exact-version exemption. The [plugin manager's compatibility reference](../../packages/boot/plugin-manager/README.md#version-compatibility-and-exemptions) documents `version-exemptions`, `allow-version`, `revoke-version`, persistence, and risks.
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ dsh --help # the launcher's own help
|
||||
<a id="profiles"></a>
|
||||
## Profile
|
||||
|
||||
profile 目录包含一个 `package.json`,其中记录树外插件依赖,以及 profile manifest(元数据清单)`dsh.profile`、其中按顺序排列的 `bundles` 列表;还包含一个 `cordis.patch.yml`,其中保存用户自己的 patch 层。在 YAML 中启用的 `dsh-hmr` 监视 profile manifest、profile 与 home 级 patch 文件,再通过统一串行重载重新组合所有层。未启用 HMR 时,更改在重启后生效。监听器注册期间发生的编辑与后续编辑使用相同的非致命重载错误报告。[插件管理器](../../packages/boot/plugin-manager/README.zh.md) 与 `dsh plugin` 共享包操作和 profile 写锁;更新依赖会保留已停用的组合包选择。CLI 包操作继承认证环境和终端描述符,支持交互式构建批准;service 调用保留清理后的环境并捕获诊断。
|
||||
profile 目录包含一个 `package.json`,其中记录树外插件依赖,以及 profile manifest(元数据清单)`dsh.profile`、其中按顺序排列的 `bundles` 列表;还包含一个 `cordis.patch.yml`,其中保存用户自己的 patch 层。在 YAML 中启用的 `dsh-hmr` 监视 profile manifest、profile 与 home 级 patch 文件以及每个 `--patch` overlay 文件,再通过统一串行重载重新组合所有层。未启用 HMR 时,更改在重启后生效;例外是 Config Editor 保存时会应用所有 patch 与 overlay 文件的当前内容。监听器注册期间发生的编辑与后续编辑使用相同的非致命重载错误报告。[插件管理器](../../packages/boot/plugin-manager/README.zh.md) 与 `dsh plugin` 共享包操作和 profile 写锁;更新依赖会保留已停用的组合包选择。CLI 包操作继承认证环境和终端描述符,支持交互式构建批准;service 调用保留清理后的环境并捕获诊断。
|
||||
|
||||
安装和 profile 启动会按声明的 `engines.dsh` 范围(未声明时按 DSH peer 范围),检查与 `dsh --version` 显示值相同的运行时版本。不兼容插件需要用户明确确认精确版本豁免。[插件管理器的兼容性参考](../../packages/boot/plugin-manager/README.zh.md#version-compatibility-and-exemptions)说明 `version-exemptions`、`allow-version`、`revoke-version`、持久化规则与风险。
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
en: 8d2cfff9bab7327f
|
||||
zh: 21515ab6e6798504
|
||||
/dsh-cli-behavior-reference/web-profile:
|
||||
en: 149c5571acd51baf
|
||||
zh: 300e3c2425273a92
|
||||
en: afc6ddcd63f24664
|
||||
zh: ed11d2ad6d7a9852
|
||||
/dsh-cli-behavior-reference/shared-deployment-behavior:
|
||||
en: f02219118dcec531
|
||||
zh: fe2977628d7340da
|
||||
|
||||
@@ -128,7 +128,7 @@ The production Web runner needs built package and frontend artifacts (`pnpm run
|
||||
|
||||
Process shutdown gives the plugin tree up to five seconds to dispose. The first `SIGINT`/`SIGTERM` starts that graceful drain — `SIGTERM` is a supervisor's ordinary stop request and exits 0 on every surface, `SIGINT` reports 130; a second signal forces immediate exit. If one-shot normal completion is already stuck in disposal, the first `Ctrl+C` is the escalation and exits immediately instead of being swallowed.
|
||||
|
||||
The base-backed modes treat the invoking directory as the default workspace root, load applicable `AGENTS.md` or `CLAUDE.md` instructions with a 65,536-byte render budget for each instruction chain, and use an in-memory SQLite session content index. The standalone `sdk-minimal` profile uses the invoking directory as its sandbox-policy root and includes `read_image`, but omits text filesystem tools, instruction discovery, and SQLite. An enabled HMR plugin watches both `cordis.patch.yml` layers (profile and home) and reapplies valid edits transactionally; without HMR, the process applies them once. A one-shot surface exits through its bounded shutdown, which disposes any live watchers.
|
||||
The base-backed modes treat the invoking directory as the default workspace root, load applicable `AGENTS.md` or `CLAUDE.md` instructions with a 65,536-byte render budget for each instruction chain, and use an in-memory SQLite session content index. The standalone `sdk-minimal` profile uses the invoking directory as its sandbox-policy root and includes `read_image`, but omits text filesystem tools, instruction discovery, and SQLite. An enabled HMR plugin watches both `cordis.patch.yml` layers (profile and home) and every `--patch` overlay file, and reapplies valid edits transactionally; without HMR, the process applies them once. A one-shot surface exits through its bounded shutdown, which disposes any live watchers.
|
||||
|
||||
New sessions in base-backed profiles default to the `workspace-write` permission preset. Bash and filesystem mutations are restricted to the session workspace and platform temporary roots; reads and network access are not confined, while process visibility depends on the selected sandbox backend — bwrap runs commands in a private PID namespace that hides host processes, and Landlock and Seatbelt leave host process visibility unchanged. `DSH_PERMISSION_MODE` changes the process fallback. Stored General-settings permissions affect later Web sessions, not an already-open one. The standalone `sdk-minimal` tree instead pins `danger-full-access` and mounts no approval or permission-settings service.
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ dsh web --help
|
||||
|
||||
进程关闭时,插件树最多有 5 秒完成 dispose。首次收到 `SIGINT` 或 `SIGTERM` 时会开始优雅排空:`SIGTERM` 是监督进程发出的常规停止请求,在所有运行模式下都以 0 退出;`SIGINT` 则报告 130。第二次收到信号时会立即强制退出。如果一次性运行在正常结束时已经卡在 dispose 阶段,第一次按下 `Ctrl+C` 就会直接升级为强制退出,而不会被忽略。
|
||||
|
||||
基于 base 的模式都将运行命令时所在的目录作为默认 workspace 根目录,以每条指令链 65,536 字节的渲染预算加载适用的 `AGENTS.md` 或 `CLAUDE.md` 指令,并使用内存 SQLite 会话内容索引。独立的 `sdk-minimal` profile 把运行命令时所在的目录作为沙箱策略根目录并包含 `read_image`,但省略文本文件系统工具、指令发现与 SQLite。启用的 HMR 插件会监视 profile 与 home 两个 `cordis.patch.yml` 配置层的有效变更,并以事务方式重新应用;未启用 HMR 时只应用一次。一次性运行模式通过有界关闭流程退出,该流程会 dispose 所有实时监视器。
|
||||
基于 base 的模式都将运行命令时所在的目录作为默认 workspace 根目录,以每条指令链 65,536 字节的渲染预算加载适用的 `AGENTS.md` 或 `CLAUDE.md` 指令,并使用内存 SQLite 会话内容索引。独立的 `sdk-minimal` profile 把运行命令时所在的目录作为沙箱策略根目录并包含 `read_image`,但省略文本文件系统工具、指令发现与 SQLite。启用的 HMR 插件会监视 profile 与 home 两个 `cordis.patch.yml` 配置层以及每个 `--patch` overlay 文件的有效变更,并以事务方式重新应用;未启用 HMR 时只应用一次。一次性运行模式通过有界关闭流程退出,该流程会 dispose 所有实时监视器。
|
||||
|
||||
基于 base 的 profile 中,新会话默认使用 `workspace-write` 权限预设。Bash 和文件系统修改仅限于会话 workspace 与平台临时根目录;读取和网络访问不受限制,进程可见性则取决于所选沙箱后端——bwrap 在私有 PID 命名空间中运行命令并隐藏宿主进程,Landlock 与 Seatbelt 保持宿主进程可见性不变。`DSH_PERMISSION_MODE` 更改进程后备值。General settings 中存储的权限影响后续 Web 会话,不改变已打开的会话。独立的 `sdk-minimal` 配置树则固定为 `danger-full-access`,且不挂载 approval 或权限 settings 服务。
|
||||
|
||||
|
||||
@@ -14,14 +14,12 @@ import { existsSync, mkdirSync, mkdtempSync, renameSync, rmSync, writeFileSync }
|
||||
import { dirname, join, resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { FiberState, type Context } from '@deepseek-ai/cordis'
|
||||
import type { PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
import {
|
||||
boot,
|
||||
readProfilePatches,
|
||||
createRuntimeResolution,
|
||||
initProfile,
|
||||
installFailLoud,
|
||||
loadOverlayPatches,
|
||||
loadProfile,
|
||||
reportSkippedBundles,
|
||||
PluginPackages,
|
||||
@@ -204,8 +202,8 @@ interface ComposedProfile {
|
||||
profile: Profile
|
||||
/** Immutable runtime resolution computed before any plugin imports. */
|
||||
resolution: RuntimeResolution
|
||||
/** Command-line overlay contents, frozen for this invocation. */
|
||||
overlays: PatchOptions[]
|
||||
/** Absolute command-line overlay files, in argv order. */
|
||||
overlayPaths: string[]
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,8 +229,7 @@ async function composeProfile(
|
||||
if (resolvedProfile !== undefined) writeFileSync(join(profile.dir, PROFILE_ROOT_FILENAME), PROFILE_ROOT_CONFIG)
|
||||
const resolutionOptions = { installAnchor: resolvedProfile?.installAnchor ?? INSTALL_ANCHOR, profile }
|
||||
const resolution = await createRuntimeResolution(resolutionOptions)
|
||||
const overlays = patchFiles.flatMap(file => loadOverlayPatches(NAME, resolve(file)))
|
||||
return { profile, resolution, overlays }
|
||||
return { profile, resolution, overlayPaths: patchFiles.map(file => resolve(file)) }
|
||||
}
|
||||
|
||||
/** An application-owned profile and its independent installation fallback. */
|
||||
@@ -331,7 +328,7 @@ export async function runProfile(options: RunProfileOptions): Promise<{ ctx: Con
|
||||
installAnchor: options.resolvedProfile?.installAnchor ?? INSTALL_ANCHOR,
|
||||
startedBundles: composed.profile.layers.map(layer => layer.packageName),
|
||||
cwd: process.cwd(), home: resolveDshHome(),
|
||||
overlays: composed.overlays, telemetryDisabledEnv: process.env.DSH_TELEMETRY_DISABLED,
|
||||
overlayPaths: composed.overlayPaths, telemetryDisabledEnv: process.env.DSH_TELEMETRY_DISABLED,
|
||||
}
|
||||
const ctx = await boot(NAME, rootConfig, readProfilePatches(NAME, profileContext, composed.profile), async (hostCtx) => {
|
||||
app.current = hostCtx
|
||||
|
||||
@@ -95,7 +95,7 @@ describe.skipIf(!existsSync(join(root, 'apps/cli/lib/bin.js')))('Official option
|
||||
const profile = app.loadProfileDirectory('bundle-test', directory, installAnchor)
|
||||
const profileContext: ProfileContext = {
|
||||
name: 'web', dir: directory, patchPath: profile.patchPath, installAnchor, cwd: workspace, home,
|
||||
startedBundles: profile.layers.map(layer => layer.packageName), overlays: [], telemetryDisabledEnv: '1',
|
||||
startedBundles: profile.layers.map(layer => layer.packageName), overlayPaths: [], telemetryDisabledEnv: '1',
|
||||
}
|
||||
const resolution = await app.createRuntimeResolution({ installAnchor, home, profile })
|
||||
const listeners = new Set<() => void>()
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
{
|
||||
"name": "cua_run_code",
|
||||
"title": "Computer use program",
|
||||
"description": "Run a TypeScript program to observe and operate desktop applications. The global cua object is ready to use; retain application and window objects across calls. Only tools.cua is available inside the program. Call other session tools directly. Use inspect(...values) to display selected text and images. The program contains TypeScript REPL statements; only erasable syntax is accepted, with no enum or namespaces. Type annotations are advisory. Top-level declarations and await are supported; top-level return is not supported. Use inspect(...values) to display output. Do not use console. The program runs in strict mode: assigning an undeclared name throws, so use globalThis for intentional globals; eval and new Function are unavailable. Variables, functions, and imported modules remain in memory for this Agent across calls. Each call runs one program in its own top-level scope. Its top-level let, const, var, class, and function declarations, and the names it received from earlier programs, are copied into the top-level scope of later programs: later programs receive copies of these variables, not references to them, so an object they hold is still shared. In one program, either use a copied name or declare it again; do not declare a name and also use its copied value. Assigning to a copied name, even one declared with const, changes only this program's copy, which later programs receive. Do not declare var inside blocks; a block-level var changes which value later programs copy. Functions and still-running code from earlier programs keep the values they captured, and assignments they make later are not copied; keep shared mutable state in objects. If a program fails before a declaration of an existing name finishes, later programs keep that name's earlier value. Use await import(...) for modules; require and module are unavailable. Relative import specifiers resolve from the working directory of this environment's first program, while process.cwd() and relative file paths follow each program's working directory. Direct filesystem access follows the environment's launch-time sandbox policy; process.env starts empty. Timeout and cancellation results say whether retained variables were preserved or cleared. Restart, sandbox changes, output overflow, or process failure clears them. Recreate missing variables and resources; conversation history does not restore state. Earlier mutations and tool effects are not rolled back. Approved sandbox escalations use a fresh environment and discard its variables afterward. Await tools and cleanup before the program ends; unfinished tools reject. After completion, timeout, or cancellation, new tool calls are rejected and captured output is discarded; background work may still change state. Await child-process completion before the program ends; raw output belongs to the active evaluation. Each program starts in the Session's current directory. Running programs keep their initial directory. A sandbox escalation approves this complete program for one execution only. Nested tools retain their own policies and approvals. Request wider access only after evidence of a denial. Earlier effects may already have completed: inspect them before explicitly retrying. Programs are never replayed automatically.",
|
||||
"description": "Run a TypeScript program to observe and operate desktop applications. The global cua object is ready to use; retain application and window objects across calls. Only tools.cua is available inside the program. Call other session tools directly. Use inspect(...values) to display selected text and images. The program contains TypeScript REPL statements; only erasable syntax is accepted, with no enum or namespaces. Type annotations are advisory. Top-level declarations and await are supported; top-level return is not supported. Use inspect(...values) to display output. Do not use console. Use the raw form of a template literal only for short text whose backslashes must stay exactly as written, such as a regular expression; write other text, in particular file contents and commands, as ordinary strings. Write file contents as an array of quoted strings, one line each, joined with newlines; never as one template literal. The program runs in strict mode: assigning an undeclared name throws, so use globalThis for intentional globals; eval and new Function are unavailable. Variables, functions, and imported modules remain in memory for this Agent across calls. Each call runs one program in its own top-level scope. Its top-level let, const, var, class, and function declarations, and the names it received from earlier programs, are copied into the top-level scope of later programs: later programs receive copies of these variables, not references to them, so an object they hold is still shared. In one program, either use a copied name or declare it again; do not declare a name and also use its copied value. Assigning to a copied name, even one declared with const, changes only this program's copy, which later programs receive. Do not declare var inside blocks; a block-level var changes which value later programs copy. Functions and still-running code from earlier programs keep the values they captured, and assignments they make later are not copied; keep shared mutable state in objects. If a program fails before a declaration of an existing name finishes, later programs keep that name's earlier value. Use await import(...) for modules; require and module are unavailable. Relative import specifiers resolve from the working directory of this environment's first program, while process.cwd() and relative file paths follow each program's working directory. Direct filesystem access follows the environment's launch-time sandbox policy; process.env starts empty. Timeout and cancellation results say whether retained variables were preserved or cleared. Restart, sandbox changes, output overflow, or process failure clears them. Recreate missing variables and resources; conversation history does not restore state. Earlier mutations and tool effects are not rolled back. Approved sandbox escalations use a fresh environment and discard its variables afterward. Await tools and cleanup before the program ends; unfinished tools reject. After completion, timeout, or cancellation, new tool calls are rejected and captured output is discarded; background work may still change state. Await child-process completion before the program ends; raw output belongs to the active evaluation. Each program starts in the Session's current directory. Running programs keep their initial directory. A sandbox escalation approves this complete program for one execution only. Nested tools retain their own policies and approvals. Request wider access only after evidence of a denial. Earlier effects may already have completed: inspect them before explicitly retrying. Programs are never replayed automatically.",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { executeModelToolFixture } from '@deepseek-ai/dsh-tool-testkit'
|
||||
import { mkdtemp, mkdir, readFile, rm, writeFile } from 'node:fs/promises'
|
||||
import { executeToolFixture, executeModelToolFixture } from '@deepseek-ai/dsh-tool-testkit'
|
||||
import { mkdtemp, mkdir, readFile, realpath, rm, writeFile } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { afterEach, describe, expect, it, onTestFinished, vi } from 'vitest'
|
||||
@@ -152,6 +152,50 @@ async function backgroundPtcModeHarness(cwd: string): Promise<Context> {
|
||||
}
|
||||
|
||||
describe('PTC mode typed values: keyless real-process contracts', () => {
|
||||
it('returns formatted read content from inspect through the real outer run_code result', async () => {
|
||||
workdir = await realpath(await mkdtemp(join(tmpdir(), 'dsh-ptc-inspect-read-')))
|
||||
const path = join(workdir, 'a.txt')
|
||||
await writeFile(path, 'alpha\nbeta\n')
|
||||
ctx = await typedPtcModeHarness()
|
||||
await ctx.plugin(ToolFs)
|
||||
|
||||
const formatted = `<path>${path}</path>\n<type>file</type>\n<content>\n1: alpha\n2: beta\n\n(End of file - total 2 lines)\n</content>`
|
||||
const native = await executeToolFixture(ctx, {
|
||||
callId: brandString<ToolCallId>('inspect-read-reference'), name: 'read',
|
||||
arguments: { file_path: path }, signal: testToolSignal,
|
||||
})
|
||||
expect(native.isError).toBe(false)
|
||||
expect(native.content).toEqual([{ type: 'text', text: formatted }])
|
||||
|
||||
const result = await runCode(ctx, `inspect(await tools.read({ file_path: ${JSON.stringify(path)} }));`)
|
||||
expect(result.isError).toBe(false)
|
||||
expect(result.content).toEqual([{ type: 'text', text: formatted + '\n' }])
|
||||
expect(result.value).toEqual({
|
||||
logs: [formatted + '\n'], sandbox: { mode: 'danger-full-access', denied: false },
|
||||
})
|
||||
})
|
||||
|
||||
it.each(['renderer', 'policy'])('keeps an empty %s output silent while preserving program data', async (source) => {
|
||||
ctx = await typedPtcModeHarness()
|
||||
ctx.tools.register(defineTool({
|
||||
name: 'silent_result', description: 'Return data without display text.', parameters: {},
|
||||
output: {
|
||||
schema: { type: 'object', properties: { answer: { type: 'number', required: true } }, additionalProperties: false },
|
||||
render: () => source === 'renderer' ? [] : [{ type: 'text', text: 'original rendering' }],
|
||||
},
|
||||
execute: async () => ({ answer: 42 }),
|
||||
...source === 'policy' ? { finalizeContent: () => [] } : {},
|
||||
}))
|
||||
const result = await runCode(ctx, `
|
||||
const value = await tools.silent_result({});
|
||||
if (value.answer !== 42) throw new Error('program data changed');
|
||||
inspect(value);
|
||||
`)
|
||||
expect(result.isError).toBe(false)
|
||||
expect(result.content).toEqual([{ type: 'text', text: '(run_code completed with no output)' }])
|
||||
expect(result.value).toEqual({ logs: [], sandbox: { mode: 'danger-full-access', denied: false } })
|
||||
})
|
||||
|
||||
it('crosses a large intermediate value intact and exposes only typed tool failure fields', async () => {
|
||||
ctx = await typedPtcModeHarness()
|
||||
ctx.tools.register(defineTool({
|
||||
@@ -305,15 +349,15 @@ describe('PTC mode typed values: keyless real-process contracts', () => {
|
||||
} as Agent
|
||||
|
||||
const value = completion(await runCode(ctx, `
|
||||
const listed = await tools.cordis_inspect_list({});
|
||||
const listed = await tools.cordis_inspect({});
|
||||
const provider = listed.providers.find(item => item.id === 'Tool');
|
||||
const inspected = await tools.cordis_inspect_query({
|
||||
const inspected = await tools.cordis_inspect({ query: {
|
||||
platform: provider.platform, provider: provider.id, method: provider.methods[0].name,
|
||||
});
|
||||
} });
|
||||
inspect(JSON.stringify({ provider: provider.id, names: inspected.data.tools.map(tool => tool.name) }));
|
||||
`, testToolSignal, agent))
|
||||
|
||||
expect(value).toEqual({ provider: 'Tool', names: ['cordis_inspect_list', 'cordis_inspect_query'] })
|
||||
expect(value).toEqual({ provider: 'Tool', names: ['cordis_inspect'] })
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Keyless comparison of actual SDK and Desktop/Web step-admitted tool sets.
|
||||
* Keep intentional differences in tool-parity.ts; unused exceptions fail.
|
||||
* Team mode is excluded while its known composition mismatch is tracked in #7172.
|
||||
* SDK minimal, Creator-only tools, graphical context and optional runtime payloads
|
||||
* SDK minimal, other presets, graphical context and optional runtime payloads
|
||||
* are outside this fixed standard/PTC, top-level-session comparison.
|
||||
*/
|
||||
import { createServer } from 'node:http'
|
||||
|
||||
@@ -9,8 +9,12 @@ interface Exception {
|
||||
|
||||
/** Intentional product differences; obsolete entries fail alongside undeclared differences. */
|
||||
export const toolParityExceptions: Record<ToolMode, readonly Exception[]> = {
|
||||
standard: [{ tool: 'list_subagent_models', side: 'desktop',
|
||||
reason: 'Desktop enables subagent model discovery; SDK delegation inherits the caller model by default.' }],
|
||||
standard: [
|
||||
{ tool: 'list_subagent_models', side: 'desktop',
|
||||
reason: 'Desktop enables subagent model discovery; SDK delegation inherits the caller model by default.' },
|
||||
{ tool: 'cordis_inspect', side: 'desktop',
|
||||
reason: 'Web exposes inspection of its Host and connected Client runtime; the SDK profile does not compose the Cordis inspection providers.' },
|
||||
],
|
||||
ptc: [
|
||||
{ tool: 'list_subagent_models', side: 'desktop',
|
||||
reason: 'Desktop enables subagent model discovery; SDK delegation inherits the caller model by default.' },
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { lstatSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
|
||||
import { createRequire } from 'node:module'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { join, relative } from 'node:path'
|
||||
import { Context } from '@deepseek-ai/cordis'
|
||||
import { createLaunchEnvironmentSnapshot } from '@deepseek-ai/dsh-launch-environment'
|
||||
import {
|
||||
@@ -139,7 +139,7 @@ describe('runProfile with an application-owned profile', () => {
|
||||
try {
|
||||
const { shutdown } = await runProfile({
|
||||
environment, profile: 'desktop', resolvedProfile: runtime,
|
||||
patchFiles: [overlay], args: ['--port', '0', '--no-open'],
|
||||
patchFiles: [relative(process.cwd(), overlay)], args: ['--port', '0', '--no-open'],
|
||||
})
|
||||
expect(installProxyFromEnvironment).toHaveBeenCalledWith(environment, expect.any(Function))
|
||||
const resolution = vi.mocked(createRuntimeResolution).mock.settledResults
|
||||
@@ -165,7 +165,9 @@ describe('runProfile with an application-owned profile', () => {
|
||||
])
|
||||
expect(rows.find(row => row.id === 'target')?.config).toEqual({ overlay: true, priority: 'overlay' })
|
||||
expect(rows.find(row => row.id === 'session-telemetry-otel')?.disabled).toBe(true)
|
||||
expect(ctx.profileContext).toMatchObject({ dir: home, patchPath: profilePatch, installAnchor: runtime.installAnchor })
|
||||
expect(ctx.profileContext).toMatchObject({
|
||||
dir: home, patchPath: profilePatch, installAnchor: runtime.installAnchor, overlayPaths: [overlay],
|
||||
})
|
||||
await shutdown.shutdown(0)
|
||||
expect(dispose).toHaveBeenCalledOnce()
|
||||
expect(disposeProxy).toHaveBeenCalledOnce()
|
||||
|
||||
@@ -221,7 +221,7 @@ async function bootWeb(
|
||||
bootCtx.provide('profileContext', { name: surface, dir: profileDir, patchPath: profile.patchPath,
|
||||
installAnchor: INSTALL_ANCHOR, home, cwd: home,
|
||||
startedBundles: profileBundles ?? ['@deepseek-ai/dsh-base', '@deepseek-ai/dsh-web-app'],
|
||||
overlays: [], telemetryDisabledEnv: '1' })
|
||||
overlayPaths: [], telemetryDisabledEnv: '1' })
|
||||
await bootCtx.plugin(PluginPackages, { resolution })
|
||||
bootCtx.provide('connection', {
|
||||
fetch: { register: () => () => {} },
|
||||
@@ -351,7 +351,7 @@ describe('the shipped Web composition', () => {
|
||||
// excluded for the reason the TUI composition e2e excludes them — they
|
||||
// depend on ripgrep being present on the machine.
|
||||
expect(toolNames(ctx, handle.agent).filter(name => name !== 'glob' && name !== 'grep')).toEqual([
|
||||
'ask_user_question', 'bash', 'create_goal', 'edit', 'exit_plan_mode',
|
||||
'ask_user_question', 'bash', 'cordis_inspect', 'create_goal', 'edit', 'exit_plan_mode',
|
||||
'get_goal', 'job_kill', 'job_list', 'job_output', 'list_agents', 'list_subagent_models', 'office_convert', 'office_recalculate', 'office_render', 'plugin_manager', 'present', 'read', 'read_image',
|
||||
'schedule_create', 'schedule_edit', 'schedule_list', 'schedule_view',
|
||||
'send_message', 'skill',
|
||||
@@ -359,6 +359,18 @@ describe('the shipped Web composition', () => {
|
||||
'workflow', 'working_directory', 'write',
|
||||
])
|
||||
expect(ctx.commands.find(handle.agent, 'goal')).toBeDefined()
|
||||
for (const query of [undefined, { platform: 'host', provider: 'Config', method: 'listConfigs', input: { name: '@deepseek-ai/dsh-agent-loop' } }] as const) {
|
||||
const inspected = await executeToolFixture(ctx, {
|
||||
agent: handle.agent, callId: brandString<ToolCallId>(`standard-inspect-${query === undefined ? 'list' : 'query'}`), name: 'cordis_inspect',
|
||||
arguments: query === undefined ? {} : { query }, signal: new AbortController().signal,
|
||||
})
|
||||
expect(inspected.isError).toBe(false)
|
||||
const text = inspected.content.flatMap(block => block.type === 'text' ? [block.text] : []).join('')
|
||||
const value: unknown = JSON.parse(text)
|
||||
const path = query === undefined ? 'providers' : 'data.entries'
|
||||
const entry = query === undefined ? { platform: 'host', id: 'Config' } : { name: '@deepseek-ai/dsh-agent-loop' }
|
||||
expect(value).toHaveProperty(path, expect.arrayContaining([expect.objectContaining(entry)]))
|
||||
}
|
||||
} finally {
|
||||
await handle.dispose()
|
||||
}
|
||||
@@ -603,7 +615,7 @@ describe('the shipped Web composition', () => {
|
||||
try {
|
||||
const tools = toolNames(ctx, handle.agent)
|
||||
expect(tools).toEqual(expect.arrayContaining([
|
||||
'cordis_inspect_list', 'cordis_inspect_query', 'plugin_manager',
|
||||
'cordis_inspect', 'plugin_manager',
|
||||
]))
|
||||
for (const removed of ['cordis_define', 'cordis_run', 'cordis_stop', 'cordis_undefine', 'cordis_inspect_self']) {
|
||||
expect(tools).not.toContain(removed)
|
||||
@@ -985,8 +997,7 @@ describe('the standard preset documentation skill', () => {
|
||||
expect((await testCtx.skills.get('dsh-doc', { cwd: root, scope: creator.agent }))?.path).toBe(definition.path)
|
||||
const schemas = testCtx.tools.schemas(standardAgent.agent)
|
||||
expect(schemas).toEqual(testCtx.tools.schemas(baseline.agent))
|
||||
expect(schemas.map(tool => tool.name)).not.toContain('cordis_inspect_list')
|
||||
expect(schemas.map(tool => tool.name)).not.toContain('cordis_inspect_query')
|
||||
expect(schemas.map(tool => tool.name)).toContain('cordis_inspect')
|
||||
for (const handle of [baseline, standardAgent]) {
|
||||
handle.agent.followup(createUserMessage({ content: [{ type: 'text', text: 'Reply ready.' }], source: { kind: 'user' } }))
|
||||
await handle.agent.whenIdle()
|
||||
@@ -1116,13 +1127,13 @@ describe('a user preset declared from the shipped cordis rows', () => {
|
||||
try {
|
||||
for (const handle of [shipped, copied]) {
|
||||
expect(toolNames(copyCtx, handle.agent)).toEqual(expect.arrayContaining([
|
||||
'cordis_inspect_list', 'cordis_inspect_query', 'plugin_manager',
|
||||
'cordis_inspect', 'plugin_manager',
|
||||
]))
|
||||
}
|
||||
const signal = new AbortController().signal
|
||||
const listed = await executeToolFixture(copyCtx, {
|
||||
callId: brandString<ToolCallId>('copied-preset-inspect-list'),
|
||||
name: 'cordis_inspect_list',
|
||||
name: 'cordis_inspect',
|
||||
arguments: {},
|
||||
signal,
|
||||
agent: copied.agent,
|
||||
@@ -1139,15 +1150,15 @@ describe('a user preset declared from the shipped cordis rows', () => {
|
||||
onTestFinished(() => { spills.mockRestore() })
|
||||
const queried = await executeToolFixture(copyCtx, {
|
||||
callId: brandString<ToolCallId>('copied-preset-inspect-tools'),
|
||||
name: 'cordis_inspect_query',
|
||||
arguments: { platform: 'host', provider: 'Tool', method: 'listTools' },
|
||||
name: 'cordis_inspect',
|
||||
arguments: { query: { platform: 'host', provider: 'Tool', method: 'listTools' } },
|
||||
signal,
|
||||
agent: copied.agent,
|
||||
})
|
||||
expect(queried.isError).toBe(false)
|
||||
// The tool catalog may exceed the inline budget; assert its complete stored text.
|
||||
const queriedText = spills.mock.calls.at(-1)?.[0].content ?? resultText(queried)
|
||||
for (const toolName of ['bash', 'cordis_inspect_list', 'cordis_inspect_query', 'plugin_manager']) {
|
||||
for (const toolName of ['bash', 'cordis_inspect', 'plugin_manager']) {
|
||||
expect(queriedText).toContain(`"name": "${toolName}"`)
|
||||
}
|
||||
|
||||
@@ -1158,8 +1169,8 @@ describe('a user preset declared from the shipped cordis rows', () => {
|
||||
const listConfigs = async (input: Record<string, string | number>, callId: string): Promise<ConfigPage['data']> => {
|
||||
const page = await executeToolFixture(copyCtx, {
|
||||
callId: brandString<ToolCallId>(callId),
|
||||
name: 'cordis_inspect_query',
|
||||
arguments: { platform: 'host', provider: 'Config', method: 'listConfigs', input },
|
||||
name: 'cordis_inspect',
|
||||
arguments: { query: { platform: 'host', provider: 'Config', method: 'listConfigs', input } },
|
||||
signal,
|
||||
agent: copied.agent,
|
||||
})
|
||||
@@ -1177,8 +1188,8 @@ describe('a user preset declared from the shipped cordis rows', () => {
|
||||
expect(firstPage.nextOffset).toBe(5)
|
||||
const projected = await executeToolFixture(copyCtx, {
|
||||
callId: brandString<ToolCallId>('copied-preset-inspect-config'),
|
||||
name: 'cordis_inspect_query',
|
||||
arguments: { platform: 'host', provider: 'Config', method: 'listConfigs', input: { entry: toolsRow!.id } },
|
||||
name: 'cordis_inspect',
|
||||
arguments: { query: { platform: 'host', provider: 'Config', method: 'listConfigs', input: { entry: toolsRow!.id } } },
|
||||
signal,
|
||||
agent: copied.agent,
|
||||
})
|
||||
|
||||
@@ -43,6 +43,16 @@ describe('web e2e: preset roster guidance', () => {
|
||||
it('reads mode details and examples without changing the new-task default', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'preset-roster-guide'))
|
||||
const settings = page.getByRole('dialog', { name: '设置' })
|
||||
for (const name of ['标准模式', '创造模式']) {
|
||||
const sharedTrigger = settings.getByRole('button', { name: `模式说明: ${name}`, exact: true })
|
||||
await sharedTrigger.click()
|
||||
const sharedGuide = page.getByRole('dialog', { name, exact: true })
|
||||
await sharedGuide.getByText(/只读运行时检查/).waitFor()
|
||||
expect(await sharedGuide.innerText()).not.toContain('增加了运行时检查')
|
||||
if (name === '创造模式') expect(await sharedGuide.innerText()).toContain('创造模式专注于定制 DSH')
|
||||
await page.keyboard.press('Escape')
|
||||
await sharedGuide.waitFor({ state: 'detached' })
|
||||
}
|
||||
const trigger = settings.getByRole('button', { name: '模式说明: PTC 模式', exact: true })
|
||||
await trigger.click()
|
||||
const guide = page.getByRole('dialog', { name: 'PTC 模式', exact: true })
|
||||
|
||||
@@ -486,7 +486,7 @@ it.each([false, true])('starts Creator from Plugins with Coding Tools=%s without
|
||||
expect(scaffold.ctx.sessionProjections.checkpoint(creator.session).agentPreset?.val).toBe('cordis')
|
||||
expect(scaffold.ctx.agentPresets.composedPreset(creator.ctx)).toBe('cordis')
|
||||
expect(scaffold.ctx.tools.schemas(creator).map(tool => tool.name))
|
||||
.toEqual(expect.arrayContaining(['cordis_inspect_list', 'cordis_inspect_query', 'plugin_manager']))
|
||||
.toEqual(expect.arrayContaining(['cordis_inspect', 'plugin_manager']))
|
||||
// The Session starts under Creator; a chip selection after the list updates records no switch.
|
||||
expect(creator.session.snapshotEvents().filter(event => event.type === 'agent-preset/selected')).toEqual([])
|
||||
expect(creator.session.snapshotEvents().some(event => event.type === 'user/message' || event.type === 'turn/start')).toBe(false)
|
||||
|
||||
@@ -450,10 +450,11 @@ export interface LaunchOptions {
|
||||
harnessHome?: string
|
||||
}
|
||||
|
||||
/** Dispose the booted tree and remove both owned temp roots, reporting every independent cleanup failure. */
|
||||
async function cleanupScaffoldWorld(ctx: Context, workspaceCwd: string, persistenceRoot: string): Promise<unknown[]> {
|
||||
/** Dispose the booted tree and remove the owned temp roots and overlay file, reporting every independent cleanup failure. */
|
||||
async function cleanupScaffoldWorld(ctx: Context, workspaceCwd: string, persistenceRoot: string, overlayPath: string): Promise<unknown[]> {
|
||||
const failures: unknown[] = []
|
||||
await Promise.resolve(ctx.fiber.dispose()).catch((error: unknown) => failures.push(error))
|
||||
await rm(overlayPath, { force: true }).catch((error: unknown) => failures.push(error))
|
||||
await rm(workspaceCwd, { recursive: true, force: true }).catch((error: unknown) => failures.push(error))
|
||||
await rm(persistenceRoot, { recursive: true, force: true }).catch((error: unknown) => failures.push(error))
|
||||
return failures
|
||||
@@ -526,6 +527,8 @@ export async function launchWebScaffold(options: LaunchOptions = {}): Promise<We
|
||||
// paths at load, and an in-process boot must NEVER touch the developer's
|
||||
// real ~/.dsh document or credential file.
|
||||
const harnessHome = options.harnessHome ?? join(workspaceCwd, '.dsh-home')
|
||||
// Scaffolds sharing a harness home each watch their own process overlay file.
|
||||
const overlayPath = join(harnessHome, 'profiles', 'scaffold', `${basename(workspaceCwd)}.overlay.patch.yml`)
|
||||
// Skill discovery is model-visible input, and its roots now resolve inside a
|
||||
// PRESET — a subtree this lane's include patches cannot reach, because the
|
||||
// roster mounts it directly per session rather than as a row of the booted
|
||||
@@ -811,6 +814,8 @@ export async function launchWebScaffold(options: LaunchOptions = {}): Promise<We
|
||||
bundles.push(SCAFFOLD_DEFAULTS_BUNDLE)
|
||||
dependencies[SCAFFOLD_DEFAULTS_BUNDLE] = `file:${fixtureDir}`
|
||||
initProfile(profileDir, bundles)
|
||||
// Process-specific rows load like a `--patch` file, so profile reads see the launcher's overlay layer.
|
||||
await writeFile(overlayPath, stringifyEntryYaml(processOverlays))
|
||||
const manifest = readProfileManifest('dsh', profileDir)
|
||||
manifest.dependencies = dependencies
|
||||
await writeFile(join(profileDir, 'package.json'), JSON.stringify(manifest, null, 2) + '\n')
|
||||
@@ -819,7 +824,7 @@ export async function launchWebScaffold(options: LaunchOptions = {}): Promise<We
|
||||
...options.profile?.packageManager === undefined ? {} : { packageManager: options.profile.packageManager },
|
||||
cwd: workspaceCwd, home: harnessHome,
|
||||
startedBundles: loadProfileDirectory('dsh', profileDir, INSTALL_ANCHOR).layers.map(layer => layer.packageName),
|
||||
overlays: processOverlays, telemetryDisabledEnv: undefined,
|
||||
overlayPaths: [overlayPath], telemetryDisabledEnv: undefined,
|
||||
}
|
||||
// HMR gates file-driven reloads on application readiness, which the
|
||||
// launcher commits after boot; this direct harness is ready at once.
|
||||
@@ -975,7 +980,7 @@ export async function launchWebScaffold(options: LaunchOptions = {}): Promise<We
|
||||
}
|
||||
} catch (error) {
|
||||
if (process.cwd() !== originalCwd) process.chdir(originalCwd)
|
||||
const cleanupFailures = await cleanupScaffoldWorld(ctx, workspaceCwd, persistenceRoot)
|
||||
const cleanupFailures = await cleanupScaffoldWorld(ctx, workspaceCwd, persistenceRoot, overlayPath)
|
||||
if (publicProxy !== undefined) {
|
||||
await publicProxy.close().catch((closeError: unknown) => cleanupFailures.push(closeError))
|
||||
}
|
||||
@@ -1051,7 +1056,7 @@ export async function launchWebScaffold(options: LaunchOptions = {}): Promise<We
|
||||
}
|
||||
try {
|
||||
stopObservingSessions()
|
||||
failures.push(...await cleanupScaffoldWorld(ctx, workspaceCwd, persistenceRoot))
|
||||
failures.push(...await cleanupScaffoldWorld(ctx, workspaceCwd, persistenceRoot, overlayPath))
|
||||
if (publicProxy !== undefined) {
|
||||
try {
|
||||
await publicProxy.close()
|
||||
|
||||
@@ -845,12 +845,14 @@ describe.skipIf(MODE === 'record')('web e2e: active Schedule catalog', () => {
|
||||
it('manages cross-Session tasks from the sidebar without activating their Sessions', async () => {
|
||||
const otherSessionId = brandString<SessionId>('schedule-manager-other-session')
|
||||
await seedSession(scaffold, await readFile(CATALOG_FIXTURE, 'utf8'), otherSessionId, 'standard')
|
||||
const other = await scaffold.ctx.schedule.create({ prompt: 'Inspect the second workspace deployment', title: 'Second workspace deployment', timing: { kind: 'at', at: '2099-08-25T12:08:00.000Z' }, target: { kind: 'session', sessionId: otherSessionId } }, otherSessionId)
|
||||
const other = await scaffold.ctx.schedule.create({ prompt: 'Inspect the second workspace deployment', title: 'Second workspace deployment', timing: { kind: 'at', at: '2099-08-25T12:08:00.000Z' }, target: { kind: 'session', sessionId: otherSessionId } }, CATALOG_SESSION_ID)
|
||||
await page.getByRole('button', { name: 'Automation tasks', exact: true }).click()
|
||||
const manager = page.getByTestId('task-manager-page')
|
||||
await manager.getByRole('heading', { name: 'Automation tasks', exact: true }).waitFor()
|
||||
const tasks = manager.getByRole('list', { name: 'Task catalog' })
|
||||
await expect.poll(() => tasks.getByRole('listitem').count()).toBe(4)
|
||||
const creatorMark = page.locator(`[data-row-key="session:${CATALOG_SESSION_ID}"] [data-session-schedule-mark]`)
|
||||
await expect.poll(() => creatorMark.textContent()).toBe('3 automation tasks')
|
||||
expect(scaffold.ctx.agents.get(CATALOG_SESSION_ID)).toBeUndefined()
|
||||
expect(scaffold.ctx.agents.get(otherSessionId)).toBeUndefined()
|
||||
|
||||
|
||||
@@ -464,18 +464,14 @@ function assertLeanChildRecord(agent: Agent): void {
|
||||
}
|
||||
|
||||
/**
|
||||
* The catalog the shipped Web composition puts in front of the model, minus the
|
||||
* ripgrep-dependent pair below. The absences are deliberate, not incidental
|
||||
* gaps: the `cordis_*` toolset executes model-written JavaScript that no
|
||||
* sandbox row confines, `mcp_*` servers spawn outside `ctx.shell`, and `ralph`
|
||||
* runs unsupervised rounds whose completion is a worker self-report.
|
||||
* `web_fetch` is present because it adds no network reach beyond the
|
||||
* mounted shell tools. The composition
|
||||
* Agent Note owns the rationale and its sources.
|
||||
* The shipped Standard catalog, minus the ripgrep-dependent pair below.
|
||||
* Runtime inspection is read-only. Generated-code execution tools, external
|
||||
* MCP servers, and ralph are not enabled in this preset.
|
||||
*/
|
||||
const EXPECTED_TOOLS = [
|
||||
'ask_user_question',
|
||||
'bash',
|
||||
'cordis_inspect',
|
||||
'create_goal',
|
||||
'edit',
|
||||
'exit_plan_mode',
|
||||
|
||||
@@ -38,8 +38,7 @@ it('lists dsh-doc once without loading instructions or calling tools for an ordi
|
||||
expect(events.filter(event => event.type === 'user/message'
|
||||
&& event.data.source.kind === 'skill-invocation')).toEqual([])
|
||||
const names = scaffold.ctx.tools.schemas(agent).map(tool => tool.name)
|
||||
expect(names).not.toContain('cordis_inspect_list')
|
||||
expect(names).not.toContain('cordis_inspect_query')
|
||||
expect(names).toContain('cordis_inspect')
|
||||
await page.getByText('READY', { exact: true }).waitFor()
|
||||
await assertFixtureInventory(dirname(FIXTURE), ['session.v4.jsonl'])
|
||||
} finally {
|
||||
|
||||
@@ -262,7 +262,7 @@ export interface Config {
|
||||
## `@deepseek-ai/dsh-api-session-controller`
|
||||
|
||||
- `inject`: `agentDefaultModel` · `agents` · `attachments` · `fileUploads` · `fs` · `llm` · `remoteAccess` · `sessions` · `sessionProjections` · `sessionQuery` · `typert` · `typertGateway` · `workspaceRegistry`
|
||||
- `source`: [`packages/api/session-controller/src/index.ts:111`](../packages/api/session-controller/src/index.ts)
|
||||
- `source`: [`packages/api/session-controller/src/index.ts:83`](../packages/api/session-controller/src/index.ts)
|
||||
|
||||
```ts config-catalog
|
||||
/** Session Controller deployment policy. */
|
||||
@@ -2740,7 +2740,7 @@ export interface Config {
|
||||
|
||||
- `inject`: `shell` · `approval` · `sessions` · `agents` · `sessionProjections`
|
||||
- `refs`: [`ApprovalPolicy`](subsystems/approval.md) · [`SandboxMode`](subsystems/sandbox.md) · `Volatile` (`@deepseek-ai/cordis`)
|
||||
- `source`: [`packages/interaction/permission-presets/src/index.ts:154`](../packages/interaction/permission-presets/src/index.ts)
|
||||
- `source`: [`packages/interaction/permission-presets/src/index.ts:161`](../packages/interaction/permission-presets/src/index.ts)
|
||||
|
||||
```ts config-catalog
|
||||
/** The {@link PermissionPresetService} config: preset table and composition default. */
|
||||
|
||||
@@ -264,7 +264,7 @@ export interface Config {
|
||||
## `@deepseek-ai/dsh-api-session-controller`
|
||||
|
||||
- `inject`: `agentDefaultModel` · `agents` · `attachments` · `fileUploads` · `fs` · `llm` · `remoteAccess` · `sessions` · `sessionProjections` · `sessionQuery` · `typert` · `typertGateway` · `workspaceRegistry`
|
||||
- `source`: [`packages/api/session-controller/src/index.ts:111`](../packages/api/session-controller/src/index.ts)
|
||||
- `source`: [`packages/api/session-controller/src/index.ts:83`](../packages/api/session-controller/src/index.ts)
|
||||
|
||||
```ts config-catalog
|
||||
/** Session Controller deployment policy. */
|
||||
@@ -2742,7 +2742,7 @@ export interface Config {
|
||||
|
||||
- `inject`: `shell` · `approval` · `sessions` · `agents` · `sessionProjections`
|
||||
- `refs`: [`ApprovalPolicy`](subsystems/approval.zh.md) · [`SandboxMode`](subsystems/sandbox.zh.md) · `Volatile` (`@deepseek-ai/cordis`)
|
||||
- `source`: [`packages/interaction/permission-presets/src/index.ts:154`](../packages/interaction/permission-presets/src/index.ts)
|
||||
- `source`: [`packages/interaction/permission-presets/src/index.ts:161`](../packages/interaction/permission-presets/src/index.ts)
|
||||
|
||||
```ts config-catalog
|
||||
/** The {@link PermissionPresetService} config: preset table and composition default. */
|
||||
|
||||
@@ -62,7 +62,7 @@ Application listeners are outside this package matrix. Desktop Host subscribes t
|
||||
| `llm/models-updated` | `emit` | [`packages/llm/llm/src/types.ts:30`](../packages/llm/llm/src/types.ts) | [`llm-deepseek`](../packages/llm/llm-deepseek) (`emit`) | `remotes` |
|
||||
| `llm/stream` | `waterfall` | [`packages/llm/llm/src/index.ts:76`](../packages/llm/llm/src/index.ts) | [`llm`](../packages/llm/llm) (`waterfall`) | [`llm-replay`](../packages/test-support/llm-replay), [`session-checkpoint-policy`](../packages/session/session-checkpoint-policy), [`session-title`](../packages/session/session-title), [`timeline`](../packages/experimental/timeline) |
|
||||
| `mcp-manager/status` | `parallel` | [`packages/mcp/mcp-manager/src/types.ts:46`](../packages/mcp/mcp-manager/src/types.ts) | [`mcp-manager`](../packages/mcp/mcp-manager) (`parallel`) | - |
|
||||
| `permission-presets/catalog-changed` | `emit` | [`packages/interaction/permission-presets/src/types.ts:48`](../packages/interaction/permission-presets/src/types.ts) | [`permission-presets`](../packages/interaction/permission-presets) (`events.dispatch`) | `remotes` |
|
||||
| `permission-presets/catalog-changed` | `emit` | [`packages/interaction/permission-presets/src/types.ts:62`](../packages/interaction/permission-presets/src/types.ts) | [`permission-presets`](../packages/interaction/permission-presets) (`events.dispatch`) | `remotes` |
|
||||
| `plugin-manager/changed` | `emit` | [`packages/boot/plugin-manager/src/types.ts:455`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-manager/install-log` | `emit` | [`packages/boot/plugin-manager/src/types.ts:461`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-manager/install-state` | `emit` | [`packages/boot/plugin-manager/src/types.ts:468`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
| `llm/models-updated` | `emit` | [`packages/llm/llm/src/types.ts:30`](../packages/llm/llm/src/types.ts) | [`llm-deepseek`](../packages/llm/llm-deepseek) (`emit`) | `remotes` |
|
||||
| `llm/stream` | `waterfall` | [`packages/llm/llm/src/index.ts:76`](../packages/llm/llm/src/index.ts) | [`llm`](../packages/llm/llm) (`waterfall`) | [`llm-replay`](../packages/test-support/llm-replay), [`session-checkpoint-policy`](../packages/session/session-checkpoint-policy), [`session-title`](../packages/session/session-title), [`timeline`](../packages/experimental/timeline) |
|
||||
| `mcp-manager/status` | `parallel` | [`packages/mcp/mcp-manager/src/types.ts:46`](../packages/mcp/mcp-manager/src/types.ts) | [`mcp-manager`](../packages/mcp/mcp-manager) (`parallel`) | - |
|
||||
| `permission-presets/catalog-changed` | `emit` | [`packages/interaction/permission-presets/src/types.ts:48`](../packages/interaction/permission-presets/src/types.ts) | [`permission-presets`](../packages/interaction/permission-presets) (`events.dispatch`) | `remotes` |
|
||||
| `permission-presets/catalog-changed` | `emit` | [`packages/interaction/permission-presets/src/types.ts:62`](../packages/interaction/permission-presets/src/types.ts) | [`permission-presets`](../packages/interaction/permission-presets) (`events.dispatch`) | `remotes` |
|
||||
| `plugin-manager/changed` | `emit` | [`packages/boot/plugin-manager/src/types.ts:455`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-manager/install-log` | `emit` | [`packages/boot/plugin-manager/src/types.ts:461`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
| `plugin-manager/install-state` | `emit` | [`packages/boot/plugin-manager/src/types.ts:468`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
|
||||
|
||||
@@ -147,8 +147,8 @@
|
||||
en: 19917bc5438e60af
|
||||
zh: 19917bc5438e60af
|
||||
/session-persistence-event-catalog/events/permission/permission-preset-log-only:
|
||||
en: 5a38e50ed89e1a80
|
||||
zh: 5c4160ebfb3d661b
|
||||
en: bf9ce12daf742e7f
|
||||
zh: 78d8424f1493ca2c
|
||||
/session-persistence-event-catalog/events/plan:
|
||||
en: 4294f78d26ed985b
|
||||
zh: 4294f78d26ed985b
|
||||
@@ -1959,8 +1959,8 @@
|
||||
en: 88fd92dff7aa505f
|
||||
zh: b400712b3ef749aa
|
||||
/session-persistence-event-catalog/resolved-persistence-types/preset:
|
||||
en: 9fbb222685c7310c
|
||||
zh: 26e3032eae149f0a
|
||||
en: 42a6a0b07a66ad45
|
||||
zh: eaecef11c5b3ac02
|
||||
/session-persistence-event-catalog/resolved-persistence-types/reason-turn:
|
||||
en: b8d80b4b1e6441ad
|
||||
zh: d5c52e1bfe560297
|
||||
|
||||
@@ -718,7 +718,7 @@ Source: [`packages/core/agent/src/types.ts:121`](../packages/core/agent/src/type
|
||||
'permission/preset': { preset: string }
|
||||
```
|
||||
|
||||
Source: [`packages/interaction/permission-presets/src/index.ts:54`](../packages/interaction/permission-presets/src/index.ts)
|
||||
Source: [`packages/interaction/permission-presets/src/index.ts:61`](../packages/interaction/permission-presets/src/index.ts)
|
||||
|
||||
### `plan/*`
|
||||
|
||||
@@ -8081,7 +8081,7 @@ Sources: [`packages/interaction/user-approval/src/index.ts:41`](../packages/inte
|
||||
|
||||
SHA-256: `8a9c990773f798eac10ca8878e6bcc531ee080bc589cac956730e462cc6a09ad`
|
||||
|
||||
Sources: [`packages/interaction/permission-presets/src/index.ts:54`](../packages/interaction/permission-presets/src/index.ts)
|
||||
Sources: [`packages/interaction/permission-presets/src/index.ts:61`](../packages/interaction/permission-presets/src/index.ts)
|
||||
|
||||
| Property | Presence | Type |
|
||||
|---|---|---|
|
||||
|
||||
@@ -720,7 +720,7 @@ export type SessionEvent<T extends SessionEventType = SessionEventType> = {
|
||||
'permission/preset': { preset: string }
|
||||
```
|
||||
|
||||
来源:[`packages/interaction/permission-presets/src/index.ts:54`](../packages/interaction/permission-presets/src/index.ts)
|
||||
来源:[`packages/interaction/permission-presets/src/index.ts:61`](../packages/interaction/permission-presets/src/index.ts)
|
||||
|
||||
### `plan/*`
|
||||
|
||||
@@ -8083,7 +8083,7 @@ SHA-256: `11f70b595aa76897fc4e25a352bfa718c659f44b799e5aa14e84e5a38fe72912`
|
||||
|
||||
SHA-256: `8a9c990773f798eac10ca8878e6bcc531ee080bc589cac956730e462cc6a09ad`
|
||||
|
||||
来源:[`packages/interaction/permission-presets/src/index.ts:54`](../packages/interaction/permission-presets/src/index.ts)
|
||||
来源:[`packages/interaction/permission-presets/src/index.ts:61`](../packages/interaction/permission-presets/src/index.ts)
|
||||
|
||||
| 属性 | 存在性 | 类型 |
|
||||
|---|---|---|
|
||||
|
||||
Generated
+1
-1
@@ -416,7 +416,7 @@
|
||||
{"digest":"88a610b831be6d92612a464be5c7d0b88ec24d97bd299837bf74bf7672183c9a","names":[],"sources":["packages/llm/llm/src/types.ts:500"]},
|
||||
{"digest":"8a046b52331959aa3394680d6acbe09b8a5447c6b61375f263445bfcef19b7f1","names":[],"sources":[]},
|
||||
{"digest":"8a6e1ec9e8db346b0e02f027db73c07a94f067a26d40c1aef1abd09c47ce7ba0","names":[],"sources":[]},
|
||||
{"digest":"8a9c990773f798eac10ca8878e6bcc531ee080bc589cac956730e462cc6a09ad","names":[],"sources":["packages/interaction/permission-presets/src/index.ts:54"]},
|
||||
{"digest":"8a9c990773f798eac10ca8878e6bcc531ee080bc589cac956730e462cc6a09ad","names":[],"sources":["packages/interaction/permission-presets/src/index.ts:61"]},
|
||||
{"digest":"8ad45ad053b4d89f8865c17cc9ff3b8748e86045f3f0fb816269a34af2619141","names":[],"sources":["packages/experimental/hook-protocol/src/types.ts:31"]},
|
||||
{"digest":"8af841fc9b265ade3441caf9fe40dd24db24226befba48150e6d0eeccc1389c3","names":[],"sources":[]},
|
||||
{"digest":"8bb8c3751a6ce64b61aba1ec7ae798c00a5803c4d868a0430873216c6569ed52","names":[],"sources":["packages/session/session-log-deepseek/src/types.ts:96"]},
|
||||
|
||||
@@ -16,7 +16,7 @@ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnp
|
||||
|
||||
### `ctx.cordisInspect` — `CordisInspectRegistryService`
|
||||
|
||||
Registry and cross-page router behind the two model-facing inspect tools.
|
||||
Registry and cross-page router behind the model-facing inspection tool.
|
||||
|
||||
```ts cordis-catalog
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,7 @@ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnp
|
||||
|
||||
### `ctx.cordisInspect` — `CordisInspectRegistryService`
|
||||
|
||||
Registry and cross-page router behind the two model-facing inspect tools.
|
||||
Registry and cross-page router behind the model-facing inspection tool.
|
||||
|
||||
```ts cordis-catalog
|
||||
/**
|
||||
|
||||
@@ -404,6 +404,9 @@ Host service backing the generated `ctx.remote.job` namespace.
|
||||
* Stream the jobs one session can see — its own plus every unowned job —
|
||||
* as whole-set frames: one on open, then one after each coalesced burst of
|
||||
* lifecycle commits. The stream has no natural end; the carrier closes it.
|
||||
*
|
||||
* The Gateway names this call's Session resource from `request.sessionId`
|
||||
* through the session controller's resolver; no explicit reader is needed.
|
||||
* @param request - the session whose visible set to mirror.
|
||||
* @param signal - cancellation owned by the Remote stream carrier.
|
||||
* @returns the roster frames.
|
||||
|
||||
@@ -404,6 +404,9 @@ Host service backing the generated `ctx.remote.job` namespace.
|
||||
* Stream the jobs one session can see — its own plus every unowned job —
|
||||
* as whole-set frames: one on open, then one after each coalesced burst of
|
||||
* lifecycle commits. The stream has no natural end; the carrier closes it.
|
||||
*
|
||||
* The Gateway names this call's Session resource from `request.sessionId`
|
||||
* through the session controller's resolver; no explicit reader is needed.
|
||||
* @param request - the session whose visible set to mirror.
|
||||
* @param signal - cancellation owned by the Remote stream carrier.
|
||||
* @returns the roster frames.
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
en: 43a7b661b747091f
|
||||
zh: ee6b4f1ddb8cf6f2
|
||||
/permission-presets/switching-and-the-permission-preset-event:
|
||||
en: 71924a3f5f717704
|
||||
zh: 0a7ecbbf8d801a32
|
||||
en: 2f287db1b6649a86
|
||||
zh: 99dac792fc340097
|
||||
@@ -72,6 +72,8 @@ interface PresetOption {
|
||||
|
||||
`set(session, name)` resolves the preset (unknown names throw), runs Auto admission when applicable, appends a log-only `permission/preset` event unless `name` is already the effective preset, then writes each knob through its own setter — `setSandboxMode` from [dsh-sandbox-policy](../../packages/sandbox/sandbox-policy) and `setApprovalPolicy` from [dsh-user-approval](../../packages/interaction/user-approval) — only when that knob's effective value changes. The selection event precedes the knob events in the same turn, and re-selecting the effective preset appends nothing.
|
||||
|
||||
The `permissionPresets/set` Remote (`setPreset`) is the write's Remote face: it switches one live Session through `set` and declares that Session as the `session` resource the Gateway decides, so access control runs before any preset is resolved.
|
||||
|
||||
`permission/preset` is durable, log-only user intent: it stays out of the model transcript (the knob events own the model-visible consequences through their consumers), and it exists so `current()` can preserve which preset the user chose when two presets share a bundle. The `permissions` projection folds that selection with both knob events and retains the `session/end-seed` boundary used to distinguish a restored empty seed from a fresh session; replay needs no catch-up state or raw-log rescan. A restored `auto` selection requires the live Auto registration before Agent publication. The complete event declaration is in the [persistence log event catalog](../persistence-catalog.md); the method signatures are in the generated [service catalog](#ctxpermissionpresets--permissionpresetservice).
|
||||
|
||||
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
||||
@@ -95,6 +97,25 @@ Owns the deployment's configured permission presets, the fixed Auto integration
|
||||
*/
|
||||
@Remote('catalog') catalog(): PermissionCatalog
|
||||
|
||||
/**
|
||||
* Switch one live Session to another preset, opened as a Remote call so a
|
||||
* caller's Session access is decided before any preset is resolved or any
|
||||
* knob is written. The call's `session` resource is the Session named by
|
||||
* `request.sessionId`, per {@link PermissionPresetSetRequest}; the session
|
||||
* controller's resolver names it.
|
||||
*
|
||||
* The switch appends `permission/preset` and the changed knob events to the
|
||||
* Session log, so persisted-only Sessions are refused: they have no live log
|
||||
* to append to.
|
||||
* @param request - live target Session and the preset name to switch to.
|
||||
* @returns the Session's current selection after the switch, read the way
|
||||
* the client reads it: the recorded preset while its bundle still matches,
|
||||
* otherwise the first preset whose bundle matches, otherwise `custom`.
|
||||
* @throws {RemoteError} `gateway/bad-request` for an unknown preset name or a
|
||||
* Session this process does not hold live; neither call writes.
|
||||
*/
|
||||
@Remote({ name: 'set' }) setPreset(request: PermissionPresetSetRequest): PermissionSelection
|
||||
|
||||
/**
|
||||
* Publish the fixed current-session Auto preset for the calling
|
||||
* integration's effect lifetime.
|
||||
|
||||
@@ -72,6 +72,8 @@ interface PresetOption {
|
||||
|
||||
`set(session, name)` 解析预设(未知名称抛出异常),在适用时运行 Auto 准入,在 `name` 尚不是生效预设时追加一条仅记日志的 `permission/preset` 事件,然后通过各旋钮自己的 setter([dsh-sandbox-policy](../../packages/sandbox/sandbox-policy) 的 `setSandboxMode` 与 [dsh-user-approval](../../packages/interaction/user-approval) 的 `setApprovalPolicy`)写入,且仅当该 knob 的生效值发生变化时才写。同一轮次内,选择事件先于旋钮事件出现;重新选择当前生效的预设则什么都不追加。
|
||||
|
||||
`permissionPresets/set` Remote(`setPreset`)是这条写入路径的 Remote 面:它通过 `set` 切换一个 live Session,并把该 Session 声明为 Gateway 要判定的 `session` 资源,因此访问控制在解析任何预设之前就已执行。
|
||||
|
||||
`permission/preset` 是持久、仅记日志的用户意图:它不进入模型 transcript(文本记录),模型可见的后果由 knob 事件经各自消费方承担;它存在是为了在两个预设共享同一个旋钮组合时,让 `current()` 仍能保住用户选择的究竟是哪一个预设。`permissions` 投影把该选择与两个 knob 事件一同折叠,并保留用于区分空恢复 seed 与新会话的 `session/end-seed` 边界;回放不需要任何追赶状态或原始日志重扫。恢复的 `auto` 选择在 agent 发布前必须存在 live Auto 注册。完整事件声明见[持久化日志事件目录](../persistence-catalog.zh.md);方法签名见生成的[服务目录](#ctxpermissionpresets--permissionpresetservice)。
|
||||
|
||||
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
||||
@@ -95,6 +97,25 @@ Owns the deployment's configured permission presets, the fixed Auto integration
|
||||
*/
|
||||
@Remote('catalog') catalog(): PermissionCatalog
|
||||
|
||||
/**
|
||||
* Switch one live Session to another preset, opened as a Remote call so a
|
||||
* caller's Session access is decided before any preset is resolved or any
|
||||
* knob is written. The call's `session` resource is the Session named by
|
||||
* `request.sessionId`, per {@link PermissionPresetSetRequest}; the session
|
||||
* controller's resolver names it.
|
||||
*
|
||||
* The switch appends `permission/preset` and the changed knob events to the
|
||||
* Session log, so persisted-only Sessions are refused: they have no live log
|
||||
* to append to.
|
||||
* @param request - live target Session and the preset name to switch to.
|
||||
* @returns the Session's current selection after the switch, read the way
|
||||
* the client reads it: the recorded preset while its bundle still matches,
|
||||
* otherwise the first preset whose bundle matches, otherwise `custom`.
|
||||
* @throws {RemoteError} `gateway/bad-request` for an unknown preset name or a
|
||||
* Session this process does not hold live; neither call writes.
|
||||
*/
|
||||
@Remote({ name: 'set' }) setPreset(request: PermissionPresetSetRequest): PermissionSelection
|
||||
|
||||
/**
|
||||
* Publish the fixed current-session Auto preset for the calling
|
||||
* integration's effect lifetime.
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
en: 94ba725bef6684b7
|
||||
zh: f113745a4a07952a
|
||||
/ptc-runtime/bindings-host-functions-as-program-globals:
|
||||
en: 182147ddf388c600
|
||||
zh: c0a7d77602c78bcd
|
||||
en: a387577007373804
|
||||
zh: a330173368db598d
|
||||
/ptc-runtime/captured-output-and-the-failure-taxonomy:
|
||||
en: ef553620e77bd638
|
||||
zh: 40ff2f5ba3de5ed5
|
||||
|
||||
@@ -115,7 +115,7 @@ type PtcProgramFormat = 'function-body' | 'repl' | 'script' | 'scoped-repl'
|
||||
|
||||
## Bindings: host functions as program globals
|
||||
|
||||
Each `PtcBindingNamespace` becomes a global object of async callables; PTC passes `tools`. Arguments and resolutions must be lossless JSON. Providers enforce their own transport caps; the seam sets no uniform binding-byte limit. An optional error-class descriptor creates program-visible typed rejections without naming a consumer inside the runtime. Binding names are own properties, so `__proto__` cannot traverse a prototype:
|
||||
Each `PtcBindingNamespace` becomes a global object of async callables; PTC passes `tools`. Arguments and resolutions must be lossless JSON, with host-issued `PtcImage` and `PtcInspectableValue` descriptors adapted by the provider. Providers enforce their own transport caps; the seam sets no uniform binding-byte limit. An optional error-class descriptor creates program-visible typed rejections without naming a consumer inside the runtime. Binding names are own properties, so `__proto__` cannot traverse a prototype:
|
||||
|
||||
```ts type-equiv
|
||||
/**
|
||||
@@ -168,15 +168,38 @@ type PtcJsonValue = null | boolean | number | string | PtcJsonValue[] | { [key:
|
||||
/**
|
||||
* One host-side function exposed to the program as an async callable. The
|
||||
* runtime bridges calls to it (possibly across a serialization boundary), so
|
||||
* `args` must be lossless JSON; resolutions also support host-issued PtcImage values. A runtime rejects a
|
||||
* lossy or non-cloneable value with a descriptive error rather than corrupting
|
||||
* the run. No seam-level byte cap applies to a binding resolution. A rejection
|
||||
* of this function surfaces inside the program as a rejection of the
|
||||
* corresponding call.
|
||||
* `args` must be lossless JSON; resolutions also support host-issued PtcImage and
|
||||
* PtcInspectableValue values. An inspectable resolution delivers its JSON object
|
||||
* or array to the program and uses its text only when that unchanged value is
|
||||
* inspected directly. A runtime rejects a lossy or non-cloneable value with a
|
||||
* descriptive error rather than corrupting the run. No seam-level byte cap
|
||||
* applies to a binding resolution. A rejection of this function surfaces inside
|
||||
* the program as a rejection of the corresponding call.
|
||||
*/
|
||||
type PtcBindingFunction = (args: unknown) => Promise<PtcJsonValue>
|
||||
```
|
||||
|
||||
`PtcInspectableValue`, exported from `@deepseek-ai/dsh-ptc-runtime`, associates a lossless JSON object or array with host-authored text through `new PtcInspectableValue(value, text)`. The provider delivers the data itself to the program, without exposing the descriptor or adding program-visible properties. Direct `inspect` of the original result uses its text only while the data matches its initial snapshot; empty text emits nothing. Copies, field selections, modified results, and nested values use ordinary formatting. The Node process owns this association, which is neither serialized into Session logs nor transferred by copying a program value. See [`src/inspectable-value.ts`](../../packages/ptc-runtime/ptc-runtime/src/inspectable-value.ts).
|
||||
|
||||
The data may contain host-issued `PtcImage` descriptors. The provider preserves their program `Image` identities in the inspection snapshot. Direct inspection of the unchanged container displays its supplied text; inspecting an Image field displays that image.
|
||||
|
||||
```ts public-api
|
||||
/** A binding result whose unchanged object or array displays the supplied text when inspected directly. */
|
||||
declare class PtcInspectableValue {
|
||||
readonly [key: string]: PtcJsonValue;
|
||||
/** The JSON object or array delivered unchanged to the program. */
|
||||
readonly value: PtcJsonValue[] | { [key: string]: PtcJsonValue };
|
||||
/** Text shown by a direct inspection of the unchanged value; empty text emits nothing. */
|
||||
readonly text: string;
|
||||
/**
|
||||
* Associate an object or array with its host-authored inspection text.
|
||||
* @param value - Lossless JSON data retained for programmatic access.
|
||||
* @param text - Text to display instead of generic object formatting.
|
||||
*/
|
||||
constructor(value: PtcJsonValue[] | { [key: string]: PtcJsonValue }, text: string);
|
||||
}
|
||||
```
|
||||
|
||||
## Captured output and the failure taxonomy
|
||||
|
||||
`output` contains text and image entries in emission order: `{ type: 'text', text }` or `{ type: 'image', attachment }`. Text entries retain emitted newline characters; concatenate adjacent text without separators. Each source channel preserves emission order; interleaving across independent channels is backend-dependent. Host bindings return `PtcImage` descriptors containing the attachment reference and a readable execution-world `path`; the program receives an `Image` with that path and the stored pixel dimensions. The Node provider caps serialized text, image descriptors, and completion or diagnostic payloads together; overflow is an explicit failure.
|
||||
|
||||
@@ -115,7 +115,7 @@ type PtcProgramFormat = 'function-body' | 'repl' | 'script' | 'scoped-repl'
|
||||
|
||||
## 绑定:宿主函数作为程序全局变量
|
||||
|
||||
每个 `PtcBindingNamespace` 成为一个异步可调用函数的全局对象;PTC 传入 `tools`。参数与返回值必须是无损 JSON。提供方强制各自的传输上限;seam 不设统一的绑定字节上限。可选错误类描述符创建程序可见的类型化拒绝,无需在运行时内点名消费方。绑定名是自有属性,因此 `__proto__` 不能遍历原型:
|
||||
每个 `PtcBindingNamespace` 成为一个异步可调用函数的全局对象;PTC 传入 `tools`。参数与返回值必须是无损 JSON,宿主签发的 `PtcImage` 和 `PtcInspectableValue` 描述符由提供方适配。提供方强制各自的传输上限;seam 不设统一的绑定字节上限。可选错误类描述符创建程序可见的类型化拒绝,无需在运行时内点名消费方。绑定名是自有属性,因此 `__proto__` 不能遍历原型:
|
||||
|
||||
```ts type-equiv
|
||||
/**
|
||||
@@ -168,15 +168,38 @@ type PtcJsonValue = null | boolean | number | string | PtcJsonValue[] | { [key:
|
||||
/**
|
||||
* One host-side function exposed to the program as an async callable. The
|
||||
* runtime bridges calls to it (possibly across a serialization boundary), so
|
||||
* `args` must be lossless JSON; resolutions also support host-issued PtcImage values. A runtime rejects a
|
||||
* lossy or non-cloneable value with a descriptive error rather than corrupting
|
||||
* the run. No seam-level byte cap applies to a binding resolution. A rejection
|
||||
* of this function surfaces inside the program as a rejection of the
|
||||
* corresponding call.
|
||||
* `args` must be lossless JSON; resolutions also support host-issued PtcImage and
|
||||
* PtcInspectableValue values. An inspectable resolution delivers its JSON object
|
||||
* or array to the program and uses its text only when that unchanged value is
|
||||
* inspected directly. A runtime rejects a lossy or non-cloneable value with a
|
||||
* descriptive error rather than corrupting the run. No seam-level byte cap
|
||||
* applies to a binding resolution. A rejection of this function surfaces inside
|
||||
* the program as a rejection of the corresponding call.
|
||||
*/
|
||||
type PtcBindingFunction = (args: unknown) => Promise<PtcJsonValue>
|
||||
```
|
||||
|
||||
`@deepseek-ai/dsh-ptc-runtime` 导出的 `PtcInspectableValue` 通过 `new PtcInspectableValue(value, text)`,为无损 JSON 对象或数组关联宿主提供的文本。提供方向程序交付数据本身,不暴露描述符,也不添加程序可见属性。只有直接 `inspect` 原结果,且其数据仍与初始快照一致时,才使用附带文本;空文本不产生输出。拷贝、字段选择、修改后的结果和嵌套值使用普通格式。该关联由 Node 进程拥有,不序列化到 Session 日志,复制程序值也不会传递该关联。参见 [`src/inspectable-value.ts`](../../packages/ptc-runtime/ptc-runtime/src/inspectable-value.ts)。
|
||||
|
||||
数据中可以包含宿主提供的 `PtcImage` 描述符。提供方在展示快照中保留对应程序 `Image` 的身份。直接展示未修改的容器时输出附带文本;展示 Image 字段时输出该图片。
|
||||
|
||||
```ts public-api
|
||||
/** A binding result whose unchanged object or array displays the supplied text when inspected directly. */
|
||||
declare class PtcInspectableValue {
|
||||
readonly [key: string]: PtcJsonValue;
|
||||
/** The JSON object or array delivered unchanged to the program. */
|
||||
readonly value: PtcJsonValue[] | { [key: string]: PtcJsonValue };
|
||||
/** Text shown by a direct inspection of the unchanged value; empty text emits nothing. */
|
||||
readonly text: string;
|
||||
/**
|
||||
* Associate an object or array with its host-authored inspection text.
|
||||
* @param value - Lossless JSON data retained for programmatic access.
|
||||
* @param text - Text to display instead of generic object formatting.
|
||||
*/
|
||||
constructor(value: PtcJsonValue[] | { [key: string]: PtcJsonValue }, text: string);
|
||||
}
|
||||
```
|
||||
|
||||
## 捕获的输出与失败分类体系
|
||||
|
||||
`output` 按发出顺序保存文本和图片条目:文本使用 `{ type: 'text', text }`,图片使用 `{ type: 'image', attachment }`。文本条目保留实际输出的换行,相邻文本直接拼接,不额外插入分隔符。每个来源通道都保留发出顺序;独立通道之间的交错顺序由后端决定。宿主绑定返回 `PtcImage` 描述符,包含附件引用和可在执行环境读取的 `path`;程序收到带有该路径和存储像素尺寸的 `Image`。Node 提供方对序列化文本、图片描述符、完成值或诊断一起计量;超限会显式失败。
|
||||
|
||||
@@ -184,6 +184,13 @@ Exact-read consumer that prepares immutable cross-session message context.
|
||||
*
|
||||
* Discovery runs at keystroke rate, so titles and subagent labels only ever
|
||||
* come from projection reads; sessions without either fall back to their id.
|
||||
*
|
||||
* The list names every Session the session index holds, whatever identity the
|
||||
* caller acts for; it is not narrowed to Sessions that caller else can read.
|
||||
* A share viewer therefore learns the id, title, and working-directory path of
|
||||
* each Session on the owner Host, and {@link prepare} reads the snapshot of a
|
||||
* cited Session without asking who cited it. That exposure is a recorded
|
||||
* LiveShare limitation, not a grant: narrowing the list is deferred.
|
||||
* @param agent - target agent; self is excluded and its cwd drives ranking.
|
||||
* @param query - optional search text: label and display title match
|
||||
* fuzzily, session id and working directory as substrings. Matches keep the
|
||||
|
||||
@@ -184,6 +184,13 @@ Exact-read consumer that prepares immutable cross-session message context.
|
||||
*
|
||||
* Discovery runs at keystroke rate, so titles and subagent labels only ever
|
||||
* come from projection reads; sessions without either fall back to their id.
|
||||
*
|
||||
* The list names every Session the session index holds, whatever identity the
|
||||
* caller acts for; it is not narrowed to Sessions that caller else can read.
|
||||
* A share viewer therefore learns the id, title, and working-directory path of
|
||||
* each Session on the owner Host, and {@link prepare} reads the snapshot of a
|
||||
* cited Session without asking who cited it. That exposure is a recorded
|
||||
* LiveShare limitation, not a grant: narrowing the list is deferred.
|
||||
* @param agent - target agent; self is excluded and its cwd drives ranking.
|
||||
* @param query - optional search text: label and display title match
|
||||
* fuzzily, session id and working directory as substrings. Matches keep the
|
||||
|
||||
@@ -240,11 +240,29 @@ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnp
|
||||
* Answer a continued question. The reply is steered into the agent as a
|
||||
* user message whose source names the call; that message is also the
|
||||
* record that closes the question in the projection.
|
||||
*
|
||||
* The only call this method can answer is one the projection lists as
|
||||
* `continued` on this Session, and it steers a user message into the running
|
||||
* turn, so it speaks for the person the Session runs for. A LiveShare reader
|
||||
* reaches it through the Session read role, which is safe only while an
|
||||
* approval question cannot become `continued`: the projection tracks only
|
||||
* calls made under the timed `ask_user_question` schema, and a call becomes
|
||||
* `continued` only by returning the pending result a timed wait produces (or,
|
||||
* for PTC, a pending dispatch) or by resume repair recording
|
||||
* `TOOL_OUTCOME_UNKNOWN` for a call the process never finished. Plan review
|
||||
* (`plan-review`) and the CUA approvals (`approval`) reach `ctx.userQuestions.ask`
|
||||
* without a `wait` and without a `timeout`, so their result is a settled
|
||||
* answer, an abort, or a failure, never a pending result, and they stay out
|
||||
* of the projection. A future approval surface must keep asking without
|
||||
* `wait`/`timeout`, or it must gain its own owner-only gate; giving it a timed
|
||||
* form makes an approval answerable by a share viewer.
|
||||
* @param agent - Live root agent for the owning Session.
|
||||
* @param callId - Continued question identity.
|
||||
* @param answer - Complete structured answer batch, one item per question of the call.
|
||||
* @returns Whether the question is still continued; an accepted reply stays
|
||||
* queued until the agent admits its user message.
|
||||
* @returns Whether the question is still continued (`false` when this Session
|
||||
* lists no such continued call, or its composition carries no Session
|
||||
* projections); an accepted reply stays queued until the agent admits its
|
||||
* user message.
|
||||
* @throws {UserQuestionError} `BAD_ANSWER` when the batch does not name each
|
||||
* question of the call exactly once, or `REPLY_QUEUED` when a reply is
|
||||
* already waiting for admission.
|
||||
|
||||
@@ -240,11 +240,29 @@ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnp
|
||||
* Answer a continued question. The reply is steered into the agent as a
|
||||
* user message whose source names the call; that message is also the
|
||||
* record that closes the question in the projection.
|
||||
*
|
||||
* The only call this method can answer is one the projection lists as
|
||||
* `continued` on this Session, and it steers a user message into the running
|
||||
* turn, so it speaks for the person the Session runs for. A LiveShare reader
|
||||
* reaches it through the Session read role, which is safe only while an
|
||||
* approval question cannot become `continued`: the projection tracks only
|
||||
* calls made under the timed `ask_user_question` schema, and a call becomes
|
||||
* `continued` only by returning the pending result a timed wait produces (or,
|
||||
* for PTC, a pending dispatch) or by resume repair recording
|
||||
* `TOOL_OUTCOME_UNKNOWN` for a call the process never finished. Plan review
|
||||
* (`plan-review`) and the CUA approvals (`approval`) reach `ctx.userQuestions.ask`
|
||||
* without a `wait` and without a `timeout`, so their result is a settled
|
||||
* answer, an abort, or a failure, never a pending result, and they stay out
|
||||
* of the projection. A future approval surface must keep asking without
|
||||
* `wait`/`timeout`, or it must gain its own owner-only gate; giving it a timed
|
||||
* form makes an approval answerable by a share viewer.
|
||||
* @param agent - Live root agent for the owning Session.
|
||||
* @param callId - Continued question identity.
|
||||
* @param answer - Complete structured answer batch, one item per question of the call.
|
||||
* @returns Whether the question is still continued; an accepted reply stays
|
||||
* queued until the agent admits its user message.
|
||||
* @returns Whether the question is still continued (`false` when this Session
|
||||
* lists no such continued call, or its composition carries no Session
|
||||
* projections); an accepted reply stays queued until the agent admits its
|
||||
* user message.
|
||||
* @throws {UserQuestionError} `BAD_ANSWER` when the batch does not name each
|
||||
* question of the call exactly once, or `REPLY_QUEUED` when a reply is
|
||||
* already waiting for admission.
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
en: 6cc2cd9ced70bb09
|
||||
zh: 1c0e6cb4ba2ed637
|
||||
/tool-schema-catalog/tool-package-map:
|
||||
en: 4e5bb11e4664bb1c
|
||||
zh: 4855556d38701373
|
||||
en: 789c9c7932024257
|
||||
zh: 6d0465e0463b321c
|
||||
/tool-schema-catalog/deepseek-ai-dsh-plugin-manager:
|
||||
en: e0143916bb634762
|
||||
zh: e0143916bb634762
|
||||
@@ -72,8 +72,8 @@
|
||||
en: 8c8643ef46fd075f
|
||||
zh: 8c8643ef46fd075f
|
||||
/tool-schema-catalog/deepseek-ai-dsh-tool-executor-ptc/run-code:
|
||||
en: cff92e5a2476af7e
|
||||
zh: 8d56bc41053f0a85
|
||||
en: 93d8526bbc4936d2
|
||||
zh: 963af83582d289c5
|
||||
/tool-schema-catalog/deepseek-ai-dsh-plan-mode:
|
||||
en: b500b530845e26a9
|
||||
zh: b500b530845e26a9
|
||||
@@ -113,12 +113,9 @@
|
||||
/tool-schema-catalog/deepseek-ai-dsh-tool-cordis:
|
||||
en: 76c7c62f9029b6f5
|
||||
zh: 76c7c62f9029b6f5
|
||||
/tool-schema-catalog/deepseek-ai-dsh-tool-cordis/cordis-inspect-list:
|
||||
en: 594e5b42047969cc
|
||||
zh: 72189ca21345c210
|
||||
/tool-schema-catalog/deepseek-ai-dsh-tool-cordis/cordis-inspect-query:
|
||||
en: 42a647ba98527f9e
|
||||
zh: c53ade6a47ea523f
|
||||
/tool-schema-catalog/deepseek-ai-dsh-tool-cordis/cordis-inspect:
|
||||
en: f804c4e7fccc1c45
|
||||
zh: 7538d8201ef16ed9
|
||||
/tool-schema-catalog/deepseek-ai-dsh-tool-bash-persistent:
|
||||
en: bdd9e88c49029e05
|
||||
zh: bdd9e88c49029e05
|
||||
|
||||
+34
-41
@@ -27,7 +27,7 @@ This table connects model-visible tool names to the plugin package and service s
|
||||
| `@deepseek-ai/dsh-tool-office` | `office_convert`, `office_recalculate`, `office_render` | `ctx.workingDirectory`, `ctx.tools`, `ctx.fs`, `ctx.agents`, `ctx.officeKit`, `ctx.attachments and ctx.llm for office_render` | `tool/call`, `tool/result with rendered image attachments`, `temporary converted files in the Office kit output store` | - | Declared to an Agent from the step after it successfully loads an Office skill, and kept while the previous request header declares an Office tool. Admitted calls fail with the Office service's unavailable error when LibreOffice Kit is not installed. |
|
||||
| `@deepseek-ai/dsh-tool-present` | `present` | `ctx.workingDirectory`, `ctx.tools`, `ctx.fs`, `ctx.agents` | `tool/call`, `deliverables/presented after a successful final result`, `tool/result` | - | Deliveries belong to the calling Session; Web ui-deliverables supplies source-file opening and cards. |
|
||||
| `@deepseek-ai/dsh-tool-pwsh` | `pwsh` | `ctx.workingDirectory`, `ctx.tools`, `ctx.shell`, `ctx.systemPrompt`, `ctx.shellEnv`, `ctx.jobs for run_in_background and the job-backed foreground path` | `tool/call`, `tool/result` | - | The pwsh tool is the PowerShell-dialect consumer of the bash executor seam for Windows compositions (a PowerShell executor such as `@deepseek-ai/dsh-pwsh-local` backs `ctx.shell`); it mirrors the bash tool call-for-call minus sandbox controls — `run_in_background` runs register with the generic `ctx.jobs` runtime and are collected/stopped through the `job_*` tools, and the managed `DSH_*` environment comes from `@deepseek-ai/dsh-shell-env`. Each call runs in a fresh process (no persistent PTY session), with native `C:\...` paths and `$env:NAME` variables. |
|
||||
| `@deepseek-ai/dsh-tool-cordis` | `cordis_inspect_list`, `cordis_inspect_query` | `ctx.tools`, `ctx.cordisInspect` | `tool/call`, `tool/result` | - | Creator mode provides two read-only runtime inspection tools. The Cordis host runner supplies the inspection registry; Client queries require a connected page. Author persistent changes as bundles and install them with plugin_manager. |
|
||||
| `@deepseek-ai/dsh-tool-cordis` | `cordis_inspect` | `ctx.tools`, `ctx.cordisInspect` | `tool/call`, `tool/result` | - | Standard and Creator modes provide one read-only runtime inspection tool. Omit query for the provider directory; pass query to inspect a declared method. The Cordis host runner supplies the inspection registry; Client queries require a connected page. Author persistent changes as bundles and install them with plugin_manager. |
|
||||
| `@deepseek-ai/dsh-tool-bash-persistent` | `bash` | `ctx.workingDirectory`, `ctx.tools`, `ctx.terminals`, `an owning Agent at execution time` | `tool/call`, `PTY shell state`, `tool/result` | - | One owner-isolated persistent bash tool; deployment composition supplies the PTY backend and may override the model-facing environment description. |
|
||||
| `@deepseek-ai/dsh-tool-pwsh-persistent` | `pwsh` | `ctx.workingDirectory`, `ctx.tools`, `ctx.terminals`, `an owning Agent at execution time` | `tool/call`, `PTY shell state`, `tool/result` | - | One owner-isolated persistent pwsh tool, the Windows counterpart of the persistent bash tool; deployment composition supplies a pwsh-dialect PTY backend and may override the model-facing environment description. |
|
||||
| `@deepseek-ai/dsh-tool-str-replace-editor` | `str_replace_editor` | `ctx.tools`, `ctx.fs` | `tool/call`, `fs/observed after view presence/absence, edit absence, or successful mutation`, `tool/result` | - | Standalone view/create/unique literal replace/line insert tool over the filesystem seam; it composes with any shell or terminal API. |
|
||||
@@ -623,7 +623,7 @@ ask_user_question keeps the original blocking behavior by default; set `mode: ti
|
||||
|
||||
### `run_code`
|
||||
|
||||
Execute a TypeScript program against the available tools. Takes two required arguments: `code`, the BODY of an async function (erasable syntax only; top-level `await` and `return` work), and `description`, a short summary of what the program does. Call tools as `await tools.name(args)` per the declarations in the system prompt. Show selected text and images with inspect(...values). The program is the body of an async TypeScript function; only erasable syntax is accepted, with no enum or namespaces. Type annotations are advisory. Top-level await and return are supported. Use inspect(...values) to display output. Do not use console. Each call runs in a fresh Node process. Node APIs are available through await import(...). Relative paths use the supplied working directory; process.env starts empty. Direct filesystem access follows this execution's sandbox policy. Each program starts in the Session's current directory. Running programs keep their initial directory. A sandbox escalation approves this complete program for one execution only. Nested tools retain their own policies and approvals. Request wider access only after evidence of a denial. Earlier effects may already have completed: inspect them before explicitly retrying. Programs are never replayed automatically.
|
||||
Execute a TypeScript program against the available tools. Takes two required arguments: `code`, the BODY of an async function (erasable syntax only; top-level `await` and `return` work), and `description`, a short summary of what the program does. Call tools as `await tools.name(args)` per the declarations in the system prompt. Show selected text and images with inspect(...values). The program is the body of an async TypeScript function; only erasable syntax is accepted, with no enum or namespaces. Type annotations are advisory. Top-level await and return are supported. Use inspect(...values) to display output. Do not use console. Use the raw form of a template literal only for short text whose backslashes must stay exactly as written, such as a regular expression; write other text, in particular file contents and commands, as ordinary strings. Write file contents as an array of quoted strings, one line each, joined with newlines; never as one template literal. Each call runs in a fresh Node process. Node APIs are available through await import(...). Relative paths use the supplied working directory; process.env starts empty. Direct filesystem access follows this execution's sandbox policy. Each program starts in the Session's current directory. Running programs keep their initial directory. A sandbox escalation approves this complete program for one execution only. Nested tools retain their own policies and approvals. Request wider access only after evidence of a denial. Earlier effects may already have completed: inspect them before explicitly retrying. Programs are never replayed automatically.
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -945,58 +945,51 @@ The pwsh tool is the PowerShell-dialect consumer of the bash executor seam for W
|
||||
|
||||
## `@deepseek-ai/dsh-tool-cordis`
|
||||
|
||||
### `cordis_inspect_list`
|
||||
### `cordis_inspect`
|
||||
|
||||
List every Cordis Inspect Provider currently known to the Host, including local Host Providers and the latest manifests synchronized from the Client. Each entry includes its platform, purpose, read-only methods, and input/output schemas. Call this Tool before writing or configuring a plugin, then select the provider and method for cordis_inspect_query from its result. Do not guess names or treat an Inspect method as a business Service that Plugin code can call.
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
}
|
||||
```
|
||||
|
||||
Source: [`packages/extensions/tool-cordis/src/index.ts`](../packages/extensions/tool-cordis/src/index.ts)
|
||||
|
||||
### `cordis_inspect_query`
|
||||
|
||||
Run a read-only query declared by an Inspect Provider. platform, provider, and method must come from cordis_inspect_list, and input must satisfy that method's schema. Use this Tool before writing plugin code to read exact Service methods, Event modes, plugin Config schemas, Tool schemas, theme tokens, or live Slot trees and props. Host queries run locally. A Client query waits for the first valid page response within the configured timeout; otherwise it reports a Client failure or asks you to reconnect and retry. This Tool cannot invoke business Service methods or modify the runtime.
|
||||
Inspect runtime APIs before writing or configuring plugins. Omit query to discover providers, methods, and input schemas; then query an exact entry from that directory. Read-only: cannot invoke business Service methods or modify the runtime. Client queries require a connected page.
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"platform": {
|
||||
"type": "string",
|
||||
"description": "Runtime platform that owns the Provider.",
|
||||
"enum": [
|
||||
"host",
|
||||
"client"
|
||||
"query": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"platform": {
|
||||
"type": "string",
|
||||
"description": "Provider platform.",
|
||||
"enum": [
|
||||
"host",
|
||||
"client"
|
||||
]
|
||||
},
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"description": "Provider ID from the directory."
|
||||
},
|
||||
"method": {
|
||||
"type": "string",
|
||||
"description": "Method name from the directory."
|
||||
},
|
||||
"input": {
|
||||
"description": "Arguments matching the method's input schema."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"platform",
|
||||
"provider",
|
||||
"method"
|
||||
]
|
||||
},
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"description": "Exact Provider ID returned by cordis_inspect_list."
|
||||
},
|
||||
"method": {
|
||||
"type": "string",
|
||||
"description": "Exact method name declared by the Provider manifest."
|
||||
},
|
||||
"input": {
|
||||
"description": "Optional query input; it must satisfy the method input schema."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"platform",
|
||||
"provider",
|
||||
"method"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Source: [`packages/extensions/tool-cordis/src/index.ts`](../packages/extensions/tool-cordis/src/index.ts)
|
||||
|
||||
Creator mode provides two read-only runtime inspection tools. The Cordis host runner supplies the inspection registry; Client queries require a connected page. Author persistent changes as bundles and install them with plugin_manager.
|
||||
Standard and Creator modes provide one read-only runtime inspection tool. Omit query for the provider directory; pass query to inspect a declared method. The Cordis host runner supplies the inspection registry; Client queries require a connected page. Author persistent changes as bundles and install them with plugin_manager.
|
||||
|
||||
<a id="deepseek-aidsh-tool-bash-persistent"></a>
|
||||
|
||||
|
||||
+34
-41
@@ -31,7 +31,7 @@
|
||||
| `@deepseek-ai/dsh-tool-office` | `office_convert`、`office_recalculate`、`office_render` | `ctx.workingDirectory`、`ctx.tools`、`ctx.fs`、`ctx.agents`、`ctx.officeKit`、`ctx.attachments and ctx.llm for office_render` | `tool/call`、`tool/result with rendered image attachments`、`temporary converted files in the Office kit output store` | - | Agent 成功加载 Office 技能后,从下一步起向其声明这些工具;上一次请求头已声明 Office 工具时继续保留。未安装 LibreOffice Kit 时,已声明工具的调用以 Office 服务的 unavailable 错误失败。 |
|
||||
| `@deepseek-ai/dsh-tool-present` | `present` | `ctx.workingDirectory`、`ctx.tools`, `ctx.fs`, `ctx.agents` | `tool/call`, `deliverables/presented 在成功的最终结果之后`, `tool/result` | - | 交付归调用方 Session 所有;Web ui-deliverables 提供源文件打开与卡片。 |
|
||||
| `@deepseek-ai/dsh-tool-pwsh` | `pwsh` | `ctx.workingDirectory`、`ctx.tools`、`ctx.shell`、`ctx.systemPrompt`、`ctx.shellEnv`、`ctx.jobs for run_in_background and the job-backed foreground path` | `tool/call`、`tool/result` | - | pwsh 工具是 Windows 组合中 bash 执行器 seam 的 PowerShell 方言消费方(由 `@deepseek-ai/dsh-pwsh-local` 等 PowerShell 执行器为 `ctx.shell` 提供后端);除沙箱接口外,它逐项对应 bash 工具调用。使用 `run_in_background` 的运行会注册到通用 `ctx.jobs` 运行时,并通过 `job_*` 工具收集/停止;托管的 `DSH_*` 环境来自 `@deepseek-ai/dsh-shell-env`。每次调用都在新进程中运行,不使用持久 PTY 会话。路径采用原生 `C:\...` 形式,变量采用 `$env:NAME`。 |
|
||||
| `@deepseek-ai/dsh-tool-cordis` | `cordis_inspect_list`, `cordis_inspect_query` | `ctx.tools`, `ctx.cordisInspect` | `tool/call`, `tool/result` | - | 创造模式提供两个只读运行时检查工具。Cordis host runner 提供检查注册表;Client 查询需要已连接页面。持久化变更编写为组合包,再通过 plugin_manager 安装。 |
|
||||
| `@deepseek-ai/dsh-tool-cordis` | `cordis_inspect` | `ctx.tools`, `ctx.cordisInspect` | `tool/call`, `tool/result` | - | 标准模式和创造模式提供一个只读运行时检查工具。省略 query 获取 provider 目录;传入 query 查询已声明的方法。Cordis host runner 提供检查注册表;Client 查询需要已连接页面。持久化变更编写为组合包,再通过 plugin_manager 安装。 |
|
||||
| `@deepseek-ai/dsh-tool-bash-persistent` | `bash` | `ctx.workingDirectory`、`ctx.tools`、`ctx.terminals`、`an owning Agent at execution time` | `tool/call`、`PTY shell state`、`tool/result` | - | 一个按所有者隔离的持久 bash 工具;部署组合提供 PTY 后端,并可覆盖面向模型的环境描述。 |
|
||||
| `@deepseek-ai/dsh-tool-pwsh-persistent` | `pwsh` | `ctx.workingDirectory`、`ctx.tools`、`ctx.terminals`、`an owning Agent at execution time` | `tool/call`、`PTY shell state`、`tool/result` | - | 一个按所有者隔离的持久 pwsh 工具,持久 bash 工具的 Windows 对应物;部署组合提供 pwsh 方言的 PTY 后端,并可覆盖面向模型的环境描述。 |
|
||||
| `@deepseek-ai/dsh-tool-str-replace-editor` | `str_replace_editor` | `ctx.tools`、`ctx.fs` | `tool/call`、`fs/observed after view presence/absence, edit absence, or successful mutation`、`tool/result` | - | 基于文件系统 seam 的独立查看/创建/唯一字面量替换/按行插入工具;可与任何 shell 或终端接口组合。 |
|
||||
@@ -627,7 +627,7 @@ ask_user_question 默认保持原有阻塞行为;设置 `mode: timed` 后才
|
||||
|
||||
### `run_code`
|
||||
|
||||
针对可用工具执行 TypeScript 程序。接受两个必填参数:`code`,异步函数的函数体(仅限可擦除语法,支持顶层 `await` 和 `return`);以及 `description`,简要说明程序做什么。请按系统提示词中的声明,以 `await tools.name(args)` 调用工具。使用 inspect(...values) 展示选定的文本和图片。程序是异步 TypeScript 函数的函数体,只接受可擦除语法,不支持 enum 或 namespace。类型标注只作提示。支持顶层 await 和 return。使用 inspect(...values) 展示输出。不要使用 console。每次调用在新的 Node 进程中运行,可通过 await import(...) 使用 Node API。相对路径以传入的工作目录为准;process.env 初始为空。直接文件系统访问遵循本次执行的沙箱策略。每个程序从 Session 的当前目录启动,运行中保留初始目录。沙箱提权只为本次完整程序执行授权。嵌套工具保留自身策略与审批。只有在获得拒绝证据后才请求更宽访问。先前效果可能已经发生,请在显式重试前检查。程序不会自动重放。
|
||||
针对可用工具执行 TypeScript 程序。接受两个必填参数:`code`,异步函数的函数体(仅限可擦除语法,支持顶层 `await` 和 `return`);以及 `description`,简要说明程序做什么。请按系统提示词中的声明,以 `await tools.name(args)` 调用工具。使用 inspect(...values) 展示选定的文本和图片。程序是异步 TypeScript 函数的函数体,只接受可擦除语法,不支持 enum 或 namespace。类型标注只作提示。支持顶层 await 和 return。使用 inspect(...values) 展示输出。不要使用 console。模板字面量的 raw 形式只用于反斜杠必须原样保留的短文本,例如正则表达式;其他文本,尤其是文件内容和命令,用普通字符串书写。文件内容写成引号字符串数组,每行一个元素,用换行符拼接;不要写成一个模板字面量。每次调用在新的 Node 进程中运行,可通过 await import(...) 使用 Node API。相对路径以传入的工作目录为准;process.env 初始为空。直接文件系统访问遵循本次执行的沙箱策略。每个程序从 Session 的当前目录启动,运行中保留初始目录。沙箱提权只为本次完整程序执行授权。嵌套工具保留自身策略与审批。只有在获得拒绝证据后才请求更宽访问。先前效果可能已经发生,请在显式重试前检查。程序不会自动重放。
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -949,58 +949,51 @@ pwsh 工具是 Windows 组合中 bash 执行器 seam 的 PowerShell 方言消费
|
||||
|
||||
## `@deepseek-ai/dsh-tool-cordis`
|
||||
|
||||
### `cordis_inspect_list`
|
||||
### `cordis_inspect`
|
||||
|
||||
列出 Host 当前已知的所有 Cordis Inspect Provider,包括本地 Host Provider 和 Client 同步的最新清单。每项包含平台、用途、只读方法以及输入输出 schema。编写或配置插件前先调用本工具,再从结果选择 cordis_inspect_query 的 provider 和方法。不要猜测名称,也不要把 Inspect 方法当作插件代码可调用的业务 Service。
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
}
|
||||
```
|
||||
|
||||
来源: [`packages/extensions/tool-cordis/src/index.ts`](../packages/extensions/tool-cordis/src/index.ts)
|
||||
|
||||
### `cordis_inspect_query`
|
||||
|
||||
执行 Inspect Provider 声明的只读查询。platform、provider 和 method 必须来自 cordis_inspect_list,input 必须符合该方法的 schema。编写插件代码前,用本工具读取准确的 Service 方法、Event 模式、插件 Config schema、Tool schema、主题 token,或实时 Slot 树与 props。Host 查询在本地运行。Client 查询在配置的超时内等待页面首个有效响应;否则返回 Client 错误,或提示重新连接后重试。本工具不能调用业务 Service 方法或修改运行时。
|
||||
编写或配置插件前查询运行时 API。省略 query 以发现 provider、方法和输入 schema,再查询该目录中的具体条目。只读:不能调用业务 Service 方法或修改运行时。Client 查询需要已连接的页面。
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"platform": {
|
||||
"type": "string",
|
||||
"description": "Runtime platform that owns the Provider.",
|
||||
"enum": [
|
||||
"host",
|
||||
"client"
|
||||
"query": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"platform": {
|
||||
"type": "string",
|
||||
"description": "Provider platform.",
|
||||
"enum": [
|
||||
"host",
|
||||
"client"
|
||||
]
|
||||
},
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"description": "Provider ID from the directory."
|
||||
},
|
||||
"method": {
|
||||
"type": "string",
|
||||
"description": "Method name from the directory."
|
||||
},
|
||||
"input": {
|
||||
"description": "Arguments matching the method's input schema."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"platform",
|
||||
"provider",
|
||||
"method"
|
||||
]
|
||||
},
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"description": "Exact Provider ID returned by cordis_inspect_list."
|
||||
},
|
||||
"method": {
|
||||
"type": "string",
|
||||
"description": "Exact method name declared by the Provider manifest."
|
||||
},
|
||||
"input": {
|
||||
"description": "Optional query input; it must satisfy the method input schema."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"platform",
|
||||
"provider",
|
||||
"method"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
来源: [`packages/extensions/tool-cordis/src/index.ts`](../packages/extensions/tool-cordis/src/index.ts)
|
||||
|
||||
创造模式提供两个只读运行时检查工具。Cordis host runner 提供检查注册表;Client 查询需要已连接页面。持久化变更编写为组合包,再通过 plugin_manager 安装。
|
||||
标准模式和创造模式提供一个只读运行时检查工具。省略 query 获取 provider 目录;传入 query 查询已声明的方法。Cordis host runner 提供检查注册表;Client 查询需要已连接页面。持久化变更编写为组合包,再通过 plugin_manager 安装。
|
||||
|
||||
<a id="deepseek-aidsh-tool-bash-persistent"></a>
|
||||
|
||||
|
||||
@@ -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.3/cordis-inspect-tool/guide.md
|
||||
/:
|
||||
en: 74fcdcd04d1f4a09
|
||||
zh: 29f3fd6a4996f748
|
||||
/use-one-cordis-inspection-tool:
|
||||
en: da2e5b8ded13d6ad
|
||||
zh: 67d4ae724c7561e2
|
||||
/use-one-cordis-inspection-tool/change:
|
||||
en: 4ba772b8a87ad4bd
|
||||
zh: a50b3c0739a68b67
|
||||
/use-one-cordis-inspection-tool/migration:
|
||||
en: c10ebe52b24af1e2
|
||||
zh: be4ba383eb213057
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
kind: upgrade-guide
|
||||
description: "The cordis_inspect tool replaces cordis_inspect_list and cordis_inspect_query."
|
||||
---
|
||||
|
||||
# Use one Cordis inspection tool
|
||||
|
||||
English | [中文](guide.zh.md)
|
||||
|
||||
## Change
|
||||
|
||||
`cordis_inspect` replaces `cordis_inspect_list` and `cordis_inspect_query`. Custom prompts, skills, and tool callers that name either old tool must use the new name and arguments. An omitted `query` returns the provider directory; a supplied `query` selects a provider method.
|
||||
|
||||
## Migration
|
||||
|
||||
1. Replace `cordis_inspect_list({})` calls with `cordis_inspect({})`.
|
||||
2. Replace `cordis_inspect_query({ platform, provider, method, input })` calls with `cordis_inspect({ query: { platform, provider, method, input } })`. Keep `platform`, `provider`, and `method` inside `query`; `input` remains optional.
|
||||
3. Confirm that `cordis_inspect({})` returns a provider directory. Select a provider and method from that directory, supply arguments matching its input schema under `query.input`, and confirm that the query returns the requested data. Client queries require a connected page.
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
kind: upgrade-guide
|
||||
description: "cordis_inspect 工具替代 cordis_inspect_list 和 cordis_inspect_query。"
|
||||
---
|
||||
|
||||
# 使用单个 Cordis 检查工具
|
||||
|
||||
[English](guide.md) | 中文
|
||||
|
||||
## 变更
|
||||
|
||||
`cordis_inspect` 替代 `cordis_inspect_list` 和 `cordis_inspect_query`。引用任一旧工具名称的自定义提示词、skill(技能)和工具调用方必须使用新名称及参数。省略 `query` 时返回 provider 目录;提供 `query` 时选择 provider 方法。
|
||||
|
||||
## 迁移
|
||||
|
||||
1. 将 `cordis_inspect_list({})` 调用替换为 `cordis_inspect({})`。
|
||||
2. 将 `cordis_inspect_query({ platform, provider, method, input })` 调用替换为 `cordis_inspect({ query: { platform, provider, method, input } })`。将 `platform`、`provider` 和 `method` 放在 `query` 内;`input` 仍为可选参数。
|
||||
3. 确认 `cordis_inspect({})` 返回 provider 目录。从该目录中选择 provider 和方法,在 `query.input` 下提供符合其输入 schema 的参数,并确认查询返回所请求的数据。Client 查询需要已连接的页面。
|
||||
@@ -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.3/profile-context-overlay-paths/guide.md
|
||||
/:
|
||||
en: c4ef1e7d8d298290
|
||||
zh: 31b78ba3894af10c
|
||||
/read-command-line-overlays-from-their-files:
|
||||
en: bfab1724009b36aa
|
||||
zh: 103463ee47fbdafc
|
||||
/read-command-line-overlays-from-their-files/change:
|
||||
en: 8abc69fc8b12c36e
|
||||
zh: 89856745d785a697
|
||||
/read-command-line-overlays-from-their-files/migration:
|
||||
en: 87ea30b7ee93ef13
|
||||
zh: 898cfde6b53f8248
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
kind: upgrade-guide
|
||||
description: "ProfileContext replaces parsed overlays with overlay file paths that every composition rereads."
|
||||
---
|
||||
|
||||
# Read command-line overlays from their files
|
||||
|
||||
English | [中文](guide.zh.md)
|
||||
|
||||
## Change
|
||||
|
||||
`ProfileContext` from `@deepseek-ai/dsh-app-boot`, provided as `ctx.profileContext`, no longer has `overlays: readonly PatchOptions[]`. It now carries `overlayPaths: readonly string[]`: the absolute `--patch` file paths in argv order. `readProfilePatches()` reads those files on each call, so it returns current overlay contents and throws while an overlay file is missing or invalid. With `dsh-hmr` enabled, editing a `--patch` file recomposes the running profile. Plugins that read `profileContext.overlays` and launchers or tests that construct a `ProfileContext` are affected.
|
||||
|
||||
## Migration
|
||||
|
||||
1. Replace reads of `ctx.profileContext.overlays` with `ctx.profileContext.overlayPaths.flatMap(path => loadOverlayPatches(binName, path))`, which returns the same overlay layer. Call `readProfilePatches(binName, ctx.profileContext)` only when you need the full composition of bundle, profile, home, and overlay layers.
|
||||
2. Where code constructs a `ProfileContext`, replace `overlays: [...]` with `overlayPaths: [...]`. Write any in-memory overlay rows to a patch file first and pass its absolute path.
|
||||
3. Confirm the migration by running your type checker: no `overlays` property remains on `ProfileContext` values.
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
kind: upgrade-guide
|
||||
description: "ProfileContext 以 overlay 文件路径取代已解析的 overlay,每次组合都会重新读取这些文件。"
|
||||
---
|
||||
|
||||
# 从文件读取命令行 overlay
|
||||
|
||||
[English](guide.md) | 中文
|
||||
|
||||
## 变更
|
||||
|
||||
`@deepseek-ai/dsh-app-boot` 的 `ProfileContext`(以 `ctx.profileContext` 提供)不再包含 `overlays: readonly PatchOptions[]`,改为 `overlayPaths: readonly string[]`:按命令行顺序排列的 `--patch` 文件绝对路径。`readProfilePatches()` 每次调用都会读取这些文件,因此返回当前的 overlay 内容,并在 overlay 文件缺失或无效时抛出异常。启用 `dsh-hmr` 时,编辑 `--patch` 文件会重新组合运行中的 profile。读取 `profileContext.overlays` 的插件,以及构造 `ProfileContext` 的启动器或测试会受到影响。
|
||||
|
||||
## 迁移
|
||||
|
||||
1. 将对 `ctx.profileContext.overlays` 的读取替换为 `ctx.profileContext.overlayPaths.flatMap(path => loadOverlayPatches(binName, path))`,它返回相同的 overlay 层。只有需要 bundle、profile、home 与 overlay 各层的完整组合结果时,才调用 `readProfilePatches(binName, ctx.profileContext)`。
|
||||
2. 在构造 `ProfileContext` 的代码中,将 `overlays: [...]` 替换为 `overlayPaths: [...]`。内存中的 overlay 行需先写入 patch 文件,再传入该文件的绝对路径。
|
||||
3. 运行类型检查确认迁移完成:`ProfileContext` 值上不再存在 `overlays` 属性。
|
||||
@@ -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.3/ptc-mcp-image-values/guide.md
|
||||
/:
|
||||
en: 4ef7bb2332b41c50
|
||||
zh: 64dc0fee94ec109f
|
||||
/admitted-mcp-image-blocks-become-ptc-image-values:
|
||||
en: d6de4dbd1d9e5b97
|
||||
zh: abfc0e17251123b4
|
||||
/admitted-mcp-image-blocks-become-ptc-image-values/change:
|
||||
en: 49c1de6568812254
|
||||
zh: e33b028fb5369be3
|
||||
/admitted-mcp-image-blocks-become-ptc-image-values/migration:
|
||||
en: 7015ecfe11765993
|
||||
zh: 677267091fa5458a
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
kind: upgrade-guide
|
||||
description: "Admitted MCP image blocks carry an attachment reference and reach PTC programs as Image values instead of base64 JSON."
|
||||
---
|
||||
|
||||
# Admitted MCP image blocks become PTC `Image` values
|
||||
|
||||
English | [中文](guide.zh.md)
|
||||
|
||||
## Change
|
||||
|
||||
An MCP tool result keeps its canonical `{ content, structuredContent? }` value. Each image block admitted to durable model context now also carries an `attachment` reference beside its original `type`, `mimeType`, and `data` fields. Refused images keep their original fields only.
|
||||
|
||||
In PTC mode, each value entry of the form `{ type: 'image', attachment }` whose attachment appears in the finalized tool result becomes an `Image`, the same value that `read_image` and CUA screenshots return. Previously, the program received the base64 image block, so `inspect(result)` printed the base64 data, and the complete result content, text and pictures, was attached automatically as additional model context. Now `inspect` shows the picture, and the result's text and pictures enter the conversation only when the program inspects them, as for native CUA screenshots. When the value does not reference every image of the final result, or the program cannot read an image file, the program receives the raw blocks and the complete result content is still attached automatically, as before. Image blocks that an output policy removed keep their `attachment` field but stay JSON.
|
||||
|
||||
This affects PTC programs that read `data` or `mimeType` from an admitted MCP image block or rely on the automatic attachment of its result text, and code that compares MCP tool values with the raw server result.
|
||||
|
||||
## Migration
|
||||
|
||||
1. In PTC programs, inspect the `Image` and any result text the model needs, or read the image file through `path`:
|
||||
|
||||
```js
|
||||
const result = await tools.mcp__server__screenshot({});
|
||||
const image = result.content.find(block => block instanceof Image);
|
||||
inspect(image);
|
||||
```
|
||||
|
||||
2. Where a program needs the bytes, read `image.path` instead of decoding `data`.
|
||||
3. In code that compares MCP tool values with the server result, allow the added `attachment` field on admitted image blocks.
|
||||
4. Run the example with a model route that accepts image input. Confirm that the `run_code` result contains the picture and no base64 text.
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
kind: upgrade-guide
|
||||
description: "已接受的 MCP 图片块携带附件引用,并以 Image 值而非 base64 JSON 传给 PTC 程序。"
|
||||
---
|
||||
|
||||
# 已接受的 MCP 图片块成为 PTC `Image` 值
|
||||
|
||||
[English](guide.md) | 中文
|
||||
|
||||
## 变更
|
||||
|
||||
MCP 工具结果保留其规范值 `{ content, structuredContent? }`。每个进入持久模型上下文的图片块现在除原有的 `type`、`mimeType` 和 `data` 字段外,还携带 `attachment` 引用。被拒绝的图片仅保留原有字段。
|
||||
|
||||
在 PTC 模式下,形如 `{ type: 'image', attachment }` 且其附件出现在最终工具结果中的每个值条目都会变为 `Image`,与 `read_image` 和 CUA 截图返回的值相同。此前,程序收到的是 base64 图片块,因此 `inspect(result)` 输出 base64 数据,包括文本与图片在内的完整结果内容则自动作为额外模型上下文附加。现在 `inspect` 展示图片,且结果的文本与图片仅在程序 inspect 时进入对话,与原生 CUA 截图相同。返回值未引用最终结果中的每张图片,或程序无法读取某个图片文件时,程序接收原始块,完整的结果内容仍与此前一样自动附加。被输出策略移除的图片块保留 `attachment` 字段,但仍为 JSON。
|
||||
|
||||
从已接受的 MCP 图片块读取 `data` 或 `mimeType`、或依赖其结果文本自动附加的 PTC 程序,以及将 MCP 工具值与服务器原始结果比较的代码会受到影响。
|
||||
|
||||
## 迁移
|
||||
|
||||
1. 在 PTC 程序中,inspect `Image` 以及模型需要的结果文本,或通过 `path` 读取图片文件:
|
||||
|
||||
```js
|
||||
const result = await tools.mcp__server__screenshot({});
|
||||
const image = result.content.find(block => block instanceof Image);
|
||||
inspect(image);
|
||||
```
|
||||
|
||||
2. 程序需要字节数据时,读取 `image.path`,不要解码 `data`。
|
||||
3. 在将 MCP 工具值与服务器结果比较的代码中,允许已接受图片块上新增的 `attachment` 字段。
|
||||
4. 使用接受图片输入的模型路由运行上面的示例。确认 `run_code` 结果包含图片且不含 base64 文本。
|
||||
@@ -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.3/ptc-tool-result-inspection/guide.md
|
||||
/:
|
||||
en: 31e27f1eb83f9740
|
||||
zh: 85c7c3637222f1d8
|
||||
/ptc-tool-result-inspection-and-bootstrap-protocol-4:
|
||||
en: 2509c4fe8d208eb8
|
||||
zh: 5f5dfd41fd29cd55
|
||||
/ptc-tool-result-inspection-and-bootstrap-protocol-4/change:
|
||||
en: a374fea86e00efb1
|
||||
zh: fa50515f25ef048e
|
||||
/ptc-tool-result-inspection-and-bootstrap-protocol-4/migration:
|
||||
en: bfb868b271b5113d
|
||||
zh: 597c95d985891d43
|
||||
@@ -0,0 +1,34 @@
|
||||
---
|
||||
kind: upgrade-guide
|
||||
description: "Direct inspection of unchanged PTC object and array tool results uses tool-rendered text, and custom Node bootstraps require protocol 4."
|
||||
---
|
||||
|
||||
# PTC tool-result inspection and bootstrap protocol 4
|
||||
|
||||
English | [中文](guide.zh.md)
|
||||
|
||||
## Change
|
||||
|
||||
PTC tools keep their declared JSON return values. With or without inspection metadata, field access, copying, and JSON serialization operate on the original data; the host-only descriptor is not exposed to the program. Previously, `inspect(result)` formatted an object or array with Node's generic object formatter. It now displays the tool's final rendered text when the original result is unchanged and its output contains only text. The text includes completed output-policy changes; inspection neither reruns the tool nor calls `output.render` again. Log-only replacements do not affect it.
|
||||
|
||||
Non-empty associated text occupies a separate output group. `inspect('result:', result, 'done')` emits the label and a newline, then the tool text, followed by `done` in another group. Ordinary values in one group remain space-separated.
|
||||
|
||||
Field selections, copies, modified results, and results nested inside another value still use generic formatting. Scalar results, Images, and mixed text/image outputs keep their behavior. This affects programs and checks that depend on the exact text produced by inspecting a complete tool result. Inspectable containers may retain Image fields: direct inspection shows the supplied text; inspect the image field separately to display it.
|
||||
|
||||
The Node bootstrap protocol changes from 3 to 4. `HostMethods.invoke` replies now use `{ value: flatWire, inspection?: string }`. Custom `launch.bootstrapPath` deployments must update their bootstrap; the bundled bootstrap updates with the host.
|
||||
|
||||
## Migration
|
||||
|
||||
1. Keep `inspect(result)` to display the tool's rendered text. To display an object's structure, inspect a copy or selected fields:
|
||||
|
||||
```js
|
||||
const result = await tools.read({ file_path: "README.md" });
|
||||
inspect(result);
|
||||
inspect({ ...result });
|
||||
inspect(result.lines);
|
||||
```
|
||||
|
||||
2. For an array result, use `inspect([...result])` to display its elements with generic formatting. Update any expected output that relied on the previous full-result object formatting.
|
||||
3. If you implement a third-party `PtcRuntime`, recognize `PtcInspectableValue` binding results from `@deepseek-ai/dsh-ptc-runtime`. Deliver `.value` as the program's object or array, and associate `.text` with that unchanged value for direct `inspect`. Do not expose the wrapper or add inspection metadata to program fields.
|
||||
4. If you configure `launch.bootstrapPath`, deploy the matching `@deepseek-ai/dsh-ptc-runtime-node` bootstrap and its dependencies in that execution environment. Use the package's built `lib/process.js`, or `lib/persistent-process.js` for a REPL default. A custom protocol implementation must handle the new reply envelope as well as announce protocol 4; changing the version alone is insufficient.
|
||||
5. Run the example above. Confirm that the first inspection shows the tool's rendered file text, while the other two show object and array data. For a custom provider, also confirm that field access and `JSON.stringify(result)` use the original data. For a custom bootstrap, confirm that a PTC program starts without a protocol-mismatch error.
|
||||
@@ -0,0 +1,34 @@
|
||||
---
|
||||
kind: upgrade-guide
|
||||
description: "直接展示未修改的 PTC 工具对象和数组结果时使用工具渲染文本,自定义 Node bootstrap 须升级到协议 4。"
|
||||
---
|
||||
|
||||
# PTC 工具结果展示与 bootstrap 协议 4
|
||||
|
||||
[English](guide.md) | 中文
|
||||
|
||||
## 变更
|
||||
|
||||
PTC 工具保留声明的 JSON 返回值。无论是否附带展示元数据,字段访问、拷贝和 JSON 序列化都操作原有数据;只供宿主使用的描述符不会暴露给程序。此前,`inspect(result)` 使用 Node 的通用对象格式展示对象或数组。现在,原结果未被修改且其输出仅包含文本时,会展示工具最终渲染的文本。该文本包含已完成的输出策略修改;展示不会重新运行工具或再次调用 `output.render`。仅针对日志的替换不影响此文本。
|
||||
|
||||
非空的关联文本独占一个输出组。执行 `inspect('result:', result, 'done')` 时,先输出标签并换行,再输出工具文本,随后另起一组输出 `done`。同组普通值仍以空格分隔。
|
||||
|
||||
字段选择、拷贝、修改后的结果,以及嵌套在其他值中的结果,仍使用通用格式。标量结果、Image 和混合文本与图片的输出保持原有行为。依赖完整工具结果展示文本的程序和检查会受到影响。可展示的容器可以保留 Image 字段:直接展示容器时输出附带文本;单独展示图片字段时输出该图片。
|
||||
|
||||
Node bootstrap 协议从 3 升至 4。`HostMethods.invoke` 的回复现在使用 `{ value: flatWire, inspection?: string }`。自定义 `launch.bootstrapPath` 部署必须更新 bootstrap;内置 bootstrap 随宿主一同更新。
|
||||
|
||||
## 迁移
|
||||
|
||||
1. 保留 `inspect(result)` 可展示工具渲染的文本。如需展示对象结构,改为展示拷贝或选定字段:
|
||||
|
||||
```js
|
||||
const result = await tools.read({ file_path: "README.md" });
|
||||
inspect(result);
|
||||
inspect({ ...result });
|
||||
inspect(result.lines);
|
||||
```
|
||||
|
||||
2. 对数组结果,使用 `inspect([...result])` 以通用格式展示元素。更新依赖此前完整结果对象格式的预期输出。
|
||||
3. 如果实现了第三方 `PtcRuntime`,请识别绑定返回的 `@deepseek-ai/dsh-ptc-runtime` 包中的 `PtcInspectableValue`。将 `.value` 作为程序的对象或数组,并为该未修改的原值关联 `.text`,供直接 `inspect` 使用。不要暴露包装对象,也不要向程序字段添加展示元数据。
|
||||
4. 如果配置了 `launch.bootstrapPath`,请在执行环境中部署匹配版本的 `@deepseek-ai/dsh-ptc-runtime-node` bootstrap 及其依赖。使用包内构建产物 `lib/process.js`,或默认采用 REPL 的 `lib/persistent-process.js`。自定义协议实现必须处理新的回复信封并声明协议 4;只改版本号并不足够。
|
||||
5. 运行上面的示例。确认第一次展示工具渲染的文件文本,后两次分别展示对象和数组数据。对于自定义提供方,还须确认字段访问和 `JSON.stringify(result)` 使用原有数据。对于自定义 bootstrap,确认 PTC 程序启动时不再报告协议不匹配。
|
||||
@@ -3,8 +3,8 @@
|
||||
# After editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write docs/user/develop/practice/dynamic-cordis.md
|
||||
/configure-persistent-plugins-from-a-prompt:
|
||||
en: d50e336357663f75
|
||||
zh: 4364e91403387e2a
|
||||
en: e61e42a805142826
|
||||
zh: da51aa93305f2a3c
|
||||
/configure-persistent-plugins-from-a-prompt/connect-an-mcp-server:
|
||||
en: f9fefda94ba8a005
|
||||
zh: f1a9a977a0732fc0
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
English | [中文](dynamic-cordis.zh.md)
|
||||
|
||||
Standard and Creator modes provide [Plugin Manager](../../../../packages/boot/plugin-manager/README.md); Creator mode adds read-only [runtime inspection](../../../../packages/extensions/tool-cordis/README.md). Plugin configuration belongs to the current profile, affects its sessions, and survives process restarts.
|
||||
Standard and Creator modes provide [Plugin Manager](../../../../packages/boot/plugin-manager/README.md) and read-only [runtime inspection](../../../../packages/extensions/tool-cordis/README.md). Plugin configuration belongs to the current profile, affects its sessions, and survives process restarts.
|
||||
|
||||
## Connect an MCP server
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[English](dynamic-cordis.md) | 中文
|
||||
|
||||
标准模式和创造模式提供 [Plugin Manager](../../../../packages/boot/plugin-manager/README.zh.md);创造模式还提供只读[运行时检查](../../../../packages/extensions/tool-cordis/README.zh.md)。插件配置属于当前 profile,影响其会话,并在进程重启后保留。
|
||||
标准模式和创造模式提供 [Plugin Manager](../../../../packages/boot/plugin-manager/README.zh.md) 和只读[运行时检查](../../../../packages/extensions/tool-cordis/README.zh.md)。插件配置属于当前 profile,影响其会话,并在进程重启后保留。
|
||||
|
||||
## 连接 MCP 服务器
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
en: 762ecb7a7743cd2d
|
||||
zh: 1b163ae679601767
|
||||
/schedule-reminders/inspect-run-and-delete-tasks:
|
||||
en: 9f1e9d732597aa28
|
||||
zh: 66feec44adf24332
|
||||
en: cad6e8f2facb59a7
|
||||
zh: d624b2f4bba8fd9f
|
||||
/schedule-reminders/edit-a-task:
|
||||
en: fe8c59251f0b4620
|
||||
zh: a422e44f758adae1
|
||||
|
||||
@@ -38,7 +38,7 @@ Ask the model to list reminders to see the reminders of every conversation, acti
|
||||
|
||||
Open Automation tasks from the sidebar to view reminders across Sessions without activating their conversations. Search by the task name, the instruction, or the id of the task's conversation, and filter by Task status: All, Enabled, Paused, or Ended. Rows are ordered by their scheduled time, earliest first. Each row shows the task name and one summary line: the status of a paused or ended task, the frequency, and, for an enabled task, Next scheduled time with its local and relative time.
|
||||
|
||||
A Session's tasks are the tasks that deliver to it, including the latest run of a task that creates a new conversation for every run, and the tasks that its Agent created or edited. An idle, unarchived Session row whose Session has at least one active task shows a clock mark; an archived row keeps that cell blank, with its live status on the hover card only. A long hover on a Session row with active tasks lists up to two of those tasks with their frequency and their next run as a device-zone time with its relative duration. The open Session's header shows an icon-only reminder clock while the Session has active tasks: it opens the sole task's details in the right sidebar, or otherwise a list of those tasks in which each row opens the task's details or deletes the task.
|
||||
The Session header clock, row mark, and hover list show active tasks with that Session as a fixed delivery target. These tasks deliver to an existing Session or reuse the Session created for their first delivery. An idle, unarchived Session row with at least one such task shows a clock mark. An archived row shows its live status only in the hover card. A long hover on a Session row with such tasks lists up to two of those tasks with their frequency and their next run as a device-zone time with its relative duration. The open Session's header shows an icon-only reminder clock while that Session has such tasks. The clock opens the sole task's details in the right sidebar. For multiple tasks, it opens a list where each row can open the task's details or delete the task.
|
||||
|
||||
Select a task to open its details. Rules shows the task name, Next run with its local and relative time or the status of a paused or ended task, the instruction, Repeat, and Run in, which shows Current linked conversation for a task that delivers to an existing conversation. The bottom of the details shows Linked session, or Latest run conversation for a task that creates a new conversation for every run. Its button opens that conversation when the Session is available and unarchived, and is disabled otherwise; before the first run creates the conversation, the entry shows Pending creation. For a task that delivers to an existing conversation, Rules states when that conversation is archived, unavailable, or still loading. The task details and deletion remain available even when a conversation cannot open. Browsing tasks does not unarchive Sessions.
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
从侧栏打开自动化任务页面,可跨 Session 查看提醒,而不激活相应对话。按任务名称、指令或任务所属对话的 id 搜索,并用“任务状态”(“全部”“已开启”“已暂停”或“已结束”)过滤。各行按计划时间排列,最早的在前。每行显示任务名称和一行摘要:已暂停或已结束任务的状态、频率,以及已开启任务的“下次计划时间”与其本地时间和相对时间。
|
||||
|
||||
一个 Session 的任务包括投递到该 Session 的任务(对于每次运行都新建对话的任务,以其最近一次运行为准),以及该 Session 的 Agent(智能体)创建或修改过的任务。空闲、未归档且至少有一个活动任务的 Session 行显示时钟标识;归档行该格留空,其实时状态只在悬浮卡片中显示。长时间悬停在带活动任务的 Session 行上时,最多列出其中两个任务及其频率,以及设备时区下的下次运行时间与相对时长。已打开 Session 的顶部在该 Session 有活动任务时显示仅图标的提醒时钟:只有一个任务时,它在右侧栏打开该任务的详情;否则列出这些任务,每行可打开任务详情或删除任务。
|
||||
Session 的页头时钟、行标识和悬浮列表只显示以该 Session 为固定投递目标的活动任务。此类任务投递到现有 Session,或复用首次投递时创建的 Session。空闲且未归档的 Session 行有此类任务时显示时钟标识。归档行的实时状态只在悬浮卡片中显示。长时间悬停在有此类任务的 Session 行上时,最多列出其中两个任务及其频率,以及设备时区下的下次运行时间与相对时长。已打开的 Session 有此类任务时,页头显示仅图标的提醒时钟。只有一个任务时,时钟在右侧栏打开任务详情。有多个任务时,时钟打开任务列表,每行可打开任务详情或删除任务。
|
||||
|
||||
选择任务打开其详情。“规则”显示任务名称、“下次运行”及其本地时间和相对时间(已暂停或已结束的任务显示其状态)、指令、“重复”和“执行位置”;投递到现有对话的任务,“执行位置”显示“当前关联对话”。详情底部显示“关联会话”;对于每次运行都新建对话的任务,显示“最近运行对话”。其按钮在 Session 可用且未归档时打开该对话,否则禁用;首次运行创建对话之前,该条目显示“待创建”。对于投递到现有对话的任务,“规则”会说明该对话已归档、不可用或仍在加载。即使对话无法打开,任务详情与删除操作仍然可用。浏览任务不会取消 Session 归档。
|
||||
|
||||
|
||||
@@ -68,6 +68,9 @@ export class JobController extends TypertRemoteService {
|
||||
* Stream the jobs one session can see — its own plus every unowned job —
|
||||
* as whole-set frames: one on open, then one after each coalesced burst of
|
||||
* lifecycle commits. The stream has no natural end; the carrier closes it.
|
||||
*
|
||||
* The Gateway names this call's Session resource from `request.sessionId`
|
||||
* through the session controller's resolver; no explicit reader is needed.
|
||||
* @param request - the session whose visible set to mirror.
|
||||
* @param signal - cancellation owned by the Remote stream carrier.
|
||||
* @returns the roster frames.
|
||||
|
||||
@@ -7,11 +7,17 @@ import type { JobId, JobOutcome } from '@deepseek-ai/dsh-jobs'
|
||||
import LocalJobRegistry from '@deepseek-ai/dsh-jobs-local'
|
||||
import SessionStore from '@deepseek-ai/dsh-session'
|
||||
import type { Session } from '@deepseek-ai/dsh-session'
|
||||
import { remoteErrorOf } from '@deepseek-ai/dsh-typert-protocol'
|
||||
import { remoteErrorOf, remoteMethods } from '@deepseek-ai/dsh-typert-protocol'
|
||||
import type { InvocationDescriptor, InvocationParameterDescriptor } from '@deepseek-ai/dsh-typert-protocol'
|
||||
import TypertRegistry from '@deepseek-ai/dsh-typert-registry'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { callResources } from '../../gateway/src/access.ts'
|
||||
import { resolveSessionResource } from '../../session-controller/src/session-resource.ts'
|
||||
import { JobController } from '../src/index.ts'
|
||||
|
||||
/** The Typert registry {@link callResources} resolves against. */
|
||||
type Typert = Parameters<typeof callResources>[0]
|
||||
|
||||
function producer(label = 'sleep 60') {
|
||||
let settle!: (outcome: JobOutcome) => void
|
||||
const cancels: (string | undefined)[] = []
|
||||
@@ -57,6 +63,18 @@ async function harness(): Promise<{
|
||||
return { ctx, session, agent, controller: ctx.jobController }
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the Session Controller's own `session` resource default with the
|
||||
* resolver it registers. Mounting the whole Session Controller would drag its
|
||||
* entire dependency web into the job harness, while this registration is the
|
||||
* one Host-side step that names the resource; the controller's own suite
|
||||
* covers the rest of it.
|
||||
* @param ctx - context holding the live Typert registry.
|
||||
*/
|
||||
function installSessionResolver(ctx: Context): void {
|
||||
ctx.typert.resources.register('session', { resolve: resolveSessionResource })
|
||||
}
|
||||
|
||||
function failureCode(run: () => unknown): string {
|
||||
try {
|
||||
run()
|
||||
@@ -68,6 +86,87 @@ function failureCode(run: () => unknown): string {
|
||||
throw new Error('expected a RemoteError failure')
|
||||
}
|
||||
|
||||
/**
|
||||
* The invocation the Gateway holds for one endpoint: these methods are direct
|
||||
* and take only JSON arguments, so their wire parameters are the decorated
|
||||
* ones in declaration order.
|
||||
* @param wires - the method's JSON parameter wires, in order.
|
||||
* @returns the invocation and parameters {@link callResources} reads.
|
||||
*/
|
||||
function invocationOf(wires: readonly string[]): Pick<InvocationDescriptor, 'invocation' | 'parameters'> {
|
||||
return {
|
||||
invocation: { kind: 'direct' },
|
||||
parameters: wires.map((wire): InvocationParameterDescriptor => ({ name: wire, wire, source: 'json', codec: { mode: 'src-json' } })),
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The resources the Gateway resolves for one call: the readers the live
|
||||
* Service declares, the registry they resolve against, and the call's named
|
||||
* arguments. `list` and `follow` take their cancellation signal after the
|
||||
* request, so the caller passes it as the trailing positional argument.
|
||||
* @param service - the mounted Remote Service.
|
||||
* @param typert - the registry the Gateway resolves against.
|
||||
* @param method - Remote method name.
|
||||
* @param wires - the method's JSON parameter wires, in order.
|
||||
* @param args - named arguments, the request included, plus the cancellation signal.
|
||||
* @returns the resolved resources, or `undefined` when they are invalid.
|
||||
*/
|
||||
function resourcesOf(
|
||||
service: JobController,
|
||||
typert: Typert,
|
||||
method: string,
|
||||
wires: readonly string[],
|
||||
args: Readonly<Record<string, unknown>>,
|
||||
): ReturnType<typeof callResources> {
|
||||
const readers = remoteMethods(service).find(candidate => candidate.exportName === method || candidate.method === method)?.resources
|
||||
return callResources(typert, readers, invocationOf(wires), args, NEVER)
|
||||
}
|
||||
|
||||
const NEVER = new AbortController().signal
|
||||
|
||||
describe('JobController Remote Session resources', () => {
|
||||
const SESSION = { kind: 'session' } as const
|
||||
|
||||
it('names the Session of the request on the roster, the follow stream, and a kill', async () => {
|
||||
// The production composition mounts the Session Controller beside this
|
||||
// Service, so its default `session` resolver — not a reader on these
|
||||
// methods — is the layer that names the resource. The assertions read the
|
||||
// resource the Gateway resolves against, so losing that resolver here
|
||||
// turns them global and fails them.
|
||||
const { ctx, session, controller } = await harness()
|
||||
installSessionResolver(ctx)
|
||||
const jobId = 'bash-1' as JobId
|
||||
const request = { sessionId: session.id, jobId }
|
||||
expect(resourcesOf(controller, ctx.typert, 'list', ['request'], { request: { sessionId: session.id }, signal: NEVER }))
|
||||
.toEqual([{ kind: SESSION.kind, id: session.id }])
|
||||
expect(resourcesOf(controller, ctx.typert, 'follow', ['request'], { request, signal: NEVER }))
|
||||
.toEqual([{ kind: SESSION.kind, id: session.id }])
|
||||
expect(resourcesOf(controller, ctx.typert, 'kill', ['request'], { request }))
|
||||
.toEqual([{ kind: SESSION.kind, id: session.id }])
|
||||
})
|
||||
|
||||
it('resolves those endpoints to the global resource without a resolver', async () => {
|
||||
// The counterpart above: the endpoints declare no reader of their own, so
|
||||
// omitting the Session Controller's resolver leaves every call global.
|
||||
const { ctx, session, controller } = await harness()
|
||||
const request = { sessionId: session.id, jobId: 'bash-1' as JobId }
|
||||
for (const [method, wires] of [['list', ['request']], ['follow', ['request']], ['kill', ['request']]] as const) {
|
||||
expect(resourcesOf(controller, ctx.typert, method, wires, method === 'kill' ? { request } : { request, signal: NEVER }))
|
||||
.toEqual([{ kind: 'global' }])
|
||||
}
|
||||
})
|
||||
|
||||
it('falls back to the global resource for a follow of an unowned job', async () => {
|
||||
// An unowned job is observer-visible to any caller, so its request names
|
||||
// no Session and the resolver has nothing to answer.
|
||||
const { ctx, controller } = await harness()
|
||||
installSessionResolver(ctx)
|
||||
const args = { request: { jobId: 'bash-1' as JobId }, signal: NEVER }
|
||||
expect(resourcesOf(controller, ctx.typert, 'follow', ['request'], args)).toEqual([{ kind: 'global' }])
|
||||
})
|
||||
})
|
||||
|
||||
describe('JobController.kill', () => {
|
||||
it('kills an owned running job without claiming the terminal report', async () => {
|
||||
const { ctx, session, agent, controller } = await harness()
|
||||
|
||||
@@ -13,7 +13,7 @@ import { canOpenNativePath, nativeFileManager, nativeFileApplications, openNativ
|
||||
import type { SessionId } from '@deepseek-ai/dsh-session'
|
||||
import type {} from '@deepseek-ai/dsh-session-projection-cache'
|
||||
import type { SessionObservation } from '@deepseek-ai/dsh-session-query'
|
||||
import { Remote, RemoteError, TypertRemoteService, principalOf, type TypertResourceResolveInput } from '@deepseek-ai/dsh-typert-protocol'
|
||||
import { Remote, RemoteError, TypertRemoteService, principalOf } from '@deepseek-ai/dsh-typert-protocol'
|
||||
import { canonicalClientTimeZone } from '@deepseek-ai/dsh-util-time'
|
||||
import { assertNever } from '@deepseek-ai/dsh-util-values'
|
||||
import type {} from '@deepseek-ai/dsh-api-remote-access'
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
type ApiSessionAgentResult,
|
||||
} from './agent.ts'
|
||||
import { SessionCommandController, hasPromptContent } from './commands.ts'
|
||||
import { resolveSessionResource } from './session-resource.ts'
|
||||
import { SessionControlController } from './control.ts'
|
||||
import { HistoryController } from './history/controller.ts'
|
||||
import { StateController } from './state/controller.ts'
|
||||
@@ -35,7 +36,6 @@ import { ArchivedSessionGate } from './archived-session-gate.ts'
|
||||
import type {
|
||||
ModelCatalog,
|
||||
SessionWorkspacePathApplication,
|
||||
SessionAddress,
|
||||
SessionAttachmentRequest,
|
||||
SessionAttachmentValue,
|
||||
SessionCancelRequest,
|
||||
@@ -79,34 +79,6 @@ declare module '@deepseek-ai/cordis' {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the Session resource from an ID or a history address.
|
||||
*
|
||||
* Registers as the `session` kind default, so it applies to every Remote method of
|
||||
* every namespace: a top-level `sessionId` parameter, otherwise the first object
|
||||
* parameter carrying `sessionId` or an `address`. A new request type whose first
|
||||
* object parameter has an unrelated `address` field would be read as an address.
|
||||
* @param input - validated wire arguments and their ordered parameter descriptions.
|
||||
* @returns the named Session identity, otherwise the first object's Session identity or history address.
|
||||
* @throws Error when the request object supplies both sessionId and address.
|
||||
*/
|
||||
function resolveSessionResource({ args, parameters }: TypertResourceResolveInput): SessionId | undefined {
|
||||
const sessionParameter = parameters.find(parameter => parameter.name === 'sessionId' || parameter.wire === 'sessionId')
|
||||
if (sessionParameter !== undefined) return args[sessionParameter.wire] as SessionId | undefined
|
||||
for (const parameter of parameters) {
|
||||
const value = args[parameter.wire]
|
||||
if (typeof value !== 'object' || value === null || Array.isArray(value)) continue
|
||||
const request = value as { readonly sessionId?: SessionId; readonly address?: SessionAddress }
|
||||
const address = request.address
|
||||
if (request.sessionId !== undefined && address !== undefined) {
|
||||
throw new Error('Session resource request must not contain both sessionId and address')
|
||||
}
|
||||
return request.sessionId ?? (address === undefined ? undefined
|
||||
: address.kind === 'session' ? address.sessionId : address.childSessionId)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
/** Session Controller deployment policy. */
|
||||
export interface Config {
|
||||
/** Override platform desktop-opener detection. */
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* The `session` resource kind's default identity extraction: the Session one
|
||||
* Remote call names, read from its validated wire arguments.
|
||||
* @module @deepseek-ai/dsh-api-session-controller/session-resource
|
||||
*/
|
||||
|
||||
import type { SessionId } from '@deepseek-ai/dsh-session'
|
||||
import type { TypertResourceResolveInput } from '@deepseek-ai/dsh-typert-protocol'
|
||||
import type { SessionAddress } from './types.ts'
|
||||
|
||||
/**
|
||||
* Extract the Session resource from an ID or a history address.
|
||||
*
|
||||
* Registers as the `session` kind default, so it applies to every Remote method of
|
||||
* every namespace: a top-level `sessionId` parameter, otherwise the first object
|
||||
* parameter carrying `sessionId` or an `address`. A new request type whose first
|
||||
* object parameter has an unrelated `address` field would be read as an address.
|
||||
* @param input - validated wire arguments and their ordered parameter descriptions.
|
||||
* @returns the named Session identity, otherwise the first object's Session identity or history address.
|
||||
* @throws Error when the request object supplies both sessionId and address.
|
||||
*/
|
||||
export function resolveSessionResource(input: TypertResourceResolveInput): SessionId | undefined {
|
||||
const { args, parameters } = input
|
||||
const sessionParameter = parameters.find(parameter => parameter.name === 'sessionId' || parameter.wire === 'sessionId')
|
||||
if (sessionParameter !== undefined) return args[sessionParameter.wire] as SessionId | undefined
|
||||
for (const parameter of parameters) {
|
||||
const value = args[parameter.wire]
|
||||
if (typeof value !== 'object' || value === null || Array.isArray(value)) continue
|
||||
const request = value as { readonly sessionId?: SessionId; readonly address?: SessionAddress }
|
||||
const address = request.address
|
||||
if (request.sessionId !== undefined && address !== undefined) {
|
||||
throw new Error('Session resource request must not contain both sessionId and address')
|
||||
}
|
||||
return request.sessionId ?? (address === undefined ? undefined
|
||||
: address.kind === 'session' ? address.sessionId : address.childSessionId)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
"src/index.ts",
|
||||
"src/types.ts",
|
||||
"src/remote-events.ts",
|
||||
"src/session-resource.ts",
|
||||
"src/agent.ts",
|
||||
"src/assistant-stream.ts",
|
||||
"src/catalog.ts",
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
en: 65bf2834b81f87da
|
||||
zh: c864ac60a3005b99
|
||||
/deepseek-ai-dsh-app-boot/use-this-package/profiles:
|
||||
en: 781fe487a973ee6f
|
||||
zh: e95188274f75f9ad
|
||||
en: ba1c456bf22d8fc0
|
||||
zh: 018bd12bd56912e4
|
||||
/deepseek-ai-dsh-app-boot/use-this-package/previewing-the-effective-configuration:
|
||||
en: 646a0ccdd7881ad1
|
||||
zh: e3696acb1573dd7b
|
||||
@@ -36,14 +36,14 @@
|
||||
en: 91d80c444ac0cfe5
|
||||
zh: e7db496043528ffb
|
||||
/deepseek-ai-dsh-app-boot/use-this-package/startup-and-reload-failures:
|
||||
en: dc13dfa1f79292e4
|
||||
zh: d51682ced7a18ac2
|
||||
en: 9b9e08c8638a975b
|
||||
zh: 8a3f906c4d98cb89
|
||||
/deepseek-ai-dsh-app-boot/understand-the-implementation:
|
||||
en: f4a2695cb4c8a570
|
||||
zh: 89837235d2f376cf
|
||||
/deepseek-ai-dsh-app-boot/understand-the-implementation/design-notes:
|
||||
en: 6eba01e24a2a68ab
|
||||
zh: 64af424489087ec7
|
||||
en: 2943e0f4e90f2dde
|
||||
zh: 1c752b58515153e5
|
||||
/deepseek-ai-dsh-app-boot/understand-the-implementation/helper-behavior:
|
||||
en: 6fa850d1bb000d0e
|
||||
zh: aa83a40a9d3db295
|
||||
|
||||
@@ -64,7 +64,7 @@ Your machine-local preferences also live in the Harness home:
|
||||
- **`.env`** — your ordinary environment layers: the invoking directory's file outranks the Harness-home file, and both sit below the inherited environment. Variables that decide how the process starts (`PATH`, `DSH_*`, `XDG_*` and similar) are rejected from files: export them instead. The four proxy names (`HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`, `NO_PROXY`) in any letter case and the DeepSeek endpoint names (`DEEPSEEK_BASE_URL`, `DEEPSEEK_SEARCH_BASE_URL`) in exactly that spelling are accepted from the Harness-home file only, never from the invoking directory's, which arrives with a clone. For a non-product bin that just wants one directory's `.env`, a missing file is fine and an unloadable one prints one labelled warning line.
|
||||
- **`cordis.patch.yml`** — your tweak layer, applied after every bundle layer (per-profile first, then the home-level file, which therefore outranks it): replace one entry's whole config (restating the fields you keep), insert new entries, or interpolate `!!js` expressions at boot. A patch naming an entry that does not exist prints a stderr warning; an empty or comments-only file fails boot — disable the layer with `[]` instead.
|
||||
|
||||
The enabled `dsh-hmr` plugin watches the profile manifest and both user patch files, re-reads the ordered bundle layers, and applies the [reload failure policy](#startup-and-reload-failures). [DSH HMR](../hmr/README.md) serializes these reloads with [Plugin Manager](../plugin-manager/README.md) configuration writes; package operations run outside its queue. The launcher does not install HMR or watchers; disabled or absent HMR means changes require restart.
|
||||
The enabled `dsh-hmr` plugin watches the profile manifest, both user patch files, and every `--patch` overlay file, re-reads the ordered bundle layers, and applies the [reload failure policy](#startup-and-reload-failures). [DSH HMR](../hmr/README.md) serializes these reloads with [Plugin Manager](../plugin-manager/README.md) configuration writes; package operations run outside its queue. The launcher does not install HMR or watchers; disabled or absent HMR means changes require restart, except that a Config Editor save applies the current contents of every patch and overlay file.
|
||||
|
||||
Inserted plugin names may be absolute filesystem paths, file URLs, or package specifiers. Patch loading converts absolute paths and patch-relative `./` or `../` paths to file URLs within `insert` rows and their nested groups; existing-entry name assertions and replacement `config` values remain literal.
|
||||
|
||||
@@ -101,7 +101,7 @@ After the Loader settles, app-boot warns when only optional entries are inactive
|
||||
|
||||
| Failure pattern | Optional entry at startup | Required entry at startup | Later configuration HMR |
|
||||
|---|---|---|---|
|
||||
| Root config or required overlay is missing, unreadable, malformed, or contains invalid entries | Stop startup | Stop startup | Malformed or invalid live patches are rejected without changing the running configuration; a valid edit applies |
|
||||
| Root config or required overlay is missing, unreadable, malformed, or contains invalid entries | Stop startup | Stop startup | Missing, malformed, or invalid live patches and overlays are rejected without changing the running configuration; a valid edit applies |
|
||||
| Module import fails or module evaluation throws | Warn; continue | Stop startup | Report the error; keep successful siblings; a corrected import can activate |
|
||||
| Plugin config schema validation fails | Warn; continue | Stop startup | A new entry stays inactive; an existing entry retains its prior instance and config; a valid correction applies |
|
||||
| Config `!!js` evaluation throws | Warn; continue | Stop startup | Report the error; keep successful siblings; a valid correction can activate |
|
||||
@@ -133,7 +133,7 @@ This section explains how the outcomes above are realized and points at the code
|
||||
### Design notes
|
||||
|
||||
- **Runtime version.** `getDshRuntimeVersion()` reads this package's manifest through a filesystem path, including the executable's virtual filesystem; missing or invalid versions fail rather than bypassing compatibility checks.
|
||||
- **Profile launch data.** `ctx.profileContext` contains only profile locations, startup bundle names, parsed invocation overlays and the telemetry opt-out value. `readProfilePatches()` composes the supplied startup profile or reads current files at those locations; callers schedule and apply the result.
|
||||
- **Profile launch data.** `ctx.profileContext` contains only profile locations, startup bundle names, absolute invocation overlay paths and the telemetry opt-out value. `readProfilePatches()` composes the supplied startup profile or reads current files at those locations, and always rereads the overlay files; callers schedule and apply the result. Plugin Manager listings and Config Editor writes call it with or without HMR, so they see current overlay contents and fail while an overlay file is missing or invalid.
|
||||
- **Process-local module resolution.** The launcher installs the runtime resolution on Node's internal ESM and CommonJS resolvers before profile rows mount. Node still owns exports, conditions, subpaths, module caches, and error codes; routed ESM failures report the original importer. Explicit CommonJS `paths` always retain native lookup, including paths inside profiles.
|
||||
- **Linked directories.** A profile link to an external directory admits its importers to peer-aware ancestor lookup, even without its own `package.json`. At each `D/node_modules` position, current `D/package.json` peer names present in the runtime table use the runtime package; other names use the physical candidate. A nearer physical package precedes a later peer declaration, and a peer position needs no physical `node_modules`. Installation-scope package directories are excluded from linked interception; overlapping roots do not change the importer's lookup order ([rule](../../../.agents/notes/implemented/architecture/2026-09-19-profile-resolution-lookup-order.md)).
|
||||
- **Package metadata.** `ctx.pluginPackages.packageOf` locates the owning package without loading code or requiring an exported `package.json`; a subpath selects its package without validating that file. The installed runtime resolution owns selection even for a miss. Low-level embedders that install the service without one retain native lookup. Display metadata uses the separate entry-aware reader described above.
|
||||
|
||||
@@ -64,7 +64,7 @@ profile 导入插件前,DSH 会将其声明的 DSH 版本要求与 `getDshRunt
|
||||
- **`.env`**——你的普通环境层:调用目录的文件优先于 harness home 的文件,两者都低于继承环境。在文件中设置的进程启动变量(如 `PATH`、`DSH_*`、`XDG_*`)会被拒绝:请改为导出这些变量。四个代理名(`HTTP_PROXY`、`HTTPS_PROXY`、`ALL_PROXY`、`NO_PROXY`,大小写不限)和 DeepSeek 端点变量名(`DEEPSEEK_BASE_URL`、`DEEPSEEK_SEARCH_BASE_URL`,须按此拼写)只从 harness home 的文件接受,绝不从调用目录的文件接受——后者随 clone 一起到来。对于只想加载某个目录 `.env` 的非产品 bin,文件缺失不影响启动,文件无法加载时输出一行带标签的警告。
|
||||
- **`cordis.patch.yml`**——你的 tweak 层,应用在所有组合包层之后(先应用逐 profile 的文件,再应用 home 级文件,因此后者优先级更高):替换某个条目的整个配置(重述你要保留的字段)、插入新条目,或在启动时插值 `!!js` 表达式。patch 指定的条目不存在时输出 stderr 警告;空文件或仅含注释的文件会导致启动失败——如需禁用该层,请改用 `[]`。
|
||||
|
||||
启用的 `dsh-hmr` 插件会监视 profile manifest 与两份用户 patch 文件,重新读取按顺序排列的组合包层,并应用[重载失败策略](#startup-and-reload-failures)。[DSH HMR](../hmr/README.zh.md) 将这些重载与[插件管理器](../plugin-manager/README.zh.md)的配置写入串行化;包操作在其队列之外执行。启动器不安装 HMR 或监视器;HMR 被禁用或不存在时,更改需要重启。
|
||||
启用的 `dsh-hmr` 插件会监视 profile manifest、两份用户 patch 文件与每个 `--patch` overlay 文件,重新读取按顺序排列的组合包层,并应用[重载失败策略](#startup-and-reload-failures)。[DSH HMR](../hmr/README.zh.md) 将这些重载与[插件管理器](../plugin-manager/README.zh.md)的配置写入串行化;包操作在其队列之外执行。启动器不安装 HMR 或监视器;HMR 被禁用或不存在时,更改需要重启;例外是 Config Editor 保存时会应用所有 patch 与 overlay 文件的当前内容。
|
||||
|
||||
插入条目的插件名可以是绝对文件系统路径、文件 URL 或包标识符。patch 加载会把 `insert` 条目及其嵌套分组中的绝对路径以及相对于 patch 文件的 `./` 或 `../` 路径转换为文件 URL;对已有条目名称的断言及替换用的 `config` 值保持原样。
|
||||
|
||||
@@ -101,7 +101,7 @@ Loader 结算后,app-boot 在仅 optional 条目未激活时输出警告。如
|
||||
|
||||
| 失败模式 | Optional 条目启动时 | Required 条目启动时 | 后续配置 HMR |
|
||||
|---|---|---|---|
|
||||
| 根配置或必需 overlay 缺失、不可读、格式错误,或包含无效条目 | 终止启动 | 终止启动 | 拒绝格式错误或无效的实时 patch,不改变运行中的配置;有效修改可以应用 |
|
||||
| 根配置或必需 overlay 缺失、不可读、格式错误,或包含无效条目 | 终止启动 | 终止启动 | 拒绝缺失、格式错误或无效的实时 patch 与 overlay,不改变运行中的配置;有效修改可以应用 |
|
||||
| 模块 import 失败或模块求值抛出异常 | 警告;继续 | 终止启动 | 报告错误;保留成功的兄弟插件;修正 import 后可以激活 |
|
||||
| 插件配置 schema 校验失败 | 警告;继续 | 终止启动 | 新条目保持未激活;现有条目保留原实例与配置;有效修正可以应用 |
|
||||
| 配置 `!!js` 求值抛出异常 | 警告;继续 | 终止启动 | 报告错误;保留成功的兄弟插件;有效修正后可以激活 |
|
||||
@@ -133,7 +133,7 @@ Loader 结算后,app-boot 在仅 optional 条目未激活时输出警告。如
|
||||
### 设计说明
|
||||
|
||||
- **运行时版本。** `getDshRuntimeVersion()` 通过文件系统路径读取本包清单,也支持可执行文件内的虚拟文件系统;版本缺失或无效时会失败,而不会绕过兼容性检查。
|
||||
- **Profile 启动数据。** `ctx.profileContext` 只包含 profile 位置、启动时组合包名称、已解析的调用级 overlay 与遥测退出值。`readProfilePatches()` 组合传入的启动 profile,或读取这些位置上的当前文件;调用方负责调度和应用结果。
|
||||
- **Profile 启动数据。** `ctx.profileContext` 只包含 profile 位置、启动时组合包名称、调用级 overlay 的绝对路径与遥测退出值。`readProfilePatches()` 组合传入的启动 profile,或读取这些位置上的当前文件,并且总是重新读取 overlay 文件;调用方负责调度和应用结果。插件管理器的列表与 Config Editor 的写入无论是否启用 HMR 都调用它,因此会读到当前 overlay 内容,并在 overlay 文件缺失或无效时失败。
|
||||
- **进程内模块解析。** launcher 在挂载 profile 条目前,将 runtime resolution 安装到 Node 的 ESM 与 CommonJS 内部 resolver。exports、conditions、子路径、模块缓存和错误码仍由 Node 负责;路由后的 ESM 失败报告原始 importer。显式 CommonJS `paths` 始终保留原生查询,包括指向 profile 内的路径。
|
||||
- **链接目录。** profile 链接到树外目录时,其下的 importer 参与逐层 peer 查询,即使目标没有自身的 `package.json`。在每个 `D/node_modules` 位置,当前 `D/package.json` 的 peer 包名若存在于运行时表,就使用运行时包;其他包名查询物理候选。更近的物理包先于后续 peer 声明,peer 位置无需物理 `node_modules`。installation 作用域包目录不参与 linked 拦截,重叠 root 不改变 importer 的查询顺序([规则](../../../.agents/notes/implemented/architecture/2026-09-19-profile-resolution-lookup-order.zh.md))。
|
||||
- **包元数据。** `ctx.pluginPackages.packageOf` 定位所属包,不加载代码,也不要求导出 `package.json`;子路径选择其所属包,不校验该文件。安装 runtime resolution 后,即使查询未命中也以其选包规则为准。仅安装服务而不提供 runtime resolution 的底层嵌入方保留原生查询。展示元数据使用上文另述的入口感知读取器。
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** Launcher-owned profile locations and composition inputs. */
|
||||
import { join } from 'node:path'
|
||||
import { composeEntries, loadProfileDirectory, PROFILE_PATCH_FILENAME, type Profile } from './profile.ts'
|
||||
import { loadOptionalPatches } from './index.ts'
|
||||
import { loadOptionalPatches, loadOverlayPatches } from './index.ts'
|
||||
import type { PatchOptions } from '@deepseek-ai/cordis-plugin-include'
|
||||
|
||||
/** Application-owned package manager executable; environment applies only to package operations. */
|
||||
@@ -23,8 +23,8 @@ export interface ProfileContext {
|
||||
readonly home: string
|
||||
/** Bundle packages used to start this process, before any persisted edits. */
|
||||
readonly startedBundles: readonly string[]
|
||||
/** Parsed command-line overlays, applied above profile and home patches. */
|
||||
readonly overlays: readonly PatchOptions[]
|
||||
/** Absolute command-line overlay files in argv order, read on every composition and applied above profile and home patches. */
|
||||
readonly overlayPaths: readonly string[]
|
||||
/** Launch-time DSH_TELEMETRY_DISABLED value; any non-empty value opts out. */
|
||||
readonly telemetryDisabledEnv: string | undefined
|
||||
}
|
||||
@@ -65,18 +65,19 @@ export function readBundlePatches(binName: string, context: ProfileContext, init
|
||||
return profile.layers.flatMap(layer => layer.patches)
|
||||
}
|
||||
|
||||
/** Read current bundle and user layers with the launch-time overlays.
|
||||
/** Read current bundle, user, and command-line overlay layers.
|
||||
* @param binName Diagnostic prefix for malformed or missing configuration.
|
||||
* @param context Data supplied by the profile launcher.
|
||||
* @param initialProfile Already loaded startup profile; omitted reads the current files.
|
||||
* @returns Detached ordered patches; this function does not update the Loader.
|
||||
* @throws When a present patch file or any overlay file is missing, unreadable, or not a patch list.
|
||||
*/
|
||||
export function readProfilePatches(binName: string, context: ProfileContext, initialProfile?: Profile): PatchOptions[] {
|
||||
const patches = structuredClone([
|
||||
...readBundlePatches(binName, context, initialProfile),
|
||||
...(initialProfile?.patches ?? loadOptionalPatches(binName, context.patchPath) ?? []),
|
||||
...(loadOptionalPatches(binName, join(context.home, PROFILE_PATCH_FILENAME)) ?? []),
|
||||
...context.overlays,
|
||||
...context.overlayPaths.flatMap(path => loadOverlayPatches(binName, path)),
|
||||
])
|
||||
const telemetryPatch = resolveTelemetryPatch(context.telemetryDisabledEnv,
|
||||
composeEntries([patches]).some(row => row.id === TELEMETRY_ROW_ID))
|
||||
|
||||
@@ -51,7 +51,7 @@ export function apply() { record('apply:${name}') }
|
||||
const profile: ProfileContext = {
|
||||
name: 'preflight', dir, patchPath: join(dir, 'cordis.patch.yml'),
|
||||
installAnchor: join(dir, 'package.json'), cwd: dir, home: dir,
|
||||
startedBundles: [], overlays: [], telemetryDisabledEnv: undefined,
|
||||
startedBundles: [], overlayPaths: [], telemetryDisabledEnv: undefined,
|
||||
}
|
||||
const configPath = join(dir, 'cordis.yml')
|
||||
writeFileSync(configPath, '[]\n')
|
||||
|
||||
@@ -198,7 +198,7 @@ describe('resolveProfileDir', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('composes current files from profile data and retains launch overlay and telemetry precedence', () => {
|
||||
it('composes current profile, home, and overlay files with telemetry precedence', () => {
|
||||
const home = tmp()
|
||||
const installAnchor = stageInstallation({ base: { patch: '- insert:\n - id: session-telemetry-otel\n name: telemetry\n' } })
|
||||
const dir = resolveProfileDir('test', home)
|
||||
@@ -206,23 +206,26 @@ it('composes current files from profile data and retains launch overlay and tele
|
||||
const patchPath = join(dir, 'application.patch.yml')
|
||||
writeFileSync(patchPath, '- id: session-telemetry-otel\n disabled: true\n')
|
||||
writeFileSync(join(home, PROFILE_PATCH_FILENAME), '- id: session-telemetry-otel\n disabled: false\n')
|
||||
const overlayPath = join(home, 'overlay.yml')
|
||||
writeFileSync(overlayPath, '- id: session-telemetry-otel\n disabled: false\n')
|
||||
const context = {
|
||||
name: 'test', dir, patchPath, installAnchor, home, cwd: home,
|
||||
startedBundles: ['base'],
|
||||
overlays: [{ id: 'session-telemetry-otel', disabled: false }], telemetryDisabledEnv: 'false',
|
||||
overlayPaths: [overlayPath], telemetryDisabledEnv: 'false',
|
||||
}
|
||||
expect(composeEntries([readProfilePatches('test', context)])[0]?.disabled).toBe(true)
|
||||
const enabled = { ...context, telemetryDisabledEnv: undefined }
|
||||
expect(composeEntries([readProfilePatches('test', enabled)])[0]?.disabled).toBe(false)
|
||||
const patches = readProfilePatches('test', enabled)
|
||||
patches.at(-1)!.disabled = true
|
||||
expect(context.overlays[0]?.disabled).toBe(false)
|
||||
writeFileSync(overlayPath, '- id: session-telemetry-otel\n disabled: true\n')
|
||||
expect(composeEntries([readProfilePatches('test', enabled)])[0]?.disabled).toBe(true)
|
||||
rmSync(overlayPath)
|
||||
expect(() => readProfilePatches('test', enabled)).toThrow(`failed to read overlay ${overlayPath}`)
|
||||
writeFileSync(join(home, PROFILE_PATCH_FILENAME), '- id: session-telemetry-otel\n disabled: true\n')
|
||||
expect(composeEntries([readProfilePatches('test', { ...enabled, overlays: [] })])[0]?.disabled).toBe(true)
|
||||
expect(composeEntries([readProfilePatches('test', { ...enabled, overlayPaths: [] })])[0]?.disabled).toBe(true)
|
||||
writeFileSync(join(home, PROFILE_PATCH_FILENAME), '[]\n')
|
||||
expect(composeEntries([readProfilePatches('test', { ...enabled, overlays: [] })])[0]?.disabled).toBe(true)
|
||||
expect(composeEntries([readProfilePatches('test', { ...enabled, overlayPaths: [] })])[0]?.disabled).toBe(true)
|
||||
writeFileSync(patchPath, '- id: session-telemetry-otel\n disabled: false\n')
|
||||
expect(composeEntries([readProfilePatches('test', { ...enabled, overlays: [] })])[0]?.disabled).toBe(false)
|
||||
expect(composeEntries([readProfilePatches('test', { ...enabled, overlayPaths: [] })])[0]?.disabled).toBe(false)
|
||||
})
|
||||
|
||||
describe('initProfile', () => {
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
en: 11ef18c6d08f39f3
|
||||
zh: 2911cdd03ff3747d
|
||||
/deepseek-ai-dsh-hmr/understand-the-implementation:
|
||||
en: bd608f418630317f
|
||||
zh: 053fa77a3fa571a9
|
||||
en: a1eede170f8754f0
|
||||
zh: dd2bfef9ad06ee3b
|
||||
/deepseek-ai-dsh-hmr/model-experience:
|
||||
en: 215e7ba838619b7b
|
||||
zh: a311da3843709f90
|
||||
|
||||
@@ -56,9 +56,9 @@ Profile recompositions run by HMR's profile watches and by Plugin Manager also r
|
||||
<details>
|
||||
<summary>Implementation internals — click to expand</summary>
|
||||
|
||||
`watchConfig()` registers an awaited configuration handler and watches only its target path and required parent directories; sibling files, including temporary writer locks, are excluded before native watcher creation. `runExclusive()` serializes configuration changes and Loader updates with automatic reloads and rejects nested transactions. Package installation and removal run outside this queue. HMR does not acquire the package writer lock; manifest notifications reload only when the ordered `dsh.profile.bundles` list changes. Profile and home patch changes also trigger recomposition. File events received during a configuration transaction are processed afterward. Include refreshes and profile reconciliation reach plugins through ordinary Loader entry updates; Loader commits volatile-only changes in place.
|
||||
`watchConfig()` registers an awaited configuration handler and watches only its target path and required parent directories; sibling files, including temporary writer locks, are excluded before native watcher creation. `runExclusive()` serializes configuration changes and Loader updates with automatic reloads and rejects nested transactions. Package installation and removal run outside this queue. HMR does not acquire the package writer lock; manifest notifications reload only when the ordered `dsh.profile.bundles` list changes. Profile, home, and `--patch` overlay file changes also trigger recomposition. File events received during a configuration transaction are processed afterward. Include refreshes and profile reconciliation reach plugins through ordinary Loader entry updates; Loader commits volatile-only changes in place.
|
||||
|
||||
App-boot owns profile parsing and patch precedence. HMR reads the launcher’s data-only `profileContext`, registers the profile manifest and both user patch watches during initialization, and waits for application readiness before processing changes. Its disposal closes the watchers and cancels reloads waiting for startup. Configuration watchers start outside the active transaction context so later notifications can enter the queue.
|
||||
App-boot owns profile parsing and patch precedence. HMR reads the launcher’s data-only `profileContext`, registers watches for the profile manifest, both user patches, and each `--patch` overlay during initialization, watching a file named under several spellings once, and waits for application readiness before processing changes. Its disposal closes the watchers and cancels reloads waiting for startup. Configuration watchers start outside the active transaction context so later notifications can enter the queue.
|
||||
|
||||
`reconcileProfile()` is shared by HMR’s profile watches and Plugin Manager; callers hold `runExclusive()`. Config Editor recomposes through app-boot without replacing modules. App-boot prepares and preflights the generation before caches or running entries change.
|
||||
|
||||
|
||||
@@ -56,9 +56,9 @@ HMR 的 profile 监听和 Plugin Manager 执行的 profile 重新组合,还会
|
||||
<details>
|
||||
<summary>实现细节——点击展开</summary>
|
||||
|
||||
`watchConfig()` 注册会被等待的配置处理器,仅监听目标路径及必要的父目录;同级文件(包括临时写锁)在创建原生 watcher 前即被排除。`runExclusive()` 将配置变更、Loader 更新与自动重载串行化,并拒绝嵌套事务。包安装和删除在该队列之外执行。HMR 不获取包操作写锁;manifest 通知仅在有序的 `dsh.profile.bundles` 列表变化时触发重载。profile 与 home patch 变化也会触发重新组合。配置事务期间收到的文件事件在事务结束后处理。 Include 刷新和 profile 重载都通过普通的 Loader 条目更新到达插件;仅 volatile 变化由 Loader 就地提交。
|
||||
`watchConfig()` 注册会被等待的配置处理器,仅监听目标路径及必要的父目录;同级文件(包括临时写锁)在创建原生 watcher 前即被排除。`runExclusive()` 将配置变更、Loader 更新与自动重载串行化,并拒绝嵌套事务。包安装和删除在该队列之外执行。HMR 不获取包操作写锁;manifest 通知仅在有序的 `dsh.profile.bundles` 列表变化时触发重载。profile、home 与 `--patch` overlay 文件的变化也会触发重新组合。配置事务期间收到的文件事件在事务结束后处理。 Include 刷新和 profile 重载都通过普通的 Loader 条目更新到达插件;仅 volatile 变化由 Loader 就地提交。
|
||||
|
||||
App-boot 负责 profile 解析和 patch 优先级规则。HMR 读取启动器提供的纯数据 `profileContext`,在初始化时注册 profile manifest 和两份用户 patch 的监听,并等待应用就绪后处理更改。销毁 HMR 时会关闭监听器并取消等待启动的重载。配置监听器在当前事务上下文之外启动,使后续通知可以进入队列。
|
||||
App-boot 负责 profile 解析和 patch 优先级规则。HMR 读取启动器提供的纯数据 `profileContext`,在初始化时注册 profile manifest、两份用户 patch 与每个 `--patch` overlay 的监听,以不同写法指向同一文件的路径只监听一次,并等待应用就绪后处理更改。销毁 HMR 时会关闭监听器并取消等待启动的重载。配置监听器在当前事务上下文之外启动,使后续通知可以进入队列。
|
||||
|
||||
`reconcileProfile()` 由 HMR 的 profile 监听和 Plugin Manager 共用;调用方持有 `runExclusive()`。Config Editor 通过 app-boot 重新组合,不替换模块。app-boot 在缓存或运行中条目发生变化前准备新一代组合并执行预检。
|
||||
|
||||
|
||||
@@ -382,7 +382,14 @@ class Hmr extends Service {
|
||||
})
|
||||
yield () => { unsubscribe(); started.resolve(false); return Promise.resolve() }
|
||||
const manifestPath = join(profile.dir, 'package.json')
|
||||
const patchFiles = [profile.patchPath, join(profile.home, PROFILE_PATCH_FILENAME)]
|
||||
// A file named by several layers or repeated `--patch` options, under any spelling, is watched and compared once.
|
||||
const canonicalFiles = new Set<string>()
|
||||
const patchFiles = [profile.patchPath, join(profile.home, PROFILE_PATCH_FILENAME), ...profile.overlayPaths].filter((filename) => {
|
||||
const canonical = canonicalPath(filename)
|
||||
if (canonicalFiles.has(canonical)) return false
|
||||
canonicalFiles.add(canonical)
|
||||
return true
|
||||
})
|
||||
let lastInputs: string | undefined
|
||||
let lastBundles = JSON.stringify(profile.startedBundles)
|
||||
const refresh = async (manifestOnly: boolean): Promise<void> => {
|
||||
|
||||
@@ -129,7 +129,7 @@ async function fixture(bundles = ['addon', 'other'], before?: (home: string, dir
|
||||
await before?.(home, dir)
|
||||
const profile: ProfileContext = {
|
||||
name: 'test', dir, patchPath: join(dir, 'cordis.patch.yml'), home, cwd: home,
|
||||
installAnchor: join(home, 'package.json'), startedBundles: bundles, overlays: [], telemetryDisabledEnv: undefined,
|
||||
installAnchor: join(home, 'package.json'), startedBundles: bundles, overlayPaths: [], telemetryDisabledEnv: undefined,
|
||||
}
|
||||
writeFileSync(profile.patchPath, JSON.stringify([{ insert: [
|
||||
{ id: 'timer', name: 'cordis:timer' },
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** Profile watches share HMR's queue and readiness barrier without waiting for package installation. */
|
||||
import { mkdtempSync, mkdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs'
|
||||
import { mkdtempSync, mkdirSync, readFileSync, realpathSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { pathToFileURL } from 'node:url'
|
||||
@@ -23,14 +23,32 @@ vi.mock('chokidar', async (original) => {
|
||||
} }
|
||||
})
|
||||
|
||||
async function fixture(beforeWatch?: (profile: ProfileContext) => void) {
|
||||
/** An overlay file's content, or the empty home patch named directly or through a linked directory. */
|
||||
type Overlay = string | { home: 'path' | 'link' }
|
||||
|
||||
/** Write each overlay beside the home patch. */
|
||||
async function fixture(beforeWatch?: (profile: ProfileContext) => void, overlays: readonly Overlay[] = []) {
|
||||
const home = realpathSync(mkdtempSync(join(tmpdir(), 'hmr-profile-')))
|
||||
const dir = join(home, 'profiles', 'test')
|
||||
initProfile(dir, [])
|
||||
writeFileSync(join(dir, 'cordis.yml'), '[]\n')
|
||||
const homePatch = join(home, 'cordis.patch.yml')
|
||||
const overlayPaths = overlays.map((overlay, index) => {
|
||||
if (typeof overlay === 'string') {
|
||||
const path = join(home, `overlay-${index}.yml`)
|
||||
writeFileSync(path, overlay)
|
||||
return path
|
||||
}
|
||||
writeFileSync(homePatch, '[]\n')
|
||||
if (overlay.home === 'path') return homePatch
|
||||
// A directory junction aliases the home patch on every platform without file-symlink privileges.
|
||||
const alias = join(home, `alias-${index}`)
|
||||
symlinkSync(home, alias, 'junction')
|
||||
return join(alias, 'cordis.patch.yml')
|
||||
})
|
||||
const profile: ProfileContext = {
|
||||
name: 'test', dir, patchPath: join(dir, 'cordis.patch.yml'), home, cwd: home,
|
||||
installAnchor: join(home, 'package.json'), startedBundles: [], overlays: [], telemetryDisabledEnv: undefined,
|
||||
installAnchor: join(home, 'package.json'), startedBundles: [], overlayPaths, telemetryDisabledEnv: undefined,
|
||||
}
|
||||
const rows = [{ insert: [
|
||||
{ id: 'timer', name: 'cordis:timer' },
|
||||
@@ -49,7 +67,8 @@ async function fixture(beforeWatch?: (profile: ProfileContext) => void) {
|
||||
host.loader.builtins.probe = { apply(ctx: Context, config: { value: string }) { ctx.provide('profileProbe', config.value) } }
|
||||
})
|
||||
onTestFinished(async () => { await ctx.fiber.dispose(); rmSync(home, { recursive: true, force: true }) })
|
||||
const configWatches = watchers.slice(start, start + 3)
|
||||
// Profile, home, and overlay patch watches precede the manifest watch.
|
||||
const configWatches = watchers.slice(start, start + 3 + overlayPaths.length)
|
||||
const emit = (index: number, filename: string) => { configWatches[index]!.emit('change', filename) }
|
||||
const drain = () => ctx.hmr.runExclusive(async () => {})
|
||||
return { ctx, profile, dir, home, emit, drain, commit: () => commit?.() }
|
||||
@@ -205,3 +224,50 @@ it('applies a patch edited after boot parsing but before watcher registration',
|
||||
await f.drain()
|
||||
expect(f.ctx.get('profileProbe')).toBe('edited-during-boot')
|
||||
})
|
||||
|
||||
it('applies edited --patch overlays above profile and home patches in argv order', async () => {
|
||||
const f = await fixture(undefined, ['- id: probe\n config: { value: first }\n', '[]\n'])
|
||||
f.commit()
|
||||
expect(f.ctx.get('profileProbe')).toBe('first')
|
||||
const [first, second] = f.profile.overlayPaths
|
||||
writeFileSync(second!, '- id: probe\n config: { value: second }\n')
|
||||
f.emit(3, second!)
|
||||
await f.drain()
|
||||
expect(f.ctx.get('profileProbe')).toBe('second')
|
||||
writeFileSync(join(f.home, 'cordis.patch.yml'), '- id: probe\n config: { value: home }\n')
|
||||
writeFileSync(second!, '[]\n')
|
||||
f.emit(1, join(f.home, 'cordis.patch.yml'))
|
||||
await f.drain()
|
||||
expect(f.ctx.get('profileProbe')).toBe('first')
|
||||
writeFileSync(first!, '[]\n')
|
||||
f.emit(2, first!)
|
||||
await f.drain()
|
||||
expect(f.ctx.get('profileProbe')).toBe('home')
|
||||
})
|
||||
|
||||
it('keeps the running configuration when an overlay file disappears and recovers when it returns', async () => {
|
||||
const f = await fixture(undefined, ['- id: probe\n config: { value: overlay }\n'])
|
||||
f.commit()
|
||||
const warn = vi.spyOn(f.ctx.logger, 'warn').mockImplementation(() => {})
|
||||
onTestFinished(() => { warn.mockRestore() })
|
||||
const [overlay] = f.profile.overlayPaths
|
||||
rmSync(overlay!)
|
||||
f.emit(2, overlay!)
|
||||
await f.drain()
|
||||
expect(warn.mock.calls.some(([reason]) => reason instanceof Error && reason.message.includes(`failed to read overlay ${overlay}`))).toBe(true)
|
||||
expect(f.ctx.get('profileProbe')).toBe('overlay')
|
||||
writeFileSync(overlay!, '- id: probe\n config: { value: restored }\n')
|
||||
f.emit(2, overlay!)
|
||||
await f.drain()
|
||||
expect(f.ctx.get('profileProbe')).toBe('restored')
|
||||
})
|
||||
|
||||
it('watches a home patch also named by repeated or linked-directory overlays once', async () => {
|
||||
const f = await fixture(undefined, [{ home: 'path' }, { home: 'path' }, { home: 'link' }])
|
||||
f.commit()
|
||||
const homePatch = join(f.home, 'cordis.patch.yml')
|
||||
writeFileSync(homePatch, '- id: probe\n config: { value: home }\n')
|
||||
f.emit(1, homePatch)
|
||||
await f.drain()
|
||||
expect(f.ctx.get('profileProbe')).toBe('home')
|
||||
})
|
||||
@@ -63,7 +63,7 @@ async function fixture(config: Config = {}) {
|
||||
writeFileSync(join(dir, 'cordis.yml'), '[]\n')
|
||||
const profile: ProfileContext = {
|
||||
name: 'test', startedBundles: loadProfileDirectory('test', dir, join(home, 'package.json')).layers.map(layer => layer.packageName),
|
||||
dir, patchPath: join(dir, 'cordis.patch.yml'), installAnchor: join(home, 'package.json'), cwd: home, home, overlays: [], telemetryDisabledEnv: undefined,
|
||||
dir, patchPath: join(dir, 'cordis.patch.yml'), installAnchor: join(home, 'package.json'), cwd: home, home, overlayPaths: [], telemetryDisabledEnv: undefined,
|
||||
}
|
||||
const ctx = await boot('test', join(dir, 'cordis.yml'), readProfilePatches('test', profile), (root) => {
|
||||
owner = root
|
||||
|
||||
@@ -63,13 +63,14 @@ async function fixture(reload: 'live' | 'startup' = 'live', overlay = false, pre
|
||||
writeFileSync(join(dir, 'package.json'), JSON.stringify(manifest))
|
||||
writeFileSync(join(dir, 'cordis.yml'), '[]\n')
|
||||
prepareFiles?.(dir)
|
||||
const overlays: PatchOptions[] = overlay ? [{ id: 'managed', disabled: true }] : []
|
||||
const overlayPath = join(home, 'overlay.patch.yml')
|
||||
writeFileSync(overlayPath, JSON.stringify(overlay ? [{ id: 'managed', disabled: true }] : []))
|
||||
const profile: ProfileContext = {
|
||||
name: 'test',
|
||||
...(packageManager === undefined ? {} : { packageManager }),
|
||||
startedBundles: loadProfileDirectory('test', dir, anchor).layers.map(layer => layer.packageName),
|
||||
dir, patchPath: join(dir, 'cordis.patch.yml'), installAnchor: anchor, cwd: home, home,
|
||||
overlays, telemetryDisabledEnv: undefined,
|
||||
overlayPaths: [overlayPath], telemetryDisabledEnv: undefined,
|
||||
}
|
||||
const ctx = await boot('test', join(dir, 'cordis.yml'), readProfilePatches('test', profile), (ctx) => {
|
||||
owner = ctx
|
||||
@@ -90,7 +91,7 @@ async function fixture(reload: 'live' | 'startup' = 'live', overlay = false, pre
|
||||
stopHmr = () => owner.dispose()
|
||||
await ctx.hmr.runExclusive(async () => {})
|
||||
}
|
||||
return { ctx, dir, manager: ctx.pluginManager, bundle, profile, stopHmr, overlays, connection, gitConnection }
|
||||
return { ctx, dir, manager: ctx.pluginManager, bundle, profile, stopHmr, overlayPath, connection, gitConnection }
|
||||
}
|
||||
|
||||
it.each(['live', 'startup'] as const)('refuses an unsupported bundle before saving or applying it with %s reload', async (reload) => {
|
||||
@@ -736,6 +737,15 @@ it('reports an overlay overriding a saved plugin toggle', async () => {
|
||||
expect(await manager.setPluginEnabled(id, true)).toMatchObject({ changed: false, application: 'overridden' })
|
||||
})
|
||||
|
||||
it('lists plugins from current overlay files in a startup-only profile', async () => {
|
||||
const { manager, overlayPath } = await fixture('startup')
|
||||
const id = (await manager.listPlugins()).find(row => row.patchId === 'managed')!.entryId
|
||||
rmSync(overlayPath)
|
||||
await expect(manager.listPlugins()).rejects.toThrow(`failed to read overlay ${overlayPath}`)
|
||||
writeFileSync(overlayPath, '[]\n')
|
||||
expect((await manager.listPlugins()).some(row => row.entryId === id)).toBe(true)
|
||||
})
|
||||
|
||||
it('saves startup-only toggles and refuses removal of currently used packages', async () => {
|
||||
const { manager } = await fixture('startup')
|
||||
const id = (await manager.listPlugins()).find(row => row.patchId === 'managed')!.entryId
|
||||
@@ -1463,9 +1473,10 @@ it('omits installation-owned plain packages from the bundle inventory', async ()
|
||||
})
|
||||
|
||||
it('does not delete a bundle retained by a higher-priority overlay', async () => {
|
||||
const { ctx, manager, overlays, dir } = await fixture()
|
||||
const { ctx, manager, overlayPath, dir } = await fixture()
|
||||
const entry = [...ctx.loader.entries()].find(row => row.id === 'include:managed')!
|
||||
overlays.push({ insert: [{ ...entry.options }] })
|
||||
const retained: PatchOptions[] = [{ insert: [{ ...entry.options }] }]
|
||||
writeFileSync(overlayPath, JSON.stringify(retained))
|
||||
const remove = vi.spyOn(operations, 'runProfilePnpm')
|
||||
onTestFinished(() => { remove.mockRestore() })
|
||||
expect(await manager.removeBundle('extra')).toMatchObject({ changed: true, application: 'failed', error: { code: 'bundle-in-use' } })
|
||||
|
||||
@@ -123,7 +123,7 @@ export function apply(ctx) {
|
||||
const loaded = loadProfileDirectory('test', dir, installAnchor)
|
||||
const profile: ProfileContext = {
|
||||
name: 'test', dir, patchPath: join(dir, 'cordis.patch.yml'), installAnchor, cwd: home, home,
|
||||
startedBundles: loaded.layers.map(layer => layer.packageName), overlays: [], telemetryDisabledEnv: undefined,
|
||||
startedBundles: loaded.layers.map(layer => layer.packageName), overlayPaths: [], telemetryDisabledEnv: undefined,
|
||||
}
|
||||
const resolution = await createRuntimeResolution({ installAnchor, profile: loaded, home })
|
||||
const trace: string[] = []
|
||||
|
||||
@@ -23,7 +23,7 @@ async function fixture(text?: string, rows: object[] = []): Promise<ProfileConte
|
||||
await writeFile(join(bundle, 'cordis.patch.yml'), JSON.stringify([{ insert: rows }]))
|
||||
const patchPath = join(dir, 'cordis.patch.yml')
|
||||
await (text === undefined ? rm(patchPath) : writeFile(patchPath, text))
|
||||
return { name: 'test', dir, patchPath, installAnchor, cwd: home, home, startedBundles: ['bundle'], overlays: [], telemetryDisabledEnv: undefined }
|
||||
return { name: 'test', dir, patchPath, installAnchor, cwd: home, home, startedBundles: ['bundle'], overlayPaths: [], telemetryDisabledEnv: undefined }
|
||||
}
|
||||
|
||||
it('preserves comments, expressions, unrelated configuration and the last override', async () => {
|
||||
|
||||
@@ -30,7 +30,7 @@ it('saves index sources without remounting, announces them, and restores them at
|
||||
writeFileSync(join(dir, 'cordis.yml'), '[]\n')
|
||||
const profile: ProfileContext = {
|
||||
name: 'test', startedBundles: ['test-bundle'], dir, patchPath: join(dir, 'cordis.patch.yml'),
|
||||
installAnchor: join(home, 'package.json'), cwd: home, home, overlays: [], telemetryDisabledEnv: undefined,
|
||||
installAnchor: join(home, 'package.json'), cwd: home, home, overlayPaths: [], telemetryDisabledEnv: undefined,
|
||||
}
|
||||
const start = () => boot('test', join(dir, 'cordis.yml'), readProfilePatches('test', profile), (root) => {
|
||||
root.provide('profileContext', profile)
|
||||
@@ -99,7 +99,7 @@ it('reads a market entry detail document and serves its images through the compo
|
||||
writeFileSync(join(dir, 'cordis.yml'), '- name: cordis:connection\n')
|
||||
const profile: ProfileContext = {
|
||||
name: 'test', startedBundles: ['test-bundle'], dir, patchPath: join(dir, 'cordis.patch.yml'),
|
||||
installAnchor: join(home, 'package.json'), cwd: home, home, overlays: [], telemetryDisabledEnv: undefined,
|
||||
installAnchor: join(home, 'package.json'), cwd: home, home, overlayPaths: [], telemetryDisabledEnv: undefined,
|
||||
}
|
||||
ctx = await boot('test', join(dir, 'cordis.yml'), readProfilePatches('test', profile), (root) => {
|
||||
root.provide('profileContext', profile)
|
||||
|
||||
@@ -79,7 +79,7 @@ async function mount(options: { profile?: boolean; connection?: boolean } = {})
|
||||
if (options.profile === true) {
|
||||
ctx.provide('profileContext', {
|
||||
name: 'test', startedBundles: [], dir: join(home, 'profile'), patchPath: join(home, 'profile', 'cordis.patch.yml'),
|
||||
installAnchor: join(home, 'package.json'), cwd: home, home, overlays: [], telemetryDisabledEnv: undefined,
|
||||
installAnchor: join(home, 'package.json'), cwd: home, home, overlayPaths: [], telemetryDisabledEnv: undefined,
|
||||
})
|
||||
}
|
||||
const routes = new Map<string, (request: Request) => Promise<Response>>()
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
en: df205a26b6d49168
|
||||
zh: e46ed7cf9e06248a
|
||||
/deepseek-ai-dsh-web-app/use-this-package/per-session-agent-setup:
|
||||
en: 1f16cd1737256729
|
||||
zh: 1d24cd133933ad9e
|
||||
en: 23cd05a35a675076
|
||||
zh: 6f32ef8a4a6a2c4d
|
||||
/deepseek-ai-dsh-web-app/understand-the-implementation:
|
||||
en: 567cf3afa68e6b68
|
||||
zh: f065cdb56c28d4e6
|
||||
|
||||
@@ -96,7 +96,7 @@ When you launch `dsh --profile web` over SSH, the URL line still prints but the
|
||||
|
||||
Each browser session selects a shipped preset (`standard` by default). The Agent presets settings page changes the default and edits preset child plugins; saves persist in `$DSH_HOME/profiles/web/cordis.patch.yml`. Standard and Creator enable the plugin-management tool only when the Host provides an editable profile.
|
||||
|
||||
Standard and Creator include the `dsh-doc` skill for questions about DSH and requested plugin or preset work. It guides the agent to the installed version's documentation and source. See [Model Experience](#model-experience) for loading and context effects.
|
||||
Both modes expose read-only runtime inspection through `cordis_inspect`; see [its context effects](../../extensions/tool-cordis/README.md#model-experience). Standard and Creator include the `dsh-doc` skill for questions about DSH and requested plugin or preset work. It guides the agent to the installed version's documentation and source. See [Model Experience](#model-experience) for loading and context effects.
|
||||
|
||||
The packaged skill uses the custom skill root: a same-named project skill overrides it, and it overrides same-named user skills. One catalog entry wins without an error; see [skill-root priority](../../skill/skill-filesystem/README.md).
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ dsh --profile web --no-open --host "$(hostname -i | awk '{print $1}')" --public-
|
||||
|
||||
每个浏览器会话选择一个随发行版交付的 preset(默认 `standard`)。Agent 预设设置页可更改默认项并编辑预设的子插件;保存结果持久化到 `$DSH_HOME/profiles/web/cordis.patch.yml`。只有 Host 提供可编辑的 profile 时,标准模式和 Creator 才会启用插件管理工具。
|
||||
|
||||
标准模式和创造模式包含 `dsh-doc` skill,用于 DSH 相关问题以及你要求的插件或预设工作。该 skill 引导 agent 查阅已安装版本的文档和源码。加载方式及其对上下文的影响参见[模型体验](#model-experience)。
|
||||
两种模式均通过 `cordis_inspect` 提供只读运行时检查;参见[其上下文影响](../../extensions/tool-cordis/README.zh.md#model-experience)。标准模式和创造模式包含 `dsh-doc` skill,用于 DSH 相关问题以及你要求的插件或预设工作。该 skill 引导 agent 查阅已安装版本的文档和源码。加载方式及其对上下文的影响参见[模型体验](#model-experience)。
|
||||
|
||||
打包的 skill 使用自定义 skill 根目录:同名的项目 skill 会覆盖打包的 skill,打包的 skill 又会覆盖同名的用户 skill。skill 目录中只保留优先级最高的一个条目,不会报错;参见 [skill 根目录优先级](../../skill/skill-filesystem/README.zh.md)。
|
||||
|
||||
|
||||
@@ -125,6 +125,8 @@
|
||||
config:
|
||||
fetch: true
|
||||
searchTimeoutMs: 60000
|
||||
- id: tool-cordis
|
||||
name: '@deepseek-ai/dsh-tool-cordis'
|
||||
- id: present
|
||||
name: '@deepseek-ai/dsh-tool-present'
|
||||
- id: tool-office
|
||||
|
||||
@@ -26,7 +26,7 @@ it.each([
|
||||
if (profile !== undefined) {
|
||||
ctx.provide('profileContext', {
|
||||
name: profile, dir: '/profile', patchPath: '/profile/cordis.patch.yml', installAnchor: '/profile/package.json',
|
||||
cwd: '/workspace', home: '/home', startedBundles: [], overlays: [], telemetryDisabledEnv: undefined,
|
||||
cwd: '/workspace', home: '/home', startedBundles: [], overlayPaths: [], telemetryDisabledEnv: undefined,
|
||||
})
|
||||
}
|
||||
ctx.baseUrl = 'file:///'
|
||||
|
||||
@@ -71,7 +71,7 @@ async function boot(profile: string, primaryRuntime: (root: string) => string |
|
||||
onTestFinished(() => ctx.fiber.dispose())
|
||||
ctx.provide('profileContext', {
|
||||
name: profile, dir: '/profile', patchPath: '/profile/cordis.patch.yml', installAnchor: join(root, 'package.json'),
|
||||
cwd: workspace, home: '/home', startedBundles: [], overlays: [], telemetryDisabledEnv: undefined,
|
||||
cwd: workspace, home: '/home', startedBundles: [], overlayPaths: [], telemetryDisabledEnv: undefined,
|
||||
})
|
||||
ctx.provide('dshHomePath', dshHomePath)
|
||||
provideWorkingDirectoryFixture(ctx, workspace)
|
||||
|
||||
@@ -26,7 +26,7 @@ it.each(['desktop', 'web'])('limits collection and its shutdown to the Desktop l
|
||||
onTestFinished(() => ctx.fiber.dispose())
|
||||
ctx.provide('profileContext', {
|
||||
name: profile, dir: '/profile', patchPath: '/profile/cordis.patch.yml', installAnchor: '/profile/package.json',
|
||||
cwd: '/workspace', home: '/home', startedBundles: [], overlays: [], telemetryDisabledEnv: undefined,
|
||||
cwd: '/workspace', home: '/home', startedBundles: [], overlayPaths: [], telemetryDisabledEnv: undefined,
|
||||
})
|
||||
const identity = vi.fn().mockResolvedValue(undefined)
|
||||
ctx.provide('deepseekAccount', { getDeviceIdentity: identity } as never)
|
||||
|
||||
@@ -10,7 +10,7 @@ export const guideEn = {
|
||||
guideStandardIntro: 'Choose Standard mode when starting a new task. Describe what you want to accomplish, point to the relevant files, and explain how to check the result.',
|
||||
guideStandardExplanation: [
|
||||
'### How it works',
|
||||
'The agent calls tools directly to read and edit files, search, and run terminal commands. It includes Skills, planning, goals, subagents, workflows, plugin management, and context compaction.',
|
||||
'The agent calls tools directly to read and edit files, search, and run terminal commands. It includes Skills, planning, goals, subagents, workflows, plugin management, read-only runtime inspection, and context compaction.',
|
||||
'For questions about DSH and plugin or preset work you request, the dsh-doc skill guides the agent to the installed documentation and source. Its instructions load only when requested or relevant; loading it does not change files, tools, or the profile.',
|
||||
'### When to choose it',
|
||||
'Start here for everyday coding, file work, and research. Standard mode can also write scripts and process files in batches. PTC changes how tool calls are organized; it is not required for batch tasks.',
|
||||
@@ -55,7 +55,7 @@ export const guideEn = {
|
||||
guideCordisIntro: 'Choose Creator mode for a new task. Describe the capability you want, where it should appear, and how you will verify it.',
|
||||
guideCordisExplanation: [
|
||||
'### What you can create',
|
||||
'Creator mode includes the standard task tools and adds runtime inspection. Standard and Creator share the dsh-doc guidance for plugin and preset development. The agent can create a plugin that adds a capability or UI, or a preset that combines tools and prompts for a particular job.',
|
||||
'Creator mode focuses on customizing DSH. It shares read-only runtime inspection and dsh-doc guidance with Standard mode. The agent can create a plugin that adds a capability or UI, or a preset that combines tools and prompts for a particular job.',
|
||||
'### Plugins and modes',
|
||||
'A plugin adds capabilities to DSH, such as a tool, a service connection, or a UI entry. A mode is an agent preset that selects tools and defines how the agent works in a task. A plugin can be included in a custom preset.',
|
||||
'### How the result takes effect',
|
||||
@@ -89,7 +89,7 @@ export const guideZh: Record<PresetGuideKey, string> = {
|
||||
guideStandardIntro: '新建任务时选择「标准模式」,说明要完成什么、相关文件在哪里,以及怎样判断任务完成。',
|
||||
guideStandardExplanation: [
|
||||
'### 工作方式',
|
||||
'Agent 直接调用工具来读写文件、检索资料和执行终端命令。包含 Skills、计划、目标、子 Agent、工作流、插件管理和上下文压缩等能力。',
|
||||
'Agent 直接调用工具来读写文件、检索资料和执行终端命令。包含 Skills、计划、目标、子 Agent、工作流、插件管理、只读运行时检查和上下文压缩等能力。',
|
||||
'对于 DSH 相关问题以及你要求的插件或预设工作,dsh-doc skill 引导 Agent 查阅已安装的文档和源码。其指令仅在被要求加载或与当前任务相关时加载;加载该 skill 不会改变文件、工具或 profile。',
|
||||
'### 什么时候选',
|
||||
'日常编程、文件处理和资料整理可以从这里开始。标准模式也能编写脚本、批量处理文件;PTC 改变的是工具调用方式,批量任务并不必须使用 PTC。',
|
||||
@@ -134,7 +134,7 @@ export const guideZh: Record<PresetGuideKey, string> = {
|
||||
guideCordisIntro: '新建任务时选择「创造模式」,说明希望增加什么能力、从哪里使用,以及怎样验证效果。',
|
||||
guideCordisExplanation: [
|
||||
'### 可以创造什么',
|
||||
'创造模式包含标准任务工具,并增加了运行时检查。标准模式和创造模式共用 dsh-doc 指引,用于插件和预设开发。Agent 可以创建插件来添加能力或界面,也可以创建预设,为特定工作组合工具和提示词。',
|
||||
'创造模式专注于定制 DSH。它与标准模式共用只读运行时检查和 dsh-doc 指引。Agent 可以创建插件来添加能力或界面,也可以创建预设,为特定工作组合工具和提示词。',
|
||||
'### 插件与模式的关系',
|
||||
'插件为 DSH 增加能力,例如工具、服务连接或界面入口。模式是一份 Agent 预设,用来选择任务可用的工具,并约定 Agent 的工作方式。自定义模式中也可以使用自己开发的插件。',
|
||||
'### 怎样让成果生效',
|
||||
@@ -163,7 +163,7 @@ export const guideJa = {
|
||||
'guideCopied': 'コピーしました',
|
||||
'guideFootnotes': '脚注',
|
||||
'guideStandardIntro': '新しいタスクを始めるときは標準モードを選びます。達成したいことを説明し、関連するファイルを示し、結果の確認方法を伝えてください。',
|
||||
'guideStandardExplanation': '### 仕組み\n\nエージェントはツールを直接呼び出してファイルの読み取りや編集、検索、ターミナルコマンドの実行を行います。スキル、計画、目標、サブエージェント、ワークフロー、プラグイン管理、コンテキストの圧縮に対応しています。\n\n### 選ぶべき場面\n\n日々のコーディング、ファイル作業、調査はまずここから始めてください。標準モードではスクリプトの作成やファイルの一括処理も行えます。PTC はツール呼び出しの構成を変えるものであり、一括処理に必須ではありません。',
|
||||
'guideStandardExplanation': '### 仕組み\n\nエージェントはツールを直接呼び出してファイルの読み取りや編集、検索、ターミナルコマンドの実行を行います。スキル、計画、目標、サブエージェント、ワークフロー、プラグイン管理、読み取り専用のランタイム検査、コンテキストの圧縮に対応しています。\n\n### 選ぶべき場面\n\n日々のコーディング、ファイル作業、調査はまずここから始めてください。標準モードではスクリプトの作成やファイルの一括処理も行えます。PTC はツール呼び出しの構成を変えるものであり、一括処理に必須ではありません。',
|
||||
'guideStandardUsage': '### バグを修正する\n\n> 検索フォームを二度送信すると結果が消える原因を調べてください。修正して関連するテストを実行し、原因と変更内容を説明してください。\n\n期待される出力: コードの変更、関連するテスト結果、原因の説明。\n\n### プロジェクトのメモを整理する\n\n> このプロジェクト内の Markdown メモを読み、合意された決定と未解決の課題を、元ファイルへのリンク付きで要約してください。\n\n期待される出力: 元のメモと照合できる参照付きの要約。',
|
||||
'guidePtcIntro': '新しいタスクを始めるときは PTC モードを選びます。入力ファイル、処理ルール、出力形式を指定してください。コードはエージェントが書きます。',
|
||||
'guidePtcExplanation': '### ツールの呼び出され方\n\nPTC は Programmatic Tool Calling の略です。この組み込みプリセットでは、エージェントは run_code を使い、生成された SDK 経由でツールを呼び出す TypeScript プログラムを書きます。プログラムではループ、条件分岐、エラー処理、必要に応じて並行呼び出しを利用できます。\n\n### モデルに届くもの\n\nツールの結果はまずプログラムに届き、そこでフィルタリングや結合ができます。モデルが受け取るのはプログラムが出力または返した内容です。画像の結果は別途添付されます。ネストされたツール呼び出しも記録され、ツール権限の対象のままです。\n\n### 標準モードとの比較\n\nどちらのモードもコーディングや一括処理のタスクを扱えます。標準モードは個々のツールを直接公開し、PTC はツール呼び出しをコードで整理します。現在の PTC プリセットではワークフローとプラグイン管理ツールが無効になっています。速度とトークン消費はタスクやプログラムの結果の扱い方によって変わります。',
|
||||
@@ -172,7 +172,7 @@ export const guideJa = {
|
||||
'guideMinimalExplanation': '### 含まれるもの\n\n永続的なシェルツール 1 つ、read_image、固定のシステムプロンプト。画像の読み取りには画像対応モデルが必要です。古い履歴はコンテキストの負荷に応じて自動的に圧縮されます。エージェントがアイドル状態のときに /compact を使えば手動で圧縮できます。この組み込みプリセットはスキル、計画、標準のランタイムコンテキストを読み込みません。\n\n### 選ぶべき場面\n\n実験や比較のベースラインとして使用します。シェルコマンド経由でファイルの読み取りやスクリプトの実行はできますが、長いタスクを管理するための組み込み手段は少なくなります。ツールが少ないからといって、初心者にとって必ずしも簡単になるわけではありません。',
|
||||
'guideMinimalUsage': '### 小さなバグ修正で性能を比較する\n\n> このプロジェクトのテストを実行し、失敗の原因を見つけて最小限の修正をしてください。関連するテストを再度実行し、結果を報告してください。\n\n同じ開始状態から、標準モードと最小モードで同じタスクを別々に実行します。タスクの完了状況、ツール呼び出し、生じた変更を比較してください。最小モードはターミナルコマンドを通じて作業を行います。',
|
||||
'guideCordisIntro': '新しいタスクにはクリエイターモードを選びます。実現したい機能、表示される場所、確認方法を説明してください。',
|
||||
'guideCordisExplanation': '### 作成できるもの\n\nクリエイターモードには標準的なタスクツールに加え、ランタイムの検査、Cordis プラグインやエージェントプリセットの作成ガイドが含まれます。機能や UI を追加するプラグインを作成することも、特定の作業向けにツールとプロンプトを組み合わせたプリセットを作成することもできます。\n\n### プラグインとモード\n\nプラグインはツール、サービス接続、UI エントリなど、DSH に機能を追加します。モードはエージェントプリセットであり、ツールを選択し、タスク内でのエージェントの動作を定義します。プラグインはカスタムプリセットに含めることができます。\n\n### 結果を反映させる方法\n\nソースコードを生成するだけでなく、エージェントにインストールと確認を依頼してください。プラグインは変更内容によっては即座に読み込まれるか、再起動が必要になる場合があります。新しく作成したプリセットは、新しいタスクを始めるときに選択されます。',
|
||||
'guideCordisExplanation': '### 作成できるもの\n\nクリエイターモードは DSH のカスタマイズに重点を置いています。読み取り専用のランタイム検査と dsh-doc のガイドを標準モードと共有しています。エージェントは機能や UI を追加するプラグインを作成することも、特定の作業向けにツールとプロンプトを組み合わせたプリセットを作成することもできます。\n\n### プラグインとモード\n\nプラグインはツール、サービス接続、UI エントリなど、DSH に機能を追加します。モードはエージェントプリセットであり、ツールを選択し、タスク内でのエージェントの動作を定義します。プラグインはカスタムプリセットに含めることができます。\n\n### 結果を反映させる方法\n\nソースコードを生成するだけでなく、エージェントにインストールと確認を依頼してください。プラグインは変更内容によっては即座に読み込まれるか、再起動が必要になる場合があります。新しく作成したプリセットは、新しいタスクを始めるときに選択されます。',
|
||||
'guideCordisUsage': '### UI を追加する\n\n> サイドバーにプロジェクトメモのエントリを追加する DSH プラグインを作成してください。このワークスペース内の Markdown ファイルを閲覧でき、選択したメモをプレビューできるようにしてください。インストールしてページが開くことを確認してください。\n\n期待される出力: 動作するエントリとプレビューページを備えた、インストール済みのプラグイン。残っている有効化手順があればそれも含みます。\n\n### ツールを追加する\n\n> このプロジェクトのテストレポートを読み、失敗したテストを要約するツールを備えたプラグインを作成してください。登録し、サンプルのレポートで確認してください。\n\n期待される出力: 呼び出し可能なツールを備えたプラグインと、確認済みのサンプル呼び出し。\n\n### 独自のモードを作成する\n\n> 標準モードをベースに「コードレビュー」モードを作成してください。潜在的なバグとテストの不足を優先し、ファイルパスと行番号を示し、ファイルを変更する前に確認を求めるようにしてください。選択可能なプリセットとして保存してください。\n\n期待される出力: 新しいタスク用のカスタムプリセット。これらのレビュー指示はエージェントを導くものであり、実行できる操作は権限設定によって決まります。',
|
||||
} satisfies Record<keyof typeof guideEn, string>
|
||||
|
||||
@@ -188,7 +188,7 @@ export const guideEs = {
|
||||
guideStandardIntro: 'Elija el modo Estándar al iniciar una nueva tarea. Describe lo que quieres lograr, señala los archivos relevantes y explica cómo verificar el resultado.',
|
||||
guideStandardExplanation: [
|
||||
'### Cómo funciona',
|
||||
'El agente llama a herramientas directamente para leer y editar archivos, buscar y ejecutar comandos de terminal. Incluye habilidades, planificación, objetivos, subagentes, flujos de trabajo, gestión de complementos y compactación de contexto.',
|
||||
'El agente llama a herramientas directamente para leer y editar archivos, buscar y ejecutar comandos de terminal. Incluye habilidades, planificación, objetivos, subagentes, flujos de trabajo, gestión de complementos, inspección del tiempo de ejecución de solo lectura y compactación de contexto.',
|
||||
'### Cuándo elegirlo',
|
||||
'Comience aquí para la codificación, el trabajo con archivos y la investigación diaria. El modo estándar también puede escribir scripts y procesar archivos en lotes. PTC cambia la forma en que se organizan las llamadas a herramientas; no es necesario para tareas por lotes.',
|
||||
].join('\n\n\n\n'),
|
||||
@@ -232,7 +232,7 @@ export const guideEs = {
|
||||
guideCordisIntro: 'Elija el modo Creador para una nueva tarea. Describe la capacidad que deseas, dónde debería aparecer y cómo la verificarás.',
|
||||
guideCordisExplanation: [
|
||||
'### Lo que puedes crear',
|
||||
'El modo Creador incluye las herramientas de tareas estándar además de inspección del tiempo de ejecución y orientación para crear Cordis complementos y ajustes preestablecidos de agentes. Puede crear un complemento que agregue una capacidad o interfaz de usuario, o un ajuste preestablecido que combine herramientas e indicaciones para un trabajo en particular.',
|
||||
'El modo Creador se centra en personalizar DSH. Comparte la inspección del tiempo de ejecución de solo lectura y la orientación de dsh-doc con el modo Estándar. El agente puede crear un complemento que agregue una capacidad o interfaz de usuario, o un ajuste preestablecido que combine herramientas e indicaciones para un trabajo en particular.',
|
||||
'### Complementos y modos',
|
||||
'Un complemento agrega capacidades a DSH, como una herramienta, una conexión de servicio o una entrada de UI. Un modo es un ajuste preestablecido del agente que selecciona herramientas y define cómo trabaja el agente en una tarea. Se puede incluir un complemento en un ajuste preestablecido personalizado.',
|
||||
'### Cómo surte efecto el resultado',
|
||||
@@ -263,7 +263,7 @@ export const guideFr = {
|
||||
guideStandardIntro: 'Choisissez le mode Standard lorsque vous démarrez une nouvelle tâche. Décrivez ce que vous souhaitez accomplir, pointez vers les fichiers pertinents et expliquez comment vérifier le résultat.',
|
||||
guideStandardExplanation: [
|
||||
'### Comment ça marche',
|
||||
"L'agent appelle directement des outils pour lire et modifier des fichiers, rechercher et exécuter des commandes de terminal. Il comprend les compétences, la planification, les objectifs, les sous-agents, les flux de travail, la gestion des plugins et le compactage du contexte.",
|
||||
"L'agent appelle directement des outils pour lire et modifier des fichiers, rechercher et exécuter des commandes de terminal. Il comprend les compétences, la planification, les objectifs, les sous-agents, les flux de travail, la gestion des plugins, l\'inspection d\'exécution en lecture seule et le compactage du contexte.",
|
||||
'### Quand le choisir',
|
||||
"Commencez ici pour le codage quotidien, le travail sur les fichiers et la recherche. Le mode standard peut également écrire des scripts et traiter des fichiers par lots. PTC modifie la façon dont les appels d'outils sont organisés ; il n'est pas requis pour les tâches par lots.",
|
||||
].join('\n\n\n\n'),
|
||||
@@ -307,7 +307,7 @@ export const guideFr = {
|
||||
guideCordisIntro: 'Choisissez le mode Créateur pour une nouvelle tâche. Décrivez la fonctionnalité souhaitée, où elle doit apparaître et comment vous la vérifierez.',
|
||||
guideCordisExplanation: [
|
||||
'### Ce que vous pouvez créer',
|
||||
"Le mode Créateur inclut les outils de tâches standard, ainsi qu'une inspection d'exécution et des conseils pour la création de Cordis plug-ins et préréglages d'agent. Il peut créer un plugin qui ajoute une fonctionnalité ou une interface utilisateur, ou un préréglage combinant des outils et des invites pour une tâche particulière.",
|
||||
"Le mode Créateur se concentre sur la personnalisation de DSH. Il partage l'inspection d'exécution en lecture seule et les conseils de dsh-doc avec le mode Standard. L'agent peut créer un plugin qui ajoute une fonctionnalité ou une interface utilisateur, ou un préréglage combinant des outils et des invites pour une tâche particulière.",
|
||||
'### Plugins et modes',
|
||||
"Un plug-in ajoute des fonctionnalités à DSH, telles qu'un outil, une connexion à un service ou une entrée d'interface utilisateur. Un mode est un préréglage d'agent qui sélectionne les outils et définit la manière dont l'agent fonctionne dans une tâche. Un plugin peut être inclus dans un préréglage personnalisé.",
|
||||
'### Comment le résultat prend effet',
|
||||
@@ -338,7 +338,7 @@ export const guideDe = {
|
||||
guideStandardIntro: 'Wählen Sie den Standardmodus, wenn Sie eine neue Aufgabe starten. Beschreiben Sie, was Sie erreichen möchten, zeigen Sie auf die relevanten Dateien und erklären Sie, wie Sie das Ergebnis überprüfen können.',
|
||||
guideStandardExplanation: [
|
||||
'### Wie es funktioniert',
|
||||
'Der Agent ruft Tools direkt auf, um Dateien zu lesen und zu bearbeiten, zu suchen und Terminalbefehle auszuführen. Es umfasst Fähigkeiten, Planung, Ziele, Subagenten, Arbeitsabläufe, Plugin-Verwaltung und Kontextkomprimierung.',
|
||||
'Der Agent ruft Tools direkt auf, um Dateien zu lesen und zu bearbeiten, zu suchen und Terminalbefehle auszuführen. Es umfasst Fähigkeiten, Planung, Ziele, Subagenten, Arbeitsabläufe, Plugin-Verwaltung, schreibgeschützte Laufzeitprüfung und Kontextkomprimierung.',
|
||||
'### Wann man es wählt',
|
||||
'Beginnen Sie hier mit alltäglicher Codierung, Dateiarbeit und Recherche. Im Standardmodus können auch Skripts geschrieben und Dateien stapelweise verarbeitet werden. PTC ändert die Organisation von Toolaufrufen; Für Batch-Aufgaben ist es nicht erforderlich.',
|
||||
].join('\n\n\n\n'),
|
||||
@@ -382,7 +382,7 @@ export const guideDe = {
|
||||
guideCordisIntro: 'Wählen Sie den Erstellermodus für eine neue Aufgabe. Beschreiben Sie die gewünschte Funktion, wo sie angezeigt werden soll und wie Sie sie überprüfen.',
|
||||
guideCordisExplanation: [
|
||||
'### Was Sie erstellen können',
|
||||
'Der Erstellermodus umfasst die Standardaufgabentools sowie eine Laufzeitprüfung und Anleitungen zum Erstellen von Cordis-Plugins und Agent-Voreinstellungen. Es kann ein Plugin erstellt werden, das eine Funktion oder Benutzeroberfläche hinzufügt, oder eine Voreinstellung, die Tools und Eingabeaufforderungen für einen bestimmten Job kombiniert.',
|
||||
'Der Erstellermodus konzentriert sich auf die Anpassung von DSH. Er bietet dieselbe schreibgeschützte Laufzeitprüfung und dieselben dsh-doc-Anleitungen wie der Standardmodus. Der Agent kann ein Plugin erstellen, das eine Funktion oder Benutzeroberfläche hinzufügt, oder eine Voreinstellung, die Tools und Eingabeaufforderungen für einen bestimmten Job kombiniert.',
|
||||
'### Plugins und Modi',
|
||||
'Ein Plugin fügt DSH Funktionen hinzu, beispielsweise ein Tool, eine Dienstverbindung oder einen UI-Eintrag. Ein Modus ist eine Agentenvoreinstellung, die Tools auswählt und definiert, wie der Agent in einer Aufgabe arbeitet. Ein Plugin kann in eine benutzerdefinierte Voreinstellung eingebunden werden.',
|
||||
'### Wie das Ergebnis wirksam wird',
|
||||
@@ -413,7 +413,7 @@ export const guideRu = {
|
||||
guideStandardIntro: 'Выбирайте стандартный режим при запуске новой задачи. Опишите, чего вы хотите добиться, укажите соответствующие файлы и объясните, как проверить результат.',
|
||||
guideStandardExplanation: [
|
||||
'### Как это работает',
|
||||
'Агент напрямую вызывает инструменты для чтения и редактирования файлов, поиска и выполнения команд терминала. Он включает в себя навыки, планирование, цели, субагенты, рабочие процессы, управление плагинами и сжатие контекста.',
|
||||
'Агент напрямую вызывает инструменты для чтения и редактирования файлов, поиска и выполнения команд терминала. Он включает в себя навыки, планирование, цели, субагенты, рабочие процессы, управление плагинами, проверку во время выполнения только для чтения и сжатие контекста.',
|
||||
'### Когда это выбирать',
|
||||
'Начните здесь ежедневное программирование, работу с файлами и исследования. Стандартный режим также позволяет писать сценарии и обрабатывать файлы в пакетном режиме. PTC изменяет организацию вызовов инструментов; для пакетных задач это не требуется.',
|
||||
].join('\n\n\n\n'),
|
||||
@@ -457,7 +457,7 @@ export const guideRu = {
|
||||
guideCordisIntro: 'Выберите режим «Создатель» для новой задачи. Опишите желаемую возможность, где она должна появиться и как вы ее проверите.',
|
||||
guideCordisExplanation: [
|
||||
'### Что вы можете создать',
|
||||
'Режим Creator включает в себя стандартные инструменты задач, а также проверку во время выполнения и рекомендации по созданию подключаемых модулей Cordis и предустановок агента. Он может создать плагин, добавляющий возможности или пользовательский интерфейс, или предустановку, объединяющую инструменты и подсказки для конкретной работы.',
|
||||
'Режим Creator предназначен для настройки DSH. Он предоставляет ту же проверку во время выполнения только для чтения и те же рекомендации dsh-doc, что и стандартный режим. Агент может создать плагин, добавляющий возможности или пользовательский интерфейс, или предустановку, объединяющую инструменты и подсказки для конкретной работы.',
|
||||
'### Плагины и режимы',
|
||||
'Плагин добавляет к DSH возможности, такие как инструмент, подключение к службе или запись пользовательского интерфейса. Режим — это предустановка агента, которая выбирает инструменты и определяет, как агент работает над задачей. Плагин может быть включен в пользовательский пресет.',
|
||||
'### Как результат вступает в силу',
|
||||
@@ -488,7 +488,7 @@ export const guidePt = {
|
||||
guideStandardIntro: 'Escolha o modo Padrão ao iniciar uma nova tarefa. Descreva o que você deseja realizar, indique os arquivos relevantes e explique como verificar o resultado.',
|
||||
guideStandardExplanation: [
|
||||
'### Como funciona',
|
||||
'O agente chama ferramentas diretamente para ler e editar arquivos, pesquisar e executar comandos de terminal. Inclui habilidades, planejamento, metas, subagentes, fluxos de trabalho, gerenciamento de plugins e compactação de contexto.',
|
||||
'O agente chama ferramentas diretamente para ler e editar arquivos, pesquisar e executar comandos de terminal. Inclui habilidades, planejamento, metas, subagentes, fluxos de trabalho, gerenciamento de plugins, inspeção de tempo de execução somente leitura e compactação de contexto.',
|
||||
'### Quando escolher',
|
||||
'Comece aqui para codificação diária, trabalho de arquivo e pesquisa. O modo padrão também pode escrever scripts e processar arquivos em lotes. PTC altera a forma como as chamadas de ferramenta são organizadas; não é necessário para tarefas em lote.',
|
||||
].join('\n\n\n\n'),
|
||||
@@ -532,7 +532,7 @@ export const guidePt = {
|
||||
guideCordisIntro: 'Escolha o modo Criador para uma nova tarefa. Descreva o recurso desejado, onde ele deve aparecer e como você o verificará.',
|
||||
guideCordisExplanation: [
|
||||
'### O que você pode criar',
|
||||
'O modo Criador inclui ferramentas de tarefas padrão, além de inspeção de tempo de execução e orientação para criação de Cordis plug-ins e predefinições de agente. Ele pode criar um plug-in que adicione um recurso ou UI, ou uma predefinição que combine ferramentas e prompts para um trabalho específico.',
|
||||
'O modo Criador se concentra na personalização do DSH. Ele compartilha a inspeção de tempo de execução somente leitura e a orientação do dsh-doc com o modo Padrão. O agente pode criar um plug-in que adicione um recurso ou UI, ou uma predefinição que combine ferramentas e prompts para um trabalho específico.',
|
||||
'### Plug-ins e modos',
|
||||
'Um plug-in adiciona recursos a DSH, como uma ferramenta, uma conexão de serviço ou uma entrada de IU. Um modo é uma predefinição de agente que seleciona ferramentas e define como o agente trabalha em uma tarefa. Um plugin pode ser incluído em uma predefinição personalizada.',
|
||||
'### Como o resultado entra em vigor',
|
||||
|
||||
@@ -329,7 +329,9 @@ function JobItem({ job, view, expanded, now, onToggle, kill, t }: {
|
||||
* observation, and kill controls, and the namespace translator.
|
||||
* @returns the trigger and its popover list, or null when there is nothing to show.
|
||||
*/
|
||||
export function JobListAction({ sessionId, useJobs, watchRows, observe, killJob, t }: JobListActionProps) {
|
||||
export function JobListAction({ sessionId, useJobs, watchRows, observe, killJob, t, useAccess }: JobListActionProps) {
|
||||
// The stop control follows job/kill; a reader that may list a job but not stop it sees the row only.
|
||||
const mayKill = useAccess('job/kill')
|
||||
const activityId = useId()
|
||||
const jobs = useJobs(state => state.rows[sessionId]) ?? NO_JOBS
|
||||
const observedViews = useJobs(state => state.observed)
|
||||
@@ -552,7 +554,7 @@ export function JobListAction({ sessionId, useJobs, watchRows, observe, killJob,
|
||||
onToggle={() => {
|
||||
setExpandedKey(current => current === String(job.id) ? undefined : String(job.id))
|
||||
}}
|
||||
{...job.status === 'running'
|
||||
{...job.status === 'running' && mayKill
|
||||
? {
|
||||
kill: {
|
||||
state: killPhase?.key === String(job.id) ? killPhase.state : 'idle' as const,
|
||||
|
||||
@@ -61,12 +61,16 @@ function props(
|
||||
observed: Readonly<Record<string, ObservedJob>> = {},
|
||||
killJob: JobListActionProps['killJob'] = async () => true,
|
||||
watchRows: JobListActionProps['watchRows'] = () => () => {},
|
||||
mayKill = true,
|
||||
): JobListActionProps {
|
||||
const jobsState: JobsSnapshot = { rows: jobs.length > 0 ? { [SESSION]: jobs } : {}, observed }
|
||||
function useJobs<T>(select: (value: JobsSnapshot) => T): T {
|
||||
return select(jobsState)
|
||||
}
|
||||
return { sessionId: SESSION, useJobs, watchRows, observe, killJob, t } as JobListActionProps
|
||||
return {
|
||||
sessionId: SESSION, useJobs, watchRows, observe, killJob, t,
|
||||
useAccess: () => mayKill,
|
||||
} as JobListActionProps
|
||||
}
|
||||
|
||||
function openList(): void {
|
||||
@@ -323,6 +327,12 @@ describe('JobListAction hover', () => {
|
||||
expect(stop).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
|
||||
it('omits the stop control without job/kill access', () => {
|
||||
const view = render(<JobListAction {...props([job({ status: 'running' })], undefined, undefined, undefined, undefined, false)} />)
|
||||
openList()
|
||||
expect(view.container.querySelector('[data-kill-state]')).toBeNull()
|
||||
})
|
||||
|
||||
it('pins pointer interaction so leaving cannot interrupt stop confirmation', () => {
|
||||
vi.useFakeTimers()
|
||||
render(<JobListAction {...props([job()])} />)
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
en: d152484eb41ac6b4
|
||||
zh: 405b30feaf48c087
|
||||
/deepseek-ai-dsh-client-ui-schedule/use-this-package:
|
||||
en: 330bf974a2f6d305
|
||||
zh: 3efbe98ff08058b1
|
||||
en: ff9e353f9330cf8d
|
||||
zh: 61b0656261a69d4d
|
||||
/deepseek-ai-dsh-client-ui-schedule/use-this-package/time-zone-data-source:
|
||||
en: 4005b800e930f581
|
||||
zh: ccb9318dad7f7e8f
|
||||
/deepseek-ai-dsh-client-ui-schedule/understand-the-implementation:
|
||||
en: 73e3c0f06c7381e8
|
||||
zh: 4b83f0eb8da65ce1
|
||||
en: e8d9f289467d7cd0
|
||||
zh: 5fbe94dc32f40755
|
||||
/deepseek-ai-dsh-client-ui-schedule/further-exploration:
|
||||
en: 2fd968202916b197
|
||||
zh: f1ab66194846562b
|
||||
|
||||
Loaded 100 of 292 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user