dsh-my-go 0.4.1 → 0.4.2
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/lib/index.js +24 -17
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -662,8 +662,8 @@ export async function apply(ctx, config = {}) {
|
|
|
662
662
|
bindings = merged
|
|
663
663
|
}
|
|
664
664
|
})
|
|
665
|
-
} catch {
|
|
666
|
-
|
|
665
|
+
} catch (e) {
|
|
666
|
+
console.warn('[dsh-my-go] settings registration failed (defaults apply):', e)
|
|
667
667
|
}
|
|
668
668
|
}
|
|
669
669
|
|
|
@@ -883,30 +883,37 @@ export async function apply(ctx, config = {}) {
|
|
|
883
883
|
}
|
|
884
884
|
if (endpoint === 'saveSettings') {
|
|
885
885
|
const draft = payload
|
|
886
|
-
if (!draft || typeof draft !== 'object') return { ok: false, error: { code: '
|
|
886
|
+
if (!draft || typeof draft !== 'object') return { ok: false, error: { code: 'internal', message: 'payload must be an object', details: {} } }
|
|
887
887
|
const settingsService = ctx.get('settings')
|
|
888
|
-
if (!settingsService) return { ok: false, error: { code: '
|
|
888
|
+
if (!settingsService) return { ok: false, error: { code: 'internal', message: 'settings service not available', details: {} } }
|
|
889
889
|
try {
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
890
|
+
// 优先使用 settingsScope.replace(整段替换),比 mutate 更稳健;
|
|
891
|
+
// 降级到 mutate(path ops)兜底。
|
|
892
|
+
if (settingsScope && typeof settingsScope.replace === 'function') {
|
|
893
|
+
await settingsScope.replace(draft)
|
|
894
|
+
} else {
|
|
895
|
+
const agentTypes = ['sisyphus', 'hermes', 'explore', 'librarian', 'looker', 'hephaestus', 'prometheus', 'oracle']
|
|
896
|
+
const fields = ['provider', 'model', 'reasoningEffort', 'dsv4p0813', 'peakRouting', 'peakProvider', 'peakModel', 'offpeakProvider', 'offpeakModel']
|
|
897
|
+
const ops = []
|
|
898
|
+
for (const type of agentTypes) {
|
|
899
|
+
for (const field of fields) {
|
|
900
|
+
const val = draft[type]?.[field]
|
|
901
|
+
if (val === undefined || val === null || val === '') {
|
|
902
|
+
ops.push({ op: 'unset', path: [type, field] })
|
|
903
|
+
} else {
|
|
904
|
+
ops.push({ op: 'set', path: [type, field], value: val })
|
|
905
|
+
}
|
|
900
906
|
}
|
|
901
907
|
}
|
|
908
|
+
if (ops.length > 0) await settingsService.mutate('dsh-my-go', ops)
|
|
902
909
|
}
|
|
903
|
-
if (ops.length > 0) await settingsService.mutate('dsh-my-go', ops)
|
|
904
910
|
return { ok: true, value: null }
|
|
905
911
|
} catch (e) {
|
|
906
|
-
|
|
912
|
+
console.error('[dsh-my-go] saveSettings failed:', e)
|
|
913
|
+
return { ok: false, error: { code: 'settings-rejected', message: String(e), details: { ns: 'dsh-my-go' } } }
|
|
907
914
|
}
|
|
908
915
|
}
|
|
909
|
-
return { ok: false, error: { code: '
|
|
916
|
+
return { ok: false, error: { code: 'internal', message: `unknown endpoint: ${endpoint}`, details: {} } }
|
|
910
917
|
}, { authority: 'trusted-host' })
|
|
911
918
|
})
|
|
912
919
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-my-go",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
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": "Tisitan",
|
|
6
6
|
"license": "MIT",
|