@tangle-network/agent-app 0.63.60 → 0.63.62

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.
Files changed (105) hide show
  1. package/dist/{DesignCanvas-Q65UV4D5.js → DesignCanvas-566V5KVC.js} +3 -2
  2. package/dist/{DesignCanvasEditor-THEFESEX.js → DesignCanvasEditor-6XNHSREG.js} +5 -4
  3. package/dist/agent-profiles/d1.js +3 -3
  4. package/dist/agent-profiles/index.js +3 -3
  5. package/dist/app-auth/index.js +2 -1
  6. package/dist/app-auth/index.js.map +1 -1
  7. package/dist/assistant/index.js +6 -5
  8. package/dist/assistant/index.js.map +1 -1
  9. package/dist/chat-react/index.js +3 -3
  10. package/dist/chat-routes/agent-producers.d.ts +39 -0
  11. package/dist/chat-routes/dispatch-parts.d.ts +24 -2
  12. package/dist/chat-routes/hybrid-producer.d.ts +6 -2
  13. package/dist/chat-routes/index.d.ts +1 -0
  14. package/dist/chat-routes/index.js +31 -12
  15. package/dist/chat-routes/index.js.map +1 -1
  16. package/dist/chat-routes/turn-admission.d.ts +3 -3
  17. package/dist/chat-routes/turn-route-contracts.d.ts +39 -1
  18. package/dist/chat-routes/wire.d.ts +35 -4
  19. package/dist/chat-store/index.js +4 -2
  20. package/dist/chat-store/index.js.map +1 -1
  21. package/dist/chat-store/parts.d.ts +19 -3
  22. package/dist/{chunk-6XSQCP6W.js → chunk-43CV4JIT.js} +2 -2
  23. package/dist/{chunk-SFZELD6V.js → chunk-4JTEPK2G.js} +2 -2
  24. package/dist/{chunk-RILVJYXJ.js → chunk-5ERXADSW.js} +2 -2
  25. package/dist/{chunk-LAZCUQFZ.js → chunk-73AVOSH6.js} +179 -86
  26. package/dist/chunk-73AVOSH6.js.map +1 -0
  27. package/dist/{chunk-HHPQMFKP.js → chunk-7O62NYGT.js} +2 -2
  28. package/dist/{chunk-GGJYAV7R.js → chunk-AHBVQRJA.js} +2 -2
  29. package/dist/{chunk-GGJYAV7R.js.map → chunk-AHBVQRJA.js.map} +1 -1
  30. package/dist/{chunk-UTF7H6BK.js → chunk-EUQ46YWK.js} +15 -15
  31. package/dist/chunk-EUQ46YWK.js.map +1 -0
  32. package/dist/{chunk-PIGW5LRM.js → chunk-FJRQCF43.js} +3 -3
  33. package/dist/{chunk-AICYKYYF.js → chunk-GAYWV565.js} +17 -4
  34. package/dist/chunk-GAYWV565.js.map +1 -0
  35. package/dist/{chunk-5C3RXQQ7.js → chunk-H3DAXUKV.js} +2 -2
  36. package/dist/{chunk-SRA7VAVK.js → chunk-HJYEK4SU.js} +2 -2
  37. package/dist/{chunk-P7UB7ZVP.js → chunk-IAK227OO.js} +2 -2
  38. package/dist/{chunk-QGJOT6R6.js → chunk-K2JPSXKI.js} +54 -9
  39. package/dist/{chunk-QGJOT6R6.js.map → chunk-K2JPSXKI.js.map} +1 -1
  40. package/dist/{chunk-QFIVY6WA.js → chunk-NJW4JCSF.js} +2 -2
  41. package/dist/{chunk-IDQ7N36R.js → chunk-Q55WW6DO.js} +15 -15
  42. package/dist/{chunk-H6BRJU5M.js → chunk-RKNNMC6T.js} +1 -1
  43. package/dist/{chunk-KFO5R4SN.js → chunk-RYKANV3P.js} +945 -801
  44. package/dist/chunk-RYKANV3P.js.map +1 -0
  45. package/dist/{chunk-4E2MUVGL.js → chunk-VQIH5NAB.js} +3 -3
  46. package/dist/chunk-XBBXPZJI.js +47 -0
  47. package/dist/chunk-XBBXPZJI.js.map +1 -0
  48. package/dist/{chunk-DCGATWZ5.js → chunk-XPB2UYHU.js} +5 -5
  49. package/dist/{chunk-DCGATWZ5.js.map → chunk-XPB2UYHU.js.map} +1 -1
  50. package/dist/design-canvas/index.js +2 -1
  51. package/dist/design-canvas/index.js.map +1 -1
  52. package/dist/design-canvas-react/engine.js +2 -1
  53. package/dist/design-canvas-react/index.js +5 -4
  54. package/dist/design-canvas-react/index.js.map +1 -1
  55. package/dist/design-canvas-react/lazy.js +1 -1
  56. package/dist/operator/index.js +2 -2
  57. package/dist/platform/index.js +2 -1
  58. package/dist/platform/index.js.map +1 -1
  59. package/dist/preset-cloudflare/index.js +6 -6
  60. package/dist/public-consultation/index.d.ts +2 -2
  61. package/dist/public-consultation/index.js +11 -10
  62. package/dist/public-consultation/index.js.map +1 -1
  63. package/dist/sandbox/index.js +6 -6
  64. package/dist/sequences/index.js +2 -1
  65. package/dist/sequences/index.js.map +1 -1
  66. package/dist/stories/chat/fixtures.d.ts +4 -0
  67. package/dist/theme/brand.generated.d.ts +15 -15
  68. package/dist/theme/dom.js +2 -2
  69. package/dist/theme/index.js +1 -1
  70. package/dist/theme/tokens.css +210 -356
  71. package/dist/tools/index.js +4 -4
  72. package/dist/web/index.d.ts +1 -0
  73. package/dist/web/index.js +7 -1
  74. package/dist/web/speakers.d.ts +30 -0
  75. package/dist/web-react/chat-messages.d.ts +1 -1
  76. package/dist/web-react/chat-stream.d.ts +7 -0
  77. package/dist/web-react/document.js +2 -2
  78. package/dist/web-react/entry-composer.d.ts +2 -2
  79. package/dist/web-react/index.d.ts +3 -0
  80. package/dist/web-react/index.js +18 -5
  81. package/dist/web-react/message-projection.d.ts +19 -0
  82. package/dist/web-react/use-file-mentions.d.ts +23 -4
  83. package/dist/work-product/index.js +2 -2
  84. package/dist/workspace-react/index.d.ts +29 -1
  85. package/dist/workspace-react/index.js +34 -0
  86. package/dist/workspace-react/index.js.map +1 -1
  87. package/package.json +4 -4
  88. package/dist/chunk-AICYKYYF.js.map +0 -1
  89. package/dist/chunk-KFO5R4SN.js.map +0 -1
  90. package/dist/chunk-LAZCUQFZ.js.map +0 -1
  91. package/dist/chunk-UTF7H6BK.js.map +0 -1
  92. /package/dist/{DesignCanvas-Q65UV4D5.js.map → DesignCanvas-566V5KVC.js.map} +0 -0
  93. /package/dist/{DesignCanvasEditor-THEFESEX.js.map → DesignCanvasEditor-6XNHSREG.js.map} +0 -0
  94. /package/dist/{chunk-6XSQCP6W.js.map → chunk-43CV4JIT.js.map} +0 -0
  95. /package/dist/{chunk-SFZELD6V.js.map → chunk-4JTEPK2G.js.map} +0 -0
  96. /package/dist/{chunk-RILVJYXJ.js.map → chunk-5ERXADSW.js.map} +0 -0
  97. /package/dist/{chunk-HHPQMFKP.js.map → chunk-7O62NYGT.js.map} +0 -0
  98. /package/dist/{chunk-PIGW5LRM.js.map → chunk-FJRQCF43.js.map} +0 -0
  99. /package/dist/{chunk-5C3RXQQ7.js.map → chunk-H3DAXUKV.js.map} +0 -0
  100. /package/dist/{chunk-SRA7VAVK.js.map → chunk-HJYEK4SU.js.map} +0 -0
  101. /package/dist/{chunk-P7UB7ZVP.js.map → chunk-IAK227OO.js.map} +0 -0
  102. /package/dist/{chunk-QFIVY6WA.js.map → chunk-NJW4JCSF.js.map} +0 -0
  103. /package/dist/{chunk-IDQ7N36R.js.map → chunk-Q55WW6DO.js.map} +0 -0
  104. /package/dist/{chunk-H6BRJU5M.js.map → chunk-RKNNMC6T.js.map} +0 -0
  105. /package/dist/{chunk-4E2MUVGL.js.map → chunk-VQIH5NAB.js.map} +0 -0
@@ -50,9 +50,12 @@ import {
50
50
  import {
51
51
  AsyncView
52
52
  } from "./chunk-AVP5SNIG.js";
53
+ import {
54
+ expandSpeakerRows
55
+ } from "./chunk-XBBXPZJI.js";
53
56
  import {
54
57
  attachmentPartsFromMessageParts
55
- } from "./chunk-AICYKYYF.js";
58
+ } from "./chunk-GAYWV565.js";
56
59
  import {
57
60
  cancelStatusFor,
58
61
  fieldAcceptsFreeText,
@@ -69,7 +72,7 @@ import {
69
72
  isTurnIntentEvent,
70
73
  isTurnPhaseEvent,
71
74
  settleTurnResponse
72
- } from "./chunk-QGJOT6R6.js";
75
+ } from "./chunk-K2JPSXKI.js";
73
76
  import {
74
77
  parsePlanSubmittedEvent,
75
78
  persistedPartToPlan
@@ -127,8 +130,8 @@ ${delta.trimStart()}` : state.text + delta;
127
130
  }
128
131
  function chatReasoningFromParts(parts) {
129
132
  const runs = (parts ?? []).filter((part) => {
130
- const record = part;
131
- return record?.type === "reasoning" && typeof record.text === "string" && record.text.trim() !== "";
133
+ const record2 = part;
134
+ return record2?.type === "reasoning" && typeof record2.text === "string" && record2.text.trim() !== "";
132
135
  });
133
136
  if (runs.length === 0) return void 0;
134
137
  const times = runs.map((run) => run.time && typeof run.time === "object" ? run.time : {});
@@ -181,6 +184,11 @@ function dispatchChatStreamLine(line, cb) {
181
184
  receivedContent = true;
182
185
  }
183
186
  break;
187
+ case "speaker":
188
+ if (typeof evt.id === "string" && typeof evt.name === "string") {
189
+ cb.onSpeaker?.({ id: evt.id, name: evt.name, ...typeof evt.handle === "string" ? { handle: evt.handle } : {} });
190
+ }
191
+ break;
184
192
  case "reasoning":
185
193
  if (typeof evt.text === "string") {
186
194
  cb.onReasoning?.(evt.text);
@@ -2409,6 +2417,21 @@ function useChatInteractions(options = {}) {
2409
2417
  // src/web-react/use-file-mentions.ts
2410
2418
  import { useCallback as useCallback4, useMemo as useMemo5, useRef as useRef7, useState as useState11 } from "react";
2411
2419
  var FILE_MENTION_KIND = "file";
2420
+ var AGENT_MENTION_KIND = "agent";
2421
+ function agentToMentionItem(agent) {
2422
+ return { id: agent.handle, label: agent.name, detail: agent.description ?? `@${agent.handle}`, kind: AGENT_MENTION_KIND };
2423
+ }
2424
+ function rankAgentMentions(agents, query) {
2425
+ const q = query.trim().toLowerCase();
2426
+ if (!q) return [...agents];
2427
+ const tier = (agent) => {
2428
+ const name = agent.name.toLowerCase();
2429
+ if (name.startsWith(q) || agent.handle.startsWith(q)) return 0;
2430
+ if (name.includes(q) || agent.handle.includes(q)) return 1;
2431
+ return -1;
2432
+ };
2433
+ return agents.map((agent) => ({ agent, tier: tier(agent) })).filter((entry) => entry.tier >= 0).sort((a, b) => a.tier - b.tier || a.agent.name.localeCompare(b.agent.name)).map((entry) => entry.agent);
2434
+ }
2412
2435
  function toMentionItem(file) {
2413
2436
  return { id: file.path, label: file.name, detail: file.path, kind: FILE_MENTION_KIND };
2414
2437
  }
@@ -2462,7 +2485,8 @@ function useFileMentions(options) {
2462
2485
  indexUrl,
2463
2486
  limit = DEFAULT_MENTION_LIMIT,
2464
2487
  refreshAfterMs = INDEX_REFRESH_AFTER_MS,
2465
- emptyText = DEFAULT_MENTION_EMPTY_TEXT
2488
+ emptyText = DEFAULT_MENTION_EMPTY_TEXT,
2489
+ agents
2466
2490
  } = options;
2467
2491
  const fetchImpl = options.fetchImpl ?? fetch;
2468
2492
  const [state, setState] = useState11({ kind: "idle" });
@@ -2470,6 +2494,7 @@ function useFileMentions(options) {
2470
2494
  stateRef.current = state;
2471
2495
  const inFlightRef = useRef7(null);
2472
2496
  const [mentions, setMentions] = useState11([]);
2497
+ const agentsByHandle = useMemo5(() => new Map((agents ?? []).map((agent) => [agent.handle, agent])), [agents]);
2473
2498
  const load = useCallback4(() => {
2474
2499
  if (inFlightRef.current) return inFlightRef.current;
2475
2500
  if (stateRef.current.kind === "idle") {
@@ -2515,14 +2540,24 @@ function useFileMentions(options) {
2515
2540
  } else if (Date.now() - current.attemptedAt > RETRY_AFTER_MS) {
2516
2541
  void load();
2517
2542
  }
2518
- if (current.kind !== "ready") return [];
2519
- return rankFileMentions(current.files, query, limit).map(toMentionItem);
2543
+ const agentItems = rankAgentMentions(agents ?? [], query).map(agentToMentionItem);
2544
+ if (current.kind !== "ready") return agentItems;
2545
+ return [...agentItems, ...rankFileMentions(current.files, query, Math.max(0, limit - agentItems.length)).map(toMentionItem)];
2520
2546
  },
2521
- [load, limit, refreshAfterMs]
2547
+ [load, limit, refreshAfterMs, agents]
2522
2548
  );
2523
2549
  const onMentionsChange = useCallback4((items) => {
2524
- setMentions(items.filter((item) => item.kind === void 0 || item.kind === FILE_MENTION_KIND).map(toFileMention));
2525
- }, []);
2550
+ const next = [];
2551
+ for (const item of items) {
2552
+ if (item.kind === AGENT_MENTION_KIND) {
2553
+ const agent = agentsByHandle.get(item.id);
2554
+ if (agent) next.push({ kind: "agent", agentId: agent.id, handle: agent.handle, name: agent.name });
2555
+ } else if (item.kind === void 0 || item.kind === FILE_MENTION_KIND) {
2556
+ next.push(toFileMention(item));
2557
+ }
2558
+ }
2559
+ setMentions(next);
2560
+ }, [agentsByHandle]);
2526
2561
  const clearMentions = useCallback4(() => setMentions([]), []);
2527
2562
  const mention = useMemo5(
2528
2563
  () => ({
@@ -2575,6 +2610,50 @@ function segmentMentionContent(content, parts) {
2575
2610
  return { segments, matched };
2576
2611
  }
2577
2612
 
2613
+ // src/web-react/message-projection.ts
2614
+ var record = (value) => value && typeof value === "object" ? value : null;
2615
+ function toolCallFromPart(part) {
2616
+ const p = record(part);
2617
+ if (!p || p.type !== "tool" || typeof p.id !== "string" || typeof p.tool !== "string") return null;
2618
+ const state = record(p.state) ?? {};
2619
+ const status = state.status;
2620
+ return {
2621
+ id: typeof p.callID === "string" ? p.callID : p.id,
2622
+ name: p.tool,
2623
+ status: status === "completed" ? "done" : status === "error" || status === "failed" ? "error" : "running",
2624
+ ...record(state.input) ? { args: record(state.input) } : {},
2625
+ ...state.output !== void 0 ? { result: state.output } : {}
2626
+ };
2627
+ }
2628
+ function toolCallsFromParts(parts) {
2629
+ return (parts ?? []).map(toolCallFromPart).filter((call) => call !== null);
2630
+ }
2631
+ function segmentsFromParts(parts) {
2632
+ const segments = [];
2633
+ let interleaved = false;
2634
+ for (const raw of parts ?? []) {
2635
+ const part = record(raw);
2636
+ if (!part) continue;
2637
+ if (part.type === "text" && typeof part.text === "string") {
2638
+ const last = segments[segments.length - 1];
2639
+ if (last && last.kind === "text") segments[segments.length - 1] = { kind: "text", content: last.content + part.text };
2640
+ else segments.push({ kind: "text", content: part.text });
2641
+ continue;
2642
+ }
2643
+ const call = toolCallFromPart(part);
2644
+ if (call) {
2645
+ segments.push({ kind: "tool", call });
2646
+ interleaved = true;
2647
+ continue;
2648
+ }
2649
+ if (part.type === "notice" && typeof part.text === "string" && (part.noticeKind === "error" || part.noticeKind === "warning")) {
2650
+ segments.push({ kind: "notice", tone: part.noticeKind, content: part.text });
2651
+ interleaved = true;
2652
+ }
2653
+ }
2654
+ return interleaved ? segments : [];
2655
+ }
2656
+
2578
2657
  // src/web-react/use-plan-mode-selection.ts
2579
2658
  import { useCallback as useCallback5, useEffect as useEffect6, useRef as useRef8, useState as useState12 } from "react";
2580
2659
  function usePlanModeSelection(threadId, initialPlanMode, options = {}) {
@@ -3078,47 +3157,47 @@ function MissionActivityLane({ activity, startedAt, nowMs }) {
3078
3157
  ] });
3079
3158
  }
3080
3159
  function ActivityRow({
3081
- record,
3160
+ record: record2,
3082
3161
  renderMissionRef,
3083
3162
  staggerIndex
3084
3163
  }) {
3085
3164
  const arrival = useArrivalStyle(staggerIndex);
3086
3165
  const [open, setOpen] = useState16(false);
3087
- const tone = activityTone(record.status);
3088
- const cost = formatActivityCost(record.costUsd);
3089
- const duration = formatActivityDuration(record.durationMs);
3166
+ const tone = activityTone(record2.status);
3167
+ const cost = formatActivityCost(record2.costUsd);
3168
+ const duration = formatActivityDuration(record2.durationMs);
3090
3169
  return /* @__PURE__ */ jsxs10("div", { className: "agent-arrive rounded-lg border border-card-edge bg-card", style: arrival, children: [
3091
3170
  /* @__PURE__ */ jsxs10("button", { type: "button", onClick: () => setOpen((v) => !v), className: "flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm", children: [
3092
3171
  /* @__PURE__ */ jsx11(StatusDot, { tone }),
3093
- /* @__PURE__ */ jsx11(RunLabel, { tool: record.tool, detail: record.detail, live: tone === "live" }),
3094
- tone === "live" && (record.iteration !== void 0 || record.phase !== void 0) && /* @__PURE__ */ jsx11("span", { className: "shrink-0 rounded-full bg-warning/10 px-2 py-0.5 font-mono text-xs text-warning", children: [record.iteration !== void 0 ? `iter ${record.iteration}` : null, record.phase ?? null].filter(Boolean).join(" \xB7 ") }),
3172
+ /* @__PURE__ */ jsx11(RunLabel, { tool: record2.tool, detail: record2.detail, live: tone === "live" }),
3173
+ tone === "live" && (record2.iteration !== void 0 || record2.phase !== void 0) && /* @__PURE__ */ jsx11("span", { className: "shrink-0 rounded-full bg-warning/10 px-2 py-0.5 font-mono text-xs text-warning", children: [record2.iteration !== void 0 ? `iter ${record2.iteration}` : null, record2.phase ?? null].filter(Boolean).join(" \xB7 ") }),
3095
3174
  /* @__PURE__ */ jsx11(
3096
3175
  "span",
3097
3176
  {
3098
3177
  className: `shrink-0 rounded-full px-2 py-0.5 text-xs font-medium ${tone === "ok" ? "bg-success/10 text-success" : tone === "error" ? "bg-destructive/10 text-destructive" : tone === "live" ? "bg-warning/10 text-warning" : "bg-secondary text-muted-foreground"}`,
3099
- children: record.status
3178
+ children: record2.status
3100
3179
  }
3101
3180
  ),
3102
3181
  cost && /* @__PURE__ */ jsx11("span", { className: "shrink-0 font-mono text-xs tabular-nums text-muted-foreground", children: cost }),
3103
3182
  /* @__PURE__ */ jsx11(ChevronGlyph, { className: `h-3 w-3 shrink-0 text-muted-foreground transition-transform ${open ? "rotate-180" : ""}` })
3104
3183
  ] }),
3105
3184
  open && /* @__PURE__ */ jsxs10("div", { className: "space-y-2.5 border-t border-border px-3 py-2.5", children: [
3106
- record.durationMs !== void 0 && /* @__PURE__ */ jsx11("div", { className: "rounded-md border border-border bg-secondary p-2", children: /* @__PURE__ */ jsx11(FlowWaterfall, { trace: stepActivityFlowTrace([record]) }) }),
3185
+ record2.durationMs !== void 0 && /* @__PURE__ */ jsx11("div", { className: "rounded-md border border-border bg-secondary p-2", children: /* @__PURE__ */ jsx11(FlowWaterfall, { trace: stepActivityFlowTrace([record2]) }) }),
3107
3186
  /* @__PURE__ */ jsxs10("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 font-mono text-xs", children: [
3108
3187
  /* @__PURE__ */ jsx11("dt", { className: "text-muted-foreground/60", children: "task" }),
3109
- /* @__PURE__ */ jsx11("dd", { className: "truncate text-muted-foreground", children: record.taskId }),
3188
+ /* @__PURE__ */ jsx11("dd", { className: "truncate text-muted-foreground", children: record2.taskId }),
3110
3189
  /* @__PURE__ */ jsx11("dt", { className: "text-muted-foreground/60", children: "started" }),
3111
- /* @__PURE__ */ jsx11("dd", { className: "text-muted-foreground", children: new Date(record.startedAt).toLocaleString() }),
3190
+ /* @__PURE__ */ jsx11("dd", { className: "text-muted-foreground", children: new Date(record2.startedAt).toLocaleString() }),
3112
3191
  duration && /* @__PURE__ */ jsxs10(Fragment2, { children: [
3113
3192
  /* @__PURE__ */ jsx11("dt", { className: "text-muted-foreground/60", children: "duration" }),
3114
3193
  /* @__PURE__ */ jsx11("dd", { className: "text-muted-foreground", children: duration })
3115
3194
  ] }),
3116
- record.traceId && /* @__PURE__ */ jsxs10(Fragment2, { children: [
3195
+ record2.traceId && /* @__PURE__ */ jsxs10(Fragment2, { children: [
3117
3196
  /* @__PURE__ */ jsx11("dt", { className: "text-muted-foreground/60", children: "trace" }),
3118
- /* @__PURE__ */ jsx11("dd", { className: "min-w-0", children: /* @__PURE__ */ jsx11(TraceIdCopy, { traceId: record.traceId }) })
3197
+ /* @__PURE__ */ jsx11("dd", { className: "min-w-0", children: /* @__PURE__ */ jsx11(TraceIdCopy, { traceId: record2.traceId }) })
3119
3198
  ] })
3120
3199
  ] }),
3121
- record.missionRef && renderMissionRef?.(record.missionRef, record)
3200
+ record2.missionRef && renderMissionRef?.(record2.missionRef, record2)
3122
3201
  ] })
3123
3202
  ] });
3124
3203
  }
@@ -3165,7 +3244,7 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
3165
3244
  status === "error" && /* @__PURE__ */ jsx11("p", { role: "alert", className: "rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive", children: error }),
3166
3245
  status === "ready" && rows.length === 0 && /* @__PURE__ */ jsx11("p", { className: "px-1 text-sm text-muted-foreground", children: emptyLabel }),
3167
3246
  /* @__PURE__ */ jsx11("span", { role: "status", "aria-live": "polite", "aria-busy": loading, className: "sr-only", children: loading ? "Loading activity\u2026" : "" }),
3168
- /* @__PURE__ */ jsx11("div", { className: "space-y-1.5", "aria-busy": loading, children: rows.map((record, index) => /* @__PURE__ */ jsx11(ActivityRow, { record, renderMissionRef, staggerIndex: index }, record.taskId)) }),
3247
+ /* @__PURE__ */ jsx11("div", { className: "space-y-1.5", "aria-busy": loading, children: rows.map((record2, index) => /* @__PURE__ */ jsx11(ActivityRow, { record: record2, renderMissionRef, staggerIndex: index }, record2.taskId)) }),
3169
3248
  cursor && /* @__PURE__ */ jsx11(
3170
3249
  "button",
3171
3250
  {
@@ -3240,16 +3319,16 @@ function describeProvenanceSourceStatus(source) {
3240
3319
  }
3241
3320
  return null;
3242
3321
  }
3243
- function provenanceGaps(record) {
3322
+ function provenanceGaps(record2) {
3244
3323
  const gaps = [];
3245
- const sources = record.sources ?? [];
3246
- if (record.basis === "extracted" && sources.length === 0) {
3324
+ const sources = record2.sources ?? [];
3325
+ if (record2.basis === "extracted" && sources.length === 0) {
3247
3326
  gaps.push({
3248
3327
  kind: "no-source",
3249
3328
  message: "Read from a document, but no document is on file \u2014 nothing here shows where this came from."
3250
3329
  });
3251
3330
  }
3252
- if (record.basis === "computed" && (record.inputs ?? []).length === 0) {
3331
+ if (record2.basis === "computed" && (record2.inputs ?? []).length === 0) {
3253
3332
  gaps.push({
3254
3333
  kind: "no-inputs",
3255
3334
  message: "Computed, but the values it was computed from are not recorded."
@@ -3265,22 +3344,22 @@ function provenanceGaps(record) {
3265
3344
  }
3266
3345
  return gaps;
3267
3346
  }
3268
- function loadingProvenanceSources(record) {
3269
- return (record.sources ?? []).filter((source) => source.status === "loading");
3347
+ function loadingProvenanceSources(record2) {
3348
+ return (record2.sources ?? []).filter((source) => source.status === "loading");
3270
3349
  }
3271
- function resolveProvenanceStanding(record, policy = DEFAULT_PROVENANCE_CONFIDENCE_POLICY) {
3272
- let standing = record.standing ?? (record.confidence === void 0 ? standingFromBasis(record.basis) : standingFromConfidence(record.confidence, policy));
3273
- if (record.basis === "asserted") standing = weakerProvenanceStanding(standing, "check");
3274
- for (const gap of provenanceGaps(record)) {
3350
+ function resolveProvenanceStanding(record2, policy = DEFAULT_PROVENANCE_CONFIDENCE_POLICY) {
3351
+ let standing = record2.standing ?? (record2.confidence === void 0 ? standingFromBasis(record2.basis) : standingFromConfidence(record2.confidence, policy));
3352
+ if (record2.basis === "asserted") standing = weakerProvenanceStanding(standing, "check");
3353
+ for (const gap of provenanceGaps(record2)) {
3275
3354
  standing = weakerProvenanceStanding(standing, gap.kind === "unavailable-source" ? "check" : "confirm");
3276
3355
  }
3277
3356
  return standing;
3278
3357
  }
3279
- function rollUpProvenanceStanding(record, policy = DEFAULT_PROVENANCE_CONFIDENCE_POLICY, seen = /* @__PURE__ */ new Set()) {
3280
- if (seen.has(record)) return "settled";
3281
- seen.add(record);
3282
- let standing = resolveProvenanceStanding(record, policy);
3283
- for (const input of record.inputs ?? []) {
3358
+ function rollUpProvenanceStanding(record2, policy = DEFAULT_PROVENANCE_CONFIDENCE_POLICY, seen = /* @__PURE__ */ new Set()) {
3359
+ if (seen.has(record2)) return "settled";
3360
+ seen.add(record2);
3361
+ let standing = resolveProvenanceStanding(record2, policy);
3362
+ for (const input of record2.inputs ?? []) {
3284
3363
  standing = weakerProvenanceStanding(standing, rollUpProvenanceStanding(input, policy, seen));
3285
3364
  }
3286
3365
  return standing;
@@ -3291,18 +3370,18 @@ function sourcePhrase(source) {
3291
3370
  function inputPhrase(input) {
3292
3371
  return input.label ?? input.display;
3293
3372
  }
3294
- function describeProvenance(record) {
3295
- const sources = record.sources ?? [];
3373
+ function describeProvenance(record2) {
3374
+ const sources = record2.sources ?? [];
3296
3375
  const first = sources[0];
3297
3376
  const more = sources.length > 1 ? ` and ${sources.length - 1} more source${sources.length > 2 ? "s" : ""}` : "";
3298
- switch (record.basis) {
3377
+ switch (record2.basis) {
3299
3378
  case "extracted":
3300
3379
  return first ? `Read from ${sourcePhrase(first)}${more}.` : "Read from a document, but no document is on file.";
3301
3380
  case "entered":
3302
3381
  return first ? `Entered by ${sourcePhrase(first)}.` : "Entered by a person.";
3303
3382
  case "computed": {
3304
- const inputs = record.inputs ?? [];
3305
- if (record.derivation) return `Computed from ${record.derivation}.`;
3383
+ const inputs = record2.inputs ?? [];
3384
+ if (record2.derivation) return `Computed from ${record2.derivation}.`;
3306
3385
  if (inputs.length === 0) return "Computed, but the values it was computed from are not recorded.";
3307
3386
  return `Computed from ${inputs.map(inputPhrase).join(", ")}.`;
3308
3387
  }
@@ -3310,10 +3389,10 @@ function describeProvenance(record) {
3310
3389
  return first ? `Stated by the agent, pointing at ${sourcePhrase(first)} \u2014 not verified against it.` : "Stated by the agent, with no source to check it against.";
3311
3390
  }
3312
3391
  }
3313
- function provenanceNextMove(record, standing, policy = DEFAULT_PROVENANCE_CONFIDENCE_POLICY) {
3392
+ function provenanceNextMove(record2, standing, policy = DEFAULT_PROVENANCE_CONFIDENCE_POLICY) {
3314
3393
  const generic = provenanceStandingMeta(standing).action;
3315
3394
  if (standing === "settled") return generic;
3316
- const gaps = provenanceGaps(record);
3395
+ const gaps = provenanceGaps(record2);
3317
3396
  if (gaps.some((gap) => gap.kind === "no-source")) {
3318
3397
  return "Nobody recorded where this came from. Confirm the value and record its source before it is used.";
3319
3398
  }
@@ -3323,18 +3402,18 @@ function provenanceNextMove(record, standing, policy = DEFAULT_PROVENANCE_CONFID
3323
3402
  if (gaps.some((gap) => gap.kind === "unavailable-source")) {
3324
3403
  return "The source could not be opened. Try again, or confirm this value another way before you rely on it.";
3325
3404
  }
3326
- if (record.basis === "asserted" && (record.sources ?? []).length === 0) {
3405
+ if (record2.basis === "asserted" && (record2.sources ?? []).length === 0) {
3327
3406
  return "The agent gave no source. Check this against the real document before you rely on it.";
3328
3407
  }
3329
- if (record.basis === "computed" && (record.inputs ?? []).length > 0 && resolveProvenanceStanding(record, policy) === "settled") {
3408
+ if (record2.basis === "computed" && (record2.inputs ?? []).length > 0 && resolveProvenanceStanding(record2, policy) === "settled") {
3330
3409
  return "One of the values this was computed from still needs checking \u2014 open the marked ones below.";
3331
3410
  }
3332
3411
  return generic;
3333
3412
  }
3334
- function provenanceTriggerLabel(record, standing) {
3335
- const value = record.display.trim() === "" ? "this missing value" : `\u201C${record.display}\u201D`;
3336
- const named = record.label ? `${record.label} ${value}` : value;
3337
- const basis = provenanceBasisMeta(record.basis).label;
3413
+ function provenanceTriggerLabel(record2, standing) {
3414
+ const value = record2.display.trim() === "" ? "this missing value" : `\u201C${record2.display}\u201D`;
3415
+ const named = record2.label ? `${record2.label} ${value}` : value;
3416
+ const basis = provenanceBasisMeta(record2.basis).label;
3338
3417
  const next = standing === "settled" ? "" : ` ${provenanceStandingMeta(standing).label}.`;
3339
3418
  return `Where ${named} came from \u2014 ${basis}.${next}`;
3340
3419
  }
@@ -3398,7 +3477,7 @@ function closeTrailsOutside(root) {
3398
3477
  var DEFAULT_MISSING_VALUE_LABEL = "No value recorded";
3399
3478
  function SourceRow({
3400
3479
  source,
3401
- record,
3480
+ record: record2,
3402
3481
  onOpenSource,
3403
3482
  onRetrySource
3404
3483
  }) {
@@ -3413,7 +3492,7 @@ function SourceRow({
3413
3492
  "button",
3414
3493
  {
3415
3494
  type: "button",
3416
- onClick: () => onOpenSource(source, record),
3495
+ onClick: () => onOpenSource(source, record2),
3417
3496
  className: "rounded px-1 text-xs font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3418
3497
  children: [
3419
3498
  "Open ",
@@ -3454,7 +3533,7 @@ function SourceRow({
3454
3533
  "button",
3455
3534
  {
3456
3535
  type: "button",
3457
- onClick: () => onRetrySource(source, record),
3536
+ onClick: () => onRetrySource(source, record2),
3458
3537
  className: "ml-2 rounded border border-border px-1.5 py-0.5 text-xs font-medium text-foreground hover:bg-accent focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3459
3538
  children: "Try again"
3460
3539
  }
@@ -3465,7 +3544,7 @@ function SourceRow({
3465
3544
  ] });
3466
3545
  }
3467
3546
  function ProvenanceValue({
3468
- record,
3547
+ record: record2,
3469
3548
  onOpenSource,
3470
3549
  onRetrySource,
3471
3550
  confidencePolicy,
@@ -3478,14 +3557,14 @@ function ProvenanceValue({
3478
3557
  const triggerRef = useRef11(null);
3479
3558
  const rootRef = useRef11(null);
3480
3559
  const panelId = useId();
3481
- const standing = rollUpProvenanceStanding(record, confidencePolicy);
3482
- const basisMeta = provenanceBasisMeta(record.basis);
3560
+ const standing = rollUpProvenanceStanding(record2, confidencePolicy);
3561
+ const basisMeta = provenanceBasisMeta(record2.basis);
3483
3562
  const standingMeta = provenanceStandingMeta(standing);
3484
- const gaps = provenanceGaps(record);
3485
- const loading = loadingProvenanceSources(record);
3486
- const sources = record.sources ?? [];
3487
- const inputs = record.inputs ?? [];
3488
- const hasValue = record.display.trim() !== "";
3563
+ const gaps = provenanceGaps(record2);
3564
+ const loading = loadingProvenanceSources(record2);
3565
+ const sources = record2.sources ?? [];
3566
+ const inputs = record2.inputs ?? [];
3567
+ const hasValue = record2.display.trim() !== "";
3489
3568
  const onKeyDown = useCallback8(
3490
3569
  (event) => {
3491
3570
  if (event.key !== "Escape" || !open) return;
@@ -3518,29 +3597,29 @@ function ProvenanceValue({
3518
3597
  };
3519
3598
  }, [open]);
3520
3599
  const summary = /* @__PURE__ */ jsxs11("span", { className: "inline-flex flex-wrap items-baseline gap-x-1.5", children: [
3521
- record.label && /* @__PURE__ */ jsx12("span", { className: "text-xs text-muted-foreground", children: record.label }),
3522
- /* @__PURE__ */ jsx12("span", { className: hasValue ? "text-sm text-foreground" : "text-sm italic text-muted-foreground", children: hasValue ? record.display : missingValueLabel })
3600
+ record2.label && /* @__PURE__ */ jsx12("span", { className: "text-xs text-muted-foreground", children: record2.label }),
3601
+ /* @__PURE__ */ jsx12("span", { className: hasValue ? "text-sm text-foreground" : "text-sm italic text-muted-foreground", children: hasValue ? record2.display : missingValueLabel })
3523
3602
  ] });
3524
3603
  if (maxDepth <= 0) {
3525
3604
  return /* @__PURE__ */ jsxs11(
3526
3605
  "div",
3527
3606
  {
3528
3607
  className: `inline-block max-w-full [overflow-wrap:anywhere] ${className ?? ""}`,
3529
- "data-provenance-basis": record.basis,
3608
+ "data-provenance-basis": record2.basis,
3530
3609
  "data-provenance-standing": standing,
3531
3610
  children: [
3532
3611
  summary,
3533
3612
  /* @__PURE__ */ jsxs11(
3534
3613
  "span",
3535
3614
  {
3536
- className: `ml-1.5 inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-xs font-medium ${BASIS_TONES[record.basis]}`,
3615
+ className: `ml-1.5 inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-xs font-medium ${BASIS_TONES[record2.basis]}`,
3537
3616
  children: [
3538
- /* @__PURE__ */ jsx12(BasisGlyph, { basis: record.basis, className: "h-3 w-3" }),
3617
+ /* @__PURE__ */ jsx12(BasisGlyph, { basis: record2.basis, className: "h-3 w-3" }),
3539
3618
  basisMeta.label
3540
3619
  ]
3541
3620
  }
3542
3621
  ),
3543
- /* @__PURE__ */ jsx12("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: describeProvenance(record) })
3622
+ /* @__PURE__ */ jsx12("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: describeProvenance(record2) })
3544
3623
  ]
3545
3624
  }
3546
3625
  );
@@ -3551,7 +3630,7 @@ function ProvenanceValue({
3551
3630
  ref: rootRef,
3552
3631
  className: `inline-block max-w-full [overflow-wrap:anywhere] ${className ?? ""}`,
3553
3632
  onKeyDown,
3554
- "data-provenance-basis": record.basis,
3633
+ "data-provenance-basis": record2.basis,
3555
3634
  "data-provenance-standing": standing,
3556
3635
  children: [
3557
3636
  /* @__PURE__ */ jsxs11("span", { className: "inline-flex flex-wrap items-baseline gap-1.5", children: [
@@ -3564,10 +3643,10 @@ function ProvenanceValue({
3564
3643
  onClick: onToggle,
3565
3644
  "aria-expanded": open,
3566
3645
  "aria-controls": panelId,
3567
- "aria-label": provenanceTriggerLabel(record, standing),
3568
- className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-xs font-medium transition hover:brightness-105 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring ${BASIS_TONES[record.basis]}`,
3646
+ "aria-label": provenanceTriggerLabel(record2, standing),
3647
+ className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-xs font-medium transition hover:brightness-105 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring ${BASIS_TONES[record2.basis]}`,
3569
3648
  children: [
3570
- /* @__PURE__ */ jsx12(BasisGlyph, { basis: record.basis, className: "h-3 w-3" }),
3649
+ /* @__PURE__ */ jsx12(BasisGlyph, { basis: record2.basis, className: "h-3 w-3" }),
3571
3650
  /* @__PURE__ */ jsx12("span", { "aria-hidden": true, children: basisMeta.label })
3572
3651
  ]
3573
3652
  }
@@ -3582,15 +3661,15 @@ function ProvenanceValue({
3582
3661
  {
3583
3662
  id: panelId,
3584
3663
  role: "group",
3585
- "aria-label": provenanceTriggerLabel(record, standing),
3664
+ "aria-label": provenanceTriggerLabel(record2, standing),
3586
3665
  className: "mt-1.5 w-full min-w-0 space-y-2 rounded-lg border border-border bg-card px-3 py-2.5 text-left",
3587
3666
  children: [
3588
3667
  /* @__PURE__ */ jsxs11("div", { children: [
3589
- /* @__PURE__ */ jsx12("p", { className: "text-[12px] leading-snug text-foreground", children: describeProvenance(record) }),
3668
+ /* @__PURE__ */ jsx12("p", { className: "text-[12px] leading-snug text-foreground", children: describeProvenance(record2) }),
3590
3669
  /* @__PURE__ */ jsxs11("p", { className: `mt-0.5 text-xs leading-snug ${STANDING_TONES[standing]}`, children: [
3591
3670
  standingMeta.label,
3592
3671
  " \u2014 ",
3593
- provenanceNextMove(record, standing, confidencePolicy)
3672
+ provenanceNextMove(record2, standing, confidencePolicy)
3594
3673
  ] }),
3595
3674
  basisMeta.checkableAgainst === null && /* @__PURE__ */ jsxs11("p", { className: "mt-0.5 text-xs leading-snug text-muted-foreground", children: [
3596
3675
  basisMeta.meaning,
@@ -3601,7 +3680,7 @@ function ProvenanceValue({
3601
3680
  SourceRow,
3602
3681
  {
3603
3682
  source,
3604
- record,
3683
+ record: record2,
3605
3684
  onOpenSource,
3606
3685
  onRetrySource
3607
3686
  },
@@ -3614,7 +3693,7 @@ function ProvenanceValue({
3614
3693
  )),
3615
3694
  loading.length > 0 && sources.length === 0 && /* @__PURE__ */ jsx12("p", { role: "status", className: "text-xs text-muted-foreground", children: "Looking up where this came from\u2026" }),
3616
3695
  inputs.length > 0 && /* @__PURE__ */ jsxs11("div", { className: "border-t border-border pt-2", children: [
3617
- /* @__PURE__ */ jsx12("p", { className: "text-xs font-medium uppercase tracking-[0.05em] text-muted-foreground", children: record.derivation ? `Computed from ${record.derivation}` : "Computed from" }),
3696
+ /* @__PURE__ */ jsx12("p", { className: "text-xs font-medium uppercase tracking-[0.05em] text-muted-foreground", children: record2.derivation ? `Computed from ${record2.derivation}` : "Computed from" }),
3618
3697
  /* @__PURE__ */ jsx12("ul", { className: "mt-1.5 space-y-1.5", children: inputs.map((input, index) => /* @__PURE__ */ jsx12("li", { children: /* @__PURE__ */ jsx12(
3619
3698
  ProvenanceValue,
3620
3699
  {
@@ -6644,15 +6723,15 @@ function pageSizeFault(pageSize) {
6644
6723
  }
6645
6724
  function warnPageSize(pageSize) {
6646
6725
  const fault = pageSizeFault(pageSize);
6647
- const record = warnedPageSizes[fault];
6648
- if (record.latched || record.named.has(pageSize)) return;
6649
- record.named.add(pageSize);
6726
+ const record2 = warnedPageSizes[fault];
6727
+ if (record2.latched || record2.named.has(pageSize)) return;
6728
+ record2.named.add(pageSize);
6650
6729
  console.warn(
6651
6730
  `[insight-card] pageSize must be a whole number of cards, 1 or more \u2014 received ${String(pageSize)}. Using ${DEFAULT_INSIGHT_PAGE_SIZE}. ${PAGE_SIZE_FAULT_REASON[fault]}`
6652
6731
  );
6653
- if (record.named.size >= MAX_NAMED_PAGE_SIZES) {
6654
- record.named.clear();
6655
- record.latched = true;
6732
+ if (record2.named.size >= MAX_NAMED_PAGE_SIZES) {
6733
+ record2.named.clear();
6734
+ record2.latched = true;
6656
6735
  console.warn(`[insight-card] further "${fault}" pageSize warnings are suppressed.`);
6657
6736
  }
6658
6737
  }
@@ -7965,7 +8044,7 @@ function OtherPersonMessage({
7965
8044
  ] });
7966
8045
  }
7967
8046
  function ChatMessages({
7968
- messages,
8047
+ messages: storedMessages,
7969
8048
  messageSize = "default",
7970
8049
  chrome = "labeled",
7971
8050
  models = [],
@@ -7994,6 +8073,16 @@ function ChatMessages({
7994
8073
  () => renderMarkdown ?? ((content) => /* @__PURE__ */ jsx28("p", { className: "whitespace-pre-wrap", children: content })),
7995
8074
  [renderMarkdown]
7996
8075
  );
8076
+ const messages = useMemo11(() => expandSpeakerRows(storedMessages).map((row) => {
8077
+ if (!row.author || row.role !== "assistant" || row.segments !== void 0 || row.toolCalls !== void 0) return row;
8078
+ const reasoning = chatReasoningFromParts(row.parts);
8079
+ const segments = segmentsFromParts(row.parts);
8080
+ return {
8081
+ ...row,
8082
+ ...segments.length > 0 ? { segments } : { toolCalls: toolCallsFromParts(row.parts) },
8083
+ ...reasoning ? { reasoning: reasoning.text, reasoningStartedAt: reasoning.startedAt, reasoningEndedAt: reasoning.endedAt } : {}
8084
+ };
8085
+ }), [storedMessages]);
7997
8086
  const lastIsUser = messages[messages.length - 1]?.role === "user";
7998
8087
  const quiet = chrome === "quiet";
7999
8088
  if (messages.length === 0 && !loading && !error) {
@@ -8482,12 +8571,16 @@ export {
8482
8571
  restoreChatInteractions,
8483
8572
  hydrateChatInteractions,
8484
8573
  useChatInteractions,
8574
+ rankAgentMentions,
8485
8575
  rankFileMentions,
8486
8576
  DEFAULT_MENTION_LIMIT,
8487
8577
  INDEX_REFRESH_AFTER_MS,
8488
8578
  DEFAULT_MENTION_EMPTY_TEXT,
8489
8579
  useFileMentions,
8490
8580
  segmentMentionContent,
8581
+ toolCallFromPart,
8582
+ toolCallsFromParts,
8583
+ segmentsFromParts,
8491
8584
  usePlanModeSelection,
8492
8585
  useModels,
8493
8586
  __resetAttachmentFileCacheForTests,
@@ -8583,4 +8676,4 @@ export {
8583
8676
  AgentProfileChoices,
8584
8677
  ComposerProfilePill
8585
8678
  };
8586
- //# sourceMappingURL=chunk-LAZCUQFZ.js.map
8679
+ //# sourceMappingURL=chunk-73AVOSH6.js.map