@dudko.dev/agent-web-react 0.0.27 → 0.0.29
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 +49 -20
- package/dist/{chunk-LCJZEGB5.js → chunk-UUB7CE6N.js} +91 -42
- 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 +1018 -298
- package/dist/index.js.map +1 -1
- package/dist/mcp.cjs +27 -3
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.cts +48 -10
- package/dist/mcp.d.ts +48 -10
- package/dist/mcp.js +26 -3
- package/dist/mcp.js.map +1 -1
- package/dist/pipeline.cjs.map +1 -1
- package/dist/pipeline.js +1 -1
- package/dist/styles.css +281 -0
- package/package.json +3 -3
- package/dist/chunk-LCJZEGB5.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -27,62 +27,68 @@ __export(src_exports, {
|
|
|
27
27
|
ApiKeyForm: () => ApiKeyForm,
|
|
28
28
|
ApprovalModeSwitch: () => ApprovalModeSwitch,
|
|
29
29
|
AttachmentView: () => AttachmentView,
|
|
30
|
-
AttachmentsNotSupportedError: () =>
|
|
30
|
+
AttachmentsNotSupportedError: () => import_agent_web6.AttachmentsNotSupportedError,
|
|
31
31
|
ChatHistoryList: () => ChatHistoryList,
|
|
32
32
|
ChatHistoryStore: () => ChatHistoryStore,
|
|
33
33
|
Composer: () => Composer,
|
|
34
34
|
ContextMeter: () => ContextMeter,
|
|
35
35
|
FilesPanel: () => FilesPanel,
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
GeneratedMedia: () => GeneratedMedia,
|
|
37
|
+
ImagesNotSupportedError: () => import_agent_web6.ImagesNotSupportedError,
|
|
38
|
+
IndexedDBStore: () => import_agent_web6.IndexedDBStore,
|
|
38
39
|
LearnedSkills: () => LearnedSkills,
|
|
39
|
-
MemoryCredentialStore: () =>
|
|
40
|
-
MemorySkillStore: () =>
|
|
41
|
-
MemoryStore: () =>
|
|
40
|
+
MemoryCredentialStore: () => import_agent_web6.MemoryCredentialStore,
|
|
41
|
+
MemorySkillStore: () => import_agent_web6.MemorySkillStore,
|
|
42
|
+
MemoryStore: () => import_agent_web6.MemoryStore,
|
|
42
43
|
MessageList: () => MessageList,
|
|
43
44
|
ModelLoadBar: () => ModelLoadBar,
|
|
44
45
|
PlanView: () => PlanView,
|
|
45
46
|
StepList: () => StepList,
|
|
46
47
|
SubagentRow: () => SubagentRow,
|
|
48
|
+
SubagentTree: () => SubagentTree,
|
|
47
49
|
ToolApprovalPrompt: () => ToolApprovalPrompt,
|
|
48
50
|
ToolCallRow: () => ToolCallRow,
|
|
51
|
+
TranscriptBlock: () => TranscriptBlock,
|
|
49
52
|
UsageBadge: () => UsageBadge,
|
|
50
53
|
UserNoteRow: () => UserNoteRow,
|
|
51
|
-
VaultCredentialStore: () =>
|
|
52
|
-
VfsSkillStore: () =>
|
|
53
|
-
VirtualFileSystem: () =>
|
|
54
|
+
VaultCredentialStore: () => import_agent_web6.VaultCredentialStore,
|
|
55
|
+
VfsSkillStore: () => import_agent_web6.VfsSkillStore,
|
|
56
|
+
VirtualFileSystem: () => import_agent_web6.VirtualFileSystem,
|
|
54
57
|
agentStateReducer: () => agentStateReducer,
|
|
55
58
|
attachmentKindOf: () => attachmentKindOf,
|
|
56
59
|
attachmentRefusal: () => attachmentRefusal,
|
|
57
60
|
chatTitle: () => chatTitle,
|
|
58
|
-
createAgent: () =>
|
|
59
|
-
createFileTools: () =>
|
|
61
|
+
createAgent: () => import_agent_web6.createAgent,
|
|
62
|
+
createFileTools: () => import_agent_web6.createFileTools,
|
|
60
63
|
createInitialAgentState: () => createInitialAgentState,
|
|
61
|
-
createRunControl: () =>
|
|
62
|
-
createSubagentTool: () =>
|
|
64
|
+
createRunControl: () => import_agent_web6.createRunControl,
|
|
65
|
+
createSubagentTool: () => import_agent_web6.createSubagentTool,
|
|
63
66
|
createWebLLMEngine: () => createWebLLMEngine,
|
|
64
|
-
createWebLLMModel: () =>
|
|
67
|
+
createWebLLMModel: () => import_agent_web6.createWebLLMModel,
|
|
68
|
+
decisionNote: () => decisionNote,
|
|
65
69
|
defaultLabels: () => defaultLabels,
|
|
66
|
-
defineSkill: () =>
|
|
67
|
-
defineTool: () =>
|
|
70
|
+
defineSkill: () => import_agent_web6.defineSkill,
|
|
71
|
+
defineTool: () => import_agent_web6.defineTool,
|
|
68
72
|
downscaleImage: () => downscaleImage,
|
|
69
73
|
filterCommands: () => filterCommands,
|
|
70
74
|
formatElapsed: () => formatElapsed,
|
|
71
|
-
isWebGPUAvailable: () =>
|
|
75
|
+
isWebGPUAvailable: () => import_agent_web6.isWebGPUAvailable,
|
|
72
76
|
lessonsOf: () => lessonsOf,
|
|
73
|
-
loadSkillFromUrl: () =>
|
|
74
|
-
markReadOnly: () =>
|
|
77
|
+
loadSkillFromUrl: () => import_agent_web6.loadSkillFromUrl,
|
|
78
|
+
markReadOnly: () => import_agent_web6.markReadOnly,
|
|
79
|
+
mediaFamilyOf: () => mediaFamilyOf,
|
|
75
80
|
mergeLabels: () => mergeLabels,
|
|
76
81
|
newChatId: () => newChatId,
|
|
77
82
|
noticesOf: () => noticesOf,
|
|
78
|
-
parseSkillMarkdown: () =>
|
|
83
|
+
parseSkillMarkdown: () => import_agent_web6.parseSkillMarkdown,
|
|
79
84
|
parseSlash: () => parseSlash,
|
|
80
|
-
preloadWebLLMModel: () =>
|
|
81
|
-
serveSubagentWorker: () =>
|
|
85
|
+
preloadWebLLMModel: () => import_agent_web6.preloadWebLLMModel,
|
|
86
|
+
serveSubagentWorker: () => import_agent_web6.serveSubagentWorker,
|
|
82
87
|
steerIntent: () => steerIntent,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
subagentTree: () => subagentTree,
|
|
89
|
+
supportsImages: () => import_agent_web6.supportsImages,
|
|
90
|
+
supportsPdf: () => import_agent_web6.supportsPdf,
|
|
91
|
+
unloadWebLLMModel: () => import_agent_web6.unloadWebLLMModel,
|
|
86
92
|
usageLine: () => usageLine,
|
|
87
93
|
useAgent: () => useAgent,
|
|
88
94
|
useAgentContext: () => useAgentContext,
|
|
@@ -94,24 +100,26 @@ __export(src_exports, {
|
|
|
94
100
|
useSpeechToText: () => useSpeechToText,
|
|
95
101
|
useVirtualFiles: () => useVirtualFiles,
|
|
96
102
|
useWebLLMModel: () => useWebLLMModel,
|
|
103
|
+
webSearchOf: () => webSearchOf,
|
|
97
104
|
withAttachments: () => withAttachments
|
|
98
105
|
});
|
|
99
106
|
module.exports = __toCommonJS(src_exports);
|
|
100
107
|
|
|
101
108
|
// src/hooks/use-agent.ts
|
|
102
109
|
var import_react = require("react");
|
|
103
|
-
var
|
|
110
|
+
var import_agent_web2 = require("@dudko.dev/agent-web");
|
|
104
111
|
|
|
105
112
|
// src/state.ts
|
|
113
|
+
var import_agent_web = require("@dudko.dev/agent-web");
|
|
106
114
|
var approxTokens = (value) => {
|
|
107
115
|
if (value === void 0) return 0;
|
|
108
|
-
let
|
|
116
|
+
let text2;
|
|
109
117
|
try {
|
|
110
|
-
|
|
118
|
+
text2 = typeof value === "string" ? value : JSON.stringify(value) ?? "";
|
|
111
119
|
} catch {
|
|
112
|
-
|
|
120
|
+
text2 = String(value);
|
|
113
121
|
}
|
|
114
|
-
return Math.ceil(
|
|
122
|
+
return Math.ceil(text2.length / 4);
|
|
115
123
|
};
|
|
116
124
|
var emptyUsage = () => ({
|
|
117
125
|
inputTokens: 0,
|
|
@@ -121,14 +129,28 @@ var emptyUsage = () => ({
|
|
|
121
129
|
cachedInputTokens: 0,
|
|
122
130
|
cacheWriteTokens: 0
|
|
123
131
|
});
|
|
124
|
-
var
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
+
var USAGE_COUNTS = [
|
|
133
|
+
"mediaCalls",
|
|
134
|
+
"imagesGenerated",
|
|
135
|
+
"speechCharacters",
|
|
136
|
+
"transcriptionSeconds",
|
|
137
|
+
"decisionCalls"
|
|
138
|
+
];
|
|
139
|
+
var addUsage = (a, b) => {
|
|
140
|
+
const sum = {
|
|
141
|
+
inputTokens: a.inputTokens + b.inputTokens,
|
|
142
|
+
outputTokens: a.outputTokens + b.outputTokens,
|
|
143
|
+
totalTokens: a.totalTokens + b.totalTokens,
|
|
144
|
+
reasoningTokens: (a.reasoningTokens ?? 0) + (b.reasoningTokens ?? 0),
|
|
145
|
+
cachedInputTokens: (a.cachedInputTokens ?? 0) + (b.cachedInputTokens ?? 0),
|
|
146
|
+
cacheWriteTokens: (a.cacheWriteTokens ?? 0) + (b.cacheWriteTokens ?? 0)
|
|
147
|
+
};
|
|
148
|
+
for (const key of USAGE_COUNTS) {
|
|
149
|
+
const n = (a[key] ?? 0) + (b[key] ?? 0);
|
|
150
|
+
if (n) sum[key] = n;
|
|
151
|
+
}
|
|
152
|
+
return sum;
|
|
153
|
+
};
|
|
132
154
|
var lessonsOf = (skills) => skills.filter((s) => s.origin?.kind === "learned").map((s) => ({
|
|
133
155
|
name: s.name,
|
|
134
156
|
description: s.description,
|
|
@@ -186,8 +208,13 @@ var applySubagentEvent = (view, event) => {
|
|
|
186
208
|
return {
|
|
187
209
|
...view,
|
|
188
210
|
steps: view.steps + 1,
|
|
189
|
-
activity: `step ${event.index}/${event.total}: ${event.step.description}
|
|
211
|
+
activity: `step ${event.index}/${event.total}: ${event.step.description}`,
|
|
212
|
+
// Known only when the child runs with model tiers.
|
|
213
|
+
...event.model !== void 0 ? { model: event.model } : {},
|
|
214
|
+
...event.tier !== void 0 ? { tier: event.tier } : {}
|
|
190
215
|
};
|
|
216
|
+
case "step.escalated":
|
|
217
|
+
return { ...view, tier: event.to, ...event.model ? { model: event.model } : {} };
|
|
191
218
|
case "step.tool-call":
|
|
192
219
|
return { ...view, toolCalls: view.toolCalls + 1, activity: `\u2192 ${event.name}` };
|
|
193
220
|
case "final.text-delta":
|
|
@@ -200,6 +227,208 @@ var applySubagentEvent = (view, event) => {
|
|
|
200
227
|
return view;
|
|
201
228
|
}
|
|
202
229
|
};
|
|
230
|
+
var ensureSubagent = (state, id, name, ancestors, ctx) => {
|
|
231
|
+
if (state.subagents.some((s) => s.id === id)) return state;
|
|
232
|
+
const parentId = ancestors[ancestors.length - 1]?.id;
|
|
233
|
+
const parent = parentId ? state.subagents.find((s) => s.id === parentId) : void 0;
|
|
234
|
+
const stepId = parent ? parent.stepId : runningStepId(state.steps);
|
|
235
|
+
const node = {
|
|
236
|
+
id,
|
|
237
|
+
name,
|
|
238
|
+
task: "",
|
|
239
|
+
...parentId ? { parentId } : {},
|
|
240
|
+
depth: ancestors.length + 1,
|
|
241
|
+
status: "running",
|
|
242
|
+
...stepId ? { stepId } : {},
|
|
243
|
+
...ctx.at !== void 0 ? { startedAt: ctx.at } : {},
|
|
244
|
+
activity: "starting",
|
|
245
|
+
steps: 0,
|
|
246
|
+
toolCalls: 0,
|
|
247
|
+
text: "",
|
|
248
|
+
usage: emptyUsage()
|
|
249
|
+
};
|
|
250
|
+
return { ...state, subagents: [...state.subagents, node] };
|
|
251
|
+
};
|
|
252
|
+
var startSubagent = (state, event, ancestors, ctx) => {
|
|
253
|
+
const depth = Math.max(event.depth ?? 1, ancestors.length + 1);
|
|
254
|
+
const parentId = ancestors[ancestors.length - 1]?.id ?? (depth > 1 ? event.parentId : void 0);
|
|
255
|
+
const told = {
|
|
256
|
+
name: event.name,
|
|
257
|
+
task: event.task,
|
|
258
|
+
depth,
|
|
259
|
+
...parentId ? { parentId } : {},
|
|
260
|
+
...event.profile ? { profile: event.profile } : {},
|
|
261
|
+
...event.dynamic ? { dynamic: true } : {},
|
|
262
|
+
...event.role ? { role: event.role } : {},
|
|
263
|
+
...event.tools ? { tools: event.tools } : {}
|
|
264
|
+
};
|
|
265
|
+
if (state.subagents.some((s) => s.id === event.id)) {
|
|
266
|
+
return {
|
|
267
|
+
...state,
|
|
268
|
+
subagents: patchSubagent(state.subagents, event.id, (s) => ({ ...s, ...told }))
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
const parent = parentId ? state.subagents.find((s) => s.id === parentId) : void 0;
|
|
272
|
+
const stepId = parent ? parent.stepId : runningStepId(state.steps);
|
|
273
|
+
const node = {
|
|
274
|
+
id: event.id,
|
|
275
|
+
...told,
|
|
276
|
+
status: "running",
|
|
277
|
+
stepId,
|
|
278
|
+
...ctx.at !== void 0 ? { startedAt: ctx.at } : {},
|
|
279
|
+
activity: "starting",
|
|
280
|
+
steps: 0,
|
|
281
|
+
toolCalls: 0,
|
|
282
|
+
text: "",
|
|
283
|
+
usage: emptyUsage()
|
|
284
|
+
};
|
|
285
|
+
return { ...state, subagents: [...state.subagents, node] };
|
|
286
|
+
};
|
|
287
|
+
var subagentDuration = (s, at) => at !== void 0 && s.startedAt !== void 0 ? { durationMs: Math.max(0, at - s.startedAt) } : {};
|
|
288
|
+
var addMedia = (state, view) => ({
|
|
289
|
+
...state,
|
|
290
|
+
media: [...state.media ?? [], view],
|
|
291
|
+
...view.stepId ? {
|
|
292
|
+
steps: patchStep(state.steps, view.stepId, (s) => ({
|
|
293
|
+
...s,
|
|
294
|
+
media: [...s.media ?? [], view]
|
|
295
|
+
}))
|
|
296
|
+
} : {}
|
|
297
|
+
});
|
|
298
|
+
var mediaOf = (event, withStep) => ({
|
|
299
|
+
kind: event.kind,
|
|
300
|
+
path: event.path,
|
|
301
|
+
mediaType: event.mediaType,
|
|
302
|
+
bytes: event.bytes,
|
|
303
|
+
model: event.model,
|
|
304
|
+
...withStep && event.step ? { stepId: event.step.id } : {}
|
|
305
|
+
});
|
|
306
|
+
var transcriptOf = (event) => ({
|
|
307
|
+
source: event.source,
|
|
308
|
+
name: event.name,
|
|
309
|
+
text: event.text,
|
|
310
|
+
...event.language ? { language: event.language } : {},
|
|
311
|
+
...event.durationInSeconds !== void 0 ? { durationInSeconds: event.durationInSeconds } : {},
|
|
312
|
+
model: event.model
|
|
313
|
+
});
|
|
314
|
+
var applySubagent = (state, event, ancestors, ctx) => {
|
|
315
|
+
switch (event.type) {
|
|
316
|
+
case "subagent.start":
|
|
317
|
+
return startSubagent(state, event, ancestors, ctx);
|
|
318
|
+
case "subagent.event": {
|
|
319
|
+
const known = ensureSubagent(state, event.id, event.name, ancestors, ctx);
|
|
320
|
+
const inner = event.event;
|
|
321
|
+
switch (inner.type) {
|
|
322
|
+
case "subagent.start":
|
|
323
|
+
case "subagent.event":
|
|
324
|
+
case "subagent.complete":
|
|
325
|
+
case "subagent.error":
|
|
326
|
+
return applySubagent(known, inner, [...ancestors, { id: event.id }], ctx);
|
|
327
|
+
// A helper the model started asks through the run's own consent gate (the event says
|
|
328
|
+
// which helper): its request is the user's to answer, like the run's. A subagent with
|
|
329
|
+
// a gate of its own (no `subagent` on the event) is its host's business.
|
|
330
|
+
case "tool.approval-requested": {
|
|
331
|
+
if (!inner.subagent || known.approvals.some((a) => a.id === inner.id)) return known;
|
|
332
|
+
const node = known.subagents.find((s) => s.id === inner.subagent.id);
|
|
333
|
+
return {
|
|
334
|
+
...known,
|
|
335
|
+
approvals: [
|
|
336
|
+
...known.approvals,
|
|
337
|
+
{
|
|
338
|
+
id: inner.id,
|
|
339
|
+
name: inner.name,
|
|
340
|
+
input: inner.input,
|
|
341
|
+
readOnly: inner.readOnly,
|
|
342
|
+
// The helper's own step ids mean nothing here: the step that delegated it does.
|
|
343
|
+
stepId: node?.stepId,
|
|
344
|
+
subagent: {
|
|
345
|
+
id: inner.subagent.id,
|
|
346
|
+
depth: inner.subagent.depth,
|
|
347
|
+
...node ? { name: node.name } : {},
|
|
348
|
+
...node?.role ? { role: node.role } : {}
|
|
349
|
+
},
|
|
350
|
+
status: "pending"
|
|
351
|
+
}
|
|
352
|
+
]
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
case "tool.approval-resolved":
|
|
356
|
+
return known.approvals.some((a) => a.id === inner.id) ? {
|
|
357
|
+
...known,
|
|
358
|
+
approvals: patchApproval(known.approvals, inner.id, (a) => ({
|
|
359
|
+
...a,
|
|
360
|
+
status: inner.approved ? "approved" : "denied",
|
|
361
|
+
reason: inner.reason,
|
|
362
|
+
automatic: inner.automatic
|
|
363
|
+
}))
|
|
364
|
+
} : known;
|
|
365
|
+
// What a subagent generated is in the same workspace: it shows in the turn (its step
|
|
366
|
+
// ids are its own, so it is tied to no step here).
|
|
367
|
+
case "media.generated":
|
|
368
|
+
return addMedia(known, mediaOf(inner, false));
|
|
369
|
+
case "media.transcribed":
|
|
370
|
+
return { ...known, transcripts: [...known.transcripts ?? [], transcriptOf(inner)] };
|
|
371
|
+
default:
|
|
372
|
+
return {
|
|
373
|
+
...known,
|
|
374
|
+
subagents: patchSubagent(
|
|
375
|
+
known.subagents,
|
|
376
|
+
event.id,
|
|
377
|
+
(s) => applySubagentEvent(s, inner)
|
|
378
|
+
)
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
case "subagent.complete": {
|
|
383
|
+
const known = ensureSubagent(state, event.id, event.name, ancestors, ctx);
|
|
384
|
+
return {
|
|
385
|
+
...known,
|
|
386
|
+
subagents: patchSubagent(known.subagents, event.id, (s) => ({
|
|
387
|
+
...s,
|
|
388
|
+
status: "done",
|
|
389
|
+
activity: "done",
|
|
390
|
+
text: event.text,
|
|
391
|
+
usage: event.usage,
|
|
392
|
+
...subagentDuration(s, ctx.at)
|
|
393
|
+
}))
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
case "subagent.error": {
|
|
397
|
+
const known = ensureSubagent(state, event.id, event.name, ancestors, ctx);
|
|
398
|
+
return {
|
|
399
|
+
...known,
|
|
400
|
+
subagents: patchSubagent(known.subagents, event.id, (s) => ({
|
|
401
|
+
...s,
|
|
402
|
+
status: event.stopped ? "stopped" : "error",
|
|
403
|
+
activity: event.stopped ? "stopped" : "failed",
|
|
404
|
+
error: event.error,
|
|
405
|
+
// A helper says what it had spent when it ended; a static subagent does not.
|
|
406
|
+
...event.usage ? { usage: event.usage } : {},
|
|
407
|
+
...subagentDuration(s, ctx.at)
|
|
408
|
+
}))
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
var subagentTree = (subagents) => {
|
|
414
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
415
|
+
for (const s of subagents) nodes.set(s.id, { ...s, children: [] });
|
|
416
|
+
const loops = (node) => {
|
|
417
|
+
let up = node.parentId;
|
|
418
|
+
for (let i = 0; up !== void 0 && i <= nodes.size; i++) {
|
|
419
|
+
if (up === node.id) return true;
|
|
420
|
+
up = nodes.get(up)?.parentId;
|
|
421
|
+
}
|
|
422
|
+
return false;
|
|
423
|
+
};
|
|
424
|
+
const roots = [];
|
|
425
|
+
for (const node of nodes.values()) {
|
|
426
|
+
const parent = node.parentId !== void 0 && !loops(node) ? nodes.get(node.parentId) : void 0;
|
|
427
|
+
if (parent) parent.children.push(node);
|
|
428
|
+
else roots.push(node);
|
|
429
|
+
}
|
|
430
|
+
return roots;
|
|
431
|
+
};
|
|
203
432
|
var finalizeAssistant = (messages, content, extra = {}) => {
|
|
204
433
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
205
434
|
const m = messages[i];
|
|
@@ -281,10 +510,39 @@ var applyEvent = (state, event, ctx) => {
|
|
|
281
510
|
reasoning: "",
|
|
282
511
|
toolCalls: [],
|
|
283
512
|
status: "running",
|
|
284
|
-
blocked: false
|
|
513
|
+
blocked: false,
|
|
514
|
+
// Only with `config.executorTiers`: without it the view is what it always was.
|
|
515
|
+
...event.tier !== void 0 ? { tier: event.tier } : {},
|
|
516
|
+
...event.model !== void 0 ? { model: event.model } : {},
|
|
517
|
+
...event.tierReason !== void 0 ? { tierReason: event.tierReason } : {}
|
|
285
518
|
};
|
|
286
519
|
return { ...state, steps: [...state.steps, view] };
|
|
287
520
|
}
|
|
521
|
+
case "step.escalated":
|
|
522
|
+
return {
|
|
523
|
+
...state,
|
|
524
|
+
steps: patchStep(state.steps, event.step.id, (s) => {
|
|
525
|
+
const attempt = (s.escalations?.length ?? 0) + 1;
|
|
526
|
+
return {
|
|
527
|
+
...s,
|
|
528
|
+
tier: event.to,
|
|
529
|
+
...event.model ? { model: event.model } : {},
|
|
530
|
+
text: "",
|
|
531
|
+
reasoning: "",
|
|
532
|
+
toolCalls: s.toolCalls.map((c) => c.attempt === void 0 ? { ...c, attempt } : c),
|
|
533
|
+
escalations: [
|
|
534
|
+
...s.escalations ?? [],
|
|
535
|
+
{
|
|
536
|
+
from: event.from,
|
|
537
|
+
to: event.to,
|
|
538
|
+
reason: event.reason,
|
|
539
|
+
...event.model ? { model: event.model } : {},
|
|
540
|
+
...s.text.trim() ? { text: s.text } : {}
|
|
541
|
+
}
|
|
542
|
+
]
|
|
543
|
+
};
|
|
544
|
+
})
|
|
545
|
+
};
|
|
288
546
|
case "step.reasoning-delta":
|
|
289
547
|
return {
|
|
290
548
|
...state,
|
|
@@ -328,6 +586,7 @@ var applyEvent = (state, event, ctx) => {
|
|
|
328
586
|
ok: event.ok,
|
|
329
587
|
status: "done",
|
|
330
588
|
outputTokens: approxTokens(event.output),
|
|
589
|
+
...(0, import_agent_web.isReplayedToolOutput)(event.output) ? { replayed: true } : {},
|
|
331
590
|
...ctx.at !== void 0 && c.startedAt !== void 0 ? { durationMs: Math.max(0, ctx.at - c.startedAt) } : {}
|
|
332
591
|
};
|
|
333
592
|
}
|
|
@@ -343,6 +602,16 @@ var applyEvent = (state, event, ctx) => {
|
|
|
343
602
|
...s,
|
|
344
603
|
status: "done",
|
|
345
604
|
summary: event.result.summary,
|
|
605
|
+
// With tiers: where the step finished and how it got there. The result's list is the
|
|
606
|
+
// authority; an escalation seen live keeps what only the event told (model, text).
|
|
607
|
+
...event.result.tier !== void 0 ? { tier: event.result.tier } : {},
|
|
608
|
+
...event.result.model !== void 0 ? { model: event.result.model } : {},
|
|
609
|
+
...event.result.escalations?.length ? {
|
|
610
|
+
escalations: event.result.escalations.map((e, i) => {
|
|
611
|
+
const live = s.escalations?.[i];
|
|
612
|
+
return live && live.from === e.from && live.to === e.to ? { ...live, reason: e.reason } : { from: e.from, to: e.to, reason: e.reason };
|
|
613
|
+
})
|
|
614
|
+
} : {},
|
|
346
615
|
blocked: event.result.blocked,
|
|
347
616
|
// The result carries the authoritative, ordered tool-call list; keep
|
|
348
617
|
// the timing the streamed calls measured (matched in order per name).
|
|
@@ -361,21 +630,68 @@ var applyEvent = (state, event, ctx) => {
|
|
|
361
630
|
inputTokens: approxTokens(c.input),
|
|
362
631
|
outputTokens: approxTokens(c.output),
|
|
363
632
|
...streamed?.startedAt !== void 0 ? { startedAt: streamed.startedAt } : {},
|
|
364
|
-
...streamed?.durationMs !== void 0 ? { durationMs: streamed.durationMs } : {}
|
|
633
|
+
...streamed?.durationMs !== void 0 ? { durationMs: streamed.durationMs } : {},
|
|
634
|
+
// With tiers the list holds every attempt's calls, in the order they were made.
|
|
635
|
+
...streamed?.attempt !== void 0 ? { attempt: streamed.attempt } : {},
|
|
636
|
+
...(0, import_agent_web.isReplayedToolOutput)(c.output) ? { replayed: true } : {}
|
|
365
637
|
};
|
|
366
638
|
});
|
|
367
639
|
})()
|
|
368
640
|
}))
|
|
369
641
|
};
|
|
370
|
-
case "replan.decision":
|
|
642
|
+
case "replan.decision": {
|
|
643
|
+
if (!event.failed) {
|
|
644
|
+
return {
|
|
645
|
+
...state,
|
|
646
|
+
replan: {
|
|
647
|
+
mode: event.mode,
|
|
648
|
+
reason: event.reason,
|
|
649
|
+
...event.byUser ? { byUser: true } : {},
|
|
650
|
+
...event.confidence !== void 0 ? { confidence: event.confidence } : {}
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
const error = state.replan?.failed ? state.replan.error : void 0;
|
|
655
|
+
const last = state.steps[state.steps.length - 1];
|
|
371
656
|
return {
|
|
372
657
|
...state,
|
|
373
658
|
replan: {
|
|
374
659
|
mode: event.mode,
|
|
375
660
|
reason: event.reason,
|
|
376
|
-
...event.byUser ? { byUser: true } : {}
|
|
377
|
-
|
|
661
|
+
...event.byUser ? { byUser: true } : {},
|
|
662
|
+
failed: true,
|
|
663
|
+
...error ? { error } : {}
|
|
664
|
+
},
|
|
665
|
+
steps: last ? patchStep(state.steps, last.id, (s) => ({
|
|
666
|
+
...s,
|
|
667
|
+
replanFailed: error ?? event.reason
|
|
668
|
+
})) : state.steps
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
case "decision": {
|
|
672
|
+
const view = {
|
|
673
|
+
point: event.point,
|
|
674
|
+
accepted: event.accepted,
|
|
675
|
+
...event.choice !== void 0 ? { choice: event.choice } : {},
|
|
676
|
+
...event.confidence !== void 0 ? { confidence: event.confidence } : {},
|
|
677
|
+
threshold: event.threshold,
|
|
678
|
+
...event.reason ? { reason: event.reason } : {},
|
|
679
|
+
durationMs: event.durationMs,
|
|
680
|
+
...event.model ? { model: event.model } : {}
|
|
378
681
|
};
|
|
682
|
+
const last = state.steps[state.steps.length - 1];
|
|
683
|
+
return last ? {
|
|
684
|
+
...state,
|
|
685
|
+
steps: patchStep(state.steps, last.id, (s) => ({
|
|
686
|
+
...s,
|
|
687
|
+
decisions: [...s.decisions ?? [], view]
|
|
688
|
+
}))
|
|
689
|
+
} : { ...state, decisions: [...state.decisions ?? [], view] };
|
|
690
|
+
}
|
|
691
|
+
case "media.generated":
|
|
692
|
+
return addMedia(state, mediaOf(event, true));
|
|
693
|
+
case "media.transcribed":
|
|
694
|
+
return { ...state, transcripts: [...state.transcripts ?? [], transcriptOf(event)] };
|
|
379
695
|
case "message.queued":
|
|
380
696
|
return state.queued.some((q) => q.id === event.id) ? state : { ...state, queued: [...state.queued, { id: event.id, text: event.text }] };
|
|
381
697
|
case "message.delivered": {
|
|
@@ -418,6 +734,7 @@ var applyEvent = (state, event, ctx) => {
|
|
|
418
734
|
input: event.input,
|
|
419
735
|
readOnly: event.readOnly,
|
|
420
736
|
stepId: event.step?.id,
|
|
737
|
+
...event.subagent ? { subagent: event.subagent } : {},
|
|
421
738
|
status: "pending"
|
|
422
739
|
}
|
|
423
740
|
]
|
|
@@ -449,55 +766,10 @@ var applyEvent = (state, event, ctx) => {
|
|
|
449
766
|
};
|
|
450
767
|
}
|
|
451
768
|
case "subagent.start":
|
|
452
|
-
return {
|
|
453
|
-
...state,
|
|
454
|
-
subagents: [
|
|
455
|
-
...state.subagents,
|
|
456
|
-
{
|
|
457
|
-
id: event.id,
|
|
458
|
-
name: event.name,
|
|
459
|
-
task: event.task,
|
|
460
|
-
status: "running",
|
|
461
|
-
...event.profile ? { profile: event.profile } : {},
|
|
462
|
-
stepId: runningStepId(state.steps),
|
|
463
|
-
activity: "starting",
|
|
464
|
-
steps: 0,
|
|
465
|
-
toolCalls: 0,
|
|
466
|
-
text: "",
|
|
467
|
-
usage: emptyUsage()
|
|
468
|
-
}
|
|
469
|
-
]
|
|
470
|
-
};
|
|
471
769
|
case "subagent.event":
|
|
472
|
-
return {
|
|
473
|
-
...state,
|
|
474
|
-
subagents: patchSubagent(
|
|
475
|
-
state.subagents,
|
|
476
|
-
event.id,
|
|
477
|
-
(s) => applySubagentEvent(s, event.event)
|
|
478
|
-
)
|
|
479
|
-
};
|
|
480
770
|
case "subagent.complete":
|
|
481
|
-
return {
|
|
482
|
-
...state,
|
|
483
|
-
subagents: patchSubagent(state.subagents, event.id, (s) => ({
|
|
484
|
-
...s,
|
|
485
|
-
status: "done",
|
|
486
|
-
activity: "done",
|
|
487
|
-
text: event.text,
|
|
488
|
-
usage: event.usage
|
|
489
|
-
}))
|
|
490
|
-
};
|
|
491
771
|
case "subagent.error":
|
|
492
|
-
return
|
|
493
|
-
...state,
|
|
494
|
-
subagents: patchSubagent(state.subagents, event.id, (s) => ({
|
|
495
|
-
...s,
|
|
496
|
-
status: event.stopped ? "stopped" : "error",
|
|
497
|
-
activity: event.stopped ? "stopped" : "failed",
|
|
498
|
-
error: event.error
|
|
499
|
-
}))
|
|
500
|
-
};
|
|
772
|
+
return applySubagent(state, event, [], ctx);
|
|
501
773
|
case "skill.activated":
|
|
502
774
|
return state.skills.includes(event.name) ? state : { ...state, skills: [...state.skills, event.name] };
|
|
503
775
|
case "skill.learned": {
|
|
@@ -562,6 +834,12 @@ var applyEvent = (state, event, ctx) => {
|
|
|
562
834
|
)
|
|
563
835
|
};
|
|
564
836
|
case "error":
|
|
837
|
+
if (event.phase === "replan") {
|
|
838
|
+
return {
|
|
839
|
+
...state,
|
|
840
|
+
replan: { mode: "continue", reason: "", failed: true, error: event.error }
|
|
841
|
+
};
|
|
842
|
+
}
|
|
565
843
|
return event.phase === "run" ? {
|
|
566
844
|
...state,
|
|
567
845
|
error: event.error,
|
|
@@ -594,6 +872,9 @@ var syncRunMessage = (state) => {
|
|
|
594
872
|
if (state.learnedNow.length > 0 && m.learned !== state.learnedNow)
|
|
595
873
|
patch.learned = state.learnedNow;
|
|
596
874
|
if (state.fetches.length > 0 && m.fetches !== state.fetches) patch.fetches = state.fetches;
|
|
875
|
+
if (state.media && m.media !== state.media) patch.media = state.media;
|
|
876
|
+
if (state.transcripts && m.transcripts !== state.transcripts)
|
|
877
|
+
patch.transcripts = state.transcripts;
|
|
597
878
|
if ((m.approvals?.length ?? 0) !== decided.length || decided.some((a, k) => m.approvals?.[k] !== a)) {
|
|
598
879
|
patch.approvals = decided;
|
|
599
880
|
}
|
|
@@ -711,7 +992,7 @@ var useAgent = (config, options = {}) => {
|
|
|
711
992
|
} : cfg;
|
|
712
993
|
let cancelled = false;
|
|
713
994
|
setBuildStatus({ status: "initializing" });
|
|
714
|
-
(0,
|
|
995
|
+
(0, import_agent_web2.createAgent)(built).then((agent) => {
|
|
715
996
|
if (cancelled) return;
|
|
716
997
|
agent.setToolApprovalMode(modeRef.current);
|
|
717
998
|
agentRef.current = agent;
|
|
@@ -739,7 +1020,7 @@ var useAgent = (config, options = {}) => {
|
|
|
739
1020
|
if (!agent || abortRef.current) return void 0;
|
|
740
1021
|
const controller = new AbortController();
|
|
741
1022
|
abortRef.current = controller;
|
|
742
|
-
const control = (0,
|
|
1023
|
+
const control = (0, import_agent_web2.createRunControl)();
|
|
743
1024
|
controlRef.current = control;
|
|
744
1025
|
let left = [];
|
|
745
1026
|
dispatch({ type: "status", status: "running" });
|
|
@@ -796,7 +1077,7 @@ var useAgent = (config, options = {}) => {
|
|
|
796
1077
|
[settleAll]
|
|
797
1078
|
);
|
|
798
1079
|
runRef.current = run;
|
|
799
|
-
const send = (0, import_react.useCallback)((
|
|
1080
|
+
const send = (0, import_react.useCallback)((text2) => controlRef.current?.send(text2) ?? false, []);
|
|
800
1081
|
const stopSubagent = (0, import_react.useCallback)(
|
|
801
1082
|
(id) => controlRef.current?.stopSubagent(id) ?? false,
|
|
802
1083
|
[]
|
|
@@ -1089,14 +1370,14 @@ var useVirtualFiles = (vfs, prefix = "/") => {
|
|
|
1089
1370
|
[vfs]
|
|
1090
1371
|
);
|
|
1091
1372
|
const dataUrl = (0, import_react3.useCallback)(async (path) => vfs?.readDataUrl(path), [vfs]);
|
|
1092
|
-
const
|
|
1373
|
+
const text2 = (0, import_react3.useCallback)(
|
|
1093
1374
|
async (path) => {
|
|
1094
1375
|
const f = await vfs?.read(path);
|
|
1095
1376
|
return f && f.encoding === "utf8" ? f.content : void 0;
|
|
1096
1377
|
},
|
|
1097
1378
|
[vfs]
|
|
1098
1379
|
);
|
|
1099
|
-
return { files, loading, error, refresh, upload, remove, dataUrl, text };
|
|
1380
|
+
return { files, loading, error, refresh, upload, remove, dataUrl, text: text2 };
|
|
1100
1381
|
};
|
|
1101
1382
|
|
|
1102
1383
|
// src/hooks/use-speech-to-text.ts
|
|
@@ -1164,9 +1445,9 @@ var useSpeechToText = (options = {}) => {
|
|
|
1164
1445
|
|
|
1165
1446
|
// src/hooks/use-credentials.ts
|
|
1166
1447
|
var import_react5 = require("react");
|
|
1167
|
-
var
|
|
1448
|
+
var import_agent_web3 = require("@dudko.dev/agent-web");
|
|
1168
1449
|
var useCredentials = (store) => {
|
|
1169
|
-
const resolved = (0, import_react5.useMemo)(() => store ?? new
|
|
1450
|
+
const resolved = (0, import_react5.useMemo)(() => store ?? new import_agent_web3.VaultCredentialStore(), [store]);
|
|
1170
1451
|
const [version, setVersion] = (0, import_react5.useState)(0);
|
|
1171
1452
|
const setKey = (0, import_react5.useCallback)(
|
|
1172
1453
|
async (ref, key) => {
|
|
@@ -1190,7 +1471,7 @@ var useCredentials = (store) => {
|
|
|
1190
1471
|
};
|
|
1191
1472
|
|
|
1192
1473
|
// src/hooks/use-webllm-model.ts
|
|
1193
|
-
var
|
|
1474
|
+
var import_agent_web4 = require("@dudko.dev/agent-web");
|
|
1194
1475
|
|
|
1195
1476
|
// src/hooks/use-local-model.ts
|
|
1196
1477
|
var import_react6 = require("react");
|
|
@@ -1301,7 +1582,7 @@ var useWebLLMModel = (modelId, options) => useLocalModel(modelId, createWebLLMEn
|
|
|
1301
1582
|
});
|
|
1302
1583
|
var createWebLLMEngine = (options) => {
|
|
1303
1584
|
const {
|
|
1304
|
-
create =
|
|
1585
|
+
create = import_agent_web4.createWebLLMModel,
|
|
1305
1586
|
contextWindowTokens: _perLoad,
|
|
1306
1587
|
...modelOptions
|
|
1307
1588
|
} = options ?? {};
|
|
@@ -1323,11 +1604,11 @@ var createWebLLMEngine = (options) => {
|
|
|
1323
1604
|
// 1-token warm-up). WebLLM builds are otherwise lazy — the ~GB download
|
|
1324
1605
|
// would only start on the first `run()`, long after we told the UI the
|
|
1325
1606
|
// model is "ready". Fast + idempotent once the weights are cached.
|
|
1326
|
-
warmUp: (model) => (0,
|
|
1327
|
-
unload:
|
|
1328
|
-
supported:
|
|
1607
|
+
warmUp: (model) => (0, import_agent_web4.preloadWebLLMModel)(model),
|
|
1608
|
+
unload: import_agent_web4.unloadWebLLMModel,
|
|
1609
|
+
supported: import_agent_web4.isWebGPUAvailable,
|
|
1329
1610
|
unsupportedMessage: "WebGPU is not available in this browser.",
|
|
1330
|
-
contextWindowOf:
|
|
1611
|
+
contextWindowOf: import_agent_web4.webLLMContextWindow
|
|
1331
1612
|
};
|
|
1332
1613
|
};
|
|
1333
1614
|
|
|
@@ -1335,8 +1616,8 @@ var createWebLLMEngine = (options) => {
|
|
|
1335
1616
|
var import_react7 = require("react");
|
|
1336
1617
|
|
|
1337
1618
|
// src/composer.ts
|
|
1338
|
-
var parseSlash = (
|
|
1339
|
-
const m = /^\/([\w-]*)(?:\s+([\s\S]*))?$/.exec(
|
|
1619
|
+
var parseSlash = (text2) => {
|
|
1620
|
+
const m = /^\/([\w-]*)(?:\s+([\s\S]*))?$/.exec(text2.trimStart());
|
|
1340
1621
|
return m ? { name: m[1].toLowerCase(), args: (m[2] ?? "").trim() } : void 0;
|
|
1341
1622
|
};
|
|
1342
1623
|
var steerIntent = (input) => {
|
|
@@ -1365,9 +1646,9 @@ var attachmentKindOf = (mediaType, name) => {
|
|
|
1365
1646
|
}
|
|
1366
1647
|
return "file";
|
|
1367
1648
|
};
|
|
1368
|
-
var withAttachments = (
|
|
1649
|
+
var withAttachments = (text2, files) => {
|
|
1369
1650
|
const texts = files.filter((f) => f.kind === "text" && f.text !== void 0);
|
|
1370
|
-
if (texts.length === 0) return
|
|
1651
|
+
if (texts.length === 0) return text2;
|
|
1371
1652
|
const blocks = texts.map((f) => {
|
|
1372
1653
|
const body = f.text;
|
|
1373
1654
|
const fence = body.includes("```") ? "~~~" : "```";
|
|
@@ -1377,7 +1658,7 @@ ${fence}
|
|
|
1377
1658
|
${body}
|
|
1378
1659
|
${fence}`;
|
|
1379
1660
|
});
|
|
1380
|
-
return `${
|
|
1661
|
+
return `${text2}
|
|
1381
1662
|
|
|
1382
1663
|
Attached file(s):
|
|
1383
1664
|
${blocks.join("\n\n")}`;
|
|
@@ -1566,7 +1847,54 @@ var defaultLabels = {
|
|
|
1566
1847
|
stopSubagent: "Stop this subagent",
|
|
1567
1848
|
subagentStopped: "stopped",
|
|
1568
1849
|
failed: "failed",
|
|
1569
|
-
toolCostTitle: "Estimated tokens of the arguments and of the result fed back to the model (chars / 4), and the call's duration"
|
|
1850
|
+
toolCostTitle: "Estimated tokens of the arguments and of the result fed back to the model (chars / 4), and the call's duration",
|
|
1851
|
+
tierNames: { light: "light", standard: "standard", strong: "strong" },
|
|
1852
|
+
tierReasons: {
|
|
1853
|
+
planned: "The planner rated this step for this model tier",
|
|
1854
|
+
default: "The planner did not rate this step: it runs on the standard model",
|
|
1855
|
+
fallback: "The tier the planner asked for is not configured: the nearest one runs the step"
|
|
1856
|
+
},
|
|
1857
|
+
escalationReasons: {
|
|
1858
|
+
blocked: "reported a blocker",
|
|
1859
|
+
"empty-result": "produced no result",
|
|
1860
|
+
"tool-arguments": "kept sending tool arguments that did not parse",
|
|
1861
|
+
"output-cut": "output was cut off",
|
|
1862
|
+
error: "the model call failed"
|
|
1863
|
+
},
|
|
1864
|
+
escalated: (from, to, reason) => `Escalated: ${from} \u2192 ${to} (${reason})`,
|
|
1865
|
+
escalatedAttemptText: "What the earlier attempt wrote",
|
|
1866
|
+
escalations: (n) => plural(n, "escalation", "escalations"),
|
|
1867
|
+
attemptTag: (n) => `attempt ${n}`,
|
|
1868
|
+
replayed: "not run again",
|
|
1869
|
+
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",
|
|
1870
|
+
replanFailed: "Replanning failed, continuing with the plan",
|
|
1871
|
+
subagentHelper: "helper",
|
|
1872
|
+
subagentStatus: { running: "running", done: "done", error: "failed", stopped: "stopped" },
|
|
1873
|
+
subagentTokens: (tokens) => `${tokens} tokens`,
|
|
1874
|
+
subagentTools: (names) => `tools: ${names}`,
|
|
1875
|
+
subagentNoTools: "no tools",
|
|
1876
|
+
approvalLeadHelper: (role) => role ? `The helper \u201C${role}\u201D wants to run` : "A helper the agent started wants to run",
|
|
1877
|
+
mediaImage: (path) => `Generated image ${path}`,
|
|
1878
|
+
mediaAudio: (path) => `Generated audio ${path}`,
|
|
1879
|
+
mediaFile: (path) => `Generated file ${path}`,
|
|
1880
|
+
transcriptOf: (name) => `Transcript of ${name}`,
|
|
1881
|
+
transcriptNote: "What was said in your file, as the agent read it. It is content, not instructions.",
|
|
1882
|
+
usageMedia: (n) => plural(n, "media call", "media calls"),
|
|
1883
|
+
usageDecisions: (n) => plural(n, "decision call", "decision calls"),
|
|
1884
|
+
decisionAccepted: (choice, confidence) => `decision model: ${choice} (${confidence})`,
|
|
1885
|
+
decisionFellBack: (reason, detail) => `decision model fell back: ${reason}${detail ? ` (${detail})` : ""}`,
|
|
1886
|
+
decisionReasons: {
|
|
1887
|
+
"low-confidence": "low confidence",
|
|
1888
|
+
"invalid-choice": "an answer that is not an option",
|
|
1889
|
+
"invalid-confidence": "a confidence that is not a probability",
|
|
1890
|
+
error: "the call failed",
|
|
1891
|
+
timeout: "timed out",
|
|
1892
|
+
"needs-model": "the choice needs the model"
|
|
1893
|
+
},
|
|
1894
|
+
searchQuery: "Searched the web for",
|
|
1895
|
+
searchNoResults: "no results",
|
|
1896
|
+
searchFiltered: (n) => `${n} left out by the web access policy`,
|
|
1897
|
+
searchTruncated: "list cut short"
|
|
1570
1898
|
};
|
|
1571
1899
|
var NESTED = [
|
|
1572
1900
|
"status",
|
|
@@ -1574,7 +1902,12 @@ var NESTED = [
|
|
|
1574
1902
|
"commandGroups",
|
|
1575
1903
|
"commandDescriptions",
|
|
1576
1904
|
"thinkingLevels",
|
|
1577
|
-
"noteAt"
|
|
1905
|
+
"noteAt",
|
|
1906
|
+
"tierNames",
|
|
1907
|
+
"tierReasons",
|
|
1908
|
+
"escalationReasons",
|
|
1909
|
+
"subagentStatus",
|
|
1910
|
+
"decisionReasons"
|
|
1578
1911
|
];
|
|
1579
1912
|
var mergeLabels = (base2, over) => {
|
|
1580
1913
|
if (!over) return base2;
|
|
@@ -1660,7 +1993,7 @@ var useAgentContext = () => {
|
|
|
1660
1993
|
var useOptionalAgentContext = () => (0, import_react8.useContext)(AgentContext);
|
|
1661
1994
|
|
|
1662
1995
|
// src/components/AgentChat.tsx
|
|
1663
|
-
var
|
|
1996
|
+
var import_react15 = require("react");
|
|
1664
1997
|
|
|
1665
1998
|
// src/components/AgentComposer.tsx
|
|
1666
1999
|
var import_react9 = require("react");
|
|
@@ -1690,6 +2023,10 @@ var AlertIcon = ({ size, className }) => /* @__PURE__ */ (0, import_jsx_runtime3
|
|
|
1690
2023
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 9v4" }),
|
|
1691
2024
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 17h.01" })
|
|
1692
2025
|
] });
|
|
2026
|
+
var ArrowUpIcon = ({ size, className }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(size), className, children: [
|
|
2027
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 19V5" }),
|
|
2028
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m5 12 7-7 7 7" })
|
|
2029
|
+
] });
|
|
1693
2030
|
var ToolIcon = ({ size, className }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...base(size), className, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("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" }) });
|
|
1694
2031
|
var ShieldIcon = ({ size, className }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...base(size), className, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z" }) });
|
|
1695
2032
|
var BrainIcon = ({ size, className }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...base(size), className, children: [
|
|
@@ -1829,7 +2166,7 @@ var AgentComposer = ({
|
|
|
1829
2166
|
const L = useLabels(labelsOverride);
|
|
1830
2167
|
const MODE_CHIP = L.modes;
|
|
1831
2168
|
const DEFAULT_THINKING = thinkingDefaults(L);
|
|
1832
|
-
const [
|
|
2169
|
+
const [text2, setText] = (0, import_react9.useState)("");
|
|
1833
2170
|
const [pending, setPending] = (0, import_react9.useState)([]);
|
|
1834
2171
|
const [menu, setMenu] = (0, import_react9.useState)(void 0);
|
|
1835
2172
|
const [active, setActive] = (0, import_react9.useState)(0);
|
|
@@ -1949,14 +2286,14 @@ var AgentComposer = ({
|
|
|
1949
2286
|
}
|
|
1950
2287
|
return [...out, ...commands];
|
|
1951
2288
|
}, [agent, builtinCommands, skillCommands, commands, thinking, L]);
|
|
1952
|
-
const slash = parseSlash(
|
|
1953
|
-
const matches = slash && !/\s/.test(
|
|
2289
|
+
const slash = parseSlash(text2);
|
|
2290
|
+
const matches = slash && !/\s/.test(text2.trimStart()) ? filterCommands(allCommands, slash.name) : [];
|
|
1954
2291
|
const palette = menu === "commands" && !slash ? allCommands : matches;
|
|
1955
2292
|
const paletteOpen = palette.length > 0 && (menu === "commands" || matches.length > 0);
|
|
1956
2293
|
const commandsStyle = useMenuPlacement(paletteOpen, rootRef, "stretch");
|
|
1957
2294
|
const modelStyle = useMenuPlacement(menu === "model", modelRef, "left");
|
|
1958
2295
|
const modeStyle = useMenuPlacement(menu === "mode", modeRef, "right");
|
|
1959
|
-
(0, import_react9.useEffect)(() => setActive(0), [
|
|
2296
|
+
(0, import_react9.useEffect)(() => setActive(0), [text2, menu]);
|
|
1960
2297
|
(0, import_react9.useEffect)(() => {
|
|
1961
2298
|
if (!menu) return;
|
|
1962
2299
|
const onDown = (e) => {
|
|
@@ -1972,7 +2309,7 @@ var AgentComposer = ({
|
|
|
1972
2309
|
inputRef.current?.focus();
|
|
1973
2310
|
return;
|
|
1974
2311
|
}
|
|
1975
|
-
const args = parseSlash(
|
|
2312
|
+
const args = parseSlash(text2)?.args ?? "";
|
|
1976
2313
|
setText("");
|
|
1977
2314
|
void cmd.run?.(args);
|
|
1978
2315
|
};
|
|
@@ -2095,7 +2432,7 @@ var AgentComposer = ({
|
|
|
2095
2432
|
};
|
|
2096
2433
|
}, [attachments, dropZone]);
|
|
2097
2434
|
const submit = () => {
|
|
2098
|
-
const raw =
|
|
2435
|
+
const raw = text2.trim();
|
|
2099
2436
|
const intent = steerIntent({ raw, busy, steering, hasAttachments: pending.length > 0 });
|
|
2100
2437
|
if (intent === "steer") {
|
|
2101
2438
|
if (agent.send(raw)) setText("");
|
|
@@ -2203,8 +2540,8 @@ var AgentComposer = ({
|
|
|
2203
2540
|
const runningAgents = agent.subagents.filter((s) => s.status === "running");
|
|
2204
2541
|
const thinkingOptions = thinking?.options ?? DEFAULT_THINKING;
|
|
2205
2542
|
const thinkingLabel = thinking ? thinkingOptions.find((o) => o.id === thinking.value)?.label ?? thinking.value : void 0;
|
|
2206
|
-
const canSend = ready && (
|
|
2207
|
-
const canSteer = busy && steering &&
|
|
2543
|
+
const canSend = ready && (text2.trim().length > 0 || pending.length > 0);
|
|
2544
|
+
const canSteer = busy && steering && text2.trim().length > 0;
|
|
2208
2545
|
const queuedStrip = showQueued && (agent.queued.length > 0 || agent.undelivered.length > 0) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "awr-queued", children: [
|
|
2209
2546
|
agent.queued.map((q) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "awr-queued__item", role: "status", children: [
|
|
2210
2547
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ClockIcon, { size: 13, className: "awr-queued__icon" }),
|
|
@@ -2303,7 +2640,7 @@ var AgentComposer = ({
|
|
|
2303
2640
|
{
|
|
2304
2641
|
ref: inputRef,
|
|
2305
2642
|
className: "awr-composer2__input",
|
|
2306
|
-
value:
|
|
2643
|
+
value: text2,
|
|
2307
2644
|
onChange: (e) => setText(e.target.value),
|
|
2308
2645
|
onKeyDown,
|
|
2309
2646
|
onPaste,
|
|
@@ -2590,17 +2927,17 @@ var ChatHistoryList = ({
|
|
|
2590
2927
|
// src/components/format.ts
|
|
2591
2928
|
var previewValue = (value, max = 140) => {
|
|
2592
2929
|
if (value === void 0) return "";
|
|
2593
|
-
let
|
|
2594
|
-
if (typeof value === "string")
|
|
2930
|
+
let text2;
|
|
2931
|
+
if (typeof value === "string") text2 = value;
|
|
2595
2932
|
else {
|
|
2596
2933
|
try {
|
|
2597
|
-
|
|
2934
|
+
text2 = JSON.stringify(value);
|
|
2598
2935
|
} catch {
|
|
2599
|
-
|
|
2936
|
+
text2 = String(value);
|
|
2600
2937
|
}
|
|
2601
2938
|
}
|
|
2602
|
-
|
|
2603
|
-
return
|
|
2939
|
+
text2 = text2.replace(/\s+/g, " ").trim();
|
|
2940
|
+
return text2.length > max ? `${text2.slice(0, max - 1)}\u2026` : text2;
|
|
2604
2941
|
};
|
|
2605
2942
|
var formatTokens = (n) => n >= 1e3 ? `${(n / 1e3).toFixed(n >= 1e4 ? 0 : 1)}k` : String(n);
|
|
2606
2943
|
var formatDuration = (ms) => {
|
|
@@ -2626,6 +2963,48 @@ var imagesInOutput = (output, depth = 0) => {
|
|
|
2626
2963
|
}
|
|
2627
2964
|
return [];
|
|
2628
2965
|
};
|
|
2966
|
+
var text = (v, max) => typeof v === "string" ? v.replace(/\s+/g, " ").trim().slice(0, max) : "";
|
|
2967
|
+
var webSearchOf = (output) => {
|
|
2968
|
+
let value = output;
|
|
2969
|
+
if (typeof value === "string") {
|
|
2970
|
+
try {
|
|
2971
|
+
value = JSON.parse(value);
|
|
2972
|
+
} catch {
|
|
2973
|
+
return void 0;
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
2977
|
+
const o = value;
|
|
2978
|
+
if (typeof o.query !== "string" || !Array.isArray(o.results)) return void 0;
|
|
2979
|
+
const results = [];
|
|
2980
|
+
for (const r of o.results.slice(0, 10)) {
|
|
2981
|
+
if (!r || typeof r !== "object") continue;
|
|
2982
|
+
const item = r;
|
|
2983
|
+
if (typeof item.url !== "string") continue;
|
|
2984
|
+
let url;
|
|
2985
|
+
try {
|
|
2986
|
+
url = new URL(item.url);
|
|
2987
|
+
} catch {
|
|
2988
|
+
continue;
|
|
2989
|
+
}
|
|
2990
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") continue;
|
|
2991
|
+
const date = text(item.date, 40);
|
|
2992
|
+
results.push({
|
|
2993
|
+
title: text(item.title, 200) || url.host,
|
|
2994
|
+
url: url.href,
|
|
2995
|
+
host: url.host,
|
|
2996
|
+
snippet: text(item.snippet, 400),
|
|
2997
|
+
...date ? { date } : {}
|
|
2998
|
+
});
|
|
2999
|
+
}
|
|
3000
|
+
return {
|
|
3001
|
+
query: text(o.query, 300),
|
|
3002
|
+
results,
|
|
3003
|
+
filtered: typeof o.filtered === "number" && o.filtered > 0 ? o.filtered : 0,
|
|
3004
|
+
truncated: o.truncated === true
|
|
3005
|
+
};
|
|
3006
|
+
};
|
|
3007
|
+
var formatProbability = (p) => String(Math.round(p * 100) / 100);
|
|
2629
3008
|
|
|
2630
3009
|
// src/components/ContextMeter.tsx
|
|
2631
3010
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
@@ -2736,8 +3115,8 @@ var FilesPanel = ({
|
|
|
2736
3115
|
if (src) setPreview({ path: f.path, kind: "image", src });
|
|
2737
3116
|
return;
|
|
2738
3117
|
}
|
|
2739
|
-
const
|
|
2740
|
-
if (
|
|
3118
|
+
const text2 = await fs.text(f.path);
|
|
3119
|
+
if (text2 !== void 0) setPreview({ path: f.path, kind: "text", text: text2 });
|
|
2741
3120
|
else setPreview(void 0);
|
|
2742
3121
|
};
|
|
2743
3122
|
const download = async (f) => {
|
|
@@ -2833,69 +3212,290 @@ var FilesPanel = ({
|
|
|
2833
3212
|
] });
|
|
2834
3213
|
};
|
|
2835
3214
|
|
|
2836
|
-
// src/components/
|
|
3215
|
+
// src/components/Media.tsx
|
|
2837
3216
|
var import_react12 = require("react");
|
|
3217
|
+
var import_agent_web5 = require("@dudko.dev/agent-web");
|
|
2838
3218
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2839
|
-
var
|
|
3219
|
+
var mediaFamilyOf = (mediaType) => {
|
|
3220
|
+
const type = mediaType.toLowerCase().split(";")[0].trim();
|
|
3221
|
+
if (Object.hasOwn(import_agent_web5.MEDIA_IMAGE_TYPES, type)) return "image";
|
|
3222
|
+
if (Object.hasOwn(import_agent_web5.MEDIA_AUDIO_TYPES, type)) return "audio";
|
|
3223
|
+
return void 0;
|
|
3224
|
+
};
|
|
3225
|
+
var bytesOf = (content, encoding) => {
|
|
3226
|
+
if (encoding !== "base64") return new TextEncoder().encode(content);
|
|
3227
|
+
const binary = atob(content);
|
|
3228
|
+
const bytes = new Uint8Array(binary.length);
|
|
3229
|
+
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
3230
|
+
return bytes;
|
|
3231
|
+
};
|
|
3232
|
+
var useFileUrl = (files, path, mediaType) => {
|
|
3233
|
+
const [url, setUrl] = (0, import_react12.useState)(void 0);
|
|
3234
|
+
(0, import_react12.useEffect)(() => {
|
|
3235
|
+
if (!files || !mediaType) return;
|
|
3236
|
+
let made;
|
|
3237
|
+
let gone = false;
|
|
3238
|
+
files.read(path).then((file) => {
|
|
3239
|
+
if (gone || !file) return;
|
|
3240
|
+
made = URL.createObjectURL(
|
|
3241
|
+
new Blob([bytesOf(file.content, file.encoding)], { type: mediaType })
|
|
3242
|
+
);
|
|
3243
|
+
setUrl(made);
|
|
3244
|
+
}).catch(() => {
|
|
3245
|
+
});
|
|
3246
|
+
return () => {
|
|
3247
|
+
gone = true;
|
|
3248
|
+
if (made) URL.revokeObjectURL(made);
|
|
3249
|
+
setUrl(void 0);
|
|
3250
|
+
};
|
|
3251
|
+
}, [files, path, mediaType]);
|
|
3252
|
+
return url;
|
|
3253
|
+
};
|
|
3254
|
+
var GeneratedMedia = ({ media, files, labels }) => {
|
|
2840
3255
|
const L = useLabels(labels);
|
|
2841
|
-
const
|
|
2842
|
-
const
|
|
2843
|
-
const
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
3256
|
+
const family = mediaFamilyOf(media.mediaType);
|
|
3257
|
+
const type = family ? media.mediaType.toLowerCase().split(";")[0].trim() : void 0;
|
|
3258
|
+
const url = useFileUrl(files, media.path, type);
|
|
3259
|
+
if (url && family === "image") {
|
|
3260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3261
|
+
"a",
|
|
3262
|
+
{
|
|
3263
|
+
className: "awr-media awr-media--image",
|
|
3264
|
+
href: url,
|
|
3265
|
+
target: "_blank",
|
|
3266
|
+
rel: "noopener noreferrer",
|
|
3267
|
+
title: media.path,
|
|
3268
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("img", { className: "awr-media__img", src: url, alt: L.mediaImage(media.path) })
|
|
3269
|
+
}
|
|
3270
|
+
);
|
|
3271
|
+
}
|
|
3272
|
+
if (url && family === "audio") {
|
|
3273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "awr-media awr-media--audio", title: media.path, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3274
|
+
"audio",
|
|
3275
|
+
{
|
|
3276
|
+
className: "awr-media__audio",
|
|
3277
|
+
controls: true,
|
|
3278
|
+
preload: "metadata",
|
|
3279
|
+
src: url,
|
|
3280
|
+
"aria-label": L.mediaAudio(media.path)
|
|
3281
|
+
}
|
|
3282
|
+
) });
|
|
3283
|
+
}
|
|
3284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "awr-chip awr-file awr-media awr-media--file", title: L.mediaFile(media.path), children: [
|
|
3285
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FileIcon, { size: 13 }),
|
|
3286
|
+
" ",
|
|
3287
|
+
media.path
|
|
3288
|
+
] });
|
|
3289
|
+
};
|
|
3290
|
+
var TranscriptBlock = ({ transcript, labels }) => {
|
|
3291
|
+
const L = useLabels(labels);
|
|
3292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("details", { className: "awr-transcript", children: [
|
|
3293
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("summary", { className: "awr-transcript__summary", children: [
|
|
3294
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FileIcon, { size: 13 }),
|
|
3295
|
+
" ",
|
|
3296
|
+
L.transcriptOf(transcript.name)
|
|
2856
3297
|
] }),
|
|
2857
|
-
|
|
3298
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "awr-transcript__note", children: L.transcriptNote }),
|
|
3299
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("blockquote", { className: "awr-transcript__text", children: transcript.text })
|
|
2858
3300
|
] });
|
|
2859
3301
|
};
|
|
3302
|
+
|
|
3303
|
+
// src/components/StepList.tsx
|
|
3304
|
+
var import_react14 = require("react");
|
|
3305
|
+
|
|
3306
|
+
// src/components/SubagentTree.tsx
|
|
3307
|
+
var import_react13 = require("react");
|
|
3308
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
3309
|
+
var useElapsed = (startedAt, running) => {
|
|
3310
|
+
const [now, setNow] = (0, import_react13.useState)(void 0);
|
|
3311
|
+
(0, import_react13.useEffect)(() => {
|
|
3312
|
+
if (!running || startedAt === void 0) return;
|
|
3313
|
+
setNow(Date.now());
|
|
3314
|
+
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
3315
|
+
return () => clearInterval(timer);
|
|
3316
|
+
}, [running, startedAt]);
|
|
3317
|
+
return running && startedAt !== void 0 && now !== void 0 ? Math.max(0, now - startedAt) : void 0;
|
|
3318
|
+
};
|
|
2860
3319
|
var SubagentRow = ({
|
|
2861
3320
|
sub,
|
|
2862
3321
|
onStop,
|
|
3322
|
+
showUsage = true,
|
|
3323
|
+
showTools = true,
|
|
3324
|
+
labels,
|
|
3325
|
+
children
|
|
3326
|
+
}) => {
|
|
3327
|
+
const L = useLabels(labels);
|
|
3328
|
+
const running = sub.status === "running";
|
|
3329
|
+
const elapsed = useElapsed(sub.startedAt, running);
|
|
3330
|
+
const time = sub.durationMs ?? elapsed;
|
|
3331
|
+
const role = sub.dynamic ? previewValue(sub.role ?? "", 48) : "";
|
|
3332
|
+
const meta = [
|
|
3333
|
+
sub.model ?? "",
|
|
3334
|
+
sub.tier ? L.tierNames[sub.tier] : "",
|
|
3335
|
+
sub.usage.totalTokens > 0 ? L.subagentTokens(formatTokens(sub.usage.totalTokens)) : "",
|
|
3336
|
+
sub.toolCalls > 0 ? L.toolCalls(sub.toolCalls) : "",
|
|
3337
|
+
time !== void 0 ? formatDuration(time) : ""
|
|
3338
|
+
].filter(Boolean);
|
|
3339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3340
|
+
"li",
|
|
3341
|
+
{
|
|
3342
|
+
className: `awr-subagent awr-subagent--${sub.status}${sub.dynamic ? " awr-subagent--dynamic" : ""}`,
|
|
3343
|
+
"data-depth": sub.depth,
|
|
3344
|
+
children: [
|
|
3345
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "awr-subagent__head", children: [
|
|
3346
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "awr-subagent__icon", children: running ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SpinnerIcon, { size: 13 }) : sub.status === "done" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(BotIcon, { size: 13 }) : sub.status === "stopped" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(StopIcon, { size: 13 }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AlertIcon, { size: 13 }) }),
|
|
3347
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "awr-subagent__name", title: sub.role, children: role || (sub.dynamic ? L.subagentHelper : sub.name) }),
|
|
3348
|
+
sub.dynamic && role && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "awr-subagent__profile", children: L.subagentHelper }),
|
|
3349
|
+
sub.profile && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "awr-subagent__profile", children: sub.profile }),
|
|
3350
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "awr-subagent__task", title: sub.task, children: previewValue(sub.task, 90) }),
|
|
3351
|
+
running && onStop && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3352
|
+
"button",
|
|
3353
|
+
{
|
|
3354
|
+
type: "button",
|
|
3355
|
+
className: "awr-iconbtn awr-subagent__stop",
|
|
3356
|
+
"aria-label": L.stopSubagent,
|
|
3357
|
+
title: L.stopSubagent,
|
|
3358
|
+
onClick: () => onStop(sub.id),
|
|
3359
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(StopIcon, { size: 12 })
|
|
3360
|
+
}
|
|
3361
|
+
)
|
|
3362
|
+
] }),
|
|
3363
|
+
showUsage && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "awr-subagent__meta", children: [
|
|
3364
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "awr-subagent__status", children: L.subagentStatus[sub.status] }),
|
|
3365
|
+
meta.map((part, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "awr-subagent__metaitem", children: part }, i))
|
|
3366
|
+
] }),
|
|
3367
|
+
showTools && sub.tools && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "awr-subagent__tools", children: sub.tools.length > 0 ? L.subagentTools(sub.tools.join(", ")) : L.subagentNoTools }),
|
|
3368
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("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)}` : ""}` }),
|
|
3369
|
+
children
|
|
3370
|
+
]
|
|
3371
|
+
}
|
|
3372
|
+
);
|
|
3373
|
+
};
|
|
3374
|
+
var SubagentTree = ({
|
|
3375
|
+
subagents,
|
|
3376
|
+
onStop,
|
|
3377
|
+
showUsage = true,
|
|
3378
|
+
showTools = true,
|
|
3379
|
+
renderSubagent,
|
|
3380
|
+
labels,
|
|
3381
|
+
className
|
|
3382
|
+
}) => {
|
|
3383
|
+
if (subagents.length === 0) return null;
|
|
3384
|
+
const branch = (nodes, nested) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3385
|
+
"ul",
|
|
3386
|
+
{
|
|
3387
|
+
className: ["awr-subagents", nested ? "awr-subagents--nested" : className].filter(Boolean).join(" "),
|
|
3388
|
+
children: nodes.map((node) => {
|
|
3389
|
+
const row = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3390
|
+
SubagentRow,
|
|
3391
|
+
{
|
|
3392
|
+
sub: node,
|
|
3393
|
+
onStop,
|
|
3394
|
+
showUsage,
|
|
3395
|
+
showTools,
|
|
3396
|
+
labels,
|
|
3397
|
+
children: node.children.length > 0 ? branch(node.children, true) : null
|
|
3398
|
+
},
|
|
3399
|
+
node.id
|
|
3400
|
+
);
|
|
3401
|
+
return renderSubagent ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react13.Fragment, { children: renderSubagent(node, row) }, node.id) : row;
|
|
3402
|
+
})
|
|
3403
|
+
}
|
|
3404
|
+
);
|
|
3405
|
+
return branch(subagentTree(subagents), false);
|
|
3406
|
+
};
|
|
3407
|
+
|
|
3408
|
+
// src/components/StepList.tsx
|
|
3409
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3410
|
+
var WEB_SEARCH = "web_search";
|
|
3411
|
+
var ToolCallRow = ({
|
|
3412
|
+
call,
|
|
3413
|
+
showUsage = true,
|
|
3414
|
+
showTiers = true,
|
|
3415
|
+
showSearchResults = true,
|
|
2863
3416
|
labels
|
|
2864
3417
|
}) => {
|
|
2865
3418
|
const L = useLabels(labels);
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
3419
|
+
const state = call.status === "calling" ? "calling" : call.ok === false ? "failed" : "ok";
|
|
3420
|
+
const images = call.ok === false ? [] : imagesInOutput(call.output).slice(0, 4);
|
|
3421
|
+
const search = showSearchResults && call.name === WEB_SEARCH && call.status === "done" && call.ok !== false ? webSearchOf(call.output) : void 0;
|
|
3422
|
+
const cost = [
|
|
3423
|
+
call.inputTokens ? `\u2248${formatTokens(call.inputTokens)} in` : "",
|
|
3424
|
+
call.outputTokens ? `\u2248${formatTokens(call.outputTokens)} out` : "",
|
|
3425
|
+
call.durationMs !== void 0 ? formatDuration(call.durationMs) : ""
|
|
3426
|
+
].filter(Boolean).join(" \xB7 ");
|
|
3427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3428
|
+
"li",
|
|
3429
|
+
{
|
|
3430
|
+
className: `awr-tool awr-tool--${state}${showTiers && call.attempt !== void 0 ? " awr-tool--earlier" : ""}`,
|
|
3431
|
+
children: [
|
|
3432
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "awr-tool__row", children: [
|
|
3433
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToolIcon, { size: 13, className: "awr-tool__icon" }),
|
|
3434
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("code", { className: "awr-tool__name", children: call.name }),
|
|
3435
|
+
previewValue(call.input) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "awr-tool__args", children: previewValue(call.input) }),
|
|
3436
|
+
call.status === "calling" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SpinnerIcon, { size: 12, className: "awr-tool__spin" }),
|
|
3437
|
+
call.status === "done" && call.ok === false && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "awr-tool__badge", children: L.failed }),
|
|
3438
|
+
showTiers && call.replayed && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "awr-tool__tag", title: L.replayedTitle, children: L.replayed }),
|
|
3439
|
+
showTiers && call.attempt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "awr-tool__tag", children: L.attemptTag(call.attempt) }),
|
|
3440
|
+
showUsage && cost && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "awr-tool__cost", title: L.toolCostTitle, children: cost })
|
|
3441
|
+
] }),
|
|
3442
|
+
images.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "awr-tool__images", children: images.map((src, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("a", { href: src, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("img", { className: "awr-thumb", src, alt: `${call.name} result ${i + 1}` }) }, i)) }),
|
|
3443
|
+
search && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "awr-search", children: [
|
|
3444
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { className: "awr-search__query", children: [
|
|
3445
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GlobeIcon, { size: 12 }),
|
|
3446
|
+
" ",
|
|
3447
|
+
L.searchQuery,
|
|
3448
|
+
" ",
|
|
3449
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("q", { children: search.query })
|
|
3450
|
+
] }),
|
|
3451
|
+
search.results.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ol", { className: "awr-search__results", children: search.results.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("li", { className: "awr-search__result", children: [
|
|
3452
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3453
|
+
"a",
|
|
3454
|
+
{
|
|
3455
|
+
className: "awr-search__title",
|
|
3456
|
+
href: r.url,
|
|
3457
|
+
target: "_blank",
|
|
3458
|
+
rel: "noopener noreferrer",
|
|
3459
|
+
children: r.title
|
|
3460
|
+
}
|
|
3461
|
+
),
|
|
3462
|
+
" ",
|
|
3463
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "awr-search__host", children: [
|
|
3464
|
+
r.host,
|
|
3465
|
+
r.date ? ` \xB7 ${r.date}` : ""
|
|
3466
|
+
] }),
|
|
3467
|
+
r.snippet && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "awr-search__snippet", children: r.snippet })
|
|
3468
|
+
] }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "awr-search__note", children: L.searchNoResults }),
|
|
3469
|
+
(search.filtered > 0 || search.truncated) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "awr-search__note", children: [
|
|
3470
|
+
search.filtered > 0 ? L.searchFiltered(search.filtered) : "",
|
|
3471
|
+
search.truncated ? L.searchTruncated : ""
|
|
3472
|
+
].filter(Boolean).join(" \xB7 ") })
|
|
3473
|
+
] })
|
|
3474
|
+
]
|
|
3475
|
+
}
|
|
3476
|
+
);
|
|
2887
3477
|
};
|
|
2888
3478
|
var UserNoteRow = ({
|
|
2889
3479
|
note,
|
|
2890
3480
|
labels
|
|
2891
3481
|
}) => {
|
|
2892
3482
|
const L = useLabels(labels);
|
|
2893
|
-
return /* @__PURE__ */ (0,
|
|
2894
|
-
/* @__PURE__ */ (0,
|
|
2895
|
-
/* @__PURE__ */ (0,
|
|
2896
|
-
/* @__PURE__ */ (0,
|
|
3483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("li", { className: `awr-note awr-note--${note.at}`, children: [
|
|
3484
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SendIcon, { size: 12, className: "awr-note__icon" }),
|
|
3485
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "awr-note__where", children: L.noteAt[note.at] }),
|
|
3486
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("q", { className: "awr-note__text", children: note.text })
|
|
2897
3487
|
] });
|
|
2898
3488
|
};
|
|
3489
|
+
var decisionNote = (d, L) => {
|
|
3490
|
+
if (d.accepted) {
|
|
3491
|
+
return L.decisionAccepted(
|
|
3492
|
+
d.choice ?? "",
|
|
3493
|
+
d.confidence !== void 0 ? formatProbability(d.confidence) : ""
|
|
3494
|
+
);
|
|
3495
|
+
}
|
|
3496
|
+
const detail = d.reason === "low-confidence" && d.confidence !== void 0 ? `${formatProbability(d.confidence)} < ${formatProbability(d.threshold)}` : "";
|
|
3497
|
+
return L.decisionFellBack(d.reason ? L.decisionReasons[d.reason] : "", detail);
|
|
3498
|
+
};
|
|
2899
3499
|
var decisionLabel = (a, L) => a.status === "pending" ? L.consentWaiting : a.status === "approved" ? L.consentAllowed : L.consentDenied(a.reason);
|
|
2900
3500
|
var StepItem = ({
|
|
2901
3501
|
step,
|
|
@@ -2906,39 +3506,98 @@ var StepItem = ({
|
|
|
2906
3506
|
showToolCalls,
|
|
2907
3507
|
showUsage,
|
|
2908
3508
|
showThoughts,
|
|
3509
|
+
showTiers,
|
|
3510
|
+
showReplanFailed,
|
|
3511
|
+
showDecisions,
|
|
3512
|
+
showSearchResults,
|
|
3513
|
+
showSubagents,
|
|
2909
3514
|
renderToolCall,
|
|
3515
|
+
renderSubagent,
|
|
2910
3516
|
L
|
|
2911
|
-
}) => /* @__PURE__ */ (0,
|
|
2912
|
-
/* @__PURE__ */ (0,
|
|
2913
|
-
/* @__PURE__ */ (0,
|
|
2914
|
-
/* @__PURE__ */ (0,
|
|
3517
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("li", { className: `awr-step awr-step--${step.blocked ? "blocked" : step.status}`, children: [
|
|
3518
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "awr-step__head", children: [
|
|
3519
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "awr-step__marker", children: step.status === "running" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SpinnerIcon, { size: 14 }) : step.blocked ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AlertIcon, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CheckIcon, { size: 14 }) }),
|
|
3520
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "awr-step__index", children: [
|
|
2915
3521
|
step.index,
|
|
2916
3522
|
"/",
|
|
2917
3523
|
step.total
|
|
2918
3524
|
] }),
|
|
2919
|
-
/* @__PURE__ */ (0,
|
|
3525
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "awr-step__desc", children: step.step.description })
|
|
3526
|
+
] }),
|
|
3527
|
+
showTiers && step.tier && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "awr-step__meta", children: [
|
|
3528
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3529
|
+
"span",
|
|
3530
|
+
{
|
|
3531
|
+
className: `awr-step__tier awr-step__tier--${step.tier}`,
|
|
3532
|
+
title: step.tierReason ? L.tierReasons[step.tierReason] : void 0,
|
|
3533
|
+
children: L.tierNames[step.tier]
|
|
3534
|
+
}
|
|
3535
|
+
),
|
|
3536
|
+
step.model && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "awr-step__model", children: step.model })
|
|
2920
3537
|
] }),
|
|
2921
|
-
|
|
2922
|
-
/* @__PURE__ */ (0,
|
|
2923
|
-
/* @__PURE__ */ (0,
|
|
3538
|
+
showTiers && step.escalations?.map((e, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "awr-step__escalated", children: [
|
|
3539
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { className: "awr-step__escalated-line", children: [
|
|
3540
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ArrowUpIcon, { size: 12 }),
|
|
3541
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: L.escalated(L.tierNames[e.from], L.tierNames[e.to], L.escalationReasons[e.reason]) })
|
|
3542
|
+
] }),
|
|
3543
|
+
e.text?.trim() && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("details", { className: "awr-step__attempt", children: [
|
|
3544
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("summary", { children: L.escalatedAttemptText }),
|
|
3545
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "awr-step__text", children: e.text.trim() })
|
|
3546
|
+
] })
|
|
3547
|
+
] }, i)),
|
|
3548
|
+
showThoughts && step.reasoning.trim() && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("details", { className: "awr-thought", open: step.status === "running" && !step.text, children: [
|
|
3549
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("summary", { children: [
|
|
3550
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BrainIcon, { size: 13 }),
|
|
2924
3551
|
" ",
|
|
2925
3552
|
L.stepThoughts
|
|
2926
3553
|
] }),
|
|
2927
|
-
/* @__PURE__ */ (0,
|
|
3554
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "awr-thought__text", children: step.reasoning.trim() })
|
|
2928
3555
|
] }),
|
|
2929
|
-
step.text.trim() && /* @__PURE__ */ (0,
|
|
2930
|
-
showToolCalls && step.toolCalls.length > 0 && /* @__PURE__ */ (0,
|
|
2931
|
-
const row = /* @__PURE__ */ (0,
|
|
2932
|
-
|
|
3556
|
+
step.text.trim() && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "awr-step__text", children: step.text.trim() }),
|
|
3557
|
+
showToolCalls && step.toolCalls.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "awr-step__tools", children: step.toolCalls.map((call, i) => {
|
|
3558
|
+
const row = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3559
|
+
ToolCallRow,
|
|
3560
|
+
{
|
|
3561
|
+
call,
|
|
3562
|
+
showUsage,
|
|
3563
|
+
showTiers,
|
|
3564
|
+
showSearchResults
|
|
3565
|
+
},
|
|
3566
|
+
i
|
|
3567
|
+
);
|
|
3568
|
+
return renderToolCall ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react14.Fragment, { children: renderToolCall(call, row) }, i) : row;
|
|
2933
3569
|
}) }),
|
|
2934
|
-
approvals.length > 0 && /* @__PURE__ */ (0,
|
|
2935
|
-
/* @__PURE__ */ (0,
|
|
2936
|
-
/* @__PURE__ */ (0,
|
|
2937
|
-
/* @__PURE__ */ (0,
|
|
3570
|
+
approvals.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "awr-step__tools", children: approvals.map((a) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("li", { className: `awr-tool awr-tool__row awr-tool--approval-${a.status}`, children: [
|
|
3571
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ShieldIcon, { size: 13, className: "awr-tool__icon" }),
|
|
3572
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("code", { className: "awr-tool__name", children: a.name }),
|
|
3573
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "awr-tool__args", children: decisionLabel(a, L) }),
|
|
3574
|
+
a.subagent && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "awr-tool__tag", children: L.subagentHelper })
|
|
2938
3575
|
] }, a.id)) }),
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
3576
|
+
showSubagents && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3577
|
+
SubagentTree,
|
|
3578
|
+
{
|
|
3579
|
+
subagents,
|
|
3580
|
+
onStop: onStopSubagent,
|
|
3581
|
+
showUsage,
|
|
3582
|
+
renderSubagent
|
|
3583
|
+
}
|
|
3584
|
+
),
|
|
3585
|
+
notes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "awr-notes", children: notes.map((n) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(UserNoteRow, { note: n }, n.id)) }),
|
|
3586
|
+
step.blocked && step.summary && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "awr-step__blocked", children: step.summary }),
|
|
3587
|
+
showReplanFailed && step.replanFailed && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { className: "awr-step__warn", title: step.replanFailed, children: [
|
|
3588
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AlertIcon, { size: 12 }),
|
|
3589
|
+
" ",
|
|
3590
|
+
L.replanFailed
|
|
3591
|
+
] }),
|
|
3592
|
+
showDecisions && step.decisions?.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3593
|
+
"p",
|
|
3594
|
+
{
|
|
3595
|
+
className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
|
|
3596
|
+
title: d.model,
|
|
3597
|
+
children: decisionNote(d, L)
|
|
3598
|
+
},
|
|
3599
|
+
i
|
|
3600
|
+
))
|
|
2942
3601
|
] });
|
|
2943
3602
|
var StepList = ({
|
|
2944
3603
|
steps,
|
|
@@ -2950,7 +3609,13 @@ var StepList = ({
|
|
|
2950
3609
|
showToolCalls = true,
|
|
2951
3610
|
showUsage = true,
|
|
2952
3611
|
showThoughts = true,
|
|
3612
|
+
showTiers = true,
|
|
3613
|
+
showReplanFailed = true,
|
|
3614
|
+
showDecisions = true,
|
|
3615
|
+
showSearchResults = true,
|
|
3616
|
+
showSubagents = true,
|
|
2953
3617
|
renderToolCall,
|
|
3618
|
+
renderSubagent,
|
|
2954
3619
|
labels,
|
|
2955
3620
|
className
|
|
2956
3621
|
}) => {
|
|
@@ -2958,8 +3623,9 @@ var StepList = ({
|
|
|
2958
3623
|
if (steps.length === 0) return null;
|
|
2959
3624
|
const known = new Set(steps.map((s) => s.id));
|
|
2960
3625
|
const atEnd = showNotes ? notes.filter((n) => !n.stepId || !known.has(n.stepId)) : [];
|
|
2961
|
-
|
|
2962
|
-
|
|
3626
|
+
const loose = showSubagents ? subagents.filter((s) => !s.stepId || !known.has(s.stepId)) : [];
|
|
3627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("ol", { className: ["awr-steps", className].filter(Boolean).join(" "), children: [
|
|
3628
|
+
steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2963
3629
|
StepItem,
|
|
2964
3630
|
{
|
|
2965
3631
|
step,
|
|
@@ -2970,17 +3636,32 @@ var StepList = ({
|
|
|
2970
3636
|
showToolCalls,
|
|
2971
3637
|
showUsage,
|
|
2972
3638
|
showThoughts,
|
|
3639
|
+
showTiers,
|
|
3640
|
+
showReplanFailed,
|
|
3641
|
+
showDecisions,
|
|
3642
|
+
showSearchResults,
|
|
3643
|
+
showSubagents,
|
|
2973
3644
|
renderToolCall,
|
|
3645
|
+
renderSubagent,
|
|
2974
3646
|
L
|
|
2975
3647
|
},
|
|
2976
3648
|
step.id
|
|
2977
3649
|
)),
|
|
2978
|
-
|
|
3650
|
+
loose.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { className: "awr-step awr-step--subagents", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3651
|
+
SubagentTree,
|
|
3652
|
+
{
|
|
3653
|
+
subagents: loose,
|
|
3654
|
+
onStop: onStopSubagent,
|
|
3655
|
+
showUsage,
|
|
3656
|
+
renderSubagent
|
|
3657
|
+
}
|
|
3658
|
+
) }),
|
|
3659
|
+
atEnd.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { className: "awr-step awr-step--notes", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "awr-notes", children: atEnd.map((n) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(UserNoteRow, { note: n }, n.id)) }) })
|
|
2979
3660
|
] });
|
|
2980
3661
|
};
|
|
2981
3662
|
|
|
2982
3663
|
// src/components/MessageList.tsx
|
|
2983
|
-
var
|
|
3664
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2984
3665
|
var usageLine = (usage, durationMs) => {
|
|
2985
3666
|
const parts = [];
|
|
2986
3667
|
if (usage && usage.totalTokens > 0) {
|
|
@@ -2991,16 +3672,18 @@ var usageLine = (usage, durationMs) => {
|
|
|
2991
3672
|
if (durationMs !== void 0) parts.push(formatDuration(durationMs));
|
|
2992
3673
|
return parts.join(" \xB7 ");
|
|
2993
3674
|
};
|
|
2994
|
-
var AttachmentView = ({ attachment: a }) => a.dataUrl && a.mediaType.startsWith("image/") ? /* @__PURE__ */ (0,
|
|
2995
|
-
/* @__PURE__ */ (0,
|
|
3675
|
+
var AttachmentView = ({ attachment: a }) => a.dataUrl && a.mediaType.startsWith("image/") ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("a", { href: a.dataUrl, target: "_blank", rel: "noreferrer", title: a.path ?? a.name, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("img", { className: "awr-thumb awr-thumb--msg", src: a.dataUrl, alt: a.name }) }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "awr-chip awr-file", title: a.path ?? a.mediaType, children: [
|
|
3676
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FileIcon, { size: 13 }),
|
|
2996
3677
|
" ",
|
|
2997
3678
|
a.name
|
|
2998
3679
|
] });
|
|
2999
3680
|
var toolCallCount = (m) => (m.steps ?? []).reduce((n, s) => n + s.toolCalls.length, 0);
|
|
3000
|
-
var activitySummary = (m, showToolCalls, showLearned, L) => {
|
|
3681
|
+
var activitySummary = (m, showToolCalls, showLearned, showTiers, L) => {
|
|
3001
3682
|
const steps = m.steps ?? [];
|
|
3002
3683
|
const parts = [L.steps(steps.length)];
|
|
3003
3684
|
if (showToolCalls) parts.push(L.toolCalls(toolCallCount(m)));
|
|
3685
|
+
const escalations = steps.reduce((n, s) => n + (s.escalations?.length ?? 0), 0);
|
|
3686
|
+
if (showTiers && escalations > 0) parts.push(L.escalations(escalations));
|
|
3004
3687
|
if (m.subagents?.length) parts.push(L.subagents(m.subagents.length));
|
|
3005
3688
|
if (m.skills?.length) parts.push(L.skillsUsed(m.skills.join(", ")));
|
|
3006
3689
|
if (showLearned && m.learned?.length) parts.push(L.learnedNow(m.learned.join(", ")));
|
|
@@ -3016,6 +3699,15 @@ var MessageList = ({
|
|
|
3016
3699
|
showThoughts = true,
|
|
3017
3700
|
showNotes = true,
|
|
3018
3701
|
showLearned = true,
|
|
3702
|
+
showTiers = true,
|
|
3703
|
+
showReplanFailed = true,
|
|
3704
|
+
showDecisions = true,
|
|
3705
|
+
showSearchResults = true,
|
|
3706
|
+
showSubagents = true,
|
|
3707
|
+
showMedia = true,
|
|
3708
|
+
files,
|
|
3709
|
+
renderMedia,
|
|
3710
|
+
renderSubagent,
|
|
3019
3711
|
onStopSubagent,
|
|
3020
3712
|
activityOpen = false,
|
|
3021
3713
|
liveExtra,
|
|
@@ -3028,21 +3720,21 @@ var MessageList = ({
|
|
|
3028
3720
|
}) => {
|
|
3029
3721
|
const L = useLabels(labels);
|
|
3030
3722
|
if (messages.length === 0) {
|
|
3031
|
-
return empty ? /* @__PURE__ */ (0,
|
|
3723
|
+
return empty ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "awr-messages__empty", children: empty }) : null;
|
|
3032
3724
|
}
|
|
3033
|
-
return /* @__PURE__ */ (0,
|
|
3725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: ["awr-messages", className].filter(Boolean).join(" "), children: messages.map((m) => {
|
|
3034
3726
|
const steps = m.steps ?? [];
|
|
3035
3727
|
const hasActivity = showActivity && (steps.length > 0 || (m.subagents?.length ?? 0) > 0 || m.pending && !!liveExtra);
|
|
3036
3728
|
const usage = showUsage ? usageLine(m.usage, m.durationMs) : "";
|
|
3037
|
-
const node = /* @__PURE__ */ (0,
|
|
3729
|
+
const node = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3038
3730
|
"div",
|
|
3039
3731
|
{
|
|
3040
3732
|
className: `awr-msg awr-msg--${m.role}${m.error ? " awr-msg--error" : ""}${m.pending ? " is-pending" : ""}`,
|
|
3041
|
-
children: /* @__PURE__ */ (0,
|
|
3042
|
-
m.role === "assistant" && hasActivity && /* @__PURE__ */ (0,
|
|
3043
|
-
/* @__PURE__ */ (0,
|
|
3733
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "awr-msg__col", children: [
|
|
3734
|
+
m.role === "assistant" && hasActivity && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("details", { className: "awr-activity", open: m.pending || activityOpen, children: [
|
|
3735
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("summary", { className: "awr-activity__summary", children: activitySummary(m, showToolCalls, showLearned, showTiers, L) }),
|
|
3044
3736
|
m.pending && liveExtra,
|
|
3045
|
-
/* @__PURE__ */ (0,
|
|
3737
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3046
3738
|
StepList,
|
|
3047
3739
|
{
|
|
3048
3740
|
steps,
|
|
@@ -3054,153 +3746,190 @@ var MessageList = ({
|
|
|
3054
3746
|
showToolCalls,
|
|
3055
3747
|
showUsage,
|
|
3056
3748
|
showThoughts,
|
|
3749
|
+
showTiers,
|
|
3750
|
+
showReplanFailed,
|
|
3751
|
+
showDecisions,
|
|
3752
|
+
showSearchResults,
|
|
3753
|
+
showSubagents,
|
|
3057
3754
|
renderToolCall,
|
|
3755
|
+
renderSubagent,
|
|
3058
3756
|
labels
|
|
3059
3757
|
}
|
|
3060
3758
|
),
|
|
3061
|
-
showLearned && m.fetches?.length ? /* @__PURE__ */ (0,
|
|
3759
|
+
showLearned && m.fetches?.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { className: "awr-fetches", children: m.fetches.map((f, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3062
3760
|
"li",
|
|
3063
3761
|
{
|
|
3064
3762
|
className: `awr-fetch${f.allowed ? "" : " awr-fetch--refused"}`,
|
|
3065
3763
|
children: [
|
|
3066
|
-
/* @__PURE__ */ (0,
|
|
3764
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GlobeIcon, { size: 12 }),
|
|
3067
3765
|
" ",
|
|
3068
|
-
/* @__PURE__ */ (0,
|
|
3766
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("code", { children: f.url }),
|
|
3069
3767
|
" ",
|
|
3070
|
-
/* @__PURE__ */ (0,
|
|
3768
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "awr-fetch__result", children: f.allowed ? f.status ?? "ok" : L.fetchRefused(f.reason ?? "") })
|
|
3071
3769
|
]
|
|
3072
3770
|
},
|
|
3073
3771
|
i
|
|
3074
3772
|
)) }) : null,
|
|
3075
|
-
showLearned && m.learned?.length ? /* @__PURE__ */ (0,
|
|
3076
|
-
/* @__PURE__ */ (0,
|
|
3773
|
+
showLearned && m.learned?.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { className: "awr-learned", children: [
|
|
3774
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(BookIcon, { size: 12 }),
|
|
3077
3775
|
" ",
|
|
3078
3776
|
L.learnedNow(m.learned.join(", "))
|
|
3079
3777
|
] }) : null,
|
|
3080
|
-
showThoughts && m.reasoning?.trim() && /* @__PURE__ */ (0,
|
|
3081
|
-
/* @__PURE__ */ (0,
|
|
3082
|
-
/* @__PURE__ */ (0,
|
|
3778
|
+
showThoughts && m.reasoning?.trim() && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("details", { className: "awr-thought", children: [
|
|
3779
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("summary", { children: [
|
|
3780
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(BrainIcon, { size: 13 }),
|
|
3083
3781
|
" ",
|
|
3084
3782
|
L.answerThoughts
|
|
3085
3783
|
] }),
|
|
3086
|
-
/* @__PURE__ */ (0,
|
|
3784
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "awr-thought__text", children: m.reasoning.trim() })
|
|
3087
3785
|
] })
|
|
3088
3786
|
] }),
|
|
3089
|
-
|
|
3787
|
+
showMedia && m.transcripts?.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "awr-msg__transcripts", children: m.transcripts.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranscriptBlock, { transcript: t, labels }, i)) }) : null,
|
|
3788
|
+
(m.content || m.pending || !m.attachments?.length) && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "awr-msg__bubble", children: [
|
|
3090
3789
|
m.content ? renderContent ? renderContent(m) : m.content : null,
|
|
3091
|
-
m.pending && !m.content && /* @__PURE__ */ (0,
|
|
3790
|
+
m.pending && !m.content && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SpinnerIcon, { size: 14, className: "awr-msg__pending" })
|
|
3092
3791
|
] }),
|
|
3093
|
-
m.
|
|
3094
|
-
|
|
3792
|
+
showMedia && m.media?.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "awr-msg__media", children: m.media.map((item, i) => {
|
|
3793
|
+
const built = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GeneratedMedia, { media: item, files, labels }, i);
|
|
3794
|
+
return renderMedia ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "awr-msg__mediaitem", children: renderMedia(item, m, built) }, i) : built;
|
|
3795
|
+
}) }) : null,
|
|
3796
|
+
m.attachments?.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "awr-msg__attachments", "aria-label": L.attachments, children: m.attachments.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "awr-msg__attachment", children: renderAttachment ? renderAttachment(a, m) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AttachmentView, { attachment: a }) }, i)) }) : null,
|
|
3797
|
+
m.role === "assistant" && usage && !m.pending && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "awr-msg__usage", title: L.usageTitle, children: usage })
|
|
3095
3798
|
] })
|
|
3096
3799
|
},
|
|
3097
3800
|
m.id
|
|
3098
3801
|
);
|
|
3099
|
-
return renderMessage ? /* @__PURE__ */ (0,
|
|
3802
|
+
return renderMessage ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: renderMessage(m, node) }, m.id) : node;
|
|
3100
3803
|
}) });
|
|
3101
3804
|
};
|
|
3102
3805
|
|
|
3103
3806
|
// src/components/ModelLoadBar.tsx
|
|
3104
|
-
var
|
|
3807
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3105
3808
|
var ModelLoadBar = ({ load, className }) => {
|
|
3106
3809
|
const pct = Math.round(Math.max(0, Math.min(1, load.progress)) * 100);
|
|
3107
|
-
return /* @__PURE__ */ (0,
|
|
3108
|
-
/* @__PURE__ */ (0,
|
|
3109
|
-
/* @__PURE__ */ (0,
|
|
3110
|
-
/* @__PURE__ */ (0,
|
|
3810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: ["awr-modelload", className].filter(Boolean).join(" "), children: [
|
|
3811
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "awr-modelload__head", children: [
|
|
3812
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "awr-modelload__text", children: load.text || "Loading model\u2026" }),
|
|
3813
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "awr-modelload__pct", children: [
|
|
3111
3814
|
pct,
|
|
3112
3815
|
"%"
|
|
3113
3816
|
] })
|
|
3114
3817
|
] }),
|
|
3115
|
-
/* @__PURE__ */ (0,
|
|
3818
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "awr-modelload__track", role: "progressbar", "aria-valuenow": pct, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "awr-modelload__fill", style: { width: `${pct}%` } }) })
|
|
3116
3819
|
] });
|
|
3117
3820
|
};
|
|
3118
3821
|
|
|
3119
3822
|
// src/components/ToolApprovalPrompt.tsx
|
|
3120
|
-
var
|
|
3823
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3121
3824
|
var ToolApprovalPrompt = ({
|
|
3122
3825
|
approvals,
|
|
3123
3826
|
onApprove,
|
|
3124
3827
|
onDeny,
|
|
3125
3828
|
allowRemember = true,
|
|
3829
|
+
showHelper = true,
|
|
3126
3830
|
renderApproval,
|
|
3127
3831
|
labels,
|
|
3128
3832
|
className
|
|
3129
3833
|
}) => {
|
|
3130
3834
|
const L = useLabels(labels);
|
|
3131
3835
|
if (approvals.length === 0) return null;
|
|
3132
|
-
return /* @__PURE__ */ (0,
|
|
3133
|
-
const
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
}
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: ["awr-approvals", className].filter(Boolean).join(" "), role: "alert", children: approvals.map((a) => {
|
|
3837
|
+
const helper = showHelper ? a.subagent : void 0;
|
|
3838
|
+
const card = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
3839
|
+
"div",
|
|
3840
|
+
{
|
|
3841
|
+
className: `awr-approval${helper ? " awr-approval--helper" : ""}`,
|
|
3842
|
+
"data-subagent": helper?.id,
|
|
3843
|
+
children: [
|
|
3844
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "awr-approval__head", children: [
|
|
3845
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
|
|
3846
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
3847
|
+
helper ? L.approvalLeadHelper(
|
|
3848
|
+
previewValue(helper.role ?? "", 60) || void 0,
|
|
3849
|
+
helper.depth
|
|
3850
|
+
) : L.approvalLead,
|
|
3851
|
+
" ",
|
|
3852
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("code", { className: "awr-tool__name", children: a.name }),
|
|
3853
|
+
a.readOnly ? ` (${L.readOnlyTool})` : ""
|
|
3854
|
+
] })
|
|
3855
|
+
] }),
|
|
3856
|
+
previewValue(a.input, 300) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("pre", { className: "awr-approval__input", children: previewValue(a.input, 300) }),
|
|
3857
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "awr-approval__actions", children: [
|
|
3858
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3859
|
+
"button",
|
|
3860
|
+
{
|
|
3861
|
+
type: "button",
|
|
3862
|
+
className: "awr-btn awr-btn--primary",
|
|
3863
|
+
onClick: () => onApprove(a.id),
|
|
3864
|
+
children: L.approve
|
|
3865
|
+
}
|
|
3866
|
+
),
|
|
3867
|
+
allowRemember && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3868
|
+
"button",
|
|
3869
|
+
{
|
|
3870
|
+
type: "button",
|
|
3871
|
+
className: "awr-btn",
|
|
3872
|
+
onClick: () => onApprove(a.id, { remember: true }),
|
|
3873
|
+
children: L.alwaysAllow
|
|
3874
|
+
}
|
|
3875
|
+
),
|
|
3876
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3877
|
+
"button",
|
|
3878
|
+
{
|
|
3879
|
+
type: "button",
|
|
3880
|
+
className: "awr-btn awr-btn--danger",
|
|
3881
|
+
onClick: () => onDeny(a.id, L.declinedReason),
|
|
3882
|
+
children: L.deny
|
|
3883
|
+
}
|
|
3884
|
+
)
|
|
3885
|
+
] })
|
|
3886
|
+
]
|
|
3887
|
+
},
|
|
3888
|
+
a.id
|
|
3889
|
+
);
|
|
3890
|
+
return renderApproval ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: renderApproval(a, card) }, a.id) : card;
|
|
3175
3891
|
}) });
|
|
3176
3892
|
};
|
|
3177
3893
|
|
|
3178
3894
|
// src/components/UsageBadge.tsx
|
|
3179
|
-
var
|
|
3180
|
-
var UsageBadge = ({
|
|
3181
|
-
|
|
3895
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3896
|
+
var UsageBadge = ({
|
|
3897
|
+
usage,
|
|
3898
|
+
compact = false,
|
|
3899
|
+
showCalls = true,
|
|
3900
|
+
labels,
|
|
3901
|
+
className
|
|
3902
|
+
}) => {
|
|
3903
|
+
const L = useLabels(labels);
|
|
3904
|
+
const media = showCalls ? usage.mediaCalls ?? 0 : 0;
|
|
3905
|
+
const decisions = showCalls ? usage.decisionCalls ?? 0 : 0;
|
|
3906
|
+
if (usage.totalTokens === 0 && media === 0 && decisions === 0) return null;
|
|
3182
3907
|
const reasoning = usage.reasoningTokens ?? 0;
|
|
3183
3908
|
const cached = usage.cachedInputTokens ?? 0;
|
|
3184
3909
|
const title = [
|
|
3185
3910
|
`${usage.inputTokens} in + ${usage.outputTokens} out = ${usage.totalTokens} tokens`,
|
|
3186
3911
|
reasoning ? `${reasoning} thinking` : "",
|
|
3187
|
-
cached ? `${cached} input tokens from the prompt cache` : ""
|
|
3912
|
+
cached ? `${cached} input tokens from the prompt cache` : "",
|
|
3913
|
+
media ? L.usageMedia(media) : "",
|
|
3914
|
+
decisions ? L.usageDecisions(decisions) : ""
|
|
3188
3915
|
].filter(Boolean).join(" \xB7 ");
|
|
3189
|
-
return /* @__PURE__ */ (0,
|
|
3916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: ["awr-usage", className].filter(Boolean).join(" "), title, children: [
|
|
3190
3917
|
formatTokens(usage.inputTokens),
|
|
3191
3918
|
"\u2191 ",
|
|
3192
3919
|
formatTokens(usage.outputTokens),
|
|
3193
3920
|
"\u2193",
|
|
3194
3921
|
!compact && reasoning > 0 && ` \xB7 ${formatTokens(reasoning)} think`,
|
|
3195
|
-
!compact && cached > 0 && ` \xB7 ${formatTokens(cached)} cached
|
|
3922
|
+
!compact && cached > 0 && ` \xB7 ${formatTokens(cached)} cached`,
|
|
3923
|
+
!compact && media > 0 && ` \xB7 ${L.usageMedia(media)}`,
|
|
3924
|
+
!compact && decisions > 0 && ` \xB7 ${L.usageDecisions(decisions)}`
|
|
3196
3925
|
] });
|
|
3197
3926
|
};
|
|
3198
3927
|
|
|
3199
3928
|
// src/components/AgentChat.tsx
|
|
3200
|
-
var
|
|
3929
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3201
3930
|
var isHistoryHook = (h) => typeof h === "object" && h !== null && "select" in h && "chats" in h;
|
|
3202
3931
|
var cx = (...names) => names.filter(Boolean).join(" ");
|
|
3203
|
-
var AgentChat = (props) => /* @__PURE__ */ (0,
|
|
3932
|
+
var AgentChat = (props) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentLabelsProvider, { labels: props.labels ?? NO_LABELS, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentChatInner, { ...props }) });
|
|
3204
3933
|
var NO_LABELS = {};
|
|
3205
3934
|
var AgentChatInner = ({
|
|
3206
3935
|
controller,
|
|
@@ -3213,6 +3942,12 @@ var AgentChatInner = ({
|
|
|
3213
3942
|
showThoughts = true,
|
|
3214
3943
|
showNotes = true,
|
|
3215
3944
|
showLearned = true,
|
|
3945
|
+
showTiers = true,
|
|
3946
|
+
showReplanFailed = true,
|
|
3947
|
+
showDecisions = true,
|
|
3948
|
+
showSearchResults = true,
|
|
3949
|
+
showSubagents = true,
|
|
3950
|
+
showMedia = true,
|
|
3216
3951
|
stoppableSubagents = true,
|
|
3217
3952
|
showTotalUsage = true,
|
|
3218
3953
|
showStatus = true,
|
|
@@ -3229,6 +3964,8 @@ var AgentChatInner = ({
|
|
|
3229
3964
|
renderMessage,
|
|
3230
3965
|
renderAttachment,
|
|
3231
3966
|
renderToolCall,
|
|
3967
|
+
renderSubagent,
|
|
3968
|
+
renderMedia,
|
|
3232
3969
|
renderApproval,
|
|
3233
3970
|
slots = {},
|
|
3234
3971
|
components = {},
|
|
@@ -3246,7 +3983,7 @@ var AgentChatInner = ({
|
|
|
3246
3983
|
}
|
|
3247
3984
|
const L = useLabels();
|
|
3248
3985
|
const external = isHistoryHook(history) ? history : void 0;
|
|
3249
|
-
const [ownStore] = (0,
|
|
3986
|
+
const [ownStore] = (0, import_react15.useState)(
|
|
3250
3987
|
() => history instanceof ChatHistoryStore ? history : new ChatHistoryStore()
|
|
3251
3988
|
);
|
|
3252
3989
|
const own = useChatHistory(agent, {
|
|
@@ -3254,9 +3991,9 @@ var AgentChatInner = ({
|
|
|
3254
3991
|
enabled: Boolean(history) && !external
|
|
3255
3992
|
});
|
|
3256
3993
|
const chats = history ? external ?? own : void 0;
|
|
3257
|
-
const rootRef = (0,
|
|
3258
|
-
const [narrow, setNarrow] = (0,
|
|
3259
|
-
(0,
|
|
3994
|
+
const rootRef = (0, import_react15.useRef)(null);
|
|
3995
|
+
const [narrow, setNarrow] = (0, import_react15.useState)(void 0);
|
|
3996
|
+
(0, import_react15.useEffect)(() => {
|
|
3260
3997
|
const el = rootRef.current;
|
|
3261
3998
|
if (!el || typeof ResizeObserver === "undefined") return setNarrow(false);
|
|
3262
3999
|
const measure = () => setNarrow(el.getBoundingClientRect().width < narrowWidth);
|
|
@@ -3265,9 +4002,9 @@ var AgentChatInner = ({
|
|
|
3265
4002
|
ro.observe(el);
|
|
3266
4003
|
return () => ro.disconnect();
|
|
3267
4004
|
}, [narrowWidth]);
|
|
3268
|
-
const [historyChoice, setHistoryOpen] = (0,
|
|
4005
|
+
const [historyChoice, setHistoryOpen] = (0, import_react15.useState)(defaultHistoryOpen);
|
|
3269
4006
|
const historyOpen = historyChoice ?? narrow === false;
|
|
3270
|
-
const [filesOpen, setFilesOpen] = (0,
|
|
4007
|
+
const [filesOpen, setFilesOpen] = (0, import_react15.useState)(defaultFilesOpen);
|
|
3271
4008
|
const toggleHistory = () => {
|
|
3272
4009
|
setHistoryOpen(!historyOpen);
|
|
3273
4010
|
if (narrow && !historyOpen) setFilesOpen(false);
|
|
@@ -3276,13 +4013,13 @@ var AgentChatInner = ({
|
|
|
3276
4013
|
setFilesOpen((o) => !o);
|
|
3277
4014
|
if (narrow && !filesOpen) setHistoryOpen(false);
|
|
3278
4015
|
};
|
|
3279
|
-
const bodyRef = (0,
|
|
3280
|
-
const stickRef = (0,
|
|
3281
|
-
(0,
|
|
4016
|
+
const bodyRef = (0, import_react15.useRef)(null);
|
|
4017
|
+
const stickRef = (0, import_react15.useRef)(true);
|
|
4018
|
+
(0, import_react15.useEffect)(() => {
|
|
3282
4019
|
const el = bodyRef.current;
|
|
3283
4020
|
if (el && stickRef.current) el.scrollTop = el.scrollHeight;
|
|
3284
4021
|
}, [agent.messages, agent.steps, agent.finalText, agent.modelLoad, agent.pendingApprovals]);
|
|
3285
|
-
const [compacting, setCompacting] = (0,
|
|
4022
|
+
const [compacting, setCompacting] = (0, import_react15.useState)(false);
|
|
3286
4023
|
const compact = () => {
|
|
3287
4024
|
setCompacting(true);
|
|
3288
4025
|
void agent.compact().finally(() => setCompacting(false));
|
|
@@ -3294,15 +4031,30 @@ var AgentChatInner = ({
|
|
|
3294
4031
|
const Approvals = components.ApprovalPrompt ?? ToolApprovalPrompt;
|
|
3295
4032
|
const loading = agent.modelLoad && agent.modelLoad.progress < 1;
|
|
3296
4033
|
const showReplan = agent.replan && agent.replan.mode !== "continue";
|
|
3297
|
-
const
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
4034
|
+
const replanFailedEarly = showReplanFailed && agent.replan?.failed === true && agent.steps.length === 0;
|
|
4035
|
+
const earlyDecisions = showDecisions ? agent.decisions ?? [] : [];
|
|
4036
|
+
const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
4037
|
+
agent.planThought.trim() && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("details", { className: "awr-activity__plan", children: [
|
|
4038
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("summary", { children: L.planned }),
|
|
4039
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "awr-activity__thought", children: agent.planThought })
|
|
4040
|
+
] }),
|
|
4041
|
+
showReplan && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "awr-activity__replan", children: L.replanned(agent.replan.mode, agent.replan.reason) }),
|
|
4042
|
+
replanFailedEarly && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { className: "awr-step__warn", title: agent.replan.error, children: [
|
|
4043
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AlertIcon, { size: 12 }),
|
|
4044
|
+
" ",
|
|
4045
|
+
L.replanFailed
|
|
3301
4046
|
] }),
|
|
3302
|
-
|
|
4047
|
+
earlyDecisions.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
4048
|
+
"p",
|
|
4049
|
+
{
|
|
4050
|
+
className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
|
|
4051
|
+
children: decisionNote(d, L)
|
|
4052
|
+
},
|
|
4053
|
+
i
|
|
4054
|
+
))
|
|
3303
4055
|
] }) : void 0;
|
|
3304
|
-
const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */ (0,
|
|
3305
|
-
chats && /* @__PURE__ */ (0,
|
|
4056
|
+
const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cx("awr-chat__header", classNames.header), children: [
|
|
4057
|
+
chats && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3306
4058
|
"button",
|
|
3307
4059
|
{
|
|
3308
4060
|
type: "button",
|
|
@@ -3311,17 +4063,17 @@ var AgentChatInner = ({
|
|
|
3311
4063
|
title: L.showHistory,
|
|
3312
4064
|
"aria-pressed": historyOpen,
|
|
3313
4065
|
onClick: toggleHistory,
|
|
3314
|
-
children: /* @__PURE__ */ (0,
|
|
4066
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(HistoryIcon, { size: 16 })
|
|
3315
4067
|
}
|
|
3316
4068
|
),
|
|
3317
4069
|
slots.headerStart,
|
|
3318
|
-
/* @__PURE__ */ (0,
|
|
3319
|
-
showStatus && /* @__PURE__ */ (0,
|
|
3320
|
-
/* @__PURE__ */ (0,
|
|
3321
|
-
/* @__PURE__ */ (0,
|
|
4070
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "awr-chat__title", children: title }),
|
|
4071
|
+
showStatus && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: `awr-status awr-status--${agent.status}`, title: L.status[agent.status], children: [
|
|
4072
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-status__dot" }),
|
|
4073
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-status__text", children: L.status[agent.status] })
|
|
3322
4074
|
] }),
|
|
3323
|
-
showTotalUsage && /* @__PURE__ */ (0,
|
|
3324
|
-
files && /* @__PURE__ */ (0,
|
|
4075
|
+
showTotalUsage && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { title: L.totalUsage, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(UsageBadge, { usage: agent.totalUsage, compact: narrow !== false }) }),
|
|
4076
|
+
files && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3325
4077
|
"button",
|
|
3326
4078
|
{
|
|
3327
4079
|
type: "button",
|
|
@@ -3330,12 +4082,12 @@ var AgentChatInner = ({
|
|
|
3330
4082
|
title: L.showFiles,
|
|
3331
4083
|
"aria-pressed": filesOpen,
|
|
3332
4084
|
onClick: toggleFiles,
|
|
3333
|
-
children: /* @__PURE__ */ (0,
|
|
4085
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FileIcon, { size: 16 })
|
|
3334
4086
|
}
|
|
3335
4087
|
),
|
|
3336
4088
|
slots.headerEnd
|
|
3337
4089
|
] });
|
|
3338
|
-
return /* @__PURE__ */ (0,
|
|
4090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3339
4091
|
"div",
|
|
3340
4092
|
{
|
|
3341
4093
|
ref: rootRef,
|
|
@@ -3343,8 +4095,8 @@ var AgentChatInner = ({
|
|
|
3343
4095
|
style,
|
|
3344
4096
|
"data-awr-theme": theme === "auto" ? void 0 : theme,
|
|
3345
4097
|
children: [
|
|
3346
|
-
chats && historyOpen && /* @__PURE__ */ (0,
|
|
3347
|
-
/* @__PURE__ */ (0,
|
|
4098
|
+
chats && historyOpen && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("aside", { className: cx("awr-chat__sidebar", classNames.sidebar), children: [
|
|
4099
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3348
4100
|
HistoryList,
|
|
3349
4101
|
{
|
|
3350
4102
|
history: {
|
|
@@ -3363,7 +4115,7 @@ var AgentChatInner = ({
|
|
|
3363
4115
|
}
|
|
3364
4116
|
),
|
|
3365
4117
|
slots.sidebar,
|
|
3366
|
-
/* @__PURE__ */ (0,
|
|
4118
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3367
4119
|
"button",
|
|
3368
4120
|
{
|
|
3369
4121
|
type: "button",
|
|
@@ -3374,9 +4126,9 @@ var AgentChatInner = ({
|
|
|
3374
4126
|
}
|
|
3375
4127
|
)
|
|
3376
4128
|
] }),
|
|
3377
|
-
/* @__PURE__ */ (0,
|
|
4129
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cx("awr-chat__main", classNames.main), children: [
|
|
3378
4130
|
header,
|
|
3379
|
-
/* @__PURE__ */ (0,
|
|
4131
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3380
4132
|
"div",
|
|
3381
4133
|
{
|
|
3382
4134
|
className: cx("awr-chat__body", classNames.body),
|
|
@@ -3387,7 +4139,7 @@ var AgentChatInner = ({
|
|
|
3387
4139
|
},
|
|
3388
4140
|
children: [
|
|
3389
4141
|
slots.beforeMessages,
|
|
3390
|
-
/* @__PURE__ */ (0,
|
|
4142
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3391
4143
|
Messages,
|
|
3392
4144
|
{
|
|
3393
4145
|
messages: agent.messages,
|
|
@@ -3398,6 +4150,15 @@ var AgentChatInner = ({
|
|
|
3398
4150
|
showThoughts,
|
|
3399
4151
|
showNotes,
|
|
3400
4152
|
showLearned,
|
|
4153
|
+
showTiers,
|
|
4154
|
+
showReplanFailed,
|
|
4155
|
+
showDecisions,
|
|
4156
|
+
showSearchResults,
|
|
4157
|
+
showSubagents,
|
|
4158
|
+
showMedia,
|
|
4159
|
+
files,
|
|
4160
|
+
renderMedia,
|
|
4161
|
+
renderSubagent,
|
|
3401
4162
|
onStopSubagent: stoppableSubagents ? agent.stopSubagent : void 0,
|
|
3402
4163
|
activityOpen,
|
|
3403
4164
|
liveExtra,
|
|
@@ -3407,7 +4168,7 @@ var AgentChatInner = ({
|
|
|
3407
4168
|
renderToolCall
|
|
3408
4169
|
}
|
|
3409
4170
|
),
|
|
3410
|
-
/* @__PURE__ */ (0,
|
|
4171
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3411
4172
|
Approvals,
|
|
3412
4173
|
{
|
|
3413
4174
|
approvals: agent.pendingApprovals,
|
|
@@ -3416,14 +4177,14 @@ var AgentChatInner = ({
|
|
|
3416
4177
|
renderApproval
|
|
3417
4178
|
}
|
|
3418
4179
|
),
|
|
3419
|
-
agent.modelLoad && loading && /* @__PURE__ */ (0,
|
|
4180
|
+
agent.modelLoad && loading && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ModelLoadBar, { load: agent.modelLoad }),
|
|
3420
4181
|
slots.afterMessages
|
|
3421
4182
|
]
|
|
3422
4183
|
}
|
|
3423
4184
|
),
|
|
3424
|
-
/* @__PURE__ */ (0,
|
|
4185
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cx("awr-chat__footer", classNames.footer), children: [
|
|
3425
4186
|
slots.footerStart,
|
|
3426
|
-
showContext !== false && /* @__PURE__ */ (0,
|
|
4187
|
+
showContext !== false && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3427
4188
|
ContextMeter,
|
|
3428
4189
|
{
|
|
3429
4190
|
usage: agent.usage,
|
|
@@ -3434,11 +4195,11 @@ var AgentChatInner = ({
|
|
|
3434
4195
|
compacting
|
|
3435
4196
|
}
|
|
3436
4197
|
),
|
|
3437
|
-
composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */ (0,
|
|
3438
|
-
/* @__PURE__ */ (0,
|
|
4198
|
+
composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "awr-chat__error", children: [
|
|
4199
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AlertIcon, { size: 14 }),
|
|
3439
4200
|
" ",
|
|
3440
4201
|
agent.error
|
|
3441
|
-
] }) : /* @__PURE__ */ (0,
|
|
4202
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3442
4203
|
Composer2,
|
|
3443
4204
|
{
|
|
3444
4205
|
controller: agent,
|
|
@@ -3451,9 +4212,9 @@ var AgentChatInner = ({
|
|
|
3451
4212
|
)
|
|
3452
4213
|
] })
|
|
3453
4214
|
] }),
|
|
3454
|
-
files && filesOpen && /* @__PURE__ */ (0,
|
|
3455
|
-
/* @__PURE__ */ (0,
|
|
3456
|
-
/* @__PURE__ */ (0,
|
|
4215
|
+
files && filesOpen && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("aside", { className: cx("awr-chat__files", classNames.files), children: [
|
|
4216
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Files, { files }),
|
|
4217
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3457
4218
|
"button",
|
|
3458
4219
|
{
|
|
3459
4220
|
type: "button",
|
|
@@ -3470,7 +4231,7 @@ var AgentChatInner = ({
|
|
|
3470
4231
|
};
|
|
3471
4232
|
|
|
3472
4233
|
// src/components/LearnedSkills.tsx
|
|
3473
|
-
var
|
|
4234
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3474
4235
|
var LearnedSkills = ({
|
|
3475
4236
|
controller,
|
|
3476
4237
|
lessons,
|
|
@@ -3486,18 +4247,18 @@ var LearnedSkills = ({
|
|
|
3486
4247
|
const c = controller ?? ctx;
|
|
3487
4248
|
const list = lessons ?? c?.learned ?? [];
|
|
3488
4249
|
const forget = onForget === false ? void 0 : onForget ?? c?.forgetSkill;
|
|
3489
|
-
return /* @__PURE__ */ (0,
|
|
3490
|
-
!hideTitle && /* @__PURE__ */ (0,
|
|
3491
|
-
/* @__PURE__ */ (0,
|
|
4250
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("section", { className: ["awr-notebook", className].filter(Boolean).join(" "), children: [
|
|
4251
|
+
!hideTitle && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("h3", { className: "awr-notebook__title", children: [
|
|
4252
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BookIcon, { size: 14 }),
|
|
3492
4253
|
" ",
|
|
3493
4254
|
L.notebookTitle,
|
|
3494
|
-
list.length > 0 && /* @__PURE__ */ (0,
|
|
4255
|
+
list.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-notebook__count", children: list.length })
|
|
3495
4256
|
] }),
|
|
3496
|
-
list.length === 0 ? /* @__PURE__ */ (0,
|
|
3497
|
-
/* @__PURE__ */ (0,
|
|
3498
|
-
/* @__PURE__ */ (0,
|
|
3499
|
-
l.revision > 1 && /* @__PURE__ */ (0,
|
|
3500
|
-
forget && /* @__PURE__ */ (0,
|
|
4257
|
+
list.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "awr-notebook__empty", children: empty ?? L.notebookEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "awr-notebook__list", children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("li", { className: "awr-lesson", children: [
|
|
4258
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "awr-lesson__head", children: [
|
|
4259
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("code", { className: "awr-lesson__name", children: l.name }),
|
|
4260
|
+
l.revision > 1 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-lesson__rev", children: L.notebookRevision(l.revision) }),
|
|
4261
|
+
forget && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3501
4262
|
"button",
|
|
3502
4263
|
{
|
|
3503
4264
|
type: "button",
|
|
@@ -3505,12 +4266,12 @@ var LearnedSkills = ({
|
|
|
3505
4266
|
title: `${L.notebookForget}: ${l.name}`,
|
|
3506
4267
|
"aria-label": `${L.notebookForget}: ${l.name}`,
|
|
3507
4268
|
onClick: () => void forget(l.name),
|
|
3508
|
-
children: /* @__PURE__ */ (0,
|
|
4269
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(XIcon, { size: 12 })
|
|
3509
4270
|
}
|
|
3510
4271
|
)
|
|
3511
4272
|
] }),
|
|
3512
|
-
/* @__PURE__ */ (0,
|
|
3513
|
-
showSources && l.sources.length > 0 && /* @__PURE__ */ (0,
|
|
4273
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "awr-lesson__when", children: l.description }),
|
|
4274
|
+
showSources && l.sources.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "awr-lesson__from", children: [
|
|
3514
4275
|
L.notebookFrom,
|
|
3515
4276
|
" ",
|
|
3516
4277
|
l.sources.join(", ")
|
|
@@ -3520,8 +4281,8 @@ var LearnedSkills = ({
|
|
|
3520
4281
|
};
|
|
3521
4282
|
|
|
3522
4283
|
// src/components/Composer.tsx
|
|
3523
|
-
var
|
|
3524
|
-
var
|
|
4284
|
+
var import_react16 = require("react");
|
|
4285
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3525
4286
|
var Composer = ({
|
|
3526
4287
|
onSubmit,
|
|
3527
4288
|
busy = false,
|
|
@@ -3530,9 +4291,9 @@ var Composer = ({
|
|
|
3530
4291
|
placeholder = "Ask the agent to do something\u2026",
|
|
3531
4292
|
className
|
|
3532
4293
|
}) => {
|
|
3533
|
-
const [
|
|
4294
|
+
const [text2, setText] = (0, import_react16.useState)("");
|
|
3534
4295
|
const submit = () => {
|
|
3535
|
-
const value =
|
|
4296
|
+
const value = text2.trim();
|
|
3536
4297
|
if (!value || busy || disabled) return;
|
|
3537
4298
|
setText("");
|
|
3538
4299
|
onSubmit(value);
|
|
@@ -3543,7 +4304,7 @@ var Composer = ({
|
|
|
3543
4304
|
submit();
|
|
3544
4305
|
}
|
|
3545
4306
|
};
|
|
3546
|
-
return /* @__PURE__ */ (0,
|
|
4307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3547
4308
|
"form",
|
|
3548
4309
|
{
|
|
3549
4310
|
className: ["awr-composer", className].filter(Boolean).join(" "),
|
|
@@ -3552,11 +4313,11 @@ var Composer = ({
|
|
|
3552
4313
|
submit();
|
|
3553
4314
|
},
|
|
3554
4315
|
children: [
|
|
3555
|
-
/* @__PURE__ */ (0,
|
|
4316
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3556
4317
|
"textarea",
|
|
3557
4318
|
{
|
|
3558
4319
|
className: "awr-composer__input",
|
|
3559
|
-
value:
|
|
4320
|
+
value: text2,
|
|
3560
4321
|
onChange: (e) => setText(e.target.value),
|
|
3561
4322
|
onKeyDown,
|
|
3562
4323
|
placeholder,
|
|
@@ -3564,23 +4325,23 @@ var Composer = ({
|
|
|
3564
4325
|
rows: 1
|
|
3565
4326
|
}
|
|
3566
4327
|
),
|
|
3567
|
-
busy ? /* @__PURE__ */ (0,
|
|
4328
|
+
busy ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3568
4329
|
"button",
|
|
3569
4330
|
{
|
|
3570
4331
|
type: "button",
|
|
3571
4332
|
className: "awr-composer__btn awr-composer__btn--stop",
|
|
3572
4333
|
onClick: onStop,
|
|
3573
4334
|
"aria-label": "Stop",
|
|
3574
|
-
children: /* @__PURE__ */ (0,
|
|
4335
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(StopIcon, { size: 18 })
|
|
3575
4336
|
}
|
|
3576
|
-
) : /* @__PURE__ */ (0,
|
|
4337
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3577
4338
|
"button",
|
|
3578
4339
|
{
|
|
3579
4340
|
type: "submit",
|
|
3580
4341
|
className: "awr-composer__btn",
|
|
3581
|
-
disabled: disabled || !
|
|
4342
|
+
disabled: disabled || !text2.trim(),
|
|
3582
4343
|
"aria-label": "Send",
|
|
3583
|
-
children: disabled ? /* @__PURE__ */ (0,
|
|
4344
|
+
children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SpinnerIcon, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SendIcon, { size: 18 })
|
|
3584
4345
|
}
|
|
3585
4346
|
)
|
|
3586
4347
|
]
|
|
@@ -3589,17 +4350,17 @@ var Composer = ({
|
|
|
3589
4350
|
};
|
|
3590
4351
|
|
|
3591
4352
|
// src/components/PlanView.tsx
|
|
3592
|
-
var
|
|
4353
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3593
4354
|
var PlanView = ({ plan, showThought = true, className }) => {
|
|
3594
4355
|
if (!plan.steps.length && !plan.thought) return null;
|
|
3595
|
-
return /* @__PURE__ */ (0,
|
|
3596
|
-
showThought && plan.thought.trim() && /* @__PURE__ */ (0,
|
|
3597
|
-
plan.steps.length > 0 && /* @__PURE__ */ (0,
|
|
4356
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: ["awr-plan", className].filter(Boolean).join(" "), children: [
|
|
4357
|
+
showThought && plan.thought.trim() && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "awr-plan__thought", children: plan.thought }),
|
|
4358
|
+
plan.steps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ol", { className: "awr-plan__steps", children: plan.steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("li", { className: "awr-plan__step", children: step.description }, step.id)) })
|
|
3598
4359
|
] });
|
|
3599
4360
|
};
|
|
3600
4361
|
|
|
3601
4362
|
// src/components/ApprovalModeSwitch.tsx
|
|
3602
|
-
var
|
|
4363
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3603
4364
|
var DEFAULT_LABELS = {
|
|
3604
4365
|
autopilot: "Autopilot",
|
|
3605
4366
|
"ask-writes": "Ask before changes",
|
|
@@ -3619,13 +4380,13 @@ var ApprovalModeSwitch = ({
|
|
|
3619
4380
|
labels,
|
|
3620
4381
|
disabled,
|
|
3621
4382
|
className
|
|
3622
|
-
}) => /* @__PURE__ */ (0,
|
|
4383
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3623
4384
|
"div",
|
|
3624
4385
|
{
|
|
3625
4386
|
className: ["awr-modeswitch", className].filter(Boolean).join(" "),
|
|
3626
4387
|
role: "radiogroup",
|
|
3627
4388
|
"aria-label": "Tool consent",
|
|
3628
|
-
children: modes.map((m) => /* @__PURE__ */ (0,
|
|
4389
|
+
children: modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3629
4390
|
"button",
|
|
3630
4391
|
{
|
|
3631
4392
|
type: "button",
|
|
@@ -3643,8 +4404,8 @@ var ApprovalModeSwitch = ({
|
|
|
3643
4404
|
);
|
|
3644
4405
|
|
|
3645
4406
|
// src/components/ApiKeyForm.tsx
|
|
3646
|
-
var
|
|
3647
|
-
var
|
|
4407
|
+
var import_react17 = require("react");
|
|
4408
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3648
4409
|
var ApiKeyForm = ({
|
|
3649
4410
|
credentials,
|
|
3650
4411
|
credentialRef,
|
|
@@ -3653,10 +4414,10 @@ var ApiKeyForm = ({
|
|
|
3653
4414
|
onChange,
|
|
3654
4415
|
className
|
|
3655
4416
|
}) => {
|
|
3656
|
-
const [value, setValue] = (0,
|
|
3657
|
-
const [present, setPresent] = (0,
|
|
3658
|
-
const [busy, setBusy] = (0,
|
|
3659
|
-
(0,
|
|
4417
|
+
const [value, setValue] = (0, import_react17.useState)("");
|
|
4418
|
+
const [present, setPresent] = (0, import_react17.useState)(false);
|
|
4419
|
+
const [busy, setBusy] = (0, import_react17.useState)(false);
|
|
4420
|
+
(0, import_react17.useEffect)(() => {
|
|
3660
4421
|
let active = true;
|
|
3661
4422
|
credentials.hasKey(credentialRef).then((has) => {
|
|
3662
4423
|
if (active) setPresent(has);
|
|
@@ -3688,16 +4449,16 @@ var ApiKeyForm = ({
|
|
|
3688
4449
|
setBusy(false);
|
|
3689
4450
|
}
|
|
3690
4451
|
};
|
|
3691
|
-
return /* @__PURE__ */ (0,
|
|
3692
|
-
/* @__PURE__ */ (0,
|
|
4452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: ["awr-keyform", className].filter(Boolean).join(" "), children: [
|
|
4453
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "awr-keyform__label", children: [
|
|
3693
4454
|
label,
|
|
3694
|
-
present && /* @__PURE__ */ (0,
|
|
3695
|
-
/* @__PURE__ */ (0,
|
|
4455
|
+
present && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "awr-keyform__saved", children: [
|
|
4456
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CheckIcon, { size: 12 }),
|
|
3696
4457
|
" stored, encrypted"
|
|
3697
4458
|
] })
|
|
3698
4459
|
] }),
|
|
3699
|
-
/* @__PURE__ */ (0,
|
|
3700
|
-
/* @__PURE__ */ (0,
|
|
4460
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "awr-keyform__row", children: [
|
|
4461
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3701
4462
|
"input",
|
|
3702
4463
|
{
|
|
3703
4464
|
className: "awr-keyform__input",
|
|
@@ -3715,7 +4476,7 @@ var ApiKeyForm = ({
|
|
|
3715
4476
|
disabled: busy
|
|
3716
4477
|
}
|
|
3717
4478
|
),
|
|
3718
|
-
/* @__PURE__ */ (0,
|
|
4479
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3719
4480
|
"button",
|
|
3720
4481
|
{
|
|
3721
4482
|
type: "button",
|
|
@@ -3725,7 +4486,7 @@ var ApiKeyForm = ({
|
|
|
3725
4486
|
children: "Save"
|
|
3726
4487
|
}
|
|
3727
4488
|
),
|
|
3728
|
-
present && /* @__PURE__ */ (0,
|
|
4489
|
+
present && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3729
4490
|
"button",
|
|
3730
4491
|
{
|
|
3731
4492
|
type: "button",
|
|
@@ -3740,7 +4501,7 @@ var ApiKeyForm = ({
|
|
|
3740
4501
|
};
|
|
3741
4502
|
|
|
3742
4503
|
// src/index.ts
|
|
3743
|
-
var
|
|
4504
|
+
var import_agent_web6 = require("@dudko.dev/agent-web");
|
|
3744
4505
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3745
4506
|
0 && (module.exports = {
|
|
3746
4507
|
AgentChat,
|
|
@@ -3756,6 +4517,7 @@ var import_agent_web4 = require("@dudko.dev/agent-web");
|
|
|
3756
4517
|
Composer,
|
|
3757
4518
|
ContextMeter,
|
|
3758
4519
|
FilesPanel,
|
|
4520
|
+
GeneratedMedia,
|
|
3759
4521
|
ImagesNotSupportedError,
|
|
3760
4522
|
IndexedDBStore,
|
|
3761
4523
|
LearnedSkills,
|
|
@@ -3767,8 +4529,10 @@ var import_agent_web4 = require("@dudko.dev/agent-web");
|
|
|
3767
4529
|
PlanView,
|
|
3768
4530
|
StepList,
|
|
3769
4531
|
SubagentRow,
|
|
4532
|
+
SubagentTree,
|
|
3770
4533
|
ToolApprovalPrompt,
|
|
3771
4534
|
ToolCallRow,
|
|
4535
|
+
TranscriptBlock,
|
|
3772
4536
|
UsageBadge,
|
|
3773
4537
|
UserNoteRow,
|
|
3774
4538
|
VaultCredentialStore,
|
|
@@ -3785,6 +4549,7 @@ var import_agent_web4 = require("@dudko.dev/agent-web");
|
|
|
3785
4549
|
createSubagentTool,
|
|
3786
4550
|
createWebLLMEngine,
|
|
3787
4551
|
createWebLLMModel,
|
|
4552
|
+
decisionNote,
|
|
3788
4553
|
defaultLabels,
|
|
3789
4554
|
defineSkill,
|
|
3790
4555
|
defineTool,
|
|
@@ -3795,6 +4560,7 @@ var import_agent_web4 = require("@dudko.dev/agent-web");
|
|
|
3795
4560
|
lessonsOf,
|
|
3796
4561
|
loadSkillFromUrl,
|
|
3797
4562
|
markReadOnly,
|
|
4563
|
+
mediaFamilyOf,
|
|
3798
4564
|
mergeLabels,
|
|
3799
4565
|
newChatId,
|
|
3800
4566
|
noticesOf,
|
|
@@ -3803,6 +4569,7 @@ var import_agent_web4 = require("@dudko.dev/agent-web");
|
|
|
3803
4569
|
preloadWebLLMModel,
|
|
3804
4570
|
serveSubagentWorker,
|
|
3805
4571
|
steerIntent,
|
|
4572
|
+
subagentTree,
|
|
3806
4573
|
supportsImages,
|
|
3807
4574
|
supportsPdf,
|
|
3808
4575
|
unloadWebLLMModel,
|
|
@@ -3817,6 +4584,7 @@ var import_agent_web4 = require("@dudko.dev/agent-web");
|
|
|
3817
4584
|
useSpeechToText,
|
|
3818
4585
|
useVirtualFiles,
|
|
3819
4586
|
useWebLLMModel,
|
|
4587
|
+
webSearchOf,
|
|
3820
4588
|
withAttachments
|
|
3821
4589
|
});
|
|
3822
4590
|
//# sourceMappingURL=index.cjs.map
|