@tangle-network/agent-app 0.60.282 → 0.60.284

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 (49) 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 +18 -18
  6. package/dist/{chunk-VJBFCNAU.js → chunk-7D5MHMCP.js} +4 -4
  7. package/dist/{chunk-4P5NFBWX.js → chunk-BI5AZAOO.js} +4 -4
  8. package/dist/chunk-BLCYKYFV.js +346 -0
  9. package/dist/chunk-BLCYKYFV.js.map +1 -0
  10. package/dist/{chunk-FBVLEGEG.js → chunk-GDUT72VK.js} +34 -6
  11. package/dist/chunk-GDUT72VK.js.map +1 -0
  12. package/dist/{chunk-LO6VQ35O.js → chunk-U77HPL3I.js} +2 -2
  13. package/dist/{chunk-YI2XZCTP.js → chunk-XTMRAE6I.js} +5 -48
  14. package/dist/chunk-XTMRAE6I.js.map +1 -0
  15. package/dist/design-canvas/index.js +3 -3
  16. package/dist/design-canvas-react/index.js +4 -4
  17. package/dist/launch-invariants/index.js +8 -8
  18. package/dist/openui/index.js +3 -3
  19. package/dist/platform/index.js +12 -12
  20. package/dist/profile/index.js +1 -1
  21. package/dist/runtime/index.js +3 -3
  22. package/dist/runtime/router-turn.js +2 -2
  23. package/dist/sequences/index.js +5 -5
  24. package/dist/settings-react/index.js +1 -1
  25. package/dist/skills/index.js +3 -3
  26. package/dist/skills-placement/box.js +1 -1
  27. package/dist/skills-placement/index.js +1 -1
  28. package/dist/stories/chat-controls/discovery-waterfall-fixture.d.ts +3 -0
  29. package/dist/theme/tokens.css +72 -0
  30. package/dist/trace/flow-types.d.ts +9 -1
  31. package/dist/trace/index.d.ts +1 -0
  32. package/dist/trace/index.js +14 -1
  33. package/dist/trace/index.js.map +1 -1
  34. package/dist/trace/mission-flow.d.ts +2 -3
  35. package/dist/turn-stream/index.js +3 -3
  36. package/dist/web-react/flow-waterfall-model.d.ts +22 -0
  37. package/dist/web-react/flow-waterfall.css +72 -0
  38. package/dist/web-react/flow-waterfall.d.ts +14 -0
  39. package/dist/web-react/flow-waterfall.js +7 -0
  40. package/dist/web-react/flow-waterfall.js.map +1 -0
  41. package/dist/web-react/index.js +14 -12
  42. package/dist/web-react/mission-activity.d.ts +2 -20
  43. package/dist/work-product/index.js +10 -10
  44. package/package.json +14 -7
  45. package/dist/chunk-FBVLEGEG.js.map +0 -1
  46. package/dist/chunk-YI2XZCTP.js.map +0 -1
  47. /package/dist/{chunk-VJBFCNAU.js.map → chunk-7D5MHMCP.js.map} +0 -0
  48. /package/dist/{chunk-4P5NFBWX.js.map → chunk-BI5AZAOO.js.map} +0 -0
  49. /package/dist/{chunk-LO6VQ35O.js.map → chunk-U77HPL3I.js.map} +0 -0
@@ -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,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
  // 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-BLCYKYFV.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-XTMRAE6I.js.map