@halonicjs/testing 0.0.0-stage → 0.1.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 (384) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +1 -0
  3. package/README.md +40 -2
  4. package/dist/adapters/http-kit/src/address-class.d.ts +34 -0
  5. package/dist/adapters/http-kit/src/address-class.js +109 -0
  6. package/dist/adapters/http-kit/src/index.d.ts +2 -0
  7. package/dist/adapters/http-kit/src/index.js +2 -0
  8. package/dist/adapters/http-kit/src/ip-address.d.ts +23 -0
  9. package/dist/adapters/http-kit/src/ip-address.js +89 -0
  10. package/dist/adapters/integration-kit/src/declaration.d.ts +14 -0
  11. package/dist/adapters/integration-kit/src/declaration.js +77 -0
  12. package/dist/adapters/integration-kit/src/host.d.ts +28 -0
  13. package/dist/adapters/integration-kit/src/host.js +30 -0
  14. package/dist/adapters/integration-kit/src/index.d.ts +14 -0
  15. package/dist/adapters/integration-kit/src/index.js +21 -0
  16. package/dist/adapters/integration-kit/src/leak-attempt.d.ts +14 -0
  17. package/dist/adapters/integration-kit/src/leak-attempt.js +16 -0
  18. package/dist/adapters/integration-kit/src/limited-http.d.ts +49 -0
  19. package/dist/adapters/integration-kit/src/limited-http.js +182 -0
  20. package/dist/adapters/integration-kit/src/load-problem.d.ts +20 -0
  21. package/dist/adapters/integration-kit/src/load-problem.js +1 -0
  22. package/dist/adapters/integration-kit/src/loader.d.ts +104 -0
  23. package/dist/adapters/integration-kit/src/loader.js +219 -0
  24. package/dist/adapters/integration-kit/src/local-address.d.ts +15 -0
  25. package/dist/adapters/integration-kit/src/local-address.js +25 -0
  26. package/dist/adapters/integration-kit/src/own-request.d.ts +33 -0
  27. package/dist/adapters/integration-kit/src/own-request.js +36 -0
  28. package/dist/adapters/integration-kit/src/plugin-load.d.ts +14 -0
  29. package/dist/adapters/integration-kit/src/plugin-load.js +58 -0
  30. package/dist/adapters/integration-kit/src/policy.d.ts +55 -0
  31. package/dist/adapters/integration-kit/src/policy.js +37 -0
  32. package/dist/adapters/integration-kit/src/request-body.d.ts +38 -0
  33. package/dist/adapters/integration-kit/src/request-body.js +68 -0
  34. package/dist/adapters/integration-kit/src/request-log.d.ts +25 -0
  35. package/dist/adapters/integration-kit/src/request-log.js +17 -0
  36. package/dist/adapters/integration-kit/src/response-body.d.ts +23 -0
  37. package/dist/adapters/integration-kit/src/response-body.js +117 -0
  38. package/dist/adapters/integration-kit/src/scoped-tokens.d.ts +14 -0
  39. package/dist/adapters/integration-kit/src/scoped-tokens.js +27 -0
  40. package/dist/adapters/integration-kit/src/secret-filter.d.ts +84 -0
  41. package/dist/adapters/integration-kit/src/secret-filter.js +205 -0
  42. package/dist/adapters/integration-kit/src/secret-in-request.d.ts +59 -0
  43. package/dist/adapters/integration-kit/src/secret-in-request.js +133 -0
  44. package/dist/adapters/integration-kit/src/secret-placement.d.ts +36 -0
  45. package/dist/adapters/integration-kit/src/secret-placement.js +190 -0
  46. package/dist/adapters/integration-kit/src/wait.d.ts +16 -0
  47. package/dist/adapters/integration-kit/src/wait.js +35 -0
  48. package/dist/core/events/src/add-usage.d.ts +10 -0
  49. package/dist/core/events/src/add-usage.js +27 -0
  50. package/dist/core/events/src/agent-resume.d.ts +24 -0
  51. package/dist/core/events/src/agent-resume.js +1 -0
  52. package/dist/core/events/src/home-path.d.ts +13 -0
  53. package/dist/core/events/src/home-path.js +26 -0
  54. package/dist/core/events/src/index.d.ts +13 -0
  55. package/dist/core/events/src/index.js +7 -0
  56. package/dist/core/events/src/run-basics.d.ts +205 -0
  57. package/dist/core/events/src/run-basics.js +1 -0
  58. package/dist/core/events/src/run-event.d.ts +434 -0
  59. package/dist/core/events/src/run-event.js +1 -0
  60. package/dist/core/events/src/run-summary.d.ts +108 -0
  61. package/dist/core/events/src/run-summary.js +1 -0
  62. package/dist/core/events/src/sandbox-blocked.d.ts +42 -0
  63. package/dist/core/events/src/sandbox-blocked.js +26 -0
  64. package/dist/core/events/src/sandbox-opened-read.d.ts +17 -0
  65. package/dist/core/events/src/sandbox-opened-read.js +63 -0
  66. package/dist/core/events/src/sandbox-opened.d.ts +94 -0
  67. package/dist/core/events/src/sandbox-opened.js +52 -0
  68. package/dist/core/events/src/summarize.d.ts +14 -0
  69. package/dist/core/events/src/summarize.js +188 -0
  70. package/dist/core/events/src/timeline-entry.d.ts +21 -0
  71. package/dist/core/events/src/timeline-entry.js +105 -0
  72. package/dist/core/events/src/upgrade.d.ts +23 -0
  73. package/dist/core/events/src/upgrade.js +49 -0
  74. package/dist/core/format/src/compact.d.ts +30 -0
  75. package/dist/core/format/src/compact.js +72 -0
  76. package/dist/core/format/src/index.d.ts +37 -0
  77. package/dist/core/format/src/index.js +23 -0
  78. package/dist/core/format/src/integration/index.d.ts +6 -0
  79. package/dist/core/format/src/integration/index.js +9 -0
  80. package/dist/core/format/src/json-schema.d.ts +26 -0
  81. package/dist/core/format/src/json-schema.js +48 -0
  82. package/dist/core/format/src/kind.d.ts +65 -0
  83. package/dist/core/format/src/kind.js +1 -0
  84. package/dist/core/format/src/kinds/agent/kind.d.ts +4 -0
  85. package/dist/core/format/src/kinds/agent/kind.js +10 -0
  86. package/dist/core/format/src/kinds/agent/sandbox-fields.d.ts +89 -0
  87. package/dist/core/format/src/kinds/agent/sandbox-fields.js +197 -0
  88. package/dist/core/format/src/kinds/agent/schema.d.ts +147 -0
  89. package/dist/core/format/src/kinds/agent/schema.js +107 -0
  90. package/dist/core/format/src/kinds/agent/working-folder-start.d.ts +74 -0
  91. package/dist/core/format/src/kinds/agent/working-folder-start.js +312 -0
  92. package/dist/core/format/src/kinds/collection/kind.d.ts +8 -0
  93. package/dist/core/format/src/kinds/collection/kind.js +14 -0
  94. package/dist/core/format/src/kinds/collection/schema.d.ts +89 -0
  95. package/dist/core/format/src/kinds/collection/schema.js +90 -0
  96. package/dist/core/format/src/kinds/connector/is-local.d.ts +10 -0
  97. package/dist/core/format/src/kinds/connector/is-local.js +43 -0
  98. package/dist/core/format/src/kinds/connector/kind.d.ts +4 -0
  99. package/dist/core/format/src/kinds/connector/kind.js +119 -0
  100. package/dist/core/format/src/kinds/connector/schema.d.ts +50 -0
  101. package/dist/core/format/src/kinds/connector/schema.js +92 -0
  102. package/dist/core/format/src/kinds/deployments/kind.d.ts +4 -0
  103. package/dist/core/format/src/kinds/deployments/kind.js +25 -0
  104. package/dist/core/format/src/kinds/deployments/schema.d.ts +37 -0
  105. package/dist/core/format/src/kinds/deployments/schema.js +42 -0
  106. package/dist/core/format/src/kinds/hub/kind.d.ts +4 -0
  107. package/dist/core/format/src/kinds/hub/kind.js +10 -0
  108. package/dist/core/format/src/kinds/hub/schema.d.ts +54 -0
  109. package/dist/core/format/src/kinds/hub/schema.js +34 -0
  110. package/dist/core/format/src/kinds/integration/kind.d.ts +16 -0
  111. package/dist/core/format/src/kinds/integration/kind.js +138 -0
  112. package/dist/core/format/src/kinds/integration/parse-sheet.d.ts +19 -0
  113. package/dist/core/format/src/kinds/integration/parse-sheet.js +24 -0
  114. package/dist/core/format/src/kinds/integration/policy.d.ts +67 -0
  115. package/dist/core/format/src/kinds/integration/policy.js +268 -0
  116. package/dist/core/format/src/kinds/integration/schema.d.ts +233 -0
  117. package/dist/core/format/src/kinds/integration/schema.js +233 -0
  118. package/dist/core/format/src/kinds/knowledge/kind.d.ts +4 -0
  119. package/dist/core/format/src/kinds/knowledge/kind.js +13 -0
  120. package/dist/core/format/src/kinds/knowledge/schema.d.ts +18 -0
  121. package/dist/core/format/src/kinds/knowledge/schema.js +25 -0
  122. package/dist/core/format/src/kinds/models/kind.d.ts +4 -0
  123. package/dist/core/format/src/kinds/models/kind.js +10 -0
  124. package/dist/core/format/src/kinds/models/schema.d.ts +92 -0
  125. package/dist/core/format/src/kinds/models/schema.js +38 -0
  126. package/dist/core/format/src/kinds/plugin/backend.d.ts +22 -0
  127. package/dist/core/format/src/kinds/plugin/backend.js +31 -0
  128. package/dist/core/format/src/kinds/plugin/checks.d.ts +13 -0
  129. package/dist/core/format/src/kinds/plugin/checks.js +131 -0
  130. package/dist/core/format/src/kinds/plugin/kind.d.ts +8 -0
  131. package/dist/core/format/src/kinds/plugin/kind.js +16 -0
  132. package/dist/core/format/src/kinds/plugin/problems.d.ts +24 -0
  133. package/dist/core/format/src/kinds/plugin/problems.js +65 -0
  134. package/dist/core/format/src/kinds/plugin/schema.d.ts +542 -0
  135. package/dist/core/format/src/kinds/plugin/schema.js +261 -0
  136. package/dist/core/format/src/kinds/plugin/setting-values.d.ts +17 -0
  137. package/dist/core/format/src/kinds/plugin/setting-values.js +38 -0
  138. package/dist/core/format/src/kinds/plugin/ui-checks.d.ts +8 -0
  139. package/dist/core/format/src/kinds/plugin/ui-checks.js +94 -0
  140. package/dist/core/format/src/kinds/provider/kind.d.ts +4 -0
  141. package/dist/core/format/src/kinds/provider/kind.js +24 -0
  142. package/dist/core/format/src/kinds/provider/schema.d.ts +17 -0
  143. package/dist/core/format/src/kinds/provider/schema.js +22 -0
  144. package/dist/core/format/src/kinds/routine/kind.d.ts +8 -0
  145. package/dist/core/format/src/kinds/routine/kind.js +25 -0
  146. package/dist/core/format/src/kinds/routine/schema.d.ts +84 -0
  147. package/dist/core/format/src/kinds/routine/schema.js +93 -0
  148. package/dist/core/format/src/kinds/runtime/kind.d.ts +4 -0
  149. package/dist/core/format/src/kinds/runtime/kind.js +13 -0
  150. package/dist/core/format/src/kinds/runtime/schema.d.ts +10 -0
  151. package/dist/core/format/src/kinds/runtime/schema.js +12 -0
  152. package/dist/core/format/src/kinds/skill/kind.d.ts +4 -0
  153. package/dist/core/format/src/kinds/skill/kind.js +10 -0
  154. package/dist/core/format/src/kinds/skill/schema.d.ts +17 -0
  155. package/dist/core/format/src/kinds/skill/schema.js +17 -0
  156. package/dist/core/format/src/kinds/skill/scripts-folder.d.ts +27 -0
  157. package/dist/core/format/src/kinds/skill/scripts-folder.js +37 -0
  158. package/dist/core/format/src/kinds/workflow/kind.d.ts +8 -0
  159. package/dist/core/format/src/kinds/workflow/kind.js +14 -0
  160. package/dist/core/format/src/kinds/workflow/schema.d.ts +162 -0
  161. package/dist/core/format/src/kinds/workflow/schema.js +106 -0
  162. package/dist/core/format/src/kinds/workflow-test/kind.d.ts +4 -0
  163. package/dist/core/format/src/kinds/workflow-test/kind.js +14 -0
  164. package/dist/core/format/src/kinds/workflow-test/schema.d.ts +67 -0
  165. package/dist/core/format/src/kinds/workflow-test/schema.js +59 -0
  166. package/dist/core/format/src/kinds/workspace/kind.d.ts +4 -0
  167. package/dist/core/format/src/kinds/workspace/kind.js +10 -0
  168. package/dist/core/format/src/kinds/workspace/schema.d.ts +72 -0
  169. package/dist/core/format/src/kinds/workspace/schema.js +66 -0
  170. package/dist/core/format/src/parse-file.d.ts +69 -0
  171. package/dist/core/format/src/parse-file.js +105 -0
  172. package/dist/core/format/src/recording/format.d.ts +81 -0
  173. package/dist/core/format/src/recording/format.js +102 -0
  174. package/dist/core/format/src/recording/index.d.ts +1 -0
  175. package/dist/core/format/src/recording/index.js +3 -0
  176. package/dist/core/format/src/registry.d.ts +64 -0
  177. package/dist/core/format/src/registry.js +61 -0
  178. package/dist/core/format/src/reserved.d.ts +20 -0
  179. package/dist/core/format/src/reserved.js +30 -0
  180. package/dist/core/format/src/shared/fields.d.ts +37 -0
  181. package/dist/core/format/src/shared/fields.js +54 -0
  182. package/dist/core/format/src/shared/guard.d.ts +32 -0
  183. package/dist/core/format/src/shared/guard.js +16 -0
  184. package/dist/core/format/src/shared/key-in-value.d.ts +28 -0
  185. package/dist/core/format/src/shared/key-in-value.js +82 -0
  186. package/dist/core/format/src/shared/legacy-keys.d.ts +8 -0
  187. package/dist/core/format/src/shared/legacy-keys.js +17 -0
  188. package/dist/core/format/src/shared/program-start.d.ts +60 -0
  189. package/dist/core/format/src/shared/program-start.js +99 -0
  190. package/dist/core/format/src/shared/relative-path.d.ts +29 -0
  191. package/dist/core/format/src/shared/relative-path.js +50 -0
  192. package/dist/core/format/src/shared/secret-name.d.ts +24 -0
  193. package/dist/core/format/src/shared/secret-name.js +107 -0
  194. package/dist/core/format/src/source.d.ts +16 -0
  195. package/dist/core/format/src/source.js +73 -0
  196. package/dist/core/ports/src/agent-placement-store.d.ts +74 -0
  197. package/dist/core/ports/src/agent-placement-store.js +27 -0
  198. package/dist/core/ports/src/blob-store.d.ts +33 -0
  199. package/dist/core/ports/src/blob-store.js +2 -0
  200. package/dist/core/ports/src/cant-try-error.d.ts +35 -0
  201. package/dist/core/ports/src/cant-try-error.js +44 -0
  202. package/dist/core/ports/src/chat.d.ts +127 -0
  203. package/dist/core/ports/src/chat.js +1 -0
  204. package/dist/core/ports/src/clock.d.ts +7 -0
  205. package/dist/core/ports/src/clock.js +2 -0
  206. package/dist/core/ports/src/connection-settings-store.d.ts +57 -0
  207. package/dist/core/ports/src/connection-settings-store.js +2 -0
  208. package/dist/core/ports/src/connector-client.d.ts +259 -0
  209. package/dist/core/ports/src/connector-client.js +2 -0
  210. package/dist/core/ports/src/coordination.d.ts +84 -0
  211. package/dist/core/ports/src/coordination.js +2 -0
  212. package/dist/core/ports/src/definition-store.d.ts +208 -0
  213. package/dist/core/ports/src/definition-store.js +122 -0
  214. package/dist/core/ports/src/digest.d.ts +14 -0
  215. package/dist/core/ports/src/digest.js +2 -0
  216. package/dist/core/ports/src/folder-reader.d.ts +89 -0
  217. package/dist/core/ports/src/folder-reader.js +2 -0
  218. package/dist/core/ports/src/harness-bridge-server.d.ts +189 -0
  219. package/dist/core/ports/src/harness-bridge-server.js +37 -0
  220. package/dist/core/ports/src/harness.d.ts +250 -0
  221. package/dist/core/ports/src/harness.js +45 -0
  222. package/dist/core/ports/src/http-client.d.ts +27 -0
  223. package/dist/core/ports/src/http-client.js +2 -0
  224. package/dist/core/ports/src/id-generator.d.ts +14 -0
  225. package/dist/core/ports/src/id-generator.js +2 -0
  226. package/dist/core/ports/src/index.d.ts +37 -0
  227. package/dist/core/ports/src/index.js +36 -0
  228. package/dist/core/ports/src/integration.d.ts +178 -0
  229. package/dist/core/ports/src/integration.js +13 -0
  230. package/dist/core/ports/src/knowledge-provider.d.ts +65 -0
  231. package/dist/core/ports/src/knowledge-provider.js +2 -0
  232. package/dist/core/ports/src/llm-cache.d.ts +13 -0
  233. package/dist/core/ports/src/llm-cache.js +2 -0
  234. package/dist/core/ports/src/llm-provider.d.ts +184 -0
  235. package/dist/core/ports/src/llm-provider.js +136 -0
  236. package/dist/core/ports/src/model-price.d.ts +34 -0
  237. package/dist/core/ports/src/model-price.js +25 -0
  238. package/dist/core/ports/src/password-hasher.d.ts +47 -0
  239. package/dist/core/ports/src/password-hasher.js +2 -0
  240. package/dist/core/ports/src/plugin-folder-writer.d.ts +104 -0
  241. package/dist/core/ports/src/plugin-folder-writer.js +95 -0
  242. package/dist/core/ports/src/port-versions.d.ts +44 -0
  243. package/dist/core/ports/src/port-versions.js +74 -0
  244. package/dist/core/ports/src/program-probe.d.ts +46 -0
  245. package/dist/core/ports/src/program-probe.js +2 -0
  246. package/dist/core/ports/src/record-store.d.ts +62 -0
  247. package/dist/core/ports/src/record-store.js +38 -0
  248. package/dist/core/ports/src/resource-probe.d.ts +59 -0
  249. package/dist/core/ports/src/resource-probe.js +2 -0
  250. package/dist/core/ports/src/run-executor.d.ts +302 -0
  251. package/dist/core/ports/src/run-executor.js +2 -0
  252. package/dist/core/ports/src/run-failure-error.d.ts +49 -0
  253. package/dist/core/ports/src/run-failure-error.js +47 -0
  254. package/dist/core/ports/src/run-store.d.ts +194 -0
  255. package/dist/core/ports/src/run-store.js +131 -0
  256. package/dist/core/ports/src/sandbox.d.ts +247 -0
  257. package/dist/core/ports/src/sandbox.js +34 -0
  258. package/dist/core/ports/src/scheduler.d.ts +85 -0
  259. package/dist/core/ports/src/scheduler.js +2 -0
  260. package/dist/core/ports/src/secrets.d.ts +128 -0
  261. package/dist/core/ports/src/secrets.js +144 -0
  262. package/dist/core/ports/src/token-store.d.ts +19 -0
  263. package/dist/core/ports/src/token-store.js +2 -0
  264. package/dist/core/ports/src/tool-approval-store.d.ts +211 -0
  265. package/dist/core/ports/src/tool-approval-store.js +57 -0
  266. package/dist/core/ports/src/trust-store.d.ts +72 -0
  267. package/dist/core/ports/src/trust-store.js +2 -0
  268. package/dist/core/ports/src/unfenced-run-consent-store.d.ts +43 -0
  269. package/dist/core/ports/src/unfenced-run-consent-store.js +2 -0
  270. package/dist/core/ports/src/vcs.d.ts +394 -0
  271. package/dist/core/ports/src/vcs.js +48 -0
  272. package/dist/core/schema-kit/src/builders.d.ts +50 -0
  273. package/dist/core/schema-kit/src/builders.js +72 -0
  274. package/dist/core/schema-kit/src/depth.d.ts +15 -0
  275. package/dist/core/schema-kit/src/depth.js +37 -0
  276. package/dist/core/schema-kit/src/index.d.ts +6 -0
  277. package/dist/core/schema-kit/src/index.js +6 -0
  278. package/dist/core/schema-kit/src/issue.d.ts +22 -0
  279. package/dist/core/schema-kit/src/issue.js +23 -0
  280. package/dist/core/schema-kit/src/json-schema.d.ts +23 -0
  281. package/dist/core/schema-kit/src/json-schema.js +22 -0
  282. package/dist/core/schema-kit/src/parse.d.ts +17 -0
  283. package/dist/core/schema-kit/src/parse.js +25 -0
  284. package/dist/core/schema-kit/src/schema.d.ts +12 -0
  285. package/dist/core/schema-kit/src/schema.js +1 -0
  286. package/dist/core/std/src/ascii-host.d.ts +18 -0
  287. package/dist/core/std/src/ascii-host.js +110 -0
  288. package/dist/core/std/src/assert.d.ts +39 -0
  289. package/dist/core/std/src/assert.js +59 -0
  290. package/dist/core/std/src/base64url.d.ts +23 -0
  291. package/dist/core/std/src/base64url.js +65 -0
  292. package/dist/core/std/src/canonical-json.d.ts +18 -0
  293. package/dist/core/std/src/canonical-json.js +56 -0
  294. package/dist/core/std/src/clock.d.ts +27 -0
  295. package/dist/core/std/src/clock.js +33 -0
  296. package/dist/core/std/src/constant-time.d.ts +16 -0
  297. package/dist/core/std/src/constant-time.js +26 -0
  298. package/dist/core/std/src/content-digest.d.ts +24 -0
  299. package/dist/core/std/src/content-digest.js +28 -0
  300. package/dist/core/std/src/deep-clone.d.ts +15 -0
  301. package/dist/core/std/src/deep-clone.js +59 -0
  302. package/dist/core/std/src/deep-equal.d.ts +23 -0
  303. package/dist/core/std/src/deep-equal.js +64 -0
  304. package/dist/core/std/src/emitter.d.ts +42 -0
  305. package/dist/core/std/src/emitter.js +74 -0
  306. package/dist/core/std/src/error-kind.d.ts +88 -0
  307. package/dist/core/std/src/error-kind.js +98 -0
  308. package/dist/core/std/src/hex.d.ts +10 -0
  309. package/dist/core/std/src/hex.js +16 -0
  310. package/dist/core/std/src/ids.d.ts +45 -0
  311. package/dist/core/std/src/ids.js +49 -0
  312. package/dist/core/std/src/index.d.ts +25 -0
  313. package/dist/core/std/src/index.js +26 -0
  314. package/dist/core/std/src/keyed-queue.d.ts +18 -0
  315. package/dist/core/std/src/keyed-queue.js +32 -0
  316. package/dist/core/std/src/line-diff.d.ts +83 -0
  317. package/dist/core/std/src/line-diff.js +179 -0
  318. package/dist/core/std/src/line-merge.d.ts +63 -0
  319. package/dist/core/std/src/line-merge.js +138 -0
  320. package/dist/core/std/src/plain-data.d.ts +32 -0
  321. package/dist/core/std/src/plain-data.js +57 -0
  322. package/dist/core/std/src/posix-path.d.ts +61 -0
  323. package/dist/core/std/src/posix-path.js +121 -0
  324. package/dist/core/std/src/result.d.ts +55 -0
  325. package/dist/core/std/src/result.js +52 -0
  326. package/dist/core/std/src/secret-scrubber.d.ts +54 -0
  327. package/dist/core/std/src/secret-scrubber.js +124 -0
  328. package/dist/core/std/src/secret-shape.d.ts +20 -0
  329. package/dist/core/std/src/secret-shape.js +53 -0
  330. package/dist/core/std/src/stop-signal.d.ts +44 -0
  331. package/dist/core/std/src/stop-signal.js +77 -0
  332. package/dist/core/std/src/text.d.ts +28 -0
  333. package/dist/core/std/src/text.js +54 -0
  334. package/dist/core/std/src/utf8.d.ts +23 -0
  335. package/dist/core/std/src/utf8.js +110 -0
  336. package/dist/core/std/src/version.d.ts +48 -0
  337. package/dist/core/std/src/version.js +103 -0
  338. package/dist/core/yaml/src/depth.d.ts +14 -0
  339. package/dist/core/yaml/src/depth.js +140 -0
  340. package/dist/core/yaml/src/edit-data.d.ts +47 -0
  341. package/dist/core/yaml/src/edit-data.js +286 -0
  342. package/dist/core/yaml/src/edit-text.d.ts +92 -0
  343. package/dist/core/yaml/src/edit-text.js +267 -0
  344. package/dist/core/yaml/src/edit.d.ts +47 -0
  345. package/dist/core/yaml/src/edit.js +198 -0
  346. package/dist/core/yaml/src/index.d.ts +5 -0
  347. package/dist/core/yaml/src/index.js +4 -0
  348. package/dist/core/yaml/src/problem.d.ts +20 -0
  349. package/dist/core/yaml/src/problem.js +1 -0
  350. package/dist/core/yaml/src/read.d.ts +47 -0
  351. package/dist/core/yaml/src/read.js +130 -0
  352. package/dist/core/yaml/src/splice-node.d.ts +47 -0
  353. package/dist/core/yaml/src/splice-node.js +333 -0
  354. package/dist/core/yaml/src/splice.d.ts +13 -0
  355. package/dist/core/yaml/src/splice.js +174 -0
  356. package/dist/core/yaml/src/unsupported.d.ts +26 -0
  357. package/dist/core/yaml/src/unsupported.js +70 -0
  358. package/dist/core/yaml/src/write.d.ts +35 -0
  359. package/dist/core/yaml/src/write.js +44 -0
  360. package/dist/testing/integration/src/canaries.d.ts +14 -0
  361. package/dist/testing/integration/src/canaries.js +17 -0
  362. package/dist/testing/integration/src/checks.d.ts +37 -0
  363. package/dist/testing/integration/src/checks.js +195 -0
  364. package/dist/testing/integration/src/describe.d.ts +35 -0
  365. package/dist/testing/integration/src/describe.js +74 -0
  366. package/dist/testing/integration/src/failure.d.ts +6 -0
  367. package/dist/testing/integration/src/failure.js +8 -0
  368. package/dist/testing/integration/src/fake-wait.d.ts +18 -0
  369. package/dist/testing/integration/src/fake-wait.js +21 -0
  370. package/dist/testing/integration/src/index.d.ts +10 -0
  371. package/dist/testing/integration/src/index.js +11 -0
  372. package/dist/testing/integration/src/load.d.ts +14 -0
  373. package/dist/testing/integration/src/load.js +45 -0
  374. package/dist/testing/integration/src/plugin-folder.d.ts +23 -0
  375. package/dist/testing/integration/src/plugin-folder.js +59 -0
  376. package/dist/testing/integration/src/plugin.d.ts +32 -0
  377. package/dist/testing/integration/src/plugin.js +57 -0
  378. package/dist/testing/integration/src/recording.d.ts +84 -0
  379. package/dist/testing/integration/src/recording.js +164 -0
  380. package/dist/testing/integration/src/run.d.ts +60 -0
  381. package/dist/testing/integration/src/run.js +81 -0
  382. package/dist/testing/integration/src/source-scan.d.ts +16 -0
  383. package/dist/testing/integration/src/source-scan.js +40 -0
  384. package/package.json +35 -4
@@ -0,0 +1,190 @@
1
+ import { IntegrationRefusedError } from "@halonicjs/adapters/integration-kit";
2
+ import { isLoopback } from "./local-address.js";
3
+ import { hostIn, } from "./policy.js";
4
+ /**
5
+ * Copies the placements the integration's code gave into frozen objects of
6
+ * text fields, reading each field once. The kit checks and places only
7
+ * these copies: the code keeps its own objects and could change them, or
8
+ * give a getter, after the check and before the secret is placed. A field
9
+ * that isn't text is refused here, because an object could turn into other
10
+ * text each time it is read.
11
+ */
12
+ export function copyPlacements(policy, placements) {
13
+ return Object.freeze(placements.map((placement) => copyPlacement(policy, placement)));
14
+ }
15
+ function copyPlacement(policy, placement) {
16
+ if (typeof placement !== "object" || placement === null) {
17
+ throw notText(policy, "a secret placement");
18
+ }
19
+ const given = placement;
20
+ const secret = given.secret;
21
+ const as = given.as;
22
+ if (typeof secret !== "string")
23
+ throw notText(policy, "the secret's name");
24
+ if (typeof as !== "string")
25
+ throw notText(policy, `the "as" of the secret ${quoted(secret)}`);
26
+ const copy = { secret, as };
27
+ for (const key of ["header", "prefix", "field"]) {
28
+ const value = given[key];
29
+ if (value === undefined)
30
+ continue;
31
+ if (typeof value !== "string")
32
+ throw notText(policy, `the "${key}" of the secret ${quoted(secret)}`);
33
+ copy[key] = value;
34
+ }
35
+ // Whether the fields fit together is for `checkPlacements` to say.
36
+ return Object.freeze(copy);
37
+ }
38
+ function notText(policy, what) {
39
+ return new IntegrationRefusedError("placement-not-in-sheet", `${policy.name}: ${what} in a secret placement is not text`);
40
+ }
41
+ /**
42
+ * Checks every placement against the sheet before a secret value is read.
43
+ * Give it the copies from {@link copyPlacements}, never the code's own
44
+ * objects. Where the secret may go is for {@link checkPlacementHosts}.
45
+ */
46
+ export function checkPlacements(policy, placements) {
47
+ for (const placement of placements) {
48
+ const declared = declaredSecret(policy, placement.secret);
49
+ if (declared === undefined) {
50
+ throw new IntegrationRefusedError("secret-not-declared", `${policy.name}: the secret ${quoted(placement.secret)} is not in its permission sheet`);
51
+ }
52
+ if (!matchesSheet(placement, declared.placement)) {
53
+ throw new IntegrationRefusedError("placement-not-in-sheet", `${policy.name}: the secret ${quoted(placement.secret)} goes ${describe(declared.placement)} in its permission sheet, not ${describe(placement)}`);
54
+ }
55
+ }
56
+ }
57
+ /**
58
+ * Checks that every placed secret may go to the request's first host, once
59
+ * the URL is parsed. {@link checkPlacements} has already run, so every
60
+ * secret is declared.
61
+ */
62
+ export function checkPlacementHosts(policy, placements, url) {
63
+ for (const placement of placements) {
64
+ const declared = declaredSecret(policy, placement.secret);
65
+ if (declared === undefined || !hostIn(declared.hosts, url)) {
66
+ throw new IntegrationRefusedError("secret-not-allowed-for-host", `${policy.name}: the secret ${quoted(placement.secret)} may not go to ${url.host}`);
67
+ }
68
+ if (!mayCarrySecret(url)) {
69
+ throw new IntegrationRefusedError("secret-over-plain-http", `${policy.name}: the secret ${quoted(placement.secret)} may not go over plain http to another machine (${url.host})`);
70
+ }
71
+ }
72
+ }
73
+ /** The sheet's entry for a secret, looked up by own key only, so `toString` is never a secret. */
74
+ function declaredSecret(policy, secret) {
75
+ return Object.hasOwn(policy.secrets, secret) ? policy.secrets[secret] : undefined;
76
+ }
77
+ /**
78
+ * Whether the code places the secret the way the sheet says. Otherwise it
79
+ * could put a key in a field the service stores, such as a note title,
80
+ * where the integration could read it back. Header names match ignoring
81
+ * ASCII case, as HTTP does; a missing prefix and `""` send the same bytes;
82
+ * form field names are case-sensitive. The placement comes from the
83
+ * integration's code, so nothing in it is trusted to have the right type.
84
+ */
85
+ function matchesSheet(placement, sheet) {
86
+ switch (sheet.as) {
87
+ case "bearer":
88
+ return placement.as === "bearer";
89
+ case "header":
90
+ return (placement.as === "header" &&
91
+ typeof placement.header === "string" &&
92
+ asciiLowerCase(placement.header) === asciiLowerCase(sheet.header) &&
93
+ (placement.prefix ?? "") === (sheet.prefix ?? ""));
94
+ case "form":
95
+ return placement.as === "form" && placement.field === sheet.field;
96
+ }
97
+ }
98
+ /**
99
+ * Lower-cases `A` to `Z` only. `toLowerCase` would also turn the Kelvin
100
+ * sign into `k`, so a header no service reads would pass as `x-api-key`.
101
+ */
102
+ function asciiLowerCase(text) {
103
+ return text.replace(/[A-Z]/g, (letter) => letter.toLowerCase());
104
+ }
105
+ /** A placement in words, for a refusal message. It never holds a value. */
106
+ function describe(placement) {
107
+ switch (placement.as) {
108
+ case "bearer":
109
+ return "as a bearer token";
110
+ case "header": {
111
+ const prefix = placement.prefix ?? "";
112
+ return prefix === ""
113
+ ? `in the header ${quoted(placement.header)}`
114
+ : `in the header ${quoted(placement.header)} after ${quoted(prefix)}`;
115
+ }
116
+ case "form":
117
+ return `in the form field ${quoted(placement.field)}`;
118
+ default:
119
+ return `as ${quoted(placement.as)}`;
120
+ }
121
+ }
122
+ /**
123
+ * Text from the integration's code, cut short and quoted, so it can't break
124
+ * the message. It is cut by characters before quoting, so the cut never
125
+ * falls inside an escape or a surrogate pair.
126
+ */
127
+ function quoted(text) {
128
+ const characters = Array.from(String(text));
129
+ const shown = characters.length <= 50 ? characters.join("") : `${characters.slice(0, 50).join("")}…`;
130
+ return JSON.stringify(shown);
131
+ }
132
+ /** A secret goes over `https`, or over plain `http` only to this machine. */
133
+ function mayCarrySecret(url) {
134
+ return url.protocol === "https:" || isLoopback(url.hostname);
135
+ }
136
+ /**
137
+ * Reads each secret's value once. The values never leave the kit. An
138
+ * optional secret without a value gets no entry, so `place` leaves it out.
139
+ */
140
+ export async function readSecrets(policy, secrets, placements) {
141
+ const values = new Map();
142
+ for (const { secret } of placements) {
143
+ if (values.has(secret))
144
+ continue;
145
+ const value = await secrets.get(secret);
146
+ if (value === null || value === "") {
147
+ // `checkPlacements` ran first, so the secret is declared.
148
+ if (policy.secrets[secret]?.optional === true)
149
+ continue;
150
+ throw new IntegrationRefusedError("secret-not-configured", `${policy.name}: the secret ${quoted(secret)} is not configured`);
151
+ }
152
+ values.set(secret, value);
153
+ }
154
+ return values;
155
+ }
156
+ /**
157
+ * Puts the secrets allowed for this hop's host into the headers and the form
158
+ * body. A placement whose secret may not go to this hop is left out, which
159
+ * happens after a redirect to another declared host.
160
+ *
161
+ * @returns the form body to send, when a placement wrote into it
162
+ */
163
+ export function place(policy, placements, values, url, headers, form) {
164
+ let body = form;
165
+ for (const placement of placements) {
166
+ const declared = policy.secrets[placement.secret];
167
+ const value = values.get(placement.secret);
168
+ if (declared === undefined ||
169
+ value === undefined ||
170
+ !hostIn(declared.hosts, url) ||
171
+ !mayCarrySecret(url))
172
+ continue;
173
+ switch (placement.as) {
174
+ case "bearer":
175
+ headers.set("authorization", `Bearer ${value}`);
176
+ break;
177
+ case "header":
178
+ headers.set(placement.header, `${placement.prefix ?? ""}${value}`);
179
+ break;
180
+ case "form":
181
+ if (body === undefined) {
182
+ throw new IntegrationRefusedError("secret-needs-form-body", `${policy.name}: the secret ${quoted(placement.secret)} goes in a form field, so the body must be a form`);
183
+ }
184
+ body = new URLSearchParams(body);
185
+ body.set(placement.field, value);
186
+ break;
187
+ }
188
+ }
189
+ return body;
190
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The milliseconds the host really waits for `ms`: `NaN` and negative values
3
+ * wait 0, anything above {@link maxIntegrationWaitMs} (`Infinity` too) waits
4
+ * the maximum.
5
+ */
6
+ export declare function clampWaitMs(ms: number): number;
7
+ /**
8
+ * `IntegrationHost.wait`: waits the clamped `ms`, and rejects with
9
+ * `signal.reason` as soon as `signal` aborts, or straight away when it
10
+ * already has. The timer and the abort listener are always cleared, so a
11
+ * wait never outlives its call.
12
+ *
13
+ * @example
14
+ * await integrationWait(retryMs, signal);
15
+ */
16
+ export declare function integrationWait(ms: number, signal?: AbortSignal): Promise<void>;
@@ -0,0 +1,35 @@
1
+ import { maxIntegrationWaitMs } from "../../../core/ports/src/index.js";
2
+ /**
3
+ * The milliseconds the host really waits for `ms`: `NaN` and negative values
4
+ * wait 0, anything above {@link maxIntegrationWaitMs} (`Infinity` too) waits
5
+ * the maximum.
6
+ */
7
+ export function clampWaitMs(ms) {
8
+ if (Number.isNaN(ms) || ms <= 0)
9
+ return 0;
10
+ return Math.min(ms, maxIntegrationWaitMs);
11
+ }
12
+ /**
13
+ * `IntegrationHost.wait`: waits the clamped `ms`, and rejects with
14
+ * `signal.reason` as soon as `signal` aborts, or straight away when it
15
+ * already has. The timer and the abort listener are always cleared, so a
16
+ * wait never outlives its call.
17
+ *
18
+ * @example
19
+ * await integrationWait(retryMs, signal);
20
+ */
21
+ export function integrationWait(ms, signal) {
22
+ if (signal?.aborted)
23
+ return Promise.reject(signal.reason);
24
+ return new Promise((resolve, reject) => {
25
+ const onAbort = () => {
26
+ clearTimeout(timer);
27
+ reject(signal?.reason);
28
+ };
29
+ const timer = setTimeout(() => {
30
+ signal?.removeEventListener("abort", onAbort);
31
+ resolve();
32
+ }, clampWaitMs(ms));
33
+ signal?.addEventListener("abort", onAbort, { once: true });
34
+ });
35
+ }
@@ -0,0 +1,10 @@
1
+ import type { Usage } from "./run-basics.js";
2
+ /**
3
+ * The tokens of two model calls together. A cache count is in the sum only
4
+ * when one of them has it, so calls without a prompt cache keep their old shape.
5
+ *
6
+ * @example
7
+ * addUsage({ inputTokens: 10, outputTokens: 5 }, { inputTokens: 2, outputTokens: 1, cacheReadTokens: 900 });
8
+ * // { inputTokens: 12, outputTokens: 6, cacheReadTokens: 900 }
9
+ */
10
+ export declare function addUsage(total: Usage, more: Usage): Usage;
@@ -0,0 +1,27 @@
1
+ /** The optional token counts of a call that used a prompt cache. */
2
+ const cacheCounts = ["cacheReadTokens", "cacheWriteTokens", "cacheWrite1hTokens"];
3
+ /**
4
+ * The tokens of two model calls together. A cache count is in the sum only
5
+ * when one of them has it, so calls without a prompt cache keep their old shape.
6
+ *
7
+ * @example
8
+ * addUsage({ inputTokens: 10, outputTokens: 5 }, { inputTokens: 2, outputTokens: 1, cacheReadTokens: 900 });
9
+ * // { inputTokens: 12, outputTokens: 6, cacheReadTokens: 900 }
10
+ */
11
+ export function addUsage(total, more) {
12
+ const sum = {
13
+ inputTokens: total.inputTokens + more.inputTokens,
14
+ outputTokens: total.outputTokens + more.outputTokens,
15
+ };
16
+ for (const count of cacheCounts) {
17
+ const added = addOptional(total[count], more[count]);
18
+ if (added !== undefined)
19
+ sum[count] = added;
20
+ }
21
+ return sum;
22
+ }
23
+ function addOptional(left, right) {
24
+ if (left === undefined && right === undefined)
25
+ return undefined;
26
+ return (left ?? 0) + (right ?? 0);
27
+ }
@@ -0,0 +1,24 @@
1
+ /** A model tool call as stored in the log. */
2
+ export interface LoggedToolCall {
3
+ id: string;
4
+ name: string;
5
+ arguments: Record<string, unknown>;
6
+ }
7
+ /** Where an agent stopped to wait for an approval, so it can continue after a restart. */
8
+ export interface AgentResume {
9
+ /** The conversation so far (chat messages, including the assistant's tool calls). */
10
+ messages: unknown[];
11
+ /** Tool calls of the current model reply still to handle, the one waiting for approval first. */
12
+ calls: LoggedToolCall[];
13
+ /** Model step the agent was on. */
14
+ step: number;
15
+ /**
16
+ * Set when `calls[0]` is a `delegate_*` call whose subagent stopped: the
17
+ * subagent, and where its own turn goes on from, nested at most 3 deep
18
+ * (requirement `events.agent-resume-inner`). Absent in older logs.
19
+ */
20
+ inner?: {
21
+ agent: string;
22
+ resume: AgentResume;
23
+ };
24
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * `path` with the person's home folder written as `~`, or `path` as it is
3
+ * when it is outside the home folder or the home folder is unknown. A folder
4
+ * next to the home folder whose name starts the same stays as it is.
5
+ *
6
+ * @param path - an absolute path
7
+ * @param home - the person's home folder, or `null` when it is unknown
8
+ * @returns the path to log
9
+ *
10
+ * @example
11
+ * shortenHome("<home>/work", "<home>"); // => "~/work"
12
+ */
13
+ export declare function shortenHome(path: string, home: string | null): string;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * `path` with the person's home folder written as `~`, or `path` as it is
3
+ * when it is outside the home folder or the home folder is unknown. A folder
4
+ * next to the home folder whose name starts the same stays as it is.
5
+ *
6
+ * @param path - an absolute path
7
+ * @param home - the person's home folder, or `null` when it is unknown
8
+ * @returns the path to log
9
+ *
10
+ * @example
11
+ * shortenHome("<home>/work", "<home>"); // => "~/work"
12
+ */
13
+ export function shortenHome(path, home) {
14
+ if (home === null)
15
+ return path;
16
+ const root = home.replace(/[/\\]+$/, "");
17
+ if (root === "")
18
+ return path;
19
+ if (path === root)
20
+ return "~";
21
+ const separator = path.charAt(root.length);
22
+ if (path.startsWith(root) && (separator === "/" || separator === "\\")) {
23
+ return `~${path.slice(root.length)}`;
24
+ }
25
+ return path;
26
+ }
@@ -0,0 +1,13 @@
1
+ export { addUsage } from "./add-usage.js";
2
+ export type { AgentResume, LoggedToolCall } from "./agent-resume.js";
3
+ export type { ApprovalResolver, CantTryReason, CantTryStep, LeftOutReason, ModelSkipReason, ProviderText, RunCatchUp, RunFailureReason, RunKind, RunParent, RunStatus, RunTrigger, RunVersion, StoredBlob, ToolNoun, ToolOutcome, ToolRefusalReason, ToolRisk, Usage, } from "./run-basics.js";
4
+ export type { RunEvent, RunEventBase, RunEventBody, RunEventType } from "./run-event.js";
5
+ export type { PendingApproval, RunSummary, SentSignal } from "./run-summary.js";
6
+ export type { LoggedSandboxBlock, SandboxBlock } from "./sandbox-blocked.js";
7
+ export { maxBlockedTargetsPerStep, sandboxBlockedView } from "./sandbox-blocked.js";
8
+ export type { DeniedPathGroup, DeniedPathGroupCode, SandboxOpenedOptions, SandboxOpenedView, SandboxStrength, ShownSandboxProfile, } from "./sandbox-opened.js";
9
+ export { deniedPathGroupCodes, sandboxOpenedView } from "./sandbox-opened.js";
10
+ export { readSandboxOpened } from "./sandbox-opened-read.js";
11
+ export { summarize } from "./summarize.js";
12
+ export { entryOf } from "./timeline-entry.js";
13
+ export { parseEventLine, upgradeEvent } from "./upgrade.js";
@@ -0,0 +1,7 @@
1
+ export { addUsage } from "./add-usage.js";
2
+ export { maxBlockedTargetsPerStep, sandboxBlockedView } from "./sandbox-blocked.js";
3
+ export { deniedPathGroupCodes, sandboxOpenedView } from "./sandbox-opened.js";
4
+ export { readSandboxOpened } from "./sandbox-opened-read.js";
5
+ export { summarize } from "./summarize.js";
6
+ export { entryOf } from "./timeline-entry.js";
7
+ export { parseEventLine, upgradeEvent } from "./upgrade.js";
@@ -0,0 +1,205 @@
1
+ /** Whether a run is a real run or part of a workflow test. */
2
+ export type RunKind = "run" | "test";
3
+ /**
4
+ * Where a run is: still going, waiting for an event or a timer, or ended.
5
+ * `cant-try` is a Try it or Test run that ended at a step it couldn't try,
6
+ * because the step needs a change left out of it (see {@link CantTryStep}).
7
+ * It never counts as `completed`, and a real failure in the same run makes
8
+ * it `failed` instead.
9
+ */
10
+ export type RunStatus = "running" | "waiting" | "completed" | "failed" | "cant-try";
11
+ /**
12
+ * Why one change to review is left out of Try it and Test. A file has
13
+ * exactly one reason: `before-trust` wins over the others.
14
+ *
15
+ * - `before-trust`: written before the workspace was trusted; the whole file stays at its baseline.
16
+ * - `permissions`: the tool list, `tools.approve`, the step limit or the budget.
17
+ * - `trust-and-sandbox`: the network allowlist or folders.
18
+ * - `connections`: which ones, a connector or MCP definition, or a secret mapping.
19
+ * - `models`: `models.yaml`, a provider address, headers, a key mapping or new aliases.
20
+ */
21
+ export type LeftOutReason = "before-trust" | "permissions" | "trust-and-sandbox" | "connections" | "models";
22
+ /**
23
+ * Why a step can't be tried:
24
+ *
25
+ * - `needs-left-out-change`: it uses a change left out of the run, such as a
26
+ * new alias or connection; `path` is the file of that change.
27
+ * - `invalid-without-change`: the item doesn't load with the baseline value of
28
+ * the file at `path`; `message` says why, for "Details" only.
29
+ */
30
+ export type CantTryReason = {
31
+ kind: "needs-left-out-change";
32
+ path: string;
33
+ leftOut: LeftOutReason;
34
+ } | {
35
+ kind: "invalid-without-change";
36
+ path: string;
37
+ message: string;
38
+ };
39
+ /**
40
+ * A step a Try it or Test run didn't run, because leaving a change out
41
+ * breaks it, instead of quietly using the change (requirement
42
+ * `events.run-cant-try`). It ends its branch the way a failed step does.
43
+ */
44
+ export interface CantTryStep {
45
+ status: "cant-try";
46
+ /** The path of the item being tried. */
47
+ item: string;
48
+ /** The step's id, or `null` when the whole item can't be tried. */
49
+ step: string | null;
50
+ reason: CantTryReason;
51
+ }
52
+ /**
53
+ * Tokens one model call used, or the sum over a run. Providers with a prompt
54
+ * cache charge the tokens read from it and written to it at their own rates,
55
+ * so those are counted apart and are not in `inputTokens`.
56
+ */
57
+ export interface Usage {
58
+ /** Input tokens the cache didn't serve or store. */
59
+ inputTokens: number;
60
+ outputTokens: number;
61
+ /** Input tokens read from the provider's prompt cache. Absent when there were none. */
62
+ cacheReadTokens?: number;
63
+ /**
64
+ * Input tokens written to the provider's prompt cache for its short
65
+ * lifetime (Anthropic: 5 minutes). Absent when there were none.
66
+ */
67
+ cacheWriteTokens?: number;
68
+ /**
69
+ * Input tokens written to the provider's prompt cache for 1 hour, which
70
+ * costs more than a short write. Absent when there were none.
71
+ */
72
+ cacheWrite1hTokens?: number;
73
+ }
74
+ /** What started a run. Absent for runs started by hand from a workflow. */
75
+ export interface RunTrigger {
76
+ type: "manual" | "schedule" | "every" | "mail" | "signal";
77
+ /** Routine key: "<hubId>/<routineId>" or "@workspace/<routineId>". */
78
+ routineId?: string;
79
+ /** ISO time the run was due (the scheduled time, not when it actually started). */
80
+ at: string;
81
+ /** Mail triggers: the Gmail message that started this run (one run per message). */
82
+ messageId?: string;
83
+ /** Signal triggers: "<runId>:<seq>" of the signal that started this run (one run per signal). */
84
+ signalId?: string;
85
+ /**
86
+ * Routine runs that started later than the tick's grace after `at`, such
87
+ * as after the computer slept or Halonic was closed. Absent for a run that
88
+ * started on time.
89
+ */
90
+ catchUp?: RunCatchUp;
91
+ }
92
+ /** How a routine run caught up: what its routine's catch-up rule dropped on the same tick. */
93
+ export interface RunCatchUp {
94
+ /**
95
+ * Earlier due times of the routine that the catch-up rule dropped on this
96
+ * tick: the "run once" rule, the 100 cap and the 7-day window. Only the
97
+ * first catch-up run of a tick counts them; later ones have 0. Times
98
+ * skipped because the last run was still going don't count.
99
+ */
100
+ skipped: number;
101
+ /** Set when counting stopped at its limit, so there were at least `skipped`. */
102
+ countIsMinimum?: true;
103
+ }
104
+ /**
105
+ * Which version of the workspace a run read, as its `run.started` records it
106
+ * (save model 2.2–2.3, HAL-3246):
107
+ * - `live-version`: the live version, at `commit`. `versionDate` is that
108
+ * version's date, when it was made (the commit's ISO date), not when the
109
+ * run started, so a run view can say "the version of <date>";
110
+ * - `saved-files`: the files as saved, for Try it and Test, and for every
111
+ * run while history is off.
112
+ */
113
+ export type RunVersion = {
114
+ reads: "live-version";
115
+ commit: string;
116
+ versionDate: string;
117
+ } | {
118
+ reads: "saved-files";
119
+ };
120
+ /** The run and state that started a child run, and how deep it is (1 = child of a top-level run). */
121
+ export interface RunParent {
122
+ runId: string;
123
+ state: string;
124
+ depth: number;
125
+ }
126
+ /**
127
+ * How a tool call ended: it answered (`ok`), it failed (`error`), or it broke
128
+ * off without an answer, so it may or may not have done its work (`unknown`).
129
+ */
130
+ export type ToolOutcome = "ok" | "error" | "unknown";
131
+ /**
132
+ * Why a model's tool call was refused before it ran (requirement
133
+ * `events.tool-refused`): `not-offered`, the step offered no tool of that name.
134
+ */
135
+ export type ToolRefusalReason = "not-offered";
136
+ /**
137
+ * Where a payload too large for the run log is kept: the hash of its bytes
138
+ * in the run's blob store, their size and their media type. The same shape
139
+ * as `BlobRef` in `@halonicjs/ports`, which this package may not import.
140
+ */
141
+ export interface StoredBlob {
142
+ /** Lowercase hex SHA-256 of the bytes. */
143
+ hash: string;
144
+ /** In bytes. */
145
+ size: number;
146
+ mediaType: string;
147
+ }
148
+ /**
149
+ * What a tool can do, as its integration's sheet says: `read` changes
150
+ * nothing, `write` changes data, `send` reaches people outside. The same
151
+ * values as `ToolRisk` in `@halonicjs/ports`.
152
+ */
153
+ export type ToolRisk = "read" | "write" | "send";
154
+ /**
155
+ * What one call of a sending tool sends, in the singular and the plural, as
156
+ * its integration's sheet names it, such as `{ one: "email", many: "emails" }`.
157
+ * Both are stored so a reader never has to make a plural itself.
158
+ */
159
+ export interface ToolNoun {
160
+ one: string;
161
+ many: string;
162
+ }
163
+ /**
164
+ * Why a run failed. Each reason has its own requirement in `requirements/`.
165
+ *
166
+ * - `budget`: a run or monthly budget stopped it.
167
+ * - `cancelled`: someone cancelled it.
168
+ * - `model-missing`: the model it asked for doesn't exist at its provider.
169
+ * - `model-no-tools`: that model can't call tools and the step offered some.
170
+ * - `error`: something else went wrong; the `error` text says what.
171
+ * - `model-unreachable`: the model's host didn't answer; `run.failed` names it in `host`.
172
+ * - `model-out-of-memory`: the machine running the model ran out of memory for it.
173
+ * - `disk-full`: there was no disk space left to write what the run needed.
174
+ * - `interrupted`: the engine stopped while the run was going, and found it on its next start.
175
+ * - `sandbox-not-ready`: the sandbox check failed, so the step that needs the sandbox didn't
176
+ * start; `run.failed` gives the check's reason code in `sandboxReason`.
177
+ * - `sandbox-start-failed`: the sandbox check had passed, but the sandbox didn't start for this run.
178
+ * - `harness-start-failed`: the harness program failed to start for this run, or didn't send its
179
+ * first event within its time limit (60 s by default).
180
+ * - `key-refused`: the model's provider didn't accept its key, or no key was stored for it.
181
+ * - `out-of-credit`: the account at the model's provider has no credit left or reached its limit.
182
+ * This is never the Halonic budget, which is `budget`.
183
+ * - `provider-busy`: the model's provider was overloaded or asked Halonic to slow down.
184
+ * - `answer-not-an-option`: the agent's output is a `choice`, and its answer wasn't one of the
185
+ * options.
186
+ * - `harness-unavailable`: the step's agent runs in a harness program, and the engine that ran it
187
+ * has no harnesses, as in workflow tests, which never start programs.
188
+ */
189
+ export type RunFailureReason = "budget" | "cancelled" | "model-missing" | "model-no-tools" | "error" | "model-unreachable" | "model-out-of-memory" | "disk-full" | "interrupted" | "sandbox-not-ready" | "sandbox-start-failed" | "harness-start-failed" | "key-refused" | "out-of-credit" | "provider-busy" | "answer-not-an-option" | "harness-unavailable";
190
+ /**
191
+ * The model provider's own error text, kept in the run log for `--debug` and
192
+ * Copy details only (requirement `events.provider-text`). Studio and the
193
+ * command line never show it by default: microcopy 1.4 allows no quoted
194
+ * outside text in a message. The provider shortened it and checked it for
195
+ * keys before the engine logged it.
196
+ */
197
+ export interface ProviderText {
198
+ /** The HTTP status the text came with; left out for a stream error that has none. */
199
+ status?: number;
200
+ text: string;
201
+ }
202
+ /** Why a model was skipped before it was called: its provider's key isn't set. */
203
+ export type ModelSkipReason = "no-key";
204
+ /** Who resolved an approval: a person, or a rule that answers without asking anyone. */
205
+ export type ApprovalResolver = "person" | "rule";
@@ -0,0 +1 @@
1
+ export {};