@tangle-network/agent-app 0.63.61 → 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 (70) hide show
  1. package/dist/{DesignCanvasEditor-YWDEFWYQ.js → DesignCanvasEditor-6XNHSREG.js} +3 -3
  2. package/dist/agent-profiles/d1.js +3 -3
  3. package/dist/agent-profiles/index.js +3 -3
  4. package/dist/assistant/index.js +5 -5
  5. package/dist/chat-react/index.js +3 -3
  6. package/dist/chat-routes/agent-producers.d.ts +11 -10
  7. package/dist/chat-routes/dispatch-parts.d.ts +24 -2
  8. package/dist/chat-routes/hybrid-producer.d.ts +6 -2
  9. package/dist/chat-routes/index.js +13 -11
  10. package/dist/chat-routes/index.js.map +1 -1
  11. package/dist/chat-routes/turn-route-contracts.d.ts +4 -3
  12. package/dist/chat-routes/wire.d.ts +6 -0
  13. package/dist/chat-store/index.js +2 -2
  14. package/dist/{chunk-6XSQCP6W.js → chunk-43CV4JIT.js} +2 -2
  15. package/dist/{chunk-SFZELD6V.js → chunk-4JTEPK2G.js} +2 -2
  16. package/dist/{chunk-N5KBDRSX.js → chunk-5ERXADSW.js} +2 -2
  17. package/dist/{chunk-F2N55QQX.js → chunk-73AVOSH6.js} +136 -80
  18. package/dist/chunk-73AVOSH6.js.map +1 -0
  19. package/dist/{chunk-RNFVAAJJ.js → chunk-7O62NYGT.js} +2 -2
  20. package/dist/{chunk-DPZXCVVS.js → chunk-AHBVQRJA.js} +2 -2
  21. package/dist/{chunk-UTF7H6BK.js → chunk-EUQ46YWK.js} +15 -15
  22. package/dist/chunk-EUQ46YWK.js.map +1 -0
  23. package/dist/{chunk-PIGW5LRM.js → chunk-FJRQCF43.js} +3 -3
  24. package/dist/{chunk-MIQL36JS.js → chunk-GAYWV565.js} +2 -2
  25. package/dist/{chunk-5C3RXQQ7.js → chunk-H3DAXUKV.js} +2 -2
  26. package/dist/{chunk-SRA7VAVK.js → chunk-HJYEK4SU.js} +2 -2
  27. package/dist/{chunk-75I4RXIE.js → chunk-IAK227OO.js} +2 -2
  28. package/dist/{chunk-F6UC2T6U.js → chunk-K2JPSXKI.js} +6 -1
  29. package/dist/{chunk-F6UC2T6U.js.map → chunk-K2JPSXKI.js.map} +1 -1
  30. package/dist/{chunk-QFIVY6WA.js → chunk-NJW4JCSF.js} +2 -2
  31. package/dist/{chunk-O2TYB3DH.js → chunk-Q55WW6DO.js} +15 -15
  32. package/dist/{chunk-RVC7EHJI.js → chunk-RYKANV3P.js} +2056 -1983
  33. package/dist/chunk-RYKANV3P.js.map +1 -0
  34. package/dist/{chunk-TFV4QOCG.js → chunk-VQIH5NAB.js} +2 -2
  35. package/dist/{chunk-DCGATWZ5.js → chunk-XPB2UYHU.js} +5 -5
  36. package/dist/{chunk-DCGATWZ5.js.map → chunk-XPB2UYHU.js.map} +1 -1
  37. package/dist/design-canvas-react/index.js +3 -3
  38. package/dist/design-canvas-react/lazy.js +1 -1
  39. package/dist/operator/index.js +2 -2
  40. package/dist/preset-cloudflare/index.js +6 -6
  41. package/dist/public-consultation/index.js +9 -9
  42. package/dist/sandbox/index.js +6 -6
  43. package/dist/theme/brand.generated.d.ts +15 -15
  44. package/dist/theme/dom.js +2 -2
  45. package/dist/theme/index.js +1 -1
  46. package/dist/theme/tokens.css +210 -356
  47. package/dist/tools/index.js +4 -4
  48. package/dist/web-react/document.js +2 -2
  49. package/dist/web-react/index.d.ts +3 -0
  50. package/dist/web-react/index.js +15 -5
  51. package/dist/web-react/message-projection.d.ts +19 -0
  52. package/dist/work-product/index.js +2 -2
  53. package/package.json +4 -4
  54. package/dist/chunk-F2N55QQX.js.map +0 -1
  55. package/dist/chunk-RVC7EHJI.js.map +0 -1
  56. package/dist/chunk-UTF7H6BK.js.map +0 -1
  57. /package/dist/{DesignCanvasEditor-YWDEFWYQ.js.map → DesignCanvasEditor-6XNHSREG.js.map} +0 -0
  58. /package/dist/{chunk-6XSQCP6W.js.map → chunk-43CV4JIT.js.map} +0 -0
  59. /package/dist/{chunk-SFZELD6V.js.map → chunk-4JTEPK2G.js.map} +0 -0
  60. /package/dist/{chunk-N5KBDRSX.js.map → chunk-5ERXADSW.js.map} +0 -0
  61. /package/dist/{chunk-RNFVAAJJ.js.map → chunk-7O62NYGT.js.map} +0 -0
  62. /package/dist/{chunk-DPZXCVVS.js.map → chunk-AHBVQRJA.js.map} +0 -0
  63. /package/dist/{chunk-PIGW5LRM.js.map → chunk-FJRQCF43.js.map} +0 -0
  64. /package/dist/{chunk-MIQL36JS.js.map → chunk-GAYWV565.js.map} +0 -0
  65. /package/dist/{chunk-5C3RXQQ7.js.map → chunk-H3DAXUKV.js.map} +0 -0
  66. /package/dist/{chunk-SRA7VAVK.js.map → chunk-HJYEK4SU.js.map} +0 -0
  67. /package/dist/{chunk-75I4RXIE.js.map → chunk-IAK227OO.js.map} +0 -0
  68. /package/dist/{chunk-QFIVY6WA.js.map → chunk-NJW4JCSF.js.map} +0 -0
  69. /package/dist/{chunk-O2TYB3DH.js.map → chunk-Q55WW6DO.js.map} +0 -0
  70. /package/dist/{chunk-TFV4QOCG.js.map → chunk-VQIH5NAB.js.map} +0 -0
@@ -260,9 +260,10 @@ export interface ChatTurnAgentsOptions<TContext> {
260
260
  export interface ChatTurnProduceArgs<TContext, TResource = unknown> {
261
261
  /** The agent this producer answers as, when the turn was addressed to one
262
262
  * or more agents by mention. The route calls `produce` once per responder,
263
- * one after another in mention order, and persists their answers as one
264
- * assistant row with a speaker part before each. Absent → the thread's own
265
- * agent answers, as before. */
263
+ * all at once, each with the same thread history and none seeing another's
264
+ * answer, and persists their answers as one assistant row with a speaker
265
+ * part before each, in mention order. Absent → the thread's own agent
266
+ * answers, as before. */
266
267
  agent?: ChatTurnAgentTarget;
267
268
  /** Every responder of this turn, in mention order. */
268
269
  agents?: ChatTurnAgentTarget[];
@@ -246,6 +246,12 @@ export declare function agentMentionsOf(mentions: readonly ChatMention[]): Agent
246
246
  /** A handle is what a person types after `@`: lowercase letters, digits and
247
247
  * hyphens, as `normalizeProfileName` in `/agent-profiles` spells a name. */
248
248
  export declare const AGENT_HANDLE_PATTERN: RegExp;
249
+ /** The handle a profile name gets: lowercase, runs of anything else become one
250
+ * hyphen, no leading or trailing hyphen, at most 63 characters. "Research
251
+ * Lead" is `research-lead`. One spelling for the composer, the route and the
252
+ * rail, so a product never derives its own. An empty result (a name with no
253
+ * letters or digits) is `agent`. */
254
+ export declare function agentHandle(name: string): string;
249
255
  /** The `image/*` mime for a mention path by extension, or `undefined` for
250
256
  * anything not in the known image set (dispatched as `type: 'file'`). */
251
257
  export declare function mediaTypeForMentionPath(path: string): string | undefined;
@@ -16,13 +16,13 @@ import {
16
16
  mentionInputToPart,
17
17
  mentionPartsFromMessageParts,
18
18
  toChatMessageParts
19
- } from "../chunk-MIQL36JS.js";
19
+ } from "../chunk-GAYWV565.js";
20
20
  import "../chunk-ZVEEWGDK.js";
21
21
  import {
22
22
  attachmentPartKey
23
23
  } from "../chunk-U4F6NHAA.js";
24
24
  import "../chunk-TB6KNPFI.js";
25
- import "../chunk-F6UC2T6U.js";
25
+ import "../chunk-K2JPSXKI.js";
26
26
  import "../chunk-4PIN6QYQ.js";
27
27
  import "../chunk-TXD5HXLE.js";
28
28
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  validateOpenUIJsonNode
3
- } from "./chunk-DCGATWZ5.js";
3
+ } from "./chunk-XPB2UYHU.js";
4
4
  import {
5
5
  ToolInputError
6
6
  } from "./chunk-F4XBNR5L.js";
@@ -27,4 +27,4 @@ function parseRenderUiSchema(value) {
27
27
  export {
28
28
  parseRenderUiSchema
29
29
  };
30
- //# sourceMappingURL=chunk-6XSQCP6W.js.map
30
+ //# sourceMappingURL=chunk-43CV4JIT.js.map
@@ -2,7 +2,7 @@ import {
2
2
  darkTheme,
3
3
  lightTheme,
4
4
  themeColor
5
- } from "./chunk-UTF7H6BK.js";
5
+ } from "./chunk-EUQ46YWK.js";
6
6
 
7
7
  // src/theme/dom.ts
8
8
  var LIGHT_THEME_COLOR = themeColor(lightTheme.background);
@@ -49,4 +49,4 @@ export {
49
49
  syncThemePreference,
50
50
  THEME_BOOTSTRAP_SCRIPT
51
51
  };
52
- //# sourceMappingURL=chunk-SFZELD6V.js.map
52
+ //# sourceMappingURL=chunk-4JTEPK2G.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  addStepFinishUsage
3
- } from "./chunk-RNFVAAJJ.js";
3
+ } from "./chunk-7O62NYGT.js";
4
4
  import {
5
5
  asRecord,
6
6
  asString,
@@ -480,4 +480,4 @@ export {
480
480
  TOOL_ABORTED_ERROR,
481
481
  observeNativeCompletion
482
482
  };
483
- //# sourceMappingURL=chunk-N5KBDRSX.js.map
483
+ //# sourceMappingURL=chunk-5ERXADSW.js.map
@@ -55,7 +55,7 @@ import {
55
55
  } from "./chunk-XBBXPZJI.js";
56
56
  import {
57
57
  attachmentPartsFromMessageParts
58
- } from "./chunk-MIQL36JS.js";
58
+ } from "./chunk-GAYWV565.js";
59
59
  import {
60
60
  cancelStatusFor,
61
61
  fieldAcceptsFreeText,
@@ -72,7 +72,7 @@ import {
72
72
  isTurnIntentEvent,
73
73
  isTurnPhaseEvent,
74
74
  settleTurnResponse
75
- } from "./chunk-F6UC2T6U.js";
75
+ } from "./chunk-K2JPSXKI.js";
76
76
  import {
77
77
  parsePlanSubmittedEvent,
78
78
  persistedPartToPlan
@@ -130,8 +130,8 @@ ${delta.trimStart()}` : state.text + delta;
130
130
  }
131
131
  function chatReasoningFromParts(parts) {
132
132
  const runs = (parts ?? []).filter((part) => {
133
- const record = part;
134
- 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() !== "";
135
135
  });
136
136
  if (runs.length === 0) return void 0;
137
137
  const times = runs.map((run) => run.time && typeof run.time === "object" ? run.time : {});
@@ -2610,6 +2610,50 @@ function segmentMentionContent(content, parts) {
2610
2610
  return { segments, matched };
2611
2611
  }
2612
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
+
2613
2657
  // src/web-react/use-plan-mode-selection.ts
2614
2658
  import { useCallback as useCallback5, useEffect as useEffect6, useRef as useRef8, useState as useState12 } from "react";
2615
2659
  function usePlanModeSelection(threadId, initialPlanMode, options = {}) {
@@ -3113,47 +3157,47 @@ function MissionActivityLane({ activity, startedAt, nowMs }) {
3113
3157
  ] });
3114
3158
  }
3115
3159
  function ActivityRow({
3116
- record,
3160
+ record: record2,
3117
3161
  renderMissionRef,
3118
3162
  staggerIndex
3119
3163
  }) {
3120
3164
  const arrival = useArrivalStyle(staggerIndex);
3121
3165
  const [open, setOpen] = useState16(false);
3122
- const tone = activityTone(record.status);
3123
- const cost = formatActivityCost(record.costUsd);
3124
- const duration = formatActivityDuration(record.durationMs);
3166
+ const tone = activityTone(record2.status);
3167
+ const cost = formatActivityCost(record2.costUsd);
3168
+ const duration = formatActivityDuration(record2.durationMs);
3125
3169
  return /* @__PURE__ */ jsxs10("div", { className: "agent-arrive rounded-lg border border-card-edge bg-card", style: arrival, children: [
3126
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: [
3127
3171
  /* @__PURE__ */ jsx11(StatusDot, { tone }),
3128
- /* @__PURE__ */ jsx11(RunLabel, { tool: record.tool, detail: record.detail, live: tone === "live" }),
3129
- 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 ") }),
3130
3174
  /* @__PURE__ */ jsx11(
3131
3175
  "span",
3132
3176
  {
3133
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"}`,
3134
- children: record.status
3178
+ children: record2.status
3135
3179
  }
3136
3180
  ),
3137
3181
  cost && /* @__PURE__ */ jsx11("span", { className: "shrink-0 font-mono text-xs tabular-nums text-muted-foreground", children: cost }),
3138
3182
  /* @__PURE__ */ jsx11(ChevronGlyph, { className: `h-3 w-3 shrink-0 text-muted-foreground transition-transform ${open ? "rotate-180" : ""}` })
3139
3183
  ] }),
3140
3184
  open && /* @__PURE__ */ jsxs10("div", { className: "space-y-2.5 border-t border-border px-3 py-2.5", children: [
3141
- 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]) }) }),
3142
3186
  /* @__PURE__ */ jsxs10("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 font-mono text-xs", children: [
3143
3187
  /* @__PURE__ */ jsx11("dt", { className: "text-muted-foreground/60", children: "task" }),
3144
- /* @__PURE__ */ jsx11("dd", { className: "truncate text-muted-foreground", children: record.taskId }),
3188
+ /* @__PURE__ */ jsx11("dd", { className: "truncate text-muted-foreground", children: record2.taskId }),
3145
3189
  /* @__PURE__ */ jsx11("dt", { className: "text-muted-foreground/60", children: "started" }),
3146
- /* @__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() }),
3147
3191
  duration && /* @__PURE__ */ jsxs10(Fragment2, { children: [
3148
3192
  /* @__PURE__ */ jsx11("dt", { className: "text-muted-foreground/60", children: "duration" }),
3149
3193
  /* @__PURE__ */ jsx11("dd", { className: "text-muted-foreground", children: duration })
3150
3194
  ] }),
3151
- record.traceId && /* @__PURE__ */ jsxs10(Fragment2, { children: [
3195
+ record2.traceId && /* @__PURE__ */ jsxs10(Fragment2, { children: [
3152
3196
  /* @__PURE__ */ jsx11("dt", { className: "text-muted-foreground/60", children: "trace" }),
3153
- /* @__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 }) })
3154
3198
  ] })
3155
3199
  ] }),
3156
- record.missionRef && renderMissionRef?.(record.missionRef, record)
3200
+ record2.missionRef && renderMissionRef?.(record2.missionRef, record2)
3157
3201
  ] })
3158
3202
  ] });
3159
3203
  }
@@ -3200,7 +3244,7 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
3200
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 }),
3201
3245
  status === "ready" && rows.length === 0 && /* @__PURE__ */ jsx11("p", { className: "px-1 text-sm text-muted-foreground", children: emptyLabel }),
3202
3246
  /* @__PURE__ */ jsx11("span", { role: "status", "aria-live": "polite", "aria-busy": loading, className: "sr-only", children: loading ? "Loading activity\u2026" : "" }),
3203
- /* @__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)) }),
3204
3248
  cursor && /* @__PURE__ */ jsx11(
3205
3249
  "button",
3206
3250
  {
@@ -3275,16 +3319,16 @@ function describeProvenanceSourceStatus(source) {
3275
3319
  }
3276
3320
  return null;
3277
3321
  }
3278
- function provenanceGaps(record) {
3322
+ function provenanceGaps(record2) {
3279
3323
  const gaps = [];
3280
- const sources = record.sources ?? [];
3281
- if (record.basis === "extracted" && sources.length === 0) {
3324
+ const sources = record2.sources ?? [];
3325
+ if (record2.basis === "extracted" && sources.length === 0) {
3282
3326
  gaps.push({
3283
3327
  kind: "no-source",
3284
3328
  message: "Read from a document, but no document is on file \u2014 nothing here shows where this came from."
3285
3329
  });
3286
3330
  }
3287
- if (record.basis === "computed" && (record.inputs ?? []).length === 0) {
3331
+ if (record2.basis === "computed" && (record2.inputs ?? []).length === 0) {
3288
3332
  gaps.push({
3289
3333
  kind: "no-inputs",
3290
3334
  message: "Computed, but the values it was computed from are not recorded."
@@ -3300,22 +3344,22 @@ function provenanceGaps(record) {
3300
3344
  }
3301
3345
  return gaps;
3302
3346
  }
3303
- function loadingProvenanceSources(record) {
3304
- return (record.sources ?? []).filter((source) => source.status === "loading");
3347
+ function loadingProvenanceSources(record2) {
3348
+ return (record2.sources ?? []).filter((source) => source.status === "loading");
3305
3349
  }
3306
- function resolveProvenanceStanding(record, policy = DEFAULT_PROVENANCE_CONFIDENCE_POLICY) {
3307
- let standing = record.standing ?? (record.confidence === void 0 ? standingFromBasis(record.basis) : standingFromConfidence(record.confidence, policy));
3308
- if (record.basis === "asserted") standing = weakerProvenanceStanding(standing, "check");
3309
- 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)) {
3310
3354
  standing = weakerProvenanceStanding(standing, gap.kind === "unavailable-source" ? "check" : "confirm");
3311
3355
  }
3312
3356
  return standing;
3313
3357
  }
3314
- function rollUpProvenanceStanding(record, policy = DEFAULT_PROVENANCE_CONFIDENCE_POLICY, seen = /* @__PURE__ */ new Set()) {
3315
- if (seen.has(record)) return "settled";
3316
- seen.add(record);
3317
- let standing = resolveProvenanceStanding(record, policy);
3318
- 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 ?? []) {
3319
3363
  standing = weakerProvenanceStanding(standing, rollUpProvenanceStanding(input, policy, seen));
3320
3364
  }
3321
3365
  return standing;
@@ -3326,18 +3370,18 @@ function sourcePhrase(source) {
3326
3370
  function inputPhrase(input) {
3327
3371
  return input.label ?? input.display;
3328
3372
  }
3329
- function describeProvenance(record) {
3330
- const sources = record.sources ?? [];
3373
+ function describeProvenance(record2) {
3374
+ const sources = record2.sources ?? [];
3331
3375
  const first = sources[0];
3332
3376
  const more = sources.length > 1 ? ` and ${sources.length - 1} more source${sources.length > 2 ? "s" : ""}` : "";
3333
- switch (record.basis) {
3377
+ switch (record2.basis) {
3334
3378
  case "extracted":
3335
3379
  return first ? `Read from ${sourcePhrase(first)}${more}.` : "Read from a document, but no document is on file.";
3336
3380
  case "entered":
3337
3381
  return first ? `Entered by ${sourcePhrase(first)}.` : "Entered by a person.";
3338
3382
  case "computed": {
3339
- const inputs = record.inputs ?? [];
3340
- if (record.derivation) return `Computed from ${record.derivation}.`;
3383
+ const inputs = record2.inputs ?? [];
3384
+ if (record2.derivation) return `Computed from ${record2.derivation}.`;
3341
3385
  if (inputs.length === 0) return "Computed, but the values it was computed from are not recorded.";
3342
3386
  return `Computed from ${inputs.map(inputPhrase).join(", ")}.`;
3343
3387
  }
@@ -3345,10 +3389,10 @@ function describeProvenance(record) {
3345
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.";
3346
3390
  }
3347
3391
  }
3348
- function provenanceNextMove(record, standing, policy = DEFAULT_PROVENANCE_CONFIDENCE_POLICY) {
3392
+ function provenanceNextMove(record2, standing, policy = DEFAULT_PROVENANCE_CONFIDENCE_POLICY) {
3349
3393
  const generic = provenanceStandingMeta(standing).action;
3350
3394
  if (standing === "settled") return generic;
3351
- const gaps = provenanceGaps(record);
3395
+ const gaps = provenanceGaps(record2);
3352
3396
  if (gaps.some((gap) => gap.kind === "no-source")) {
3353
3397
  return "Nobody recorded where this came from. Confirm the value and record its source before it is used.";
3354
3398
  }
@@ -3358,18 +3402,18 @@ function provenanceNextMove(record, standing, policy = DEFAULT_PROVENANCE_CONFID
3358
3402
  if (gaps.some((gap) => gap.kind === "unavailable-source")) {
3359
3403
  return "The source could not be opened. Try again, or confirm this value another way before you rely on it.";
3360
3404
  }
3361
- if (record.basis === "asserted" && (record.sources ?? []).length === 0) {
3405
+ if (record2.basis === "asserted" && (record2.sources ?? []).length === 0) {
3362
3406
  return "The agent gave no source. Check this against the real document before you rely on it.";
3363
3407
  }
3364
- 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") {
3365
3409
  return "One of the values this was computed from still needs checking \u2014 open the marked ones below.";
3366
3410
  }
3367
3411
  return generic;
3368
3412
  }
3369
- function provenanceTriggerLabel(record, standing) {
3370
- const value = record.display.trim() === "" ? "this missing value" : `\u201C${record.display}\u201D`;
3371
- const named = record.label ? `${record.label} ${value}` : value;
3372
- 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;
3373
3417
  const next = standing === "settled" ? "" : ` ${provenanceStandingMeta(standing).label}.`;
3374
3418
  return `Where ${named} came from \u2014 ${basis}.${next}`;
3375
3419
  }
@@ -3433,7 +3477,7 @@ function closeTrailsOutside(root) {
3433
3477
  var DEFAULT_MISSING_VALUE_LABEL = "No value recorded";
3434
3478
  function SourceRow({
3435
3479
  source,
3436
- record,
3480
+ record: record2,
3437
3481
  onOpenSource,
3438
3482
  onRetrySource
3439
3483
  }) {
@@ -3448,7 +3492,7 @@ function SourceRow({
3448
3492
  "button",
3449
3493
  {
3450
3494
  type: "button",
3451
- onClick: () => onOpenSource(source, record),
3495
+ onClick: () => onOpenSource(source, record2),
3452
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",
3453
3497
  children: [
3454
3498
  "Open ",
@@ -3489,7 +3533,7 @@ function SourceRow({
3489
3533
  "button",
3490
3534
  {
3491
3535
  type: "button",
3492
- onClick: () => onRetrySource(source, record),
3536
+ onClick: () => onRetrySource(source, record2),
3493
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",
3494
3538
  children: "Try again"
3495
3539
  }
@@ -3500,7 +3544,7 @@ function SourceRow({
3500
3544
  ] });
3501
3545
  }
3502
3546
  function ProvenanceValue({
3503
- record,
3547
+ record: record2,
3504
3548
  onOpenSource,
3505
3549
  onRetrySource,
3506
3550
  confidencePolicy,
@@ -3513,14 +3557,14 @@ function ProvenanceValue({
3513
3557
  const triggerRef = useRef11(null);
3514
3558
  const rootRef = useRef11(null);
3515
3559
  const panelId = useId();
3516
- const standing = rollUpProvenanceStanding(record, confidencePolicy);
3517
- const basisMeta = provenanceBasisMeta(record.basis);
3560
+ const standing = rollUpProvenanceStanding(record2, confidencePolicy);
3561
+ const basisMeta = provenanceBasisMeta(record2.basis);
3518
3562
  const standingMeta = provenanceStandingMeta(standing);
3519
- const gaps = provenanceGaps(record);
3520
- const loading = loadingProvenanceSources(record);
3521
- const sources = record.sources ?? [];
3522
- const inputs = record.inputs ?? [];
3523
- 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() !== "";
3524
3568
  const onKeyDown = useCallback8(
3525
3569
  (event) => {
3526
3570
  if (event.key !== "Escape" || !open) return;
@@ -3553,29 +3597,29 @@ function ProvenanceValue({
3553
3597
  };
3554
3598
  }, [open]);
3555
3599
  const summary = /* @__PURE__ */ jsxs11("span", { className: "inline-flex flex-wrap items-baseline gap-x-1.5", children: [
3556
- record.label && /* @__PURE__ */ jsx12("span", { className: "text-xs text-muted-foreground", children: record.label }),
3557
- /* @__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 })
3558
3602
  ] });
3559
3603
  if (maxDepth <= 0) {
3560
3604
  return /* @__PURE__ */ jsxs11(
3561
3605
  "div",
3562
3606
  {
3563
3607
  className: `inline-block max-w-full [overflow-wrap:anywhere] ${className ?? ""}`,
3564
- "data-provenance-basis": record.basis,
3608
+ "data-provenance-basis": record2.basis,
3565
3609
  "data-provenance-standing": standing,
3566
3610
  children: [
3567
3611
  summary,
3568
3612
  /* @__PURE__ */ jsxs11(
3569
3613
  "span",
3570
3614
  {
3571
- 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]}`,
3572
3616
  children: [
3573
- /* @__PURE__ */ jsx12(BasisGlyph, { basis: record.basis, className: "h-3 w-3" }),
3617
+ /* @__PURE__ */ jsx12(BasisGlyph, { basis: record2.basis, className: "h-3 w-3" }),
3574
3618
  basisMeta.label
3575
3619
  ]
3576
3620
  }
3577
3621
  ),
3578
- /* @__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) })
3579
3623
  ]
3580
3624
  }
3581
3625
  );
@@ -3586,7 +3630,7 @@ function ProvenanceValue({
3586
3630
  ref: rootRef,
3587
3631
  className: `inline-block max-w-full [overflow-wrap:anywhere] ${className ?? ""}`,
3588
3632
  onKeyDown,
3589
- "data-provenance-basis": record.basis,
3633
+ "data-provenance-basis": record2.basis,
3590
3634
  "data-provenance-standing": standing,
3591
3635
  children: [
3592
3636
  /* @__PURE__ */ jsxs11("span", { className: "inline-flex flex-wrap items-baseline gap-1.5", children: [
@@ -3599,10 +3643,10 @@ function ProvenanceValue({
3599
3643
  onClick: onToggle,
3600
3644
  "aria-expanded": open,
3601
3645
  "aria-controls": panelId,
3602
- "aria-label": provenanceTriggerLabel(record, standing),
3603
- 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]}`,
3604
3648
  children: [
3605
- /* @__PURE__ */ jsx12(BasisGlyph, { basis: record.basis, className: "h-3 w-3" }),
3649
+ /* @__PURE__ */ jsx12(BasisGlyph, { basis: record2.basis, className: "h-3 w-3" }),
3606
3650
  /* @__PURE__ */ jsx12("span", { "aria-hidden": true, children: basisMeta.label })
3607
3651
  ]
3608
3652
  }
@@ -3617,15 +3661,15 @@ function ProvenanceValue({
3617
3661
  {
3618
3662
  id: panelId,
3619
3663
  role: "group",
3620
- "aria-label": provenanceTriggerLabel(record, standing),
3664
+ "aria-label": provenanceTriggerLabel(record2, standing),
3621
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",
3622
3666
  children: [
3623
3667
  /* @__PURE__ */ jsxs11("div", { children: [
3624
- /* @__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) }),
3625
3669
  /* @__PURE__ */ jsxs11("p", { className: `mt-0.5 text-xs leading-snug ${STANDING_TONES[standing]}`, children: [
3626
3670
  standingMeta.label,
3627
3671
  " \u2014 ",
3628
- provenanceNextMove(record, standing, confidencePolicy)
3672
+ provenanceNextMove(record2, standing, confidencePolicy)
3629
3673
  ] }),
3630
3674
  basisMeta.checkableAgainst === null && /* @__PURE__ */ jsxs11("p", { className: "mt-0.5 text-xs leading-snug text-muted-foreground", children: [
3631
3675
  basisMeta.meaning,
@@ -3636,7 +3680,7 @@ function ProvenanceValue({
3636
3680
  SourceRow,
3637
3681
  {
3638
3682
  source,
3639
- record,
3683
+ record: record2,
3640
3684
  onOpenSource,
3641
3685
  onRetrySource
3642
3686
  },
@@ -3649,7 +3693,7 @@ function ProvenanceValue({
3649
3693
  )),
3650
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" }),
3651
3695
  inputs.length > 0 && /* @__PURE__ */ jsxs11("div", { className: "border-t border-border pt-2", children: [
3652
- /* @__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" }),
3653
3697
  /* @__PURE__ */ jsx12("ul", { className: "mt-1.5 space-y-1.5", children: inputs.map((input, index) => /* @__PURE__ */ jsx12("li", { children: /* @__PURE__ */ jsx12(
3654
3698
  ProvenanceValue,
3655
3699
  {
@@ -6679,15 +6723,15 @@ function pageSizeFault(pageSize) {
6679
6723
  }
6680
6724
  function warnPageSize(pageSize) {
6681
6725
  const fault = pageSizeFault(pageSize);
6682
- const record = warnedPageSizes[fault];
6683
- if (record.latched || record.named.has(pageSize)) return;
6684
- record.named.add(pageSize);
6726
+ const record2 = warnedPageSizes[fault];
6727
+ if (record2.latched || record2.named.has(pageSize)) return;
6728
+ record2.named.add(pageSize);
6685
6729
  console.warn(
6686
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]}`
6687
6731
  );
6688
- if (record.named.size >= MAX_NAMED_PAGE_SIZES) {
6689
- record.named.clear();
6690
- record.latched = true;
6732
+ if (record2.named.size >= MAX_NAMED_PAGE_SIZES) {
6733
+ record2.named.clear();
6734
+ record2.latched = true;
6691
6735
  console.warn(`[insight-card] further "${fault}" pageSize warnings are suppressed.`);
6692
6736
  }
6693
6737
  }
@@ -8029,7 +8073,16 @@ function ChatMessages({
8029
8073
  () => renderMarkdown ?? ((content) => /* @__PURE__ */ jsx28("p", { className: "whitespace-pre-wrap", children: content })),
8030
8074
  [renderMarkdown]
8031
8075
  );
8032
- const messages = useMemo11(() => expandSpeakerRows(storedMessages), [storedMessages]);
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]);
8033
8086
  const lastIsUser = messages[messages.length - 1]?.role === "user";
8034
8087
  const quiet = chrome === "quiet";
8035
8088
  if (messages.length === 0 && !loading && !error) {
@@ -8525,6 +8578,9 @@ export {
8525
8578
  DEFAULT_MENTION_EMPTY_TEXT,
8526
8579
  useFileMentions,
8527
8580
  segmentMentionContent,
8581
+ toolCallFromPart,
8582
+ toolCallsFromParts,
8583
+ segmentsFromParts,
8528
8584
  usePlanModeSelection,
8529
8585
  useModels,
8530
8586
  __resetAttachmentFileCacheForTests,
@@ -8620,4 +8676,4 @@ export {
8620
8676
  AgentProfileChoices,
8621
8677
  ComposerProfilePill
8622
8678
  };
8623
- //# sourceMappingURL=chunk-F2N55QQX.js.map
8679
+ //# sourceMappingURL=chunk-73AVOSH6.js.map