@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,131 @@
1
+ import { parseEventLine, } from "../../events/src/index.js";
2
+ /** Version of the {@link RunStore} port. A breaking change bumps it and comes with an ADR. */
3
+ export const runStoreVersion = 1;
4
+ /** The format version of {@link RunLockRecord} that adapters write today. */
5
+ export const runLockFormat = 1;
6
+ /**
7
+ * How old a run lock may get before any writer may remove it. An append holds
8
+ * the lock for milliseconds, so this is far longer than any append takes.
9
+ */
10
+ export const runLockStaleAfterMs = 10_000;
11
+ /**
12
+ * How old a lock's takeover file may get before any writer may remove it.
13
+ * Removing a stale lock takes milliseconds, and up to 2 seconds a step on
14
+ * Windows while a file is busy, so a takeover file this old was left by a
15
+ * writer that crashed while removing a lock.
16
+ */
17
+ export const runLockTakeoverStaleAfterMs = 5_000;
18
+ // The rules above, as code, so every adapter checks appends and filters runs the same way.
19
+ /**
20
+ * Refuses an append that is the caller's bug, as {@link RunStore.append}
21
+ * says: `expectedSeq` that isn't a whole number of 0 or more, no events,
22
+ * an event of another run, or events not numbered from `expectedSeq + 1`.
23
+ *
24
+ * @throws RangeError naming what is wrong
25
+ */
26
+ export function checkRunAppend(runId, expectedSeq, events) {
27
+ if (!Number.isSafeInteger(expectedSeq) || expectedSeq < 0) {
28
+ throw new RangeError(`expectedSeq must be a whole number of 0 or more, not ${expectedSeq}.`);
29
+ }
30
+ if (events.length === 0) {
31
+ throw new RangeError("append needs at least one event.");
32
+ }
33
+ events.forEach((event, index) => {
34
+ if (event.runId !== runId) {
35
+ throw new RangeError(`Event ${event.seq} belongs to run ${event.runId}, not ${runId}.`);
36
+ }
37
+ if (event.seq !== expectedSeq + index + 1) {
38
+ throw new RangeError(`Event ${index} has seq ${event.seq}, not ${expectedSeq + index + 1}.`);
39
+ }
40
+ });
41
+ }
42
+ /** Whether a summary matches every field of a {@link RunFilter}. An empty status list is no status filter. */
43
+ export function matchesRunFilter(summary, filter) {
44
+ const statuses = filter.status === undefined ? [] : [filter.status].flat();
45
+ return ((filter.hubId === undefined || summary.hubId === filter.hubId) &&
46
+ (filter.workflowId === undefined || summary.workflowId === filter.workflowId) &&
47
+ (filter.kind === undefined || summary.kind === filter.kind) &&
48
+ (statuses.length === 0 || statuses.includes(summary.status)) &&
49
+ (filter.startedSince === undefined || startedAtOrAfter(summary.startedAt, filter.startedSince)));
50
+ }
51
+ /**
52
+ * Whether a run that started at `startedAt` is in a list filtered by
53
+ * `startedSince`. Both are ISO times; they are compared as times, so an
54
+ * offset or a missing fraction of a second doesn't change the answer.
55
+ */
56
+ export function startedAtOrAfter(startedAt, since) {
57
+ return Date.parse(startedAt) >= Date.parse(since);
58
+ }
59
+ /** Orders summaries as {@link RunStore.list} returns them: newest start time first, then by run id. */
60
+ export function compareRunSummaries(a, b) {
61
+ return b.startedAt.localeCompare(a.startedAt) || a.id.localeCompare(b.id);
62
+ }
63
+ // The run folder's file rules, which every adapter that keeps runs as files
64
+ // in a folder applies: the CLI's `FolderRunStore` in `fs-node` and the
65
+ // desktop app's store in `fs-tauri`, whose shell writes the same files. Bytes
66
+ // stay with the adapters: each finds the log's whole lines and decodes them
67
+ // its own way, then reads them here (HAL-2701).
68
+ /** Letters, digits, `_`, `-` and `.`, not starting with a dot, at most 128 characters: a safe file name everywhere. */
69
+ const runIdPattern = /^[A-Za-z0-9_-][A-Za-z0-9_.-]{0,127}$/u;
70
+ /** Names Windows opens as a device whatever the extension, such as `NUL.jsonl`. */
71
+ const windowsDeviceName = /^(con|prn|aux|nul|com\d|lpt\d)(\.|$)/iu;
72
+ /** Writes events as run log lines: one JSON event per line, each ending in a line break. */
73
+ export function formatLogLines(events) {
74
+ return events.map((event) => `${JSON.stringify(event)}\n`).join("");
75
+ }
76
+ /**
77
+ * Reads a run log's whole lines back into events. Every line must hold the
78
+ * run's next event, numbered from 1. Pass only whole lines, each ending in
79
+ * a line break: a torn last line, from a crash, is the adapter's to leave
80
+ * out first.
81
+ *
82
+ * @param lines - the log's whole lines, or `""` for an empty log
83
+ * @param runId - the run the log belongs to
84
+ * @param file - the log's name, for the error message
85
+ * @returns the events, in order
86
+ * @throws Error naming the file and line when a line is broken
87
+ */
88
+ export function parseLogLines(lines, runId, file) {
89
+ if (lines === "") {
90
+ return [];
91
+ }
92
+ if (!lines.endsWith("\n")) {
93
+ throw new RangeError(`Only whole lines of run log ${file} can be read.`);
94
+ }
95
+ return lines
96
+ .slice(0, -1)
97
+ .split("\n")
98
+ .map((line, index) => parseLine(line, index + 1, runId, file));
99
+ }
100
+ /**
101
+ * Whether a run id can be a plain file name in the run folder: 1 to 128
102
+ * letters, digits, `_`, `-` or `.`, not starting with a dot, and not a name
103
+ * Windows keeps for a device.
104
+ */
105
+ export function isRunId(runId) {
106
+ return runIdPattern.test(runId) && !windowsDeviceName.test(runId);
107
+ }
108
+ /**
109
+ * Refuses a run id that couldn't be a plain file name in the run folder:
110
+ * `..`, a separator, an absolute path, a name Windows keeps for a device.
111
+ *
112
+ * @throws RangeError naming the run id
113
+ */
114
+ export function checkRunId(runId) {
115
+ if (!isRunId(runId)) {
116
+ throw new RangeError(`Unsafe run id ${JSON.stringify(runId)}: use 1 to 128 letters, digits, "_", "-" or ".", not starting with ".".`);
117
+ }
118
+ }
119
+ function parseLine(line, seq, runId, file) {
120
+ let event;
121
+ try {
122
+ event = parseEventLine(line);
123
+ }
124
+ catch (error) {
125
+ throw new Error(`Broken run log ${file}, line ${seq}: ${error.message}`);
126
+ }
127
+ if (event.runId !== runId || event.seq !== seq) {
128
+ throw new Error(`Broken run log ${file}, line ${seq}: it holds event ${event.seq} of run ${event.runId}.`);
129
+ }
130
+ return event;
131
+ }
@@ -0,0 +1,34 @@
1
+ /** What a run was asked to start does not exist: a hub, a workflow in a hub, or an agent in a hub. */
2
+ export type RunTargetKind = "hub" | "workflow" | "agent";
3
+ /**
4
+ * What {@link RunExecutor.start} and `startAgent` throw when the hub, the
5
+ * workflow or the agent the request names doesn't exist (requirement
6
+ * `ports.run-target-not-found`). A caller that answers a person, such as the
7
+ * host's run routes, can then tell a wrong name from a real failure.
8
+ *
9
+ * It is a `RangeError`, as the lookups threw before. Check for it with
10
+ * {@link isRunTargetNotFound}, not `instanceof`: an executor may be built
11
+ * against its own copy of this package.
12
+ *
13
+ * @example
14
+ * throw new RunTargetNotFound("workflow", "tidy", 'The hub "billing" has no workflow "tidy".');
15
+ */
16
+ export declare class RunTargetNotFound extends RangeError {
17
+ readonly name = "RunTargetNotFound";
18
+ /** Which kind of thing is missing. */
19
+ readonly kind: RunTargetKind;
20
+ /** The id the request named. */
21
+ readonly id: string;
22
+ /**
23
+ * @param kind - which kind of thing is missing
24
+ * @param id - the id the request named
25
+ * @param message - safe to log; the host doesn't send it to a client
26
+ */
27
+ constructor(kind: RunTargetKind, id: string, message: string);
28
+ }
29
+ /**
30
+ * Whether `value` is a {@link RunTargetNotFound}: an `Error` named
31
+ * "RunTargetNotFound" with a known `kind` and an `id`. It works across
32
+ * copies of this package, where `instanceof` doesn't.
33
+ */
34
+ export declare function isRunTargetNotFound(value: unknown): value is RunTargetNotFound;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * What {@link RunExecutor.start} and `startAgent` throw when the hub, the
3
+ * workflow or the agent the request names doesn't exist (requirement
4
+ * `ports.run-target-not-found`). A caller that answers a person, such as the
5
+ * host's run routes, can then tell a wrong name from a real failure.
6
+ *
7
+ * It is a `RangeError`, as the lookups threw before. Check for it with
8
+ * {@link isRunTargetNotFound}, not `instanceof`: an executor may be built
9
+ * against its own copy of this package.
10
+ *
11
+ * @example
12
+ * throw new RunTargetNotFound("workflow", "tidy", 'The hub "billing" has no workflow "tidy".');
13
+ */
14
+ export class RunTargetNotFound extends RangeError {
15
+ name = "RunTargetNotFound";
16
+ /** Which kind of thing is missing. */
17
+ kind;
18
+ /** The id the request named. */
19
+ id;
20
+ /**
21
+ * @param kind - which kind of thing is missing
22
+ * @param id - the id the request named
23
+ * @param message - safe to log; the host doesn't send it to a client
24
+ */
25
+ constructor(kind, id, message) {
26
+ super(message);
27
+ this.kind = kind;
28
+ this.id = id;
29
+ }
30
+ }
31
+ /**
32
+ * Whether `value` is a {@link RunTargetNotFound}: an `Error` named
33
+ * "RunTargetNotFound" with a known `kind` and an `id`. It works across
34
+ * copies of this package, where `instanceof` doesn't.
35
+ */
36
+ export function isRunTargetNotFound(value) {
37
+ if (!(value instanceof Error) || value.name !== "RunTargetNotFound")
38
+ return false;
39
+ const { kind, id } = value;
40
+ return (kind === "hub" || kind === "workflow" || kind === "agent") && typeof id === "string";
41
+ }
@@ -0,0 +1,68 @@
1
+ /** Version of the {@link SandboxSettingStore} port. A breaking change bumps it and comes with an ADR. */
2
+ export declare const sandboxSettingStoreVersion = 1;
3
+ /** Every sandbox backend Halonic knows, by id. A new backend is a new entry here. */
4
+ export declare const sandboxBackendIds: readonly ["srt", "srt-wsl", "mxc", "docker-sbx", "cloud"];
5
+ /** A sandbox backend: one of {@link sandboxBackendIds}. */
6
+ export type SandboxBackendId = (typeof sandboxBackendIds)[number];
7
+ /**
8
+ * The person's choice of sandbox: a backend, or to continue without one.
9
+ * "Not chosen yet" is no record, which is `null` from the store.
10
+ *
11
+ * @example
12
+ * const setting: SandboxSetting = { backend: "srt-wsl", chosenAt: "2026-11-13T09:00:00.000Z" };
13
+ * const without: SandboxSetting = {
14
+ * backend: "none",
15
+ * chosenAt: "2026-11-13T09:00:00.000Z",
16
+ * appVersion: "0.1.0",
17
+ * };
18
+ */
19
+ export type SandboxSetting = {
20
+ /** The backend the person chose. */
21
+ backend: SandboxBackendId;
22
+ /** When the person chose, as ISO text. */
23
+ chosenAt: string;
24
+ } | {
25
+ /** The person chose to continue without a sandbox. */
26
+ backend: "none";
27
+ /** When the person chose, as ISO text. */
28
+ chosenAt: string;
29
+ /** The Halonic version that was running when they chose. */
30
+ appVersion: string;
31
+ };
32
+ /**
33
+ * The person's sandbox choice for this computer and this operating system
34
+ * user (requirement `ports.sandbox-setting-store`), in the user's profile:
35
+ * the profile folder for the CLI and `serve`, the app data folder for the
36
+ * desktop app, memory for tests and the browser demo. **Never inside a
37
+ * workspace**, so an agent that edits the workspace can't change the
38
+ * sandbox it runs in. It replaces the earlier MXC `on`/`off` setting.
39
+ *
40
+ * The port only stores the choice. `SandboxChoiceService` in `core/app`
41
+ * reads it and decides what runs. Only a person makes a choice: no tool the
42
+ * model can call reaches this store.
43
+ *
44
+ * A saved choice that exists but can't be read makes `get` throw, never
45
+ * return `null`: `null` means the onboarding hasn't run, and the caller must
46
+ * not take a damaged choice for that. `remove` still deletes it, and `save`
47
+ * still replaces it.
48
+ */
49
+ export interface SandboxSettingStore {
50
+ /** The saved choice, or `null` when none is saved. */
51
+ get(): Promise<SandboxSetting | null>;
52
+ /** Saves a choice, replacing any saved before. */
53
+ save(setting: SandboxSetting): Promise<void>;
54
+ /** Deletes the choice, even one that can't be read. Removing a choice that isn't there is not an error. */
55
+ remove(): Promise<void>;
56
+ }
57
+ /**
58
+ * Whether `value`, as read back from a store, is a valid choice: exactly the
59
+ * fields of a {@link SandboxSetting}, each text, and a backend that is
60
+ * {@link sandboxBackendIds} or `"none"`. Anything else is a damaged or
61
+ * hand-edited choice and must never pick a sandbox. Every adapter checks
62
+ * what it reads with this, and `SandboxChoiceService` in `core/app` checks
63
+ * what an adapter gives back with it again.
64
+ *
65
+ * @example
66
+ * isSandboxSetting(JSON.parse(text)); // false for `{ backend: "docker", chosenAt }`
67
+ */
68
+ export declare function isSandboxSetting(value: unknown): value is SandboxSetting;
@@ -0,0 +1,33 @@
1
+ /** Version of the {@link SandboxSettingStore} port. A breaking change bumps it and comes with an ADR. */
2
+ export const sandboxSettingStoreVersion = 1;
3
+ /** Every sandbox backend Halonic knows, by id. A new backend is a new entry here. */
4
+ export const sandboxBackendIds = ["srt", "srt-wsl", "mxc", "docker-sbx", "cloud"];
5
+ const backendFields = ["backend", "chosenAt"];
6
+ const noneFields = ["backend", "chosenAt", "appVersion"];
7
+ /**
8
+ * Whether `value`, as read back from a store, is a valid choice: exactly the
9
+ * fields of a {@link SandboxSetting}, each text, and a backend that is
10
+ * {@link sandboxBackendIds} or `"none"`. Anything else is a damaged or
11
+ * hand-edited choice and must never pick a sandbox. Every adapter checks
12
+ * what it reads with this, and `SandboxChoiceService` in `core/app` checks
13
+ * what an adapter gives back with it again.
14
+ *
15
+ * @example
16
+ * isSandboxSetting(JSON.parse(text)); // false for `{ backend: "docker", chosenAt }`
17
+ */
18
+ export function isSandboxSetting(value) {
19
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
20
+ return false;
21
+ }
22
+ const record = value;
23
+ const backend = record["backend"];
24
+ if (backend === "none")
25
+ return hasExactlyTextFields(record, noneFields);
26
+ return (typeof backend === "string" &&
27
+ sandboxBackendIds.includes(backend) &&
28
+ hasExactlyTextFields(record, backendFields));
29
+ }
30
+ function hasExactlyTextFields(record, fields) {
31
+ return (Object.keys(record).length === fields.length &&
32
+ fields.every((field) => Object.hasOwn(record, field) && typeof record[field] === "string"));
33
+ }
@@ -0,0 +1,364 @@
1
+ /**
2
+ * Version of the {@link Sandbox} port. A breaking change bumps it and comes with an ADR.
3
+ *
4
+ * 2: {@link SandboxSession.fence} proves the fence before anything runs
5
+ * (docs/adr/2026-11-09-sandbox-fence-proof.md).
6
+ * 3: `SandboxCheck.reason` says why the sandbox can't start, as a listed code
7
+ * (docs/adr/2026-11-09-sandbox-check-reason-codes.md).
8
+ * 4: {@link SandboxNetwork.bridge} may be `null`: a session with no network
9
+ * but its listed sites (docs/adr/2026-11-10-sandbox-optional-bridge.md).
10
+ * 5: strength `none` and the fence proof `off`, for the launcher that starts
11
+ * programs without a fence (docs/adr/2026-11-11-sandbox-without-fence.md).
12
+ * 6: reason codes for setup, WSL, company policy and sign-in, and `windows`
13
+ * narrowed to a backend with no Windows mode
14
+ * (docs/adr/2026-11-11-pluggable-sandbox-layer.md).
15
+ * 7: {@link SandboxNetwork.bridge} says its kind: a loopback port, or a name
16
+ * the sandbox's proxy serves on a Unix socket
17
+ * (docs/adr/2026-11-11-sandbox-bridge-on-a-socket.md).
18
+ */
19
+ export declare const sandboxVersion = 7;
20
+ /**
21
+ * How files reach the sandbox. `shared`: the program sees the same folders as
22
+ * Halonic, so nothing is copied (a sandbox on this computer). `copied`: the
23
+ * sandbox has its own file system, and the adapter syncs the working folder
24
+ * in before a run and out after it (a VM or Halonic Cloud).
25
+ */
26
+ export type SandboxFileAccess = "shared" | "copied";
27
+ /**
28
+ * How strong the fence is. `os`: the operating system confines the program
29
+ * (kernel escapes are not covered). `vm`: a micro-VM, with its own kernel.
30
+ * `remote`: another machine. `none`: no fence at all, only the launcher
31
+ * (`sandbox-host`), for runs the user confirmed without the sandbox.
32
+ */
33
+ export type SandboxStrength = "os" | "vm" | "remote" | "none";
34
+ /** What a sandbox adapter can do. */
35
+ export interface SandboxCapabilities {
36
+ /** How files reach the sandbox. */
37
+ files: SandboxFileAccess;
38
+ /** How strong the fence is. */
39
+ strength: SandboxStrength;
40
+ }
41
+ /**
42
+ * Every reason a sandbox can't start on this machine. The list is closed: an
43
+ * adapter returns only these, and a new reason is a port change. Studio and
44
+ * the CLI turn each one into the words a person reads and the fix; the
45
+ * adapter never words it.
46
+ *
47
+ * - `windows`: this backend has no Windows mode, so it can't run on Windows at all.
48
+ * - `container`: Halonic itself runs inside a container (such as Docker), which won't nest the fence.
49
+ * - `not-supported`: this edition or build of the operating system can't run the backend, such as Windows older than 10 2004.
50
+ * - `blocked-by-policy`: a company policy blocks the backend, such as a WSL group policy or Docker's admin settings.
51
+ * - `virtualisation-off`: hardware virtualisation is off, or a VM has no nested virtualisation.
52
+ * - `wsl-missing`: WSL isn't installed, which needs an administrator.
53
+ * - `restart-needed`: WSL is installed, but Windows must restart first.
54
+ * - `distro-missing`: WSL works, but Halonic's own distro isn't imported (no administrator needed).
55
+ * - `setup-conflict`: the machine-wide setup belongs to another program, or is set up another way.
56
+ * - `setup-needed`: the one-time administrator setup isn't done, or was done by another release of the backend.
57
+ * - `user-namespaces-restricted`: the system doesn't let programs create user namespaces, as Ubuntu 24.04 does by default.
58
+ * - `bubblewrap-missing`: bubblewrap (`bwrap`) is not installed.
59
+ * - `linux-tools-missing`: `socat` or ripgrep (`rg`), which srt starts next to bubblewrap, is not installed.
60
+ * - `ripgrep-missing`: ripgrep (`rg`), which srt starts next to Seatbelt on macOS, is not installed.
61
+ * - `sign-in-needed`: the backend needs an account sign-in.
62
+ * - `other`: none of the above; `SandboxCheck.missing` says what.
63
+ *
64
+ * The order is the order of the fixes: what Halonic can't fix comes before
65
+ * what an administrator can, and that before what the person can do in one
66
+ * step.
67
+ */
68
+ export declare const sandboxUnavailableReasons: readonly ["windows", "container", "not-supported", "blocked-by-policy", "virtualisation-off", "wsl-missing", "restart-needed", "distro-missing", "setup-conflict", "setup-needed", "user-namespaces-restricted", "bubblewrap-missing", "linux-tools-missing", "ripgrep-missing", "sign-in-needed", "other"];
69
+ /** Why a sandbox can't start on this machine: one of {@link sandboxUnavailableReasons}. */
70
+ export type SandboxUnavailableReason = (typeof sandboxUnavailableReasons)[number];
71
+ /**
72
+ * Whether a sandbox works on this machine. `ok` is true when
73
+ * {@link Sandbox.open} can be expected to work; then there is no reason and
74
+ * nothing missing. Otherwise:
75
+ *
76
+ * - `reason` says why it can't start (since version 3). When more than one
77
+ * reason applies, the first in {@link sandboxUnavailableReasons}, because
78
+ * its fix comes first.
79
+ * - `missing` says what is missing, one plain sentence each, such as
80
+ * "bubblewrap is not installed". For logs and support, not for people:
81
+ * Studio words the refusal from `reason`.
82
+ * - `fix`, when set, is what fixes it on this machine, as data (since
83
+ * HAL-5393; optional, so the port stays at its version). See {@link SandboxFix}.
84
+ */
85
+ export type SandboxCheck = {
86
+ ok: true;
87
+ reason: null;
88
+ missing: [];
89
+ } | {
90
+ ok: false;
91
+ reason: SandboxUnavailableReason;
92
+ missing: string[];
93
+ fix?: SandboxFix;
94
+ };
95
+ /**
96
+ * Every package manager a {@link SandboxFix} can name: `apt` (Debian,
97
+ * Ubuntu), `dnf` (Fedora), `pacman` (Arch), `zypper` (openSUSE) and `brew`
98
+ * (Homebrew on macOS). The list is closed, and a new one is a port change.
99
+ */
100
+ export declare const sandboxPackageManagers: readonly ["apt", "dnf", "pacman", "zypper", "brew"];
101
+ /** A package manager a {@link SandboxFix} can name: one of {@link sandboxPackageManagers}. */
102
+ export type SandboxPackageManager = (typeof sandboxPackageManagers)[number];
103
+ /**
104
+ * What fixes a refused {@link SandboxCheck} on this machine, as data and
105
+ * never as words or a command line: Studio and the CLI word it. It is advice
106
+ * to show the person. No caller runs it or asks for administrator rights on
107
+ * its own; offering to run it is a new flow that needs the board's approval
108
+ * (docs/adr/2026-11-12-sandbox-check-fix-data.md).
109
+ *
110
+ * - `install`: install every package in `packages` with `packageManager`,
111
+ * as one command. `packageManager` is `null` when the machine has none
112
+ * that Halonic knows; then Studio names the packages only.
113
+ * - `apparmor-profile`: write `profile` to `path` and load it, which lets
114
+ * `program`, and only it, create user namespaces. The machine-wide setting
115
+ * stays on.
116
+ */
117
+ export type SandboxFix = {
118
+ kind: "install";
119
+ packageManager: SandboxPackageManager | null;
120
+ packages: string[];
121
+ } | {
122
+ kind: "apparmor-profile";
123
+ program: string;
124
+ path: string;
125
+ profile: string;
126
+ };
127
+ /**
128
+ * What a program in the sandbox may reach. Halonic builds it from the
129
+ * person's profile and the trusted workspace, and the agent can't change it.
130
+ * Every path is absolute, in the host's notation.
131
+ *
132
+ * The profile is Halonic's own format, not that of a particular sandbox
133
+ * library, so an adapter for a VM or for Halonic Cloud reads the same one.
134
+ * It is a plain type and not a schema: Halonic builds it in process and never
135
+ * reads it from data, and a port may not import the schema package. An
136
+ * adapter that takes one from outside must check it itself.
137
+ */
138
+ export interface SandboxProfile {
139
+ /** The one folder the program writes to, and where it starts. */
140
+ workingFolder: string;
141
+ /** A private temp folder, writable. A fresh one per session; the adapter doesn't clean it up. */
142
+ tempFolder: string;
143
+ /**
144
+ * The agent's own settings folder inside Halonic's data (such as
145
+ * `CLAUDE_CONFIG_DIR`), writable, never the person's own. `null` when the
146
+ * program needs none.
147
+ */
148
+ settingsFolder: string | null;
149
+ /** Paths the program may read but not change, such as the workspace's definition files. */
150
+ readOnlyPaths: string[];
151
+ /**
152
+ * Paths the program may not read or write, such as SSH keys and Halonic's
153
+ * own data. Wins over every other list, except that a path in
154
+ * {@link reopenedPaths} may be read again.
155
+ */
156
+ deniedPaths: string[];
157
+ /**
158
+ * Paths inside a denied path that the program may read again, such as a
159
+ * run's own folders in Halonic's denied data folder. A writable folder
160
+ * inside a denied path must be listed here too; it stays writable. Each
161
+ * path must exist when the session opens, must lie inside a path of
162
+ * {@link deniedPaths}, and must not hold a writable folder (list the
163
+ * entries around that folder instead). An adapter refuses a profile that
164
+ * breaks one of these rules. Absent means none, so a profile that drops it
165
+ * can only deny more.
166
+ */
167
+ reopenedPaths?: string[] | undefined;
168
+ /**
169
+ * The only environment variables the program gets, by name and value. The
170
+ * host's own environment is never passed on.
171
+ */
172
+ env: Readonly<Record<string, string>>;
173
+ /** The network. Everything not named here is blocked. */
174
+ network: SandboxNetwork;
175
+ /** How long the whole run may last, in milliseconds, counted from {@link Sandbox.open}. */
176
+ timeLimitMs: number;
177
+ /**
178
+ * Whether the program may ask the operating system's key store for a
179
+ * stored secret. `denied` for code nobody reviewed, such as a local
180
+ * integration (attack case A36). Left out, it may, because an agent can
181
+ * keep its own sign-in in the macOS Keychain. With `denied`, the fence on
182
+ * macOS refuses the Keychain's Mach services. On Linux the Secret Service
183
+ * is a D-Bus socket, so hide its folder in {@link deniedPaths}. On Windows
184
+ * no adapter can fence the Credential Manager yet.
185
+ */
186
+ keyStore?: "allowed" | "denied";
187
+ }
188
+ /**
189
+ * Where the program reaches the Halonic bridge.
190
+ *
191
+ * - `loopback`: a port on this computer's loopback, `host` being `127.0.0.1`,
192
+ * `::1` or `localhost`. The program dials it as it is.
193
+ * - `socket`: the bridge serves a Unix socket at `socketPath`, an absolute
194
+ * path, and the program calls it by `name`, a host name that never
195
+ * resolves, such as `bridge.halonic.invalid`. The sandbox's own proxy,
196
+ * outside the fence, sends requests for that name, on port 80 only, to the
197
+ * socket, so no port is open to anything else on the computer. The program
198
+ * never opens the socket itself.
199
+ */
200
+ export type SandboxBridge = {
201
+ kind: "loopback";
202
+ host: string;
203
+ port: number;
204
+ } | {
205
+ kind: "socket";
206
+ name: string;
207
+ socketPath: string;
208
+ };
209
+ /** The network a {@link SandboxProfile} allows. */
210
+ export interface SandboxNetwork {
211
+ /**
212
+ * The Halonic bridge: the one address on this computer the program can
213
+ * reach. An adapter rejects, when {@link Sandbox.open} is called, a
214
+ * `loopback` bridge whose host is not a loopback address, and a bridge kind
215
+ * it can't serve.
216
+ *
217
+ * `null` means no bridge: the program reaches no loopback address at all,
218
+ * only the allowed sites. The integration runner uses it, because it talks
219
+ * to Halonic over its standard input and output, not the network. The field
220
+ * is never optional, so leaving it out can't mean "the whole network".
221
+ */
222
+ bridge: SandboxBridge | null;
223
+ /**
224
+ * Further sites, by host name such as "registry.npmjs.org" or with a
225
+ * leading "*." for every subdomain. Empty by default.
226
+ */
227
+ allowedSites: string[];
228
+ }
229
+ /** What to start in a session. */
230
+ export interface SandboxCommand {
231
+ /** The program, by name or path. */
232
+ program: string;
233
+ /** Its arguments, passed as they are, never through a shell. */
234
+ args: string[];
235
+ /**
236
+ * Where it starts, read against the working folder. Absent means the
237
+ * working folder. It must lie, where it really is through symbolic links,
238
+ * inside the working folder or inside a path of
239
+ * {@link SandboxProfile.readOnlyPaths}, and not inside a path of
240
+ * {@link SandboxProfile.deniedPaths} unless that part is reopened.
241
+ * {@link SandboxSession.start} throws on any other folder (HAL-6884).
242
+ *
243
+ * A folder in a read-only path stays read-only: a workspace connector
244
+ * starts where its script and `node_modules` are, but writes only to the
245
+ * working and temp folders. A program that writes next to its script fails
246
+ * there, such as `uv run` making `.venv`; the caller points it elsewhere,
247
+ * as with `UV_PROJECT_ENVIRONMENT`.
248
+ *
249
+ * The fence's own write rules for tool settings and git hooks in folders
250
+ * nested in the working folder, such as `sub/.claude/`, follow the start
251
+ * folder. Only start outside the working folder when that working folder
252
+ * is thrown away when the session closes, as a connector's own is.
253
+ */
254
+ cwd?: string;
255
+ }
256
+ /** How a started program ended. */
257
+ export interface SandboxExit {
258
+ /**
259
+ * The exit code, or `null` when a signal ended it. A program the fence can't
260
+ * find or run ends with a non-zero code, not `null`.
261
+ */
262
+ code: number | null;
263
+ /** The signal that ended it, such as "SIGKILL", or `null`. */
264
+ signal: string | null;
265
+ /** Why: it finished by itself, it was stopped (`kill`, `close`, cancel), or the time limit ran out. */
266
+ reason: "exited" | "stopped" | "timeout";
267
+ }
268
+ /** A program a session started. */
269
+ export interface SandboxProcess {
270
+ /** Writes to the program's standard input. Close it to end the input. */
271
+ stdin: WritableStream<Uint8Array>;
272
+ /** The program's standard output, as bytes. */
273
+ stdout: ReadableStream<Uint8Array>;
274
+ /** The program's standard error, as bytes. */
275
+ stderr: ReadableStream<Uint8Array>;
276
+ /** Settles when the program and everything it started has ended. Never rejects. */
277
+ exited: Promise<SandboxExit>;
278
+ /** Stops the program and everything it started. Safe to call twice. */
279
+ kill(): Promise<void>;
280
+ }
281
+ /** An access the sandbox refused. It becomes the run's `sandbox.blocked` event. */
282
+ export type SandboxBlock = {
283
+ kind: "file";
284
+ path: string;
285
+ access: "read" | "write";
286
+ } | {
287
+ kind: "network";
288
+ host: string;
289
+ port: number | null;
290
+ };
291
+ /** Hears the session's blocked accesses. */
292
+ export type SandboxBlockListener = (block: SandboxBlock) => void;
293
+ /**
294
+ * Whether the fence is really around the session. Before a session starts any
295
+ * program, the adapter runs its own probes (a file the fence hides, and a
296
+ * loopback port the fence blocks) and reports what it found.
297
+ *
298
+ * `fenced`: the probes were refused, so programs run inside the fence.
299
+ * `not-fenced`: a probe got through, or could not run; `reason` says which, in
300
+ * one plain sentence, and {@link SandboxSession.start} throws.
301
+ * `off`: the adapter has no fence by design (strength `none`), so there is
302
+ * nothing to prove and programs start without one. Only the launcher reports
303
+ * it; a fenced adapter whose fence fails reports `not-fenced`, never `off`.
304
+ * `stopped`: the session is closed.
305
+ */
306
+ export type SandboxFence = {
307
+ state: "fenced";
308
+ } | {
309
+ state: "not-fenced";
310
+ reason: string;
311
+ } | {
312
+ state: "off";
313
+ } | {
314
+ state: "stopped";
315
+ };
316
+ /** One run's sandbox: the programs it started, the fence they are in and the time limit. */
317
+ export interface SandboxSession {
318
+ /** The profile the session was opened with. */
319
+ readonly profile: SandboxProfile;
320
+ /**
321
+ * The fence proof. It is settled before {@link Sandbox.open} returns, so no
322
+ * untrusted code has loaded when it is read, and it becomes `stopped` after
323
+ * {@link SandboxSession.close}.
324
+ */
325
+ readonly fence: SandboxFence;
326
+ /**
327
+ * Starts a program inside the fence.
328
+ *
329
+ * @throws when the session is closed, the fence proof is `not-fenced`, or the sandbox can't launch anything.
330
+ * A program that is missing inside the fence doesn't throw: it ends with a
331
+ * non-zero {@link SandboxExit.code}.
332
+ */
333
+ start(command: SandboxCommand): Promise<SandboxProcess>;
334
+ /** Reports each blocked access from now on. Returns a function that stops the reports. */
335
+ onBlocked(listener: SandboxBlockListener): () => void;
336
+ /**
337
+ * Stops every program the session started, and everything they started, and
338
+ * resolves when they have ended. The session does this by itself when the
339
+ * time limit runs out or the signal given to {@link Sandbox.open} aborts.
340
+ * Safe to call twice.
341
+ */
342
+ close(): Promise<void>;
343
+ }
344
+ /** Runs programs inside a fence: a sandbox on this computer today, a VM or Halonic Cloud later. */
345
+ export interface Sandbox {
346
+ /**
347
+ * Whether it works on this machine, and if not, why and what is missing.
348
+ * Never throws. When it isn't `ok`, Halonic doesn't run the step: it never
349
+ * falls back to running a program without the fence by itself. Only the
350
+ * user's saved yes for that reason sends a start to the launcher instead.
351
+ */
352
+ check(): Promise<SandboxCheck>;
353
+ /** How files reach it and how strong the fence is. */
354
+ capabilities(): SandboxCapabilities;
355
+ /**
356
+ * Opens a session for one run. Cancelling the run, by aborting `signal`,
357
+ * closes the session.
358
+ *
359
+ * @throws when the sandbox doesn't work here (see {@link Sandbox.check}) or the profile can't be applied, including a loopback bridge whose host is not a loopback address, or a bridge kind it can't serve
360
+ */
361
+ open(profile: SandboxProfile, options?: {
362
+ signal?: AbortSignal;
363
+ }): Promise<SandboxSession>;
364
+ }