@agi-fans/dsh-tui 0.17.0 → 0.18.0

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 (54) hide show
  1. package/lib/CHANGELOG.md +36 -1
  2. package/lib/chrome/status-config.d.ts +4 -1
  3. package/lib/chrome/status-config.js.map +1 -1
  4. package/lib/chrome/tool-renderers.js +0 -2
  5. package/lib/chrome/tool-renderers.js.map +1 -1
  6. package/lib/commands/auth.js +4 -2
  7. package/lib/commands/auth.js.map +1 -1
  8. package/lib/commands/jobs.d.ts +2 -2
  9. package/lib/commands/jobs.js +2 -2
  10. package/lib/commands/jobs.js.map +1 -1
  11. package/lib/definition.d.ts +3 -0
  12. package/lib/definition.js.map +1 -1
  13. package/lib/index.d.ts +1 -1
  14. package/lib/index.js +1 -1
  15. package/lib/index.js.map +1 -1
  16. package/lib/runtime/provider-local.d.ts +43 -7
  17. package/lib/runtime/provider-local.js +75 -32
  18. package/lib/runtime/provider-local.js.map +1 -1
  19. package/lib/runtime/session-runtime.d.ts +9 -1
  20. package/lib/runtime/session-runtime.js +2 -2
  21. package/lib/runtime/session-runtime.js.map +1 -1
  22. package/lib/runtime/startup-notices.js +6 -9
  23. package/lib/runtime/startup-notices.js.map +1 -1
  24. package/lib/runtime/tool-presentation.js +3 -3
  25. package/lib/runtime/tool-presentation.js.map +1 -1
  26. package/lib/session/job-notice.d.ts +2 -2
  27. package/lib/session/job-notice.js.map +1 -1
  28. package/lib/session/session-configuration.d.ts +0 -3
  29. package/lib/session/session-configuration.js +0 -4
  30. package/lib/session/session-configuration.js.map +1 -1
  31. package/lib/session/session-controller.d.ts +6 -4
  32. package/lib/session/session-controller.js +96 -42
  33. package/lib/session/session-controller.js.map +1 -1
  34. package/lib/session/session-library.d.ts +20 -0
  35. package/lib/session/session-library.js +52 -0
  36. package/lib/session/session-library.js.map +1 -1
  37. package/lib/session/subagent-roster.js +3 -3
  38. package/lib/session/subagent-roster.js.map +1 -1
  39. package/lib/session/subagent-tracker.d.ts +2 -9
  40. package/lib/session/subagent-tracker.js +3 -4
  41. package/lib/session/subagent-tracker.js.map +1 -1
  42. package/lib/session/tui-settings.d.ts +41 -18
  43. package/lib/session/tui-settings.js +57 -39
  44. package/lib/session/tui-settings.js.map +1 -1
  45. package/lib/views/at-complete.d.ts +2 -0
  46. package/lib/views/at-complete.js +2 -2
  47. package/lib/views/at-complete.js.map +1 -1
  48. package/lib/views/event-views.js +9 -12
  49. package/lib/views/event-views.js.map +1 -1
  50. package/lib/views/settings-list.d.ts +2 -2
  51. package/lib/views/settings-list.js.map +1 -1
  52. package/lib/views/transcript-export.js +0 -2
  53. package/lib/views/transcript-export.js.map +1 -1
  54. package/package.json +39 -38
@@ -35,13 +35,14 @@ import { applyTranscriptSearchEvent, createTranscriptSearch, searchBlockIndexes,
35
35
  import { nextRevealStep, revealStreamingAssistant, streamingAssistantKey, streamingAssistantUnits, } from "../views/streaming-reveal.js";
36
36
  import { flushPending, parseKeys } from "../input/keys.js";
37
37
  import { MainScreenRenderer } from "../chrome/main-screen-renderer.js";
38
- import { colorDisabledByEnv, detectTrueColor, parseThemeName } from "../chrome/theme.js";
38
+ import { colorDisabledByEnv, detectTrueColor } from "../chrome/theme.js";
39
39
  import { renderTool } from "../chrome/tool-renderers.js";
40
- import { TUI_SETTINGS_NAMESPACE, TuiSettingsSchema } from "../session/tui-settings.js";
40
+ import { TUI_SETTINGS_ENTRY, TUI_SETTINGS_FIELDS } from "../session/tui-settings.js";
41
41
  import { defaultStatusBarConfig, resolveStatusBarConfig } from "../chrome/status-config.js";
42
42
  import { HistoryStore } from "../session/history-store.js";
43
43
  import { loadKeybindings } from "../input/keybindings-config.js";
44
44
  import { editExternally } from "../input/external-editor.js";
45
+ import z from '@deepseek-ai/schemastery';
45
46
  import { movePromptSelection, filteredPromptOptions, selectedPromptAnswer, selectedFilteredPromptAnswer, togglePromptSelection, } from "../views/prompt-selector.js";
46
47
  import { refreshProjectContext, resolveProjectContext } from "../session/project-context.js";
47
48
  import { pickWelcomeTips } from "../chrome/welcome-tips.js";
@@ -89,6 +90,17 @@ function windowTitleText(title) {
89
90
  return [...cleaned].slice(0, WINDOW_TITLE_MAX).join('');
90
91
  }
91
92
  export const name = 'omdsh-tui';
93
+ /**
94
+ * Row schema. The durable preferences ride as volatile fields, so a settings
95
+ * form edit commits into their references and reaches this fiber through
96
+ * `loader/volatile-update` without remounting the terminal provider.
97
+ */
98
+ export const Config = z.object({
99
+ model: z.string(),
100
+ historyPath: z.string(),
101
+ keybindingsPath: z.string(),
102
+ ...TUI_SETTINGS_FIELDS,
103
+ });
92
104
  /**
93
105
  * Local terminal presentation service.
94
106
  */
@@ -645,7 +657,7 @@ export class LocalTui {
645
657
  #syncTrueColor() {
646
658
  this.#trueColor = this.#colors && detectTrueColor();
647
659
  }
648
- /** Apply prefs loaded from the settings document (does not persist). */
660
+ /** Apply prefs loaded from this entry's config (does not persist). */
649
661
  applyStoredPrefs(prefs) {
650
662
  this.#applyPrefs(prefs, { persist: false, forceToolsSync: true });
651
663
  if (this.#settings !== null)
@@ -653,6 +665,29 @@ export class LocalTui {
653
665
  if (this.#tty)
654
666
  this.#render();
655
667
  }
668
+ /** Currently applied preferences; sibling rows read these instead of the config references. */
669
+ prefs() {
670
+ return {
671
+ theme: this.#themeName,
672
+ colors: this.#colors,
673
+ motion: this.#motion,
674
+ terminalProgress: this.#terminalProgress,
675
+ expandTools: this.#expandTools,
676
+ checkUpdates: this.#checkUpdates,
677
+ startupChangelog: this.#startupChangelog,
678
+ notifications: this.#notificationPolicy,
679
+ notificationThreshold: this.#notificationThreshold,
680
+ statusBar: {
681
+ ...this.#statusBar,
682
+ groups: [...this.#statusBar.groups],
683
+ ...(this.#statusBar.order === undefined ? {} : { order: [...this.#statusBar.order] }),
684
+ ...(this.#statusBar.meta === undefined ? {} : { meta: [...this.#statusBar.meta] }),
685
+ ...(this.#statusBar.metaOrder === undefined ? {} : { metaOrder: [...this.#statusBar.metaOrder] }),
686
+ ...(this.#statusBar.colors === undefined ? {} : { colors: { ...this.#statusBar.colors } }),
687
+ ...(this.#statusBar.sides === undefined ? {} : { sides: { ...this.#statusBar.sides } }),
688
+ },
689
+ };
690
+ }
656
691
  /** Called after a live `/settings` change. */
657
692
  setPrefsPersist(persist) {
658
693
  this.#persistPrefs = persist;
@@ -675,7 +710,7 @@ export class LocalTui {
675
710
  this.#agentBehavior = undefined;
676
711
  this.#agentBehaviorPending = false;
677
712
  if (this.#settings !== null)
678
- this.#settings = createSettings(this.#prefs());
713
+ this.#settings = createSettings(this.prefs());
679
714
  if (this.#tty && !this.#disposed)
680
715
  this.#render();
681
716
  };
@@ -1620,28 +1655,6 @@ export class LocalTui {
1620
1655
  this.#agentHub = createAgentHub({ agents });
1621
1656
  this.#render();
1622
1657
  }
1623
- #prefs() {
1624
- return {
1625
- theme: this.#themeName,
1626
- colors: this.#colors,
1627
- motion: this.#motion,
1628
- terminalProgress: this.#terminalProgress,
1629
- expandTools: this.#expandTools,
1630
- checkUpdates: this.#checkUpdates,
1631
- startupChangelog: this.#startupChangelog,
1632
- notifications: this.#notificationPolicy,
1633
- notificationThreshold: this.#notificationThreshold,
1634
- statusBar: {
1635
- ...this.#statusBar,
1636
- groups: [...this.#statusBar.groups],
1637
- ...(this.#statusBar.order === undefined ? {} : { order: [...this.#statusBar.order] }),
1638
- ...(this.#statusBar.meta === undefined ? {} : { meta: [...this.#statusBar.meta] }),
1639
- ...(this.#statusBar.metaOrder === undefined ? {} : { metaOrder: [...this.#statusBar.metaOrder] }),
1640
- ...(this.#statusBar.colors === undefined ? {} : { colors: { ...this.#statusBar.colors } }),
1641
- ...(this.#statusBar.sides === undefined ? {} : { sides: { ...this.#statusBar.sides } }),
1642
- },
1643
- };
1644
- }
1645
1658
  #applyPrefs(prefs, options) {
1646
1659
  const previousMotion = this.#motion;
1647
1660
  const expandChanged = prefs.expandTools !== this.#expandTools;
@@ -2324,7 +2337,7 @@ export class LocalTui {
2324
2337
  }
2325
2338
  this.#search = null;
2326
2339
  this.#ac = null;
2327
- this.#settings = createSettings(this.#prefs(), undefined, this.#agentBehavior);
2340
+ this.#settings = createSettings(this.prefs(), undefined, this.#agentBehavior);
2328
2341
  this.#render();
2329
2342
  }
2330
2343
  #notice(text) {
@@ -2521,7 +2534,7 @@ export function apply(ctx, config) {
2521
2534
  return () => { process.stdout.removeListener('resize', listener); };
2522
2535
  },
2523
2536
  };
2524
- const tui = new LocalTui(term, config.model, config.colors, parseThemeName(config.theme), copyToClipboard, {
2537
+ const tui = new LocalTui(term, config.model, config.colors.get(), config.theme.get(), copyToClipboard, {
2525
2538
  deferInitialRender: true,
2526
2539
  terminalProfile,
2527
2540
  alternateScreenOverlays: terminalProfile === 'direct',
@@ -2531,11 +2544,41 @@ export function apply(ctx, config) {
2531
2544
  });
2532
2545
  ctx.provide(TUI_SERVICE, tui);
2533
2546
  ctx.effect(() => () => { tui.dispose(); });
2547
+ // Preferences are this entry's own volatile config: the initial read applies
2548
+ // them without persisting, a committed form edit dispatches a volatile update
2549
+ // to this fiber only, and an in-app `/settings` change writes back through the
2550
+ // settings service, which persists the edit into the active profile patch.
2551
+ const storedPrefs = () => {
2552
+ const prefs = {
2553
+ theme: config.theme.get(),
2554
+ colors: resolveColors(config.colors.get(), term.output.isTTY === true),
2555
+ motion: config.motion.get(),
2556
+ terminalProgress: config.terminalProgress.get(),
2557
+ expandTools: config.expandTools.get(),
2558
+ checkUpdates: config.checkUpdates.get(),
2559
+ startupChangelog: config.startupChangelog.get(),
2560
+ notifications: config.notifications.get(),
2561
+ notificationThreshold: config.notificationThreshold.get(),
2562
+ };
2563
+ const statusBar = config.statusBar.get();
2564
+ // The reference holds a frozen snapshot; the provider keeps a mutable copy.
2565
+ if (statusBar !== undefined)
2566
+ prefs.statusBar = structuredClone(statusBar);
2567
+ const statusPreset = config.statusPreset.get();
2568
+ if (statusPreset !== undefined)
2569
+ prefs.statusPreset = statusPreset;
2570
+ return prefs;
2571
+ };
2572
+ tui.applyStoredPrefs(storedPrefs());
2573
+ ctx.on('loader/volatile-update', () => { tui.applyStoredPrefs(storedPrefs()); });
2574
+ // Persistence needs the settings service; without one the provider still runs
2575
+ // and an in-app change stays session-local, as it did before.
2534
2576
  ctx.inject(['settings'], (settingsCtx) => {
2535
- const scope = settingsCtx.settings.register(TUI_SETTINGS_NAMESPACE, TuiSettingsSchema, { base: { theme: parseThemeName(config.theme), colors: resolveColors(config.colors, term.output.isTTY === true), expandTools: false } });
2536
- tui.applyStoredPrefs(scope.get());
2537
- tui.setPrefsPersist((prefs) => { void scope.update(prefs); });
2538
- scope.watch((next) => { tui.applyStoredPrefs(next); });
2577
+ tui.setPrefsPersist((prefs) => {
2578
+ const ops = Object.entries(prefs).map(([key, value]) => ({ op: 'set', path: [key], value }));
2579
+ void settingsCtx.settings.mutate(TUI_SETTINGS_ENTRY, ops)
2580
+ .catch((error) => { settingsCtx.logger.warn(error); });
2581
+ });
2539
2582
  });
2540
2583
  }
2541
2584
  //# sourceMappingURL=provider-local.js.map