dsh-my-go 0.1.13 → 0.1.14

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.
@@ -199,12 +199,11 @@ function apply(ctx) {
199
199
  const [available, setAvailable] = React.useState({ providers: [], models: {} });
200
200
  React.useEffect(() => {
201
201
  if (!sp) return;
202
- try {
203
- setDraft(sp.read());
204
- } catch {
205
- setDraft({});
206
- }
207
202
  if (connection && connection.rpc && typeof connection.rpc.call === "function") {
203
+ connection.rpc.call("/dsh-my-go", "loadSettings", {}).then((res) => {
204
+ if (res && res.ok && res.value) setDraft(res.value);
205
+ else setDraft({});
206
+ }).catch(() => setDraft({}));
208
207
  connection.rpc.call("/dsh-my-go", "listModels", {}).then((res) => {
209
208
  if (res && res.ok && res.value && Array.isArray(res.value.providers)) setAvailable(res.value);
210
209
  }).catch(() => {
@@ -246,17 +245,6 @@ function apply(ctx) {
246
245
  setSaving(false);
247
246
  }
248
247
  };
249
- const autoSaveTimer = React.useRef(null);
250
- React.useEffect(() => {
251
- if (!draft || !sp) return;
252
- if (autoSaveTimer.current) clearTimeout(autoSaveTimer.current);
253
- autoSaveTimer.current = setTimeout(() => {
254
- void save();
255
- }, 500);
256
- return () => {
257
- if (autoSaveTimer.current) clearTimeout(autoSaveTimer.current);
258
- };
259
- }, [draft, sp]);
260
248
  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" };
261
249
  const labelStyle = { fontSize: 12, color: "var(--text-secondary, #888)", marginBottom: 2 };
262
250
  const cardStyle = { border: "1px solid var(--separator, #333)", borderRadius: 8, padding: 12, marginBottom: 12 };
package/dist/client.js CHANGED
@@ -204,12 +204,11 @@ function apply(ctx) {
204
204
  const [available, setAvailable] = React.useState({ providers: [], models: {} });
205
205
  React.useEffect(() => {
206
206
  if (!sp) return;
207
- try {
208
- setDraft(sp.read());
209
- } catch {
210
- setDraft({});
211
- }
212
207
  if (connection && connection.rpc && typeof connection.rpc.call === "function") {
208
+ connection.rpc.call("/dsh-my-go", "loadSettings", {}).then((res) => {
209
+ if (res && res.ok && res.value) setDraft(res.value);
210
+ else setDraft({});
211
+ }).catch(() => setDraft({}));
213
212
  connection.rpc.call("/dsh-my-go", "listModels", {}).then((res) => {
214
213
  if (res && res.ok && res.value && Array.isArray(res.value.providers)) setAvailable(res.value);
215
214
  }).catch(() => {
@@ -251,17 +250,6 @@ function apply(ctx) {
251
250
  setSaving(false);
252
251
  }
253
252
  };
254
- const autoSaveTimer = React.useRef(null);
255
- React.useEffect(() => {
256
- if (!draft || !sp) return;
257
- if (autoSaveTimer.current) clearTimeout(autoSaveTimer.current);
258
- autoSaveTimer.current = setTimeout(() => {
259
- void save();
260
- }, 500);
261
- return () => {
262
- if (autoSaveTimer.current) clearTimeout(autoSaveTimer.current);
263
- };
264
- }, [draft, sp]);
265
253
  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" };
266
254
  const labelStyle = { fontSize: 12, color: "var(--text-secondary, #888)", marginBottom: 2 };
267
255
  const cardStyle = { border: "1px solid var(--separator, #333)", borderRadius: 8, padding: 12, marginBottom: 12 };
package/lib/index.js CHANGED
@@ -376,6 +376,16 @@ export async function apply(ctx, config = {}) {
376
376
  }
377
377
  return { ok: true, value: { providers, models } }
378
378
  }
379
+ if (endpoint === 'loadSettings') {
380
+ const settingsService = ctx.get('settings')
381
+ if (!settingsService) return { ok: true, value: {} }
382
+ try {
383
+ const stored = settingsService.get('dsh-my-go')
384
+ return { ok: true, value: stored && typeof stored === 'object' ? stored : {} }
385
+ } catch (e) {
386
+ return { ok: true, value: {} }
387
+ }
388
+ }
379
389
  if (endpoint === 'saveSettings') {
380
390
  const draft = payload
381
391
  if (!draft || typeof draft !== 'object') return { ok: false, error: { code: 'bad-request', message: 'payload must be an object' } }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-my-go",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
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
@@ -187,8 +187,12 @@ export function apply(ctx) {
187
187
 
188
188
  React.useEffect(() => {
189
189
  if (!sp) return
190
- try { setDraft(sp.read()) } catch { setDraft({}) }
190
+ // Load settings via host RPC (DSH SettingsScope doesn't support nested reads)
191
191
  if (connection && connection.rpc && typeof connection.rpc.call === 'function') {
192
+ connection.rpc.call('/dsh-my-go', 'loadSettings', {}).then((res) => {
193
+ if (res && res.ok && res.value) setDraft(res.value)
194
+ else setDraft({})
195
+ }).catch(() => setDraft({}))
192
196
  connection.rpc.call('/dsh-my-go', 'listModels', {}).then((res) => {
193
197
  if (res && res.ok && res.value && Array.isArray(res.value.providers)) setAvailable(res.value)
194
198
  }).catch(() => {})
@@ -212,6 +216,7 @@ export function apply(ctx) {
212
216
  })
213
217
  }
214
218
 
219
+ // Manual save only — auto-save risks infinite loops with settings/updated events
215
220
  const save = async () => {
216
221
  setSaving(true); setMsg(null)
217
222
  try {
@@ -229,15 +234,6 @@ export function apply(ctx) {
229
234
  } finally { setSaving(false) }
230
235
  }
231
236
 
232
- // Auto-save on draft change with debounce
233
- const autoSaveTimer = React.useRef(null)
234
- React.useEffect(() => {
235
- if (!draft || !sp) return
236
- if (autoSaveTimer.current) clearTimeout(autoSaveTimer.current)
237
- autoSaveTimer.current = setTimeout(() => { void save() }, 500)
238
- return () => { if (autoSaveTimer.current) clearTimeout(autoSaveTimer.current) }
239
- }, [draft, sp])
240
-
241
237
  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' }
242
238
  const labelStyle = { fontSize: 12, color: 'var(--text-secondary, #888)', marginBottom: 2 }
243
239
  const cardStyle = { border: '1px solid var(--separator, #333)', borderRadius: 8, padding: 12, marginBottom: 12 }