@halonicjs/testing 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (384) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +1 -0
  3. package/README.md +40 -2
  4. package/dist/adapters/http-kit/src/address-class.d.ts +34 -0
  5. package/dist/adapters/http-kit/src/address-class.js +109 -0
  6. package/dist/adapters/http-kit/src/index.d.ts +2 -0
  7. package/dist/adapters/http-kit/src/index.js +2 -0
  8. package/dist/adapters/http-kit/src/ip-address.d.ts +23 -0
  9. package/dist/adapters/http-kit/src/ip-address.js +89 -0
  10. package/dist/adapters/integration-kit/src/declaration.d.ts +14 -0
  11. package/dist/adapters/integration-kit/src/declaration.js +77 -0
  12. package/dist/adapters/integration-kit/src/host.d.ts +28 -0
  13. package/dist/adapters/integration-kit/src/host.js +30 -0
  14. package/dist/adapters/integration-kit/src/index.d.ts +14 -0
  15. package/dist/adapters/integration-kit/src/index.js +21 -0
  16. package/dist/adapters/integration-kit/src/leak-attempt.d.ts +14 -0
  17. package/dist/adapters/integration-kit/src/leak-attempt.js +16 -0
  18. package/dist/adapters/integration-kit/src/limited-http.d.ts +49 -0
  19. package/dist/adapters/integration-kit/src/limited-http.js +182 -0
  20. package/dist/adapters/integration-kit/src/load-problem.d.ts +20 -0
  21. package/dist/adapters/integration-kit/src/load-problem.js +1 -0
  22. package/dist/adapters/integration-kit/src/loader.d.ts +104 -0
  23. package/dist/adapters/integration-kit/src/loader.js +219 -0
  24. package/dist/adapters/integration-kit/src/local-address.d.ts +15 -0
  25. package/dist/adapters/integration-kit/src/local-address.js +25 -0
  26. package/dist/adapters/integration-kit/src/own-request.d.ts +33 -0
  27. package/dist/adapters/integration-kit/src/own-request.js +36 -0
  28. package/dist/adapters/integration-kit/src/plugin-load.d.ts +14 -0
  29. package/dist/adapters/integration-kit/src/plugin-load.js +58 -0
  30. package/dist/adapters/integration-kit/src/policy.d.ts +55 -0
  31. package/dist/adapters/integration-kit/src/policy.js +37 -0
  32. package/dist/adapters/integration-kit/src/request-body.d.ts +38 -0
  33. package/dist/adapters/integration-kit/src/request-body.js +68 -0
  34. package/dist/adapters/integration-kit/src/request-log.d.ts +25 -0
  35. package/dist/adapters/integration-kit/src/request-log.js +17 -0
  36. package/dist/adapters/integration-kit/src/response-body.d.ts +23 -0
  37. package/dist/adapters/integration-kit/src/response-body.js +117 -0
  38. package/dist/adapters/integration-kit/src/scoped-tokens.d.ts +14 -0
  39. package/dist/adapters/integration-kit/src/scoped-tokens.js +27 -0
  40. package/dist/adapters/integration-kit/src/secret-filter.d.ts +84 -0
  41. package/dist/adapters/integration-kit/src/secret-filter.js +205 -0
  42. package/dist/adapters/integration-kit/src/secret-in-request.d.ts +59 -0
  43. package/dist/adapters/integration-kit/src/secret-in-request.js +133 -0
  44. package/dist/adapters/integration-kit/src/secret-placement.d.ts +36 -0
  45. package/dist/adapters/integration-kit/src/secret-placement.js +190 -0
  46. package/dist/adapters/integration-kit/src/wait.d.ts +16 -0
  47. package/dist/adapters/integration-kit/src/wait.js +35 -0
  48. package/dist/core/events/src/add-usage.d.ts +10 -0
  49. package/dist/core/events/src/add-usage.js +27 -0
  50. package/dist/core/events/src/agent-resume.d.ts +24 -0
  51. package/dist/core/events/src/agent-resume.js +1 -0
  52. package/dist/core/events/src/home-path.d.ts +13 -0
  53. package/dist/core/events/src/home-path.js +26 -0
  54. package/dist/core/events/src/index.d.ts +13 -0
  55. package/dist/core/events/src/index.js +7 -0
  56. package/dist/core/events/src/run-basics.d.ts +205 -0
  57. package/dist/core/events/src/run-basics.js +1 -0
  58. package/dist/core/events/src/run-event.d.ts +434 -0
  59. package/dist/core/events/src/run-event.js +1 -0
  60. package/dist/core/events/src/run-summary.d.ts +108 -0
  61. package/dist/core/events/src/run-summary.js +1 -0
  62. package/dist/core/events/src/sandbox-blocked.d.ts +42 -0
  63. package/dist/core/events/src/sandbox-blocked.js +26 -0
  64. package/dist/core/events/src/sandbox-opened-read.d.ts +17 -0
  65. package/dist/core/events/src/sandbox-opened-read.js +63 -0
  66. package/dist/core/events/src/sandbox-opened.d.ts +94 -0
  67. package/dist/core/events/src/sandbox-opened.js +52 -0
  68. package/dist/core/events/src/summarize.d.ts +14 -0
  69. package/dist/core/events/src/summarize.js +188 -0
  70. package/dist/core/events/src/timeline-entry.d.ts +21 -0
  71. package/dist/core/events/src/timeline-entry.js +105 -0
  72. package/dist/core/events/src/upgrade.d.ts +23 -0
  73. package/dist/core/events/src/upgrade.js +49 -0
  74. package/dist/core/format/src/compact.d.ts +30 -0
  75. package/dist/core/format/src/compact.js +72 -0
  76. package/dist/core/format/src/index.d.ts +37 -0
  77. package/dist/core/format/src/index.js +23 -0
  78. package/dist/core/format/src/integration/index.d.ts +6 -0
  79. package/dist/core/format/src/integration/index.js +9 -0
  80. package/dist/core/format/src/json-schema.d.ts +26 -0
  81. package/dist/core/format/src/json-schema.js +48 -0
  82. package/dist/core/format/src/kind.d.ts +65 -0
  83. package/dist/core/format/src/kind.js +1 -0
  84. package/dist/core/format/src/kinds/agent/kind.d.ts +4 -0
  85. package/dist/core/format/src/kinds/agent/kind.js +10 -0
  86. package/dist/core/format/src/kinds/agent/sandbox-fields.d.ts +89 -0
  87. package/dist/core/format/src/kinds/agent/sandbox-fields.js +197 -0
  88. package/dist/core/format/src/kinds/agent/schema.d.ts +147 -0
  89. package/dist/core/format/src/kinds/agent/schema.js +107 -0
  90. package/dist/core/format/src/kinds/agent/working-folder-start.d.ts +74 -0
  91. package/dist/core/format/src/kinds/agent/working-folder-start.js +312 -0
  92. package/dist/core/format/src/kinds/collection/kind.d.ts +8 -0
  93. package/dist/core/format/src/kinds/collection/kind.js +14 -0
  94. package/dist/core/format/src/kinds/collection/schema.d.ts +89 -0
  95. package/dist/core/format/src/kinds/collection/schema.js +90 -0
  96. package/dist/core/format/src/kinds/connector/is-local.d.ts +10 -0
  97. package/dist/core/format/src/kinds/connector/is-local.js +43 -0
  98. package/dist/core/format/src/kinds/connector/kind.d.ts +4 -0
  99. package/dist/core/format/src/kinds/connector/kind.js +119 -0
  100. package/dist/core/format/src/kinds/connector/schema.d.ts +50 -0
  101. package/dist/core/format/src/kinds/connector/schema.js +92 -0
  102. package/dist/core/format/src/kinds/deployments/kind.d.ts +4 -0
  103. package/dist/core/format/src/kinds/deployments/kind.js +25 -0
  104. package/dist/core/format/src/kinds/deployments/schema.d.ts +37 -0
  105. package/dist/core/format/src/kinds/deployments/schema.js +42 -0
  106. package/dist/core/format/src/kinds/hub/kind.d.ts +4 -0
  107. package/dist/core/format/src/kinds/hub/kind.js +10 -0
  108. package/dist/core/format/src/kinds/hub/schema.d.ts +54 -0
  109. package/dist/core/format/src/kinds/hub/schema.js +34 -0
  110. package/dist/core/format/src/kinds/integration/kind.d.ts +16 -0
  111. package/dist/core/format/src/kinds/integration/kind.js +138 -0
  112. package/dist/core/format/src/kinds/integration/parse-sheet.d.ts +19 -0
  113. package/dist/core/format/src/kinds/integration/parse-sheet.js +24 -0
  114. package/dist/core/format/src/kinds/integration/policy.d.ts +67 -0
  115. package/dist/core/format/src/kinds/integration/policy.js +268 -0
  116. package/dist/core/format/src/kinds/integration/schema.d.ts +233 -0
  117. package/dist/core/format/src/kinds/integration/schema.js +233 -0
  118. package/dist/core/format/src/kinds/knowledge/kind.d.ts +4 -0
  119. package/dist/core/format/src/kinds/knowledge/kind.js +13 -0
  120. package/dist/core/format/src/kinds/knowledge/schema.d.ts +18 -0
  121. package/dist/core/format/src/kinds/knowledge/schema.js +25 -0
  122. package/dist/core/format/src/kinds/models/kind.d.ts +4 -0
  123. package/dist/core/format/src/kinds/models/kind.js +10 -0
  124. package/dist/core/format/src/kinds/models/schema.d.ts +92 -0
  125. package/dist/core/format/src/kinds/models/schema.js +38 -0
  126. package/dist/core/format/src/kinds/plugin/backend.d.ts +22 -0
  127. package/dist/core/format/src/kinds/plugin/backend.js +31 -0
  128. package/dist/core/format/src/kinds/plugin/checks.d.ts +13 -0
  129. package/dist/core/format/src/kinds/plugin/checks.js +131 -0
  130. package/dist/core/format/src/kinds/plugin/kind.d.ts +8 -0
  131. package/dist/core/format/src/kinds/plugin/kind.js +16 -0
  132. package/dist/core/format/src/kinds/plugin/problems.d.ts +24 -0
  133. package/dist/core/format/src/kinds/plugin/problems.js +65 -0
  134. package/dist/core/format/src/kinds/plugin/schema.d.ts +542 -0
  135. package/dist/core/format/src/kinds/plugin/schema.js +261 -0
  136. package/dist/core/format/src/kinds/plugin/setting-values.d.ts +17 -0
  137. package/dist/core/format/src/kinds/plugin/setting-values.js +38 -0
  138. package/dist/core/format/src/kinds/plugin/ui-checks.d.ts +8 -0
  139. package/dist/core/format/src/kinds/plugin/ui-checks.js +94 -0
  140. package/dist/core/format/src/kinds/provider/kind.d.ts +4 -0
  141. package/dist/core/format/src/kinds/provider/kind.js +24 -0
  142. package/dist/core/format/src/kinds/provider/schema.d.ts +17 -0
  143. package/dist/core/format/src/kinds/provider/schema.js +22 -0
  144. package/dist/core/format/src/kinds/routine/kind.d.ts +8 -0
  145. package/dist/core/format/src/kinds/routine/kind.js +25 -0
  146. package/dist/core/format/src/kinds/routine/schema.d.ts +84 -0
  147. package/dist/core/format/src/kinds/routine/schema.js +93 -0
  148. package/dist/core/format/src/kinds/runtime/kind.d.ts +4 -0
  149. package/dist/core/format/src/kinds/runtime/kind.js +13 -0
  150. package/dist/core/format/src/kinds/runtime/schema.d.ts +10 -0
  151. package/dist/core/format/src/kinds/runtime/schema.js +12 -0
  152. package/dist/core/format/src/kinds/skill/kind.d.ts +4 -0
  153. package/dist/core/format/src/kinds/skill/kind.js +10 -0
  154. package/dist/core/format/src/kinds/skill/schema.d.ts +17 -0
  155. package/dist/core/format/src/kinds/skill/schema.js +17 -0
  156. package/dist/core/format/src/kinds/skill/scripts-folder.d.ts +27 -0
  157. package/dist/core/format/src/kinds/skill/scripts-folder.js +37 -0
  158. package/dist/core/format/src/kinds/workflow/kind.d.ts +8 -0
  159. package/dist/core/format/src/kinds/workflow/kind.js +14 -0
  160. package/dist/core/format/src/kinds/workflow/schema.d.ts +162 -0
  161. package/dist/core/format/src/kinds/workflow/schema.js +106 -0
  162. package/dist/core/format/src/kinds/workflow-test/kind.d.ts +4 -0
  163. package/dist/core/format/src/kinds/workflow-test/kind.js +14 -0
  164. package/dist/core/format/src/kinds/workflow-test/schema.d.ts +67 -0
  165. package/dist/core/format/src/kinds/workflow-test/schema.js +59 -0
  166. package/dist/core/format/src/kinds/workspace/kind.d.ts +4 -0
  167. package/dist/core/format/src/kinds/workspace/kind.js +10 -0
  168. package/dist/core/format/src/kinds/workspace/schema.d.ts +72 -0
  169. package/dist/core/format/src/kinds/workspace/schema.js +66 -0
  170. package/dist/core/format/src/parse-file.d.ts +69 -0
  171. package/dist/core/format/src/parse-file.js +105 -0
  172. package/dist/core/format/src/recording/format.d.ts +81 -0
  173. package/dist/core/format/src/recording/format.js +102 -0
  174. package/dist/core/format/src/recording/index.d.ts +1 -0
  175. package/dist/core/format/src/recording/index.js +3 -0
  176. package/dist/core/format/src/registry.d.ts +64 -0
  177. package/dist/core/format/src/registry.js +61 -0
  178. package/dist/core/format/src/reserved.d.ts +20 -0
  179. package/dist/core/format/src/reserved.js +30 -0
  180. package/dist/core/format/src/shared/fields.d.ts +37 -0
  181. package/dist/core/format/src/shared/fields.js +54 -0
  182. package/dist/core/format/src/shared/guard.d.ts +32 -0
  183. package/dist/core/format/src/shared/guard.js +16 -0
  184. package/dist/core/format/src/shared/key-in-value.d.ts +28 -0
  185. package/dist/core/format/src/shared/key-in-value.js +82 -0
  186. package/dist/core/format/src/shared/legacy-keys.d.ts +8 -0
  187. package/dist/core/format/src/shared/legacy-keys.js +17 -0
  188. package/dist/core/format/src/shared/program-start.d.ts +60 -0
  189. package/dist/core/format/src/shared/program-start.js +99 -0
  190. package/dist/core/format/src/shared/relative-path.d.ts +29 -0
  191. package/dist/core/format/src/shared/relative-path.js +50 -0
  192. package/dist/core/format/src/shared/secret-name.d.ts +24 -0
  193. package/dist/core/format/src/shared/secret-name.js +107 -0
  194. package/dist/core/format/src/source.d.ts +16 -0
  195. package/dist/core/format/src/source.js +73 -0
  196. package/dist/core/ports/src/agent-placement-store.d.ts +74 -0
  197. package/dist/core/ports/src/agent-placement-store.js +27 -0
  198. package/dist/core/ports/src/blob-store.d.ts +33 -0
  199. package/dist/core/ports/src/blob-store.js +2 -0
  200. package/dist/core/ports/src/cant-try-error.d.ts +35 -0
  201. package/dist/core/ports/src/cant-try-error.js +44 -0
  202. package/dist/core/ports/src/chat.d.ts +127 -0
  203. package/dist/core/ports/src/chat.js +1 -0
  204. package/dist/core/ports/src/clock.d.ts +7 -0
  205. package/dist/core/ports/src/clock.js +2 -0
  206. package/dist/core/ports/src/connection-settings-store.d.ts +57 -0
  207. package/dist/core/ports/src/connection-settings-store.js +2 -0
  208. package/dist/core/ports/src/connector-client.d.ts +259 -0
  209. package/dist/core/ports/src/connector-client.js +2 -0
  210. package/dist/core/ports/src/coordination.d.ts +84 -0
  211. package/dist/core/ports/src/coordination.js +2 -0
  212. package/dist/core/ports/src/definition-store.d.ts +208 -0
  213. package/dist/core/ports/src/definition-store.js +122 -0
  214. package/dist/core/ports/src/digest.d.ts +14 -0
  215. package/dist/core/ports/src/digest.js +2 -0
  216. package/dist/core/ports/src/folder-reader.d.ts +89 -0
  217. package/dist/core/ports/src/folder-reader.js +2 -0
  218. package/dist/core/ports/src/harness-bridge-server.d.ts +189 -0
  219. package/dist/core/ports/src/harness-bridge-server.js +37 -0
  220. package/dist/core/ports/src/harness.d.ts +250 -0
  221. package/dist/core/ports/src/harness.js +45 -0
  222. package/dist/core/ports/src/http-client.d.ts +27 -0
  223. package/dist/core/ports/src/http-client.js +2 -0
  224. package/dist/core/ports/src/id-generator.d.ts +14 -0
  225. package/dist/core/ports/src/id-generator.js +2 -0
  226. package/dist/core/ports/src/index.d.ts +37 -0
  227. package/dist/core/ports/src/index.js +36 -0
  228. package/dist/core/ports/src/integration.d.ts +178 -0
  229. package/dist/core/ports/src/integration.js +13 -0
  230. package/dist/core/ports/src/knowledge-provider.d.ts +65 -0
  231. package/dist/core/ports/src/knowledge-provider.js +2 -0
  232. package/dist/core/ports/src/llm-cache.d.ts +13 -0
  233. package/dist/core/ports/src/llm-cache.js +2 -0
  234. package/dist/core/ports/src/llm-provider.d.ts +184 -0
  235. package/dist/core/ports/src/llm-provider.js +136 -0
  236. package/dist/core/ports/src/model-price.d.ts +34 -0
  237. package/dist/core/ports/src/model-price.js +25 -0
  238. package/dist/core/ports/src/password-hasher.d.ts +47 -0
  239. package/dist/core/ports/src/password-hasher.js +2 -0
  240. package/dist/core/ports/src/plugin-folder-writer.d.ts +104 -0
  241. package/dist/core/ports/src/plugin-folder-writer.js +95 -0
  242. package/dist/core/ports/src/port-versions.d.ts +44 -0
  243. package/dist/core/ports/src/port-versions.js +74 -0
  244. package/dist/core/ports/src/program-probe.d.ts +46 -0
  245. package/dist/core/ports/src/program-probe.js +2 -0
  246. package/dist/core/ports/src/record-store.d.ts +62 -0
  247. package/dist/core/ports/src/record-store.js +38 -0
  248. package/dist/core/ports/src/resource-probe.d.ts +59 -0
  249. package/dist/core/ports/src/resource-probe.js +2 -0
  250. package/dist/core/ports/src/run-executor.d.ts +302 -0
  251. package/dist/core/ports/src/run-executor.js +2 -0
  252. package/dist/core/ports/src/run-failure-error.d.ts +49 -0
  253. package/dist/core/ports/src/run-failure-error.js +47 -0
  254. package/dist/core/ports/src/run-store.d.ts +194 -0
  255. package/dist/core/ports/src/run-store.js +131 -0
  256. package/dist/core/ports/src/sandbox.d.ts +247 -0
  257. package/dist/core/ports/src/sandbox.js +34 -0
  258. package/dist/core/ports/src/scheduler.d.ts +85 -0
  259. package/dist/core/ports/src/scheduler.js +2 -0
  260. package/dist/core/ports/src/secrets.d.ts +128 -0
  261. package/dist/core/ports/src/secrets.js +144 -0
  262. package/dist/core/ports/src/token-store.d.ts +19 -0
  263. package/dist/core/ports/src/token-store.js +2 -0
  264. package/dist/core/ports/src/tool-approval-store.d.ts +211 -0
  265. package/dist/core/ports/src/tool-approval-store.js +57 -0
  266. package/dist/core/ports/src/trust-store.d.ts +72 -0
  267. package/dist/core/ports/src/trust-store.js +2 -0
  268. package/dist/core/ports/src/unfenced-run-consent-store.d.ts +43 -0
  269. package/dist/core/ports/src/unfenced-run-consent-store.js +2 -0
  270. package/dist/core/ports/src/vcs.d.ts +394 -0
  271. package/dist/core/ports/src/vcs.js +48 -0
  272. package/dist/core/schema-kit/src/builders.d.ts +50 -0
  273. package/dist/core/schema-kit/src/builders.js +72 -0
  274. package/dist/core/schema-kit/src/depth.d.ts +15 -0
  275. package/dist/core/schema-kit/src/depth.js +37 -0
  276. package/dist/core/schema-kit/src/index.d.ts +6 -0
  277. package/dist/core/schema-kit/src/index.js +6 -0
  278. package/dist/core/schema-kit/src/issue.d.ts +22 -0
  279. package/dist/core/schema-kit/src/issue.js +23 -0
  280. package/dist/core/schema-kit/src/json-schema.d.ts +23 -0
  281. package/dist/core/schema-kit/src/json-schema.js +22 -0
  282. package/dist/core/schema-kit/src/parse.d.ts +17 -0
  283. package/dist/core/schema-kit/src/parse.js +25 -0
  284. package/dist/core/schema-kit/src/schema.d.ts +12 -0
  285. package/dist/core/schema-kit/src/schema.js +1 -0
  286. package/dist/core/std/src/ascii-host.d.ts +18 -0
  287. package/dist/core/std/src/ascii-host.js +110 -0
  288. package/dist/core/std/src/assert.d.ts +39 -0
  289. package/dist/core/std/src/assert.js +59 -0
  290. package/dist/core/std/src/base64url.d.ts +23 -0
  291. package/dist/core/std/src/base64url.js +65 -0
  292. package/dist/core/std/src/canonical-json.d.ts +18 -0
  293. package/dist/core/std/src/canonical-json.js +56 -0
  294. package/dist/core/std/src/clock.d.ts +27 -0
  295. package/dist/core/std/src/clock.js +33 -0
  296. package/dist/core/std/src/constant-time.d.ts +16 -0
  297. package/dist/core/std/src/constant-time.js +26 -0
  298. package/dist/core/std/src/content-digest.d.ts +24 -0
  299. package/dist/core/std/src/content-digest.js +28 -0
  300. package/dist/core/std/src/deep-clone.d.ts +15 -0
  301. package/dist/core/std/src/deep-clone.js +59 -0
  302. package/dist/core/std/src/deep-equal.d.ts +23 -0
  303. package/dist/core/std/src/deep-equal.js +64 -0
  304. package/dist/core/std/src/emitter.d.ts +42 -0
  305. package/dist/core/std/src/emitter.js +74 -0
  306. package/dist/core/std/src/error-kind.d.ts +88 -0
  307. package/dist/core/std/src/error-kind.js +98 -0
  308. package/dist/core/std/src/hex.d.ts +10 -0
  309. package/dist/core/std/src/hex.js +16 -0
  310. package/dist/core/std/src/ids.d.ts +45 -0
  311. package/dist/core/std/src/ids.js +49 -0
  312. package/dist/core/std/src/index.d.ts +25 -0
  313. package/dist/core/std/src/index.js +26 -0
  314. package/dist/core/std/src/keyed-queue.d.ts +18 -0
  315. package/dist/core/std/src/keyed-queue.js +32 -0
  316. package/dist/core/std/src/line-diff.d.ts +83 -0
  317. package/dist/core/std/src/line-diff.js +179 -0
  318. package/dist/core/std/src/line-merge.d.ts +63 -0
  319. package/dist/core/std/src/line-merge.js +138 -0
  320. package/dist/core/std/src/plain-data.d.ts +32 -0
  321. package/dist/core/std/src/plain-data.js +57 -0
  322. package/dist/core/std/src/posix-path.d.ts +61 -0
  323. package/dist/core/std/src/posix-path.js +121 -0
  324. package/dist/core/std/src/result.d.ts +55 -0
  325. package/dist/core/std/src/result.js +52 -0
  326. package/dist/core/std/src/secret-scrubber.d.ts +54 -0
  327. package/dist/core/std/src/secret-scrubber.js +124 -0
  328. package/dist/core/std/src/secret-shape.d.ts +20 -0
  329. package/dist/core/std/src/secret-shape.js +53 -0
  330. package/dist/core/std/src/stop-signal.d.ts +44 -0
  331. package/dist/core/std/src/stop-signal.js +77 -0
  332. package/dist/core/std/src/text.d.ts +28 -0
  333. package/dist/core/std/src/text.js +54 -0
  334. package/dist/core/std/src/utf8.d.ts +23 -0
  335. package/dist/core/std/src/utf8.js +110 -0
  336. package/dist/core/std/src/version.d.ts +48 -0
  337. package/dist/core/std/src/version.js +103 -0
  338. package/dist/core/yaml/src/depth.d.ts +14 -0
  339. package/dist/core/yaml/src/depth.js +140 -0
  340. package/dist/core/yaml/src/edit-data.d.ts +47 -0
  341. package/dist/core/yaml/src/edit-data.js +286 -0
  342. package/dist/core/yaml/src/edit-text.d.ts +92 -0
  343. package/dist/core/yaml/src/edit-text.js +267 -0
  344. package/dist/core/yaml/src/edit.d.ts +47 -0
  345. package/dist/core/yaml/src/edit.js +198 -0
  346. package/dist/core/yaml/src/index.d.ts +5 -0
  347. package/dist/core/yaml/src/index.js +4 -0
  348. package/dist/core/yaml/src/problem.d.ts +20 -0
  349. package/dist/core/yaml/src/problem.js +1 -0
  350. package/dist/core/yaml/src/read.d.ts +47 -0
  351. package/dist/core/yaml/src/read.js +130 -0
  352. package/dist/core/yaml/src/splice-node.d.ts +47 -0
  353. package/dist/core/yaml/src/splice-node.js +333 -0
  354. package/dist/core/yaml/src/splice.d.ts +13 -0
  355. package/dist/core/yaml/src/splice.js +174 -0
  356. package/dist/core/yaml/src/unsupported.d.ts +26 -0
  357. package/dist/core/yaml/src/unsupported.js +70 -0
  358. package/dist/core/yaml/src/write.d.ts +35 -0
  359. package/dist/core/yaml/src/write.js +44 -0
  360. package/dist/testing/integration/src/canaries.d.ts +14 -0
  361. package/dist/testing/integration/src/canaries.js +17 -0
  362. package/dist/testing/integration/src/checks.d.ts +37 -0
  363. package/dist/testing/integration/src/checks.js +195 -0
  364. package/dist/testing/integration/src/describe.d.ts +35 -0
  365. package/dist/testing/integration/src/describe.js +74 -0
  366. package/dist/testing/integration/src/failure.d.ts +6 -0
  367. package/dist/testing/integration/src/failure.js +8 -0
  368. package/dist/testing/integration/src/fake-wait.d.ts +18 -0
  369. package/dist/testing/integration/src/fake-wait.js +21 -0
  370. package/dist/testing/integration/src/index.d.ts +10 -0
  371. package/dist/testing/integration/src/index.js +11 -0
  372. package/dist/testing/integration/src/load.d.ts +14 -0
  373. package/dist/testing/integration/src/load.js +45 -0
  374. package/dist/testing/integration/src/plugin-folder.d.ts +23 -0
  375. package/dist/testing/integration/src/plugin-folder.js +59 -0
  376. package/dist/testing/integration/src/plugin.d.ts +32 -0
  377. package/dist/testing/integration/src/plugin.js +57 -0
  378. package/dist/testing/integration/src/recording.d.ts +84 -0
  379. package/dist/testing/integration/src/recording.js +164 -0
  380. package/dist/testing/integration/src/run.d.ts +60 -0
  381. package/dist/testing/integration/src/run.js +81 -0
  382. package/dist/testing/integration/src/source-scan.d.ts +16 -0
  383. package/dist/testing/integration/src/source-scan.js +40 -0
  384. package/package.json +35 -4
@@ -0,0 +1,72 @@
1
+ import type { ConnectorPin } from "./connector-client.js";
2
+ /** Version of the {@link TrustStore} port. A breaking change bumps it and comes with an ADR. */
3
+ export declare const trustStoreVersion = 1;
4
+ /** How a trust record came to be: the Studio prompt, `halonic trust`, a new workspace Halonic wrote, or the one-time migration. */
5
+ export type TrustOrigin = "prompt" | "cli" | "created" | "migration";
6
+ /**
7
+ * What Halonic keeps when a person trusts a source (a workspace, or a hub
8
+ * or skill folder outside it).
9
+ *
10
+ * @example
11
+ * const record: TrustRecord = {
12
+ * location: "/workspaces/acme",
13
+ * fingerprint: "hfp1:9f86d081884c7d65…",
14
+ * content: { programs: [{ connector: "mail", command: "npx", args: ["-y", "@acme/mail-mcp"] }] },
15
+ * grantedAt: "2026-11-08T10:00:00.000Z",
16
+ * appVersion: "0.1.0",
17
+ * pins: { mail: { registry: "npm", registryUrl: "https://registry.npmjs.org", package: "@acme/mail-mcp", version: "2.3.1" } },
18
+ * origin: "prompt",
19
+ * };
20
+ */
21
+ export interface TrustRecord {
22
+ /** The source's resolved real path. It is the record's key and isn't part of the fingerprint. */
23
+ location: string;
24
+ /** The fingerprint of what the prompt showed, such as "hfp1:9f86d0…". */
25
+ fingerprint: string;
26
+ /** The normalised content the fingerprint was computed from, as JSON, so "what changed" can be shown later. */
27
+ content: unknown;
28
+ /** When the person trusted it, as ISO text. */
29
+ grantedAt: string;
30
+ /** The version of Halonic that wrote the record. */
31
+ appVersion: string;
32
+ /** The pinned version of each package-runner connector (`npx`, `uvx` and so on), by connector id. */
33
+ pins: Record<string, ConnectorPin>;
34
+ origin: TrustOrigin;
35
+ }
36
+ /**
37
+ * The trust records in the user's profile: the profile folder for the CLI
38
+ * and `serve`, the app data folder for the desktop app, memory for tests
39
+ * and the browser demo. **Never inside a workspace**, so a workspace can't
40
+ * trust itself.
41
+ *
42
+ * The port only stores records. `TrustService` in `core/app` resolves the
43
+ * location, computes the fingerprint and decides whether a source is
44
+ * trusted. Locations are compared exactly as given: no case folding and
45
+ * no Unicode normalisation, so `café` written as one code point and as `e`
46
+ * plus a combining accent are two locations.
47
+ *
48
+ * A record that exists but can't be read makes `get` and `list` throw,
49
+ * never return `null` or skip it: the service then treats the source as
50
+ * untrusted and tells the user why, instead of asking again as if it were
51
+ * new. The error names the record's location, and `revoke` still deletes
52
+ * that record, so the user can recover with `halonic trust --remove`.
53
+ */
54
+ export interface TrustStore {
55
+ /** The record for a location, or `null` when there is none. */
56
+ get(location: string): Promise<TrustRecord | null>;
57
+ /** Saves a record, replacing any record for the same location. */
58
+ grant(record: TrustRecord): Promise<void>;
59
+ /**
60
+ * Deletes the record for a location, even one that can't be read.
61
+ * Revoking one that isn't there is not an error.
62
+ */
63
+ revoke(location: string): Promise<void>;
64
+ /**
65
+ * Every record, sorted by location in UTF-16 code-unit order (as `<`
66
+ * compares strings, not `localeCompare`), for `halonic trust --list` and
67
+ * the trusted-sources list.
68
+ *
69
+ * @throws when any record can't be read, naming its location
70
+ */
71
+ list(): Promise<TrustRecord[]>;
72
+ }
@@ -0,0 +1,2 @@
1
+ /** Version of the {@link TrustStore} port. A breaking change bumps it and comes with an ADR. */
2
+ export const trustStoreVersion = 1;
@@ -0,0 +1,43 @@
1
+ /** Version of the {@link UnfencedRunConsentStore} port. A breaking change bumps it and comes with an ADR. */
2
+ export declare const unfencedRunConsentStoreVersion = 1;
3
+ /**
4
+ * The user's yes to run plugin and integration code without the sandbox on
5
+ * this computer (requirement `ports.unfenced-run-consent-store`). One yes
6
+ * covers every plugin and integration, and holds only for the reason it was
7
+ * given for.
8
+ *
9
+ * @example
10
+ * const consent: UnfencedRunConsent = { reason: "windows", allowedAt: "2026-11-09T10:00:00.000Z" };
11
+ */
12
+ export interface UnfencedRunConsent {
13
+ /**
14
+ * Why the code couldn't run in the sandbox when the user said yes, as the
15
+ * fence status names it, such as `windows` or `container`.
16
+ */
17
+ reason: string;
18
+ /** When the user said yes, as ISO text. Studio shows it ("You allowed … on 9 Nov"). */
19
+ allowedAt: string;
20
+ }
21
+ /**
22
+ * The user's one saved yes, in their profile on this computer: the profile
23
+ * folder for the CLI and `serve`, the app data folder for the desktop app,
24
+ * memory for tests. **Never in a workspace, a sheet, a setting or a config
25
+ * file**, and there is no CLI flag for it, so neither a workspace nor an
26
+ * agent can give it (I5 design 4.3.1).
27
+ *
28
+ * The port only stores the yes. `UnfencedRuns` in `core/app` decides from it
29
+ * and the fence status whether code may start, and asks again when the
30
+ * reason changes. Only Studio saves a yes, when the user ticks the trust
31
+ * check's checkbox; no tool the model can call reaches this store.
32
+ *
33
+ * A yes that exists but can't be read makes `get` throw, never return
34
+ * `null`; the caller then treats it as no yes. `remove` still deletes it.
35
+ */
36
+ export interface UnfencedRunConsentStore {
37
+ /** The saved yes, or `null` when there is none. */
38
+ get(): Promise<UnfencedRunConsent | null>;
39
+ /** Saves the yes, replacing any saved one. */
40
+ save(consent: UnfencedRunConsent): Promise<void>;
41
+ /** Deletes the yes, even one that can't be read. Removing none is not an error. */
42
+ remove(): Promise<void>;
43
+ }
@@ -0,0 +1,2 @@
1
+ /** Version of the {@link UnfencedRunConsentStore} port. A breaking change bumps it and comes with an ADR. */
2
+ export const unfencedRunConsentStoreVersion = 1;
@@ -0,0 +1,394 @@
1
+ /** Version of the {@link Vcs} port. A breaking change bumps it and comes with an ADR. */
2
+ export declare const vcsVersion = 2;
3
+ /**
4
+ * Refuses a version that isn't a full commit id, the only kind of version a
5
+ * {@link Vcs} method takes. A branch name, `HEAD`, `@{-1}` or a short id would
6
+ * be resolved by git against whatever the repository holds at that moment,
7
+ * and a name starting with `-` would be read as an option; a caller only ever
8
+ * holds ids that `snapshot`, `commit` or `log` gave it.
9
+ *
10
+ * @throws RangeError naming the version
11
+ */
12
+ export declare function checkCommitId(version: string): void;
13
+ /**
14
+ * Refuses a ref that isn't a proposal ref, the only kind of ref
15
+ * `commitWorktreeTo`, `readRef` and `deleteRef` take:
16
+ * `refs/halonic/proposals/<id>`, with the id as {@link proposalIdPattern}
17
+ * says. Any other name could be a branch, `HEAD` or a tag, which these
18
+ * methods must never move or delete.
19
+ *
20
+ * @throws RangeError naming the ref
21
+ */
22
+ export declare function checkProposalRef(ref: string): void;
23
+ /**
24
+ * Folders Create version always leaves out, whatever `.gitignore` says:
25
+ * `.halonic/review/` holds the assistant's review records, which are per
26
+ * device (HAL-3277). Workspaces made before `init` ignored it don't have the
27
+ * line, so the port can't count on `.gitignore`.
28
+ */
29
+ export declare const unversionedFolders: readonly string[];
30
+ /** How a file differs from the last commit. */
31
+ export type VcsFileStatus = "modified" | "added" | "deleted" | "renamed" | "untracked" | "conflicted";
32
+ /** One changed file. */
33
+ export interface VcsChange {
34
+ /** Path relative to the workspace root, "/" separated. */
35
+ path: string;
36
+ /** How it differs from the last commit. */
37
+ status: VcsFileStatus;
38
+ /** In the index (will be committed) or only in the working tree. */
39
+ staged: boolean;
40
+ /** Renames: the old path. */
41
+ from?: string;
42
+ }
43
+ /** The state of the workspace folder's repository. */
44
+ export interface VcsStatus {
45
+ /** Whether the folder is a repository at all; when not, the other fields are empty. */
46
+ isRepo: boolean;
47
+ /** Current branch; null when detached or not a repo. */
48
+ branch: string | null;
49
+ /** The branch it tracks, such as "origin/main", or `null` when none. */
50
+ upstream: string | null;
51
+ /** Commits on the branch that the upstream doesn't have. */
52
+ ahead: number;
53
+ /** Commits on the upstream that the branch doesn't have. */
54
+ behind: number;
55
+ /** Every changed file, staged or not. */
56
+ changes: VcsChange[];
57
+ }
58
+ /** One commit in the history. */
59
+ export interface VcsCommit {
60
+ /** The full commit hash. */
61
+ hash: string;
62
+ /** The author's name. */
63
+ author: string;
64
+ /** ISO date. */
65
+ date: string;
66
+ /** The first line of the commit message. */
67
+ message: string;
68
+ }
69
+ /** A worktree: a version checked out, detached, into its own folder outside the workspace. */
70
+ export interface VcsWorktree {
71
+ /** The adapter's id for it, as `removeWorktree` and `diffBetween` take it. */
72
+ id: string;
73
+ /** Its folder: an absolute path outside the workspace folder for a git adapter. */
74
+ path: string;
75
+ /** The commit it was added at. */
76
+ version: string;
77
+ }
78
+ /** How a file in a worktree differs from the version it is compared with. */
79
+ export type VcsDiffStatus = "added" | "modified" | "deleted";
80
+ /** One file that differs between a version and a worktree. */
81
+ export interface VcsFileDiff {
82
+ /** Path relative to the worktree's root, "/" separated. */
83
+ path: string;
84
+ status: VcsDiffStatus;
85
+ /** Unified diff of the file, in git's format. */
86
+ diff: string;
87
+ }
88
+ /** How `applyPatch` applies a patch. */
89
+ export interface VcsApplyOptions {
90
+ /** Undo the patch instead: what discarding one hunk does. */
91
+ reverse?: boolean;
92
+ }
93
+ /** What `commitVersion` commits. */
94
+ export interface VcsCommitVersionOptions {
95
+ /** The commit message, committed as written. */
96
+ message: string;
97
+ /** Files and folders whose changes to commit; every change when absent. Never empty. */
98
+ include?: string[];
99
+ /** Files and folders whose changes to leave out, even under `include`. */
100
+ exclude: string[];
101
+ }
102
+ /** How `commitWorktreeTo` commits a worktree. */
103
+ export interface VcsCommitWorktreeOptions {
104
+ /** The new commit's only parent: a full commit id (see {@link checkCommitId}). */
105
+ parent: string;
106
+ }
107
+ /**
108
+ * Version control of one workspace folder (git today). Paths are relative to that folder.
109
+ *
110
+ * The folder is a repository only when it is a repository's root. A folder
111
+ * inside another repository is not one: its status says so, and `init`
112
+ * makes it a repository of its own. So no method ever reads or changes a
113
+ * file outside the folder, such as a parent repository's staged changes or
114
+ * the files a checkout there would rewrite.
115
+ *
116
+ * **Nothing a caller passes is ever read as an option or as the
117
+ * repository's own files.** The old desktop app kept a blocklist of git
118
+ * options, which a unique prefix such as `--upload-pac=` could get around.
119
+ * So every adapter, before anything runs:
120
+ *
121
+ * - refuses with a `RangeError` every **path the `DefinitionSource` port
122
+ * refuses**: an unsafe one (absolute, a `.`, `..` or empty segment, a
123
+ * backslash or NUL) and a private one, matched the same way (`.git`,
124
+ * `.studio`, `.env`, `.envrc` and `.env.*` in any case, with trailing dots
125
+ * or spaces or the code points HFS+ ignores, and any segment with a `:`
126
+ * or an 8.3 short name such as `GIT~1`);
127
+ * - treats **every path as a literal file name**: never an option (one that
128
+ * starts with `-`) and never a pattern (`*`, `?`, `[` or `:(…)`), so a git
129
+ * adapter passes paths after `--` with `--literal-pathspecs` (or
130
+ * `GIT_LITERAL_PATHSPECS=1`), or `discard(["*.yaml"])` would wipe every
131
+ * `.yaml` file;
132
+ * - refuses with a `RangeError` a **branch name** that starts with `-`, that
133
+ * `git check-ref-format --branch` refuses, the name `HEAD`, and `@` or any
134
+ * name with `@{`, which git expands (`@{-1}` is the previous branch);
135
+ * - in a git adapter, refuses a path that goes through a symbolic link, such
136
+ * as `link/config` with `link -> .git` or a link out of the folder, which
137
+ * the path rules above can't see;
138
+ * - commits a message as the message, whatever it starts with.
139
+ *
140
+ * Remotes and upstreams come from the repository, never from a caller.
141
+ *
142
+ * **An adapter that drives git always runs it hardened**, whether the
143
+ * workspace is trusted or not (plan section 11). Anyone who can write the
144
+ * workspace folder can write `.git/config` and `.git/info/attributes`, so
145
+ * no program named there ever runs. Every call:
146
+ *
147
+ * - points `core.hooksPath` at an empty folder and passes
148
+ * `-c core.fsmonitor=false` (hooks and fsmonitor);
149
+ * - blanks the `clean`, `smudge` and `process` commands of every
150
+ * `filter.<name>` driver the repository's config has, and the config of
151
+ * every repository nested in it as a gitlink, which `add`, `status` and
152
+ * `diff` look into (filters);
153
+ * - diffs and logs with `--no-ext-diff --no-textconv` (`diff.external`,
154
+ * `diff.<name>.command` and `diff.<name>.textconv`), and with
155
+ * `-c diff.submodule=short`, so no submodule's own diff programs run;
156
+ * - commits with the message it is given (`commit.template`, which can name
157
+ * any file whose text would otherwise become the message);
158
+ * - passes `-c core.alternateRefsCommand=true`, since `pull` would run it
159
+ * locally for every alternate, and blanks `fetch.bundleURI`, which would
160
+ * read objects and refs from any local file;
161
+ * - passes `-c maintenance.auto=false -c gc.auto=0`, so no automatic `gc`
162
+ * runs `gc.recentObjectsHook`;
163
+ * - passes `-c commit.gpgSign=false -c push.gpgSign=false
164
+ * -c log.showSignature=false` (`gpg.program`, `gpg.ssh.defaultKeyCommand`
165
+ * and the other signing programs);
166
+ * - passes `-c submodule.recurse=false -c fetch.recurseSubmodules=false`, so
167
+ * git never fetches, checks out or pushes inside a submodule, where that
168
+ * submodule's own config applies;
169
+ * - fetches and pushes with `--upload-pack=git-upload-pack` and
170
+ * `--receive-pack=git-receive-pack` (`remote.<name>.uploadpack` and
171
+ * `receivepack`), `-c credential.helper=` followed only by Halonic's own
172
+ * helper, if any (`credential.helper`), `GIT_SSH_COMMAND=ssh`
173
+ * (`core.sshCommand`), `GIT_ASKPASS` set (`core.askPass`) and
174
+ * `GIT_ALLOW_PROTOCOL=https:ssh` (`protocol.*.allow`, so no `ext::` URL
175
+ * runs a command). No `file`: a local remote such as `./planted.git` runs
176
+ * its own hooks and config on push and pull, out of reach of every
177
+ * setting here, so local remotes are refused;
178
+ * - starts from an environment with every inherited `GIT_*` variable
179
+ * removed (such as `GIT_DIR`, `GIT_WORK_TREE`, `GIT_INDEX_FILE` and
180
+ * `GIT_CONFIG_PARAMETERS`), and sets `GIT_TERMINAL_PROMPT=0`,
181
+ * `GIT_EDITOR=true` and `GIT_PAGER=cat`, so nothing waits on a prompt;
182
+ * - never sets `safe.directory=*`.
183
+ *
184
+ * Out of scope, because no port method reaches them: merge drivers
185
+ * (`pull` is fast-forward only), `submodule.*.update` (no submodule
186
+ * command), and a remote server's own config, which runs on another
187
+ * machine. Where a
188
+ * workspace's config would make a program run, the adapter neutralises it
189
+ * as above rather than refusing the workspace, so a cloned repository that
190
+ * names one still works.
191
+ */
192
+ export interface Vcs {
193
+ /** The branch, its upstream and the changed files. */
194
+ status(): Promise<VcsStatus>;
195
+ /** Unified diff of one file: staged = index vs HEAD, otherwise working tree vs index. Empty when they are the same. */
196
+ diff(path: string, staged: boolean): Promise<string>;
197
+ /** Adds the files' changes to the index. */
198
+ stage(paths: string[]): Promise<void>;
199
+ /** Takes the files' changes out of the index, leaving the working tree as it is. */
200
+ unstage(paths: string[]): Promise<void>;
201
+ /** Throw away working-tree changes: tracked files go back to the index, untracked files are deleted. */
202
+ discard(paths: string[]): Promise<void>;
203
+ /**
204
+ * Commits what is staged; returns the new commit hash.
205
+ *
206
+ * @throws when nothing is staged, or the message is empty
207
+ */
208
+ commit(message: string): Promise<string>;
209
+ /**
210
+ * At most `limit` commits on the current branch, newest first.
211
+ *
212
+ * @throws RangeError when `limit` isn't a whole number of at least 1
213
+ */
214
+ log(limit: number): Promise<VcsCommit[]>;
215
+ /** The local branch names; a branch with no commits yet isn't listed. */
216
+ branches(): Promise<string[]>;
217
+ /**
218
+ * Switches to a local branch. Refuses, and changes nothing, when that would
219
+ * overwrite an untracked file, or while a tracked file has changes: an
220
+ * adapter may refuse any such change, as the memory one does, though git
221
+ * refuses only those the branch would touch.
222
+ *
223
+ * A name is only ever a branch, never a path: `git checkout a.yaml` with no
224
+ * such branch would throw away the changes to `a.yaml`, so a git adapter
225
+ * uses `git switch` or `git checkout <branch> --`.
226
+ *
227
+ * @throws when there is no such branch, or the switch would lose changes
228
+ */
229
+ checkout(branch: string): Promise<void>;
230
+ /**
231
+ * Creates a branch from the current commit and switches to it.
232
+ *
233
+ * @throws when a branch of that name already exists, or it would sit next
234
+ * to `x` as `x/y` or the other way round, which git refuses
235
+ */
236
+ createBranch(name: string): Promise<void>;
237
+ /**
238
+ * Commits the workspace's files as they are on disk now, new files
239
+ * included, and returns the commit's id. Files the repository ignores and
240
+ * private entries (see `DefinitionSource`) are left out, so a `.env` with
241
+ * a key never reaches a worktree. The commit's parent is the current
242
+ * commit, if any. Neither HEAD, the branch, the index nor the working tree
243
+ * changes: the commit is on no branch.
244
+ *
245
+ * @throws when the folder isn't a repository
246
+ */
247
+ snapshot(): Promise<string>;
248
+ /**
249
+ * A file's text at a commit, or `null` when the commit has no such file.
250
+ * Never reads the working tree or the index.
251
+ *
252
+ * @throws RangeError for a version that isn't a full commit id (see
253
+ * {@link checkCommitId}) or a path the port refuses
254
+ * @throws when the repository has no such commit: `Unknown version <id>`
255
+ */
256
+ readAt(version: string, path: string): Promise<string | null>;
257
+ /**
258
+ * Every file under `dir` at a commit (the whole workspace without one),
259
+ * recursively, as sorted paths relative to the workspace folder, private
260
+ * entries left out; `null` when the commit has no file under `dir`.
261
+ *
262
+ * @throws as {@link Vcs.readAt}
263
+ */
264
+ listAt(version: string, dir?: string): Promise<string[] | null>;
265
+ /**
266
+ * Moves a file or folder in the working tree and, where the repository
267
+ * tracks it, in the index too (`git mv`), so its history follows it. An
268
+ * untracked file just moves.
269
+ *
270
+ * @throws when `from` doesn't exist or `to` already does; nothing changes
271
+ */
272
+ rename(from: string, to: string): Promise<void>;
273
+ /**
274
+ * Checks a commit out, detached, into a new folder of its own, where the
275
+ * assistant or an agent can change files without touching the workspace.
276
+ * The folder is never inside the workspace folder, so the Studio's file
277
+ * tree and watcher never see it. A git adapter takes the folder that
278
+ * holds its worktrees (in the app's data folder) when it is made.
279
+ *
280
+ * @throws as {@link Vcs.readAt} for the version
281
+ */
282
+ addWorktree(version: string): Promise<VcsWorktree>;
283
+ /**
284
+ * Deletes a worktree's folder, changed files and all, and the
285
+ * repository's record of it.
286
+ *
287
+ * @throws when there is no worktree with that id: `Unknown worktree <id>`
288
+ */
289
+ removeWorktree(id: string): Promise<void>;
290
+ /**
291
+ * The worktrees this adapter added that still exist, oldest first.
292
+ *
293
+ * @throws when the folder isn't a repository
294
+ */
295
+ listWorktrees(): Promise<VcsWorktree[]>;
296
+ /**
297
+ * Every file that differs between a commit and a worktree's files as they
298
+ * are on disk, new files included, private entries left out, sorted by
299
+ * path. Changes neither the worktree nor the workspace. A git adapter
300
+ * finds the worktree's repository through its own record of it, never
301
+ * through the `.git` file in the worktree folder, which whatever ran there
302
+ * could have rewritten.
303
+ *
304
+ * @throws as {@link Vcs.readAt} for the version, and as
305
+ * {@link Vcs.removeWorktree} for the id
306
+ */
307
+ diffBetween(version: string, worktreeId: string): Promise<VcsFileDiff[]>;
308
+ /**
309
+ * Applies a unified diff to the workspace's working tree, not the index;
310
+ * with `reverse`, undoes it instead. Discarding one hunk of a change is
311
+ * `applyPatch(hunk, { reverse: true })`. All or nothing: when any part of
312
+ * it doesn't apply cleanly, nothing changes.
313
+ *
314
+ * @throws RangeError for a patch that would be refused whatever the files
315
+ * hold: one that names a path the port refuses, one that does more than
316
+ * edit, create or delete a plain text file's lines (a binary change, a
317
+ * mode change, a symbolic link, a gitlink, a rename or a copy), or one
318
+ * that can't be read
319
+ * @throws when it is fine but no longer applies cleanly: `The change no
320
+ * longer matches the file.` The Studio offers to refresh only this one.
321
+ */
322
+ applyPatch(patch: string, options?: VcsApplyOptions): Promise<void>;
323
+ /**
324
+ * Create version: commits the changes on disk under `include` (the whole
325
+ * workspace when absent), new, changed and deleted files alike, except
326
+ * those under `exclude`, on the current branch, and returns the commit's
327
+ * id. A path names a file or everything in a folder; a renamed item is
328
+ * left out by naming both its paths.
329
+ *
330
+ * A path left out keeps its content at HEAD in the new commit, even when
331
+ * the repository tracks it and it changed on disk (unlike
332
+ * `git commit -- <path>`, which commits what is on disk for every tracked
333
+ * path it names). Files the repository ignores are left out, and so are
334
+ * private entries and {@link unversionedFolders}, even where `.gitignore`
335
+ * doesn't name them; one HEAD already tracks keeps its content at HEAD. The working tree is never touched.
336
+ * The index takes the new commit's content for the paths it committed;
337
+ * every other path stays as it was, staged changes and all, so the
338
+ * changes left out are still changes afterwards.
339
+ *
340
+ * @throws RangeError for a path the port refuses in `include` or
341
+ * `exclude`, or an empty `include`
342
+ * @throws when the message is empty, or there is nothing to commit
343
+ * because every change is left out; nothing changes
344
+ */
345
+ commitVersion(options: VcsCommitVersionOptions): Promise<string>;
346
+ /**
347
+ * Commits a worktree's files as they are on disk, new files included,
348
+ * ignored files and private entries left out, with `parent` as the only
349
+ * parent, and points the proposal ref `ref` at it (see
350
+ * {@link checkProposalRef}). Returns the commit's id. HEAD, the branches,
351
+ * the index, the working tree and the worktree don't change, and
352
+ * `branches` never lists the ref. Nothing pushes it.
353
+ *
354
+ * @throws RangeError for a ref that isn't a proposal ref, or a parent
355
+ * that isn't a full commit id
356
+ * @throws when the ref already exists, so a proposal is never
357
+ * overwritten; as {@link Vcs.readAt} for the parent; and as
358
+ * {@link Vcs.removeWorktree} for the id
359
+ */
360
+ commitWorktreeTo(worktreeId: string, ref: string, options: VcsCommitWorktreeOptions): Promise<string>;
361
+ /**
362
+ * The commit a proposal ref points at, or `null` when there is no such
363
+ * ref, even when a branch has the same name.
364
+ *
365
+ * @throws RangeError for a ref that isn't a proposal ref
366
+ * @throws when the folder isn't a repository
367
+ */
368
+ readRef(ref: string): Promise<string | null>;
369
+ /**
370
+ * Deletes a proposal ref. The commit stays until git's own `gc` removes it.
371
+ *
372
+ * @throws RangeError for a ref that isn't a proposal ref
373
+ * @throws when there is no such ref
374
+ */
375
+ deleteRef(ref: string): Promise<void>;
376
+ /** Make the folder a repository, ignoring `.studio`, the folder Halonic keeps its runtime data in. */
377
+ init(): Promise<void>;
378
+ /** The remote names, such as "origin". */
379
+ remotes(): Promise<string[]>;
380
+ /**
381
+ * Brings in the upstream's commits, fast-forward only. Like `checkout`, it
382
+ * refuses to overwrite an untracked file or to switch over changes.
383
+ *
384
+ * @throws when the branch and its upstream have both moved on; nothing is merged
385
+ */
386
+ pull(): Promise<void>;
387
+ /**
388
+ * Sends the branch's commits to its upstream, or to the first remote (which
389
+ * becomes the upstream) when it has none.
390
+ *
391
+ * @throws when the remote has commits the branch doesn't (no force push), or there is no remote
392
+ */
393
+ push(): Promise<void>;
394
+ }
@@ -0,0 +1,48 @@
1
+ /** Version of the {@link Vcs} port. A breaking change bumps it and comes with an ADR. */
2
+ export const vcsVersion = 2;
3
+ /** A full commit id: 40 (SHA-1) or 64 (SHA-256) lowercase hex characters. */
4
+ const commitIdPattern = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u;
5
+ /**
6
+ * Refuses a version that isn't a full commit id, the only kind of version a
7
+ * {@link Vcs} method takes. A branch name, `HEAD`, `@{-1}` or a short id would
8
+ * be resolved by git against whatever the repository holds at that moment,
9
+ * and a name starting with `-` would be read as an option; a caller only ever
10
+ * holds ids that `snapshot`, `commit` or `log` gave it.
11
+ *
12
+ * @throws RangeError naming the version
13
+ */
14
+ export function checkCommitId(version) {
15
+ if (!commitIdPattern.test(version)) {
16
+ throw new RangeError(`Invalid version ${JSON.stringify(version)}: give a full commit id (40 or 64 lowercase hex characters).`);
17
+ }
18
+ }
19
+ /** Where every proposal ref lives. */
20
+ const proposalRefPrefix = "refs/halonic/proposals/";
21
+ /**
22
+ * A proposal ref's id: ASCII letters, digits, `-` and `_`, at most 64 of
23
+ * them, not starting with `-`. No `/`, `.`, `@`, `~`, `^` or `:`, so git
24
+ * never reads one as a path, a revision expression or an option.
25
+ */
26
+ const proposalIdPattern = /^[A-Za-z0-9_][A-Za-z0-9_-]{0,63}$/u;
27
+ /**
28
+ * Refuses a ref that isn't a proposal ref, the only kind of ref
29
+ * `commitWorktreeTo`, `readRef` and `deleteRef` take:
30
+ * `refs/halonic/proposals/<id>`, with the id as {@link proposalIdPattern}
31
+ * says. Any other name could be a branch, `HEAD` or a tag, which these
32
+ * methods must never move or delete.
33
+ *
34
+ * @throws RangeError naming the ref
35
+ */
36
+ export function checkProposalRef(ref) {
37
+ const id = ref.startsWith(proposalRefPrefix) ? ref.slice(proposalRefPrefix.length) : null;
38
+ if (id === null || !proposalIdPattern.test(id)) {
39
+ throw new RangeError(`Invalid proposal ref ${JSON.stringify(ref)}: give ${proposalRefPrefix}<id>, with an id of up to 64 letters, digits, - and _, not starting with -.`);
40
+ }
41
+ }
42
+ /**
43
+ * Folders Create version always leaves out, whatever `.gitignore` says:
44
+ * `.halonic/review/` holds the assistant's review records, which are per
45
+ * device (HAL-3277). Workspaces made before `init` ignored it don't have the
46
+ * line, so the port can't count on `.gitignore`.
47
+ */
48
+ export const unversionedFolders = Object.freeze([".halonic/review"]);
@@ -0,0 +1,50 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Builds schemas. These are Zod's own builders, limited to the ones the file
4
+ * format uses, so the rest of the code never imports Zod. The
5
+ * schemas they return have Zod's methods, such as `.min()`, `.optional()`,
6
+ * `.default()`, `.strict()`, `.extend()` and `.superRefine()`.
7
+ *
8
+ * @example
9
+ * const Deployment = s.object({
10
+ * name: s.string().min(1),
11
+ * host: s.enum(["local", "cloudflare"]).default("local"),
12
+ * }).strict();
13
+ * type Deployment = Infer<typeof Deployment>;
14
+ */
15
+ export declare const s: {
16
+ /** Text. Add `.min()`, `.max()`, `.regex()`, `.email()` or `.url()`. */
17
+ readonly string: typeof z.string;
18
+ /** A finite number. Add `.min()`, `.max()`, `.positive()` or `.int()`. */
19
+ readonly number: typeof z.number;
20
+ /** `true` or `false`. */
21
+ readonly boolean: typeof z.boolean;
22
+ /** Only `null`. */
23
+ readonly null: typeof z.null;
24
+ /** Anything. In an object the key must still be there unless you add `.optional()`. */
25
+ readonly unknown: typeof z.unknown;
26
+ /** Exactly one value, such as `s.literal(1)` or `s.literal("text")`. */
27
+ readonly literal: typeof z.literal;
28
+ /** One of a fixed list of texts, such as `s.enum(["low", "medium", "high"])`. */
29
+ readonly enum: typeof z.enum;
30
+ /** A map with these keys. Unknown keys are dropped; add `.strict()` to refuse or `.passthrough()` to keep them. */
31
+ readonly object: typeof z.object;
32
+ /** A list whose items all match one schema. Add `.min()` or `.max()` for its length. */
33
+ readonly array: typeof z.array;
34
+ /** A list with one schema per position. */
35
+ readonly tuple: typeof z.tuple;
36
+ /** A map with any keys: every key matches the key schema and every value the value schema. */
37
+ readonly record: typeof z.record;
38
+ /** A value that matches any of the options. */
39
+ readonly union: typeof z.union;
40
+ /** A map whose value at one key picks one of the object schemas. */
41
+ readonly discriminatedUnion: typeof z.discriminatedUnion;
42
+ /** A value that matches both schemas; maps are merged. */
43
+ readonly intersection: typeof z.intersection;
44
+ /** A schema that refers to itself. */
45
+ readonly lazy: typeof z.lazy;
46
+ /** Any JSON value: null, a boolean, a finite number, text, or a list or map of JSON values. */
47
+ readonly json: typeof z.json;
48
+ /** An absolute `http` or `https` URL as `URL` writes it; see `URL_PATTERN`. */
49
+ readonly url: () => z.ZodString;
50
+ };