@wrongstack/tui 1.1.4 → 1.1.6
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/dist/components/context-panel-cache-memory.d.ts +17 -0
- package/dist/components/context-panel-sections.d.ts +1 -15
- package/dist/components/input-rows.d.ts +29 -0
- package/dist/components/input.d.ts +1 -1
- package/dist/components/settings-picker-rows.d.ts +9 -0
- package/dist/components/settings-picker.d.ts +1 -1
- package/dist/components/sidebar-cache-card.d.ts +8 -0
- package/dist/components/sidebar-panels-sessions.d.ts +23 -0
- package/dist/components/sidebar-panels-task.d.ts +3 -21
- package/dist/components/user-input-draft.d.ts +34 -0
- package/dist/components/user-input-prompt.d.ts +2 -18
- package/dist/hooks/app-resume-runner.d.ts +32 -0
- package/dist/hooks/auth-panel-support.d.ts +43 -0
- package/dist/hooks/provider-routing-events.d.ts +15 -0
- package/dist/hooks/use-auth-panel.d.ts +2 -41
- package/dist/hooks/use-picker-keys-navigation.d.ts +8 -0
- package/dist/index.js +4159 -4073
- package/dist/run-tui-options.d.ts +3 -461
- package/dist/run-tui-surface-options.d.ts +468 -0
- package/dist/submit-controller-support.d.ts +92 -0
- package/dist/submit-controller.d.ts +2 -81
- package/dist/use-controller-confirm-auth.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
import type { AutonomousCoordinator, CoordinatorEvent, Director } from '@wrongstack/core/coordination';
|
|
2
|
+
import type { StatuslineDensities, StatuslineLines, StatuslineOrder } from '@wrongstack/core/statusline';
|
|
3
|
+
import type { ConfigStore, ContextSnapshot, FleetChatVerbosity, Message, SessionLoadProgress, ThemePresetId } from '@wrongstack/core/types';
|
|
4
|
+
import type { AgentTranscriptReader } from './components/agents-monitor.js';
|
|
5
|
+
import type { McpPickerItem } from './components/mcp-picker.js';
|
|
6
|
+
import type { PluginPickerItem } from './components/plugin-picker.js';
|
|
7
|
+
import type { StatuslineItem } from './components/statusline-picker.js';
|
|
8
|
+
import type { ToolPickerItem } from './components/tools-picker.js';
|
|
9
|
+
/**
|
|
10
|
+
* The `runTui` options for the fleet surface (director mode), project and
|
|
11
|
+
* session switching, and the AutonomousCoordinator. Part of
|
|
12
|
+
* {@link RunTuiOptions}, split out to keep each declaration readable.
|
|
13
|
+
*/
|
|
14
|
+
export interface RunTuiSurfaceOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Live director instance. When set, the TUI renders a fleet panel
|
|
17
|
+
* showing every spawned subagent, its current task, streaming output,
|
|
18
|
+
* and runtime cost — updated live from the FleetBus. Pass null or omit
|
|
19
|
+
* when multi-agent / director mode is disabled.
|
|
20
|
+
*/
|
|
21
|
+
director?: Director | null | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Read the CURRENT director. Unlike the static `director` option (captured
|
|
24
|
+
* at boot, null in non---director sessions), this sees a director the fleet
|
|
25
|
+
* host built lazily on the first delegate/spawn — the TUI's fleet-teardown
|
|
26
|
+
* paths (Ctrl+C, Esc, /steer) resolve through it.
|
|
27
|
+
*/
|
|
28
|
+
getDirector?: (() => Director | null) | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Optional roster reference for resolving subagent role ids to
|
|
31
|
+
* human-readable names. Same value passed to director.tools().
|
|
32
|
+
*/
|
|
33
|
+
fleetRoster?: Record<string, {
|
|
34
|
+
name: string;
|
|
35
|
+
}> | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Shared controller for the `/fleet stream on|off` toggle. The slash
|
|
38
|
+
* command runs in the CLI process and needs to flip TUI reducer state;
|
|
39
|
+
* the App installs a dispatch-backed `setEnabled` here on mount so
|
|
40
|
+
* both sides stay synchronized.
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* Shared controller for the `/fleet stream on|off` toggle. The slash
|
|
44
|
+
* command runs in the CLI process and needs to flip TUI reducer state;
|
|
45
|
+
* the App installs a dispatch-backed `setEnabled` here on mount so
|
|
46
|
+
* both sides stay synchronized.
|
|
47
|
+
*/
|
|
48
|
+
fleetStreamController?: {
|
|
49
|
+
mode: FleetChatVerbosity;
|
|
50
|
+
setMode: (mode: FleetChatVerbosity) => void;
|
|
51
|
+
} | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Read-only per-subagent transcript access for the F3 agents monitor
|
|
54
|
+
* (AgentMonitorService satisfies this structurally).
|
|
55
|
+
*/
|
|
56
|
+
agentTranscripts?: AgentTranscriptReader | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Controller for the `/interrupt` slash command. The App installs the real
|
|
59
|
+
* `abortLeader` on mount so the command can abort the in-flight leader run.
|
|
60
|
+
*/
|
|
61
|
+
interruptController?: {
|
|
62
|
+
abortLeader: () => boolean;
|
|
63
|
+
isRunning?: (() => boolean) | undefined;
|
|
64
|
+
confirmClear?: ((info: {
|
|
65
|
+
leaderActive: boolean;
|
|
66
|
+
subagentCount: number;
|
|
67
|
+
}) => Promise<boolean>) | undefined;
|
|
68
|
+
confirmSlash?: ((question: string, defaultYes: boolean) => Promise<boolean | null>) | undefined;
|
|
69
|
+
resetSession?: (() => void) | undefined;
|
|
70
|
+
waitForIdle?: (() => Promise<void>) | undefined;
|
|
71
|
+
} | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Controller for the `/enhance on|off` prompt-refinement toggle. The App
|
|
74
|
+
* installs a dispatch-backed `setEnabled` here on mount so the slash command
|
|
75
|
+
* (run in the CLI process) flips the TUI's reducer flag. Mirrors
|
|
76
|
+
* `fleetStreamController`.
|
|
77
|
+
*/
|
|
78
|
+
enhanceController?: {
|
|
79
|
+
enabled: boolean;
|
|
80
|
+
setEnabled: (enabled: boolean) => void;
|
|
81
|
+
} | undefined;
|
|
82
|
+
/** Capability-gated low-effort reasoning hint for the prompt refiner. */
|
|
83
|
+
getEnhancerReasoning?: ((providerId?: string, modelId?: string) => import('@wrongstack/core/types').ReasoningRequest | undefined | Promise<import('@wrongstack/core/types').ReasoningRequest | undefined>) | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Effort levels the ACTIVE model documents (models.dev reasoningConfig),
|
|
86
|
+
* for the model-aware /settings reasoning-effort cycle. Undefined =
|
|
87
|
+
* vocabulary undocumented; the picker cycles the full canonical set.
|
|
88
|
+
*/
|
|
89
|
+
getActiveModelReasoningEffortLevels?: (() => string[] | undefined) | undefined;
|
|
90
|
+
/** Build an ephemeral Provider for retrying a failed refinement on another model (no session switch). */
|
|
91
|
+
buildEnhancerProvider?: ((providerId: string, modelId: string) => Promise<import('@wrongstack/core/types').Provider | undefined>) | undefined;
|
|
92
|
+
/** Resolve the one-key "retry with another model" fallback ref on a refine failure. */
|
|
93
|
+
getEnhanceFallbackRef?: (() => string | undefined) | undefined;
|
|
94
|
+
/** Resolve the dedicated refiner target for the initial refinement attempt. */
|
|
95
|
+
getConfiguredRefinerRef?: (() => string | undefined) | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Controller for status bar hidden items. App installs a dispatch-backed
|
|
98
|
+
* setter on mount so the /statusline slash command can update the TUI's
|
|
99
|
+
* visible bar without a round-trip. The initial value is loaded from
|
|
100
|
+
* the config file before App mounts.
|
|
101
|
+
*/
|
|
102
|
+
statuslineHiddenItems: StatuslineItem[];
|
|
103
|
+
setStatuslineHiddenItems: (items: StatuslineItem[]) => void;
|
|
104
|
+
/**
|
|
105
|
+
* Atomically updates in-memory state AND persists to
|
|
106
|
+
* Active profile/statusline.json. Used by the statusline picker to
|
|
107
|
+
* make each toggle immediately durable.
|
|
108
|
+
*/
|
|
109
|
+
saveStatuslineHiddenItems: (items: StatuslineItem[]) => Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Per-chip statusline line assignment (statusline.json schema v2).
|
|
112
|
+
* Optional: hosts that don't load it keep the core contract defaults.
|
|
113
|
+
*/
|
|
114
|
+
statuslineLines?: StatuslineLines | undefined;
|
|
115
|
+
setStatuslineLines?: ((lines: StatuslineLines) => void) | undefined;
|
|
116
|
+
saveStatuslineLines?: ((lines: StatuslineLines) => Promise<void>) | undefined;
|
|
117
|
+
/** Per-chip density pin (statusline.json schema v3). */
|
|
118
|
+
statuslineDensities?: StatuslineDensities | undefined;
|
|
119
|
+
setStatuslineDensities?: ((densities: StatuslineDensities) => void) | undefined;
|
|
120
|
+
saveStatuslineDensities?: ((densities: StatuslineDensities) => Promise<void>) | undefined;
|
|
121
|
+
/** Custom left-to-right chip order (statusline.json schema v4). */
|
|
122
|
+
statuslineOrder?: StatuslineOrder | undefined;
|
|
123
|
+
setStatuslineOrder?: ((order: StatuslineOrder) => void) | undefined;
|
|
124
|
+
saveStatuslineOrder?: ((order: StatuslineOrder) => Promise<void>) | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Controller for the agents monitor overlay. App installs a dispatch-backed
|
|
127
|
+
* setter on mount so the `/agents on|off` slash command can toggle the
|
|
128
|
+
* overlay without a round-trip.
|
|
129
|
+
*/
|
|
130
|
+
agentsMonitorController?: {
|
|
131
|
+
visible: boolean;
|
|
132
|
+
setVisible: (visible: boolean) => void;
|
|
133
|
+
} | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* Mutable ref for opening TUI panels from slash commands. The slash commands
|
|
136
|
+
* call `onPanelOpen.current(action)` to open panels. The App sets
|
|
137
|
+
* `onPanelOpen.current` to its actual dispatch function on mount.
|
|
138
|
+
*/
|
|
139
|
+
onPanelOpen?: {
|
|
140
|
+
current: ((action: string) => boolean) | null;
|
|
141
|
+
} | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* If set, the App boots straight into goal mode — the text is wrapped
|
|
144
|
+
* in the GOAL preamble and submitted as the first turn. Lets users
|
|
145
|
+
* launch directly from the shell:
|
|
146
|
+
* wstack --tui --director --goal "audit packages/core for races"
|
|
147
|
+
* The chat shows a one-line "🎯 Goal locked: …" hint; the actual
|
|
148
|
+
* preamble is hidden from the visible history (same as `/goal`).
|
|
149
|
+
*/
|
|
150
|
+
initialGoal?: string | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* If set, submitted as the first turn verbatim (no preamble). Mainly
|
|
153
|
+
* for scripted shell aliases — `wstack --tui --ask "summarize foo.md"`
|
|
154
|
+
* — that want one turn pre-populated without the goal-mode framing.
|
|
155
|
+
* Ignored when `initialGoal` is also set.
|
|
156
|
+
*/
|
|
157
|
+
initialAsk?: string | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* Directory containing session JSONL files. Required for rewind
|
|
160
|
+
* functionality. When provided the TUI can list checkpoints and
|
|
161
|
+
* trigger a rewind via `/rewind` or Ctrl+R.
|
|
162
|
+
*/
|
|
163
|
+
sessionsDir?: string | undefined;
|
|
164
|
+
/** Live active session id for cross-surface client registration. */
|
|
165
|
+
getSessionId?: (() => string | undefined) | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* SDD session context getter. When an SDD session is active, returns
|
|
168
|
+
* the AI prompt context to inject into user messages.
|
|
169
|
+
*/
|
|
170
|
+
getSDDContext?: (() => Promise<string | null>) | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Process AI output for SDD auto-detection (spec, tasks, plan).
|
|
173
|
+
* Returns displayable status messages.
|
|
174
|
+
*/
|
|
175
|
+
onSDDOutput?: ((output: string) => Promise<string[]>) | undefined;
|
|
176
|
+
/**
|
|
177
|
+
* Subscribe to Goal phase/graph events from the PhaseOrchestrator.
|
|
178
|
+
* Returns an unsubscribe function. The TUI uses this to drive the
|
|
179
|
+
* PhaseMonitor and PhasePanel live views via dispatch actions.
|
|
180
|
+
*/
|
|
181
|
+
subscribeGoal?: ((handler: (event: string, payload: unknown) => void) => () => void) | undefined;
|
|
182
|
+
/**
|
|
183
|
+
* Read the persisted autonomy settings (defaultMode, autoProceedDelayMs).
|
|
184
|
+
* Used by the SettingsPicker in the TUI on mount and after Ctrl+S toggle.
|
|
185
|
+
*/
|
|
186
|
+
getSettings?: (() => import('./app-state.js').Settings) | undefined;
|
|
187
|
+
/**
|
|
188
|
+
* The leader's own effort override (`leader_effort_set`), while it is in
|
|
189
|
+
* force. Display-only: kept apart from `getSettings` so the settings picker
|
|
190
|
+
* never reads — and on save persists — the leader's choice as the user's.
|
|
191
|
+
*/
|
|
192
|
+
getLeaderEffort?: (() => string | undefined) | undefined;
|
|
193
|
+
/**
|
|
194
|
+
* Persist settings changes. Returns null on success, or an
|
|
195
|
+
* error string on failure (so the TUI can display it as a hint).
|
|
196
|
+
*/
|
|
197
|
+
saveSettings?: ((s: import('./app-state.js').Settings) => string | null | Promise<string | null>) | undefined;
|
|
198
|
+
/** Persist the active theme preset to disk so the next boot starts with it. */
|
|
199
|
+
saveThemePreset?: ((preset: ThemePresetId) => Promise<void>) | undefined;
|
|
200
|
+
/**
|
|
201
|
+
* Live ConfigStore — passed through to the TUI so the `/theme` slash
|
|
202
|
+
* command can read the current `themePreset`, apply it via
|
|
203
|
+
* `setActiveTheme()`, and persist the user's pick back to disk.
|
|
204
|
+
* Subscribes via `ConfigStore.watch` so any external write (CLI REPL,
|
|
205
|
+
* WebUI, profile migration) is reflected immediately.
|
|
206
|
+
*/
|
|
207
|
+
configStore?: ConfigStore | undefined;
|
|
208
|
+
/** Load toggleable plugin rows for the interactive plugin picker. */
|
|
209
|
+
getPluginItems?: (() => PluginPickerItem[]) | undefined;
|
|
210
|
+
/** Toggle one plugin from the interactive picker and return refreshed rows. */
|
|
211
|
+
onPluginToggle?: ((name: string) => Promise<{
|
|
212
|
+
items: PluginPickerItem[];
|
|
213
|
+
message?: string | undefined;
|
|
214
|
+
error?: string | undefined;
|
|
215
|
+
}>) | undefined;
|
|
216
|
+
/** Load MCP server rows for the interactive MCP picker. */
|
|
217
|
+
getMcpServers?: (() => McpPickerItem[]) | undefined;
|
|
218
|
+
onMcpManage?: ((action: 'add' | 'edit' | 'remove', input: Pick<McpPickerItem, 'name' | 'transport' | 'command' | 'url' | 'args'>) => Promise<{
|
|
219
|
+
items: McpPickerItem[];
|
|
220
|
+
message?: string | undefined;
|
|
221
|
+
error?: string | undefined;
|
|
222
|
+
}>) | undefined;
|
|
223
|
+
/** Toggle one MCP server (enable/disable) from the interactive picker. */
|
|
224
|
+
onMcpToggle?: ((name: string) => Promise<{
|
|
225
|
+
items: McpPickerItem[];
|
|
226
|
+
message?: string | undefined;
|
|
227
|
+
error?: string | undefined;
|
|
228
|
+
}>) | undefined;
|
|
229
|
+
/** Restart one MCP server from the interactive picker. */
|
|
230
|
+
onMcpRestart?: ((name: string) => Promise<{
|
|
231
|
+
items: McpPickerItem[];
|
|
232
|
+
message?: string | undefined;
|
|
233
|
+
error?: string | undefined;
|
|
234
|
+
}>) | undefined;
|
|
235
|
+
/** Load tool rows for the interactive tool picker. */
|
|
236
|
+
getToolsItems?: (() => ToolPickerItem[]) | undefined;
|
|
237
|
+
/** Toggle one tool (enable/disable) from the interactive tool picker. */
|
|
238
|
+
onToolToggle?: ((name: string) => Promise<{
|
|
239
|
+
items: ToolPickerItem[];
|
|
240
|
+
message?: string | undefined;
|
|
241
|
+
error?: string | undefined;
|
|
242
|
+
}>) | undefined;
|
|
243
|
+
/** Get current brain risk level and decision log for the Brain panel. */
|
|
244
|
+
getBrainData?: (() => {
|
|
245
|
+
riskLevel: 'off' | 'low' | 'medium' | 'high' | 'all';
|
|
246
|
+
log: Array<{
|
|
247
|
+
kind: string;
|
|
248
|
+
question: string;
|
|
249
|
+
outcome: string;
|
|
250
|
+
age: string;
|
|
251
|
+
}>;
|
|
252
|
+
}) | undefined;
|
|
253
|
+
/** Set brain risk ceiling from the Brain panel. */
|
|
254
|
+
onBrainRiskLevel?: ((level: 'off' | 'low' | 'medium' | 'high' | 'all') => string | undefined) | undefined;
|
|
255
|
+
/** Full Brain settings editor bridge (live apply + persist to global config). */
|
|
256
|
+
brainPanelHost?: import('./brain-panel-model.js').BrainPanelHost | undefined;
|
|
257
|
+
/** Session-scoped model-lane bridge for the interactive `/subagent-models` panel. */
|
|
258
|
+
subagentModelsHost?: import('./subagent-models-panel-model.js').SubagentModelsPanelHost | undefined;
|
|
259
|
+
/** Get current Shadow Agent state. */
|
|
260
|
+
getShadowData?: (() => {
|
|
261
|
+
activeId: string | null;
|
|
262
|
+
running: boolean;
|
|
263
|
+
model: string;
|
|
264
|
+
intervalMs: number;
|
|
265
|
+
}) | undefined;
|
|
266
|
+
/** Start Shadow Agent. Returns message or error. */
|
|
267
|
+
onShadowStart?: (() => Promise<string | undefined>) | undefined;
|
|
268
|
+
/** Stop Shadow Agent. Returns message or error. */
|
|
269
|
+
onShadowStop?: (() => Promise<string | undefined>) | undefined;
|
|
270
|
+
/**
|
|
271
|
+
* Host for the interactive `/auth` panel (provider/key management, OAuth
|
|
272
|
+
* sign-in, local-server add). The CLI builds this from its vault +
|
|
273
|
+
* models registry; when absent, `/auth` falls back to plain text.
|
|
274
|
+
*/
|
|
275
|
+
authHost?: import('./auth-panel-model.js').AuthPanelHost | undefined;
|
|
276
|
+
/**
|
|
277
|
+
* Predict likely next steps after a completed turn. The CLI wires this from
|
|
278
|
+
* the session provider and the `/next` toggle; it returns [] when prediction
|
|
279
|
+
* is disabled or autonomy isn't 'off'. Display-only — never executed.
|
|
280
|
+
*/
|
|
281
|
+
predictNext?: ((input: {
|
|
282
|
+
userRequest: string;
|
|
283
|
+
assistantSummary: string;
|
|
284
|
+
}) => Promise<string[]>) | undefined;
|
|
285
|
+
/**
|
|
286
|
+
* Called after each agent turn with the assistant's final output text.
|
|
287
|
+
* The host parses "💡 Next steps" suggestions from the text and stores
|
|
288
|
+
* them in the shared suggestion store so `/next 1`, `/next 1 2 3` work.
|
|
289
|
+
*/
|
|
290
|
+
onSuggestionsParsed?: ((finalText: string) => void) | undefined;
|
|
291
|
+
/**
|
|
292
|
+
* Retrieve current suggestions from the shared suggestion store.
|
|
293
|
+
* Used by the TUI to display and auto-submit next steps in 'auto' mode.
|
|
294
|
+
*/
|
|
295
|
+
getSuggestions?: (() => string[]) | undefined;
|
|
296
|
+
/**
|
|
297
|
+
* Retrieve current auto suggestions (items with auto="true" attribute).
|
|
298
|
+
* Used by YOLO+auto mode for automatic next-step submission.
|
|
299
|
+
*/
|
|
300
|
+
getAutoSuggestions?: (() => string[]) | undefined;
|
|
301
|
+
/**
|
|
302
|
+
* Autonomy next prompt template for YOLO+auto mode. Contains {{suggestion}} placeholder.
|
|
303
|
+
*/
|
|
304
|
+
autonomyNextPrompt?: string | undefined;
|
|
305
|
+
/**
|
|
306
|
+
* Write parsed next steps into the shared suggestion store.
|
|
307
|
+
* Called by the Entry component after parsing each assistant message
|
|
308
|
+
* so /next 1 and the auto-submit countdown can access them.
|
|
309
|
+
*/
|
|
310
|
+
setSuggestions?: ((steps: string[]) => void) | undefined;
|
|
311
|
+
/**
|
|
312
|
+
* Messages restored from a previous session. When provided (non-empty),
|
|
313
|
+
* the TUI renders the prior conversation as history entries so a resumed
|
|
314
|
+
* session shows its full chat context, not just the LLM's internal state.
|
|
315
|
+
*/
|
|
316
|
+
restoredMessages?: Message[] | undefined;
|
|
317
|
+
/**
|
|
318
|
+
* Tool execution records from a previous session, keyed by tool_use id.
|
|
319
|
+
* Used to render tool entries (name, duration, ok/error) in the TUI on
|
|
320
|
+
* resume. Events are `tool_call_end` records from the session JSONL.
|
|
321
|
+
*/
|
|
322
|
+
restoredToolCalls?: Array<{
|
|
323
|
+
name: string;
|
|
324
|
+
id: string;
|
|
325
|
+
durationMs: number;
|
|
326
|
+
ok: boolean;
|
|
327
|
+
outputBytes?: number | undefined;
|
|
328
|
+
outputTokens?: number | undefined;
|
|
329
|
+
outputLines?: number | undefined;
|
|
330
|
+
}> | undefined;
|
|
331
|
+
/**
|
|
332
|
+
* Raw prior-session JSONL events. When provided, the boot `--resume` history
|
|
333
|
+
* is rebuilt with the canonical renderer (tool I/O + interleaved audit
|
|
334
|
+
* markers) instead of meta-only tool chips. Omitted → legacy fallback.
|
|
335
|
+
*/
|
|
336
|
+
restoredEvents?: import('@wrongstack/core/types').SessionEvent[] | undefined;
|
|
337
|
+
/**
|
|
338
|
+
* List recent session summaries for the /resume picker. The CLI reads
|
|
339
|
+
* from the session store and returns ResumeSessionEntry-shaped data.
|
|
340
|
+
*/
|
|
341
|
+
listSessions?: ((limit?: number) => Promise<import('./app-state.js').ResumeSessionEntry[]>) | undefined;
|
|
342
|
+
/**
|
|
343
|
+
* Branch a session at a checkpoint (the conversation before that prompt)
|
|
344
|
+
* into a new session, leaving the original as it is. Returns the new id;
|
|
345
|
+
* the TUI then resumes it. The working tree is shared, not copied.
|
|
346
|
+
*/
|
|
347
|
+
forkSession?: ((sessionId: string, checkpointPromptIndex: number) => Promise<{
|
|
348
|
+
id: string;
|
|
349
|
+
}>) | undefined;
|
|
350
|
+
/**
|
|
351
|
+
* Resume a session by id: load JSONL events, replay history entries,
|
|
352
|
+
* rebuild agent context, and return hydrated entries for the TUI to
|
|
353
|
+
* display. Returns null when resume fails.
|
|
354
|
+
*/
|
|
355
|
+
onResumeSession?: ((sessionId: string, onLoadProgress?: (progress: SessionLoadProgress) => void,
|
|
356
|
+
/**
|
|
357
|
+
* Live stage names as each step of the resume begins (`resolve_id`,
|
|
358
|
+
* `open_journal`, `swap_writer`, …). Drives the rolling rows of the
|
|
359
|
+
* resume loading block, so the screen reports what is actually
|
|
360
|
+
* happening instead of a spinner over an unexplained multi-second wait.
|
|
361
|
+
*/
|
|
362
|
+
onStage?: (stage: string) => void) => Promise<{
|
|
363
|
+
entries: import('./components/history/types.js').HistoryEntry[];
|
|
364
|
+
nextId: number;
|
|
365
|
+
sessionId: string;
|
|
366
|
+
/**
|
|
367
|
+
* Optional context-window snapshot computed from the resumed
|
|
368
|
+
* session's tokenCounter after accounting the persisted usage.
|
|
369
|
+
* When present, the reducer writes `tokens` to `state.leader.ctxTokens`
|
|
370
|
+
* and bumps `state.contextChipVersion` so the chip refreshes
|
|
371
|
+
* immediately. When absent, the chip stays at its previous value
|
|
372
|
+
* until the next ctx.pct event lands.
|
|
373
|
+
*/
|
|
374
|
+
contextSnapshot?: ContextSnapshot | undefined;
|
|
375
|
+
/** `false` = transcript replayed read-only; the session was not claimed. */
|
|
376
|
+
attached?: boolean | undefined;
|
|
377
|
+
/** Non-fatal problems to surface next to the replayed transcript. */
|
|
378
|
+
warnings?: string[] | undefined;
|
|
379
|
+
/**
|
|
380
|
+
* `<nextsteps>` parsed from the resumed session's final assistant turn.
|
|
381
|
+
*
|
|
382
|
+
* OFFERED, never executed: the resume lists them and stops. Empty when
|
|
383
|
+
* the session did not end on a next-steps block, when it has open todos
|
|
384
|
+
* (the board keeps precedence), or when the transcript is read-only.
|
|
385
|
+
*/
|
|
386
|
+
nextSteps?: string[] | undefined;
|
|
387
|
+
} | null>) | undefined;
|
|
388
|
+
getProjectPickerItems?: (() => Promise<import('./components/project-picker.js').ProjectPickerItem[]>) | undefined;
|
|
389
|
+
onProjectSelect?: ((key: string, kind: 'project' | 'action') => void | string | null | Promise<void | string | null>) | undefined;
|
|
390
|
+
/**
|
|
391
|
+
* Request the TUI to exit with a specific code. Used by the project picker
|
|
392
|
+
* to trigger a clean exit before spawning a new wstack process in a different
|
|
393
|
+
* project directory. The host CLI catches this exit code and performs the
|
|
394
|
+
* actual project switch.
|
|
395
|
+
*/
|
|
396
|
+
requestExit?: (code: number) => void;
|
|
397
|
+
getLiveSessions?: (() => Promise<import('./components/sessions-panel.js').LiveSessionEntry[]>) | undefined;
|
|
398
|
+
onSwitchToSession?: ((sessionId: string, projectRoot: string, projectName: string) => void) | undefined;
|
|
399
|
+
/**
|
|
400
|
+
* When true, the agents monitor (F3) is open by default at TUI startup.
|
|
401
|
+
* Used by the `wrongstack quick` command to show agents panel immediately.
|
|
402
|
+
*/
|
|
403
|
+
initialAgentsMonitorOpen?: boolean | undefined;
|
|
404
|
+
/**
|
|
405
|
+
* Access the project-level AutonomousCoordinator instance. When set, the TUI
|
|
406
|
+
* renders a coordination panel showing live goals, pending tasks, consensus
|
|
407
|
+
* decisions, and shared knowledge from all active sessions. The coordinator
|
|
408
|
+
* runs independently of the session — it coordinates multiple sessions.
|
|
409
|
+
*/
|
|
410
|
+
getAutonomousCoordinator?: () => AutonomousCoordinator | null | undefined;
|
|
411
|
+
/**
|
|
412
|
+
* Subscribe to live events from the AutonomousCoordinator:
|
|
413
|
+
* - `goal:added` — new coordination goal received
|
|
414
|
+
* - `goal:completed` — goal finished successfully
|
|
415
|
+
* - `goal:failed` — goal failed after max attempts
|
|
416
|
+
* - `task:ready` — task's dependencies are satisfied, ready to execute
|
|
417
|
+
* - `task:completed` — task finished
|
|
418
|
+
* - `knowledge:added` — new shared fact published
|
|
419
|
+
* - `consensus:reached` — multi-session agreement reached
|
|
420
|
+
* Returns an unsubscribe function.
|
|
421
|
+
*/
|
|
422
|
+
subscribeCoordinatorEvents?: (fn: (event: CoordinatorEvent) => void) => () => void;
|
|
423
|
+
/**
|
|
424
|
+
* Start the AutonomousCoordinator loop. Fire-and-forget — run() loops
|
|
425
|
+
* asynchronously. Pass a goal string to begin decomposition and task
|
|
426
|
+
* auction immediately.
|
|
427
|
+
*/
|
|
428
|
+
onCoordinatorStart?: ((goal?: string) => void) | undefined;
|
|
429
|
+
/** Stop the AutonomousCoordinator loop. */
|
|
430
|
+
onCoordinatorStop?: (() => void) | undefined;
|
|
431
|
+
/** List pending coordinator tasks claimable by this terminal. */
|
|
432
|
+
onCoordinatorTasks?: (() => Promise<Array<{
|
|
433
|
+
id: string;
|
|
434
|
+
title: string;
|
|
435
|
+
priority: string;
|
|
436
|
+
tags: string[];
|
|
437
|
+
}> | null>) | undefined;
|
|
438
|
+
/** Claim a coordinator task. Returns description on success. */
|
|
439
|
+
onCoordinatorClaim?: ((taskId: string) => Promise<string | null | {
|
|
440
|
+
description: string;
|
|
441
|
+
}>) | undefined;
|
|
442
|
+
/** Mark a claimed task as completed. */
|
|
443
|
+
onCoordinatorComplete?: ((taskId: string, result?: string) => Promise<string | null>) | undefined;
|
|
444
|
+
/** Mark a claimed task as failed. */
|
|
445
|
+
onCoordinatorFail?: ((taskId: string, error: string) => Promise<string | null>) | undefined;
|
|
446
|
+
/** Get coordinator stats for status display. */
|
|
447
|
+
onCoordinatorStatus?: (() => Promise<{
|
|
448
|
+
goals: {
|
|
449
|
+
total: number;
|
|
450
|
+
done: number;
|
|
451
|
+
pending: number;
|
|
452
|
+
failed: number;
|
|
453
|
+
};
|
|
454
|
+
dag: {
|
|
455
|
+
running: number;
|
|
456
|
+
ready: number;
|
|
457
|
+
done: number;
|
|
458
|
+
failed: number;
|
|
459
|
+
};
|
|
460
|
+
auction: {
|
|
461
|
+
pending: number;
|
|
462
|
+
inProgress: number;
|
|
463
|
+
};
|
|
464
|
+
} | null>) | undefined;
|
|
465
|
+
/** Access the persistent memory store for listing and inspecting memories. */
|
|
466
|
+
memoryStore?: import('@wrongstack/core/types').MemoryPort | undefined;
|
|
467
|
+
}
|
|
468
|
+
//# sourceMappingURL=run-tui-surface-options.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { InputBuilder } from '@wrongstack/core/agent';
|
|
2
|
+
import type { Director } from '@wrongstack/core/coordination';
|
|
3
|
+
import type { AttachmentStore, ContentBlock } from '@wrongstack/core/types';
|
|
4
|
+
import type { Action, State } from './app-reducer.js';
|
|
5
|
+
import type { emptyMemoryContextMonitor } from './memory-context-monitor.js';
|
|
6
|
+
import type { MutableCell } from './shared-types.js';
|
|
7
|
+
import type { TokenPreviewStore } from './token-previews.js';
|
|
8
|
+
import type { SubmitCapabilities } from './tui-host-capabilities.js';
|
|
9
|
+
/**
|
|
10
|
+
* Wait up to `deadlineMs` for an in-flight run to settle into `idle` before
|
|
11
|
+
* kicking the next iteration. Polls `isIdle` rather than spinning: the cadence
|
|
12
|
+
* starts tight (so we react quickly when the abort settles early) and backs
|
|
13
|
+
* off toward the deadline, so a long wait never hammers the event loop at a
|
|
14
|
+
* fixed high frequency. Returns true if idle was reached before the deadline.
|
|
15
|
+
*/
|
|
16
|
+
export declare function waitForIdleSettle(isIdle: () => boolean, deadlineMs: number, opts?: {
|
|
17
|
+
maxPollMs?: number;
|
|
18
|
+
}): Promise<boolean>;
|
|
19
|
+
export interface SubmitControllerHost {
|
|
20
|
+
readonly capabilities: SubmitCapabilities;
|
|
21
|
+
readonly state: State;
|
|
22
|
+
readonly live: {
|
|
23
|
+
readonly mouseMode: boolean;
|
|
24
|
+
/** Mouse tracking released to the terminal (`/mouse native`). */
|
|
25
|
+
readonly nativeMouse: boolean;
|
|
26
|
+
readonly model: string;
|
|
27
|
+
readonly provider: string;
|
|
28
|
+
readonly maxContext: number | undefined;
|
|
29
|
+
readonly yolo: boolean;
|
|
30
|
+
readonly autonomy: 'off' | 'suggest' | 'auto' | 'eternal' | 'eternal-parallel';
|
|
31
|
+
readonly modeLabel: string | undefined;
|
|
32
|
+
setMouseMode(value: boolean): void;
|
|
33
|
+
setNativeMouse(value: boolean): void;
|
|
34
|
+
setModel(value: string): void;
|
|
35
|
+
setProvider(value: string): void;
|
|
36
|
+
setMaxContext(value: number): void;
|
|
37
|
+
setYolo(value: boolean): void;
|
|
38
|
+
setAutonomy(value: 'off' | 'suggest' | 'auto' | 'eternal' | 'eternal-parallel'): void;
|
|
39
|
+
setModeLabel(value: string): void;
|
|
40
|
+
setToolCount(value: number): void;
|
|
41
|
+
};
|
|
42
|
+
readonly refs: {
|
|
43
|
+
readonly state: MutableCell<State>;
|
|
44
|
+
readonly interrupts: MutableCell<number>;
|
|
45
|
+
readonly autoSubmitStreak: MutableCell<number>;
|
|
46
|
+
readonly autoSubmitCapWarned: MutableCell<boolean>;
|
|
47
|
+
readonly autoSubmitLoopGuard: MutableCell<{
|
|
48
|
+
reset(): void;
|
|
49
|
+
}>;
|
|
50
|
+
readonly tokenPreviews: MutableCell<TokenPreviewStore>;
|
|
51
|
+
readonly attachments: AttachmentStore;
|
|
52
|
+
readonly builder: MutableCell<InputBuilder | null>;
|
|
53
|
+
readonly sessionGeneration: MutableCell<number>;
|
|
54
|
+
readonly eternalLoop: MutableCell<() => Promise<void>>;
|
|
55
|
+
readonly parallelLoop: MutableCell<() => Promise<void>>;
|
|
56
|
+
readonly enhanceEnabled: MutableCell<boolean>;
|
|
57
|
+
readonly enhanceOriginal: MutableCell<string>;
|
|
58
|
+
readonly enhanceAbort: MutableCell<AbortController | null>;
|
|
59
|
+
readonly enhanceCancelled: MutableCell<boolean>;
|
|
60
|
+
readonly nextStepsTimer: MutableCell<ReturnType<typeof setInterval> | undefined>;
|
|
61
|
+
readonly midRunSendPicker: MutableCell<boolean>;
|
|
62
|
+
/** Managed-history scroll surface; null until ScrollableHistory mounts. */
|
|
63
|
+
readonly historyScroll: MutableCell<import('./components/scrollable-history.js').HistoryScrollController | null>;
|
|
64
|
+
};
|
|
65
|
+
readonly actions: {
|
|
66
|
+
dispatch(action: Action): void;
|
|
67
|
+
clearDraft(): void;
|
|
68
|
+
setDraft(buffer: string, cursor: number): void;
|
|
69
|
+
pasteClipboardImage(): Promise<void>;
|
|
70
|
+
openPromptPicker(): Promise<void>;
|
|
71
|
+
refreshGoalSummary(): void;
|
|
72
|
+
exit(): void;
|
|
73
|
+
runBlocks(blocks: ContentBlock[]): Promise<void>;
|
|
74
|
+
liveDirector(): Director | null;
|
|
75
|
+
setMemoryContextMonitor(value: ReturnType<typeof emptyMemoryContextMonitor>): void;
|
|
76
|
+
runSteerSequence(direction: string): {
|
|
77
|
+
preamble: string;
|
|
78
|
+
};
|
|
79
|
+
setEnhanceStartedAt(value: number | null): void;
|
|
80
|
+
setEnhanceDuration(value: number | null): void;
|
|
81
|
+
setRefineProvider(value: string | null): void;
|
|
82
|
+
setRefineModel(value: string | null): void;
|
|
83
|
+
onBugHuntStarted(command: string, totalRounds?: number): void;
|
|
84
|
+
stopBugHuntAfterCurrentRound(): void;
|
|
85
|
+
consumeBugHuntReplay(command: string): boolean;
|
|
86
|
+
/** Called after /clear dispatches clearHistory — app.tsx uses this to
|
|
87
|
+
* reset mutable refs that the reducer cannot reach (paste accumulator,
|
|
88
|
+
* next-steps auto-submit, prompt-usage store, enhance abort). */
|
|
89
|
+
onAfterClear?(): void;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=submit-controller-support.d.ts.map
|
|
@@ -1,83 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import type { AttachmentStore, ContentBlock } from '@wrongstack/core/types';
|
|
4
|
-
import type { Action, State } from './app-reducer.js';
|
|
5
|
-
import type { emptyMemoryContextMonitor } from './memory-context-monitor.js';
|
|
6
|
-
import type { MutableCell } from './shared-types.js';
|
|
7
|
-
import { type TokenPreviewStore } from './token-previews.js';
|
|
8
|
-
import type { SubmitCapabilities } from './tui-host-capabilities.js';
|
|
9
|
-
export interface SubmitControllerHost {
|
|
10
|
-
readonly capabilities: SubmitCapabilities;
|
|
11
|
-
readonly state: State;
|
|
12
|
-
readonly live: {
|
|
13
|
-
readonly mouseMode: boolean;
|
|
14
|
-
/** Mouse tracking released to the terminal (`/mouse native`). */
|
|
15
|
-
readonly nativeMouse: boolean;
|
|
16
|
-
readonly model: string;
|
|
17
|
-
readonly provider: string;
|
|
18
|
-
readonly maxContext: number | undefined;
|
|
19
|
-
readonly yolo: boolean;
|
|
20
|
-
readonly autonomy: 'off' | 'suggest' | 'auto' | 'eternal' | 'eternal-parallel';
|
|
21
|
-
readonly modeLabel: string | undefined;
|
|
22
|
-
setMouseMode(value: boolean): void;
|
|
23
|
-
setNativeMouse(value: boolean): void;
|
|
24
|
-
setModel(value: string): void;
|
|
25
|
-
setProvider(value: string): void;
|
|
26
|
-
setMaxContext(value: number): void;
|
|
27
|
-
setYolo(value: boolean): void;
|
|
28
|
-
setAutonomy(value: 'off' | 'suggest' | 'auto' | 'eternal' | 'eternal-parallel'): void;
|
|
29
|
-
setModeLabel(value: string): void;
|
|
30
|
-
setToolCount(value: number): void;
|
|
31
|
-
};
|
|
32
|
-
readonly refs: {
|
|
33
|
-
readonly state: MutableCell<State>;
|
|
34
|
-
readonly interrupts: MutableCell<number>;
|
|
35
|
-
readonly autoSubmitStreak: MutableCell<number>;
|
|
36
|
-
readonly autoSubmitCapWarned: MutableCell<boolean>;
|
|
37
|
-
readonly autoSubmitLoopGuard: MutableCell<{
|
|
38
|
-
reset(): void;
|
|
39
|
-
}>;
|
|
40
|
-
readonly tokenPreviews: MutableCell<TokenPreviewStore>;
|
|
41
|
-
readonly attachments: AttachmentStore;
|
|
42
|
-
readonly builder: MutableCell<InputBuilder | null>;
|
|
43
|
-
readonly sessionGeneration: MutableCell<number>;
|
|
44
|
-
readonly eternalLoop: MutableCell<() => Promise<void>>;
|
|
45
|
-
readonly parallelLoop: MutableCell<() => Promise<void>>;
|
|
46
|
-
readonly enhanceEnabled: MutableCell<boolean>;
|
|
47
|
-
readonly enhanceOriginal: MutableCell<string>;
|
|
48
|
-
readonly enhanceAbort: MutableCell<AbortController | null>;
|
|
49
|
-
readonly enhanceCancelled: MutableCell<boolean>;
|
|
50
|
-
readonly nextStepsTimer: MutableCell<ReturnType<typeof setInterval> | undefined>;
|
|
51
|
-
readonly midRunSendPicker: MutableCell<boolean>;
|
|
52
|
-
/** Managed-history scroll surface; null until ScrollableHistory mounts. */
|
|
53
|
-
readonly historyScroll: MutableCell<import('./components/scrollable-history.js').HistoryScrollController | null>;
|
|
54
|
-
};
|
|
55
|
-
readonly actions: {
|
|
56
|
-
dispatch(action: Action): void;
|
|
57
|
-
clearDraft(): void;
|
|
58
|
-
setDraft(buffer: string, cursor: number): void;
|
|
59
|
-
pasteClipboardImage(): Promise<void>;
|
|
60
|
-
openPromptPicker(): Promise<void>;
|
|
61
|
-
refreshGoalSummary(): void;
|
|
62
|
-
exit(): void;
|
|
63
|
-
runBlocks(blocks: ContentBlock[]): Promise<void>;
|
|
64
|
-
liveDirector(): Director | null;
|
|
65
|
-
setMemoryContextMonitor(value: ReturnType<typeof emptyMemoryContextMonitor>): void;
|
|
66
|
-
runSteerSequence(direction: string): {
|
|
67
|
-
preamble: string;
|
|
68
|
-
};
|
|
69
|
-
setEnhanceStartedAt(value: number | null): void;
|
|
70
|
-
setEnhanceDuration(value: number | null): void;
|
|
71
|
-
setRefineProvider(value: string | null): void;
|
|
72
|
-
setRefineModel(value: string | null): void;
|
|
73
|
-
onBugHuntStarted(command: string, totalRounds?: number): void;
|
|
74
|
-
stopBugHuntAfterCurrentRound(): void;
|
|
75
|
-
consumeBugHuntReplay(command: string): boolean;
|
|
76
|
-
/** Called after /clear dispatches clearHistory — app.tsx uses this to
|
|
77
|
-
* reset mutable refs that the reducer cannot reach (paste accumulator,
|
|
78
|
-
* next-steps auto-submit, prompt-usage store, enhance abort). */
|
|
79
|
-
onAfterClear?(): void;
|
|
80
|
-
};
|
|
81
|
-
}
|
|
1
|
+
import type { SubmitControllerHost } from './submit-controller-support.js';
|
|
2
|
+
export type { SubmitControllerHost } from './submit-controller-support.js';
|
|
82
3
|
export declare function createSubmitController(host: SubmitControllerHost): (overrideRaw?: string) => Promise<void>;
|
|
83
4
|
//# sourceMappingURL=submit-controller.d.ts.map
|
|
@@ -15,6 +15,6 @@ export declare function useControllerConfirmAuth({ getDirector, controllerProps,
|
|
|
15
15
|
}): {
|
|
16
16
|
liveDirector: () => Director | null;
|
|
17
17
|
clearPendingConfirms: () => void;
|
|
18
|
-
authPanelController: import("./hooks/
|
|
18
|
+
authPanelController: import("./hooks/auth-panel-support.js").AuthPanelController;
|
|
19
19
|
};
|
|
20
20
|
//# sourceMappingURL=use-controller-confirm-auth.d.ts.map
|