@tangle-network/agent-runtime 6.0.8 → 7.0.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 (78) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +23 -9
  3. package/dist/{activation-Cwy3_Qn_.js → activation-Ba9IAgQ3.js} +2 -2
  4. package/dist/{activation-Cwy3_Qn_.js.map → activation-Ba9IAgQ3.js.map} +1 -1
  5. package/dist/{activation-CWx7I1PU.d.ts → activation-DIkTEBWF.d.ts} +2 -2
  6. package/dist/agent.d.ts +1 -1
  7. package/dist/agent.js +3 -3
  8. package/dist/{coordination-manager-D9z7To7p.js → coordination-manager-DQZ2u6L-.js} +58 -6
  9. package/dist/coordination-manager-DQZ2u6L-.js.map +1 -0
  10. package/dist/{delegate-ws-KBA2H.js → delegate-DFLSVjFG.js} +2 -2
  11. package/dist/{delegate-ws-KBA2H.js.map → delegate-DFLSVjFG.js.map} +1 -1
  12. package/dist/durable.d.ts +71 -4
  13. package/dist/durable.js +158 -10
  14. package/dist/durable.js.map +1 -1
  15. package/dist/{failure-cause-BzjUUsRz.js → failure-cause-rJTm_Tx8.js} +6 -9
  16. package/dist/failure-cause-rJTm_Tx8.js.map +1 -0
  17. package/dist/{graph-2_nX4ib4.js → graph-BjQF2syl.js} +6 -6
  18. package/dist/{graph-2_nX4ib4.js.map → graph-BjQF2syl.js.map} +1 -1
  19. package/dist/{improve-BxfqTsZy.js → improve-BolbYegO.js} +6 -6
  20. package/dist/{improve-BxfqTsZy.js.map → improve-BolbYegO.js.map} +1 -1
  21. package/dist/index.d.ts +3 -3
  22. package/dist/index.js +10 -10
  23. package/dist/intelligence.d.ts +2 -2
  24. package/dist/intelligence.js +4 -4
  25. package/dist/kernel.d.ts +2 -2
  26. package/dist/kernel.js +13 -13
  27. package/dist/{loop-runner-BmGZ4y1W.js → loop-runner-C9W3T_3T.js} +2 -2
  28. package/dist/{loop-runner-BmGZ4y1W.js.map → loop-runner-C9W3T_3T.js.map} +1 -1
  29. package/dist/{loop-runner-CUMypgRw.d.ts → loop-runner-Cs9IJ6Nk.d.ts} +2 -2
  30. package/dist/loop-runner-bin.d.ts +1 -1
  31. package/dist/loop-runner-bin.js +1 -1
  32. package/dist/mcp/bin.js +3 -3
  33. package/dist/mcp/index.d.ts +1 -1
  34. package/dist/mcp/index.js +6 -6
  35. package/dist/mcp/memory-bin.js +1 -1
  36. package/dist/profiles.d.ts +1 -1
  37. package/dist/{provision-supervisor-CeQTPHRr.js → provision-supervisor-BQFHjCtN.js} +5 -5
  38. package/dist/{provision-supervisor-CeQTPHRr.js.map → provision-supervisor-BQFHjCtN.js.map} +1 -1
  39. package/dist/{run-cancellation-D_4vJ522.js → run-cancellation-B84X8ZAP.js} +2 -2
  40. package/dist/{run-cancellation-D_4vJ522.js.map → run-cancellation-B84X8ZAP.js.map} +1 -1
  41. package/dist/{run-state-CTZVngI_.js → run-state-Dh1bGERI.js} +6 -6
  42. package/dist/{run-state-CTZVngI_.js.map → run-state-Dh1bGERI.js.map} +1 -1
  43. package/dist/{runtime-COm9uBBx.js → runtime-C9F1PG2A.js} +13 -13
  44. package/dist/{runtime-COm9uBBx.js.map → runtime-C9F1PG2A.js.map} +1 -1
  45. package/dist/{search-executor-DTEIl58w.js → search-executor-CKR9_6NR.js} +4 -4
  46. package/dist/{search-executor-DTEIl58w.js.map → search-executor-CKR9_6NR.js.map} +1 -1
  47. package/dist/{server-zO9Nz9Nk.js → server-Dh3SQGQT.js} +4 -4
  48. package/dist/{server-zO9Nz9Nk.js.map → server-Dh3SQGQT.js.map} +1 -1
  49. package/dist/{settle-record-U7fkQEZa.js → settle-record-C6LdVvok.js} +12 -4
  50. package/dist/settle-record-C6LdVvok.js.map +1 -0
  51. package/dist/{structural-rollout-BwTwTUXF.js → structural-rollout-Dapf2aZY.js} +25 -7
  52. package/dist/structural-rollout-Dapf2aZY.js.map +1 -0
  53. package/dist/{supervise-tmqDU6YT.js → supervise-xwl2D6q3.js} +9 -7
  54. package/dist/{supervise-tmqDU6YT.js.map → supervise-xwl2D6q3.js.map} +1 -1
  55. package/dist/{supervision-discovery-CGbXayGv.js → supervision-discovery-B47U8TH5.js} +3 -3
  56. package/dist/{supervision-discovery-CGbXayGv.js.map → supervision-discovery-B47U8TH5.js.map} +1 -1
  57. package/dist/{scope-gIYQ5ZiL.js → supervisor-accounting-DxLQ_TQe.js} +330 -44
  58. package/dist/supervisor-accounting-DxLQ_TQe.js.map +1 -0
  59. package/dist/{supervisor-1A27fE6k.js → supervisor-gC-u_PRk.js} +11 -314
  60. package/dist/supervisor-gC-u_PRk.js.map +1 -0
  61. package/dist/testing.d.ts +1 -1
  62. package/dist/testing.js +11 -11
  63. package/dist/{tool-server-B9q2dtnW.js → tool-server-Dg350Bgz.js} +2 -2
  64. package/dist/{tool-server-B9q2dtnW.js.map → tool-server-Dg350Bgz.js.map} +1 -1
  65. package/dist/{top-web-CS4PD4ck.js → top-web-BJLnFQdr.js} +6 -6
  66. package/dist/{top-web-CS4PD4ck.js.map → top-web-BJLnFQdr.js.map} +1 -1
  67. package/dist/tui/bin.js +6 -6
  68. package/dist/tui/bin.js.map +1 -1
  69. package/dist/tui/index.d.ts +1 -1
  70. package/dist/tui/index.js +2 -2
  71. package/dist/{types-w3Oo1uRJ.d.ts → types-Jg274chm.d.ts} +153 -309
  72. package/package.json +1 -1
  73. package/dist/coordination-manager-D9z7To7p.js.map +0 -1
  74. package/dist/failure-cause-BzjUUsRz.js.map +0 -1
  75. package/dist/scope-gIYQ5ZiL.js.map +0 -1
  76. package/dist/settle-record-U7fkQEZa.js.map +0 -1
  77. package/dist/structural-rollout-BwTwTUXF.js.map +0 -1
  78. package/dist/supervisor-1A27fE6k.js.map +0 -1
package/dist/agent.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BS as OutputAdapter, HS as SandboxClient, S as RuntimeStreamEvent, _S as AgentRunSpec } from "./types-w3Oo1uRJ.js";
1
+ import { S as RuntimeStreamEvent, US as SandboxClient, VS as OutputAdapter, vS as AgentRunSpec } from "./types-Jg274chm.js";
2
2
  import { a as ProfileMaterializationContract, c as assertProfileMaterializes, n as AssertProfileMaterializationOptions, o as ProfileMaterializationIssue, r as DefineProfileMaterializationContractOptions, s as ValidateProfileMaterializationOptions, t as AgentProfileMaterializationAxis } from "./profile-materialization-BRY22Oh8.js";
3
3
  import { a as createSurfaceImprovementProposer, c as SurfaceValidationIssue, i as SurfaceImprovementEdit, l as renderSurfaceIssues, n as DraftPatchInput, o as AgentSurfaces, r as DraftPatchOutput, s as ResolvedSurface, t as CreateSurfaceImprovementProposerOptions, u as validateSurfaces } from "./improvement-adapter-D5GRU1eY.js";
4
4
  import { AgentProfile, AgentProfileFileMount, AgentProfileMcpServer } from "@tangle-network/agent-interface";
package/dist/agent.js CHANGED
@@ -1,7 +1,7 @@
1
- import { nt as mapSandboxEvent } from "./failure-cause-BzjUUsRz.js";
2
- import { A as createSandboxForSpec, Gt as assertProfileMaterialization, Kt as assertProfileMaterializes, en as sandboxActProfileMaterialization } from "./supervisor-1A27fE6k.js";
1
+ import { nt as mapSandboxEvent } from "./failure-cause-rJTm_Tx8.js";
2
+ import { A as createSandboxForSpec, Gt as assertProfileMaterialization, Kt as assertProfileMaterializes, en as sandboxActProfileMaterialization } from "./supervisor-gC-u_PRk.js";
3
3
  import { l as sha256 } from "./jsonl-file-DsxVI0E_.js";
4
- import "./runtime-COm9uBBx.js";
4
+ import "./runtime-C9F1PG2A.js";
5
5
  import { existsSync, readFileSync, statSync } from "node:fs";
6
6
  import { isAbsolute, join, relative, resolve, sep } from "node:path";
7
7
  import { parseFindingSubject } from "@tangle-network/agent-eval/analyst";
@@ -1,8 +1,8 @@
1
- import { $t as FileResultBlobStore, B as FileSpawnJournal, C as writeWorkerSteerAcknowledgement, H as spawnJournalRecordEvents, M as workerTraceAnalysisStore, Pt as runtimeGraphMetadataKey, et as meterRuntimeOwnedAccounting, f as readWorkerCancelRequests, h as readWorkerSteerRequests, j as parseWorkerToolTraceArtifact, l as claimWorkerSteerDelivery, m as readWorkerSteerAcknowledgement, or as isLiveNodeStatus, p as readWorkerCancellation, sr as isTerminalNodeStatus, vt as resolveSpawnResourcePaths, x as writeWorkerCancellation } from "./scope-gIYQ5ZiL.js";
2
- import { $ as assertValidBudget, M as contentAddress, o as settlementFailureCause } from "./failure-cause-BzjUUsRz.js";
1
+ import { C as writeWorkerCancellation, Ft as runtimeGraphMetadataKey, M as parseWorkerToolTraceArtifact, N as workerTraceAnalysisStore, T as writeWorkerSteerAcknowledgement, U as spawnJournalRecordEvents, V as FileSpawnJournal, _ as readWorkerSteerRequests, d as claimWorkerSteerDelivery, en as FileResultBlobStore, g as readWorkerSteerAcknowledgement, h as readWorkerCancellation, m as readWorkerCancelRequests, or as isLiveNodeStatus, sr as isTerminalNodeStatus, tt as meterRuntimeOwnedAccounting, yt as resolveSpawnResourcePaths } from "./supervisor-accounting-DxLQ_TQe.js";
2
+ import { $ as assertValidBudget, M as contentAddress, o as settlementFailureCause } from "./failure-cause-rJTm_Tx8.js";
3
3
  import { a as errMessage, d as resolveRedactor, t as detachedFrozen } from "./snapshot-Cgj2Wzi6.js";
4
- import { Et as failedItems, Y as INBOX_RECEIPT_KEY, _ as withDriverExecutor, b as createExecutorRegistry, gt as CheckUnavailableError, nt as createPeerMailbox, v as InMemoryResultBlobStore, wt as checkVerdictOf, y as InMemorySpawnJournal } from "./supervisor-1A27fE6k.js";
5
- import { c as writeRunCancellation, i as readRunCancellation, r as readRunCancelRequest, t as applyRunCancellation, v as FileCoordinationLog } from "./run-cancellation-D_4vJ522.js";
4
+ import { Et as failedItems, Y as INBOX_RECEIPT_KEY, _ as withDriverExecutor, b as createExecutorRegistry, gt as CheckUnavailableError, nt as createPeerMailbox, v as InMemoryResultBlobStore, wt as checkVerdictOf, y as InMemorySpawnJournal } from "./supervisor-gC-u_PRk.js";
5
+ import { c as writeRunCancellation, i as readRunCancellation, r as readRunCancelRequest, t as applyRunCancellation, v as FileCoordinationLog } from "./run-cancellation-B84X8ZAP.js";
6
6
  import { a as admitRuntimeSpawn, i as workerSettlement, n as resolveJsonPointer, o as safeJsonText, r as textBytes, t as createMapRouting } from "./coordination-map-routing-CKRNZSaV.js";
7
7
  import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest } from "@tangle-network/agent-interface";
8
8
  import { argHash, errorStreakDetector, observeAll, repeatedActionDetector } from "@tangle-network/agent-eval";
@@ -112,6 +112,7 @@ const journalEventKinds = [
112
112
  "analyst-assignment",
113
113
  "acknowledgement",
114
114
  "tool-outcome",
115
+ "tool-timing",
115
116
  "lead-message",
116
117
  "map",
117
118
  "route"
@@ -2153,6 +2154,10 @@ const projectEvent = (ev) => {
2153
2154
  type: "tool-outcome",
2154
2155
  ...ev.outcome
2155
2156
  };
2157
+ if (ev.type === "tool-timing") return {
2158
+ type: "tool-timing",
2159
+ ...ev.call
2160
+ };
2156
2161
  if (ev.type === "lead-message") return {
2157
2162
  type: "lead-message",
2158
2163
  ...ev.message
@@ -4926,7 +4931,54 @@ function assembleTools(parts) {
4926
4931
  analystRunContext: analysis.analystRunContext,
4927
4932
  defineAnalyst: analysis.defineAnalyst
4928
4933
  });
4929
- return tools;
4934
+ return tools.map((tool) => timeCoordinationTool(bus, tool));
4935
+ }
4936
+ /** Record handler duration for every coordination tool call without changing its result. */
4937
+ function timeCoordinationTool(bus, tool) {
4938
+ return {
4939
+ ...tool,
4940
+ handler: async (raw) => {
4941
+ const receivedAt = Date.now();
4942
+ try {
4943
+ const value = await tool.handler(raw);
4944
+ await recordToolTiming(bus, tool.name, receivedAt, true, value);
4945
+ return value;
4946
+ } catch (error) {
4947
+ await recordToolTiming(bus, tool.name, receivedAt, false, error);
4948
+ throw error;
4949
+ }
4950
+ }
4951
+ };
4952
+ }
4953
+ async function recordToolTiming(bus, tool, receivedAt, ok, value) {
4954
+ try {
4955
+ await bus.publish({
4956
+ type: "tool-timing",
4957
+ call: {
4958
+ tool,
4959
+ receivedAt,
4960
+ elapsedMs: Math.max(0, Date.now() - receivedAt),
4961
+ responseBytes: responseUtf8Bytes(ok ? value : errorText(value)),
4962
+ ok
4963
+ }
4964
+ }, { queue: false });
4965
+ } catch (error) {
4966
+ console.error("Runtime could not record coordination tool timing", {
4967
+ tool,
4968
+ error: error instanceof Error ? error.message : String(error)
4969
+ });
4970
+ }
4971
+ }
4972
+ function responseUtf8Bytes(value) {
4973
+ if (typeof value === "string") return Buffer.byteLength(value);
4974
+ try {
4975
+ return Buffer.byteLength(JSON.stringify(value) ?? "null");
4976
+ } catch {
4977
+ return Buffer.byteLength(String(value));
4978
+ }
4979
+ }
4980
+ function errorText(error) {
4981
+ return error instanceof Error ? error.message : String(error);
4930
4982
  }
4931
4983
  function managerSurface(parts, tools) {
4932
4984
  const { opts, bus, state, ledger, questionLedger, spawnAdmission, analysis, settlements, messages, workers, waiting, intake, journal, peerMail, ackEnv, ready } = parts;
@@ -5135,4 +5187,4 @@ function createResumeReplay({ opts, bus, ledger, analysis, projectSettled }) {
5135
5187
  }
5136
5188
  export { downMessageRefusalReasons as a, createSteerAcknowledger as c, coordinationVerbNames as d, createFileRunContext as f, watchTrace as i, budgetOverspendText as l, withRunContext as m, createCoordinationToolsForManager as n, createEventBus as o, createInMemoryRunContext as p, defaultToolDetectors as r, createCancelAcknowledger as s, createCoordinationTools as t, normalizeAnalyzeOnSettle as u };
5137
5189
 
5138
- //# sourceMappingURL=coordination-manager-D9z7To7p.js.map
5190
+ //# sourceMappingURL=coordination-manager-DQZ2u6L-.js.map