dsh-plugin-dev-kb 1.0.8 → 1.0.9
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/CHANGELOG.md +11 -0
- package/README.en.md +6 -6
- package/README.md +6 -6
- package/kb/INDEX.md +19 -5
- package/kb/README.md +11 -10
- package/kb/extra/AGENTS.md +4 -4
- package/kb/extra/cookbook/adding-a-vendored-package.md +2 -2
- package/kb/extra/cookbook/adding-a-vendored-package.zh.md +2 -2
- package/kb/extra/deepseek-llm-api-wire-extensions.md +159 -0
- package/kb/extra/deepseek-llm-api-wire-extensions.zh.md +159 -0
- package/kb/extra/development.md +8 -14
- package/kb/extra/development.zh.md +8 -14
- package/kb/extra/event-producer-consumer.md +47 -41
- package/kb/extra/event-producer-consumer.zh.md +47 -41
- package/kb/extra/glossary.md +1 -1
- package/kb/extra/glossary.zh.md +1 -1
- package/kb/extra/graph-atlas.md +0 -2
- package/kb/extra/graph-atlas.zh.md +0 -2
- package/kb/extra/i18n/README.md +4 -4
- package/kb/extra/i18n/README.zh.md +4 -4
- package/kb/extra/module-graph.md +680 -413
- package/kb/extra/module-graph.zh.md +681 -414
- package/kb/extra/postmortem/0001-acp-default-export-drops-inject.md +2 -2
- package/kb/extra/postmortem/0001-acp-default-export-drops-inject.zh.md +2 -2
- package/kb/extra/postmortem/0002-js-expression-disabled-filesystem-tools.md +2 -2
- package/kb/extra/postmortem/0002-js-expression-disabled-filesystem-tools.zh.md +2 -2
- package/kb/extra/postmortem/0003-web-agent-gui-feedback-loop.md +2 -2
- package/kb/extra/postmortem/0003-web-agent-gui-feedback-loop.zh.md +2 -2
- package/kb/extra/postmortem/0004-landlock-partial-notice-misclassified-child-failures.md +1 -1
- package/kb/extra/postmortem/0004-landlock-partial-notice-misclassified-child-failures.zh.md +1 -1
- package/kb/extra/rescope.md +2 -2
- package/kb/extra/rescope.zh.md +2 -2
- package/kb/extra/subsystems/agent-team.md +24 -1
- package/kb/extra/subsystems/agent-team.zh.md +24 -1
- package/kb/extra/subsystems/attachment.md +12 -4
- package/kb/extra/subsystems/attachment.zh.md +12 -4
- package/kb/extra/subsystems/extensions.md +18 -0
- package/kb/extra/subsystems/extensions.zh.md +18 -0
- package/kb/extra/subsystems/feedback.md +2 -2
- package/kb/extra/subsystems/feedback.zh.md +2 -2
- package/kb/extra/subsystems/todo.md +32 -0
- package/kb/extra/subsystems/todo.zh.md +32 -0
- package/kb/extra/subsystems/webhook.md +70 -0
- package/kb/extra/subsystems/webhook.zh.md +70 -0
- package/kb/extra/testing.md +11 -10
- package/kb/extra/testing.zh.md +8 -7
- package/kb/meta/search-index.json +269 -161
- package/kb/meta/site-pages.txt +182 -168
- package/kb/meta/source.json +5 -5
- package/kb/meta/topics.md +14 -6
- package/kb/site/develop/basic/publish.md +2 -2
- package/kb/site/develop/basic/tool.md +1 -1
- package/kb/site/develop/cordis-tutorial/07-into-the-harness.md +4 -4
- package/kb/site/develop/framework/events.md +1 -1
- package/kb/site/develop/practice/dynamic-cordis.md +17 -0
- package/kb/site/develop/practice/llm-adapter.md +3 -3
- package/kb/site/en/develop/basic/publish.md +2 -2
- package/kb/site/en/develop/basic/tool.md +1 -1
- package/kb/site/en/develop/cordis-tutorial/07-into-the-harness.md +4 -4
- package/kb/site/en/develop/framework/events.md +1 -1
- package/kb/site/en/develop/practice/dynamic-cordis.md +17 -0
- package/kb/site/en/develop/practice/llm-adapter.md +3 -3
- package/kb/site/en/guide/github-review.md +104 -0
- package/kb/site/en/guide/mcp-memory.md +103 -0
- package/kb/site/en/guide/python-sdk.md +80 -34
- package/kb/site/en/guide/schedule.md +21 -0
- package/kb/site/en/reference/agent-lifecycle.md +1 -1
- package/kb/{extra → site/en/reference}/api-gateway.md +11 -9
- package/kb/site/en/reference/capability-seams.md +115 -67
- package/kb/site/en/reference/config-catalog.md +358 -164
- package/kb/site/en/reference/cookbook/adding-a-package.md +2 -2
- package/kb/site/en/reference/cookbook/adding-a-settings-card.md +2 -2
- package/kb/site/en/reference/cookbook/adding-a-tool.md +11 -4
- package/kb/site/en/reference/cookbook/adding-an-llm-adapter.md +1 -1
- package/kb/site/en/reference/cookbook/extension-cookbook.md +6 -6
- package/kb/site/en/reference/cordis-api/inherited.md +1 -1
- package/kb/site/en/reference/cordis-primer.md +2 -1
- package/kb/site/en/reference/index.md +19 -7
- package/kb/site/en/reference/persistence-catalog.md +91 -44
- package/kb/site/en/reference/subsystems/approval.md +10 -10
- package/kb/site/en/reference/subsystems/client-modules.md +58 -16
- package/kb/site/en/reference/subsystems/code-runtime.md +3 -3
- package/kb/site/en/reference/subsystems/compaction.md +2 -2
- package/kb/site/en/reference/{cookbook/adding-a-conversation-node.md → subsystems/conversation.md} +43 -24
- package/kb/site/en/reference/subsystems/core.md +70 -12
- package/kb/site/en/reference/subsystems/credentials.md +43 -3
- package/kb/site/en/reference/subsystems/filesystem.md +12 -2
- package/kb/site/en/reference/subsystems/index.md +6 -1
- package/kb/site/en/reference/subsystems/jobs.md +1 -1
- package/kb/site/en/reference/subsystems/llm-streaming.md +132 -11
- package/kb/site/en/reference/subsystems/permission-presets.md +1 -1
- package/kb/site/en/reference/subsystems/persistence.md +22 -3
- package/kb/site/en/reference/subsystems/plan.md +1 -1
- package/kb/site/en/reference/subsystems/session-projection.md +74 -33
- package/kb/site/en/reference/subsystems/session-query.md +9 -1
- package/kb/site/en/reference/subsystems/session-reference.md +28 -7
- package/kb/site/en/reference/subsystems/session-telemetry.md +2 -3
- package/kb/site/en/reference/subsystems/session.md +260 -41
- package/kb/site/en/reference/subsystems/settings.md +78 -1
- package/kb/site/en/reference/subsystems/skills.md +23 -0
- package/kb/site/en/reference/subsystems/slots.md +177 -0
- package/kb/site/en/reference/subsystems/spill.md +2 -2
- package/kb/site/en/reference/subsystems/storage.md +9 -1
- package/kb/site/en/reference/subsystems/subagent.md +90 -23
- package/kb/site/en/reference/subsystems/system-prompt.md +4 -4
- package/kb/site/en/reference/subsystems/token-meter.md +25 -10
- package/kb/site/en/reference/subsystems/tools.md +39 -39
- package/kb/site/en/reference/subsystems/typert.md +44 -37
- package/kb/site/en/reference/subsystems/user-questions.md +33 -33
- package/kb/site/en/reference/subsystems/web-client.md +98 -0
- package/kb/site/en/reference/subsystems/web-server.md +11 -5
- package/kb/site/en/reference/subsystems/web.md +7 -1
- package/kb/site/en/reference/subsystems/workspace.md +95 -2
- package/kb/site/en/reference/tool-catalog.md +76 -18
- package/kb/site/en/reference/tool-execution-pipeline.md +1 -1
- package/kb/site/guide/github-review.md +104 -0
- package/kb/site/guide/mcp-memory.md +103 -0
- package/kb/site/guide/python-sdk.md +87 -41
- package/kb/site/guide/schedule.md +21 -0
- package/kb/site/reference/agent-lifecycle.md +1 -1
- package/kb/{extra/api-gateway.zh.md → site/reference/api-gateway.md} +11 -9
- package/kb/site/reference/capability-seams.md +115 -67
- package/kb/site/reference/config-catalog.md +357 -163
- package/kb/site/reference/cookbook/adding-a-package.md +2 -2
- package/kb/site/reference/cookbook/adding-a-settings-card.md +2 -2
- package/kb/site/reference/cookbook/adding-a-tool.md +11 -4
- package/kb/site/reference/cookbook/adding-an-llm-adapter.md +1 -1
- package/kb/site/reference/cookbook/extension-cookbook.md +6 -6
- package/kb/site/reference/cordis-api/inherited.md +1 -1
- package/kb/site/reference/cordis-primer.md +2 -1
- package/kb/site/reference/index.md +19 -7
- package/kb/site/reference/persistence-catalog.md +87 -40
- package/kb/site/reference/subsystems/approval.md +10 -10
- package/kb/site/reference/subsystems/client-modules.md +58 -16
- package/kb/site/reference/subsystems/code-runtime.md +3 -3
- package/kb/site/reference/subsystems/compaction.md +2 -2
- package/kb/site/reference/{cookbook/adding-a-conversation-node.md → subsystems/conversation.md} +43 -24
- package/kb/site/reference/subsystems/core.md +70 -12
- package/kb/site/reference/subsystems/credentials.md +43 -3
- package/kb/site/reference/subsystems/filesystem.md +12 -2
- package/kb/site/reference/subsystems/index.md +6 -1
- package/kb/site/reference/subsystems/jobs.md +1 -1
- package/kb/site/reference/subsystems/llm-streaming.md +132 -11
- package/kb/site/reference/subsystems/persistence.md +22 -3
- package/kb/site/reference/subsystems/plan.md +1 -1
- package/kb/site/reference/subsystems/session-projection.md +74 -33
- package/kb/site/reference/subsystems/session-query.md +9 -1
- package/kb/site/reference/subsystems/session-reference.md +28 -7
- package/kb/site/reference/subsystems/session-telemetry.md +2 -3
- package/kb/site/reference/subsystems/session.md +260 -41
- package/kb/site/reference/subsystems/settings.md +78 -1
- package/kb/site/reference/subsystems/skills.md +23 -0
- package/kb/site/reference/subsystems/slots.md +177 -0
- package/kb/site/reference/subsystems/spill.md +2 -2
- package/kb/site/reference/subsystems/storage.md +9 -1
- package/kb/site/reference/subsystems/subagent.md +90 -23
- package/kb/site/reference/subsystems/system-prompt.md +4 -4
- package/kb/site/reference/subsystems/token-meter.md +25 -10
- package/kb/site/reference/subsystems/tools.md +39 -39
- package/kb/site/reference/subsystems/typert.md +44 -37
- package/kb/site/reference/subsystems/user-questions.md +33 -33
- package/kb/site/reference/subsystems/web-client.md +98 -0
- package/kb/site/reference/subsystems/web-server.md +11 -5
- package/kb/site/reference/subsystems/web.md +7 -1
- package/kb/site/reference/subsystems/workspace.md +95 -2
- package/kb/site/reference/tool-catalog.md +76 -18
- package/kb/site/reference/tool-execution-pipeline.md +1 -1
- package/package.json +2 -2
- package/skills/dsh-plugin-dev-kb.md +8 -6
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
---
|
|
2
|
+
editSource: "docs/subsystems/slots.zh.md"
|
|
3
|
+
outline: [2,3]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Web Client Slots
|
|
7
|
+
|
|
8
|
+
Slots 是 Web Client 的类型化 React 组合系统。[`dsh-client-ui-slots`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/client/ui-slots/README.zh.md)定义不依赖 React 的注册表与类型代数;[`dsh-client-ui-renderer`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/client/ui-renderer/README.zh.md)把可观测源绑定成钩子、渲染整棵树,并在内部拥有 React context。功能插件通过 `ctx.slots.register()` 贡献 UI,绝不导入其他功能插件的组件。
|
|
9
|
+
|
|
10
|
+
本文记录 slot 的所有权、组件输入、扩展 API 与当前层级。外围的启动、Remote、Client model 与 Conversation 数据通路见 [Web Client 架构](./web-client.md)。
|
|
11
|
+
|
|
12
|
+
## 声明与生命周期
|
|
13
|
+
|
|
14
|
+
`SlotMap` 是编译期注册表。包通过声明合并写入 key、cardinality(基数)、scope、owner props、keyed props 与可选的 slot 级 inject face。运行时声明则是拥有该渲染位置的组件在 `children` 中给出的对应条目。
|
|
15
|
+
|
|
16
|
+
声明一个 child 会同时产生三种效果:令该 child key 生效、授权 parent entry 调用 `renderSlot` 或 `renderSlotChain`,以及记录运行时 dispatch 规格。每个声明只能有一个存活 owner。向未声明 slot 注册,或重复声明其他 entry 已拥有的 child,都会在插件激活时失败。
|
|
17
|
+
|
|
18
|
+
`root` 是唯一内建声明,也是唯一由 Cordis service 自身渲染的 key。`ui-renderer` 调用 `ctx.slots.renderSlot('root', {})`;其余每个后代都通过声明它的 entry 所收到的 `renderSlot` 或 `renderSlotChain` prop 渲染。
|
|
19
|
+
|
|
20
|
+
注册和声明遵循 Cordis effect 生命周期。销毁一个 entry 会移除其贡献,并递归折叠它声明的 child slots。因此,向其他包的 slot 贡献功能时使用 `ctx.slots.inject(key, callback)`:callback 会在每段声明生命周期内运行,owner 折叠时其 effect 随之移除,owner 再次挂载时则重新运行。
|
|
21
|
+
|
|
22
|
+
```tsx ignore-check
|
|
23
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
24
|
+
import type {} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
25
|
+
import type {} from '@deepseek-ai/dsh-client-ui-session/client'
|
|
26
|
+
import type { PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
|
|
27
|
+
|
|
28
|
+
type HeaderActionProps = PropsRuntime<'conversation.session.header.actions'>
|
|
29
|
+
|
|
30
|
+
function HeaderAction({ useSession }: HeaderActionProps) {
|
|
31
|
+
const running = useSession(snapshot => snapshot.running)
|
|
32
|
+
return <button disabled={running}>Review</button>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const inject = ['slots']
|
|
36
|
+
|
|
37
|
+
export function apply(ctx: Context): void {
|
|
38
|
+
ctx.slots.inject('conversation.session.header.actions', () =>
|
|
39
|
+
ctx.slots.register({
|
|
40
|
+
name: 'conversation.session.header.actions',
|
|
41
|
+
id: 'review',
|
|
42
|
+
order: 100,
|
|
43
|
+
}, HeaderAction))
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Cardinality 与 scope
|
|
48
|
+
|
|
49
|
+
Slot 声明固定两个相互独立的维度。
|
|
50
|
+
|
|
51
|
+
| 维度 | 值 | 含义 |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| cardinality | `single` | 单个 cell,渲染当前 priority 胜者;需要并列内容时应声明 child slot,而不是把它当作列表。 |
|
|
54
|
+
| cardinality | `list` | cell 由必填 `id` 定址,先按 `order`、再按注册顺序排列。 |
|
|
55
|
+
| cardinality | `keyed` | owner 传入 `entryKey`;匹配 cell 以该 key 对应的 props 渲染。 |
|
|
56
|
+
| cardinality | `chain` | 每个 entry 提供纯 `select(owner)` 函数;按 priority 顺序遇到的第一个非 null 结果获选,并以 `matched` 传给组件;全部拒绝时渲染 owner fallback。 |
|
|
57
|
+
| scope | `root` | 一个 root 作用域组件和 store 实例。 |
|
|
58
|
+
| scope | `session-maybe` | 跟随当前选择,但没有 Session 时仍可渲染;Session 值是可选的。 |
|
|
59
|
+
| scope | `session` | 要求可解析的 Session binding,并收到确定存在的 Session 值。 |
|
|
60
|
+
|
|
61
|
+
对于 `single`、`list` 和 `keyed` cell,`priority` 是遮蔽优先级;对于 `chain`,它是选举顺序。数值越小越先运行或渲染。普通增量贡献应选用新的 list `id` 或 keyed `key`;复用已有 cell 表示有意替换其展示。
|
|
62
|
+
|
|
63
|
+
## 组件输入
|
|
64
|
+
|
|
65
|
+
注册组件会在 binding 位置收到组装后的输入。组件应从这些类型推导 props,不要重新抄写成员。
|
|
66
|
+
|
|
67
|
+
| 输入 | 声明者 | 组件类型 |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| owner 值与标准 scope 值 | `SlotMap` 条目与已安装的 scope adapter | `PropsRuntime<K>` |
|
|
70
|
+
| 获授权的 child renderer | 注册项的 `children` keys | `PropsRenderSlots<S>` |
|
|
71
|
+
| 共享视图状态的 selector hook 与 mutation callback | 注册项的 `store` | `PropsStore<H>` |
|
|
72
|
+
| 私有数据、callback 与 observable hook | 注册项的 `inject` factory | `InjectFace<I>` |
|
|
73
|
+
| 本地化 `t` 函数 | 注册项的 `locale` namespace | `PropsLocale<N>` |
|
|
74
|
+
| chain 选中的值 | 注册项的 `select` 结果 | 通过 `ComposedProps` 提供的 `matched` |
|
|
75
|
+
|
|
76
|
+
当 entry 声明 strict Session child 时,`PropsRenderSlots` 还会提供 `SessionProvider`。它把子树绑定到当前 Session identity,并在 identity 改变时重新挂载 body。
|
|
77
|
+
|
|
78
|
+
组件绝不会收到 `ctx`。父组件在某次渲染时已经知道的值通过 `renderSlot` 的 owner 参数进入;共享视图状态使用声明的 store;service 与 model object 留在 `apply` closure 中,只向组件投影 callback 或 observable source。
|
|
79
|
+
|
|
80
|
+
## 框架提供的 hooks
|
|
81
|
+
|
|
82
|
+
当前组合中的 adapter 会添加以下标准 props。它们按目标 slot 的 scope 提供,与注册组件来自哪个包无关。
|
|
83
|
+
|
|
84
|
+
| 可用范围 | Props | Owner |
|
|
85
|
+
|---|---|---|
|
|
86
|
+
| 所有 scope | `useSessions`、`useSessionPendingInteraction` | `ui-session` |
|
|
87
|
+
| 所有 scope | `useWorkspaces` | `ui-workspace` |
|
|
88
|
+
| `session` | `sessionId`、`useSession`、`useProjection` | `ui-session` |
|
|
89
|
+
| `session-maybe` | 结果可选的 `sessionId`、`useSession`、`useProjection` | `ui-session` |
|
|
90
|
+
| `session` | `useConversation`、`useInput`、`inputActions` | `ui-conversation` |
|
|
91
|
+
| `session-maybe` | 结果可选的 `useConversation`、`useInput`、`inputActions` | `ui-conversation` |
|
|
92
|
+
| `session` | `useChat` | `ui-chat` |
|
|
93
|
+
| `session` | `useTrajectory` | `ui-trajectory` |
|
|
94
|
+
|
|
95
|
+
Renderer 还会根据声明的 store 创建 `useStore`,并根据声明的 locale namespace 创建 `t`。这些是由注册项推导的 props,不属于全局标准 props。
|
|
96
|
+
|
|
97
|
+
框架与领域 adapter owner 可以通过 `ctx.slots.provideRoot()` 或 `ctx.uiSession.provide()` 扩展标准集合,同时提供对应的 `GlobalStandardProps`、`SessionStandardProps` 或 `SessionMaybeStandardProps` 声明合并。普通功能组件不应自行创建 React hook prop,也不应为 entry 私有数据添加全局标准 prop。
|
|
98
|
+
|
|
99
|
+
## 开发者提供的 injection
|
|
100
|
+
|
|
101
|
+
注册项的 `inject` 选项是通常使用的功能私有注入点。它的 factory 在插件的 `apply` 世界中运行,可以闭包捕获已经注入的 Cordis service,并且只返回组件所需的数据与 callback。对于 `session` slot,它会收到 `sessionId`;对于 `session-maybe`,它收到 `sessionId | undefined`;声明 store 后,它还会收到该 store 绑定后的 actions。
|
|
102
|
+
|
|
103
|
+
返回值中保留的 `hooks` 对象接收裸 `getSnapshot`/`subscribe` source。Renderer 把 `hooks: { status }` 转换为组件 prop `useStatus(selector)`,并按 source identity 缓存绑定。组件不会收到 source 本身,也不直接调用 `useSyncExternalStore`。
|
|
104
|
+
|
|
105
|
+
当每个 occupant 都需要同一种能力时,slot owner 可以在 child 声明里放置 `inject` face。普通成员会原样交给所有 occupant;其 `hooks` 对象中的函数成员是 hook factory,它会收到 slot 的标准 props 与可选的逐次渲染 `hookContext`,再返回提供给 occupant 的受限 hook。`conversation.chat.node` 正是通过这种机制,为当前渲染的 node 提供 `useTurnData(key)`。
|
|
106
|
+
|
|
107
|
+
一次渲染时 owner 已知的值走 owner props;单个 entry 的 callback 与私有 observable 走注册项 `inject`;由 slot owner 控制、所有 occupant 共享的能力走 slot 级 `inject`;需要跨 entry 共享或跨重新挂载保留的可变视图状态走声明的 store。React node 通过 child slot 组合,不通过注入值传递。
|
|
108
|
+
|
|
109
|
+
## 当前层级
|
|
110
|
+
|
|
111
|
+
下图是当前发布组合的声明树。只有具名 parent entry 已挂载时,其 child 才存在;因此可选功能 entry 可以作为一个生命周期单元让整棵子树出现或消失。
|
|
112
|
+
|
|
113
|
+
```text
|
|
114
|
+
root
|
|
115
|
+
├─ sidebar
|
|
116
|
+
│ ├─ sidebar.brand.mark
|
|
117
|
+
│ ├─ sidebar.brand.name
|
|
118
|
+
│ ├─ sidebar.footer.action
|
|
119
|
+
│ ├─ sidebar.workspaces
|
|
120
|
+
│ │ └─ sidebar.workspaces.directoryFlow
|
|
121
|
+
│ └─ sidebar.settings
|
|
122
|
+
│ ├─ settings.trigger
|
|
123
|
+
│ ├─ settings.header
|
|
124
|
+
│ ├─ settings.action
|
|
125
|
+
│ ├─ settings.close
|
|
126
|
+
│ ├─ settings.onboarding
|
|
127
|
+
│ └─ settings.section
|
|
128
|
+
│ ├─ settings.general.item
|
|
129
|
+
│ ├─ settings.models.provider-card
|
|
130
|
+
│ ├─ settings.models.footer
|
|
131
|
+
│ └─ settings.plugins.tab
|
|
132
|
+
│ └─ settings.plugin.item
|
|
133
|
+
├─ conversation
|
|
134
|
+
│ ├─ conversation.session
|
|
135
|
+
│ │ └─ conversation.view
|
|
136
|
+
│ │ ├─ conversation.chat.node
|
|
137
|
+
│ │ │ ├─ conversation.chat.assistant-actions
|
|
138
|
+
│ │ │ ├─ conversation.chat.commandview
|
|
139
|
+
│ │ │ ├─ conversation.chat.turnTail
|
|
140
|
+
│ │ │ └─ tool.call.toolview
|
|
141
|
+
│ │ │ └─ tool.view.cordis
|
|
142
|
+
│ │ ├─ conversation.message.images
|
|
143
|
+
│ │ └─ conversation.trajectory.images
|
|
144
|
+
│ ├─ conversation.session.header
|
|
145
|
+
│ │ ├─ conversation.session.header.lineage
|
|
146
|
+
│ │ ├─ conversation.session.header.actions
|
|
147
|
+
│ │ └─ conversation.session.header.utilities
|
|
148
|
+
│ ├─ conversation.composer
|
|
149
|
+
│ │ └─ conversation.approval.detail
|
|
150
|
+
│ ├─ conversation.composer.bar
|
|
151
|
+
│ │ ├─ conversation.input.attachments
|
|
152
|
+
│ │ ├─ conversation.input.plan
|
|
153
|
+
│ │ └─ conversation.input.model
|
|
154
|
+
│ ├─ conversation.input.overlay
|
|
155
|
+
│ ├─ conversation.input.dock
|
|
156
|
+
│ ├─ conversation.composer.dock
|
|
157
|
+
│ ├─ conversation.input.left
|
|
158
|
+
│ ├─ conversation.input.right
|
|
159
|
+
│ ├─ conversation.hero.brand.mark
|
|
160
|
+
│ ├─ conversation.hero.workspace
|
|
161
|
+
│ │ └─ conversation.hero.workspace.directoryFlow
|
|
162
|
+
│ └─ conversation.hero.agentPreset
|
|
163
|
+
├─ details
|
|
164
|
+
│ └─ conversation.details.tool
|
|
165
|
+
└─ shell.overlay
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
生成的 Client inspect catalog 是每个 key 的完整参考,包含 cardinality、scope、owner props、标准 props、当前 occupant、声明 owner 与替换风险。运行中的动态包可以用 `cordis_inspect what:"client"` 查询实时树与某个精确 key;源码 catalog 由 `pnpm run gen-client-catalog` 根据 `SlotMap` 声明和 `slots.register()` 调用点生成。
|
|
169
|
+
|
|
170
|
+
## 扩展规则
|
|
171
|
+
|
|
172
|
+
- 另一个功能包只能通过 `import type` 引入声明;绝不导入或转发它的运行时值。
|
|
173
|
+
- 只在拥有并渲染某个位置的组件中声明新的 child slot。其他包通过 `ctx.slots.inject()` 等待,再通过 `ctx.slots.register()` 贡献内容。
|
|
174
|
+
- 业务与传输状态留在所属 Cordis service 或 Client model 中。Slot store 只承载共享的视图与交互状态。
|
|
175
|
+
- 可观测 source 及其 snapshot identity 在值变化前保持稳定;值变化时通过同一个 source 发布。
|
|
176
|
+
- UI domain 之间只传 JSON 兼容数据和 callback。`hooks` compartment 是裸 observable 的唯一例外;React 内容通过 slot 传递。
|
|
177
|
+
- 将 `single` 和已有 occupant 的 keyed cell 视为替换点。增量扩展使用 list id 或尚未占用的 key。
|
|
@@ -41,7 +41,7 @@ interface SpillOwner {
|
|
|
41
41
|
}
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
保留期清理可以连同其他旧会话产物一起使旧定位符失效;spill seam 不定义逐会话的清理策略。
|
|
45
45
|
|
|
46
46
|
```ts type-equiv
|
|
47
47
|
/**
|
|
@@ -53,7 +53,7 @@ interface SpillSource {
|
|
|
53
53
|
/** The tool whose result was spilled (e.g. `web_fetch`). */
|
|
54
54
|
toolName: string
|
|
55
55
|
/** The model-issued call id the result belongs to. */
|
|
56
|
-
callId:
|
|
56
|
+
callId: ToolCallId
|
|
57
57
|
/** A short human label for the artifact (e.g. `result`). */
|
|
58
58
|
label: string
|
|
59
59
|
}
|
|
@@ -47,7 +47,7 @@ interface StorageBackend {
|
|
|
47
47
|
}
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
一个后端拥有一个介质(一棵文件树的根目录、一个数据库文件),并提供可选的操作组;`kv` 是唯一已交付的操作组。`KvFacet.open(descriptor)` 打开一个具名 unit——`KvUnitDescriptor` 携带名称、格式版本、表名清单,以及是否存在全局单例 slot——并返回提供 `loadAll`、`putRecord`、`deleteRecord`、`setGlobal` 和 `close` 的 `KvUnit`。unit 名与表名必须匹配 `UNIT_NAME_RE`(既可安全用作文件名,也可安全用作 SQL 标识符片段);记录键是任意字符串,绝不进入文件路径。unit 不对并发写入做串行化——顺序由调用方负责——但每次单独调用在介质上都是原子的,且 resolve 后即已持久。介质上记录的版本与之不同时拒绝 `version-mismatch`;无法按该 unit 解析的介质拒绝 `malformed-medium`(不做迁移:预发布立场)。[`backend.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/storage/storage/src/backend.ts) 是逐条款的规范性约定,[`tests/contract.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/storage/storage/tests/contract.ts) 中的共享一致性套件会针对每个后端检查每项条款。[json 后端](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/storage/storage-json/README.zh.md)以原子方式为每个 unit 整文件重新发布一份人类可读文件;[sqlite 后端](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/storage/storage-sqlite/README.zh.md)在单个数据库中每行存储一份文档,用于频繁更新的数据。
|
|
51
51
|
|
|
52
52
|
## 声明领域
|
|
53
53
|
|
|
@@ -60,6 +60,14 @@ interface DomainSpec {
|
|
|
60
60
|
readonly name: string
|
|
61
61
|
/** Domain format version; a medium stamped with a different version rejects at open. */
|
|
62
62
|
readonly version: number
|
|
63
|
+
/**
|
|
64
|
+
* Medium layout for the backend unit: `single` (the default) stores the
|
|
65
|
+
* whole unit as one document; `per-record` stores each record as its own
|
|
66
|
+
* document, for units whose records are large, sparse, or individually
|
|
67
|
+
* disposable — the projection cache — and scopes version bumps per record
|
|
68
|
+
* (a stale record document is discarded, never migrated).
|
|
69
|
+
*/
|
|
70
|
+
readonly layout?: 'single' | 'per-record'
|
|
63
71
|
/** Optional global singleton slot. */
|
|
64
72
|
readonly global?: DomainGlobalSpec<unknown>
|
|
65
73
|
/** Table declarations keyed by table name; each name must match `UNIT_NAME_RE`. */
|
|
@@ -7,7 +7,7 @@ outline: [2,3]
|
|
|
7
7
|
|
|
8
8
|
subagent seam 让一个 agent(智能体)将工作委派给子 agent。与 [bash](./shell.md) 一样,它是**一项可选能力**,不属于 agent loop(智能体循环),因此其类型定义在此而非 [core.md](./core.md) 中。它不同于其他能力 seam,因为**同一上下文中可共存多个提供方实现**,并按名称注册(`ctx.subagents`),而 bash 只允许一个执行器。该注册表遵循 [LLM(大语言模型)适配器注册表](./llm-streaming.md),而非单服务的 bash 执行器。
|
|
9
9
|
|
|
10
|
-
Service Definition:[dsh-subagent](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/subagent/subagent)(`ctx.subagents` + 下文词汇)。Service Provider 是六个兄弟包:`dsh-subagent-spawn-in-process
|
|
10
|
+
Service Definition:[dsh-subagent](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/subagent/subagent)(`ctx.subagents` + 下文词汇)。Service Provider 是六个兄弟包:`dsh-subagent-spawn-in-process`、`dsh-subagent-fork-in-process`、`dsh-subagent-acp`、`dsh-subagent-codex`、`dsh-subagent-claude-code`、`dsh-subagent-dsh-sdk`;面向模型的 Consumer 包括 [dsh-tool-subagent](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/subagent/tool-subagent)(按提供方委派)、[dsh-tool-subagent-control](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/subagent/tool-subagent-control)(可选的全局 `send_message`、`interrupt_agent` 与 `list_agents` 控制工具)和 [dsh-tool-subagent-report](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/subagent/tool-subagent-report)(可选的 child 作用域 `report` 返回通道)。同一个 `ctx.subagents` 服务通过内部激活管理器负责可继续子 agent 编排,并直接基于会话存储和可选的会话持久化提供只读的 child 与后代发现。产品提供方设计理由见 [Codex 与 Claude Code Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/feature/2026-08-04-claude-code-and-codex-subagent-backends.zh.md);通用 seam 的设计理由见 [subagent Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/feature/2026-06-21-subagent-capability-seam.zh.md)、[可继续 subagent Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/feature/2026-07-28-continuable-subagent-conversations.zh.md)、[report 工具 Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/feature/2026-07-30-continuable-subagent-report-tool.zh.md)、[持久化目录 Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/feature/2026-07-22-durable-subagent-catalog-and-list-agents.zh.md)、[列表身份投影 Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/architecture/2026-08-06-subagent-list-identity-projection.zh.md)和[服务合并 Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/simplification/2026-07-26-merge-subagent-control-service.zh.md)。
|
|
11
11
|
|
|
12
12
|
源码:[`packages/subagent/subagent/src/types.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/subagent/subagent/src/types.ts)、[`packages/subagent/subagent/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/subagent/subagent/src/index.ts)和 [`packages/subagent/subagent/src/continuation.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/subagent/subagent/src/continuation.ts)
|
|
13
13
|
|
|
@@ -28,6 +28,7 @@ Service Definition:[dsh-subagent](https://github.com/deepseek-ai/deepseek-harn
|
|
|
28
28
|
* to `maxDepth`; the other names match.
|
|
29
29
|
*/
|
|
30
30
|
interface SubagentCapabilities {
|
|
31
|
+
readonly agentOptions: boolean
|
|
31
32
|
readonly outputSchema: boolean
|
|
32
33
|
readonly depthLimit: boolean
|
|
33
34
|
readonly toolFilter: boolean
|
|
@@ -37,7 +38,7 @@ interface SubagentCapabilities {
|
|
|
37
38
|
|
|
38
39
|
## 单次启动请求
|
|
39
40
|
|
|
40
|
-
工具层根据模型输入和自身配置构建此请求;服务在 `start` 之前针对指定提供方进行校验。必填的 `parent` 提供会话 cwd、谱系与委派深度。可选的 output schema、depth、工具过滤器和 persona 需要对应的能力 flag
|
|
41
|
+
工具层根据模型输入和自身配置构建此请求;服务在 `start` 之前针对指定提供方进行校验。必填的 `parent` 提供会话 cwd、谱系与委派深度。可选的 Agent 提供方、模型、推理强度与 token 覆盖、output schema、depth、工具过滤器和 persona 需要对应的能力 flag 匹配。进程内后端会把 `agentOptions` 合并到父 Agent 选项之上,将 filter 和 persona 的作用域限定在子 agent 创建阶段,并通过强制 capture 工具实现所支持的 object-rooted schema。DSH SDK 后端会把四个 Agent 路由字段合并到实例默认值之上,并在子运行时初始化期间校验;ACP、Codex 与 Claude Code 会在启动传输前拒绝 `agentOptions`。
|
|
41
42
|
|
|
42
43
|
```ts type-equiv
|
|
43
44
|
/**
|
|
@@ -66,6 +67,13 @@ interface SubagentStartRequest {
|
|
|
66
67
|
* remaining turn work when it fires afterward.
|
|
67
68
|
*/
|
|
68
69
|
readonly signal: AbortSignal
|
|
70
|
+
/**
|
|
71
|
+
* Optional host-Agent provider, model, reasoning-effort, and output-token
|
|
72
|
+
* overrides. Requires {@link SubagentCapabilities.agentOptions}; in-process
|
|
73
|
+
* providers merge them over the parent Agent's options when they create the
|
|
74
|
+
* child, while the DSH SDK provider merges them over its instance defaults
|
|
75
|
+
* before initializing the separate child runtime.
|
|
76
|
+
*/
|
|
69
77
|
readonly agentOptions?: AgentOptions
|
|
70
78
|
/**
|
|
71
79
|
* Object-rooted JSON Schema within `assertObjectJsonSchema`'s enforced subset. Start rejects
|
|
@@ -243,7 +251,7 @@ interface SubagentReportOptions {
|
|
|
243
251
|
}
|
|
244
252
|
```
|
|
245
253
|
|
|
246
|
-
提供方只参与准备初始创建 spec,`spawn` 与 `fork` 在此有所不同。其返回的 spec
|
|
254
|
+
提供方只参与准备初始创建 spec,`spawn` 与 `fork` 在此有所不同。其返回的 spec 只携带分离的、提供方专属的创建输入——即可选的父级历史种子——不含 Agent、`AgentHandle`、提示词投递、结果、dispose 或恢复操作。冷恢复根本不经由提供方分发:管理器折叠通用描述符,通过同一个 activation-owner 作用域调用 `ctx.agents.resume()`,并提交等待中的轮次。
|
|
247
255
|
|
|
248
256
|
```ts type-equiv
|
|
249
257
|
/**
|
|
@@ -283,7 +291,7 @@ interface ContinuableCreateSpec {
|
|
|
283
291
|
}
|
|
284
292
|
```
|
|
285
293
|
|
|
286
|
-
描述符([descriptor.ts](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/subagent/subagent/src/descriptor.ts) 中的 `SubagentDescriptorData`)是每个由会话支撑的 subagent 所使用、按模式判别的持久化身份。两种模式都携带提供方名称。`one-shot` 描述符可以携带调用方拥有的可选显示 `label`;`continuable` 描述符要求以委派 `description` 作为持久化创建标签,并另外对已解析的子 agent `agentOptions.provider`/`model` 与可选的 `persona`/`toolFilter` 建立快照,用于冷恢复。它绝不会对可合并扩展的 `AgentOptions` 对象建立快照,因此无关的扩展值不会破坏继续执行,后续新增组合配置输入则是一次有意的版本更改。描述符省略 `subagentDepth`(冷恢复以持久化 header 中的 `delegationDepth` 作为单调下界)和 `outputSchema`(单次运行或 Activation 的结果约定,而非持久化身份)。
|
|
294
|
+
描述符([descriptor.ts](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/subagent/subagent/src/descriptor.ts) 中的 `SubagentDescriptorData`)是每个由会话支撑的 subagent 所使用、按模式判别的持久化身份。两种模式都携带提供方名称。`one-shot` 描述符可以携带调用方拥有的可选显示 `label`;`continuable` 描述符要求以委派 `description` 作为持久化创建标签,并另外对已解析的子 agent `agentOptions.provider`/`model`/`reasoningEffort` 与可选的 `persona`/`toolFilter` 建立快照,用于冷恢复。它绝不会对可合并扩展的 `AgentOptions` 对象建立快照,因此无关的扩展值不会破坏继续执行,后续新增组合配置输入则是一次有意的版本更改。描述符省略 `subagentDepth`(冷恢复以持久化 header 中的 `delegationDepth` 作为单调下界)和 `outputSchema`(单次运行或 Activation 的结果约定,而非持久化身份)。
|
|
287
295
|
|
|
288
296
|
本地一次性提供方会在子 agent 的初始轮次内、首次请求前追加描述符。继续执行管理器会在任何提供方提供的谱系之后、初始提示词获准之前追加描述符;`header.seedLength` 仍是 fork 谱系边界:恢复时的描述符权威读取子 agent 自身的后缀,而供列表使用的身份投影以 last-wins 折叠 `subagent/descriptor`,子 agent 自己的描述符会覆盖 fork seed 中祖先的描述符。该事件只进入日志:不含 `surfaceOp`,绝不进入模型历史,并由仅追加日志跨压缩保留。格式错误的当前版本描述符属于损坏;本运行时无法对不受支持的版本进行分类。
|
|
289
297
|
|
|
@@ -419,7 +427,7 @@ interface SubagentRun {
|
|
|
419
427
|
|
|
420
428
|
## 提供方约定:`SubagentProvider`
|
|
421
429
|
|
|
422
|
-
每个提供方都是一个具名的子 agent 传输层,多个提供方可以共存。服务在 `start()` 之前校验请求的启动时能力,并拒绝在没有 `prepareContinuable` 的提供方上发起可继续 start。`inheritsParentContext` 仅描述对话种子注入(`fork`:true;`spawn` 和 `acp`:false
|
|
430
|
+
每个提供方都是一个具名的子 agent 传输层,多个提供方可以共存。服务在 `start()` 之前校验请求的启动时能力,并拒绝在没有 `prepareContinuable` 的提供方上发起可继续 start。`inheritsParentContext` 仅描述对话种子注入(`fork`:true;`spawn` 和 `acp`:false),使消费方能生成准确的面向模型措辞,而不暗示继承了工具、服务或权限。如果某个提供方的一次性路由拥有静态的提供方自有默认值,它会公开可选且不可变的 `agentRouteDefaults`,使 Consumer 能够在预检前以正确基线合并模型与工具覆盖。
|
|
423
431
|
|
|
424
432
|
```ts type-equiv
|
|
425
433
|
/**
|
|
@@ -441,6 +449,13 @@ interface SubagentProvider {
|
|
|
441
449
|
* It says nothing about tool registration, injected services, or authority inheritance.
|
|
442
450
|
*/
|
|
443
451
|
readonly inheritsParentContext: boolean
|
|
452
|
+
/**
|
|
453
|
+
* Optional static provider-owned provider/model route for one-shot Agent
|
|
454
|
+
* options. Consumers merge tool/model overrides over these values before
|
|
455
|
+
* preflight; providers whose route derives from the parent omit it. The value
|
|
456
|
+
* is detached immutable data and requires `agentOptions` support.
|
|
457
|
+
*/
|
|
458
|
+
readonly agentRouteDefaults?: Readonly<{ provider: string; model: string }>
|
|
444
459
|
/**
|
|
445
460
|
* Establish a ONE-SHOT child and return its handle after publication.
|
|
446
461
|
* The service has already validated that every requested start-time
|
|
@@ -489,6 +504,22 @@ spawn 和 fork 后端通过 `parent.ctx` 创建一个普通的单次 agent,将
|
|
|
489
504
|
|
|
490
505
|
Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
|
|
491
506
|
|
|
507
|
+
<a id="ctxsubagentmodelselection--subagentmodelselectionconfig"></a>
|
|
508
|
+
|
|
509
|
+
### `ctx.subagentModelSelection` — `SubagentModelSelectionConfig`
|
|
510
|
+
|
|
511
|
+
Singleton settings owner read by delegation tools when an Agent is published.
|
|
512
|
+
|
|
513
|
+
```ts cordis-catalog
|
|
514
|
+
/**
|
|
515
|
+
* Read a detached selection preference for the next eligible Agent publication.
|
|
516
|
+
* @returns the enabled state and exact allowed routes.
|
|
517
|
+
*/
|
|
518
|
+
current(): SubagentModelSelectionSettings
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
Source: [`packages/subagent/tool-subagent/src/model-selection-settings.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/subagent/tool-subagent/src/model-selection-settings.ts)
|
|
522
|
+
|
|
492
523
|
<a id="ctxsubagents--subagentruntime"></a>
|
|
493
524
|
|
|
494
525
|
### `ctx.subagents` — `SubagentRuntime`
|
|
@@ -590,27 +621,16 @@ async drainContinuableChildren(parent: Agent, childIds: readonly SessionId[]): P
|
|
|
590
621
|
|
|
591
622
|
/**
|
|
592
623
|
* Enumerate the parent's direct session-backed subagents without loading or
|
|
593
|
-
* resuming an Agent
|
|
594
|
-
*
|
|
595
|
-
*
|
|
596
|
-
* projection
|
|
597
|
-
* snapshot for a live child; for a cold one, a durable projection-cache
|
|
598
|
-
* row when the optional cache serves an own-suffix identity (its `seq`
|
|
599
|
-
* gate proves the value postdates the fork seed, where a child's own
|
|
600
|
-
* descriptor is immutable once appended), else one persistence inspection
|
|
601
|
-
* folded through the registry. The
|
|
602
|
-
* projection fold is the single classification authority; per-child
|
|
603
|
-
* diagnostics relay a fold that served no identity or a failed inspection,
|
|
604
|
-
* never a list-time descriptor parse. Absent persistence, enumeration is
|
|
605
|
-
* live-only (a cold child cannot be resumed then either, so its absence is
|
|
606
|
-
* capability absence, not an error). This service consults no Agent
|
|
607
|
-
* registrations, Activations, or providers.
|
|
624
|
+
* resuming an Agent. The Session query service supplies one live-preferred
|
|
625
|
+
* corpus and shared point observations; the projection cache supplies
|
|
626
|
+
* immutable descriptor hits without opening cold logs. The registered
|
|
627
|
+
* `subagent` projection remains the sole mode/label classifier.
|
|
608
628
|
*
|
|
609
|
-
* Every
|
|
610
|
-
*
|
|
629
|
+
* Every query receives `signal`, and the listing rechecks cancellation
|
|
630
|
+
* around each await. Read rejections that settle
|
|
611
631
|
* after an abort become a stable `SubagentError` with code `CANCELLED`.
|
|
612
632
|
* @param parentSessionId - parent session whose direct children are listed.
|
|
613
|
-
* @param signal - caller-owned cancellation forwarded to
|
|
633
|
+
* @param signal - caller-owned cancellation forwarded to Session queries
|
|
614
634
|
* and observed around every read await.
|
|
615
635
|
* @returns children and per-child diagnostics ordered by `createdAt`, then id.
|
|
616
636
|
* @throws {@link SubagentError} when the projection registry or the session
|
|
@@ -635,6 +655,53 @@ listChildren(parentSessionId: SessionId, signal?: AbortSignal): Promise<Subagent
|
|
|
635
655
|
*/
|
|
636
656
|
listDescendants(rootSessionId: SessionId, signal?: AbortSignal): Promise<SubagentDescendantListEntry[]>
|
|
637
657
|
|
|
658
|
+
/**
|
|
659
|
+
* Remote face of {@link listChildren} for one browser: the durable listing
|
|
660
|
+
* plus live Agent activity and the delivery-time parent availability hint.
|
|
661
|
+
* Parent availability is a hint; {@link prompt} performs the authoritative
|
|
662
|
+
* check. Named apart from the provider-name {@link list}, which owns the
|
|
663
|
+
* member.
|
|
664
|
+
* @param parentSessionId - parent session whose direct children are listed.
|
|
665
|
+
* @param signal - carrier cancellation forwarded to Session queries.
|
|
666
|
+
* @returns the catalog view for that parent.
|
|
667
|
+
* @throws {TypertRemoteFailure} `bad-request` for an empty parent id,
|
|
668
|
+
* `cancelled` for an aborted read, `subagent-projections-unavailable` when
|
|
669
|
+
* the deployment has no projection registry, otherwise `internal`.
|
|
670
|
+
*/
|
|
671
|
+
@Remote('list') async remoteExportList(parentSessionId: SessionId, signal: AbortSignal): Promise<SubagentCatalog>
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Deliver one browser-authored message to a continuable child through the
|
|
675
|
+
* exact live direct parent, retaining the caller-minted request identity and
|
|
676
|
+
* validated browser zone on the accepted message. Success identifies the
|
|
677
|
+
* message the child's FIFO inbox accepted; later execution is independent of
|
|
678
|
+
* this call.
|
|
679
|
+
* @param request - durable address, minted identity, content, and optional browser zone.
|
|
680
|
+
* @param signal - carrier cancellation, owning the call until inbox acceptance.
|
|
681
|
+
* @returns the accepted message's inbox identity.
|
|
682
|
+
* @throws {TypertRemoteFailure} `bad-request`, `invalid-time-zone`,
|
|
683
|
+
* `subagent-parent-unavailable`, `subagent-not-resumable`,
|
|
684
|
+
* `subagent-unauthorized`, `subagent-delivery-unavailable`, `cancelled`, or
|
|
685
|
+
* `internal`.
|
|
686
|
+
*/
|
|
687
|
+
@Remote('prompt') async prompt(request: SubagentPromptRequest, signal: AbortSignal): Promise<SubagentPromptReceipt>
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Remote face of {@link interrupt} under one durable parent address. No
|
|
691
|
+
* catalog, history, persistence, or parent Agent lookup runs: the core
|
|
692
|
+
* primitive alone authorizes the address against the live Activation, which
|
|
693
|
+
* is what keeps a live child interruptible while its parent Agent is offline.
|
|
694
|
+
* Absent, idle, and already-completed targets are accepted no-ops there.
|
|
695
|
+
* @param childSessionId - durable child session id to interrupt.
|
|
696
|
+
* @param parentSessionId - durable direct parent whose authority is claimed.
|
|
697
|
+
* @param mode - required continuable-address discriminator.
|
|
698
|
+
* @returns acknowledgement that the cancel signal was admitted, not that the target is quiescent.
|
|
699
|
+
* @throws {TypertRemoteFailure} `bad-request` for an empty id,
|
|
700
|
+
* `subagent-unauthorized` when the address does not own the live target,
|
|
701
|
+
* otherwise `internal`.
|
|
702
|
+
*/
|
|
703
|
+
@Remote('interruptByParent') interruptByParent( childSessionId: SessionId, parentSessionId: SessionId, mode: 'continuable', ): SubagentInterruptReceipt
|
|
704
|
+
|
|
638
705
|
/**
|
|
639
706
|
* Register a provider under its name. Registration is effect-scoped and HMR
|
|
640
707
|
* safe; removing a provider blocks new starts but does not revoke runs that
|
|
@@ -42,7 +42,7 @@ interface ToolProviderResult {
|
|
|
42
42
|
|
|
43
43
|
## 提示词段落
|
|
44
44
|
|
|
45
|
-
`PromptSection`
|
|
45
|
+
`PromptSection` 是一份只读的同进程注册约定。其文本可以是静态的,也可以从当前组装上下文动态解析。各段先按 order 升序排列,再按名称的代码单元顺序排列;`FIRST_PARTY_SECTION_ORDER` 公开仓库自带贡献的稀疏具名分配表。协作式组装完成后,一个有效的 `complete` 段会成为唯一的提示词段落。
|
|
46
46
|
|
|
47
47
|
```ts type-equiv
|
|
48
48
|
/** One contributed section of the system prompt (registry input). */
|
|
@@ -50,9 +50,9 @@ interface PromptSection {
|
|
|
50
50
|
/** Unique name — a duplicate registration throws (see {@link SystemPrompt.section}). */
|
|
51
51
|
readonly name: string
|
|
52
52
|
/**
|
|
53
|
-
* Sections are concatenated in ascending order.
|
|
54
|
-
*
|
|
55
|
-
*
|
|
53
|
+
* Sections are concatenated in ascending order. Equal orders use code-unit
|
|
54
|
+
* name order. Repository-owned placements use
|
|
55
|
+
* {@link FIRST_PARTY_SECTION_ORDER}.
|
|
56
56
|
*/
|
|
57
57
|
readonly order: number
|
|
58
58
|
/**
|
|
@@ -22,14 +22,14 @@ interface TokenMeasurement {
|
|
|
22
22
|
readonly surfaceDeltaTokens: number
|
|
23
23
|
/** Non-negative current request-and-response pressure. */
|
|
24
24
|
readonly totalTokens: number
|
|
25
|
-
/** Total
|
|
25
|
+
/** Total route-priced request tokens across the current surface; equals the sum of the node prices. */
|
|
26
26
|
readonly surfaceTokens: number
|
|
27
27
|
/** Current surface nodes in positional head-to-tail order. */
|
|
28
28
|
readonly nodes: readonly TokenSurfaceNode[]
|
|
29
29
|
}
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
`baseline.kind === 'usage'` 表示最近一次成功的提供方调用具有相同的规范请求 envelope
|
|
32
|
+
每次计量都会通过 `ctx.llm` 把生效信封的路由 provider/model 解析为该路由声明的请求图片定价,因此图片出现处按请求实际发送的视觉 token 加模型可见文本计价;未声明定价的路由与组合保持固定启发式规则。`baseline.kind === 'usage'` 表示最近一次成功的提供方调用具有相同的规范请求 envelope,且该调用的总量不低于其完整路由定价锚点。`estimated` 表示不存在可复用的保守 usage 锚点,因此服务自行对完整信封和表层定价。后续成功请求会替换早先的锚点;有符号的 `surfaceDeltaTokens` 会保留相对于匹配锚点的增长与缩减,且两侧按同一路由重新定价。`totalTokens` 仍表示请求与响应压力,`surfaceTokens` 则是表层的路由定价总量,等于所有节点价格之和。
|
|
33
33
|
|
|
34
34
|
## `TokenSurfaceNode`
|
|
35
35
|
|
|
@@ -38,8 +38,19 @@ interface TokenMeasurement {
|
|
|
38
38
|
interface TokenSurfaceNode {
|
|
39
39
|
/** Durable sequence number of the surface event. */
|
|
40
40
|
readonly seq: number
|
|
41
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Request-pressure tokens for the exact message projected by this node under
|
|
43
|
+
* the measured route: image occurrences carry the route's declared visual
|
|
44
|
+
* price when the routed adapter declares one, and the fixed heuristic
|
|
45
|
+
* otherwise. Trigger, retention, and range selection all read this price.
|
|
46
|
+
*/
|
|
42
47
|
readonly tokens: number
|
|
48
|
+
/**
|
|
49
|
+
* Fixed-heuristic tokens for the same message, independent of any route.
|
|
50
|
+
* The shadow-price protocol prices replacements with this value so the O(1)
|
|
51
|
+
* projection fold stays in agreement with its own appends.
|
|
52
|
+
*/
|
|
53
|
+
readonly heuristicTokens: number
|
|
43
54
|
}
|
|
44
55
|
```
|
|
45
56
|
|
|
@@ -63,14 +74,18 @@ Replay owner for one service-wide estimator and isolated per-session folds.
|
|
|
63
74
|
/**
|
|
64
75
|
* Measure current request pressure and surface through the durable tail.
|
|
65
76
|
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
77
|
+
* The effective envelope's routed provider/model selects the request-image
|
|
78
|
+
* pricing every node is priced under: a route whose adapter declares image
|
|
79
|
+
* pricing charges each retained image its visual tokens plus its
|
|
80
|
+
* model-visible text, while other routes keep the fixed heuristic. Provider
|
|
81
|
+
* usage is reused only when the latest successful call's canonical request
|
|
82
|
+
* envelope matches `requestHeader` and its total is no lower than that
|
|
83
|
+
* call's full route-priced anchor; otherwise the complete envelope and
|
|
84
|
+
* surface are repriced.
|
|
70
85
|
*
|
|
71
|
-
* `requestHeader`
|
|
72
|
-
*
|
|
73
|
-
* nodes, so measurement is O(surface).
|
|
86
|
+
* `requestHeader` replaces the latest logged envelope for pressure and node
|
|
87
|
+
* pricing; the node set always describes the current session surface. Every
|
|
88
|
+
* call clones those positional nodes, so measurement is O(surface).
|
|
74
89
|
*
|
|
75
90
|
* @param session - session to replay through its current durable tail.
|
|
76
91
|
* @param requestHeader - optional effective request envelope replacing the latest logged header.
|