@tangle-network/agent-runtime 0.348.1 → 0.349.0

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/{activation-BEGalhOL.js → activation-tNGW73Y9.js} +4 -4
  2. package/dist/{activation-BEGalhOL.js.map → activation-tNGW73Y9.js.map} +1 -1
  3. package/dist/{activation-NQZP_mdI.d.ts → activation-wBipBkCf.d.ts} +2 -2
  4. package/dist/agent.d.ts +1 -1
  5. package/dist/agent.js +2 -2
  6. package/dist/{bundle-DKQtOO9d.js → bundle-1xaJEgjq.js} +2 -2
  7. package/dist/{bundle-DKQtOO9d.js.map → bundle-1xaJEgjq.js.map} +1 -1
  8. package/dist/candidate-execution/index.js +4 -4
  9. package/dist/{coordination-manager-Bm6leXc6.js → coordination-manager-B2Z_MmL9.js} +2 -2
  10. package/dist/coordination-manager-B2Z_MmL9.js.map +1 -0
  11. package/dist/{delegate-Cp5-PsaX.js → delegate-Dr-63jFl.js} +2 -2
  12. package/dist/{delegate-Cp5-PsaX.js.map → delegate-Dr-63jFl.js.map} +1 -1
  13. package/dist/durable.d.ts +1 -1
  14. package/dist/durable.js +5 -5
  15. package/dist/durable.js.map +1 -1
  16. package/dist/{graph-CE_pzU31.js → graph-DPejYB3C.js} +5 -5
  17. package/dist/{graph-CE_pzU31.js.map → graph-DPejYB3C.js.map} +1 -1
  18. package/dist/{improve-wT11zteg.js → improve-DwSahPi1.js} +6 -6
  19. package/dist/{improve-wT11zteg.js.map → improve-DwSahPi1.js.map} +1 -1
  20. package/dist/index.d.ts +3 -3
  21. package/dist/index.js +9 -9
  22. package/dist/intelligence.d.ts +2 -2
  23. package/dist/intelligence.js +6 -6
  24. package/dist/kernel.d.ts +2 -2
  25. package/dist/kernel.js +10 -10
  26. package/dist/{loop-runner-CY5HHhtR.d.ts → loop-runner-C6pGq-2l.d.ts} +2 -2
  27. package/dist/{loop-runner-CZzeeJTG.js → loop-runner-CP6MfO1b.js} +2 -2
  28. package/dist/{loop-runner-CZzeeJTG.js.map → loop-runner-CP6MfO1b.js.map} +1 -1
  29. package/dist/loop-runner-bin.d.ts +1 -1
  30. package/dist/loop-runner-bin.js +1 -1
  31. package/dist/mcp/bin.js +3 -3
  32. package/dist/mcp/index.d.ts +1 -1
  33. package/dist/mcp/index.js +5 -5
  34. package/dist/model-policy-CyCUwHed.js.map +1 -1
  35. package/dist/{prepare-TEEHSJwq.js → prepare-B9wWffjO.js} +3 -3
  36. package/dist/{prepare-TEEHSJwq.js.map → prepare-B9wWffjO.js.map} +1 -1
  37. package/dist/{profile-6OLpbjvV.js → profile-JLJd2wFG.js} +2 -2
  38. package/dist/{profile-6OLpbjvV.js.map → profile-JLJd2wFG.js.map} +1 -1
  39. package/dist/profiles.d.ts +1 -1
  40. package/dist/{provision-supervisor-CC0HdOHo.js → provision-supervisor-C4v2vqDo.js} +4 -4
  41. package/dist/{provision-supervisor-CC0HdOHo.js.map → provision-supervisor-C4v2vqDo.js.map} +1 -1
  42. package/dist/{runtime-B_40dXlF.js → runtime-CsvGCQpl.js} +200 -15
  43. package/dist/runtime-CsvGCQpl.js.map +1 -0
  44. package/dist/{sandbox-profile-compat-_fEtHPCj.js → sandbox-profile-compat-DtuJWFrM.js} +2 -2
  45. package/dist/sandbox-profile-compat-DtuJWFrM.js.map +1 -0
  46. package/dist/{search-executor-COd2F2wp.js → search-executor-CCb82Umc.js} +5 -5
  47. package/dist/search-executor-CCb82Umc.js.map +1 -0
  48. package/dist/{server-BGB4R4wQ.js → server-CKPwZU-I.js} +4 -4
  49. package/dist/{server-BGB4R4wQ.js.map → server-CKPwZU-I.js.map} +1 -1
  50. package/dist/{structural-rollout-Wl_rCuzM.js → structural-rollout-DylC_fwU.js} +3 -3
  51. package/dist/{structural-rollout-Wl_rCuzM.js.map → structural-rollout-DylC_fwU.js.map} +1 -1
  52. package/dist/{supervise-BUOeThuB.js → supervise-BGfm2GlY.js} +174 -27
  53. package/dist/supervise-BGfm2GlY.js.map +1 -0
  54. package/dist/{supervisor-DDy0aEtR.js → supervisor-wS9Ehz_x.js} +17 -18
  55. package/dist/supervisor-wS9Ehz_x.js.map +1 -0
  56. package/dist/testing.d.ts +2 -2
  57. package/dist/testing.js +13 -13
  58. package/dist/tui/index.d.ts +1 -1
  59. package/dist/tui/index.js +1 -1
  60. package/dist/{types-hc4cmSc7.d.ts → types-C8BGOCBn.d.ts} +196 -25
  61. package/package.json +2 -2
  62. package/skills/agent-graphs/SKILL.md +2 -0
  63. package/skills/graph-designer/SKILL.md +6 -0
  64. package/skills/profile-authoring/SKILL.md +1 -1
  65. package/dist/coordination-manager-Bm6leXc6.js.map +0 -1
  66. package/dist/runtime-B_40dXlF.js.map +0 -1
  67. package/dist/sandbox-profile-compat-_fEtHPCj.js.map +0 -1
  68. package/dist/search-executor-COd2F2wp.js.map +0 -1
  69. package/dist/supervise-BUOeThuB.js.map +0 -1
  70. package/dist/supervisor-DDy0aEtR.js.map +0 -1
@@ -1,18 +1,18 @@
1
1
  import { s as writeAtomicDurableFile } from "./record-events-D93DkpAx.js";
2
- import { At as createExecutor, Ct as readCommittedJsonLines, Dt as createExecutorRegistry, Et as insideCursorNamespace, Ft as assertBoxlessPromptOptions, I as coordinationProfileToolPrefix, It as readPromptOptions, Jt as routerBrain, Li as detachedFrozen, Pr as runAbortable, Pt as runAgentRounds, Ri as detachedSnapshot, Rt as createSandboxLineage, Si as executableAgentSpecSnapshot, St as readCommittedJsonFile, Tt as withJsonlFileLock, Vt as defaultSelectWinner, W as rollingDispatch, _ as withDriverExecutor, _t as InMemorySpawnJournal, aa as notifySandboxEventObserver, b as isTraceAnalysisStore, bt as isNoEntError, dr as CheckUnavailableError, gt as InMemoryResultBlobStore, hn as createWorktreeCliExecutor, hr as verdictFromJudgeScore, mr as mapExecutorResult, n as createSupervisor, na as createSandboxTurnEventCollector, pr as gateOnDeliverable, wt as upsertCommittedJsonLine, xi as executableAgentProfileSnapshot, yt as appendCommittedJsonLine, z as settledToIteration, zi as contentAddress } from "./supervisor-DDy0aEtR.js";
2
+ import { At as createExecutor, Ct as readCommittedJsonLines, Dt as createExecutorRegistry, Et as insideCursorNamespace, Ft as assertBoxlessPromptOptions, I as coordinationProfileToolPrefix, It as readPromptOptions, Jt as routerBrain, Li as detachedFrozen, Pr as runAbortable, Pt as runAgentRounds, Ri as detachedSnapshot, Rt as createSandboxLineage, Si as executableAgentSpecSnapshot, St as readCommittedJsonFile, Tt as withJsonlFileLock, Vt as defaultSelectWinner, W as rollingDispatch, _ as withDriverExecutor, _t as InMemorySpawnJournal, aa as notifySandboxEventObserver, b as isTraceAnalysisStore, bt as isNoEntError, dr as CheckUnavailableError, gt as InMemoryResultBlobStore, hn as createWorktreeCliExecutor, hr as verdictFromJudgeScore, mr as mapExecutorResult, n as createSupervisor, na as createSandboxTurnEventCollector, pr as gateOnDeliverable, wt as upsertCommittedJsonLine, xi as executableAgentProfileSnapshot, yt as appendCommittedJsonLine, z as settledToIteration, zi as contentAddress } from "./supervisor-wS9Ehz_x.js";
3
3
  import { i as ConfigError, m as ValidationError, n as AnalystError, s as PlannerError } from "./errors-DodWX-cb.js";
4
- import { D as runAgentic, E as refine, M as renderReport, N as profileChatClient, O as sample, j as observe, k as ObservationError, v as loadAuthoredStrategy, x as strategyAuthorContract, y as requestStrategySource } from "./structural-rollout-Wl_rCuzM.js";
5
- import { $ as isAbortError, B as sha256Bytes$1, C as WorkspaceScanLimitError, Ct as armDeadlineTimer, E as captureMaterializedWorkspace, K as chargedTokens, P as canonicalCandidateDigest$1, Q as hasCompleteCacheBreakdown, R as immutableCandidateValue, W as addSpend, X as errorMessage, Z as fnv1a32Hex, et as isAsyncIterable, ft as zeroSpend, h as markPutStreamVerified, ot as sleep, q as cloneSpend, rt as randomSuffix, st as stringifySafe, tt as mapWithConcurrency } from "./sandbox-profile-compat-_fEtHPCj.js";
4
+ import { D as runAgentic, E as refine, M as renderReport, N as profileChatClient, O as sample, j as observe, k as ObservationError, v as loadAuthoredStrategy, x as strategyAuthorContract, y as requestStrategySource } from "./structural-rollout-DylC_fwU.js";
5
+ import { $ as isAbortError, B as sha256Bytes$1, C as WorkspaceScanLimitError, Ct as armDeadlineTimer, E as captureMaterializedWorkspace, K as chargedTokens, P as canonicalCandidateDigest$1, Q as hasCompleteCacheBreakdown, R as immutableCandidateValue, W as addSpend, X as errorMessage, Z as fnv1a32Hex, et as isAsyncIterable, ft as zeroSpend, h as markPutStreamVerified, ot as sleep, q as cloneSpend, rt as randomSuffix, st as stringifySafe, tt as mapWithConcurrency } from "./sandbox-profile-compat-DtuJWFrM.js";
6
6
  import { c as profileModelExecutionSettings, i as concreteModelId, l as profileProviderModel, o as enforceTokenLimits, p as canonicalObservedModelParts, t as assertExecutableAgentProfile, v as harnessRunsAgent } from "./model-policy-CyCUwHed.js";
7
7
  import { i as notifyRuntimeHookEvent } from "./runtime-hooks-tXpAarhW.js";
8
- import { a as reconcileInterruptedSearchCalls, c as searchExecutor, r as dedicatedLane, x as runtimeShipDecision } from "./search-executor-COd2F2wp.js";
9
- import { g as foldCoordinationRecords, p as createInMemoryRunContext } from "./coordination-manager-Bm6leXc6.js";
10
- import { A as runBrainLoop, S as taskShapeDigest, b as recordGraphRun, f as graphFromStored, m as graphRunsFor, p as graphRegistry, t as supervise, u as digestOfGraph, v as lookupGraph } from "./supervise-BUOeThuB.js";
8
+ import { a as reconcileInterruptedSearchCalls, c as searchExecutor, r as dedicatedLane, x as runtimeShipDecision } from "./search-executor-CCb82Umc.js";
9
+ import { g as foldCoordinationRecords, p as createInMemoryRunContext } from "./coordination-manager-B2Z_MmL9.js";
10
+ import { M as runBrainLoop, f as graphDigest, h as graphRunsFor, m as graphRegistry, p as graphFromStored, t as supervise, u as digestOfGraph, w as taskShapeDigest, x as recordGraphRun, y as lookupGraph } from "./supervise-BGfm2GlY.js";
11
11
  import "./run-cancellation-CzFhQGMa.js";
12
12
  import { i as redactProtectedValue, r as redactProtectedReason } from "./protected-redaction-DFCeo4vg.js";
13
- import "./provision-supervisor-CC0HdOHo.js";
14
- import "./delegate-Cp5-PsaX.js";
15
- import "./graph-CE_pzU31.js";
13
+ import "./provision-supervisor-C4v2vqDo.js";
14
+ import "./delegate-Dr-63jFl.js";
15
+ import "./graph-DPejYB3C.js";
16
16
  import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, sha256Bytes, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
17
17
  import { CODING_HARNESSES, DEFAULT_TRACE_ANALYST_KINDS, InMemoryTraceStore, OUTPUT_VALUE, benjaminiHochberg, buildTrajectory, computeFindingId as computeFindingId$1, confidenceInterval, createTraceAnalyst, expandProfileAxes, makeFinding as makeFinding$1, pairedBootstrap, paretoFrontier, wilcoxonSignedRank, wilson } from "@tangle-network/agent-eval";
18
18
  import { createAgentRunOutcomeTracker } from "@tangle-network/sandbox/runtime";
@@ -4586,7 +4586,7 @@ function requireSpend(rolled, id, root) {
4586
4586
  /**
4587
4587
  * Threads that run fsync for the private CAS. Node runs every fs call on libuv's pool of four
4588
4588
  * threads, and an fsync on a busy disk holds its thread until the filesystem journal commits. On
4589
- * drew-gtr-pro's USB disk (2026-10-20) all four sat in jbd2_log_wait_commit and rq_qos_wait while
4589
+ * drew-gtr-pro's USB disk all four sat in jbd2_log_wait_commit and rq_qos_wait while
4590
4590
  * a tree capture had 16 files in flight: four fsyncs shared each journal commit, and every open,
4591
4591
  * read, lstat and link of the capture queued behind them, at about one file per second. On
4592
4592
  * threads of their own, every fsync in flight waits on the same commit and the pool stays free
@@ -5333,7 +5333,7 @@ function streamDurably(layout, digest, path, byteLength, signal) {
5333
5333
  * that finds its digest in flight waits for that copy, then reads the receipt. Copying it again
5334
5334
  * doubles the upload and, for a buffered store, the archive in memory. Reporting it pending
5335
5335
  * failed captures: a capture refuses on any pending object, so two captures sharing one store
5336
- * refused each other (discovery-lab provider-retention, agent-runtime 0.325.6, 2026-10-18).
5336
+ * refused each other (discovery-lab provider-retention, agent-runtime 0.325.6).
5337
5337
  * A copy never waits for a pass, so a pass may wait for a copy.
5338
5338
  */
5339
5339
  function createDurableCopier(layout) {
@@ -7353,7 +7353,7 @@ function graphDesignerExtraTools(env) {
7353
7353
  })();
7354
7354
  if (name === "designer_history") return (async () => {
7355
7355
  const args = asRecord(raw ?? {}, "designer_history");
7356
- const { listGraphRuns } = await import("./supervise-BUOeThuB.js").then((n) => n.h);
7356
+ const { listGraphRuns } = await import("./supervise-BGfm2GlY.js").then((n) => n.g);
7357
7357
  const all = await listGraphRuns(registry);
7358
7358
  return { runs: (args.taskShape === void 0 ? all : all.filter((row) => row.taskDigest === taskShapeDigest(asRecord(args.taskShape, "designer_history.taskShape")))).map(summarize) };
7359
7359
  })();
@@ -7364,7 +7364,7 @@ function graphDesignerExtraTools(env) {
7364
7364
  if (mode === "replay") {
7365
7365
  const digest = args.graphDigest;
7366
7366
  if (typeof digest !== "string" || digest.length === 0) throw new ValidationError("designer_run_graph: replay mode requires graphDigest from lookup");
7367
- const { loadGraph } = await import("./supervise-BUOeThuB.js").then((n) => n.h);
7367
+ const { loadGraph } = await import("./supervise-BGfm2GlY.js").then((n) => n.g);
7368
7368
  const stored = await loadGraph(registry, digest);
7369
7369
  if (!stored) throw new ValidationError(`designer_run_graph: no stored graph ${digest.slice(0, 12)} — re-lookup`);
7370
7370
  const graph = env.bindCheck(graphFromStored(stored, () => {
@@ -7404,6 +7404,191 @@ function graphDesignerExtraTools(env) {
7404
7404
  }
7405
7405
  }
7406
7406
  //#endregion
7407
+ //#region src/runtime/supervise/graph-session-observation.ts
7408
+ function measured(fact) {
7409
+ return fact && !fact.partial && fact.value !== null ? fact.value : void 0;
7410
+ }
7411
+ function recordedAt(fact) {
7412
+ const value = measured(fact);
7413
+ return value && Number.isFinite(Date.parse(value)) ? value : void 0;
7414
+ }
7415
+ /** Project an existing canonical span run tree into an observed graph design,
7416
+ * linked to its trace run. SessionFacts supplies exclusive accounting. No
7417
+ * execution tree, transcript, or source-specific traversal parser is stored. */
7418
+ function graphFromSessionFacts(facts, options) {
7419
+ if (!facts.length) throw new ValidationError("graphFromSessionFacts: no session facts");
7420
+ const unknowns = ["edge traversal accounting unavailable from canonical span relationships", "span containment does not establish graph edge semantics"];
7421
+ const spanNodes = options.spanRun?.present ? options.spanRun.nodes : [];
7422
+ const spanKey = (traceId, spanId) => JSON.stringify([traceId, spanId]);
7423
+ const identities = /* @__PURE__ */ new Set();
7424
+ const observations = facts.map((fact) => {
7425
+ const roots = spanNodes.filter((node) => node.traceId === fact.traceId && node.parentNodeId === null);
7426
+ const anchor = measured(fact.rootSpanId) ?? (roots.length === 1 ? roots[0].spanId : void 0);
7427
+ const boundary = fact.traceId && anchor ? `span:${spanKey(fact.traceId, anchor)}` : void 0;
7428
+ const sourceId = fact.sessionId ?? boundary;
7429
+ const identity = boundary ?? (fact.sessionId ? `session:${fact.sessionId}` : void 0);
7430
+ if (!identity || !sourceId || identities.has(identity)) throw new ValidationError("graphFromSessionFacts: every observation needs a unique recorded session or span identity");
7431
+ identities.add(identity);
7432
+ const humanCounts = measured(fact.typedTurnCounts)?.filter((entry) => entry.actor === "human");
7433
+ if (humanCounts?.some((entry) => !Number.isSafeInteger(entry.turns) || entry.turns < 0)) throw new ValidationError("graphFromSessionFacts: invalid human turn count");
7434
+ const humanMessages = fact.typedTurnCounts === void 0 ? measured(fact.humanTurns)?.length : humanCounts?.reduce((sum, entry) => sum + entry.turns, 0);
7435
+ const leadMessages = measured(fact.leadMessages);
7436
+ const inputTokens = fact.tokens.input ?? void 0;
7437
+ const outputTokens = fact.tokens.output ?? void 0;
7438
+ for (const [key, value] of Object.entries({
7439
+ inputTokens,
7440
+ outputTokens,
7441
+ humanMessages,
7442
+ leadMessages
7443
+ })) if (value === void 0) unknowns.push(`${sourceId}: ${key} unavailable`);
7444
+ else if (!Number.isSafeInteger(value) || value < 0) throw new ValidationError(`graphFromSessionFacts: invalid ${key}`);
7445
+ return {
7446
+ sourceId,
7447
+ startedAt: recordedAt(fact.firstRecordAt),
7448
+ lastRecordAt: recordedAt(fact.lastRecordAt),
7449
+ inputTokens,
7450
+ outputTokens,
7451
+ humanMessages,
7452
+ leadMessages
7453
+ };
7454
+ });
7455
+ const ids = /* @__PURE__ */ new Map();
7456
+ for (const [index, node] of spanNodes.entries()) {
7457
+ const key = spanKey(node.traceId, node.spanId);
7458
+ if (ids.has(key)) throw new ValidationError("graphFromSessionFacts: duplicate canonical span identity");
7459
+ ids.set(key, `n${index}`);
7460
+ }
7461
+ const nodes = spanNodes.map((node) => {
7462
+ const profile = { name: node.parentNodeId === null ? "observed-agent" : "observed-child" };
7463
+ if (node.runtime || node.kind) profile.metadata = {
7464
+ ...node.runtime ? { runtime: node.runtime } : {},
7465
+ ...node.kind ? { spanKind: node.kind } : {}
7466
+ };
7467
+ return {
7468
+ id: ids.get(spanKey(node.traceId, node.spanId)),
7469
+ profile
7470
+ };
7471
+ });
7472
+ const edges = [];
7473
+ for (const node of spanNodes) {
7474
+ if (node.parentNodeId === null) continue;
7475
+ const from = ids.get(spanKey(node.traceId, node.parentNodeId));
7476
+ if (from) edges.push({
7477
+ from,
7478
+ to: ids.get(spanKey(node.traceId, node.spanId))
7479
+ });
7480
+ else unknowns.push("canonical span run has an unresolved parent node");
7481
+ }
7482
+ edges.sort((a, b) => a.from.localeCompare(b.from) || a.to.localeCompare(b.to));
7483
+ const nodeUsage = [];
7484
+ const joinedNodes = /* @__PURE__ */ new Set();
7485
+ for (const [index, fact] of facts.entries()) {
7486
+ const anchor = measured(fact.rootSpanId);
7487
+ const matching = spanNodes.filter((node) => node.traceId === fact.traceId && (anchor === void 0 ? node.parentNodeId === null : node.spanId === anchor));
7488
+ if (matching.length !== 1 || joinedNodes.has(spanKey(matching[0].traceId, matching[0].spanId))) {
7489
+ unknowns.push(`${fact.sessionId}: session accounting cannot be joined to one canonical span node`);
7490
+ continue;
7491
+ }
7492
+ const key = spanKey(matching[0].traceId, matching[0].spanId);
7493
+ joinedNodes.add(key);
7494
+ const nodeId = ids.get(key);
7495
+ nodeUsage.push({
7496
+ nodeId,
7497
+ ...observations[index]
7498
+ });
7499
+ const profile = nodes.find((node) => node.id === nodeId).profile;
7500
+ const identity = measured(fact.agent);
7501
+ const model = identity?.model;
7502
+ if (model) profile.model = { default: model };
7503
+ const harness = identity?.harness ?? fact.harness;
7504
+ if (harness) profile.metadata = {
7505
+ ...profile.metadata,
7506
+ harness
7507
+ };
7508
+ }
7509
+ for (const node of spanNodes) {
7510
+ const key = spanKey(node.traceId, node.spanId);
7511
+ if (!joinedNodes.has(key)) {
7512
+ nodeUsage.push({ nodeId: ids.get(key) });
7513
+ unknowns.push(`${ids.get(key)}: canonical node accounting unavailable`);
7514
+ }
7515
+ }
7516
+ if (!spanNodes.length) unknowns.push("topology unavailable: no canonical span run tree was supplied");
7517
+ if (spanNodes.some((node) => node.kind == null)) unknowns.push("canonical span node kind unavailable");
7518
+ if (options.spanRun?.orphanSpans) unknowns.push("canonical span run contains orphan spans");
7519
+ if (!options.traceRunId) unknowns.push("trace run identity unavailable");
7520
+ for (const issue of options.issues ?? []) {
7521
+ const kind = issue && typeof issue === "object" && "kind" in issue ? issue.kind : void 0;
7522
+ const reason = issue && typeof issue === "object" && "reason" in issue ? issue.reason : void 0;
7523
+ if (typeof kind === "string") unknowns.push("workflow issue: " + kind + (kind === "source-coverage" && typeof reason === "string" ? `: ${reason.replace(/[\r\n]/g, " ").slice(0, 500)}` : ""));
7524
+ }
7525
+ const incompleteIssues = options.issues?.some((issue) => !issue || typeof issue !== "object" || !("kind" in issue) || issue.kind !== "source-coverage");
7526
+ const unread = facts.some((fact) => fact.unreadRecords?.partial || (fact.unreadRecords?.value ?? 0) > 0);
7527
+ if (unread) unknowns.push("source contains unread or partial records; total accounting unavailable");
7528
+ const complete = options.complete !== false && !incompleteIssues && !unread;
7529
+ if (!complete) unknowns.push("workflow selection incomplete; total accounting unavailable");
7530
+ if (!options.taskType) unknowns.push("task type not explicitly labeled");
7531
+ const starts = observations.flatMap((node) => node.startedAt ? [node.startedAt] : []).sort((a, b) => Date.parse(a) - Date.parse(b));
7532
+ const startedAt = options.startedAt ?? starts[0];
7533
+ if (!startedAt || !Number.isFinite(Date.parse(startedAt))) throw new ValidationError("graphFromSessionFacts: no recorded task start; supply an authoritative startedAt");
7534
+ const cost = {};
7535
+ for (const channel of [
7536
+ "inputTokens",
7537
+ "outputTokens",
7538
+ "humanMessages",
7539
+ "leadMessages"
7540
+ ]) if (complete && observations.every((node) => node[channel] !== void 0)) cost[channel] = observations.reduce((sum, node) => sum + node[channel], 0);
7541
+ if (cost.inputTokens !== void 0 && cost.outputTokens !== void 0) cost.tokens = cost.inputTokens + cost.outputTokens;
7542
+ const outcome = options.outcome ?? {
7543
+ kind: "unknown",
7544
+ reason: "no independent delivery outcome was joined"
7545
+ };
7546
+ if ((outcome.kind === "delivered" || outcome.kind === "no-winner") && !options.finishedAt) throw new ValidationError("graphFromSessionFacts: terminal outcomes require authoritative finishedAt");
7547
+ if (!options.startedAt) unknowns.push("task start unconfirmed; startedAt is earliest observed activity");
7548
+ if (options.finishedAt) {
7549
+ const elapsed = Date.parse(options.finishedAt) - Date.parse(startedAt);
7550
+ if (!Number.isFinite(elapsed) || elapsed < 0) throw new ValidationError("graphFromSessionFacts: invalid finishedAt");
7551
+ if (options.startedAt) cost.ms = elapsed;
7552
+ }
7553
+ const merged = options.evidence?.filter((entry) => entry.kind === "pr-merged" && entry.at).map((entry) => Date.parse(entry.at)).filter(Number.isFinite).sort((a, b) => a - b)[0];
7554
+ if (options.startedAt && merged !== void 0 && merged >= Date.parse(startedAt)) cost.mergeMs = merged - Date.parse(startedAt);
7555
+ const content = {
7556
+ observed: true,
7557
+ nodes,
7558
+ edges,
7559
+ deliverable: {}
7560
+ };
7561
+ const graph = {
7562
+ digest: graphDigest(content),
7563
+ ...content
7564
+ };
7565
+ return {
7566
+ graph,
7567
+ record: {
7568
+ graphDigest: graph.digest,
7569
+ ...spanNodes.length ? { topologyDigest: taskShapeDigest({
7570
+ nodes: nodes.map((node, index) => ({
7571
+ id: node.id,
7572
+ kind: spanNodes[index].kind ?? null
7573
+ })),
7574
+ edges
7575
+ }) } : {},
7576
+ taskDigest: taskShapeDigest(options.taskShape ?? { taskType: options.taskType ?? "unknown" }),
7577
+ startedAt,
7578
+ ...options.finishedAt ? { finishedAt: options.finishedAt } : {},
7579
+ outcome,
7580
+ cost,
7581
+ source: options.source,
7582
+ ...options.traceRunId ? { traceRunId: options.traceRunId } : {},
7583
+ ...options.observedAt ? { observedAt: options.observedAt } : {},
7584
+ ...options.taskType ? { taskType: options.taskType } : {},
7585
+ ...options.evidence ? { evidence: options.evidence } : {},
7586
+ ...nodeUsage.length ? { nodeUsage } : {},
7587
+ unknowns
7588
+ }
7589
+ };
7590
+ }
7591
+ //#endregion
7407
7592
  //#region src/runtime/supervise/profile-registry.ts
7408
7593
  /**
7409
7594
  * `profile-registry` — named AgentProfiles with run receipts: the missing
@@ -9406,6 +9591,6 @@ function tail(s) {
9406
9591
  return s.slice(-400);
9407
9592
  }
9408
9593
  //#endregion
9409
- export { runPersonified as $, openSqlRunStore as $t, searchSpecDigest as A, secretEnvOfMcpServer as At, chatWorkerSeam as B, readDeclaredCheck as Bt, withUntrackedArtifacts as C, materializeLocalMcp as Ct, assertSearchSpec as D, mcpSecretEnvMetadataKey as Dt, SEARCH_SPEC_CORRELATION_KEY as E, envKeyProvider as Et, profileRegistry as F, assertDeclaredCheck as Ft, openSandboxRun as G, stopSentinel as Gt, runStrategyEvolution as H, completionAuthorizes as Ht, profileRunsForName as I, checkProgramDigest as It, runBenchmark as J, renderLeaderboardHtml as Jt, createS3PrivateCasStore as K, leaderboard as Kt, recordProfileRun as L, declaredCheckDeliverable as Lt, bestProfileFor as M, loopCampaignDispatch as Mt, loadProfile as N, loopDispatch as Nt, compileSearchSpec as O, resolveMcpServerLaunch as Ot, pickBestProfile as P, superviseDispatch as Pt, definePersona as Q, SqlRunOwnershipError as Qt, graphDesignerExtraTools as R, declaredCheckDigest as Rt, copyUntrackedIntoClone as S, connectStdioMcp as St, createFencedSqlRunContext as T, sanitizeMcpToolSchema as Tt, strategyTournament as U, deterministicCompletion as Ut, createChatSessionStore as V, runIsolatedCheck as Vt, SandboxRunAbortError as W, sentinelCompletion as Wt, equalKOnCost as X, renderLeaderboardSvg as Xt, createPrivateCasArtifactPort as Y, renderLeaderboardMarkdown as Yt, trajectoryReport as Z, renderPairwiseMarkdown as Zt, NOTE_MAX_CHARS as _, HarvestError as _t, localShell as a, loopUntil as at, composeWorkerEvidence as b, resolveSandboxClient as bt, createVerifierEnvironment as c, selectValidWinner as ct, harvestSurfaceDiffs as d, assertTraceDerivedFindings as dt, FileCorpus as et, analystsFromRegistry as f, buildSteerContext as ft, EVIDENCE_MAX_CHARS as g, inProcessSandboxClient as gt, runCoderChecks as h, observationFromRegistry as ht, jjWorkspace as i, flatWidenGate as it, connectRemoteSupervisor as j, inlineSandboxClient as jt, searchPresets as k, resolveSecretEnv as kt, boxSurfaceReader as l, verify as lt, worktreeFanout as m, registryScopeAnalyst as mt, makeFinding$1 as n, renderCorpusToInstructions as nt, runInWorkspace as o, panel as ot, failuresAnalyst as p, createScopeAnalyst as pt, printBenchmarkReport as q, pairwiseSignificance as qt, gitWorkspace as r, fanout as rt, createWaterfallCollector as s, pipeline as st, computeFindingId$1 as t, InMemoryCorpus as tt, fsSurfaceReader as u, widen as ut, VERIFY_TAIL_CHARS as v, harvestCorpus as vt, analyzeTrace as w, createMcpEnvironment as wt, settledWorkerOut as x, McpSpawnFault as xt, closingWorkerNote as y, defineLeaderboard as yt, chatTransportExecutor as z, declaredCheckJudge as zt };
9594
+ export { definePersona as $, SqlRunOwnershipError as $t, searchSpecDigest as A, resolveSecretEnv as At, chatTransportExecutor as B, declaredCheckJudge as Bt, withUntrackedArtifacts as C, connectStdioMcp as Ct, assertSearchSpec as D, envKeyProvider as Dt, SEARCH_SPEC_CORRELATION_KEY as E, sanitizeMcpToolSchema as Et, profileRegistry as F, superviseDispatch as Ft, SandboxRunAbortError as G, sentinelCompletion as Gt, createChatSessionStore as H, runIsolatedCheck as Ht, profileRunsForName as I, assertDeclaredCheck as It, printBenchmarkReport as J, pairwiseSignificance as Jt, openSandboxRun as K, stopSentinel as Kt, recordProfileRun as L, checkProgramDigest as Lt, bestProfileFor as M, inlineSandboxClient as Mt, loadProfile as N, loopCampaignDispatch as Nt, compileSearchSpec as O, mcpSecretEnvMetadataKey as Ot, pickBestProfile as P, loopDispatch as Pt, trajectoryReport as Q, renderPairwiseMarkdown as Qt, graphFromSessionFacts as R, declaredCheckDeliverable as Rt, copyUntrackedIntoClone as S, McpSpawnFault as St, createFencedSqlRunContext as T, createMcpEnvironment as Tt, runStrategyEvolution as U, completionAuthorizes as Ut, chatWorkerSeam as V, readDeclaredCheck as Vt, strategyTournament as W, deterministicCompletion as Wt, createPrivateCasArtifactPort as X, renderLeaderboardMarkdown as Xt, runBenchmark as Y, renderLeaderboardHtml as Yt, equalKOnCost as Z, renderLeaderboardSvg as Zt, NOTE_MAX_CHARS as _, inProcessSandboxClient as _t, localShell as a, flatWidenGate as at, composeWorkerEvidence as b, defineLeaderboard as bt, createVerifierEnvironment as c, pipeline as ct, harvestSurfaceDiffs as d, widen as dt, openSqlRunStore as en, runPersonified as et, analystsFromRegistry as f, assertTraceDerivedFindings as ft, EVIDENCE_MAX_CHARS as g, observationFromRegistry as gt, runCoderChecks as h, registryScopeAnalyst as ht, jjWorkspace as i, fanout as it, connectRemoteSupervisor as j, secretEnvOfMcpServer as jt, searchPresets as k, resolveMcpServerLaunch as kt, boxSurfaceReader as l, selectValidWinner as lt, worktreeFanout as m, createScopeAnalyst as mt, makeFinding$1 as n, InMemoryCorpus as nt, runInWorkspace as o, loopUntil as ot, failuresAnalyst as p, buildSteerContext as pt, createS3PrivateCasStore as q, leaderboard as qt, gitWorkspace as r, renderCorpusToInstructions as rt, createWaterfallCollector as s, panel as st, computeFindingId$1 as t, FileCorpus as tt, fsSurfaceReader as u, verify as ut, VERIFY_TAIL_CHARS as v, HarvestError as vt, analyzeTrace as w, materializeLocalMcp as wt, settledWorkerOut as x, resolveSandboxClient as xt, closingWorkerNote as y, harvestCorpus as yt, graphDesignerExtraTools as z, declaredCheckDigest as zt };
9410
9595
 
9411
- //# sourceMappingURL=runtime-B_40dXlF.js.map
9596
+ //# sourceMappingURL=runtime-CsvGCQpl.js.map