@deepseek-ai/dsh-tool-cordis 0.1.6-alpha.1 → 0.1.6-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write packages/extensions/tool-cordis/README.md
5
- README.md: d7fa7acf14ffbe5e9d3177af3ec354963d05e8db
6
- README.zh.md: 80d094252848cd11b175686963a15b86490fecd3
5
+ README.md: a0152cf3dbdd08599ba431113123c6aaf097723d
6
+ README.zh.md: cde328fce54b4c18f57b7a044e6afc24215417dd
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Model-facing Cordis runtime tools for agents and maintainers choosing, composing, or debugging dynamic-package workflows."
2
+ description: "Read-only runtime API discovery for agents developing and configuring installed Harness plugins."
3
3
  kind: "package-reference"
4
4
  ---
5
5
 
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
9
9
 
10
10
  ## Summary
11
11
 
12
- `dsh-tool-cordis` lets a model inspect the live Cordis runtime and create, run, stop, update, or remove temporary dynamic packages with host code, browser code, or both. Package versions are immutable, so a failed package can be corrected by adding a new version and updating the active one. Definitions exist only in process memory and disappear when DSH restarts; the package does not write repository files, install dependencies, or change `cordis.yml`. It also teaches the model this workflow. Compose it with `@deepseek-ai/dsh-cordis-host-runner`, which provides the sandbox and run round trip.
12
+ Inspect Host and Client runtime APIs before writing plugin code. Creator mode provides these read-only tools alongside Plugin Manager, which owns persistent profile changes. The inspection registry is supplied by the Cordis host runner; browser queries need a connected page.
13
13
 
14
14
  ## Table of Contents
15
15
 
@@ -25,38 +25,7 @@ English | [中文](README.zh.md)
25
25
  <a id="use-this-package"></a>
26
26
  ## Use this package
27
27
 
28
- Mount this plugin when a session should be able to extend its own runtime temporarily — for example, a model-written tool, service, or browser UI that helps the current work but should not become a repository plugin. Compose it with the host runner; without the runner the tools never activate, and no shipped bundle mounts the toolset (the web profile already mounts the host runner and the browser faces), so add the tool row explicitly.
29
-
30
- ### Minimal composition
31
-
32
- ```yaml
33
- - name: '@deepseek-ai/dsh-cordis-host-runner'
34
- config:
35
- vmTimeoutMs: 5000
36
- - name: '@deepseek-ai/dsh-tool-cordis'
37
- ```
38
-
39
- The CLI example [`apps/cli/config/examples/cordis/cordis.yml`](../../../apps/cli/config/examples/cordis/cordis.yml) composes both. A package with a browser half additionally needs the browser runner and the UI package in the client composition; a host-only package needs none of them.
40
-
41
- ### What the tools do
42
-
43
- The three inspect tools are read-only; the four lifecycle tools define and manage packages. All results are JSON rendered as text.
44
-
45
- - `cordis_inspect_list` — list the Inspect Providers (host and client) and their query methods.
46
- - `cordis_inspect_query` — run one provider query: exact service methods, event modes, builtin signatures, tool schemas, theme tokens, or live slot trees.
47
- - `cordis_inspect_self` — this session's dynamic plugins: version pointers, latest run, and, for one exact package, its source and runtime diagnostics.
48
- - `cordis_define` — record a package: a new plugin (`plugin.kind: "new"` with a 3–6-letter `idPrefix`) or a new version of an existing plugin (`plugin.kind: "existing"` with its `pluginId`). It validates parameters and syntax only; nothing runs and no approval is requested.
49
- - `cordis_run` — activate one package (`mode: "run"` for the first activation or restart, `mode: "update"` to switch versions). A package with a browser half may return `awaiting-approval` until a person allows it; the tool never waits for the final outcome.
50
- - `cordis_stop` — stop the current run and cancel any pending approval, keeping the plugin and every package version.
51
- - `cordis_undefine` — stop and permanently remove a plugin and all of its packages.
52
-
53
- ### A typical workflow
54
-
55
- Inspect before writing, then define, then run: `cordis_inspect_query` reads the exact contract of the service or slot the package will use, `cordis_define` records the source (and the conversation shows a define card pointing to the panel where the run control lives), and `cordis_run` activates it. When the user types `@pluginId`, this package injects a context message that pins the referenced plugin, its base package, and the update path. After a technical failure, read the diagnostics with `cordis_inspect_self`, append a corrected package to the same plugin, and update to it.
56
-
57
- ### Boundaries to plan around
58
-
59
- Definitions are session-scoped and process-local: a package is visible and controllable only in the session that defined it, stays active across later turns, and can affect other sessions in the same process while running. Stopping, removing, unloading the toolset, or restarting DSH clears it. The sandbox isolates globals but is not a security boundary — treat a dynamic package like bash access, and load this plugin as deliberately as you would grant one.
28
+ Creator mode includes this toolset. Other compositions mount `@deepseek-ai/dsh-tool-cordis` alongside the host runner that provides `cordisInspect`. Call `cordis_inspect_list` to discover providers, then `cordis_inspect_query` for a provider's exact methods and types. Use [Plugin Manager](../../boot/plugin-manager/README.md) to install bundles containing plugin code or MCP configuration.
60
29
 
61
30
  -----
62
31
 
@@ -66,26 +35,7 @@ Definitions are session-scoped and process-local: a package is visible and contr
66
35
  <details>
67
36
  <summary>Implementation internals — click to expand</summary>
68
37
 
69
- This section explains the design behind the tools; the observable behavior is fully covered in [Use this package](#use-this-package).
70
-
71
- ### Design philosophy
72
-
73
- The toolset is built on one separation: the tools are a thin, model-facing layer over the runner service. Inspection data comes from generated catalogs intersected with the live service store; definition and lifecycle verbs delegate to `ctx.dynamicCordisRunner`, which owns the registry, the vm sandbox, and the browser round trip. The tools add the model-facing judgments: only callable methods are shown, only keys a host half can reach are named, and every refusal is a teaching error the model can act on.
74
-
75
- ### Source map
76
-
77
- | File | Role |
78
- |---|---|
79
- | [`src/index.ts`](src/index.ts) | Plugin entry: tool registration, system-prompt section, `@pluginId` context injection |
80
- | [`src/inspect.ts`](src/inspect.ts) | Report rendering: joins the generated API catalog with the live service store |
81
- | [`src/api-catalog.ts`](src/api-catalog.ts) | Generated projection of the workspace's Cordis declarations (regenerated by `pnpm run gen-cordis-api`, gated by `verify-cordis-api`) |
82
- | [`src/prompt.ts`](src/prompt.ts) | The `tool:cordis` system-prompt section |
83
- | [`src/providers.ts`](src/providers.ts) | First-party host Inspect Providers: Service, Event, Builtin, Tool |
84
- | [`src/present.ts`](src/present.ts) | Replay-safe generic card render intents |
85
-
86
- ### How a call flows
87
-
88
- An inspect call queries `ctx.cordisInspect`: host providers run locally, client providers wait for the first valid page response. Define prechecks each half's syntax by compiling it in the same wrapper the sandbox uses, so unparseable code is refused before an id exists. Run delegates to the runner, which activates host-only packages in-process and suspends browser-half packages on a `cordis/request-run` round trip; the tool returns the runner's receipt (`awaiting-approval`, `starting`, or `running`). When the user writes `@pluginId`, an `agent/pre-step` handler reads the reference and injects a user-role context message naming the base package and the required next steps.
38
+ Host providers combine generated Service/Event catalogs and the requesting agent's tool registry. Client providers synchronize their manifests through the existing inspection registry and answer queries from a connected page. The tool plugin owns its registrations through Cordis effects; disposal removes both tools and prompt contributions. No invariant companion is published because inspection reads its providers directly and maintains no independent runtime projection.
89
39
 
90
40
  </details>
91
41
 
@@ -94,103 +44,33 @@ An inspect call queries `ctx.cordisInspect`: host providers run locally, client
94
44
  <a id="further-exploration"></a>
95
45
  ## Further Exploration
96
46
 
97
- Read these pages when the package-level contract is not enough. They move from the shared toolset to the runner internals, the generated schemas, and the subsystem surface.
98
-
99
- - [Host runner](../cordis-host-runner/README.md) — the registry, sandbox, and run round trip these tools delegate to.
100
- - [Client runner](../cordis-client-runner/README.md) — the browser half that answers run requests and loads browser-half code.
101
- - [UI package](../ui-cordis/README.md) — the panel and tool cards users operate definitions with.
102
- - [Generated tool catalog](../../../docs/tool-catalog.md#deepseek-aidsh-tool-cordis) — the exact schemas the model receives.
103
- - [Extensions subsystem](../../../docs/subsystems/extensions.md) — the generated `ctx.cordisInspect` and `ctx.dynamicCordisRunner` API.
104
- - [Self-referential Cordis toolset Agent Note](../../../.agents/notes/implemented/feature/2026-07-08-self-referential-cordis-toolset.md) — design home: sandbox semantics, dynamic-package lifecycle, and composition.
105
-
106
- -----
47
+ - [Plugin Manager](../../boot/plugin-manager/README.md) — persistent bundle installation and enablement.
48
+ - [Cordis host runner](../cordis-host-runner/README.md) — inspection registry and existing runtime consumers.
107
49
 
108
50
  <a id="model-experience"></a>
109
51
  ## Model Experience
110
52
 
111
- ### Tool schemas
53
+ ### Runtime inspection
112
54
 
113
55
  #### What the model sees
114
56
 
115
- The conversation model sees the generated [`cordis_inspect_list`, `cordis_inspect_query`, `cordis_inspect_self`, `cordis_define`, `cordis_run`, `cordis_stop`, and `cordis_undefine` schemas](../../../docs/tool-catalog.md#deepseek-aidsh-tool-cordis) whenever this plugin is visible.
57
+ The [tool catalog](../../../docs/tool-catalog.md#deepseek-aidsh-tool-cordis) describes two read-only inspection tools. The [prompt](src/prompt.ts) directs persistent changes through Plugin Manager and describes MCP setup. Creator visual requests default to an installed UI plugin displayed in the current Web page; the development skill covers Client packaging and slot registration. Query results contain the requested API declarations or live tool schemas.
116
58
 
117
59
  #### Token effect
118
60
 
119
- Fixed schema cost on every request in that tool view.
61
+ Both tool schemas and the guidance section enter model requests while this plugin is visible. Query results append to the transcript; exact queries avoid loading unrelated declarations.
120
62
 
121
63
  #### KV Cache effect
122
64
 
123
- Prefix-stable while this tool view is unchanged. Scoping or plugin-lifecycle changes that hide these definitions may invalidate reuse from the first changed schema token.
124
-
125
- ### System prompt section
126
-
127
- #### What the model sees
128
-
129
- This package registers one system-prompt section (`tool:cordis`, order 115) teaching when and how to use the dynamic-plugin workflow, the recommended tool sequence, and the high-frequency errors to avoid; the full text lives in [`src/prompt.ts`](src/prompt.ts). The section opens with:
130
-
131
- ##### Section opening
132
-
133
- ```markdown
134
- # Dynamic Cordis Plugins
135
-
136
- Dynamic Cordis plugins temporarily extend the current DSH process. A Plugin uses apply(ctx) to consume Services, listen to Events, provide Services, register model Tools, or register browser UI in Slots.
137
- ```
138
-
139
- #### Token effect
140
-
141
- The section's rendered text repeats on every request while this plugin is visible.
142
-
143
- #### KV Cache effect
144
-
145
- Prefix-stable while the section text and order are unchanged; editing the prompt or changing its order may invalidate reuse from the first changed token.
146
-
147
- ### Tool-call history and results
148
-
149
- #### What the model sees
150
-
151
- Inspect outputs are JSON rendered as text: `cordis_inspect_list` returns the provider directory, `cordis_inspect_query` the queried data, and `cordis_inspect_self` a plugin, version, and package summary with source and diagnostics for an exact package. Define answers that the package is defined and not running yet, with the ids to run. Run reports `awaiting-approval`, `starting`, or `running` with the run id and version pointers. Stop and undefine acknowledge in one line. Every refusal is a tool error carrying the runner's teaching text, and the submitted program stays in assistant tool-call history.
152
-
153
- #### Token effect
154
-
155
- Inspect output and submitted package code are data-dependent and resent until compaction; lifecycle acknowledgements are small.
156
-
157
- #### KV Cache effect
158
-
159
- Append-only; newly visible content follows the reusable request prefix and does not invalidate existing KV Cache entries.
160
-
161
- ### Later requests after cordis_run
162
-
163
- #### What the model sees
164
-
165
- A running package may register tools, prompt contributions, or listeners that change later requests for the scopes it targets; `cordis_stop` and `cordis_undefine` remove those contributions after quiescence. When the user types `@pluginId`, the injected reference context also adds a user-role message naming the base package and the next steps.
166
-
167
- #### Token effect
168
-
169
- Indirect token impact equals the running package's contributions and lasts only for its process-local lifetime.
170
-
171
- #### KV Cache effect
172
-
173
- Running or stopping a prompt or tool contribution changes later request prefixes and may invalidate reuse from the first changed contribution; an unchanged running set remains prefix-stable.
65
+ Unchanged schemas and guidance remain prefix-stable. Query results append to history; enabling other plugins can change subsequent tool schemas.
174
66
 
175
67
  ## Known Limitations and Deferred Work
176
68
 
177
69
  <a id="known-limitations-and-deferred-work"></a>
178
70
 
179
-
180
- These limits define when the toolset is a poor fit or needs special care. They are current package constraints, not a task backlog.
181
-
182
- - **The sandbox is containment for honest code, not a security boundary** — host-realm helpers on the sandbox global are reachable, so package code can reach Node; load this plugin as deliberately as you would grant a bash tool.
183
- - **Plain JavaScript only** — dynamic package code is not transformed: no TypeScript, JSX, or imports, and the sandbox withholds Node globals such as `require`, `setTimeout`, and `fetch`, redirecting filesystem, network, and process work to Cordis services.
184
- - **The vm and approval bounds belong to the runner** — see its [Known Limitations](../cordis-host-runner/README.md#known-limitations-and-deferred-work); an async host-half body escapes `vmTimeoutMs`.
71
+ - Client queries wait for a responding page or cancellation. Inspection cannot invoke service methods, configure plugins, or execute generated code.
185
72
 
186
73
  <a id="dev-note"></a>
187
74
  ### Dev Note
188
75
 
189
- <details>
190
- <summary>Working context for maintainers — click to expand</summary>
191
-
192
76
  None.
193
-
194
- </details>
195
-
196
- **Runtime invariant:** No companion is published. This model-facing adapter has no independent lifecycle stream; execution relations are owned by the capability seam it calls.
package/README.zh.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "面向 agent(智能体)与维护者的 Cordis 运行时工具说明,用于选择、组合或排查动态包工作流。"
2
+ description: "为开发和配置已安装 Harness 插件的 agent 提供只读运行时 API 查询。"
3
3
  kind: "package-reference"
4
4
  ---
5
5
 
@@ -9,7 +9,7 @@ kind: "package-reference"
9
9
 
10
10
  ## 概述
11
11
 
12
- `dsh-tool-cordis` 让模型检查实时 Cordis 运行时,并创建、运行、停止、更新或移除包含 host 代码、浏览器代码或两者的临时动态包。包版本不可变,因此包失败后,模型可以添加新版本并更新当前运行的版本。定义只存在于进程内存中,DSH 重启即消失;本包不写仓库文件、不安装依赖,也不改 `cordis.yml`。它还会把这套工作流教给模型。请与 `@deepseek-ai/dsh-cordis-host-runner` 一同组合,后者提供沙箱与运行往返。
12
+ 编写插件代码前查询 Host 和 Client 的运行时 API。创造模式同时提供这些只读工具与 Plugin Manager,后者负责持久化 profile 变更。检查注册表由 Cordis host runner 提供;浏览器查询需要已连接的页面。
13
13
 
14
14
  ## 目录
15
15
 
@@ -17,7 +17,7 @@ kind: "package-reference"
17
17
  - [理解实现](#understand-the-implementation)
18
18
  - [进一步探索](#further-exploration)
19
19
  - [模型体验](#model-experience)
20
- - [已知限制与延期工作](#known-limitations-and-deferred-work)
20
+ - [已知限制与待办](#known-limitations-and-deferred-work)
21
21
  - [开发备注](#dev-note)
22
22
 
23
23
  -----
@@ -25,38 +25,7 @@ kind: "package-reference"
25
25
  <a id="use-this-package"></a>
26
26
  ## 使用本包
27
27
 
28
- 当某个会话应当能临时扩展它自己的运行时——例如一个对当前工作有用、但不应成为仓库插件的模型编写的工具、服务或浏览器 UI——挂载本插件。请与 host runner 一同组合;没有 runner,这些工具永远不会激活,而且任何已发布的组合包都不会挂载这套工具集(web profile 已挂载 host runner 与浏览器侧组件),所以要显式地添加工具行。
29
-
30
- ### 最小组合
31
-
32
- ```yaml
33
- - name: '@deepseek-ai/dsh-cordis-host-runner'
34
- config:
35
- vmTimeoutMs: 5000
36
- - name: '@deepseek-ai/dsh-tool-cordis'
37
- ```
38
-
39
- CLI 示例 [`apps/cli/config/examples/cordis/cordis.yml`](../../../apps/cli/config/examples/cordis/cordis.yml) 同时组合了这两者。带浏览器半的包还额外需要客户端组合里的浏览器 runner 与 UI 包;纯 host 包则两者都不需要。
40
-
41
- ### 工具能做什么
42
-
43
- 三个检查工具只读;四个生命周期工具定义并管理包。所有结果都是渲染成文本的 JSON。
44
-
45
- - `cordis_inspect_list`——列出 Inspect Provider(host 与 client)及其查询方法。
46
- - `cordis_inspect_query`——执行一次提供方查询:精确的服务方法、事件模式、builtin 签名、工具 schema、主题 token 或实时 slot 树。
47
- - `cordis_inspect_self`——本会话的动态插件:版本指针、最近一次运行,以及(对某个精确包而言)源码与运行时诊断。
48
- - `cordis_define`——登记一个包:新插件(`plugin.kind: "new"`,配 3–6 个字母的 `idPrefix`),或既有插件的新版本(`plugin.kind: "existing"`,配其 `pluginId`)。它只校验参数与语法;不运行任何东西,也不请求审批。
49
- - `cordis_run`——激活一个包(首次激活或重启用 `mode: "run"`,切换版本用 `mode: "update"`)。带浏览器半的包可能先返回 `awaiting-approval`,直到有人允许;工具从不等待最终结果。
50
- - `cordis_stop`——停止当前运行并取消任何待审批请求,保留插件与全部包版本。
51
- - `cordis_undefine`——停止并彻底移除一个插件及其全部包。
52
-
53
- ### 典型工作流
54
-
55
- 先检查、再定义、后运行:`cordis_inspect_query` 读取包要用的服务或 slot 的精确约定,`cordis_define` 记录源码(会话里会出现一张 define 卡片,指向存放运行控件的面板),`cordis_run` 激活它。当用户输入 `@pluginId` 时,本包注入一条上下文消息,钉住所引用的插件、其基准包与更新路径。技术性失败之后,用 `cordis_inspect_self` 读取诊断,向同一插件追加修正版,再更新到该版本。
56
-
57
- ### 需要规划的边界
58
-
59
- 定义以会话为界、以进程为本:包只在定义它的会话里可见可控,可跨后续轮次保持活跃,运行时也可能影响同一进程中的其他会话。停止、移除、卸载工具集或重启 DSH 都会清除它。沙箱隔离全局变量,但不是安全边界——对待动态包要像对待 bash 访问一样,加载本插件时也要像授予 bash 工具那样慎重。
28
+ 创造模式包含这组工具。其他组合需要同时挂载 `@deepseek-ai/dsh-tool-cordis` 和提供 `cordisInspect` 的 host runner。调用 `cordis_inspect_list` 发现 provider,再用 `cordis_inspect_query` 查询其具体方法和类型。通过 [Plugin Manager](../../boot/plugin-manager/README.zh.md) 安装包含插件代码或 MCP 配置的组合包。
60
29
 
61
30
  -----
62
31
 
@@ -64,28 +33,9 @@ CLI 示例 [`apps/cli/config/examples/cordis/cordis.yml`](../../../apps/cli/conf
64
33
  ## 理解实现
65
34
 
66
35
  <details>
67
- <summary>实现细节——点击展开</summary>
68
-
69
- 本节解释工具背后的设计;可观察行为已在[使用本包](#use-this-package)中完整说明。
70
-
71
- ### 设计理念
72
-
73
- 工具集基于一项职责分离原则:工具是在 runner 服务之上面向模型的轻量层。检查数据来自生成的目录与实时服务存储的交集;定义与生命周期操作委托给 `ctx.dynamicCordisRunner`,它拥有注册表、vm 沙箱与浏览器往返。工具层负责面向模型作出判断:只展示可调用的方法、只列出 host 侧可访问的键,并且每次拒绝都会提供可指导模型采取行动的错误信息。
74
-
75
- ### 源码地图
36
+ <summary>实现细节 — 点击展开</summary>
76
37
 
77
- | 文件 | 职责 |
78
- |---|---|
79
- | [`src/index.ts`](src/index.ts) | 插件入口:工具注册、系统提示词章节、`@pluginId` 上下文注入 |
80
- | [`src/inspect.ts`](src/inspect.ts) | 报告渲染:把生成的 API 目录与实时服务存储相交 |
81
- | [`src/api-catalog.ts`](src/api-catalog.ts) | 工作区 Cordis 声明的生成投影(由 `pnpm run gen-cordis-api` 重新生成,`verify-cordis-api` 守其新鲜度) |
82
- | [`src/prompt.ts`](src/prompt.ts) | `tool:cordis` 系统提示词章节 |
83
- | [`src/providers.ts`](src/providers.ts) | 第一方 host Inspect Provider:Service、Event、Builtin、Tool |
84
- | [`src/present.ts`](src/present.ts) | 可安全回放的通用卡片渲染意图 |
85
-
86
- ### 一次调用的流程
87
-
88
- 检查调用查询 `ctx.cordisInspect`:host 提供方在本地执行,client 提供方等待第一个有效的页面应答。define 用与沙箱相同的包装器编译每一半来做语法预检,因此无法解析的代码在拿到 id 之前就被拒绝。run 委托给 runner:纯 host 包在进程内激活,带浏览器半的包挂起在 `cordis/request-run` 往返上;工具返回 runner 的回执(`awaiting-approval`、`starting` 或 `running`)。当用户写下 `@pluginId` 时,一个 `agent/pre-step` 处理器读取引用,并注入一条 user 角色的上下文消息,点明基准包与必须的后续步骤。
38
+ Host provider 结合生成的 Service/Event 目录与请求 agent 的工具注册表。Client provider 通过现有检查注册表同步清单,并从已连接页面回答查询。工具插件通过 Cordis effect 持有注册;释放时移除工具和提示词贡献。检查直接读取 provider,不维护独立运行时投影,因此不发布不变式配套插件。
89
39
 
90
40
  </details>
91
41
 
@@ -94,103 +44,33 @@ CLI 示例 [`apps/cli/config/examples/cordis/cordis.yml`](../../../apps/cli/conf
94
44
  <a id="further-exploration"></a>
95
45
  ## 进一步探索
96
46
 
97
- 当包级约定不够用时阅读以下页面。它们从共享工具集逐步进入 runner 内部、生成 schema 与子系统接口。
98
-
99
- - [Host runner](../cordis-host-runner/README.zh.md)——这些工具委托的注册表、沙箱与运行往返。
100
- - [Client runner](../cordis-client-runner/README.zh.md)——应答运行请求并装载浏览器半代码的浏览器半。
101
- - [UI 包](../ui-cordis/README.zh.md)——用户操作定义所用的面板与工具卡片。
102
- - [生成的工具目录](../../../docs/tool-catalog.zh.md#deepseek-aidsh-tool-cordis)——模型收到的确切 schema。
103
- - [extensions 子系统](../../../docs/subsystems/extensions.zh.md)——生成的 `ctx.cordisInspect` 与 `ctx.dynamicCordisRunner` API。
104
- - [自引用 Cordis 工具集 Agent Note](../../../.agents/notes/implemented/feature/2026-07-08-self-referential-cordis-toolset.zh.md)——设计居所:沙箱语义、动态包生命周期与组合。
105
-
106
- -----
47
+ - [Plugin Manager](../../boot/plugin-manager/README.zh.md) — 持久化组合包安装和启停。
48
+ - [Cordis host runner](../cordis-host-runner/README.zh.md) — 检查注册表和现有运行时消费者。
107
49
 
108
50
  <a id="model-experience"></a>
109
51
  ## 模型体验
110
52
 
111
- ### 工具 schema
112
-
113
- #### 模型看到的内容
114
-
115
- 该插件可见时,会话模型会看到生成的 [`cordis_inspect_list`、`cordis_inspect_query`、`cordis_inspect_self`、`cordis_define`、`cordis_run`、`cordis_stop` 和 `cordis_undefine` schema](../../../docs/tool-catalog.zh.md#deepseek-aidsh-tool-cordis)。
116
-
117
- #### Token 影响
118
-
119
- 该工具视图中的每次请求承担固定 schema 成本。
120
-
121
- #### KV Cache 影响
122
-
123
- 只要该工具视图不变,前缀就保持稳定。隐藏这些定义的 scope 或插件生命周期变更,可能使从第一个变化的 schema token 起的复用失效。
124
-
125
- ### 系统提示词章节
53
+ ### 运行时检查
126
54
 
127
- #### 模型看到的内容
55
+ #### 模型所见
128
56
 
129
- 本包注册一个系统提示词章节(`tool:cordis`,order 115),教模型何时以及如何使用动态包工作流、推荐的工具顺序与必须避免的高频错误;完整文本在 [`src/prompt.ts`](src/prompt.ts) 中。章节开头如下:
130
-
131
- ##### 章节开头
132
-
133
- ```markdown
134
- # Dynamic Cordis Plugins
135
-
136
- Dynamic Cordis plugins temporarily extend the current DSH process. A Plugin uses apply(ctx) to consume Services, listen to Events, provide Services, register model Tools, or register browser UI in Slots.
137
- ```
138
-
139
- #### Token 影响
140
-
141
- 该插件可见时,章节渲染出的文本会在每次请求中重复。
142
-
143
- #### KV Cache 影响
144
-
145
- 只要章节文本与顺序不变,前缀就保持稳定;编辑提示词或改变其顺序可能使从第一个变化 token 起的复用失效。
146
-
147
- ### 工具调用历史与结果
148
-
149
- #### 模型看到的内容
150
-
151
- 检查输出是渲染成文本的 JSON:`cordis_inspect_list` 返回提供方目录,`cordis_inspect_query` 返回查询数据,`cordis_inspect_self` 返回插件、版本与包摘要,并在指定精确包时给出源码与诊断。define 返回该包已定义但尚未运行,并给出用于运行的 id。run 返回 `awaiting-approval`、`starting` 或 `running`,附运行 id 与版本指针。stop 与 undefine 各返回一行确认信息。每一次拒绝都是携带 runner 教学文本的工具错误,提交的程序保留在 assistant 工具调用历史中。
152
-
153
- #### Token 影响
154
-
155
- 检查输出与提交的包代码取决于数据,并在压缩(compaction)前重复发送;生命周期确认文本很短。
156
-
157
- #### KV Cache 影响
158
-
159
- 仅追加;新可见内容位于可复用请求前缀之后,不会使现有 KV Cache 条目失效。
160
-
161
- ### cordis_run 之后的后续请求
162
-
163
- #### 模型看到的内容
164
-
165
- 运行中的包可能注册工具、提示词贡献或监听器,改变其目标 scope 的后续请求;`cordis_stop` 与 `cordis_undefine` 会在完全停稳后移除这些贡献。当用户输入 `@pluginId` 时,注入的引用上下文还会增加一条 user 角色的消息,点明基准包与后续步骤。
57
+ [工具目录](../../../docs/tool-catalog.zh.md#deepseek-aidsh-tool-cordis) 描述两个只读检查工具。[提示词](src/prompt.ts) 指引模型通过 Plugin Manager 进行持久化变更并说明 MCP 设置方式。创造模式的视觉请求默认通过已安装的 UI 插件显示在当前 Web 页面;开发技能说明 Client 打包和 slot 注册方法。查询结果包含所请求的 API 声明或当前工具 schema。
166
58
 
167
59
  #### Token 影响
168
60
 
169
- 间接 token 影响等于运行中包的贡献,且只在其进程内生命周期内持续。
61
+ 插件可见时,两个工具 schema 和指导段落进入模型请求。查询结果追加到转录中;精确查询避免加载无关声明。
170
62
 
171
63
  #### KV Cache 影响
172
64
 
173
- 运行或停止提示词/工具贡献会改变后续请求前缀,并可能使从第一个变化的贡献起的复用失效;运行集合不变时,前缀保持稳定。
65
+ 未改变的 schema 和指导保持前缀稳定。查询结果追加到历史中;启用其他插件可能改变后续工具 schema。
174
66
 
175
- ## 已知限制与延期工作
67
+ ## 已知限制与待办
176
68
 
177
69
  <a id="known-limitations-and-deferred-work"></a>
178
70
 
179
-
180
- 这些限制说明工具集何时不合适或需要特别小心。它们是当前包约束,不是任务积压。
181
-
182
- - **沙箱只用于约束诚实代码,并非安全边界**——可以触及沙箱全局变量上的 host realm helper,因此包代码可以触达 Node;加载本插件时,应当像授予 bash 工具一样慎重。
183
- - **只支持纯 JavaScript**——动态包代码不做任何转换:没有 TypeScript、JSX 或 import,沙箱还不提供 `require`、`setTimeout`、`fetch` 等 Node 全局变量,把文件、网络与进程工作重定向到 Cordis 服务。
184
- - **vm 与审批边界属于 runner**——见它的[已知限制](../cordis-host-runner/README.zh.md#known-limitations-and-deferred-work);async 的 host 半主体可逃出 `vmTimeoutMs`。
71
+ - Client 查询等待页面响应或取消。检查不能调用服务方法、配置插件或执行生成代码。
185
72
 
186
73
  <a id="dev-note"></a>
187
74
  ### 开发备注
188
75
 
189
- <details>
190
- <summary>维护者的工作上下文——点击展开</summary>
191
-
192
76
  无。
193
-
194
- </details>
195
-
196
- **运行时不变式:** 不发布伴生入口。这个面向模型的适配器没有独立 lifecycle stream;执行关系由它调用的能力 seam 负责。