@dudko.dev/agent-web-react 0.0.26 → 0.0.28
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 +125 -23
- package/dist/chunk-UUB7CE6N.js +196 -0
- package/dist/chunk-UUB7CE6N.js.map +1 -0
- package/dist/index.cjs +1135 -367
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +426 -22
- package/dist/index.d.ts +426 -22
- package/dist/index.js +1178 -547
- package/dist/index.js.map +1 -1
- package/dist/mcp.cjs +91 -38
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.cts +72 -13
- package/dist/mcp.d.ts +72 -13
- package/dist/mcp.js +89 -38
- package/dist/mcp.js.map +1 -1
- package/dist/pipeline.cjs +3485 -0
- package/dist/pipeline.cjs.map +1 -0
- package/dist/pipeline.css +1407 -0
- package/dist/pipeline.d.cts +830 -0
- package/dist/pipeline.d.ts +830 -0
- package/dist/pipeline.js +3390 -0
- package/dist/pipeline.js.map +1 -0
- package/dist/styles.css +278 -0
- package/package.json +17 -4
package/dist/index.js
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AlertIcon,
|
|
3
|
+
ArrowUpIcon,
|
|
4
|
+
BoltIcon,
|
|
5
|
+
BookIcon,
|
|
6
|
+
BotIcon,
|
|
7
|
+
BrainIcon,
|
|
8
|
+
CheckIcon,
|
|
9
|
+
ClockIcon,
|
|
10
|
+
DownloadIcon,
|
|
11
|
+
EyeIcon,
|
|
12
|
+
FileIcon,
|
|
13
|
+
GlobeIcon,
|
|
14
|
+
HistoryIcon,
|
|
15
|
+
MicIcon,
|
|
16
|
+
PlusIcon,
|
|
17
|
+
SendIcon,
|
|
18
|
+
ShieldIcon,
|
|
19
|
+
SlashIcon,
|
|
20
|
+
SpinnerIcon,
|
|
21
|
+
StopIcon,
|
|
22
|
+
ToolIcon,
|
|
23
|
+
XIcon,
|
|
24
|
+
errMessage,
|
|
25
|
+
formatDuration,
|
|
26
|
+
formatProbability,
|
|
27
|
+
formatTokens,
|
|
28
|
+
imagesInOutput,
|
|
29
|
+
previewValue,
|
|
30
|
+
webSearchOf
|
|
31
|
+
} from "./chunk-UUB7CE6N.js";
|
|
32
|
+
|
|
1
33
|
// src/hooks/use-agent.ts
|
|
2
34
|
import { useCallback, useEffect, useReducer, useRef, useState } from "react";
|
|
3
35
|
import {
|
|
@@ -6,6 +38,9 @@ import {
|
|
|
6
38
|
} from "@dudko.dev/agent-web";
|
|
7
39
|
|
|
8
40
|
// src/state.ts
|
|
41
|
+
import {
|
|
42
|
+
isReplayedToolOutput
|
|
43
|
+
} from "@dudko.dev/agent-web";
|
|
9
44
|
var approxTokens = (value) => {
|
|
10
45
|
if (value === void 0) return 0;
|
|
11
46
|
let text;
|
|
@@ -24,14 +59,28 @@ var emptyUsage = () => ({
|
|
|
24
59
|
cachedInputTokens: 0,
|
|
25
60
|
cacheWriteTokens: 0
|
|
26
61
|
});
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
62
|
+
var USAGE_COUNTS = [
|
|
63
|
+
"mediaCalls",
|
|
64
|
+
"imagesGenerated",
|
|
65
|
+
"speechCharacters",
|
|
66
|
+
"transcriptionSeconds",
|
|
67
|
+
"decisionCalls"
|
|
68
|
+
];
|
|
69
|
+
var addUsage = (a, b) => {
|
|
70
|
+
const sum = {
|
|
71
|
+
inputTokens: a.inputTokens + b.inputTokens,
|
|
72
|
+
outputTokens: a.outputTokens + b.outputTokens,
|
|
73
|
+
totalTokens: a.totalTokens + b.totalTokens,
|
|
74
|
+
reasoningTokens: (a.reasoningTokens ?? 0) + (b.reasoningTokens ?? 0),
|
|
75
|
+
cachedInputTokens: (a.cachedInputTokens ?? 0) + (b.cachedInputTokens ?? 0),
|
|
76
|
+
cacheWriteTokens: (a.cacheWriteTokens ?? 0) + (b.cacheWriteTokens ?? 0)
|
|
77
|
+
};
|
|
78
|
+
for (const key of USAGE_COUNTS) {
|
|
79
|
+
const n = (a[key] ?? 0) + (b[key] ?? 0);
|
|
80
|
+
if (n) sum[key] = n;
|
|
81
|
+
}
|
|
82
|
+
return sum;
|
|
83
|
+
};
|
|
35
84
|
var lessonsOf = (skills) => skills.filter((s) => s.origin?.kind === "learned").map((s) => ({
|
|
36
85
|
name: s.name,
|
|
37
86
|
description: s.description,
|
|
@@ -89,8 +138,13 @@ var applySubagentEvent = (view, event) => {
|
|
|
89
138
|
return {
|
|
90
139
|
...view,
|
|
91
140
|
steps: view.steps + 1,
|
|
92
|
-
activity: `step ${event.index}/${event.total}: ${event.step.description}
|
|
141
|
+
activity: `step ${event.index}/${event.total}: ${event.step.description}`,
|
|
142
|
+
// Known only when the child runs with model tiers.
|
|
143
|
+
...event.model !== void 0 ? { model: event.model } : {},
|
|
144
|
+
...event.tier !== void 0 ? { tier: event.tier } : {}
|
|
93
145
|
};
|
|
146
|
+
case "step.escalated":
|
|
147
|
+
return { ...view, tier: event.to, ...event.model ? { model: event.model } : {} };
|
|
94
148
|
case "step.tool-call":
|
|
95
149
|
return { ...view, toolCalls: view.toolCalls + 1, activity: `\u2192 ${event.name}` };
|
|
96
150
|
case "final.text-delta":
|
|
@@ -103,6 +157,208 @@ var applySubagentEvent = (view, event) => {
|
|
|
103
157
|
return view;
|
|
104
158
|
}
|
|
105
159
|
};
|
|
160
|
+
var ensureSubagent = (state, id, name, ancestors, ctx) => {
|
|
161
|
+
if (state.subagents.some((s) => s.id === id)) return state;
|
|
162
|
+
const parentId = ancestors[ancestors.length - 1]?.id;
|
|
163
|
+
const parent = parentId ? state.subagents.find((s) => s.id === parentId) : void 0;
|
|
164
|
+
const stepId = parent ? parent.stepId : runningStepId(state.steps);
|
|
165
|
+
const node = {
|
|
166
|
+
id,
|
|
167
|
+
name,
|
|
168
|
+
task: "",
|
|
169
|
+
...parentId ? { parentId } : {},
|
|
170
|
+
depth: ancestors.length + 1,
|
|
171
|
+
status: "running",
|
|
172
|
+
...stepId ? { stepId } : {},
|
|
173
|
+
...ctx.at !== void 0 ? { startedAt: ctx.at } : {},
|
|
174
|
+
activity: "starting",
|
|
175
|
+
steps: 0,
|
|
176
|
+
toolCalls: 0,
|
|
177
|
+
text: "",
|
|
178
|
+
usage: emptyUsage()
|
|
179
|
+
};
|
|
180
|
+
return { ...state, subagents: [...state.subagents, node] };
|
|
181
|
+
};
|
|
182
|
+
var startSubagent = (state, event, ancestors, ctx) => {
|
|
183
|
+
const depth = Math.max(event.depth ?? 1, ancestors.length + 1);
|
|
184
|
+
const parentId = ancestors[ancestors.length - 1]?.id ?? (depth > 1 ? event.parentId : void 0);
|
|
185
|
+
const told = {
|
|
186
|
+
name: event.name,
|
|
187
|
+
task: event.task,
|
|
188
|
+
depth,
|
|
189
|
+
...parentId ? { parentId } : {},
|
|
190
|
+
...event.profile ? { profile: event.profile } : {},
|
|
191
|
+
...event.dynamic ? { dynamic: true } : {},
|
|
192
|
+
...event.role ? { role: event.role } : {},
|
|
193
|
+
...event.tools ? { tools: event.tools } : {}
|
|
194
|
+
};
|
|
195
|
+
if (state.subagents.some((s) => s.id === event.id)) {
|
|
196
|
+
return {
|
|
197
|
+
...state,
|
|
198
|
+
subagents: patchSubagent(state.subagents, event.id, (s) => ({ ...s, ...told }))
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
const parent = parentId ? state.subagents.find((s) => s.id === parentId) : void 0;
|
|
202
|
+
const stepId = parent ? parent.stepId : runningStepId(state.steps);
|
|
203
|
+
const node = {
|
|
204
|
+
id: event.id,
|
|
205
|
+
...told,
|
|
206
|
+
status: "running",
|
|
207
|
+
stepId,
|
|
208
|
+
...ctx.at !== void 0 ? { startedAt: ctx.at } : {},
|
|
209
|
+
activity: "starting",
|
|
210
|
+
steps: 0,
|
|
211
|
+
toolCalls: 0,
|
|
212
|
+
text: "",
|
|
213
|
+
usage: emptyUsage()
|
|
214
|
+
};
|
|
215
|
+
return { ...state, subagents: [...state.subagents, node] };
|
|
216
|
+
};
|
|
217
|
+
var subagentDuration = (s, at) => at !== void 0 && s.startedAt !== void 0 ? { durationMs: Math.max(0, at - s.startedAt) } : {};
|
|
218
|
+
var addMedia = (state, view) => ({
|
|
219
|
+
...state,
|
|
220
|
+
media: [...state.media ?? [], view],
|
|
221
|
+
...view.stepId ? {
|
|
222
|
+
steps: patchStep(state.steps, view.stepId, (s) => ({
|
|
223
|
+
...s,
|
|
224
|
+
media: [...s.media ?? [], view]
|
|
225
|
+
}))
|
|
226
|
+
} : {}
|
|
227
|
+
});
|
|
228
|
+
var mediaOf = (event, withStep) => ({
|
|
229
|
+
kind: event.kind,
|
|
230
|
+
path: event.path,
|
|
231
|
+
mediaType: event.mediaType,
|
|
232
|
+
bytes: event.bytes,
|
|
233
|
+
model: event.model,
|
|
234
|
+
...withStep && event.step ? { stepId: event.step.id } : {}
|
|
235
|
+
});
|
|
236
|
+
var transcriptOf = (event) => ({
|
|
237
|
+
source: event.source,
|
|
238
|
+
name: event.name,
|
|
239
|
+
text: event.text,
|
|
240
|
+
...event.language ? { language: event.language } : {},
|
|
241
|
+
...event.durationInSeconds !== void 0 ? { durationInSeconds: event.durationInSeconds } : {},
|
|
242
|
+
model: event.model
|
|
243
|
+
});
|
|
244
|
+
var applySubagent = (state, event, ancestors, ctx) => {
|
|
245
|
+
switch (event.type) {
|
|
246
|
+
case "subagent.start":
|
|
247
|
+
return startSubagent(state, event, ancestors, ctx);
|
|
248
|
+
case "subagent.event": {
|
|
249
|
+
const known = ensureSubagent(state, event.id, event.name, ancestors, ctx);
|
|
250
|
+
const inner = event.event;
|
|
251
|
+
switch (inner.type) {
|
|
252
|
+
case "subagent.start":
|
|
253
|
+
case "subagent.event":
|
|
254
|
+
case "subagent.complete":
|
|
255
|
+
case "subagent.error":
|
|
256
|
+
return applySubagent(known, inner, [...ancestors, { id: event.id }], ctx);
|
|
257
|
+
// A helper the model started asks through the run's own consent gate (the event says
|
|
258
|
+
// which helper): its request is the user's to answer, like the run's. A subagent with
|
|
259
|
+
// a gate of its own (no `subagent` on the event) is its host's business.
|
|
260
|
+
case "tool.approval-requested": {
|
|
261
|
+
if (!inner.subagent || known.approvals.some((a) => a.id === inner.id)) return known;
|
|
262
|
+
const node = known.subagents.find((s) => s.id === inner.subagent.id);
|
|
263
|
+
return {
|
|
264
|
+
...known,
|
|
265
|
+
approvals: [
|
|
266
|
+
...known.approvals,
|
|
267
|
+
{
|
|
268
|
+
id: inner.id,
|
|
269
|
+
name: inner.name,
|
|
270
|
+
input: inner.input,
|
|
271
|
+
readOnly: inner.readOnly,
|
|
272
|
+
// The helper's own step ids mean nothing here: the step that delegated it does.
|
|
273
|
+
stepId: node?.stepId,
|
|
274
|
+
subagent: {
|
|
275
|
+
id: inner.subagent.id,
|
|
276
|
+
depth: inner.subagent.depth,
|
|
277
|
+
...node ? { name: node.name } : {},
|
|
278
|
+
...node?.role ? { role: node.role } : {}
|
|
279
|
+
},
|
|
280
|
+
status: "pending"
|
|
281
|
+
}
|
|
282
|
+
]
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
case "tool.approval-resolved":
|
|
286
|
+
return known.approvals.some((a) => a.id === inner.id) ? {
|
|
287
|
+
...known,
|
|
288
|
+
approvals: patchApproval(known.approvals, inner.id, (a) => ({
|
|
289
|
+
...a,
|
|
290
|
+
status: inner.approved ? "approved" : "denied",
|
|
291
|
+
reason: inner.reason,
|
|
292
|
+
automatic: inner.automatic
|
|
293
|
+
}))
|
|
294
|
+
} : known;
|
|
295
|
+
// What a subagent generated is in the same workspace: it shows in the turn (its step
|
|
296
|
+
// ids are its own, so it is tied to no step here).
|
|
297
|
+
case "media.generated":
|
|
298
|
+
return addMedia(known, mediaOf(inner, false));
|
|
299
|
+
case "media.transcribed":
|
|
300
|
+
return { ...known, transcripts: [...known.transcripts ?? [], transcriptOf(inner)] };
|
|
301
|
+
default:
|
|
302
|
+
return {
|
|
303
|
+
...known,
|
|
304
|
+
subagents: patchSubagent(
|
|
305
|
+
known.subagents,
|
|
306
|
+
event.id,
|
|
307
|
+
(s) => applySubagentEvent(s, inner)
|
|
308
|
+
)
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
case "subagent.complete": {
|
|
313
|
+
const known = ensureSubagent(state, event.id, event.name, ancestors, ctx);
|
|
314
|
+
return {
|
|
315
|
+
...known,
|
|
316
|
+
subagents: patchSubagent(known.subagents, event.id, (s) => ({
|
|
317
|
+
...s,
|
|
318
|
+
status: "done",
|
|
319
|
+
activity: "done",
|
|
320
|
+
text: event.text,
|
|
321
|
+
usage: event.usage,
|
|
322
|
+
...subagentDuration(s, ctx.at)
|
|
323
|
+
}))
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
case "subagent.error": {
|
|
327
|
+
const known = ensureSubagent(state, event.id, event.name, ancestors, ctx);
|
|
328
|
+
return {
|
|
329
|
+
...known,
|
|
330
|
+
subagents: patchSubagent(known.subagents, event.id, (s) => ({
|
|
331
|
+
...s,
|
|
332
|
+
status: event.stopped ? "stopped" : "error",
|
|
333
|
+
activity: event.stopped ? "stopped" : "failed",
|
|
334
|
+
error: event.error,
|
|
335
|
+
// A helper says what it had spent when it ended; a static subagent does not.
|
|
336
|
+
...event.usage ? { usage: event.usage } : {},
|
|
337
|
+
...subagentDuration(s, ctx.at)
|
|
338
|
+
}))
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
var subagentTree = (subagents) => {
|
|
344
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
345
|
+
for (const s of subagents) nodes.set(s.id, { ...s, children: [] });
|
|
346
|
+
const loops = (node) => {
|
|
347
|
+
let up = node.parentId;
|
|
348
|
+
for (let i = 0; up !== void 0 && i <= nodes.size; i++) {
|
|
349
|
+
if (up === node.id) return true;
|
|
350
|
+
up = nodes.get(up)?.parentId;
|
|
351
|
+
}
|
|
352
|
+
return false;
|
|
353
|
+
};
|
|
354
|
+
const roots = [];
|
|
355
|
+
for (const node of nodes.values()) {
|
|
356
|
+
const parent = node.parentId !== void 0 && !loops(node) ? nodes.get(node.parentId) : void 0;
|
|
357
|
+
if (parent) parent.children.push(node);
|
|
358
|
+
else roots.push(node);
|
|
359
|
+
}
|
|
360
|
+
return roots;
|
|
361
|
+
};
|
|
106
362
|
var finalizeAssistant = (messages, content, extra = {}) => {
|
|
107
363
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
108
364
|
const m = messages[i];
|
|
@@ -129,16 +385,16 @@ var streamAssistant = (messages, content) => {
|
|
|
129
385
|
var applyEvent = (state, event, ctx) => {
|
|
130
386
|
switch (event.type) {
|
|
131
387
|
case "run.start": {
|
|
132
|
-
const
|
|
133
|
-
const userId = `msg-${
|
|
134
|
-
const assistantId = `msg-${
|
|
388
|
+
const base = resetRun(state);
|
|
389
|
+
const userId = `msg-${base.seq}`;
|
|
390
|
+
const assistantId = `msg-${base.seq + 1}`;
|
|
135
391
|
return {
|
|
136
|
-
...
|
|
392
|
+
...base,
|
|
137
393
|
goal: event.goal,
|
|
138
394
|
runStartedAt: ctx.at,
|
|
139
395
|
runMessageId: assistantId,
|
|
140
396
|
messages: [
|
|
141
|
-
...
|
|
397
|
+
...base.messages,
|
|
142
398
|
{
|
|
143
399
|
id: userId,
|
|
144
400
|
role: "user",
|
|
@@ -148,7 +404,7 @@ var applyEvent = (state, event, ctx) => {
|
|
|
148
404
|
},
|
|
149
405
|
{ id: assistantId, role: "assistant", content: "", pending: true }
|
|
150
406
|
],
|
|
151
|
-
seq:
|
|
407
|
+
seq: base.seq + 2
|
|
152
408
|
};
|
|
153
409
|
}
|
|
154
410
|
case "model.load":
|
|
@@ -184,10 +440,39 @@ var applyEvent = (state, event, ctx) => {
|
|
|
184
440
|
reasoning: "",
|
|
185
441
|
toolCalls: [],
|
|
186
442
|
status: "running",
|
|
187
|
-
blocked: false
|
|
443
|
+
blocked: false,
|
|
444
|
+
// Only with `config.executorTiers`: without it the view is what it always was.
|
|
445
|
+
...event.tier !== void 0 ? { tier: event.tier } : {},
|
|
446
|
+
...event.model !== void 0 ? { model: event.model } : {},
|
|
447
|
+
...event.tierReason !== void 0 ? { tierReason: event.tierReason } : {}
|
|
188
448
|
};
|
|
189
449
|
return { ...state, steps: [...state.steps, view] };
|
|
190
450
|
}
|
|
451
|
+
case "step.escalated":
|
|
452
|
+
return {
|
|
453
|
+
...state,
|
|
454
|
+
steps: patchStep(state.steps, event.step.id, (s) => {
|
|
455
|
+
const attempt = (s.escalations?.length ?? 0) + 1;
|
|
456
|
+
return {
|
|
457
|
+
...s,
|
|
458
|
+
tier: event.to,
|
|
459
|
+
...event.model ? { model: event.model } : {},
|
|
460
|
+
text: "",
|
|
461
|
+
reasoning: "",
|
|
462
|
+
toolCalls: s.toolCalls.map((c) => c.attempt === void 0 ? { ...c, attempt } : c),
|
|
463
|
+
escalations: [
|
|
464
|
+
...s.escalations ?? [],
|
|
465
|
+
{
|
|
466
|
+
from: event.from,
|
|
467
|
+
to: event.to,
|
|
468
|
+
reason: event.reason,
|
|
469
|
+
...event.model ? { model: event.model } : {},
|
|
470
|
+
...s.text.trim() ? { text: s.text } : {}
|
|
471
|
+
}
|
|
472
|
+
]
|
|
473
|
+
};
|
|
474
|
+
})
|
|
475
|
+
};
|
|
191
476
|
case "step.reasoning-delta":
|
|
192
477
|
return {
|
|
193
478
|
...state,
|
|
@@ -231,6 +516,7 @@ var applyEvent = (state, event, ctx) => {
|
|
|
231
516
|
ok: event.ok,
|
|
232
517
|
status: "done",
|
|
233
518
|
outputTokens: approxTokens(event.output),
|
|
519
|
+
...isReplayedToolOutput(event.output) ? { replayed: true } : {},
|
|
234
520
|
...ctx.at !== void 0 && c.startedAt !== void 0 ? { durationMs: Math.max(0, ctx.at - c.startedAt) } : {}
|
|
235
521
|
};
|
|
236
522
|
}
|
|
@@ -246,6 +532,16 @@ var applyEvent = (state, event, ctx) => {
|
|
|
246
532
|
...s,
|
|
247
533
|
status: "done",
|
|
248
534
|
summary: event.result.summary,
|
|
535
|
+
// With tiers: where the step finished and how it got there. The result's list is the
|
|
536
|
+
// authority; an escalation seen live keeps what only the event told (model, text).
|
|
537
|
+
...event.result.tier !== void 0 ? { tier: event.result.tier } : {},
|
|
538
|
+
...event.result.model !== void 0 ? { model: event.result.model } : {},
|
|
539
|
+
...event.result.escalations?.length ? {
|
|
540
|
+
escalations: event.result.escalations.map((e, i) => {
|
|
541
|
+
const live = s.escalations?.[i];
|
|
542
|
+
return live && live.from === e.from && live.to === e.to ? { ...live, reason: e.reason } : { from: e.from, to: e.to, reason: e.reason };
|
|
543
|
+
})
|
|
544
|
+
} : {},
|
|
249
545
|
blocked: event.result.blocked,
|
|
250
546
|
// The result carries the authoritative, ordered tool-call list; keep
|
|
251
547
|
// the timing the streamed calls measured (matched in order per name).
|
|
@@ -264,21 +560,68 @@ var applyEvent = (state, event, ctx) => {
|
|
|
264
560
|
inputTokens: approxTokens(c.input),
|
|
265
561
|
outputTokens: approxTokens(c.output),
|
|
266
562
|
...streamed?.startedAt !== void 0 ? { startedAt: streamed.startedAt } : {},
|
|
267
|
-
...streamed?.durationMs !== void 0 ? { durationMs: streamed.durationMs } : {}
|
|
563
|
+
...streamed?.durationMs !== void 0 ? { durationMs: streamed.durationMs } : {},
|
|
564
|
+
// With tiers the list holds every attempt's calls, in the order they were made.
|
|
565
|
+
...streamed?.attempt !== void 0 ? { attempt: streamed.attempt } : {},
|
|
566
|
+
...isReplayedToolOutput(c.output) ? { replayed: true } : {}
|
|
268
567
|
};
|
|
269
568
|
});
|
|
270
569
|
})()
|
|
271
570
|
}))
|
|
272
571
|
};
|
|
273
|
-
case "replan.decision":
|
|
572
|
+
case "replan.decision": {
|
|
573
|
+
if (!event.failed) {
|
|
574
|
+
return {
|
|
575
|
+
...state,
|
|
576
|
+
replan: {
|
|
577
|
+
mode: event.mode,
|
|
578
|
+
reason: event.reason,
|
|
579
|
+
...event.byUser ? { byUser: true } : {},
|
|
580
|
+
...event.confidence !== void 0 ? { confidence: event.confidence } : {}
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
const error = state.replan?.failed ? state.replan.error : void 0;
|
|
585
|
+
const last = state.steps[state.steps.length - 1];
|
|
274
586
|
return {
|
|
275
587
|
...state,
|
|
276
588
|
replan: {
|
|
277
589
|
mode: event.mode,
|
|
278
590
|
reason: event.reason,
|
|
279
|
-
...event.byUser ? { byUser: true } : {}
|
|
280
|
-
|
|
591
|
+
...event.byUser ? { byUser: true } : {},
|
|
592
|
+
failed: true,
|
|
593
|
+
...error ? { error } : {}
|
|
594
|
+
},
|
|
595
|
+
steps: last ? patchStep(state.steps, last.id, (s) => ({
|
|
596
|
+
...s,
|
|
597
|
+
replanFailed: error ?? event.reason
|
|
598
|
+
})) : state.steps
|
|
281
599
|
};
|
|
600
|
+
}
|
|
601
|
+
case "decision": {
|
|
602
|
+
const view = {
|
|
603
|
+
point: event.point,
|
|
604
|
+
accepted: event.accepted,
|
|
605
|
+
...event.choice !== void 0 ? { choice: event.choice } : {},
|
|
606
|
+
...event.confidence !== void 0 ? { confidence: event.confidence } : {},
|
|
607
|
+
threshold: event.threshold,
|
|
608
|
+
...event.reason ? { reason: event.reason } : {},
|
|
609
|
+
durationMs: event.durationMs,
|
|
610
|
+
...event.model ? { model: event.model } : {}
|
|
611
|
+
};
|
|
612
|
+
const last = state.steps[state.steps.length - 1];
|
|
613
|
+
return last ? {
|
|
614
|
+
...state,
|
|
615
|
+
steps: patchStep(state.steps, last.id, (s) => ({
|
|
616
|
+
...s,
|
|
617
|
+
decisions: [...s.decisions ?? [], view]
|
|
618
|
+
}))
|
|
619
|
+
} : { ...state, decisions: [...state.decisions ?? [], view] };
|
|
620
|
+
}
|
|
621
|
+
case "media.generated":
|
|
622
|
+
return addMedia(state, mediaOf(event, true));
|
|
623
|
+
case "media.transcribed":
|
|
624
|
+
return { ...state, transcripts: [...state.transcripts ?? [], transcriptOf(event)] };
|
|
282
625
|
case "message.queued":
|
|
283
626
|
return state.queued.some((q) => q.id === event.id) ? state : { ...state, queued: [...state.queued, { id: event.id, text: event.text }] };
|
|
284
627
|
case "message.delivered": {
|
|
@@ -321,6 +664,7 @@ var applyEvent = (state, event, ctx) => {
|
|
|
321
664
|
input: event.input,
|
|
322
665
|
readOnly: event.readOnly,
|
|
323
666
|
stepId: event.step?.id,
|
|
667
|
+
...event.subagent ? { subagent: event.subagent } : {},
|
|
324
668
|
status: "pending"
|
|
325
669
|
}
|
|
326
670
|
]
|
|
@@ -352,55 +696,10 @@ var applyEvent = (state, event, ctx) => {
|
|
|
352
696
|
};
|
|
353
697
|
}
|
|
354
698
|
case "subagent.start":
|
|
355
|
-
return {
|
|
356
|
-
...state,
|
|
357
|
-
subagents: [
|
|
358
|
-
...state.subagents,
|
|
359
|
-
{
|
|
360
|
-
id: event.id,
|
|
361
|
-
name: event.name,
|
|
362
|
-
task: event.task,
|
|
363
|
-
status: "running",
|
|
364
|
-
...event.profile ? { profile: event.profile } : {},
|
|
365
|
-
stepId: runningStepId(state.steps),
|
|
366
|
-
activity: "starting",
|
|
367
|
-
steps: 0,
|
|
368
|
-
toolCalls: 0,
|
|
369
|
-
text: "",
|
|
370
|
-
usage: emptyUsage()
|
|
371
|
-
}
|
|
372
|
-
]
|
|
373
|
-
};
|
|
374
699
|
case "subagent.event":
|
|
375
|
-
return {
|
|
376
|
-
...state,
|
|
377
|
-
subagents: patchSubagent(
|
|
378
|
-
state.subagents,
|
|
379
|
-
event.id,
|
|
380
|
-
(s) => applySubagentEvent(s, event.event)
|
|
381
|
-
)
|
|
382
|
-
};
|
|
383
700
|
case "subagent.complete":
|
|
384
|
-
return {
|
|
385
|
-
...state,
|
|
386
|
-
subagents: patchSubagent(state.subagents, event.id, (s) => ({
|
|
387
|
-
...s,
|
|
388
|
-
status: "done",
|
|
389
|
-
activity: "done",
|
|
390
|
-
text: event.text,
|
|
391
|
-
usage: event.usage
|
|
392
|
-
}))
|
|
393
|
-
};
|
|
394
701
|
case "subagent.error":
|
|
395
|
-
return
|
|
396
|
-
...state,
|
|
397
|
-
subagents: patchSubagent(state.subagents, event.id, (s) => ({
|
|
398
|
-
...s,
|
|
399
|
-
status: event.stopped ? "stopped" : "error",
|
|
400
|
-
activity: event.stopped ? "stopped" : "failed",
|
|
401
|
-
error: event.error
|
|
402
|
-
}))
|
|
403
|
-
};
|
|
702
|
+
return applySubagent(state, event, [], ctx);
|
|
404
703
|
case "skill.activated":
|
|
405
704
|
return state.skills.includes(event.name) ? state : { ...state, skills: [...state.skills, event.name] };
|
|
406
705
|
case "skill.learned": {
|
|
@@ -465,6 +764,12 @@ var applyEvent = (state, event, ctx) => {
|
|
|
465
764
|
)
|
|
466
765
|
};
|
|
467
766
|
case "error":
|
|
767
|
+
if (event.phase === "replan") {
|
|
768
|
+
return {
|
|
769
|
+
...state,
|
|
770
|
+
replan: { mode: "continue", reason: "", failed: true, error: event.error }
|
|
771
|
+
};
|
|
772
|
+
}
|
|
468
773
|
return event.phase === "run" ? {
|
|
469
774
|
...state,
|
|
470
775
|
error: event.error,
|
|
@@ -497,6 +802,9 @@ var syncRunMessage = (state) => {
|
|
|
497
802
|
if (state.learnedNow.length > 0 && m.learned !== state.learnedNow)
|
|
498
803
|
patch.learned = state.learnedNow;
|
|
499
804
|
if (state.fetches.length > 0 && m.fetches !== state.fetches) patch.fetches = state.fetches;
|
|
805
|
+
if (state.media && m.media !== state.media) patch.media = state.media;
|
|
806
|
+
if (state.transcripts && m.transcripts !== state.transcripts)
|
|
807
|
+
patch.transcripts = state.transcripts;
|
|
500
808
|
if ((m.approvals?.length ?? 0) !== decided.length || decided.some((a, k) => m.approvals?.[k] !== a)) {
|
|
501
809
|
patch.approvals = decided;
|
|
502
810
|
}
|
|
@@ -551,9 +859,6 @@ var agentStateReducer = (state, action) => {
|
|
|
551
859
|
}
|
|
552
860
|
};
|
|
553
861
|
|
|
554
|
-
// src/util.ts
|
|
555
|
-
var errMessage = (err) => err instanceof Error ? err.message : String(err);
|
|
556
|
-
|
|
557
862
|
// src/hooks/use-agent.ts
|
|
558
863
|
var useAgent = (config, options = {}) => {
|
|
559
864
|
const [state, dispatch] = useReducer(agentStateReducer, void 0, createInitialAgentState);
|
|
@@ -1475,7 +1780,54 @@ var defaultLabels = {
|
|
|
1475
1780
|
stopSubagent: "Stop this subagent",
|
|
1476
1781
|
subagentStopped: "stopped",
|
|
1477
1782
|
failed: "failed",
|
|
1478
|
-
toolCostTitle: "Estimated tokens of the arguments and of the result fed back to the model (chars / 4), and the call's duration"
|
|
1783
|
+
toolCostTitle: "Estimated tokens of the arguments and of the result fed back to the model (chars / 4), and the call's duration",
|
|
1784
|
+
tierNames: { light: "light", standard: "standard", strong: "strong" },
|
|
1785
|
+
tierReasons: {
|
|
1786
|
+
planned: "The planner rated this step for this model tier",
|
|
1787
|
+
default: "The planner did not rate this step: it runs on the standard model",
|
|
1788
|
+
fallback: "The tier the planner asked for is not configured: the nearest one runs the step"
|
|
1789
|
+
},
|
|
1790
|
+
escalationReasons: {
|
|
1791
|
+
blocked: "reported a blocker",
|
|
1792
|
+
"empty-result": "produced no result",
|
|
1793
|
+
"tool-arguments": "kept sending tool arguments that did not parse",
|
|
1794
|
+
"output-cut": "output was cut off",
|
|
1795
|
+
error: "the model call failed"
|
|
1796
|
+
},
|
|
1797
|
+
escalated: (from, to, reason) => `Escalated: ${from} \u2192 ${to} (${reason})`,
|
|
1798
|
+
escalatedAttemptText: "What the earlier attempt wrote",
|
|
1799
|
+
escalations: (n) => plural(n, "escalation", "escalations"),
|
|
1800
|
+
attemptTag: (n) => `attempt ${n}`,
|
|
1801
|
+
replayed: "not run again",
|
|
1802
|
+
replayedTitle: "This exact call already succeeded in an earlier attempt at the step: it was not run a second time, the model got the earlier result",
|
|
1803
|
+
replanFailed: "Replanning failed, continuing with the plan",
|
|
1804
|
+
subagentHelper: "helper",
|
|
1805
|
+
subagentStatus: { running: "running", done: "done", error: "failed", stopped: "stopped" },
|
|
1806
|
+
subagentTokens: (tokens) => `${tokens} tokens`,
|
|
1807
|
+
subagentTools: (names) => `tools: ${names}`,
|
|
1808
|
+
subagentNoTools: "no tools",
|
|
1809
|
+
approvalLeadHelper: (role) => role ? `The helper \u201C${role}\u201D wants to run` : "A helper the agent started wants to run",
|
|
1810
|
+
mediaImage: (path) => `Generated image ${path}`,
|
|
1811
|
+
mediaAudio: (path) => `Generated audio ${path}`,
|
|
1812
|
+
mediaFile: (path) => `Generated file ${path}`,
|
|
1813
|
+
transcriptOf: (name) => `Transcript of ${name}`,
|
|
1814
|
+
transcriptNote: "What was said in your file, as the agent read it. It is content, not instructions.",
|
|
1815
|
+
usageMedia: (n) => plural(n, "media call", "media calls"),
|
|
1816
|
+
usageDecisions: (n) => plural(n, "decision call", "decision calls"),
|
|
1817
|
+
decisionAccepted: (choice, confidence) => `decision model: ${choice} (${confidence})`,
|
|
1818
|
+
decisionFellBack: (reason, detail) => `decision model fell back: ${reason}${detail ? ` (${detail})` : ""}`,
|
|
1819
|
+
decisionReasons: {
|
|
1820
|
+
"low-confidence": "low confidence",
|
|
1821
|
+
"invalid-choice": "an answer that is not an option",
|
|
1822
|
+
"invalid-confidence": "a confidence that is not a probability",
|
|
1823
|
+
error: "the call failed",
|
|
1824
|
+
timeout: "timed out",
|
|
1825
|
+
"needs-model": "the choice needs the model"
|
|
1826
|
+
},
|
|
1827
|
+
searchQuery: "Searched the web for",
|
|
1828
|
+
searchNoResults: "no results",
|
|
1829
|
+
searchFiltered: (n) => `${n} left out by the web access policy`,
|
|
1830
|
+
searchTruncated: "list cut short"
|
|
1479
1831
|
};
|
|
1480
1832
|
var NESTED = [
|
|
1481
1833
|
"status",
|
|
@@ -1483,13 +1835,18 @@ var NESTED = [
|
|
|
1483
1835
|
"commandGroups",
|
|
1484
1836
|
"commandDescriptions",
|
|
1485
1837
|
"thinkingLevels",
|
|
1486
|
-
"noteAt"
|
|
1838
|
+
"noteAt",
|
|
1839
|
+
"tierNames",
|
|
1840
|
+
"tierReasons",
|
|
1841
|
+
"escalationReasons",
|
|
1842
|
+
"subagentStatus",
|
|
1843
|
+
"decisionReasons"
|
|
1487
1844
|
];
|
|
1488
|
-
var mergeLabels = (
|
|
1489
|
-
if (!over) return
|
|
1490
|
-
const out = { ...
|
|
1845
|
+
var mergeLabels = (base, over) => {
|
|
1846
|
+
if (!over) return base;
|
|
1847
|
+
const out = { ...base, ...over };
|
|
1491
1848
|
for (const key of NESTED) {
|
|
1492
|
-
if (over[key]) out[key] = { ...
|
|
1849
|
+
if (over[key]) out[key] = { ...base[key], ...over[key] };
|
|
1493
1850
|
}
|
|
1494
1851
|
return out;
|
|
1495
1852
|
};
|
|
@@ -1569,86 +1926,11 @@ var useAgentContext = () => {
|
|
|
1569
1926
|
var useOptionalAgentContext = () => useContext2(AgentContext);
|
|
1570
1927
|
|
|
1571
1928
|
// src/components/AgentChat.tsx
|
|
1572
|
-
import { useEffect as
|
|
1929
|
+
import { useEffect as useEffect9, useRef as useRef7, useState as useState11 } from "react";
|
|
1573
1930
|
|
|
1574
1931
|
// src/components/AgentComposer.tsx
|
|
1575
1932
|
import { useEffect as useEffect5, useLayoutEffect, useMemo as useMemo4, useRef as useRef5, useState as useState7 } from "react";
|
|
1576
|
-
|
|
1577
|
-
// src/components/icons.tsx
|
|
1578
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
1579
|
-
var base = (size = 16) => ({
|
|
1580
|
-
width: size,
|
|
1581
|
-
height: size,
|
|
1582
|
-
viewBox: "0 0 24 24",
|
|
1583
|
-
fill: "none",
|
|
1584
|
-
stroke: "currentColor",
|
|
1585
|
-
strokeWidth: 2,
|
|
1586
|
-
strokeLinecap: "round",
|
|
1587
|
-
strokeLinejoin: "round",
|
|
1588
|
-
"aria-hidden": true
|
|
1589
|
-
});
|
|
1590
|
-
var SendIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
1591
|
-
/* @__PURE__ */ jsx3("path", { d: "M22 2 11 13" }),
|
|
1592
|
-
/* @__PURE__ */ jsx3("path", { d: "M22 2 15 22l-4-9-9-4Z" })
|
|
1593
|
-
] });
|
|
1594
|
-
var StopIcon = ({ size, className }) => /* @__PURE__ */ jsx3("svg", { ...base(size), className, children: /* @__PURE__ */ jsx3("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" }) });
|
|
1595
|
-
var SpinnerIcon = ({ size, className }) => /* @__PURE__ */ jsx3("svg", { ...base(size), className: ["awr-spin", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx3("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) });
|
|
1596
|
-
var CheckIcon = ({ size, className }) => /* @__PURE__ */ jsx3("svg", { ...base(size), className, children: /* @__PURE__ */ jsx3("path", { d: "M20 6 9 17l-5-5" }) });
|
|
1597
|
-
var AlertIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
1598
|
-
/* @__PURE__ */ jsx3("path", { d: "M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z" }),
|
|
1599
|
-
/* @__PURE__ */ jsx3("path", { d: "M12 9v4" }),
|
|
1600
|
-
/* @__PURE__ */ jsx3("path", { d: "M12 17h.01" })
|
|
1601
|
-
] });
|
|
1602
|
-
var ToolIcon = ({ size, className }) => /* @__PURE__ */ jsx3("svg", { ...base(size), className, children: /* @__PURE__ */ jsx3("path", { d: "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76Z" }) });
|
|
1603
|
-
var ShieldIcon = ({ size, className }) => /* @__PURE__ */ jsx3("svg", { ...base(size), className, children: /* @__PURE__ */ jsx3("path", { d: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z" }) });
|
|
1604
|
-
var BrainIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
1605
|
-
/* @__PURE__ */ jsx3("path", { d: "M9 3a3 3 0 0 0-3 3 3 3 0 0 0-2 5 3 3 0 0 0 2 5 3 3 0 0 0 6 1V4a3 3 0 0 0-3-1Z" }),
|
|
1606
|
-
/* @__PURE__ */ jsx3("path", { d: "M15 3a3 3 0 0 1 3 3 3 3 0 0 1 2 5 3 3 0 0 1-2 5 3 3 0 0 1-6 1" })
|
|
1607
|
-
] });
|
|
1608
|
-
var BotIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
1609
|
-
/* @__PURE__ */ jsx3("rect", { x: "4", y: "8", width: "16", height: "12", rx: "3" }),
|
|
1610
|
-
/* @__PURE__ */ jsx3("path", { d: "M12 8V4" }),
|
|
1611
|
-
/* @__PURE__ */ jsx3("path", { d: "M9 14h.01M15 14h.01" })
|
|
1612
|
-
] });
|
|
1613
|
-
var PlusIcon = ({ size, className }) => /* @__PURE__ */ jsx3("svg", { ...base(size), className, children: /* @__PURE__ */ jsx3("path", { d: "M12 5v14M5 12h14" }) });
|
|
1614
|
-
var SlashIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
1615
|
-
/* @__PURE__ */ jsx3("rect", { x: "3", y: "3", width: "18", height: "18", rx: "3" }),
|
|
1616
|
-
/* @__PURE__ */ jsx3("path", { d: "m15 7-6 10" })
|
|
1617
|
-
] });
|
|
1618
|
-
var ClockIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
1619
|
-
/* @__PURE__ */ jsx3("circle", { cx: "12", cy: "12", r: "9" }),
|
|
1620
|
-
/* @__PURE__ */ jsx3("path", { d: "M12 7v5l3 2" })
|
|
1621
|
-
] });
|
|
1622
|
-
var MicIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
1623
|
-
/* @__PURE__ */ jsx3("rect", { x: "9", y: "3", width: "6", height: "11", rx: "3" }),
|
|
1624
|
-
/* @__PURE__ */ jsx3("path", { d: "M5 11a7 7 0 0 0 14 0M12 18v3" })
|
|
1625
|
-
] });
|
|
1626
|
-
var BoltIcon = ({ size, className }) => /* @__PURE__ */ jsx3("svg", { ...base(size), className, children: /* @__PURE__ */ jsx3("path", { d: "M13 2 4 14h7l-1 8 9-12h-7Z" }) });
|
|
1627
|
-
var EyeIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
1628
|
-
/* @__PURE__ */ jsx3("path", { d: "M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z" }),
|
|
1629
|
-
/* @__PURE__ */ jsx3("circle", { cx: "12", cy: "12", r: "3" })
|
|
1630
|
-
] });
|
|
1631
|
-
var XIcon = ({ size, className }) => /* @__PURE__ */ jsx3("svg", { ...base(size), className, children: /* @__PURE__ */ jsx3("path", { d: "M18 6 6 18M6 6l12 12" }) });
|
|
1632
|
-
var FileIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
1633
|
-
/* @__PURE__ */ jsx3("path", { d: "M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9Z" }),
|
|
1634
|
-
/* @__PURE__ */ jsx3("path", { d: "M14 3v6h6" })
|
|
1635
|
-
] });
|
|
1636
|
-
var HistoryIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
1637
|
-
/* @__PURE__ */ jsx3("path", { d: "M3 12a9 9 0 1 0 3-6.7L3 8" }),
|
|
1638
|
-
/* @__PURE__ */ jsx3("path", { d: "M3 3v5h5M12 7v5l3 2" })
|
|
1639
|
-
] });
|
|
1640
|
-
var BookIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
1641
|
-
/* @__PURE__ */ jsx3("path", { d: "M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2Z" }),
|
|
1642
|
-
/* @__PURE__ */ jsx3("path", { d: "M4 19V5M9 7h6" })
|
|
1643
|
-
] });
|
|
1644
|
-
var GlobeIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
1645
|
-
/* @__PURE__ */ jsx3("circle", { cx: "12", cy: "12", r: "9" }),
|
|
1646
|
-
/* @__PURE__ */ jsx3("path", { d: "M3 12h18M12 3c3 3.2 3 14.8 0 18M12 3c-3 3.2-3 14.8 0 18" })
|
|
1647
|
-
] });
|
|
1648
|
-
var DownloadIcon = ({ size, className }) => /* @__PURE__ */ jsx3("svg", { ...base(size), className, children: /* @__PURE__ */ jsx3("path", { d: "M12 3v12m-5-5 5 5 5-5M5 21h14" }) });
|
|
1649
|
-
|
|
1650
|
-
// src/components/AgentComposer.tsx
|
|
1651
|
-
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1933
|
+
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
1652
1934
|
var thinkingDefaults = (l) => [
|
|
1653
1935
|
{ id: "off", label: l.thinkingLevels.off },
|
|
1654
1936
|
{ id: "none", label: l.thinkingLevels.none },
|
|
@@ -1657,7 +1939,7 @@ var thinkingDefaults = (l) => [
|
|
|
1657
1939
|
{ id: "high", label: l.thinkingLevels.high }
|
|
1658
1940
|
];
|
|
1659
1941
|
var MODES = ["autopilot", "ask-writes", "ask-all", "read-only"];
|
|
1660
|
-
var ModeIcon = ({ mode }) => mode === "autopilot" ? /* @__PURE__ */
|
|
1942
|
+
var ModeIcon = ({ mode }) => mode === "autopilot" ? /* @__PURE__ */ jsx3(BoltIcon, { size: 14 }) : mode === "read-only" ? /* @__PURE__ */ jsx3(EyeIcon, { size: 14 }) : /* @__PURE__ */ jsx3(ShieldIcon, { size: 14 });
|
|
1661
1943
|
var attachSeq = 0;
|
|
1662
1944
|
var useIsoLayoutEffect = typeof window === "undefined" ? useEffect5 : useLayoutEffect;
|
|
1663
1945
|
var useMenuPlacement = (open, anchor, align) => {
|
|
@@ -2114,24 +2396,24 @@ var AgentComposer = ({
|
|
|
2114
2396
|
const thinkingLabel = thinking ? thinkingOptions.find((o) => o.id === thinking.value)?.label ?? thinking.value : void 0;
|
|
2115
2397
|
const canSend = ready && (text.trim().length > 0 || pending.length > 0);
|
|
2116
2398
|
const canSteer = busy && steering && text.trim().length > 0;
|
|
2117
|
-
const queuedStrip = showQueued && (agent.queued.length > 0 || agent.undelivered.length > 0) ? /* @__PURE__ */
|
|
2118
|
-
agent.queued.map((q) => /* @__PURE__ */
|
|
2119
|
-
/* @__PURE__ */
|
|
2120
|
-
/* @__PURE__ */
|
|
2121
|
-
/* @__PURE__ */
|
|
2399
|
+
const queuedStrip = showQueued && (agent.queued.length > 0 || agent.undelivered.length > 0) ? /* @__PURE__ */ jsxs("div", { className: "awr-queued", children: [
|
|
2400
|
+
agent.queued.map((q) => /* @__PURE__ */ jsxs("div", { className: "awr-queued__item", role: "status", children: [
|
|
2401
|
+
/* @__PURE__ */ jsx3(ClockIcon, { size: 13, className: "awr-queued__icon" }),
|
|
2402
|
+
/* @__PURE__ */ jsx3("span", { className: "awr-queued__text", title: q.text, children: q.text }),
|
|
2403
|
+
/* @__PURE__ */ jsx3("span", { className: "awr-queued__state", children: L.queuedWaiting })
|
|
2122
2404
|
] }, q.id)),
|
|
2123
|
-
agent.undelivered.length > 0 && /* @__PURE__ */
|
|
2124
|
-
/* @__PURE__ */
|
|
2125
|
-
/* @__PURE__ */
|
|
2405
|
+
agent.undelivered.length > 0 && /* @__PURE__ */ jsxs("div", { className: "awr-queued__item awr-queued__item--undelivered", role: "status", children: [
|
|
2406
|
+
/* @__PURE__ */ jsx3(AlertIcon, { size: 13, className: "awr-queued__icon" }),
|
|
2407
|
+
/* @__PURE__ */ jsxs("span", { className: "awr-queued__text", title: agent.undelivered.join("\n\n"), children: [
|
|
2126
2408
|
L.undelivered(agent.undelivered.length),
|
|
2127
2409
|
": ",
|
|
2128
2410
|
agent.undelivered.join(" \xB7 ")
|
|
2129
2411
|
] }),
|
|
2130
|
-
/* @__PURE__ */
|
|
2131
|
-
/* @__PURE__ */
|
|
2412
|
+
/* @__PURE__ */ jsx3("button", { type: "button", className: "awr-linkbtn", onClick: agent.sendUndelivered, children: L.sendUndelivered }),
|
|
2413
|
+
/* @__PURE__ */ jsx3("button", { type: "button", className: "awr-linkbtn", onClick: agent.discardUndelivered, children: L.discardUndelivered })
|
|
2132
2414
|
] })
|
|
2133
2415
|
] }) : null;
|
|
2134
|
-
return /* @__PURE__ */
|
|
2416
|
+
return /* @__PURE__ */ jsxs(
|
|
2135
2417
|
"div",
|
|
2136
2418
|
{
|
|
2137
2419
|
className: [
|
|
@@ -2142,11 +2424,11 @@ var AgentComposer = ({
|
|
|
2142
2424
|
].filter(Boolean).join(" "),
|
|
2143
2425
|
ref: rootRef,
|
|
2144
2426
|
children: [
|
|
2145
|
-
dragging && /* @__PURE__ */
|
|
2427
|
+
dragging && /* @__PURE__ */ jsx3("div", { className: "awr-dropnote", style: dropRect, "aria-hidden": "true", children: L.dropHint }),
|
|
2146
2428
|
queuedStrip,
|
|
2147
|
-
notices.length > 0 && /* @__PURE__ */
|
|
2148
|
-
/* @__PURE__ */
|
|
2149
|
-
/* @__PURE__ */
|
|
2429
|
+
notices.length > 0 && /* @__PURE__ */ jsx3("div", { className: "awr-notices", children: notices.map((n) => /* @__PURE__ */ jsxs("div", { className: `awr-notice awr-notice--${n.tone}`, role: "status", children: [
|
|
2430
|
+
/* @__PURE__ */ jsx3("span", { children: n.text }),
|
|
2431
|
+
/* @__PURE__ */ jsx3(
|
|
2150
2432
|
"button",
|
|
2151
2433
|
{
|
|
2152
2434
|
type: "button",
|
|
@@ -2156,18 +2438,18 @@ var AgentComposer = ({
|
|
|
2156
2438
|
setDismissed((d) => new Set(d).add(n.id));
|
|
2157
2439
|
if (n.id.startsWith("attach:")) setAttachError(void 0);
|
|
2158
2440
|
},
|
|
2159
|
-
children: /* @__PURE__ */
|
|
2441
|
+
children: /* @__PURE__ */ jsx3(XIcon, { size: 14 })
|
|
2160
2442
|
}
|
|
2161
2443
|
)
|
|
2162
2444
|
] }, n.id)) }),
|
|
2163
|
-
paletteOpen && /* @__PURE__ */
|
|
2445
|
+
paletteOpen && /* @__PURE__ */ jsx3(
|
|
2164
2446
|
"ul",
|
|
2165
2447
|
{
|
|
2166
2448
|
className: "awr-menu awr-menu--commands",
|
|
2167
2449
|
style: commandsStyle,
|
|
2168
2450
|
role: "listbox",
|
|
2169
2451
|
"aria-label": L.commands,
|
|
2170
|
-
children: palette.map((c, i) => /* @__PURE__ */
|
|
2452
|
+
children: palette.map((c, i) => /* @__PURE__ */ jsx3("li", { children: /* @__PURE__ */ jsxs(
|
|
2171
2453
|
"button",
|
|
2172
2454
|
{
|
|
2173
2455
|
type: "button",
|
|
@@ -2177,37 +2459,37 @@ var AgentComposer = ({
|
|
|
2177
2459
|
onMouseDown: (e) => e.preventDefault(),
|
|
2178
2460
|
onClick: () => pick(c),
|
|
2179
2461
|
children: [
|
|
2180
|
-
/* @__PURE__ */
|
|
2462
|
+
/* @__PURE__ */ jsxs("code", { children: [
|
|
2181
2463
|
"/",
|
|
2182
2464
|
c.name
|
|
2183
2465
|
] }),
|
|
2184
|
-
/* @__PURE__ */
|
|
2185
|
-
c.group && /* @__PURE__ */
|
|
2466
|
+
/* @__PURE__ */ jsx3("span", { className: "awr-menu__desc", children: c.description }),
|
|
2467
|
+
c.group && /* @__PURE__ */ jsx3("span", { className: "awr-menu__group", children: c.group })
|
|
2186
2468
|
]
|
|
2187
2469
|
}
|
|
2188
2470
|
) }, `${c.group}:${c.name}`))
|
|
2189
2471
|
}
|
|
2190
2472
|
),
|
|
2191
|
-
pending.length > 0 && /* @__PURE__ */
|
|
2473
|
+
pending.length > 0 && /* @__PURE__ */ jsx3("div", { className: "awr-files", children: pending.map((a) => {
|
|
2192
2474
|
const remove = () => setPending((cur) => cur.filter((x) => x.id !== a.id));
|
|
2193
|
-
if (renderAttachment) return /* @__PURE__ */
|
|
2194
|
-
return /* @__PURE__ */
|
|
2195
|
-
a.kind === "image" && a.dataUrl ? /* @__PURE__ */
|
|
2196
|
-
/* @__PURE__ */
|
|
2197
|
-
/* @__PURE__ */
|
|
2475
|
+
if (renderAttachment) return /* @__PURE__ */ jsx3("span", { children: renderAttachment(a, remove) }, a.id);
|
|
2476
|
+
return /* @__PURE__ */ jsxs("span", { className: "awr-chip awr-file", title: a.note ?? a.mediaType, children: [
|
|
2477
|
+
a.kind === "image" && a.dataUrl ? /* @__PURE__ */ jsx3("img", { className: "awr-file__thumb", src: a.dataUrl, alt: a.name }) : /* @__PURE__ */ jsx3(FileIcon, { size: 14 }),
|
|
2478
|
+
/* @__PURE__ */ jsx3("span", { className: "awr-file__name", children: a.name }),
|
|
2479
|
+
/* @__PURE__ */ jsx3(
|
|
2198
2480
|
"button",
|
|
2199
2481
|
{
|
|
2200
2482
|
type: "button",
|
|
2201
2483
|
className: "awr-iconbtn",
|
|
2202
2484
|
"aria-label": L.remove(a.name),
|
|
2203
2485
|
onClick: remove,
|
|
2204
|
-
children: /* @__PURE__ */
|
|
2486
|
+
children: /* @__PURE__ */ jsx3(XIcon, { size: 12 })
|
|
2205
2487
|
}
|
|
2206
2488
|
)
|
|
2207
2489
|
] }, a.id);
|
|
2208
2490
|
}) }),
|
|
2209
|
-
/* @__PURE__ */
|
|
2210
|
-
/* @__PURE__ */
|
|
2491
|
+
/* @__PURE__ */ jsxs("div", { className: "awr-composer2__inputrow", children: [
|
|
2492
|
+
/* @__PURE__ */ jsx3(
|
|
2211
2493
|
"textarea",
|
|
2212
2494
|
{
|
|
2213
2495
|
ref: inputRef,
|
|
@@ -2222,7 +2504,7 @@ var AgentComposer = ({
|
|
|
2222
2504
|
"aria-label": L.message
|
|
2223
2505
|
}
|
|
2224
2506
|
),
|
|
2225
|
-
showMic && /* @__PURE__ */
|
|
2507
|
+
showMic && /* @__PURE__ */ jsx3(
|
|
2226
2508
|
"button",
|
|
2227
2509
|
{
|
|
2228
2510
|
type: "button",
|
|
@@ -2231,14 +2513,14 @@ var AgentComposer = ({
|
|
|
2231
2513
|
title: stt.listening ? L.stopDictation : L.dictateTitle,
|
|
2232
2514
|
onClick: stt.toggle,
|
|
2233
2515
|
disabled,
|
|
2234
|
-
children: /* @__PURE__ */
|
|
2516
|
+
children: /* @__PURE__ */ jsx3(MicIcon, { size: 18 })
|
|
2235
2517
|
}
|
|
2236
2518
|
)
|
|
2237
2519
|
] }),
|
|
2238
|
-
stt.listening && stt.interim && /* @__PURE__ */
|
|
2239
|
-
/* @__PURE__ */
|
|
2240
|
-
attachments !== false && /* @__PURE__ */
|
|
2241
|
-
/* @__PURE__ */
|
|
2520
|
+
stt.listening && stt.interim && /* @__PURE__ */ jsx3("div", { className: "awr-composer2__interim", children: stt.interim }),
|
|
2521
|
+
/* @__PURE__ */ jsxs("div", { className: "awr-toolbar", children: [
|
|
2522
|
+
attachments !== false && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2523
|
+
/* @__PURE__ */ jsx3(
|
|
2242
2524
|
"button",
|
|
2243
2525
|
{
|
|
2244
2526
|
type: "button",
|
|
@@ -2247,10 +2529,10 @@ var AgentComposer = ({
|
|
|
2247
2529
|
title: L.attachTitle,
|
|
2248
2530
|
onClick: () => fileRef.current?.click(),
|
|
2249
2531
|
disabled,
|
|
2250
|
-
children: /* @__PURE__ */
|
|
2532
|
+
children: /* @__PURE__ */ jsx3(PlusIcon, { size: 18 })
|
|
2251
2533
|
}
|
|
2252
2534
|
),
|
|
2253
|
-
/* @__PURE__ */
|
|
2535
|
+
/* @__PURE__ */ jsx3(
|
|
2254
2536
|
"input",
|
|
2255
2537
|
{
|
|
2256
2538
|
ref: fileRef,
|
|
@@ -2262,7 +2544,7 @@ var AgentComposer = ({
|
|
|
2262
2544
|
}
|
|
2263
2545
|
)
|
|
2264
2546
|
] }),
|
|
2265
|
-
/* @__PURE__ */
|
|
2547
|
+
/* @__PURE__ */ jsx3(
|
|
2266
2548
|
"button",
|
|
2267
2549
|
{
|
|
2268
2550
|
type: "button",
|
|
@@ -2270,30 +2552,30 @@ var AgentComposer = ({
|
|
|
2270
2552
|
"aria-label": L.commands,
|
|
2271
2553
|
title: L.commandsTitle,
|
|
2272
2554
|
onClick: () => setMenu(menu === "commands" ? void 0 : "commands"),
|
|
2273
|
-
children: /* @__PURE__ */
|
|
2555
|
+
children: /* @__PURE__ */ jsx3(SlashIcon, { size: 18 })
|
|
2274
2556
|
}
|
|
2275
2557
|
),
|
|
2276
2558
|
toolbarExtra,
|
|
2277
|
-
showTimer && elapsed !== void 0 && /* @__PURE__ */
|
|
2278
|
-
/* @__PURE__ */
|
|
2559
|
+
showTimer && elapsed !== void 0 && /* @__PURE__ */ jsxs("span", { className: "awr-tchip", title: busy ? L.timerRunning : L.timerLast, children: [
|
|
2560
|
+
/* @__PURE__ */ jsx3(ClockIcon, { size: 14 }),
|
|
2279
2561
|
" ",
|
|
2280
2562
|
formatElapsed(elapsed)
|
|
2281
2563
|
] }),
|
|
2282
|
-
showAgents && /* @__PURE__ */
|
|
2564
|
+
showAgents && /* @__PURE__ */ jsxs(
|
|
2283
2565
|
"span",
|
|
2284
2566
|
{
|
|
2285
2567
|
className: `awr-tchip awr-agents${runningAgents.length ? " is-busy" : ""}`,
|
|
2286
2568
|
title: agent.subagents.length ? agent.subagents.map((s) => `${s.name} (${s.status}): ${s.task}`).join("\n") : L.agentsTitle,
|
|
2287
2569
|
children: [
|
|
2288
|
-
/* @__PURE__ */
|
|
2289
|
-
/* @__PURE__ */
|
|
2570
|
+
/* @__PURE__ */ jsx3("span", { className: "awr-agents__dot", "aria-hidden": "true" }),
|
|
2571
|
+
/* @__PURE__ */ jsx3(BotIcon, { size: 14 }),
|
|
2290
2572
|
" ",
|
|
2291
2573
|
compactBar ? runningAgents.length : L.agents(runningAgents.length)
|
|
2292
2574
|
]
|
|
2293
2575
|
}
|
|
2294
2576
|
),
|
|
2295
|
-
(model || thinking) && /* @__PURE__ */
|
|
2296
|
-
/* @__PURE__ */
|
|
2577
|
+
(model || thinking) && /* @__PURE__ */ jsxs("span", { className: "awr-popwrap awr-popwrap--model", ref: modelRef, children: [
|
|
2578
|
+
/* @__PURE__ */ jsxs(
|
|
2297
2579
|
"button",
|
|
2298
2580
|
{
|
|
2299
2581
|
type: "button",
|
|
@@ -2303,15 +2585,15 @@ var AgentComposer = ({
|
|
|
2303
2585
|
"aria-expanded": menu === "model",
|
|
2304
2586
|
title: [model?.label, thinkingLabel].filter(Boolean).join(" \xB7 "),
|
|
2305
2587
|
children: [
|
|
2306
|
-
/* @__PURE__ */
|
|
2307
|
-
thinkingLabel && !compactBar && /* @__PURE__ */
|
|
2588
|
+
/* @__PURE__ */ jsx3("span", { className: "awr-tchip__label", children: model?.label ?? L.model }),
|
|
2589
|
+
thinkingLabel && !compactBar && /* @__PURE__ */ jsx3("span", { className: "awr-tchip__sub", children: thinkingLabel })
|
|
2308
2590
|
]
|
|
2309
2591
|
}
|
|
2310
2592
|
),
|
|
2311
|
-
menu === "model" && /* @__PURE__ */
|
|
2312
|
-
thinking && /* @__PURE__ */
|
|
2313
|
-
/* @__PURE__ */
|
|
2314
|
-
thinkingOptions.map((o) => /* @__PURE__ */
|
|
2593
|
+
menu === "model" && /* @__PURE__ */ jsxs("div", { className: "awr-menu awr-menu--pop", style: modelStyle, role: "menu", children: [
|
|
2594
|
+
thinking && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2595
|
+
/* @__PURE__ */ jsx3("div", { className: "awr-menu__head", children: L.thinking }),
|
|
2596
|
+
thinkingOptions.map((o) => /* @__PURE__ */ jsx3(
|
|
2315
2597
|
"button",
|
|
2316
2598
|
{
|
|
2317
2599
|
type: "button",
|
|
@@ -2327,9 +2609,9 @@ var AgentComposer = ({
|
|
|
2327
2609
|
o.id
|
|
2328
2610
|
))
|
|
2329
2611
|
] }),
|
|
2330
|
-
model?.options?.length ? /* @__PURE__ */
|
|
2331
|
-
/* @__PURE__ */
|
|
2332
|
-
model.options.map((o) => /* @__PURE__ */
|
|
2612
|
+
model?.options?.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2613
|
+
/* @__PURE__ */ jsx3("div", { className: "awr-menu__head", children: L.model }),
|
|
2614
|
+
model.options.map((o) => /* @__PURE__ */ jsxs(
|
|
2333
2615
|
"button",
|
|
2334
2616
|
{
|
|
2335
2617
|
type: "button",
|
|
@@ -2342,7 +2624,7 @@ var AgentComposer = ({
|
|
|
2342
2624
|
},
|
|
2343
2625
|
children: [
|
|
2344
2626
|
o.label,
|
|
2345
|
-
o.group && /* @__PURE__ */
|
|
2627
|
+
o.group && /* @__PURE__ */ jsx3("span", { className: "awr-menu__group", children: o.group })
|
|
2346
2628
|
]
|
|
2347
2629
|
},
|
|
2348
2630
|
o.id
|
|
@@ -2350,10 +2632,10 @@ var AgentComposer = ({
|
|
|
2350
2632
|
] }) : null
|
|
2351
2633
|
] })
|
|
2352
2634
|
] }),
|
|
2353
|
-
/* @__PURE__ */
|
|
2635
|
+
/* @__PURE__ */ jsx3("span", { className: "awr-toolbar__spacer" }),
|
|
2354
2636
|
toolbarEnd,
|
|
2355
|
-
showApprovalMode && /* @__PURE__ */
|
|
2356
|
-
/* @__PURE__ */
|
|
2637
|
+
showApprovalMode && /* @__PURE__ */ jsxs("span", { className: "awr-popwrap", ref: modeRef, children: [
|
|
2638
|
+
/* @__PURE__ */ jsxs(
|
|
2357
2639
|
"button",
|
|
2358
2640
|
{
|
|
2359
2641
|
type: "button",
|
|
@@ -2364,14 +2646,14 @@ var AgentComposer = ({
|
|
|
2364
2646
|
"aria-expanded": menu === "mode",
|
|
2365
2647
|
"aria-label": `${L.toolConsent}: ${MODE_CHIP[agent.approvalMode].label}`,
|
|
2366
2648
|
children: [
|
|
2367
|
-
/* @__PURE__ */
|
|
2649
|
+
/* @__PURE__ */ jsx3(ModeIcon, { mode: agent.approvalMode }),
|
|
2368
2650
|
!compactBar && ` ${MODE_CHIP[agent.approvalMode].label}`
|
|
2369
2651
|
]
|
|
2370
2652
|
}
|
|
2371
2653
|
),
|
|
2372
|
-
menu === "mode" && /* @__PURE__ */
|
|
2373
|
-
/* @__PURE__ */
|
|
2374
|
-
MODES.map((m) => /* @__PURE__ */
|
|
2654
|
+
menu === "mode" && /* @__PURE__ */ jsxs("div", { className: "awr-menu awr-menu--pop", style: modeStyle, role: "menu", children: [
|
|
2655
|
+
/* @__PURE__ */ jsx3("div", { className: "awr-menu__head", children: L.toolConsent }),
|
|
2656
|
+
MODES.map((m) => /* @__PURE__ */ jsxs(
|
|
2375
2657
|
"button",
|
|
2376
2658
|
{
|
|
2377
2659
|
type: "button",
|
|
@@ -2383,27 +2665,27 @@ var AgentComposer = ({
|
|
|
2383
2665
|
setMenu(void 0);
|
|
2384
2666
|
},
|
|
2385
2667
|
children: [
|
|
2386
|
-
/* @__PURE__ */
|
|
2668
|
+
/* @__PURE__ */ jsx3(ModeIcon, { mode: m }),
|
|
2387
2669
|
" ",
|
|
2388
2670
|
MODE_CHIP[m].label,
|
|
2389
|
-
/* @__PURE__ */
|
|
2671
|
+
/* @__PURE__ */ jsx3("span", { className: "awr-menu__desc", children: MODE_CHIP[m].hint })
|
|
2390
2672
|
]
|
|
2391
2673
|
},
|
|
2392
2674
|
m
|
|
2393
2675
|
))
|
|
2394
2676
|
] })
|
|
2395
2677
|
] }),
|
|
2396
|
-
canSteer && /* @__PURE__ */
|
|
2397
|
-
busy ? /* @__PURE__ */
|
|
2678
|
+
canSteer && /* @__PURE__ */ jsx3("button", { type: "button", className: "awr-sendbtn", onClick: submit, "aria-label": L.steer, children: /* @__PURE__ */ jsx3(SendIcon, { size: 16 }) }),
|
|
2679
|
+
busy ? /* @__PURE__ */ jsx3(
|
|
2398
2680
|
"button",
|
|
2399
2681
|
{
|
|
2400
2682
|
type: "button",
|
|
2401
2683
|
className: "awr-sendbtn awr-sendbtn--stop",
|
|
2402
2684
|
onClick: agent.stop,
|
|
2403
2685
|
"aria-label": L.stop,
|
|
2404
|
-
children: /* @__PURE__ */
|
|
2686
|
+
children: /* @__PURE__ */ jsx3(StopIcon, { size: 16 })
|
|
2405
2687
|
}
|
|
2406
|
-
) : /* @__PURE__ */
|
|
2688
|
+
) : /* @__PURE__ */ jsx3(
|
|
2407
2689
|
"button",
|
|
2408
2690
|
{
|
|
2409
2691
|
type: "button",
|
|
@@ -2411,7 +2693,7 @@ var AgentComposer = ({
|
|
|
2411
2693
|
onClick: submit,
|
|
2412
2694
|
disabled: !canSend,
|
|
2413
2695
|
"aria-label": L.send,
|
|
2414
|
-
children: agent.status === "initializing" ? /* @__PURE__ */
|
|
2696
|
+
children: agent.status === "initializing" ? /* @__PURE__ */ jsx3(SpinnerIcon, { size: 16 }) : /* @__PURE__ */ jsx3(SendIcon, { size: 16 })
|
|
2415
2697
|
}
|
|
2416
2698
|
)
|
|
2417
2699
|
] })
|
|
@@ -2422,7 +2704,7 @@ var AgentComposer = ({
|
|
|
2422
2704
|
|
|
2423
2705
|
// src/components/ChatHistoryList.tsx
|
|
2424
2706
|
import { Fragment as Fragment2 } from "react";
|
|
2425
|
-
import { jsx as
|
|
2707
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2426
2708
|
var defaultTime = (ms) => {
|
|
2427
2709
|
const d = new Date(ms);
|
|
2428
2710
|
const today = (/* @__PURE__ */ new Date()).toDateString() === d.toDateString();
|
|
@@ -2438,10 +2720,10 @@ var ChatHistoryList = ({
|
|
|
2438
2720
|
className
|
|
2439
2721
|
}) => {
|
|
2440
2722
|
const L = useLabels(labels);
|
|
2441
|
-
return /* @__PURE__ */
|
|
2442
|
-
/* @__PURE__ */
|
|
2443
|
-
/* @__PURE__ */
|
|
2444
|
-
/* @__PURE__ */
|
|
2723
|
+
return /* @__PURE__ */ jsxs2("div", { className: ["awr-history", className].filter(Boolean).join(" "), children: [
|
|
2724
|
+
/* @__PURE__ */ jsxs2("div", { className: "awr-panel__head", children: [
|
|
2725
|
+
/* @__PURE__ */ jsx4("span", { className: "awr-panel__title", children: title ?? L.history }),
|
|
2726
|
+
/* @__PURE__ */ jsxs2(
|
|
2445
2727
|
"button",
|
|
2446
2728
|
{
|
|
2447
2729
|
type: "button",
|
|
@@ -2449,18 +2731,18 @@ var ChatHistoryList = ({
|
|
|
2449
2731
|
onClick: history.newChat,
|
|
2450
2732
|
disabled,
|
|
2451
2733
|
children: [
|
|
2452
|
-
/* @__PURE__ */
|
|
2734
|
+
/* @__PURE__ */ jsx4(PlusIcon, { size: 14 }),
|
|
2453
2735
|
" ",
|
|
2454
2736
|
L.newChat
|
|
2455
2737
|
]
|
|
2456
2738
|
}
|
|
2457
2739
|
)
|
|
2458
2740
|
] }),
|
|
2459
|
-
!history.loading && history.chats.length === 0 && /* @__PURE__ */
|
|
2460
|
-
/* @__PURE__ */
|
|
2741
|
+
!history.loading && history.chats.length === 0 && /* @__PURE__ */ jsx4("div", { className: "awr-panel__empty", children: L.historyEmpty }),
|
|
2742
|
+
/* @__PURE__ */ jsx4("ul", { className: "awr-history__list", children: history.chats.map((c) => {
|
|
2461
2743
|
const active = c.id === history.currentId;
|
|
2462
|
-
const row = /* @__PURE__ */
|
|
2463
|
-
/* @__PURE__ */
|
|
2744
|
+
const row = /* @__PURE__ */ jsxs2("li", { className: `awr-history__item${active ? " is-active" : ""}`, children: [
|
|
2745
|
+
/* @__PURE__ */ jsxs2(
|
|
2464
2746
|
"button",
|
|
2465
2747
|
{
|
|
2466
2748
|
type: "button",
|
|
@@ -2469,8 +2751,8 @@ var ChatHistoryList = ({
|
|
|
2469
2751
|
disabled: disabled || active,
|
|
2470
2752
|
"aria-current": active ? "true" : void 0,
|
|
2471
2753
|
children: [
|
|
2472
|
-
/* @__PURE__ */
|
|
2473
|
-
/* @__PURE__ */
|
|
2754
|
+
/* @__PURE__ */ jsx4("span", { className: "awr-history__title", children: c.title }),
|
|
2755
|
+
/* @__PURE__ */ jsxs2("span", { className: "awr-history__meta", children: [
|
|
2474
2756
|
formatTime(c.updatedAt),
|
|
2475
2757
|
" \xB7 ",
|
|
2476
2758
|
L.messagesCount(c.messageCount)
|
|
@@ -2478,7 +2760,7 @@ var ChatHistoryList = ({
|
|
|
2478
2760
|
]
|
|
2479
2761
|
}
|
|
2480
2762
|
),
|
|
2481
|
-
/* @__PURE__ */
|
|
2763
|
+
/* @__PURE__ */ jsx4(
|
|
2482
2764
|
"button",
|
|
2483
2765
|
{
|
|
2484
2766
|
type: "button",
|
|
@@ -2487,57 +2769,17 @@ var ChatHistoryList = ({
|
|
|
2487
2769
|
title: L.deleteChat,
|
|
2488
2770
|
onClick: () => void history.remove(c.id),
|
|
2489
2771
|
disabled,
|
|
2490
|
-
children: /* @__PURE__ */
|
|
2772
|
+
children: /* @__PURE__ */ jsx4(XIcon, { size: 14 })
|
|
2491
2773
|
}
|
|
2492
2774
|
)
|
|
2493
2775
|
] }, c.id);
|
|
2494
|
-
return renderChat ? /* @__PURE__ */
|
|
2776
|
+
return renderChat ? /* @__PURE__ */ jsx4(Fragment2, { children: renderChat(c, active, row) }, c.id) : row;
|
|
2495
2777
|
}) })
|
|
2496
2778
|
] });
|
|
2497
2779
|
};
|
|
2498
2780
|
|
|
2499
|
-
// src/components/format.ts
|
|
2500
|
-
var previewValue = (value, max = 140) => {
|
|
2501
|
-
if (value === void 0) return "";
|
|
2502
|
-
let text;
|
|
2503
|
-
if (typeof value === "string") text = value;
|
|
2504
|
-
else {
|
|
2505
|
-
try {
|
|
2506
|
-
text = JSON.stringify(value);
|
|
2507
|
-
} catch {
|
|
2508
|
-
text = String(value);
|
|
2509
|
-
}
|
|
2510
|
-
}
|
|
2511
|
-
text = text.replace(/\s+/g, " ").trim();
|
|
2512
|
-
return text.length > max ? `${text.slice(0, max - 1)}\u2026` : text;
|
|
2513
|
-
};
|
|
2514
|
-
var formatTokens = (n) => n >= 1e3 ? `${(n / 1e3).toFixed(n >= 1e4 ? 0 : 1)}k` : String(n);
|
|
2515
|
-
var formatDuration = (ms) => {
|
|
2516
|
-
if (ms < 1e3) return `${Math.round(ms)} ms`;
|
|
2517
|
-
if (ms < 6e4) return `${(ms / 1e3).toFixed(ms < 1e4 ? 1 : 0)} s`;
|
|
2518
|
-
const s = Math.round(ms / 1e3);
|
|
2519
|
-
return `${Math.floor(s / 60)}m ${s % 60}s`;
|
|
2520
|
-
};
|
|
2521
|
-
var isDataImage = (v) => typeof v === "string" && /^data:image\/[\w.+-]+;base64,/.test(v);
|
|
2522
|
-
var imagesInOutput = (output, depth = 0) => {
|
|
2523
|
-
if (depth > 2 || output == null) return [];
|
|
2524
|
-
if (isDataImage(output)) return [output];
|
|
2525
|
-
if (Array.isArray(output)) return output.flatMap((v) => imagesInOutput(v, depth + 1));
|
|
2526
|
-
if (typeof output === "object") {
|
|
2527
|
-
const o = output;
|
|
2528
|
-
if (o.type === "image" && typeof o.data === "string") {
|
|
2529
|
-
const mime = typeof o.mimeType === "string" ? o.mimeType : "image/png";
|
|
2530
|
-
return [o.data.startsWith("data:") ? o.data : `data:${mime};base64,${o.data}`];
|
|
2531
|
-
}
|
|
2532
|
-
for (const key of ["dataUrl", "url", "image"])
|
|
2533
|
-
if (isDataImage(o[key])) return [o[key]];
|
|
2534
|
-
if (depth < 2) return Object.values(o).flatMap((v) => imagesInOutput(v, depth + 1));
|
|
2535
|
-
}
|
|
2536
|
-
return [];
|
|
2537
|
-
};
|
|
2538
|
-
|
|
2539
2781
|
// src/components/ContextMeter.tsx
|
|
2540
|
-
import { jsx as
|
|
2782
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2541
2783
|
var ContextMeter = ({
|
|
2542
2784
|
usage,
|
|
2543
2785
|
budgetTokens,
|
|
@@ -2555,26 +2797,26 @@ var ContextMeter = ({
|
|
|
2555
2797
|
const hitRate = usage.inputTokens > 0 ? Math.round(cached / usage.inputTokens * 100) : 0;
|
|
2556
2798
|
const fill = budgetTokens ? Math.min(1, usage.totalTokens / budgetTokens) : void 0;
|
|
2557
2799
|
const last = compactions.at(-1);
|
|
2558
|
-
return /* @__PURE__ */
|
|
2559
|
-
/* @__PURE__ */
|
|
2560
|
-
/* @__PURE__ */
|
|
2800
|
+
return /* @__PURE__ */ jsxs3("div", { className: ["awr-context", className].filter(Boolean).join(" "), children: [
|
|
2801
|
+
/* @__PURE__ */ jsxs3("div", { className: "awr-context__row", children: [
|
|
2802
|
+
/* @__PURE__ */ jsxs3("span", { title: "input tokens", children: [
|
|
2561
2803
|
"in ",
|
|
2562
2804
|
formatTokens(usage.inputTokens)
|
|
2563
2805
|
] }),
|
|
2564
|
-
/* @__PURE__ */
|
|
2806
|
+
/* @__PURE__ */ jsxs3("span", { title: "output tokens", children: [
|
|
2565
2807
|
"out ",
|
|
2566
2808
|
formatTokens(usage.outputTokens)
|
|
2567
2809
|
] }),
|
|
2568
|
-
reasoning > 0 && /* @__PURE__ */
|
|
2810
|
+
reasoning > 0 && /* @__PURE__ */ jsxs3("span", { title: "thinking tokens", children: [
|
|
2569
2811
|
"think ",
|
|
2570
2812
|
formatTokens(reasoning)
|
|
2571
2813
|
] }),
|
|
2572
|
-
/* @__PURE__ */
|
|
2814
|
+
/* @__PURE__ */ jsxs3("span", { title: "input tokens served from the provider's prompt cache", children: [
|
|
2573
2815
|
"cached ",
|
|
2574
2816
|
formatTokens(cached),
|
|
2575
2817
|
hitRate > 0 ? ` (${hitRate}%)` : ""
|
|
2576
2818
|
] }),
|
|
2577
|
-
onCompact && /* @__PURE__ */
|
|
2819
|
+
onCompact && /* @__PURE__ */ jsx5(
|
|
2578
2820
|
"button",
|
|
2579
2821
|
{
|
|
2580
2822
|
type: "button",
|
|
@@ -2585,15 +2827,15 @@ var ContextMeter = ({
|
|
|
2585
2827
|
}
|
|
2586
2828
|
)
|
|
2587
2829
|
] }),
|
|
2588
|
-
fill !== void 0 && /* @__PURE__ */
|
|
2830
|
+
fill !== void 0 && /* @__PURE__ */ jsx5(
|
|
2589
2831
|
"div",
|
|
2590
2832
|
{
|
|
2591
2833
|
className: `awr-context__track${fill >= 1 ? " is-full" : ""}`,
|
|
2592
2834
|
title: `${usage.totalTokens} / ${budgetTokens} tokens`,
|
|
2593
|
-
children: /* @__PURE__ */
|
|
2835
|
+
children: /* @__PURE__ */ jsx5("div", { className: "awr-context__fill", style: { width: `${fill * 100}%` } })
|
|
2594
2836
|
}
|
|
2595
2837
|
),
|
|
2596
|
-
budget && /* @__PURE__ */
|
|
2838
|
+
budget && /* @__PURE__ */ jsxs3("div", { className: "awr-context__note awr-context__note--warn", children: [
|
|
2597
2839
|
budget.kind === "tool-calls" ? "Tool-call" : `${budget.kind} token`,
|
|
2598
2840
|
" limit reached (",
|
|
2599
2841
|
budget.tokens,
|
|
@@ -2601,7 +2843,7 @@ var ContextMeter = ({
|
|
|
2601
2843
|
budget.cap,
|
|
2602
2844
|
") \u2014 the agent stopped early."
|
|
2603
2845
|
] }),
|
|
2604
|
-
last && /* @__PURE__ */
|
|
2846
|
+
last && /* @__PURE__ */ jsxs3("div", { className: "awr-context__note", children: [
|
|
2605
2847
|
"Compacted ",
|
|
2606
2848
|
last.scope,
|
|
2607
2849
|
": ",
|
|
@@ -2616,7 +2858,7 @@ var ContextMeter = ({
|
|
|
2616
2858
|
|
|
2617
2859
|
// src/components/FilesPanel.tsx
|
|
2618
2860
|
import { Fragment as Fragment3, useEffect as useEffect6, useRef as useRef6, useState as useState8 } from "react";
|
|
2619
|
-
import { Fragment as Fragment4, jsx as
|
|
2861
|
+
import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2620
2862
|
var PREVIEW_CHARS = 2e4;
|
|
2621
2863
|
var FilesPanel = ({
|
|
2622
2864
|
files: vfs,
|
|
@@ -2657,11 +2899,11 @@ var FilesPanel = ({
|
|
|
2657
2899
|
a.download = f.path.split("/").pop() || "file";
|
|
2658
2900
|
a.click();
|
|
2659
2901
|
};
|
|
2660
|
-
return /* @__PURE__ */
|
|
2661
|
-
/* @__PURE__ */
|
|
2662
|
-
/* @__PURE__ */
|
|
2663
|
-
allowUpload && /* @__PURE__ */
|
|
2664
|
-
/* @__PURE__ */
|
|
2902
|
+
return /* @__PURE__ */ jsxs4("div", { className: ["awr-filespanel", className].filter(Boolean).join(" "), children: [
|
|
2903
|
+
/* @__PURE__ */ jsxs4("div", { className: "awr-panel__head", children: [
|
|
2904
|
+
/* @__PURE__ */ jsx6("span", { className: "awr-panel__title", children: title ?? L.files }),
|
|
2905
|
+
allowUpload && /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
2906
|
+
/* @__PURE__ */ jsx6(
|
|
2665
2907
|
"button",
|
|
2666
2908
|
{
|
|
2667
2909
|
type: "button",
|
|
@@ -2669,10 +2911,10 @@ var FilesPanel = ({
|
|
|
2669
2911
|
"aria-label": L.upload,
|
|
2670
2912
|
title: L.upload,
|
|
2671
2913
|
onClick: () => inputRef.current?.click(),
|
|
2672
|
-
children: /* @__PURE__ */
|
|
2914
|
+
children: /* @__PURE__ */ jsx6(PlusIcon, { size: 16 })
|
|
2673
2915
|
}
|
|
2674
2916
|
),
|
|
2675
|
-
/* @__PURE__ */
|
|
2917
|
+
/* @__PURE__ */ jsx6(
|
|
2676
2918
|
"input",
|
|
2677
2919
|
{
|
|
2678
2920
|
ref: inputRef,
|
|
@@ -2687,15 +2929,15 @@ var FilesPanel = ({
|
|
|
2687
2929
|
)
|
|
2688
2930
|
] })
|
|
2689
2931
|
] }),
|
|
2690
|
-
fs.error && /* @__PURE__ */
|
|
2691
|
-
!fs.loading && fs.files.length === 0 && /* @__PURE__ */
|
|
2692
|
-
/* @__PURE__ */
|
|
2693
|
-
const row = /* @__PURE__ */
|
|
2932
|
+
fs.error && /* @__PURE__ */ jsx6("div", { className: "awr-notice awr-notice--warn", children: fs.error }),
|
|
2933
|
+
!fs.loading && fs.files.length === 0 && /* @__PURE__ */ jsx6("div", { className: "awr-panel__empty", children: L.filesEmpty }),
|
|
2934
|
+
/* @__PURE__ */ jsx6("ul", { className: "awr-filelist", children: fs.files.map((f) => {
|
|
2935
|
+
const row = /* @__PURE__ */ jsxs4(
|
|
2694
2936
|
"li",
|
|
2695
2937
|
{
|
|
2696
2938
|
className: `awr-filelist__item${preview?.path === f.path ? " is-active" : ""}`,
|
|
2697
2939
|
children: [
|
|
2698
|
-
/* @__PURE__ */
|
|
2940
|
+
/* @__PURE__ */ jsxs4(
|
|
2699
2941
|
"button",
|
|
2700
2942
|
{
|
|
2701
2943
|
type: "button",
|
|
@@ -2703,13 +2945,13 @@ var FilesPanel = ({
|
|
|
2703
2945
|
onClick: () => void open(f),
|
|
2704
2946
|
title: `${L.preview}: ${f.path}`,
|
|
2705
2947
|
children: [
|
|
2706
|
-
/* @__PURE__ */
|
|
2707
|
-
/* @__PURE__ */
|
|
2708
|
-
/* @__PURE__ */
|
|
2948
|
+
/* @__PURE__ */ jsx6(FileIcon, { size: 14 }),
|
|
2949
|
+
/* @__PURE__ */ jsx6("span", { className: "awr-filelist__path", children: f.path }),
|
|
2950
|
+
/* @__PURE__ */ jsx6("span", { className: "awr-filelist__size", children: L.bytes(f.size) })
|
|
2709
2951
|
]
|
|
2710
2952
|
}
|
|
2711
2953
|
),
|
|
2712
|
-
/* @__PURE__ */
|
|
2954
|
+
/* @__PURE__ */ jsx6(
|
|
2713
2955
|
"button",
|
|
2714
2956
|
{
|
|
2715
2957
|
type: "button",
|
|
@@ -2717,10 +2959,10 @@ var FilesPanel = ({
|
|
|
2717
2959
|
"aria-label": `${L.download} ${f.path}`,
|
|
2718
2960
|
title: L.download,
|
|
2719
2961
|
onClick: () => void download(f),
|
|
2720
|
-
children: /* @__PURE__ */
|
|
2962
|
+
children: /* @__PURE__ */ jsx6(DownloadIcon, { size: 14 })
|
|
2721
2963
|
}
|
|
2722
2964
|
),
|
|
2723
|
-
allowDelete && /* @__PURE__ */
|
|
2965
|
+
allowDelete && /* @__PURE__ */ jsx6(
|
|
2724
2966
|
"button",
|
|
2725
2967
|
{
|
|
2726
2968
|
type: "button",
|
|
@@ -2728,83 +2970,304 @@ var FilesPanel = ({
|
|
|
2728
2970
|
"aria-label": `${L.delete} ${f.path}`,
|
|
2729
2971
|
title: L.delete,
|
|
2730
2972
|
onClick: () => void fs.remove(f.path),
|
|
2731
|
-
children: /* @__PURE__ */
|
|
2973
|
+
children: /* @__PURE__ */ jsx6(XIcon, { size: 14 })
|
|
2732
2974
|
}
|
|
2733
2975
|
)
|
|
2734
2976
|
]
|
|
2735
2977
|
},
|
|
2736
2978
|
f.path
|
|
2737
2979
|
);
|
|
2738
|
-
return renderFile ? /* @__PURE__ */
|
|
2980
|
+
return renderFile ? /* @__PURE__ */ jsx6(Fragment3, { children: renderFile(f, row) }, f.path) : row;
|
|
2739
2981
|
}) }),
|
|
2740
|
-
preview && /* @__PURE__ */
|
|
2982
|
+
preview && /* @__PURE__ */ jsx6("div", { className: "awr-filepreview", children: preview.kind === "image" ? /* @__PURE__ */ jsx6("img", { src: preview.src, alt: preview.path }) : /* @__PURE__ */ jsx6("pre", { children: preview.text.length > PREVIEW_CHARS ? `${preview.text.slice(0, PREVIEW_CHARS)}
|
|
2741
2983
|
\u2026` : preview.text }) })
|
|
2742
2984
|
] });
|
|
2743
2985
|
};
|
|
2744
2986
|
|
|
2745
|
-
// src/components/
|
|
2746
|
-
import {
|
|
2747
|
-
import {
|
|
2748
|
-
|
|
2987
|
+
// src/components/Media.tsx
|
|
2988
|
+
import { useEffect as useEffect7, useState as useState9 } from "react";
|
|
2989
|
+
import { MEDIA_AUDIO_TYPES, MEDIA_IMAGE_TYPES } from "@dudko.dev/agent-web";
|
|
2990
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2991
|
+
var mediaFamilyOf = (mediaType) => {
|
|
2992
|
+
const type = mediaType.toLowerCase().split(";")[0].trim();
|
|
2993
|
+
if (Object.hasOwn(MEDIA_IMAGE_TYPES, type)) return "image";
|
|
2994
|
+
if (Object.hasOwn(MEDIA_AUDIO_TYPES, type)) return "audio";
|
|
2995
|
+
return void 0;
|
|
2996
|
+
};
|
|
2997
|
+
var bytesOf = (content, encoding) => {
|
|
2998
|
+
if (encoding !== "base64") return new TextEncoder().encode(content);
|
|
2999
|
+
const binary = atob(content);
|
|
3000
|
+
const bytes = new Uint8Array(binary.length);
|
|
3001
|
+
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
3002
|
+
return bytes;
|
|
3003
|
+
};
|
|
3004
|
+
var useFileUrl = (files, path, mediaType) => {
|
|
3005
|
+
const [url, setUrl] = useState9(void 0);
|
|
3006
|
+
useEffect7(() => {
|
|
3007
|
+
if (!files || !mediaType) return;
|
|
3008
|
+
let made;
|
|
3009
|
+
let gone = false;
|
|
3010
|
+
files.read(path).then((file) => {
|
|
3011
|
+
if (gone || !file) return;
|
|
3012
|
+
made = URL.createObjectURL(
|
|
3013
|
+
new Blob([bytesOf(file.content, file.encoding)], { type: mediaType })
|
|
3014
|
+
);
|
|
3015
|
+
setUrl(made);
|
|
3016
|
+
}).catch(() => {
|
|
3017
|
+
});
|
|
3018
|
+
return () => {
|
|
3019
|
+
gone = true;
|
|
3020
|
+
if (made) URL.revokeObjectURL(made);
|
|
3021
|
+
setUrl(void 0);
|
|
3022
|
+
};
|
|
3023
|
+
}, [files, path, mediaType]);
|
|
3024
|
+
return url;
|
|
3025
|
+
};
|
|
3026
|
+
var GeneratedMedia = ({ media, files, labels }) => {
|
|
2749
3027
|
const L = useLabels(labels);
|
|
2750
|
-
const
|
|
2751
|
-
const
|
|
2752
|
-
const
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
3028
|
+
const family = mediaFamilyOf(media.mediaType);
|
|
3029
|
+
const type = family ? media.mediaType.toLowerCase().split(";")[0].trim() : void 0;
|
|
3030
|
+
const url = useFileUrl(files, media.path, type);
|
|
3031
|
+
if (url && family === "image") {
|
|
3032
|
+
return /* @__PURE__ */ jsx7(
|
|
3033
|
+
"a",
|
|
3034
|
+
{
|
|
3035
|
+
className: "awr-media awr-media--image",
|
|
3036
|
+
href: url,
|
|
3037
|
+
target: "_blank",
|
|
3038
|
+
rel: "noopener noreferrer",
|
|
3039
|
+
title: media.path,
|
|
3040
|
+
children: /* @__PURE__ */ jsx7("img", { className: "awr-media__img", src: url, alt: L.mediaImage(media.path) })
|
|
3041
|
+
}
|
|
3042
|
+
);
|
|
3043
|
+
}
|
|
3044
|
+
if (url && family === "audio") {
|
|
3045
|
+
return /* @__PURE__ */ jsx7("span", { className: "awr-media awr-media--audio", title: media.path, children: /* @__PURE__ */ jsx7(
|
|
3046
|
+
"audio",
|
|
3047
|
+
{
|
|
3048
|
+
className: "awr-media__audio",
|
|
3049
|
+
controls: true,
|
|
3050
|
+
preload: "metadata",
|
|
3051
|
+
src: url,
|
|
3052
|
+
"aria-label": L.mediaAudio(media.path)
|
|
3053
|
+
}
|
|
3054
|
+
) });
|
|
3055
|
+
}
|
|
3056
|
+
return /* @__PURE__ */ jsxs5("span", { className: "awr-chip awr-file awr-media awr-media--file", title: L.mediaFile(media.path), children: [
|
|
3057
|
+
/* @__PURE__ */ jsx7(FileIcon, { size: 13 }),
|
|
3058
|
+
" ",
|
|
3059
|
+
media.path
|
|
3060
|
+
] });
|
|
3061
|
+
};
|
|
3062
|
+
var TranscriptBlock = ({ transcript, labels }) => {
|
|
3063
|
+
const L = useLabels(labels);
|
|
3064
|
+
return /* @__PURE__ */ jsxs5("details", { className: "awr-transcript", children: [
|
|
3065
|
+
/* @__PURE__ */ jsxs5("summary", { className: "awr-transcript__summary", children: [
|
|
3066
|
+
/* @__PURE__ */ jsx7(FileIcon, { size: 13 }),
|
|
3067
|
+
" ",
|
|
3068
|
+
L.transcriptOf(transcript.name)
|
|
2765
3069
|
] }),
|
|
2766
|
-
|
|
3070
|
+
/* @__PURE__ */ jsx7("p", { className: "awr-transcript__note", children: L.transcriptNote }),
|
|
3071
|
+
/* @__PURE__ */ jsx7("blockquote", { className: "awr-transcript__text", children: transcript.text })
|
|
2767
3072
|
] });
|
|
2768
3073
|
};
|
|
3074
|
+
|
|
3075
|
+
// src/components/StepList.tsx
|
|
3076
|
+
import { Fragment as Fragment6 } from "react";
|
|
3077
|
+
|
|
3078
|
+
// src/components/SubagentTree.tsx
|
|
3079
|
+
import { Fragment as Fragment5, useEffect as useEffect8, useState as useState10 } from "react";
|
|
3080
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3081
|
+
var useElapsed = (startedAt, running) => {
|
|
3082
|
+
const [now, setNow] = useState10(void 0);
|
|
3083
|
+
useEffect8(() => {
|
|
3084
|
+
if (!running || startedAt === void 0) return;
|
|
3085
|
+
setNow(Date.now());
|
|
3086
|
+
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
3087
|
+
return () => clearInterval(timer);
|
|
3088
|
+
}, [running, startedAt]);
|
|
3089
|
+
return running && startedAt !== void 0 && now !== void 0 ? Math.max(0, now - startedAt) : void 0;
|
|
3090
|
+
};
|
|
2769
3091
|
var SubagentRow = ({
|
|
2770
3092
|
sub,
|
|
2771
3093
|
onStop,
|
|
3094
|
+
showUsage = true,
|
|
3095
|
+
showTools = true,
|
|
3096
|
+
labels,
|
|
3097
|
+
children
|
|
3098
|
+
}) => {
|
|
3099
|
+
const L = useLabels(labels);
|
|
3100
|
+
const running = sub.status === "running";
|
|
3101
|
+
const elapsed = useElapsed(sub.startedAt, running);
|
|
3102
|
+
const time = sub.durationMs ?? elapsed;
|
|
3103
|
+
const role = sub.dynamic ? previewValue(sub.role ?? "", 48) : "";
|
|
3104
|
+
const meta = [
|
|
3105
|
+
sub.model ?? "",
|
|
3106
|
+
sub.tier ? L.tierNames[sub.tier] : "",
|
|
3107
|
+
sub.usage.totalTokens > 0 ? L.subagentTokens(formatTokens(sub.usage.totalTokens)) : "",
|
|
3108
|
+
sub.toolCalls > 0 ? L.toolCalls(sub.toolCalls) : "",
|
|
3109
|
+
time !== void 0 ? formatDuration(time) : ""
|
|
3110
|
+
].filter(Boolean);
|
|
3111
|
+
return /* @__PURE__ */ jsxs6(
|
|
3112
|
+
"li",
|
|
3113
|
+
{
|
|
3114
|
+
className: `awr-subagent awr-subagent--${sub.status}${sub.dynamic ? " awr-subagent--dynamic" : ""}`,
|
|
3115
|
+
"data-depth": sub.depth,
|
|
3116
|
+
children: [
|
|
3117
|
+
/* @__PURE__ */ jsxs6("div", { className: "awr-subagent__head", children: [
|
|
3118
|
+
/* @__PURE__ */ jsx8("span", { className: "awr-subagent__icon", children: running ? /* @__PURE__ */ jsx8(SpinnerIcon, { size: 13 }) : sub.status === "done" ? /* @__PURE__ */ jsx8(BotIcon, { size: 13 }) : sub.status === "stopped" ? /* @__PURE__ */ jsx8(StopIcon, { size: 13 }) : /* @__PURE__ */ jsx8(AlertIcon, { size: 13 }) }),
|
|
3119
|
+
/* @__PURE__ */ jsx8("span", { className: "awr-subagent__name", title: sub.role, children: role || (sub.dynamic ? L.subagentHelper : sub.name) }),
|
|
3120
|
+
sub.dynamic && role && /* @__PURE__ */ jsx8("span", { className: "awr-subagent__profile", children: L.subagentHelper }),
|
|
3121
|
+
sub.profile && /* @__PURE__ */ jsx8("span", { className: "awr-subagent__profile", children: sub.profile }),
|
|
3122
|
+
/* @__PURE__ */ jsx8("span", { className: "awr-subagent__task", title: sub.task, children: previewValue(sub.task, 90) }),
|
|
3123
|
+
running && onStop && /* @__PURE__ */ jsx8(
|
|
3124
|
+
"button",
|
|
3125
|
+
{
|
|
3126
|
+
type: "button",
|
|
3127
|
+
className: "awr-iconbtn awr-subagent__stop",
|
|
3128
|
+
"aria-label": L.stopSubagent,
|
|
3129
|
+
title: L.stopSubagent,
|
|
3130
|
+
onClick: () => onStop(sub.id),
|
|
3131
|
+
children: /* @__PURE__ */ jsx8(StopIcon, { size: 12 })
|
|
3132
|
+
}
|
|
3133
|
+
)
|
|
3134
|
+
] }),
|
|
3135
|
+
showUsage && /* @__PURE__ */ jsxs6("div", { className: "awr-subagent__meta", children: [
|
|
3136
|
+
/* @__PURE__ */ jsx8("span", { className: "awr-subagent__status", children: L.subagentStatus[sub.status] }),
|
|
3137
|
+
meta.map((part, i) => /* @__PURE__ */ jsx8("span", { className: "awr-subagent__metaitem", children: part }, i))
|
|
3138
|
+
] }),
|
|
3139
|
+
showTools && sub.tools && /* @__PURE__ */ jsx8("div", { className: "awr-subagent__tools", children: sub.tools.length > 0 ? L.subagentTools(sub.tools.join(", ")) : L.subagentNoTools }),
|
|
3140
|
+
/* @__PURE__ */ jsx8("div", { className: "awr-subagent__activity", children: sub.status === "error" ? sub.error : sub.status === "stopped" ? L.subagentStopped : sub.status === "done" ? previewValue(sub.text, 160) : `${sub.activity}${!showUsage && sub.toolCalls ? ` \xB7 ${L.toolCalls(sub.toolCalls)}` : ""}` }),
|
|
3141
|
+
children
|
|
3142
|
+
]
|
|
3143
|
+
}
|
|
3144
|
+
);
|
|
3145
|
+
};
|
|
3146
|
+
var SubagentTree = ({
|
|
3147
|
+
subagents,
|
|
3148
|
+
onStop,
|
|
3149
|
+
showUsage = true,
|
|
3150
|
+
showTools = true,
|
|
3151
|
+
renderSubagent,
|
|
3152
|
+
labels,
|
|
3153
|
+
className
|
|
3154
|
+
}) => {
|
|
3155
|
+
if (subagents.length === 0) return null;
|
|
3156
|
+
const branch = (nodes, nested) => /* @__PURE__ */ jsx8(
|
|
3157
|
+
"ul",
|
|
3158
|
+
{
|
|
3159
|
+
className: ["awr-subagents", nested ? "awr-subagents--nested" : className].filter(Boolean).join(" "),
|
|
3160
|
+
children: nodes.map((node) => {
|
|
3161
|
+
const row = /* @__PURE__ */ jsx8(
|
|
3162
|
+
SubagentRow,
|
|
3163
|
+
{
|
|
3164
|
+
sub: node,
|
|
3165
|
+
onStop,
|
|
3166
|
+
showUsage,
|
|
3167
|
+
showTools,
|
|
3168
|
+
labels,
|
|
3169
|
+
children: node.children.length > 0 ? branch(node.children, true) : null
|
|
3170
|
+
},
|
|
3171
|
+
node.id
|
|
3172
|
+
);
|
|
3173
|
+
return renderSubagent ? /* @__PURE__ */ jsx8(Fragment5, { children: renderSubagent(node, row) }, node.id) : row;
|
|
3174
|
+
})
|
|
3175
|
+
}
|
|
3176
|
+
);
|
|
3177
|
+
return branch(subagentTree(subagents), false);
|
|
3178
|
+
};
|
|
3179
|
+
|
|
3180
|
+
// src/components/StepList.tsx
|
|
3181
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3182
|
+
var WEB_SEARCH = "web_search";
|
|
3183
|
+
var ToolCallRow = ({
|
|
3184
|
+
call,
|
|
3185
|
+
showUsage = true,
|
|
3186
|
+
showTiers = true,
|
|
3187
|
+
showSearchResults = true,
|
|
2772
3188
|
labels
|
|
2773
3189
|
}) => {
|
|
2774
3190
|
const L = useLabels(labels);
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
3191
|
+
const state = call.status === "calling" ? "calling" : call.ok === false ? "failed" : "ok";
|
|
3192
|
+
const images = call.ok === false ? [] : imagesInOutput(call.output).slice(0, 4);
|
|
3193
|
+
const search = showSearchResults && call.name === WEB_SEARCH && call.status === "done" && call.ok !== false ? webSearchOf(call.output) : void 0;
|
|
3194
|
+
const cost = [
|
|
3195
|
+
call.inputTokens ? `\u2248${formatTokens(call.inputTokens)} in` : "",
|
|
3196
|
+
call.outputTokens ? `\u2248${formatTokens(call.outputTokens)} out` : "",
|
|
3197
|
+
call.durationMs !== void 0 ? formatDuration(call.durationMs) : ""
|
|
3198
|
+
].filter(Boolean).join(" \xB7 ");
|
|
3199
|
+
return /* @__PURE__ */ jsxs7(
|
|
3200
|
+
"li",
|
|
3201
|
+
{
|
|
3202
|
+
className: `awr-tool awr-tool--${state}${showTiers && call.attempt !== void 0 ? " awr-tool--earlier" : ""}`,
|
|
3203
|
+
children: [
|
|
3204
|
+
/* @__PURE__ */ jsxs7("div", { className: "awr-tool__row", children: [
|
|
3205
|
+
/* @__PURE__ */ jsx9(ToolIcon, { size: 13, className: "awr-tool__icon" }),
|
|
3206
|
+
/* @__PURE__ */ jsx9("code", { className: "awr-tool__name", children: call.name }),
|
|
3207
|
+
previewValue(call.input) && /* @__PURE__ */ jsx9("span", { className: "awr-tool__args", children: previewValue(call.input) }),
|
|
3208
|
+
call.status === "calling" && /* @__PURE__ */ jsx9(SpinnerIcon, { size: 12, className: "awr-tool__spin" }),
|
|
3209
|
+
call.status === "done" && call.ok === false && /* @__PURE__ */ jsx9("span", { className: "awr-tool__badge", children: L.failed }),
|
|
3210
|
+
showTiers && call.replayed && /* @__PURE__ */ jsx9("span", { className: "awr-tool__tag", title: L.replayedTitle, children: L.replayed }),
|
|
3211
|
+
showTiers && call.attempt !== void 0 && /* @__PURE__ */ jsx9("span", { className: "awr-tool__tag", children: L.attemptTag(call.attempt) }),
|
|
3212
|
+
showUsage && cost && /* @__PURE__ */ jsx9("span", { className: "awr-tool__cost", title: L.toolCostTitle, children: cost })
|
|
3213
|
+
] }),
|
|
3214
|
+
images.length > 0 && /* @__PURE__ */ jsx9("div", { className: "awr-tool__images", children: images.map((src, i) => /* @__PURE__ */ jsx9("a", { href: src, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ jsx9("img", { className: "awr-thumb", src, alt: `${call.name} result ${i + 1}` }) }, i)) }),
|
|
3215
|
+
search && /* @__PURE__ */ jsxs7("div", { className: "awr-search", children: [
|
|
3216
|
+
/* @__PURE__ */ jsxs7("p", { className: "awr-search__query", children: [
|
|
3217
|
+
/* @__PURE__ */ jsx9(GlobeIcon, { size: 12 }),
|
|
3218
|
+
" ",
|
|
3219
|
+
L.searchQuery,
|
|
3220
|
+
" ",
|
|
3221
|
+
/* @__PURE__ */ jsx9("q", { children: search.query })
|
|
3222
|
+
] }),
|
|
3223
|
+
search.results.length > 0 ? /* @__PURE__ */ jsx9("ol", { className: "awr-search__results", children: search.results.map((r, i) => /* @__PURE__ */ jsxs7("li", { className: "awr-search__result", children: [
|
|
3224
|
+
/* @__PURE__ */ jsx9(
|
|
3225
|
+
"a",
|
|
3226
|
+
{
|
|
3227
|
+
className: "awr-search__title",
|
|
3228
|
+
href: r.url,
|
|
3229
|
+
target: "_blank",
|
|
3230
|
+
rel: "noopener noreferrer",
|
|
3231
|
+
children: r.title
|
|
3232
|
+
}
|
|
3233
|
+
),
|
|
3234
|
+
" ",
|
|
3235
|
+
/* @__PURE__ */ jsxs7("span", { className: "awr-search__host", children: [
|
|
3236
|
+
r.host,
|
|
3237
|
+
r.date ? ` \xB7 ${r.date}` : ""
|
|
3238
|
+
] }),
|
|
3239
|
+
r.snippet && /* @__PURE__ */ jsx9("p", { className: "awr-search__snippet", children: r.snippet })
|
|
3240
|
+
] }, i)) }) : /* @__PURE__ */ jsx9("p", { className: "awr-search__note", children: L.searchNoResults }),
|
|
3241
|
+
(search.filtered > 0 || search.truncated) && /* @__PURE__ */ jsx9("p", { className: "awr-search__note", children: [
|
|
3242
|
+
search.filtered > 0 ? L.searchFiltered(search.filtered) : "",
|
|
3243
|
+
search.truncated ? L.searchTruncated : ""
|
|
3244
|
+
].filter(Boolean).join(" \xB7 ") })
|
|
3245
|
+
] })
|
|
3246
|
+
]
|
|
3247
|
+
}
|
|
3248
|
+
);
|
|
2796
3249
|
};
|
|
2797
3250
|
var UserNoteRow = ({
|
|
2798
3251
|
note,
|
|
2799
3252
|
labels
|
|
2800
3253
|
}) => {
|
|
2801
3254
|
const L = useLabels(labels);
|
|
2802
|
-
return /* @__PURE__ */
|
|
2803
|
-
/* @__PURE__ */
|
|
2804
|
-
/* @__PURE__ */
|
|
2805
|
-
/* @__PURE__ */
|
|
3255
|
+
return /* @__PURE__ */ jsxs7("li", { className: `awr-note awr-note--${note.at}`, children: [
|
|
3256
|
+
/* @__PURE__ */ jsx9(SendIcon, { size: 12, className: "awr-note__icon" }),
|
|
3257
|
+
/* @__PURE__ */ jsx9("span", { className: "awr-note__where", children: L.noteAt[note.at] }),
|
|
3258
|
+
/* @__PURE__ */ jsx9("q", { className: "awr-note__text", children: note.text })
|
|
2806
3259
|
] });
|
|
2807
3260
|
};
|
|
3261
|
+
var decisionNote = (d, L) => {
|
|
3262
|
+
if (d.accepted) {
|
|
3263
|
+
return L.decisionAccepted(
|
|
3264
|
+
d.choice ?? "",
|
|
3265
|
+
d.confidence !== void 0 ? formatProbability(d.confidence) : ""
|
|
3266
|
+
);
|
|
3267
|
+
}
|
|
3268
|
+
const detail = d.reason === "low-confidence" && d.confidence !== void 0 ? `${formatProbability(d.confidence)} < ${formatProbability(d.threshold)}` : "";
|
|
3269
|
+
return L.decisionFellBack(d.reason ? L.decisionReasons[d.reason] : "", detail);
|
|
3270
|
+
};
|
|
2808
3271
|
var decisionLabel = (a, L) => a.status === "pending" ? L.consentWaiting : a.status === "approved" ? L.consentAllowed : L.consentDenied(a.reason);
|
|
2809
3272
|
var StepItem = ({
|
|
2810
3273
|
step,
|
|
@@ -2815,39 +3278,98 @@ var StepItem = ({
|
|
|
2815
3278
|
showToolCalls,
|
|
2816
3279
|
showUsage,
|
|
2817
3280
|
showThoughts,
|
|
3281
|
+
showTiers,
|
|
3282
|
+
showReplanFailed,
|
|
3283
|
+
showDecisions,
|
|
3284
|
+
showSearchResults,
|
|
3285
|
+
showSubagents,
|
|
2818
3286
|
renderToolCall,
|
|
3287
|
+
renderSubagent,
|
|
2819
3288
|
L
|
|
2820
|
-
}) => /* @__PURE__ */
|
|
2821
|
-
/* @__PURE__ */
|
|
2822
|
-
/* @__PURE__ */
|
|
2823
|
-
/* @__PURE__ */
|
|
3289
|
+
}) => /* @__PURE__ */ jsxs7("li", { className: `awr-step awr-step--${step.blocked ? "blocked" : step.status}`, children: [
|
|
3290
|
+
/* @__PURE__ */ jsxs7("div", { className: "awr-step__head", children: [
|
|
3291
|
+
/* @__PURE__ */ jsx9("span", { className: "awr-step__marker", children: step.status === "running" ? /* @__PURE__ */ jsx9(SpinnerIcon, { size: 14 }) : step.blocked ? /* @__PURE__ */ jsx9(AlertIcon, { size: 14 }) : /* @__PURE__ */ jsx9(CheckIcon, { size: 14 }) }),
|
|
3292
|
+
/* @__PURE__ */ jsxs7("span", { className: "awr-step__index", children: [
|
|
2824
3293
|
step.index,
|
|
2825
3294
|
"/",
|
|
2826
3295
|
step.total
|
|
2827
3296
|
] }),
|
|
2828
|
-
/* @__PURE__ */
|
|
3297
|
+
/* @__PURE__ */ jsx9("span", { className: "awr-step__desc", children: step.step.description })
|
|
2829
3298
|
] }),
|
|
2830
|
-
|
|
2831
|
-
/* @__PURE__ */
|
|
2832
|
-
|
|
3299
|
+
showTiers && step.tier && /* @__PURE__ */ jsxs7("div", { className: "awr-step__meta", children: [
|
|
3300
|
+
/* @__PURE__ */ jsx9(
|
|
3301
|
+
"span",
|
|
3302
|
+
{
|
|
3303
|
+
className: `awr-step__tier awr-step__tier--${step.tier}`,
|
|
3304
|
+
title: step.tierReason ? L.tierReasons[step.tierReason] : void 0,
|
|
3305
|
+
children: L.tierNames[step.tier]
|
|
3306
|
+
}
|
|
3307
|
+
),
|
|
3308
|
+
step.model && /* @__PURE__ */ jsx9("span", { className: "awr-step__model", children: step.model })
|
|
3309
|
+
] }),
|
|
3310
|
+
showTiers && step.escalations?.map((e, i) => /* @__PURE__ */ jsxs7("div", { className: "awr-step__escalated", children: [
|
|
3311
|
+
/* @__PURE__ */ jsxs7("p", { className: "awr-step__escalated-line", children: [
|
|
3312
|
+
/* @__PURE__ */ jsx9(ArrowUpIcon, { size: 12 }),
|
|
3313
|
+
/* @__PURE__ */ jsx9("span", { children: L.escalated(L.tierNames[e.from], L.tierNames[e.to], L.escalationReasons[e.reason]) })
|
|
3314
|
+
] }),
|
|
3315
|
+
e.text?.trim() && /* @__PURE__ */ jsxs7("details", { className: "awr-step__attempt", children: [
|
|
3316
|
+
/* @__PURE__ */ jsx9("summary", { children: L.escalatedAttemptText }),
|
|
3317
|
+
/* @__PURE__ */ jsx9("p", { className: "awr-step__text", children: e.text.trim() })
|
|
3318
|
+
] })
|
|
3319
|
+
] }, i)),
|
|
3320
|
+
showThoughts && step.reasoning.trim() && /* @__PURE__ */ jsxs7("details", { className: "awr-thought", open: step.status === "running" && !step.text, children: [
|
|
3321
|
+
/* @__PURE__ */ jsxs7("summary", { children: [
|
|
3322
|
+
/* @__PURE__ */ jsx9(BrainIcon, { size: 13 }),
|
|
2833
3323
|
" ",
|
|
2834
3324
|
L.stepThoughts
|
|
2835
3325
|
] }),
|
|
2836
|
-
/* @__PURE__ */
|
|
3326
|
+
/* @__PURE__ */ jsx9("p", { className: "awr-thought__text", children: step.reasoning.trim() })
|
|
2837
3327
|
] }),
|
|
2838
|
-
step.text.trim() && /* @__PURE__ */
|
|
2839
|
-
showToolCalls && step.toolCalls.length > 0 && /* @__PURE__ */
|
|
2840
|
-
const row = /* @__PURE__ */
|
|
2841
|
-
|
|
3328
|
+
step.text.trim() && /* @__PURE__ */ jsx9("p", { className: "awr-step__text", children: step.text.trim() }),
|
|
3329
|
+
showToolCalls && step.toolCalls.length > 0 && /* @__PURE__ */ jsx9("ul", { className: "awr-step__tools", children: step.toolCalls.map((call, i) => {
|
|
3330
|
+
const row = /* @__PURE__ */ jsx9(
|
|
3331
|
+
ToolCallRow,
|
|
3332
|
+
{
|
|
3333
|
+
call,
|
|
3334
|
+
showUsage,
|
|
3335
|
+
showTiers,
|
|
3336
|
+
showSearchResults
|
|
3337
|
+
},
|
|
3338
|
+
i
|
|
3339
|
+
);
|
|
3340
|
+
return renderToolCall ? /* @__PURE__ */ jsx9(Fragment6, { children: renderToolCall(call, row) }, i) : row;
|
|
2842
3341
|
}) }),
|
|
2843
|
-
approvals.length > 0 && /* @__PURE__ */
|
|
2844
|
-
/* @__PURE__ */
|
|
2845
|
-
/* @__PURE__ */
|
|
2846
|
-
/* @__PURE__ */
|
|
3342
|
+
approvals.length > 0 && /* @__PURE__ */ jsx9("ul", { className: "awr-step__tools", children: approvals.map((a) => /* @__PURE__ */ jsxs7("li", { className: `awr-tool awr-tool__row awr-tool--approval-${a.status}`, children: [
|
|
3343
|
+
/* @__PURE__ */ jsx9(ShieldIcon, { size: 13, className: "awr-tool__icon" }),
|
|
3344
|
+
/* @__PURE__ */ jsx9("code", { className: "awr-tool__name", children: a.name }),
|
|
3345
|
+
/* @__PURE__ */ jsx9("span", { className: "awr-tool__args", children: decisionLabel(a, L) }),
|
|
3346
|
+
a.subagent && /* @__PURE__ */ jsx9("span", { className: "awr-tool__tag", children: L.subagentHelper })
|
|
2847
3347
|
] }, a.id)) }),
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
3348
|
+
showSubagents && /* @__PURE__ */ jsx9(
|
|
3349
|
+
SubagentTree,
|
|
3350
|
+
{
|
|
3351
|
+
subagents,
|
|
3352
|
+
onStop: onStopSubagent,
|
|
3353
|
+
showUsage,
|
|
3354
|
+
renderSubagent
|
|
3355
|
+
}
|
|
3356
|
+
),
|
|
3357
|
+
notes.length > 0 && /* @__PURE__ */ jsx9("ul", { className: "awr-notes", children: notes.map((n) => /* @__PURE__ */ jsx9(UserNoteRow, { note: n }, n.id)) }),
|
|
3358
|
+
step.blocked && step.summary && /* @__PURE__ */ jsx9("p", { className: "awr-step__blocked", children: step.summary }),
|
|
3359
|
+
showReplanFailed && step.replanFailed && /* @__PURE__ */ jsxs7("p", { className: "awr-step__warn", title: step.replanFailed, children: [
|
|
3360
|
+
/* @__PURE__ */ jsx9(AlertIcon, { size: 12 }),
|
|
3361
|
+
" ",
|
|
3362
|
+
L.replanFailed
|
|
3363
|
+
] }),
|
|
3364
|
+
showDecisions && step.decisions?.map((d, i) => /* @__PURE__ */ jsx9(
|
|
3365
|
+
"p",
|
|
3366
|
+
{
|
|
3367
|
+
className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
|
|
3368
|
+
title: d.model,
|
|
3369
|
+
children: decisionNote(d, L)
|
|
3370
|
+
},
|
|
3371
|
+
i
|
|
3372
|
+
))
|
|
2851
3373
|
] });
|
|
2852
3374
|
var StepList = ({
|
|
2853
3375
|
steps,
|
|
@@ -2859,7 +3381,13 @@ var StepList = ({
|
|
|
2859
3381
|
showToolCalls = true,
|
|
2860
3382
|
showUsage = true,
|
|
2861
3383
|
showThoughts = true,
|
|
3384
|
+
showTiers = true,
|
|
3385
|
+
showReplanFailed = true,
|
|
3386
|
+
showDecisions = true,
|
|
3387
|
+
showSearchResults = true,
|
|
3388
|
+
showSubagents = true,
|
|
2862
3389
|
renderToolCall,
|
|
3390
|
+
renderSubagent,
|
|
2863
3391
|
labels,
|
|
2864
3392
|
className
|
|
2865
3393
|
}) => {
|
|
@@ -2867,8 +3395,9 @@ var StepList = ({
|
|
|
2867
3395
|
if (steps.length === 0) return null;
|
|
2868
3396
|
const known = new Set(steps.map((s) => s.id));
|
|
2869
3397
|
const atEnd = showNotes ? notes.filter((n) => !n.stepId || !known.has(n.stepId)) : [];
|
|
2870
|
-
|
|
2871
|
-
|
|
3398
|
+
const loose = showSubagents ? subagents.filter((s) => !s.stepId || !known.has(s.stepId)) : [];
|
|
3399
|
+
return /* @__PURE__ */ jsxs7("ol", { className: ["awr-steps", className].filter(Boolean).join(" "), children: [
|
|
3400
|
+
steps.map((step) => /* @__PURE__ */ jsx9(
|
|
2872
3401
|
StepItem,
|
|
2873
3402
|
{
|
|
2874
3403
|
step,
|
|
@@ -2879,17 +3408,32 @@ var StepList = ({
|
|
|
2879
3408
|
showToolCalls,
|
|
2880
3409
|
showUsage,
|
|
2881
3410
|
showThoughts,
|
|
3411
|
+
showTiers,
|
|
3412
|
+
showReplanFailed,
|
|
3413
|
+
showDecisions,
|
|
3414
|
+
showSearchResults,
|
|
3415
|
+
showSubagents,
|
|
2882
3416
|
renderToolCall,
|
|
3417
|
+
renderSubagent,
|
|
2883
3418
|
L
|
|
2884
3419
|
},
|
|
2885
3420
|
step.id
|
|
2886
3421
|
)),
|
|
2887
|
-
|
|
3422
|
+
loose.length > 0 && /* @__PURE__ */ jsx9("li", { className: "awr-step awr-step--subagents", children: /* @__PURE__ */ jsx9(
|
|
3423
|
+
SubagentTree,
|
|
3424
|
+
{
|
|
3425
|
+
subagents: loose,
|
|
3426
|
+
onStop: onStopSubagent,
|
|
3427
|
+
showUsage,
|
|
3428
|
+
renderSubagent
|
|
3429
|
+
}
|
|
3430
|
+
) }),
|
|
3431
|
+
atEnd.length > 0 && /* @__PURE__ */ jsx9("li", { className: "awr-step awr-step--notes", children: /* @__PURE__ */ jsx9("ul", { className: "awr-notes", children: atEnd.map((n) => /* @__PURE__ */ jsx9(UserNoteRow, { note: n }, n.id)) }) })
|
|
2888
3432
|
] });
|
|
2889
3433
|
};
|
|
2890
3434
|
|
|
2891
3435
|
// src/components/MessageList.tsx
|
|
2892
|
-
import { jsx as
|
|
3436
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2893
3437
|
var usageLine = (usage, durationMs) => {
|
|
2894
3438
|
const parts = [];
|
|
2895
3439
|
if (usage && usage.totalTokens > 0) {
|
|
@@ -2900,16 +3444,18 @@ var usageLine = (usage, durationMs) => {
|
|
|
2900
3444
|
if (durationMs !== void 0) parts.push(formatDuration(durationMs));
|
|
2901
3445
|
return parts.join(" \xB7 ");
|
|
2902
3446
|
};
|
|
2903
|
-
var AttachmentView = ({ attachment: a }) => a.dataUrl && a.mediaType.startsWith("image/") ? /* @__PURE__ */
|
|
2904
|
-
/* @__PURE__ */
|
|
3447
|
+
var AttachmentView = ({ attachment: a }) => a.dataUrl && a.mediaType.startsWith("image/") ? /* @__PURE__ */ jsx10("a", { href: a.dataUrl, target: "_blank", rel: "noreferrer", title: a.path ?? a.name, children: /* @__PURE__ */ jsx10("img", { className: "awr-thumb awr-thumb--msg", src: a.dataUrl, alt: a.name }) }) : /* @__PURE__ */ jsxs8("span", { className: "awr-chip awr-file", title: a.path ?? a.mediaType, children: [
|
|
3448
|
+
/* @__PURE__ */ jsx10(FileIcon, { size: 13 }),
|
|
2905
3449
|
" ",
|
|
2906
3450
|
a.name
|
|
2907
3451
|
] });
|
|
2908
3452
|
var toolCallCount = (m) => (m.steps ?? []).reduce((n, s) => n + s.toolCalls.length, 0);
|
|
2909
|
-
var activitySummary = (m, showToolCalls, showLearned, L) => {
|
|
3453
|
+
var activitySummary = (m, showToolCalls, showLearned, showTiers, L) => {
|
|
2910
3454
|
const steps = m.steps ?? [];
|
|
2911
3455
|
const parts = [L.steps(steps.length)];
|
|
2912
3456
|
if (showToolCalls) parts.push(L.toolCalls(toolCallCount(m)));
|
|
3457
|
+
const escalations = steps.reduce((n, s) => n + (s.escalations?.length ?? 0), 0);
|
|
3458
|
+
if (showTiers && escalations > 0) parts.push(L.escalations(escalations));
|
|
2913
3459
|
if (m.subagents?.length) parts.push(L.subagents(m.subagents.length));
|
|
2914
3460
|
if (m.skills?.length) parts.push(L.skillsUsed(m.skills.join(", ")));
|
|
2915
3461
|
if (showLearned && m.learned?.length) parts.push(L.learnedNow(m.learned.join(", ")));
|
|
@@ -2925,6 +3471,15 @@ var MessageList = ({
|
|
|
2925
3471
|
showThoughts = true,
|
|
2926
3472
|
showNotes = true,
|
|
2927
3473
|
showLearned = true,
|
|
3474
|
+
showTiers = true,
|
|
3475
|
+
showReplanFailed = true,
|
|
3476
|
+
showDecisions = true,
|
|
3477
|
+
showSearchResults = true,
|
|
3478
|
+
showSubagents = true,
|
|
3479
|
+
showMedia = true,
|
|
3480
|
+
files,
|
|
3481
|
+
renderMedia,
|
|
3482
|
+
renderSubagent,
|
|
2928
3483
|
onStopSubagent,
|
|
2929
3484
|
activityOpen = false,
|
|
2930
3485
|
liveExtra,
|
|
@@ -2937,21 +3492,21 @@ var MessageList = ({
|
|
|
2937
3492
|
}) => {
|
|
2938
3493
|
const L = useLabels(labels);
|
|
2939
3494
|
if (messages.length === 0) {
|
|
2940
|
-
return empty ? /* @__PURE__ */
|
|
3495
|
+
return empty ? /* @__PURE__ */ jsx10("div", { className: "awr-messages__empty", children: empty }) : null;
|
|
2941
3496
|
}
|
|
2942
|
-
return /* @__PURE__ */
|
|
3497
|
+
return /* @__PURE__ */ jsx10("div", { className: ["awr-messages", className].filter(Boolean).join(" "), children: messages.map((m) => {
|
|
2943
3498
|
const steps = m.steps ?? [];
|
|
2944
3499
|
const hasActivity = showActivity && (steps.length > 0 || (m.subagents?.length ?? 0) > 0 || m.pending && !!liveExtra);
|
|
2945
3500
|
const usage = showUsage ? usageLine(m.usage, m.durationMs) : "";
|
|
2946
|
-
const node = /* @__PURE__ */
|
|
3501
|
+
const node = /* @__PURE__ */ jsx10(
|
|
2947
3502
|
"div",
|
|
2948
3503
|
{
|
|
2949
3504
|
className: `awr-msg awr-msg--${m.role}${m.error ? " awr-msg--error" : ""}${m.pending ? " is-pending" : ""}`,
|
|
2950
|
-
children: /* @__PURE__ */
|
|
2951
|
-
m.role === "assistant" && hasActivity && /* @__PURE__ */
|
|
2952
|
-
/* @__PURE__ */
|
|
3505
|
+
children: /* @__PURE__ */ jsxs8("div", { className: "awr-msg__col", children: [
|
|
3506
|
+
m.role === "assistant" && hasActivity && /* @__PURE__ */ jsxs8("details", { className: "awr-activity", open: m.pending || activityOpen, children: [
|
|
3507
|
+
/* @__PURE__ */ jsx10("summary", { className: "awr-activity__summary", children: activitySummary(m, showToolCalls, showLearned, showTiers, L) }),
|
|
2953
3508
|
m.pending && liveExtra,
|
|
2954
|
-
/* @__PURE__ */
|
|
3509
|
+
/* @__PURE__ */ jsx10(
|
|
2955
3510
|
StepList,
|
|
2956
3511
|
{
|
|
2957
3512
|
steps,
|
|
@@ -2963,153 +3518,190 @@ var MessageList = ({
|
|
|
2963
3518
|
showToolCalls,
|
|
2964
3519
|
showUsage,
|
|
2965
3520
|
showThoughts,
|
|
3521
|
+
showTiers,
|
|
3522
|
+
showReplanFailed,
|
|
3523
|
+
showDecisions,
|
|
3524
|
+
showSearchResults,
|
|
3525
|
+
showSubagents,
|
|
2966
3526
|
renderToolCall,
|
|
3527
|
+
renderSubagent,
|
|
2967
3528
|
labels
|
|
2968
3529
|
}
|
|
2969
3530
|
),
|
|
2970
|
-
showLearned && m.fetches?.length ? /* @__PURE__ */
|
|
3531
|
+
showLearned && m.fetches?.length ? /* @__PURE__ */ jsx10("ul", { className: "awr-fetches", children: m.fetches.map((f, i) => /* @__PURE__ */ jsxs8(
|
|
2971
3532
|
"li",
|
|
2972
3533
|
{
|
|
2973
3534
|
className: `awr-fetch${f.allowed ? "" : " awr-fetch--refused"}`,
|
|
2974
3535
|
children: [
|
|
2975
|
-
/* @__PURE__ */
|
|
3536
|
+
/* @__PURE__ */ jsx10(GlobeIcon, { size: 12 }),
|
|
2976
3537
|
" ",
|
|
2977
|
-
/* @__PURE__ */
|
|
3538
|
+
/* @__PURE__ */ jsx10("code", { children: f.url }),
|
|
2978
3539
|
" ",
|
|
2979
|
-
/* @__PURE__ */
|
|
3540
|
+
/* @__PURE__ */ jsx10("span", { className: "awr-fetch__result", children: f.allowed ? f.status ?? "ok" : L.fetchRefused(f.reason ?? "") })
|
|
2980
3541
|
]
|
|
2981
3542
|
},
|
|
2982
3543
|
i
|
|
2983
3544
|
)) }) : null,
|
|
2984
|
-
showLearned && m.learned?.length ? /* @__PURE__ */
|
|
2985
|
-
/* @__PURE__ */
|
|
3545
|
+
showLearned && m.learned?.length ? /* @__PURE__ */ jsxs8("p", { className: "awr-learned", children: [
|
|
3546
|
+
/* @__PURE__ */ jsx10(BookIcon, { size: 12 }),
|
|
2986
3547
|
" ",
|
|
2987
3548
|
L.learnedNow(m.learned.join(", "))
|
|
2988
3549
|
] }) : null,
|
|
2989
|
-
showThoughts && m.reasoning?.trim() && /* @__PURE__ */
|
|
2990
|
-
/* @__PURE__ */
|
|
2991
|
-
/* @__PURE__ */
|
|
3550
|
+
showThoughts && m.reasoning?.trim() && /* @__PURE__ */ jsxs8("details", { className: "awr-thought", children: [
|
|
3551
|
+
/* @__PURE__ */ jsxs8("summary", { children: [
|
|
3552
|
+
/* @__PURE__ */ jsx10(BrainIcon, { size: 13 }),
|
|
2992
3553
|
" ",
|
|
2993
3554
|
L.answerThoughts
|
|
2994
3555
|
] }),
|
|
2995
|
-
/* @__PURE__ */
|
|
3556
|
+
/* @__PURE__ */ jsx10("p", { className: "awr-thought__text", children: m.reasoning.trim() })
|
|
2996
3557
|
] })
|
|
2997
3558
|
] }),
|
|
2998
|
-
|
|
3559
|
+
showMedia && m.transcripts?.length ? /* @__PURE__ */ jsx10("div", { className: "awr-msg__transcripts", children: m.transcripts.map((t, i) => /* @__PURE__ */ jsx10(TranscriptBlock, { transcript: t, labels }, i)) }) : null,
|
|
3560
|
+
(m.content || m.pending || !m.attachments?.length) && /* @__PURE__ */ jsxs8("div", { className: "awr-msg__bubble", children: [
|
|
2999
3561
|
m.content ? renderContent ? renderContent(m) : m.content : null,
|
|
3000
|
-
m.pending && !m.content && /* @__PURE__ */
|
|
3562
|
+
m.pending && !m.content && /* @__PURE__ */ jsx10(SpinnerIcon, { size: 14, className: "awr-msg__pending" })
|
|
3001
3563
|
] }),
|
|
3002
|
-
m.
|
|
3003
|
-
|
|
3564
|
+
showMedia && m.media?.length ? /* @__PURE__ */ jsx10("div", { className: "awr-msg__media", children: m.media.map((item, i) => {
|
|
3565
|
+
const built = /* @__PURE__ */ jsx10(GeneratedMedia, { media: item, files, labels }, i);
|
|
3566
|
+
return renderMedia ? /* @__PURE__ */ jsx10("span", { className: "awr-msg__mediaitem", children: renderMedia(item, m, built) }, i) : built;
|
|
3567
|
+
}) }) : null,
|
|
3568
|
+
m.attachments?.length ? /* @__PURE__ */ jsx10("div", { className: "awr-msg__attachments", "aria-label": L.attachments, children: m.attachments.map((a, i) => /* @__PURE__ */ jsx10("span", { className: "awr-msg__attachment", children: renderAttachment ? renderAttachment(a, m) : /* @__PURE__ */ jsx10(AttachmentView, { attachment: a }) }, i)) }) : null,
|
|
3569
|
+
m.role === "assistant" && usage && !m.pending && /* @__PURE__ */ jsx10("div", { className: "awr-msg__usage", title: L.usageTitle, children: usage })
|
|
3004
3570
|
] })
|
|
3005
3571
|
},
|
|
3006
3572
|
m.id
|
|
3007
3573
|
);
|
|
3008
|
-
return renderMessage ? /* @__PURE__ */
|
|
3574
|
+
return renderMessage ? /* @__PURE__ */ jsx10("div", { children: renderMessage(m, node) }, m.id) : node;
|
|
3009
3575
|
}) });
|
|
3010
3576
|
};
|
|
3011
3577
|
|
|
3012
3578
|
// src/components/ModelLoadBar.tsx
|
|
3013
|
-
import { jsx as
|
|
3579
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3014
3580
|
var ModelLoadBar = ({ load, className }) => {
|
|
3015
3581
|
const pct = Math.round(Math.max(0, Math.min(1, load.progress)) * 100);
|
|
3016
|
-
return /* @__PURE__ */
|
|
3017
|
-
/* @__PURE__ */
|
|
3018
|
-
/* @__PURE__ */
|
|
3019
|
-
/* @__PURE__ */
|
|
3582
|
+
return /* @__PURE__ */ jsxs9("div", { className: ["awr-modelload", className].filter(Boolean).join(" "), children: [
|
|
3583
|
+
/* @__PURE__ */ jsxs9("div", { className: "awr-modelload__head", children: [
|
|
3584
|
+
/* @__PURE__ */ jsx11("span", { className: "awr-modelload__text", children: load.text || "Loading model\u2026" }),
|
|
3585
|
+
/* @__PURE__ */ jsxs9("span", { className: "awr-modelload__pct", children: [
|
|
3020
3586
|
pct,
|
|
3021
3587
|
"%"
|
|
3022
3588
|
] })
|
|
3023
3589
|
] }),
|
|
3024
|
-
/* @__PURE__ */
|
|
3590
|
+
/* @__PURE__ */ jsx11("div", { className: "awr-modelload__track", role: "progressbar", "aria-valuenow": pct, children: /* @__PURE__ */ jsx11("div", { className: "awr-modelload__fill", style: { width: `${pct}%` } }) })
|
|
3025
3591
|
] });
|
|
3026
3592
|
};
|
|
3027
3593
|
|
|
3028
3594
|
// src/components/ToolApprovalPrompt.tsx
|
|
3029
|
-
import { jsx as
|
|
3595
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3030
3596
|
var ToolApprovalPrompt = ({
|
|
3031
3597
|
approvals,
|
|
3032
3598
|
onApprove,
|
|
3033
3599
|
onDeny,
|
|
3034
3600
|
allowRemember = true,
|
|
3601
|
+
showHelper = true,
|
|
3035
3602
|
renderApproval,
|
|
3036
3603
|
labels,
|
|
3037
3604
|
className
|
|
3038
3605
|
}) => {
|
|
3039
3606
|
const L = useLabels(labels);
|
|
3040
3607
|
if (approvals.length === 0) return null;
|
|
3041
|
-
return /* @__PURE__ */
|
|
3042
|
-
const
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
}
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3608
|
+
return /* @__PURE__ */ jsx12("div", { className: ["awr-approvals", className].filter(Boolean).join(" "), role: "alert", children: approvals.map((a) => {
|
|
3609
|
+
const helper = showHelper ? a.subagent : void 0;
|
|
3610
|
+
const card = /* @__PURE__ */ jsxs10(
|
|
3611
|
+
"div",
|
|
3612
|
+
{
|
|
3613
|
+
className: `awr-approval${helper ? " awr-approval--helper" : ""}`,
|
|
3614
|
+
"data-subagent": helper?.id,
|
|
3615
|
+
children: [
|
|
3616
|
+
/* @__PURE__ */ jsxs10("div", { className: "awr-approval__head", children: [
|
|
3617
|
+
/* @__PURE__ */ jsx12(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
|
|
3618
|
+
/* @__PURE__ */ jsxs10("span", { children: [
|
|
3619
|
+
helper ? L.approvalLeadHelper(
|
|
3620
|
+
previewValue(helper.role ?? "", 60) || void 0,
|
|
3621
|
+
helper.depth
|
|
3622
|
+
) : L.approvalLead,
|
|
3623
|
+
" ",
|
|
3624
|
+
/* @__PURE__ */ jsx12("code", { className: "awr-tool__name", children: a.name }),
|
|
3625
|
+
a.readOnly ? ` (${L.readOnlyTool})` : ""
|
|
3626
|
+
] })
|
|
3627
|
+
] }),
|
|
3628
|
+
previewValue(a.input, 300) && /* @__PURE__ */ jsx12("pre", { className: "awr-approval__input", children: previewValue(a.input, 300) }),
|
|
3629
|
+
/* @__PURE__ */ jsxs10("div", { className: "awr-approval__actions", children: [
|
|
3630
|
+
/* @__PURE__ */ jsx12(
|
|
3631
|
+
"button",
|
|
3632
|
+
{
|
|
3633
|
+
type: "button",
|
|
3634
|
+
className: "awr-btn awr-btn--primary",
|
|
3635
|
+
onClick: () => onApprove(a.id),
|
|
3636
|
+
children: L.approve
|
|
3637
|
+
}
|
|
3638
|
+
),
|
|
3639
|
+
allowRemember && /* @__PURE__ */ jsx12(
|
|
3640
|
+
"button",
|
|
3641
|
+
{
|
|
3642
|
+
type: "button",
|
|
3643
|
+
className: "awr-btn",
|
|
3644
|
+
onClick: () => onApprove(a.id, { remember: true }),
|
|
3645
|
+
children: L.alwaysAllow
|
|
3646
|
+
}
|
|
3647
|
+
),
|
|
3648
|
+
/* @__PURE__ */ jsx12(
|
|
3649
|
+
"button",
|
|
3650
|
+
{
|
|
3651
|
+
type: "button",
|
|
3652
|
+
className: "awr-btn awr-btn--danger",
|
|
3653
|
+
onClick: () => onDeny(a.id, L.declinedReason),
|
|
3654
|
+
children: L.deny
|
|
3655
|
+
}
|
|
3656
|
+
)
|
|
3657
|
+
] })
|
|
3658
|
+
]
|
|
3659
|
+
},
|
|
3660
|
+
a.id
|
|
3661
|
+
);
|
|
3662
|
+
return renderApproval ? /* @__PURE__ */ jsx12("div", { children: renderApproval(a, card) }, a.id) : card;
|
|
3084
3663
|
}) });
|
|
3085
3664
|
};
|
|
3086
3665
|
|
|
3087
3666
|
// src/components/UsageBadge.tsx
|
|
3088
|
-
import { jsxs as
|
|
3089
|
-
var UsageBadge = ({
|
|
3090
|
-
|
|
3667
|
+
import { jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3668
|
+
var UsageBadge = ({
|
|
3669
|
+
usage,
|
|
3670
|
+
compact = false,
|
|
3671
|
+
showCalls = true,
|
|
3672
|
+
labels,
|
|
3673
|
+
className
|
|
3674
|
+
}) => {
|
|
3675
|
+
const L = useLabels(labels);
|
|
3676
|
+
const media = showCalls ? usage.mediaCalls ?? 0 : 0;
|
|
3677
|
+
const decisions = showCalls ? usage.decisionCalls ?? 0 : 0;
|
|
3678
|
+
if (usage.totalTokens === 0 && media === 0 && decisions === 0) return null;
|
|
3091
3679
|
const reasoning = usage.reasoningTokens ?? 0;
|
|
3092
3680
|
const cached = usage.cachedInputTokens ?? 0;
|
|
3093
3681
|
const title = [
|
|
3094
3682
|
`${usage.inputTokens} in + ${usage.outputTokens} out = ${usage.totalTokens} tokens`,
|
|
3095
3683
|
reasoning ? `${reasoning} thinking` : "",
|
|
3096
|
-
cached ? `${cached} input tokens from the prompt cache` : ""
|
|
3684
|
+
cached ? `${cached} input tokens from the prompt cache` : "",
|
|
3685
|
+
media ? L.usageMedia(media) : "",
|
|
3686
|
+
decisions ? L.usageDecisions(decisions) : ""
|
|
3097
3687
|
].filter(Boolean).join(" \xB7 ");
|
|
3098
|
-
return /* @__PURE__ */
|
|
3688
|
+
return /* @__PURE__ */ jsxs11("span", { className: ["awr-usage", className].filter(Boolean).join(" "), title, children: [
|
|
3099
3689
|
formatTokens(usage.inputTokens),
|
|
3100
3690
|
"\u2191 ",
|
|
3101
3691
|
formatTokens(usage.outputTokens),
|
|
3102
3692
|
"\u2193",
|
|
3103
3693
|
!compact && reasoning > 0 && ` \xB7 ${formatTokens(reasoning)} think`,
|
|
3104
|
-
!compact && cached > 0 && ` \xB7 ${formatTokens(cached)} cached
|
|
3694
|
+
!compact && cached > 0 && ` \xB7 ${formatTokens(cached)} cached`,
|
|
3695
|
+
!compact && media > 0 && ` \xB7 ${L.usageMedia(media)}`,
|
|
3696
|
+
!compact && decisions > 0 && ` \xB7 ${L.usageDecisions(decisions)}`
|
|
3105
3697
|
] });
|
|
3106
3698
|
};
|
|
3107
3699
|
|
|
3108
3700
|
// src/components/AgentChat.tsx
|
|
3109
|
-
import { Fragment as
|
|
3701
|
+
import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3110
3702
|
var isHistoryHook = (h) => typeof h === "object" && h !== null && "select" in h && "chats" in h;
|
|
3111
3703
|
var cx = (...names) => names.filter(Boolean).join(" ");
|
|
3112
|
-
var AgentChat = (props) => /* @__PURE__ */
|
|
3704
|
+
var AgentChat = (props) => /* @__PURE__ */ jsx13(AgentLabelsProvider, { labels: props.labels ?? NO_LABELS, children: /* @__PURE__ */ jsx13(AgentChatInner, { ...props }) });
|
|
3113
3705
|
var NO_LABELS = {};
|
|
3114
3706
|
var AgentChatInner = ({
|
|
3115
3707
|
controller,
|
|
@@ -3122,6 +3714,12 @@ var AgentChatInner = ({
|
|
|
3122
3714
|
showThoughts = true,
|
|
3123
3715
|
showNotes = true,
|
|
3124
3716
|
showLearned = true,
|
|
3717
|
+
showTiers = true,
|
|
3718
|
+
showReplanFailed = true,
|
|
3719
|
+
showDecisions = true,
|
|
3720
|
+
showSearchResults = true,
|
|
3721
|
+
showSubagents = true,
|
|
3722
|
+
showMedia = true,
|
|
3125
3723
|
stoppableSubagents = true,
|
|
3126
3724
|
showTotalUsage = true,
|
|
3127
3725
|
showStatus = true,
|
|
@@ -3138,6 +3736,8 @@ var AgentChatInner = ({
|
|
|
3138
3736
|
renderMessage,
|
|
3139
3737
|
renderAttachment,
|
|
3140
3738
|
renderToolCall,
|
|
3739
|
+
renderSubagent,
|
|
3740
|
+
renderMedia,
|
|
3141
3741
|
renderApproval,
|
|
3142
3742
|
slots = {},
|
|
3143
3743
|
components = {},
|
|
@@ -3155,7 +3755,7 @@ var AgentChatInner = ({
|
|
|
3155
3755
|
}
|
|
3156
3756
|
const L = useLabels();
|
|
3157
3757
|
const external = isHistoryHook(history) ? history : void 0;
|
|
3158
|
-
const [ownStore] =
|
|
3758
|
+
const [ownStore] = useState11(
|
|
3159
3759
|
() => history instanceof ChatHistoryStore ? history : new ChatHistoryStore()
|
|
3160
3760
|
);
|
|
3161
3761
|
const own = useChatHistory(agent, {
|
|
@@ -3164,8 +3764,8 @@ var AgentChatInner = ({
|
|
|
3164
3764
|
});
|
|
3165
3765
|
const chats = history ? external ?? own : void 0;
|
|
3166
3766
|
const rootRef = useRef7(null);
|
|
3167
|
-
const [narrow, setNarrow] =
|
|
3168
|
-
|
|
3767
|
+
const [narrow, setNarrow] = useState11(void 0);
|
|
3768
|
+
useEffect9(() => {
|
|
3169
3769
|
const el = rootRef.current;
|
|
3170
3770
|
if (!el || typeof ResizeObserver === "undefined") return setNarrow(false);
|
|
3171
3771
|
const measure = () => setNarrow(el.getBoundingClientRect().width < narrowWidth);
|
|
@@ -3174,9 +3774,9 @@ var AgentChatInner = ({
|
|
|
3174
3774
|
ro.observe(el);
|
|
3175
3775
|
return () => ro.disconnect();
|
|
3176
3776
|
}, [narrowWidth]);
|
|
3177
|
-
const [historyChoice, setHistoryOpen] =
|
|
3777
|
+
const [historyChoice, setHistoryOpen] = useState11(defaultHistoryOpen);
|
|
3178
3778
|
const historyOpen = historyChoice ?? narrow === false;
|
|
3179
|
-
const [filesOpen, setFilesOpen] =
|
|
3779
|
+
const [filesOpen, setFilesOpen] = useState11(defaultFilesOpen);
|
|
3180
3780
|
const toggleHistory = () => {
|
|
3181
3781
|
setHistoryOpen(!historyOpen);
|
|
3182
3782
|
if (narrow && !historyOpen) setFilesOpen(false);
|
|
@@ -3187,11 +3787,11 @@ var AgentChatInner = ({
|
|
|
3187
3787
|
};
|
|
3188
3788
|
const bodyRef = useRef7(null);
|
|
3189
3789
|
const stickRef = useRef7(true);
|
|
3190
|
-
|
|
3790
|
+
useEffect9(() => {
|
|
3191
3791
|
const el = bodyRef.current;
|
|
3192
3792
|
if (el && stickRef.current) el.scrollTop = el.scrollHeight;
|
|
3193
3793
|
}, [agent.messages, agent.steps, agent.finalText, agent.modelLoad, agent.pendingApprovals]);
|
|
3194
|
-
const [compacting, setCompacting] =
|
|
3794
|
+
const [compacting, setCompacting] = useState11(false);
|
|
3195
3795
|
const compact = () => {
|
|
3196
3796
|
setCompacting(true);
|
|
3197
3797
|
void agent.compact().finally(() => setCompacting(false));
|
|
@@ -3203,15 +3803,30 @@ var AgentChatInner = ({
|
|
|
3203
3803
|
const Approvals = components.ApprovalPrompt ?? ToolApprovalPrompt;
|
|
3204
3804
|
const loading = agent.modelLoad && agent.modelLoad.progress < 1;
|
|
3205
3805
|
const showReplan = agent.replan && agent.replan.mode !== "continue";
|
|
3206
|
-
const
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3806
|
+
const replanFailedEarly = showReplanFailed && agent.replan?.failed === true && agent.steps.length === 0;
|
|
3807
|
+
const earlyDecisions = showDecisions ? agent.decisions ?? [] : [];
|
|
3808
|
+
const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
3809
|
+
agent.planThought.trim() && /* @__PURE__ */ jsxs12("details", { className: "awr-activity__plan", children: [
|
|
3810
|
+
/* @__PURE__ */ jsx13("summary", { children: L.planned }),
|
|
3811
|
+
/* @__PURE__ */ jsx13("p", { className: "awr-activity__thought", children: agent.planThought })
|
|
3210
3812
|
] }),
|
|
3211
|
-
showReplan && /* @__PURE__ */
|
|
3813
|
+
showReplan && /* @__PURE__ */ jsx13("div", { className: "awr-activity__replan", children: L.replanned(agent.replan.mode, agent.replan.reason) }),
|
|
3814
|
+
replanFailedEarly && /* @__PURE__ */ jsxs12("p", { className: "awr-step__warn", title: agent.replan.error, children: [
|
|
3815
|
+
/* @__PURE__ */ jsx13(AlertIcon, { size: 12 }),
|
|
3816
|
+
" ",
|
|
3817
|
+
L.replanFailed
|
|
3818
|
+
] }),
|
|
3819
|
+
earlyDecisions.map((d, i) => /* @__PURE__ */ jsx13(
|
|
3820
|
+
"p",
|
|
3821
|
+
{
|
|
3822
|
+
className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
|
|
3823
|
+
children: decisionNote(d, L)
|
|
3824
|
+
},
|
|
3825
|
+
i
|
|
3826
|
+
))
|
|
3212
3827
|
] }) : void 0;
|
|
3213
|
-
const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */
|
|
3214
|
-
chats && /* @__PURE__ */
|
|
3828
|
+
const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */ jsxs12("div", { className: cx("awr-chat__header", classNames.header), children: [
|
|
3829
|
+
chats && /* @__PURE__ */ jsx13(
|
|
3215
3830
|
"button",
|
|
3216
3831
|
{
|
|
3217
3832
|
type: "button",
|
|
@@ -3220,17 +3835,17 @@ var AgentChatInner = ({
|
|
|
3220
3835
|
title: L.showHistory,
|
|
3221
3836
|
"aria-pressed": historyOpen,
|
|
3222
3837
|
onClick: toggleHistory,
|
|
3223
|
-
children: /* @__PURE__ */
|
|
3838
|
+
children: /* @__PURE__ */ jsx13(HistoryIcon, { size: 16 })
|
|
3224
3839
|
}
|
|
3225
3840
|
),
|
|
3226
3841
|
slots.headerStart,
|
|
3227
|
-
/* @__PURE__ */
|
|
3228
|
-
showStatus && /* @__PURE__ */
|
|
3229
|
-
/* @__PURE__ */
|
|
3230
|
-
/* @__PURE__ */
|
|
3842
|
+
/* @__PURE__ */ jsx13("div", { className: "awr-chat__title", children: title }),
|
|
3843
|
+
showStatus && /* @__PURE__ */ jsxs12("span", { className: `awr-status awr-status--${agent.status}`, title: L.status[agent.status], children: [
|
|
3844
|
+
/* @__PURE__ */ jsx13("span", { className: "awr-status__dot" }),
|
|
3845
|
+
/* @__PURE__ */ jsx13("span", { className: "awr-status__text", children: L.status[agent.status] })
|
|
3231
3846
|
] }),
|
|
3232
|
-
showTotalUsage && /* @__PURE__ */
|
|
3233
|
-
files && /* @__PURE__ */
|
|
3847
|
+
showTotalUsage && /* @__PURE__ */ jsx13("span", { title: L.totalUsage, children: /* @__PURE__ */ jsx13(UsageBadge, { usage: agent.totalUsage, compact: narrow !== false }) }),
|
|
3848
|
+
files && /* @__PURE__ */ jsx13(
|
|
3234
3849
|
"button",
|
|
3235
3850
|
{
|
|
3236
3851
|
type: "button",
|
|
@@ -3239,12 +3854,12 @@ var AgentChatInner = ({
|
|
|
3239
3854
|
title: L.showFiles,
|
|
3240
3855
|
"aria-pressed": filesOpen,
|
|
3241
3856
|
onClick: toggleFiles,
|
|
3242
|
-
children: /* @__PURE__ */
|
|
3857
|
+
children: /* @__PURE__ */ jsx13(FileIcon, { size: 16 })
|
|
3243
3858
|
}
|
|
3244
3859
|
),
|
|
3245
3860
|
slots.headerEnd
|
|
3246
3861
|
] });
|
|
3247
|
-
return /* @__PURE__ */
|
|
3862
|
+
return /* @__PURE__ */ jsxs12(
|
|
3248
3863
|
"div",
|
|
3249
3864
|
{
|
|
3250
3865
|
ref: rootRef,
|
|
@@ -3252,8 +3867,8 @@ var AgentChatInner = ({
|
|
|
3252
3867
|
style,
|
|
3253
3868
|
"data-awr-theme": theme === "auto" ? void 0 : theme,
|
|
3254
3869
|
children: [
|
|
3255
|
-
chats && historyOpen && /* @__PURE__ */
|
|
3256
|
-
/* @__PURE__ */
|
|
3870
|
+
chats && historyOpen && /* @__PURE__ */ jsxs12("aside", { className: cx("awr-chat__sidebar", classNames.sidebar), children: [
|
|
3871
|
+
/* @__PURE__ */ jsx13(
|
|
3257
3872
|
HistoryList,
|
|
3258
3873
|
{
|
|
3259
3874
|
history: {
|
|
@@ -3272,7 +3887,7 @@ var AgentChatInner = ({
|
|
|
3272
3887
|
}
|
|
3273
3888
|
),
|
|
3274
3889
|
slots.sidebar,
|
|
3275
|
-
/* @__PURE__ */
|
|
3890
|
+
/* @__PURE__ */ jsx13(
|
|
3276
3891
|
"button",
|
|
3277
3892
|
{
|
|
3278
3893
|
type: "button",
|
|
@@ -3283,9 +3898,9 @@ var AgentChatInner = ({
|
|
|
3283
3898
|
}
|
|
3284
3899
|
)
|
|
3285
3900
|
] }),
|
|
3286
|
-
/* @__PURE__ */
|
|
3901
|
+
/* @__PURE__ */ jsxs12("div", { className: cx("awr-chat__main", classNames.main), children: [
|
|
3287
3902
|
header,
|
|
3288
|
-
/* @__PURE__ */
|
|
3903
|
+
/* @__PURE__ */ jsxs12(
|
|
3289
3904
|
"div",
|
|
3290
3905
|
{
|
|
3291
3906
|
className: cx("awr-chat__body", classNames.body),
|
|
@@ -3296,7 +3911,7 @@ var AgentChatInner = ({
|
|
|
3296
3911
|
},
|
|
3297
3912
|
children: [
|
|
3298
3913
|
slots.beforeMessages,
|
|
3299
|
-
/* @__PURE__ */
|
|
3914
|
+
/* @__PURE__ */ jsx13(
|
|
3300
3915
|
Messages,
|
|
3301
3916
|
{
|
|
3302
3917
|
messages: agent.messages,
|
|
@@ -3307,6 +3922,15 @@ var AgentChatInner = ({
|
|
|
3307
3922
|
showThoughts,
|
|
3308
3923
|
showNotes,
|
|
3309
3924
|
showLearned,
|
|
3925
|
+
showTiers,
|
|
3926
|
+
showReplanFailed,
|
|
3927
|
+
showDecisions,
|
|
3928
|
+
showSearchResults,
|
|
3929
|
+
showSubagents,
|
|
3930
|
+
showMedia,
|
|
3931
|
+
files,
|
|
3932
|
+
renderMedia,
|
|
3933
|
+
renderSubagent,
|
|
3310
3934
|
onStopSubagent: stoppableSubagents ? agent.stopSubagent : void 0,
|
|
3311
3935
|
activityOpen,
|
|
3312
3936
|
liveExtra,
|
|
@@ -3316,7 +3940,7 @@ var AgentChatInner = ({
|
|
|
3316
3940
|
renderToolCall
|
|
3317
3941
|
}
|
|
3318
3942
|
),
|
|
3319
|
-
/* @__PURE__ */
|
|
3943
|
+
/* @__PURE__ */ jsx13(
|
|
3320
3944
|
Approvals,
|
|
3321
3945
|
{
|
|
3322
3946
|
approvals: agent.pendingApprovals,
|
|
@@ -3325,14 +3949,14 @@ var AgentChatInner = ({
|
|
|
3325
3949
|
renderApproval
|
|
3326
3950
|
}
|
|
3327
3951
|
),
|
|
3328
|
-
agent.modelLoad && loading && /* @__PURE__ */
|
|
3952
|
+
agent.modelLoad && loading && /* @__PURE__ */ jsx13(ModelLoadBar, { load: agent.modelLoad }),
|
|
3329
3953
|
slots.afterMessages
|
|
3330
3954
|
]
|
|
3331
3955
|
}
|
|
3332
3956
|
),
|
|
3333
|
-
/* @__PURE__ */
|
|
3957
|
+
/* @__PURE__ */ jsxs12("div", { className: cx("awr-chat__footer", classNames.footer), children: [
|
|
3334
3958
|
slots.footerStart,
|
|
3335
|
-
showContext !== false && /* @__PURE__ */
|
|
3959
|
+
showContext !== false && /* @__PURE__ */ jsx13(
|
|
3336
3960
|
ContextMeter,
|
|
3337
3961
|
{
|
|
3338
3962
|
usage: agent.usage,
|
|
@@ -3343,11 +3967,11 @@ var AgentChatInner = ({
|
|
|
3343
3967
|
compacting
|
|
3344
3968
|
}
|
|
3345
3969
|
),
|
|
3346
|
-
composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */
|
|
3347
|
-
/* @__PURE__ */
|
|
3970
|
+
composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */ jsxs12("div", { className: "awr-chat__error", children: [
|
|
3971
|
+
/* @__PURE__ */ jsx13(AlertIcon, { size: 14 }),
|
|
3348
3972
|
" ",
|
|
3349
3973
|
agent.error
|
|
3350
|
-
] }) : /* @__PURE__ */
|
|
3974
|
+
] }) : /* @__PURE__ */ jsx13(
|
|
3351
3975
|
Composer2,
|
|
3352
3976
|
{
|
|
3353
3977
|
controller: agent,
|
|
@@ -3360,9 +3984,9 @@ var AgentChatInner = ({
|
|
|
3360
3984
|
)
|
|
3361
3985
|
] })
|
|
3362
3986
|
] }),
|
|
3363
|
-
files && filesOpen && /* @__PURE__ */
|
|
3364
|
-
/* @__PURE__ */
|
|
3365
|
-
/* @__PURE__ */
|
|
3987
|
+
files && filesOpen && /* @__PURE__ */ jsxs12("aside", { className: cx("awr-chat__files", classNames.files), children: [
|
|
3988
|
+
/* @__PURE__ */ jsx13(Files, { files }),
|
|
3989
|
+
/* @__PURE__ */ jsx13(
|
|
3366
3990
|
"button",
|
|
3367
3991
|
{
|
|
3368
3992
|
type: "button",
|
|
@@ -3379,7 +4003,7 @@ var AgentChatInner = ({
|
|
|
3379
4003
|
};
|
|
3380
4004
|
|
|
3381
4005
|
// src/components/LearnedSkills.tsx
|
|
3382
|
-
import { jsx as
|
|
4006
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3383
4007
|
var LearnedSkills = ({
|
|
3384
4008
|
controller,
|
|
3385
4009
|
lessons,
|
|
@@ -3395,18 +4019,18 @@ var LearnedSkills = ({
|
|
|
3395
4019
|
const c = controller ?? ctx;
|
|
3396
4020
|
const list = lessons ?? c?.learned ?? [];
|
|
3397
4021
|
const forget = onForget === false ? void 0 : onForget ?? c?.forgetSkill;
|
|
3398
|
-
return /* @__PURE__ */
|
|
3399
|
-
!hideTitle && /* @__PURE__ */
|
|
3400
|
-
/* @__PURE__ */
|
|
4022
|
+
return /* @__PURE__ */ jsxs13("section", { className: ["awr-notebook", className].filter(Boolean).join(" "), children: [
|
|
4023
|
+
!hideTitle && /* @__PURE__ */ jsxs13("h3", { className: "awr-notebook__title", children: [
|
|
4024
|
+
/* @__PURE__ */ jsx14(BookIcon, { size: 14 }),
|
|
3401
4025
|
" ",
|
|
3402
4026
|
L.notebookTitle,
|
|
3403
|
-
list.length > 0 && /* @__PURE__ */
|
|
4027
|
+
list.length > 0 && /* @__PURE__ */ jsx14("span", { className: "awr-notebook__count", children: list.length })
|
|
3404
4028
|
] }),
|
|
3405
|
-
list.length === 0 ? /* @__PURE__ */
|
|
3406
|
-
/* @__PURE__ */
|
|
3407
|
-
/* @__PURE__ */
|
|
3408
|
-
l.revision > 1 && /* @__PURE__ */
|
|
3409
|
-
forget && /* @__PURE__ */
|
|
4029
|
+
list.length === 0 ? /* @__PURE__ */ jsx14("p", { className: "awr-notebook__empty", children: empty ?? L.notebookEmpty }) : /* @__PURE__ */ jsx14("ul", { className: "awr-notebook__list", children: list.map((l) => /* @__PURE__ */ jsxs13("li", { className: "awr-lesson", children: [
|
|
4030
|
+
/* @__PURE__ */ jsxs13("div", { className: "awr-lesson__head", children: [
|
|
4031
|
+
/* @__PURE__ */ jsx14("code", { className: "awr-lesson__name", children: l.name }),
|
|
4032
|
+
l.revision > 1 && /* @__PURE__ */ jsx14("span", { className: "awr-lesson__rev", children: L.notebookRevision(l.revision) }),
|
|
4033
|
+
forget && /* @__PURE__ */ jsx14(
|
|
3410
4034
|
"button",
|
|
3411
4035
|
{
|
|
3412
4036
|
type: "button",
|
|
@@ -3414,12 +4038,12 @@ var LearnedSkills = ({
|
|
|
3414
4038
|
title: `${L.notebookForget}: ${l.name}`,
|
|
3415
4039
|
"aria-label": `${L.notebookForget}: ${l.name}`,
|
|
3416
4040
|
onClick: () => void forget(l.name),
|
|
3417
|
-
children: /* @__PURE__ */
|
|
4041
|
+
children: /* @__PURE__ */ jsx14(XIcon, { size: 12 })
|
|
3418
4042
|
}
|
|
3419
4043
|
)
|
|
3420
4044
|
] }),
|
|
3421
|
-
/* @__PURE__ */
|
|
3422
|
-
showSources && l.sources.length > 0 && /* @__PURE__ */
|
|
4045
|
+
/* @__PURE__ */ jsx14("p", { className: "awr-lesson__when", children: l.description }),
|
|
4046
|
+
showSources && l.sources.length > 0 && /* @__PURE__ */ jsxs13("p", { className: "awr-lesson__from", children: [
|
|
3423
4047
|
L.notebookFrom,
|
|
3424
4048
|
" ",
|
|
3425
4049
|
l.sources.join(", ")
|
|
@@ -3429,8 +4053,8 @@ var LearnedSkills = ({
|
|
|
3429
4053
|
};
|
|
3430
4054
|
|
|
3431
4055
|
// src/components/Composer.tsx
|
|
3432
|
-
import { useState as
|
|
3433
|
-
import { jsx as
|
|
4056
|
+
import { useState as useState12 } from "react";
|
|
4057
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3434
4058
|
var Composer = ({
|
|
3435
4059
|
onSubmit,
|
|
3436
4060
|
busy = false,
|
|
@@ -3439,7 +4063,7 @@ var Composer = ({
|
|
|
3439
4063
|
placeholder = "Ask the agent to do something\u2026",
|
|
3440
4064
|
className
|
|
3441
4065
|
}) => {
|
|
3442
|
-
const [text, setText] =
|
|
4066
|
+
const [text, setText] = useState12("");
|
|
3443
4067
|
const submit = () => {
|
|
3444
4068
|
const value = text.trim();
|
|
3445
4069
|
if (!value || busy || disabled) return;
|
|
@@ -3452,7 +4076,7 @@ var Composer = ({
|
|
|
3452
4076
|
submit();
|
|
3453
4077
|
}
|
|
3454
4078
|
};
|
|
3455
|
-
return /* @__PURE__ */
|
|
4079
|
+
return /* @__PURE__ */ jsxs14(
|
|
3456
4080
|
"form",
|
|
3457
4081
|
{
|
|
3458
4082
|
className: ["awr-composer", className].filter(Boolean).join(" "),
|
|
@@ -3461,7 +4085,7 @@ var Composer = ({
|
|
|
3461
4085
|
submit();
|
|
3462
4086
|
},
|
|
3463
4087
|
children: [
|
|
3464
|
-
/* @__PURE__ */
|
|
4088
|
+
/* @__PURE__ */ jsx15(
|
|
3465
4089
|
"textarea",
|
|
3466
4090
|
{
|
|
3467
4091
|
className: "awr-composer__input",
|
|
@@ -3473,23 +4097,23 @@ var Composer = ({
|
|
|
3473
4097
|
rows: 1
|
|
3474
4098
|
}
|
|
3475
4099
|
),
|
|
3476
|
-
busy ? /* @__PURE__ */
|
|
4100
|
+
busy ? /* @__PURE__ */ jsx15(
|
|
3477
4101
|
"button",
|
|
3478
4102
|
{
|
|
3479
4103
|
type: "button",
|
|
3480
4104
|
className: "awr-composer__btn awr-composer__btn--stop",
|
|
3481
4105
|
onClick: onStop,
|
|
3482
4106
|
"aria-label": "Stop",
|
|
3483
|
-
children: /* @__PURE__ */
|
|
4107
|
+
children: /* @__PURE__ */ jsx15(StopIcon, { size: 18 })
|
|
3484
4108
|
}
|
|
3485
|
-
) : /* @__PURE__ */
|
|
4109
|
+
) : /* @__PURE__ */ jsx15(
|
|
3486
4110
|
"button",
|
|
3487
4111
|
{
|
|
3488
4112
|
type: "submit",
|
|
3489
4113
|
className: "awr-composer__btn",
|
|
3490
4114
|
disabled: disabled || !text.trim(),
|
|
3491
4115
|
"aria-label": "Send",
|
|
3492
|
-
children: disabled ? /* @__PURE__ */
|
|
4116
|
+
children: disabled ? /* @__PURE__ */ jsx15(SpinnerIcon, { size: 18 }) : /* @__PURE__ */ jsx15(SendIcon, { size: 18 })
|
|
3493
4117
|
}
|
|
3494
4118
|
)
|
|
3495
4119
|
]
|
|
@@ -3498,17 +4122,17 @@ var Composer = ({
|
|
|
3498
4122
|
};
|
|
3499
4123
|
|
|
3500
4124
|
// src/components/PlanView.tsx
|
|
3501
|
-
import { jsx as
|
|
4125
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3502
4126
|
var PlanView = ({ plan, showThought = true, className }) => {
|
|
3503
4127
|
if (!plan.steps.length && !plan.thought) return null;
|
|
3504
|
-
return /* @__PURE__ */
|
|
3505
|
-
showThought && plan.thought.trim() && /* @__PURE__ */
|
|
3506
|
-
plan.steps.length > 0 && /* @__PURE__ */
|
|
4128
|
+
return /* @__PURE__ */ jsxs15("div", { className: ["awr-plan", className].filter(Boolean).join(" "), children: [
|
|
4129
|
+
showThought && plan.thought.trim() && /* @__PURE__ */ jsx16("p", { className: "awr-plan__thought", children: plan.thought }),
|
|
4130
|
+
plan.steps.length > 0 && /* @__PURE__ */ jsx16("ol", { className: "awr-plan__steps", children: plan.steps.map((step) => /* @__PURE__ */ jsx16("li", { className: "awr-plan__step", children: step.description }, step.id)) })
|
|
3507
4131
|
] });
|
|
3508
4132
|
};
|
|
3509
4133
|
|
|
3510
4134
|
// src/components/ApprovalModeSwitch.tsx
|
|
3511
|
-
import { jsx as
|
|
4135
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
3512
4136
|
var DEFAULT_LABELS = {
|
|
3513
4137
|
autopilot: "Autopilot",
|
|
3514
4138
|
"ask-writes": "Ask before changes",
|
|
@@ -3528,13 +4152,13 @@ var ApprovalModeSwitch = ({
|
|
|
3528
4152
|
labels,
|
|
3529
4153
|
disabled,
|
|
3530
4154
|
className
|
|
3531
|
-
}) => /* @__PURE__ */
|
|
4155
|
+
}) => /* @__PURE__ */ jsx17(
|
|
3532
4156
|
"div",
|
|
3533
4157
|
{
|
|
3534
4158
|
className: ["awr-modeswitch", className].filter(Boolean).join(" "),
|
|
3535
4159
|
role: "radiogroup",
|
|
3536
4160
|
"aria-label": "Tool consent",
|
|
3537
|
-
children: modes.map((m) => /* @__PURE__ */
|
|
4161
|
+
children: modes.map((m) => /* @__PURE__ */ jsx17(
|
|
3538
4162
|
"button",
|
|
3539
4163
|
{
|
|
3540
4164
|
type: "button",
|
|
@@ -3552,8 +4176,8 @@ var ApprovalModeSwitch = ({
|
|
|
3552
4176
|
);
|
|
3553
4177
|
|
|
3554
4178
|
// src/components/ApiKeyForm.tsx
|
|
3555
|
-
import { useEffect as
|
|
3556
|
-
import { jsx as
|
|
4179
|
+
import { useEffect as useEffect10, useState as useState13 } from "react";
|
|
4180
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3557
4181
|
var ApiKeyForm = ({
|
|
3558
4182
|
credentials,
|
|
3559
4183
|
credentialRef,
|
|
@@ -3562,10 +4186,10 @@ var ApiKeyForm = ({
|
|
|
3562
4186
|
onChange,
|
|
3563
4187
|
className
|
|
3564
4188
|
}) => {
|
|
3565
|
-
const [value, setValue] =
|
|
3566
|
-
const [present, setPresent] =
|
|
3567
|
-
const [busy, setBusy] =
|
|
3568
|
-
|
|
4189
|
+
const [value, setValue] = useState13("");
|
|
4190
|
+
const [present, setPresent] = useState13(false);
|
|
4191
|
+
const [busy, setBusy] = useState13(false);
|
|
4192
|
+
useEffect10(() => {
|
|
3569
4193
|
let active = true;
|
|
3570
4194
|
credentials.hasKey(credentialRef).then((has) => {
|
|
3571
4195
|
if (active) setPresent(has);
|
|
@@ -3597,16 +4221,16 @@ var ApiKeyForm = ({
|
|
|
3597
4221
|
setBusy(false);
|
|
3598
4222
|
}
|
|
3599
4223
|
};
|
|
3600
|
-
return /* @__PURE__ */
|
|
3601
|
-
/* @__PURE__ */
|
|
4224
|
+
return /* @__PURE__ */ jsxs16("div", { className: ["awr-keyform", className].filter(Boolean).join(" "), children: [
|
|
4225
|
+
/* @__PURE__ */ jsxs16("label", { className: "awr-keyform__label", children: [
|
|
3602
4226
|
label,
|
|
3603
|
-
present && /* @__PURE__ */
|
|
3604
|
-
/* @__PURE__ */
|
|
4227
|
+
present && /* @__PURE__ */ jsxs16("span", { className: "awr-keyform__saved", children: [
|
|
4228
|
+
/* @__PURE__ */ jsx18(CheckIcon, { size: 12 }),
|
|
3605
4229
|
" stored, encrypted"
|
|
3606
4230
|
] })
|
|
3607
4231
|
] }),
|
|
3608
|
-
/* @__PURE__ */
|
|
3609
|
-
/* @__PURE__ */
|
|
4232
|
+
/* @__PURE__ */ jsxs16("div", { className: "awr-keyform__row", children: [
|
|
4233
|
+
/* @__PURE__ */ jsx18(
|
|
3610
4234
|
"input",
|
|
3611
4235
|
{
|
|
3612
4236
|
className: "awr-keyform__input",
|
|
@@ -3624,7 +4248,7 @@ var ApiKeyForm = ({
|
|
|
3624
4248
|
disabled: busy
|
|
3625
4249
|
}
|
|
3626
4250
|
),
|
|
3627
|
-
/* @__PURE__ */
|
|
4251
|
+
/* @__PURE__ */ jsx18(
|
|
3628
4252
|
"button",
|
|
3629
4253
|
{
|
|
3630
4254
|
type: "button",
|
|
@@ -3634,7 +4258,7 @@ var ApiKeyForm = ({
|
|
|
3634
4258
|
children: "Save"
|
|
3635
4259
|
}
|
|
3636
4260
|
),
|
|
3637
|
-
present && /* @__PURE__ */
|
|
4261
|
+
present && /* @__PURE__ */ jsx18(
|
|
3638
4262
|
"button",
|
|
3639
4263
|
{
|
|
3640
4264
|
type: "button",
|
|
@@ -3690,6 +4314,7 @@ export {
|
|
|
3690
4314
|
Composer,
|
|
3691
4315
|
ContextMeter,
|
|
3692
4316
|
FilesPanel,
|
|
4317
|
+
GeneratedMedia,
|
|
3693
4318
|
ImagesNotSupportedError,
|
|
3694
4319
|
IndexedDBStore,
|
|
3695
4320
|
LearnedSkills,
|
|
@@ -3701,8 +4326,10 @@ export {
|
|
|
3701
4326
|
PlanView,
|
|
3702
4327
|
StepList,
|
|
3703
4328
|
SubagentRow,
|
|
4329
|
+
SubagentTree,
|
|
3704
4330
|
ToolApprovalPrompt,
|
|
3705
4331
|
ToolCallRow,
|
|
4332
|
+
TranscriptBlock,
|
|
3706
4333
|
UsageBadge,
|
|
3707
4334
|
UserNoteRow,
|
|
3708
4335
|
VaultCredentialStore2 as VaultCredentialStore,
|
|
@@ -3719,6 +4346,7 @@ export {
|
|
|
3719
4346
|
createSubagentTool,
|
|
3720
4347
|
createWebLLMEngine,
|
|
3721
4348
|
createWebLLMModel2 as createWebLLMModel,
|
|
4349
|
+
decisionNote,
|
|
3722
4350
|
defaultLabels,
|
|
3723
4351
|
defineSkill,
|
|
3724
4352
|
defineTool,
|
|
@@ -3729,6 +4357,7 @@ export {
|
|
|
3729
4357
|
lessonsOf,
|
|
3730
4358
|
loadSkillFromUrl,
|
|
3731
4359
|
markReadOnly,
|
|
4360
|
+
mediaFamilyOf,
|
|
3732
4361
|
mergeLabels,
|
|
3733
4362
|
newChatId,
|
|
3734
4363
|
noticesOf,
|
|
@@ -3737,6 +4366,7 @@ export {
|
|
|
3737
4366
|
preloadWebLLMModel2 as preloadWebLLMModel,
|
|
3738
4367
|
serveSubagentWorker,
|
|
3739
4368
|
steerIntent,
|
|
4369
|
+
subagentTree,
|
|
3740
4370
|
supportsImages,
|
|
3741
4371
|
supportsPdf,
|
|
3742
4372
|
unloadWebLLMModel2 as unloadWebLLMModel,
|
|
@@ -3751,6 +4381,7 @@ export {
|
|
|
3751
4381
|
useSpeechToText,
|
|
3752
4382
|
useVirtualFiles,
|
|
3753
4383
|
useWebLLMModel,
|
|
4384
|
+
webSearchOf,
|
|
3754
4385
|
withAttachments
|
|
3755
4386
|
};
|
|
3756
4387
|
//# sourceMappingURL=index.js.map
|