@halonicjs/testing 0.0.0 → 0.1.1

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 (438) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +5 -0
  3. package/README.md +41 -1
  4. package/dist/adapters/http-kit/src/address-checking.d.ts +19 -0
  5. package/dist/adapters/http-kit/src/address-checking.js +1 -0
  6. package/dist/adapters/http-kit/src/address-class.d.ts +34 -0
  7. package/dist/adapters/http-kit/src/address-class.js +109 -0
  8. package/dist/adapters/http-kit/src/index.d.ts +3 -0
  9. package/dist/adapters/http-kit/src/index.js +2 -0
  10. package/dist/adapters/http-kit/src/ip-address.d.ts +23 -0
  11. package/dist/adapters/http-kit/src/ip-address.js +89 -0
  12. package/dist/adapters/integration-kit/src/auth-placement.d.ts +40 -0
  13. package/dist/adapters/integration-kit/src/auth-placement.js +102 -0
  14. package/dist/adapters/integration-kit/src/current-secret-forms.d.ts +28 -0
  15. package/dist/adapters/integration-kit/src/current-secret-forms.js +60 -0
  16. package/dist/adapters/integration-kit/src/declaration.d.ts +15 -0
  17. package/dist/adapters/integration-kit/src/declaration.js +78 -0
  18. package/dist/adapters/integration-kit/src/host.d.ts +34 -0
  19. package/dist/adapters/integration-kit/src/host.js +31 -0
  20. package/dist/adapters/integration-kit/src/index.d.ts +16 -0
  21. package/dist/adapters/integration-kit/src/index.js +22 -0
  22. package/dist/adapters/integration-kit/src/leak-attempt.d.ts +16 -0
  23. package/dist/adapters/integration-kit/src/leak-attempt.js +19 -0
  24. package/dist/adapters/integration-kit/src/limited-http.d.ts +55 -0
  25. package/dist/adapters/integration-kit/src/limited-http.js +225 -0
  26. package/dist/adapters/integration-kit/src/load-problem.d.ts +20 -0
  27. package/dist/adapters/integration-kit/src/load-problem.js +1 -0
  28. package/dist/adapters/integration-kit/src/loader.d.ts +131 -0
  29. package/dist/adapters/integration-kit/src/loader.js +251 -0
  30. package/dist/adapters/integration-kit/src/local-address.d.ts +15 -0
  31. package/dist/adapters/integration-kit/src/local-address.js +25 -0
  32. package/dist/adapters/integration-kit/src/own-request.d.ts +33 -0
  33. package/dist/adapters/integration-kit/src/own-request.js +36 -0
  34. package/dist/adapters/integration-kit/src/plugin-load.d.ts +14 -0
  35. package/dist/adapters/integration-kit/src/plugin-load.js +58 -0
  36. package/dist/adapters/integration-kit/src/policy.d.ts +83 -0
  37. package/dist/adapters/integration-kit/src/policy.js +37 -0
  38. package/dist/adapters/integration-kit/src/request-body.d.ts +38 -0
  39. package/dist/adapters/integration-kit/src/request-body.js +68 -0
  40. package/dist/adapters/integration-kit/src/request-log.d.ts +25 -0
  41. package/dist/adapters/integration-kit/src/request-log.js +17 -0
  42. package/dist/adapters/integration-kit/src/response-body.d.ts +27 -0
  43. package/dist/adapters/integration-kit/src/response-body.js +117 -0
  44. package/dist/adapters/integration-kit/src/scoped-tokens.d.ts +14 -0
  45. package/dist/adapters/integration-kit/src/scoped-tokens.js +27 -0
  46. package/dist/adapters/integration-kit/src/secret-filter.d.ts +84 -0
  47. package/dist/adapters/integration-kit/src/secret-filter.js +220 -0
  48. package/dist/adapters/integration-kit/src/secret-in-request.d.ts +62 -0
  49. package/dist/adapters/integration-kit/src/secret-in-request.js +139 -0
  50. package/dist/adapters/integration-kit/src/secret-placement.d.ts +46 -0
  51. package/dist/adapters/integration-kit/src/secret-placement.js +160 -0
  52. package/dist/adapters/integration-kit/src/sign-in-placement.d.ts +29 -0
  53. package/dist/adapters/integration-kit/src/sign-in-placement.js +92 -0
  54. package/dist/adapters/integration-kit/src/wait.d.ts +16 -0
  55. package/dist/adapters/integration-kit/src/wait.js +35 -0
  56. package/dist/core/events/src/add-usage.d.ts +10 -0
  57. package/dist/core/events/src/add-usage.js +27 -0
  58. package/dist/core/events/src/agent-resume.d.ts +24 -0
  59. package/dist/core/events/src/agent-resume.js +1 -0
  60. package/dist/core/events/src/blocked-sites.d.ts +57 -0
  61. package/dist/core/events/src/blocked-sites.js +89 -0
  62. package/dist/core/events/src/home-path.d.ts +13 -0
  63. package/dist/core/events/src/home-path.js +26 -0
  64. package/dist/core/events/src/index.d.ts +17 -0
  65. package/dist/core/events/src/index.js +10 -0
  66. package/dist/core/events/src/run-basics.d.ts +228 -0
  67. package/dist/core/events/src/run-basics.js +1 -0
  68. package/dist/core/events/src/run-event.d.ts +478 -0
  69. package/dist/core/events/src/run-event.js +1 -0
  70. package/dist/core/events/src/run-reads.d.ts +25 -0
  71. package/dist/core/events/src/run-reads.js +44 -0
  72. package/dist/core/events/src/run-sends.d.ts +47 -0
  73. package/dist/core/events/src/run-sends.js +68 -0
  74. package/dist/core/events/src/run-summary.d.ts +108 -0
  75. package/dist/core/events/src/run-summary.js +1 -0
  76. package/dist/core/events/src/sandbox-blocked.d.ts +42 -0
  77. package/dist/core/events/src/sandbox-blocked.js +26 -0
  78. package/dist/core/events/src/sandbox-opened-read.d.ts +17 -0
  79. package/dist/core/events/src/sandbox-opened-read.js +63 -0
  80. package/dist/core/events/src/sandbox-opened.d.ts +94 -0
  81. package/dist/core/events/src/sandbox-opened.js +52 -0
  82. package/dist/core/events/src/summarize.d.ts +14 -0
  83. package/dist/core/events/src/summarize.js +192 -0
  84. package/dist/core/events/src/timeline-entry.d.ts +21 -0
  85. package/dist/core/events/src/timeline-entry.js +106 -0
  86. package/dist/core/events/src/upgrade.d.ts +23 -0
  87. package/dist/core/events/src/upgrade.js +49 -0
  88. package/dist/core/format/src/compact.d.ts +30 -0
  89. package/dist/core/format/src/compact.js +72 -0
  90. package/dist/core/format/src/index.d.ts +39 -0
  91. package/dist/core/format/src/index.js +25 -0
  92. package/dist/core/format/src/integration/index.d.ts +7 -0
  93. package/dist/core/format/src/integration/index.js +10 -0
  94. package/dist/core/format/src/json-schema.d.ts +26 -0
  95. package/dist/core/format/src/json-schema.js +48 -0
  96. package/dist/core/format/src/kind.d.ts +65 -0
  97. package/dist/core/format/src/kind.js +1 -0
  98. package/dist/core/format/src/kinds/agent/kind.d.ts +4 -0
  99. package/dist/core/format/src/kinds/agent/kind.js +10 -0
  100. package/dist/core/format/src/kinds/agent/sandbox-fields.d.ts +99 -0
  101. package/dist/core/format/src/kinds/agent/sandbox-fields.js +216 -0
  102. package/dist/core/format/src/kinds/agent/schema.d.ts +147 -0
  103. package/dist/core/format/src/kinds/agent/schema.js +107 -0
  104. package/dist/core/format/src/kinds/agent/working-folder-start.d.ts +74 -0
  105. package/dist/core/format/src/kinds/agent/working-folder-start.js +312 -0
  106. package/dist/core/format/src/kinds/collection/kind.d.ts +8 -0
  107. package/dist/core/format/src/kinds/collection/kind.js +14 -0
  108. package/dist/core/format/src/kinds/collection/schema.d.ts +89 -0
  109. package/dist/core/format/src/kinds/collection/schema.js +90 -0
  110. package/dist/core/format/src/kinds/connector/is-local.d.ts +10 -0
  111. package/dist/core/format/src/kinds/connector/is-local.js +43 -0
  112. package/dist/core/format/src/kinds/connector/kind.d.ts +4 -0
  113. package/dist/core/format/src/kinds/connector/kind.js +218 -0
  114. package/dist/core/format/src/kinds/connector/schema.d.ts +74 -0
  115. package/dist/core/format/src/kinds/connector/schema.js +143 -0
  116. package/dist/core/format/src/kinds/deployments/kind.d.ts +4 -0
  117. package/dist/core/format/src/kinds/deployments/kind.js +49 -0
  118. package/dist/core/format/src/kinds/deployments/schema.d.ts +77 -0
  119. package/dist/core/format/src/kinds/deployments/schema.js +94 -0
  120. package/dist/core/format/src/kinds/hub/kind.d.ts +4 -0
  121. package/dist/core/format/src/kinds/hub/kind.js +10 -0
  122. package/dist/core/format/src/kinds/hub/schema.d.ts +54 -0
  123. package/dist/core/format/src/kinds/hub/schema.js +34 -0
  124. package/dist/core/format/src/kinds/integration/approved-sign-ins.d.ts +62 -0
  125. package/dist/core/format/src/kinds/integration/approved-sign-ins.js +125 -0
  126. package/dist/core/format/src/kinds/integration/host-key.d.ts +7 -0
  127. package/dist/core/format/src/kinds/integration/host-key.js +8 -0
  128. package/dist/core/format/src/kinds/integration/kind.d.ts +18 -0
  129. package/dist/core/format/src/kinds/integration/kind.js +175 -0
  130. package/dist/core/format/src/kinds/integration/parse-sheet.d.ts +19 -0
  131. package/dist/core/format/src/kinds/integration/parse-sheet.js +24 -0
  132. package/dist/core/format/src/kinds/integration/policy.d.ts +112 -0
  133. package/dist/core/format/src/kinds/integration/policy.js +327 -0
  134. package/dist/core/format/src/kinds/integration/schema.d.ts +410 -0
  135. package/dist/core/format/src/kinds/integration/schema.js +359 -0
  136. package/dist/core/format/src/kinds/integration/sign-in-checks.d.ts +13 -0
  137. package/dist/core/format/src/kinds/integration/sign-in-checks.js +120 -0
  138. package/dist/core/format/src/kinds/integration/sign-in-urls.d.ts +19 -0
  139. package/dist/core/format/src/kinds/integration/sign-in-urls.js +47 -0
  140. package/dist/core/format/src/kinds/knowledge/kind.d.ts +4 -0
  141. package/dist/core/format/src/kinds/knowledge/kind.js +13 -0
  142. package/dist/core/format/src/kinds/knowledge/schema.d.ts +18 -0
  143. package/dist/core/format/src/kinds/knowledge/schema.js +25 -0
  144. package/dist/core/format/src/kinds/models/kind.d.ts +4 -0
  145. package/dist/core/format/src/kinds/models/kind.js +10 -0
  146. package/dist/core/format/src/kinds/models/schema.d.ts +92 -0
  147. package/dist/core/format/src/kinds/models/schema.js +38 -0
  148. package/dist/core/format/src/kinds/plugin/backend.d.ts +22 -0
  149. package/dist/core/format/src/kinds/plugin/backend.js +31 -0
  150. package/dist/core/format/src/kinds/plugin/checks.d.ts +13 -0
  151. package/dist/core/format/src/kinds/plugin/checks.js +137 -0
  152. package/dist/core/format/src/kinds/plugin/kind.d.ts +8 -0
  153. package/dist/core/format/src/kinds/plugin/kind.js +16 -0
  154. package/dist/core/format/src/kinds/plugin/problems.d.ts +24 -0
  155. package/dist/core/format/src/kinds/plugin/problems.js +65 -0
  156. package/dist/core/format/src/kinds/plugin/schema.d.ts +672 -0
  157. package/dist/core/format/src/kinds/plugin/schema.js +261 -0
  158. package/dist/core/format/src/kinds/plugin/setting-values.d.ts +17 -0
  159. package/dist/core/format/src/kinds/plugin/setting-values.js +38 -0
  160. package/dist/core/format/src/kinds/plugin/ui-checks.d.ts +8 -0
  161. package/dist/core/format/src/kinds/plugin/ui-checks.js +85 -0
  162. package/dist/core/format/src/kinds/provider/kind.d.ts +4 -0
  163. package/dist/core/format/src/kinds/provider/kind.js +24 -0
  164. package/dist/core/format/src/kinds/provider/schema.d.ts +17 -0
  165. package/dist/core/format/src/kinds/provider/schema.js +22 -0
  166. package/dist/core/format/src/kinds/routine/kind.d.ts +8 -0
  167. package/dist/core/format/src/kinds/routine/kind.js +62 -0
  168. package/dist/core/format/src/kinds/routine/schema.d.ts +94 -0
  169. package/dist/core/format/src/kinds/routine/schema.js +115 -0
  170. package/dist/core/format/src/kinds/routine/webhook-headers.d.ts +9 -0
  171. package/dist/core/format/src/kinds/routine/webhook-headers.js +26 -0
  172. package/dist/core/format/src/kinds/runtime/kind.d.ts +4 -0
  173. package/dist/core/format/src/kinds/runtime/kind.js +13 -0
  174. package/dist/core/format/src/kinds/runtime/schema.d.ts +10 -0
  175. package/dist/core/format/src/kinds/runtime/schema.js +12 -0
  176. package/dist/core/format/src/kinds/skill/kind.d.ts +4 -0
  177. package/dist/core/format/src/kinds/skill/kind.js +10 -0
  178. package/dist/core/format/src/kinds/skill/schema.d.ts +17 -0
  179. package/dist/core/format/src/kinds/skill/schema.js +17 -0
  180. package/dist/core/format/src/kinds/skill/scripts-folder.d.ts +27 -0
  181. package/dist/core/format/src/kinds/skill/scripts-folder.js +37 -0
  182. package/dist/core/format/src/kinds/workflow/kind.d.ts +8 -0
  183. package/dist/core/format/src/kinds/workflow/kind.js +14 -0
  184. package/dist/core/format/src/kinds/workflow/schema.d.ts +162 -0
  185. package/dist/core/format/src/kinds/workflow/schema.js +106 -0
  186. package/dist/core/format/src/kinds/workflow-test/kind.d.ts +4 -0
  187. package/dist/core/format/src/kinds/workflow-test/kind.js +14 -0
  188. package/dist/core/format/src/kinds/workflow-test/schema.d.ts +67 -0
  189. package/dist/core/format/src/kinds/workflow-test/schema.js +59 -0
  190. package/dist/core/format/src/kinds/workspace/kind.d.ts +4 -0
  191. package/dist/core/format/src/kinds/workspace/kind.js +10 -0
  192. package/dist/core/format/src/kinds/workspace/schema.d.ts +72 -0
  193. package/dist/core/format/src/kinds/workspace/schema.js +66 -0
  194. package/dist/core/format/src/parse-file.d.ts +69 -0
  195. package/dist/core/format/src/parse-file.js +105 -0
  196. package/dist/core/format/src/recording/format.d.ts +81 -0
  197. package/dist/core/format/src/recording/format.js +102 -0
  198. package/dist/core/format/src/recording/index.d.ts +1 -0
  199. package/dist/core/format/src/recording/index.js +3 -0
  200. package/dist/core/format/src/registry.d.ts +64 -0
  201. package/dist/core/format/src/registry.js +61 -0
  202. package/dist/core/format/src/reserved.d.ts +20 -0
  203. package/dist/core/format/src/reserved.js +30 -0
  204. package/dist/core/format/src/shared/fields.d.ts +34 -0
  205. package/dist/core/format/src/shared/fields.js +74 -0
  206. package/dist/core/format/src/shared/guard.d.ts +32 -0
  207. package/dist/core/format/src/shared/guard.js +16 -0
  208. package/dist/core/format/src/shared/key-in-value.d.ts +28 -0
  209. package/dist/core/format/src/shared/key-in-value.js +82 -0
  210. package/dist/core/format/src/shared/legacy-keys.d.ts +8 -0
  211. package/dist/core/format/src/shared/legacy-keys.js +17 -0
  212. package/dist/core/format/src/shared/program-start.d.ts +60 -0
  213. package/dist/core/format/src/shared/program-start.js +99 -0
  214. package/dist/core/format/src/shared/relative-path.d.ts +29 -0
  215. package/dist/core/format/src/shared/relative-path.js +50 -0
  216. package/dist/core/format/src/shared/secret-name.d.ts +24 -0
  217. package/dist/core/format/src/shared/secret-name.js +107 -0
  218. package/dist/core/format/src/source.d.ts +16 -0
  219. package/dist/core/format/src/source.js +73 -0
  220. package/dist/core/ports/src/agent-placement-store.d.ts +74 -0
  221. package/dist/core/ports/src/agent-placement-store.js +27 -0
  222. package/dist/core/ports/src/agent-runs-not-available.d.ts +21 -0
  223. package/dist/core/ports/src/agent-runs-not-available.js +25 -0
  224. package/dist/core/ports/src/blob-store.d.ts +45 -0
  225. package/dist/core/ports/src/blob-store.js +24 -0
  226. package/dist/core/ports/src/cant-try-error.d.ts +35 -0
  227. package/dist/core/ports/src/cant-try-error.js +44 -0
  228. package/dist/core/ports/src/chat.d.ts +127 -0
  229. package/dist/core/ports/src/chat.js +1 -0
  230. package/dist/core/ports/src/clock.d.ts +7 -0
  231. package/dist/core/ports/src/clock.js +2 -0
  232. package/dist/core/ports/src/connection-settings-store.d.ts +57 -0
  233. package/dist/core/ports/src/connection-settings-store.js +2 -0
  234. package/dist/core/ports/src/connector-client.d.ts +303 -0
  235. package/dist/core/ports/src/connector-client.js +19 -0
  236. package/dist/core/ports/src/coordination.d.ts +84 -0
  237. package/dist/core/ports/src/coordination.js +2 -0
  238. package/dist/core/ports/src/definition-store.d.ts +229 -0
  239. package/dist/core/ports/src/definition-store.js +122 -0
  240. package/dist/core/ports/src/digest.d.ts +14 -0
  241. package/dist/core/ports/src/digest.js +2 -0
  242. package/dist/core/ports/src/folder-reader.d.ts +89 -0
  243. package/dist/core/ports/src/folder-reader.js +2 -0
  244. package/dist/core/ports/src/harness-bridge-server.d.ts +198 -0
  245. package/dist/core/ports/src/harness-bridge-server.js +37 -0
  246. package/dist/core/ports/src/harness-sign-in-command.d.ts +27 -0
  247. package/dist/core/ports/src/harness-sign-in-command.js +31 -0
  248. package/dist/core/ports/src/harness.d.ts +283 -0
  249. package/dist/core/ports/src/harness.js +45 -0
  250. package/dist/core/ports/src/host-settings-store.d.ts +116 -0
  251. package/dist/core/ports/src/host-settings-store.js +106 -0
  252. package/dist/core/ports/src/http-client.d.ts +27 -0
  253. package/dist/core/ports/src/http-client.js +2 -0
  254. package/dist/core/ports/src/id-generator.d.ts +14 -0
  255. package/dist/core/ports/src/id-generator.js +2 -0
  256. package/dist/core/ports/src/index.d.ts +45 -0
  257. package/dist/core/ports/src/index.js +44 -0
  258. package/dist/core/ports/src/instruction-trust-store.d.ts +81 -0
  259. package/dist/core/ports/src/instruction-trust-store.js +43 -0
  260. package/dist/core/ports/src/integration.d.ts +242 -0
  261. package/dist/core/ports/src/integration.js +31 -0
  262. package/dist/core/ports/src/knowledge-provider.d.ts +65 -0
  263. package/dist/core/ports/src/knowledge-provider.js +2 -0
  264. package/dist/core/ports/src/llm-cache.d.ts +13 -0
  265. package/dist/core/ports/src/llm-cache.js +2 -0
  266. package/dist/core/ports/src/llm-provider.d.ts +186 -0
  267. package/dist/core/ports/src/llm-provider.js +139 -0
  268. package/dist/core/ports/src/model-price.d.ts +34 -0
  269. package/dist/core/ports/src/model-price.js +25 -0
  270. package/dist/core/ports/src/password-hasher.d.ts +63 -0
  271. package/dist/core/ports/src/password-hasher.js +2 -0
  272. package/dist/core/ports/src/plugin-folder-writer.d.ts +104 -0
  273. package/dist/core/ports/src/plugin-folder-writer.js +95 -0
  274. package/dist/core/ports/src/port-versions.d.ts +47 -0
  275. package/dist/core/ports/src/port-versions.js +80 -0
  276. package/dist/core/ports/src/program-probe.d.ts +69 -0
  277. package/dist/core/ports/src/program-probe.js +2 -0
  278. package/dist/core/ports/src/provider-default-base-url.d.ts +10 -0
  279. package/dist/core/ports/src/provider-default-base-url.js +18 -0
  280. package/dist/core/ports/src/record-store.d.ts +79 -0
  281. package/dist/core/ports/src/record-store.js +108 -0
  282. package/dist/core/ports/src/resource-probe.d.ts +59 -0
  283. package/dist/core/ports/src/resource-probe.js +2 -0
  284. package/dist/core/ports/src/run-executor.d.ts +303 -0
  285. package/dist/core/ports/src/run-executor.js +2 -0
  286. package/dist/core/ports/src/run-failure-error.d.ts +49 -0
  287. package/dist/core/ports/src/run-failure-error.js +47 -0
  288. package/dist/core/ports/src/run-store.d.ts +194 -0
  289. package/dist/core/ports/src/run-store.js +131 -0
  290. package/dist/core/ports/src/run-target-not-found.d.ts +34 -0
  291. package/dist/core/ports/src/run-target-not-found.js +41 -0
  292. package/dist/core/ports/src/sandbox-setting-store.d.ts +68 -0
  293. package/dist/core/ports/src/sandbox-setting-store.js +33 -0
  294. package/dist/core/ports/src/sandbox.d.ts +364 -0
  295. package/dist/core/ports/src/sandbox.js +70 -0
  296. package/dist/core/ports/src/scheduler.d.ts +85 -0
  297. package/dist/core/ports/src/scheduler.js +2 -0
  298. package/dist/core/ports/src/secrets.d.ts +201 -0
  299. package/dist/core/ports/src/secrets.js +200 -0
  300. package/dist/core/ports/src/token-store.d.ts +19 -0
  301. package/dist/core/ports/src/token-store.js +2 -0
  302. package/dist/core/ports/src/tool-approval-store.d.ts +253 -0
  303. package/dist/core/ports/src/tool-approval-store.js +116 -0
  304. package/dist/core/ports/src/trust-store.d.ts +72 -0
  305. package/dist/core/ports/src/trust-store.js +2 -0
  306. package/dist/core/ports/src/unfenced-run-consent-store.d.ts +43 -0
  307. package/dist/core/ports/src/unfenced-run-consent-store.js +2 -0
  308. package/dist/core/ports/src/vcs-status.d.ts +8 -0
  309. package/dist/core/ports/src/vcs-status.js +90 -0
  310. package/dist/core/ports/src/vcs.d.ts +394 -0
  311. package/dist/core/ports/src/vcs.js +48 -0
  312. package/dist/core/schema-kit/src/builders.d.ts +50 -0
  313. package/dist/core/schema-kit/src/builders.js +72 -0
  314. package/dist/core/schema-kit/src/depth.d.ts +15 -0
  315. package/dist/core/schema-kit/src/depth.js +37 -0
  316. package/dist/core/schema-kit/src/index.d.ts +6 -0
  317. package/dist/core/schema-kit/src/index.js +6 -0
  318. package/dist/core/schema-kit/src/issue.d.ts +22 -0
  319. package/dist/core/schema-kit/src/issue.js +23 -0
  320. package/dist/core/schema-kit/src/json-schema.d.ts +23 -0
  321. package/dist/core/schema-kit/src/json-schema.js +22 -0
  322. package/dist/core/schema-kit/src/parse.d.ts +17 -0
  323. package/dist/core/schema-kit/src/parse.js +25 -0
  324. package/dist/core/schema-kit/src/schema.d.ts +12 -0
  325. package/dist/core/schema-kit/src/schema.js +1 -0
  326. package/dist/core/std/src/amount.d.ts +13 -0
  327. package/dist/core/std/src/amount.js +22 -0
  328. package/dist/core/std/src/ascii-host.d.ts +18 -0
  329. package/dist/core/std/src/ascii-host.js +110 -0
  330. package/dist/core/std/src/assert.d.ts +39 -0
  331. package/dist/core/std/src/assert.js +59 -0
  332. package/dist/core/std/src/base64url.d.ts +23 -0
  333. package/dist/core/std/src/base64url.js +65 -0
  334. package/dist/core/std/src/canonical-json.d.ts +18 -0
  335. package/dist/core/std/src/canonical-json.js +56 -0
  336. package/dist/core/std/src/clock.d.ts +27 -0
  337. package/dist/core/std/src/clock.js +33 -0
  338. package/dist/core/std/src/constant-time.d.ts +16 -0
  339. package/dist/core/std/src/constant-time.js +26 -0
  340. package/dist/core/std/src/content-digest.d.ts +24 -0
  341. package/dist/core/std/src/content-digest.js +28 -0
  342. package/dist/core/std/src/deep-clone.d.ts +15 -0
  343. package/dist/core/std/src/deep-clone.js +59 -0
  344. package/dist/core/std/src/deep-equal.d.ts +23 -0
  345. package/dist/core/std/src/deep-equal.js +64 -0
  346. package/dist/core/std/src/emitter.d.ts +42 -0
  347. package/dist/core/std/src/emitter.js +74 -0
  348. package/dist/core/std/src/error-kind.d.ts +88 -0
  349. package/dist/core/std/src/error-kind.js +98 -0
  350. package/dist/core/std/src/hex.d.ts +10 -0
  351. package/dist/core/std/src/hex.js +16 -0
  352. package/dist/core/std/src/hidden-characters.d.ts +19 -0
  353. package/dist/core/std/src/hidden-characters.js +54 -0
  354. package/dist/core/std/src/ids.d.ts +45 -0
  355. package/dist/core/std/src/ids.js +49 -0
  356. package/dist/core/std/src/index.d.ts +30 -0
  357. package/dist/core/std/src/index.js +31 -0
  358. package/dist/core/std/src/keyed-queue.d.ts +18 -0
  359. package/dist/core/std/src/keyed-queue.js +32 -0
  360. package/dist/core/std/src/line-diff.d.ts +83 -0
  361. package/dist/core/std/src/line-diff.js +179 -0
  362. package/dist/core/std/src/line-merge.d.ts +63 -0
  363. package/dist/core/std/src/line-merge.js +138 -0
  364. package/dist/core/std/src/plain-data.d.ts +32 -0
  365. package/dist/core/std/src/plain-data.js +57 -0
  366. package/dist/core/std/src/posix-path.d.ts +61 -0
  367. package/dist/core/std/src/posix-path.js +121 -0
  368. package/dist/core/std/src/public-suffixes.generated.d.ts +9 -0
  369. package/dist/core/std/src/public-suffixes.generated.js +10429 -0
  370. package/dist/core/std/src/registrable-domain.d.ts +10 -0
  371. package/dist/core/std/src/registrable-domain.js +62 -0
  372. package/dist/core/std/src/result.d.ts +55 -0
  373. package/dist/core/std/src/result.js +52 -0
  374. package/dist/core/std/src/secret-scrubber.d.ts +54 -0
  375. package/dist/core/std/src/secret-scrubber.js +124 -0
  376. package/dist/core/std/src/secret-shape.d.ts +20 -0
  377. package/dist/core/std/src/secret-shape.js +53 -0
  378. package/dist/core/std/src/secret-variable-name.d.ts +12 -0
  379. package/dist/core/std/src/secret-variable-name.js +34 -0
  380. package/dist/core/std/src/site-name.d.ts +35 -0
  381. package/dist/core/std/src/site-name.js +111 -0
  382. package/dist/core/std/src/stop-signal.d.ts +44 -0
  383. package/dist/core/std/src/stop-signal.js +77 -0
  384. package/dist/core/std/src/text.d.ts +28 -0
  385. package/dist/core/std/src/text.js +54 -0
  386. package/dist/core/std/src/url-host.d.ts +35 -0
  387. package/dist/core/std/src/url-host.js +170 -0
  388. package/dist/core/std/src/utf8.d.ts +23 -0
  389. package/dist/core/std/src/utf8.js +110 -0
  390. package/dist/core/std/src/version.d.ts +48 -0
  391. package/dist/core/std/src/version.js +103 -0
  392. package/dist/core/yaml/src/depth.d.ts +14 -0
  393. package/dist/core/yaml/src/depth.js +140 -0
  394. package/dist/core/yaml/src/edit-data.d.ts +47 -0
  395. package/dist/core/yaml/src/edit-data.js +286 -0
  396. package/dist/core/yaml/src/edit-text.d.ts +92 -0
  397. package/dist/core/yaml/src/edit-text.js +267 -0
  398. package/dist/core/yaml/src/edit.d.ts +47 -0
  399. package/dist/core/yaml/src/edit.js +198 -0
  400. package/dist/core/yaml/src/index.d.ts +5 -0
  401. package/dist/core/yaml/src/index.js +4 -0
  402. package/dist/core/yaml/src/problem.d.ts +20 -0
  403. package/dist/core/yaml/src/problem.js +1 -0
  404. package/dist/core/yaml/src/read.d.ts +47 -0
  405. package/dist/core/yaml/src/read.js +130 -0
  406. package/dist/core/yaml/src/splice-node.d.ts +47 -0
  407. package/dist/core/yaml/src/splice-node.js +333 -0
  408. package/dist/core/yaml/src/splice.d.ts +13 -0
  409. package/dist/core/yaml/src/splice.js +174 -0
  410. package/dist/core/yaml/src/unsupported.d.ts +26 -0
  411. package/dist/core/yaml/src/unsupported.js +70 -0
  412. package/dist/core/yaml/src/write.d.ts +35 -0
  413. package/dist/core/yaml/src/write.js +44 -0
  414. package/dist/testing/integration/src/canaries.d.ts +14 -0
  415. package/dist/testing/integration/src/canaries.js +17 -0
  416. package/dist/testing/integration/src/checks.d.ts +37 -0
  417. package/dist/testing/integration/src/checks.js +195 -0
  418. package/dist/testing/integration/src/describe.d.ts +35 -0
  419. package/dist/testing/integration/src/describe.js +74 -0
  420. package/dist/testing/integration/src/failure.d.ts +6 -0
  421. package/dist/testing/integration/src/failure.js +8 -0
  422. package/dist/testing/integration/src/fake-wait.d.ts +18 -0
  423. package/dist/testing/integration/src/fake-wait.js +21 -0
  424. package/dist/testing/integration/src/index.d.ts +10 -0
  425. package/dist/testing/integration/src/index.js +11 -0
  426. package/dist/testing/integration/src/load.d.ts +14 -0
  427. package/dist/testing/integration/src/load.js +47 -0
  428. package/dist/testing/integration/src/plugin-folder.d.ts +23 -0
  429. package/dist/testing/integration/src/plugin-folder.js +59 -0
  430. package/dist/testing/integration/src/plugin.d.ts +32 -0
  431. package/dist/testing/integration/src/plugin.js +57 -0
  432. package/dist/testing/integration/src/recording.d.ts +84 -0
  433. package/dist/testing/integration/src/recording.js +164 -0
  434. package/dist/testing/integration/src/run.d.ts +60 -0
  435. package/dist/testing/integration/src/run.js +81 -0
  436. package/dist/testing/integration/src/source-scan.d.ts +16 -0
  437. package/dist/testing/integration/src/source-scan.js +40 -0
  438. package/package.json +34 -3
@@ -0,0 +1,478 @@
1
+ import type { AgentResume } from "./agent-resume.js";
2
+ import type { ApprovalResolver, CantTryStep, ModelSkipReason, ProviderText, RunFailureReason, RunKind, RunParent, RunTrigger, RunVersion, StoredBlob, ToolNoun, ToolOutcome, ToolRefusalReason, ToolRisk, ToolUnaskedReason, ToolVerb, Usage } from "./run-basics.js";
3
+ import type { LoggedSandboxBlock } from "./sandbox-blocked.js";
4
+ import type { SandboxOpenedView } from "./sandbox-opened.js";
5
+ /** The fields every event in a run log has, whatever its type. */
6
+ export interface RunEventBase {
7
+ runId: string;
8
+ /** Position in the stream, starting at 1. */
9
+ seq: number;
10
+ /** ISO timestamp. */
11
+ at: string;
12
+ /** Set on events of one branch of a parallel state. */
13
+ branch?: string;
14
+ /** Set on events of one item of a for-each state (0-based). */
15
+ item?: number;
16
+ /**
17
+ * The timeline entry this event belongs to: the `seq` of the event that
18
+ * opened the entry. On an opening event it equals `seq`. Logs written
19
+ * before this field existed don't have it; read them with `entryOf`.
20
+ */
21
+ entry?: number;
22
+ }
23
+ /** What one event says, by its `type`. A run log is a list of these, each with a {@link RunEventBase}. */
24
+ export type RunEventBody = {
25
+ type: "run.started";
26
+ hubId: string;
27
+ /** Workflow id, or "agent:<agentId>" for a run of a single agent. */
28
+ workflowId: string;
29
+ input: Record<string, unknown>;
30
+ kind: RunKind;
31
+ definitionsVersion: string;
32
+ trigger?: RunTrigger;
33
+ /** Set when a workflow state of another run started this one (a subflow). */
34
+ parent?: RunParent;
35
+ /**
36
+ * The harness every task agent of the run runs in, whatever its file
37
+ * names, such as `codex`; `halonic` runs them all in Halonic's own loop
38
+ * (requirement `events.run-started-harness`). Absent when the run keeps
39
+ * each agent's own harness, and in older logs.
40
+ */
41
+ harness?: string;
42
+ /**
43
+ * The steps of a Try it or Test run that can't be tried, as found when
44
+ * the run's item was loaded, so a timeline can mark them straight away
45
+ * (requirement `events.run-cant-try`). Absent when there are none, and
46
+ * in older logs.
47
+ */
48
+ cantTry?: CantTryStep[];
49
+ /**
50
+ * Which version of the workspace the run read: the live version, with
51
+ * its commit and date, or the saved files (requirement
52
+ * `events.run-started-version`). A child run has its parent's. Absent
53
+ * in logs written before it was recorded: read that as "not
54
+ * recorded", never as the saved files.
55
+ */
56
+ version?: RunVersion;
57
+ } | {
58
+ type: "state.entered";
59
+ state: string;
60
+ }
61
+ /** `parent`: the agent that delegated this one (subagents); absent for the state's own agent. */
62
+ | {
63
+ type: "agent.started";
64
+ state: string;
65
+ agent: string;
66
+ prompt: string;
67
+ parent?: string;
68
+ } | {
69
+ type: "llm.request";
70
+ agent: string;
71
+ provider: string;
72
+ model: string;
73
+ messages: number;
74
+ } | {
75
+ type: "llm.response";
76
+ agent: string;
77
+ provider: string;
78
+ model: string;
79
+ usage: Usage;
80
+ /**
81
+ * From the request to the answer, including the time spent on any model
82
+ * that failed before the call fell back to the one that answered.
83
+ */
84
+ latencyMs: number;
85
+ text: string;
86
+ /** The model's summary of its reasoning, when it gives one. */
87
+ thoughts?: string;
88
+ /**
89
+ * In the budget currency, when the model has a price. On a call marked
90
+ * with `paidBy`, `0` means Halonic paid nothing for it, not that the
91
+ * model is free.
92
+ */
93
+ cost?: number;
94
+ /**
95
+ * Who paid for the call when it wasn't Halonic: `"subscription"` when
96
+ * the person's own subscription did, through the harness bridge's
97
+ * sign-in. Such a call has its tokens but no price, counts in the run's
98
+ * `subscriptionCalls` and never towards `cost` or a budget (requirement
99
+ * `events.summary-cost`). Absent otherwise.
100
+ */
101
+ paidBy?: "subscription";
102
+ /** Answered from the cache (a simulation re-run), not by the model. */
103
+ cached?: boolean;
104
+ /**
105
+ * The answer made no tool call, but its text is a call to a tool the
106
+ * step offered, written out as JSON (requirement
107
+ * `events.tool-call-as-text`). That call never runs. Absent otherwise.
108
+ */
109
+ toolCallAsText?: true;
110
+ }
111
+ /**
112
+ * The call moved on to the next model. `providerText`: the provider's own
113
+ * error text, for `--debug` and Copy details only (requirement
114
+ * `events.provider-text`); absent in older logs and when it gave none.
115
+ */
116
+ | {
117
+ type: "llm.fallback";
118
+ agent: string;
119
+ from: string;
120
+ to: string;
121
+ error: string;
122
+ providerText?: ProviderText;
123
+ }
124
+ /**
125
+ * A model alias was skipped before any call (requirement
126
+ * `events.llm-skipped`), such as "smart: no key, using default". `next` is
127
+ * the alias tried instead; absent when none is left.
128
+ */
129
+ | {
130
+ type: "llm.skipped";
131
+ agent: string;
132
+ alias: string;
133
+ provider: string;
134
+ model: string;
135
+ reason: ModelSkipReason;
136
+ next?: string;
137
+ } | {
138
+ type: "tool.called";
139
+ agent: string;
140
+ tool: string;
141
+ args: unknown;
142
+ }
143
+ /**
144
+ * A model's tool call was refused before it ran, so it reached nothing
145
+ * (requirement `events.tool-refused`). `tool`: the name exactly as the
146
+ * model wrote it, which may hold look-alike or control characters.
147
+ * `toolCallId`: the model's id for the call. A refused call has no
148
+ * `tool.called` or `tool.result`.
149
+ */
150
+ | {
151
+ type: "tool.refused";
152
+ agent: string;
153
+ tool: string;
154
+ toolCallId: string;
155
+ reason: ToolRefusalReason;
156
+ }
157
+ /**
158
+ * A connector's tool call is about to run without asking a person,
159
+ * because the `read` list of the connector's file names the tool
160
+ * (requirement `events.tool-unasked`). `connector`: the connector's id.
161
+ * `tool`: the name the model called. Written before the call, so it shows
162
+ * even when the call fails.
163
+ */
164
+ | {
165
+ type: "tool.unasked";
166
+ agent: string;
167
+ connector: string;
168
+ tool: string;
169
+ reason: ToolUnaskedReason;
170
+ }
171
+ /**
172
+ * A step's sandbox is being opened (requirement `events.started-events`).
173
+ * Written before the call, so a screen can say what the step waits for;
174
+ * `timeoutMs` is how long the engine waits before the step fails.
175
+ */
176
+ | {
177
+ type: "sandbox.started";
178
+ state: string;
179
+ agent: string;
180
+ timeoutMs: number;
181
+ }
182
+ /**
183
+ * A step's harness program is being started (requirement
184
+ * `events.started-events`). `harness` is the agent's harness id, such as
185
+ * `"claude-code"`; `timeoutMs` is how long the engine waits for its first event.
186
+ */
187
+ | {
188
+ type: "harness.started";
189
+ state: string;
190
+ agent: string;
191
+ harness: string;
192
+ timeoutMs: number;
193
+ }
194
+ /**
195
+ * The instructions a step's harness runs with, pinned by content hash
196
+ * (requirement `events.harness-instructions`). Written right before
197
+ * `harness.started`, so a review can tell which instructions a run had.
198
+ * `files` lists `AGENTS.md` and each skill file, with paths relative to the
199
+ * run's folder, never absolute ones; `sha256` is the hash of the whole set.
200
+ * It never holds file contents. Logs written before this event have none.
201
+ */
202
+ | {
203
+ type: "harness.instructions";
204
+ state: string;
205
+ agent: string;
206
+ files: {
207
+ path: string;
208
+ sha256: string;
209
+ }[];
210
+ sha256: string;
211
+ }
212
+ /**
213
+ * A step's sandbox opened (requirement `events.sandbox-opened`). `sandbox`
214
+ * is a display copy of its profile, never its environment variables.
215
+ */
216
+ | {
217
+ type: "sandbox.opened";
218
+ state: string;
219
+ agent: string;
220
+ sandbox: SandboxOpenedView;
221
+ }
222
+ /**
223
+ * A step ran without the sandbox because a person chose to run the agent
224
+ * on this computer (requirement `events.sandbox-off`). `chosenAt` is when
225
+ * they made that choice, as an ISO 8601 date and time. Logs written before
226
+ * this event have neither it nor `sandbox.opened`.
227
+ */
228
+ | {
229
+ type: "sandbox.off";
230
+ state: string;
231
+ agent: string;
232
+ chosenAt: string;
233
+ }
234
+ /**
235
+ * A step's sandbox refused an access (requirement `events.sandbox-blocked`).
236
+ * `count` is the running total of refused accesses to this target (or to
237
+ * `others`) in the step so far: the engine logs a target's first block at
238
+ * once and the total at the end of the step. A later event replaces an
239
+ * earlier count, it doesn't add to it: events with 1 and then 7 for one
240
+ * target mean 7 refused accesses.
241
+ */
242
+ | {
243
+ type: "sandbox.blocked";
244
+ state: string;
245
+ agent: string;
246
+ block: LoggedSandboxBlock;
247
+ count: number;
248
+ }
249
+ /**
250
+ * A step is about to call a connector's program (requirement `events.connector-started`).
251
+ * `connector`: its id in the workspace. `timeoutMs`: how long the engine waits for it; every
252
+ * wait has a limit. Logged before the call, so a screen can say what the step is waiting for.
253
+ */
254
+ | {
255
+ type: "connector.started";
256
+ state: string;
257
+ agent: string;
258
+ connector: string;
259
+ timeoutMs: number;
260
+ }
261
+ /**
262
+ * A step is about to make a connector call that can change things
263
+ * (requirement `events.effect-requested`). Written before the call, so a
264
+ * call with this record and no `tool.result` may or may not have done its
265
+ * work. `callId`: the engine's id for the call, `call-<n>`, unique in the
266
+ * run. `idempotencyKey`: `<runId>:<callId>`, the same when a person has
267
+ * the call tried again. `resume`: where the agent goes on once the call
268
+ * has a result.
269
+ */
270
+ | {
271
+ type: "effect.requested";
272
+ state: string;
273
+ agent: string;
274
+ connector: string;
275
+ tool: string;
276
+ args: unknown;
277
+ callId: string;
278
+ idempotencyKey: string;
279
+ resume: AgentResume;
280
+ /** The subagent whose call it is (requirement `events.agent-resume-inner`); absent for the state's own agent. */
281
+ subagent?: string;
282
+ }
283
+ /** A knowledge source in "auto" mode was searched with the task before the first model call. */
284
+ | {
285
+ type: "knowledge.searched";
286
+ agent: string;
287
+ source: string;
288
+ query: string;
289
+ refs: string[];
290
+ }
291
+ /**
292
+ * `outcome`: how the call ended (requirement `events.tool-result-outcome`).
293
+ * `risk`, `noun` and `verb`: what the tool can do, what one call sends,
294
+ * reads or drafts and what it does to it, copied from its integration's
295
+ * sheet when the call ends (requirement `events.tool-result-risk`). Each is absent in older
296
+ * logs, and `risk`, `noun` and `verb` for a tool without a sheet. A
297
+ * missing `verb` means "sent".
298
+ * `resultBlob`: set when the result was too large for the log; `result`
299
+ * then holds only its start, and the whole result is in the blob store
300
+ * (requirement `events.tool-result-blob`).
301
+ */
302
+ | {
303
+ type: "tool.result";
304
+ agent: string;
305
+ tool: string;
306
+ result: string;
307
+ outcome?: ToolOutcome;
308
+ risk?: ToolRisk;
309
+ noun?: ToolNoun;
310
+ verb?: ToolVerb;
311
+ resultBlob?: StoredBlob;
312
+ }
313
+ /** A connector tool call that needs a person's OK; the run waits for "approve" or "reject". */
314
+ | {
315
+ type: "approval.requested";
316
+ state: string;
317
+ agent: string;
318
+ tool: string;
319
+ args: unknown;
320
+ callId: string;
321
+ resume: AgentResume;
322
+ /** The subagent whose call it is (requirement `events.agent-resume-inner`); absent for the state's own agent. */
323
+ subagent?: string;
324
+ } | {
325
+ type: "approval.resolved";
326
+ state: string;
327
+ agent: string;
328
+ tool: string;
329
+ callId: string;
330
+ approved: boolean;
331
+ comment?: string;
332
+ /** Who resolved it (requirement `events.approval-resolved-by`); absent in older logs. */
333
+ by?: ApprovalResolver;
334
+ }
335
+ /**
336
+ * `error` and `reason`: set when the agent failed without failing the run,
337
+ * as a parallel branch does; `output` is then `null` (requirement
338
+ * `events.agent-finished-error`). Absent in older logs and for an agent
339
+ * that answered.
340
+ * `cantTry`: set instead of `reason` when the agent's step couldn't be
341
+ * tried (requirement `events.run-cant-try`), as a parallel branch reports it.
342
+ */
343
+ | {
344
+ type: "agent.finished";
345
+ state: string;
346
+ agent: string;
347
+ output: unknown;
348
+ parent?: string;
349
+ error?: string;
350
+ reason?: RunFailureReason;
351
+ cantTry?: CantTryStep;
352
+ } | {
353
+ type: "artifact.created";
354
+ state: string;
355
+ name: string;
356
+ hash: string;
357
+ mediaType: string;
358
+ size: number;
359
+ } | {
360
+ type: "context.updated";
361
+ key: string;
362
+ value: unknown;
363
+ }
364
+ /** A step sent a signal; routines with a signal trigger start on it. */
365
+ | {
366
+ type: "signal.sent";
367
+ state: string;
368
+ name: string;
369
+ data: Record<string, unknown>;
370
+ } | {
371
+ type: "transition";
372
+ from: string;
373
+ to: string;
374
+ event: string;
375
+ }
376
+ /** A workflow state started a child run; it finishes with workflow.finished. */
377
+ | {
378
+ type: "workflow.started";
379
+ state: string;
380
+ workflow: string;
381
+ childRunId: string;
382
+ } | {
383
+ type: "workflow.finished";
384
+ state: string;
385
+ workflow: string;
386
+ childRunId: string;
387
+ /** `cant-try` when the child ended with `run.cant-try` (requirement `events.run-cant-try`). */
388
+ status: "completed" | "failed" | "cant-try";
389
+ error?: string;
390
+ /**
391
+ * The child's final context, set when it completed as one item of a
392
+ * for-each state (requirement `events.workflow-finished-context`);
393
+ * absent otherwise and in older logs.
394
+ */
395
+ context?: Record<string, unknown>;
396
+ }
397
+ /**
398
+ * The child run a waiting `workflow` state waits on runs again, so the run
399
+ * does too and takes no events until the child waits again
400
+ * (requirement `events.workflow-resumed`).
401
+ */
402
+ | {
403
+ type: "workflow.resumed";
404
+ state: string;
405
+ childRunId: string;
406
+ }
407
+ /**
408
+ * `child`: the run is waiting because this child run waits; events go to it.
409
+ * `title` and `body`: the wait step's description, filled in against the
410
+ * run when it started waiting (requirement `events.waiting-description`).
411
+ * The filled-in values can be model output: show them as plain text.
412
+ * `labels`: event → the label the step's author gave that answer, for the
413
+ * events that have one (requirement `events.answer-labels`).
414
+ */
415
+ | {
416
+ type: "run.waiting";
417
+ state: string;
418
+ events: string[];
419
+ child?: string;
420
+ timers?: {
421
+ after: string;
422
+ at: string;
423
+ }[];
424
+ title?: string;
425
+ body?: string;
426
+ labels?: Record<string, string>;
427
+ }
428
+ /** A timer transition (`after`) of a wait state fired. */
429
+ | {
430
+ type: "timer.fired";
431
+ state: string;
432
+ after: string;
433
+ } | {
434
+ type: "event.received";
435
+ event: string;
436
+ payload?: unknown;
437
+ } | {
438
+ type: "run.completed";
439
+ state: string;
440
+ context: Record<string, unknown>;
441
+ }
442
+ /**
443
+ * `reason`: why the run failed (requirement `events.run-failed-reason`); absent in older logs.
444
+ * `host`: with `model-unreachable` only, the host and port that didn't answer, such as
445
+ * `localhost:11434` (requirement `events.run-failed-model-unreachable`).
446
+ * `sandboxReason`: with `sandbox-not-ready` only, why the sandbox can't start, as the `Sandbox`
447
+ * port's reason code, such as `bubblewrap-missing` (requirement `events.run-failed-sandbox-not-ready`).
448
+ * A reader that doesn't know the code reads it as `other`.
449
+ * `providerText`: the model provider's own error text, for `--debug` and Copy details only
450
+ * (requirement `events.provider-text`); absent in older logs and when it gave none.
451
+ */
452
+ | {
453
+ type: "run.failed";
454
+ state: string | null;
455
+ error: string;
456
+ reason?: RunFailureReason;
457
+ host?: string;
458
+ sandboxReason?: string;
459
+ providerText?: ProviderText;
460
+ }
461
+ /**
462
+ * A Try it or Test run ended at a step it couldn't try, and nothing in it
463
+ * really failed (requirement `events.run-cant-try`). `cantTry` lists every
464
+ * such step: the ones found when the item was loaded and the ones found
465
+ * while running. A run with a real failure ends with `run.failed` instead.
466
+ */
467
+ | {
468
+ type: "run.cant-try";
469
+ state: string | null;
470
+ cantTry: CantTryStep[];
471
+ };
472
+ /**
473
+ * One entry of a run log. Every run is an append-only stream of these; the
474
+ * timeline, cost reports, test assertions and replays all read that one stream.
475
+ */
476
+ export type RunEvent = RunEventBase & RunEventBody;
477
+ /** The name of an event, such as `"run.started"`. */
478
+ export type RunEventType = RunEvent["type"];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import type { RunEvent } from "./run-event.js";
2
+ import { type SendCount } from "./run-sends.js";
3
+ /**
4
+ * What a run read, worked out from its log by the reader rules of requirement
5
+ * `events.tool-result-risk`: one count per noun in the order of each noun's
6
+ * first call, for every `tool.result` with `risk: "read"`, a `noun` and
7
+ * `outcome: "ok"`. Pure; the receipt says "Read 3 emails" from it.
8
+ *
9
+ * @param events - the run's events, oldest first
10
+ * @returns the reads, noun by noun; empty when the run read nothing it can name
11
+ *
12
+ * @example
13
+ * readsOf(events);
14
+ * // gmail_read_message twice, drive_get_file once => [2 emails, 1 Drive file]
15
+ */
16
+ export declare function readsOf(events: readonly RunEvent[]): SendCount[];
17
+ /**
18
+ * What a run drafted: the ok calls of a write tool whose `verb` is
19
+ * "drafted", counted per noun like {@link readsOf}. A draft is not a send.
20
+ *
21
+ * @example
22
+ * draftsOf(events);
23
+ * // gmail_create_draft once => [1 email]
24
+ */
25
+ export declare function draftsOf(events: readonly RunEvent[]): SendCount[];
@@ -0,0 +1,44 @@
1
+ import { countNoun } from "./run-sends.js";
2
+ /**
3
+ * What a run read, worked out from its log by the reader rules of requirement
4
+ * `events.tool-result-risk`: one count per noun in the order of each noun's
5
+ * first call, for every `tool.result` with `risk: "read"`, a `noun` and
6
+ * `outcome: "ok"`. Pure; the receipt says "Read 3 emails" from it.
7
+ *
8
+ * @param events - the run's events, oldest first
9
+ * @returns the reads, noun by noun; empty when the run read nothing it can name
10
+ *
11
+ * @example
12
+ * readsOf(events);
13
+ * // gmail_read_message twice, drive_get_file once => [2 emails, 1 Drive file]
14
+ */
15
+ export function readsOf(events) {
16
+ const counts = [];
17
+ for (const event of events) {
18
+ if (event.type !== "tool.result" || event.risk !== "read")
19
+ continue;
20
+ if (event.outcome !== "ok" || event.noun === undefined)
21
+ continue;
22
+ countNoun(counts, event.noun);
23
+ }
24
+ return counts;
25
+ }
26
+ /**
27
+ * What a run drafted: the ok calls of a write tool whose `verb` is
28
+ * "drafted", counted per noun like {@link readsOf}. A draft is not a send.
29
+ *
30
+ * @example
31
+ * draftsOf(events);
32
+ * // gmail_create_draft once => [1 email]
33
+ */
34
+ export function draftsOf(events) {
35
+ const counts = [];
36
+ for (const event of events) {
37
+ if (event.type !== "tool.result" || event.risk !== "write")
38
+ continue;
39
+ if (event.outcome !== "ok" || event.verb !== "drafted" || event.noun === undefined)
40
+ continue;
41
+ countNoun(counts, event.noun);
42
+ }
43
+ return counts;
44
+ }
@@ -0,0 +1,47 @@
1
+ import type { ToolNoun, ToolVerb } from "./run-basics.js";
2
+ import type { RunEvent } from "./run-event.js";
3
+ /** How many calls did one verb to one noun, such as 2 calls that sent an email. */
4
+ export interface SendCount {
5
+ noun: ToolNoun;
6
+ calls: number;
7
+ }
8
+ /**
9
+ * What one verb did, noun by noun, in the order of each noun's first call:
10
+ * "sent" with 1 email and 2 invites reads "sent 1 email and 2 invites".
11
+ */
12
+ export interface SendGroup {
13
+ verb: ToolVerb;
14
+ counts: SendCount[];
15
+ }
16
+ /** What a run sent, worked out from its log by {@link sendsOf}. */
17
+ export interface RunSends {
18
+ /** The calls that sent, one group per verb, in the order of each verb's first call. */
19
+ sent: SendGroup[];
20
+ /** The calls that broke off without an answer, so may have sent; grouped the same way. */
21
+ maySend: SendGroup[];
22
+ /**
23
+ * Whether the run made a tool call at all. A run "sent nothing" only when
24
+ * it made none: a call whose log doesn't say what it can do may have sent.
25
+ * Starting a child run counts as a call, because the child may have sent.
26
+ */
27
+ madeToolCalls: boolean;
28
+ }
29
+ /**
30
+ * What a run sent, by the reader rules of requirement
31
+ * `events.tool-result-risk`. Pure; the receipt and the runs list both use it,
32
+ * so they say the same thing about a run.
33
+ *
34
+ * A call counts as sent when its `tool.result` has `risk: "send"`, a `noun`
35
+ * and `outcome: "ok"`, and as "may have sent" with `outcome: "unknown"`. A
36
+ * missing `verb` is "sent". Groups and the counts in them keep call order.
37
+ *
38
+ * @param events - the run's events, oldest first
39
+ * @returns what it sent, what it may have sent, and whether it made a tool call
40
+ *
41
+ * @example
42
+ * const { sent } = sendsOf(await runStore.events(runId));
43
+ * // gmail_send, calendar_create_event twice, drive_create_file =>
44
+ * // [{ verb: "sent", counts: [1 email, 2 invites] }, { verb: "saved", counts: [1 file] }]
45
+ */
46
+ export declare function sendsOf(events: readonly RunEvent[]): RunSends;
47
+ export declare function countNoun(counts: SendCount[], noun: ToolNoun): void;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * What a run sent, by the reader rules of requirement
3
+ * `events.tool-result-risk`. Pure; the receipt and the runs list both use it,
4
+ * so they say the same thing about a run.
5
+ *
6
+ * A call counts as sent when its `tool.result` has `risk: "send"`, a `noun`
7
+ * and `outcome: "ok"`, and as "may have sent" with `outcome: "unknown"`. A
8
+ * missing `verb` is "sent". Groups and the counts in them keep call order.
9
+ *
10
+ * @param events - the run's events, oldest first
11
+ * @returns what it sent, what it may have sent, and whether it made a tool call
12
+ *
13
+ * @example
14
+ * const { sent } = sendsOf(await runStore.events(runId));
15
+ * // gmail_send, calendar_create_event twice, drive_create_file =>
16
+ * // [{ verb: "sent", counts: [1 email, 2 invites] }, { verb: "saved", counts: [1 file] }]
17
+ */
18
+ export function sendsOf(events) {
19
+ const sends = { sent: [], maySend: [], madeToolCalls: false };
20
+ for (const event of events) {
21
+ if (!couldSend(event))
22
+ continue;
23
+ sends.madeToolCalls = true;
24
+ if (event.type !== "tool.result" || event.risk !== "send" || event.noun === undefined) {
25
+ continue;
26
+ }
27
+ const verb = event.verb ?? "sent";
28
+ if (event.outcome === "ok")
29
+ addCall(sends.sent, verb, event.noun);
30
+ if (event.outcome === "unknown")
31
+ addCall(sends.maySend, verb, event.noun);
32
+ }
33
+ return sends;
34
+ }
35
+ /**
36
+ * Whether the event is a call that could have sent something: a tool call, or
37
+ * a child run started, whose own log holds what it sent.
38
+ */
39
+ function couldSend(event) {
40
+ return (event.type === "tool.called" ||
41
+ event.type === "tool.result" ||
42
+ event.type === "workflow.started");
43
+ }
44
+ /** Count one call in its verb's group, adding the group or the noun at the end when new. */
45
+ function addCall(groups, verb, noun) {
46
+ let group = groups.find((candidate) => candidate.verb === verb);
47
+ if (group === undefined) {
48
+ group = { verb, counts: [] };
49
+ groups.push(group);
50
+ }
51
+ const count = group.counts.find((candidate) => sameNoun(candidate.noun, noun));
52
+ if (count === undefined) {
53
+ group.counts.push({ noun: { one: noun.one, many: noun.many }, calls: 1 });
54
+ }
55
+ else {
56
+ count.calls += 1;
57
+ }
58
+ }
59
+ export function countNoun(counts, noun) {
60
+ const count = counts.find((candidate) => sameNoun(candidate.noun, noun));
61
+ if (count === undefined)
62
+ counts.push({ noun: { one: noun.one, many: noun.many }, calls: 1 });
63
+ else
64
+ count.calls += 1;
65
+ }
66
+ function sameNoun(a, b) {
67
+ return a.one === b.one && a.many === b.many;
68
+ }