@wrongstack/tui 0.1.10 → 0.2.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.
package/README.md CHANGED
@@ -31,7 +31,7 @@ const exitCode = await runTui({
31
31
  family: 'anthropic',
32
32
  keyTail: '…ABC',
33
33
  effectiveMaxContext: 200_000,
34
- altScreen: false,
34
+ altScreen: true,
35
35
  });
36
36
 
37
37
  process.exit(exitCode);
@@ -76,7 +76,7 @@ process.exit(exitCode);
76
76
 
77
77
  ## Options worth knowing
78
78
 
79
- - **`altScreen: false`** (default) — render into normal scrollback so the user keeps native terminal scroll + history after exit. Set `true` for full-screen mode (no scrollback).
79
+ - **`altScreen: true`** (default) — render into the terminal's alternate screen buffer (vim/less/htop style). The TUI owns the whole viewport, native scrollback is untouched, and the live region cannot leak into terminal history. Raw mode plus alt-screen also means every keystroke — including Ctrl+S, Ctrl+Q, Ctrl+Z, Ctrl+\\ reaches Ink instead of being consumed by the terminal driver (`runTui` additionally registers no-op handlers for `SIGTSTP`/`SIGQUIT`/`SIGTTIN`/`SIGTTOU` as belt-and-suspenders). Set `false` (or pass `--no-alt-screen`) to render into normal scrollback if you specifically want completed chat to survive after exit; the trade-off is the documented live-region leak on resize / overlay-close / picker-submit, and that some shortcuts may fall through to the terminal.
80
80
  - **`effectiveMaxContext`** — the context-bar denominator. Pass the model-specific value resolved via `ModelsRegistry`, not the family baseline; the 1M Opus variant has a much larger window than the 200k default.
81
81
  - **`queueStore`** — if set, queued input survives a crash. Without it, queued lines are in-memory only.
82
82
  - **`onClearHistory`** — invoked from the `/clear` slash command so the TUI can wipe its rendered history entries (keeping just the banner) while `Agent`/memory reset happens elsewhere.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Agent, SlashCommandRegistry, AttachmentStore, EventBus, TokenCounter, QueueStore } from '@wrongstack/core';
1
+ import { Agent, SlashCommandRegistry, AttachmentStore, EventBus, TokenCounter, QueueStore, Director } from '@wrongstack/core';
2
2
  import React from 'react';
3
3
 
4
4
  interface ProviderOption {
@@ -44,12 +44,13 @@ interface RunTuiOptions {
44
44
  effectiveMaxContext?: number;
45
45
  /**
46
46
  * Render into the terminal's alternate screen buffer (like vim/less/htop).
47
- * Default: false — we render into normal scrollback so the user can
48
- * scroll history with the terminal's native mouse wheel / Shift+PgUp,
49
- * and so completed chat survives after exit. Pass true to switch to
50
- * a fixed full-screen view (no scrollback, no native scroll); useful
51
- * when terminal redraw flicker is bad enough to outweigh the loss of
52
- * scrollback.
47
+ * Default: false — native scrollback stays live so chat history is
48
+ * scrollable via mouse wheel / Shift+PgUp, which matches the user's
49
+ * "this is a chat app, let me scroll the chat" intuition. Pass true
50
+ * (or run with `--alt-screen`) for the full-screen mode that owns the
51
+ * terminal and prevents resize/overlay leaks of the live region
52
+ * trade-off is that the terminal's native scrollback is suspended
53
+ * while the TUI is up and only what's currently on screen is visible.
53
54
  */
54
55
  altScreen?: boolean;
55
56
  /**
@@ -65,6 +66,46 @@ interface RunTuiOptions {
65
66
  } | {
66
67
  type: 'resetContextChip';
67
68
  }>) => void;
69
+ /**
70
+ * Live director instance. When set, the TUI renders a fleet panel
71
+ * showing every spawned subagent, its current task, streaming output,
72
+ * and runtime cost — updated live from the FleetBus. Pass null or omit
73
+ * when multi-agent / director mode is disabled.
74
+ */
75
+ director?: Director | null;
76
+ /**
77
+ * Optional roster reference for resolving subagent role ids to
78
+ * human-readable names. Same value passed to director.tools().
79
+ */
80
+ fleetRoster?: Record<string, {
81
+ name: string;
82
+ }>;
83
+ /**
84
+ * Shared controller for the `/fleet stream on|off` toggle. The slash
85
+ * command runs in the CLI process and needs to flip TUI reducer state;
86
+ * the App installs a dispatch-backed `setEnabled` here on mount so
87
+ * both sides stay synchronized.
88
+ */
89
+ fleetStreamController?: {
90
+ enabled: boolean;
91
+ setEnabled: (enabled: boolean) => void;
92
+ };
93
+ /**
94
+ * If set, the App boots straight into goal mode — the text is wrapped
95
+ * in the GOAL preamble and submitted as the first turn. Lets users
96
+ * launch directly from the shell:
97
+ * wstack --tui --director --goal "audit packages/core for races"
98
+ * The chat shows a one-line "🎯 Goal locked: …" hint; the actual
99
+ * preamble is hidden from the visible history (same as `/goal`).
100
+ */
101
+ initialGoal?: string;
102
+ /**
103
+ * If set, submitted as the first turn verbatim (no preamble). Mainly
104
+ * for scripted shell aliases — `wstack --tui --ask "summarize foo.md"`
105
+ * — that want one turn pre-populated without the goal-mode framing.
106
+ * Ignored when `initialGoal` is also set.
107
+ */
108
+ initialAsk?: string;
68
109
  }
69
110
  declare function runTui(opts: RunTuiOptions): Promise<number>;
70
111