stitchkit-tui 0.1.4 → 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/dist/cli.js +457 -454
- package/dist/core/index.js +30 -30
- package/dist/index.js +665 -662
- package/package.json +6 -3
package/dist/index.js
CHANGED
|
@@ -1,110 +1,19 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// src/
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
var TerminalCollectionStateSchema = z.object({
|
|
5
|
-
keys: z.array(z.string().min(1)),
|
|
6
|
-
selectedKey: z.string().min(1).nullable(),
|
|
7
|
-
start: z.int().nonnegative(),
|
|
8
|
-
capacity: z.int().positive()
|
|
9
|
-
}).strict();
|
|
10
|
-
function maximumStart(total, capacity) {
|
|
11
|
-
return Math.max(0, total - capacity);
|
|
12
|
-
}
|
|
13
|
-
function reveal(start, capacity, index, total) {
|
|
14
|
-
const bounded = Math.min(Math.max(0, start), maximumStart(total, capacity));
|
|
15
|
-
if (index < bounded)
|
|
16
|
-
return index;
|
|
17
|
-
if (index >= bounded + capacity)
|
|
18
|
-
return index - capacity + 1;
|
|
19
|
-
return bounded;
|
|
20
|
-
}
|
|
21
|
-
function uniqueKeys(keys) {
|
|
22
|
-
const result = z.array(z.string().min(1)).parse(keys);
|
|
23
|
-
if (new Set(result).size !== result.length) {
|
|
24
|
-
throw new Error("Terminal collection keys must be unique");
|
|
25
|
-
}
|
|
26
|
-
return result;
|
|
27
|
-
}
|
|
28
|
-
function createTerminalCollection(keys, capacity, selectedKey) {
|
|
29
|
-
const parsedKeys = uniqueKeys(keys);
|
|
30
|
-
const parsedCapacity = z.int().positive().parse(capacity);
|
|
31
|
-
const selected = selectedKey !== undefined && parsedKeys.includes(selectedKey) ? selectedKey : parsedKeys[0] ?? null;
|
|
32
|
-
const index = selected === null ? -1 : parsedKeys.indexOf(selected);
|
|
33
|
-
return TerminalCollectionStateSchema.parse({
|
|
34
|
-
keys: parsedKeys,
|
|
35
|
-
selectedKey: selected,
|
|
36
|
-
start: index < 0 ? 0 : reveal(0, parsedCapacity, index, parsedKeys.length),
|
|
37
|
-
capacity: parsedCapacity
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
function reduceTerminalCollection(state, action) {
|
|
41
|
-
const current = TerminalCollectionStateSchema.parse(state);
|
|
42
|
-
if (action.type === "reconcile") {
|
|
43
|
-
const keys = uniqueKeys(action.keys);
|
|
44
|
-
if (keys.length === 0)
|
|
45
|
-
return { keys, selectedKey: null, start: 0, capacity: current.capacity };
|
|
46
|
-
const previousIndex = current.selectedKey === null ? 0 : Math.max(0, current.keys.indexOf(current.selectedKey));
|
|
47
|
-
const selectedKey2 = current.selectedKey !== null && keys.includes(current.selectedKey) ? current.selectedKey : keys[Math.min(previousIndex, keys.length - 1)];
|
|
48
|
-
if (!selectedKey2)
|
|
49
|
-
throw new Error("Terminal collection survivor is unavailable");
|
|
50
|
-
const index = keys.indexOf(selectedKey2);
|
|
51
|
-
return TerminalCollectionStateSchema.parse({
|
|
52
|
-
...current,
|
|
53
|
-
keys,
|
|
54
|
-
selectedKey: selectedKey2,
|
|
55
|
-
start: reveal(current.start, current.capacity, index, keys.length)
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
if (action.type === "resize") {
|
|
59
|
-
const capacity = z.int().positive().parse(action.capacity);
|
|
60
|
-
const index = current.selectedKey === null ? -1 : current.keys.indexOf(current.selectedKey);
|
|
61
|
-
return TerminalCollectionStateSchema.parse({
|
|
62
|
-
...current,
|
|
63
|
-
capacity,
|
|
64
|
-
start: index < 0 ? 0 : reveal(current.start, capacity, index, current.keys.length)
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
if (action.type === "scroll") {
|
|
68
|
-
return TerminalCollectionStateSchema.parse({
|
|
69
|
-
...current,
|
|
70
|
-
start: Math.min(Math.max(0, current.start + action.lines), maximumStart(current.keys.length, current.capacity))
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
if (current.keys.length === 0)
|
|
74
|
-
return current;
|
|
75
|
-
const currentIndex = current.selectedKey === null ? 0 : Math.max(0, current.keys.indexOf(current.selectedKey));
|
|
76
|
-
const nextIndex = action.type === "select" ? current.keys.indexOf(action.key) : action.wrap ? ((currentIndex + action.delta) % current.keys.length + current.keys.length) % current.keys.length : Math.min(Math.max(0, currentIndex + action.delta), current.keys.length - 1);
|
|
77
|
-
if (nextIndex < 0) {
|
|
78
|
-
throw new Error(action.type === "select" ? `Unknown terminal collection key: ${action.key}` : "Terminal collection movement could not resolve a selection");
|
|
79
|
-
}
|
|
80
|
-
const selectedKey = current.keys[nextIndex];
|
|
81
|
-
if (!selectedKey)
|
|
82
|
-
throw new Error("Terminal collection selection is unavailable");
|
|
83
|
-
return TerminalCollectionStateSchema.parse({
|
|
84
|
-
...current,
|
|
85
|
-
selectedKey,
|
|
86
|
-
start: reveal(current.start, current.capacity, nextIndex, current.keys.length)
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
function visibleTerminalCollectionRange(state) {
|
|
90
|
-
const parsed = TerminalCollectionStateSchema.parse(state);
|
|
91
|
-
return {
|
|
92
|
-
start: parsed.start,
|
|
93
|
-
end: Math.min(parsed.keys.length, parsed.start + parsed.capacity)
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
// src/core/command-palette.ts
|
|
2
|
+
// src/commands.ts
|
|
97
3
|
import { z as z2 } from "zod";
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
4
|
+
|
|
5
|
+
// src/core/command-palette.ts
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
var TerminalCommandDescriptorSchema = z.object({
|
|
8
|
+
id: z.string().regex(/^[a-z][a-z0-9-]*$/),
|
|
9
|
+
aliases: z.array(z.string().min(1)).default([]),
|
|
10
|
+
label: z.string().min(1),
|
|
11
|
+
description: z.string().default("")
|
|
103
12
|
}).strict();
|
|
104
|
-
var TerminalCommandPaletteStateSchema =
|
|
105
|
-
query:
|
|
106
|
-
selectedIndex:
|
|
107
|
-
dismissed:
|
|
13
|
+
var TerminalCommandPaletteStateSchema = z.object({
|
|
14
|
+
query: z.string(),
|
|
15
|
+
selectedIndex: z.int().nonnegative(),
|
|
16
|
+
dismissed: z.boolean()
|
|
108
17
|
}).strict();
|
|
109
18
|
function validateTerminalCommands(commands) {
|
|
110
19
|
const parsed = commands.map((command) => TerminalCommandDescriptorSchema.parse(command));
|
|
@@ -135,7 +44,7 @@ function terminalCommandMatches(state, commands, limit = 20) {
|
|
|
135
44
|
return [];
|
|
136
45
|
const parsed = validateTerminalCommands(commands);
|
|
137
46
|
const query = current.query.toLowerCase();
|
|
138
|
-
return parsed.filter((command) => command.id.includes(query) || command.label.toLowerCase().includes(query) || command.aliases.some((alias) => alias.includes(query))).slice(0,
|
|
47
|
+
return parsed.filter((command) => command.id.includes(query) || command.label.toLowerCase().includes(query) || command.aliases.some((alias) => alias.includes(query))).slice(0, z.int().positive().parse(limit));
|
|
139
48
|
}
|
|
140
49
|
function moveTerminalCommandSelection(state, delta, matchCount) {
|
|
141
50
|
const current = TerminalCommandPaletteStateSchema.parse(state);
|
|
@@ -153,194 +62,17 @@ function selectedTerminalCommand(state, commands, limit = 20) {
|
|
|
153
62
|
function resolveExactTerminalCommand(name, commands) {
|
|
154
63
|
return validateTerminalCommands(commands).find((command) => command.id === name || command.aliases.includes(name));
|
|
155
64
|
}
|
|
156
|
-
|
|
157
|
-
import { z as z3 } from "zod";
|
|
158
|
-
var TerminalOperationStateSchema = z3.object({
|
|
159
|
-
status: z3.enum(["idle", "confirming", "pending", "succeeded", "failed"]),
|
|
160
|
-
operationId: z3.string().min(1).nullable(),
|
|
161
|
-
message: z3.string().optional()
|
|
162
|
-
}).strict();
|
|
163
|
-
function createTerminalOperationState() {
|
|
164
|
-
return { status: "idle", operationId: null };
|
|
165
|
-
}
|
|
166
|
-
function reduceTerminalOperationState(state, action) {
|
|
167
|
-
const current = TerminalOperationStateSchema.parse(state);
|
|
168
|
-
if (action.type === "request") {
|
|
169
|
-
if (current.status === "pending")
|
|
170
|
-
throw new Error("A terminal operation is already pending");
|
|
171
|
-
return TerminalOperationStateSchema.parse({
|
|
172
|
-
status: "confirming",
|
|
173
|
-
operationId: action.operationId,
|
|
174
|
-
...action.message !== undefined && { message: action.message }
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
if (action.type === "reset" || action.type === "cancel") {
|
|
178
|
-
if (action.type === "cancel" && current.status !== "confirming") {
|
|
179
|
-
throw new Error("Only a confirming terminal operation can be cancelled");
|
|
180
|
-
}
|
|
181
|
-
return createTerminalOperationState();
|
|
182
|
-
}
|
|
183
|
-
if (action.type === "confirm") {
|
|
184
|
-
if (current.status !== "confirming") {
|
|
185
|
-
throw new Error("Only a confirming terminal operation can become pending");
|
|
186
|
-
}
|
|
187
|
-
return { ...current, status: "pending" };
|
|
188
|
-
}
|
|
189
|
-
if (current.status !== "pending") {
|
|
190
|
-
throw new Error("Only a pending terminal operation can settle");
|
|
191
|
-
}
|
|
192
|
-
return TerminalOperationStateSchema.parse({
|
|
193
|
-
status: action.type === "succeed" ? "succeeded" : "failed",
|
|
194
|
-
operationId: current.operationId,
|
|
195
|
-
...action.message !== undefined && { message: action.message }
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
// src/core/panes.ts
|
|
199
|
-
import { z as z4 } from "zod";
|
|
200
|
-
var TerminalPaneIdSchema = z4.enum(["primary", "secondary"]);
|
|
201
|
-
var TerminalPaneModeSchema = z4.enum(["split", "single"]);
|
|
202
|
-
var TerminalPaneStateSchema = z4.object({
|
|
203
|
-
mode: TerminalPaneModeSchema,
|
|
204
|
-
focus: TerminalPaneIdSchema,
|
|
205
|
-
primarySize: z4.int().positive(),
|
|
206
|
-
totalSize: z4.int().positive(),
|
|
207
|
-
minPrimary: z4.int().positive(),
|
|
208
|
-
minSecondary: z4.int().positive()
|
|
209
|
-
}).strict();
|
|
210
|
-
function clampPrimary(input) {
|
|
211
|
-
const maximum = Math.max(input.minPrimary, input.totalSize - input.minSecondary);
|
|
212
|
-
return Math.min(Math.max(input.minPrimary, input.primarySize), maximum);
|
|
213
|
-
}
|
|
214
|
-
function createTerminalPaneState(input) {
|
|
215
|
-
const values = z4.object({
|
|
216
|
-
totalSize: z4.int().positive(),
|
|
217
|
-
primarySize: z4.int().positive(),
|
|
218
|
-
minPrimary: z4.int().positive(),
|
|
219
|
-
minSecondary: z4.int().positive(),
|
|
220
|
-
mode: TerminalPaneModeSchema.default("split"),
|
|
221
|
-
focus: TerminalPaneIdSchema.default("primary")
|
|
222
|
-
}).strict().parse(input);
|
|
223
|
-
if (values.mode === "split" && values.totalSize < values.minPrimary + values.minSecondary) {
|
|
224
|
-
throw new Error("Split terminal panes do not fit within the total size");
|
|
225
|
-
}
|
|
226
|
-
return TerminalPaneStateSchema.parse({
|
|
227
|
-
...values,
|
|
228
|
-
primarySize: clampPrimary(values)
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
function reduceTerminalPaneState(state, action) {
|
|
232
|
-
const current = TerminalPaneStateSchema.parse(state);
|
|
233
|
-
if (action.type === "focus")
|
|
234
|
-
return { ...current, focus: action.pane };
|
|
235
|
-
if (action.type === "toggle-focus") {
|
|
236
|
-
return { ...current, focus: current.focus === "primary" ? "secondary" : "primary" };
|
|
237
|
-
}
|
|
238
|
-
if (action.type === "mode") {
|
|
239
|
-
if (action.mode === "split" && current.totalSize < current.minPrimary + current.minSecondary) {
|
|
240
|
-
throw new Error("Split terminal panes do not fit within the total size");
|
|
241
|
-
}
|
|
242
|
-
return { ...current, mode: action.mode };
|
|
243
|
-
}
|
|
244
|
-
const totalSize = action.type === "terminal-resize" ? action.totalSize : current.totalSize;
|
|
245
|
-
const mode = current.mode === "split" && totalSize < current.minPrimary + current.minSecondary ? "single" : current.mode;
|
|
246
|
-
const primarySize = action.type === "resize" ? action.primarySize : current.primarySize;
|
|
247
|
-
return TerminalPaneStateSchema.parse({
|
|
248
|
-
...current,
|
|
249
|
-
totalSize,
|
|
250
|
-
mode,
|
|
251
|
-
primarySize: clampPrimary({
|
|
252
|
-
primarySize,
|
|
253
|
-
totalSize,
|
|
254
|
-
minPrimary: current.minPrimary,
|
|
255
|
-
minSecondary: current.minSecondary
|
|
256
|
-
})
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
function visibleTerminalPanes(state) {
|
|
260
|
-
const parsed = TerminalPaneStateSchema.parse(state);
|
|
261
|
-
return parsed.mode === "split" ? ["primary", "secondary"] : [parsed.focus];
|
|
262
|
-
}
|
|
263
|
-
// src/core/viewport.ts
|
|
264
|
-
import { z as z5 } from "zod";
|
|
265
|
-
var TerminalFeedViewportSchema = z5.object({
|
|
266
|
-
total: z5.int().nonnegative(),
|
|
267
|
-
capacity: z5.int().positive(),
|
|
268
|
-
start: z5.int().nonnegative(),
|
|
269
|
-
followTail: z5.boolean(),
|
|
270
|
-
unseen: z5.int().nonnegative()
|
|
271
|
-
}).strict();
|
|
272
|
-
function maximumStart2(total, capacity) {
|
|
273
|
-
return Math.max(0, total - capacity);
|
|
274
|
-
}
|
|
275
|
-
function createTerminalFeedViewport(total, capacity) {
|
|
276
|
-
const parsedTotal = z5.int().nonnegative().parse(total);
|
|
277
|
-
const parsedCapacity = z5.int().positive().parse(capacity);
|
|
278
|
-
return TerminalFeedViewportSchema.parse({
|
|
279
|
-
total: parsedTotal,
|
|
280
|
-
capacity: parsedCapacity,
|
|
281
|
-
start: maximumStart2(parsedTotal, parsedCapacity),
|
|
282
|
-
followTail: true,
|
|
283
|
-
unseen: 0
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
function reduceTerminalFeedViewport(state, action) {
|
|
287
|
-
const current = TerminalFeedViewportSchema.parse(state);
|
|
288
|
-
if (action.type === "append") {
|
|
289
|
-
const count = Math.max(0, action.count);
|
|
290
|
-
const total = current.total + count;
|
|
291
|
-
return TerminalFeedViewportSchema.parse({
|
|
292
|
-
...current,
|
|
293
|
-
total,
|
|
294
|
-
start: current.followTail ? maximumStart2(total, current.capacity) : current.start,
|
|
295
|
-
unseen: current.followTail ? 0 : current.unseen + count
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
if (action.type === "prepend") {
|
|
299
|
-
const count = Math.max(0, action.count);
|
|
300
|
-
return TerminalFeedViewportSchema.parse({
|
|
301
|
-
...current,
|
|
302
|
-
total: current.total + count,
|
|
303
|
-
start: current.start + count
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
if (action.type === "resize") {
|
|
307
|
-
const capacity = z5.int().positive().parse(action.capacity);
|
|
308
|
-
return TerminalFeedViewportSchema.parse({
|
|
309
|
-
...current,
|
|
310
|
-
capacity,
|
|
311
|
-
start: current.followTail ? maximumStart2(current.total, capacity) : Math.min(current.start, maximumStart2(current.total, capacity))
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
if (action.type === "home")
|
|
315
|
-
return { ...current, start: 0, followTail: false };
|
|
316
|
-
if (action.type === "end") {
|
|
317
|
-
return {
|
|
318
|
-
...current,
|
|
319
|
-
start: maximumStart2(current.total, current.capacity),
|
|
320
|
-
followTail: true,
|
|
321
|
-
unseen: 0
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
const delta = action.type === "page" ? action.pages * current.capacity : action.lines;
|
|
325
|
-
const start = Math.max(0, Math.min(maximumStart2(current.total, current.capacity), current.start + delta));
|
|
326
|
-
const atTail = start === maximumStart2(current.total, current.capacity) && delta > 0;
|
|
327
|
-
return { ...current, start, followTail: atTail, unseen: atTail ? 0 : current.unseen };
|
|
328
|
-
}
|
|
329
|
-
function visibleTerminalFeedRange(state) {
|
|
330
|
-
const parsed = TerminalFeedViewportSchema.parse(state);
|
|
331
|
-
return { start: parsed.start, end: Math.min(parsed.total, parsed.start + parsed.capacity) };
|
|
332
|
-
}
|
|
65
|
+
|
|
333
66
|
// src/commands.ts
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
query: z6.string().optional()
|
|
67
|
+
var AgentTuiCommandOutcomeSchema = z2.discriminatedUnion("type", [
|
|
68
|
+
z2.object({ type: z2.literal("submit"), text: z2.string().min(1) }).strict(),
|
|
69
|
+
z2.object({
|
|
70
|
+
type: z2.literal("dialog"),
|
|
71
|
+
dialog: z2.string().min(1),
|
|
72
|
+
query: z2.string().optional()
|
|
341
73
|
}).strict(),
|
|
342
|
-
|
|
343
|
-
|
|
74
|
+
z2.object({ type: z2.literal("notice"), message: z2.string() }).strict(),
|
|
75
|
+
z2.object({ type: z2.literal("action"), action: z2.string().min(1) }).strict()
|
|
344
76
|
]);
|
|
345
77
|
function defineTuiCommand(command) {
|
|
346
78
|
if (!/^[a-z][a-z0-9-]*$/.test(command.name)) {
|
|
@@ -399,12 +131,12 @@ function resolveTuiCommandSubmission(text, commands, selectedIndex, paletteDismi
|
|
|
399
131
|
return resolveTuiCommand(completion ? `/${completion.name}` : text, commands);
|
|
400
132
|
}
|
|
401
133
|
// src/composer.ts
|
|
402
|
-
import { z as
|
|
403
|
-
var AgentTuiComposerSchema =
|
|
404
|
-
draft:
|
|
405
|
-
history:
|
|
406
|
-
historyIndex:
|
|
407
|
-
preservedDraft:
|
|
134
|
+
import { z as z3 } from "zod";
|
|
135
|
+
var AgentTuiComposerSchema = z3.object({
|
|
136
|
+
draft: z3.string(),
|
|
137
|
+
history: z3.array(z3.string()),
|
|
138
|
+
historyIndex: z3.int().nonnegative().optional(),
|
|
139
|
+
preservedDraft: z3.string()
|
|
408
140
|
}).strict();
|
|
409
141
|
function createAgentTuiComposer() {
|
|
410
142
|
return { draft: "", history: [], preservedDraft: "" };
|
|
@@ -424,8 +156,8 @@ function navigateAgentTuiHistory(state, direction) {
|
|
|
424
156
|
if (state.history.length === 0)
|
|
425
157
|
return state;
|
|
426
158
|
if (direction === "older") {
|
|
427
|
-
const
|
|
428
|
-
return { ...state, historyIndex:
|
|
159
|
+
const index = state.historyIndex === undefined ? state.history.length - 1 : Math.max(0, state.historyIndex - 1);
|
|
160
|
+
return { ...state, historyIndex: index, draft: state.history[index] ?? state.draft };
|
|
429
161
|
}
|
|
430
162
|
if (state.historyIndex === undefined)
|
|
431
163
|
return state;
|
|
@@ -441,9 +173,9 @@ import { createHash } from "crypto";
|
|
|
441
173
|
import { mkdir, readFile, rename, unlink, writeFile } from "fs/promises";
|
|
442
174
|
import path from "path";
|
|
443
175
|
import { AgentModelSelectionSchema } from "stitchkit/agent-runtime";
|
|
444
|
-
import { z as
|
|
445
|
-
var SelectionFileSchema =
|
|
446
|
-
conversationId:
|
|
176
|
+
import { z as z4 } from "zod";
|
|
177
|
+
var SelectionFileSchema = z4.object({
|
|
178
|
+
conversationId: z4.string().min(1),
|
|
447
179
|
selection: AgentModelSelectionSchema
|
|
448
180
|
}).strict();
|
|
449
181
|
var defaultAgentTuiTheme = {
|
|
@@ -535,7 +267,7 @@ async function createAgentTuiController(input) {
|
|
|
535
267
|
const refresh = async () => {
|
|
536
268
|
const targetConversationId = conversationId;
|
|
537
269
|
const version = ++refreshVersion;
|
|
538
|
-
const [snapshot, approvals,
|
|
270
|
+
const [snapshot, approvals, selection] = await Promise.all([
|
|
539
271
|
input.harness.snapshot(targetConversationId),
|
|
540
272
|
input.harness.pendingApprovals(targetConversationId),
|
|
541
273
|
input.selections.load(targetConversationId)
|
|
@@ -546,7 +278,7 @@ async function createAgentTuiController(input) {
|
|
|
546
278
|
...current,
|
|
547
279
|
conversationId: targetConversationId,
|
|
548
280
|
snapshot,
|
|
549
|
-
...
|
|
281
|
+
...selection && { selectedModelId: selection.modelId },
|
|
550
282
|
...approvals[0] && { pendingApproval: approvals[0] }
|
|
551
283
|
};
|
|
552
284
|
if (!approvals[0])
|
|
@@ -706,48 +438,48 @@ async function createAgentTuiController(input) {
|
|
|
706
438
|
import { lstat, mkdir as mkdir3, readdir as readdir2, rm } from "fs/promises";
|
|
707
439
|
import path3 from "path";
|
|
708
440
|
import { createDiagnosticJournal } from "stitchkit/application/diagnostic-journal";
|
|
709
|
-
import { z as
|
|
441
|
+
import { z as z6 } from "zod";
|
|
710
442
|
|
|
711
443
|
// src/session.ts
|
|
712
444
|
import { chmod, mkdir as mkdir2, readdir, readFile as readFile2, rename as rename2, unlink as unlink2, writeFile as writeFile2 } from "fs/promises";
|
|
713
445
|
import path2 from "path";
|
|
714
|
-
import { z as
|
|
446
|
+
import { z as z5 } from "zod";
|
|
715
447
|
var MAX_REQUEST_BYTES = 65536;
|
|
716
|
-
var AgentTuiSessionDescriptorSchema =
|
|
717
|
-
schemaVersion:
|
|
718
|
-
sessionId:
|
|
719
|
-
conversationId:
|
|
720
|
-
socketPath:
|
|
721
|
-
token:
|
|
722
|
-
pid:
|
|
723
|
-
startedAt:
|
|
448
|
+
var AgentTuiSessionDescriptorSchema = z5.object({
|
|
449
|
+
schemaVersion: z5.literal(1),
|
|
450
|
+
sessionId: z5.string().min(8),
|
|
451
|
+
conversationId: z5.string().min(1),
|
|
452
|
+
socketPath: z5.string().min(1),
|
|
453
|
+
token: z5.string().min(32),
|
|
454
|
+
pid: z5.int().positive(),
|
|
455
|
+
startedAt: z5.iso.datetime({ offset: true })
|
|
724
456
|
}).strict();
|
|
725
|
-
var AgentTuiSessionRequestSchema =
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
requestId:
|
|
729
|
-
operation:
|
|
730
|
-
text:
|
|
731
|
-
idempotencyKey:
|
|
457
|
+
var AgentTuiSessionRequestSchema = z5.discriminatedUnion("operation", [
|
|
458
|
+
z5.object({ requestId: z5.string().min(1), operation: z5.literal("status") }).strict(),
|
|
459
|
+
z5.object({
|
|
460
|
+
requestId: z5.string().min(1),
|
|
461
|
+
operation: z5.literal("submit"),
|
|
462
|
+
text: z5.string().min(1),
|
|
463
|
+
idempotencyKey: z5.string().min(1)
|
|
732
464
|
}).strict(),
|
|
733
|
-
|
|
734
|
-
requestId:
|
|
735
|
-
operation:
|
|
736
|
-
runId:
|
|
465
|
+
z5.object({
|
|
466
|
+
requestId: z5.string().min(1),
|
|
467
|
+
operation: z5.literal("interrupt"),
|
|
468
|
+
runId: z5.string().min(1).optional()
|
|
737
469
|
}).strict()
|
|
738
470
|
]);
|
|
739
|
-
var AgentTuiSessionResponseSchema =
|
|
740
|
-
|
|
741
|
-
requestId:
|
|
742
|
-
outcome:
|
|
743
|
-
sessionId:
|
|
744
|
-
conversationId:
|
|
745
|
-
runId:
|
|
471
|
+
var AgentTuiSessionResponseSchema = z5.discriminatedUnion("outcome", [
|
|
472
|
+
z5.object({
|
|
473
|
+
requestId: z5.string().min(1),
|
|
474
|
+
outcome: z5.literal("ok"),
|
|
475
|
+
sessionId: z5.string().min(1),
|
|
476
|
+
conversationId: z5.string().min(1),
|
|
477
|
+
runId: z5.string().min(1).optional()
|
|
746
478
|
}).strict(),
|
|
747
|
-
|
|
748
|
-
requestId:
|
|
749
|
-
outcome:
|
|
750
|
-
error:
|
|
479
|
+
z5.object({
|
|
480
|
+
requestId: z5.string().min(1),
|
|
481
|
+
outcome: z5.literal("error"),
|
|
482
|
+
error: z5.object({ code: z5.string().min(1), message: z5.string().min(1) }).strict()
|
|
751
483
|
}).strict()
|
|
752
484
|
]);
|
|
753
485
|
function createAgentTuiSessionId() {
|
|
@@ -853,9 +585,9 @@ async function listAgentTuiSessions(rootDirectory) {
|
|
|
853
585
|
return descriptors;
|
|
854
586
|
}
|
|
855
587
|
async function startAgentTuiSessionHost(input) {
|
|
856
|
-
for (const
|
|
857
|
-
if (!processAlive(
|
|
858
|
-
await removeDescriptor(input.rootDirectory,
|
|
588
|
+
for (const descriptor of await listAgentTuiSessions(input.rootDirectory)) {
|
|
589
|
+
if (!processAlive(descriptor.pid))
|
|
590
|
+
await removeDescriptor(input.rootDirectory, descriptor);
|
|
859
591
|
}
|
|
860
592
|
const sessionId = input.sessionId ?? createAgentTuiSessionId();
|
|
861
593
|
const socketPath = path2.join(sessionsDirectory(input.rootDirectory), `${sessionId}.sock`);
|
|
@@ -962,47 +694,47 @@ var RUNTIME_EVENT_TYPES = new Set([
|
|
|
962
694
|
"step-finished"
|
|
963
695
|
]);
|
|
964
696
|
var MAX_SESSION_JOURNALS = 8;
|
|
965
|
-
var BaseEventSchema =
|
|
966
|
-
schemaVersion:
|
|
967
|
-
occurredAt:
|
|
697
|
+
var BaseEventSchema = z6.object({
|
|
698
|
+
schemaVersion: z6.literal(1),
|
|
699
|
+
occurredAt: z6.iso.datetime({ offset: true })
|
|
968
700
|
});
|
|
969
|
-
var AgentTuiDiagnosticEventSchema =
|
|
701
|
+
var AgentTuiDiagnosticEventSchema = z6.discriminatedUnion("type", [
|
|
970
702
|
BaseEventSchema.extend({
|
|
971
|
-
type:
|
|
972
|
-
sessionId:
|
|
973
|
-
conversationId:
|
|
974
|
-
launchMode:
|
|
703
|
+
type: z6.literal("host-started"),
|
|
704
|
+
sessionId: z6.string().min(8),
|
|
705
|
+
conversationId: z6.string().min(1),
|
|
706
|
+
launchMode: z6.enum(["fresh", "explicit"])
|
|
975
707
|
}).strict(),
|
|
976
708
|
BaseEventSchema.extend({
|
|
977
|
-
type:
|
|
978
|
-
sessionId:
|
|
979
|
-
previousConversationId:
|
|
980
|
-
conversationId:
|
|
981
|
-
reason:
|
|
709
|
+
type: z6.literal("conversation-changed"),
|
|
710
|
+
sessionId: z6.string().min(8),
|
|
711
|
+
previousConversationId: z6.string().min(1),
|
|
712
|
+
conversationId: z6.string().min(1),
|
|
713
|
+
reason: z6.enum(["new", "clear", "resume"])
|
|
982
714
|
}).strict(),
|
|
983
715
|
BaseEventSchema.extend({
|
|
984
|
-
type:
|
|
985
|
-
sessionId:
|
|
986
|
-
conversationId:
|
|
987
|
-
runId:
|
|
988
|
-
source:
|
|
716
|
+
type: z6.literal("submission-admitted"),
|
|
717
|
+
sessionId: z6.string().min(8),
|
|
718
|
+
conversationId: z6.string().min(1),
|
|
719
|
+
runId: z6.string().min(1),
|
|
720
|
+
source: z6.enum(["terminal", "client"])
|
|
989
721
|
}).strict(),
|
|
990
722
|
BaseEventSchema.extend({
|
|
991
|
-
type:
|
|
992
|
-
conversationId:
|
|
993
|
-
runId:
|
|
994
|
-
eventType:
|
|
995
|
-
state:
|
|
723
|
+
type: z6.literal("runtime-event"),
|
|
724
|
+
conversationId: z6.string().min(1).optional(),
|
|
725
|
+
runId: z6.string().min(1).optional(),
|
|
726
|
+
eventType: z6.string().min(1),
|
|
727
|
+
state: z6.string().min(1).optional()
|
|
996
728
|
}).strict(),
|
|
997
729
|
BaseEventSchema.extend({
|
|
998
|
-
type:
|
|
999
|
-
sessionId:
|
|
1000
|
-
operation:
|
|
730
|
+
type: z6.literal("request-failed"),
|
|
731
|
+
sessionId: z6.string().min(8),
|
|
732
|
+
operation: z6.enum(["status", "submit", "interrupt"])
|
|
1001
733
|
}).strict(),
|
|
1002
734
|
BaseEventSchema.extend({
|
|
1003
|
-
type:
|
|
1004
|
-
sessionId:
|
|
1005
|
-
conversationId:
|
|
735
|
+
type: z6.literal("host-closed"),
|
|
736
|
+
sessionId: z6.string().min(8),
|
|
737
|
+
conversationId: z6.string().min(1)
|
|
1006
738
|
}).strict()
|
|
1007
739
|
]);
|
|
1008
740
|
function stringField(value, name) {
|
|
@@ -1074,117 +806,388 @@ async function createAgentTuiDiagnosticRecorder(input) {
|
|
|
1074
806
|
maxFiles: 2
|
|
1075
807
|
}
|
|
1076
808
|
});
|
|
1077
|
-
return {
|
|
1078
|
-
write(value) {
|
|
1079
|
-
const event = projectAgentTuiRuntimeDiagnostic(value);
|
|
1080
|
-
if (event)
|
|
1081
|
-
journal.submit(event);
|
|
1082
|
-
},
|
|
1083
|
-
record(event) {
|
|
1084
|
-
journal.submit(event);
|
|
1085
|
-
},
|
|
1086
|
-
async close() {
|
|
1087
|
-
await journal.close({ timeoutMs: 2000 });
|
|
1088
|
-
}
|
|
1089
|
-
};
|
|
809
|
+
return {
|
|
810
|
+
write(value) {
|
|
811
|
+
const event = projectAgentTuiRuntimeDiagnostic(value);
|
|
812
|
+
if (event)
|
|
813
|
+
journal.submit(event);
|
|
814
|
+
},
|
|
815
|
+
record(event) {
|
|
816
|
+
journal.submit(event);
|
|
817
|
+
},
|
|
818
|
+
async close() {
|
|
819
|
+
await journal.close({ timeoutMs: 2000 });
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
// src/keyboard.ts
|
|
824
|
+
function isAgentTuiExitKey(key) {
|
|
825
|
+
return key.ctrl === true && key.name?.toLowerCase() === "c";
|
|
826
|
+
}
|
|
827
|
+
// src/model-picker.ts
|
|
828
|
+
import { searchAgentModelCatalog } from "stitchkit/agent-runtime";
|
|
829
|
+
var AGENT_TUI_MODEL_RESULT_LIMIT = 200;
|
|
830
|
+
function searchAgentTuiModels(catalog, query) {
|
|
831
|
+
return searchAgentModelCatalog(catalog, {
|
|
832
|
+
query,
|
|
833
|
+
limit: AGENT_TUI_MODEL_RESULT_LIMIT
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
// src/run.tsx
|
|
837
|
+
import path5 from "path";
|
|
838
|
+
import { createCliRenderer } from "@opentui/core";
|
|
839
|
+
import { createRoot } from "@opentui/react";
|
|
840
|
+
|
|
841
|
+
// src/App.tsx
|
|
842
|
+
import { useKeyboard, useTerminalDimensions } from "@opentui/react";
|
|
843
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
844
|
+
|
|
845
|
+
// src/builtins.ts
|
|
846
|
+
var dialog = (name, query) => ({
|
|
847
|
+
type: "dialog",
|
|
848
|
+
dialog: name,
|
|
849
|
+
...query && { query }
|
|
850
|
+
});
|
|
851
|
+
var action = (name) => ({ type: "action", action: name });
|
|
852
|
+
function createAgentTuiBuiltinCommands() {
|
|
853
|
+
return [
|
|
854
|
+
defineTuiCommand({
|
|
855
|
+
name: "help",
|
|
856
|
+
aliases: ["?"],
|
|
857
|
+
description: "Show available terminal commands",
|
|
858
|
+
execute: () => dialog("help")
|
|
859
|
+
}),
|
|
860
|
+
defineTuiCommand({
|
|
861
|
+
name: "model",
|
|
862
|
+
description: "Choose the model for the next run",
|
|
863
|
+
execute: (query) => dialog("model", query.trim())
|
|
864
|
+
}),
|
|
865
|
+
defineTuiCommand({
|
|
866
|
+
name: "new",
|
|
867
|
+
description: "Start a new durable conversation",
|
|
868
|
+
execute: () => action("new-conversation")
|
|
869
|
+
}),
|
|
870
|
+
defineTuiCommand({
|
|
871
|
+
name: "sessions",
|
|
872
|
+
description: "Browse durable conversations",
|
|
873
|
+
execute: () => dialog("sessions")
|
|
874
|
+
}),
|
|
875
|
+
defineTuiCommand({
|
|
876
|
+
name: "resume",
|
|
877
|
+
description: "Resume a durable conversation",
|
|
878
|
+
execute: () => dialog("sessions")
|
|
879
|
+
}),
|
|
880
|
+
defineTuiCommand({
|
|
881
|
+
name: "status",
|
|
882
|
+
description: "Show session, conversation and run status",
|
|
883
|
+
execute: () => dialog("status")
|
|
884
|
+
}),
|
|
885
|
+
defineTuiCommand({
|
|
886
|
+
name: "tools",
|
|
887
|
+
description: "Show the direct tool surface",
|
|
888
|
+
execute: () => dialog("tools")
|
|
889
|
+
}),
|
|
890
|
+
defineTuiCommand({
|
|
891
|
+
name: "skills",
|
|
892
|
+
description: "Show lazily available skills and resources",
|
|
893
|
+
execute: () => dialog("skills")
|
|
894
|
+
}),
|
|
895
|
+
defineTuiCommand({
|
|
896
|
+
name: "permissions",
|
|
897
|
+
description: "Show approval and sandbox enforcement",
|
|
898
|
+
execute: () => dialog("permissions")
|
|
899
|
+
}),
|
|
900
|
+
defineTuiCommand({
|
|
901
|
+
name: "interrupt",
|
|
902
|
+
description: "Interrupt the active run",
|
|
903
|
+
available: ({ activeRunId }) => activeRunId !== undefined,
|
|
904
|
+
execute: () => action("interrupt")
|
|
905
|
+
}),
|
|
906
|
+
defineTuiCommand({
|
|
907
|
+
name: "clear",
|
|
908
|
+
description: "Start clean while keeping this conversation available to resume",
|
|
909
|
+
execute: () => action("clear-conversation")
|
|
910
|
+
}),
|
|
911
|
+
defineTuiCommand({
|
|
912
|
+
name: "quit",
|
|
913
|
+
aliases: ["exit"],
|
|
914
|
+
description: "Close this terminal host",
|
|
915
|
+
execute: () => action("quit")
|
|
916
|
+
})
|
|
917
|
+
];
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
// src/core/collection.ts
|
|
921
|
+
import { z as z7 } from "zod";
|
|
922
|
+
var TerminalCollectionStateSchema = z7.object({
|
|
923
|
+
keys: z7.array(z7.string().min(1)),
|
|
924
|
+
selectedKey: z7.string().min(1).nullable(),
|
|
925
|
+
start: z7.int().nonnegative(),
|
|
926
|
+
capacity: z7.int().positive()
|
|
927
|
+
}).strict();
|
|
928
|
+
function maximumStart(total, capacity) {
|
|
929
|
+
return Math.max(0, total - capacity);
|
|
930
|
+
}
|
|
931
|
+
function reveal(start, capacity, index, total) {
|
|
932
|
+
const bounded = Math.min(Math.max(0, start), maximumStart(total, capacity));
|
|
933
|
+
if (index < bounded)
|
|
934
|
+
return index;
|
|
935
|
+
if (index >= bounded + capacity)
|
|
936
|
+
return index - capacity + 1;
|
|
937
|
+
return bounded;
|
|
938
|
+
}
|
|
939
|
+
function uniqueKeys(keys) {
|
|
940
|
+
const result = z7.array(z7.string().min(1)).parse(keys);
|
|
941
|
+
if (new Set(result).size !== result.length) {
|
|
942
|
+
throw new Error("Terminal collection keys must be unique");
|
|
943
|
+
}
|
|
944
|
+
return result;
|
|
945
|
+
}
|
|
946
|
+
function createTerminalCollection(keys, capacity, selectedKey) {
|
|
947
|
+
const parsedKeys = uniqueKeys(keys);
|
|
948
|
+
const parsedCapacity = z7.int().positive().parse(capacity);
|
|
949
|
+
const selected = selectedKey !== undefined && parsedKeys.includes(selectedKey) ? selectedKey : parsedKeys[0] ?? null;
|
|
950
|
+
const index = selected === null ? -1 : parsedKeys.indexOf(selected);
|
|
951
|
+
return TerminalCollectionStateSchema.parse({
|
|
952
|
+
keys: parsedKeys,
|
|
953
|
+
selectedKey: selected,
|
|
954
|
+
start: index < 0 ? 0 : reveal(0, parsedCapacity, index, parsedKeys.length),
|
|
955
|
+
capacity: parsedCapacity
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
function reduceTerminalCollection(state, action) {
|
|
959
|
+
const current = TerminalCollectionStateSchema.parse(state);
|
|
960
|
+
if (action.type === "reconcile") {
|
|
961
|
+
const keys = uniqueKeys(action.keys);
|
|
962
|
+
if (keys.length === 0)
|
|
963
|
+
return { keys, selectedKey: null, start: 0, capacity: current.capacity };
|
|
964
|
+
const previousIndex = current.selectedKey === null ? 0 : Math.max(0, current.keys.indexOf(current.selectedKey));
|
|
965
|
+
const selectedKey = current.selectedKey !== null && keys.includes(current.selectedKey) ? current.selectedKey : keys[Math.min(previousIndex, keys.length - 1)];
|
|
966
|
+
if (!selectedKey)
|
|
967
|
+
throw new Error("Terminal collection survivor is unavailable");
|
|
968
|
+
const index = keys.indexOf(selectedKey);
|
|
969
|
+
return TerminalCollectionStateSchema.parse({
|
|
970
|
+
...current,
|
|
971
|
+
keys,
|
|
972
|
+
selectedKey,
|
|
973
|
+
start: reveal(current.start, current.capacity, index, keys.length)
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
if (action.type === "resize") {
|
|
977
|
+
const capacity = z7.int().positive().parse(action.capacity);
|
|
978
|
+
const index = current.selectedKey === null ? -1 : current.keys.indexOf(current.selectedKey);
|
|
979
|
+
return TerminalCollectionStateSchema.parse({
|
|
980
|
+
...current,
|
|
981
|
+
capacity,
|
|
982
|
+
start: index < 0 ? 0 : reveal(current.start, capacity, index, current.keys.length)
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
if (action.type === "scroll") {
|
|
986
|
+
return TerminalCollectionStateSchema.parse({
|
|
987
|
+
...current,
|
|
988
|
+
start: Math.min(Math.max(0, current.start + action.lines), maximumStart(current.keys.length, current.capacity))
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
if (current.keys.length === 0)
|
|
992
|
+
return current;
|
|
993
|
+
const currentIndex = current.selectedKey === null ? 0 : Math.max(0, current.keys.indexOf(current.selectedKey));
|
|
994
|
+
const nextIndex = action.type === "select" ? current.keys.indexOf(action.key) : action.wrap ? ((currentIndex + action.delta) % current.keys.length + current.keys.length) % current.keys.length : Math.min(Math.max(0, currentIndex + action.delta), current.keys.length - 1);
|
|
995
|
+
if (nextIndex < 0) {
|
|
996
|
+
throw new Error(action.type === "select" ? `Unknown terminal collection key: ${action.key}` : "Terminal collection movement could not resolve a selection");
|
|
997
|
+
}
|
|
998
|
+
const selectedKey = current.keys[nextIndex];
|
|
999
|
+
if (!selectedKey)
|
|
1000
|
+
throw new Error("Terminal collection selection is unavailable");
|
|
1001
|
+
return TerminalCollectionStateSchema.parse({
|
|
1002
|
+
...current,
|
|
1003
|
+
selectedKey,
|
|
1004
|
+
start: reveal(current.start, current.capacity, nextIndex, current.keys.length)
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
function visibleTerminalCollectionRange(state) {
|
|
1008
|
+
const parsed = TerminalCollectionStateSchema.parse(state);
|
|
1009
|
+
return {
|
|
1010
|
+
start: parsed.start,
|
|
1011
|
+
end: Math.min(parsed.keys.length, parsed.start + parsed.capacity)
|
|
1012
|
+
};
|
|
1013
|
+
}
|
|
1014
|
+
// src/core/operation.ts
|
|
1015
|
+
import { z as z8 } from "zod";
|
|
1016
|
+
var TerminalOperationStateSchema = z8.object({
|
|
1017
|
+
status: z8.enum(["idle", "confirming", "pending", "succeeded", "failed"]),
|
|
1018
|
+
operationId: z8.string().min(1).nullable(),
|
|
1019
|
+
message: z8.string().optional()
|
|
1020
|
+
}).strict();
|
|
1021
|
+
function createTerminalOperationState() {
|
|
1022
|
+
return { status: "idle", operationId: null };
|
|
1023
|
+
}
|
|
1024
|
+
function reduceTerminalOperationState(state, action) {
|
|
1025
|
+
const current = TerminalOperationStateSchema.parse(state);
|
|
1026
|
+
if (action.type === "request") {
|
|
1027
|
+
if (current.status === "pending")
|
|
1028
|
+
throw new Error("A terminal operation is already pending");
|
|
1029
|
+
return TerminalOperationStateSchema.parse({
|
|
1030
|
+
status: "confirming",
|
|
1031
|
+
operationId: action.operationId,
|
|
1032
|
+
...action.message !== undefined && { message: action.message }
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
if (action.type === "reset" || action.type === "cancel") {
|
|
1036
|
+
if (action.type === "cancel" && current.status !== "confirming") {
|
|
1037
|
+
throw new Error("Only a confirming terminal operation can be cancelled");
|
|
1038
|
+
}
|
|
1039
|
+
return createTerminalOperationState();
|
|
1040
|
+
}
|
|
1041
|
+
if (action.type === "confirm") {
|
|
1042
|
+
if (current.status !== "confirming") {
|
|
1043
|
+
throw new Error("Only a confirming terminal operation can become pending");
|
|
1044
|
+
}
|
|
1045
|
+
return { ...current, status: "pending" };
|
|
1046
|
+
}
|
|
1047
|
+
if (current.status !== "pending") {
|
|
1048
|
+
throw new Error("Only a pending terminal operation can settle");
|
|
1049
|
+
}
|
|
1050
|
+
return TerminalOperationStateSchema.parse({
|
|
1051
|
+
status: action.type === "succeed" ? "succeeded" : "failed",
|
|
1052
|
+
operationId: current.operationId,
|
|
1053
|
+
...action.message !== undefined && { message: action.message }
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
// src/core/panes.ts
|
|
1057
|
+
import { z as z9 } from "zod";
|
|
1058
|
+
var TerminalPaneIdSchema = z9.enum(["primary", "secondary"]);
|
|
1059
|
+
var TerminalPaneModeSchema = z9.enum(["split", "single"]);
|
|
1060
|
+
var TerminalPaneStateSchema = z9.object({
|
|
1061
|
+
mode: TerminalPaneModeSchema,
|
|
1062
|
+
focus: TerminalPaneIdSchema,
|
|
1063
|
+
primarySize: z9.int().positive(),
|
|
1064
|
+
totalSize: z9.int().positive(),
|
|
1065
|
+
minPrimary: z9.int().positive(),
|
|
1066
|
+
minSecondary: z9.int().positive()
|
|
1067
|
+
}).strict();
|
|
1068
|
+
function clampPrimary(input) {
|
|
1069
|
+
const maximum = Math.max(input.minPrimary, input.totalSize - input.minSecondary);
|
|
1070
|
+
return Math.min(Math.max(input.minPrimary, input.primarySize), maximum);
|
|
1071
|
+
}
|
|
1072
|
+
function createTerminalPaneState(input) {
|
|
1073
|
+
const values = z9.object({
|
|
1074
|
+
totalSize: z9.int().positive(),
|
|
1075
|
+
primarySize: z9.int().positive(),
|
|
1076
|
+
minPrimary: z9.int().positive(),
|
|
1077
|
+
minSecondary: z9.int().positive(),
|
|
1078
|
+
mode: TerminalPaneModeSchema.default("split"),
|
|
1079
|
+
focus: TerminalPaneIdSchema.default("primary")
|
|
1080
|
+
}).strict().parse(input);
|
|
1081
|
+
if (values.mode === "split" && values.totalSize < values.minPrimary + values.minSecondary) {
|
|
1082
|
+
throw new Error("Split terminal panes do not fit within the total size");
|
|
1083
|
+
}
|
|
1084
|
+
return TerminalPaneStateSchema.parse({
|
|
1085
|
+
...values,
|
|
1086
|
+
primarySize: clampPrimary(values)
|
|
1087
|
+
});
|
|
1088
|
+
}
|
|
1089
|
+
function reduceTerminalPaneState(state, action) {
|
|
1090
|
+
const current = TerminalPaneStateSchema.parse(state);
|
|
1091
|
+
if (action.type === "focus")
|
|
1092
|
+
return { ...current, focus: action.pane };
|
|
1093
|
+
if (action.type === "toggle-focus") {
|
|
1094
|
+
return { ...current, focus: current.focus === "primary" ? "secondary" : "primary" };
|
|
1095
|
+
}
|
|
1096
|
+
if (action.type === "mode") {
|
|
1097
|
+
if (action.mode === "split" && current.totalSize < current.minPrimary + current.minSecondary) {
|
|
1098
|
+
throw new Error("Split terminal panes do not fit within the total size");
|
|
1099
|
+
}
|
|
1100
|
+
return { ...current, mode: action.mode };
|
|
1101
|
+
}
|
|
1102
|
+
const totalSize = action.type === "terminal-resize" ? action.totalSize : current.totalSize;
|
|
1103
|
+
const mode = current.mode === "split" && totalSize < current.minPrimary + current.minSecondary ? "single" : current.mode;
|
|
1104
|
+
const primarySize = action.type === "resize" ? action.primarySize : current.primarySize;
|
|
1105
|
+
return TerminalPaneStateSchema.parse({
|
|
1106
|
+
...current,
|
|
1107
|
+
totalSize,
|
|
1108
|
+
mode,
|
|
1109
|
+
primarySize: clampPrimary({
|
|
1110
|
+
primarySize,
|
|
1111
|
+
totalSize,
|
|
1112
|
+
minPrimary: current.minPrimary,
|
|
1113
|
+
minSecondary: current.minSecondary
|
|
1114
|
+
})
|
|
1115
|
+
});
|
|
1090
1116
|
}
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
return
|
|
1117
|
+
function visibleTerminalPanes(state) {
|
|
1118
|
+
const parsed = TerminalPaneStateSchema.parse(state);
|
|
1119
|
+
return parsed.mode === "split" ? ["primary", "secondary"] : [parsed.focus];
|
|
1094
1120
|
}
|
|
1095
|
-
// src/
|
|
1096
|
-
import {
|
|
1097
|
-
var
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1121
|
+
// src/core/viewport.ts
|
|
1122
|
+
import { z as z10 } from "zod";
|
|
1123
|
+
var TerminalFeedViewportSchema = z10.object({
|
|
1124
|
+
total: z10.int().nonnegative(),
|
|
1125
|
+
capacity: z10.int().positive(),
|
|
1126
|
+
start: z10.int().nonnegative(),
|
|
1127
|
+
followTail: z10.boolean(),
|
|
1128
|
+
unseen: z10.int().nonnegative()
|
|
1129
|
+
}).strict();
|
|
1130
|
+
function maximumStart2(total, capacity) {
|
|
1131
|
+
return Math.max(0, total - capacity);
|
|
1132
|
+
}
|
|
1133
|
+
function createTerminalFeedViewport(total, capacity) {
|
|
1134
|
+
const parsedTotal = z10.int().nonnegative().parse(total);
|
|
1135
|
+
const parsedCapacity = z10.int().positive().parse(capacity);
|
|
1136
|
+
return TerminalFeedViewportSchema.parse({
|
|
1137
|
+
total: parsedTotal,
|
|
1138
|
+
capacity: parsedCapacity,
|
|
1139
|
+
start: maximumStart2(parsedTotal, parsedCapacity),
|
|
1140
|
+
followTail: true,
|
|
1141
|
+
unseen: 0
|
|
1102
1142
|
});
|
|
1103
1143
|
}
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
description: "Show session, conversation and run status",
|
|
1151
|
-
execute: () => dialog("status")
|
|
1152
|
-
}),
|
|
1153
|
-
defineTuiCommand({
|
|
1154
|
-
name: "tools",
|
|
1155
|
-
description: "Show the direct tool surface",
|
|
1156
|
-
execute: () => dialog("tools")
|
|
1157
|
-
}),
|
|
1158
|
-
defineTuiCommand({
|
|
1159
|
-
name: "skills",
|
|
1160
|
-
description: "Show lazily available skills and resources",
|
|
1161
|
-
execute: () => dialog("skills")
|
|
1162
|
-
}),
|
|
1163
|
-
defineTuiCommand({
|
|
1164
|
-
name: "permissions",
|
|
1165
|
-
description: "Show approval and sandbox enforcement",
|
|
1166
|
-
execute: () => dialog("permissions")
|
|
1167
|
-
}),
|
|
1168
|
-
defineTuiCommand({
|
|
1169
|
-
name: "interrupt",
|
|
1170
|
-
description: "Interrupt the active run",
|
|
1171
|
-
available: ({ activeRunId }) => activeRunId !== undefined,
|
|
1172
|
-
execute: () => action("interrupt")
|
|
1173
|
-
}),
|
|
1174
|
-
defineTuiCommand({
|
|
1175
|
-
name: "clear",
|
|
1176
|
-
description: "Start clean while keeping this conversation available to resume",
|
|
1177
|
-
execute: () => action("clear-conversation")
|
|
1178
|
-
}),
|
|
1179
|
-
defineTuiCommand({
|
|
1180
|
-
name: "quit",
|
|
1181
|
-
aliases: ["exit"],
|
|
1182
|
-
description: "Close this terminal host",
|
|
1183
|
-
execute: () => action("quit")
|
|
1184
|
-
})
|
|
1185
|
-
];
|
|
1144
|
+
function reduceTerminalFeedViewport(state, action) {
|
|
1145
|
+
const current = TerminalFeedViewportSchema.parse(state);
|
|
1146
|
+
if (action.type === "append") {
|
|
1147
|
+
const count = Math.max(0, action.count);
|
|
1148
|
+
const total = current.total + count;
|
|
1149
|
+
return TerminalFeedViewportSchema.parse({
|
|
1150
|
+
...current,
|
|
1151
|
+
total,
|
|
1152
|
+
start: current.followTail ? maximumStart2(total, current.capacity) : current.start,
|
|
1153
|
+
unseen: current.followTail ? 0 : current.unseen + count
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
if (action.type === "prepend") {
|
|
1157
|
+
const count = Math.max(0, action.count);
|
|
1158
|
+
return TerminalFeedViewportSchema.parse({
|
|
1159
|
+
...current,
|
|
1160
|
+
total: current.total + count,
|
|
1161
|
+
start: current.start + count
|
|
1162
|
+
});
|
|
1163
|
+
}
|
|
1164
|
+
if (action.type === "resize") {
|
|
1165
|
+
const capacity = z10.int().positive().parse(action.capacity);
|
|
1166
|
+
return TerminalFeedViewportSchema.parse({
|
|
1167
|
+
...current,
|
|
1168
|
+
capacity,
|
|
1169
|
+
start: current.followTail ? maximumStart2(current.total, capacity) : Math.min(current.start, maximumStart2(current.total, capacity))
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
if (action.type === "home")
|
|
1173
|
+
return { ...current, start: 0, followTail: false };
|
|
1174
|
+
if (action.type === "end") {
|
|
1175
|
+
return {
|
|
1176
|
+
...current,
|
|
1177
|
+
start: maximumStart2(current.total, current.capacity),
|
|
1178
|
+
followTail: true,
|
|
1179
|
+
unseen: 0
|
|
1180
|
+
};
|
|
1181
|
+
}
|
|
1182
|
+
const delta = action.type === "page" ? action.pages * current.capacity : action.lines;
|
|
1183
|
+
const start = Math.max(0, Math.min(maximumStart2(current.total, current.capacity), current.start + delta));
|
|
1184
|
+
const atTail = start === maximumStart2(current.total, current.capacity) && delta > 0;
|
|
1185
|
+
return { ...current, start, followTail: atTail, unseen: atTail ? 0 : current.unseen };
|
|
1186
|
+
}
|
|
1187
|
+
function visibleTerminalFeedRange(state) {
|
|
1188
|
+
const parsed = TerminalFeedViewportSchema.parse(state);
|
|
1189
|
+
return { start: parsed.start, end: Math.min(parsed.total, parsed.start + parsed.capacity) };
|
|
1186
1190
|
}
|
|
1187
|
-
|
|
1188
1191
|
// src/status-line.ts
|
|
1189
1192
|
import path4 from "path";
|
|
1190
1193
|
function formatCount(value) {
|
|
@@ -1313,7 +1316,7 @@ function projectAgentTuiTranscript(snapshot) {
|
|
|
1313
1316
|
}
|
|
1314
1317
|
|
|
1315
1318
|
// src/App.tsx
|
|
1316
|
-
import {
|
|
1319
|
+
import { jsx, jsxs } from "@opentui/react/jsx-runtime";
|
|
1317
1320
|
function isDialog(value) {
|
|
1318
1321
|
return ["help", "model", "sessions", "status", "tools", "skills", "permissions"].includes(value);
|
|
1319
1322
|
}
|
|
@@ -1323,12 +1326,12 @@ function isString(value) {
|
|
|
1323
1326
|
function errorMessage(error) {
|
|
1324
1327
|
return error instanceof Error ? error.message : String(error);
|
|
1325
1328
|
}
|
|
1326
|
-
function roleLabel(
|
|
1327
|
-
if (
|
|
1329
|
+
function roleLabel(role) {
|
|
1330
|
+
if (role === "you")
|
|
1328
1331
|
return "YOU";
|
|
1329
|
-
if (
|
|
1332
|
+
if (role === "agent")
|
|
1330
1333
|
return "AGENT";
|
|
1331
|
-
if (
|
|
1334
|
+
if (role === "tool")
|
|
1332
1335
|
return "TOOL";
|
|
1333
1336
|
return "SYSTEM";
|
|
1334
1337
|
}
|
|
@@ -1367,7 +1370,7 @@ function AgentTuiApp({
|
|
|
1367
1370
|
}) {
|
|
1368
1371
|
const dimensions = useTerminalDimensions();
|
|
1369
1372
|
const [state, setState] = useState(controller.state());
|
|
1370
|
-
const [
|
|
1373
|
+
const [dialog, setDialog] = useState();
|
|
1371
1374
|
const [modelQuery, setModelQuery] = useState("");
|
|
1372
1375
|
const [modelSearchFocused, setModelSearchFocused] = useState(true);
|
|
1373
1376
|
const [composer, setComposer] = useState(createAgentTuiComposer);
|
|
@@ -1378,7 +1381,7 @@ function AgentTuiApp({
|
|
|
1378
1381
|
const [hiddenBefore, setHiddenBefore] = useState(0);
|
|
1379
1382
|
const [sessions, setSessions] = useState([]);
|
|
1380
1383
|
const [sessionCursor, setSessionCursor] = useState();
|
|
1381
|
-
const [
|
|
1384
|
+
const [viewport, setViewport] = useState(() => createTerminalFeedViewport(0, 1));
|
|
1382
1385
|
const previousTranscriptSize = useRef(0);
|
|
1383
1386
|
const previousConversationId = useRef(state.conversationId);
|
|
1384
1387
|
const composerRef = useRef(null);
|
|
@@ -1434,13 +1437,13 @@ function AgentTuiApp({
|
|
|
1434
1437
|
});
|
|
1435
1438
|
}, [dimensions.height, state.conversationId, transcriptUnits]);
|
|
1436
1439
|
useEffect(() => {
|
|
1437
|
-
if (
|
|
1440
|
+
if (dialog !== "sessions" || !conversations)
|
|
1438
1441
|
return;
|
|
1439
1442
|
conversations.list({ limit: 50 }).then((page) => {
|
|
1440
1443
|
setSessions(page.items);
|
|
1441
1444
|
setSessionCursor(page.nextCursor);
|
|
1442
1445
|
}).catch((error) => setLocalNotice(errorMessage(error)));
|
|
1443
|
-
}, [conversations,
|
|
1446
|
+
}, [conversations, dialog]);
|
|
1444
1447
|
const applyOutcome = useCallback(async (outcome) => {
|
|
1445
1448
|
if (outcome.type === "dialog") {
|
|
1446
1449
|
setDialog(isDialog(outcome.dialog) ? outcome.dialog : "help");
|
|
@@ -1524,30 +1527,30 @@ function AgentTuiApp({
|
|
|
1524
1527
|
controller.respondToApproval(false, "Denied from the terminal host").catch((error) => setLocalNotice(errorMessage(error)));
|
|
1525
1528
|
return;
|
|
1526
1529
|
}
|
|
1527
|
-
if (
|
|
1530
|
+
if (dialog && key.name === "escape") {
|
|
1528
1531
|
setDialog(undefined);
|
|
1529
1532
|
return;
|
|
1530
1533
|
}
|
|
1531
|
-
if (
|
|
1534
|
+
if (dialog === "model" && key.name === "tab") {
|
|
1532
1535
|
key.preventDefault();
|
|
1533
1536
|
key.stopPropagation();
|
|
1534
1537
|
setModelSearchFocused((focused) => !focused);
|
|
1535
1538
|
return;
|
|
1536
1539
|
}
|
|
1537
|
-
if (!
|
|
1540
|
+
if (!dialog && completions.length > 0 && key.name === "escape") {
|
|
1538
1541
|
key.preventDefault();
|
|
1539
1542
|
key.stopPropagation();
|
|
1540
1543
|
setDismissedCompletionDraft(draft);
|
|
1541
1544
|
return;
|
|
1542
1545
|
}
|
|
1543
|
-
if (!
|
|
1546
|
+
if (!dialog && completions.length > 0 && (key.name === "up" || key.name === "down")) {
|
|
1544
1547
|
key.preventDefault();
|
|
1545
1548
|
key.stopPropagation();
|
|
1546
1549
|
const direction = key.name === "up" ? -1 : 1;
|
|
1547
1550
|
setCompletionIndex((current) => moveCommandCompletionSelection(current, direction === -1 ? "previous" : "next", completions.length));
|
|
1548
1551
|
return;
|
|
1549
1552
|
}
|
|
1550
|
-
if (!
|
|
1553
|
+
if (!dialog && key.name === "tab" && completions[0]) {
|
|
1551
1554
|
key.preventDefault();
|
|
1552
1555
|
key.stopPropagation();
|
|
1553
1556
|
const selected = completions[completionIndex] ?? completions[0];
|
|
@@ -1558,28 +1561,28 @@ function AgentTuiApp({
|
|
|
1558
1561
|
setDismissedCompletionDraft(undefined);
|
|
1559
1562
|
return;
|
|
1560
1563
|
}
|
|
1561
|
-
if (!
|
|
1564
|
+
if (!dialog && key.name === "pageup") {
|
|
1562
1565
|
transcriptRef.current?.scrollBy(-0.8, "viewport");
|
|
1563
1566
|
setViewport((current) => reduceTerminalFeedViewport(current, { type: "page", pages: -1 }));
|
|
1564
1567
|
}
|
|
1565
|
-
if (!
|
|
1568
|
+
if (!dialog && key.name === "pagedown") {
|
|
1566
1569
|
transcriptRef.current?.scrollBy(0.8, "viewport");
|
|
1567
1570
|
setViewport((current) => reduceTerminalFeedViewport(current, { type: "page", pages: 1 }));
|
|
1568
1571
|
}
|
|
1569
|
-
if (!
|
|
1572
|
+
if (!dialog && key.option && (key.name === "up" || key.name === "down")) {
|
|
1570
1573
|
const lines = key.name === "up" ? -1 : 1;
|
|
1571
1574
|
transcriptRef.current?.scrollBy(lines, "step");
|
|
1572
1575
|
setViewport((current) => reduceTerminalFeedViewport(current, { type: "scroll", lines }));
|
|
1573
1576
|
}
|
|
1574
|
-
if (!
|
|
1577
|
+
if (!dialog && key.name === "home" && key.ctrl) {
|
|
1575
1578
|
transcriptRef.current?.scrollTo(0);
|
|
1576
1579
|
setViewport((current) => reduceTerminalFeedViewport(current, { type: "home" }));
|
|
1577
1580
|
}
|
|
1578
|
-
if (!
|
|
1581
|
+
if (!dialog && key.name === "end" && key.ctrl) {
|
|
1579
1582
|
transcriptRef.current?.scrollTo(Number.MAX_SAFE_INTEGER);
|
|
1580
1583
|
setViewport((current) => reduceTerminalFeedViewport(current, { type: "end" }));
|
|
1581
1584
|
}
|
|
1582
|
-
if (!
|
|
1585
|
+
if (!dialog && key.ctrl && (key.name === "up" || key.name === "down")) {
|
|
1583
1586
|
const next = navigateAgentTuiHistory(composer, key.name === "up" ? "older" : "newer");
|
|
1584
1587
|
composerRef.current?.setText(next.draft);
|
|
1585
1588
|
setComposer(next);
|
|
@@ -1595,14 +1598,14 @@ function AgentTuiApp({
|
|
|
1595
1598
|
};
|
|
1596
1599
|
});
|
|
1597
1600
|
const selectedModelIndex = Math.max(0, visibleModels.models.findIndex(({ id }) => id === state.selectedModelId));
|
|
1598
|
-
return /* @__PURE__ */
|
|
1601
|
+
return /* @__PURE__ */ jsxs("box", {
|
|
1599
1602
|
style: {
|
|
1600
1603
|
width: "100%",
|
|
1601
1604
|
height: "100%",
|
|
1602
1605
|
flexDirection: "column"
|
|
1603
1606
|
},
|
|
1604
1607
|
children: [
|
|
1605
|
-
/* @__PURE__ */
|
|
1608
|
+
/* @__PURE__ */ jsxs("box", {
|
|
1606
1609
|
style: {
|
|
1607
1610
|
height: 1,
|
|
1608
1611
|
paddingLeft: compact ? 1 : 2,
|
|
@@ -1611,28 +1614,28 @@ function AgentTuiApp({
|
|
|
1611
1614
|
flexDirection: "row"
|
|
1612
1615
|
},
|
|
1613
1616
|
children: [
|
|
1614
|
-
/* @__PURE__ */
|
|
1617
|
+
/* @__PURE__ */ jsx("text", {
|
|
1615
1618
|
fg: theme.accent,
|
|
1616
|
-
children: /* @__PURE__ */
|
|
1619
|
+
children: /* @__PURE__ */ jsxs("strong", {
|
|
1617
1620
|
children: [
|
|
1618
1621
|
"\u25C6 ",
|
|
1619
1622
|
title
|
|
1620
1623
|
]
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
!compact ? /* @__PURE__ */
|
|
1624
|
+
})
|
|
1625
|
+
}),
|
|
1626
|
+
!compact ? /* @__PURE__ */ jsxs("text", {
|
|
1624
1627
|
fg: theme.muted,
|
|
1625
1628
|
children: [
|
|
1626
1629
|
" \xB7 ",
|
|
1627
1630
|
selectedModel?.name ?? state.selectedModelId
|
|
1628
1631
|
]
|
|
1629
|
-
}
|
|
1632
|
+
}) : null
|
|
1630
1633
|
]
|
|
1631
|
-
}
|
|
1632
|
-
/* @__PURE__ */
|
|
1634
|
+
}),
|
|
1635
|
+
/* @__PURE__ */ jsxs("scrollbox", {
|
|
1633
1636
|
ref: transcriptRef,
|
|
1634
|
-
focused: !
|
|
1635
|
-
stickyScroll:
|
|
1637
|
+
focused: !dialog && !state.pendingApproval,
|
|
1638
|
+
stickyScroll: viewport.followTail,
|
|
1636
1639
|
stickyStart: "bottom",
|
|
1637
1640
|
style: {
|
|
1638
1641
|
flexGrow: 1,
|
|
@@ -1643,53 +1646,53 @@ function AgentTuiApp({
|
|
|
1643
1646
|
scrollbarOptions: { visible: !compact }
|
|
1644
1647
|
},
|
|
1645
1648
|
children: [
|
|
1646
|
-
entries.length === 0 ? /* @__PURE__ */
|
|
1649
|
+
entries.length === 0 ? /* @__PURE__ */ jsxs("box", {
|
|
1647
1650
|
style: { flexDirection: "column", paddingTop: 1 },
|
|
1648
1651
|
children: [
|
|
1649
|
-
/* @__PURE__ */
|
|
1652
|
+
/* @__PURE__ */ jsx("text", {
|
|
1650
1653
|
fg: theme.primary,
|
|
1651
|
-
children: /* @__PURE__ */
|
|
1654
|
+
children: /* @__PURE__ */ jsx("strong", {
|
|
1652
1655
|
children: "What do you want to build?"
|
|
1653
|
-
}
|
|
1654
|
-
}
|
|
1655
|
-
/* @__PURE__ */
|
|
1656
|
+
})
|
|
1657
|
+
}),
|
|
1658
|
+
/* @__PURE__ */ jsx("text", {
|
|
1656
1659
|
fg: theme.muted,
|
|
1657
1660
|
children: "Type / for commands"
|
|
1658
|
-
}
|
|
1661
|
+
})
|
|
1659
1662
|
]
|
|
1660
|
-
}
|
|
1663
|
+
}) : entries.map((entry) => /* @__PURE__ */ jsxs("box", {
|
|
1661
1664
|
style: { flexDirection: "column", marginBottom: 1 },
|
|
1662
1665
|
children: [
|
|
1663
|
-
/* @__PURE__ */
|
|
1666
|
+
/* @__PURE__ */ jsx("text", {
|
|
1664
1667
|
fg: entry.role === "you" ? theme.accent : theme.muted,
|
|
1665
|
-
children: /* @__PURE__ */
|
|
1668
|
+
children: /* @__PURE__ */ jsx("strong", {
|
|
1666
1669
|
children: roleLabel(entry.role)
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
/* @__PURE__ */
|
|
1670
|
+
})
|
|
1671
|
+
}),
|
|
1672
|
+
/* @__PURE__ */ jsx("text", {
|
|
1670
1673
|
fg: toneColor(entry.tone, theme),
|
|
1671
1674
|
children: entry.text
|
|
1672
|
-
}
|
|
1675
|
+
})
|
|
1673
1676
|
]
|
|
1674
|
-
}, entry.id
|
|
1675
|
-
Object.entries(state.streaming).map(([streamRunId, text]) => /* @__PURE__ */
|
|
1677
|
+
}, entry.id)),
|
|
1678
|
+
Object.entries(state.streaming).map(([streamRunId, text]) => /* @__PURE__ */ jsxs("box", {
|
|
1676
1679
|
style: { flexDirection: "column", marginBottom: 1 },
|
|
1677
1680
|
children: [
|
|
1678
|
-
/* @__PURE__ */
|
|
1681
|
+
/* @__PURE__ */ jsx("text", {
|
|
1679
1682
|
fg: theme.muted,
|
|
1680
|
-
children: /* @__PURE__ */
|
|
1683
|
+
children: /* @__PURE__ */ jsx("strong", {
|
|
1681
1684
|
children: "AGENT \xB7 STREAMING"
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
/* @__PURE__ */
|
|
1685
|
+
})
|
|
1686
|
+
}),
|
|
1687
|
+
/* @__PURE__ */ jsx("text", {
|
|
1685
1688
|
fg: theme.primary,
|
|
1686
1689
|
children: text
|
|
1687
|
-
}
|
|
1690
|
+
})
|
|
1688
1691
|
]
|
|
1689
|
-
}, streamRunId
|
|
1692
|
+
}, streamRunId))
|
|
1690
1693
|
]
|
|
1691
|
-
}
|
|
1692
|
-
state.pendingApproval ? /* @__PURE__ */
|
|
1694
|
+
}),
|
|
1695
|
+
state.pendingApproval ? /* @__PURE__ */ jsxs("box", {
|
|
1693
1696
|
title: " APPROVAL ",
|
|
1694
1697
|
titleColor: theme.warning,
|
|
1695
1698
|
style: {
|
|
@@ -1703,25 +1706,25 @@ function AgentTuiApp({
|
|
|
1703
1706
|
flexDirection: "column"
|
|
1704
1707
|
},
|
|
1705
1708
|
children: [
|
|
1706
|
-
/* @__PURE__ */
|
|
1709
|
+
/* @__PURE__ */ jsx("text", {
|
|
1707
1710
|
fg: theme.primary,
|
|
1708
|
-
children: /* @__PURE__ */
|
|
1711
|
+
children: /* @__PURE__ */ jsx("strong", {
|
|
1709
1712
|
children: state.pendingApproval.toolName
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
|
-
/* @__PURE__ */
|
|
1713
|
+
})
|
|
1714
|
+
}),
|
|
1715
|
+
/* @__PURE__ */ jsx("text", {
|
|
1713
1716
|
fg: theme.muted,
|
|
1714
1717
|
children: JSON.stringify(state.pendingApproval.input).slice(0, 240)
|
|
1715
|
-
}
|
|
1716
|
-
/* @__PURE__ */
|
|
1718
|
+
}),
|
|
1719
|
+
/* @__PURE__ */ jsx("text", {
|
|
1717
1720
|
fg: theme.warning,
|
|
1718
1721
|
children: "Y approve once \xB7 N / Esc deny"
|
|
1719
|
-
}
|
|
1722
|
+
})
|
|
1720
1723
|
]
|
|
1721
|
-
}
|
|
1724
|
+
}) : /* @__PURE__ */ jsxs("box", {
|
|
1722
1725
|
style: { flexDirection: "column" },
|
|
1723
1726
|
children: [
|
|
1724
|
-
completions.length > 0 ? /* @__PURE__ */
|
|
1727
|
+
completions.length > 0 ? /* @__PURE__ */ jsx("box", {
|
|
1725
1728
|
style: {
|
|
1726
1729
|
maxHeight: 7,
|
|
1727
1730
|
marginLeft: compact ? 1 : 2,
|
|
@@ -1730,49 +1733,49 @@ function AgentTuiApp({
|
|
|
1730
1733
|
borderColor: theme.border,
|
|
1731
1734
|
flexDirection: "column"
|
|
1732
1735
|
},
|
|
1733
|
-
children: completions.map((command, index) => /* @__PURE__ */
|
|
1736
|
+
children: completions.map((command, index) => /* @__PURE__ */ jsx("box", {
|
|
1734
1737
|
style: {
|
|
1735
1738
|
paddingLeft: 1,
|
|
1736
1739
|
...index === completionIndex && {
|
|
1737
1740
|
backgroundColor: theme.panelRaised
|
|
1738
1741
|
}
|
|
1739
1742
|
},
|
|
1740
|
-
children: /* @__PURE__ */
|
|
1743
|
+
children: /* @__PURE__ */ jsxs("text", {
|
|
1741
1744
|
fg: index === completionIndex ? theme.primary : theme.muted,
|
|
1742
1745
|
children: [
|
|
1743
|
-
/* @__PURE__ */
|
|
1746
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1744
1747
|
fg: theme.accent,
|
|
1745
1748
|
children: [
|
|
1746
1749
|
index === completionIndex ? "\u203A" : " ",
|
|
1747
1750
|
" /",
|
|
1748
1751
|
command.name
|
|
1749
1752
|
]
|
|
1750
|
-
}
|
|
1753
|
+
}),
|
|
1751
1754
|
" ",
|
|
1752
1755
|
command.description
|
|
1753
1756
|
]
|
|
1754
|
-
}
|
|
1755
|
-
}, command.name
|
|
1756
|
-
}
|
|
1757
|
-
/* @__PURE__ */
|
|
1757
|
+
})
|
|
1758
|
+
}, command.name))
|
|
1759
|
+
}) : null,
|
|
1760
|
+
/* @__PURE__ */ jsxs("box", {
|
|
1758
1761
|
style: {
|
|
1759
1762
|
height: 3,
|
|
1760
1763
|
marginLeft: compact ? 1 : 2,
|
|
1761
1764
|
marginRight: compact ? 1 : 2,
|
|
1762
1765
|
border: ["top", "bottom"],
|
|
1763
|
-
borderColor:
|
|
1766
|
+
borderColor: dialog ? theme.border : theme.borderActive,
|
|
1764
1767
|
paddingLeft: 1,
|
|
1765
1768
|
paddingRight: 1,
|
|
1766
1769
|
flexDirection: "row"
|
|
1767
1770
|
},
|
|
1768
1771
|
children: [
|
|
1769
|
-
/* @__PURE__ */
|
|
1770
|
-
fg:
|
|
1772
|
+
/* @__PURE__ */ jsx("text", {
|
|
1773
|
+
fg: dialog ? theme.muted : theme.accent,
|
|
1771
1774
|
children: "\u203A "
|
|
1772
|
-
}
|
|
1773
|
-
/* @__PURE__ */
|
|
1775
|
+
}),
|
|
1776
|
+
/* @__PURE__ */ jsx("textarea", {
|
|
1774
1777
|
ref: composerRef,
|
|
1775
|
-
focused: !
|
|
1778
|
+
focused: !dialog,
|
|
1776
1779
|
placeholder: "Message the agent or type / for commands\u2026",
|
|
1777
1780
|
initialValue: draft,
|
|
1778
1781
|
wrapMode: "word",
|
|
@@ -1788,27 +1791,27 @@ function AgentTuiApp({
|
|
|
1788
1791
|
},
|
|
1789
1792
|
onSubmit: () => void submit(),
|
|
1790
1793
|
style: { width: "100%", height: "100%" }
|
|
1791
|
-
}
|
|
1794
|
+
})
|
|
1792
1795
|
]
|
|
1793
|
-
}
|
|
1796
|
+
})
|
|
1794
1797
|
]
|
|
1795
|
-
}
|
|
1796
|
-
localNotice || state.notice ||
|
|
1798
|
+
}),
|
|
1799
|
+
localNotice || state.notice || viewport.unseen > 0 ? /* @__PURE__ */ jsx("box", {
|
|
1797
1800
|
style: { height: 1, paddingLeft: compact ? 1 : 2, paddingRight: 1 },
|
|
1798
|
-
children: /* @__PURE__ */
|
|
1801
|
+
children: /* @__PURE__ */ jsx("text", {
|
|
1799
1802
|
fg: localNotice || state.notice ? theme.danger : theme.accent,
|
|
1800
|
-
children: localNotice ?? state.notice?.message ?? `${
|
|
1801
|
-
}
|
|
1802
|
-
}
|
|
1803
|
-
statusRows.length > 0 ? /* @__PURE__ */
|
|
1803
|
+
children: localNotice ?? state.notice?.message ?? `${viewport.unseen} new messages`
|
|
1804
|
+
})
|
|
1805
|
+
}) : null,
|
|
1806
|
+
statusRows.length > 0 ? /* @__PURE__ */ jsx("box", {
|
|
1804
1807
|
style: {
|
|
1805
1808
|
height: statusRows.length,
|
|
1806
1809
|
paddingLeft: compact ? 1 : 2,
|
|
1807
1810
|
paddingRight: 1,
|
|
1808
1811
|
flexDirection: "column"
|
|
1809
1812
|
},
|
|
1810
|
-
children: statusRows.map((row, rowIndex) => /* @__PURE__ */
|
|
1811
|
-
children: row.map((segment, segmentIndex) => /* @__PURE__ */
|
|
1813
|
+
children: statusRows.map((row, rowIndex) => /* @__PURE__ */ jsx("text", {
|
|
1814
|
+
children: row.map((segment, segmentIndex) => /* @__PURE__ */ jsxs("span", {
|
|
1812
1815
|
fg: statusToneColor(segment.tone, theme),
|
|
1813
1816
|
bg: segmentIndex % 2 === 0 ? theme.panel : theme.panelRaised,
|
|
1814
1817
|
children: [
|
|
@@ -1816,11 +1819,11 @@ function AgentTuiApp({
|
|
|
1816
1819
|
segment.text,
|
|
1817
1820
|
" "
|
|
1818
1821
|
]
|
|
1819
|
-
}, `${segment.text}-${segmentIndex}
|
|
1820
|
-
}, `status-${rowIndex}
|
|
1821
|
-
}
|
|
1822
|
-
|
|
1823
|
-
title: ` ${
|
|
1822
|
+
}, `${segment.text}-${segmentIndex}`))
|
|
1823
|
+
}, `status-${rowIndex}`))
|
|
1824
|
+
}) : null,
|
|
1825
|
+
dialog ? /* @__PURE__ */ jsxs("box", {
|
|
1826
|
+
title: ` ${dialog.toUpperCase()} `,
|
|
1824
1827
|
titleColor: theme.accent,
|
|
1825
1828
|
style: {
|
|
1826
1829
|
position: "absolute",
|
|
@@ -1835,10 +1838,10 @@ function AgentTuiApp({
|
|
|
1835
1838
|
flexDirection: "column"
|
|
1836
1839
|
},
|
|
1837
1840
|
children: [
|
|
1838
|
-
|
|
1841
|
+
dialog === "model" ? /* @__PURE__ */ jsxs("box", {
|
|
1839
1842
|
style: { flexDirection: "column", width: "100%", height: "100%" },
|
|
1840
1843
|
children: [
|
|
1841
|
-
/* @__PURE__ */
|
|
1844
|
+
/* @__PURE__ */ jsxs("text", {
|
|
1842
1845
|
fg: theme.muted,
|
|
1843
1846
|
children: [
|
|
1844
1847
|
"Search the full catalog \xB7 showing ",
|
|
@@ -1848,8 +1851,8 @@ function AgentTuiApp({
|
|
|
1848
1851
|
visibleModels.total,
|
|
1849
1852
|
" matches \xB7 Tab switches search/list"
|
|
1850
1853
|
]
|
|
1851
|
-
}
|
|
1852
|
-
/* @__PURE__ */
|
|
1854
|
+
}),
|
|
1855
|
+
/* @__PURE__ */ jsx("box", {
|
|
1853
1856
|
style: {
|
|
1854
1857
|
height: 3,
|
|
1855
1858
|
border: true,
|
|
@@ -1857,16 +1860,16 @@ function AgentTuiApp({
|
|
|
1857
1860
|
paddingLeft: 1,
|
|
1858
1861
|
paddingRight: 1
|
|
1859
1862
|
},
|
|
1860
|
-
children: /* @__PURE__ */
|
|
1863
|
+
children: /* @__PURE__ */ jsx("input", {
|
|
1861
1864
|
focused: modelSearchFocused,
|
|
1862
1865
|
value: modelQuery,
|
|
1863
1866
|
placeholder: "Filter by model, provider or capability\u2026",
|
|
1864
1867
|
onInput: setModelQuery,
|
|
1865
1868
|
onSubmit: () => setModelSearchFocused(false),
|
|
1866
1869
|
style: { width: "100%" }
|
|
1867
|
-
}
|
|
1868
|
-
}
|
|
1869
|
-
/* @__PURE__ */
|
|
1870
|
+
})
|
|
1871
|
+
}),
|
|
1872
|
+
/* @__PURE__ */ jsx("select", {
|
|
1870
1873
|
focused: !modelSearchFocused,
|
|
1871
1874
|
options: modelOptions,
|
|
1872
1875
|
selectedIndex: selectedModelIndex,
|
|
@@ -1886,9 +1889,9 @@ function AgentTuiApp({
|
|
|
1886
1889
|
return;
|
|
1887
1890
|
controller.selectModel(model.id).then(() => setDialog(undefined)).catch((error) => setLocalNotice(errorMessage(error)));
|
|
1888
1891
|
}
|
|
1889
|
-
}
|
|
1892
|
+
})
|
|
1890
1893
|
]
|
|
1891
|
-
}
|
|
1894
|
+
}) : dialog === "sessions" ? conversations ? /* @__PURE__ */ jsx("select", {
|
|
1892
1895
|
focused: true,
|
|
1893
1896
|
options: sessions.map((session) => ({
|
|
1894
1897
|
name: session.conversationId,
|
|
@@ -1913,117 +1916,117 @@ function AgentTuiApp({
|
|
|
1913
1916
|
setHiddenBefore(0);
|
|
1914
1917
|
}).catch((error) => setLocalNotice(errorMessage(error)));
|
|
1915
1918
|
}
|
|
1916
|
-
}
|
|
1919
|
+
}) : /* @__PURE__ */ jsx("text", {
|
|
1917
1920
|
fg: theme.muted,
|
|
1918
1921
|
children: "This host does not provide a conversation catalog."
|
|
1919
|
-
}
|
|
1922
|
+
}) : dialog === "help" ? /* @__PURE__ */ jsx("scrollbox", {
|
|
1920
1923
|
focused: true,
|
|
1921
1924
|
style: { flexGrow: 1, contentOptions: { flexDirection: "column" } },
|
|
1922
|
-
children: commands.map((command) => /* @__PURE__ */
|
|
1925
|
+
children: commands.map((command) => /* @__PURE__ */ jsxs("text", {
|
|
1923
1926
|
fg: theme.primary,
|
|
1924
1927
|
children: [
|
|
1925
|
-
/* @__PURE__ */
|
|
1928
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1926
1929
|
fg: theme.accent,
|
|
1927
1930
|
children: [
|
|
1928
1931
|
"/",
|
|
1929
1932
|
command.name
|
|
1930
1933
|
]
|
|
1931
|
-
}
|
|
1934
|
+
}),
|
|
1932
1935
|
" ",
|
|
1933
1936
|
command.description
|
|
1934
1937
|
]
|
|
1935
|
-
}, command.name
|
|
1936
|
-
}
|
|
1938
|
+
}, command.name))
|
|
1939
|
+
}) : dialog === "status" ? /* @__PURE__ */ jsxs("box", {
|
|
1937
1940
|
style: { flexDirection: "column" },
|
|
1938
1941
|
children: [
|
|
1939
|
-
/* @__PURE__ */
|
|
1942
|
+
/* @__PURE__ */ jsxs("text", {
|
|
1940
1943
|
fg: theme.primary,
|
|
1941
1944
|
children: [
|
|
1942
1945
|
"Session ",
|
|
1943
1946
|
sessionId
|
|
1944
1947
|
]
|
|
1945
|
-
}
|
|
1946
|
-
/* @__PURE__ */
|
|
1948
|
+
}),
|
|
1949
|
+
/* @__PURE__ */ jsxs("text", {
|
|
1947
1950
|
fg: theme.primary,
|
|
1948
1951
|
children: [
|
|
1949
1952
|
"Conversation ",
|
|
1950
1953
|
state.conversationId
|
|
1951
1954
|
]
|
|
1952
|
-
}
|
|
1953
|
-
/* @__PURE__ */
|
|
1955
|
+
}),
|
|
1956
|
+
/* @__PURE__ */ jsxs("text", {
|
|
1954
1957
|
fg: theme.primary,
|
|
1955
1958
|
children: [
|
|
1956
1959
|
"Model ",
|
|
1957
1960
|
state.selectedModelId
|
|
1958
1961
|
]
|
|
1959
|
-
}
|
|
1960
|
-
/* @__PURE__ */
|
|
1962
|
+
}),
|
|
1963
|
+
/* @__PURE__ */ jsxs("text", {
|
|
1961
1964
|
fg: theme.primary,
|
|
1962
1965
|
children: [
|
|
1963
1966
|
"Run ",
|
|
1964
1967
|
runId ?? "idle"
|
|
1965
1968
|
]
|
|
1966
|
-
}
|
|
1967
|
-
/* @__PURE__ */
|
|
1969
|
+
}),
|
|
1970
|
+
/* @__PURE__ */ jsx("text", {
|
|
1968
1971
|
fg: theme.muted,
|
|
1969
1972
|
children: "External clients submit through this host's controller."
|
|
1970
|
-
}
|
|
1973
|
+
})
|
|
1971
1974
|
]
|
|
1972
|
-
}
|
|
1975
|
+
}) : dialog === "tools" ? /* @__PURE__ */ jsxs("box", {
|
|
1973
1976
|
style: { flexDirection: "column" },
|
|
1974
1977
|
children: [
|
|
1975
1978
|
[
|
|
1976
|
-
...new Set(entries.filter(({ role
|
|
1977
|
-
].map((name) => /* @__PURE__ */
|
|
1979
|
+
...new Set(entries.filter(({ role }) => role === "tool").map(({ text }) => text.split(" ")[1]).filter(isString))
|
|
1980
|
+
].map((name) => /* @__PURE__ */ jsx("text", {
|
|
1978
1981
|
fg: theme.primary,
|
|
1979
1982
|
children: name
|
|
1980
|
-
}, name
|
|
1981
|
-
/* @__PURE__ */
|
|
1983
|
+
}, name)),
|
|
1984
|
+
/* @__PURE__ */ jsx("text", {
|
|
1982
1985
|
fg: theme.muted,
|
|
1983
1986
|
children: "Direct tools retain their own durable identity."
|
|
1984
|
-
}
|
|
1987
|
+
})
|
|
1985
1988
|
]
|
|
1986
|
-
}
|
|
1989
|
+
}) : dialog === "permissions" ? /* @__PURE__ */ jsxs("box", {
|
|
1987
1990
|
style: { flexDirection: "column" },
|
|
1988
1991
|
children: [
|
|
1989
|
-
/* @__PURE__ */
|
|
1992
|
+
/* @__PURE__ */ jsx("text", {
|
|
1990
1993
|
fg: theme.primary,
|
|
1991
1994
|
children: "Approval decisions are per exact tool call."
|
|
1992
|
-
}
|
|
1993
|
-
/* @__PURE__ */
|
|
1995
|
+
}),
|
|
1996
|
+
/* @__PURE__ */ jsx("text", {
|
|
1994
1997
|
fg: theme.muted,
|
|
1995
1998
|
children: "Sandbox enforcement is supplied and reported by the embedding host."
|
|
1996
|
-
}
|
|
1999
|
+
})
|
|
1997
2000
|
]
|
|
1998
|
-
}
|
|
2001
|
+
}) : /* @__PURE__ */ jsxs("box", {
|
|
1999
2002
|
style: { flexDirection: "column" },
|
|
2000
2003
|
children: [
|
|
2001
|
-
/* @__PURE__ */
|
|
2004
|
+
/* @__PURE__ */ jsx("text", {
|
|
2002
2005
|
fg: theme.primary,
|
|
2003
2006
|
children: "Skills and resources are discovered lazily by the harness."
|
|
2004
|
-
}
|
|
2005
|
-
/* @__PURE__ */
|
|
2007
|
+
}),
|
|
2008
|
+
/* @__PURE__ */ jsx("text", {
|
|
2006
2009
|
fg: theme.muted,
|
|
2007
2010
|
children: "The model reads exact content through the direct read_resource tool."
|
|
2008
|
-
}
|
|
2011
|
+
})
|
|
2009
2012
|
]
|
|
2010
|
-
}
|
|
2011
|
-
|
|
2013
|
+
}),
|
|
2014
|
+
dialog === "sessions" && sessionCursor ? /* @__PURE__ */ jsx("text", {
|
|
2012
2015
|
fg: theme.muted,
|
|
2013
2016
|
children: "More conversations are available."
|
|
2014
|
-
}
|
|
2015
|
-
/* @__PURE__ */
|
|
2017
|
+
}) : null,
|
|
2018
|
+
/* @__PURE__ */ jsx("text", {
|
|
2016
2019
|
fg: theme.muted,
|
|
2017
2020
|
children: "Esc close"
|
|
2018
|
-
}
|
|
2021
|
+
})
|
|
2019
2022
|
]
|
|
2020
|
-
}
|
|
2023
|
+
}) : null
|
|
2021
2024
|
]
|
|
2022
|
-
}
|
|
2025
|
+
});
|
|
2023
2026
|
}
|
|
2024
2027
|
|
|
2025
2028
|
// src/run.tsx
|
|
2026
|
-
import {
|
|
2029
|
+
import { jsx as jsx2 } from "@opentui/react/jsx-runtime";
|
|
2027
2030
|
function runtimeContext(config) {
|
|
2028
2031
|
return Promise.resolve(config.context());
|
|
2029
2032
|
}
|
|
@@ -2079,13 +2082,13 @@ async function runAgentTui(config) {
|
|
|
2079
2082
|
}
|
|
2080
2083
|
if (request.operation === "interrupt")
|
|
2081
2084
|
await controller.interrupt(request.runId);
|
|
2082
|
-
const
|
|
2085
|
+
const activeRunId = controller.state().snapshot.runs.find(({ state }) => state === "running" || state === "interrupt_requested")?.id;
|
|
2083
2086
|
return {
|
|
2084
2087
|
requestId: request.requestId,
|
|
2085
2088
|
outcome: "ok",
|
|
2086
2089
|
sessionId,
|
|
2087
2090
|
conversationId: controller.state().conversationId,
|
|
2088
|
-
...
|
|
2091
|
+
...activeRunId && { runId: activeRunId }
|
|
2089
2092
|
};
|
|
2090
2093
|
} catch {
|
|
2091
2094
|
diagnostics.record({
|
|
@@ -2148,7 +2151,7 @@ async function runAgentTui(config) {
|
|
|
2148
2151
|
})();
|
|
2149
2152
|
return closing;
|
|
2150
2153
|
};
|
|
2151
|
-
root.render(/* @__PURE__ */
|
|
2154
|
+
root.render(/* @__PURE__ */ jsx2(AgentTuiApp, {
|
|
2152
2155
|
controller,
|
|
2153
2156
|
catalog,
|
|
2154
2157
|
...bundle.conversations && { conversations: bundle.conversations },
|
|
@@ -2173,47 +2176,47 @@ async function runAgentTui(config) {
|
|
|
2173
2176
|
});
|
|
2174
2177
|
},
|
|
2175
2178
|
onExit: close
|
|
2176
|
-
}
|
|
2179
|
+
}));
|
|
2177
2180
|
process.once("SIGINT", onSignal);
|
|
2178
2181
|
process.once("SIGTERM", onSignal);
|
|
2179
2182
|
return { sessionId: host.sessionId, close };
|
|
2180
2183
|
}
|
|
2181
2184
|
export {
|
|
2182
|
-
|
|
2183
|
-
startAgentTuiSessionHost,
|
|
2184
|
-
setAgentTuiDraft,
|
|
2185
|
-
selectedCommandCompletion,
|
|
2186
|
-
searchAgentTuiModels,
|
|
2187
|
-
runAgentTui,
|
|
2188
|
-
resolveTuiCommandSubmission,
|
|
2189
|
-
resolveTuiCommand,
|
|
2190
|
-
resolveAgentTuiTheme,
|
|
2191
|
-
resolveAgentTuiInitialConversationId,
|
|
2192
|
-
projectAgentTuiTranscript,
|
|
2193
|
-
projectAgentTuiRuntimeDiagnostic,
|
|
2194
|
-
navigateAgentTuiHistory,
|
|
2195
|
-
moveCommandCompletionSelection,
|
|
2196
|
-
listAgentTuiSessions,
|
|
2197
|
-
isAgentTuiExitKey,
|
|
2198
|
-
defineTuiCommand,
|
|
2199
|
-
defineAgentTui,
|
|
2200
|
-
defaultAgentTuiTheme,
|
|
2201
|
-
defaultAgentTuiStatusLine,
|
|
2202
|
-
defaultAgentTuiRecoveryDecision,
|
|
2203
|
-
createFileAgentModelSelectionStore,
|
|
2204
|
-
createAgentTuiSessionId,
|
|
2205
|
-
createAgentTuiDiagnosticRecorder,
|
|
2206
|
-
createAgentTuiConversationId,
|
|
2207
|
-
createAgentTuiController,
|
|
2208
|
-
createAgentTuiComposer,
|
|
2209
|
-
createAgentTuiClient,
|
|
2210
|
-
composeTuiCommands,
|
|
2211
|
-
commandCompletions,
|
|
2212
|
-
AgentTuiSessionResponseSchema,
|
|
2213
|
-
AgentTuiSessionRequestSchema,
|
|
2214
|
-
AgentTuiSessionDescriptorSchema,
|
|
2215
|
-
AgentTuiDiagnosticEventSchema,
|
|
2216
|
-
AgentTuiComposerSchema,
|
|
2185
|
+
AGENT_TUI_MODEL_RESULT_LIMIT,
|
|
2217
2186
|
AgentTuiCommandOutcomeSchema,
|
|
2218
|
-
|
|
2187
|
+
AgentTuiComposerSchema,
|
|
2188
|
+
AgentTuiDiagnosticEventSchema,
|
|
2189
|
+
AgentTuiSessionDescriptorSchema,
|
|
2190
|
+
AgentTuiSessionRequestSchema,
|
|
2191
|
+
AgentTuiSessionResponseSchema,
|
|
2192
|
+
commandCompletions,
|
|
2193
|
+
composeTuiCommands,
|
|
2194
|
+
createAgentTuiClient,
|
|
2195
|
+
createAgentTuiComposer,
|
|
2196
|
+
createAgentTuiController,
|
|
2197
|
+
createAgentTuiConversationId,
|
|
2198
|
+
createAgentTuiDiagnosticRecorder,
|
|
2199
|
+
createAgentTuiSessionId,
|
|
2200
|
+
createFileAgentModelSelectionStore,
|
|
2201
|
+
defaultAgentTuiRecoveryDecision,
|
|
2202
|
+
defaultAgentTuiStatusLine,
|
|
2203
|
+
defaultAgentTuiTheme,
|
|
2204
|
+
defineAgentTui,
|
|
2205
|
+
defineTuiCommand,
|
|
2206
|
+
isAgentTuiExitKey,
|
|
2207
|
+
listAgentTuiSessions,
|
|
2208
|
+
moveCommandCompletionSelection,
|
|
2209
|
+
navigateAgentTuiHistory,
|
|
2210
|
+
projectAgentTuiRuntimeDiagnostic,
|
|
2211
|
+
projectAgentTuiTranscript,
|
|
2212
|
+
resolveAgentTuiInitialConversationId,
|
|
2213
|
+
resolveAgentTuiTheme,
|
|
2214
|
+
resolveTuiCommand,
|
|
2215
|
+
resolveTuiCommandSubmission,
|
|
2216
|
+
runAgentTui,
|
|
2217
|
+
searchAgentTuiModels,
|
|
2218
|
+
selectedCommandCompletion,
|
|
2219
|
+
setAgentTuiDraft,
|
|
2220
|
+
startAgentTuiSessionHost,
|
|
2221
|
+
submitAgentTuiComposer
|
|
2219
2222
|
};
|