dsh-my-go 0.1.5 → 0.1.7

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.
@@ -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) => {
@@ -221,9 +228,14 @@ function apply(ctx) {
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 };
224
- const PROVIDERS = ["", "octopus", "deepseek"];
225
- const MODELS = ["", "mimo-v2.5", "deepseek-v4-flash", "deepseek-v4-pro", "deepseek-v3"];
231
+ const FALLBACK_PROVIDERS = ["octopus", "deepseek", "deepseek-chat"];
232
+ const FALLBACK_MODELS = ["mimo-v2.5", "deepseek-v4-flash", "deepseek-v4-pro", "deepseek-v3", "deepseek-v3-chat", "deepseek-reasoner"];
226
233
  const EFFORTS = ["", "low", "high", "max"];
234
+ const providers = available.providers.length > 0 ? available.providers : FALLBACK_PROVIDERS;
235
+ const modelSet = /* @__PURE__ */ new Set();
236
+ for (const m of Object.values(available.models)) for (const id of m) modelSet.add(id);
237
+ if (modelSet.size === 0) for (const m of FALLBACK_MODELS) modelSet.add(m);
238
+ const allModels = [...modelSet];
227
239
  const providerLabel = (v) => v === "" ? "\u8DDF\u968F Sisyphus" : v;
228
240
  const modelLabel = (v) => v === "" ? "\u8DDF\u968F Sisyphus" : v;
229
241
  const effortLabel = (v) => v === "" ? "\u8DDF\u968F\u6A21\u578B\u9ED8\u8BA4" : v;
@@ -252,13 +264,13 @@ function apply(ctx) {
252
264
  "div",
253
265
  null,
254
266
  React.createElement("div", { style: labelStyle }, "Provider"),
255
- makeSelect(cfg.provider ?? "", PROVIDERS, providerLabel, (v) => set(type, "provider", v))
267
+ makeSelect(cfg.provider ?? "", ["", ...providers], providerLabel, (v) => set(type, "provider", v))
256
268
  ),
257
269
  React.createElement(
258
270
  "div",
259
271
  null,
260
272
  React.createElement("div", { style: labelStyle }, "Model"),
261
- makeSelect(cfg.model ?? "", MODELS, modelLabel, (v) => set(type, "model", v))
273
+ makeSelect(cfg.model ?? "", ["", ...allModels], modelLabel, (v) => set(type, "model", v))
262
274
  )
263
275
  ),
264
276
  React.createElement(
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) => {
@@ -226,9 +233,14 @@ function apply(ctx) {
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 };
229
- const PROVIDERS = ["", "octopus", "deepseek"];
230
- const MODELS = ["", "mimo-v2.5", "deepseek-v4-flash", "deepseek-v4-pro", "deepseek-v3"];
236
+ const FALLBACK_PROVIDERS = ["octopus", "deepseek", "deepseek-chat"];
237
+ const FALLBACK_MODELS = ["mimo-v2.5", "deepseek-v4-flash", "deepseek-v4-pro", "deepseek-v3", "deepseek-v3-chat", "deepseek-reasoner"];
231
238
  const EFFORTS = ["", "low", "high", "max"];
239
+ const providers = available.providers.length > 0 ? available.providers : FALLBACK_PROVIDERS;
240
+ const modelSet = /* @__PURE__ */ new Set();
241
+ for (const m of Object.values(available.models)) for (const id of m) modelSet.add(id);
242
+ if (modelSet.size === 0) for (const m of FALLBACK_MODELS) modelSet.add(m);
243
+ const allModels = [...modelSet];
232
244
  const providerLabel = (v) => v === "" ? "\u8DDF\u968F Sisyphus" : v;
233
245
  const modelLabel = (v) => v === "" ? "\u8DDF\u968F Sisyphus" : v;
234
246
  const effortLabel = (v) => v === "" ? "\u8DDF\u968F\u6A21\u578B\u9ED8\u8BA4" : v;
@@ -257,13 +269,13 @@ function apply(ctx) {
257
269
  "div",
258
270
  null,
259
271
  React.createElement("div", { style: labelStyle }, "Provider"),
260
- makeSelect(cfg.provider ?? "", PROVIDERS, providerLabel, (v) => set(type, "provider", v))
272
+ makeSelect(cfg.provider ?? "", ["", ...providers], providerLabel, (v) => set(type, "provider", v))
261
273
  ),
262
274
  React.createElement(
263
275
  "div",
264
276
  null,
265
277
  React.createElement("div", { style: labelStyle }, "Model"),
266
- makeSelect(cfg.model ?? "", MODELS, modelLabel, (v) => set(type, "model", v))
278
+ makeSelect(cfg.model ?? "", ["", ...allModels], modelLabel, (v) => set(type, "model", v))
267
279
  )
268
280
  ),
269
281
  React.createElement(
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.5",
3
+ "version": "0.1.7",
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 交来的计划是**步骤序列**,不是一份可以直接甩给 hephaestus 的大任务。你要
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' } }, '设置服务不可用')
@@ -207,10 +213,16 @@ export function apply(ctx) {
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
 
210
- const PROVIDERS = ['', 'octopus', 'deepseek']
211
- const MODELS = ['', 'mimo-v2.5', 'deepseek-v4-flash', 'deepseek-v4-pro', 'deepseek-v3']
216
+ const FALLBACK_PROVIDERS = ['octopus', 'deepseek', 'deepseek-chat']
217
+ const FALLBACK_MODELS = ['mimo-v2.5', 'deepseek-v4-flash', 'deepseek-v4-pro', 'deepseek-v3', 'deepseek-v3-chat', 'deepseek-reasoner']
212
218
  const EFFORTS = ['', 'low', 'high', 'max']
213
219
 
220
+ const providers = available.providers.length > 0 ? available.providers : FALLBACK_PROVIDERS
221
+ const modelSet = new Set()
222
+ for (const m of Object.values(available.models)) for (const id of m) modelSet.add(id)
223
+ if (modelSet.size === 0) for (const m of FALLBACK_MODELS) modelSet.add(m)
224
+ const allModels = [...modelSet]
225
+
214
226
  const providerLabel = (v) => v === '' ? '跟随 Sisyphus' : v
215
227
  const modelLabel = (v) => v === '' ? '跟随 Sisyphus' : v
216
228
  const effortLabel = (v) => v === '' ? '跟随模型默认' : v
@@ -232,11 +244,11 @@ export function apply(ctx) {
232
244
  React.createElement('div', { style: rowStyle },
233
245
  React.createElement('div', null,
234
246
  React.createElement('div', { style: labelStyle }, 'Provider'),
235
- makeSelect(cfg.provider ?? '', PROVIDERS, providerLabel, (v) => set(type, 'provider', v)),
247
+ makeSelect(cfg.provider ?? '', ['', ...providers], providerLabel, (v) => set(type, 'provider', v)),
236
248
  ),
237
249
  React.createElement('div', null,
238
250
  React.createElement('div', { style: labelStyle }, 'Model'),
239
- makeSelect(cfg.model ?? '', MODELS, modelLabel, (v) => set(type, 'model', v)),
251
+ makeSelect(cfg.model ?? '', ['', ...allModels], modelLabel, (v) => set(type, 'model', v)),
240
252
  ),
241
253
  ),
242
254
  React.createElement('div', { style: rowStyle },