@sshirkit/dsh-orchestrator 0.8.4 → 0.8.5
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.en.md +2 -2
- package/README.md +2 -2
- package/docs/images/dispatch-panel.png +0 -0
- package/lib/client.js +1 -110
- package/lib/index.js +1 -21
- package/package.json +2 -3
- package/lib/stage.js +0 -62
package/README.en.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
#### **A powerful model plans, low-cost models do the work — the dispatch mode plugin with hard tool isolation for DeepSeek Harness**
|
|
13
13
|
|
|
14
|
-
[](https://github.com/SShiRkiT/dsh-orchestrator)
|
|
15
15
|
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
16
16
|
[](https://github.com/SShiRkiT/dsh-orchestrator)
|
|
17
17
|
[](https://nodejs.org)
|
|
@@ -112,7 +112,7 @@ The plugin depends on host subagent interfaces (the `startActivation` spec shape
|
|
|
112
112
|
|
|
113
113
|
| Plugin version | Supported DSH host | Notes |
|
|
114
114
|
| --- | --- | --- |
|
|
115
|
-
| `@sshirkit/dsh-orchestrator >= 0.8.3` (current version: `0.8.
|
|
115
|
+
| `@sshirkit/dsh-orchestrator >= 0.8.3` (current version: `0.8.5`) | **DSH `>= 0.2.2-rc.2`** | Verified against `0.2.2-rc.2` / `0.2.2-rc.3`. Since `0.2.2-rc.2`, the host has flattened the subagent spec, removed the `Symbol.for('dsh.subagent.deliverPrompt')` delivery entry point and `agents.roots()`, and added the `wait_agent` tool. It is therefore **incompatible with `0.2.2-rc.1` and earlier**. Note: although the host adds `wait_agent`, the plugin **intentionally keeps its default whitelist at 12 tools and excludes `wait_agent`**. Blocking polling can leave the main agent idling and misjudging timeouts; supervision already replaces polling with one summary plus one decision. If needed, manually check `wait_agent` in the panel's `allowedTools` list. |
|
|
116
116
|
| `dsh-orchestrator 0.8.0 – 0.8.2` | **DSH `<= 0.2.2-rc.1`** | Tested against `0.2.1-rc.3` and `0.2.2-rc.1`. The `@deepseek-ai/dsh-tools` dependency was introduced in `0.8.0`. |
|
|
117
117
|
| `dsh-orchestrator <= 0.7.3` | DSH releases predating plugin `0.8.0` | Early standalone tool-registration architecture, without a dependency on `@deepseek-ai/dsh-tools`. |
|
|
118
118
|
|
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
#### **强模型主脑规划 + 便宜模型统一打工 —— DeepSeek Harness 的「硬隔离调度模式」插件**
|
|
13
13
|
|
|
14
|
-
[](https://github.com/SShiRkiT/dsh-orchestrator)
|
|
15
15
|
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
16
16
|
[](https://github.com/SShiRkiT/dsh-orchestrator)
|
|
17
17
|
[](https://nodejs.org)
|
|
@@ -112,7 +112,7 @@ DSH 客户端自带了 `subagent` / `workflow`,官方也有 `@deepseek-ai/dsh-
|
|
|
112
112
|
|
|
113
113
|
| 插件版本 | 适配的 DSH 宿主 | 说明 |
|
|
114
114
|
| --- | --- | --- |
|
|
115
|
-
| `@sshirkit/dsh-orchestrator >= 0.8.3`(当前版本 `0.8.
|
|
115
|
+
| `@sshirkit/dsh-orchestrator >= 0.8.3`(当前版本 `0.8.5`) | **DSH `>= 0.2.2-rc.2`** | 已验证 `0.2.2-rc.2` / `0.2.2-rc.3`。宿主自 `0.2.2-rc.2` 起扁平化了 subagent spec、移除了 `Symbol.for('dsh.subagent.deliverPrompt')` 投递入口与 `agents.roots()`,并新增 `wait_agent` 工具;因此**不兼容 `0.2.2-rc.1` 及更早版本**。注意:宿主虽新增了 `wait_agent`,但本插件默认白名单**有意维持 12 项、不予放行 `wait_agent`**——阻塞式轮询等待会让主代理陷入空转与超时误判,巡检机制已用「一条摘要 + 一次决策」替代轮询;确有需要时可在面板 `allowedTools` 中手动勾选放行。 |
|
|
116
116
|
| `dsh-orchestrator 0.8.0 – 0.8.2` | **DSH `<= 0.2.2-rc.1`** | 已实测支持 `0.2.1-rc.3`、`0.2.2-rc.1`。自 `0.8.0` 起引入 `@deepseek-ai/dsh-tools` 依赖。 |
|
|
117
117
|
| `dsh-orchestrator <= 0.7.3` | `0.8.0` 之前的旧版 DSH | 早期独立工具注册架构,未依赖 `@deepseek-ai/dsh-tools`。 |
|
|
118
118
|
|
|
Binary file
|
package/lib/client.js
CHANGED
|
@@ -18,17 +18,6 @@ window.__ModuleLoader__.load({
|
|
|
18
18
|
const NS = 'orchestrator'
|
|
19
19
|
|
|
20
20
|
const zh = {
|
|
21
|
-
'toggle.label': '计划',
|
|
22
|
-
'toggle.on': '计划模式已开启,点击关闭 (/plan off)',
|
|
23
|
-
'toggle.off': '计划模式已关闭,点击开启 (/plan)',
|
|
24
|
-
'toggle.pending': ',将在下一步生效',
|
|
25
|
-
'toggle.failed': '切换计划模式失败',
|
|
26
|
-
'stage.idle': '默认',
|
|
27
|
-
'stage.clarify': '澄清',
|
|
28
|
-
'stage.planning': '规划',
|
|
29
|
-
'stage.awaiting': '待确认',
|
|
30
|
-
'stage.executing': '执行',
|
|
31
|
-
'stage.na': '不适用',
|
|
32
21
|
'route.button': '调度模式',
|
|
33
22
|
'route.title': '主代理与子代理的默认模型',
|
|
34
23
|
'route.main': '主代理',
|
|
@@ -64,17 +53,6 @@ window.__ModuleLoader__.load({
|
|
|
64
53
|
'supervise.countInvalid': '请输入 0–20 之间的整数',
|
|
65
54
|
}
|
|
66
55
|
const en = {
|
|
67
|
-
'toggle.label': 'Plan',
|
|
68
|
-
'toggle.on': 'Plan mode is on, click to turn off (/plan off)',
|
|
69
|
-
'toggle.off': 'Plan mode is off, click to turn on (/plan)',
|
|
70
|
-
'toggle.pending': ', applies from the next step',
|
|
71
|
-
'toggle.failed': 'Could not switch plan mode',
|
|
72
|
-
'stage.idle': 'Default',
|
|
73
|
-
'stage.clarify': 'Clarify',
|
|
74
|
-
'stage.planning': 'Planning',
|
|
75
|
-
'stage.awaiting': 'Review',
|
|
76
|
-
'stage.executing': 'Executing',
|
|
77
|
-
'stage.na': 'N/A',
|
|
78
56
|
'route.button': 'Dispatch',
|
|
79
57
|
'route.title': 'Default models for the main agent and subagents',
|
|
80
58
|
'route.main': 'Main agent',
|
|
@@ -131,75 +109,6 @@ window.__ModuleLoader__.load({
|
|
|
131
109
|
borderColor: 'var(--dsw-alias-brand-primary, #4d8dff)',
|
|
132
110
|
background: 'var(--dsw-alias-button-ghost-active-fill, color-mix(in srgb, #4d8dff 16%, transparent))',
|
|
133
111
|
}
|
|
134
|
-
const dot = (on) => ({
|
|
135
|
-
width: '6px',
|
|
136
|
-
height: '6px',
|
|
137
|
-
borderRadius: '999px',
|
|
138
|
-
background: on ? 'var(--dsw-alias-brand-primary, #4d8dff)' : 'var(--dsw-alias-label-tertiary, color-mix(in srgb, currentColor 45%, transparent))',
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Plan-mode toggle. The native plan projection folds the host's committed
|
|
143
|
-
* state; `/plan` during an open turn is queued, so `pending` means the shown
|
|
144
|
-
* target differs from what the host has applied so far.
|
|
145
|
-
*/
|
|
146
|
-
function PlanToggle({ useProjection, locked, setPlan, t }) {
|
|
147
|
-
// A blank new conversation has no folded plan state yet; that is plan mode off.
|
|
148
|
-
const plan = useProjection('plan') ?? { active: false, pending: false }
|
|
149
|
-
// Derived by the host from logged events; absent until the first projection arrives.
|
|
150
|
-
const stage = useProjection('orchestrator')?.stage ?? 'idle'
|
|
151
|
-
const [busy, setBusy] = React.useState(false)
|
|
152
|
-
const [error, setError] = React.useState(null)
|
|
153
|
-
const alive = React.useRef(true)
|
|
154
|
-
React.useEffect(() => {
|
|
155
|
-
alive.current = true
|
|
156
|
-
return () => {
|
|
157
|
-
alive.current = false
|
|
158
|
-
}
|
|
159
|
-
}, [])
|
|
160
|
-
|
|
161
|
-
const target = plan.pending ? !plan.active : plan.active
|
|
162
|
-
const base = target ? t('toggle.on') : t('toggle.off')
|
|
163
|
-
// The button face only says "Plan" and is lit when on; the stage lives in the hover text.
|
|
164
|
-
const title = error ?? (plan.pending ? base + t('toggle.pending') : base) + ' · ' + t('stage.' + stage)
|
|
165
|
-
|
|
166
|
-
const onClick = () => {
|
|
167
|
-
if (busy || locked) return
|
|
168
|
-
setBusy(true)
|
|
169
|
-
setError(null)
|
|
170
|
-
setPlan(!target).then(
|
|
171
|
-
(failure) => {
|
|
172
|
-
if (!alive.current) return
|
|
173
|
-
setBusy(false)
|
|
174
|
-
setError(failure)
|
|
175
|
-
},
|
|
176
|
-
(reason) => {
|
|
177
|
-
if (!alive.current) return
|
|
178
|
-
setBusy(false)
|
|
179
|
-
setError(typeof reason?.message === 'string' && reason.message !== '' ? reason.message : t('toggle.failed'))
|
|
180
|
-
},
|
|
181
|
-
)
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return React.createElement(
|
|
185
|
-
'button',
|
|
186
|
-
{
|
|
187
|
-
type: 'button',
|
|
188
|
-
style: Object.assign({}, baseStyle, target ? onStyle : null, busy || locked ? { opacity: 0.6 } : null),
|
|
189
|
-
disabled: busy || locked,
|
|
190
|
-
onClick,
|
|
191
|
-
title,
|
|
192
|
-
'aria-label': title,
|
|
193
|
-
'aria-pressed': target,
|
|
194
|
-
'data-plan': target ? 'on' : 'off',
|
|
195
|
-
'data-pending': plan.pending ? 'true' : 'false',
|
|
196
|
-
'data-stage': stage,
|
|
197
|
-
},
|
|
198
|
-
React.createElement('span', { style: dot(target), 'aria-hidden': true }),
|
|
199
|
-
React.createElement('span', null, t('toggle.label')),
|
|
200
|
-
)
|
|
201
|
-
}
|
|
202
|
-
|
|
203
112
|
// ---- Default routes -------------------------------------------------------------------
|
|
204
113
|
// Two stored routes, each a { provider, model, effort } triple under different field names.
|
|
205
114
|
// The main agent's lives in the host's `agent-default-model` entry (read when an agent is
|
|
@@ -1684,29 +1593,11 @@ window.__ModuleLoader__.load({
|
|
|
1684
1593
|
}
|
|
1685
1594
|
|
|
1686
1595
|
/** Service names, not package names: these are the `ctx.*` members used below. */
|
|
1687
|
-
const inject = ['slots', 'locale', 'remote', 'remote.
|
|
1596
|
+
const inject = ['slots', 'locale', 'remote', 'remote.session', 'configForms']
|
|
1688
1597
|
|
|
1689
1598
|
function apply(ctx) {
|
|
1690
1599
|
ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'orchestrator: dictionaries')
|
|
1691
1600
|
|
|
1692
|
-
// Same command channel the native plan chip uses to leave plan mode.
|
|
1693
|
-
const setPlanFor = (sessionId) => async (active) => {
|
|
1694
|
-
const command = active ? '/plan' : '/plan off'
|
|
1695
|
-
const result = await ctx.remote.commands.execute(sessionId, command, [])
|
|
1696
|
-
if (!result.ok) return result.error.message + ' (' + result.error.code + ')'
|
|
1697
|
-
if (result.value === undefined) return 'unknown command: ' + command
|
|
1698
|
-
return null
|
|
1699
|
-
}
|
|
1700
|
-
// `conversation.input.plan` is a single-occupant slot and the shipped plan package claims
|
|
1701
|
-
// it: a second registration makes that package's activation throw, which fails the whole
|
|
1702
|
-
// web boot. The toggle takes a seat in the left list slot instead, next to the plan chip.
|
|
1703
|
-
ctx.slots.inject('conversation.input.left', () =>
|
|
1704
|
-
ctx.slots.register(
|
|
1705
|
-
{ name: 'conversation.input.left', id: 'orchestrator-plan-toggle', order: 20, locale: NS },
|
|
1706
|
-
(props) => h(PlanToggle, Object.assign({}, props, { setPlan: setPlanFor(props.sessionId) })),
|
|
1707
|
-
),
|
|
1708
|
-
)
|
|
1709
|
-
|
|
1710
1601
|
const scopes = { main: ctx.configForms.get(MAIN.ns), worker: ctx.configForms.get(WORKER.ns), orch: ctx.configForms.get(NS) }
|
|
1711
1602
|
ctx.slots.inject('conversation.input.right', () =>
|
|
1712
1603
|
ctx.slots.register(
|
package/lib/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto'
|
|
2
2
|
import z from '@deepseek-ai/schemastery'
|
|
3
3
|
import { defineTool } from '@deepseek-ai/dsh-tools'
|
|
4
|
-
import { z as zod } from 'zod'
|
|
5
4
|
import { ORCHESTRATE_TOOL } from './api.js'
|
|
6
5
|
import { createCatalogPublisher } from './catalog.js'
|
|
7
6
|
import { createDelegateTool } from './delegate.js'
|
|
8
7
|
import { effectiveAllowed, installGate, isDelegatedChild } from './gate.js'
|
|
9
8
|
import { createOrchestrateTool } from './orchestrate.js'
|
|
10
9
|
import { RETRY_SOURCE_KIND, createRetry } from './retry.js'
|
|
11
|
-
import { STAGES, initialState, reduceStage } from './stage.js'
|
|
12
10
|
import { SUPERVISE_SOURCE_KIND, createSupervisor } from './supervise.js'
|
|
13
11
|
import { SWITCH_SOURCE_KIND, createSwitchNotices } from './switch-notice.js'
|
|
14
12
|
import { installToolSurface } from './tool-surface.js'
|
|
@@ -20,27 +18,11 @@ export { SUPERVISE_SOURCE_KIND, SWITCH_SOURCE_KIND }
|
|
|
20
18
|
export const name = '@sshirkit/dsh-orchestrator'
|
|
21
19
|
|
|
22
20
|
/**
|
|
23
|
-
* Services used here:
|
|
21
|
+
* Services used here: inbox projection state, the tool registry, the subagent
|
|
24
22
|
* service, and the live agent/session registries the supervision adapters read.
|
|
25
23
|
*/
|
|
26
24
|
export const inject = ['sessionProjections', 'tools', 'subagents', 'agents', 'sessions']
|
|
27
25
|
|
|
28
|
-
/**
|
|
29
|
-
* Stage projection. The registry calls `.parse` on these schemas, so they must be
|
|
30
|
-
* zod schemas (schemastery objects have no `.parse`), as the native plan projection does.
|
|
31
|
-
*/
|
|
32
|
-
const stageProjection = {
|
|
33
|
-
key: 'orchestrator',
|
|
34
|
-
stateVersion: 1,
|
|
35
|
-
stateSchema: zod.object({ stage: zod.enum(STAGES), plan: zod.boolean() }).strict(),
|
|
36
|
-
init: (_header, inheritedEventCount) => initialState(inheritedEventCount),
|
|
37
|
-
apply: reduceStage,
|
|
38
|
-
wire: {
|
|
39
|
-
viewSchema: zod.object({ stage: zod.enum(STAGES), plan: zod.boolean() }),
|
|
40
|
-
view: (state) => ({ stage: state.stage, plan: state.plan }),
|
|
41
|
-
},
|
|
42
|
-
}
|
|
43
|
-
|
|
44
26
|
/**
|
|
45
27
|
* The tools a main agent keeps while orchestration mode is on — the shipped whitelist.
|
|
46
28
|
*
|
|
@@ -561,8 +543,6 @@ export function createSupervisionHooks(supervisor, { headSeq, retry } = {}) {
|
|
|
561
543
|
}
|
|
562
544
|
|
|
563
545
|
export function apply(ctx, config) {
|
|
564
|
-
ctx.sessionProjections.register(stageProjection)
|
|
565
|
-
|
|
566
546
|
const supervision = createSupervision({ ctx, config })
|
|
567
547
|
|
|
568
548
|
// A child that dies without a closing message is woken again on the same durable session,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sshirkit/dsh-orchestrator",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -38,8 +38,7 @@
|
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@deepseek-ai/schemastery": ">=3.18.5 <4.0.0",
|
|
40
40
|
"@deepseek-ai/dsh-tools": ">=0.2.2-rc.2 <0.2.3-0",
|
|
41
|
-
"@deepseek-ai/dsh-llm": ">=0.2.2-rc.2 <0.2.3-0"
|
|
42
|
-
"zod": "^4.6.6"
|
|
41
|
+
"@deepseek-ai/dsh-llm": ">=0.2.2-rc.2 <0.2.3-0"
|
|
43
42
|
},
|
|
44
43
|
"peerDependenciesMeta": {
|
|
45
44
|
"@deepseek-ai/dsh-llm": {
|
package/lib/stage.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stage derivation. Pure: no imports, so it can be tested without the DSH runtime.
|
|
3
|
-
*
|
|
4
|
-
* The stage is a fold over events the session already records. Nothing new is
|
|
5
|
-
* persisted, and a reload rebuilds the same answer from the log.
|
|
6
|
-
*
|
|
7
|
-
* Not derivable today: a review/acceptance stage. Nothing in the log marks "the
|
|
8
|
-
* workers are done and the main agent is now checking", so it is left out rather
|
|
9
|
-
* than guessed.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
export const STAGES = ['idle', 'clarify', 'planning', 'awaiting', 'executing', 'na']
|
|
13
|
-
|
|
14
|
-
/** Tools whose call means work is being handed to other agents. */
|
|
15
|
-
export const DELEGATE_TOOLS = new Set(['subagent', 'subagent_fork', 'workflow', 'orchestrate'])
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* A forked session inherits the parent's history, so its tool calls say nothing
|
|
19
|
-
* about this session's own stage. It reports `na` instead of a misleading stage.
|
|
20
|
-
*/
|
|
21
|
-
export function initialState(inheritedEventCount) {
|
|
22
|
-
return { stage: inheritedEventCount > 0 ? 'na' : 'idle', plan: false }
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** The tool a call event names. PTC dispatch carries the name on its start event. */
|
|
26
|
-
function calledTool(event) {
|
|
27
|
-
if (event.type !== 'tool/call' && event.type !== 'tool/ptc-dispatch-start') return undefined
|
|
28
|
-
const name = event.data?.name
|
|
29
|
-
return typeof name === 'string' ? name : undefined
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function reduceStage(state, event) {
|
|
33
|
-
if (state.stage === 'na') return state
|
|
34
|
-
|
|
35
|
-
if (event.type === 'turn/start') {
|
|
36
|
-
return state.stage === 'idle' ? { ...state, stage: 'clarify' } : state
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (event.type === 'plan/mode') {
|
|
40
|
-
if (event.data?.active === true) return { stage: 'planning', plan: true }
|
|
41
|
-
// Leaving plan mode while a plan is awaiting review means it was approved.
|
|
42
|
-
if (state.stage === 'awaiting') return { stage: 'executing', plan: false }
|
|
43
|
-
// Leaving by hand mid-planning drops back to conversation.
|
|
44
|
-
if (state.stage === 'planning') return { stage: 'clarify', plan: false }
|
|
45
|
-
return { ...state, plan: false }
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const tool = calledTool(event)
|
|
49
|
-
if (tool === undefined) return state
|
|
50
|
-
|
|
51
|
-
if (tool === 'todo_write') {
|
|
52
|
-
return state.stage === 'idle' || state.stage === 'clarify' ? { ...state, stage: 'planning' } : state
|
|
53
|
-
}
|
|
54
|
-
if (tool === 'exit_plan_mode') {
|
|
55
|
-
return state.plan ? { ...state, stage: 'awaiting' } : state
|
|
56
|
-
}
|
|
57
|
-
if (DELEGATE_TOOLS.has(tool)) {
|
|
58
|
-
// Delegation while still planning or awaiting review is exploration, not execution.
|
|
59
|
-
return state.stage === 'planning' || state.stage === 'awaiting' ? state : { ...state, stage: 'executing' }
|
|
60
|
-
}
|
|
61
|
-
return state
|
|
62
|
-
}
|