@dudko.dev/agent-web-react 0.0.19 → 0.0.20
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 +1 -0
- package/dist/index.cjs +206 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +143 -9
- package/dist/index.d.ts +143 -9
- package/dist/index.js +206 -26
- package/dist/index.js.map +1 -1
- package/dist/styles.css +99 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// src/hooks/use-agent.ts
|
|
2
2
|
import { useCallback, useEffect, useReducer, useRef, useState } from "react";
|
|
3
3
|
import {
|
|
4
|
-
createAgent
|
|
4
|
+
createAgent,
|
|
5
|
+
createRunControl
|
|
5
6
|
} from "@dudko.dev/agent-web";
|
|
6
7
|
|
|
7
8
|
// src/state.ts
|
|
@@ -44,6 +45,9 @@ var createInitialAgentState = () => ({
|
|
|
44
45
|
runMessageId: void 0,
|
|
45
46
|
approvals: [],
|
|
46
47
|
subagents: [],
|
|
48
|
+
queued: [],
|
|
49
|
+
notes: [],
|
|
50
|
+
undelivered: [],
|
|
47
51
|
skills: [],
|
|
48
52
|
discoveredTools: [],
|
|
49
53
|
compactions: [],
|
|
@@ -147,7 +151,16 @@ var applyEvent = (state, event, ctx) => {
|
|
|
147
151
|
planThought: state.planThought || event.plan.thought
|
|
148
152
|
};
|
|
149
153
|
case "plan.revised":
|
|
150
|
-
return {
|
|
154
|
+
return {
|
|
155
|
+
...state,
|
|
156
|
+
plan: event.plan,
|
|
157
|
+
// `replan.decision` came first: keep its "because the user spoke" flag.
|
|
158
|
+
replan: {
|
|
159
|
+
mode: "revise",
|
|
160
|
+
reason: event.reason,
|
|
161
|
+
...state.replan?.byUser ? { byUser: true } : {}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
151
164
|
case "plan.step-added":
|
|
152
165
|
return state;
|
|
153
166
|
case "step.start": {
|
|
@@ -247,7 +260,27 @@ var applyEvent = (state, event, ctx) => {
|
|
|
247
260
|
}))
|
|
248
261
|
};
|
|
249
262
|
case "replan.decision":
|
|
250
|
-
return {
|
|
263
|
+
return {
|
|
264
|
+
...state,
|
|
265
|
+
replan: {
|
|
266
|
+
mode: event.mode,
|
|
267
|
+
reason: event.reason,
|
|
268
|
+
...event.byUser ? { byUser: true } : {}
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
case "message.queued":
|
|
272
|
+
return state.queued.some((q) => q.id === event.id) ? state : { ...state, queued: [...state.queued, { id: event.id, text: event.text }] };
|
|
273
|
+
case "message.delivered": {
|
|
274
|
+
const anchor = event.at === "round" ? runningStepId(state.steps) : event.at === "step" ? state.steps[state.steps.length - 1]?.id : void 0;
|
|
275
|
+
return {
|
|
276
|
+
...state,
|
|
277
|
+
queued: state.queued.filter((q) => q.id !== event.id),
|
|
278
|
+
notes: [
|
|
279
|
+
...state.notes,
|
|
280
|
+
{ id: event.id, text: event.text, at: event.at, ...anchor ? { stepId: anchor } : {} }
|
|
281
|
+
]
|
|
282
|
+
};
|
|
283
|
+
}
|
|
251
284
|
case "final.text-delta": {
|
|
252
285
|
const finalText = state.finalText + event.delta;
|
|
253
286
|
return { ...state, finalText, messages: streamAssistant(state.messages, finalText) };
|
|
@@ -317,6 +350,7 @@ var applyEvent = (state, event, ctx) => {
|
|
|
317
350
|
name: event.name,
|
|
318
351
|
task: event.task,
|
|
319
352
|
status: "running",
|
|
353
|
+
...event.profile ? { profile: event.profile } : {},
|
|
320
354
|
stepId: runningStepId(state.steps),
|
|
321
355
|
activity: "starting",
|
|
322
356
|
steps: 0,
|
|
@@ -351,8 +385,8 @@ var applyEvent = (state, event, ctx) => {
|
|
|
351
385
|
...state,
|
|
352
386
|
subagents: patchSubagent(state.subagents, event.id, (s) => ({
|
|
353
387
|
...s,
|
|
354
|
-
status: "error",
|
|
355
|
-
activity: "failed",
|
|
388
|
+
status: event.stopped ? "stopped" : "error",
|
|
389
|
+
activity: event.stopped ? "stopped" : "failed",
|
|
356
390
|
error: event.error
|
|
357
391
|
}))
|
|
358
392
|
};
|
|
@@ -413,6 +447,7 @@ var syncRunMessage = (state) => {
|
|
|
413
447
|
const patch = {};
|
|
414
448
|
if (m.steps !== state.steps) patch.steps = state.steps;
|
|
415
449
|
if (m.subagents !== state.subagents) patch.subagents = state.subagents;
|
|
450
|
+
if (state.notes.length > 0 && m.notes !== state.notes) patch.notes = state.notes;
|
|
416
451
|
if (m.usage !== state.usage) patch.usage = state.usage;
|
|
417
452
|
if ((m.reasoning ?? "") !== state.finalReasoning) patch.reasoning = state.finalReasoning;
|
|
418
453
|
if (m.skills !== state.skills) patch.skills = state.skills;
|
|
@@ -442,6 +477,8 @@ var agentStateReducer = (state, action) => {
|
|
|
442
477
|
const events = cap > 0 ? [...state.events, action.event].slice(-cap) : [...state.events, action.event];
|
|
443
478
|
return { ...next, events };
|
|
444
479
|
}
|
|
480
|
+
case "undelivered":
|
|
481
|
+
return { ...state, queued: [], undelivered: action.texts };
|
|
445
482
|
case "load": {
|
|
446
483
|
const maxSeq = action.messages.reduce((n, m) => {
|
|
447
484
|
const k = Number(/^msg-(\d+)$/.exec(m.id)?.[1] ?? -1);
|
|
@@ -468,6 +505,9 @@ var useAgent = (config, options = {}) => {
|
|
|
468
505
|
const [state, dispatch] = useReducer(agentStateReducer, void 0, createInitialAgentState);
|
|
469
506
|
const agentRef = useRef(void 0);
|
|
470
507
|
const abortRef = useRef(void 0);
|
|
508
|
+
const controlRef = useRef(void 0);
|
|
509
|
+
const stateRef = useRef(state);
|
|
510
|
+
stateRef.current = state;
|
|
471
511
|
const [generation, setGeneration] = useState(0);
|
|
472
512
|
const configRef = useRef(config);
|
|
473
513
|
configRef.current = config;
|
|
@@ -540,16 +580,21 @@ var useAgent = (config, options = {}) => {
|
|
|
540
580
|
},
|
|
541
581
|
[settleAll]
|
|
542
582
|
);
|
|
583
|
+
const runRef = useRef(void 0);
|
|
543
584
|
const run = useCallback(
|
|
544
585
|
async (goal, runOptions) => {
|
|
545
586
|
const agent = agentRef.current;
|
|
546
587
|
if (!agent || abortRef.current) return void 0;
|
|
547
588
|
const controller = new AbortController();
|
|
548
589
|
abortRef.current = controller;
|
|
590
|
+
const control = createRunControl();
|
|
591
|
+
controlRef.current = control;
|
|
592
|
+
let left = [];
|
|
549
593
|
dispatch({ type: "status", status: "running" });
|
|
550
594
|
try {
|
|
551
|
-
|
|
595
|
+
const result = await agent.run(goal, {
|
|
552
596
|
signal: controller.signal,
|
|
597
|
+
control,
|
|
553
598
|
sessionId: sessionRef.current,
|
|
554
599
|
...runOptions?.images?.length ? { images: runOptions.images } : {},
|
|
555
600
|
...runOptions?.files?.length ? { files: runOptions.files } : {},
|
|
@@ -569,7 +614,10 @@ var useAgent = (config, options = {}) => {
|
|
|
569
614
|
}
|
|
570
615
|
}
|
|
571
616
|
});
|
|
617
|
+
left = result.undelivered ?? [];
|
|
618
|
+
return result;
|
|
572
619
|
} catch (err) {
|
|
620
|
+
left = control.pending();
|
|
573
621
|
dispatch({
|
|
574
622
|
type: "event",
|
|
575
623
|
event: { type: "error", phase: "run", error: errMessage(err) },
|
|
@@ -578,12 +626,36 @@ var useAgent = (config, options = {}) => {
|
|
|
578
626
|
return void 0;
|
|
579
627
|
} finally {
|
|
580
628
|
abortRef.current = void 0;
|
|
629
|
+
controlRef.current = void 0;
|
|
581
630
|
settleAll({ approved: false, reason: "the run ended" });
|
|
582
631
|
dispatch({ type: "status", ...buildStatusRef.current });
|
|
632
|
+
if (left.length > 0) {
|
|
633
|
+
if (!controller.signal.aborted && optionsRef.current.followUp !== false) {
|
|
634
|
+
dispatch({ type: "undelivered", texts: [] });
|
|
635
|
+
void runRef.current?.(left.join("\n\n"));
|
|
636
|
+
} else {
|
|
637
|
+
dispatch({ type: "undelivered", texts: left });
|
|
638
|
+
}
|
|
639
|
+
} else {
|
|
640
|
+
dispatch({ type: "undelivered", texts: [] });
|
|
641
|
+
}
|
|
583
642
|
}
|
|
584
643
|
},
|
|
585
644
|
[settleAll]
|
|
586
645
|
);
|
|
646
|
+
runRef.current = run;
|
|
647
|
+
const send = useCallback((text) => controlRef.current?.send(text) ?? false, []);
|
|
648
|
+
const stopSubagent = useCallback(
|
|
649
|
+
(id) => controlRef.current?.stopSubagent(id) ?? false,
|
|
650
|
+
[]
|
|
651
|
+
);
|
|
652
|
+
const sendUndelivered = useCallback(() => {
|
|
653
|
+
const texts = stateRef.current.undelivered;
|
|
654
|
+
if (texts.length === 0) return;
|
|
655
|
+
dispatch({ type: "undelivered", texts: [] });
|
|
656
|
+
void runRef.current?.(texts.join("\n\n"));
|
|
657
|
+
}, []);
|
|
658
|
+
const discardUndelivered = useCallback(() => dispatch({ type: "undelivered", texts: [] }), []);
|
|
587
659
|
const stop = useCallback(() => {
|
|
588
660
|
abortRef.current?.abort();
|
|
589
661
|
settleAll({ approved: false, reason: "stopped by the user" });
|
|
@@ -637,6 +709,10 @@ var useAgent = (config, options = {}) => {
|
|
|
637
709
|
...state,
|
|
638
710
|
run,
|
|
639
711
|
stop,
|
|
712
|
+
send,
|
|
713
|
+
stopSubagent,
|
|
714
|
+
sendUndelivered,
|
|
715
|
+
discardUndelivered,
|
|
640
716
|
reset,
|
|
641
717
|
reload,
|
|
642
718
|
agent: agentRef.current,
|
|
@@ -1108,6 +1184,13 @@ var parseSlash = (text) => {
|
|
|
1108
1184
|
const m = /^\/([\w-]*)(?:\s+([\s\S]*))?$/.exec(text.trimStart());
|
|
1109
1185
|
return m ? { name: m[1].toLowerCase(), args: (m[2] ?? "").trim() } : void 0;
|
|
1110
1186
|
};
|
|
1187
|
+
var steerIntent = (input) => {
|
|
1188
|
+
if (!input.busy) return "idle";
|
|
1189
|
+
if (!input.steering) return "ignore";
|
|
1190
|
+
if (!input.raw && !input.hasAttachments) return "ignore";
|
|
1191
|
+
if (parseSlash(input.raw)) return "ignore";
|
|
1192
|
+
return input.hasAttachments ? "attachments" : "steer";
|
|
1193
|
+
};
|
|
1111
1194
|
var filterCommands = (commands, query) => {
|
|
1112
1195
|
const q = query.toLowerCase();
|
|
1113
1196
|
if (!q) return commands;
|
|
@@ -1305,6 +1388,20 @@ var defaultLabels = {
|
|
|
1305
1388
|
consentWaiting: "waiting for your consent",
|
|
1306
1389
|
consentAllowed: "allowed",
|
|
1307
1390
|
consentDenied: (reason) => `denied${reason ? ` \u2014 ${reason}` : ""}`,
|
|
1391
|
+
placeholderBusy: "Tell the agent something while it works\u2026",
|
|
1392
|
+
steer: "Send to the agent",
|
|
1393
|
+
noAttachmentsWhileBusy: "Files can\u2019t be added while the agent is working \u2014 send them with your next message.",
|
|
1394
|
+
queuedWaiting: "waiting for the agent\u2019s next step",
|
|
1395
|
+
noteAt: {
|
|
1396
|
+
round: "you said, between tool calls",
|
|
1397
|
+
step: "you said, after this step",
|
|
1398
|
+
final: "you said, before the answer"
|
|
1399
|
+
},
|
|
1400
|
+
undelivered: (n) => `Not delivered (${plural(n, "message", "messages")})`,
|
|
1401
|
+
sendUndelivered: "Send now",
|
|
1402
|
+
discardUndelivered: "Discard",
|
|
1403
|
+
stopSubagent: "Stop this subagent",
|
|
1404
|
+
subagentStopped: "stopped",
|
|
1308
1405
|
failed: "failed",
|
|
1309
1406
|
toolCostTitle: "Estimated tokens of the arguments and of the result fed back to the model (chars / 4), and the call's duration"
|
|
1310
1407
|
};
|
|
@@ -1313,7 +1410,8 @@ var NESTED = [
|
|
|
1313
1410
|
"modes",
|
|
1314
1411
|
"commandGroups",
|
|
1315
1412
|
"commandDescriptions",
|
|
1316
|
-
"thinkingLevels"
|
|
1413
|
+
"thinkingLevels",
|
|
1414
|
+
"noteAt"
|
|
1317
1415
|
];
|
|
1318
1416
|
var mergeLabels = (base2, over) => {
|
|
1319
1417
|
if (!over) return base2;
|
|
@@ -1548,6 +1646,8 @@ var AgentComposer = ({
|
|
|
1548
1646
|
showAgents = true,
|
|
1549
1647
|
showApprovalMode = true,
|
|
1550
1648
|
showNotices = true,
|
|
1649
|
+
steering = true,
|
|
1650
|
+
showQueued = true,
|
|
1551
1651
|
compactWidth = 460,
|
|
1552
1652
|
toolbarExtra,
|
|
1553
1653
|
toolbarEnd,
|
|
@@ -1825,7 +1925,17 @@ var AgentComposer = ({
|
|
|
1825
1925
|
}, [attachments, dropZone]);
|
|
1826
1926
|
const submit = () => {
|
|
1827
1927
|
const raw = text.trim();
|
|
1828
|
-
|
|
1928
|
+
const intent = steerIntent({ raw, busy, steering, hasAttachments: pending.length > 0 });
|
|
1929
|
+
if (intent === "steer") {
|
|
1930
|
+
if (agent.send(raw)) setText("");
|
|
1931
|
+
return;
|
|
1932
|
+
}
|
|
1933
|
+
if (intent === "attachments") {
|
|
1934
|
+
setAttachError(L.noAttachmentsWhileBusy);
|
|
1935
|
+
return;
|
|
1936
|
+
}
|
|
1937
|
+
if (intent === "ignore") return;
|
|
1938
|
+
if (!ready) return;
|
|
1829
1939
|
const parsed = parseSlash(raw);
|
|
1830
1940
|
if (parsed) {
|
|
1831
1941
|
const cmd = allCommands.find((c) => c.name === parsed.name);
|
|
@@ -1923,6 +2033,24 @@ var AgentComposer = ({
|
|
|
1923
2033
|
const thinkingOptions = thinking?.options ?? DEFAULT_THINKING;
|
|
1924
2034
|
const thinkingLabel = thinking ? thinkingOptions.find((o) => o.id === thinking.value)?.label ?? thinking.value : void 0;
|
|
1925
2035
|
const canSend = ready && (text.trim().length > 0 || pending.length > 0);
|
|
2036
|
+
const canSteer = busy && steering && text.trim().length > 0;
|
|
2037
|
+
const queuedStrip = showQueued && (agent.queued.length > 0 || agent.undelivered.length > 0) ? /* @__PURE__ */ jsxs2("div", { className: "awr-queued", children: [
|
|
2038
|
+
agent.queued.map((q) => /* @__PURE__ */ jsxs2("div", { className: "awr-queued__item", role: "status", children: [
|
|
2039
|
+
/* @__PURE__ */ jsx4(ClockIcon, { size: 13, className: "awr-queued__icon" }),
|
|
2040
|
+
/* @__PURE__ */ jsx4("span", { className: "awr-queued__text", title: q.text, children: q.text }),
|
|
2041
|
+
/* @__PURE__ */ jsx4("span", { className: "awr-queued__state", children: L.queuedWaiting })
|
|
2042
|
+
] }, q.id)),
|
|
2043
|
+
agent.undelivered.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "awr-queued__item awr-queued__item--undelivered", role: "status", children: [
|
|
2044
|
+
/* @__PURE__ */ jsx4(AlertIcon, { size: 13, className: "awr-queued__icon" }),
|
|
2045
|
+
/* @__PURE__ */ jsxs2("span", { className: "awr-queued__text", title: agent.undelivered.join("\n\n"), children: [
|
|
2046
|
+
L.undelivered(agent.undelivered.length),
|
|
2047
|
+
": ",
|
|
2048
|
+
agent.undelivered.join(" \xB7 ")
|
|
2049
|
+
] }),
|
|
2050
|
+
/* @__PURE__ */ jsx4("button", { type: "button", className: "awr-linkbtn", onClick: agent.sendUndelivered, children: L.sendUndelivered }),
|
|
2051
|
+
/* @__PURE__ */ jsx4("button", { type: "button", className: "awr-linkbtn", onClick: agent.discardUndelivered, children: L.discardUndelivered })
|
|
2052
|
+
] })
|
|
2053
|
+
] }) : null;
|
|
1926
2054
|
return /* @__PURE__ */ jsxs2(
|
|
1927
2055
|
"div",
|
|
1928
2056
|
{
|
|
@@ -1935,6 +2063,7 @@ var AgentComposer = ({
|
|
|
1935
2063
|
ref: rootRef,
|
|
1936
2064
|
children: [
|
|
1937
2065
|
dragging && /* @__PURE__ */ jsx4("div", { className: "awr-dropnote", style: dropRect, "aria-hidden": "true", children: L.dropHint }),
|
|
2066
|
+
queuedStrip,
|
|
1938
2067
|
notices.length > 0 && /* @__PURE__ */ jsx4("div", { className: "awr-notices", children: notices.map((n) => /* @__PURE__ */ jsxs2("div", { className: `awr-notice awr-notice--${n.tone}`, role: "status", children: [
|
|
1939
2068
|
/* @__PURE__ */ jsx4("span", { children: n.text }),
|
|
1940
2069
|
/* @__PURE__ */ jsx4(
|
|
@@ -2007,7 +2136,7 @@ var AgentComposer = ({
|
|
|
2007
2136
|
onChange: (e) => setText(e.target.value),
|
|
2008
2137
|
onKeyDown,
|
|
2009
2138
|
onPaste,
|
|
2010
|
-
placeholder: stt.listening ? L.listening : placeholder ?? L.placeholder,
|
|
2139
|
+
placeholder: stt.listening ? L.listening : busy && steering ? L.placeholderBusy : placeholder ?? L.placeholder,
|
|
2011
2140
|
disabled,
|
|
2012
2141
|
rows: 2,
|
|
2013
2142
|
"aria-label": L.message
|
|
@@ -2184,6 +2313,7 @@ var AgentComposer = ({
|
|
|
2184
2313
|
))
|
|
2185
2314
|
] })
|
|
2186
2315
|
] }),
|
|
2316
|
+
canSteer && /* @__PURE__ */ jsx4("button", { type: "button", className: "awr-sendbtn", onClick: submit, "aria-label": L.steer, children: /* @__PURE__ */ jsx4(SendIcon, { size: 16 }) }),
|
|
2187
2317
|
busy ? /* @__PURE__ */ jsx4(
|
|
2188
2318
|
"button",
|
|
2189
2319
|
{
|
|
@@ -2558,6 +2688,7 @@ var ToolCallRow = ({ call, showUsage = true, labels }) => {
|
|
|
2558
2688
|
};
|
|
2559
2689
|
var SubagentRow = ({
|
|
2560
2690
|
sub,
|
|
2691
|
+
onStop,
|
|
2561
2692
|
labels
|
|
2562
2693
|
}) => {
|
|
2563
2694
|
const L = useLabels(labels);
|
|
@@ -2565,10 +2696,33 @@ var SubagentRow = ({
|
|
|
2565
2696
|
/* @__PURE__ */ jsxs6("div", { className: "awr-subagent__head", children: [
|
|
2566
2697
|
/* @__PURE__ */ jsx8(BotIcon, { size: 13, className: "awr-subagent__icon" }),
|
|
2567
2698
|
/* @__PURE__ */ jsx8("span", { className: "awr-subagent__name", children: sub.name }),
|
|
2699
|
+
sub.profile && /* @__PURE__ */ jsx8("span", { className: "awr-subagent__profile", children: sub.profile }),
|
|
2568
2700
|
/* @__PURE__ */ jsx8("span", { className: "awr-subagent__task", title: sub.task, children: previewValue(sub.task, 90) }),
|
|
2569
|
-
sub.status === "running" && /* @__PURE__ */ jsx8(SpinnerIcon, { size: 12, className: "awr-tool__spin" })
|
|
2701
|
+
sub.status === "running" && /* @__PURE__ */ jsx8(SpinnerIcon, { size: 12, className: "awr-tool__spin" }),
|
|
2702
|
+
sub.status === "running" && onStop && /* @__PURE__ */ jsx8(
|
|
2703
|
+
"button",
|
|
2704
|
+
{
|
|
2705
|
+
type: "button",
|
|
2706
|
+
className: "awr-iconbtn awr-subagent__stop",
|
|
2707
|
+
"aria-label": L.stopSubagent,
|
|
2708
|
+
title: L.stopSubagent,
|
|
2709
|
+
onClick: () => onStop(sub.id),
|
|
2710
|
+
children: /* @__PURE__ */ jsx8(StopIcon, { size: 12 })
|
|
2711
|
+
}
|
|
2712
|
+
)
|
|
2570
2713
|
] }),
|
|
2571
|
-
/* @__PURE__ */ jsx8("div", { className: "awr-subagent__activity", children: sub.status === "error" ? sub.error : sub.status === "done" ? previewValue(sub.text, 160) : `${sub.activity}${sub.toolCalls ? ` \xB7 ${L.toolCalls(sub.toolCalls)}` : ""}` })
|
|
2714
|
+
/* @__PURE__ */ jsx8("div", { className: "awr-subagent__activity", children: sub.status === "error" ? sub.error : sub.status === "stopped" ? L.subagentStopped : sub.status === "done" ? previewValue(sub.text, 160) : `${sub.activity}${sub.toolCalls ? ` \xB7 ${L.toolCalls(sub.toolCalls)}` : ""}` })
|
|
2715
|
+
] });
|
|
2716
|
+
};
|
|
2717
|
+
var UserNoteRow = ({
|
|
2718
|
+
note,
|
|
2719
|
+
labels
|
|
2720
|
+
}) => {
|
|
2721
|
+
const L = useLabels(labels);
|
|
2722
|
+
return /* @__PURE__ */ jsxs6("li", { className: `awr-note awr-note--${note.at}`, children: [
|
|
2723
|
+
/* @__PURE__ */ jsx8(SendIcon, { size: 12, className: "awr-note__icon" }),
|
|
2724
|
+
/* @__PURE__ */ jsx8("span", { className: "awr-note__where", children: L.noteAt[note.at] }),
|
|
2725
|
+
/* @__PURE__ */ jsx8("q", { className: "awr-note__text", children: note.text })
|
|
2572
2726
|
] });
|
|
2573
2727
|
};
|
|
2574
2728
|
var decisionLabel = (a, L) => a.status === "pending" ? L.consentWaiting : a.status === "approved" ? L.consentAllowed : L.consentDenied(a.reason);
|
|
@@ -2576,6 +2730,8 @@ var StepItem = ({
|
|
|
2576
2730
|
step,
|
|
2577
2731
|
subagents,
|
|
2578
2732
|
approvals,
|
|
2733
|
+
notes,
|
|
2734
|
+
onStopSubagent,
|
|
2579
2735
|
showToolCalls,
|
|
2580
2736
|
showUsage,
|
|
2581
2737
|
showThoughts,
|
|
@@ -2609,13 +2765,17 @@ var StepItem = ({
|
|
|
2609
2765
|
/* @__PURE__ */ jsx8("code", { className: "awr-tool__name", children: a.name }),
|
|
2610
2766
|
/* @__PURE__ */ jsx8("span", { className: "awr-tool__args", children: decisionLabel(a, L) })
|
|
2611
2767
|
] }, a.id)) }),
|
|
2612
|
-
subagents.length > 0 && /* @__PURE__ */ jsx8("ul", { className: "awr-subagents", children: subagents.map((sub) => /* @__PURE__ */ jsx8(SubagentRow, { sub }, sub.id)) }),
|
|
2768
|
+
subagents.length > 0 && /* @__PURE__ */ jsx8("ul", { className: "awr-subagents", children: subagents.map((sub) => /* @__PURE__ */ jsx8(SubagentRow, { sub, onStop: onStopSubagent }, sub.id)) }),
|
|
2769
|
+
notes.length > 0 && /* @__PURE__ */ jsx8("ul", { className: "awr-notes", children: notes.map((n) => /* @__PURE__ */ jsx8(UserNoteRow, { note: n }, n.id)) }),
|
|
2613
2770
|
step.blocked && step.summary && /* @__PURE__ */ jsx8("p", { className: "awr-step__blocked", children: step.summary })
|
|
2614
2771
|
] });
|
|
2615
2772
|
var StepList = ({
|
|
2616
2773
|
steps,
|
|
2617
2774
|
subagents = [],
|
|
2618
2775
|
approvals = [],
|
|
2776
|
+
notes = [],
|
|
2777
|
+
showNotes = true,
|
|
2778
|
+
onStopSubagent,
|
|
2619
2779
|
showToolCalls = true,
|
|
2620
2780
|
showUsage = true,
|
|
2621
2781
|
showThoughts = true,
|
|
@@ -2625,20 +2785,27 @@ var StepList = ({
|
|
|
2625
2785
|
}) => {
|
|
2626
2786
|
const L = useLabels(labels);
|
|
2627
2787
|
if (steps.length === 0) return null;
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2788
|
+
const known = new Set(steps.map((s) => s.id));
|
|
2789
|
+
const atEnd = showNotes ? notes.filter((n) => !n.stepId || !known.has(n.stepId)) : [];
|
|
2790
|
+
return /* @__PURE__ */ jsxs6("ol", { className: ["awr-steps", className].filter(Boolean).join(" "), children: [
|
|
2791
|
+
steps.map((step) => /* @__PURE__ */ jsx8(
|
|
2792
|
+
StepItem,
|
|
2793
|
+
{
|
|
2794
|
+
step,
|
|
2795
|
+
subagents: subagents.filter((s) => s.stepId === step.id),
|
|
2796
|
+
approvals: approvals.filter((a) => a.stepId === step.id && a.status !== "pending"),
|
|
2797
|
+
notes: showNotes ? notes.filter((n) => n.stepId === step.id) : [],
|
|
2798
|
+
onStopSubagent,
|
|
2799
|
+
showToolCalls,
|
|
2800
|
+
showUsage,
|
|
2801
|
+
showThoughts,
|
|
2802
|
+
renderToolCall,
|
|
2803
|
+
L
|
|
2804
|
+
},
|
|
2805
|
+
step.id
|
|
2806
|
+
)),
|
|
2807
|
+
atEnd.length > 0 && /* @__PURE__ */ jsx8("li", { className: "awr-step awr-step--notes", children: /* @__PURE__ */ jsx8("ul", { className: "awr-notes", children: atEnd.map((n) => /* @__PURE__ */ jsx8(UserNoteRow, { note: n }, n.id)) }) })
|
|
2808
|
+
] });
|
|
2642
2809
|
};
|
|
2643
2810
|
|
|
2644
2811
|
// src/components/MessageList.tsx
|
|
@@ -2674,6 +2841,8 @@ var MessageList = ({
|
|
|
2674
2841
|
showToolCalls = true,
|
|
2675
2842
|
showUsage = true,
|
|
2676
2843
|
showThoughts = true,
|
|
2844
|
+
showNotes = true,
|
|
2845
|
+
onStopSubagent,
|
|
2677
2846
|
activityOpen = false,
|
|
2678
2847
|
liveExtra,
|
|
2679
2848
|
renderContent,
|
|
@@ -2705,6 +2874,9 @@ var MessageList = ({
|
|
|
2705
2874
|
steps,
|
|
2706
2875
|
subagents: m.subagents,
|
|
2707
2876
|
approvals: m.approvals,
|
|
2877
|
+
notes: m.notes,
|
|
2878
|
+
showNotes,
|
|
2879
|
+
onStopSubagent: m.pending ? onStopSubagent : void 0,
|
|
2708
2880
|
showToolCalls,
|
|
2709
2881
|
showUsage,
|
|
2710
2882
|
showThoughts,
|
|
@@ -2846,6 +3018,8 @@ var AgentChatInner = ({
|
|
|
2846
3018
|
showToolCalls = true,
|
|
2847
3019
|
showUsage = true,
|
|
2848
3020
|
showThoughts = true,
|
|
3021
|
+
showNotes = true,
|
|
3022
|
+
stoppableSubagents = true,
|
|
2849
3023
|
showTotalUsage = true,
|
|
2850
3024
|
showStatus = true,
|
|
2851
3025
|
showApprovalMode = true,
|
|
@@ -3028,6 +3202,8 @@ var AgentChatInner = ({
|
|
|
3028
3202
|
showToolCalls,
|
|
3029
3203
|
showUsage,
|
|
3030
3204
|
showThoughts,
|
|
3205
|
+
showNotes,
|
|
3206
|
+
onStopSubagent: stoppableSubagents ? agent.stopSubagent : void 0,
|
|
3031
3207
|
activityOpen,
|
|
3032
3208
|
liveExtra,
|
|
3033
3209
|
renderContent,
|
|
@@ -3325,6 +3501,7 @@ import {
|
|
|
3325
3501
|
defineSkill,
|
|
3326
3502
|
parseSkillMarkdown,
|
|
3327
3503
|
loadSkillFromUrl,
|
|
3504
|
+
createRunControl as createRunControl2,
|
|
3328
3505
|
createSubagentTool,
|
|
3329
3506
|
serveSubagentWorker,
|
|
3330
3507
|
markReadOnly,
|
|
@@ -3369,6 +3546,7 @@ export {
|
|
|
3369
3546
|
ToolApprovalPrompt,
|
|
3370
3547
|
ToolCallRow,
|
|
3371
3548
|
UsageBadge,
|
|
3549
|
+
UserNoteRow,
|
|
3372
3550
|
VaultCredentialStore2 as VaultCredentialStore,
|
|
3373
3551
|
VirtualFileSystem,
|
|
3374
3552
|
agentStateReducer,
|
|
@@ -3378,6 +3556,7 @@ export {
|
|
|
3378
3556
|
createAgent2 as createAgent,
|
|
3379
3557
|
createFileTools,
|
|
3380
3558
|
createInitialAgentState,
|
|
3559
|
+
createRunControl2 as createRunControl,
|
|
3381
3560
|
createSubagentTool,
|
|
3382
3561
|
createWebLLMEngine,
|
|
3383
3562
|
createWebLLMModel2 as createWebLLMModel,
|
|
@@ -3397,6 +3576,7 @@ export {
|
|
|
3397
3576
|
parseSlash,
|
|
3398
3577
|
preloadWebLLMModel2 as preloadWebLLMModel,
|
|
3399
3578
|
serveSubagentWorker,
|
|
3579
|
+
steerIntent,
|
|
3400
3580
|
supportsImages,
|
|
3401
3581
|
supportsPdf,
|
|
3402
3582
|
unloadWebLLMModel2 as unloadWebLLMModel,
|