@volter-ai-dev/supercode-ui 0.1.70 → 0.1.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -1
- package/activity.mjs +5 -1235
- package/chunks/chunk-ATCOWFRV.mjs +105 -0
- package/chunks/chunk-LOP6XOON.mjs +671 -0
- package/chunks/chunk-LQMYNJPU.mjs +120 -0
- package/chunks/chunk-LS6JBXNT.mjs +1237 -0
- package/chunks/chunk-O7Q2PELK.mjs +201 -0
- package/chunks/chunk-OW42DS6P.mjs +842 -0
- package/chunks/chunk-SJ3YTA6Z.mjs +316 -0
- package/chunks/chunk-SSYNT434.mjs +224 -0
- package/chunks/chunk-V3UM7H7W.mjs +328 -0
- package/chunks/chunk-XD2WJYSL.mjs +29 -0
- package/chunks/chunk-ZLYHUYE2.mjs +62 -0
- package/components.d.ts +3 -0
- package/components.mjs +59 -3766
- package/composer.mjs +8 -580
- package/conversation.mjs +16 -1373
- package/embed.mjs +15 -3681
- package/icon.mjs +3 -58
- package/index.d.ts +25 -0
- package/logo.mjs +5 -87
- package/messenger.d.ts +3 -0
- package/messenger.mjs +21 -3677
- package/package.json +3 -2
- package/react/activity.mjs +5 -1235
- package/react/chunks/chunk-2RIHDJT6.mjs +842 -0
- package/react/chunks/chunk-7ES5FSLG.mjs +316 -0
- package/react/chunks/chunk-GV5KV5UY.mjs +105 -0
- package/react/chunks/chunk-GYQOTTZ5.mjs +224 -0
- package/react/chunks/chunk-LS6JBXNT.mjs +1237 -0
- package/react/chunks/chunk-OINC7LV7.mjs +62 -0
- package/react/chunks/chunk-TQHX2DQG.mjs +120 -0
- package/react/chunks/chunk-UKHDCPME.mjs +328 -0
- package/react/chunks/chunk-UKMTRNJN.mjs +671 -0
- package/react/chunks/chunk-ZM5X5LOF.mjs +29 -0
- package/react/chunks/chunk-ZXD7NZXI.mjs +201 -0
- package/react/components.mjs +59 -3766
- package/react/composer.mjs +8 -580
- package/react/conversation.mjs +16 -1373
- package/react/icon.mjs +3 -58
- package/react/index.d.ts +25 -0
- package/react/logo.mjs +5 -87
- package/react/messenger.d.ts +3 -0
- package/react/messenger.mjs +21 -3677
- package/react/sessions.mjs +9 -519
- package/react/settings.mjs +9 -425
- package/react/subagents.mjs +8 -1546
- package/sessions.mjs +9 -519
- package/settings.mjs +9 -425
- package/styles.css +12 -0
- package/subagents.mjs +8 -1546
package/react/subagents.mjs
CHANGED
|
@@ -1,1549 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
goose: "Goose",
|
|
10
|
-
opencode: "OpenCode",
|
|
11
|
-
pi: "Pi",
|
|
12
|
-
grok: "Grok"
|
|
13
|
-
});
|
|
14
|
-
var DEFAULT_LABELS = Object.freeze({
|
|
15
|
-
chats: "Chats",
|
|
16
|
-
newChat: "New chat",
|
|
17
|
-
searchChats: "Search chats",
|
|
18
|
-
askAgent: "Ask your agent\u2026",
|
|
19
|
-
attachContext: "Attach files or images",
|
|
20
|
-
continueHere: "Continue here",
|
|
21
|
-
continueWithTerminal: "Continue with terminal",
|
|
22
|
-
joinLive: "Join live",
|
|
23
|
-
forkHere: "Fork here"
|
|
24
|
-
});
|
|
25
|
-
var EMPTY_UI_STATE = Object.freeze({
|
|
26
|
-
pill: Object.freeze({ tone: "off", label: "connecting\u2026" }),
|
|
27
|
-
startup: "connecting",
|
|
28
|
-
transcript: Object.freeze([]),
|
|
29
|
-
busy: false,
|
|
30
|
-
operation: null,
|
|
31
|
-
needsInput: false,
|
|
32
|
-
harness: "",
|
|
33
|
-
mode: "none",
|
|
34
|
-
strategy: null,
|
|
35
|
-
participant: Object.freeze({ kind: "local-user", label: null, origin: null }),
|
|
36
|
-
workspaceRef: Object.freeze({ kind: "none", value: null }),
|
|
37
|
-
mirror: null,
|
|
38
|
-
holder: null,
|
|
39
|
-
canSend: false,
|
|
40
|
-
canSteer: false,
|
|
41
|
-
canResume: false,
|
|
42
|
-
supportsResume: false,
|
|
43
|
-
continuationModes: Object.freeze([]),
|
|
44
|
-
canBranch: false,
|
|
45
|
-
supportsBranch: false,
|
|
46
|
-
canAttach: false,
|
|
47
|
-
supportsAttach: false,
|
|
48
|
-
canDetach: false,
|
|
49
|
-
canOpenTerminal: false,
|
|
50
|
-
canExport: false,
|
|
51
|
-
canReduce: false,
|
|
52
|
-
canInterrupt: false,
|
|
53
|
-
canRespond: false,
|
|
54
|
-
canConfigureSettings: false,
|
|
55
|
-
messaging: null,
|
|
56
|
-
workspace: "",
|
|
57
|
-
taskPlan: Object.freeze({ source: "none", items: Object.freeze([]), residueCount: 0, observedAt: null }),
|
|
58
|
-
semantics: Object.freeze({ fidelity: null, residue: Object.freeze([]), residueCount: 0, parseErrors: 0, rawRecords: 0, subagents: Object.freeze([]) }),
|
|
59
|
-
terminalHandoff: null,
|
|
60
|
-
exportBackTarget: null,
|
|
61
|
-
exportReceipt: null,
|
|
62
|
-
reductionReceipt: null,
|
|
63
|
-
interopSettings: null,
|
|
64
|
-
interopSettingsError: null,
|
|
65
|
-
harnessAuthentication: null,
|
|
66
|
-
error: null,
|
|
67
|
-
recoverable: false,
|
|
68
|
-
harnesses: Object.freeze([]),
|
|
69
|
-
history: Object.freeze({ sessionLimit: 0, hasMoreSessions: false, transcriptLimit: 120, hasEarlier: false }),
|
|
70
|
-
savedDraft: "",
|
|
71
|
-
attention: Object.freeze([]),
|
|
72
|
-
sessions: Object.freeze([]),
|
|
73
|
-
subagentInspector: null,
|
|
74
|
-
attached: null,
|
|
75
|
-
owned: null,
|
|
76
|
-
attachError: null,
|
|
77
|
-
agentPackage: null,
|
|
78
|
-
contributions: Object.freeze([]),
|
|
79
|
-
agentPackageError: null,
|
|
80
|
-
agentPackageCapabilityState: null,
|
|
81
|
-
agentPackageCapabilityError: null
|
|
82
|
-
});
|
|
83
|
-
var TOOL_CATEGORIES = /* @__PURE__ */ new Set(["read", "search", "edit", "command", "test", "web", "agent", "plan", "other"]);
|
|
84
|
-
var MAX_TOOL_FIELDS = 8;
|
|
85
|
-
var MAX_TOOL_FIELD_CHARS = 800;
|
|
86
|
-
var MAX_TOOL_PREVIEW_CHARS = 4e3;
|
|
87
|
-
function record(value) {
|
|
88
|
-
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
89
|
-
}
|
|
90
|
-
function boundedString(value, max = 2e3) {
|
|
91
|
-
if (typeof value !== "string") return "";
|
|
92
|
-
return value.length <= max ? value : `${value.slice(0, max)}\u2026`;
|
|
93
|
-
}
|
|
94
|
-
function argumentValue(argumentsText) {
|
|
95
|
-
if (!argumentsText) return null;
|
|
96
|
-
try {
|
|
97
|
-
return JSON.parse(argumentsText);
|
|
98
|
-
} catch {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
function firstString(source, keys) {
|
|
103
|
-
for (const key of keys) {
|
|
104
|
-
if (typeof source?.[key] === "string" && source[key].trim()) return source[key].trim();
|
|
105
|
-
}
|
|
106
|
-
return "";
|
|
107
|
-
}
|
|
108
|
-
function decodedLiteral(value) {
|
|
109
|
-
if (!value) return "";
|
|
110
|
-
if (value.startsWith('"')) {
|
|
111
|
-
try {
|
|
112
|
-
return JSON.parse(value);
|
|
113
|
-
} catch {
|
|
114
|
-
return "";
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return value.slice(1, -1).replaceAll("\\n", "\n").replaceAll("\\t", " ").replaceAll("\\r", "\r").replaceAll("\\`", "`").replaceAll("\\'", "'").replaceAll("\\\\", "\\");
|
|
118
|
-
}
|
|
119
|
-
function sourceString(source, keys) {
|
|
120
|
-
if (!source) return "";
|
|
121
|
-
const names = keys.join("|");
|
|
122
|
-
const match = new RegExp(`(?:^|[,{\\s])["']?(?:${names})["']?\\s*:\\s*("(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|\`(?:\\\\.|[^\`\\\\])*\`)`).exec(source);
|
|
123
|
-
return decodedLiteral(match?.[1]);
|
|
124
|
-
}
|
|
125
|
-
function assignedString(source, keys) {
|
|
126
|
-
if (!source) return "";
|
|
127
|
-
const names = keys.join("|");
|
|
128
|
-
const match = new RegExp(`\\b(?:${names})\\s*=\\s*("(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|\`(?:\\\\.|[^\`\\\\])*\`)`).exec(source);
|
|
129
|
-
return decodedLiteral(match?.[1]);
|
|
130
|
-
}
|
|
131
|
-
function callArgumentSource(source, open) {
|
|
132
|
-
let depth = 1;
|
|
133
|
-
let quote = "";
|
|
134
|
-
let escaped = false;
|
|
135
|
-
let lineComment = false;
|
|
136
|
-
let blockComment = false;
|
|
137
|
-
for (let index = open + 1; index < source.length; index += 1) {
|
|
138
|
-
const char = source[index];
|
|
139
|
-
const next = source[index + 1];
|
|
140
|
-
if (lineComment) {
|
|
141
|
-
if (char === "\n") lineComment = false;
|
|
142
|
-
continue;
|
|
143
|
-
}
|
|
144
|
-
if (blockComment) {
|
|
145
|
-
if (char === "*" && next === "/") {
|
|
146
|
-
blockComment = false;
|
|
147
|
-
index += 1;
|
|
148
|
-
}
|
|
149
|
-
continue;
|
|
150
|
-
}
|
|
151
|
-
if (quote) {
|
|
152
|
-
if (escaped) escaped = false;
|
|
153
|
-
else if (char === "\\") escaped = true;
|
|
154
|
-
else if (char === quote) quote = "";
|
|
155
|
-
continue;
|
|
156
|
-
}
|
|
157
|
-
if (char === "/" && next === "/") {
|
|
158
|
-
lineComment = true;
|
|
159
|
-
index += 1;
|
|
160
|
-
continue;
|
|
161
|
-
}
|
|
162
|
-
if (char === "/" && next === "*") {
|
|
163
|
-
blockComment = true;
|
|
164
|
-
index += 1;
|
|
165
|
-
continue;
|
|
166
|
-
}
|
|
167
|
-
if (char === '"' || char === "'" || char === "`") {
|
|
168
|
-
quote = char;
|
|
169
|
-
continue;
|
|
170
|
-
}
|
|
171
|
-
if (char === "(") depth += 1;
|
|
172
|
-
else if (char === ")" && (depth -= 1) === 0) return source.slice(open + 1, index);
|
|
173
|
-
}
|
|
174
|
-
return source.slice(open + 1);
|
|
175
|
-
}
|
|
176
|
-
function toolCalls(source) {
|
|
177
|
-
const calls = [];
|
|
178
|
-
let quote = "";
|
|
179
|
-
let escaped = false;
|
|
180
|
-
let lineComment = false;
|
|
181
|
-
let blockComment = false;
|
|
182
|
-
for (let index = 0; index < source.length && calls.length < 8; index += 1) {
|
|
183
|
-
const char = source[index];
|
|
184
|
-
const next = source[index + 1];
|
|
185
|
-
if (lineComment) {
|
|
186
|
-
if (char === "\n") lineComment = false;
|
|
187
|
-
continue;
|
|
188
|
-
}
|
|
189
|
-
if (blockComment) {
|
|
190
|
-
if (char === "*" && next === "/") {
|
|
191
|
-
blockComment = false;
|
|
192
|
-
index += 1;
|
|
193
|
-
}
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
if (quote) {
|
|
197
|
-
if (escaped) escaped = false;
|
|
198
|
-
else if (char === "\\") escaped = true;
|
|
199
|
-
else if (char === quote) quote = "";
|
|
200
|
-
continue;
|
|
201
|
-
}
|
|
202
|
-
if (char === "/" && next === "/") {
|
|
203
|
-
lineComment = true;
|
|
204
|
-
index += 1;
|
|
205
|
-
continue;
|
|
206
|
-
}
|
|
207
|
-
if (char === "/" && next === "*") {
|
|
208
|
-
blockComment = true;
|
|
209
|
-
index += 1;
|
|
210
|
-
continue;
|
|
211
|
-
}
|
|
212
|
-
if (char === '"' || char === "'" || char === "`") {
|
|
213
|
-
quote = char;
|
|
214
|
-
continue;
|
|
215
|
-
}
|
|
216
|
-
if (!source.startsWith("tools.", index) || /[A-Za-z0-9_$]/.test(source[index - 1] ?? "")) continue;
|
|
217
|
-
const nameStart = index + 6;
|
|
218
|
-
let nameEnd = nameStart;
|
|
219
|
-
while (/[A-Za-z0-9_$]/.test(source[nameEnd] ?? "")) nameEnd += 1;
|
|
220
|
-
let open = nameEnd;
|
|
221
|
-
while (/\s/.test(source[open] ?? "")) open += 1;
|
|
222
|
-
if (nameEnd === nameStart || source[open] !== "(") continue;
|
|
223
|
-
calls.push({ name: source.slice(nameStart, nameEnd), arguments: callArgumentSource(source, open) });
|
|
224
|
-
index = open;
|
|
225
|
-
}
|
|
226
|
-
return calls;
|
|
227
|
-
}
|
|
228
|
-
function toolEnvelope(entry) {
|
|
229
|
-
const value = argumentValue(entry.arguments);
|
|
230
|
-
const source = typeof value === "string" ? value : value === null ? entry.arguments ?? "" : "";
|
|
231
|
-
const calls = source ? toolCalls(source) : [];
|
|
232
|
-
const tools = [...new Set(calls.map((call) => call.name))];
|
|
233
|
-
const name = tools.length === 1 ? tools[0] : entry.label ?? "tool";
|
|
234
|
-
return { args: record(value), source, callSource: calls[0]?.arguments ?? "", tools, name };
|
|
235
|
-
}
|
|
236
|
-
function patchPath(source) {
|
|
237
|
-
return /\*\*\* (?:Update|Add|Delete) File:\s*([^\r\n]*?)(?=\\[nr]|[\r\n]|$)/.exec(source)?.[1]?.trim() ?? "";
|
|
238
|
-
}
|
|
239
|
-
function explicitNumber(sources, keys) {
|
|
240
|
-
for (const source of sources) {
|
|
241
|
-
for (const key of keys) {
|
|
242
|
-
const value = source?.[key];
|
|
243
|
-
const parsed = typeof value === "string" && value.trim() !== "" ? Number(value) : value;
|
|
244
|
-
if (typeof parsed === "number" && Number.isFinite(parsed)) return parsed;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
return null;
|
|
248
|
-
}
|
|
249
|
-
function toolDetail(category) {
|
|
250
|
-
return { read: "file", search: "matches", edit: "diff", command: "terminal", test: "terminal", web: "web", agent: "agent", plan: "plan" }[category] ?? "fields";
|
|
251
|
-
}
|
|
252
|
-
function usefulToolFields(args) {
|
|
253
|
-
if (!args) return [];
|
|
254
|
-
const hidden = /* @__PURE__ */ new Set(["command", "cmd", "file_path", "target_file", "path", "query", "pattern", "url", "patch", "diff", "old_string", "new_string", "content", "prompt", "description", "task", "plan", "todos"]);
|
|
255
|
-
return Object.entries(args).flatMap(([key, value]) => {
|
|
256
|
-
if (hidden.has(key) || value === null || value === void 0) return [];
|
|
257
|
-
const rendered = typeof value === "string" ? value : JSON.stringify(value);
|
|
258
|
-
if (!rendered) return [];
|
|
259
|
-
return [{ label: key.replaceAll(/[_-]+/g, " ").replace(/^./, (letter) => letter.toLocaleUpperCase()), value: boundedString(rendered, MAX_TOOL_FIELD_CHARS) }];
|
|
260
|
-
}).slice(0, MAX_TOOL_FIELDS);
|
|
261
|
-
}
|
|
262
|
-
function planItems(args) {
|
|
263
|
-
const source = Array.isArray(args?.plan) ? args.plan : Array.isArray(args?.todos) ? args.todos : [];
|
|
264
|
-
return source.flatMap((item) => {
|
|
265
|
-
if (typeof item === "string" && item.trim()) return [{ label: boundedString(item.trim(), 300), status: "" }];
|
|
266
|
-
const value = record(item);
|
|
267
|
-
const label = firstString(value, ["step", "title", "content", "text"]);
|
|
268
|
-
if (!label) return [];
|
|
269
|
-
return [{ label: boundedString(label, 300), status: firstString(value, ["status"]) }];
|
|
270
|
-
}).slice(0, 12);
|
|
271
|
-
}
|
|
272
|
-
function agentItems(name, resultText) {
|
|
273
|
-
if (!/list.?agents/i.test(name)) return [];
|
|
274
|
-
return (resultText ?? "").split("\n").flatMap((line) => {
|
|
275
|
-
const parts = line.trim().split(/\s+·\s+/).filter(Boolean);
|
|
276
|
-
return parts.length > 1 ? [{ label: boundedString(parts[0], 120), status: boundedString(parts.slice(1).join(" \xB7 "), 180) }] : [];
|
|
277
|
-
}).slice(0, 12);
|
|
278
|
-
}
|
|
279
|
-
function editPreview(args, resultText, source) {
|
|
280
|
-
const direct = firstString(args, ["patch", "diff"]);
|
|
281
|
-
if (direct) return direct;
|
|
282
|
-
const oldText = firstString(args, ["old_string"]);
|
|
283
|
-
const newText = firstString(args, ["new_string"]);
|
|
284
|
-
if (oldText || newText) {
|
|
285
|
-
return [
|
|
286
|
-
...oldText.split("\n").map((line) => `- ${line}`),
|
|
287
|
-
...newText.split("\n").map((line) => `+ ${line}`)
|
|
288
|
-
].join("\n");
|
|
289
|
-
}
|
|
290
|
-
const patch = /\*\*\* Begin Patch[\s\S]*?\*\*\* End Patch/.exec(source ?? "")?.[0];
|
|
291
|
-
if (patch) return patch;
|
|
292
|
-
return /^(?:diff --git|@@ |--- |\+\+\+ )/m.test(resultText ?? "") ? resultText : "";
|
|
293
|
-
}
|
|
294
|
-
function toolResultEnvelope(resultText) {
|
|
295
|
-
const match = /^Script (?:completed|failed)\r?\nWall time ([0-9.]+) seconds\r?\nOutput:\r?\n([\s\S]*)$/.exec(resultText ?? "");
|
|
296
|
-
if (!match) {
|
|
297
|
-
try {
|
|
298
|
-
const value = JSON.parse(resultText ?? "");
|
|
299
|
-
const object = record(value);
|
|
300
|
-
return {
|
|
301
|
-
preview: typeof value === "string" ? value : firstString(object, ["output", "message", "text", "summary", "result"]) || resultText || "",
|
|
302
|
-
value: object,
|
|
303
|
-
durationMs: null
|
|
304
|
-
};
|
|
305
|
-
} catch {
|
|
306
|
-
return { preview: resultText ?? "", value: null, durationMs: null };
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
const durationMs = Number(match[1]) * 1e3;
|
|
310
|
-
try {
|
|
311
|
-
const value = record(JSON.parse(match[2]));
|
|
312
|
-
return {
|
|
313
|
-
preview: typeof value?.output === "string" ? value.output : match[2],
|
|
314
|
-
value,
|
|
315
|
-
durationMs: Number.isFinite(durationMs) ? durationMs : null
|
|
316
|
-
};
|
|
317
|
-
} catch {
|
|
318
|
-
return { preview: match[2], value: null, durationMs: Number.isFinite(durationMs) ? durationMs : null };
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
function semanticAgentPreview(name, status, outcome) {
|
|
322
|
-
const normalized = name.toLocaleLowerCase();
|
|
323
|
-
if (status === "error") return outcome.preview;
|
|
324
|
-
if (/^(?:agent|task)$|spawn.?agent/.test(normalized) && outcome.preview) return "Agent is working in the background.";
|
|
325
|
-
if (/send.?message|followup.?task/.test(normalized) && outcome.preview) {
|
|
326
|
-
return /resumed from transcript|resumedAgentId/i.test(outcome.preview) ? "Agent resumed in the background." : "Message delivered.";
|
|
327
|
-
}
|
|
328
|
-
return outcome.preview;
|
|
329
|
-
}
|
|
330
|
-
function verificationCommand(command) {
|
|
331
|
-
let shell = "";
|
|
332
|
-
let quote = "";
|
|
333
|
-
let escaped = false;
|
|
334
|
-
for (const char of command) {
|
|
335
|
-
if (escaped) {
|
|
336
|
-
escaped = false;
|
|
337
|
-
shell += quote ? " " : char;
|
|
338
|
-
continue;
|
|
339
|
-
}
|
|
340
|
-
if (char === "\\") {
|
|
341
|
-
escaped = true;
|
|
342
|
-
shell += quote ? " " : char;
|
|
343
|
-
continue;
|
|
344
|
-
}
|
|
345
|
-
if (quote) {
|
|
346
|
-
if (char === quote) quote = "";
|
|
347
|
-
shell += " ";
|
|
348
|
-
continue;
|
|
349
|
-
}
|
|
350
|
-
if (char === '"' || char === "'" || char === "`") {
|
|
351
|
-
quote = char;
|
|
352
|
-
shell += " ";
|
|
353
|
-
continue;
|
|
354
|
-
}
|
|
355
|
-
shell += char;
|
|
356
|
-
}
|
|
357
|
-
return /(?:^|[;&|]\s*)(?:(?:npm|pnpm|yarn|bun)\s+(?:run\s+)?(?:test|typecheck|lint|build)|cargo\s+(?:test|clippy|build|check|fmt)|npx\s+(?:vitest|tsc|eslint|playwright)|pytest\b|go\s+test\b)/i.test(shell);
|
|
358
|
-
}
|
|
359
|
-
function classifyTool(name, command) {
|
|
360
|
-
const normalized = name.toLocaleLowerCase();
|
|
361
|
-
if (/write_stdin|^wait$/.test(normalized)) return "command";
|
|
362
|
-
if (/update.?plan|todo|checklist|taskcreate|taskupdate|create.?goal|update.?goal/.test(normalized)) return "plan";
|
|
363
|
-
if (/search.?replace|edit|write|patch|replace|create_file|apply_patch/.test(normalized)) return "edit";
|
|
364
|
-
if (/read|view|open_file|list_dir/.test(normalized)) return "read";
|
|
365
|
-
if (/web.?search|web.?fetch|fetch.?url/.test(normalized)) return "web";
|
|
366
|
-
if (/search|find|grep|glob|toolsearch/.test(normalized)) return "search";
|
|
367
|
-
if (/browser|web|fetch|url/.test(normalized)) return "web";
|
|
368
|
-
if (/agent|subagent|send.?message|delegate|followup.?task|taskstop|taskoutput|^task$/.test(normalized)) return "agent";
|
|
369
|
-
if (/test|typecheck|lint|build/.test(normalized)) return "test";
|
|
370
|
-
if (/terminal|bash|shell|command|exec|write_stdin|^wait$/.test(normalized)) return verificationCommand(command) ? "test" : "command";
|
|
371
|
-
return "other";
|
|
372
|
-
}
|
|
373
|
-
function toolAction(status, category, name, tools) {
|
|
374
|
-
const position = status === "pending" ? 0 : status === "error" ? 2 : 1;
|
|
375
|
-
if (tools.length > 1) return [`Running ${tools.length} actions`, `Ran ${tools.length} actions`, `${tools.length} actions failed`][position];
|
|
376
|
-
const normalized = name.toLocaleLowerCase();
|
|
377
|
-
if (/send.?message|followup.?task/.test(normalized)) return ["Messaging agent", "Messaged agent", "Agent message failed"][position];
|
|
378
|
-
if (/taskstop|interrupt.?agent|kill_command_or_subagent/.test(normalized)) return ["Stopping agent", "Stopped agent", "Stop failed"][position];
|
|
379
|
-
if (/list.?agents|taskoutput|wait.?agent/.test(normalized)) return ["Checking agents", "Checked agents", "Agent check failed"][position];
|
|
380
|
-
if (/get_command_or_subagent_output|write_stdin|^wait$/.test(normalized)) return ["Waiting for", "Checked", "Check failed"][position];
|
|
381
|
-
if (/web.?search/.test(normalized)) return ["Searching web", "Searched web", "Web search failed"][position];
|
|
382
|
-
if (/web.?fetch|fetch.?url/.test(normalized)) return ["Fetching page", "Fetched page", "Page fetch failed"][position];
|
|
383
|
-
if (/^skill$|use.?skill|load.?skill/.test(normalized)) return ["Loading skill", "Loaded skill", "Skill load failed"][position];
|
|
384
|
-
if (/taskcreate/.test(normalized)) return ["Adding task", "Added task", "Task creation failed"][position];
|
|
385
|
-
if (/taskupdate/.test(normalized)) return ["Updating task", "Updated task", "Task update failed"][position];
|
|
386
|
-
if (/create.?goal/.test(normalized)) return ["Creating goal", "Created goal", "Goal creation failed"][position];
|
|
387
|
-
if (/update.?goal/.test(normalized)) return ["Updating goal", "Updated goal", "Goal update failed"][position];
|
|
388
|
-
const actions = {
|
|
389
|
-
read: ["Reading", "Read", "Read failed"],
|
|
390
|
-
search: ["Searching", "Searched", "Search failed"],
|
|
391
|
-
edit: ["Editing", "Edited", "Edit failed"],
|
|
392
|
-
command: ["Running command", "Ran command", "Command failed"],
|
|
393
|
-
test: ["Running tests", "Ran tests", "Tests failed"],
|
|
394
|
-
web: ["Browsing", "Browsed", "Browser action failed"],
|
|
395
|
-
agent: ["Starting agent", "Started agent", "Agent failed"],
|
|
396
|
-
plan: ["Updating plan", "Updated plan", "Plan update failed"]
|
|
397
|
-
};
|
|
398
|
-
return actions[category]?.[position] ?? (status === "error" ? `${name} failed` : name.replaceAll(/[_-]+/g, " "));
|
|
399
|
-
}
|
|
400
|
-
function createToolPresentation(entry) {
|
|
401
|
-
const envelope = toolEnvelope(entry);
|
|
402
|
-
const args = envelope.args;
|
|
403
|
-
const outcome = toolResultEnvelope(entry.resultText);
|
|
404
|
-
const patchSource = assignedString(envelope.source, ["patch"]) || envelope.source;
|
|
405
|
-
const command = firstString(args, ["command", "cmd"]) || sourceString(envelope.callSource, ["command", "cmd"]);
|
|
406
|
-
const category = classifyTool(envelope.name, command || envelope.source || entry.arguments || "");
|
|
407
|
-
const path = firstString(args, ["file_path", "target_file", "target_directory", "path"]) || sourceString(envelope.callSource, ["file_path", "target_file", "target_directory", "path"]) || patchPath(patchSource);
|
|
408
|
-
const query = firstString(args, ["query", "pattern"]) || sourceString(envelope.callSource, ["query", "pattern", "q"]);
|
|
409
|
-
const url = firstString(args, ["url"]) || sourceString(envelope.callSource, ["url", "ref_id"]);
|
|
410
|
-
const subject = firstString(args, ["subject", "description", "summary", "task", "objective", "prompt"]) || sourceString(envelope.callSource, ["subject", "description", "summary", "task", "objective", "prompt"]);
|
|
411
|
-
const agentTarget = category === "agent" ? firstString(record(outcome.value), ["command", "name"]) || firstString(args, ["target", "task_name", "taskId", "task_id", "agentId", "agent_id", "resume", "team_name"]) || sourceString(envelope.callSource, ["target", "task_name", "taskId", "task_id", "agentId", "agent_id", "resume", "team_name"]) : "";
|
|
412
|
-
const skillTarget = /^skill$|use.?skill|load.?skill/i.test(envelope.name) ? firstString(args, ["skill", "name"]) || sourceString(envelope.callSource, ["skill", "name"]) : "";
|
|
413
|
-
const background = /get_command_or_subagent_output|kill_command_or_subagent/i.test(envelope.name) ? "background task" : /write_stdin|^wait$/i.test(envelope.name) ? "background command" : "";
|
|
414
|
-
const items = category === "agent" ? agentItems(envelope.name, outcome.preview) : planItems(args);
|
|
415
|
-
const taskId = firstString(args, ["taskId", "task_id"]);
|
|
416
|
-
const planTarget = category === "plan" ? items.length ? `${items.length} ${items.length === 1 ? "item" : "items"}` : taskId ? `task ${taskId}` : "" : "";
|
|
417
|
-
const target = path || command || query || url || subject || agentTarget || skillTarget || background || planTarget || (envelope.tools.length > 1 ? `${envelope.tools.length} coordinated actions` : toolTarget(entry.arguments));
|
|
418
|
-
const previewSource = category === "edit" ? editPreview(args, outcome.preview, patchSource) : category === "agent" ? semanticAgentPreview(envelope.name, entry.status ?? "completed", outcome) : outcome.preview;
|
|
419
|
-
const result = record(entry.resultContent);
|
|
420
|
-
const metadata = record(entry.metadata);
|
|
421
|
-
const resultMetadata = record(result?.metadata);
|
|
422
|
-
return {
|
|
423
|
-
name: boundedString(envelope.name, 120),
|
|
424
|
-
action: boundedString(toolAction(entry.status ?? "completed", category, envelope.name, envelope.tools), 120),
|
|
425
|
-
category,
|
|
426
|
-
detail: toolDetail(category),
|
|
427
|
-
target: boundedString(target, 300),
|
|
428
|
-
command: boundedString(command, MAX_TOOL_FIELD_CHARS),
|
|
429
|
-
path: boundedString(path, MAX_TOOL_FIELD_CHARS),
|
|
430
|
-
query: boundedString(query, MAX_TOOL_FIELD_CHARS),
|
|
431
|
-
url: boundedString(url, MAX_TOOL_FIELD_CHARS),
|
|
432
|
-
subject: boundedString(subject, MAX_TOOL_FIELD_CHARS),
|
|
433
|
-
preview: boundedString(previewSource, MAX_TOOL_PREVIEW_CHARS),
|
|
434
|
-
fields: usefulToolFields(args),
|
|
435
|
-
items,
|
|
436
|
-
tools: envelope.tools,
|
|
437
|
-
exitCode: explicitNumber([outcome.value, result, resultMetadata, metadata], ["exit_code", "exitCode", "pi_bash_exit_code"]),
|
|
438
|
-
durationMs: explicitNumber([outcome.value, result, resultMetadata, metadata], ["duration_ms", "durationMs", "elapsed_ms", "elapsedMs", "totalDurationMs"]) ?? outcome.durationMs,
|
|
439
|
-
additions: explicitNumber([result, resultMetadata, metadata], ["additions", "lines_added"]),
|
|
440
|
-
deletions: explicitNumber([result, resultMetadata, metadata], ["deletions", "lines_removed"]),
|
|
441
|
-
matches: explicitNumber([result, resultMetadata, metadata], ["matches", "match_count", "result_count"])
|
|
442
|
-
};
|
|
443
|
-
}
|
|
444
|
-
function harnessDisplayName(id) {
|
|
445
|
-
return HARNESS_NAMES[id] ?? id;
|
|
446
|
-
}
|
|
447
|
-
function sessionDisplayName(session) {
|
|
448
|
-
const title = session.title?.trim();
|
|
449
|
-
return title && title !== session.name ? title : session.name || "Untitled chat";
|
|
450
|
-
}
|
|
451
|
-
var ACTIVITY_PRIORITY = Object.freeze({
|
|
452
|
-
"needs-input": 70,
|
|
453
|
-
failed: 60,
|
|
454
|
-
working: 50,
|
|
455
|
-
unseen: 40,
|
|
456
|
-
finished: 30,
|
|
457
|
-
running: 20,
|
|
458
|
-
recent: 10,
|
|
459
|
-
idle: 0
|
|
460
|
-
});
|
|
461
|
-
function groupConversation(entries) {
|
|
462
|
-
const blocks = [];
|
|
463
|
-
for (const entry of entries) {
|
|
464
|
-
if (entry.role !== "tool") {
|
|
465
|
-
blocks.push({ kind: "entry", id: entry.id, entry });
|
|
466
|
-
continue;
|
|
467
|
-
}
|
|
468
|
-
const previous = blocks.at(-1);
|
|
469
|
-
if (previous?.kind === "activity") previous.entries.push(entry);
|
|
470
|
-
else blocks.push({ kind: "activity", id: `activity:${entry.id}`, entries: [entry] });
|
|
471
|
-
}
|
|
472
|
-
return blocks;
|
|
473
|
-
}
|
|
474
|
-
function toolCategory(entry) {
|
|
475
|
-
if (TOOL_CATEGORIES.has(entry.presentation?.category)) return entry.presentation.category;
|
|
476
|
-
const envelope = toolEnvelope(entry);
|
|
477
|
-
const command = firstString(envelope.args, ["command", "cmd"]) || sourceString(envelope.source, ["command", "cmd"]);
|
|
478
|
-
return classifyTool(envelope.name, command || envelope.source || entry.arguments || "");
|
|
479
|
-
}
|
|
480
|
-
function toolTarget(argumentsText) {
|
|
481
|
-
if (!argumentsText) return "";
|
|
482
|
-
try {
|
|
483
|
-
const args = JSON.parse(argumentsText);
|
|
484
|
-
for (const key of ["file_path", "target_file", "path", "command", "cmd", "query", "pattern", "url"]) {
|
|
485
|
-
if (typeof args?.[key] === "string") return args[key];
|
|
486
|
-
}
|
|
487
|
-
} catch {
|
|
488
|
-
return argumentsText.length > 120 ? `${argumentsText.slice(0, 117)}\u2026` : argumentsText;
|
|
489
|
-
}
|
|
490
|
-
return "";
|
|
491
|
-
}
|
|
492
|
-
function compactToolTarget(target, workspace) {
|
|
493
|
-
const prefix = workspace && !workspace.endsWith("/") ? `${workspace}/` : workspace;
|
|
494
|
-
return prefix && target.startsWith(prefix) ? target.slice(prefix.length) : target;
|
|
495
|
-
}
|
|
496
|
-
function activitySummary(entries) {
|
|
497
|
-
const counts = /* @__PURE__ */ new Map();
|
|
498
|
-
for (const entry of entries) counts.set(toolCategory(entry), (counts.get(toolCategory(entry)) ?? 0) + 1);
|
|
499
|
-
const failed = entries.filter((entry) => entry.status === "error").length;
|
|
500
|
-
const pending = entries.filter((entry) => entry.status === "pending").length;
|
|
501
|
-
if (pending) return `${entries.length} actions in progress`;
|
|
502
|
-
if (failed) return `${entries.length} actions \xB7 ${failed} failed`;
|
|
503
|
-
if ([...counts.keys()].every((key) => key === "read" || key === "search")) return `Explored ${entries.length} ${entries.length === 1 ? "item" : "items"}`;
|
|
504
|
-
const nouns = { read: ["read", "reads"], search: ["search", "searches"], edit: ["edit", "edits"], command: ["command", "commands"], test: ["test run", "test runs"], web: ["web action", "web actions"], agent: ["agent action", "agent actions"], plan: ["plan update", "plan updates"], other: ["action", "actions"] };
|
|
505
|
-
return [...counts.entries()].sort((a, b) => b[1] - a[1]).slice(0, 3).map(([category, count]) => `${count} ${nouns[category][count === 1 ? 0 : 1]}`).join(" \xB7 ");
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
// src/conversation.jsx
|
|
509
|
-
import { Fragment as Fragment3 } from "react";
|
|
510
|
-
import { useEffect as useEffect3, useId, useLayoutEffect, useRef as useRef3, useState as useState2 } from "react";
|
|
511
|
-
|
|
512
|
-
// src/markdown.jsx
|
|
513
|
-
import MarkdownIt from "markdown-it";
|
|
514
|
-
import { useEffect, useMemo, useRef } from "react";
|
|
515
|
-
import { jsx } from "react/jsx-runtime";
|
|
516
|
-
var markdown = new MarkdownIt({ html: false, linkify: true, breaks: false });
|
|
517
|
-
var LANGUAGE_LABELS = {
|
|
518
|
-
bash: "Shell",
|
|
519
|
-
css: "CSS",
|
|
520
|
-
html: "HTML",
|
|
521
|
-
js: "JavaScript",
|
|
522
|
-
javascript: "JavaScript",
|
|
523
|
-
jsx: "JSX",
|
|
524
|
-
md: "Markdown",
|
|
525
|
-
markdown: "Markdown",
|
|
526
|
-
py: "Python",
|
|
527
|
-
python: "Python",
|
|
528
|
-
rs: "Rust",
|
|
529
|
-
rust: "Rust",
|
|
530
|
-
sh: "Shell",
|
|
531
|
-
shell: "Shell",
|
|
532
|
-
ts: "TypeScript",
|
|
533
|
-
tsx: "TSX",
|
|
534
|
-
yaml: "YAML",
|
|
535
|
-
yml: "YAML",
|
|
536
|
-
json: "JSON",
|
|
537
|
-
jsonc: "JSONC",
|
|
538
|
-
sql: "SQL",
|
|
539
|
-
xml: "XML"
|
|
540
|
-
};
|
|
541
|
-
var COPY_ICON = '<svg viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="5" width="8" height="8" rx="1.5"></rect><path d="M3 10.5V4.25C3 3.56 3.56 3 4.25 3h6.25"></path></svg>';
|
|
542
|
-
function languageLabel(info) {
|
|
543
|
-
const language = info.trim().split(/\s+/, 1)[0]?.toLocaleLowerCase() ?? "";
|
|
544
|
-
if (!language) return "Code";
|
|
545
|
-
return LANGUAGE_LABELS[language] ?? language.toLocaleUpperCase();
|
|
546
|
-
}
|
|
547
|
-
function frameCode(render, tokens, index, options, env, self) {
|
|
548
|
-
const label = markdown.utils.escapeHtml(languageLabel(tokens[index]?.info ?? ""));
|
|
549
|
-
const body = render(tokens, index, options, env, self).replace(
|
|
550
|
-
"<pre>",
|
|
551
|
-
`<pre tabindex="0" role="region" aria-label="${label} code">`
|
|
552
|
-
);
|
|
553
|
-
return `<div class="scui-code-block"><div class="scui-code-head"><span>${label}</span><button class="scui-code-copy" type="button" aria-label="Copy code" title="Copy code">${COPY_ICON}<span>Copy</span></button></div>${body}</div>`;
|
|
554
|
-
}
|
|
555
|
-
for (const kind of ["fence", "code_block"]) {
|
|
556
|
-
const render = markdown.renderer.rules[kind];
|
|
557
|
-
markdown.renderer.rules[kind] = (tokens, index, options, env, self) => frameCode(render, tokens, index, options, env, self);
|
|
558
|
-
}
|
|
559
|
-
var defaultLinkOpen = markdown.renderer.rules.link_open;
|
|
560
|
-
markdown.renderer.rules.link_open = (tokens, index, options, env, self) => {
|
|
561
|
-
tokens[index]?.attrSet("target", "_blank");
|
|
562
|
-
tokens[index]?.attrSet("rel", "noreferrer noopener");
|
|
563
|
-
return defaultLinkOpen ? defaultLinkOpen(tokens, index, options, env, self) : self.renderToken(tokens, index, options);
|
|
564
|
-
};
|
|
565
|
-
function setCopyState(button, status) {
|
|
566
|
-
const labels = {
|
|
567
|
-
idle: ["Copy code", "Copy"],
|
|
568
|
-
copied: ["Code copied", "Copied"],
|
|
569
|
-
failed: ["Copy failed \xB7 retry", "Retry"]
|
|
570
|
-
};
|
|
571
|
-
const [label, visible] = labels[status];
|
|
572
|
-
button.dataset.status = status;
|
|
573
|
-
button.setAttribute("aria-label", label);
|
|
574
|
-
button.setAttribute("title", label);
|
|
575
|
-
const text = button.querySelector("span");
|
|
576
|
-
if (text) text.textContent = visible;
|
|
577
|
-
}
|
|
578
|
-
function Markdown({ value, copyText }) {
|
|
579
|
-
const html = useMemo(() => markdown.render(value), [value]);
|
|
580
|
-
const resets = useRef(/* @__PURE__ */ new Map());
|
|
581
|
-
useEffect(() => () => {
|
|
582
|
-
for (const timer of resets.current.values()) clearTimeout(timer);
|
|
583
|
-
resets.current.clear();
|
|
584
|
-
}, []);
|
|
585
|
-
const copyCode = async (event) => {
|
|
586
|
-
const button = event.target.closest?.(".scui-code-copy");
|
|
587
|
-
if (!button || !event.currentTarget.contains(button) || !copyText) return;
|
|
588
|
-
const code = button.closest(".scui-code-block")?.querySelector("pre code");
|
|
589
|
-
if (!code) return;
|
|
590
|
-
button.disabled = true;
|
|
591
|
-
try {
|
|
592
|
-
await copyText(code.textContent ?? "");
|
|
593
|
-
setCopyState(button, "copied");
|
|
594
|
-
} catch {
|
|
595
|
-
setCopyState(button, "failed");
|
|
596
|
-
} finally {
|
|
597
|
-
button.disabled = false;
|
|
598
|
-
}
|
|
599
|
-
clearTimeout(resets.current.get(button));
|
|
600
|
-
const timer = setTimeout(() => {
|
|
601
|
-
if (button.isConnected) setCopyState(button, "idle");
|
|
602
|
-
resets.current.delete(button);
|
|
603
|
-
}, 1500);
|
|
604
|
-
resets.current.set(button, timer);
|
|
605
|
-
};
|
|
606
|
-
return /* @__PURE__ */ jsx("div", { className: "scui-markdown", "data-copyable": Boolean(copyText), onClick: copyCode, dangerouslySetInnerHTML: { __html: html } });
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
// src/memory.js
|
|
610
|
-
var MEMORY_LIMIT = 100;
|
|
611
|
-
var registry = /* @__PURE__ */ new Set();
|
|
612
|
-
function uiMemory() {
|
|
613
|
-
const map = /* @__PURE__ */ new Map();
|
|
614
|
-
registry.add(map);
|
|
615
|
-
return map;
|
|
616
|
-
}
|
|
617
|
-
function boundedSet(map, key, value) {
|
|
618
|
-
map.delete(key);
|
|
619
|
-
map.set(key, value);
|
|
620
|
-
while (map.size > MEMORY_LIMIT) map.delete(map.keys().next().value);
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
// src/icon.jsx
|
|
624
|
-
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
625
|
-
var ICONS = {
|
|
626
|
-
agents: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
627
|
-
/* @__PURE__ */ jsx2("circle", { cx: "6", cy: "6.5", r: "2" }),
|
|
628
|
-
/* @__PURE__ */ jsx2("path", { d: "M2.75 13c.45-2 1.55-3 3.25-3s2.8 1 3.25 3" }),
|
|
629
|
-
/* @__PURE__ */ jsx2("circle", { cx: "12.25", cy: "7", r: "1.5" }),
|
|
630
|
-
/* @__PURE__ */ jsx2("path", { d: "M10.5 10.75c1.95-.65 3.45.1 4 2.25" })
|
|
631
|
-
] }),
|
|
632
|
-
attach: () => /* @__PURE__ */ jsx2("path", { d: "M6.25 9.75 10.6 5.4a2.1 2.1 0 0 1 2.97 2.97l-5.4 5.4a3.3 3.3 0 0 1-4.67-4.66l5.52-5.52" }),
|
|
633
|
-
back: () => /* @__PURE__ */ jsx2("path", { d: "m11.5 4.5-4.5 4.5 4.5 4.5" }),
|
|
634
|
-
check: () => /* @__PURE__ */ jsx2("path", { d: "m4 9 3.25 3.25L14 5.5" }),
|
|
635
|
-
chevron: () => /* @__PURE__ */ jsx2("path", { d: "m7 4.5 4.5 4.5L7 13.5" }),
|
|
636
|
-
close: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
637
|
-
/* @__PURE__ */ jsx2("path", { d: "m4.75 4.75 8.5 8.5" }),
|
|
638
|
-
/* @__PURE__ */ jsx2("path", { d: "m13.25 4.75-8.5 8.5" })
|
|
639
|
-
] }),
|
|
640
|
-
compose: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
641
|
-
/* @__PURE__ */ jsx2("path", { d: "M11.75 3.75 14.25 6.25 7 13.5l-3.25.75.75-3.25 7.25-7.25Z" }),
|
|
642
|
-
/* @__PURE__ */ jsx2("path", { d: "m10.5 5 2.5 2.5" })
|
|
643
|
-
] }),
|
|
644
|
-
copy: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
645
|
-
/* @__PURE__ */ jsx2("rect", { x: "5", y: "5", width: "8", height: "8", rx: "1.5" }),
|
|
646
|
-
/* @__PURE__ */ jsx2("path", { d: "M3 10.5V4.25C3 3.56 3.56 3 4.25 3h6.25" })
|
|
647
|
-
] }),
|
|
648
|
-
down: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
649
|
-
/* @__PURE__ */ jsx2("path", { d: "M9 3.5v10" }),
|
|
650
|
-
/* @__PURE__ */ jsx2("path", { d: "m4.75 9.5 4.25 4 4.25-4" })
|
|
651
|
-
] }),
|
|
652
|
-
image: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
653
|
-
/* @__PURE__ */ jsx2("rect", { x: "3", y: "3.5", width: "12", height: "11", rx: "1.75" }),
|
|
654
|
-
/* @__PURE__ */ jsx2("circle", { cx: "6.5", cy: "7", r: "1.25" }),
|
|
655
|
-
/* @__PURE__ */ jsx2("path", { d: "m4.5 13 3.25-3 2.1 1.85 1.65-1.5L14 13" })
|
|
656
|
-
] }),
|
|
657
|
-
menu: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
658
|
-
/* @__PURE__ */ jsx2("circle", { cx: "4", cy: "9", r: "1.25", fill: "currentColor", stroke: "none" }),
|
|
659
|
-
/* @__PURE__ */ jsx2("circle", { cx: "9", cy: "9", r: "1.25", fill: "currentColor", stroke: "none" }),
|
|
660
|
-
/* @__PURE__ */ jsx2("circle", { cx: "14", cy: "9", r: "1.25", fill: "currentColor", stroke: "none" })
|
|
661
|
-
] }),
|
|
662
|
-
plus: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
663
|
-
/* @__PURE__ */ jsx2("path", { d: "M9 3.5v11" }),
|
|
664
|
-
/* @__PURE__ */ jsx2("path", { d: "M3.5 9h11" })
|
|
665
|
-
] }),
|
|
666
|
-
search: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
667
|
-
/* @__PURE__ */ jsx2("circle", { cx: "7.75", cy: "7.75", r: "4.25" }),
|
|
668
|
-
/* @__PURE__ */ jsx2("path", { d: "m11 11 3.5 3.5" })
|
|
669
|
-
] }),
|
|
670
|
-
send: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
671
|
-
/* @__PURE__ */ jsx2("path", { d: "M9 14.5v-11" }),
|
|
672
|
-
/* @__PURE__ */ jsx2("path", { d: "m4.75 7.75 4.25-4.25 4.25 4.25" })
|
|
673
|
-
] }),
|
|
674
|
-
stop: () => /* @__PURE__ */ jsx2("rect", { x: "4.5", y: "4.5", width: "9", height: "9", rx: "1.5", fill: "currentColor", stroke: "none" })
|
|
675
|
-
};
|
|
676
|
-
function UiIcon({ name, size = 16, class: className = "" }) {
|
|
677
|
-
const Glyph = ICONS[name];
|
|
678
|
-
if (!Glyph) return null;
|
|
679
|
-
return /* @__PURE__ */ jsx2("svg", { className: `scui-icon ${className}`, style: { "--scui-icon-size": `${size}px` }, viewBox: "0 0 18 18", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx2(Glyph, {}) });
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
// src/context.jsx
|
|
683
|
-
import { useEffect as useEffect2, useRef as useRef2, useState } from "react";
|
|
684
|
-
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
685
|
-
var MAX_IMAGE_BYTES = 5 * 1024 * 1024;
|
|
686
|
-
var MAX_RESOLVED_IMAGE_BYTES = 16 * 1024 * 1024;
|
|
687
|
-
function imageFilename(label) {
|
|
688
|
-
const value = label.trim().replace(/[\\/:*?"<>|]+/g, "-");
|
|
689
|
-
return value || "image";
|
|
690
|
-
}
|
|
691
|
-
function ImageViewer({ items, index, adapter, onChange, onClose }) {
|
|
692
|
-
const dialog = useRef2(null);
|
|
693
|
-
const reset = useRef2(null);
|
|
694
|
-
const resolutions = useRef2(/* @__PURE__ */ new Map());
|
|
695
|
-
const alive = useRef2(true);
|
|
696
|
-
const [, redraw] = useState(0);
|
|
697
|
-
const [copyState, setCopyState2] = useState("idle");
|
|
698
|
-
const item = items[index];
|
|
699
|
-
const key = item?.reference ?? item?.url ?? `${item?.id ?? ""}:${index}`;
|
|
700
|
-
const resolution = item?.url ? null : resolutions.current.get(key);
|
|
701
|
-
const imageUrl = item?.url ?? (resolution?.status === "ready" ? resolution.url : null);
|
|
702
|
-
const remote = imageUrl?.startsWith("http://") || imageUrl?.startsWith("https://");
|
|
703
|
-
const resolve = (candidate, force = false) => {
|
|
704
|
-
if (candidate?.url || !candidate?.reference || !adapter?.resolveImage) return;
|
|
705
|
-
const candidateKey = candidate.reference;
|
|
706
|
-
const current = resolutions.current.get(candidateKey);
|
|
707
|
-
if (!force && (current?.status === "loading" || current?.status === "ready")) return;
|
|
708
|
-
if (current?.url) URL.revokeObjectURL(current.url);
|
|
709
|
-
resolutions.current.set(candidateKey, { status: "loading" });
|
|
710
|
-
redraw((value) => value + 1);
|
|
711
|
-
Promise.resolve().then(() => adapter.resolveImage(candidate)).then((blob) => {
|
|
712
|
-
if (!(blob instanceof Blob) || !blob.type.startsWith("image/")) throw new Error("The host returned an invalid image.");
|
|
713
|
-
if (blob.size > MAX_RESOLVED_IMAGE_BYTES) throw new Error("This image is too large to preview safely.");
|
|
714
|
-
if (!alive.current) return;
|
|
715
|
-
const url = URL.createObjectURL(blob);
|
|
716
|
-
resolutions.current.set(candidateKey, { status: "ready", url });
|
|
717
|
-
redraw((value) => value + 1);
|
|
718
|
-
}).catch((error) => {
|
|
719
|
-
if (!alive.current) return;
|
|
720
|
-
resolutions.current.set(candidateKey, {
|
|
721
|
-
status: "error",
|
|
722
|
-
message: error instanceof Error && error.message ? error.message : "Could not load this image."
|
|
723
|
-
});
|
|
724
|
-
redraw((value) => value + 1);
|
|
725
|
-
});
|
|
726
|
-
};
|
|
727
|
-
useEffect2(() => {
|
|
728
|
-
alive.current = true;
|
|
729
|
-
if (!dialog.current?.open) dialog.current?.showModal();
|
|
730
|
-
return () => {
|
|
731
|
-
alive.current = false;
|
|
732
|
-
clearTimeout(reset.current);
|
|
733
|
-
for (const value of resolutions.current.values()) if (value.url) URL.revokeObjectURL(value.url);
|
|
734
|
-
resolutions.current.clear();
|
|
735
|
-
};
|
|
736
|
-
}, []);
|
|
737
|
-
useEffect2(() => {
|
|
738
|
-
clearTimeout(reset.current);
|
|
739
|
-
setCopyState2("idle");
|
|
740
|
-
resolve(item);
|
|
741
|
-
}, [index, item?.reference]);
|
|
742
|
-
if (!item || !item.url && (!item.reference || !adapter?.resolveImage)) return null;
|
|
743
|
-
const move = (amount) => onChange((index + amount + items.length) % items.length);
|
|
744
|
-
const copy = async () => {
|
|
745
|
-
try {
|
|
746
|
-
await adapter.copyText(imageUrl);
|
|
747
|
-
setCopyState2("copied");
|
|
748
|
-
} catch {
|
|
749
|
-
setCopyState2("failed");
|
|
750
|
-
}
|
|
751
|
-
clearTimeout(reset.current);
|
|
752
|
-
reset.current = setTimeout(() => setCopyState2("idle"), 1500);
|
|
753
|
-
};
|
|
754
|
-
const close = () => dialog.current?.close();
|
|
755
|
-
return /* @__PURE__ */ jsxs2(
|
|
756
|
-
"dialog",
|
|
757
|
-
{
|
|
758
|
-
ref: dialog,
|
|
759
|
-
className: "scui-image-viewer",
|
|
760
|
-
"aria-label": `Image preview: ${item.label}`,
|
|
761
|
-
onClose,
|
|
762
|
-
onClick: (event) => {
|
|
763
|
-
if (event.target === event.currentTarget) close();
|
|
764
|
-
},
|
|
765
|
-
onKeyDown: (event) => {
|
|
766
|
-
if (items.length < 2 || !["ArrowLeft", "ArrowRight"].includes(event.key)) return;
|
|
767
|
-
event.preventDefault();
|
|
768
|
-
move(event.key === "ArrowLeft" ? -1 : 1);
|
|
769
|
-
},
|
|
770
|
-
children: [
|
|
771
|
-
/* @__PURE__ */ jsxs2("header", { children: [
|
|
772
|
-
/* @__PURE__ */ jsxs2("span", { children: [
|
|
773
|
-
/* @__PURE__ */ jsx3("strong", { children: item.label }),
|
|
774
|
-
items.length > 1 ? /* @__PURE__ */ jsxs2("small", { children: [
|
|
775
|
-
index + 1,
|
|
776
|
-
" of ",
|
|
777
|
-
items.length
|
|
778
|
-
] }) : null
|
|
779
|
-
] }),
|
|
780
|
-
/* @__PURE__ */ jsxs2("nav", { "aria-label": "Image actions", children: [
|
|
781
|
-
remote && adapter?.copyText ? /* @__PURE__ */ jsx3("button", { type: "button", "aria-label": copyState === "copied" ? "Image link copied" : copyState === "failed" ? "Could not copy image link" : "Copy image link", title: "Copy image link", "data-status": copyState, onClick: copy, children: /* @__PURE__ */ jsx3(UiIcon, { name: copyState === "copied" ? "check" : "copy", size: 16 }) }) : null,
|
|
782
|
-
imageUrl ? remote ? /* @__PURE__ */ jsx3("a", { href: imageUrl, target: "_blank", rel: "noreferrer", "aria-label": "Open original image", title: "Open original image", children: /* @__PURE__ */ jsx3(UiIcon, { name: "image", size: 16 }) }) : /* @__PURE__ */ jsx3("a", { href: imageUrl, download: imageFilename(item.label), "aria-label": "Download image", title: "Download image", children: /* @__PURE__ */ jsx3(UiIcon, { name: "down", size: 16 }) }) : null,
|
|
783
|
-
/* @__PURE__ */ jsx3("button", { type: "button", "aria-label": "Close image preview", title: "Close", onClick: close, children: /* @__PURE__ */ jsx3(UiIcon, { name: "close", size: 17 }) })
|
|
784
|
-
] })
|
|
785
|
-
] }),
|
|
786
|
-
/* @__PURE__ */ jsxs2("figure", { children: [
|
|
787
|
-
imageUrl ? /* @__PURE__ */ jsx3("img", { src: imageUrl, alt: item.label }) : resolution?.status === "error" ? /* @__PURE__ */ jsxs2("div", { className: "scui-image-resolution", role: "alert", children: [
|
|
788
|
-
/* @__PURE__ */ jsx3(UiIcon, { name: "image", size: 28 }),
|
|
789
|
-
/* @__PURE__ */ jsx3("strong", { children: "Could not load image" }),
|
|
790
|
-
/* @__PURE__ */ jsx3("small", { children: resolution.message }),
|
|
791
|
-
/* @__PURE__ */ jsx3("button", { type: "button", onClick: () => resolve(item, true), children: "Retry" })
|
|
792
|
-
] }) : /* @__PURE__ */ jsxs2("div", { className: "scui-image-resolution", role: "status", children: [
|
|
793
|
-
/* @__PURE__ */ jsx3("i", { className: "scui-control-spinner" }),
|
|
794
|
-
/* @__PURE__ */ jsx3("strong", { children: "Loading image\u2026" }),
|
|
795
|
-
/* @__PURE__ */ jsx3("small", { children: "The original stays out of the transcript payload." })
|
|
796
|
-
] }),
|
|
797
|
-
items.length > 1 ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
798
|
-
/* @__PURE__ */ jsx3("button", { type: "button", className: "scui-image-previous", "aria-label": "Previous image", onClick: () => move(-1), children: /* @__PURE__ */ jsx3(UiIcon, { name: "chevron", size: 19 }) }),
|
|
799
|
-
/* @__PURE__ */ jsx3("button", { type: "button", className: "scui-image-next", "aria-label": "Next image", onClick: () => move(1), children: /* @__PURE__ */ jsx3(UiIcon, { name: "chevron", size: 19 }) })
|
|
800
|
-
] }) : null
|
|
801
|
-
] })
|
|
802
|
-
]
|
|
803
|
-
}
|
|
804
|
-
);
|
|
805
|
-
}
|
|
806
|
-
function MessageImages({ items, adapter }) {
|
|
807
|
-
const [active, setActive] = useState(null);
|
|
808
|
-
const opener = useRef2(null);
|
|
809
|
-
if (!items?.length) return null;
|
|
810
|
-
const viewable = items.filter((item) => item.url || item.reference && adapter?.resolveImage);
|
|
811
|
-
const close = () => {
|
|
812
|
-
setActive(null);
|
|
813
|
-
requestAnimationFrame(() => opener.current?.focus({ preventScroll: true }));
|
|
814
|
-
};
|
|
815
|
-
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
816
|
-
/* @__PURE__ */ jsx3("div", { className: "scui-message-images", "aria-label": "Message images", children: items.map((item, index) => item.url ? /* @__PURE__ */ jsx3("button", { type: "button", "aria-label": `View image ${item.label}`, onClick: (event) => {
|
|
817
|
-
opener.current = event.currentTarget;
|
|
818
|
-
setActive(viewable.indexOf(item));
|
|
819
|
-
}, children: /* @__PURE__ */ jsx3("img", { src: item.url, alt: "" }) }, item.id ?? `${item.label}:${index}`) : item.reference && adapter?.resolveImage ? /* @__PURE__ */ jsxs2("button", { type: "button", "data-lazy": "true", "aria-label": `Load image ${item.label}`, onClick: (event) => {
|
|
820
|
-
opener.current = event.currentTarget;
|
|
821
|
-
setActive(viewable.indexOf(item));
|
|
822
|
-
}, children: [
|
|
823
|
-
/* @__PURE__ */ jsx3(UiIcon, { name: "image", size: 16 }),
|
|
824
|
-
/* @__PURE__ */ jsxs2("span", { children: [
|
|
825
|
-
/* @__PURE__ */ jsx3("strong", { children: item.label }),
|
|
826
|
-
/* @__PURE__ */ jsx3("small", { children: "Load preview" })
|
|
827
|
-
] })
|
|
828
|
-
] }, item.id ?? `${item.label}:${index}`) : /* @__PURE__ */ jsxs2("span", { "data-unavailable": "true", children: [
|
|
829
|
-
/* @__PURE__ */ jsx3(UiIcon, { name: "image", size: 14 }),
|
|
830
|
-
/* @__PURE__ */ jsxs2("span", { children: [
|
|
831
|
-
/* @__PURE__ */ jsx3("strong", { children: item.label }),
|
|
832
|
-
/* @__PURE__ */ jsx3("small", { children: "Preview unavailable" })
|
|
833
|
-
] })
|
|
834
|
-
] }, item.id ?? `${item.label}:${index}`)) }),
|
|
835
|
-
active !== null && viewable[active] ? /* @__PURE__ */ jsx3(ImageViewer, { items: viewable, index: active, adapter, onChange: setActive, onClose: close }) : null
|
|
836
|
-
] });
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
// src/conversation.jsx
|
|
840
|
-
import { Fragment as Fragment4, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
841
|
-
function LoadingStatus({ state, compact = false }) {
|
|
842
|
-
const copy = {
|
|
843
|
-
connecting: ["Connecting to coding agents", "Checking installed harnesses and capabilities.", 0],
|
|
844
|
-
starting: [`Starting ${harnessDisplayName(state.harness) || "coding agent"}`, "Opening a controlled session in this workspace.", 1],
|
|
845
|
-
discovering: ["Loading recent sessions", "Scanning native session stores without loading full transcripts.", 2],
|
|
846
|
-
ready: ["Ready", "Coding sessions are up to date.", 3]
|
|
847
|
-
}[state.startup];
|
|
848
|
-
return /* @__PURE__ */ jsxs3("div", { className: `scui-loading${compact ? " scui-loading-compact" : ""}`, role: "status", "aria-busy": state.startup !== "ready", children: [
|
|
849
|
-
/* @__PURE__ */ jsx4("span", { className: "scui-orbit", "aria-hidden": "true", children: /* @__PURE__ */ jsx4("i", {}) }),
|
|
850
|
-
/* @__PURE__ */ jsxs3("span", { className: "scui-loading-copy", children: [
|
|
851
|
-
/* @__PURE__ */ jsx4("strong", { children: copy[0] }),
|
|
852
|
-
/* @__PURE__ */ jsx4("small", { children: copy[1] })
|
|
853
|
-
] }),
|
|
854
|
-
/* @__PURE__ */ jsx4("span", { className: "scui-progress", "aria-hidden": "true", children: [1, 2, 3].map((step) => /* @__PURE__ */ jsx4("i", { "data-progress": step <= copy[2] ? "done" : step === copy[2] + 1 ? "current" : "waiting" }, step)) })
|
|
855
|
-
] });
|
|
856
|
-
}
|
|
857
|
-
function RequestCard({ entry, adapter, canRespond }) {
|
|
858
|
-
const request = entry.request;
|
|
859
|
-
if (!request) return null;
|
|
860
|
-
if (request.status === "responded") {
|
|
861
|
-
return /* @__PURE__ */ jsxs3("div", { className: "scui-request-done", children: [
|
|
862
|
-
"\u2713 Request answered \xB7 ",
|
|
863
|
-
request.resolution?.name ?? request.requestKind
|
|
864
|
-
] });
|
|
865
|
-
}
|
|
866
|
-
return /* @__PURE__ */ jsxs3("section", { className: "scui-request", role: "alert", "aria-label": `${request.requestKind} needs input`, children: [
|
|
867
|
-
/* @__PURE__ */ jsx4("strong", { children: "Agent needs input" }),
|
|
868
|
-
/* @__PURE__ */ jsx4(Markdown, { value: request.payloadText || entry.text, copyText: adapter?.copyText }),
|
|
869
|
-
/* @__PURE__ */ jsxs3("div", { className: "scui-request-actions", children: [
|
|
870
|
-
request.options.map((option) => /* @__PURE__ */ jsx4("button", { type: "button", disabled: !canRespond, onClick: () => adapter.onIntent({ action: "respond", requestId: request.requestId, optionId: option.optionId }), children: option.name }, option.optionId)),
|
|
871
|
-
request.cancellable ? /* @__PURE__ */ jsx4("button", { type: "button", disabled: !canRespond, onClick: () => adapter.onIntent({ action: "respond", requestId: request.requestId, optionId: null }), children: "Cancel" }) : null
|
|
872
|
-
] })
|
|
873
|
-
] });
|
|
874
|
-
}
|
|
875
|
-
function ContextDisclosure({ context }) {
|
|
876
|
-
if (!context?.length) return null;
|
|
877
|
-
return /* @__PURE__ */ jsxs3("details", { className: "scui-context", children: [
|
|
878
|
-
/* @__PURE__ */ jsxs3("summary", { children: [
|
|
879
|
-
"Context \xB7 ",
|
|
880
|
-
context.length
|
|
881
|
-
] }),
|
|
882
|
-
/* @__PURE__ */ jsx4("div", { children: context.map((item, index) => /* @__PURE__ */ jsxs3("p", { children: [
|
|
883
|
-
/* @__PURE__ */ jsx4("strong", { children: item.label }),
|
|
884
|
-
/* @__PURE__ */ jsx4("span", { children: item.detail })
|
|
885
|
-
] }, item.id ?? index)) })
|
|
886
|
-
] });
|
|
887
|
-
}
|
|
888
|
-
function MessageMeta({ entry, adapter }) {
|
|
889
|
-
const [copyState, setCopyState2] = useState2("idle");
|
|
890
|
-
const reset = useRef3(null);
|
|
891
|
-
useEffect3(() => () => clearTimeout(reset.current), []);
|
|
892
|
-
const date = entry.ts === null ? null : new Date(entry.ts);
|
|
893
|
-
const validDate = date && Number.isFinite(date.valueOf()) ? date : null;
|
|
894
|
-
if (!validDate && (!adapter?.copyText || !entry.text)) return null;
|
|
895
|
-
const copy = async () => {
|
|
896
|
-
try {
|
|
897
|
-
await adapter.copyText(entry.text);
|
|
898
|
-
setCopyState2("copied");
|
|
899
|
-
} catch {
|
|
900
|
-
setCopyState2("failed");
|
|
901
|
-
}
|
|
902
|
-
clearTimeout(reset.current);
|
|
903
|
-
reset.current = setTimeout(() => setCopyState2("idle"), 1500);
|
|
904
|
-
};
|
|
905
|
-
const copyLabel = copyState === "copied" ? "Message copied" : copyState === "failed" ? "Copy failed \xB7 retry" : "Copy message";
|
|
906
|
-
return /* @__PURE__ */ jsxs3("footer", { className: "scui-message-meta", children: [
|
|
907
|
-
validDate ? /* @__PURE__ */ jsx4("time", { dateTime: validDate.toISOString(), title: validDate.toLocaleString(), children: validDate.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) }) : null,
|
|
908
|
-
adapter?.copyText && entry.text ? /* @__PURE__ */ jsx4("button", { type: "button", "aria-label": copyLabel, title: copyLabel, onClick: copy, "data-status": copyState, children: /* @__PURE__ */ jsx4(UiIcon, { name: "copy", size: 13 }) }) : null
|
|
909
|
-
] });
|
|
910
|
-
}
|
|
911
|
-
var TOOL_ICONS = {
|
|
912
|
-
read: () => /* @__PURE__ */ jsxs3(Fragment4, { children: [
|
|
913
|
-
/* @__PURE__ */ jsx4("path", { d: "M5 2.75h7.25L15 5.5v7.75A1.75 1.75 0 0 1 13.25 15h-8.5A1.75 1.75 0 0 1 3 13.25v-8.5A2 2 0 0 1 5 2.75Z" }),
|
|
914
|
-
/* @__PURE__ */ jsx4("path", { d: "M12 2.9v3h2.85M6 9h6M6 12h4" })
|
|
915
|
-
] }),
|
|
916
|
-
search: () => /* @__PURE__ */ jsxs3(Fragment4, { children: [
|
|
917
|
-
/* @__PURE__ */ jsx4("circle", { cx: "8", cy: "8", r: "4.5" }),
|
|
918
|
-
/* @__PURE__ */ jsx4("path", { d: "m11.5 11.5 3 3" })
|
|
919
|
-
] }),
|
|
920
|
-
edit: () => /* @__PURE__ */ jsxs3(Fragment4, { children: [
|
|
921
|
-
/* @__PURE__ */ jsx4("path", { d: "m11.75 3.25 3 3-8.5 8.5-3.75.75.75-3.75 8.5-8.5Z" }),
|
|
922
|
-
/* @__PURE__ */ jsx4("path", { d: "m10 5 3 3" })
|
|
923
|
-
] }),
|
|
924
|
-
command: () => /* @__PURE__ */ jsx4(Fragment4, { children: /* @__PURE__ */ jsx4("path", { d: "m3 5 3 3-3 3M8 12h6" }) }),
|
|
925
|
-
test: () => /* @__PURE__ */ jsxs3(Fragment4, { children: [
|
|
926
|
-
/* @__PURE__ */ jsx4("path", { d: "M6 2.5v3L3 12a2 2 0 0 0 1.8 3h8.4a2 2 0 0 0 1.8-3l-3-6.5v-3M5 9h8" }),
|
|
927
|
-
/* @__PURE__ */ jsx4("path", { d: "M5 2.5h8" })
|
|
928
|
-
] }),
|
|
929
|
-
web: () => /* @__PURE__ */ jsxs3(Fragment4, { children: [
|
|
930
|
-
/* @__PURE__ */ jsx4("circle", { cx: "9", cy: "9", r: "6.5" }),
|
|
931
|
-
/* @__PURE__ */ jsx4("path", { d: "M2.75 9h12.5M9 2.5c2 1.8 3 4 3 6.5s-1 4.7-3 6.5c-2-1.8-3-4-3-6.5s1-4.7 3-6.5Z" })
|
|
932
|
-
] }),
|
|
933
|
-
agent: () => /* @__PURE__ */ jsxs3(Fragment4, { children: [
|
|
934
|
-
/* @__PURE__ */ jsx4("circle", { cx: "9", cy: "6", r: "2.5" }),
|
|
935
|
-
/* @__PURE__ */ jsx4("path", { d: "M4 15c.4-3 2-4.5 5-4.5s4.6 1.5 5 4.5" })
|
|
936
|
-
] }),
|
|
937
|
-
plan: () => /* @__PURE__ */ jsx4(Fragment4, { children: /* @__PURE__ */ jsx4("path", { d: "m3 5 1 1 2-2M3 9l1 1 2-2M3 13l1 1 2-2M8 5h7M8 9h7M8 13h7" }) }),
|
|
938
|
-
other: () => /* @__PURE__ */ jsxs3(Fragment4, { children: [
|
|
939
|
-
/* @__PURE__ */ jsx4("path", { d: "M9 2.5v3M9 12.5v3M2.5 9h3M12.5 9h3" }),
|
|
940
|
-
/* @__PURE__ */ jsx4("circle", { cx: "9", cy: "9", r: "3.5" })
|
|
941
|
-
] })
|
|
942
|
-
};
|
|
943
|
-
function ToolIcon({ category }) {
|
|
944
|
-
const Glyph = TOOL_ICONS[category] ?? TOOL_ICONS.other;
|
|
945
|
-
return /* @__PURE__ */ jsx4("svg", { className: "scui-tool-icon", viewBox: "0 0 18 18", fill: "none", stroke: "currentColor", strokeWidth: "1.35", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx4(Glyph, {}) });
|
|
946
|
-
}
|
|
947
|
-
function toolAction2(entry, category, presentation) {
|
|
948
|
-
if (presentation?.action) return presentation.action;
|
|
949
|
-
const status = entry.status ?? "completed";
|
|
950
|
-
const actions = {
|
|
951
|
-
read: ["Reading", "Read", "Read failed"],
|
|
952
|
-
search: ["Searching", "Searched", "Search failed"],
|
|
953
|
-
edit: ["Editing", "Edited", "Edit failed"],
|
|
954
|
-
command: ["Running command", "Ran command", "Command failed"],
|
|
955
|
-
test: ["Running tests", "Ran tests", "Tests failed"],
|
|
956
|
-
web: ["Browsing", "Browsed", "Browser action failed"],
|
|
957
|
-
agent: ["Starting agent", "Started agent", "Agent failed"],
|
|
958
|
-
plan: ["Updating plan", "Updated plan", "Plan update failed"]
|
|
959
|
-
};
|
|
960
|
-
const position = status === "pending" ? 0 : status === "error" ? 2 : 1;
|
|
961
|
-
if (actions[category]) return actions[category][position];
|
|
962
|
-
const label = entry.label?.split(/__|\//).at(-1)?.replaceAll(/[_-]+/g, " ") || "Tool";
|
|
963
|
-
return status === "error" ? `${label} failed` : label;
|
|
964
|
-
}
|
|
965
|
-
function argumentLabel(key) {
|
|
966
|
-
const labels = { cmd: "Command", command: "Command", cwd: "Working directory", file_path: "File", target_file: "File", path: "Path", query: "Query", pattern: "Pattern", url: "URL" };
|
|
967
|
-
return labels[key] ?? key.replaceAll(/[_-]+/g, " ").replace(/^./, (letter) => letter.toLocaleUpperCase());
|
|
968
|
-
}
|
|
969
|
-
function argumentRows(argumentsText) {
|
|
970
|
-
if (!argumentsText) return [];
|
|
971
|
-
try {
|
|
972
|
-
const value = JSON.parse(argumentsText);
|
|
973
|
-
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
974
|
-
return Object.entries(value).map(([key, item]) => ({
|
|
975
|
-
key,
|
|
976
|
-
label: argumentLabel(key),
|
|
977
|
-
value: typeof item === "string" ? item : JSON.stringify(item, null, 2)
|
|
978
|
-
}));
|
|
979
|
-
}
|
|
980
|
-
} catch {
|
|
981
|
-
}
|
|
982
|
-
return [{ key: "arguments", label: "Details", value: argumentsText }];
|
|
983
|
-
}
|
|
984
|
-
function stripAnsi(value) {
|
|
985
|
-
return value?.replaceAll(/[\u001B\u009B][[\]()#;?]*(?:(?:(?:[a-zA-Z\d]*(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*)?\u0007)|(?:(?:\d{1,4}(?:[;:]\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))/g, "") ?? "";
|
|
986
|
-
}
|
|
987
|
-
function formatDuration(value) {
|
|
988
|
-
if (value === null) return "";
|
|
989
|
-
if (value < 1e3) return `${Math.round(value)}ms`;
|
|
990
|
-
return `${(value / 1e3).toFixed(value < 1e4 ? 1 : 0)}s`;
|
|
991
|
-
}
|
|
992
|
-
function ToolMetrics({ presentation }) {
|
|
993
|
-
const metrics = [
|
|
994
|
-
presentation.matches === null ? "" : `${presentation.matches} ${presentation.matches === 1 ? "match" : "matches"}`,
|
|
995
|
-
presentation.additions === null ? "" : `+${presentation.additions}`,
|
|
996
|
-
presentation.deletions === null ? "" : `\u2212${presentation.deletions}`,
|
|
997
|
-
presentation.exitCode === null ? "" : `exit ${presentation.exitCode}`,
|
|
998
|
-
formatDuration(presentation.durationMs)
|
|
999
|
-
].filter(Boolean);
|
|
1000
|
-
return metrics.length ? /* @__PURE__ */ jsx4("div", { className: "scui-tool-metrics", children: metrics.map((metric) => /* @__PURE__ */ jsx4("span", { children: metric }, metric)) }) : null;
|
|
1001
|
-
}
|
|
1002
|
-
function PendingElapsed({ now }) {
|
|
1003
|
-
const clock = now ?? Date.now;
|
|
1004
|
-
const started = useRef3(clock());
|
|
1005
|
-
const [elapsed, setElapsed] = useState2(0);
|
|
1006
|
-
useEffect3(() => {
|
|
1007
|
-
const timer = setInterval(() => setElapsed(Math.max(0, clock() - started.current)), 1e3);
|
|
1008
|
-
return () => clearInterval(timer);
|
|
1009
|
-
}, [clock]);
|
|
1010
|
-
return /* @__PURE__ */ jsx4("small", { className: "scui-tool-elapsed", children: elapsed < 1e3 ? "now" : formatDuration(elapsed) });
|
|
1011
|
-
}
|
|
1012
|
-
function LinePreview({ value, kind }) {
|
|
1013
|
-
if (!value) return null;
|
|
1014
|
-
return /* @__PURE__ */ jsx4("ol", { className: "scui-code-preview", "data-kind": kind, children: stripAnsi(value).split("\n").map((line, index) => {
|
|
1015
|
-
const tone = kind === "diff" ? line.startsWith("+") && !line.startsWith("+++") ? "add" : line.startsWith("-") && !line.startsWith("---") ? "remove" : line.startsWith("@@") ? "hunk" : "plain" : "plain";
|
|
1016
|
-
return /* @__PURE__ */ jsxs3("li", { "data-tone": tone, children: [
|
|
1017
|
-
/* @__PURE__ */ jsx4("span", { children: index + 1 }),
|
|
1018
|
-
/* @__PURE__ */ jsx4("code", { children: line || " " })
|
|
1019
|
-
] }, index);
|
|
1020
|
-
}) });
|
|
1021
|
-
}
|
|
1022
|
-
function TerminalPreview({ presentation, pending, failed }) {
|
|
1023
|
-
return /* @__PURE__ */ jsxs3("section", { className: "scui-terminal", children: [
|
|
1024
|
-
/* @__PURE__ */ jsxs3("header", { children: [
|
|
1025
|
-
/* @__PURE__ */ jsxs3("span", { "aria-hidden": "true", children: [
|
|
1026
|
-
/* @__PURE__ */ jsx4("i", {}),
|
|
1027
|
-
/* @__PURE__ */ jsx4("i", {}),
|
|
1028
|
-
/* @__PURE__ */ jsx4("i", {})
|
|
1029
|
-
] }),
|
|
1030
|
-
/* @__PURE__ */ jsx4("code", { children: presentation.command ? `$ ${presentation.command}` : "Terminal" })
|
|
1031
|
-
] }),
|
|
1032
|
-
presentation.preview ? /* @__PURE__ */ jsx4("pre", { "data-error": failed, children: stripAnsi(presentation.preview) }) : pending ? /* @__PURE__ */ jsxs3("div", { className: "scui-terminal-wait", children: [
|
|
1033
|
-
/* @__PURE__ */ jsx4("i", {}),
|
|
1034
|
-
" Waiting for output"
|
|
1035
|
-
] }) : /* @__PURE__ */ jsx4("div", { className: "scui-terminal-empty", children: "No output" })
|
|
1036
|
-
] });
|
|
1037
|
-
}
|
|
1038
|
-
function SearchPreview({ presentation }) {
|
|
1039
|
-
const lines = stripAnsi(presentation.preview).split("\n").filter(Boolean);
|
|
1040
|
-
return /* @__PURE__ */ jsxs3("section", { className: "scui-search-preview", children: [
|
|
1041
|
-
presentation.query ? /* @__PURE__ */ jsxs3("header", { children: [
|
|
1042
|
-
/* @__PURE__ */ jsx4("span", { children: "Search" }),
|
|
1043
|
-
/* @__PURE__ */ jsx4("code", { children: presentation.query })
|
|
1044
|
-
] }) : null,
|
|
1045
|
-
lines.length ? /* @__PURE__ */ jsx4("ol", { children: lines.map((line, index) => {
|
|
1046
|
-
const match = /^(.*?):(\d+)(?::(\d+))?:(.*)$/.exec(line);
|
|
1047
|
-
return /* @__PURE__ */ jsx4("li", { children: match ? /* @__PURE__ */ jsxs3(Fragment4, { children: [
|
|
1048
|
-
/* @__PURE__ */ jsx4("code", { children: match[1] }),
|
|
1049
|
-
/* @__PURE__ */ jsxs3("small", { children: [
|
|
1050
|
-
match[2],
|
|
1051
|
-
match[3] ? `:${match[3]}` : ""
|
|
1052
|
-
] }),
|
|
1053
|
-
/* @__PURE__ */ jsx4("span", { children: match[4] })
|
|
1054
|
-
] }) : /* @__PURE__ */ jsx4("span", { children: line }) }, index);
|
|
1055
|
-
}) }) : /* @__PURE__ */ jsx4("p", { children: "No textual results" })
|
|
1056
|
-
] });
|
|
1057
|
-
}
|
|
1058
|
-
function ToolPreview({ presentation, entry }) {
|
|
1059
|
-
const pending = entry.status === "pending";
|
|
1060
|
-
const failed = entry.status === "error";
|
|
1061
|
-
if (presentation.detail === "terminal") return /* @__PURE__ */ jsx4(TerminalPreview, { presentation, pending, failed });
|
|
1062
|
-
if (presentation.detail === "diff") return presentation.preview ? /* @__PURE__ */ jsx4(LinePreview, { value: presentation.preview, kind: "diff" }) : /* @__PURE__ */ jsx4("div", { className: "scui-tool-empty", children: "Edit completed without a textual diff" });
|
|
1063
|
-
if (presentation.detail === "file") return presentation.preview ? /* @__PURE__ */ jsx4(LinePreview, { value: presentation.preview, kind: "file" }) : /* @__PURE__ */ jsx4("div", { className: "scui-tool-empty", children: "File contents were not included in this event" });
|
|
1064
|
-
if (presentation.detail === "matches") return /* @__PURE__ */ jsx4(SearchPreview, { presentation });
|
|
1065
|
-
if (presentation.detail === "web") return /* @__PURE__ */ jsxs3("section", { className: "scui-web-preview", children: [
|
|
1066
|
-
presentation.url ? /* @__PURE__ */ jsx4("code", { children: presentation.url }) : null,
|
|
1067
|
-
presentation.preview ? /* @__PURE__ */ jsx4("p", { children: stripAnsi(presentation.preview) }) : /* @__PURE__ */ jsx4("small", { children: pending ? "Waiting for the page" : "No page summary returned" })
|
|
1068
|
-
] });
|
|
1069
|
-
if (presentation.detail === "agent") return /* @__PURE__ */ jsx4("section", { className: "scui-agent-preview", children: presentation.items?.length ? /* @__PURE__ */ jsx4("ol", { className: "scui-agent-roster", children: presentation.items.map((item, index) => /* @__PURE__ */ jsxs3("li", { children: [
|
|
1070
|
-
/* @__PURE__ */ jsx4("strong", { children: item.label }),
|
|
1071
|
-
/* @__PURE__ */ jsx4("small", { children: item.status })
|
|
1072
|
-
] }, `${item.label}:${index}`)) }) : presentation.preview ? /* @__PURE__ */ jsx4("pre", { children: stripAnsi(presentation.preview) }) : /* @__PURE__ */ jsx4("small", { children: pending ? "Agent is working" : "No textual handoff returned" }) });
|
|
1073
|
-
if (presentation.detail === "plan") return /* @__PURE__ */ jsx4("ol", { className: "scui-plan-preview", children: presentation.items?.map((item, index) => /* @__PURE__ */ jsxs3("li", { "data-status": item.status, children: [
|
|
1074
|
-
/* @__PURE__ */ jsx4("i", { "aria-hidden": "true" }),
|
|
1075
|
-
/* @__PURE__ */ jsx4("span", { children: item.label })
|
|
1076
|
-
] }, `${item.label}:${index}`)) });
|
|
1077
|
-
return presentation.preview ? /* @__PURE__ */ jsx4("pre", { className: "scui-tool-output", "data-error": failed, children: stripAnsi(presentation.preview) }) : null;
|
|
1078
|
-
}
|
|
1079
|
-
function ToolActions({ presentation, adapter }) {
|
|
1080
|
-
const [copied, setCopied] = useState2(false);
|
|
1081
|
-
const reset = useRef3(null);
|
|
1082
|
-
useEffect3(() => () => clearTimeout(reset.current), []);
|
|
1083
|
-
if (!adapter?.copyText) return null;
|
|
1084
|
-
const action = presentation.command ? ["Copy command", presentation.command] : presentation.path ? ["Copy path", presentation.path] : presentation.url ? ["Copy URL", presentation.url] : presentation.query ? ["Copy query", presentation.query] : null;
|
|
1085
|
-
const copy = async () => {
|
|
1086
|
-
await adapter.copyText(action[1]);
|
|
1087
|
-
setCopied(true);
|
|
1088
|
-
clearTimeout(reset.current);
|
|
1089
|
-
reset.current = setTimeout(() => setCopied(false), 1500);
|
|
1090
|
-
};
|
|
1091
|
-
return action ? /* @__PURE__ */ jsx4("div", { className: "scui-tool-actions", children: /* @__PURE__ */ jsx4("button", { type: "button", onClick: copy, children: copied ? "Copied" : action[0] }) }) : null;
|
|
1092
|
-
}
|
|
1093
|
-
function ToolStack({ tools }) {
|
|
1094
|
-
if (tools.length < 2) return null;
|
|
1095
|
-
return /* @__PURE__ */ jsx4("div", { className: "scui-tool-stack", "aria-label": "Coordinated tools", children: tools.map((tool) => /* @__PURE__ */ jsx4("span", { children: tool.replaceAll("__", " \xB7 ").replaceAll("_", " ") }, tool)) });
|
|
1096
|
-
}
|
|
1097
|
-
function TechnicalDetails({ entry }) {
|
|
1098
|
-
if (!entry.arguments && !entry.resultText) return null;
|
|
1099
|
-
return /* @__PURE__ */ jsxs3("details", { className: "scui-tool-technical", children: [
|
|
1100
|
-
/* @__PURE__ */ jsx4("summary", { children: "Technical details" }),
|
|
1101
|
-
/* @__PURE__ */ jsxs3("div", { children: [
|
|
1102
|
-
entry.arguments ? /* @__PURE__ */ jsxs3("section", { children: [
|
|
1103
|
-
/* @__PURE__ */ jsx4("strong", { children: "Native arguments" }),
|
|
1104
|
-
/* @__PURE__ */ jsx4("dl", { children: argumentRows(entry.arguments).map((row) => /* @__PURE__ */ jsxs3("div", { children: [
|
|
1105
|
-
/* @__PURE__ */ jsx4("dt", { children: row.label }),
|
|
1106
|
-
/* @__PURE__ */ jsx4("dd", { children: /* @__PURE__ */ jsx4("pre", { children: row.value }) })
|
|
1107
|
-
] }, row.key)) })
|
|
1108
|
-
] }) : null,
|
|
1109
|
-
entry.resultText ? /* @__PURE__ */ jsxs3("section", { children: [
|
|
1110
|
-
/* @__PURE__ */ jsx4("strong", { children: "Native result" }),
|
|
1111
|
-
/* @__PURE__ */ jsxs3("pre", { "data-error": entry.status === "error", children: [
|
|
1112
|
-
entry.resultText,
|
|
1113
|
-
entry.truncated ? "\n[truncated]" : ""
|
|
1114
|
-
] })
|
|
1115
|
-
] }) : null
|
|
1116
|
-
] })
|
|
1117
|
-
] });
|
|
1118
|
-
}
|
|
1119
|
-
function TranscriptEntry({ entry, state, adapter }) {
|
|
1120
|
-
if (entry.role === "opaque") {
|
|
1121
|
-
return /* @__PURE__ */ jsxs3("article", { className: "scui-message scui-opaque", "data-role": "opaque", "data-kind": entry.kind, "aria-label": "Unrecognized entry", children: [
|
|
1122
|
-
/* @__PURE__ */ jsxs3("div", { className: "scui-notice", "data-code": "opaque-entry", children: [
|
|
1123
|
-
"Unrecognized entry kind ",
|
|
1124
|
-
/* @__PURE__ */ jsx4("code", { children: entry.kind }),
|
|
1125
|
-
" \u2014 kept as-is, nothing dropped"
|
|
1126
|
-
] }),
|
|
1127
|
-
entry.text ? /* @__PURE__ */ jsx4(Markdown, { value: entry.text, copyText: adapter?.copyText }) : null,
|
|
1128
|
-
entry.raw ? /* @__PURE__ */ jsxs3("details", { className: "scui-tool-technical", children: [
|
|
1129
|
-
/* @__PURE__ */ jsx4("summary", { children: "Technical details" }),
|
|
1130
|
-
/* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */ jsxs3("section", { children: [
|
|
1131
|
-
/* @__PURE__ */ jsx4("strong", { children: "Raw entry" }),
|
|
1132
|
-
/* @__PURE__ */ jsxs3("pre", { children: [
|
|
1133
|
-
entry.raw,
|
|
1134
|
-
entry.truncated ? "\n[truncated]" : ""
|
|
1135
|
-
] })
|
|
1136
|
-
] }) })
|
|
1137
|
-
] }) : null
|
|
1138
|
-
] });
|
|
1139
|
-
}
|
|
1140
|
-
if (entry.role === "request") return /* @__PURE__ */ jsx4(RequestCard, { entry, adapter, canRespond: state.canRespond });
|
|
1141
|
-
if (entry.role === "reasoning") {
|
|
1142
|
-
return /* @__PURE__ */ jsxs3("details", { className: "scui-reasoning", open: entry.streaming, children: [
|
|
1143
|
-
/* @__PURE__ */ jsx4("summary", { children: entry.streaming ? "Reasoning\u2026" : "Reasoning" }),
|
|
1144
|
-
/* @__PURE__ */ jsx4(Markdown, { value: entry.text, copyText: adapter?.copyText })
|
|
1145
|
-
] });
|
|
1146
|
-
}
|
|
1147
|
-
if (entry.role === "notice" || entry.role === "system") return /* @__PURE__ */ jsx4("div", { className: "scui-notice", "data-code": entry.code, children: entry.text });
|
|
1148
|
-
return /* @__PURE__ */ jsxs3("article", { className: "scui-message", "data-role": entry.role, "aria-label": `${entry.role === "user" ? "Your" : "Assistant"} message`, children: [
|
|
1149
|
-
/* @__PURE__ */ jsx4(MessageImages, { items: entry.images, adapter }),
|
|
1150
|
-
/* @__PURE__ */ jsx4(Markdown, { value: entry.text, copyText: adapter?.copyText }),
|
|
1151
|
-
/* @__PURE__ */ jsx4(ContextDisclosure, { context: entry.context }),
|
|
1152
|
-
entry.truncated ? /* @__PURE__ */ jsx4("small", { className: "scui-truncated", children: "Entry truncated by host \xB7 load native session for the complete value" }) : null,
|
|
1153
|
-
/* @__PURE__ */ jsx4(MessageMeta, { entry, adapter })
|
|
1154
|
-
] });
|
|
1155
|
-
}
|
|
1156
|
-
function ToolRow({ entry, workspace, open = false, adapter }) {
|
|
1157
|
-
const presentation = entry.presentation ?? createToolPresentation(entry);
|
|
1158
|
-
const [expanded, setExpanded] = useState2(open || entry.status === "pending");
|
|
1159
|
-
useEffect3(() => {
|
|
1160
|
-
if (entry.status === "pending") setExpanded(true);
|
|
1161
|
-
}, [entry.status]);
|
|
1162
|
-
const target = compactToolTarget(presentation.target, workspace);
|
|
1163
|
-
const hasDetail = Boolean(entry.arguments || entry.resultText || presentation.preview || presentation.fields.length);
|
|
1164
|
-
const category = presentation.category ?? toolCategory(entry);
|
|
1165
|
-
const summary = /* @__PURE__ */ jsxs3(Fragment4, { children: [
|
|
1166
|
-
/* @__PURE__ */ jsx4(ToolIcon, { category }),
|
|
1167
|
-
/* @__PURE__ */ jsx4("strong", { children: toolAction2(entry, category, presentation) }),
|
|
1168
|
-
target ? /* @__PURE__ */ jsx4("code", { className: "scui-tool-target", title: presentation.target, children: target }) : null,
|
|
1169
|
-
/* @__PURE__ */ jsx4("span", { className: "scui-spacer" }),
|
|
1170
|
-
entry.status === "pending" ? /* @__PURE__ */ jsx4(PendingElapsed, { now: adapter?.now }) : null,
|
|
1171
|
-
/* @__PURE__ */ jsx4("span", { className: "scui-tool-status", role: "status", "data-status": entry.status ?? "completed", "aria-label": entry.status ?? "completed", children: entry.status === "pending" ? /* @__PURE__ */ jsx4("i", {}) : /* @__PURE__ */ jsx4(UiIcon, { name: entry.status === "error" ? "close" : "check", size: 12 }) }),
|
|
1172
|
-
hasDetail ? /* @__PURE__ */ jsx4(UiIcon, { name: "chevron", size: 14, className: "scui-tool-chevron" }) : null
|
|
1173
|
-
] });
|
|
1174
|
-
if (!hasDetail) return /* @__PURE__ */ jsx4("div", { className: "scui-tool", "data-status": entry.status ?? "completed", "data-category": category, children: /* @__PURE__ */ jsx4("div", { className: "scui-tool-head", children: summary }) });
|
|
1175
|
-
return /* @__PURE__ */ jsxs3("details", { className: "scui-tool", "data-status": entry.status ?? "completed", "data-category": category, open: expanded, onToggle: (event) => setExpanded(event.currentTarget.open), children: [
|
|
1176
|
-
/* @__PURE__ */ jsx4("summary", { className: "scui-tool-head", children: summary }),
|
|
1177
|
-
/* @__PURE__ */ jsxs3("div", { className: "scui-tool-detail", children: [
|
|
1178
|
-
/* @__PURE__ */ jsx4(ToolMetrics, { presentation }),
|
|
1179
|
-
/* @__PURE__ */ jsx4(ToolStack, { tools: presentation.tools ?? [] }),
|
|
1180
|
-
/* @__PURE__ */ jsx4(ToolPreview, { presentation, entry }),
|
|
1181
|
-
presentation.fields.length ? /* @__PURE__ */ jsx4("dl", { className: "scui-tool-fields", children: presentation.fields.map((field) => /* @__PURE__ */ jsxs3("div", { children: [
|
|
1182
|
-
/* @__PURE__ */ jsx4("dt", { children: field.label }),
|
|
1183
|
-
/* @__PURE__ */ jsx4("dd", { children: field.value })
|
|
1184
|
-
] }, field.label)) }) : null,
|
|
1185
|
-
/* @__PURE__ */ jsx4(ToolActions, { presentation, adapter }),
|
|
1186
|
-
/* @__PURE__ */ jsx4(TechnicalDetails, { entry })
|
|
1187
|
-
] })
|
|
1188
|
-
] });
|
|
1189
|
-
}
|
|
1190
|
-
function ActivityGroup({ entries, state, adapter }) {
|
|
1191
|
-
const active = entries.some((entry) => entry.status === "pending");
|
|
1192
|
-
const [open, setOpen] = useState2(active);
|
|
1193
|
-
const id = useId();
|
|
1194
|
-
useEffect3(() => {
|
|
1195
|
-
if (active) setOpen(true);
|
|
1196
|
-
}, [active]);
|
|
1197
|
-
if (entries.length === 1) return /* @__PURE__ */ jsx4("section", { className: "scui-activity", "data-single": "true", children: /* @__PURE__ */ jsx4(ToolRow, { entry: entries[0], workspace: state.workspace, adapter }) });
|
|
1198
|
-
return /* @__PURE__ */ jsxs3("section", { className: "scui-activity", children: [
|
|
1199
|
-
/* @__PURE__ */ jsxs3("button", { className: "scui-activity-head", type: "button", "aria-expanded": open, "aria-controls": id, onClick: () => setOpen((value) => !value), children: [
|
|
1200
|
-
/* @__PURE__ */ jsx4("span", { className: "scui-fold", "data-open": open, children: /* @__PURE__ */ jsx4(UiIcon, { name: "chevron", size: 14 }) }),
|
|
1201
|
-
/* @__PURE__ */ jsx4("strong", { children: activitySummary(entries) }),
|
|
1202
|
-
/* @__PURE__ */ jsx4("span", { className: "scui-spacer" }),
|
|
1203
|
-
/* @__PURE__ */ jsxs3("small", { children: [
|
|
1204
|
-
entries.filter((entry) => entry.status !== "pending").length,
|
|
1205
|
-
"/",
|
|
1206
|
-
entries.length
|
|
1207
|
-
] })
|
|
1208
|
-
] }),
|
|
1209
|
-
open ? /* @__PURE__ */ jsx4("div", { id, children: entries.map((entry) => /* @__PURE__ */ jsx4(ToolRow, { entry, workspace: state.workspace, adapter }, entry.id)) }) : null
|
|
1210
|
-
] });
|
|
1211
|
-
}
|
|
1212
|
-
function TaskPlan({ plan }) {
|
|
1213
|
-
if (!plan.items.length) return null;
|
|
1214
|
-
const complete = plan.items.filter((item) => item.status === "completed" || item.status === "cancelled").length;
|
|
1215
|
-
return /* @__PURE__ */ jsxs3("details", { className: "scui-plan", children: [
|
|
1216
|
-
/* @__PURE__ */ jsxs3("summary", { children: [
|
|
1217
|
-
/* @__PURE__ */ jsx4("span", { children: "Plan" }),
|
|
1218
|
-
/* @__PURE__ */ jsxs3("small", { children: [
|
|
1219
|
-
complete,
|
|
1220
|
-
"/",
|
|
1221
|
-
plan.items.length
|
|
1222
|
-
] })
|
|
1223
|
-
] }),
|
|
1224
|
-
/* @__PURE__ */ jsx4("ol", { tabIndex: 0, "aria-label": "Task plan steps", children: plan.items.map((item) => /* @__PURE__ */ jsxs3("li", { "data-status": item.status, children: [
|
|
1225
|
-
/* @__PURE__ */ jsx4("i", { "aria-hidden": "true" }),
|
|
1226
|
-
" ",
|
|
1227
|
-
/* @__PURE__ */ jsx4("span", { children: item.title })
|
|
1228
|
-
] }, item.id)) })
|
|
1229
|
-
] });
|
|
1230
|
-
}
|
|
1231
|
-
function SessionDetails({ semantics }) {
|
|
1232
|
-
if (!semantics.fidelity && !semantics.residueCount && !semantics.parseErrors && !semantics.subagents.length) return null;
|
|
1233
|
-
return /* @__PURE__ */ jsxs3("details", { className: "scui-details", children: [
|
|
1234
|
-
/* @__PURE__ */ jsx4("summary", { children: "Session details" }),
|
|
1235
|
-
/* @__PURE__ */ jsxs3("div", { children: [
|
|
1236
|
-
semantics.fidelity ? /* @__PURE__ */ jsxs3("p", { children: [
|
|
1237
|
-
/* @__PURE__ */ jsx4("strong", { children: "Fidelity" }),
|
|
1238
|
-
/* @__PURE__ */ jsx4("span", { children: semantics.fidelity.replaceAll("_", " ") })
|
|
1239
|
-
] }) : null,
|
|
1240
|
-
/* @__PURE__ */ jsxs3("p", { children: [
|
|
1241
|
-
/* @__PURE__ */ jsx4("strong", { children: "Native records" }),
|
|
1242
|
-
/* @__PURE__ */ jsx4("span", { children: semantics.rawRecords })
|
|
1243
|
-
] }),
|
|
1244
|
-
semantics.residueCount ? /* @__PURE__ */ jsxs3("p", { children: [
|
|
1245
|
-
/* @__PURE__ */ jsx4("strong", { children: "Residue" }),
|
|
1246
|
-
/* @__PURE__ */ jsxs3("span", { children: [
|
|
1247
|
-
semantics.residueCount,
|
|
1248
|
-
" retained"
|
|
1249
|
-
] })
|
|
1250
|
-
] }) : null,
|
|
1251
|
-
semantics.parseErrors ? /* @__PURE__ */ jsxs3("p", { children: [
|
|
1252
|
-
/* @__PURE__ */ jsx4("strong", { children: "Parse diagnostics" }),
|
|
1253
|
-
/* @__PURE__ */ jsx4("span", { children: semantics.parseErrors })
|
|
1254
|
-
] }) : null,
|
|
1255
|
-
semantics.subagents.map((agent) => /* @__PURE__ */ jsxs3("p", { children: [
|
|
1256
|
-
/* @__PURE__ */ jsxs3("strong", { children: [
|
|
1257
|
-
agent.source,
|
|
1258
|
-
" subagent"
|
|
1259
|
-
] }),
|
|
1260
|
-
/* @__PURE__ */ jsxs3("span", { children: [
|
|
1261
|
-
agent.messages,
|
|
1262
|
-
" messages \xB7 ",
|
|
1263
|
-
agent.fidelity.replaceAll("_", " ")
|
|
1264
|
-
] })
|
|
1265
|
-
] }, agent.id))
|
|
1266
|
-
] })
|
|
1267
|
-
] });
|
|
1268
|
-
}
|
|
1269
|
-
var conversationMemory = uiMemory();
|
|
1270
|
-
function ConversationAnnouncements({ state }) {
|
|
1271
|
-
const previousBusy = useRef3(state.busy);
|
|
1272
|
-
const [announcement, setAnnouncement] = useState2("");
|
|
1273
|
-
useEffect3(() => {
|
|
1274
|
-
if (previousBusy.current && !state.busy && !state.error) {
|
|
1275
|
-
setAnnouncement(`${harnessDisplayName(state.harness) || "Coding agent"} finished working`);
|
|
1276
|
-
}
|
|
1277
|
-
previousBusy.current = state.busy;
|
|
1278
|
-
}, [state.busy, state.error, state.harness]);
|
|
1279
|
-
return /* @__PURE__ */ jsx4("span", { className: "scui-sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: announcement });
|
|
1280
|
-
}
|
|
1281
|
-
function Conversation({ state, adapter, components = {}, slots = {}, memoryKey = state.attached?.key || `${state.harness}:${state.workspace}`, pending = null, unreadAfterMessages = null }) {
|
|
1282
|
-
const scroller = useRef3(null);
|
|
1283
|
-
const remembered = conversationMemory.get(memoryKey) ?? { top: null, atBottom: true };
|
|
1284
|
-
const [atBottom, setAtBottom] = useState2(remembered.atBottom);
|
|
1285
|
-
const earlierAnchor = useRef3(null);
|
|
1286
|
-
const restored = useRef3(false);
|
|
1287
|
-
const blocks = groupConversation(state.transcript);
|
|
1288
|
-
const unreadBoundary = useRef3(Number.isSafeInteger(unreadAfterMessages) && unreadAfterMessages >= 0 ? unreadAfterMessages : null);
|
|
1289
|
-
const unreadBlock = unreadBoundary.current === null ? -1 : blocks.findIndex((block) => {
|
|
1290
|
-
const entries = block.kind === "activity" ? block.entries : [block.entry];
|
|
1291
|
-
return entries.some((entry) => Number.isSafeInteger(entry.messageIndex) && entry.messageIndex > unreadBoundary.current);
|
|
1292
|
-
});
|
|
1293
|
-
const Entry = components.TranscriptEntry ?? TranscriptEntry;
|
|
1294
|
-
const Group = components.ActivityGroup ?? ActivityGroup;
|
|
1295
|
-
const Plan = components.TaskPlan ?? TaskPlan;
|
|
1296
|
-
const Before = slots.beforeConversation;
|
|
1297
|
-
const After = slots.afterConversation;
|
|
1298
|
-
const Empty = slots.emptyConversation;
|
|
1299
|
-
const remember = (value) => boundedSet(conversationMemory, memoryKey, value);
|
|
1300
|
-
const pendingMessage = typeof pending === "string" ? { text: pending, status: "sending" } : pending;
|
|
1301
|
-
const pin = () => {
|
|
1302
|
-
if (!scroller.current) return;
|
|
1303
|
-
scroller.current.scrollTop = scroller.current.scrollHeight;
|
|
1304
|
-
setAtBottom(true);
|
|
1305
|
-
remember({ top: scroller.current.scrollTop, atBottom: true });
|
|
1306
|
-
};
|
|
1307
|
-
useLayoutEffect(() => {
|
|
1308
|
-
const element = scroller.current;
|
|
1309
|
-
if (!element) return;
|
|
1310
|
-
const anchor = earlierAnchor.current;
|
|
1311
|
-
if (anchor) {
|
|
1312
|
-
if (state.operation === "loadEarlier") anchor.seenOperation = true;
|
|
1313
|
-
const prepended = state.transcript.length > anchor.entries && state.transcript[0]?.id !== anchor.firstId;
|
|
1314
|
-
if (prepended) {
|
|
1315
|
-
element.scrollTop = anchor.top + (element.scrollHeight - anchor.height);
|
|
1316
|
-
earlierAnchor.current = null;
|
|
1317
|
-
remember({ top: element.scrollTop, atBottom: false });
|
|
1318
|
-
return;
|
|
1319
|
-
}
|
|
1320
|
-
if (state.error || anchor.seenOperation && state.operation !== "loadEarlier") earlierAnchor.current = null;
|
|
1321
|
-
}
|
|
1322
|
-
if (!restored.current) {
|
|
1323
|
-
restored.current = true;
|
|
1324
|
-
if (remembered.top !== null && !remembered.atBottom) element.scrollTop = remembered.top;
|
|
1325
|
-
else pin();
|
|
1326
|
-
} else if (atBottom) pin();
|
|
1327
|
-
}, [memoryKey, state.transcript, state.busy, state.operation, state.error, pendingMessage?.text, pendingMessage?.status]);
|
|
1328
|
-
return /* @__PURE__ */ jsxs3("div", { className: "scui-conversation-wrap", children: [
|
|
1329
|
-
/* @__PURE__ */ jsx4(ConversationAnnouncements, { state }),
|
|
1330
|
-
/* @__PURE__ */ jsx4("div", { className: "scui-conversation", ref: scroller, tabIndex: 0, "aria-label": "Conversation", onScroll: (event) => {
|
|
1331
|
-
const element = event.currentTarget;
|
|
1332
|
-
const bottom = element.scrollHeight - element.scrollTop - element.clientHeight <= 64;
|
|
1333
|
-
setAtBottom(bottom);
|
|
1334
|
-
remember({ top: element.scrollTop, atBottom: bottom });
|
|
1335
|
-
}, children: /* @__PURE__ */ jsxs3("div", { children: [
|
|
1336
|
-
Before ? /* @__PURE__ */ jsx4(Before, { state, adapter, value: null }) : null,
|
|
1337
|
-
/* @__PURE__ */ jsx4(Plan, { plan: state.taskPlan, value: state.taskPlan, state, adapter }),
|
|
1338
|
-
/* @__PURE__ */ jsx4(SessionDetails, { semantics: state.semantics }),
|
|
1339
|
-
state.history.hasEarlier ? /* @__PURE__ */ jsx4("button", { className: "scui-load", type: "button", disabled: Boolean(state.operation), onClick: () => {
|
|
1340
|
-
const element = scroller.current;
|
|
1341
|
-
if (element) earlierAnchor.current = { height: element.scrollHeight, top: element.scrollTop, entries: state.transcript.length, firstId: state.transcript[0]?.id, seenOperation: false };
|
|
1342
|
-
setAtBottom(false);
|
|
1343
|
-
adapter.onIntent({ action: "loadEarlier" });
|
|
1344
|
-
}, children: "Load earlier messages" }) : null,
|
|
1345
|
-
!blocks.length && state.startup !== "ready" ? /* @__PURE__ */ jsx4(LoadingStatus, { state }) : null,
|
|
1346
|
-
!blocks.length && state.startup === "ready" ? Empty ? /* @__PURE__ */ jsx4(Empty, { state, adapter, value: null }) : /* @__PURE__ */ jsx4("div", { className: "scui-empty", children: state.error ?? (state.harness ? `${harnessDisplayName(state.harness)} is listening. Say something.` : "No transcript yet.") }) : null,
|
|
1347
|
-
blocks.map((block, index) => /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
1348
|
-
index === unreadBlock ? /* @__PURE__ */ jsx4("div", { className: "scui-unread-divider", role: "separator", "aria-label": "New messages", children: /* @__PURE__ */ jsx4("span", { children: "New" }) }) : null,
|
|
1349
|
-
block.kind === "activity" ? /* @__PURE__ */ jsx4(Group, { value: block.entries, entries: block.entries, state, adapter }) : /* @__PURE__ */ jsx4(Entry, { value: block.entry, entry: block.entry, state, adapter })
|
|
1350
|
-
] }, block.id)),
|
|
1351
|
-
pendingMessage ? /* @__PURE__ */ jsxs3("article", { className: "scui-message scui-pending", "data-role": "user", "data-status": pendingMessage.status, "aria-label": "Your pending message", children: [
|
|
1352
|
-
/* @__PURE__ */ jsx4(MessageImages, { items: pendingMessage.images, adapter }),
|
|
1353
|
-
/* @__PURE__ */ jsx4(Markdown, { value: pendingMessage.text, copyText: adapter?.copyText }),
|
|
1354
|
-
/* @__PURE__ */ jsx4(ContextDisclosure, { context: pendingMessage.context }),
|
|
1355
|
-
/* @__PURE__ */ jsxs3("footer", { children: [
|
|
1356
|
-
/* @__PURE__ */ jsx4("small", { children: pendingMessage.status === "failed" ? "Not sent" : "Sending\u2026" }),
|
|
1357
|
-
pendingMessage.status === "failed" ? /* @__PURE__ */ jsxs3("span", { children: [
|
|
1358
|
-
/* @__PURE__ */ jsx4("button", { type: "button", onClick: pendingMessage.onRetry, children: "Retry" }),
|
|
1359
|
-
/* @__PURE__ */ jsx4("button", { type: "button", onClick: pendingMessage.onEdit, children: "Edit" })
|
|
1360
|
-
] }) : null
|
|
1361
|
-
] })
|
|
1362
|
-
] }) : null,
|
|
1363
|
-
state.busy ? /* @__PURE__ */ jsxs3("div", { className: "scui-working", role: "status", children: [
|
|
1364
|
-
/* @__PURE__ */ jsx4("span", { "aria-hidden": "true", children: "\u2726" }),
|
|
1365
|
-
/* @__PURE__ */ jsx4("i", {}),
|
|
1366
|
-
/* @__PURE__ */ jsx4("i", {}),
|
|
1367
|
-
/* @__PURE__ */ jsx4("i", {}),
|
|
1368
|
-
/* @__PURE__ */ jsxs3("small", { children: [
|
|
1369
|
-
harnessDisplayName(state.harness),
|
|
1370
|
-
" is working"
|
|
1371
|
-
] })
|
|
1372
|
-
] }) : null,
|
|
1373
|
-
After ? /* @__PURE__ */ jsx4(After, { state, adapter, value: null }) : null
|
|
1374
|
-
] }) }),
|
|
1375
|
-
!atBottom ? /* @__PURE__ */ jsxs3("button", { className: "scui-latest", type: "button", onClick: pin, children: [
|
|
1376
|
-
/* @__PURE__ */ jsx4(UiIcon, { name: "down", size: 13 }),
|
|
1377
|
-
" Latest"
|
|
1378
|
-
] }) : null
|
|
1379
|
-
] });
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
|
-
// src/logo.jsx
|
|
1383
|
-
import { useEffect as useEffect4 } from "react";
|
|
1384
|
-
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1385
|
-
var LOGOS = {
|
|
1386
|
-
"claude-code": {
|
|
1387
|
-
viewBox: "-1 3.5 26 18",
|
|
1388
|
-
paths: [
|
|
1389
|
-
["path", { fillRule: "evenodd", clipRule: "evenodd", d: "M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z" }]
|
|
1390
|
-
]
|
|
1391
|
-
},
|
|
1392
|
-
codex: {
|
|
1393
|
-
viewBox: "-1 -1 26 26",
|
|
1394
|
-
paths: [
|
|
1395
|
-
["path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z" }]
|
|
1396
|
-
]
|
|
1397
|
-
},
|
|
1398
|
-
gemini: {
|
|
1399
|
-
viewBox: "0 0 24 24",
|
|
1400
|
-
paths: [["path", { d: "M12 24C12 17.373 6.627 12 0 12 6.627 12 12 6.627 12 0c0 6.627 5.373 12 12 12-6.627 0-12 5.373-12 12z" }]]
|
|
1401
|
-
},
|
|
1402
|
-
grok: {
|
|
1403
|
-
viewBox: "-1 -1 26 26",
|
|
1404
|
-
paths: [["path", { d: "M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815" }]]
|
|
1405
|
-
},
|
|
1406
|
-
// Canonical mark from block/goose's documentation/static/img/goose.svg.
|
|
1407
|
-
goose: {
|
|
1408
|
-
viewBox: "0 0 45 45",
|
|
1409
|
-
paths: [["path", { d: "M43.2098 39.2492L39.8118 36.4522C37.9646 34.9318 36.3923 33.1051 35.1631 31.0529C33.4647 28.2172 31.1178 25.8243 28.3164 24.071L26.9482 23.2744C26.4794 22.9485 26.1525 22.4405 26.106 21.8675C26.0762 21.4981 26.1647 21.1678 26.3712 20.8771C27.0837 19.873 30.9617 15.6995 31.6365 15.1411C32.5056 14.4228 33.4739 13.8253 34.3724 13.1412C34.5001 13.0438 34.6283 12.9469 34.7545 12.8481C35.0574 12.6088 35.3295 12.3671 35.5458 12.0803C36.5993 10.8604 36.5783 9.82938 36.5783 9.82938C36.4677 9.5534 36.0645 8.69902 35.2449 8.29825C35.9696 8.28406 36.7872 8.55564 37.1582 8.91873C37.6039 8.21947 37.8922 7.76585 38.3404 7.00347C38.4471 6.82241 38.5038 6.48771 38.2998 6.30029C38.1114 6.11287 37.6416 6.01697 37.4606 6.12364C36.4692 6.70693 35.5047 7.33475 34.6351 7.88525C34.6351 7.88525 33.6046 7.86372 32.3842 8.91775C32.097 9.13452 31.8552 9.4066 31.6282 9.69433C31.5171 9.83476 31.4202 9.96297 31.3233 10.0912C30.6387 10.9901 30.0417 11.958 29.3234 12.8271C28.7656 13.5023 24.5915 17.3798 23.5874 18.0923C23.2967 18.2988 22.9669 18.3879 22.597 18.3575C22.0245 18.3115 21.5161 17.9842 21.1902 17.5154L20.3935 16.1472C18.6402 13.3448 16.2474 10.9989 13.4117 9.30041C11.3594 8.0712 9.5332 6.49847 8.01234 4.65172L5.2153 1.25377C5.0773 1.08642 4.81306 1.11382 4.71422 1.30662C4.39615 1.92612 3.78888 3.23411 3.32353 4.99327C3.92786 5.81095 5.26717 7.35089 6.8624 8.65351C6.97348 8.74403 6.88246 8.92313 6.74447 8.88496C5.36846 8.51013 4.03062 7.90825 3.02944 7.39542C2.94772 7.35383 2.84887 7.4057 2.83713 7.49672C2.68152 8.74354 2.64139 10.1127 2.80581 11.5562C4.02572 12.1596 5.85143 12.8804 7.76816 13.3389C7.90713 13.3722 7.90273 13.5723 7.76229 13.5992C6.26982 13.8801 4.70688 13.9427 3.43656 13.9261C3.3475 13.9251 3.28193 14.0093 3.30591 14.0949C3.56085 14.9958 3.90632 15.9118 4.3619 16.8342C4.55029 17.2487 4.75532 17.6553 4.97504 18.0532C6.21207 18.107 7.47946 17.9964 8.75369 17.7713C8.97095 17.7331 9.08741 18.0189 8.90391 18.1417C8.03877 18.7201 7.11588 19.2183 6.25758 19.6283C6.14259 19.6836 6.1054 19.8304 6.18125 19.9327C6.69114 20.6236 7.25191 21.2774 7.86114 21.8866C7.86114 21.8866 10.8608 24.9763 10.9425 25.2185C12.6928 23.4261 15.5701 21.4394 18.7474 19.7047C14.4921 23.1672 12.1198 25.7235 10.9258 27.1758L10.0935 28.3439C9.66091 28.9507 9.2856 29.5951 8.97193 30.2709C7.92231 32.5292 6.19201 37.0966 6.19201 37.0966C6.0594 37.4543 6.16755 37.8072 6.39753 38.0371C6.66031 38.2999 7.01263 38.4076 7.37033 38.275C7.37033 38.275 11.9368 36.5447 14.1961 35.495C14.8719 35.1814 15.5168 34.8056 16.1231 34.3735L17.4095 33.457C18.0907 32.9715 19.0234 33.0489 19.615 33.6405L22.5804 36.6058C23.1896 37.2151 23.8433 37.7758 24.5343 38.2857C24.637 38.3611 24.7833 38.3244 24.8386 38.2094C25.2492 37.3516 25.7473 36.4277 26.3252 35.5631C26.4481 35.3796 26.7343 35.4965 26.6957 35.7133C26.4701 36.988 26.3605 38.2554 26.3086 39.3035C27.2178 39.9172 28.5551 40.5606 30.3721 41.1611C30.4577 41.185 30.5419 41.1195 30.5409 41.0304C30.5237 39.7596 30.5864 38.1967 30.8677 36.7047C30.8942 36.5638 31.0943 36.5593 31.1281 36.6988C31.5861 38.616 32.3069 40.4417 32.8041 41.5829C34.3543 41.8256 35.7234 41.7855 36.9703 41.6298C37.0618 41.6186 37.1136 41.5197 37.0715 41.4375C36.5587 40.4364 35.9568 39.0975 35.582 37.7225C35.5443 37.584 35.7229 37.4935 35.8135 37.6046C37.1161 39.1998 38.656 40.5391 39.3548 41.1175C41.2333 40.6786 42.5413 40.0713 43.1604 39.7528C43.3532 39.6539 43.3806 39.3897 43.2132 39.2517Z" }]]
|
|
1410
|
-
},
|
|
1411
|
-
opencode: { viewBox: "2.5 0 19 24", paths: [["path", { d: "M16 6H8v12h8V6zm4 16H4V2h16v20z" }]] },
|
|
1412
|
-
pi: {
|
|
1413
|
-
viewBox: "0 0 24 24",
|
|
1414
|
-
paths: [
|
|
1415
|
-
["path", { fillRule: "evenodd", clipRule: "evenodd", d: "M1 1h16.5v11H12v5.5H6.5V23H1V1zm5.5 5.5V12H12V6.5H6.5z" }],
|
|
1416
|
-
["path", { d: "M17.5 12H23v11h-5.5V12z" }]
|
|
1417
|
-
]
|
|
1418
|
-
},
|
|
1419
|
-
// Product mark shared with the first-party browser frontend favicon.
|
|
1420
|
-
supercode: {
|
|
1421
|
-
viewBox: "0 0 64 64",
|
|
1422
|
-
paths: [
|
|
1423
|
-
["rect", { width: "64", height: "64", rx: "14", fill: "#111923" }],
|
|
1424
|
-
["path", { d: "M18 21h28v6H18zm0 13h18v6H18z", fill: "#5f8fff" }],
|
|
1425
|
-
["circle", { cx: "46", cy: "37", r: "7", fill: "none", stroke: "#8ce0aa", strokeWidth: "4" }]
|
|
1426
|
-
]
|
|
1427
|
-
}
|
|
1428
|
-
};
|
|
1429
|
-
var SVG_ATTRIBUTE_NAMES = Object.freeze({
|
|
1430
|
-
clipRule: "clip-rule",
|
|
1431
|
-
fillRule: "fill-rule",
|
|
1432
|
-
strokeWidth: "stroke-width"
|
|
1433
|
-
});
|
|
1434
|
-
function HarnessLogo({ id, activity, size = 28, onMissingLogo }) {
|
|
1435
|
-
const logo = LOGOS[id];
|
|
1436
|
-
useEffect4(() => {
|
|
1437
|
-
if (!logo) onMissingLogo?.(id);
|
|
1438
|
-
}, [id, logo, onMissingLogo]);
|
|
1439
|
-
if (!logo) return null;
|
|
1440
|
-
return /* @__PURE__ */ jsxs4("span", { className: "scui-logo", "data-harness": id, "data-activity": activity, style: { "--scui-logo-size": `${size}px` }, "aria-hidden": "true", children: [
|
|
1441
|
-
/* @__PURE__ */ jsx5("svg", { viewBox: logo.viewBox, preserveAspectRatio: "xMidYMid meet", focusable: "false", children: logo.paths.map(([Tag, props], index) => /* @__PURE__ */ jsx5(Tag, { ...props }, index)) }),
|
|
1442
|
-
activity && activity !== "idle" ? /* @__PURE__ */ jsx5("i", {}) : null
|
|
1443
|
-
] });
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
// src/subagents.jsx
|
|
1447
|
-
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1448
|
-
var ACTIVE_ACTIVITY = /* @__PURE__ */ new Set(["working", "running", "recent"]);
|
|
1449
|
-
function activityLabel(activity, age) {
|
|
1450
|
-
if (activity === "needs-input") return "Needs input";
|
|
1451
|
-
if (activity === "failed") return "Failed";
|
|
1452
|
-
if (activity === "unseen") return "New update";
|
|
1453
|
-
if (activity === "working") return "Working";
|
|
1454
|
-
if (activity === "running") return "Running";
|
|
1455
|
-
if (activity === "recent") return "Recent";
|
|
1456
|
-
if (activity === "finished") return "Finished";
|
|
1457
|
-
return age;
|
|
1458
|
-
}
|
|
1459
|
-
function SubagentRow({ row, inspector, adapter }) {
|
|
1460
|
-
return /* @__PURE__ */ jsxs5("button", { className: "scui-subagent-row", type: "button", "data-activity": row.activity ?? "idle", onClick: () => adapter.onIntent({ action: "openSubagent", parentKey: inspector.parentKey, key: row.key }), children: [
|
|
1461
|
-
/* @__PURE__ */ jsx6(HarnessLogo, { id: row.harness, activity: row.activity, size: 30 }),
|
|
1462
|
-
/* @__PURE__ */ jsxs5("span", { children: [
|
|
1463
|
-
/* @__PURE__ */ jsx6("strong", { children: sessionDisplayName(row) }),
|
|
1464
|
-
/* @__PURE__ */ jsx6("small", { children: row.preview || (row.activity === "working" ? "Working\u2026" : row.cwd) })
|
|
1465
|
-
] }),
|
|
1466
|
-
/* @__PURE__ */ jsxs5("span", { children: [
|
|
1467
|
-
/* @__PURE__ */ jsx6("small", { children: activityLabel(row.activity, row.age) }),
|
|
1468
|
-
/* @__PURE__ */ jsx6(UiIcon, { name: "chevron", size: 14 })
|
|
1469
|
-
] })
|
|
1470
|
-
] });
|
|
1471
|
-
}
|
|
1472
|
-
function SubagentSection({ label, rows, inspector, adapter }) {
|
|
1473
|
-
if (!rows.length) return null;
|
|
1474
|
-
return /* @__PURE__ */ jsxs5("section", { className: "scui-subagent-section", "aria-labelledby": `scui-subagents-${label.toLowerCase().replaceAll(" ", "-")}`, children: [
|
|
1475
|
-
/* @__PURE__ */ jsx6("h2", { id: `scui-subagents-${label.toLowerCase().replaceAll(" ", "-")}`, children: label }),
|
|
1476
|
-
rows.map((row) => /* @__PURE__ */ jsx6(SubagentRow, { row, inspector, adapter }, row.key))
|
|
1477
|
-
] });
|
|
1478
|
-
}
|
|
1479
|
-
function SubagentInspectorContent({ state, adapter, onClose, inspector }) {
|
|
1480
|
-
const selected = inspector.items.find((row) => row.key === inspector.selectedKey) ?? null;
|
|
1481
|
-
const active = inspector.items.filter((row) => ACTIVE_ACTIVITY.has(row.activity));
|
|
1482
|
-
const history = inspector.items.filter((row) => !ACTIVE_ACTIVITY.has(row.activity));
|
|
1483
|
-
const [historyOpen, setHistoryOpen] = useState3(false);
|
|
1484
|
-
const backButton = useRef4(null);
|
|
1485
|
-
useEffect5(() => {
|
|
1486
|
-
if (inspector.status === "ready" && !active.length) setHistoryOpen(true);
|
|
1487
|
-
}, [inspector.parentKey, inspector.status]);
|
|
1488
|
-
useEffect5(() => {
|
|
1489
|
-
backButton.current?.focus({ preventScroll: true });
|
|
1490
|
-
}, [selected?.key]);
|
|
1491
|
-
const detailState = selected ? {
|
|
1492
|
-
...state,
|
|
1493
|
-
transcript: inspector.transcript,
|
|
1494
|
-
busy: selected.activity === "working",
|
|
1495
|
-
needsInput: selected.activity === "needs-input",
|
|
1496
|
-
harness: selected.harness,
|
|
1497
|
-
mode: "mirror",
|
|
1498
|
-
canSend: false,
|
|
1499
|
-
canSteer: false,
|
|
1500
|
-
canInterrupt: false,
|
|
1501
|
-
canRespond: false,
|
|
1502
|
-
taskPlan: { source: "none", items: [], residueCount: 0, observedAt: null },
|
|
1503
|
-
semantics: { fidelity: null, residue: [], residueCount: 0, parseErrors: 0, rawRecords: 0, subagents: [] },
|
|
1504
|
-
history: { ...state.history, hasEarlier: false }
|
|
1505
|
-
} : null;
|
|
1506
|
-
const leave = () => {
|
|
1507
|
-
adapter.onIntent({ action: "closeSubagents" });
|
|
1508
|
-
onClose();
|
|
1509
|
-
};
|
|
1510
|
-
const back = () => selected ? adapter.onIntent({ action: "openSubagents", key: inspector.parentKey }) : leave();
|
|
1511
|
-
return /* @__PURE__ */ jsxs5("section", { className: "scui-subagents", "aria-label": `Agents for ${inspector.parentTitle}`, children: [
|
|
1512
|
-
/* @__PURE__ */ jsxs5("header", { className: "scui-head", children: [
|
|
1513
|
-
/* @__PURE__ */ jsx6("button", { ref: backButton, type: "button", "aria-label": selected ? "Back to agents" : "Back to chats", onClick: back, children: /* @__PURE__ */ jsx6(UiIcon, { name: "back", size: 17 }) }),
|
|
1514
|
-
selected ? /* @__PURE__ */ jsx6(HarnessLogo, { id: selected.harness, activity: selected.activity, size: 24 }) : /* @__PURE__ */ jsx6(UiIcon, { name: "agents", size: 20 }),
|
|
1515
|
-
/* @__PURE__ */ jsxs5("span", { className: "scui-head-copy", children: [
|
|
1516
|
-
/* @__PURE__ */ jsx6("strong", { children: selected ? sessionDisplayName(selected) : "Agents" }),
|
|
1517
|
-
/* @__PURE__ */ jsx6("small", { children: selected ? `${harnessDisplayName(selected.harness)} \xB7 Read-only` : `${inspector.items.length} ${inspector.items.length === 1 ? "session" : "sessions"} \xB7 ${inspector.parentTitle}` })
|
|
1518
|
-
] })
|
|
1519
|
-
] }),
|
|
1520
|
-
inspector.status === "loading" ? /* @__PURE__ */ jsxs5("div", { className: "scui-subagents-loading", role: "status", children: [
|
|
1521
|
-
/* @__PURE__ */ jsx6("i", {}),
|
|
1522
|
-
/* @__PURE__ */ jsxs5("span", { children: [
|
|
1523
|
-
/* @__PURE__ */ jsx6("strong", { children: selected ? "Loading subagent" : "Finding subagents" }),
|
|
1524
|
-
/* @__PURE__ */ jsx6("small", { children: selected ? "Reading a bounded recent transcript\u2026" : "Reading native session relationships\u2026" })
|
|
1525
|
-
] })
|
|
1526
|
-
] }) : null,
|
|
1527
|
-
inspector.error ? /* @__PURE__ */ jsx6("div", { className: "scui-error", role: "alert", children: inspector.error }) : null,
|
|
1528
|
-
!selected && inspector.status === "ready" && inspector.items.length ? /* @__PURE__ */ jsxs5("div", { className: "scui-subagent-rows", children: [
|
|
1529
|
-
/* @__PURE__ */ jsx6(SubagentSection, { label: "Active", rows: active, inspector, adapter }),
|
|
1530
|
-
history.length ? /* @__PURE__ */ jsxs5("details", { className: "scui-subagent-history", open: historyOpen, onToggle: (event) => setHistoryOpen(event.currentTarget.open), children: [
|
|
1531
|
-
/* @__PURE__ */ jsxs5("summary", { children: [
|
|
1532
|
-
/* @__PURE__ */ jsx6("span", { children: "History" }),
|
|
1533
|
-
/* @__PURE__ */ jsx6("small", { children: history.length }),
|
|
1534
|
-
/* @__PURE__ */ jsx6(UiIcon, { name: "chevron", size: 14 })
|
|
1535
|
-
] }),
|
|
1536
|
-
/* @__PURE__ */ jsx6("div", { children: history.map((row) => /* @__PURE__ */ jsx6(SubagentRow, { row, inspector, adapter }, row.key)) })
|
|
1537
|
-
] }) : null
|
|
1538
|
-
] }) : null,
|
|
1539
|
-
!selected && inspector.status === "ready" && !inspector.items.length ? /* @__PURE__ */ jsx6("div", { className: "scui-empty", children: "No native child sessions were found." }) : null,
|
|
1540
|
-
selected && inspector.status === "ready" && detailState ? /* @__PURE__ */ jsx6(Conversation, { state: detailState, adapter, memoryKey: `subagent:${selected.key}` }) : null
|
|
1541
|
-
] });
|
|
1542
|
-
}
|
|
1543
|
-
function SubagentInspector({ state, adapter, onClose }) {
|
|
1544
|
-
if (!state.subagentInspector) return null;
|
|
1545
|
-
return /* @__PURE__ */ jsx6(SubagentInspectorContent, { state, adapter, onClose, inspector: state.subagentInspector });
|
|
1546
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
SubagentInspector
|
|
3
|
+
} from "./chunks/chunk-TQHX2DQG.mjs";
|
|
4
|
+
import "./chunks/chunk-GV5KV5UY.mjs";
|
|
5
|
+
import "./chunks/chunk-UKMTRNJN.mjs";
|
|
6
|
+
import "./chunks/chunk-UKHDCPME.mjs";
|
|
7
|
+
import "./chunks/chunk-LS6JBXNT.mjs";
|
|
8
|
+
import "./chunks/chunk-OINC7LV7.mjs";
|
|
1547
9
|
export {
|
|
1548
10
|
SubagentInspector
|
|
1549
11
|
};
|