@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 CHANGED
@@ -170,6 +170,7 @@ function Custom() {
170
170
  | --- | --- |
171
171
  | `run(goal, { images, files, attachments, label })` | Start a run (with attachments); resolves with the `RunResult` |
172
172
  | `stop()` | Abort the in-flight run |
173
+ | `send(text)`, `stopSubagent(id)` | Say something to the running agent (shown to the model at its next boundary; the replanner re-checks the plan) / stop one subagent. `queued`, `notes` and `undelivered` show where a message is — see [docs/chat.md](docs/chat.md#talking-to-the-agent-while-it-works) |
173
174
  | `reset()` | Clear the whole conversation (and the agent's memory of it) |
174
175
  | `reload()` | Rebuild the agent (e.g. after storing a new key) |
175
176
  | `status` | `idle` \| `initializing` \| `ready` \| `running` \| `error` |
package/dist/index.cjs CHANGED
@@ -45,6 +45,7 @@ __export(src_exports, {
45
45
  ToolApprovalPrompt: () => ToolApprovalPrompt,
46
46
  ToolCallRow: () => ToolCallRow,
47
47
  UsageBadge: () => UsageBadge,
48
+ UserNoteRow: () => UserNoteRow,
48
49
  VaultCredentialStore: () => import_agent_web4.VaultCredentialStore,
49
50
  VirtualFileSystem: () => import_agent_web4.VirtualFileSystem,
50
51
  agentStateReducer: () => agentStateReducer,
@@ -54,6 +55,7 @@ __export(src_exports, {
54
55
  createAgent: () => import_agent_web4.createAgent,
55
56
  createFileTools: () => import_agent_web4.createFileTools,
56
57
  createInitialAgentState: () => createInitialAgentState,
58
+ createRunControl: () => import_agent_web4.createRunControl,
57
59
  createSubagentTool: () => import_agent_web4.createSubagentTool,
58
60
  createWebLLMEngine: () => createWebLLMEngine,
59
61
  createWebLLMModel: () => import_agent_web4.createWebLLMModel,
@@ -73,6 +75,7 @@ __export(src_exports, {
73
75
  parseSlash: () => parseSlash,
74
76
  preloadWebLLMModel: () => import_agent_web4.preloadWebLLMModel,
75
77
  serveSubagentWorker: () => import_agent_web4.serveSubagentWorker,
78
+ steerIntent: () => steerIntent,
76
79
  supportsImages: () => import_agent_web4.supportsImages,
77
80
  supportsPdf: () => import_agent_web4.supportsPdf,
78
81
  unloadWebLLMModel: () => import_agent_web4.unloadWebLLMModel,
@@ -135,6 +138,9 @@ var createInitialAgentState = () => ({
135
138
  runMessageId: void 0,
136
139
  approvals: [],
137
140
  subagents: [],
141
+ queued: [],
142
+ notes: [],
143
+ undelivered: [],
138
144
  skills: [],
139
145
  discoveredTools: [],
140
146
  compactions: [],
@@ -238,7 +244,16 @@ var applyEvent = (state, event, ctx) => {
238
244
  planThought: state.planThought || event.plan.thought
239
245
  };
240
246
  case "plan.revised":
241
- return { ...state, plan: event.plan, replan: { mode: "revise", reason: event.reason } };
247
+ return {
248
+ ...state,
249
+ plan: event.plan,
250
+ // `replan.decision` came first: keep its "because the user spoke" flag.
251
+ replan: {
252
+ mode: "revise",
253
+ reason: event.reason,
254
+ ...state.replan?.byUser ? { byUser: true } : {}
255
+ }
256
+ };
242
257
  case "plan.step-added":
243
258
  return state;
244
259
  case "step.start": {
@@ -338,7 +353,27 @@ var applyEvent = (state, event, ctx) => {
338
353
  }))
339
354
  };
340
355
  case "replan.decision":
341
- return { ...state, replan: { mode: event.mode, reason: event.reason } };
356
+ return {
357
+ ...state,
358
+ replan: {
359
+ mode: event.mode,
360
+ reason: event.reason,
361
+ ...event.byUser ? { byUser: true } : {}
362
+ }
363
+ };
364
+ case "message.queued":
365
+ return state.queued.some((q) => q.id === event.id) ? state : { ...state, queued: [...state.queued, { id: event.id, text: event.text }] };
366
+ case "message.delivered": {
367
+ const anchor = event.at === "round" ? runningStepId(state.steps) : event.at === "step" ? state.steps[state.steps.length - 1]?.id : void 0;
368
+ return {
369
+ ...state,
370
+ queued: state.queued.filter((q) => q.id !== event.id),
371
+ notes: [
372
+ ...state.notes,
373
+ { id: event.id, text: event.text, at: event.at, ...anchor ? { stepId: anchor } : {} }
374
+ ]
375
+ };
376
+ }
342
377
  case "final.text-delta": {
343
378
  const finalText = state.finalText + event.delta;
344
379
  return { ...state, finalText, messages: streamAssistant(state.messages, finalText) };
@@ -408,6 +443,7 @@ var applyEvent = (state, event, ctx) => {
408
443
  name: event.name,
409
444
  task: event.task,
410
445
  status: "running",
446
+ ...event.profile ? { profile: event.profile } : {},
411
447
  stepId: runningStepId(state.steps),
412
448
  activity: "starting",
413
449
  steps: 0,
@@ -442,8 +478,8 @@ var applyEvent = (state, event, ctx) => {
442
478
  ...state,
443
479
  subagents: patchSubagent(state.subagents, event.id, (s) => ({
444
480
  ...s,
445
- status: "error",
446
- activity: "failed",
481
+ status: event.stopped ? "stopped" : "error",
482
+ activity: event.stopped ? "stopped" : "failed",
447
483
  error: event.error
448
484
  }))
449
485
  };
@@ -504,6 +540,7 @@ var syncRunMessage = (state) => {
504
540
  const patch = {};
505
541
  if (m.steps !== state.steps) patch.steps = state.steps;
506
542
  if (m.subagents !== state.subagents) patch.subagents = state.subagents;
543
+ if (state.notes.length > 0 && m.notes !== state.notes) patch.notes = state.notes;
507
544
  if (m.usage !== state.usage) patch.usage = state.usage;
508
545
  if ((m.reasoning ?? "") !== state.finalReasoning) patch.reasoning = state.finalReasoning;
509
546
  if (m.skills !== state.skills) patch.skills = state.skills;
@@ -533,6 +570,8 @@ var agentStateReducer = (state, action) => {
533
570
  const events = cap > 0 ? [...state.events, action.event].slice(-cap) : [...state.events, action.event];
534
571
  return { ...next, events };
535
572
  }
573
+ case "undelivered":
574
+ return { ...state, queued: [], undelivered: action.texts };
536
575
  case "load": {
537
576
  const maxSeq = action.messages.reduce((n, m) => {
538
577
  const k = Number(/^msg-(\d+)$/.exec(m.id)?.[1] ?? -1);
@@ -559,6 +598,9 @@ var useAgent = (config, options = {}) => {
559
598
  const [state, dispatch] = (0, import_react.useReducer)(agentStateReducer, void 0, createInitialAgentState);
560
599
  const agentRef = (0, import_react.useRef)(void 0);
561
600
  const abortRef = (0, import_react.useRef)(void 0);
601
+ const controlRef = (0, import_react.useRef)(void 0);
602
+ const stateRef = (0, import_react.useRef)(state);
603
+ stateRef.current = state;
562
604
  const [generation, setGeneration] = (0, import_react.useState)(0);
563
605
  const configRef = (0, import_react.useRef)(config);
564
606
  configRef.current = config;
@@ -631,16 +673,21 @@ var useAgent = (config, options = {}) => {
631
673
  },
632
674
  [settleAll]
633
675
  );
676
+ const runRef = (0, import_react.useRef)(void 0);
634
677
  const run = (0, import_react.useCallback)(
635
678
  async (goal, runOptions) => {
636
679
  const agent = agentRef.current;
637
680
  if (!agent || abortRef.current) return void 0;
638
681
  const controller = new AbortController();
639
682
  abortRef.current = controller;
683
+ const control = (0, import_agent_web.createRunControl)();
684
+ controlRef.current = control;
685
+ let left = [];
640
686
  dispatch({ type: "status", status: "running" });
641
687
  try {
642
- return await agent.run(goal, {
688
+ const result = await agent.run(goal, {
643
689
  signal: controller.signal,
690
+ control,
644
691
  sessionId: sessionRef.current,
645
692
  ...runOptions?.images?.length ? { images: runOptions.images } : {},
646
693
  ...runOptions?.files?.length ? { files: runOptions.files } : {},
@@ -660,7 +707,10 @@ var useAgent = (config, options = {}) => {
660
707
  }
661
708
  }
662
709
  });
710
+ left = result.undelivered ?? [];
711
+ return result;
663
712
  } catch (err) {
713
+ left = control.pending();
664
714
  dispatch({
665
715
  type: "event",
666
716
  event: { type: "error", phase: "run", error: errMessage(err) },
@@ -669,12 +719,36 @@ var useAgent = (config, options = {}) => {
669
719
  return void 0;
670
720
  } finally {
671
721
  abortRef.current = void 0;
722
+ controlRef.current = void 0;
672
723
  settleAll({ approved: false, reason: "the run ended" });
673
724
  dispatch({ type: "status", ...buildStatusRef.current });
725
+ if (left.length > 0) {
726
+ if (!controller.signal.aborted && optionsRef.current.followUp !== false) {
727
+ dispatch({ type: "undelivered", texts: [] });
728
+ void runRef.current?.(left.join("\n\n"));
729
+ } else {
730
+ dispatch({ type: "undelivered", texts: left });
731
+ }
732
+ } else {
733
+ dispatch({ type: "undelivered", texts: [] });
734
+ }
674
735
  }
675
736
  },
676
737
  [settleAll]
677
738
  );
739
+ runRef.current = run;
740
+ const send = (0, import_react.useCallback)((text) => controlRef.current?.send(text) ?? false, []);
741
+ const stopSubagent = (0, import_react.useCallback)(
742
+ (id) => controlRef.current?.stopSubagent(id) ?? false,
743
+ []
744
+ );
745
+ const sendUndelivered = (0, import_react.useCallback)(() => {
746
+ const texts = stateRef.current.undelivered;
747
+ if (texts.length === 0) return;
748
+ dispatch({ type: "undelivered", texts: [] });
749
+ void runRef.current?.(texts.join("\n\n"));
750
+ }, []);
751
+ const discardUndelivered = (0, import_react.useCallback)(() => dispatch({ type: "undelivered", texts: [] }), []);
678
752
  const stop = (0, import_react.useCallback)(() => {
679
753
  abortRef.current?.abort();
680
754
  settleAll({ approved: false, reason: "stopped by the user" });
@@ -728,6 +802,10 @@ var useAgent = (config, options = {}) => {
728
802
  ...state,
729
803
  run,
730
804
  stop,
805
+ send,
806
+ stopSubagent,
807
+ sendUndelivered,
808
+ discardUndelivered,
731
809
  reset,
732
810
  reload,
733
811
  agent: agentRef.current,
@@ -1193,6 +1271,13 @@ var parseSlash = (text) => {
1193
1271
  const m = /^\/([\w-]*)(?:\s+([\s\S]*))?$/.exec(text.trimStart());
1194
1272
  return m ? { name: m[1].toLowerCase(), args: (m[2] ?? "").trim() } : void 0;
1195
1273
  };
1274
+ var steerIntent = (input) => {
1275
+ if (!input.busy) return "idle";
1276
+ if (!input.steering) return "ignore";
1277
+ if (!input.raw && !input.hasAttachments) return "ignore";
1278
+ if (parseSlash(input.raw)) return "ignore";
1279
+ return input.hasAttachments ? "attachments" : "steer";
1280
+ };
1196
1281
  var filterCommands = (commands, query) => {
1197
1282
  const q = query.toLowerCase();
1198
1283
  if (!q) return commands;
@@ -1390,6 +1475,20 @@ var defaultLabels = {
1390
1475
  consentWaiting: "waiting for your consent",
1391
1476
  consentAllowed: "allowed",
1392
1477
  consentDenied: (reason) => `denied${reason ? ` \u2014 ${reason}` : ""}`,
1478
+ placeholderBusy: "Tell the agent something while it works\u2026",
1479
+ steer: "Send to the agent",
1480
+ noAttachmentsWhileBusy: "Files can\u2019t be added while the agent is working \u2014 send them with your next message.",
1481
+ queuedWaiting: "waiting for the agent\u2019s next step",
1482
+ noteAt: {
1483
+ round: "you said, between tool calls",
1484
+ step: "you said, after this step",
1485
+ final: "you said, before the answer"
1486
+ },
1487
+ undelivered: (n) => `Not delivered (${plural(n, "message", "messages")})`,
1488
+ sendUndelivered: "Send now",
1489
+ discardUndelivered: "Discard",
1490
+ stopSubagent: "Stop this subagent",
1491
+ subagentStopped: "stopped",
1393
1492
  failed: "failed",
1394
1493
  toolCostTitle: "Estimated tokens of the arguments and of the result fed back to the model (chars / 4), and the call's duration"
1395
1494
  };
@@ -1398,7 +1497,8 @@ var NESTED = [
1398
1497
  "modes",
1399
1498
  "commandGroups",
1400
1499
  "commandDescriptions",
1401
- "thinkingLevels"
1500
+ "thinkingLevels",
1501
+ "noteAt"
1402
1502
  ];
1403
1503
  var mergeLabels = (base2, over) => {
1404
1504
  if (!over) return base2;
@@ -1633,6 +1733,8 @@ var AgentComposer = ({
1633
1733
  showAgents = true,
1634
1734
  showApprovalMode = true,
1635
1735
  showNotices = true,
1736
+ steering = true,
1737
+ showQueued = true,
1636
1738
  compactWidth = 460,
1637
1739
  toolbarExtra,
1638
1740
  toolbarEnd,
@@ -1910,7 +2012,17 @@ var AgentComposer = ({
1910
2012
  }, [attachments, dropZone]);
1911
2013
  const submit = () => {
1912
2014
  const raw = text.trim();
1913
- if (busy || !ready) return;
2015
+ const intent = steerIntent({ raw, busy, steering, hasAttachments: pending.length > 0 });
2016
+ if (intent === "steer") {
2017
+ if (agent.send(raw)) setText("");
2018
+ return;
2019
+ }
2020
+ if (intent === "attachments") {
2021
+ setAttachError(L.noAttachmentsWhileBusy);
2022
+ return;
2023
+ }
2024
+ if (intent === "ignore") return;
2025
+ if (!ready) return;
1914
2026
  const parsed = parseSlash(raw);
1915
2027
  if (parsed) {
1916
2028
  const cmd = allCommands.find((c) => c.name === parsed.name);
@@ -2008,6 +2120,24 @@ var AgentComposer = ({
2008
2120
  const thinkingOptions = thinking?.options ?? DEFAULT_THINKING;
2009
2121
  const thinkingLabel = thinking ? thinkingOptions.find((o) => o.id === thinking.value)?.label ?? thinking.value : void 0;
2010
2122
  const canSend = ready && (text.trim().length > 0 || pending.length > 0);
2123
+ const canSteer = busy && steering && text.trim().length > 0;
2124
+ const queuedStrip = showQueued && (agent.queued.length > 0 || agent.undelivered.length > 0) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "awr-queued", children: [
2125
+ agent.queued.map((q) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "awr-queued__item", role: "status", children: [
2126
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ClockIcon, { size: 13, className: "awr-queued__icon" }),
2127
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "awr-queued__text", title: q.text, children: q.text }),
2128
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "awr-queued__state", children: L.queuedWaiting })
2129
+ ] }, q.id)),
2130
+ agent.undelivered.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "awr-queued__item awr-queued__item--undelivered", role: "status", children: [
2131
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AlertIcon, { size: 13, className: "awr-queued__icon" }),
2132
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "awr-queued__text", title: agent.undelivered.join("\n\n"), children: [
2133
+ L.undelivered(agent.undelivered.length),
2134
+ ": ",
2135
+ agent.undelivered.join(" \xB7 ")
2136
+ ] }),
2137
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "awr-linkbtn", onClick: agent.sendUndelivered, children: L.sendUndelivered }),
2138
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "awr-linkbtn", onClick: agent.discardUndelivered, children: L.discardUndelivered })
2139
+ ] })
2140
+ ] }) : null;
2011
2141
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2012
2142
  "div",
2013
2143
  {
@@ -2020,6 +2150,7 @@ var AgentComposer = ({
2020
2150
  ref: rootRef,
2021
2151
  children: [
2022
2152
  dragging && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "awr-dropnote", style: dropRect, "aria-hidden": "true", children: L.dropHint }),
2153
+ queuedStrip,
2023
2154
  notices.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "awr-notices", children: notices.map((n) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `awr-notice awr-notice--${n.tone}`, role: "status", children: [
2024
2155
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: n.text }),
2025
2156
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
@@ -2092,7 +2223,7 @@ var AgentComposer = ({
2092
2223
  onChange: (e) => setText(e.target.value),
2093
2224
  onKeyDown,
2094
2225
  onPaste,
2095
- placeholder: stt.listening ? L.listening : placeholder ?? L.placeholder,
2226
+ placeholder: stt.listening ? L.listening : busy && steering ? L.placeholderBusy : placeholder ?? L.placeholder,
2096
2227
  disabled,
2097
2228
  rows: 2,
2098
2229
  "aria-label": L.message
@@ -2269,6 +2400,7 @@ var AgentComposer = ({
2269
2400
  ))
2270
2401
  ] })
2271
2402
  ] }),
2403
+ canSteer && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "awr-sendbtn", onClick: submit, "aria-label": L.steer, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SendIcon, { size: 16 }) }),
2272
2404
  busy ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2273
2405
  "button",
2274
2406
  {
@@ -2643,6 +2775,7 @@ var ToolCallRow = ({ call, showUsage = true, labels }) => {
2643
2775
  };
2644
2776
  var SubagentRow = ({
2645
2777
  sub,
2778
+ onStop,
2646
2779
  labels
2647
2780
  }) => {
2648
2781
  const L = useLabels(labels);
@@ -2650,10 +2783,33 @@ var SubagentRow = ({
2650
2783
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "awr-subagent__head", children: [
2651
2784
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BotIcon, { size: 13, className: "awr-subagent__icon" }),
2652
2785
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "awr-subagent__name", children: sub.name }),
2786
+ sub.profile && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "awr-subagent__profile", children: sub.profile }),
2653
2787
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "awr-subagent__task", title: sub.task, children: previewValue(sub.task, 90) }),
2654
- sub.status === "running" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SpinnerIcon, { size: 12, className: "awr-tool__spin" })
2788
+ sub.status === "running" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SpinnerIcon, { size: 12, className: "awr-tool__spin" }),
2789
+ sub.status === "running" && onStop && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2790
+ "button",
2791
+ {
2792
+ type: "button",
2793
+ className: "awr-iconbtn awr-subagent__stop",
2794
+ "aria-label": L.stopSubagent,
2795
+ title: L.stopSubagent,
2796
+ onClick: () => onStop(sub.id),
2797
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(StopIcon, { size: 12 })
2798
+ }
2799
+ )
2655
2800
  ] }),
2656
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("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)}` : ""}` })
2801
+ /* @__PURE__ */ (0, import_jsx_runtime8.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}${sub.toolCalls ? ` \xB7 ${L.toolCalls(sub.toolCalls)}` : ""}` })
2802
+ ] });
2803
+ };
2804
+ var UserNoteRow = ({
2805
+ note,
2806
+ labels
2807
+ }) => {
2808
+ const L = useLabels(labels);
2809
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("li", { className: `awr-note awr-note--${note.at}`, children: [
2810
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SendIcon, { size: 12, className: "awr-note__icon" }),
2811
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "awr-note__where", children: L.noteAt[note.at] }),
2812
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("q", { className: "awr-note__text", children: note.text })
2657
2813
  ] });
2658
2814
  };
2659
2815
  var decisionLabel = (a, L) => a.status === "pending" ? L.consentWaiting : a.status === "approved" ? L.consentAllowed : L.consentDenied(a.reason);
@@ -2661,6 +2817,8 @@ var StepItem = ({
2661
2817
  step,
2662
2818
  subagents,
2663
2819
  approvals,
2820
+ notes,
2821
+ onStopSubagent,
2664
2822
  showToolCalls,
2665
2823
  showUsage,
2666
2824
  showThoughts,
@@ -2694,13 +2852,17 @@ var StepItem = ({
2694
2852
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("code", { className: "awr-tool__name", children: a.name }),
2695
2853
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "awr-tool__args", children: decisionLabel(a, L) })
2696
2854
  ] }, a.id)) }),
2697
- subagents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "awr-subagents", children: subagents.map((sub) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SubagentRow, { sub }, sub.id)) }),
2855
+ subagents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "awr-subagents", children: subagents.map((sub) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SubagentRow, { sub, onStop: onStopSubagent }, sub.id)) }),
2856
+ notes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "awr-notes", children: notes.map((n) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(UserNoteRow, { note: n }, n.id)) }),
2698
2857
  step.blocked && step.summary && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "awr-step__blocked", children: step.summary })
2699
2858
  ] });
2700
2859
  var StepList = ({
2701
2860
  steps,
2702
2861
  subagents = [],
2703
2862
  approvals = [],
2863
+ notes = [],
2864
+ showNotes = true,
2865
+ onStopSubagent,
2704
2866
  showToolCalls = true,
2705
2867
  showUsage = true,
2706
2868
  showThoughts = true,
@@ -2710,20 +2872,27 @@ var StepList = ({
2710
2872
  }) => {
2711
2873
  const L = useLabels(labels);
2712
2874
  if (steps.length === 0) return null;
2713
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ol", { className: ["awr-steps", className].filter(Boolean).join(" "), children: steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2714
- StepItem,
2715
- {
2716
- step,
2717
- subagents: subagents.filter((s) => s.stepId === step.id),
2718
- approvals: approvals.filter((a) => a.stepId === step.id && a.status !== "pending"),
2719
- showToolCalls,
2720
- showUsage,
2721
- showThoughts,
2722
- renderToolCall,
2723
- L
2724
- },
2725
- step.id
2726
- )) });
2875
+ const known = new Set(steps.map((s) => s.id));
2876
+ const atEnd = showNotes ? notes.filter((n) => !n.stepId || !known.has(n.stepId)) : [];
2877
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("ol", { className: ["awr-steps", className].filter(Boolean).join(" "), children: [
2878
+ steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2879
+ StepItem,
2880
+ {
2881
+ step,
2882
+ subagents: subagents.filter((s) => s.stepId === step.id),
2883
+ approvals: approvals.filter((a) => a.stepId === step.id && a.status !== "pending"),
2884
+ notes: showNotes ? notes.filter((n) => n.stepId === step.id) : [],
2885
+ onStopSubagent,
2886
+ showToolCalls,
2887
+ showUsage,
2888
+ showThoughts,
2889
+ renderToolCall,
2890
+ L
2891
+ },
2892
+ step.id
2893
+ )),
2894
+ atEnd.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { className: "awr-step awr-step--notes", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "awr-notes", children: atEnd.map((n) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(UserNoteRow, { note: n }, n.id)) }) })
2895
+ ] });
2727
2896
  };
2728
2897
 
2729
2898
  // src/components/MessageList.tsx
@@ -2759,6 +2928,8 @@ var MessageList = ({
2759
2928
  showToolCalls = true,
2760
2929
  showUsage = true,
2761
2930
  showThoughts = true,
2931
+ showNotes = true,
2932
+ onStopSubagent,
2762
2933
  activityOpen = false,
2763
2934
  liveExtra,
2764
2935
  renderContent,
@@ -2790,6 +2961,9 @@ var MessageList = ({
2790
2961
  steps,
2791
2962
  subagents: m.subagents,
2792
2963
  approvals: m.approvals,
2964
+ notes: m.notes,
2965
+ showNotes,
2966
+ onStopSubagent: m.pending ? onStopSubagent : void 0,
2793
2967
  showToolCalls,
2794
2968
  showUsage,
2795
2969
  showThoughts,
@@ -2931,6 +3105,8 @@ var AgentChatInner = ({
2931
3105
  showToolCalls = true,
2932
3106
  showUsage = true,
2933
3107
  showThoughts = true,
3108
+ showNotes = true,
3109
+ stoppableSubagents = true,
2934
3110
  showTotalUsage = true,
2935
3111
  showStatus = true,
2936
3112
  showApprovalMode = true,
@@ -3113,6 +3289,8 @@ var AgentChatInner = ({
3113
3289
  showToolCalls,
3114
3290
  showUsage,
3115
3291
  showThoughts,
3292
+ showNotes,
3293
+ onStopSubagent: stoppableSubagents ? agent.stopSubagent : void 0,
3116
3294
  activityOpen,
3117
3295
  liveExtra,
3118
3296
  renderContent,
@@ -3432,6 +3610,7 @@ var import_agent_web4 = require("@dudko.dev/agent-web");
3432
3610
  ToolApprovalPrompt,
3433
3611
  ToolCallRow,
3434
3612
  UsageBadge,
3613
+ UserNoteRow,
3435
3614
  VaultCredentialStore,
3436
3615
  VirtualFileSystem,
3437
3616
  agentStateReducer,
@@ -3441,6 +3620,7 @@ var import_agent_web4 = require("@dudko.dev/agent-web");
3441
3620
  createAgent,
3442
3621
  createFileTools,
3443
3622
  createInitialAgentState,
3623
+ createRunControl,
3444
3624
  createSubagentTool,
3445
3625
  createWebLLMEngine,
3446
3626
  createWebLLMModel,
@@ -3460,6 +3640,7 @@ var import_agent_web4 = require("@dudko.dev/agent-web");
3460
3640
  parseSlash,
3461
3641
  preloadWebLLMModel,
3462
3642
  serveSubagentWorker,
3643
+ steerIntent,
3463
3644
  supportsImages,
3464
3645
  supportsPdf,
3465
3646
  unloadWebLLMModel,