@tangle-network/sandbox-cli 0.21.64 → 0.21.65

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 (136) hide show
  1. package/README.md +31 -3
  2. package/SKILL.md +29 -1
  3. package/dist/graph-native-CS_TmaCK.mjs +1 -0
  4. package/dist/graph-viewer/Analytics-bWsqhurt.js +1001 -0
  5. package/dist/graph-viewer/{AnswerStrip-DhwqOyxI.js → AnswerStrip-COxV7gLW.js} +2 -2
  6. package/dist/graph-viewer/Checks-CQGmKcQ0.js +164 -0
  7. package/dist/graph-viewer/Conversations-DgCshBAf.js +627 -0
  8. package/dist/graph-viewer/{Files-DtZhf0ii.js → Files-CvIOGrAs.js} +81 -90
  9. package/dist/graph-viewer/LiveRun-DHmsr6F7.js +311 -0
  10. package/dist/graph-viewer/{Outputs-QET3nPPp.js → Outputs-rwBg_x36.js} +4 -4
  11. package/dist/graph-viewer/Overview-C150tkVa.js +194 -0
  12. package/dist/graph-viewer/{RunOverview-DJQDAMIx.js → RunOverview-CSqsunqf.js} +2 -2
  13. package/dist/graph-viewer/RunPage-F_prVwiV.js +286 -0
  14. package/dist/graph-viewer/Timeline-BFDywlmz.js +335 -0
  15. package/dist/graph-viewer/Today-BdDuqZGF.js +623 -0
  16. package/dist/graph-viewer/Topology-SAfGtd5u.js +238 -0
  17. package/dist/graph-viewer/Traces-BYqXaS_s.js +254 -0
  18. package/dist/graph-viewer/{WallPages-4d9QUZDq.js → WallPages-MM70VZrC.js} +48 -30
  19. package/dist/graph-viewer/agent-runtime.js +55 -55
  20. package/dist/graph-viewer/{data-BJmP7F1M.js → data-DTGmre1W.js} +31 -27
  21. package/dist/graph-viewer/harness-sessions.js +1 -1
  22. package/dist/graph-viewer/index.js +1357 -1392
  23. package/dist/graph-viewer/{lazy-pages-DM0cZM10.js → lazy-pages-BYuq_L_n.js} +9 -5
  24. package/dist/graph-viewer/{outputs-model-CGdvjkQh.js → outputs-model-CHTx8rMz.js} +2 -2
  25. package/dist/graph-viewer/{viewer/plain-words-CgvxtEOa.js → plain-words-BrMHl0On.js} +9 -4
  26. package/dist/graph-viewer/receipt.js +2 -2
  27. package/dist/graph-viewer/record-CsP_3NJS.js +612 -0
  28. package/dist/graph-viewer/record-part-CuT9Xw37.js +334 -0
  29. package/dist/graph-viewer/record.js +2 -336
  30. package/dist/graph-viewer/report-viewer.js +65 -65
  31. package/dist/graph-viewer/report.js +1 -1
  32. package/dist/graph-viewer/research-publication.js +1 -1
  33. package/dist/graph-viewer/{run-files-C1NgzM0l.js → run-files-BckQDdTD.js} +1 -1
  34. package/dist/graph-viewer/{run-receipt-Bvi4-KVM.js → run-receipt-Bt2iXJUy.js} +1 -0
  35. package/dist/graph-viewer/schemas/agent-workspace.play.v1.json +3 -0
  36. package/dist/graph-viewer/schemas/agent-workspace.plays.v1.json +2 -0
  37. package/dist/graph-viewer/schemas/agent-workspace.run.v1.json +1 -0
  38. package/dist/graph-viewer/styles.css +4559 -2385
  39. package/dist/graph-viewer/trace-spans.js +1 -1
  40. package/dist/graph-viewer/ui-xa5w5bEN.js +889 -0
  41. package/dist/graph-viewer/viewer/{AgentGraphCanvas-CMdOlSlh-4EervjeC.js → AgentGraphCanvas-B74GN1o6-BZEumF7-.js} +2610 -2707
  42. package/dist/graph-viewer/viewer/Analytics-E3XS570U.js +1002 -0
  43. package/dist/graph-viewer/viewer/{AnswerStrip-CGUyXuYH.js → AnswerStrip-B7xMU57A.js} +2 -2
  44. package/dist/graph-viewer/viewer/Checks-CJ5XSHbv.js +165 -0
  45. package/dist/graph-viewer/viewer/Conversations-AX8G7Qyl.js +904 -0
  46. package/dist/graph-viewer/viewer/Files-DxL1576V.js +630 -0
  47. package/dist/graph-viewer/viewer/LiveRun-B-BckyEj.js +820 -0
  48. package/dist/graph-viewer/viewer/{Outputs-CumGyjQo.js → Outputs-BoIpgfMv.js} +24 -23
  49. package/dist/graph-viewer/viewer/Overview-Dzg5XJgy.js +436 -0
  50. package/dist/graph-viewer/viewer/RunPage-NtevWXBs.js +285 -0
  51. package/dist/graph-viewer/viewer/{Scores-ZS16yk0n.js → Scores-Dgv4WePL.js} +3 -3
  52. package/dist/graph-viewer/viewer/Timeline-CzY3LVDu.js +335 -0
  53. package/dist/graph-viewer/viewer/Today-Bi9IIwuh.js +623 -0
  54. package/dist/graph-viewer/viewer/Topology-CzjqSFXH.js +239 -0
  55. package/dist/graph-viewer/viewer/Traces-CMX0H1VU.js +254 -0
  56. package/dist/graph-viewer/viewer/{WallPages-CzWpyIfp.js → WallPages-Clj4bORg.js} +50 -32
  57. package/dist/graph-viewer/viewer/addon-webgl-BSCscllv.js +4027 -0
  58. package/dist/graph-viewer/viewer/agent-record-BrP-ENHg.css +2 -0
  59. package/dist/graph-viewer/viewer/{bot-D6Nrej7Z.js → bot-BaQU59LG.js} +1 -1
  60. package/dist/graph-viewer/viewer/{chevron-right-D_5IKLxu.js → chevron-right-Xn05jYLT.js} +1 -1
  61. package/dist/graph-viewer/viewer/{createLucideIcon-yH0cxLMy.js → createLucideIcon-BSphcoOJ.js} +1 -1
  62. package/dist/graph-viewer/viewer/dashboard-D3JhmRhe-DSl0zhkw.js +371 -0
  63. package/dist/graph-viewer/viewer/{data-CkWfWr7i.js → data-CVHeKhrh.js} +144 -139
  64. package/dist/graph-viewer/viewer/dist-4_KJz8ZM.js +349 -0
  65. package/dist/graph-viewer/viewer/dist-Dy-wrdTt.js +1615 -0
  66. package/dist/graph-viewer/viewer/es2015-utW4DTOJ.js +3506 -0
  67. package/dist/graph-viewer/viewer/{final-output-kwY11u9X.js → final-output-BYT-g-9j.js} +1 -1
  68. package/dist/graph-viewer/viewer/flow-waterfall-model-DvrgPLGS-BdThSFH-.js +2696 -0
  69. package/dist/graph-viewer/viewer/git-branch-BzTbIcYL.js +28 -0
  70. package/dist/graph-viewer/viewer/{highlights-Btsi5OXl.js → highlights-DWeSCtiR.js} +4 -4
  71. package/dist/graph-viewer/viewer/jsx-runtime-DPT6sCLq.js +319 -0
  72. package/dist/graph-viewer/viewer/lazy-pages-ChiMJ8r_.js +803 -0
  73. package/dist/graph-viewer/viewer/{markdown-CX_sVrXB.js → markdown-lADwhD7y.js} +2324 -2608
  74. package/dist/graph-viewer/viewer/model-brand-bTcMjQtB-RSb7EbGB.js +476 -0
  75. package/dist/graph-viewer/viewer/{page-header-Brq611fd.js → page-header-QbUg8F8i.js} +12 -11
  76. package/dist/graph-viewer/{plain-words-CgvxtEOa.js → viewer/plain-words-BrMHl0On.js} +9 -4
  77. package/dist/graph-viewer/viewer/primitives-znfPK9NP-B6UO7uDr.js +346 -0
  78. package/dist/graph-viewer/viewer/react-DQ7E2Epi.js +4254 -0
  79. package/dist/graph-viewer/viewer/{react-dom-t1L4_-il.js → react-dom-BEusmvQH.js} +1 -1
  80. package/dist/graph-viewer/viewer/record-DZnT6SWN-H-ul3U3a.js +3523 -0
  81. package/dist/graph-viewer/viewer/record-W39D5MO-.js +1 -0
  82. package/dist/graph-viewer/viewer/record-part-CbweyYoV.js +335 -0
  83. package/dist/graph-viewer/viewer/{segmented-control-BaJmvTNd.js → segmented-control-Di1mbQlP.js} +27 -26
  84. package/dist/graph-viewer/viewer/{shiki-Qnby7Sh6.js → shiki-BfNNlmfZ.js} +15 -15
  85. package/dist/graph-viewer/viewer/status-meta-S0kV_RDp.js +273 -0
  86. package/dist/graph-viewer/viewer/{stream-tokenizer-CWtnjmRd.js → stream-tokenizer-B5wWaM3U.js} +12 -12
  87. package/dist/graph-viewer/viewer/{themes-1i1fzpRk.js → themes-DuRxHiga.js} +1 -1
  88. package/dist/graph-viewer/viewer/ui-Co03nZUX.js +889 -0
  89. package/dist/graph-viewer/viewer/utils-BuObIC0n.js +1815 -0
  90. package/dist/graph-viewer/viewer/workbench-E6_5q_oL.js +28351 -0
  91. package/dist/graph-viewer/viewer/workflows--mZpHYqo.js +3298 -0
  92. package/dist/graph-viewer/viewer/workspace-cKs9sGEO.js +2468 -0
  93. package/dist/graph-viewer/{workspace-model-Ewf17pTW.js → workspace-model-BkPl_J8E.js} +1 -1
  94. package/dist/graph-viewer/workspace-viewer.js +7452 -7489
  95. package/dist/graph-viewer/workspace.js +1 -1
  96. package/dist/index.mjs +27 -22
  97. package/package.json +9 -8
  98. package/dist/graph-viewer/Analytics-DFWW8Phh.js +0 -938
  99. package/dist/graph-viewer/Checks-qgqV4xgV.js +0 -155
  100. package/dist/graph-viewer/Conversations-CGB45kpj.js +0 -545
  101. package/dist/graph-viewer/LiveRun-C21wUKAY.js +0 -210
  102. package/dist/graph-viewer/Overview-BjeLsA2I.js +0 -506
  103. package/dist/graph-viewer/RunPage-CkkcBEUe.js +0 -258
  104. package/dist/graph-viewer/Timeline-C2Xolk0t.js +0 -293
  105. package/dist/graph-viewer/Today-BVVDtSVN.js +0 -660
  106. package/dist/graph-viewer/Topology-DO5XX8e4.js +0 -545
  107. package/dist/graph-viewer/Traces-BhMxjNgw.js +0 -259
  108. package/dist/graph-viewer/part-events-BrLrg_EV.js +0 -276
  109. package/dist/graph-viewer/record-part-CZal_IMH.js +0 -1408
  110. package/dist/graph-viewer/ui-D8QZRsC3.js +0 -938
  111. package/dist/graph-viewer/viewer/Analytics-DD__nbLm.js +0 -939
  112. package/dist/graph-viewer/viewer/Checks-Ds5M7eAW.js +0 -156
  113. package/dist/graph-viewer/viewer/Conversations-C1n0EBBd.js +0 -819
  114. package/dist/graph-viewer/viewer/Files-Cjr7NMU_.js +0 -448
  115. package/dist/graph-viewer/viewer/LiveRun-uPTkPSjo.js +0 -6772
  116. package/dist/graph-viewer/viewer/Overview-4Umk14_2.js +0 -507
  117. package/dist/graph-viewer/viewer/RunPage-DZlBW7Va.js +0 -257
  118. package/dist/graph-viewer/viewer/Timeline-BnK6-yBR.js +0 -294
  119. package/dist/graph-viewer/viewer/Today-a_-oNigi.js +0 -660
  120. package/dist/graph-viewer/viewer/Topology-CQPCLQT6.js +0 -546
  121. package/dist/graph-viewer/viewer/Traces-C0IGk0L4.js +0 -259
  122. package/dist/graph-viewer/viewer/WorkflowGraph-DZ3xejKE-jRXKeSrg.js +0 -1559
  123. package/dist/graph-viewer/viewer/agent-record-Dw772ROs.css +0 -2
  124. package/dist/graph-viewer/viewer/agent-timeline-Cs9Qbpvo.js +0 -1798
  125. package/dist/graph-viewer/viewer/dist-C1-7EfoW.js +0 -488
  126. package/dist/graph-viewer/viewer/file-text-m7a3piQF.js +0 -47
  127. package/dist/graph-viewer/viewer/jsx-runtime-DQWyJOhv.js +0 -2136
  128. package/dist/graph-viewer/viewer/lazy-pages-BowaGsg-.js +0 -20
  129. package/dist/graph-viewer/viewer/model-brand-bTcMjQtB-fagiBQam.js +0 -723
  130. package/dist/graph-viewer/viewer/popover-CvOAjlnk.js +0 -5329
  131. package/dist/graph-viewer/viewer/react-CY3IbSNO.js +0 -4262
  132. package/dist/graph-viewer/viewer/record-part-D3_Anfpe.js +0 -1329
  133. package/dist/graph-viewer/viewer/terminal-83J_I4Ne.js +0 -52
  134. package/dist/graph-viewer/viewer/ui-C9b1rIUH.js +0 -938
  135. package/dist/graph-viewer/viewer/workspace-CekmOBs3.js +0 -25100
  136. package/dist/graph-viewer/viewer/x-DOc2URqZ.js +0 -56
@@ -6,14 +6,18 @@ var n = (e) => {
6
6
  t = Number(sessionStorage.getItem("ar-chunk-reload")) || 0, sessionStorage.setItem("ar-chunk-reload", String(Date.now()));
7
7
  } catch {}
8
8
  return typeof location > "u" || Date.now() - t <= 6e4 ? Promise.reject(e) : (location.reload(), new Promise(() => {}));
9
- }, r = () => import("./RunPage-CkkcBEUe.js").catch(n);
9
+ }, r = () => import("./RunPage-F_prVwiV.js").catch(n);
10
10
  typeof location < "u" && location.pathname.startsWith("/run/") && r();
11
- var i = t(() => r().then((e) => ({ default: e.RunPage }))), a = () => import("./WallPages-4d9QUZDq.js").catch(n), o = {
12
- live: t(() => import("./LiveRun-C21wUKAY.js").catch(n).then((e) => ({ default: e.LiveRun }))),
13
- today: t(() => import("./Today-BVVDtSVN.js").catch(n).then((e) => ({ default: e.TodayPage }))),
11
+ var i = t(() => r().then((e) => ({ default: e.RunPage }))), a = () => import("./WallPages-MM70VZrC.js").catch(n), o = {
12
+ live: t(() => import("./LiveRun-DHmsr6F7.js").catch(n).then((e) => ({ default: e.LiveRun }))),
13
+ today: t(() => import("./Today-BdDuqZGF.js").catch(n).then((e) => ({ default: e.TodayPage }))),
14
14
  fleet: t(() => a().then((e) => ({ default: e.FleetPage }))),
15
15
  sandboxes: t(() => a().then((e) => ({ default: e.SandboxesPage }))),
16
16
  ideas: t(() => a().then((e) => ({ default: e.IdeasPage })))
17
- }, s = (e) => e in o, c = ({ mode: t, api: n }) => e(o[t], { api: n }), l = t(() => import("./Outputs-QET3nPPp.js").catch(n).then((e) => ({ default: e.OutputsView }))), u = t(() => import("./Outputs-QET3nPPp.js").catch(n).then((e) => ({ default: e.OutputChanges })));
17
+ }, s = (e) => e in o, c = ({ mode: t, api: n, transport: r }) => t === "live" ? e(o.live, {
18
+ key: n,
19
+ api: n,
20
+ transport: r
21
+ }) : e(o[t], { api: n }), l = t(() => import("./Outputs-rwBg_x36.js").catch(n).then((e) => ({ default: e.OutputsView }))), u = t(() => import("./Outputs-rwBg_x36.js").catch(n).then((e) => ({ default: e.OutputChanges })));
18
22
  //#endregion
19
23
  export { s as a, i, l as n, n as o, c as r, u as t };
@@ -1,5 +1,5 @@
1
- import { m as e, p as t } from "./data-BJmP7F1M.js";
2
- import { f as n } from "./RunOverview-DJQDAMIx.js";
1
+ import { m as e, p as t } from "./data-DTGmre1W.js";
2
+ import { f as n } from "./RunOverview-CSqsunqf.js";
3
3
  import { useState as r } from "react";
4
4
  import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
5
5
  //#region src/workspace/scores-model.ts
@@ -1,17 +1,22 @@
1
1
  //#region src/workspace/plain-words.ts
2
- var e = (e) => ({
2
+ var e = (e) => new Date(e).toLocaleDateString("en-US", {
3
+ month: "short",
4
+ day: "numeric",
5
+ timeZone: "UTC"
6
+ }), t = (e) => new Date(e).toISOString().slice(11, 16), n = (e) => ({
3
7
  pass: "passed",
4
8
  fail: "failed",
5
9
  unrun: "not run yet",
6
10
  undecided: "undecided"
7
11
  })[e] ?? e;
8
- function t(e, t = 20) {
12
+ function r(e, t = 20) {
9
13
  let n = (e ?? "").replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/(\*\*|__|`)(.+?)\1/g, "$2").replace(/^[#>\s]+/, "").replace(/\s+/g, " ").trim(), r = n.split(/(?<=[.!?])\s/)[0] ?? n, i = r.split(" ");
10
14
  return i.length > t ? `${i.slice(0, t).join(" ")}…` : r;
11
15
  }
12
- function n(e) {
16
+ var i = (n) => n && !Number.isNaN(Date.parse(n)) ? `${e(Date.parse(n))} ${t(Date.parse(n))}Z` : null;
17
+ function a(e) {
13
18
  let t = (e ?? "").trim();
14
19
  return t.replace(/^Play [\w.-]+:\s*/, "").replace(/^[A-Z][\w .'-]{0,40},\s*\d{4}-\d{2}-\d{2}:\s*(\u201c[^\u201d]*\u201d|"[^"]*")[.,]?\s*/, "").trim() || t;
15
20
  }
16
21
  //#endregion
17
- export { t as n, e as r, n as t };
22
+ export { n as i, r as n, i as r, a as t };
@@ -1,5 +1,5 @@
1
- import { n as e } from "./run-receipt-Bvi4-KVM.js";
2
- import { n as t } from "./RunOverview-DJQDAMIx.js";
1
+ import { n as e } from "./run-receipt-Bt2iXJUy.js";
2
+ import { n as t } from "./RunOverview-CSqsunqf.js";
3
3
  import { jsx as n } from "react/jsx-runtime";
4
4
  import { renderToStaticMarkup as r } from "react-dom/server";
5
5
  //#region src/receipt.tsx
@@ -0,0 +1,612 @@
1
+ import { z as e } from "zod";
2
+ //#region src/adapters/part-events.ts
3
+ var t = (e) => typeof e == "string" ? e : e == null ? "" : JSON.stringify(e), n = (e) => typeof e == "number" && Number.isFinite(e) ? e : void 0, r = (e) => {
4
+ if (typeof e != "string" && typeof e != "number") return null;
5
+ let t = new Date(typeof e == "number" && e < 1e11 ? e * 1e3 : e);
6
+ return Number.isFinite(t.valueOf()) && t.valueOf() >= Date.UTC(2001, 0, 1) && t.valueOf() < Date.UTC(2100, 0, 1) ? t.toISOString() : null;
7
+ };
8
+ function i(e, i, a, o, s, c, l) {
9
+ let u = 0, d = [], f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), h = [], g = i.start ? Date.parse(i.start) : null, _, v = null, y = [];
10
+ s.forEach((e, t) => {
11
+ let r = e?.data ?? {};
12
+ if (e?.type === "message.updated" && r.info?.id && r.info?.role) f.set(r.info.id, r.info.role);
13
+ else if (e?.type === "message.part.updated" && r.part?.id) {
14
+ let e = r.part, i = n(e.state?.time?.start) ?? n(e.time?.start);
15
+ i !== void 0 && (g = Math.max(g ?? 0, i)), p.has(e.id) || d.push(e.id);
16
+ let a = p.get(e.id);
17
+ p.set(e.id, {
18
+ part: e,
19
+ index: t,
20
+ firstMs: a?.firstMs ?? g
21
+ });
22
+ let o = n(e.state?.time?.end) ?? n(e.time?.end);
23
+ o !== void 0 && (g = Math.max(g ?? 0, o));
24
+ } else if (e?.type === "raw" && r.event?.type === "item.completed" && r.event.item?.id) {
25
+ let e = r.event.item;
26
+ m.has(e.id) || h.push(e.id), m.set(e.id, {
27
+ item: e,
28
+ index: t,
29
+ firstMs: g
30
+ });
31
+ } else e?.type === "raw" && r.event?.role === "tool" && typeof r.event.tool_call_id == "string" ? y.push({
32
+ index: t,
33
+ at: g,
34
+ kind: "tool-result",
35
+ data: r.event
36
+ }) : e?.type === "raw" && r.event?.type === "rate_limit_event" ? y.push({
37
+ index: t,
38
+ at: g,
39
+ kind: "rate-limit",
40
+ data: r.event.rate_limit_info ?? {}
41
+ }) : e?.type === "done" ? v = {
42
+ data: r,
43
+ usage: e.usage,
44
+ index: t
45
+ } : e?.type === "result" && r.outcome && r.outcome.type !== "completed" && y.push({
46
+ index: t,
47
+ at: g,
48
+ kind: "execution-error",
49
+ data: r.outcome
50
+ });
51
+ });
52
+ let b = (e) => r(e ?? void 0) ?? i.start ?? null;
53
+ for (let r of d) {
54
+ let { part: s, index: d } = p.get(r), m = p.get(r).firstMs, h = f.get(s.messageID) === "user" ? "user" : "assistant";
55
+ if (s.type === "text" || s.type === "reasoning") {
56
+ let l = t(s.text);
57
+ if (!l) continue;
58
+ let f = e.clip(l, () => c.full(d, [
59
+ "data",
60
+ "part",
61
+ "text"
62
+ ], l)), p = b(n(s.time?.start) ?? m);
63
+ if (!p) continue;
64
+ e.emit({
65
+ node: i.id,
66
+ at: p,
67
+ kind: "message",
68
+ category: "reasoning",
69
+ label: h,
70
+ source: {
71
+ path: a,
72
+ sha256: o.sha256,
73
+ ...c.where(d)
74
+ },
75
+ detail: {
76
+ role: h,
77
+ nativeRecordId: r,
78
+ ...s.type === "text" ? { publicText: f.text } : { reasoning: f.text },
79
+ ...f.clip ? { clip: f.clip } : {},
80
+ ...s.time?.start ? {} : { atBasis: "carried" }
81
+ }
82
+ }), u++, h === "assistant" && (_ = e.events.at(-1));
83
+ } else if (s.type === "tool") {
84
+ let f = s.state ?? {}, p = t(s.tool), h = t(s.callID || r), g = l(p, f.input), _ = e.clip(JSON.stringify(f.input ?? {}), () => c.full(d, [
85
+ "data",
86
+ "part",
87
+ "state",
88
+ "input"
89
+ ], f.input ?? {})), v = n(f.time?.start) ?? m, y = b(v);
90
+ if (!y) continue;
91
+ let x = f.status === "completed" || f.status === "error";
92
+ if (e.emit({
93
+ node: i.id,
94
+ at: y,
95
+ kind: "message",
96
+ category: g,
97
+ label: `assistant · ${p}`,
98
+ source: {
99
+ path: a,
100
+ sha256: o.sha256,
101
+ ...c.where(d),
102
+ ...x ? { item: 0 } : {}
103
+ },
104
+ detail: {
105
+ role: "assistant",
106
+ nativeRecordId: r,
107
+ publicToolCalls: [{
108
+ id: h,
109
+ name: p,
110
+ input: _.text,
111
+ ..._.clip ? { clip: _.clip } : {}
112
+ }]
113
+ }
114
+ }), u++, x) {
115
+ let s = f.status === "error" ? "error" : "output", l = t(f[s]), u = e.clip(l, () => c.full(d, [
116
+ "data",
117
+ "part",
118
+ "state",
119
+ s
120
+ ], f[s])), m = n(f.time?.end);
121
+ e.emit({
122
+ node: i.id,
123
+ at: b(m ?? v),
124
+ kind: "tool-result",
125
+ category: g,
126
+ label: `tool result · ${p}`,
127
+ source: {
128
+ path: a,
129
+ sha256: o.sha256,
130
+ ...c.where(d),
131
+ item: 1
132
+ },
133
+ detail: {
134
+ role: "toolResult",
135
+ nativeRecordId: r,
136
+ toolCallId: h,
137
+ isError: f.status === "error",
138
+ publicText: u.text,
139
+ ...u.clip ? { clip: u.clip } : {},
140
+ ...m !== void 0 && v != null ? { durationMs: Math.max(0, m - v) } : {}
141
+ }
142
+ });
143
+ }
144
+ }
145
+ }
146
+ for (let n of h) {
147
+ let { item: r, index: s, firstMs: d } = m.get(n);
148
+ if (r.type !== "command_execution" && r.type !== "mcp_tool_call" && r.type !== "web_search" && r.type !== "file_change") continue;
149
+ let f = b(d);
150
+ if (!f) continue;
151
+ let p = r.type === "mcp_tool_call" ? t(r.tool ?? r.name) : r.type, h = r.type === "command_execution" ? { command: r.command } : r.type === "web_search" ? { query: r.query } : r.type === "file_change" ? { changes: r.changes } : r.arguments ?? {}, g = e.clip(JSON.stringify(h), () => c.full(s, [
152
+ "data",
153
+ "event",
154
+ "item"
155
+ ], r)), _ = l(p, h);
156
+ e.emit({
157
+ node: i.id,
158
+ at: f,
159
+ kind: "message",
160
+ category: _,
161
+ label: `assistant · ${p}`,
162
+ source: {
163
+ path: a,
164
+ sha256: o.sha256,
165
+ ...c.where(s),
166
+ item: 0
167
+ },
168
+ detail: {
169
+ role: "assistant",
170
+ nativeRecordId: t(n),
171
+ publicToolCalls: [{
172
+ id: t(n),
173
+ name: p,
174
+ input: g.text,
175
+ ...g.clip ? { clip: g.clip } : {}
176
+ }]
177
+ }
178
+ });
179
+ let v = t(r.aggregated_output ?? r.result ?? r.output ?? r.status), y = e.clip(v, () => c.full(s, [
180
+ "data",
181
+ "event",
182
+ "item"
183
+ ], r));
184
+ e.emit({
185
+ node: i.id,
186
+ at: f,
187
+ kind: "tool-result",
188
+ category: _,
189
+ label: `tool result · ${p}`,
190
+ source: {
191
+ path: a,
192
+ sha256: o.sha256,
193
+ ...c.where(s),
194
+ item: 1
195
+ },
196
+ detail: {
197
+ role: "toolResult",
198
+ nativeRecordId: t(n),
199
+ toolCallId: t(n),
200
+ isError: typeof r.exit_code == "number" && r.exit_code !== 0 || r.status === "failed",
201
+ publicText: y.text,
202
+ ...y.clip ? { clip: y.clip } : {},
203
+ atBasis: "carried"
204
+ }
205
+ }), u += 2;
206
+ }
207
+ for (let r of y) {
208
+ let s = b(r.at);
209
+ if (!s) continue;
210
+ if (r.kind === "tool-result") {
211
+ let n = r.data.content, l = typeof n == "string" ? n : Array.isArray(n) ? n.map((e) => t(e?.text ?? e)).join("\n") : t(n), d = e.clip(l, () => c.full(r.index, [
212
+ "data",
213
+ "event",
214
+ "content"
215
+ ], n));
216
+ e.emit({
217
+ node: i.id,
218
+ at: s,
219
+ kind: "tool-result",
220
+ category: "other",
221
+ label: "tool result",
222
+ source: {
223
+ path: a,
224
+ sha256: o.sha256,
225
+ ...c.where(r.index)
226
+ },
227
+ detail: {
228
+ role: "toolResult",
229
+ toolCallId: t(r.data.tool_call_id),
230
+ isError: /<system>ERROR/.test(l),
231
+ publicText: d.text,
232
+ ...d.clip ? { clip: d.clip } : {},
233
+ atBasis: "carried"
234
+ }
235
+ }), u++;
236
+ continue;
237
+ }
238
+ let l = r.data.rateLimitType ?? null, d = l ? n(r.data.unifiedWindows?.[l]?.utilization) ?? null : null;
239
+ e.emit({
240
+ node: i.id,
241
+ at: s,
242
+ kind: r.kind,
243
+ category: "lifecycle",
244
+ label: r.kind === "rate-limit" ? `rate limit · ${l ?? "window unknown"}` : "execution error",
245
+ source: {
246
+ path: a,
247
+ sha256: o.sha256,
248
+ ...c.where(r.index)
249
+ },
250
+ detail: r.kind === "rate-limit" ? {
251
+ rateLimit: {
252
+ window: l,
253
+ utilization: d,
254
+ status: r.data.status ?? null
255
+ },
256
+ data: e.compactValue(r.data)
257
+ } : {
258
+ responseStatus: "error",
259
+ isError: !0,
260
+ publicText: e.clip(t(r.data.error ?? r.data), null).text
261
+ }
262
+ });
263
+ }
264
+ if (v) {
265
+ let t = v.data?.effectiveBackend;
266
+ typeof t?.model == "string" && (i.servedModel ??= t.model, i.modelSource ??= "effective backend");
267
+ let r = v.usage ?? v.data?.tokenUsage, o = n(r?.cost) ?? n(v.data?.totalCostUsd), s = _ ?? [...e.events].reverse().find((t) => t.node === i.id && t.source?.path === e.sourcePath(a)), c = (v.data?.tokensKnown === !1 || v.tokensKnown === !1) && !n(r?.inputTokens) && !n(r?.outputTokens) && !n(r?.cacheReadInputTokens) && !n(r?.cacheCreationInputTokens) && !o;
268
+ s && r && !c && (s.detail.usage = {
269
+ input: n(r.inputTokens),
270
+ output: n(r.outputTokens),
271
+ cacheRead: n(r.cacheReadInputTokens),
272
+ cacheWrite: n(r.cacheCreationInputTokens)
273
+ }, s.detail.usageScope = "execution-total", o !== void 0 && (s.detail.costListUsd = o, s.detail.usdKnown = !1));
274
+ }
275
+ return u;
276
+ }
277
+ //#endregion
278
+ //#region src/record.ts
279
+ var a = e.iso.datetime({ offset: !0 }), o = e.record(e.string(), e.unknown()), s = e.object({
280
+ path: e.string(),
281
+ sha256: e.string().regex(/^[0-9a-f]{64}$/).optional(),
282
+ line: e.number().int().positive().optional(),
283
+ pointer: e.string().startsWith("/").optional()
284
+ }).catchall(e.unknown()), c = e.object({
285
+ channel: e.string(),
286
+ status: e.enum([
287
+ "complete",
288
+ "lossy",
289
+ "absent"
290
+ ]),
291
+ reason: e.string().nullable()
292
+ }).catchall(e.unknown()), l = e.object({
293
+ runId: e.string().optional(),
294
+ nodeId: e.string().nullable().optional(),
295
+ code: e.string(),
296
+ detail: e.string()
297
+ }).catchall(e.unknown()), u = e.string().regex(/^[0-9a-f]{64}$/), d = e.string().regex(/^sha256:[0-9a-f]{64}$/), f = e.object({
298
+ pageSha256: u,
299
+ claimId: e.string().min(1)
300
+ }).catchall(e.unknown()), p = e.object({
301
+ id: e.string().min(1),
302
+ kind: e.string().min(1),
303
+ title: e.string(),
304
+ digest: u.optional(),
305
+ sessionNodeId: e.string().optional(),
306
+ eventId: e.string().optional(),
307
+ source: s.nullish()
308
+ }).catchall(e.unknown()), m = f.extend({
309
+ statement: e.string(),
310
+ agentNodeId: e.string().optional(),
311
+ eventId: e.string().optional(),
312
+ runId: e.string().optional()
313
+ }).catchall(e.unknown()), h = e.object({
314
+ id: e.string().min(1),
315
+ subject: f,
316
+ reviewerSessionNodeId: e.string().min(1),
317
+ judgment: e.string().min(1),
318
+ at: a.nullish(),
319
+ eventId: e.string().optional()
320
+ }).catchall(e.unknown()), g = e.object({
321
+ id: e.string().min(1),
322
+ kind: e.string().min(1),
323
+ title: e.string(),
324
+ url: e.url().nullish(),
325
+ sessionNodeId: e.string().optional(),
326
+ cites: e.array(f.extend({ verdictId: e.string().optional() }))
327
+ }).catchall(e.unknown()), _ = e.object({
328
+ digest: d,
329
+ parents: e.array(d),
330
+ runId: e.string().optional(),
331
+ authorNodeId: e.string().optional(),
332
+ title: e.string().optional()
333
+ }).catchall(e.unknown()), v = e.object({
334
+ from: e.string().min(1),
335
+ to: e.string().min(1),
336
+ basis: e.string().min(1),
337
+ at: a.nullish(),
338
+ reason: e.string().nullish(),
339
+ source: s.nullish()
340
+ }).catchall(e.unknown()), y = e.object({
341
+ nodeId: e.string().min(1),
342
+ runId: e.string().min(1),
343
+ recordDigest: e.string().nullish(),
344
+ href: e.string().nullish()
345
+ }).catchall(e.unknown()), b = e.object({
346
+ schema: e.literal("agent-record.v1"),
347
+ runId: e.string().min(1),
348
+ title: e.string(),
349
+ nodes: e.array(e.object({
350
+ id: e.string().min(1),
351
+ label: e.string(),
352
+ parent: e.string().nullable().default(null),
353
+ kind: e.enum([
354
+ "agent",
355
+ "session",
356
+ "finding"
357
+ ]),
358
+ role: e.string().optional(),
359
+ assignment: e.string().optional(),
360
+ model: e.string().nullable().optional(),
361
+ start: a.optional(),
362
+ end: a.optional(),
363
+ status: e.string().optional(),
364
+ nativeSessionId: e.string().optional(),
365
+ agentId: e.string().optional(),
366
+ joinBasis: e.string().optional(),
367
+ joinProof: o.optional(),
368
+ modelSource: e.string().optional(),
369
+ servedModel: e.string().nullable().optional(),
370
+ harness: e.string().nullable().optional(),
371
+ sandboxes: e.array(e.string()).optional(),
372
+ capture: c.optional(),
373
+ captureNote: e.string().optional()
374
+ }).catchall(e.unknown())),
375
+ events: e.array(e.object({
376
+ id: e.string().min(1),
377
+ node: e.string().min(1),
378
+ at: a,
379
+ kind: e.string(),
380
+ category: e.string().default("other"),
381
+ activity: e.string().optional(),
382
+ end: a.optional(),
383
+ phase: e.enum([
384
+ "tool",
385
+ "model",
386
+ "idle"
387
+ ]).optional(),
388
+ label: e.string(),
389
+ source: s.nullable().optional(),
390
+ detail: e.object({
391
+ role: e.string().optional(),
392
+ publicText: e.string().optional(),
393
+ publicationNote: e.string().nullish(),
394
+ contentOmitted: e.string().optional(),
395
+ publicToolCalls: e.array(e.object({
396
+ id: e.string(),
397
+ name: e.string(),
398
+ input: e.string().optional(),
399
+ publicationNote: e.string().nullish()
400
+ }).catchall(e.unknown())).optional(),
401
+ toolCallIds: e.array(e.string()).optional(),
402
+ toolNames: e.array(e.string()).optional(),
403
+ toolCallId: e.string().optional(),
404
+ isError: e.boolean().optional(),
405
+ responseStatus: e.string().optional(),
406
+ recordedClaim: e.string().optional(),
407
+ assessment: e.string().optional(),
408
+ usage: e.object({
409
+ input: e.number().nonnegative().optional(),
410
+ output: e.number().nonnegative().optional(),
411
+ cacheRead: e.number().nonnegative().optional(),
412
+ cacheWrite: e.number().nonnegative().optional()
413
+ }).catchall(e.unknown()).nullish(),
414
+ reasoning: e.string().optional(),
415
+ reasoningOmitted: e.number().int().nonnegative().optional(),
416
+ reasoningRedacted: e.number().int().nonnegative().optional(),
417
+ durationMs: e.number().nonnegative().optional(),
418
+ costListUsd: e.number().nonnegative().optional(),
419
+ usdKnown: e.boolean().optional(),
420
+ rateLimit: e.object({
421
+ window: e.string().nullable(),
422
+ utilization: e.number().nullable(),
423
+ status: e.string().nullable()
424
+ }).catchall(e.unknown()).optional(),
425
+ clip: e.object({
426
+ bytes: e.number().int().nonnegative(),
427
+ sha256: e.string().regex(/^[0-9a-f]{64}$/).nullable()
428
+ }).catchall(e.unknown()).optional()
429
+ }).catchall(e.unknown())
430
+ }).catchall(e.unknown())),
431
+ artifacts: e.array(p).optional(),
432
+ claims: e.array(m).optional(),
433
+ verdicts: e.array(h).optional(),
434
+ publications: e.array(g).optional(),
435
+ profileVersions: e.array(_).optional(),
436
+ runs: e.array(y).optional(),
437
+ forks: e.array(v).optional(),
438
+ sources: e.array(s.extend({ bytes: e.number().nonnegative().optional() })).default([]),
439
+ assignment: e.object({
440
+ objective: e.string(),
441
+ suppliedKnowledge: e.string(),
442
+ deliverables: e.string(),
443
+ constraints: e.string(),
444
+ source: s.nullable()
445
+ }).catchall(e.unknown()).default({
446
+ objective: "",
447
+ suppliedKnowledge: "",
448
+ deliverables: "",
449
+ constraints: "",
450
+ source: null
451
+ }),
452
+ terminal: e.object({
453
+ kind: e.string().nullable(),
454
+ reason: e.string().nullable()
455
+ }).catchall(e.unknown()).nullable().default(null),
456
+ coverage: e.object({
457
+ completeOriginalCapture: e.boolean(),
458
+ publicContent: e.string(),
459
+ categoryMethod: e.string(),
460
+ cost: e.string(),
461
+ nodes: e.array(c.extend({ nodeId: e.string() })).optional(),
462
+ gaps: e.array(l).optional()
463
+ }).catchall(e.unknown()).default({
464
+ completeOriginalCapture: !1,
465
+ publicContent: "",
466
+ categoryMethod: "",
467
+ cost: "Unknown"
468
+ })
469
+ }).catchall(e.unknown()).superRefine((e, t) => {
470
+ let n = new Map(e.nodes.map((e) => [e.id, e]));
471
+ n.size !== e.nodes.length && t.addIssue({
472
+ code: "custom",
473
+ path: ["nodes"],
474
+ message: "Node IDs must be unique within a run"
475
+ }), new Set(e.events.map((e) => e.id)).size !== e.events.length && t.addIssue({
476
+ code: "custom",
477
+ path: ["events"],
478
+ message: "Event IDs must be unique within a run"
479
+ });
480
+ for (let [r, i] of e.nodes.entries()) {
481
+ i.agentId && (i.kind !== "session" || n.get(i.agentId)?.kind !== "agent") && t.addIssue({
482
+ code: "custom",
483
+ path: [
484
+ "nodes",
485
+ r,
486
+ "agentId"
487
+ ],
488
+ message: "A proven session join must reference an existing agent"
489
+ });
490
+ let e = /* @__PURE__ */ new Set([i.id]), a = i.parent;
491
+ for (; a && n.has(a);) {
492
+ if (e.has(a)) {
493
+ t.addIssue({
494
+ code: "custom",
495
+ path: [
496
+ "nodes",
497
+ r,
498
+ "parent"
499
+ ],
500
+ message: "Parent relationships must not contain a cycle"
501
+ });
502
+ break;
503
+ }
504
+ e.add(a), a = n.get(a).parent;
505
+ }
506
+ }
507
+ for (let [r, i] of e.events.entries()) {
508
+ n.has(i.node) || t.addIssue({
509
+ code: "custom",
510
+ path: [
511
+ "events",
512
+ r,
513
+ "node"
514
+ ],
515
+ message: "An event must reference an existing node, even when that node has unresolved identity"
516
+ });
517
+ let e = i.detail.publicToolCalls ?? [];
518
+ new Set(e.map((e) => e.id)).size !== e.length && t.addIssue({
519
+ code: "custom",
520
+ path: [
521
+ "events",
522
+ r,
523
+ "detail",
524
+ "publicToolCalls"
525
+ ],
526
+ message: "Published tool call IDs must be unique within an event"
527
+ });
528
+ }
529
+ let r = (e, n) => {
530
+ new Set(e).size !== e.length && t.addIssue({
531
+ code: "custom",
532
+ path: [n],
533
+ message: `${n} identifiers must be unique`
534
+ });
535
+ };
536
+ r((e.artifacts ?? []).map((e) => e.id), "artifacts"), r((e.claims ?? []).map((e) => `${e.pageSha256}:${e.claimId}`), "claims"), r((e.verdicts ?? []).map((e) => e.id), "verdicts"), r((e.publications ?? []).map((e) => e.id), "publications"), r((e.profileVersions ?? []).map((e) => e.digest), "profileVersions");
537
+ let i = new Set(e.events.map((e) => e.id));
538
+ for (let [r, a] of (e.artifacts ?? []).entries()) a.sessionNodeId && !n.has(a.sessionNodeId) && t.addIssue({
539
+ code: "custom",
540
+ path: [
541
+ "artifacts",
542
+ r,
543
+ "sessionNodeId"
544
+ ],
545
+ message: "Artifact session must exist in this record"
546
+ }), a.eventId && !i.has(a.eventId) && t.addIssue({
547
+ code: "custom",
548
+ path: [
549
+ "artifacts",
550
+ r,
551
+ "eventId"
552
+ ],
553
+ message: "Artifact event must exist in this record"
554
+ });
555
+ for (let [r, a] of (e.claims ?? []).entries()) a.agentNodeId && !n.has(a.agentNodeId) && t.addIssue({
556
+ code: "custom",
557
+ path: [
558
+ "claims",
559
+ r,
560
+ "agentNodeId"
561
+ ],
562
+ message: "Claim agent must exist in this record"
563
+ }), a.eventId && !i.has(a.eventId) && t.addIssue({
564
+ code: "custom",
565
+ path: [
566
+ "claims",
567
+ r,
568
+ "eventId"
569
+ ],
570
+ message: "Claim event must exist in this record"
571
+ });
572
+ for (let [r, a] of (e.verdicts ?? []).entries()) n.get(a.reviewerSessionNodeId)?.kind !== "session" && t.addIssue({
573
+ code: "custom",
574
+ path: [
575
+ "verdicts",
576
+ r,
577
+ "reviewerSessionNodeId"
578
+ ],
579
+ message: "Verdict reviewer must be a session in this record"
580
+ }), a.eventId && !i.has(a.eventId) && t.addIssue({
581
+ code: "custom",
582
+ path: [
583
+ "verdicts",
584
+ r,
585
+ "eventId"
586
+ ],
587
+ message: "Verdict event must exist in this record"
588
+ });
589
+ for (let [r, i] of (e.publications ?? []).entries()) i.sessionNodeId && n.get(i.sessionNodeId)?.kind !== "session" && t.addIssue({
590
+ code: "custom",
591
+ path: [
592
+ "publications",
593
+ r,
594
+ "sessionNodeId"
595
+ ],
596
+ message: "Publication session must exist in this record"
597
+ });
598
+ for (let [r, i] of (e.profileVersions ?? []).entries()) i.authorNodeId && !n.has(i.authorNodeId) && t.addIssue({
599
+ code: "custom",
600
+ path: [
601
+ "profileVersions",
602
+ r,
603
+ "authorNodeId"
604
+ ],
605
+ message: "Profile author must exist in this record"
606
+ });
607
+ });
608
+ function x(e) {
609
+ return b.parse(e);
610
+ }
611
+ //#endregion
612
+ export { b as n, i as r, x as t };