dsh-my-go 0.1.4 → 0.1.6
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/dist/client.core.js +26 -4
- package/dist/client.js +26 -4
- package/lib/index.js +14 -1
- package/package.json +1 -1
- package/preset/tools/orchestration-section.mjs +23 -5
- package/src/client.js +27 -4
package/dist/client.core.js
CHANGED
|
@@ -193,6 +193,7 @@ function apply(ctx) {
|
|
|
193
193
|
const [draft, setDraft] = React.useState(null);
|
|
194
194
|
const [saving, setSaving] = React.useState(false);
|
|
195
195
|
const [msg, setMsg] = React.useState(null);
|
|
196
|
+
const [available, setAvailable] = React.useState({ providers: [], models: {} });
|
|
196
197
|
React.useEffect(() => {
|
|
197
198
|
if (!sp) return;
|
|
198
199
|
try {
|
|
@@ -200,6 +201,12 @@ function apply(ctx) {
|
|
|
200
201
|
} catch {
|
|
201
202
|
setDraft({});
|
|
202
203
|
}
|
|
204
|
+
if (host && typeof host.call === "function") {
|
|
205
|
+
host.call("dsh-my-go/listModels").then((data) => {
|
|
206
|
+
if (data && Array.isArray(data.providers)) setAvailable(data);
|
|
207
|
+
}).catch(() => {
|
|
208
|
+
});
|
|
209
|
+
}
|
|
203
210
|
}, [sp]);
|
|
204
211
|
if (!sp) return React.createElement("div", { style: { padding: 16, color: "#888" } }, "\u8BBE\u7F6E\u670D\u52A1\u4E0D\u53EF\u7528");
|
|
205
212
|
const set = (type, field, value) => {
|
|
@@ -217,10 +224,25 @@ function apply(ctx) {
|
|
|
217
224
|
setSaving(false);
|
|
218
225
|
}
|
|
219
226
|
};
|
|
220
|
-
const
|
|
227
|
+
const selectStyle = { background: "var(--surface, #1e1e1e)", color: "var(--text, #e0e0e0)", border: "1px solid var(--separator, #333)", borderRadius: 4, padding: "4px 8px", fontSize: 13, width: "100%", boxSizing: "border-box" };
|
|
221
228
|
const labelStyle = { fontSize: 12, color: "var(--text-secondary, #888)", marginBottom: 2 };
|
|
222
229
|
const cardStyle = { border: "1px solid var(--separator, #333)", borderRadius: 8, padding: 12, marginBottom: 12 };
|
|
223
230
|
const rowStyle = { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8, marginBottom: 8 };
|
|
231
|
+
const PROVIDERS = ["", ...available.providers];
|
|
232
|
+
const ALL_MODELS = /* @__PURE__ */ new Set();
|
|
233
|
+
for (const m of Object.values(available.models)) for (const id of m) ALL_MODELS.add(id);
|
|
234
|
+
const MODELS = ["", ...ALL_MODELS];
|
|
235
|
+
const EFFORTS = ["", "low", "high", "max"];
|
|
236
|
+
const providerLabel = (v) => v === "" ? "\u8DDF\u968F Sisyphus" : v;
|
|
237
|
+
const modelLabel = (v) => v === "" ? "\u8DDF\u968F Sisyphus" : v;
|
|
238
|
+
const effortLabel = (v) => v === "" ? "\u8DDF\u968F\u6A21\u578B\u9ED8\u8BA4" : v;
|
|
239
|
+
const makeSelect = (value, options, labelFn, onChange) => React.createElement(
|
|
240
|
+
"select",
|
|
241
|
+
{ style: selectStyle, value: value ?? "", onChange: (e) => onChange(e.target.value) },
|
|
242
|
+
...options.map(
|
|
243
|
+
(opt) => React.createElement("option", { key: opt, value: opt }, labelFn(opt))
|
|
244
|
+
)
|
|
245
|
+
);
|
|
224
246
|
return React.createElement(
|
|
225
247
|
"div",
|
|
226
248
|
{ style: { padding: 16, maxWidth: 600 } },
|
|
@@ -239,13 +261,13 @@ function apply(ctx) {
|
|
|
239
261
|
"div",
|
|
240
262
|
null,
|
|
241
263
|
React.createElement("div", { style: labelStyle }, "Provider"),
|
|
242
|
-
|
|
264
|
+
makeSelect(cfg.provider ?? "", PROVIDERS, providerLabel, (v) => set(type, "provider", v))
|
|
243
265
|
),
|
|
244
266
|
React.createElement(
|
|
245
267
|
"div",
|
|
246
268
|
null,
|
|
247
269
|
React.createElement("div", { style: labelStyle }, "Model"),
|
|
248
|
-
|
|
270
|
+
makeSelect(cfg.model ?? "", MODELS, modelLabel, (v) => set(type, "model", v))
|
|
249
271
|
)
|
|
250
272
|
),
|
|
251
273
|
React.createElement(
|
|
@@ -255,7 +277,7 @@ function apply(ctx) {
|
|
|
255
277
|
"div",
|
|
256
278
|
null,
|
|
257
279
|
React.createElement("div", { style: labelStyle }, "Reasoning Effort"),
|
|
258
|
-
|
|
280
|
+
makeSelect(cfg.reasoningEffort ?? "", EFFORTS, effortLabel, (v) => set(type, "reasoningEffort", v))
|
|
259
281
|
),
|
|
260
282
|
React.createElement(
|
|
261
283
|
"div",
|
package/dist/client.js
CHANGED
|
@@ -198,6 +198,7 @@ function apply(ctx) {
|
|
|
198
198
|
const [draft, setDraft] = React.useState(null);
|
|
199
199
|
const [saving, setSaving] = React.useState(false);
|
|
200
200
|
const [msg, setMsg] = React.useState(null);
|
|
201
|
+
const [available, setAvailable] = React.useState({ providers: [], models: {} });
|
|
201
202
|
React.useEffect(() => {
|
|
202
203
|
if (!sp) return;
|
|
203
204
|
try {
|
|
@@ -205,6 +206,12 @@ function apply(ctx) {
|
|
|
205
206
|
} catch {
|
|
206
207
|
setDraft({});
|
|
207
208
|
}
|
|
209
|
+
if (host && typeof host.call === "function") {
|
|
210
|
+
host.call("dsh-my-go/listModels").then((data) => {
|
|
211
|
+
if (data && Array.isArray(data.providers)) setAvailable(data);
|
|
212
|
+
}).catch(() => {
|
|
213
|
+
});
|
|
214
|
+
}
|
|
208
215
|
}, [sp]);
|
|
209
216
|
if (!sp) return React.createElement("div", { style: { padding: 16, color: "#888" } }, "\u8BBE\u7F6E\u670D\u52A1\u4E0D\u53EF\u7528");
|
|
210
217
|
const set = (type, field, value) => {
|
|
@@ -222,10 +229,25 @@ function apply(ctx) {
|
|
|
222
229
|
setSaving(false);
|
|
223
230
|
}
|
|
224
231
|
};
|
|
225
|
-
const
|
|
232
|
+
const selectStyle = { background: "var(--surface, #1e1e1e)", color: "var(--text, #e0e0e0)", border: "1px solid var(--separator, #333)", borderRadius: 4, padding: "4px 8px", fontSize: 13, width: "100%", boxSizing: "border-box" };
|
|
226
233
|
const labelStyle = { fontSize: 12, color: "var(--text-secondary, #888)", marginBottom: 2 };
|
|
227
234
|
const cardStyle = { border: "1px solid var(--separator, #333)", borderRadius: 8, padding: 12, marginBottom: 12 };
|
|
228
235
|
const rowStyle = { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8, marginBottom: 8 };
|
|
236
|
+
const PROVIDERS = ["", ...available.providers];
|
|
237
|
+
const ALL_MODELS = /* @__PURE__ */ new Set();
|
|
238
|
+
for (const m of Object.values(available.models)) for (const id of m) ALL_MODELS.add(id);
|
|
239
|
+
const MODELS = ["", ...ALL_MODELS];
|
|
240
|
+
const EFFORTS = ["", "low", "high", "max"];
|
|
241
|
+
const providerLabel = (v) => v === "" ? "\u8DDF\u968F Sisyphus" : v;
|
|
242
|
+
const modelLabel = (v) => v === "" ? "\u8DDF\u968F Sisyphus" : v;
|
|
243
|
+
const effortLabel = (v) => v === "" ? "\u8DDF\u968F\u6A21\u578B\u9ED8\u8BA4" : v;
|
|
244
|
+
const makeSelect = (value, options, labelFn, onChange) => React.createElement(
|
|
245
|
+
"select",
|
|
246
|
+
{ style: selectStyle, value: value ?? "", onChange: (e) => onChange(e.target.value) },
|
|
247
|
+
...options.map(
|
|
248
|
+
(opt) => React.createElement("option", { key: opt, value: opt }, labelFn(opt))
|
|
249
|
+
)
|
|
250
|
+
);
|
|
229
251
|
return React.createElement(
|
|
230
252
|
"div",
|
|
231
253
|
{ style: { padding: 16, maxWidth: 600 } },
|
|
@@ -244,13 +266,13 @@ function apply(ctx) {
|
|
|
244
266
|
"div",
|
|
245
267
|
null,
|
|
246
268
|
React.createElement("div", { style: labelStyle }, "Provider"),
|
|
247
|
-
|
|
269
|
+
makeSelect(cfg.provider ?? "", PROVIDERS, providerLabel, (v) => set(type, "provider", v))
|
|
248
270
|
),
|
|
249
271
|
React.createElement(
|
|
250
272
|
"div",
|
|
251
273
|
null,
|
|
252
274
|
React.createElement("div", { style: labelStyle }, "Model"),
|
|
253
|
-
|
|
275
|
+
makeSelect(cfg.model ?? "", MODELS, modelLabel, (v) => set(type, "model", v))
|
|
254
276
|
)
|
|
255
277
|
),
|
|
256
278
|
React.createElement(
|
|
@@ -260,7 +282,7 @@ function apply(ctx) {
|
|
|
260
282
|
"div",
|
|
261
283
|
null,
|
|
262
284
|
React.createElement("div", { style: labelStyle }, "Reasoning Effort"),
|
|
263
|
-
|
|
285
|
+
makeSelect(cfg.reasoningEffort ?? "", EFFORTS, effortLabel, (v) => set(type, "reasoningEffort", v))
|
|
264
286
|
),
|
|
265
287
|
React.createElement(
|
|
266
288
|
"div",
|
package/lib/index.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
export const name = 'dsh-my-go'
|
|
18
18
|
|
|
19
|
-
export const inject = ['tools', 'subagents', 'systemPrompt']
|
|
19
|
+
export const inject = ['tools', 'subagents', 'systemPrompt', 'llm']
|
|
20
20
|
|
|
21
21
|
import { access, cp, mkdir } from 'node:fs/promises'
|
|
22
22
|
import { dirname, join } from 'node:path'
|
|
@@ -346,6 +346,19 @@ export async function apply(ctx, config = {}) {
|
|
|
346
346
|
if (harness && typeof harness.handle === 'function') {
|
|
347
347
|
disposers.push(harness.handle('dsh-my-go/snapshot', async () => latestSnapshot ?? { seq: 0, current: null, queue: [], helpRequests: [], history: [] }))
|
|
348
348
|
disposers.push(harness.handle('dsh-my-go/notify', async () => { bump(); return { seq: snapshotSeq } }))
|
|
349
|
+
disposers.push(harness.handle('dsh-my-go/listModels', async () => {
|
|
350
|
+
const llm = ctx.get('llm')
|
|
351
|
+
if (!llm) return { providers: [], models: {} }
|
|
352
|
+
const providers = await llm.listProviders()
|
|
353
|
+
const result = { providers: providers.map((p) => p.id), models: {} }
|
|
354
|
+
for (const pid of result.providers) {
|
|
355
|
+
try {
|
|
356
|
+
const models = await llm.listModels(pid)
|
|
357
|
+
result.models[pid] = models.map((m) => m.id)
|
|
358
|
+
} catch { /* provider may not support listing */ }
|
|
359
|
+
}
|
|
360
|
+
return result
|
|
361
|
+
}))
|
|
349
362
|
}
|
|
350
363
|
|
|
351
364
|
// ── internal go_work implementation (shared by the tool, forward, queue) ─
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-my-go",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "DSH plugin: Sisyphus agent orchestration — star topology, single-line blocking, 7 specialist sub-agents (Hermes/Explore/Librarian/Looker/Hephaestus/Prometheus/Oracle) with per-type model binding, go_work/continue/need_help/forward communication tools, Web UI tree panel and settings.",
|
|
5
5
|
"author": "daizihan233",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,8 +14,7 @@ export const inject = ['systemPrompt']
|
|
|
14
14
|
|
|
15
15
|
const SECTION_TEXT = `# Sisyphus 编排规则
|
|
16
16
|
|
|
17
|
-
你是 Sisyphus:总调度 +
|
|
18
|
-
难度与类型挑选合适的工种,而不是把整个任务一次性甩给一个子智能体。
|
|
17
|
+
你是 Sisyphus:总调度 + 质检官。子智能体不直接通信,全部经由你中转。
|
|
19
18
|
|
|
20
19
|
## 你的工具
|
|
21
20
|
- \`go_work(agent, prompt)\` — 派发一个新子智能体(空上下文)。可用类型见下方「工种清单」。
|
|
@@ -28,6 +27,26 @@ const SECTION_TEXT = `# Sisyphus 编排规则
|
|
|
28
27
|
- \`list_subagents\` — 列出已派发的所有 sub-agent(类型/childId/状态/最后收到的 prompt)。
|
|
29
28
|
派发或复用前先调用它:能 continue 复用的(同任务、上下文有价值)就不要重新 go_work。
|
|
30
29
|
|
|
30
|
+
## 何时调用 Prometheus(重要)
|
|
31
|
+
|
|
32
|
+
**不要对每个任务都先调 Prometheus。** Prometheus 只在以下情况需要:
|
|
33
|
+
|
|
34
|
+
1. **需求模糊**:用户描述含混,有多种理解方式,需要调研、提问、细化后才能执行。
|
|
35
|
+
例如:「帮我优化一下这个项目」「做个新功能」。
|
|
36
|
+
2. **任务庞大且复杂**:涉及多个模块、多步骤、需要先摸清现状再规划的大型任务。
|
|
37
|
+
例如:「重构认证模块」「实现一个完整的 CI/CD 流水线」。
|
|
38
|
+
3. **涉及不确定的依赖或技术选型**:需要先调研可行性再决定方案。
|
|
39
|
+
|
|
40
|
+
**以下情况直接派工种,跳过 Prometheus:**
|
|
41
|
+
|
|
42
|
+
1. **需求明确无歧义**:任务目标清晰、步骤可直接推断。
|
|
43
|
+
例如:「帮我看看这个项目在干啥」「读一下 README」「找到 XXX 文件」。
|
|
44
|
+
2. **单步可完成的轻活**:一个工种就能搞定的小任务。
|
|
45
|
+
例如:「把这个变量名改成 XXX」「格式化这段代码」「搜索某个函数」。
|
|
46
|
+
3. **用户明确指定了工种和做法**。
|
|
47
|
+
|
|
48
|
+
简单判断标准:如果用户的话已经足够明确到你能直接写出子智能体的 prompt,就不要调 Prometheus。
|
|
49
|
+
|
|
31
50
|
## 工种清单(你可调用的子智能体)
|
|
32
51
|
- \`prometheus\` — 需求规划。调研、提问、细化需求,把模糊需求拆成**可执行步骤序列**
|
|
33
52
|
(每步只描述做什么与交付物,不标工种)。仅在流程开始时调用一次;它输出计划后由你
|
|
@@ -39,9 +58,8 @@ const SECTION_TEXT = `# Sisyphus 编排规则
|
|
|
39
58
|
- \`hephaestus\` — 代码编写。单文件重构、模块实现、单元测试、常规代码生成。(触发词:写代码/实现/重构/修改)
|
|
40
59
|
- \`oracle\` — 架构调试 + 终验。跨模块依赖分析、深层 Bug 定位、代码审查、最终验收。(触发词:调试/架构/审查/验证)
|
|
41
60
|
|
|
42
|
-
##
|
|
43
|
-
Prometheus
|
|
44
|
-
**逐步骤决策**:
|
|
61
|
+
## 步骤级调度
|
|
62
|
+
当 Prometheus 交来计划(或你自己拆解了多步任务)时,**逐步骤决策**:
|
|
45
63
|
1. 看这一步的类型与难度(检索?实现?重构?验收?)。
|
|
46
64
|
2. 选择最省 token 的工种:轻活(检索/文档/批量)派轻工种(explore/librarian/hermes),
|
|
47
65
|
重活(写代码/调试/终验)派重工种(hephaestus/oracle)。
|
package/src/client.js
CHANGED
|
@@ -180,10 +180,16 @@ export function apply(ctx) {
|
|
|
180
180
|
const [draft, setDraft] = React.useState(null)
|
|
181
181
|
const [saving, setSaving] = React.useState(false)
|
|
182
182
|
const [msg, setMsg] = React.useState(null)
|
|
183
|
+
const [available, setAvailable] = React.useState({ providers: [], models: {} })
|
|
183
184
|
|
|
184
185
|
React.useEffect(() => {
|
|
185
186
|
if (!sp) return
|
|
186
187
|
try { setDraft(sp.read()) } catch { setDraft({}) }
|
|
188
|
+
if (host && typeof host.call === 'function') {
|
|
189
|
+
host.call('dsh-my-go/listModels').then((data) => {
|
|
190
|
+
if (data && Array.isArray(data.providers)) setAvailable(data)
|
|
191
|
+
}).catch(() => {})
|
|
192
|
+
}
|
|
187
193
|
}, [sp])
|
|
188
194
|
|
|
189
195
|
if (!sp) return React.createElement('div', { style: { padding: 16, color: '#888' } }, '设置服务不可用')
|
|
@@ -202,11 +208,28 @@ export function apply(ctx) {
|
|
|
202
208
|
} finally { setSaving(false) }
|
|
203
209
|
}
|
|
204
210
|
|
|
205
|
-
const
|
|
211
|
+
const selectStyle = { background: 'var(--surface, #1e1e1e)', color: 'var(--text, #e0e0e0)', border: '1px solid var(--separator, #333)', borderRadius: 4, padding: '4px 8px', fontSize: 13, width: '100%', boxSizing: 'border-box' }
|
|
206
212
|
const labelStyle = { fontSize: 12, color: 'var(--text-secondary, #888)', marginBottom: 2 }
|
|
207
213
|
const cardStyle = { border: '1px solid var(--separator, #333)', borderRadius: 8, padding: 12, marginBottom: 12 }
|
|
208
214
|
const rowStyle = { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8, marginBottom: 8 }
|
|
209
215
|
|
|
216
|
+
const PROVIDERS = ['', ...available.providers]
|
|
217
|
+
const ALL_MODELS = new Set()
|
|
218
|
+
for (const m of Object.values(available.models)) for (const id of m) ALL_MODELS.add(id)
|
|
219
|
+
const MODELS = ['', ...ALL_MODELS]
|
|
220
|
+
const EFFORTS = ['', 'low', 'high', 'max']
|
|
221
|
+
|
|
222
|
+
const providerLabel = (v) => v === '' ? '跟随 Sisyphus' : v
|
|
223
|
+
const modelLabel = (v) => v === '' ? '跟随 Sisyphus' : v
|
|
224
|
+
const effortLabel = (v) => v === '' ? '跟随模型默认' : v
|
|
225
|
+
|
|
226
|
+
const makeSelect = (value, options, labelFn, onChange) =>
|
|
227
|
+
React.createElement('select', { style: selectStyle, value: value ?? '', onChange: (e) => onChange(e.target.value) },
|
|
228
|
+
...options.map((opt) =>
|
|
229
|
+
React.createElement('option', { key: opt, value: opt }, labelFn(opt))
|
|
230
|
+
)
|
|
231
|
+
)
|
|
232
|
+
|
|
210
233
|
return React.createElement('div', { style: { padding: 16, maxWidth: 600 } },
|
|
211
234
|
React.createElement('h2', { style: { margin: '0 0 4px' } }, 'MyGO 编排配置'),
|
|
212
235
|
React.createElement('p', { style: { margin: '0 0 16px', fontSize: 13, color: 'var(--text-secondary, #888)' } }, '每个子智能体的模型 / Provider / 思考程度 / DSV4P0813 补丁开关。修改后点保存,下次派发生效。'),
|
|
@@ -217,17 +240,17 @@ export function apply(ctx) {
|
|
|
217
240
|
React.createElement('div', { style: rowStyle },
|
|
218
241
|
React.createElement('div', null,
|
|
219
242
|
React.createElement('div', { style: labelStyle }, 'Provider'),
|
|
220
|
-
|
|
243
|
+
makeSelect(cfg.provider ?? '', PROVIDERS, providerLabel, (v) => set(type, 'provider', v)),
|
|
221
244
|
),
|
|
222
245
|
React.createElement('div', null,
|
|
223
246
|
React.createElement('div', { style: labelStyle }, 'Model'),
|
|
224
|
-
|
|
247
|
+
makeSelect(cfg.model ?? '', MODELS, modelLabel, (v) => set(type, 'model', v)),
|
|
225
248
|
),
|
|
226
249
|
),
|
|
227
250
|
React.createElement('div', { style: rowStyle },
|
|
228
251
|
React.createElement('div', null,
|
|
229
252
|
React.createElement('div', { style: labelStyle }, 'Reasoning Effort'),
|
|
230
|
-
|
|
253
|
+
makeSelect(cfg.reasoningEffort ?? '', EFFORTS, effortLabel, (v) => set(type, 'reasoningEffort', v)),
|
|
231
254
|
),
|
|
232
255
|
React.createElement('div', { style: { display: 'flex', alignItems: 'flex-end', gap: 8 } },
|
|
233
256
|
React.createElement('label', { style: { display: 'flex', alignItems: 'center', gap: 6, cursor: 'pointer', fontSize: 13, paddingTop: 18 } },
|