@wrongstack/tui 0.284.0 → 0.285.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 (239) hide show
  1. package/dist/app-initial-state.d.ts +26 -0
  2. package/dist/app-initial-state.d.ts.map +1 -0
  3. package/dist/app-reducer.d.ts +5 -0
  4. package/dist/app-reducer.d.ts.map +1 -0
  5. package/dist/app-state.d.ts +1801 -0
  6. package/dist/app-state.d.ts.map +1 -0
  7. package/dist/app.d.ts +579 -0
  8. package/dist/app.d.ts.map +1 -0
  9. package/dist/clipboard.d.ts +2 -0
  10. package/dist/clipboard.d.ts.map +1 -0
  11. package/dist/components/agents-monitor.d.ts +49 -0
  12. package/dist/components/agents-monitor.d.ts.map +1 -0
  13. package/dist/components/animation-style.d.ts +51 -0
  14. package/dist/components/animation-style.d.ts.map +1 -0
  15. package/dist/components/audit-panel.d.ts +9 -0
  16. package/dist/components/audit-panel.d.ts.map +1 -0
  17. package/dist/components/auth-panel-model.d.ts +150 -0
  18. package/dist/components/auth-panel-model.d.ts.map +1 -0
  19. package/dist/components/auth-panel.d.ts +8 -0
  20. package/dist/components/auth-panel.d.ts.map +1 -0
  21. package/dist/components/autonomy-picker.d.ts +15 -0
  22. package/dist/components/autonomy-picker.d.ts.map +1 -0
  23. package/dist/components/brain-decision-prompt.d.ts +28 -0
  24. package/dist/components/brain-decision-prompt.d.ts.map +1 -0
  25. package/dist/components/brain-panel.d.ts +16 -0
  26. package/dist/components/brain-panel.d.ts.map +1 -0
  27. package/dist/components/checkpoint-timeline.d.ts +19 -0
  28. package/dist/components/checkpoint-timeline.d.ts.map +1 -0
  29. package/dist/components/confirm-prompt.d.ts +26 -0
  30. package/dist/components/confirm-prompt.d.ts.map +1 -0
  31. package/dist/components/continue-confirm-panel.d.ts +47 -0
  32. package/dist/components/continue-confirm-panel.d.ts.map +1 -0
  33. package/dist/components/coordinator-panel.d.ts +11 -0
  34. package/dist/components/coordinator-panel.d.ts.map +1 -0
  35. package/dist/components/design-picker.d.ts +14 -0
  36. package/dist/components/design-picker.d.ts.map +1 -0
  37. package/dist/components/enhance-panel.d.ts +36 -0
  38. package/dist/components/enhance-panel.d.ts.map +1 -0
  39. package/dist/components/esc-confirm-prompt.d.ts +17 -0
  40. package/dist/components/esc-confirm-prompt.d.ts.map +1 -0
  41. package/dist/components/f-key-picker.d.ts +13 -0
  42. package/dist/components/f-key-picker.d.ts.map +1 -0
  43. package/dist/components/file-picker.d.ts +8 -0
  44. package/dist/components/file-picker.d.ts.map +1 -0
  45. package/dist/components/fleet-monitor.d.ts +60 -0
  46. package/dist/components/fleet-monitor.d.ts.map +1 -0
  47. package/dist/components/fleet-panel.d.ts +69 -0
  48. package/dist/components/fleet-panel.d.ts.map +1 -0
  49. package/dist/components/goal-panel.d.ts +17 -0
  50. package/dist/components/goal-panel.d.ts.map +1 -0
  51. package/dist/components/help-overlay.d.ts +27 -0
  52. package/dist/components/help-overlay.d.ts.map +1 -0
  53. package/dist/components/help-panel.d.ts +16 -0
  54. package/dist/components/help-panel.d.ts.map +1 -0
  55. package/dist/components/history/assistant.d.ts +61 -0
  56. package/dist/components/history/assistant.d.ts.map +1 -0
  57. package/dist/components/history/banner.d.ts +13 -0
  58. package/dist/components/history/banner.d.ts.map +1 -0
  59. package/dist/components/history/code-block.d.ts +217 -0
  60. package/dist/components/history/code-block.d.ts.map +1 -0
  61. package/dist/components/history/entry.d.ts +19 -0
  62. package/dist/components/history/entry.d.ts.map +1 -0
  63. package/dist/components/history/index.d.ts +21 -0
  64. package/dist/components/history/index.d.ts.map +1 -0
  65. package/dist/components/history/replay.d.ts +44 -0
  66. package/dist/components/history/replay.d.ts.map +1 -0
  67. package/dist/components/history/types.d.ts +146 -0
  68. package/dist/components/history/types.d.ts.map +1 -0
  69. package/dist/components/history/utils.d.ts +65 -0
  70. package/dist/components/history/utils.d.ts.map +1 -0
  71. package/dist/components/history.d.ts +2 -0
  72. package/dist/components/history.d.ts.map +1 -0
  73. package/dist/components/input.d.ts +57 -0
  74. package/dist/components/input.d.ts.map +1 -0
  75. package/dist/components/kanban-panel.d.ts +7 -0
  76. package/dist/components/kanban-panel.d.ts.map +1 -0
  77. package/dist/components/key-hint-bar.d.ts +31 -0
  78. package/dist/components/key-hint-bar.d.ts.map +1 -0
  79. package/dist/components/live-activity-strip.d.ts +39 -0
  80. package/dist/components/live-activity-strip.d.ts.map +1 -0
  81. package/dist/components/mailbox-panel.d.ts +40 -0
  82. package/dist/components/mailbox-panel.d.ts.map +1 -0
  83. package/dist/components/mcp-picker.d.ts +18 -0
  84. package/dist/components/mcp-picker.d.ts.map +1 -0
  85. package/dist/components/mode-picker.d.ts +17 -0
  86. package/dist/components/mode-picker.d.ts.map +1 -0
  87. package/dist/components/model-picker.d.ts +32 -0
  88. package/dist/components/model-picker.d.ts.map +1 -0
  89. package/dist/components/phase-monitor.d.ts +33 -0
  90. package/dist/components/phase-monitor.d.ts.map +1 -0
  91. package/dist/components/phase-panel.d.ts +22 -0
  92. package/dist/components/phase-panel.d.ts.map +1 -0
  93. package/dist/components/plan-panel.d.ts +17 -0
  94. package/dist/components/plan-panel.d.ts.map +1 -0
  95. package/dist/components/plugin-picker.d.ts +22 -0
  96. package/dist/components/plugin-picker.d.ts.map +1 -0
  97. package/dist/components/process-list.d.ts +14 -0
  98. package/dist/components/process-list.d.ts.map +1 -0
  99. package/dist/components/project-picker.d.ts +21 -0
  100. package/dist/components/project-picker.d.ts.map +1 -0
  101. package/dist/components/prompt-picker.d.ts +31 -0
  102. package/dist/components/prompt-picker.d.ts.map +1 -0
  103. package/dist/components/provider-colors.d.ts +40 -0
  104. package/dist/components/provider-colors.d.ts.map +1 -0
  105. package/dist/components/queue-panel.d.ts +16 -0
  106. package/dist/components/queue-panel.d.ts.map +1 -0
  107. package/dist/components/resume-picker.d.ts +16 -0
  108. package/dist/components/resume-picker.d.ts.map +1 -0
  109. package/dist/components/scrollable-history.d.ts +60 -0
  110. package/dist/components/scrollable-history.d.ts.map +1 -0
  111. package/dist/components/sdd-board-overlay.d.ts +15 -0
  112. package/dist/components/sdd-board-overlay.d.ts.map +1 -0
  113. package/dist/components/send-mode-picker.d.ts +64 -0
  114. package/dist/components/send-mode-picker.d.ts.map +1 -0
  115. package/dist/components/sessions-panel.d.ts +46 -0
  116. package/dist/components/sessions-panel.d.ts.map +1 -0
  117. package/dist/components/settings-picker.d.ts +371 -0
  118. package/dist/components/settings-picker.d.ts.map +1 -0
  119. package/dist/components/shadow-panel.d.ts +13 -0
  120. package/dist/components/shadow-panel.d.ts.map +1 -0
  121. package/dist/components/shell-command-warning.d.ts +9 -0
  122. package/dist/components/shell-command-warning.d.ts.map +1 -0
  123. package/dist/components/slash-menu.d.ts +9 -0
  124. package/dist/components/slash-menu.d.ts.map +1 -0
  125. package/dist/components/status-bar.d.ts +378 -0
  126. package/dist/components/status-bar.d.ts.map +1 -0
  127. package/dist/components/statusline-picker.d.ts +55 -0
  128. package/dist/components/statusline-picker.d.ts.map +1 -0
  129. package/dist/components/suggestions.d.ts +9 -0
  130. package/dist/components/suggestions.d.ts.map +1 -0
  131. package/dist/components/todos-monitor.d.ts +13 -0
  132. package/dist/components/todos-monitor.d.ts.map +1 -0
  133. package/dist/components/tools-picker.d.ts +20 -0
  134. package/dist/components/tools-picker.d.ts.map +1 -0
  135. package/dist/components/worktree-monitor.d.ts +23 -0
  136. package/dist/components/worktree-monitor.d.ts.map +1 -0
  137. package/dist/components/worktree-panel.d.ts +21 -0
  138. package/dist/components/worktree-panel.d.ts.map +1 -0
  139. package/dist/f-key-panels.d.ts +46 -0
  140. package/dist/f-key-panels.d.ts.map +1 -0
  141. package/dist/file-search.d.ts +3 -0
  142. package/dist/file-search.d.ts.map +1 -0
  143. package/dist/fn-keys.d.ts +20 -0
  144. package/dist/fn-keys.d.ts.map +1 -0
  145. package/dist/git-info.d.ts +20 -0
  146. package/dist/git-info.d.ts.map +1 -0
  147. package/dist/heap-watchdog.d.ts +41 -0
  148. package/dist/heap-watchdog.d.ts.map +1 -0
  149. package/dist/highlight.d.ts +30 -0
  150. package/dist/highlight.d.ts.map +1 -0
  151. package/dist/hit-test.d.ts +75 -0
  152. package/dist/hit-test.d.ts.map +1 -0
  153. package/dist/hooks/use-auth-panel.d.ts +38 -0
  154. package/dist/hooks/use-auth-panel.d.ts.map +1 -0
  155. package/dist/hooks/use-autonomous-coordinator.d.ts +21 -0
  156. package/dist/hooks/use-autonomous-coordinator.d.ts.map +1 -0
  157. package/dist/hooks/use-brain-events.d.ts +7 -0
  158. package/dist/hooks/use-brain-events.d.ts.map +1 -0
  159. package/dist/hooks/use-director-fleet-bridge.d.ts +17 -0
  160. package/dist/hooks/use-director-fleet-bridge.d.ts.map +1 -0
  161. package/dist/hooks/use-file-search.d.ts +42 -0
  162. package/dist/hooks/use-file-search.d.ts.map +1 -0
  163. package/dist/hooks/use-input-history-persistence.d.ts +14 -0
  164. package/dist/hooks/use-input-history-persistence.d.ts.map +1 -0
  165. package/dist/hooks/use-mode-picker.d.ts +15 -0
  166. package/dist/hooks/use-mode-picker.d.ts.map +1 -0
  167. package/dist/hooks/use-paste-handling.d.ts +30 -0
  168. package/dist/hooks/use-paste-handling.d.ts.map +1 -0
  169. package/dist/hooks/use-picker-keys.d.ts +58 -0
  170. package/dist/hooks/use-picker-keys.d.ts.map +1 -0
  171. package/dist/hooks/use-prompt-picker.d.ts +28 -0
  172. package/dist/hooks/use-prompt-picker.d.ts.map +1 -0
  173. package/dist/hooks/use-queue-manager.d.ts +26 -0
  174. package/dist/hooks/use-queue-manager.d.ts.map +1 -0
  175. package/dist/hooks/use-statusline-hidden-sync.d.ts +14 -0
  176. package/dist/hooks/use-statusline-hidden-sync.d.ts.map +1 -0
  177. package/dist/hooks/use-statusline-state.d.ts +44 -0
  178. package/dist/hooks/use-statusline-state.d.ts.map +1 -0
  179. package/dist/hooks/use-stream-chip-expiration.d.ts +25 -0
  180. package/dist/hooks/use-stream-chip-expiration.d.ts.map +1 -0
  181. package/dist/hooks/use-subagent-events.d.ts +8 -0
  182. package/dist/hooks/use-subagent-events.d.ts.map +1 -0
  183. package/dist/hooks/use-token-counter-refresh.d.ts +30 -0
  184. package/dist/hooks/use-token-counter-refresh.d.ts.map +1 -0
  185. package/dist/hooks/use-tui-controllers.d.ts +31 -0
  186. package/dist/hooks/use-tui-controllers.d.ts.map +1 -0
  187. package/dist/hooks/use-tui-event-bridge.d.ts +29 -0
  188. package/dist/hooks/use-tui-event-bridge.d.ts.map +1 -0
  189. package/dist/hooks/use-working-dir-chip.d.ts +8 -0
  190. package/dist/hooks/use-working-dir-chip.d.ts.map +1 -0
  191. package/dist/index.d.ts +11 -910
  192. package/dist/index.d.ts.map +1 -0
  193. package/dist/index.js +2633 -2188
  194. package/dist/index.js.map +7 -1
  195. package/dist/ink.d.ts +20 -0
  196. package/dist/ink.d.ts.map +1 -0
  197. package/dist/input-editing.d.ts +76 -0
  198. package/dist/input-editing.d.ts.map +1 -0
  199. package/dist/input-tokens.d.ts +65 -0
  200. package/dist/input-tokens.d.ts.map +1 -0
  201. package/dist/kill-slash.d.ts +3 -0
  202. package/dist/kill-slash.d.ts.map +1 -0
  203. package/dist/markdown-table.d.ts +45 -0
  204. package/dist/markdown-table.d.ts.map +1 -0
  205. package/dist/markdown.d.ts +47 -0
  206. package/dist/markdown.d.ts.map +1 -0
  207. package/dist/mouse.d.ts +73 -0
  208. package/dist/mouse.d.ts.map +1 -0
  209. package/dist/on-panel-open.d.ts +62 -0
  210. package/dist/on-panel-open.d.ts.map +1 -0
  211. package/dist/paste-accumulator.d.ts +19 -0
  212. package/dist/paste-accumulator.d.ts.map +1 -0
  213. package/dist/ps-slash.d.ts +7 -0
  214. package/dist/ps-slash.d.ts.map +1 -0
  215. package/dist/queue-slash.d.ts +24 -0
  216. package/dist/queue-slash.d.ts.map +1 -0
  217. package/dist/reducers/fleet.d.ts +16 -0
  218. package/dist/reducers/fleet.d.ts.map +1 -0
  219. package/dist/reducers/helpers.d.ts +38 -0
  220. package/dist/reducers/helpers.d.ts.map +1 -0
  221. package/dist/rehydrate-history.d.ts +40 -0
  222. package/dist/rehydrate-history.d.ts.map +1 -0
  223. package/dist/run-tui.d.ts +507 -0
  224. package/dist/run-tui.d.ts.map +1 -0
  225. package/dist/slash-command-search.d.ts +10 -0
  226. package/dist/slash-command-search.d.ts.map +1 -0
  227. package/dist/steering-preamble.d.ts +25 -0
  228. package/dist/steering-preamble.d.ts.map +1 -0
  229. package/dist/submit-history.d.ts +17 -0
  230. package/dist/submit-history.d.ts.map +1 -0
  231. package/dist/terminal-title.d.ts +12 -0
  232. package/dist/terminal-title.d.ts.map +1 -0
  233. package/dist/theme.d.ts +91 -0
  234. package/dist/theme.d.ts.map +1 -0
  235. package/dist/thinking-word.d.ts +26 -0
  236. package/dist/thinking-word.d.ts.map +1 -0
  237. package/dist/tool-glyph.d.ts +18 -0
  238. package/dist/tool-glyph.d.ts.map +1 -0
  239. package/package.json +8 -9
package/dist/index.d.ts CHANGED
@@ -1,910 +1,11 @@
1
- import * as _wrongstack_core from '@wrongstack/core';
2
- import { TokenSavingTier, Agent, SlashCommandRegistry, AttachmentStore, EventBus, TokenCounter, QueueStore, AutonomyStage, Director, Message, AutonomousCoordinator, CoordinatorEvent, SessionEvent } from '@wrongstack/core';
3
- export { buildGoalPreamble } from '@wrongstack/core';
4
- import { VisionAdapters } from '@wrongstack/runtime/vision';
5
- import { SddRunControl, SddLifecycleResult } from '@wrongstack/sdd';
6
- import React from 'react';
7
- export { ParseNextStepsResult, ParsedNextStep, parseNextSteps } from '@wrongstack/tools/next-steps';
8
-
9
- /** A single session row from the SessionRegistry, exposed via WebSocket. */
10
- interface LiveSessionEntry {
11
- sessionId: string;
12
- projectName: string;
13
- projectSlug: string;
14
- projectRoot?: string | undefined;
15
- workingDir: string;
16
- gitBranch?: string | undefined;
17
- status: string;
18
- pid: number;
19
- startedAt: string;
20
- agentCount: number;
21
- agents: LiveAgentEntry[];
22
- }
23
- interface LiveAgentEntry {
24
- id: string;
25
- name: string;
26
- status: string;
27
- currentTool?: string | undefined;
28
- iterations: number;
29
- toolCalls: number;
30
- lastActivityAt: string;
31
- }
32
-
33
- /** A single row in the project picker. Matches the CLI's PickerItem shape. */
34
- interface ProjectPickerItem {
35
- key: string;
36
- label: string;
37
- subtitle?: string | undefined;
38
- meta?: string | undefined;
39
- kind: 'project' | 'action';
40
- }
41
-
42
- type HistoryEntry = {
43
- id: number;
44
- kind: 'user';
45
- text: string;
46
- queued?: boolean | undefined;
47
- pasteContent?: string | undefined;
48
- } | {
49
- id: number;
50
- kind: 'assistant';
51
- text: string;
52
- } | {
53
- id: number;
54
- kind: 'thinking';
55
- text: string;
56
- } | {
57
- id: number;
58
- kind: 'tool';
59
- name: string;
60
- durationMs: number;
61
- ok: boolean;
62
- input?: unknown | undefined;
63
- output?: string | undefined;
64
- /** Full byte length of the result body the model actually received
65
- * (post-cap, post-scrub). Carried separately because `output` is a
66
- * ~400-char preview — `outputBytes` is what the model paid for. */
67
- outputBytes?: number | undefined;
68
- /** ~3.5 chars/token estimate over `outputBytes`. Cheap to render in
69
- * the chip; the authoritative count lives in provider.response.usage. */
70
- outputTokens?: number | undefined;
71
- /** Real line count for tools that have a meaningful one — read counts
72
- * numbered prefixes, shell/grep/logs count newlines. Undefined for
73
- * tools without a line notion (json, fetch, …). */
74
- outputLines?: number | undefined;
75
- /**
76
- * Per-tool on-screen result render mode. `simple` hides the body
77
- * preview and shows only meta (line count, byte size); `extend`
78
- * shows the full preview. Mirrors the CLI's `setResultRenderMode`
79
- * state. The frontend TUI reads this off the same
80
- * `tools.resultRenderMode[name]` config the CLI uses.
81
- */
82
- resultRenderMode?: 'simple' | 'extend' | undefined;
83
- } | {
84
- id: number;
85
- kind: 'info';
86
- text: string;
87
- } | {
88
- id: number;
89
- kind: 'warn';
90
- text: string;
91
- } | {
92
- id: number;
93
- kind: 'error';
94
- text: string;
95
- } | {
96
- id: number;
97
- kind: 'turn-summary';
98
- text: string;
99
- } | {
100
- id: number;
101
- kind: 'brain';
102
- status: 'thinking' | 'answered' | 'ask_human' | 'denied' | 'intervention';
103
- source: string;
104
- risk: 'low' | 'medium' | 'high' | 'critical';
105
- question: string;
106
- decision?: string | undefined;
107
- rationale?: string | undefined;
108
- } | {
109
- id: number;
110
- kind: 'banner';
111
- version: string;
112
- provider: string;
113
- model: string;
114
- cwd: string;
115
- family?: string | undefined;
116
- keyTail?: string | undefined;
117
- } | {
118
- id: number;
119
- kind: 'confirm';
120
- toolName: string;
121
- input: unknown;
122
- suggestedPattern: string;
123
- } | {
124
- id: number;
125
- kind: 'subagent';
126
- agentLabel: string;
127
- agentColor: string;
128
- icon: string;
129
- text: string;
130
- detail?: string | undefined;
131
- };
132
-
133
- /** One saved API key / OAuth token, with the secret already masked. */
134
- interface AuthKeyRow {
135
- label: string;
136
- /** Pre-masked display form ("sk-a…f3k2" / "••••••") — never the secret. */
137
- masked: string;
138
- createdAt: string;
139
- active: boolean;
140
- authMethod?: 'api_key' | 'oauth' | 'session_token' | undefined;
141
- expiresAt?: string | undefined;
142
- }
143
- /** One saved provider from ~/.wrongstack/config.json. */
144
- interface AuthProviderRow {
145
- id: string;
146
- type?: string | undefined;
147
- family?: string | undefined;
148
- baseUrl?: string | undefined;
149
- models: string[];
150
- envVars: string[];
151
- keys: AuthKeyRow[];
152
- }
153
- /** One models.dev catalog entry offered by "Add provider (catalog)". */
154
- interface AuthCatalogRow {
155
- id: string;
156
- name: string;
157
- family: string;
158
- apiBase?: string | undefined;
159
- envVars: string[];
160
- /** Already present in the saved config (shown as ◉). */
161
- saved: boolean;
162
- }
163
- /** One local-LLM preset (OmniRoute / Ollama / vLLM / LM Studio). */
164
- interface AuthLocalPresetRow {
165
- id: string;
166
- label: string;
167
- defaultBaseUrl: string;
168
- noAuth: boolean;
169
- hint: string;
170
- }
171
- type AuthOAuthKind = 'chatgpt' | 'claude' | 'copilot';
172
- /**
173
- * Bridge the CLI flows use to talk to the panel while a flow runs.
174
- * `prompt` REJECTS when the user cancels (Esc) — flows treat a thrown
175
- * prompt as user-cancel, which aborts before anything is saved.
176
- */
177
- interface AuthFlowIo {
178
- onLog(line: string): void;
179
- prompt(question: string, opts: {
180
- secret: boolean;
181
- }): Promise<string>;
182
- signal: AbortSignal;
183
- }
184
- interface AuthFlowResult {
185
- ok: boolean;
186
- message?: string | undefined;
187
- }
188
- /**
189
- * Host callbacks the CLI provides. Simple mutations return an error
190
- * string (or null on success); multi-step interactions run as "flows"
191
- * that log and prompt through {@link AuthFlowIo}.
192
- */
193
- interface AuthPanelHost {
194
- listProviders(): Promise<AuthProviderRow[]>;
195
- listCatalog(): Promise<AuthCatalogRow[]>;
196
- localPresets(): AuthLocalPresetRow[];
197
- setActiveKey(providerId: string, label: string): Promise<string | null>;
198
- deleteKey(providerId: string, label: string): Promise<string | null>;
199
- removeProvider(providerId: string): Promise<string | null>;
200
- addKey(providerId: string, io: AuthFlowIo): Promise<AuthFlowResult>;
201
- updateKey(providerId: string, label: string, io: AuthFlowIo): Promise<AuthFlowResult>;
202
- editField(providerId: string, field: 'family' | 'baseUrl' | 'models', io: AuthFlowIo): Promise<AuthFlowResult>;
203
- addCatalogProvider(catalogId: string, io: AuthFlowIo): Promise<AuthFlowResult>;
204
- addCustomProvider(io: AuthFlowIo): Promise<AuthFlowResult>;
205
- addLocal(presetId: string, io: AuthFlowIo): Promise<AuthFlowResult>;
206
- oauthLogin(kind: AuthOAuthKind, io: AuthFlowIo): Promise<AuthFlowResult>;
207
- }
208
-
209
- interface ProviderOption {
210
- id: string;
211
- family: string;
212
- /** Model ids the picker offers in step 2 for this provider. */
213
- models: string[];
214
- /** Optional dim hint shown next to the model list (e.g. "from saved config"). */
215
- modelsLabel?: string | undefined;
216
- }
217
-
218
- interface McpPickerItem {
219
- name: string;
220
- enabled: boolean;
221
- status: string;
222
- transport: string;
223
- description?: string | undefined;
224
- toolCount: number;
225
- lazy?: boolean | undefined;
226
- }
227
-
228
- interface PluginPickerItem {
229
- name: string;
230
- enabled: boolean;
231
- risk: 'low' | 'medium' | 'high';
232
- summary: string;
233
- /**
234
- * When false the row is locked: the picker renders a 🔒 marker and ignores
235
- * Enter/←/→ on it. The current built-in audit list is fully toggleable, but
236
- * the component keeps this marker for future or externally supplied locked
237
- * rows.
238
- */
239
- lockable?: boolean | undefined;
240
- }
241
-
242
- interface ToolPickerItem {
243
- name: string;
244
- owner: string;
245
- category: string;
246
- enabled: boolean;
247
- mutating: boolean;
248
- permission: string;
249
- descMode: 'extend' | 'simple';
250
- description: string;
251
- }
252
-
253
- /** Context window mode options — cyclable via ←/→. */
254
- declare const CONTEXT_MODES: readonly ["balanced", "frugal", "deep", "archival"];
255
- type ContextMode = (typeof CONTEXT_MODES)[number];
256
- declare const STATUSLINE_MODES: readonly ["minimum", "detailed"];
257
- type StatuslineMode = (typeof STATUSLINE_MODES)[number];
258
- declare const REASONING_EFFORTS: readonly ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
259
- type ReasoningEffort = (typeof REASONING_EFFORTS)[number];
260
- declare const CACHE_TTLS: readonly ["default", "5m", "1h"];
261
- type CacheTtl = (typeof CACHE_TTLS)[number];
262
-
263
- /** All possible statusline chip keys. */
264
- type StatuslineItem = 'version' | 'state' | 'model' | 'tokens' | 'cache' | 'queue' | 'processes' | 'hint' | 'index' | 'breaker' | 'todos' | 'plan' | 'tasks' | 'fleet' | 'fleet_agents' | 'git' | 'elapsed' | 'context' | 'cost' | 'working_dir' | 'project' | 'yolo' | 'autonomy' | 'eternal_stage' | 'goal' | 'mode' | 'auto_proceed' | 'sessions' | 'tools' | 'token_saving' | 'brain' | 'mailbox' | 'enhance' | 'debug_stream' | 'next_steps';
265
-
266
- /** Thin view over a SessionSummary for the resume picker. */
267
- interface ResumeSessionEntry {
268
- id: string;
269
- title: string;
270
- startedAt: string;
271
- endedAt?: string | undefined;
272
- tokenTotal: number;
273
- iterationCount: number;
274
- toolCallCount: number;
275
- toolErrorCount: number;
276
- outcome?: 'completed' | 'error' | 'timeout' | 'aborted' | undefined;
277
- /** The current session — marked so the picker can disallow resuming into itself. */
278
- isCurrent?: boolean | undefined;
279
- }
280
- type Settings = {
281
- mode: 'off' | 'suggest' | 'auto';
282
- delayMs: number;
283
- titleAnimation: boolean;
284
- yolo: boolean;
285
- streamFleet: boolean;
286
- chime: boolean;
287
- confirmExit: boolean;
288
- nextPrediction: boolean;
289
- featureMcp: boolean;
290
- featurePlugins: boolean;
291
- featureMemory: boolean;
292
- featureSkills: boolean;
293
- featureModelsRegistry: boolean;
294
- /** Token-saving tier: off | minimal | light | medium | aggressive. */
295
- featureTokenSaving: TokenSavingTier;
296
- /** Allow tools to access paths outside the project root. Default: true (open). */
297
- allowOutsideProjectRoot: boolean;
298
- contextAutoCompact: boolean;
299
- contextStrategy: 'hybrid' | 'intelligent' | 'selective';
300
- contextMode: ContextMode;
301
- maxConcurrent: number;
302
- logLevel: 'error' | 'warn' | 'info' | 'debug' | 'trace';
303
- auditLevel: 'minimal' | 'standard' | 'full';
304
- indexOnStart: boolean;
305
- /** Multi-file diff summary footer cutoff. 0 = off; positive = min file count. */
306
- multiDiffSummaryThreshold: number;
307
- /**
308
- * Settings-picker row the user last navigated to. Carried in the
309
- * canonical Settings shape so reopening the picker after a session
310
- * restart lands on the same row they were last tweaking, rather than
311
- * always resetting to 0. Updated on every `settingsFieldMove` /
312
- * `settingsFieldSet`; consumed by the `settingsOpen` action.
313
- */
314
- lastSettingsField: number;
315
- maxIterations: number;
316
- /** Maximum auto-proceed iterations (0 = unlimited). */
317
- autoProceedMaxIterations: number;
318
- /** Prompt refinement preview countdown (ms). */
319
- enhanceDelayMs: number;
320
- /** Enable/disable prompt refinement. */
321
- enhanceEnabled: boolean;
322
- /** Default language for refinement: original or english. */
323
- enhanceLanguage: 'original' | 'english';
324
- /**
325
- * When true (default), submitting a plain message while the agent is busy
326
- * pops the send-mode picker (queue / by-the-way / steer). Toggled via
327
- * `/queue picker on|off`; persisted to `autonomy.midRunSendPicker`.
328
- */
329
- midRunSendPicker?: boolean | undefined;
330
- /** Raw SSE stream debugging — hex-dump every byte received from providers. */
331
- debugStream: boolean;
332
- /** Skip the confirmation prompt for the `!<command>` shell shortcut. */
333
- shellBangWarningDontShowAgain?: boolean | undefined;
334
- /** Statusline density mode. Defaults to detailed. */
335
- statuslineMode: StatuslineMode;
336
- /** Reasoning mode: auto (provider default) | on | off. */
337
- reasoningMode: 'auto' | 'on' | 'off';
338
- /** Reasoning effort level. */
339
- reasoningEffort: ReasoningEffort;
340
- /** Preserve thinking across turns. */
341
- reasoningPreserve: boolean;
342
- /** Single word shown in the TUI rainbow working-state chip. */
343
- thinkingWord: string;
344
- /** Prompt cache TTL. */
345
- cacheTtl: CacheTtl;
346
- /** Where to persist settings: 'global' or 'project'. */
347
- configScope: 'global' | 'project';
348
- /**
349
- * Animation style for the working/thinking chip in the status bar. One of
350
- * the renderable styles plus the meta-mode `'cycle'` that rotates through
351
- * the variant styles every `CYCLE_INTERVAL_SECONDS`.
352
- */
353
- animationStyle: 'rainbow' | 'wave' | 'pulse' | 'dots' | 'breathe' | 'cycle';
354
- /** Full mouse mode: in-app managed scroll + clickable UI (SGR tracking on). */
355
- mouseMode?: boolean | undefined;
356
- /** Whether the process circuit breaker gates bash/exec. Default false (off). */
357
- breakerEnabled?: boolean | undefined;
358
- /** Auto kill/reset delay (ms) when the breaker trips. 0 = manual recovery. */
359
- breakerAutoKillResetMs?: number | undefined;
360
- };
361
-
362
- interface RunTuiOptions {
363
- agent: Agent;
364
- slashRegistry: SlashCommandRegistry;
365
- attachments: AttachmentStore;
366
- events: EventBus;
367
- tokenCounter?: TokenCounter | undefined;
368
- visionAdapters?: VisionAdapters | undefined;
369
- /** Resolve current model vision support. Falls back to provider capability when omitted. */
370
- supportsVision?: (() => boolean | Promise<boolean>) | undefined;
371
- model: string;
372
- banner?: boolean | undefined;
373
- /** Persists the input queue across crashes; if omitted, the queue is in-memory only. */
374
- queueStore?: QueueStore | undefined;
375
- /**
376
- * Called with the queue's display texts (head first) on EVERY queue change
377
- * — enqueue, /queue delete, /queue clear, dequeue-for-delivery. The CLI
378
- * mirrors the snapshot onto the live agent Context (core's
379
- * setQueuedMessagesSnapshot) so a running agent learns what's waiting at
380
- * its next iteration boundary without the queue being delivered early.
381
- */
382
- onQueueChange?: ((items: string[]) => void) | undefined;
383
- /** Surfaces the "⚠ YOLO" chip in the status bar. */
384
- yolo?: boolean | undefined;
385
- /** Query live YOLO state from the permission policy. */
386
- getYolo?: (() => boolean) | undefined;
387
- /** Set live YOLO state from TUI-owned controls such as ConfirmPrompt. */
388
- onYolo?: ((enabled: boolean) => boolean) | undefined;
389
- /** Query the live autonomy mode. */
390
- getAutonomy?: (() => 'off' | 'suggest' | 'auto' | 'eternal' | 'eternal-parallel') | undefined;
391
- /**
392
- * Access the eternal-autonomy engine. When autonomy mode flips to
393
- * 'eternal' the TUI drives `runOneIteration()` from the post-slash hook
394
- * so the engine and TUI never race for the shared Context.
395
- */
396
- getEternalEngine?: (() => _wrongstack_core.EternalAutonomyEngine | null) | undefined;
397
- /**
398
- * Access the parallel-eternal engine. When autonomy mode flips to
399
- * 'eternal-parallel' the TUI drives `runOneIteration()` from the post-slash
400
- * hook so the engine and TUI never race for the shared Context.
401
- */
402
- getParallelEngine?: (() => _wrongstack_core.ParallelEternalEngine | null) | undefined;
403
- /**
404
- * Access the active SDD parallel run's control surface (or null). The TUI's
405
- * SIGINT handler uses it to stop a running `/sdd parallel` on the first Ctrl+C.
406
- */
407
- getSddRun?: (() => SddRunControl | null) | undefined;
408
- /**
409
- * Apply a post-run SDD lifecycle op (clean / rollback / destroy) from the host.
410
- * Drives the board overlay keys c / z / x so they work after the run ends.
411
- */
412
- onSddLifecycle?: ((op: 'cleanup_worktrees' | 'rollback' | 'destroy', opts?: {
413
- revertMerged?: boolean;
414
- }) => Promise<SddLifecycleResult>) | undefined;
415
- /**
416
- * Subscribe to live per-iteration events from the eternal engine.
417
- * Returns an unsubscribe function. TUI uses this to render each
418
- * iteration as a live timeline entry as it lands.
419
- */
420
- subscribeEternalIteration?: ((fn: (entry: _wrongstack_core.JournalEntry) => void) => () => void) | undefined;
421
- /**
422
- * Subscribe to per-iteration stage transitions from the autonomy engines.
423
- * TUI uses this to render live status in the status bar.
424
- */
425
- subscribeEternalStage?: ((fn: (stage: AutonomyStage) => void) => () => void) | undefined;
426
- /** Renders in the startup banner. Read from the CLI's package.json. */
427
- appVersion?: string | undefined;
428
- /** Provider id for the startup banner ("openai", "anthropic", ...). */
429
- provider?: string | undefined;
430
- /** Wire family — shown beneath provider in the banner. */
431
- family?: string | undefined;
432
- /** Last 3 chars of the active API key — shown in the banner for visual key-pick verification. */
433
- keyTail?: string | undefined;
434
- /** Snapshot of keyed providers + their model lists for the `/model` picker. Async — the catalog fetch may need to hit disk/network. */
435
- getPickableProviders?: (() => Promise<ProviderOption[]>) | undefined;
436
- /** Apply a (provider, model) pair after the picker confirms. Returns an error string on failure. */
437
- switchProviderAndModel?: ((providerId: string, modelId: string) => string | null | Promise<string | null>) | undefined;
438
- /** Apply an autonomy mode after the picker confirms. Returns an error string on failure. */
439
- switchAutonomy?: ((mode: 'off' | 'suggest' | 'auto' | 'eternal' | 'eternal-parallel') => string | null) | undefined;
440
- /**
441
- * Model-specific maxContext (tokens), resolved by the CLI via the
442
- * ModelsRegistry. When omitted, the TUI falls back to the provider
443
- * family's baseline (e.g. anthropic = 200_000), which can be wrong
444
- * for variants like the 1M-context Opus build. The status bar's
445
- * context chip uses this for its progress denominator.
446
- */
447
- effectiveMaxContext?: number | undefined;
448
- /** Absolute project root for goal.json loading. */
449
- projectRoot?: string | undefined;
450
- /** Full app config, used for HQ client publishing settings. */
451
- appConfig?: _wrongstack_core.Config | undefined;
452
- /**
453
- * Terminal title animation on/off. Defaults to true. When false, the
454
- * OSC-0 window/tab title stays static (the app name only, no spinner).
455
- * Controlled via /settings → Terminal title animation.
456
- */
457
- titleAnimation?: boolean | undefined;
458
- /** Play terminal bell (\\x07) when agent run completes. */
459
- chime?: boolean | undefined;
460
- /**
461
- * Enable terminal mouse tracking (SGR; click + wheel). Stays in the normal
462
- * screen buffer so native scrollback survives, BUT while tracking is on the
463
- * plain wheel reports to the app instead of scrolling history — only
464
- * Shift+wheel reaches native scrollback. Off by default; opt in here or via
465
- * WRONGSTACK_MOUSE=1. See mouse.ts for the trade-off rationale.
466
- */
467
- mouse?: boolean | undefined;
468
- /** Show "confirm exit" message on first Ctrl+C instead of "exit". */
469
- confirmExit?: boolean | undefined;
470
- /** Active agent mode label shown in the status bar (e.g. "teach", "brief"). */
471
- modeLabel?: string | undefined;
472
- /** Token-saving tier — shown as a `💾 <tier>` chip in the TUI status bar (hidden when `'off'`). */
473
- tokenSavingMode?: TokenSavingTier | undefined;
474
- /** Number of registered tools — shown on the status bar line 2. */
475
- toolCount?: number | undefined;
476
- /** Live getter for the agent mode label so the status bar updates after /mode. */
477
- getModeLabel?: (() => string) | undefined;
478
- /**
479
- * Get all available agent modes with their names, descriptions, and the
480
- * currently active mode id. Used by the `/mode` picker in the TUI.
481
- */
482
- getModes?: (() => Promise<{
483
- modes: _wrongstack_core.Mode[];
484
- activeId: string | null;
485
- }>) | undefined;
486
- /** Switch to a different agent mode by id (e.g. "teach", "brief"). */
487
- switchMode?: ((modeId: string) => Promise<string | null>) | undefined;
488
- /**
489
- * Called ONCE on mount by the App to install its debug-stream telemetry
490
- * callback. The CLI wires this to setDebugStreamCallback() from
491
- * @wrongstack/providers. On App unmount, the default stderr callback
492
- * is restored.
493
- */
494
- registerDebugStreamCallback?: ((cb: (stats: {
495
- chunkCount: number;
496
- lastChunkSize: number;
497
- lastDeltaMs: number;
498
- totalBytes: number;
499
- lastChunkAt: string;
500
- }) => void) => void) | undefined;
501
- /** Called on App unmount — restores the default stderr debug-stream callback. */
502
- restoreDebugStreamCallback?: (() => void) | undefined;
503
- /** Called from /clear so the TUI can wipe its history entries while agent.ctx + memory are cleared separately. */
504
- onClearHistory?: ((dispatch: React.Dispatch<{
505
- type: 'clearHistory';
506
- } | {
507
- type: 'resetContextChip';
508
- } | {
509
- type: 'streamReset';
510
- } | {
511
- type: 'toolStreamClear';
512
- }>) => void) | undefined;
513
- /**
514
- * Live director instance. When set, the TUI renders a fleet panel
515
- * showing every spawned subagent, its current task, streaming output,
516
- * and runtime cost — updated live from the FleetBus. Pass null or omit
517
- * when multi-agent / director mode is disabled.
518
- */
519
- director?: Director | null | undefined;
520
- /**
521
- * Optional roster reference for resolving subagent role ids to
522
- * human-readable names. Same value passed to director.tools().
523
- */
524
- fleetRoster?: Record<string, {
525
- name: string;
526
- }> | undefined;
527
- /**
528
- * Shared controller for the `/fleet stream on|off` toggle. The slash
529
- * command runs in the CLI process and needs to flip TUI reducer state;
530
- * the App installs a dispatch-backed `setEnabled` here on mount so
531
- * both sides stay synchronized.
532
- */
533
- /**
534
- * Shared controller for the `/fleet stream on|off` toggle. The slash
535
- * command runs in the CLI process and needs to flip TUI reducer state;
536
- * the App installs a dispatch-backed `setEnabled` here on mount so
537
- * both sides stay synchronized.
538
- */
539
- fleetStreamController?: {
540
- enabled: boolean;
541
- setEnabled: (enabled: boolean) => void;
542
- } | undefined;
543
- /**
544
- * Controller for the `/interrupt` slash command. The App installs the real
545
- * `abortLeader` on mount so the command can abort the in-flight leader run.
546
- */
547
- interruptController?: {
548
- abortLeader: () => boolean;
549
- } | undefined;
550
- /**
551
- * Controller for the `/enhance on|off` prompt-refinement toggle. The App
552
- * installs a dispatch-backed `setEnabled` here on mount so the slash command
553
- * (run in the CLI process) flips the TUI's reducer flag. Mirrors
554
- * `fleetStreamController`.
555
- */
556
- enhanceController?: {
557
- enabled: boolean;
558
- setEnabled: (enabled: boolean) => void;
559
- } | undefined;
560
- /**
561
- * Controller for status bar hidden items. App installs a dispatch-backed
562
- * setter on mount so the /statusline slash command can update the TUI's
563
- * visible bar without a round-trip. The initial value is loaded from
564
- * the config file before App mounts.
565
- */
566
- statuslineHiddenItems: StatuslineItem[];
567
- setStatuslineHiddenItems: (items: StatuslineItem[]) => void;
568
- /**
569
- * Atomically updates in-memory state AND persists to
570
- * ~/.wrongstack/statusline.json. Used by the statusline picker to
571
- * make each toggle immediately durable.
572
- */
573
- saveStatuslineHiddenItems: (items: StatuslineItem[]) => Promise<void>;
574
- /**
575
- * Controller for the agents monitor overlay. App installs a dispatch-backed
576
- * setter on mount so the `/agents on|off` slash command can toggle the
577
- * overlay without a round-trip.
578
- */
579
- agentsMonitorController?: {
580
- visible: boolean;
581
- setVisible: (visible: boolean) => void;
582
- } | undefined;
583
- /**
584
- * Mutable ref for opening TUI panels from slash commands. The slash commands
585
- * call `onPanelOpen.current(action)` to open panels. The App sets
586
- * `onPanelOpen.current` to its actual dispatch function on mount.
587
- */
588
- onPanelOpen?: {
589
- current: ((action: string) => boolean) | null;
590
- } | undefined;
591
- /**
592
- * If set, the App boots straight into goal mode — the text is wrapped
593
- * in the GOAL preamble and submitted as the first turn. Lets users
594
- * launch directly from the shell:
595
- * wstack --tui --director --goal "audit packages/core for races"
596
- * The chat shows a one-line "🎯 Goal locked: …" hint; the actual
597
- * preamble is hidden from the visible history (same as `/goal`).
598
- */
599
- initialGoal?: string | undefined;
600
- /**
601
- * If set, submitted as the first turn verbatim (no preamble). Mainly
602
- * for scripted shell aliases — `wstack --tui --ask "summarize foo.md"`
603
- * — that want one turn pre-populated without the goal-mode framing.
604
- * Ignored when `initialGoal` is also set.
605
- */
606
- initialAsk?: string | undefined;
607
- /**
608
- * Directory containing session JSONL files. Required for rewind
609
- * functionality. When provided the TUI can list checkpoints and
610
- * trigger a rewind via `/rewind` or Ctrl+R.
611
- */
612
- sessionsDir?: string | undefined;
613
- /** Live active session id for cross-surface client registration. */
614
- getSessionId?: (() => string | undefined) | undefined;
615
- /**
616
- * SDD session context getter. When an SDD session is active, returns
617
- * the AI prompt context to inject into user messages.
618
- */
619
- getSDDContext?: (() => Promise<string | null>) | undefined;
620
- /**
621
- * Process AI output for SDD auto-detection (spec, tasks, plan).
622
- * Returns displayable status messages.
623
- */
624
- onSDDOutput?: ((output: string) => Promise<string[]>) | undefined;
625
- /**
626
- * Subscribe to AutoPhase phase/graph events from the PhaseOrchestrator.
627
- * Returns an unsubscribe function. The TUI uses this to drive the
628
- * PhaseMonitor and PhasePanel live views via dispatch actions.
629
- */
630
- subscribeAutoPhase?: ((handler: (event: string, payload: unknown) => void) => () => void) | undefined;
631
- /**
632
- * Read the persisted autonomy settings (defaultMode, autoProceedDelayMs).
633
- * Used by the SettingsPicker in the TUI on mount and after Ctrl+S toggle.
634
- */
635
- getSettings?: (() => Settings) | undefined;
636
- /**
637
- * Persist settings changes. Returns null on success, or an
638
- * error string on failure (so the TUI can display it as a hint).
639
- */
640
- saveSettings?: ((s: Settings) => string | null | Promise<string | null>) | undefined;
641
- /** Load toggleable plugin rows for the interactive plugin picker. */
642
- getPluginItems?: (() => PluginPickerItem[]) | undefined;
643
- /** Toggle one plugin from the interactive picker and return refreshed rows. */
644
- onPluginToggle?: ((name: string) => Promise<{
645
- items: PluginPickerItem[];
646
- message?: string | undefined;
647
- error?: string | undefined;
648
- }>) | undefined;
649
- /** Load MCP server rows for the interactive MCP picker. */
650
- getMcpServers?: (() => McpPickerItem[]) | undefined;
651
- /** Toggle one MCP server (enable/disable) from the interactive picker. */
652
- onMcpToggle?: ((name: string) => Promise<{
653
- items: McpPickerItem[];
654
- message?: string | undefined;
655
- error?: string | undefined;
656
- }>) | undefined;
657
- /** Restart one MCP server from the interactive picker. */
658
- onMcpRestart?: ((name: string) => Promise<{
659
- items: McpPickerItem[];
660
- message?: string | undefined;
661
- error?: string | undefined;
662
- }>) | undefined;
663
- /** Load tool rows for the interactive tool picker. */
664
- getToolsItems?: (() => ToolPickerItem[]) | undefined;
665
- /** Toggle one tool (enable/disable) from the interactive tool picker. */
666
- onToolToggle?: ((name: string) => Promise<{
667
- items: ToolPickerItem[];
668
- message?: string | undefined;
669
- error?: string | undefined;
670
- }>) | undefined;
671
- /** Get current brain risk level and decision log for the Brain panel. */
672
- getBrainData?: (() => {
673
- riskLevel: 'off' | 'low' | 'medium' | 'high' | 'all';
674
- log: Array<{
675
- kind: string;
676
- question: string;
677
- outcome: string;
678
- age: string;
679
- }>;
680
- }) | undefined;
681
- /** Set brain risk ceiling from the Brain panel. */
682
- onBrainRiskLevel?: ((level: 'off' | 'low' | 'medium' | 'high' | 'all') => string | undefined) | undefined;
683
- /** Get current Shadow Agent state. */
684
- getShadowData?: (() => {
685
- activeId: string | null;
686
- running: boolean;
687
- model: string;
688
- intervalMs: number;
689
- }) | undefined;
690
- /** Start Shadow Agent. Returns message or error. */
691
- onShadowStart?: (() => Promise<string | undefined>) | undefined;
692
- /** Stop Shadow Agent. Returns message or error. */
693
- onShadowStop?: (() => Promise<string | undefined>) | undefined;
694
- /**
695
- * Host for the interactive `/auth` panel (provider/key management, OAuth
696
- * sign-in, local-server add). The CLI builds this from its vault +
697
- * models registry; when absent, `/auth` falls back to plain text.
698
- */
699
- authHost?: AuthPanelHost | undefined;
700
- /**
701
- * Predict likely next steps after a completed turn. The CLI wires this from
702
- * the session provider and the `/next` toggle; it returns [] when prediction
703
- * is disabled or autonomy isn't 'off'. Display-only — never executed.
704
- */
705
- predictNext?: ((input: {
706
- userRequest: string;
707
- assistantSummary: string;
708
- }) => Promise<string[]>) | undefined;
709
- /**
710
- * Called after each agent turn with the assistant's final output text.
711
- * The host parses "💡 Next steps" suggestions from the text and stores
712
- * them in the shared suggestion store so `/next 1`, `/next 1 2 3` work.
713
- */
714
- onSuggestionsParsed?: ((finalText: string) => void) | undefined;
715
- /**
716
- * Retrieve current suggestions from the shared suggestion store.
717
- * Used by the TUI to display and auto-submit next steps in 'auto' mode.
718
- */
719
- getSuggestions?: (() => string[]) | undefined;
720
- /**
721
- * Retrieve current auto suggestions (items with auto="true" attribute).
722
- * Used by YOLO+auto mode for automatic next-step submission.
723
- */
724
- getAutoSuggestions?: (() => string[]) | undefined;
725
- /**
726
- * Autonomy next prompt template for YOLO+auto mode. Contains {{suggestion}} placeholder.
727
- */
728
- autonomyNextPrompt?: string | undefined;
729
- /**
730
- * Write parsed next steps into the shared suggestion store.
731
- * Called by the Entry component after parsing each assistant message
732
- * so /next 1 and the auto-submit countdown can access them.
733
- */
734
- setSuggestions?: ((steps: string[]) => void) | undefined;
735
- /**
736
- * Messages restored from a previous session. When provided (non-empty),
737
- * the TUI renders the prior conversation as history entries so a resumed
738
- * session shows its full chat context, not just the LLM's internal state.
739
- */
740
- restoredMessages?: Message[] | undefined;
741
- /**
742
- * Tool execution records from a previous session, keyed by tool_use id.
743
- * Used to render tool entries (name, duration, ok/error) in the TUI on
744
- * resume. Events are `tool_call_end` records from the session JSONL.
745
- */
746
- restoredToolCalls?: Array<{
747
- name: string;
748
- id: string;
749
- durationMs: number;
750
- ok: boolean;
751
- outputBytes?: number | undefined;
752
- outputTokens?: number | undefined;
753
- outputLines?: number | undefined;
754
- }> | undefined;
755
- /**
756
- * List recent session summaries for the /resume picker. The CLI reads
757
- * from the session store and returns ResumeSessionEntry-shaped data.
758
- */
759
- listSessions?: ((limit?: number) => Promise<ResumeSessionEntry[]>) | undefined;
760
- /**
761
- * Resume a session by id: load JSONL events, replay history entries,
762
- * rebuild agent context, and return hydrated entries for the TUI to
763
- * display. Returns null when resume fails.
764
- */
765
- onResumeSession?: ((sessionId: string) => Promise<{
766
- entries: HistoryEntry[];
767
- nextId: number;
768
- sessionId: string;
769
- } | null>) | undefined;
770
- getProjectPickerItems?: (() => Promise<ProjectPickerItem[]>) | undefined;
771
- onProjectSelect?: ((key: string, kind: 'project' | 'action') => void) | undefined;
772
- /**
773
- * Request the TUI to exit with a specific code. Used by the project picker
774
- * to trigger a clean exit before spawning a new wstack process in a different
775
- * project directory. The host CLI catches this exit code and performs the
776
- * actual project switch.
777
- */
778
- requestExit?: (code: number) => void;
779
- getLiveSessions?: (() => Promise<LiveSessionEntry[]>) | undefined;
780
- onSwitchToSession?: ((sessionId: string, projectRoot: string, projectName: string) => void) | undefined;
781
- /**
782
- * When true, the agents monitor (F3) is open by default at TUI startup.
783
- * Used by the `wrongstack quick` command to show agents panel immediately.
784
- */
785
- initialAgentsMonitorOpen?: boolean | undefined;
786
- /**
787
- * Access the project-level AutonomousCoordinator instance. When set, the TUI
788
- * renders a coordination panel showing live goals, pending tasks, consensus
789
- * decisions, and shared knowledge from all active sessions. The coordinator
790
- * runs independently of the session — it coordinates multiple sessions.
791
- */
792
- getAutonomousCoordinator?: () => AutonomousCoordinator | null | undefined;
793
- /**
794
- * Subscribe to live events from the AutonomousCoordinator:
795
- * - `goal:added` — new coordination goal received
796
- * - `goal:completed` — goal finished successfully
797
- * - `goal:failed` — goal failed after max attempts
798
- * - `task:ready` — task's dependencies are satisfied, ready to execute
799
- * - `task:completed` — task finished
800
- * - `knowledge:added` — new shared fact published
801
- * - `consensus:reached` — multi-session agreement reached
802
- * Returns an unsubscribe function.
803
- */
804
- subscribeCoordinatorEvents?: (fn: (event: CoordinatorEvent) => void) => () => void;
805
- /**
806
- * Start the AutonomousCoordinator loop. Fire-and-forget — run() loops
807
- * asynchronously. Pass a goal string to begin decomposition and task
808
- * auction immediately.
809
- */
810
- onCoordinatorStart?: ((goal?: string) => void) | undefined;
811
- /** Stop the AutonomousCoordinator loop. */
812
- onCoordinatorStop?: (() => void) | undefined;
813
- /** List pending coordinator tasks claimable by this terminal. */
814
- onCoordinatorTasks?: (() => Promise<Array<{
815
- id: string;
816
- title: string;
817
- priority: string;
818
- tags: string[];
819
- }> | null>) | undefined;
820
- /** Claim a coordinator task. Returns description on success. */
821
- onCoordinatorClaim?: ((taskId: string) => Promise<string | null | {
822
- description: string;
823
- }>) | undefined;
824
- /** Mark a claimed task as completed. */
825
- onCoordinatorComplete?: ((taskId: string, result?: string) => Promise<string | null>) | undefined;
826
- /** Mark a claimed task as failed. */
827
- onCoordinatorFail?: ((taskId: string, error: string) => Promise<string | null>) | undefined;
828
- /** Get coordinator stats for status display. */
829
- onCoordinatorStatus?: (() => Promise<{
830
- goals: {
831
- total: number;
832
- done: number;
833
- pending: number;
834
- failed: number;
835
- };
836
- dag: {
837
- running: number;
838
- ready: number;
839
- done: number;
840
- failed: number;
841
- };
842
- auction: {
843
- pending: number;
844
- inProgress: number;
845
- };
846
- } | null>) | undefined;
847
- }
848
- declare function runTui(opts: RunTuiOptions): Promise<number>;
849
-
850
- interface InlineToken {
851
- text: string;
852
- bold?: boolean | undefined;
853
- italic?: boolean | undefined;
854
- code?: boolean | undefined;
855
- strike?: boolean | undefined;
856
- }
857
- /**
858
- * Parse one line of prose into inline-emphasis tokens. Markers are stripped
859
- * (this is display text, not length-preserving). `_..._` is intentionally NOT
860
- * treated as italic so snake_case / file_names aren't mangled. An unterminated
861
- * marker is emitted literally so no text is ever lost.
862
- *
863
- * Results are memoized: repeated calls with the same text return the identical
864
- * cached array, eliminating redundant parsing on every TUI re-render.
865
- */
866
- declare function parseInline(text: string): InlineToken[];
867
-
868
- /**
869
- * Render a SessionEvent back into a TUI HistoryEntry so a resumed session
870
- * displays exactly what the user saw during live interaction.
871
- *
872
- * ## Entry mapping
873
- *
874
- * | Event type | HistoryEntry kind |
875
- * |--------------------------|-------------------|
876
- * | `user_input` | `user` |
877
- * | `llm_response` | `assistant` |
878
- * | `tool_use` + `tool_result` | `tool` (paired) |
879
- * | `tool_call_start`/`tool_call_end` | `tool` |
880
- * | `compaction` | `info` |
881
- * | `error` | `error` |
882
- * | `provider_retry` | `warn` |
883
- * | `provider_error` | `error` |
884
- * | `checkpoint` | `info` |
885
- * | `agent_spawned`/`agent_stopped` | `subagent` |
886
- * | `agent_error` | `subagent` |
887
- * | `mode_changed` | `info` |
888
- * | `skill_activated`/`skill_deactivated` | `info` |
889
- * | `message_truncated` | `warn` |
890
- *
891
- * ## Non-resumable events (subagent transcripts)
892
- *
893
- * Subagent events (`agent_spawned`, `agent_stopped`, `agent_error`) are
894
- * rendered as `subagent` entries in the main TUI history but the full
895
- * subagent tool-call details live in per-subagent JSONL files. The main
896
- * session only holds the lifecycle markers.
897
- *
898
- * ## Compaction events
899
- *
900
- * Compaction boundaries are rendered as `info` entries showing how many
901
- * tokens were collapsed. This keeps the display neat without pretending
902
- * the full verbose context never existed.
903
- *
904
- * @param events Parsed SessionEvent[] from session JSONL
905
- * @param startId Starting id counter for the generated entries
906
- * @returns Ordered HistoryEntry[] ready for display
907
- */
908
- declare function replaySessionEvents(events: SessionEvent[], startId: number): HistoryEntry[];
909
-
910
- export { type AuthCatalogRow, type AuthFlowIo, type AuthFlowResult, type AuthKeyRow, type AuthLocalPresetRow, type AuthOAuthKind, type AuthPanelHost, type AuthProviderRow, type PluginPickerItem, type RunTuiOptions, type Settings, parseInline, replaySessionEvents, runTui };
1
+ export { runTui } from './run-tui.js';
2
+ export type { RunTuiOptions } from './run-tui.js';
3
+ export { buildGoalPreamble } from './app.js';
4
+ export type { Settings } from './app.js';
5
+ export type { PluginPickerItem } from './components/plugin-picker.js';
6
+ export type { AuthCatalogRow, AuthFlowIo, AuthFlowResult, AuthKeyRow, AuthLocalPresetRow, AuthOAuthKind, AuthPanelHost, AuthProviderRow, } from './components/auth-panel-model.js';
7
+ export { parseInline } from './markdown.js';
8
+ export { replaySessionEvents } from './components/history/replay.js';
9
+ export { parseNextSteps } from './components/suggestions.js';
10
+ export type { ParsedNextStep, ParseNextStepsResult } from './components/suggestions.js';
11
+ //# sourceMappingURL=index.d.ts.map