dsh-my-go 0.1.6 → 0.1.8

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.
@@ -228,11 +228,8 @@ function apply(ctx) {
228
228
  const labelStyle = { fontSize: 12, color: "var(--text-secondary, #888)", marginBottom: 2 };
229
229
  const cardStyle = { border: "1px solid var(--separator, #333)", borderRadius: 8, padding: 12, marginBottom: 12 };
230
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
231
  const EFFORTS = ["", "low", "high", "max"];
232
+ const allModels = [...new Set(Object.values(available.models).flat())];
236
233
  const providerLabel = (v) => v === "" ? "\u8DDF\u968F Sisyphus" : v;
237
234
  const modelLabel = (v) => v === "" ? "\u8DDF\u968F Sisyphus" : v;
238
235
  const effortLabel = (v) => v === "" ? "\u8DDF\u968F\u6A21\u578B\u9ED8\u8BA4" : v;
@@ -243,11 +240,15 @@ function apply(ctx) {
243
240
  (opt) => React.createElement("option", { key: opt, value: opt }, labelFn(opt))
244
241
  )
245
242
  );
243
+ const fetchFailed = available.providers.length === 0;
246
244
  return React.createElement(
247
245
  "div",
248
246
  { style: { padding: 16, maxWidth: 600 } },
249
247
  React.createElement("h2", { style: { margin: "0 0 4px" } }, "MyGO \u7F16\u6392\u914D\u7F6E"),
250
248
  React.createElement("p", { style: { margin: "0 0 16px", fontSize: 13, color: "var(--text-secondary, #888)" } }, "\u6BCF\u4E2A\u5B50\u667A\u80FD\u4F53\u7684\u6A21\u578B / Provider / \u601D\u8003\u7A0B\u5EA6 / DSV4P0813 \u8865\u4E01\u5F00\u5173\u3002\u4FEE\u6539\u540E\u70B9\u4FDD\u5B58\uFF0C\u4E0B\u6B21\u6D3E\u53D1\u751F\u6548\u3002"),
249
+ fetchFailed ? React.createElement("div", {
250
+ style: { padding: 12, marginBottom: 16, borderRadius: 6, background: "rgba(244,67,54,0.1)", border: "1px solid rgba(244,67,54,0.3)", fontSize: 13 }
251
+ }, "\u26A0 \u65E0\u6CD5\u4ECE DSH \u83B7\u53D6 Provider/Model \u5217\u8868\u3002\u8BF7\u786E\u8BA4\uFF1A1) \u5DF2\u91CD\u542F dsh web\uFF1B2) LLM \u63D2\u4EF6\u5DF2\u914D\u7F6E\u5E76\u6FC0\u6D3B\u3002\u4E0B\u62C9\u6846\u4ECD\u53EF\u624B\u52A8\u8F93\u5165\u81EA\u5B9A\u4E49\u503C\u3002") : null,
251
252
  ...AGENT_TYPES.map((type) => {
252
253
  const cfg = draft?.[type] || {};
253
254
  return React.createElement(
@@ -261,13 +262,13 @@ function apply(ctx) {
261
262
  "div",
262
263
  null,
263
264
  React.createElement("div", { style: labelStyle }, "Provider"),
264
- makeSelect(cfg.provider ?? "", PROVIDERS, providerLabel, (v) => set(type, "provider", v))
265
+ makeSelect(cfg.provider ?? "", ["", ...providers], providerLabel, (v) => set(type, "provider", v))
265
266
  ),
266
267
  React.createElement(
267
268
  "div",
268
269
  null,
269
270
  React.createElement("div", { style: labelStyle }, "Model"),
270
- makeSelect(cfg.model ?? "", MODELS, modelLabel, (v) => set(type, "model", v))
271
+ makeSelect(cfg.model ?? "", ["", ...allModels], modelLabel, (v) => set(type, "model", v))
271
272
  )
272
273
  ),
273
274
  React.createElement(
package/dist/client.js CHANGED
@@ -233,11 +233,8 @@ function apply(ctx) {
233
233
  const labelStyle = { fontSize: 12, color: "var(--text-secondary, #888)", marginBottom: 2 };
234
234
  const cardStyle = { border: "1px solid var(--separator, #333)", borderRadius: 8, padding: 12, marginBottom: 12 };
235
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
236
  const EFFORTS = ["", "low", "high", "max"];
237
+ const allModels = [...new Set(Object.values(available.models).flat())];
241
238
  const providerLabel = (v) => v === "" ? "\u8DDF\u968F Sisyphus" : v;
242
239
  const modelLabel = (v) => v === "" ? "\u8DDF\u968F Sisyphus" : v;
243
240
  const effortLabel = (v) => v === "" ? "\u8DDF\u968F\u6A21\u578B\u9ED8\u8BA4" : v;
@@ -248,11 +245,15 @@ function apply(ctx) {
248
245
  (opt) => React.createElement("option", { key: opt, value: opt }, labelFn(opt))
249
246
  )
250
247
  );
248
+ const fetchFailed = available.providers.length === 0;
251
249
  return React.createElement(
252
250
  "div",
253
251
  { style: { padding: 16, maxWidth: 600 } },
254
252
  React.createElement("h2", { style: { margin: "0 0 4px" } }, "MyGO \u7F16\u6392\u914D\u7F6E"),
255
253
  React.createElement("p", { style: { margin: "0 0 16px", fontSize: 13, color: "var(--text-secondary, #888)" } }, "\u6BCF\u4E2A\u5B50\u667A\u80FD\u4F53\u7684\u6A21\u578B / Provider / \u601D\u8003\u7A0B\u5EA6 / DSV4P0813 \u8865\u4E01\u5F00\u5173\u3002\u4FEE\u6539\u540E\u70B9\u4FDD\u5B58\uFF0C\u4E0B\u6B21\u6D3E\u53D1\u751F\u6548\u3002"),
254
+ fetchFailed ? React.createElement("div", {
255
+ style: { padding: 12, marginBottom: 16, borderRadius: 6, background: "rgba(244,67,54,0.1)", border: "1px solid rgba(244,67,54,0.3)", fontSize: 13 }
256
+ }, "\u26A0 \u65E0\u6CD5\u4ECE DSH \u83B7\u53D6 Provider/Model \u5217\u8868\u3002\u8BF7\u786E\u8BA4\uFF1A1) \u5DF2\u91CD\u542F dsh web\uFF1B2) LLM \u63D2\u4EF6\u5DF2\u914D\u7F6E\u5E76\u6FC0\u6D3B\u3002\u4E0B\u62C9\u6846\u4ECD\u53EF\u624B\u52A8\u8F93\u5165\u81EA\u5B9A\u4E49\u503C\u3002") : null,
256
257
  ...AGENT_TYPES.map((type) => {
257
258
  const cfg = draft?.[type] || {};
258
259
  return React.createElement(
@@ -266,13 +267,13 @@ function apply(ctx) {
266
267
  "div",
267
268
  null,
268
269
  React.createElement("div", { style: labelStyle }, "Provider"),
269
- makeSelect(cfg.provider ?? "", PROVIDERS, providerLabel, (v) => set(type, "provider", v))
270
+ makeSelect(cfg.provider ?? "", ["", ...providers], providerLabel, (v) => set(type, "provider", v))
270
271
  ),
271
272
  React.createElement(
272
273
  "div",
273
274
  null,
274
275
  React.createElement("div", { style: labelStyle }, "Model"),
275
- makeSelect(cfg.model ?? "", MODELS, modelLabel, (v) => set(type, "model", v))
276
+ makeSelect(cfg.model ?? "", ["", ...allModels], modelLabel, (v) => set(type, "model", v))
276
277
  )
277
278
  ),
278
279
  React.createElement(
package/lib/index.js CHANGED
@@ -349,15 +349,24 @@ export async function apply(ctx, config = {}) {
349
349
  disposers.push(harness.handle('dsh-my-go/listModels', async () => {
350
350
  const llm = ctx.get('llm')
351
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) {
352
+ let providers = []
353
+ try {
354
+ const all = llm.listConfigurableProviders()
355
+ providers = all.map((p) => p.provider)
356
+ } catch {
357
+ try {
358
+ const active = await llm.listProviders()
359
+ providers = active.map((p) => p.id)
360
+ } catch { /* llm not available */ }
361
+ }
362
+ const models = {}
363
+ for (const pid of providers) {
355
364
  try {
356
- const models = await llm.listModels(pid)
357
- result.models[pid] = models.map((m) => m.id)
365
+ const list = await llm.listModels(pid)
366
+ models[pid] = list.map((m) => m.id)
358
367
  } catch { /* provider may not support listing */ }
359
368
  }
360
- return result
369
+ return { providers, models }
361
370
  }))
362
371
  }
363
372
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-my-go",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
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",
package/src/client.js CHANGED
@@ -213,11 +213,8 @@ export function apply(ctx) {
213
213
  const cardStyle = { border: '1px solid var(--separator, #333)', borderRadius: 8, padding: 12, marginBottom: 12 }
214
214
  const rowStyle = { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8, marginBottom: 8 }
215
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
216
  const EFFORTS = ['', 'low', 'high', 'max']
217
+ const allModels = [...new Set(Object.values(available.models).flat())]
221
218
 
222
219
  const providerLabel = (v) => v === '' ? '跟随 Sisyphus' : v
223
220
  const modelLabel = (v) => v === '' ? '跟随 Sisyphus' : v
@@ -230,9 +227,14 @@ export function apply(ctx) {
230
227
  )
231
228
  )
232
229
 
230
+ const fetchFailed = available.providers.length === 0
231
+
233
232
  return React.createElement('div', { style: { padding: 16, maxWidth: 600 } },
234
233
  React.createElement('h2', { style: { margin: '0 0 4px' } }, 'MyGO 编排配置'),
235
234
  React.createElement('p', { style: { margin: '0 0 16px', fontSize: 13, color: 'var(--text-secondary, #888)' } }, '每个子智能体的模型 / Provider / 思考程度 / DSV4P0813 补丁开关。修改后点保存,下次派发生效。'),
235
+ fetchFailed ? React.createElement('div', {
236
+ style: { padding: 12, marginBottom: 16, borderRadius: 6, background: 'rgba(244,67,54,0.1)', border: '1px solid rgba(244,67,54,0.3)', fontSize: 13 },
237
+ }, '⚠ 无法从 DSH 获取 Provider/Model 列表。请确认:1) 已重启 dsh web;2) LLM 插件已配置并激活。下拉框仍可手动输入自定义值。') : null,
236
238
  ...AGENT_TYPES.map((type) => {
237
239
  const cfg = draft?.[type] || {}
238
240
  return React.createElement('div', { key: type, style: cardStyle },
@@ -240,11 +242,11 @@ export function apply(ctx) {
240
242
  React.createElement('div', { style: rowStyle },
241
243
  React.createElement('div', null,
242
244
  React.createElement('div', { style: labelStyle }, 'Provider'),
243
- makeSelect(cfg.provider ?? '', PROVIDERS, providerLabel, (v) => set(type, 'provider', v)),
245
+ makeSelect(cfg.provider ?? '', ['', ...providers], providerLabel, (v) => set(type, 'provider', v)),
244
246
  ),
245
247
  React.createElement('div', null,
246
248
  React.createElement('div', { style: labelStyle }, 'Model'),
247
- makeSelect(cfg.model ?? '', MODELS, modelLabel, (v) => set(type, 'model', v)),
249
+ makeSelect(cfg.model ?? '', ['', ...allModels], modelLabel, (v) => set(type, 'model', v)),
248
250
  ),
249
251
  ),
250
252
  React.createElement('div', { style: rowStyle },