@tangle-network/agent-app 0.60.281 → 0.60.283

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 (52) hide show
  1. package/dist/app-auth/index.js +2 -2
  2. package/dist/assistant/index.js +6 -5
  3. package/dist/assistant/index.js.map +1 -1
  4. package/dist/chat-react/index.js +1 -1
  5. package/dist/chat-routes/index.js +19 -19
  6. package/dist/chunk-276PF4R6.js +342 -0
  7. package/dist/chunk-276PF4R6.js.map +1 -0
  8. package/dist/{chunk-GDBDTM7N.js → chunk-4S6YIDKU.js} +28 -27
  9. package/dist/{chunk-GDBDTM7N.js.map → chunk-4S6YIDKU.js.map} +1 -1
  10. package/dist/{chunk-VJBFCNAU.js → chunk-7D5MHMCP.js} +4 -4
  11. package/dist/{chunk-4P5NFBWX.js → chunk-BI5AZAOO.js} +4 -4
  12. package/dist/{chunk-FBVLEGEG.js → chunk-GDUT72VK.js} +34 -6
  13. package/dist/chunk-GDUT72VK.js.map +1 -0
  14. package/dist/{chunk-LO6VQ35O.js → chunk-U77HPL3I.js} +2 -2
  15. package/dist/{chunk-YI2XZCTP.js → chunk-WEUCLHAP.js} +5 -48
  16. package/dist/chunk-WEUCLHAP.js.map +1 -0
  17. package/dist/design-canvas/index.js +3 -3
  18. package/dist/design-canvas-react/index.js +4 -4
  19. package/dist/launch-invariants/index.js +8 -8
  20. package/dist/openui/index.js +3 -3
  21. package/dist/platform/index.js +12 -12
  22. package/dist/profile/index.js +1 -1
  23. package/dist/public-consultation/index.js +1 -1
  24. package/dist/runtime/index.js +3 -3
  25. package/dist/runtime/router-turn.js +2 -2
  26. package/dist/sequences/index.js +5 -5
  27. package/dist/settings-react/index.js +1 -1
  28. package/dist/skills/index.js +3 -3
  29. package/dist/skills-placement/box.js +1 -1
  30. package/dist/skills-placement/index.js +1 -1
  31. package/dist/stories/chat-controls/discovery-waterfall-fixture.d.ts +3 -0
  32. package/dist/theme/tokens.css +72 -0
  33. package/dist/trace/flow-types.d.ts +9 -1
  34. package/dist/trace/index.d.ts +1 -0
  35. package/dist/trace/index.js +14 -1
  36. package/dist/trace/index.js.map +1 -1
  37. package/dist/trace/mission-flow.d.ts +2 -3
  38. package/dist/turn-stream/index.js +3 -3
  39. package/dist/web-react/flow-waterfall-model.d.ts +22 -0
  40. package/dist/web-react/flow-waterfall.css +72 -0
  41. package/dist/web-react/flow-waterfall.d.ts +14 -0
  42. package/dist/web-react/flow-waterfall.js +7 -0
  43. package/dist/web-react/flow-waterfall.js.map +1 -0
  44. package/dist/web-react/index.js +14 -12
  45. package/dist/web-react/mission-activity.d.ts +2 -20
  46. package/dist/work-product/index.js +10 -10
  47. package/package.json +14 -7
  48. package/dist/chunk-FBVLEGEG.js.map +0 -1
  49. package/dist/chunk-YI2XZCTP.js.map +0 -1
  50. /package/dist/{chunk-VJBFCNAU.js.map → chunk-7D5MHMCP.js.map} +0 -0
  51. /package/dist/{chunk-4P5NFBWX.js.map → chunk-BI5AZAOO.js.map} +0 -0
  52. /package/dist/{chunk-LO6VQ35O.js.map → chunk-U77HPL3I.js.map} +0 -0
@@ -5,12 +5,12 @@ import {
5
5
  import {
6
6
  DEFAULT_TANGLE_ROUTER_BASE_URL
7
7
  } from "./chunk-D6UJEOZQ.js";
8
- import {
9
- normalizeModelId
10
- } from "./chunk-AMUXRAUO.js";
11
8
  import {
12
9
  turnTraceId
13
10
  } from "./chunk-ORQD4AUO.js";
11
+ import {
12
+ normalizeModelId
13
+ } from "./chunk-AMUXRAUO.js";
14
14
 
15
15
  // src/runtime/loop.ts
16
16
  import {
@@ -982,4 +982,4 @@ export {
982
982
  composeRouterTurnPrompt,
983
983
  runRouterTurn
984
984
  };
985
- //# sourceMappingURL=chunk-VJBFCNAU.js.map
985
+ //# sourceMappingURL=chunk-7D5MHMCP.js.map
@@ -1,11 +1,11 @@
1
- import {
2
- isTangleBillingEnforcementDisabled
3
- } from "./chunk-D6UJEOZQ.js";
4
1
  import {
5
2
  clearCookieHeader,
6
3
  readCookieValue,
7
4
  serializeCookie
8
5
  } from "./chunk-WP2GYFZ4.js";
6
+ import {
7
+ isTangleBillingEnforcementDisabled
8
+ } from "./chunk-D6UJEOZQ.js";
9
9
 
10
10
  // src/platform/sso.ts
11
11
  var DEFAULT_STATE_TTL_SECONDS = 600;
@@ -516,4 +516,4 @@ export {
516
516
  createAdminGuard,
517
517
  assertBillableBalance
518
518
  };
519
- //# sourceMappingURL=chunk-4P5NFBWX.js.map
519
+ //# sourceMappingURL=chunk-BI5AZAOO.js.map
@@ -3,6 +3,7 @@ var num = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
3
3
  var str = (v) => typeof v === "string" && v.length > 0 ? v : void 0;
4
4
  var rec = (v) => v && typeof v === "object" ? v : {};
5
5
  var LIVE_DELEGATION_STATUSES = /* @__PURE__ */ new Set(["pending", "running"]);
6
+ var ERROR_STATUSES = /* @__PURE__ */ new Set(["failed", "error", "cancelled", "aborted", "down"]);
6
7
  function delegationActivityToFlowSpans(activity, turnStartMs, opts) {
7
8
  const spans = [];
8
9
  for (const run of activity) {
@@ -12,6 +13,8 @@ function delegationActivityToFlowSpans(activity, turnStartMs, opts) {
12
13
  const live = LIVE_DELEGATION_STATUSES.has(run.status);
13
14
  const endMs = run.durationMs !== void 0 ? startMs + run.durationMs : live && opts?.nowMs !== void 0 ? opts.nowMs - turnStartMs : startMs;
14
15
  spans.push({
16
+ id: run.taskId,
17
+ status: live ? "running" : ERROR_STATUSES.has(run.status) ? "failed" : "done",
15
18
  kind: "tool",
16
19
  name: `${run.tool} \u2014 ${run.detail}`,
17
20
  startMs,
@@ -38,11 +41,14 @@ function loopTraceEventsToFlowSpans(events) {
38
41
  const origin = started?.timestamp ?? ordered[0].timestamp;
39
42
  const rootEnd = ended?.timestamp ?? ordered[ordered.length - 1].timestamp;
40
43
  const t = (epochMs) => epochMs - origin;
44
+ const rootId = `loop:${ordered[0].runId}`;
41
45
  const spans = [];
42
46
  const sp = rec(started?.payload);
43
47
  const ep = rec(ended?.payload);
44
48
  spans.push({
45
49
  kind: "pipeline",
50
+ id: rootId,
51
+ status: ended ? "done" : "running",
46
52
  name: "loop",
47
53
  startMs: 0,
48
54
  endMs: t(rootEnd),
@@ -56,10 +62,13 @@ function loopTraceEventsToFlowSpans(events) {
56
62
  });
57
63
  const iterStart = /* @__PURE__ */ new Map();
58
64
  let round;
59
- const flushRound = (endEpochMs) => {
65
+ const flushRound = (endEpochMs, running = false) => {
60
66
  if (!round) return;
61
67
  spans.push({
62
68
  kind: "pipeline",
69
+ id: `${rootId}:round-${round.index}`,
70
+ parentId: rootId,
71
+ status: running ? "running" : "done",
63
72
  name: `loop \u25B8 round ${round.index} (${round.moveKind})`,
64
73
  startMs: round.startMs,
65
74
  endMs: t(endEpochMs),
@@ -89,18 +98,23 @@ function loopTraceEventsToFlowSpans(events) {
89
98
  }
90
99
  case "loop.iteration.started": {
91
100
  const idx = num(p.iterationIndex);
92
- if (idx !== void 0) iterStart.set(idx, e.timestamp);
101
+ if (idx !== void 0) iterStart.set(idx, { timestamp: e.timestamp, parentId: round ? `${rootId}:round-${round.index}` : rootId });
93
102
  break;
94
103
  }
95
104
  case "loop.iteration.ended": {
96
105
  const idx = num(p.iterationIndex) ?? 0;
97
- const startEpoch = iterStart.get(idx) ?? e.timestamp;
106
+ const open = iterStart.get(idx);
107
+ const startEpoch = open?.timestamp ?? e.timestamp;
108
+ iterStart.delete(idx);
98
109
  const error = str(p.error);
99
110
  const verdict = rec(p.verdict);
100
111
  const tokens = rec(p.tokenUsage);
101
112
  const roundLabel = round ? `round ${round.index} \u25B8 ` : "";
102
113
  spans.push({
103
114
  kind: "model",
115
+ id: `${rootId}:iteration-${idx}`,
116
+ parentId: open?.parentId ?? rootId,
117
+ status: error ? "failed" : "done",
104
118
  name: `loop \u25B8 ${roundLabel}iter ${idx} (${str(p.agentRunName) ?? "agent"})`,
105
119
  startMs: t(startEpoch),
106
120
  endMs: t(e.timestamp),
@@ -127,7 +141,19 @@ function loopTraceEventsToFlowSpans(events) {
127
141
  }
128
142
  }
129
143
  }
130
- flushRound(rootEnd);
144
+ flushRound(rootEnd, !ended);
145
+ for (const [idx, open] of iterStart) {
146
+ spans.push({
147
+ kind: "model",
148
+ id: `${rootId}:iteration-${idx}`,
149
+ parentId: open.parentId,
150
+ name: `loop \u25B8 iter ${idx}`,
151
+ startMs: t(open.timestamp),
152
+ endMs: t(rootEnd),
153
+ status: ended ? "failed" : "running",
154
+ approx: true
155
+ });
156
+ }
131
157
  return spans;
132
158
  }
133
159
  function stepActivityFlowTrace(activity, opts) {
@@ -185,6 +211,8 @@ function composeMissionFlowTrace(input) {
185
211
  const endMs = Math.max(step.durationMs !== void 0 ? startMs + step.durationMs : startMs, runExtent);
186
212
  spans.push({
187
213
  kind: "pipeline",
214
+ id: `step-${step.id}`,
215
+ ...step.status && LIVE_DELEGATION_STATUSES.has(step.status) ? { status: "running" } : {},
188
216
  name: step.intent,
189
217
  startMs,
190
218
  endMs,
@@ -192,7 +220,7 @@ function composeMissionFlowTrace(input) {
192
220
  meta: { stepId: step.id, ...step.status !== void 0 ? { status: step.status } : {} }
193
221
  });
194
222
  for (const span of runSpans) {
195
- spans.push({ ...span, name: `${step.intent} \u25B8 ${span.name}` });
223
+ spans.push({ ...span, id: `step-${step.id}:${span.id}`, parentId: `step-${step.id}`, name: `${step.intent} \u25B8 ${span.name}` });
196
224
  toolCalls++;
197
225
  const c = num(rec(span.meta).costUsd);
198
226
  if (c !== void 0) costUsd = (costUsd ?? 0) + c;
@@ -215,4 +243,4 @@ export {
215
243
  stepActivityFlowTrace,
216
244
  composeMissionFlowTrace
217
245
  };
218
- //# sourceMappingURL=chunk-FBVLEGEG.js.map
246
+ //# sourceMappingURL=chunk-GDUT72VK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/trace/mission-flow.ts"],"sourcesContent":["/**\n * Delegation → FlowSpan converters — render what a mission's delegated agent\n * runs actually did as ONE FlowTrace, drawable by the existing\n * `renderWaterfall` (or any viewer that consumes FlowSpans).\n *\n * Two fidelities, one tree:\n * - COARSE: `delegationActivityToFlowSpans` draws one 'tool' span per\n * delegation from the StepAgentActivity snapshot (startedAt/durationMs) —\n * available live, from the step's journaled lane.\n * - FINE: `loopTraceEventsToFlowSpans` reconstructs agent-runtime's\n * loop → round → iteration hierarchy from the LoopTraceEvent journal a\n * delegation persists. Stable ids carry the hierarchy; descriptive names\n * retain context in the ASCII waterfall as well.\n *\n * `composeMissionFlowTrace` lays a whole mission out: one 'pipeline' span per\n * step, each step's delegations beneath it. Pure data transforms — the\n * structural `LoopTraceEventLike` keeps this module free of the optional\n * agent-runtime peer.\n */\n\nimport type { StepAgentActivity } from '../missions/agent-activity'\nimport type { FlowSpan, FlowTrace } from './flow-types'\n\n/** Structural mirror of agent-runtime's `LoopTraceEvent` — same fields, no\n * import, so journals parsed from JSON feed straight in. */\nexport interface LoopTraceEventLike {\n kind: string\n runId: string\n /** Epoch ms. */\n timestamp: number\n payload: object\n}\n\nconst num = (v: unknown): number | undefined =>\n typeof v === 'number' && Number.isFinite(v) ? v : undefined\nconst str = (v: unknown): string | undefined =>\n typeof v === 'string' && v.length > 0 ? v : undefined\nconst rec = (v: unknown): Record<string, unknown> =>\n v && typeof v === 'object' ? (v as Record<string, unknown>) : {}\n\n/** Statuses that mean the delegation is still producing wall time. */\nconst LIVE_DELEGATION_STATUSES = new Set(['pending', 'running'])\nconst ERROR_STATUSES = new Set(['failed', 'error', 'cancelled', 'aborted', 'down'])\n\n/**\n * One 'tool' FlowSpan per delegation, positioned relative to `turnStartMs`\n * (the epoch-ms origin of the trace — usually the step or mission start).\n * A row whose `startedAt` does not parse cannot be placed on a timeline and\n * is omitted from the WATERFALL (it stays in the lane itself). A run without\n * `durationMs` is still in flight: its span extends to `opts.nowMs` when\n * given, else renders as a point — `approx` flags both.\n */\nexport function delegationActivityToFlowSpans(\n activity: StepAgentActivity[],\n turnStartMs: number,\n opts?: { nowMs?: number },\n): FlowSpan[] {\n const spans: FlowSpan[] = []\n for (const run of activity) {\n const startedAt = Date.parse(run.startedAt)\n if (!Number.isFinite(startedAt)) continue\n const startMs = startedAt - turnStartMs\n const live = LIVE_DELEGATION_STATUSES.has(run.status)\n const endMs =\n run.durationMs !== undefined\n ? startMs + run.durationMs\n : live && opts?.nowMs !== undefined\n ? opts.nowMs - turnStartMs\n : startMs\n spans.push({\n id: run.taskId,\n status: live ? 'running' : ERROR_STATUSES.has(run.status) ? 'failed' : 'done',\n kind: 'tool',\n name: `${run.tool} — ${run.detail}`,\n startMs,\n endMs: Math.max(endMs, startMs),\n ...(run.durationMs === undefined ? { approx: true } : {}),\n meta: {\n taskId: run.taskId,\n status: run.status,\n ...(run.costUsd !== undefined ? { costUsd: run.costUsd } : {}),\n ...(run.iteration !== undefined ? { iteration: run.iteration } : {}),\n ...(run.phase !== undefined ? { phase: run.phase } : {}),\n ...(run.traceId !== undefined ? { traceId: run.traceId } : {}),\n ...(run.spanId !== undefined ? { spanId: run.spanId } : {}),\n },\n })\n }\n return spans\n}\n\n/**\n * Reconstruct one delegation's loop → round → iteration tree from its\n * journaled LoopTraceEvents, as FlowSpans relative to `loop.started` (or the\n * first event). Mirrors agent-runtime's `buildLoopOtelSpans` topology:\n * rounds open on `loop.plan` and flush on the next plan / `loop.decision` /\n * `loop.ended`; iterations span `loop.iteration.started` → `.ended`.\n */\nexport function loopTraceEventsToFlowSpans(events: LoopTraceEventLike[]): FlowSpan[] {\n if (events.length === 0) return []\n const ordered = [...events].sort((a, b) => a.timestamp - b.timestamp)\n const started = ordered.find((e) => e.kind === 'loop.started')\n const ended = ordered.find((e) => e.kind === 'loop.ended')\n const origin = started?.timestamp ?? ordered[0]!.timestamp\n const rootEnd = ended?.timestamp ?? ordered[ordered.length - 1]!.timestamp\n const t = (epochMs: number) => epochMs - origin\n const rootId = `loop:${ordered[0]!.runId}`\n\n const spans: FlowSpan[] = []\n const sp = rec(started?.payload)\n const ep = rec(ended?.payload)\n spans.push({\n kind: 'pipeline',\n id: rootId,\n status: ended ? 'done' : 'running',\n name: 'loop',\n startMs: 0,\n endMs: t(rootEnd),\n meta: {\n runId: ordered[0]!.runId,\n ...(str(sp.driver) !== undefined ? { driver: str(sp.driver) } : {}),\n ...(num(ep.totalCostUsd) !== undefined ? { costUsd: num(ep.totalCostUsd) } : {}),\n ...(num(ep.winnerIterationIndex) !== undefined\n ? { winnerIterationIndex: num(ep.winnerIterationIndex) }\n : {}),\n ...(num(ep.iterations) !== undefined ? { iterations: num(ep.iterations) } : {}),\n },\n })\n\n const iterStart = new Map<number, { timestamp: number; parentId: string }>()\n let round: { index: number; startMs: number; meta: Record<string, unknown>; moveKind: string } | undefined\n const flushRound = (endEpochMs: number, running = false) => {\n if (!round) return\n spans.push({\n kind: 'pipeline',\n id: `${rootId}:round-${round.index}`,\n parentId: rootId,\n status: running ? 'running' : 'done',\n name: `loop ▸ round ${round.index} (${round.moveKind})`,\n startMs: round.startMs,\n endMs: t(endEpochMs),\n meta: round.meta,\n })\n round = undefined\n }\n\n for (const e of ordered) {\n const p = rec(e.payload)\n switch (e.kind) {\n case 'loop.plan': {\n flushRound(e.timestamp)\n const index = num(p.roundIndex) ?? 0\n round = {\n index,\n startMs: t(e.timestamp),\n moveKind: str(p.moveKind) ?? 'unknown',\n meta: {\n roundIndex: index,\n moveKind: str(p.moveKind) ?? 'unknown',\n width: num(p.plannedCount) ?? 0,\n ...(str(p.rationale) !== undefined ? { rationale: str(p.rationale) } : {}),\n ...(num(p.parentIndex) !== undefined ? { parentIndex: num(p.parentIndex) } : {}),\n },\n }\n break\n }\n case 'loop.iteration.started': {\n const idx = num(p.iterationIndex)\n if (idx !== undefined) iterStart.set(idx, { timestamp: e.timestamp, parentId: round ? `${rootId}:round-${round.index}` : rootId })\n break\n }\n case 'loop.iteration.ended': {\n const idx = num(p.iterationIndex) ?? 0\n const open = iterStart.get(idx)\n const startEpoch = open?.timestamp ?? e.timestamp\n iterStart.delete(idx)\n const error = str(p.error)\n const verdict = rec(p.verdict)\n const tokens = rec(p.tokenUsage)\n const roundLabel = round ? `round ${round.index} ▸ ` : ''\n spans.push({\n kind: 'model',\n id: `${rootId}:iteration-${idx}`,\n parentId: open?.parentId ?? rootId,\n status: error ? 'failed' : 'done',\n name: `loop ▸ ${roundLabel}iter ${idx} (${str(p.agentRunName) ?? 'agent'})`,\n startMs: t(startEpoch),\n endMs: t(e.timestamp),\n meta: {\n iterationIndex: idx,\n ok: error === undefined,\n ...(error !== undefined ? { error } : {}),\n ...(num(p.costUsd) !== undefined ? { costUsd: num(p.costUsd) } : {}),\n ...(typeof verdict.valid === 'boolean' ? { verdictValid: verdict.valid } : {}),\n ...(num(verdict.score) !== undefined ? { verdictScore: num(verdict.score) } : {}),\n ...(num(tokens.input) !== undefined ? { inputTokens: num(tokens.input) } : {}),\n ...(num(tokens.output) !== undefined ? { outputTokens: num(tokens.output) } : {}),\n },\n })\n break\n }\n case 'loop.decision': {\n if (round) {\n const decision = str(p.decision)\n if (decision !== undefined) round.meta.decision = decision\n flushRound(e.timestamp)\n }\n break\n }\n }\n }\n flushRound(rootEnd, !ended)\n for (const [idx, open] of iterStart) {\n spans.push({ kind: 'model', id: `${rootId}:iteration-${idx}`, parentId: open.parentId,\n name: `loop ▸ iter ${idx}`, startMs: t(open.timestamp), endMs: t(rootEnd),\n status: ended ? 'failed' : 'running', approx: true })\n }\n return spans\n}\n\n/**\n * A single step's activity lane as its own FlowTrace — what a per-step\n * drill-in renders. Origin defaults to the earliest delegation start so the\n * waterfall begins at the lane's first run.\n */\nexport function stepActivityFlowTrace(\n activity: StepAgentActivity[],\n opts?: { startedAt?: number; nowMs?: number },\n): FlowTrace {\n let origin = opts?.startedAt\n if (origin === undefined) {\n for (const run of activity) {\n const parsed = Date.parse(run.startedAt)\n if (Number.isFinite(parsed) && (origin === undefined || parsed < origin)) origin = parsed\n }\n }\n const spans = delegationActivityToFlowSpans(\n activity,\n origin ?? 0,\n opts?.nowMs !== undefined ? { nowMs: opts.nowMs } : undefined,\n )\n let costUsd: number | undefined\n for (const span of spans) {\n const c = num(rec(span.meta).costUsd)\n if (c !== undefined) costUsd = (costUsd ?? 0) + c\n }\n return {\n spans,\n totalMs: spans.reduce((max, s) => Math.max(max, s.endMs), 0),\n promptTokens: 0,\n completionTokens: 0,\n ...(costUsd !== undefined ? { costUsd } : {}),\n toolCalls: spans.length,\n }\n}\n\n/** Define a step in a mission flow with id, intent, optional status, start time, and duration */\nexport interface MissionFlowStep {\n id: string\n intent: string\n status?: string\n /** Epoch ms the step attempt started. Absent → laid out sequentially after\n * the previous step (missions run steps in order), `approx` flagged. */\n startedAt?: number\n durationMs?: number\n}\n\n/**\n * Compose a mission-wide FlowTrace: one 'pipeline' span per step, the step's\n * delegated runs ('tool' spans, from `activity[stepId]`) beneath it. A step\n * span always covers its delegations' extent. Cost is the sum of delegation\n * `costUsd`; token counts are not knowable from the activity lane and stay 0.\n */\nexport function composeMissionFlowTrace(input: {\n steps: MissionFlowStep[]\n /** Delegated-run snapshots keyed by step id (the step's `agentActivity`). */\n activity?: Record<string, StepAgentActivity[]>\n /** Epoch-ms origin. Default: the earliest known step/delegation start. */\n startedAt?: number\n}): FlowTrace {\n const activity = input.activity ?? {}\n\n const startCandidates: number[] = []\n if (input.startedAt !== undefined) startCandidates.push(input.startedAt)\n else {\n for (const step of input.steps) {\n if (step.startedAt !== undefined) startCandidates.push(step.startedAt)\n }\n for (const runs of Object.values(activity)) {\n for (const run of runs) {\n const parsed = Date.parse(run.startedAt)\n if (Number.isFinite(parsed)) startCandidates.push(parsed)\n }\n }\n }\n const origin = startCandidates.length > 0 ? Math.min(...startCandidates) : 0\n\n const spans: FlowSpan[] = []\n let costUsd: number | undefined\n let toolCalls = 0\n let cursorMs = 0\n\n for (const step of input.steps) {\n const inferred = step.startedAt === undefined\n const startMs = inferred ? cursorMs : step.startedAt! - origin\n const runSpans = delegationActivityToFlowSpans(activity[step.id] ?? [], origin)\n const runExtent = runSpans.reduce((max, s) => Math.max(max, s.endMs), startMs)\n const endMs = Math.max(step.durationMs !== undefined ? startMs + step.durationMs : startMs, runExtent)\n\n spans.push({\n kind: 'pipeline',\n id: `step-${step.id}`,\n ...(step.status && LIVE_DELEGATION_STATUSES.has(step.status) ? { status: 'running' as const } : {}),\n name: step.intent,\n startMs,\n endMs,\n ...(inferred || step.durationMs === undefined ? { approx: true } : {}),\n meta: { stepId: step.id, ...(step.status !== undefined ? { status: step.status } : {}) },\n })\n for (const span of runSpans) {\n spans.push({ ...span, id: `step-${step.id}:${span.id}`, parentId: `step-${step.id}`, name: `${step.intent} ▸ ${span.name}` })\n toolCalls++\n const c = num(rec(span.meta).costUsd)\n if (c !== undefined) costUsd = (costUsd ?? 0) + c\n }\n cursorMs = endMs\n }\n\n return {\n spans,\n totalMs: spans.reduce((max, s) => Math.max(max, s.endMs), 0),\n promptTokens: 0,\n completionTokens: 0,\n ...(costUsd !== undefined ? { costUsd } : {}),\n toolCalls,\n }\n}\n"],"mappings":";AAiCA,IAAM,MAAM,CAAC,MACX,OAAO,MAAM,YAAY,OAAO,SAAS,CAAC,IAAI,IAAI;AACpD,IAAM,MAAM,CAAC,MACX,OAAO,MAAM,YAAY,EAAE,SAAS,IAAI,IAAI;AAC9C,IAAM,MAAM,CAAC,MACX,KAAK,OAAO,MAAM,WAAY,IAAgC,CAAC;AAGjE,IAAM,2BAA2B,oBAAI,IAAI,CAAC,WAAW,SAAS,CAAC;AAC/D,IAAM,iBAAiB,oBAAI,IAAI,CAAC,UAAU,SAAS,aAAa,WAAW,MAAM,CAAC;AAU3E,SAAS,8BACd,UACA,aACA,MACY;AACZ,QAAM,QAAoB,CAAC;AAC3B,aAAW,OAAO,UAAU;AAC1B,UAAM,YAAY,KAAK,MAAM,IAAI,SAAS;AAC1C,QAAI,CAAC,OAAO,SAAS,SAAS,EAAG;AACjC,UAAM,UAAU,YAAY;AAC5B,UAAM,OAAO,yBAAyB,IAAI,IAAI,MAAM;AACpD,UAAM,QACJ,IAAI,eAAe,SACf,UAAU,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AAG,KAAK,MAAM,WAAM,KAAK,IAAI,GAAG,CAAC;AAC5H;AACA,YAAM,IAAI,IAAI,IAAI,KAAK,IAAI,EAAE,OAAO;AACpC,UAAI,MAAM,OAAW,YAAW,WAAW,KAAK;AAAA,IAClD;AACA,eAAW;AAAA,EACb;AAEA,SAAO;AAAA,IACL;AAAA,IACA,SAAS,MAAM,OAAO,CAAC,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,KAAK,GAAG,CAAC;AAAA,IAC3D,cAAc;AAAA,IACd,kBAAkB;AAAA,IAClB,GAAI,YAAY,SAAY,EAAE,QAAQ,IAAI,CAAC;AAAA,IAC3C;AAAA,EACF;AACF;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runRouterTurn
3
- } from "./chunk-VJBFCNAU.js";
3
+ } from "./chunk-7D5MHMCP.js";
4
4
 
5
5
  // src/runtime/protected-model.ts
6
6
  import {
@@ -219,4 +219,4 @@ export {
219
219
  createRouterProtectedModelPort,
220
220
  runProtectedRouterTurn
221
221
  };
222
- //# sourceMappingURL=chunk-LO6VQ35O.js.map
222
+ //# sourceMappingURL=chunk-U77HPL3I.js.map
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-3HUFJ5LO.js";
10
10
  import {
11
11
  stepActivityFlowTrace
12
- } from "./chunk-FBVLEGEG.js";
12
+ } from "./chunk-GDUT72VK.js";
13
13
  import {
14
14
  WorkProductCard,
15
15
  workProductPartsFromMessageParts
@@ -69,6 +69,9 @@ import {
69
69
  parsePlanSubmittedEvent,
70
70
  persistedPartToPlan
71
71
  } from "./chunk-WL7PZK7Q.js";
72
+ import {
73
+ FlowWaterfall
74
+ } from "./chunk-276PF4R6.js";
72
75
 
73
76
  // src/web-react/chat-stream.ts
74
77
  function mintThreadId() {
@@ -2613,22 +2616,6 @@ function mergeActivityPages(existing, incoming) {
2613
2616
  for (const row of incoming) byTask.set(row.taskId, row);
2614
2617
  return [...byTask.values()].sort((a, b) => Date.parse(b.startedAt) - Date.parse(a.startedAt));
2615
2618
  }
2616
- function waterfallLayout(trace) {
2617
- const total = trace.totalMs > 0 ? trace.totalMs : 1;
2618
- return [...trace.spans].sort((a, b) => a.startMs - b.startMs).map((span) => {
2619
- const meta = span.meta ?? {};
2620
- const failed = meta.ok === false || typeof meta.status === "string" && activityTone(meta.status) === "error";
2621
- return {
2622
- name: span.name,
2623
- kind: span.kind,
2624
- offsetPct: Math.max(0, Math.min(100, span.startMs / total * 100)),
2625
- widthPct: Math.max(0.5, Math.min(100, (span.endMs - span.startMs) / total * 100)),
2626
- durationLabel: `${((span.endMs - span.startMs) / 1e3).toFixed(1)}s${span.approx ? "~" : ""}`,
2627
- approx: span.approx === true,
2628
- ok: !failed
2629
- };
2630
- });
2631
- }
2632
2619
  function ChevronGlyph({ className }) {
2633
2620
  return /* @__PURE__ */ jsx10("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx10("path", { d: "m6 9 6 6 6-6" }) });
2634
2621
  }
@@ -2690,34 +2677,6 @@ function RunLabel({ tool, detail, live }) {
2690
2677
  ] })
2691
2678
  ] });
2692
2679
  }
2693
- var BAR_CLASS = {
2694
- pipeline: "bg-muted-foreground/30",
2695
- model: "bg-primary/60",
2696
- tool: "bg-primary"
2697
- };
2698
- function FlowWaterfall({ trace }) {
2699
- const rows = waterfallLayout(trace);
2700
- if (rows.length === 0) return null;
2701
- const cost = formatActivityCost(trace.costUsd);
2702
- return /* @__PURE__ */ jsxs9("div", { className: "space-y-1", children: [
2703
- rows.map((row, i) => /* @__PURE__ */ jsxs9("div", { className: "grid grid-cols-[minmax(0,2fr)_minmax(0,3fr)_auto] items-center gap-2", children: [
2704
- /* @__PURE__ */ jsx10("span", { className: "truncate font-mono text-xs text-muted-foreground", title: row.name, children: row.name }),
2705
- /* @__PURE__ */ jsx10("div", { className: "relative h-2 rounded-sm bg-secondary", children: /* @__PURE__ */ jsx10(
2706
- "div",
2707
- {
2708
- className: `absolute inset-y-0 rounded-sm ${row.ok ? BAR_CLASS[row.kind] : "bg-destructive/80"} ${row.approx ? "opacity-70" : ""}`,
2709
- style: { left: `${row.offsetPct}%`, width: `${row.widthPct}%` }
2710
- }
2711
- ) }),
2712
- /* @__PURE__ */ jsx10("span", { className: "shrink-0 font-mono text-xs tabular-nums text-muted-foreground/70", children: row.durationLabel })
2713
- ] }, i)),
2714
- /* @__PURE__ */ jsxs9("p", { className: "pt-0.5 text-right font-mono text-xs tabular-nums text-muted-foreground/60", children: [
2715
- (trace.totalMs / 1e3).toFixed(1),
2716
- "s",
2717
- cost ? ` \xB7 ${cost}` : ""
2718
- ] })
2719
- ] });
2720
- }
2721
2680
  function LaneRow({ run, staggerIndex }) {
2722
2681
  const arrival = useArrivalStyle(staggerIndex);
2723
2682
  const tone = activityTone(run.status);
@@ -7907,8 +7866,6 @@ export {
7907
7866
  formatActivityCost,
7908
7867
  formatActivityDuration,
7909
7868
  mergeActivityPages,
7910
- waterfallLayout,
7911
- FlowWaterfall,
7912
7869
  MissionActivityLane,
7913
7870
  AgentActivityPanel,
7914
7871
  PROVENANCE_BASES,
@@ -7991,4 +7948,4 @@ export {
7991
7948
  AgentProfileChoices,
7992
7949
  ComposerProfilePill
7993
7950
  };
7994
- //# sourceMappingURL=chunk-YI2XZCTP.js.map
7951
+ //# sourceMappingURL=chunk-WEUCLHAP.js.map