agentfootprint 9.25.0 → 9.26.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 (189) hide show
  1. package/AGENTS.md +1 -1
  2. package/CLAUDE.md +7 -1
  3. package/ai-instructions/claude-code/SKILL.md +1 -1
  4. package/dist/adapters/code/local.js +102 -2
  5. package/dist/adapters/code/local.js.map +1 -1
  6. package/dist/adapters/hosting/agentcore.js +11 -0
  7. package/dist/adapters/hosting/agentcore.js.map +1 -1
  8. package/dist/adapters/identity/jwks.js +277 -0
  9. package/dist/adapters/identity/jwks.js.map +1 -0
  10. package/dist/adapters/types.js +18 -1
  11. package/dist/adapters/types.js.map +1 -1
  12. package/dist/artifacts/index.js +6 -1
  13. package/dist/artifacts/index.js.map +1 -1
  14. package/dist/artifacts/recordingArtifact.js +88 -0
  15. package/dist/artifacts/recordingArtifact.js.map +1 -0
  16. package/dist/core/Agent.js +176 -0
  17. package/dist/core/Agent.js.map +1 -1
  18. package/dist/core/agent/repeatedCall.js +190 -0
  19. package/dist/core/agent/repeatedCall.js.map +1 -0
  20. package/dist/core/agent/stages/toolCalls.js +50 -0
  21. package/dist/core/agent/stages/toolCalls.js.map +1 -1
  22. package/dist/core/codeRunnerTool.js +149 -12
  23. package/dist/core/codeRunnerTool.js.map +1 -1
  24. package/dist/esm/adapters/code/local.d.ts +16 -0
  25. package/dist/esm/adapters/code/local.js +102 -2
  26. package/dist/esm/adapters/code/local.js.map +1 -1
  27. package/dist/esm/adapters/hosting/agentcore.js +11 -0
  28. package/dist/esm/adapters/hosting/agentcore.js.map +1 -1
  29. package/dist/esm/adapters/identity/jwks.d.ts +124 -0
  30. package/dist/esm/adapters/identity/jwks.js +249 -0
  31. package/dist/esm/adapters/identity/jwks.js.map +1 -0
  32. package/dist/esm/adapters/types.d.ts +86 -0
  33. package/dist/esm/adapters/types.js +16 -0
  34. package/dist/esm/adapters/types.js.map +1 -1
  35. package/dist/esm/artifacts/index.d.ts +1 -0
  36. package/dist/esm/artifacts/index.js +1 -0
  37. package/dist/esm/artifacts/index.js.map +1 -1
  38. package/dist/esm/artifacts/recordingArtifact.d.ts +76 -0
  39. package/dist/esm/artifacts/recordingArtifact.js +83 -0
  40. package/dist/esm/artifacts/recordingArtifact.js.map +1 -0
  41. package/dist/esm/core/Agent.d.ts +66 -2
  42. package/dist/esm/core/Agent.js +176 -0
  43. package/dist/esm/core/Agent.js.map +1 -1
  44. package/dist/esm/core/agent/repeatedCall.d.ts +150 -0
  45. package/dist/esm/core/agent/repeatedCall.js +184 -0
  46. package/dist/esm/core/agent/repeatedCall.js.map +1 -0
  47. package/dist/esm/core/agent/stages/toolCalls.d.ts +12 -0
  48. package/dist/esm/core/agent/stages/toolCalls.js +50 -0
  49. package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
  50. package/dist/esm/core/agent/types.d.ts +82 -0
  51. package/dist/esm/core/codeRunnerTool.d.ts +31 -0
  52. package/dist/esm/core/codeRunnerTool.js +149 -12
  53. package/dist/esm/core/codeRunnerTool.js.map +1 -1
  54. package/dist/esm/events/payloads.d.ts +22 -0
  55. package/dist/esm/events/registry.d.ts +3 -1
  56. package/dist/esm/events/registry.js +2 -0
  57. package/dist/esm/events/registry.js.map +1 -1
  58. package/dist/esm/hosting/admission.d.ts +180 -0
  59. package/dist/esm/hosting/admission.js +188 -0
  60. package/dist/esm/hosting/admission.js.map +1 -0
  61. package/dist/esm/hosting/artifactWire.d.ts +8 -5
  62. package/dist/esm/hosting/artifactWire.js +14 -9
  63. package/dist/esm/hosting/artifactWire.js.map +1 -1
  64. package/dist/esm/hosting/envelope.d.ts +34 -0
  65. package/dist/esm/hosting/envelope.js +81 -0
  66. package/dist/esm/hosting/envelope.js.map +1 -1
  67. package/dist/esm/hosting/errors.d.ts +131 -0
  68. package/dist/esm/hosting/errors.js +195 -0
  69. package/dist/esm/hosting/errors.js.map +1 -1
  70. package/dist/esm/hosting/httpHost.d.ts +21 -0
  71. package/dist/esm/hosting/httpHost.js +44 -2
  72. package/dist/esm/hosting/httpHost.js.map +1 -1
  73. package/dist/esm/hosting/identityVerification.d.ts +154 -0
  74. package/dist/esm/hosting/identityVerification.js +135 -0
  75. package/dist/esm/hosting/identityVerification.js.map +1 -0
  76. package/dist/esm/hosting/index.d.ts +12 -3
  77. package/dist/esm/hosting/index.js +16 -2
  78. package/dist/esm/hosting/index.js.map +1 -1
  79. package/dist/esm/hosting/memorySessions.d.ts +9 -0
  80. package/dist/esm/hosting/memorySessions.js +86 -0
  81. package/dist/esm/hosting/memorySessions.js.map +1 -1
  82. package/dist/esm/hosting/nodeHost.js +8 -0
  83. package/dist/esm/hosting/nodeHost.js.map +1 -1
  84. package/dist/esm/hosting/sessionWire.d.ts +126 -0
  85. package/dist/esm/hosting/sessionWire.js +95 -0
  86. package/dist/esm/hosting/sessionWire.js.map +1 -0
  87. package/dist/esm/hosting/sqliteSessions.js +122 -5
  88. package/dist/esm/hosting/sqliteSessions.js.map +1 -1
  89. package/dist/esm/hosting/standingAgent.js +299 -8
  90. package/dist/esm/hosting/standingAgent.js.map +1 -1
  91. package/dist/esm/hosting/types.d.ts +166 -6
  92. package/dist/esm/hosting/types.js.map +1 -1
  93. package/dist/esm/hosting/wireOps.d.ts +52 -0
  94. package/dist/esm/hosting/wireOps.js +60 -0
  95. package/dist/esm/hosting/wireOps.js.map +1 -0
  96. package/dist/esm/identity.d.ts +1 -0
  97. package/dist/esm/identity.js +6 -0
  98. package/dist/esm/identity.js.map +1 -1
  99. package/dist/esm/index.d.ts +2 -2
  100. package/dist/esm/index.js +5 -1
  101. package/dist/esm/index.js.map +1 -1
  102. package/dist/events/registry.js +2 -0
  103. package/dist/events/registry.js.map +1 -1
  104. package/dist/hosting/admission.js +194 -0
  105. package/dist/hosting/admission.js.map +1 -0
  106. package/dist/hosting/artifactWire.js +14 -9
  107. package/dist/hosting/artifactWire.js.map +1 -1
  108. package/dist/hosting/envelope.js +84 -1
  109. package/dist/hosting/envelope.js.map +1 -1
  110. package/dist/hosting/errors.js +203 -1
  111. package/dist/hosting/errors.js.map +1 -1
  112. package/dist/hosting/httpHost.js +43 -1
  113. package/dist/hosting/httpHost.js.map +1 -1
  114. package/dist/hosting/identityVerification.js +140 -0
  115. package/dist/hosting/identityVerification.js.map +1 -0
  116. package/dist/hosting/index.js +38 -1
  117. package/dist/hosting/index.js.map +1 -1
  118. package/dist/hosting/memorySessions.js +86 -0
  119. package/dist/hosting/memorySessions.js.map +1 -1
  120. package/dist/hosting/nodeHost.js +8 -0
  121. package/dist/hosting/nodeHost.js.map +1 -1
  122. package/dist/hosting/sessionWire.js +100 -0
  123. package/dist/hosting/sessionWire.js.map +1 -0
  124. package/dist/hosting/sqliteSessions.js +121 -4
  125. package/dist/hosting/sqliteSessions.js.map +1 -1
  126. package/dist/hosting/standingAgent.js +297 -6
  127. package/dist/hosting/standingAgent.js.map +1 -1
  128. package/dist/hosting/types.js.map +1 -1
  129. package/dist/hosting/wireOps.js +65 -0
  130. package/dist/hosting/wireOps.js.map +1 -0
  131. package/dist/identity.js +9 -1
  132. package/dist/identity.js.map +1 -1
  133. package/dist/index.js +9 -2
  134. package/dist/index.js.map +1 -1
  135. package/dist/types/adapters/code/local.d.ts +16 -0
  136. package/dist/types/adapters/code/local.d.ts.map +1 -1
  137. package/dist/types/adapters/hosting/agentcore.d.ts.map +1 -1
  138. package/dist/types/adapters/identity/jwks.d.ts +125 -0
  139. package/dist/types/adapters/identity/jwks.d.ts.map +1 -0
  140. package/dist/types/adapters/types.d.ts +86 -0
  141. package/dist/types/adapters/types.d.ts.map +1 -1
  142. package/dist/types/artifacts/index.d.ts +1 -0
  143. package/dist/types/artifacts/index.d.ts.map +1 -1
  144. package/dist/types/artifacts/recordingArtifact.d.ts +77 -0
  145. package/dist/types/artifacts/recordingArtifact.d.ts.map +1 -0
  146. package/dist/types/core/Agent.d.ts +66 -2
  147. package/dist/types/core/Agent.d.ts.map +1 -1
  148. package/dist/types/core/agent/repeatedCall.d.ts +151 -0
  149. package/dist/types/core/agent/repeatedCall.d.ts.map +1 -0
  150. package/dist/types/core/agent/stages/toolCalls.d.ts +12 -0
  151. package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
  152. package/dist/types/core/agent/types.d.ts +82 -0
  153. package/dist/types/core/agent/types.d.ts.map +1 -1
  154. package/dist/types/core/codeRunnerTool.d.ts +31 -0
  155. package/dist/types/core/codeRunnerTool.d.ts.map +1 -1
  156. package/dist/types/events/payloads.d.ts +22 -0
  157. package/dist/types/events/payloads.d.ts.map +1 -1
  158. package/dist/types/events/registry.d.ts +3 -1
  159. package/dist/types/events/registry.d.ts.map +1 -1
  160. package/dist/types/hosting/admission.d.ts +181 -0
  161. package/dist/types/hosting/admission.d.ts.map +1 -0
  162. package/dist/types/hosting/artifactWire.d.ts +8 -5
  163. package/dist/types/hosting/artifactWire.d.ts.map +1 -1
  164. package/dist/types/hosting/envelope.d.ts +34 -0
  165. package/dist/types/hosting/envelope.d.ts.map +1 -1
  166. package/dist/types/hosting/errors.d.ts +131 -0
  167. package/dist/types/hosting/errors.d.ts.map +1 -1
  168. package/dist/types/hosting/httpHost.d.ts +21 -0
  169. package/dist/types/hosting/httpHost.d.ts.map +1 -1
  170. package/dist/types/hosting/identityVerification.d.ts +155 -0
  171. package/dist/types/hosting/identityVerification.d.ts.map +1 -0
  172. package/dist/types/hosting/index.d.ts +12 -3
  173. package/dist/types/hosting/index.d.ts.map +1 -1
  174. package/dist/types/hosting/memorySessions.d.ts +9 -0
  175. package/dist/types/hosting/memorySessions.d.ts.map +1 -1
  176. package/dist/types/hosting/nodeHost.d.ts.map +1 -1
  177. package/dist/types/hosting/sessionWire.d.ts +127 -0
  178. package/dist/types/hosting/sessionWire.d.ts.map +1 -0
  179. package/dist/types/hosting/sqliteSessions.d.ts.map +1 -1
  180. package/dist/types/hosting/standingAgent.d.ts.map +1 -1
  181. package/dist/types/hosting/types.d.ts +166 -6
  182. package/dist/types/hosting/types.d.ts.map +1 -1
  183. package/dist/types/hosting/wireOps.d.ts +53 -0
  184. package/dist/types/hosting/wireOps.d.ts.map +1 -0
  185. package/dist/types/identity.d.ts +1 -0
  186. package/dist/types/identity.d.ts.map +1 -1
  187. package/dist/types/index.d.ts +2 -2
  188. package/dist/types/index.d.ts.map +1 -1
  189. package/package.json +6 -1
@@ -14,7 +14,7 @@
14
14
  * these interfaces — never on concrete adapters.
15
15
  */
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.checkerGoverns = exports.DEFAULT_CARRIES_IN_MESSAGES = void 0;
17
+ exports.canStageCodeInputs = exports.STAGED_INPUTS_ENV = exports.checkerGoverns = exports.DEFAULT_CARRIES_IN_MESSAGES = void 0;
18
18
  /**
19
19
  * The floor every known wire supports. Used for any provider that does not
20
20
  * declare `carriesInMessages` — a third-party adapter is assumed to carry
@@ -39,4 +39,21 @@ function checkerGoverns(checker, capability) {
39
39
  return checker.governs?.includes(capability) === true;
40
40
  }
41
41
  exports.checkerGoverns = checkerGoverns;
42
+ /**
43
+ * The environment variable an executing snippet reads its staged inputs from —
44
+ * a JSON object mapping each input's NAME to the path it landed at.
45
+ *
46
+ * Part of {@link CodeSession.stageInputs}'s contract rather than one adapter's
47
+ * convention, and named here so an adapter uses the constant instead of
48
+ * retyping the string. It is what makes model-written code portable across
49
+ * backends: the code reads one variable, and every adapter that stages inputs
50
+ * fills it the same way.
51
+ */
52
+ exports.STAGED_INPUTS_ENV = 'AF_STAGED_INPUTS';
53
+ /** Can this session accept staged inputs? The feature-detection law: read the
54
+ * member, never assume it from the adapter's name. */
55
+ function canStageCodeInputs(session) {
56
+ return typeof session.stageInputs === 'function';
57
+ }
58
+ exports.canStageCodeInputs = canStageCodeInputs;
42
59
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/adapters/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AA+GH;;;;GAIG;AACU,QAAA,2BAA2B,GAAwB,MAAM,CAAC,MAAM,CAAC;IAC5E,MAAM;IACN,WAAW;CACZ,CAAC,CAAC;AAikBH;;;;;;GAMG;AACH,SAAgB,cAAc,CAC5B,OAAsC,EACtC,UAAgC;IAEhC,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,IAAI,UAAU,KAAK,WAAW;QAAE,OAAO,IAAI,CAAC;IAC5C,OAAO,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;AACxD,CAAC;AAPD,wCAOC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/adapters/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AA+GH;;;;GAIG;AACU,QAAA,2BAA2B,GAAwB,MAAM,CAAC,MAAM,CAAC;IAC5E,MAAM;IACN,WAAW;CACZ,CAAC,CAAC;AAikBH;;;;;;GAMG;AACH,SAAgB,cAAc,CAC5B,OAAsC,EACtC,UAAgC;IAEhC,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,IAAI,UAAU,KAAK,WAAW;QAAE,OAAO,IAAI,CAAC;IAC5C,OAAO,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;AACxD,CAAC;AAPD,wCAOC;AAqDD;;;;;;;;;GASG;AACU,QAAA,iBAAiB,GAAG,kBAAkB,CAAC;AAgGpD;uDACuD;AACvD,SAAgB,kBAAkB,CAChC,OAAoB;IAEpB,OAAO,OAAO,OAAO,CAAC,WAAW,KAAK,UAAU,CAAC;AACnD,CAAC;AAJD,gDAIC"}
@@ -11,7 +11,7 @@
11
11
  * this folder for the one-job map and the import direction.
12
12
  */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.placedToolResult = exports.placedResultKind = exports.isPlacedToolResult = exports.assertArtifactPlacement = exports.presentArtifact = exports.PRESENT_TOOL_NAME = exports.wantsNeedsStoreRefusal = exports.resolveToolWants = exports.assertToolWants = exports.unconfiguredArtifacts = exports.bindArtifacts = exports.collectStream = exports.canStreamArtifacts = exports.canPutArtifactStream = exports.canGetArtifactStream = exports.bytesAsStream = exports.assertStreamBytes = exports.gcsArtifacts = exports.s3Artifacts = exports.UnreadableArtifactStoreError = exports.sqliteArtifacts = exports.UnreadableArtifactFileError = exports.fileArtifacts = exports.DEFAULT_IN_MEMORY_ARTIFACT_RETENTION = exports.inMemoryArtifacts = exports.mintArtifactRef = exports.isArtifactRef = exports.ARTIFACT_REF_PREFIX = exports.UnknownParentRefError = exports.InvalidArtifactError = exports.ArtifactIntegrityError = void 0;
14
+ exports.placedToolResult = exports.placedResultKind = exports.isPlacedToolResult = exports.assertArtifactPlacement = exports.UnserializableRecordingError = exports.RECORDING_MEDIA_TYPE = exports.RECORDING_ARTIFACT_KIND = exports.recordingPutInput = exports.presentArtifact = exports.PRESENT_TOOL_NAME = exports.wantsNeedsStoreRefusal = exports.resolveToolWants = exports.assertToolWants = exports.unconfiguredArtifacts = exports.bindArtifacts = exports.collectStream = exports.canStreamArtifacts = exports.canPutArtifactStream = exports.canGetArtifactStream = exports.bytesAsStream = exports.assertStreamBytes = exports.gcsArtifacts = exports.s3Artifacts = exports.UnreadableArtifactStoreError = exports.sqliteArtifacts = exports.UnreadableArtifactFileError = exports.fileArtifacts = exports.DEFAULT_IN_MEMORY_ARTIFACT_RETENTION = exports.inMemoryArtifacts = exports.mintArtifactRef = exports.isArtifactRef = exports.ARTIFACT_REF_PREFIX = exports.UnknownParentRefError = exports.InvalidArtifactError = exports.ArtifactIntegrityError = void 0;
15
15
  var types_js_1 = require("./types.js");
16
16
  Object.defineProperty(exports, "ArtifactIntegrityError", { enumerable: true, get: function () { return types_js_1.ArtifactIntegrityError; } });
17
17
  Object.defineProperty(exports, "InvalidArtifactError", { enumerable: true, get: function () { return types_js_1.InvalidArtifactError; } });
@@ -50,6 +50,11 @@ Object.defineProperty(exports, "wantsNeedsStoreRefusal", { enumerable: true, get
50
50
  var present_js_1 = require("./present.js");
51
51
  Object.defineProperty(exports, "PRESENT_TOOL_NAME", { enumerable: true, get: function () { return present_js_1.PRESENT_TOOL_NAME; } });
52
52
  Object.defineProperty(exports, "presentArtifact", { enumerable: true, get: function () { return present_js_1.presentArtifact; } });
53
+ var recordingArtifact_js_1 = require("./recordingArtifact.js");
54
+ Object.defineProperty(exports, "recordingPutInput", { enumerable: true, get: function () { return recordingArtifact_js_1.recordingPutInput; } });
55
+ Object.defineProperty(exports, "RECORDING_ARTIFACT_KIND", { enumerable: true, get: function () { return recordingArtifact_js_1.RECORDING_ARTIFACT_KIND; } });
56
+ Object.defineProperty(exports, "RECORDING_MEDIA_TYPE", { enumerable: true, get: function () { return recordingArtifact_js_1.RECORDING_MEDIA_TYPE; } });
57
+ Object.defineProperty(exports, "UnserializableRecordingError", { enumerable: true, get: function () { return recordingArtifact_js_1.UnserializableRecordingError; } });
53
58
  var placement_js_1 = require("./placement.js");
54
59
  Object.defineProperty(exports, "assertArtifactPlacement", { enumerable: true, get: function () { return placement_js_1.assertArtifactPlacement; } });
55
60
  Object.defineProperty(exports, "isPlacedToolResult", { enumerable: true, get: function () { return placement_js_1.isPlacedToolResult; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/artifacts/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,uCAkBoB;AAjBlB,kHAAA,sBAAsB,OAAA;AACtB,gHAAA,oBAAoB,OAAA;AACpB,iHAAA,qBAAqB,OAAA;AAgBvB,yCAAkF;AAAzE,gHAAA,mBAAmB,OAAA;AAAE,0GAAA,aAAa,OAAA;AAAE,4GAAA,eAAe,OAAA;AAE5D,+DAKgC;AAJ9B,yHAAA,iBAAiB,OAAA;AACjB,4IAAA,oCAAoC,OAAA;AAItC,uDAI4B;AAH1B,iHAAA,aAAa,OAAA;AACb,+HAAA,2BAA2B,OAAA;AAG7B,2DAK8B;AAJ5B,qHAAA,eAAe,OAAA;AACf,kIAAA,4BAA4B,OAAA;AAI9B,mDAAwE;AAA/D,6GAAA,WAAW,OAAA;AACpB,qDAA2E;AAAlE,+GAAA,YAAY,OAAA;AACrB,+CAUwB;AATtB,iHAAA,iBAAiB,OAAA;AACjB,6GAAA,aAAa,OAAA;AACb,oHAAA,oBAAoB,OAAA;AACpB,oHAAA,oBAAoB,OAAA;AACpB,kHAAA,kBAAkB,OAAA;AAClB,6GAAA,aAAa,OAAA;AAKf,iDAUyB;AATvB,8GAAA,aAAa,OAAA;AACb,sHAAA,qBAAqB,OAAA;AASvB,uCAOoB;AANlB,2GAAA,eAAe,OAAA;AACf,4GAAA,gBAAgB,OAAA;AAChB,kHAAA,sBAAsB,OAAA;AAKxB,2CAMsB;AALpB,+GAAA,iBAAiB,OAAA;AACjB,6GAAA,eAAe,OAAA;AAKjB,+CAOwB;AANtB,uHAAA,uBAAuB,OAAA;AACvB,kHAAA,kBAAkB,OAAA;AAClB,gHAAA,gBAAgB,OAAA;AAChB,gHAAA,gBAAgB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/artifacts/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,uCAkBoB;AAjBlB,kHAAA,sBAAsB,OAAA;AACtB,gHAAA,oBAAoB,OAAA;AACpB,iHAAA,qBAAqB,OAAA;AAgBvB,yCAAkF;AAAzE,gHAAA,mBAAmB,OAAA;AAAE,0GAAA,aAAa,OAAA;AAAE,4GAAA,eAAe,OAAA;AAE5D,+DAKgC;AAJ9B,yHAAA,iBAAiB,OAAA;AACjB,4IAAA,oCAAoC,OAAA;AAItC,uDAI4B;AAH1B,iHAAA,aAAa,OAAA;AACb,+HAAA,2BAA2B,OAAA;AAG7B,2DAK8B;AAJ5B,qHAAA,eAAe,OAAA;AACf,kIAAA,4BAA4B,OAAA;AAI9B,mDAAwE;AAA/D,6GAAA,WAAW,OAAA;AACpB,qDAA2E;AAAlE,+GAAA,YAAY,OAAA;AACrB,+CAUwB;AATtB,iHAAA,iBAAiB,OAAA;AACjB,6GAAA,aAAa,OAAA;AACb,oHAAA,oBAAoB,OAAA;AACpB,oHAAA,oBAAoB,OAAA;AACpB,kHAAA,kBAAkB,OAAA;AAClB,6GAAA,aAAa,OAAA;AAKf,iDAUyB;AATvB,8GAAA,aAAa,OAAA;AACb,sHAAA,qBAAqB,OAAA;AASvB,uCAOoB;AANlB,2GAAA,eAAe,OAAA;AACf,4GAAA,gBAAgB,OAAA;AAChB,kHAAA,sBAAsB,OAAA;AAKxB,2CAMsB;AALpB,+GAAA,iBAAiB,OAAA;AACjB,6GAAA,eAAe,OAAA;AAKjB,+DAMgC;AAL9B,yHAAA,iBAAiB,OAAA;AACjB,+HAAA,uBAAuB,OAAA;AACvB,4HAAA,oBAAoB,OAAA;AACpB,oIAAA,4BAA4B,OAAA;AAG9B,+CAOwB;AANtB,uHAAA,uBAAuB,OAAA;AACvB,kHAAA,kBAAkB,OAAA;AAClB,gHAAA,gBAAgB,OAAA;AAChB,gHAAA,gBAAgB,OAAA"}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ /**
3
+ * artifacts/recordingArtifact — a finished run, checked into the store like any
4
+ * other payload.
5
+ *
6
+ * `recordRun` has produced `{ snapshot, events, structure }` since 8.x and the
7
+ * lens family has consumed exactly that shape since. What nobody shipped was
8
+ * the boring half in between: WHERE a completed run's recording goes so a
9
+ * screen can ask for it later. Every deployment that wanted the Lens over the
10
+ * wire wrote the same twenty lines — record the run, serialize it, put it
11
+ * somewhere with a key, hand the key to the frontend — and each one wrote a
12
+ * slightly different, slightly wrong version of retention and scoping.
13
+ *
14
+ * All four of those problems already have an answer in this package: the
15
+ * artifact store IS a keyed payload store with scope isolation, retention and
16
+ * a read-only wire. So a recording is simply an artifact of kind
17
+ * `'recording/run'`, and the wire ops that already redeem claim tickets serve
18
+ * it with **zero new operations** — `{ op: 'artifact-get', ref }` returns the
19
+ * recording, and the frontend does what it always did with the bytes.
20
+ *
21
+ * ── Why the payload is TEXT and not an object ───────────────────────────────
22
+ * The recording is minted as its JSON text — the same bytes
23
+ * `JSON.stringify(recorder.toRecording())` produces, which is precisely what
24
+ * `observeRecording(JSON.parse(text))` consumes on the viewer side. Two
25
+ * reasons, and both are about not lying:
26
+ *
27
+ * • `recordRun` states that `snapshot` and `structure` are the runner's OWN
28
+ * objects, held by reference. An in-process store handed those would keep
29
+ * a live view into a finished run's state — the artifact would silently
30
+ * change if anything touched it. Serializing detaches it, once, here.
31
+ * • A recording that cannot be serialized cannot be delivered over any wire
32
+ * either, so failing at the mint is failing at the honest moment rather
33
+ * than at whatever reads it next.
34
+ */
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.recordingPutInput = exports.UnserializableRecordingError = exports.RECORDING_MEDIA_TYPE = exports.RECORDING_ARTIFACT_KIND = void 0;
37
+ /** The consumer vocabulary a run recording is stored under. One kind, exact
38
+ * match — the same rule every `wants` declaration is judged by. */
39
+ exports.RECORDING_ARTIFACT_KIND = 'recording/run';
40
+ /** The media type a recording is minted with. */
41
+ exports.RECORDING_MEDIA_TYPE = 'application/json';
42
+ /**
43
+ * Raised when a recording could not be turned into bytes.
44
+ *
45
+ * Its own class because the CALLER's answer differs from every other mint
46
+ * failure: a full store is retryable and a cyclic snapshot is not.
47
+ */
48
+ class UnserializableRecordingError extends Error {
49
+ code = 'ERR_UNSERIALIZABLE_RECORDING';
50
+ constructor(detail) {
51
+ super(`[artifacts] the run recording could not be serialized (${detail}), so it was not ` +
52
+ `stored. A recording that JSON cannot carry could not be delivered over any wire ` +
53
+ `either — this fails at the mint rather than at whatever tried to read it. The run ` +
54
+ `itself is unaffected: its answer was already composed before this was attempted.`);
55
+ this.name = 'UnserializableRecordingError';
56
+ }
57
+ }
58
+ exports.UnserializableRecordingError = UnserializableRecordingError;
59
+ /**
60
+ * Turn one finished recording into the `put` input that stores it.
61
+ *
62
+ * Pure: no store, no events, no agent. The caller owns WHEN this happens (after
63
+ * the answer is composed) and what to do when it fails.
64
+ *
65
+ * @throws UnserializableRecordingError when the recording cannot be
66
+ * JSON-serialized — a cyclic object in a snapshot, most likely.
67
+ */
68
+ function recordingPutInput(recording, facts = {}) {
69
+ let text;
70
+ try {
71
+ text = JSON.stringify(recording) ?? '';
72
+ }
73
+ catch (err) {
74
+ throw new UnserializableRecordingError(err instanceof Error ? err.message : String(err));
75
+ }
76
+ if (text === '') {
77
+ throw new UnserializableRecordingError('it serializes to nothing');
78
+ }
79
+ return {
80
+ kind: exports.RECORDING_ARTIFACT_KIND,
81
+ mediaType: exports.RECORDING_MEDIA_TYPE,
82
+ data: text,
83
+ label: facts.label ?? (facts.runId !== undefined ? `run ${facts.runId}` : 'run recording'),
84
+ ...(facts.runId !== undefined && { origin: { runId: facts.runId } }),
85
+ };
86
+ }
87
+ exports.recordingPutInput = recordingPutInput;
88
+ //# sourceMappingURL=recordingArtifact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordingArtifact.js","sourceRoot":"","sources":["../../src/artifacts/recordingArtifact.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;;;AAIH;oEACoE;AACvD,QAAA,uBAAuB,GAAG,eAAe,CAAC;AAEvD,iDAAiD;AACpC,QAAA,oBAAoB,GAAG,kBAAkB,CAAC;AAoBvD;;;;;GAKG;AACH,MAAa,4BAA6B,SAAQ,KAAK;IAC5C,IAAI,GAAG,8BAAuC,CAAC;IAExD,YAAY,MAAc;QACxB,KAAK,CACH,0DAA0D,MAAM,mBAAmB;YACjF,kFAAkF;YAClF,oFAAoF;YACpF,kFAAkF,CACrF,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAC;IAC7C,CAAC;CACF;AAZD,oEAYC;AAED;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAC/B,SAAkB,EAClB,QAA4B,EAAE;IAE9B,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IACzC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,4BAA4B,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3F,CAAC;IACD,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;QAChB,MAAM,IAAI,4BAA4B,CAAC,0BAA0B,CAAC,CAAC;IACrE,CAAC;IACD,OAAO;QACL,IAAI,EAAE,+BAAuB;QAC7B,SAAS,EAAE,4BAAoB;QAC/B,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC;QAC1F,GAAG,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;KACrE,CAAC;AACJ,CAAC;AApBD,8CAoBC"}
@@ -26,6 +26,8 @@ const skillBrains_js_1 = require("./agent/skillBrains.js");
26
26
  const conventions_js_1 = require("../conventions.js");
27
27
  const pause_js_1 = require("./pause.js");
28
28
  const placement_js_1 = require("../artifacts/placement.js");
29
+ const recordingArtifact_js_1 = require("../artifacts/recordingArtifact.js");
30
+ const recordRun_js_1 = require("../recorders/observability/recordRun.js");
29
31
  const CredentialConsentRequiredError_js_1 = require("../identity/CredentialConsentRequiredError.js");
30
32
  const ContextRecorder_js_1 = require("../recorders/core/ContextRecorder.js");
31
33
  const ContextEvaluatedRecorder_js_1 = require("../recorders/core/ContextEvaluatedRecorder.js");
@@ -237,6 +239,13 @@ class Agent extends RunnerBase_js_1.RunnerBase {
237
239
  /** The placement threshold (9.22.0) — the operator's ref-ing dial from the
238
240
  * object form of AgentOptions.artifacts. Only ever set beside a store. */
239
241
  artifactPlacement;
242
+ /** Recordings-as-artifacts (9.26.0) — the operator's dial from the object
243
+ * form of AgentOptions.artifacts. Only ever set beside a store; absent
244
+ * means no recorder is ever attached and no run is ever recorded. */
245
+ artifactRecordings;
246
+ /** The repeated-call nudge (9.26.0) — `false` only when the operator turned
247
+ * it off. See AgentOptions.repeatedCallNudge. */
248
+ repeatedCallNudge;
240
249
  /** What a run does when a declared credential needs 3LO consent (8.6.0).
241
250
  * Default `'pause'`. See AgentOptions.onAuthorizationRequired. */
242
251
  onAuthorizationRequired;
@@ -514,6 +523,11 @@ class Agent extends RunnerBase_js_1.RunnerBase {
514
523
  this.observerDeliveryOptions = opts.observerDeliveryOptions;
515
524
  if (opts.credentials)
516
525
  this.credentialProvider = opts.credentials;
526
+ // Kept only when it says something: `undefined` and `true` are the same
527
+ // default, and storing `true` would make the thread-when-off rule below
528
+ // read as a coincidence.
529
+ if (opts.repeatedCallNudge === false)
530
+ this.repeatedCallNudge = false;
517
531
  // The claim-check seam (9.21.0). One store per agent, attached at
518
532
  // construction — idempotent by shape: there is no second door to attach a
519
533
  // competing one through, so "one per agent" is a fact of the type rather
@@ -537,6 +551,16 @@ class Agent extends RunnerBase_js_1.RunnerBase {
537
551
  if (opts.artifacts.placement !== undefined) {
538
552
  this.artifactPlacement = opts.artifacts.placement;
539
553
  }
554
+ // The recordings dial (9.26.0). `true` and `{ … }` normalize to ONE
555
+ // shape here, so every downstream reader asks a single question
556
+ // ("is there a recordings option?") rather than re-deriving the union.
557
+ if (opts.artifacts.recordings === true) {
558
+ this.artifactRecordings = {};
559
+ }
560
+ else if (typeof opts.artifacts.recordings === 'object' &&
561
+ opts.artifacts.recordings !== null) {
562
+ this.artifactRecordings = opts.artifacts.recordings;
563
+ }
540
564
  }
541
565
  else {
542
566
  this.artifactStore = opts.artifacts;
@@ -629,6 +653,134 @@ class Agent extends RunnerBase_js_1.RunnerBase {
629
653
  getArtifactStore() {
630
654
  return this.artifactStore;
631
655
  }
656
+ /**
657
+ * Start recording this run — or do nothing at all (9.26.0).
658
+ *
659
+ * Zero-cost when unused is not a claim here, it is the control flow: with
660
+ * `recordings` unset this returns `undefined` before touching the agent, so
661
+ * no listener is subscribed, no boundary recorder is attached, and the run
662
+ * is byte-identical to every earlier release.
663
+ *
664
+ * It is deliberately the SAME `recordRun` a consumer would call by hand.
665
+ * Nothing about this feature is a second recording implementation — the
666
+ * three connections that a hand-rolled version gets wrong (attach,
667
+ * subscribe, getCommitCount) are wired in exactly one place in this package,
668
+ * and this is a caller of it.
669
+ */
670
+ startRunRecording() {
671
+ if (this.artifactRecordings === undefined || this.artifactStore === undefined)
672
+ return undefined;
673
+ return (0, recordRun_js_1.recordRun)(this);
674
+ }
675
+ /**
676
+ * File the finished recording into the artifact store.
677
+ *
678
+ * ── When ────────────────────────────────────────────────────────────────
679
+ * After the answer is composed, and only for a run that COMPLETED. A pause
680
+ * is not a finished run (the turn continues, and the resume mints its own);
681
+ * a throw never reaches here at all.
682
+ *
683
+ * ── Why it is awaited ───────────────────────────────────────────────────
684
+ * The answer is final before this begins and this cannot change it — but
685
+ * `run()` does return after the write rather than before, and that is a
686
+ * choice rather than an oversight. A fire-and-forget write is a recording
687
+ * lost whenever the process exits with the reply, which is precisely the
688
+ * serverless deployment that wants recordings most. The cost is one store
689
+ * write per turn, stated on the option.
690
+ *
691
+ * ── Why it can never fail the run ───────────────────────────────────────
692
+ * A full store, an unserializable snapshot, a bucket that 500s — none of
693
+ * them are facts about the ANSWER, which is already correct and already
694
+ * paid for. Turning "your recording was not filed" into "your request
695
+ * failed" would be the library deciding that its observability matters more
696
+ * than the user's turn. So every failure degrades to today's path: the
697
+ * answer is returned unchanged and the reason lands on the record as
698
+ * `agentfootprint.artifacts.refused`, where a sink can count it.
699
+ *
700
+ * The recording is FROZEN before the mint, so it can never contain the
701
+ * `artifacts.minted` event describing itself.
702
+ */
703
+ async fileRunRecording(recorder, outcome) {
704
+ const store = this.artifactStore;
705
+ if (recorder === undefined || store === undefined || this.artifactRecordings === undefined) {
706
+ return;
707
+ }
708
+ if ((0, pause_js_1.isPaused)(outcome))
709
+ return;
710
+ const runId = this.currentRunContext?.runId;
711
+ let input;
712
+ try {
713
+ input = (0, recordingArtifact_js_1.recordingPutInput)(recorder.toRecording(), {
714
+ ...(runId !== undefined && { runId }),
715
+ ...(this.artifactRecordings.label !== undefined && {
716
+ label: this.artifactRecordings.label,
717
+ }),
718
+ });
719
+ }
720
+ catch (err) {
721
+ this.reportRecordingRefused(err, 'invalid-input');
722
+ return;
723
+ }
724
+ try {
725
+ const result = await store.put(this.runArtifactScope(), input);
726
+ // Sweeps ride the put result, so retention that evicted an older
727
+ // recording to make room says so on the record — the same law a tool's
728
+ // own mint follows.
729
+ for (const swept of result.swept) {
730
+ this.emit('agentfootprint.artifacts.expired', {
731
+ ref: swept.ref,
732
+ reason: swept.reason,
733
+ kind: swept.kind,
734
+ bytes: swept.bytes,
735
+ });
736
+ }
737
+ this.emit('agentfootprint.artifacts.minted', {
738
+ ref: result.meta.ref,
739
+ kind: result.meta.kind,
740
+ mediaType: result.meta.mediaType,
741
+ bytes: result.meta.bytes,
742
+ ...(result.meta.label !== undefined && { label: result.meta.label }),
743
+ ...(result.meta.expiresAt !== undefined && { expiresAt: result.meta.expiresAt }),
744
+ ...(result.meta.origin !== undefined && { origin: result.meta.origin }),
745
+ });
746
+ }
747
+ catch (err) {
748
+ this.reportRecordingRefused(err, 'invalid-input');
749
+ }
750
+ }
751
+ /** One refusal fact for a recording that could not be filed. The message is
752
+ * the store's own, which never carries a payload — only what went wrong. */
753
+ reportRecordingRefused(err, reason) {
754
+ this.emit('agentfootprint.artifacts.refused', {
755
+ op: 'put',
756
+ reason,
757
+ detail: err instanceof Error ? err.message : String(err),
758
+ });
759
+ }
760
+ /**
761
+ * The run's artifact scope, read from the finished run's own state.
762
+ *
763
+ * The SAME tuple `ctx.artifacts` bound during the run (`scope.runIdentity`,
764
+ * composed by seed from the caller's identity or derived from the session).
765
+ * Read rather than recomposed: a second derivation here could disagree with
766
+ * the one the run's tools used, and a recording filed in a different scope
767
+ * from the artifacts it describes is a recording nobody can find.
768
+ */
769
+ runArtifactScope() {
770
+ const identity = this.getLastSnapshot()?.sharedState
771
+ ?.runIdentity;
772
+ if (identity === undefined) {
773
+ // No state to read means no run happened, which this path cannot reach —
774
+ // but a scope is required and inventing a tenant would be worse than a
775
+ // conversation id that names the run itself.
776
+ return { conversationId: this.currentRunContext?.runId ?? 'unknown' };
777
+ }
778
+ return {
779
+ conversationId: identity.conversationId,
780
+ ...(identity.tenant !== undefined && { tenant: identity.tenant }),
781
+ ...(identity.principal !== undefined && { principal: identity.principal }),
782
+ };
783
+ }
632
784
  /**
633
785
  * The footprintjs `RuntimeSnapshot` from the most recent `run()` /
634
786
  * `resume()`. Feeds Lens's Trace tab (ExplainableShell `runtimeSnapshot`
@@ -854,6 +1006,12 @@ class Agent extends RunnerBase_js_1.RunnerBase {
854
1006
  // so a continued turn stays in the namespace it started in.
855
1007
  this.lastRunIdentity =
856
1008
  runInput.identity ?? options?.identity ?? (continued ? continued.identity : undefined);
1009
+ // Recordings-as-artifacts (9.26.0). BEFORE `createExecutor`, because
1010
+ // `attach()` collects recorders for the executor that has not been built
1011
+ // yet — a recording started one line later would be missing its
1012
+ // boundaries, which is the failure mode `recordRun` exists to prevent.
1013
+ // Returns `undefined` (and touches nothing) unless the dial is on.
1014
+ const recording = this.startRunRecording();
857
1015
  // (helper used in the catch block below — module-private function
858
1016
  // declared at file end via hoisting)
859
1017
  const executor = this.createExecutor(options);
@@ -895,6 +1053,10 @@ class Agent extends RunnerBase_js_1.RunnerBase {
895
1053
  this.lastRunAnswer = finalized;
896
1054
  this.recordPendingQuestion(finalized);
897
1055
  await this.endRunToolSessions(finalized);
1056
+ // The answer is FINISHED before this line and cannot be changed by it.
1057
+ // See `fileRunRecording` for why the write is awaited rather than left
1058
+ // in flight, and why it can never fail the run.
1059
+ await this.fileRunRecording(recording, finalized);
898
1060
  return finalized;
899
1061
  }
900
1062
  catch (cause) {
@@ -955,6 +1117,9 @@ class Agent extends RunnerBase_js_1.RunnerBase {
955
1117
  throw cause;
956
1118
  }
957
1119
  finally {
1120
+ // Always released: a recording left subscribed would keep listening
1121
+ // through the next run and grow a tail nobody reads.
1122
+ recording?.stop();
958
1123
  stopTracking();
959
1124
  this.inFlightRunId = undefined;
960
1125
  // `seed` consumes the restored conversation on its way past. A run that
@@ -1203,6 +1368,11 @@ class Agent extends RunnerBase_js_1.RunnerBase {
1203
1368
  // `checkpoint.sharedState` (and nested subflow states) automatically
1204
1369
  // on a fresh executor's `resume()`. No need to retain a paused
1205
1370
  // executor between run/resume.
1371
+ // Recorded on the same terms a fresh run is (9.26.0) — and the recording
1372
+ // covers the RESUMED run, which is what the recorder saw. A turn that
1373
+ // paused and resumed is two runs, and each mints its own recording when
1374
+ // (and only when) it completes.
1375
+ const recording = this.startRunRecording();
1206
1376
  const executor = this.createExecutor(options);
1207
1377
  this.inFlightRunId = this.currentRunContext.runId;
1208
1378
  this.lastRunAnswer = undefined;
@@ -1217,6 +1387,7 @@ class Agent extends RunnerBase_js_1.RunnerBase {
1217
1387
  // AGAIN has asked a new one, and that one is outstanding from here.
1218
1388
  this.recordPendingQuestion(finalized);
1219
1389
  await this.endRunToolSessions(finalized);
1390
+ await this.fileRunRecording(recording, finalized);
1220
1391
  return finalized;
1221
1392
  }
1222
1393
  catch (cause) {
@@ -1224,6 +1395,7 @@ class Agent extends RunnerBase_js_1.RunnerBase {
1224
1395
  throw cause;
1225
1396
  }
1226
1397
  finally {
1398
+ recording?.stop();
1227
1399
  this.inFlightRunId = undefined;
1228
1400
  }
1229
1401
  }
@@ -2516,6 +2688,10 @@ class Agent extends RunnerBase_js_1.RunnerBase {
2516
2688
  ...(this.maxToolResultChars !== undefined && {
2517
2689
  maxToolResultChars: this.maxToolResultChars,
2518
2690
  }),
2691
+ // The repeated-call nudge (9.26.0). Threaded ONLY when switched off —
2692
+ // the VALUE-conditional pattern, so an agent on the default hands the
2693
+ // handler exactly the deps object it always did.
2694
+ ...(this.repeatedCallNudge === false && { repeatedCallNudge: false }),
2519
2695
  // Skill-graph read_skill gate: bound the model's read_skill jumps to the
2520
2696
  // reachable set from the current cursor. Undefined → gate off (back-compat).
2521
2697
  ...(this.skillGraphReachable && {