@tangle-network/agent-runtime 0.228.0 → 0.229.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 (49) hide show
  1. package/dist/{activation-Dv8TBXAS.d.ts → activation-DFSQ90A8.d.ts} +2 -2
  2. package/dist/{activation-t__E2fFP.js → activation-o9SrkJqs.js} +2 -2
  3. package/dist/{activation-t__E2fFP.js.map → activation-o9SrkJqs.js.map} +1 -1
  4. package/dist/agent.d.ts +1 -1
  5. package/dist/agent.js +2 -2
  6. package/dist/{coordination-driver-r9_4mvgK.js → coordination-driver-C6rde-Rv.js} +2 -2
  7. package/dist/{coordination-driver-r9_4mvgK.js.map → coordination-driver-C6rde-Rv.js.map} +1 -1
  8. package/dist/{delegate-OUy-TxtQ.js → delegate-Cmd-qlWH.js} +2 -2
  9. package/dist/{delegate-OUy-TxtQ.js.map → delegate-Cmd-qlWH.js.map} +1 -1
  10. package/dist/durable.d.ts +2 -2
  11. package/dist/durable.js +2 -2
  12. package/dist/{graph-Bfqckohg.js → graph-BK05MhFv.js} +3 -3
  13. package/dist/{graph-Bfqckohg.js.map → graph-BK05MhFv.js.map} +1 -1
  14. package/dist/{improvement-cycle-COOuIQpm.js → improvement-cycle-DHl4SxbQ.js} +3 -3
  15. package/dist/{improvement-cycle-COOuIQpm.js.map → improvement-cycle-DHl4SxbQ.js.map} +1 -1
  16. package/dist/{index-DAIij88v.d.ts → index-B6xSpuPo.d.ts} +2 -2
  17. package/dist/index.d.ts +4 -4
  18. package/dist/index.js +7 -7
  19. package/dist/intelligence.d.ts +2 -2
  20. package/dist/intelligence.js +3 -3
  21. package/dist/kernel.d.ts +3 -3
  22. package/dist/kernel.js +8 -8
  23. package/dist/{loop-runner-bin-DW_8__PB.js → loop-runner-bin-CU2bdlr1.js} +3 -3
  24. package/dist/{loop-runner-bin-DW_8__PB.js.map → loop-runner-bin-CU2bdlr1.js.map} +1 -1
  25. package/dist/{loop-runner-bin-CN1rstwC.d.ts → loop-runner-bin-D5hutINM.d.ts} +3 -3
  26. package/dist/loop-runner-bin.d.ts +1 -1
  27. package/dist/loop-runner-bin.js +1 -1
  28. package/dist/mcp/bin.js +3 -3
  29. package/dist/mcp/index.d.ts +2 -2
  30. package/dist/mcp/index.js +4 -4
  31. package/dist/{provision-supervisor-BVglIjhG.js → provision-supervisor-C2rRWXG6.js} +3 -3
  32. package/dist/{provision-supervisor-BVglIjhG.js.map → provision-supervisor-C2rRWXG6.js.map} +1 -1
  33. package/dist/{runtime-lysnGswg.js → runtime-BBcrtrkj.js} +8 -8
  34. package/dist/{runtime-lysnGswg.js.map → runtime-BBcrtrkj.js.map} +1 -1
  35. package/dist/{server-BL3RTYqx.js → server-CWIl-a3C.js} +3 -3
  36. package/dist/{server-BL3RTYqx.js.map → server-CWIl-a3C.js.map} +1 -1
  37. package/dist/{stream-agent-turn-Dy-QleSb.d.ts → stream-agent-turn-jPdnzI_5.d.ts} +50 -2
  38. package/dist/{structural-rollout-DGsWDP0f.js → structural-rollout-zl02ztZ4.js} +2 -2
  39. package/dist/{structural-rollout-DGsWDP0f.js.map → structural-rollout-zl02ztZ4.js.map} +1 -1
  40. package/dist/{supervise-UgmGtrlX.js → supervise-DbNMYx7z.js} +3 -3
  41. package/dist/{supervise-UgmGtrlX.js.map → supervise-DbNMYx7z.js.map} +1 -1
  42. package/dist/{supervisor-DBnQuTyJ.js → supervisor-DAHG98Rs.js} +162 -1
  43. package/dist/supervisor-DAHG98Rs.js.map +1 -0
  44. package/dist/testing.d.ts +2 -2
  45. package/dist/testing.js +12 -12
  46. package/dist/tui/index.d.ts +1 -1
  47. package/dist/tui/index.js +1 -1
  48. package/package.json +1 -1
  49. package/dist/supervisor-DBnQuTyJ.js.map +0 -1
@@ -5754,6 +5754,165 @@ function generateTraceId() {
5754
5754
  return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
5755
5755
  }
5756
5756
  //#endregion
5757
+ //#region src/runtime/native-session-evidence.ts
5758
+ /**
5759
+ * Read a sandbox child's own harness transcript out of its environment before the
5760
+ * environment is destroyed, and persist it beside the tool-span `trace` receipt.
5761
+ *
5762
+ * Why this exists: Runtime destroys a child's environment at teardown and nothing read
5763
+ * those files first, so a child's Claude Code / Codex / OpenCode session never reached a
5764
+ * run record. The settled `trace` receipt covers the supervisor's own tool spans only —
5765
+ * `toolName`, `args`, `status`, `callId`, with `startedAt === endedAt` — so it carries no
5766
+ * assistant text, no reasoning, and no tool results, and `status: 'available'` never meant
5767
+ * the transcript survived. See tangle-network/agent-runtime#1214.
5768
+ *
5769
+ * The port already has what this needs: `AgentEnvironment.read?(path, { signal })`
5770
+ * returns a file's content as a string. Two constraints shape the design:
5771
+ *
5772
+ * - `read` is OPTIONAL and, on the Tangle provider, gated behind
5773
+ * `capabilities.workspace.read && box.read`. An environment without it is reported as
5774
+ * `unsupported` rather than silently producing an empty artifact — the whole point of
5775
+ * #1214 is that a receipt must not claim coverage it does not have.
5776
+ * - `read` takes one path and gives no directory listing, so enumeration goes through
5777
+ * `exec`. An environment with `read` but no `exec` cannot be enumerated and is also
5778
+ * reported, not guessed at.
5779
+ *
5780
+ * Storage is NOT this module's business. The executor returns the artifact inside the result
5781
+ * it already settles with, and supervise puts that under the child's `outRef` in its own
5782
+ * `ResultBlobStore`. No destroy site learns about storage, and replay rehydrates it for free.
5783
+ *
5784
+ * Credentials are excluded by construction: enumeration lists only the transcript globs
5785
+ * for the harness, and any path matching DENY is dropped even if a producer moved a
5786
+ * credential file inside a session directory. The helper never reads `auth.json`,
5787
+ * `.credentials.json`, `credentials`, or a dotenv file.
5788
+ */
5789
+ /** Where each harness keeps the session files that hold the conversation. */
5790
+ const HARNESS_ROOTS = Object.freeze({
5791
+ "claude-code": Object.freeze([
5792
+ ".claude/projects",
5793
+ ".claude/history.jsonl",
5794
+ ".claude/todos"
5795
+ ]),
5796
+ codex: Object.freeze([".codex/sessions", ".codex/history.jsonl"]),
5797
+ opencode: Object.freeze([".local/share/opencode/storage", ".local/share/opencode/log"]),
5798
+ pi: Object.freeze([".pi/agent/sessions"])
5799
+ });
5800
+ /**
5801
+ * Never read, whatever a producer put inside a session tree.
5802
+ *
5803
+ * Case-insensitive and broader than the obvious names: `.netrc`, `*.key`, `*.p12`/`*.pfx`
5804
+ * and an uppercase `ID_RSA` all slipped an earlier lowercase-only pattern.
5805
+ */
5806
+ const DENY = /(^|\/)(auth\.json|\.credentials\.json|credentials|\.netrc|\.env(\..*)?|secrets?(\.|$)|.*\.(pem|key|p12|pfx)|id_[a-z0-9_]+)$/iu;
5807
+ /**
5808
+ * Bounds per file and in total. These are deliberately modest: the artifact rides inside the
5809
+ * settled result that supervise blobs under one `outRef`, so an unbounded transcript would
5810
+ * bloat every replay of that child, not just the capture.
5811
+ */
5812
+ const MAX_FILE_BYTES = 2 * 1024 * 1024;
5813
+ const MAX_TOTAL_BYTES = 16 * 1024 * 1024;
5814
+ const MAX_FILES = 1e3;
5815
+ function unavailable$2(reason) {
5816
+ return Object.freeze({
5817
+ status: "unavailable",
5818
+ reason
5819
+ });
5820
+ }
5821
+ /**
5822
+ * Enumerate candidate transcript paths inside the environment.
5823
+ *
5824
+ * `find` is given the roots and prints one path per line. A missing root is not an error:
5825
+ * a child that never used a harness has no directory for it.
5826
+ */
5827
+ async function enumerate(environment, roots, signal) {
5828
+ if (!environment.exec) return void 0;
5829
+ const command = `find ${roots.map((r) => `"$HOME/${r}"`).join(" ")} -type f -size -${Math.floor(MAX_FILE_BYTES / 1024)}k 2>/dev/null | head -${MAX_FILES}`;
5830
+ try {
5831
+ return ((await environment.exec(command, signal ? { signal } : void 0)).stdout ?? "").split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
5832
+ } catch {
5833
+ return;
5834
+ }
5835
+ }
5836
+ /**
5837
+ * Read the harness transcript out of one LIVE environment.
5838
+ *
5839
+ * Call this before the environment is destroyed — on the settled path that means before the
5840
+ * result is built, since the `finally` that destroys runs after. It never throws: a teardown
5841
+ * must not fail because evidence could not be collected, and every failure mode is a named
5842
+ * `reason` the settled receipt carries instead of an empty artifact that reads as coverage.
5843
+ */
5844
+ async function captureNativeSessionEvidence(environment, harness, signal) {
5845
+ if (!environment?.read) return unavailable$2("unsupported-environment");
5846
+ if (harness === void 0) return unavailable$2("unknown-harness");
5847
+ const roots = HARNESS_ROOTS[harness];
5848
+ if (!roots) return unavailable$2("unknown-harness");
5849
+ const paths = await enumerate(environment, roots, signal);
5850
+ if (paths === void 0) return unavailable$2("enumeration-failed");
5851
+ if (paths.length === 0) return unavailable$2("no-transcript");
5852
+ const files = [];
5853
+ const skipped = [];
5854
+ let total = 0;
5855
+ for (const path of paths) {
5856
+ if (signal?.aborted) {
5857
+ skipped.push({
5858
+ path,
5859
+ reason: "aborted"
5860
+ });
5861
+ continue;
5862
+ }
5863
+ if (DENY.test(path)) {
5864
+ skipped.push({
5865
+ path,
5866
+ reason: "denied-credential-shaped-path"
5867
+ });
5868
+ continue;
5869
+ }
5870
+ if (total >= MAX_TOTAL_BYTES) {
5871
+ skipped.push({
5872
+ path,
5873
+ reason: "total-byte-budget-exhausted"
5874
+ });
5875
+ continue;
5876
+ }
5877
+ try {
5878
+ const content = await environment.read(path, signal ? { signal } : void 0);
5879
+ const bytes = Buffer.byteLength(content, "utf8");
5880
+ if (bytes > MAX_FILE_BYTES) {
5881
+ skipped.push({
5882
+ path,
5883
+ reason: "file-exceeds-byte-bound"
5884
+ });
5885
+ continue;
5886
+ }
5887
+ files.push(Object.freeze({
5888
+ path,
5889
+ bytes,
5890
+ content
5891
+ }));
5892
+ total += bytes;
5893
+ } catch {
5894
+ skipped.push({
5895
+ path,
5896
+ reason: "read-failed"
5897
+ });
5898
+ }
5899
+ }
5900
+ if (files.length === 0) return unavailable$2("no-transcript");
5901
+ const artifact = Object.freeze({
5902
+ schemaVersion: 1,
5903
+ harness,
5904
+ files: Object.freeze(files),
5905
+ skipped: Object.freeze(skipped)
5906
+ });
5907
+ return Object.freeze({
5908
+ status: "available",
5909
+ artifact,
5910
+ fileCount: files.length,
5911
+ totalBytes: total,
5912
+ skippedCount: skipped.length
5913
+ });
5914
+ }
5915
+ //#endregion
5757
5916
  //#region src/runtime/provider-placement.ts
5758
5917
  const placementMetadataKey = "runtimeProviderPlacement";
5759
5918
  /** Select exactly one declaration before any provider effects. Shared defaults carry infrastructure only. */
@@ -7655,8 +7814,10 @@ async function* streamProviderExecutor(args) {
7655
7814
  }
7656
7815
  if ((args.options.requireTerminalEvent ?? true) && !terminal) throw new ValidationError(`providerAsExecutor(${args.provider.name}): stream ended without a terminal result/done/status event`);
7657
7816
  yield { kind: "iteration" };
7817
+ const nativeSession = await captureNativeSessionEvidence(environment, args.profile.harness, linked);
7658
7818
  const result = {
7659
7819
  ...resultFromEvents(archive.events(), text),
7820
+ nativeSession,
7660
7821
  ...archive.superseded > 0 ? { supersededPartUpdates: archive.superseded } : {},
7661
7822
  ...explicitFailure ? { outcome: outcomeTracker.finish() } : {}
7662
7823
  };
@@ -23691,4 +23852,4 @@ function isNonEmptySpend(s) {
23691
23852
  //#endregion
23692
23853
  export { cliInPlaceExecutor as $, generateSpanId as $n, runtimeOwnedExecutorProviderEvidence as $r, createCodexRolloutStoreReader as $t, waitUntil as A, sleep as Ai, abortError as An, renderProfileMaterializationIssues as Ar, WORKER_TRACE_PROPAGATION as At, readWorkerInteractiveBinding as B, decodeHarnessUsage as Bi, resolveRedactor as Bn, attestRuntimeOwnedPendingExecutor as Br, AUTHORITY_MARKERS as Bt, scopeOwnerExecutorNodeContext as C, chargedTokens as Ci, sandboxClientAsProvider as Cn, defineProfileMaterializationContract as Cr, BudgetReconcileFault as Ct, pollFor as D, isAbortError$2 as Di, registerRetainedExecutorPreparation as Dn, promptModelProfileMaterialization as Dr, newUsageTotals as Dt, isWaitOutcome as E, hasCompleteCacheBreakdown as Ei, sandboxSessionTraceSource as En, promptControlProfileMaterialization as Er, meterUsageEvent as Et, scopeRetainedOwnerResult as F, withTimeout as Fi, startRetainedRun as Fn, worktreeCliProfileMaterialization as Fr, taskToPrompt as Ft, startRetainedInteractiveRun as G, teardownExecutor as Gi, INTELLIGENCE_WIRE_VERSION as Gn, knownExecutionBindingReceipt as Gr, isPeerMailEnvelope as Gt, workerInteractiveBindingsDir as H, awaitAbortable$1 as Hi, mergeTraceEnv as Hn, authoredProfileDigest as Hr, PEER_MAIL_WIRE_KEY as Ht, interactiveAdmissionSeamKey as I, zeroSpend as Ii, startRetainedRunInEnvironment as In, isNoEntError as Ir, DEFAULT_STALL_AFTER_MS as It, freeSlots as J, providerMessageText as Ji, buildRuntimeEventOtelSpans as Jn, providerAttemptEvidence as Jr, isLiveNodeStatus as Jt, destroyInteractiveEnvironment as K, promptFromAgentTurnInput as Ki, buildLoopOtelSpans as Kn, knownMaterializationReceipt as Kr, peerMailTools as Kt, readWorkerInteractiveAdmissions as L, addResourceSpend as Li, retainedCreateMaterial as Ln, parseCommittedJsonLines as Lr, createActivityLog as Lt, prepareScopeRetainedOwnerTask as M, throwAbort as Mi, runAbortable as Mn, sandboxActProfileMaterialization as Mr, workerTraceEnv as Mt, scopeRetainedOwnerContext as N, throwIfAborted as Ni, reconnectRetainedRun as Nn, unsupportedProfileDimensions as Nr, workerTraceHeaders as Nt, timerAt as O, promptCacheTokenClasses as Oi, retainedExecutorSeamKey as On, promptOnlyProfileMaterialization as Or, spendFromUsageEvents as Ot, scopeRetainedOwnerPriorSpend as P, unmeteredSpend as Pi, recoverRetainedRun as Pn, validateProfileMaterialization as Pr, workerTraceSeamKey as Pt, captureReusableExecutorConfig as Q, flatOtelSpan as Qn, runtimeOwnedExecutorMaterialization as Qr, addHarnessUsage as Qt, workerInteractiveAdmissionFile as R, resourceTelemetry as Ri, defaultRedactor as Rn, prepareJsonlAppend as Rr, readWorkerProgress as Rt, restoreScopeOwnerAcceptedExecution as S, addSpend as Si, resolveAgentEnvironmentProvider as Sn, controlProfileMaterialization as Sr, contentAddress as St, createWaitProbes as T, deleteBoxSafe as Ti, decodeToolPart as Tn, profileMaterializationAxes$1 as Tr, createBudgetPool as Tt, reconnectRetainedInteractiveRun as U, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as Ui, readTraceContextFromEnv as Un, finalizeRuntimeOwnedPendingExecutor as Ur, claimsAuthority as Ut, workerInteractiveBindingFile as V, abortError$2 as Vi, createPropagatingTraceEmitter as Vn, attestRuntimeOwnedScopeOwner as Vr, DEFAULT_PEER_MAIL_LIMITS as Vt, recoverRetainedInteractiveRun as W, armDeadlineTimer as Wi, traceContextToEnv as Wn, inheritRuntimeOwnedExecutorAttestation as Wr, createPeerMailbox as Wt, rollingDispatch as X, createOtelExporter as Xn, runtimeOwnedDriveHarnessProviderEvidence as Xr, bridgeAdmissionRefusal as Xt, queueOf as Y, createOpenInferenceFileExporter as Yn, recordRuntimeOwnedDriveHarnessProviderEvidence as Yr, isTerminalNodeStatus as Yt, bindReusableExecutorExecutionId as Z, exportEvalRuns as Zn, runtimeOwnedExecutorExecutionBinding as Zr, bridgeModelRouteRefusal as Zt, createScope as _, mapSandboxToolEvent as _i, observedModelMatchesDeclared as _n, localHarnessExecutable as _r, WORKER_TOOL_TRACE_SCHEMA_VERSION as _t, pickBestDelivered as a, executableAgentSpecSnapshot as ai, createSandboxForSpec as an, createRuntimeStreamEventCollector as ar, DEFAULT_SANDBOX_STEERING_MAX_TURNS as at, meterRuntimeOwnedProviderAttempt as b, sandboxProgressEvents as bi, providerAsExecutor as bn, AGENT_PROFILE_MATERIALIZATION_AXES as br, parseWorkerToolTraceArtifact as bt, DriverAttemptsExhaustedError as c, projectSandboxOutcome as ci, runAgentRounds as cn, sanitizeRuntimeStreamEvent as cr, FileResultBlobStore as ct, runDriverWithRetry as d, canonicalStreamEventFromSandboxEvent as di, acquireSandbox as dn, captureWorktreeDiff as dr, InMemorySpawnJournal as dt, runtimeOwnedPendingExecutorMaterialization as ei, harnessUsageIsEmpty as en, loopEventToOtelSpan as er, cliWorktreeExecutor as et, driverChild as f, createSandboxToolPartState as fi, assertBoxlessPromptOptions as fn, createWorktree as fr, insideCursorNamespace as ft, beginScopeOwnerAttempt as g, mapSandboxEvent as gi, canonicalObservedModelParts as gn, harnessSupportsReasoningEffort as gr, replaySpawnTree as gt, withDriverExecutor as h, isSandboxTerminalEvent as hi, runBrainLoop as hn, LOCAL_HARNESSES as hr, pendingWaits as ht, collectDelivered as i, executableAgentProfileSnapshot as ii, TERMINAL_DECISIONS as in, createRuntimeEventCollector as ir, createWorktreeCliExecutor as it, consumeScopeRetainedOwnerResult as j, stringifySafe as ji, linkAbort as jn, renderUnsupported as jr, readWorkerTraceContext as jt, validateWaitSpec as k, randomSuffix as ki, RunCancellationReason as kn, promptResourceProfileMaterialization as kr, spendFromUsageTotals as kt, classifyDriverFailure as l, readSandboxOutcome as li, createSandboxLineage as ln, runSettledCommand as lr, FileSpawnJournal as lt, isDriverSpec as m, extractLlmCallEvent as mi, routerBrain as mn, DEFAULT_LOCAL_HARNESS as mr, materializeTreeView as mt, createSupervisor as n, unknownExecutionBindingReceipt as ni, bridgeRuntimeAttachmentsKey as nn, padTraceId as nr, createExecutorRegistry as nt, runFinalizer as o, detachedFrozen as oi, defaultSelectWinner as on, sanitizeAgentRuntimeEvent as or, createSteerableSandboxSession as ot, driverExecutorFactory as p, createSandboxUsageLedger as pi, readPromptOptions as pn, removeWorktree as pr, loadSpawnForest as pt, effectiveConcurrency as q, promptOptionsFromAgentTurnInput as qi, buildLoopSpanNodes as qn, newExecutionAttemptId as qr, peerMailVerbNames as qt, bestDelivered as r, unknownMaterializationReceipt as ri, bridgeStopSignalKey as rn, toOtelAttributes as rr, snapshotExecutorConfig as rt, runTree as s, detachedSnapshot as si, isTerminalDecision as sn, sanitizeKnowledgeReadinessReport as sr, createInPlaceCliExecutor as st, createRootHandle as t, runtimeOwnedScopeOwnerRuntime as ti, readCodexRolloutSession as tn, padSpanId as tr, createExecutor as tt, defaultUnmetContractSteer as u, assertSandboxServedModel as ui, probeSandboxCapabilities as un, runWorktreeHarness as ur, InMemoryResultBlobStore as ut, deriveNodeExecutionIdentity as v, notifySandboxEventObserver as vi, DEFAULT_SANDBOX_IDLE_TIMEOUT_SECONDS as vn, parseCodexTokenUsage as vr, captureWorkerTraceEvidence as vt, settledToIteration as w, cloneSpend as wi, createPushTraceSource as wn, fullProfileMaterialization as wr, assertValidBudget as wt, recordScopeOwnerMaterialization as x, sumSandboxUsage as xi, providerAsSandboxClient as xn, assertProfileMaterialization as xr, workerTraceAnalysisStore as xt, meterRuntimeOwnedAccounting as y, sandboxEventServedBackend as yi, createAgentEnvironmentProviderRegistry as yn, CodexExecutionDiagnosticError as yr, isTraceAnalysisStore as yt, attachWorker as z, withBudgetResources as zi, defaultRedactorIdentityMaterial as zn, writeAllBytes as zr, createInbox as zt };
23693
23854
 
23694
- //# sourceMappingURL=supervisor-DBnQuTyJ.js.map
23855
+ //# sourceMappingURL=supervisor-DAHG98Rs.js.map