@linxin666/dsh-liangshen 0.3.13 → 0.3.15

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 CHANGED
@@ -453,13 +453,23 @@ function applyImpl(ctx, config) {
453
453
  });
454
454
  };
455
455
  ctx.inject(["settings"], (settingsCtx) => {
456
- settingsCtx.settings.installSection(ctx, LIANGSHEN_SETTINGS_NAMESPACE, Config, config ?? {}, {
457
- setSource: (source) => {
458
- current = source;
456
+ try {
457
+ if (typeof settingsCtx.settings?.installSection === "function") settingsCtx.settings.installSection(ctx, LIANGSHEN_SETTINGS_NAMESPACE, Config, config ?? {}, {
458
+ setSource: (source) => {
459
+ current = source;
460
+ refresh();
461
+ },
462
+ onChange: refresh
463
+ });
464
+ else if (typeof settingsCtx.settings?.register === "function") {
465
+ const scope = settingsCtx.settings.register(LIANGSHEN_SETTINGS_NAMESPACE, Config, { base: config ?? {} });
466
+ current = () => scope?.get?.() ?? config ?? {};
467
+ scope?.watch?.(() => {
468
+ refresh();
469
+ });
459
470
  refresh();
460
- },
461
- onChange: refresh
462
- });
471
+ }
472
+ } catch {}
463
473
  });
464
474
  refresh();
465
475
  ctx.effect(() => () => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@linxin666/dsh-liangshen",
3
3
  "description": "LiangShen (梁神) agent preset for the dsh web GUI: a two-phase anchored-standard preset — the first model request exposes only the builtin Minimal exact two-tool surface (persistent bash plus str_replace_editor) with no runtime contexts or injected instructions (Minimal-aligned trajectory anchor), promotion is gated on the first minimal-like reasoning block with a fallback, and the wire then switches to PTC Mode (a single run_code tool over the full registry) with the ordinary injections returning afterwards. The preset files are synced into ~/.dsh/.agent-presets on host startup. Hot-pluggable — mounted via cordis.patch.yml + a profile node_modules symlink, no dsh source changes.",
4
- "version": "0.3.13",
4
+ "version": "0.3.15",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": "^22.19.0 || >=24.0.0"
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "dsh": {
20
20
  "engines": {
21
- "dsh": ">=0.1.2-alpha.4"
21
+ "dsh": ">=0.1.2-rc.1"
22
22
  },
23
23
  "bundle": {
24
24
  "patch": "./cordis.patch.yml"
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@deepseek-ai/cordis": "^4.0.2",
32
- "@deepseek-ai/dsh-settings": "^0.1.2-alpha.4",
33
- "@deepseek-ai/dsh-system-prompt": "^0.1.2-alpha.4",
32
+ "@deepseek-ai/dsh-settings": "^0.1.2-rc.1",
33
+ "@deepseek-ai/dsh-system-prompt": "^0.1.2-rc.1",
34
34
  "@types/node": "^22.20.0",
35
35
  "tsdown": "0.22.2",
36
36
  "typescript": "~5.7.2",
@@ -341,7 +341,11 @@ function decidePromotion(state, config) {
341
341
 
342
342
  /** Scan newly appended session events and update promotion state. */
343
343
  function scanEvents(state, session) {
344
- const events = session.events
344
+ const events = Array.isArray(session?.events)
345
+ ? session.events
346
+ : typeof session?.snapshotEvents === 'function'
347
+ ? session.snapshotEvents()
348
+ : []
345
349
  for (; state.next < events.length; state.next += 1) {
346
350
  const event = events[state.next]
347
351
  if (event === undefined) continue
package/src/index.ts CHANGED
@@ -127,13 +127,24 @@ function applyImpl(ctx: Context, config?: Config): void {
127
127
  // fields from this namespace; a settings edit re-runs refresh live, and
128
128
  // deployments without a settings service keep the composition entry.
129
129
  ctx.inject(['settings'], (settingsCtx) => {
130
- settingsCtx.settings.installSection(ctx, LIANGSHEN_SETTINGS_NAMESPACE, Config, config ?? {}, {
131
- setSource: (source) => {
132
- current = source
130
+ try {
131
+ if (typeof settingsCtx.settings?.installSection === 'function') {
132
+ settingsCtx.settings.installSection(ctx, LIANGSHEN_SETTINGS_NAMESPACE, Config, config ?? {}, {
133
+ setSource: (source) => {
134
+ current = source
135
+ refresh()
136
+ },
137
+ onChange: refresh,
138
+ })
139
+ } else if (typeof settingsCtx.settings?.register === 'function') {
140
+ const scope = settingsCtx.settings.register(LIANGSHEN_SETTINGS_NAMESPACE, Config, { base: config ?? {} })
141
+ current = () => scope?.get?.() ?? (config ?? {})
142
+ scope?.watch?.(() => { refresh() })
133
143
  refresh()
134
- },
135
- onChange: refresh,
136
- })
144
+ }
145
+ } catch {
146
+ // Defensive fallback against settings registration differences
147
+ }
137
148
  })
138
149
 
139
150
  refresh()