@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,64 @@
1
+ import type { FileKind } from "./kind.js";
2
+ import type { Agent } from "./kinds/agent/schema.js";
3
+ import type { Collection } from "./kinds/collection/schema.js";
4
+ import type { Connector } from "./kinds/connector/schema.js";
5
+ import type { Deployments } from "./kinds/deployments/schema.js";
6
+ import type { Hub } from "./kinds/hub/schema.js";
7
+ import type { IntegrationSheet } from "./kinds/integration/schema.js";
8
+ import type { KnowledgeSource } from "./kinds/knowledge/schema.js";
9
+ import type { Models } from "./kinds/models/schema.js";
10
+ import type { Plugin } from "./kinds/plugin/schema.js";
11
+ import type { Provider } from "./kinds/provider/schema.js";
12
+ import type { Routine } from "./kinds/routine/schema.js";
13
+ import type { Runtime } from "./kinds/runtime/schema.js";
14
+ import type { Skill } from "./kinds/skill/schema.js";
15
+ import type { Workflow } from "./kinds/workflow/schema.js";
16
+ import type { WorkflowTest } from "./kinds/workflow-test/schema.js";
17
+ import type { WorkspaceSettings } from "./kinds/workspace/schema.js";
18
+ /** The value each file kind parses to, by kind name. */
19
+ export interface KindValues {
20
+ workspace: WorkspaceSettings;
21
+ deployments: Deployments;
22
+ models: Models;
23
+ provider: Provider;
24
+ runtime: Runtime;
25
+ knowledge: KnowledgeSource;
26
+ collection: Collection;
27
+ connector: Connector;
28
+ skill: Skill;
29
+ hub: Hub;
30
+ agent: Agent;
31
+ workflow: Workflow;
32
+ workflowTest: WorkflowTest;
33
+ routine: Routine;
34
+ integration: IntegrationSheet;
35
+ plugin: Plugin;
36
+ }
37
+ /** The name of a file kind: `workspace`, `agent`, `workflowTest`, … */
38
+ export type KindName = keyof KindValues;
39
+ /**
40
+ * Every file kind, by name. Adding a kind means adding its folder under
41
+ * `kinds/` and one line here; the loader and the tooling read this list
42
+ * instead of switching on kind names.
43
+ */
44
+ export declare const fileKinds: {
45
+ readonly [Name in KindName]: FileKind<KindValues[Name]>;
46
+ };
47
+ /**
48
+ * The names of every file kind, workspace-level kinds first and the
49
+ * integration sheet and the plugin manifest, which sit outside workspaces,
50
+ * last, in a fixed order.
51
+ *
52
+ * @example
53
+ * for (const name of kindNames()) console.log(name, fileKinds[name].about);
54
+ */
55
+ export declare function kindNames(): readonly KindName[];
56
+ /**
57
+ * Whether a text names a file kind, for input from outside such as a CLI
58
+ * argument.
59
+ *
60
+ * @example
61
+ * isKindName("agent"); // true
62
+ * isKindName("toString"); // false
63
+ */
64
+ export declare function isKindName(name: string): name is KindName;
@@ -0,0 +1,61 @@
1
+ import { agentKind } from "./kinds/agent/kind.js";
2
+ import { collectionKind } from "./kinds/collection/kind.js";
3
+ import { connectorKind } from "./kinds/connector/kind.js";
4
+ import { deploymentsKind } from "./kinds/deployments/kind.js";
5
+ import { hubKind } from "./kinds/hub/kind.js";
6
+ import { integrationKind } from "./kinds/integration/kind.js";
7
+ import { knowledgeKind } from "./kinds/knowledge/kind.js";
8
+ import { modelsKind } from "./kinds/models/kind.js";
9
+ import { pluginKind } from "./kinds/plugin/kind.js";
10
+ import { providerKind } from "./kinds/provider/kind.js";
11
+ import { routineKind } from "./kinds/routine/kind.js";
12
+ import { runtimeKind } from "./kinds/runtime/kind.js";
13
+ import { skillKind } from "./kinds/skill/kind.js";
14
+ import { workflowKind } from "./kinds/workflow/kind.js";
15
+ import { workflowTestKind } from "./kinds/workflow-test/kind.js";
16
+ import { workspaceKind } from "./kinds/workspace/kind.js";
17
+ /**
18
+ * Every file kind, by name. Adding a kind means adding its folder under
19
+ * `kinds/` and one line here; the loader and the tooling read this list
20
+ * instead of switching on kind names.
21
+ */
22
+ export const fileKinds = {
23
+ workspace: workspaceKind,
24
+ deployments: deploymentsKind,
25
+ models: modelsKind,
26
+ provider: providerKind,
27
+ runtime: runtimeKind,
28
+ knowledge: knowledgeKind,
29
+ collection: collectionKind,
30
+ connector: connectorKind,
31
+ skill: skillKind,
32
+ hub: hubKind,
33
+ agent: agentKind,
34
+ workflow: workflowKind,
35
+ workflowTest: workflowTestKind,
36
+ routine: routineKind,
37
+ integration: integrationKind,
38
+ plugin: pluginKind,
39
+ };
40
+ /**
41
+ * The names of every file kind, workspace-level kinds first and the
42
+ * integration sheet and the plugin manifest, which sit outside workspaces,
43
+ * last, in a fixed order.
44
+ *
45
+ * @example
46
+ * for (const name of kindNames()) console.log(name, fileKinds[name].about);
47
+ */
48
+ export function kindNames() {
49
+ return Object.keys(fileKinds);
50
+ }
51
+ /**
52
+ * Whether a text names a file kind, for input from outside such as a CLI
53
+ * argument.
54
+ *
55
+ * @example
56
+ * isKindName("agent"); // true
57
+ * isKindName("toString"); // false
58
+ */
59
+ export function isKindName(name) {
60
+ return Object.hasOwn(fileKinds, name);
61
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The folder Halonic keeps for its own data inside a workspace and inside
3
+ * each hub: install records, staging and change sets. It holds no workspace
4
+ * files, so the loader skips it without a warning (format.reserved-folder).
5
+ */
6
+ export declare const RESERVED_FOLDER = ".halonic";
7
+ /**
8
+ * Whether a workspace-relative path (with `/` separators) sits in the
9
+ * reserved `.halonic/` folder of the workspace root or of a hub. Names
10
+ * compare the way Windows and macOS open them, as `segmentAsOpened` gives
11
+ * them: case folded, without trailing dots and spaces and without the code
12
+ * points HFS+ ignores. So `.Halonic./x` and `HUBS/billing/.HALONIC/x` are
13
+ * reserved too, since they open the same folder.
14
+ *
15
+ * @example
16
+ * isReservedPath("hubs/billing/.halonic/source.json"); // true
17
+ * isReservedPath(".Halonic./staging/abc/hub.yaml"); // true
18
+ * isReservedPath("hubs/billing/agents/clerk.agent.yaml"); // false
19
+ */
20
+ export declare function isReservedPath(path: string): boolean;
@@ -0,0 +1,30 @@
1
+ import { segmentAsOpened } from "../../ports/src/index.js";
2
+ /**
3
+ * The folder Halonic keeps for its own data inside a workspace and inside
4
+ * each hub: install records, staging and change sets. It holds no workspace
5
+ * files, so the loader skips it without a warning (format.reserved-folder).
6
+ */
7
+ export const RESERVED_FOLDER = ".halonic";
8
+ /**
9
+ * Whether a workspace-relative path (with `/` separators) sits in the
10
+ * reserved `.halonic/` folder of the workspace root or of a hub. Names
11
+ * compare the way Windows and macOS open them, as `segmentAsOpened` gives
12
+ * them: case folded, without trailing dots and spaces and without the code
13
+ * points HFS+ ignores. So `.Halonic./x` and `HUBS/billing/.HALONIC/x` are
14
+ * reserved too, since they open the same folder.
15
+ *
16
+ * @example
17
+ * isReservedPath("hubs/billing/.halonic/source.json"); // true
18
+ * isReservedPath(".Halonic./staging/abc/hub.yaml"); // true
19
+ * isReservedPath("hubs/billing/agents/clerk.agent.yaml"); // false
20
+ */
21
+ export function isReservedPath(path) {
22
+ const [first = "", hub = "", inHub = ""] = path.split("/");
23
+ if (opensAsReservedFolder(first)) {
24
+ return true;
25
+ }
26
+ return segmentAsOpened(first) === "hubs" && hub !== "" && opensAsReservedFolder(inHub);
27
+ }
28
+ function opensAsReservedFolder(segment) {
29
+ return segmentAsOpened(segment) === RESERVED_FOLDER;
30
+ }
@@ -0,0 +1,34 @@
1
+ /** The file format version every kind's `version` key holds. */
2
+ export declare const SCHEMA_VERSION: 1;
3
+ /** An item's id: lowercase letters, digits, `-` and `_`, starting with a letter or digit. */
4
+ export declare const id: import("zod").ZodString;
5
+ /** A deployment's id, which names the deployment's runs folder. */
6
+ export declare const deploymentId: import("zod").ZodString;
7
+ /** An agent's id, which names the agent's harness settings folder. */
8
+ export declare const agentId: import("zod").ZodString;
9
+ /**
10
+ * A workspace collection's id: lowercase letters, digits and `-`, starting
11
+ * with a letter or digit. Halonic's own collections (`_tokens`,
12
+ * `_google_setups`) start with `_`, so no workspace file can name them.
13
+ * The scheduler's and coordination's collections (`halonic.scheduler.timers`,
14
+ * `halonic.coordination`) are kept out by the `.` instead, so keep a `.` in
15
+ * their names.
16
+ */
17
+ export declare const collectionId: import("zod").ZodString;
18
+ /** The `version` key: `1`, and `1` when the file leaves it out. */
19
+ export declare const version: import("zod").ZodDefault<import("zod").ZodLiteral<1>>;
20
+ /** A whole number and a unit: minutes, hours or days ("30m", "4h", "2d"). */
21
+ export declare const DURATION_PATTERN: RegExp;
22
+ /** Tuning passed to a model (temperature, maxTokens, …). */
23
+ export declare const ModelParams: import("zod").ZodObject<{
24
+ temperature: import("zod").ZodOptional<import("zod").ZodNumber>;
25
+ topP: import("zod").ZodOptional<import("zod").ZodNumber>;
26
+ maxTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
27
+ stop: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
28
+ reasoningEffort: import("zod").ZodOptional<import("zod").ZodEnum<{
29
+ high: "high";
30
+ low: "low";
31
+ medium: "medium";
32
+ }>>;
33
+ extra: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
34
+ }, import("zod/v4/core").$strict>;
@@ -0,0 +1,74 @@
1
+ // Field schemas that several file kinds share. Each keeps the exact rule and
2
+ // message of the old schema (784f78d: packages/core/schema/src/index.ts).
3
+ import { s } from "../../../schema-kit/src/index.js";
4
+ /** The file format version every kind's `version` key holds. */
5
+ export const SCHEMA_VERSION = 1;
6
+ /** An item's id: lowercase letters, digits, `-` and `_`, starting with a letter or digit. */
7
+ export const id = s
8
+ .string()
9
+ .min(1)
10
+ .regex(/^[a-z0-9][a-z0-9-_]*$/, "use lowercase letters, digits, '-' or '_'");
11
+ /**
12
+ * The most characters an id that names a folder may have. A deployment's runs
13
+ * live in `deployments/<id>/runs` and an agent's harness settings in
14
+ * `harness-settings/<id>/<harness>` in the profile, and 64 keeps those paths
15
+ * well under Windows' 260-character limit.
16
+ */
17
+ const FOLDER_ID_MAX_LENGTH = 64;
18
+ /** Names Windows keeps for devices; no file or folder can have them. */
19
+ const WINDOWS_DEVICE_NAME = /^(?:con|prn|aux|nul|com[0-9]|lpt[0-9])$/;
20
+ /**
21
+ * An {@link id} that names a folder in the profile: at most 64 characters
22
+ * and not a Windows device name. `owner` says whose folder it is in the
23
+ * message. The device names are refused by a separate rule that the JSON
24
+ * Schema carries as `not: { pattern }`, not by a lookahead, so the pattern
25
+ * also works in Go and Rust regex libraries, which have no lookaround.
26
+ * `@halonicjs/profile` keeps the same rule, and a test in each kind that
27
+ * uses it holds the two together.
28
+ */
29
+ function folderId(owner) {
30
+ return id
31
+ .max(FOLDER_ID_MAX_LENGTH, `use at most ${FOLDER_ID_MAX_LENGTH} characters, so the ${owner}'s folder fits in a Windows path`)
32
+ .superRefine((name, context) => {
33
+ if (WINDOWS_DEVICE_NAME.test(name)) {
34
+ context.addIssue({
35
+ code: "invalid_format",
36
+ format: "regex",
37
+ pattern: WINDOWS_DEVICE_NAME.source,
38
+ message: "use a name Windows doesn't keep for a device (con, prn, aux, nul, com0-com9, lpt0-lpt9)",
39
+ });
40
+ }
41
+ })
42
+ .meta({ not: { pattern: WINDOWS_DEVICE_NAME.source } });
43
+ }
44
+ /** A deployment's id, which names the deployment's runs folder. */
45
+ export const deploymentId = folderId("deployment");
46
+ /** An agent's id, which names the agent's harness settings folder. */
47
+ export const agentId = folderId("agent");
48
+ /**
49
+ * A workspace collection's id: lowercase letters, digits and `-`, starting
50
+ * with a letter or digit. Halonic's own collections (`_tokens`,
51
+ * `_google_setups`) start with `_`, so no workspace file can name them.
52
+ * The scheduler's and coordination's collections (`halonic.scheduler.timers`,
53
+ * `halonic.coordination`) are kept out by the `.` instead, so keep a `.` in
54
+ * their names.
55
+ */
56
+ export const collectionId = s
57
+ .string()
58
+ .regex(/^[a-z0-9][a-z0-9-]*$/, "use lowercase letters, digits or '-'");
59
+ /** The `version` key: `1`, and `1` when the file leaves it out. */
60
+ export const version = s.literal(SCHEMA_VERSION).default(SCHEMA_VERSION);
61
+ /** A whole number and a unit: minutes, hours or days ("30m", "4h", "2d"). */
62
+ export const DURATION_PATTERN = /^[1-9]\d*(m|h|d)$/;
63
+ /** Tuning passed to a model (temperature, maxTokens, …). */
64
+ export const ModelParams = s
65
+ .object({
66
+ temperature: s.number().min(0).max(2).optional(),
67
+ topP: s.number().min(0).max(1).optional(),
68
+ maxTokens: s.number().int().positive().optional(),
69
+ stop: s.array(s.string()).optional(),
70
+ reasoningEffort: s.enum(["low", "medium", "high"]).optional(),
71
+ /** Provider-specific extras, passed through untouched. */
72
+ extra: s.record(s.string(), s.unknown()).optional(),
73
+ })
74
+ .strict();
@@ -0,0 +1,32 @@
1
+ import { type Schema } from "../../../schema-kit/src/index.js";
2
+ /**
3
+ * A condition on a run's data, used by workflow transitions and signal
4
+ * routines. Values may be `{{path}}` templates.
5
+ */
6
+ export type Guard = {
7
+ equals: [unknown, unknown];
8
+ } | {
9
+ notEquals: [unknown, unknown];
10
+ } | {
11
+ contains: [unknown, unknown];
12
+ } | {
13
+ exists: string;
14
+ }
15
+ /** Numbers: both sides are read as numbers; a side that is no number makes the guard false. */
16
+ | {
17
+ gt: [unknown, unknown];
18
+ } | {
19
+ gte: [unknown, unknown];
20
+ } | {
21
+ lt: [unknown, unknown];
22
+ } | {
23
+ lte: [unknown, unknown];
24
+ } | {
25
+ not: Guard;
26
+ } | {
27
+ all: Guard[];
28
+ } | {
29
+ any: Guard[];
30
+ };
31
+ /** The schema of a `Guard`. It refers to itself for `not`, `all` and `any`. */
32
+ export declare const Guard: Schema<Guard>;
@@ -0,0 +1,16 @@
1
+ import { s } from "../../../schema-kit/src/index.js";
2
+ const pair = () => s.tuple([s.unknown(), s.unknown()]);
3
+ /** The schema of a `Guard`. It refers to itself for `not`, `all` and `any`. */
4
+ export const Guard = s.lazy(() => s.union([
5
+ s.object({ equals: pair() }).strict(),
6
+ s.object({ notEquals: pair() }).strict(),
7
+ s.object({ contains: pair() }).strict(),
8
+ s.object({ exists: s.string() }).strict(),
9
+ s.object({ gt: pair() }).strict(),
10
+ s.object({ gte: pair() }).strict(),
11
+ s.object({ lt: pair() }).strict(),
12
+ s.object({ lte: pair() }).strict(),
13
+ s.object({ not: Guard }).strict(),
14
+ s.object({ all: s.array(Guard) }).strict(),
15
+ s.object({ any: s.array(Guard) }).strict(),
16
+ ]));
@@ -0,0 +1,28 @@
1
+ import type { Path } from "../../../schema-kit/src/index.js";
2
+ import type { KindCheckProblem } from "../kind.js";
3
+ declare const words: {
4
+ readonly header: "This looks like an API key written into the file. Remove it, store the key as a secret, and write the secret's name in the connector's secret, which is sent as a bearer token.";
5
+ readonly env: "This looks like an API key written into the file. Remove it, store the key as a secret, and set this variable under secretEnv to the secret's name instead.";
6
+ readonly arg: "This looks like an API key written into the file. Remove it, store the key as a secret, and give it to the program through secretEnv instead of its arguments.";
7
+ readonly "provider-option": "This looks like an API key written into the file. Remove it, store the key as a secret, and write the secret's name in the provider's secret.";
8
+ readonly setting: "This looks like an API key written into the file. Remove it and store the key as a secret, so the file can be shared and committed safely.";
9
+ };
10
+ /** Which field the text sits in, which picks the advice in the message. */
11
+ export type KeyPlace = keyof typeof words;
12
+ /**
13
+ * Checks every text in a free field for a pasted key, down through nested
14
+ * maps and lists, and reports each one as the error `value-looks-like-key`
15
+ * at its own path. The message never repeats the value.
16
+ *
17
+ * @param value - the field's value from the file
18
+ * @param path - where the field sits in the file
19
+ * @param place - which advice the message gives
20
+ * @param name - the name the value sits under, when the field itself is one entry
21
+ * @returns one problem per text that holds a key
22
+ *
23
+ * @example
24
+ * checkKeysIn({ Authorization: `Bearer sk-${"Q7x2Lm9K".repeat(4)}` }, ["headers"], "header");
25
+ * // [{ code: "value-looks-like-key", path: ["headers", "Authorization"], … }]
26
+ */
27
+ export declare function checkKeysIn(value: unknown, path: Path, place: KeyPlace, name?: string): KindCheckProblem[];
28
+ export {};
@@ -0,0 +1,82 @@
1
+ import { findSecretShape } from "../../../std/src/index.js";
2
+ import { looksLikeKey } from "./secret-name.js";
3
+ /*
4
+ * A file holds only a secret's name, never the secret (save model 8.1). The
5
+ * fields checked here take any text: a connector's HTTP headers, a local
6
+ * program's `env` and `args`, and the adapter settings in `options` and
7
+ * `config`. Two tests catch a key pasted into one:
8
+ *
9
+ * - The known key formats `findSecretShape` spots, anywhere in the text, so
10
+ * `Bearer sk-…` and `--api-key=sk-…` are caught too.
11
+ * - Under a name that says it holds a credential (`Authorization`,
12
+ * `GITHUB_TOKEN`, `apiKey`), the full `looksLikeKey` test, once a leading
13
+ * `Bearer`, `Basic` or `Token` is dropped. Only a value made of key
14
+ * characters counts: without the name, or with a `.`, `:` or space left
15
+ * in it, the long-random-part test would also find addresses and paths
16
+ * such as `/opt/python3.12-tools`. A value that starts like a path
17
+ * (`/`, `./`, `../`, `~/`) is a path, such as `CREDENTIALS_DIR:
18
+ * /srv/runner/work/app2/creds`; a base64 key may hold a `/`, but doesn't
19
+ * start with one.
20
+ */
21
+ const credentialName = /token|secret|passw(?:or)?d|api[-_]?key|access[-_]?key|private[-_]?key|credential|authorization|^auth$/i;
22
+ const authScheme = /^(?:bearer|basic|token)\s+/i;
23
+ const keyCharacters = /^[A-Za-z0-9+/=_-]+$/;
24
+ const pathStart = /^(?:\/|\.\.?\/|~\/)/;
25
+ /**
26
+ * Whether a value in a free text field holds a key.
27
+ * Only the answer leaves the check; when it is `true`, never repeat the value.
28
+ *
29
+ * @param value - the text from the file
30
+ * @param name - the header, variable or setting the text belongs to
31
+ */
32
+ function holdsKey(value, name) {
33
+ if (findSecretShape(value) !== undefined) {
34
+ return true;
35
+ }
36
+ if (name === undefined || !credentialName.test(name)) {
37
+ return false;
38
+ }
39
+ const credential = value.trim().replace(authScheme, "");
40
+ return !pathStart.test(credential) && keyCharacters.test(credential) && looksLikeKey(credential);
41
+ }
42
+ /*
43
+ * The words wait on the board (HAL-2264, P8), like those in
44
+ * `secret-name.ts`. Each says where the secret's name goes instead.
45
+ */
46
+ const opening = "This looks like an API key written into the file.";
47
+ const words = {
48
+ header: `${opening} Remove it, store the key as a secret, and write the secret's name in the connector's secret, which is sent as a bearer token.`,
49
+ env: `${opening} Remove it, store the key as a secret, and set this variable under secretEnv to the secret's name instead.`,
50
+ arg: `${opening} Remove it, store the key as a secret, and give it to the program through secretEnv instead of its arguments.`,
51
+ "provider-option": `${opening} Remove it, store the key as a secret, and write the secret's name in the provider's secret.`,
52
+ setting: `${opening} Remove it and store the key as a secret, so the file can be shared and committed safely.`,
53
+ };
54
+ /**
55
+ * Checks every text in a free field for a pasted key, down through nested
56
+ * maps and lists, and reports each one as the error `value-looks-like-key`
57
+ * at its own path. The message never repeats the value.
58
+ *
59
+ * @param value - the field's value from the file
60
+ * @param path - where the field sits in the file
61
+ * @param place - which advice the message gives
62
+ * @param name - the name the value sits under, when the field itself is one entry
63
+ * @returns one problem per text that holds a key
64
+ *
65
+ * @example
66
+ * checkKeysIn({ Authorization: `Bearer sk-${"Q7x2Lm9K".repeat(4)}` }, ["headers"], "header");
67
+ * // [{ code: "value-looks-like-key", path: ["headers", "Authorization"], … }]
68
+ */
69
+ export function checkKeysIn(value, path, place, name) {
70
+ if (typeof value === "string") {
71
+ return holdsKey(value, name)
72
+ ? [{ severity: "error", code: "value-looks-like-key", path, message: words[place] }]
73
+ : [];
74
+ }
75
+ if (Array.isArray(value)) {
76
+ return value.flatMap((item, index) => checkKeysIn(item, [...path, index], place, name));
77
+ }
78
+ if (typeof value === "object" && value !== null) {
79
+ return Object.entries(value).flatMap(([key, item]) => checkKeysIn(item, [...path, key], place, key));
80
+ }
81
+ return [];
82
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Returns a copy of `map` with the key `oldName` read as `newName`, so files
3
+ * from before a rename keep loading. When the file already has `newName`,
4
+ * the old key stays as it is and the schema reports it as unknown.
5
+ */
6
+ export declare function renameKey(map: Readonly<Record<string, unknown>>, oldName: string, newName: string): Record<string, unknown>;
7
+ /** Whether a value is a plain map (not a list, not null). */
8
+ export declare function isMap(value: unknown): value is Readonly<Record<string, unknown>>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Returns a copy of `map` with the key `oldName` read as `newName`, so files
3
+ * from before a rename keep loading. When the file already has `newName`,
4
+ * the old key stays as it is and the schema reports it as unknown.
5
+ */
6
+ export function renameKey(map, oldName, newName) {
7
+ if (!Object.hasOwn(map, oldName) || Object.hasOwn(map, newName)) {
8
+ return { ...map };
9
+ }
10
+ // fromEntries defines keys as plain properties, so a "__proto__" key in a
11
+ // file stays data instead of changing the copy's prototype.
12
+ return Object.fromEntries(Object.entries(map).map(([key, value]) => [key === oldName ? newName : key, value]));
13
+ }
14
+ /** Whether a value is a plain map (not a list, not null). */
15
+ export function isMap(value) {
16
+ return typeof value === "object" && value !== null && !Array.isArray(value);
17
+ }
@@ -0,0 +1,60 @@
1
+ /**
2
+ * How Halonic reads a program start for the paths it names. Three guards
3
+ * refuse a start by what it names: a skill's `scripts/` folder
4
+ * (`format.skill-scripts-folder`), and an agent's working folder, both as
5
+ * written in a workspace (`workspace.working-folders`) and on the real file
6
+ * system (`format.working-folder-start`). They read a start the same way, so
7
+ * a path one of them finds, the others find too (HAL-4777). Reading too much
8
+ * as a path only makes a guard stricter.
9
+ */
10
+ /** What a start would run: the program, its arguments, the folder it starts in and its environment. */
11
+ export interface ProgramStart {
12
+ readonly cwd: string;
13
+ readonly program: string;
14
+ readonly args: readonly string[];
15
+ /** The variables the program gets. Their values are read for paths; their names aren't. */
16
+ readonly env?: Readonly<Record<string, string>>;
17
+ }
18
+ /** A path a start names. */
19
+ export interface NamedPath {
20
+ /** The path as written. A relative path is read from the start folder. */
21
+ readonly path: string;
22
+ /** The program, argument or `NAME=value` it comes from, for a message. */
23
+ readonly shown: string;
24
+ }
25
+ /**
26
+ * The paths a start names, besides the folder it starts in: the program,
27
+ * every path each argument names (see {@link pathsIn}), the folder path of a
28
+ * module that `python -m` runs (see {@link moduleIn}) and every path an `env`
29
+ * value names. The start folder isn't listed, as each guard reads it on its
30
+ * own terms.
31
+ *
32
+ * @example
33
+ * pathsNamedBy({ cwd: ".", program: "node", args: ["--config=tools/mail.json"] });
34
+ * // [{ path: "node", shown: "node" },
35
+ * // { path: "--config=tools/mail.json", shown: "--config=tools/mail.json" },
36
+ * // { path: "--config", shown: "--config=tools/mail.json" },
37
+ * // { path: "tools/mail.json", shown: "--config=tools/mail.json" }]
38
+ */
39
+ export declare function pathsNamedBy({ program, args, env }: ProgramStart): NamedPath[];
40
+ /**
41
+ * The paths an argument or `env` value may name: the whole text, each piece
42
+ * between `;` and spaces (a Windows `PATH` keeps its drive letters), each
43
+ * piece between `=`, `:`, `;`, `@` and spaces (as in
44
+ * `--config=tools/mail.json`, `--define=KEY=tools/x`, `PATH=tools/bin:/usr/bin`,
45
+ * `file:tools/x` or `@tools/args.txt`), the whole text after each `=`, `:`
46
+ * and `@` (so `--file=my link` still names `my link`), the whole text inside
47
+ * each pair of quotes (as in `--require "my tools/x.js"`), each piece without
48
+ * its quotes (HAL-4903), and each piece without its short flag, as in
49
+ * `-ctools/mail.json`.
50
+ */
51
+ export declare function pathsIn(text: string): string[];
52
+ /**
53
+ * The folder paths of a module that `python -m` runs, from the argument at
54
+ * `index`: `-m tools.mail`, `-mtools.mail` and, with `-m` among other short
55
+ * flags, `-Im tools.mail` or `-Imtools.mail` read `tools/mail`. Both readings
56
+ * are kept: in `-Wm -mtools.mail`, the argument is read as a module after
57
+ * `-Wm` and as `-m` with its module, so a guard never reads less than before
58
+ * (HAL-4903). Empty when that argument names no module.
59
+ */
60
+ export declare function moduleIn(args: readonly string[], index: number): string[];
@@ -0,0 +1,99 @@
1
+ /**
2
+ * How Halonic reads a program start for the paths it names. Three guards
3
+ * refuse a start by what it names: a skill's `scripts/` folder
4
+ * (`format.skill-scripts-folder`), and an agent's working folder, both as
5
+ * written in a workspace (`workspace.working-folders`) and on the real file
6
+ * system (`format.working-folder-start`). They read a start the same way, so
7
+ * a path one of them finds, the others find too (HAL-4777). Reading too much
8
+ * as a path only makes a guard stricter.
9
+ */
10
+ /**
11
+ * The paths a start names, besides the folder it starts in: the program,
12
+ * every path each argument names (see {@link pathsIn}), the folder path of a
13
+ * module that `python -m` runs (see {@link moduleIn}) and every path an `env`
14
+ * value names. The start folder isn't listed, as each guard reads it on its
15
+ * own terms.
16
+ *
17
+ * @example
18
+ * pathsNamedBy({ cwd: ".", program: "node", args: ["--config=tools/mail.json"] });
19
+ * // [{ path: "node", shown: "node" },
20
+ * // { path: "--config=tools/mail.json", shown: "--config=tools/mail.json" },
21
+ * // { path: "--config", shown: "--config=tools/mail.json" },
22
+ * // { path: "tools/mail.json", shown: "--config=tools/mail.json" }]
23
+ */
24
+ export function pathsNamedBy({ program, args, env = {} }) {
25
+ const named = (shown, paths) => paths.map((path) => ({ path, shown }));
26
+ return [
27
+ { path: program, shown: program },
28
+ ...args.flatMap((arg, index) => named(arg, [...pathsIn(arg), ...moduleIn(args, index)])),
29
+ ...Object.entries(env).flatMap(([name, value]) => named(`${name}=${value}`, pathsIn(value))),
30
+ ];
31
+ }
32
+ /**
33
+ * The paths an argument or `env` value may name: the whole text, each piece
34
+ * between `;` and spaces (a Windows `PATH` keeps its drive letters), each
35
+ * piece between `=`, `:`, `;`, `@` and spaces (as in
36
+ * `--config=tools/mail.json`, `--define=KEY=tools/x`, `PATH=tools/bin:/usr/bin`,
37
+ * `file:tools/x` or `@tools/args.txt`), the whole text after each `=`, `:`
38
+ * and `@` (so `--file=my link` still names `my link`), the whole text inside
39
+ * each pair of quotes (as in `--require "my tools/x.js"`), each piece without
40
+ * its quotes (HAL-4903), and each piece without its short flag, as in
41
+ * `-ctools/mail.json`.
42
+ */
43
+ export function pathsIn(text) {
44
+ const pieces = [
45
+ text,
46
+ ...text.split(/[;\s]+/),
47
+ ...text.split(/[=:;@\s]+/),
48
+ ...textsAfter(/[=:@]/g, text),
49
+ ...textsInQuotes(text),
50
+ ];
51
+ const withoutQuotes = pieces.flatMap((piece) => [piece, piece.replaceAll(/["']/g, "")]);
52
+ const withoutFlags = withoutQuotes.flatMap((piece) => /^-[^-]./.test(piece) ? [piece, piece.slice(2)] : [piece]);
53
+ return [...new Set(withoutFlags.filter((piece) => piece !== ""))];
54
+ }
55
+ /** The whole text after each match of `separator`: `a=b:c` gives `b:c` and `c` for `/[=:]/g`. */
56
+ function textsAfter(separator, text) {
57
+ return [...text.matchAll(separator)].map((match) => text.slice(match.index + 1));
58
+ }
59
+ /**
60
+ * The text inside each pair of `"` and each pair of `'`: `--require "my x.js"`
61
+ * gives `my x.js`. The two kinds are paired in separate passes, so a stray
62
+ * apostrophe, as in `it's --require "my x.js"`, can't hide a double-quoted
63
+ * path (HAL-4903). A quote escaped with `\` inside quotes isn't read as part
64
+ * of the path; that needs a path with quotes and spaces in its name.
65
+ */
66
+ function textsInQuotes(text) {
67
+ const inPairsOf = (quote) => [...text.matchAll(new RegExp(`${quote}([^${quote}]*)${quote}`, "g"))].map((match) => match[1] ?? "");
68
+ return [...inPairsOf('"'), ...inPairsOf("'")];
69
+ }
70
+ /**
71
+ * The folder paths of a module that `python -m` runs, from the argument at
72
+ * `index`: `-m tools.mail`, `-mtools.mail` and, with `-m` among other short
73
+ * flags, `-Im tools.mail` or `-Imtools.mail` read `tools/mail`. Both readings
74
+ * are kept: in `-Wm -mtools.mail`, the argument is read as a module after
75
+ * `-Wm` and as `-m` with its module, so a guard never reads less than before
76
+ * (HAL-4903). Empty when that argument names no module.
77
+ */
78
+ export function moduleIn(args, index) {
79
+ return moduleNames(args[index - 1], args[index] ?? "").map((name) => name.replaceAll(".", "/"));
80
+ }
81
+ /** The modules an argument names: after a `-m` before it, and after its own `-m`. */
82
+ function moduleNames(before, arg) {
83
+ const afterFlagBefore = before !== undefined && textAfterShortM(before) === "" ? arg : "";
84
+ const afterOwnFlag = textAfterShortM(arg) ?? "";
85
+ return [...new Set([afterFlagBefore, afterOwnFlag].filter((name) => name !== ""))];
86
+ }
87
+ /**
88
+ * The text after the first `m` in a group of short flags, as Python reads
89
+ * one: `-Imtools.mail` gives `tools.mail`, and `-Im` gives an empty text, as
90
+ * the module is the next argument. Undefined when the argument isn't a group
91
+ * of short flags or has no `m`. A flag that takes a value, as in `-Xdev`, may
92
+ * read a stray module; that only makes a guard stricter.
93
+ */
94
+ function textAfterShortM(arg) {
95
+ if (!/^-[^-]/.test(arg))
96
+ return undefined;
97
+ const at = arg.indexOf("m", 1);
98
+ return at === -1 ? undefined : arg.slice(at + 1);
99
+ }