@mars.liu/dsh-cybernetics 0.25.1 → 0.25.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.
Files changed (2) hide show
  1. package/lib/client.js +59 -2
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -221,6 +221,10 @@ window.__ModuleLoader__.load({
221
221
  // richer mode.tip.* wording (source + round detail).
222
222
  'mode.pillCounts': '控制模式:{stopped}/{total}',
223
223
  'mode.pillUnknown': '控制模式:…',
224
+ // 编辑器下方提示条标签(v0.25.3):括号式「控制模式({stopped}/{total})({plan})」,
225
+ // plan 为当前会话使用的 agent preset(方案)名称,未选择任何方案时为「未命名」。
226
+ 'mode.hintCounts': '控制模式({stopped}/{total})({plan})',
227
+ 'mode.plan.unnamed': '未命名',
224
228
  'mode.state.on': '开',
225
229
  'mode.state.off': '关',
226
230
  'mode.state.unknown': '…',
@@ -407,6 +411,11 @@ window.__ModuleLoader__.load({
407
411
  // v0.18.x: same label contract as the zh dictionary (key parity).
408
412
  'mode.pillCounts': 'Control {stopped}/{total}',
409
413
  'mode.pillUnknown': 'Control …',
414
+ // Composer hint bar label (v0.25.3): parenthesized segments
415
+ // 「控制模式({stopped}/{total})({plan})」 — plan = the session's
416
+ // active agent-preset name, or "Unnamed" when none is selected.
417
+ 'mode.hintCounts': '控制模式({stopped}/{total})({plan})',
418
+ 'mode.plan.unnamed': 'Unnamed',
410
419
  'mode.state.on': 'On',
411
420
  'mode.state.off': 'Off',
412
421
  'mode.state.unknown': '…',
@@ -2392,6 +2401,43 @@ window.__ModuleLoader__.load({
2392
2401
  const PILL_RING_STROKE = 2;
2393
2402
  const PILL_RING_DASHARRAY = '28.3 9.4';
2394
2403
 
2404
+ // v0.25.2: resolve the display name of the session's active agent
2405
+ // preset (方案) for the composer hint bar's third segment. Data
2406
+ // source: the plugin ConfigForm snapshot's live value — `presetPlan`
2407
+ // is the current selector ('' = nothing selected → 「未命名」;
2408
+ // 'custom:<id>' = a user-saved preset whose display name lives in
2409
+ // the `customPresets` JSON list; anything else = a built-in vendor
2410
+ // preset id whose label comes from PRESET_CHOICES via the locale
2411
+ // dicts). Shape-tolerant everywhere: a malformed/missing snapshot
2412
+ // or a dangling custom id degrades to 「未命名」, never throws.
2413
+ // Exported on module.exports for offline unit tests.
2414
+ function resolvePlanName(cfgSnap, t) {
2415
+ const cfg = cfgSnap !== undefined && cfgSnap !== null && typeof cfgSnap === 'object'
2416
+ && cfgSnap.status === 'ready' && cfgSnap.value !== null && typeof cfgSnap.value === 'object'
2417
+ ? cfgSnap.value
2418
+ : {};
2419
+ const plan = typeof cfg.presetPlan === 'string' ? cfg.presetPlan : '';
2420
+ if (plan === '') return t('mode.plan.unnamed');
2421
+ if (plan.startsWith('custom:')) {
2422
+ const customId = plan.slice('custom:'.length);
2423
+ try {
2424
+ const parsed = JSON.parse(cfg.customPresets);
2425
+ if (Array.isArray(parsed)) {
2426
+ for (const entry of parsed) {
2427
+ if (entry !== null && typeof entry === 'object'
2428
+ && entry.id === customId
2429
+ && typeof entry.name === 'string' && entry.name.trim() !== '') {
2430
+ return entry.name.trim();
2431
+ }
2432
+ }
2433
+ }
2434
+ } catch { /* corrupt payload → unnamed */ }
2435
+ return t('mode.plan.unnamed');
2436
+ }
2437
+ const choice = PRESET_CHOICES.find((opt) => opt.id === plan);
2438
+ return choice ? t(choice.labelKey) : plan;
2439
+ }
2440
+
2395
2441
  // v0.12.0: the running-state animation styles, injected into document.head
2396
2442
  // exactly once per page load (guarded by the data attribute). Later
2397
2443
  // change: the running indicator is a slowly rotating ring instead of a
@@ -2646,7 +2692,18 @@ window.__ModuleLoader__.load({
2646
2692
  style: modeIndicatorStyles.hint,
2647
2693
  children: [
2648
2694
  renderModeRing(running.count > 0, MODE_ON_COLOR),
2649
- jsx.jsx('span', { style: { overflow: 'hidden', textOverflow: 'ellipsis' }, children: t('mode.pillCounts', { stopped: counts.stopped, total: counts.total }) }),
2695
+ // v0.25.2: three-segment label「控制模式|{stopped}/{total}|{plan}」
2696
+ // — same goal counts as the session pill, plus the active
2697
+ // agent-preset name (「未命名」 when no preset is selected).
2698
+ // The insert/queue wording stays in the tooltip.
2699
+ jsx.jsx('span', {
2700
+ style: { overflow: 'hidden', textOverflow: 'ellipsis' },
2701
+ children: t('mode.hintCounts', {
2702
+ stopped: counts.stopped,
2703
+ total: counts.total,
2704
+ plan: resolvePlanName(cfgSnap, t),
2705
+ }),
2706
+ }),
2650
2707
  ],
2651
2708
  });
2652
2709
  }
@@ -3145,7 +3202,7 @@ window.__ModuleLoader__.load({
3145
3202
  // singleton) exported for the offline harness (test/v20-home-entry.mjs).
3146
3203
  module.exports = {
3147
3204
  name, inject, apply, countRunningGoals, countGoals, readHintLocation,
3148
- usePopupRows,
3205
+ usePopupRows, resolvePlanName,
3149
3206
  homeSessionOf, requestHome, consumeHomeRequest,
3150
3207
  };
3151
3208
  return module.exports;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mars.liu/dsh-cybernetics",
3
- "version": "0.25.1",
3
+ "version": "0.25.2",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "files": [