@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,218 @@
1
+ import { passesNameRule } from "../../../../ports/src/index.js";
2
+ import { isSecretVariableName } from "../../../../std/src/index.js";
3
+ import { checkKeysIn } from "../../shared/key-in-value.js";
4
+ import { checkSecretName, looksLikeKey } from "../../shared/secret-name.js";
5
+ import { approveAll, Connector } from "./schema.js";
6
+ /** `library/connectors/<id>.connector.yaml`, shared at the root or a hub's own. */
7
+ export const connectorKind = {
8
+ name: "connector",
9
+ about: "Tools for agents from an MCP server or a built-in service such as Google.",
10
+ syntax: "yaml",
11
+ schema: Connector,
12
+ places: [
13
+ { scope: "workspace-and-hub", folder: "library/connectors", name: "<id>.connector.yaml" },
14
+ ],
15
+ idFromPlace: "fallback",
16
+ check: (connector) => [
17
+ ...checkSecretNames(connector),
18
+ ...checkGoogleValues(connector),
19
+ ...checkPastedKeys(connector),
20
+ ...checkInheritedNames(connector),
21
+ ...checkApprovedTools(connector),
22
+ ...checkReadTools(connector),
23
+ ],
24
+ };
25
+ /**
26
+ * Every value the connector gives as a secret's name: its own `secret` (the
27
+ * HTTP bearer token) and, for a local program, each `secretEnv` value. A
28
+ * Google connector names no secret: see {@link checkGoogleValues}.
29
+ */
30
+ function secretNames(connector) {
31
+ const names = [];
32
+ if (connector.secret !== undefined && !("google" in connector.transport)) {
33
+ names.push([connector.secret, ["secret"]]);
34
+ }
35
+ if ("stdio" in connector.transport) {
36
+ for (const [variable, name] of Object.entries(connector.transport.stdio.secretEnv ?? {})) {
37
+ names.push([name, ["transport", "stdio", "secretEnv", variable]]);
38
+ }
39
+ }
40
+ return names;
41
+ }
42
+ /** The secrets are named in the file, so a bad name or a pasted key is caught here, not at run time. */
43
+ function checkSecretNames(connector) {
44
+ return secretNames(connector).flatMap(([name, path]) => checkSecretName(name, path) ?? []);
45
+ }
46
+ /**
47
+ * A Google connector's `client` and `secret` name no secret. The account's
48
+ * Google setup decides which OAuth client a sign-in uses and keeps the
49
+ * refresh token as `google-account-<accountRef>` (`google-setup.store-names`).
50
+ * Both stay so older files still read, and both are refused only when they
51
+ * hold a pasted key, since the file may be committed or shared.
52
+ */
53
+ function checkGoogleValues(connector) {
54
+ if (!("google" in connector.transport)) {
55
+ return [];
56
+ }
57
+ const values = [
58
+ [connector.transport.google.client, ["transport", "google", "client"]],
59
+ [connector.secret, ["secret"]],
60
+ ];
61
+ return values.flatMap(([value, path]) => value !== undefined && looksLikeKey(value) ? (checkSecretName(value, path) ?? []) : []);
62
+ }
63
+ /**
64
+ * HTTP headers and a local program's `env` and `args` take any text, so a
65
+ * key pasted there would be saved in the file. The connector's `secret` and
66
+ * `secretEnv` name the secrets instead.
67
+ */
68
+ function checkPastedKeys(connector) {
69
+ const { transport } = connector;
70
+ if ("http" in transport) {
71
+ return checkKeysIn(transport.http.headers, ["transport", "http", "headers"], "header");
72
+ }
73
+ if ("stdio" in transport) {
74
+ const path = ["transport", "stdio"];
75
+ return [
76
+ ...checkKeysIn(transport.stdio.env, [...path, "env"], "env"),
77
+ ...transport.stdio.args.flatMap((arg, index) => {
78
+ const [name, value] = argument(arg, transport.stdio.args[index - 1]);
79
+ return checkKeysIn(value, [...path, "args", index], "arg", name);
80
+ }),
81
+ ];
82
+ }
83
+ return [];
84
+ }
85
+ /** A variable name a program can be given: letters, digits and `_`, not starting with a digit. */
86
+ const variableName = /^[A-Za-z_][A-Za-z0-9_]*$/;
87
+ /*
88
+ * The words are the team's (HAL-6266), next to the placeholders of
89
+ * `secret-name.ts` and `key-in-value.ts` that wait on the board.
90
+ */
91
+ const inheritWords = {
92
+ "inherit-env-name": (name) => `"${name}" isn't a variable name. Use only letters, digits and _, not starting with a digit.`,
93
+ "inherit-env-secret": (name) => `"${name}" looks like it holds a secret, so it can't be taken from your environment. Store the value as a secret and set this variable under secretEnv to the secret's name instead.`,
94
+ "inherit-env-duplicate": (name) => `"${name}" is already in this list. Name each variable once, whatever its letter case.`,
95
+ };
96
+ /**
97
+ * `inheritEnv` names variables a local program takes from the app's own
98
+ * environment. A name that says it holds a secret, such as
99
+ * `ANTHROPIC_API_KEY`, is refused: a workspace file must not reach for a
100
+ * key in the person's shell, and `secretEnv` names the secret openly. A name
101
+ * written twice, in any letter case, is refused too, since Windows reads
102
+ * `Aws_Profile` and `AWS_PROFILE` as one variable.
103
+ */
104
+ function checkInheritedNames(connector) {
105
+ if (!("stdio" in connector.transport)) {
106
+ return [];
107
+ }
108
+ const problems = [];
109
+ const seen = new Set();
110
+ (connector.transport.stdio.inheritEnv ?? []).forEach((name, index) => {
111
+ const path = ["transport", "stdio", "inheritEnv", index];
112
+ const folded = name.toUpperCase();
113
+ const repeated = seen.has(folded);
114
+ seen.add(folded);
115
+ if (!variableName.test(name)) {
116
+ const code = "inherit-env-name";
117
+ problems.push({ severity: "error", code, path, message: inheritWords[code](name) });
118
+ }
119
+ else if (isSecretVariableName(name)) {
120
+ const code = "inherit-env-secret";
121
+ problems.push({ severity: "error", code, path, message: inheritWords[code](name) });
122
+ }
123
+ else if (repeated) {
124
+ const code = "inherit-env-duplicate";
125
+ problems.push({ severity: "error", code, path, message: inheritWords[code](name) });
126
+ }
127
+ });
128
+ return problems;
129
+ }
130
+ /**
131
+ * An argument's value and the option it belongs to: `--api-key=…` and
132
+ * `--api-key …` both name the value, so a key without a known format is
133
+ * still caught after a flag that says it is one.
134
+ *
135
+ * @example
136
+ * argument("--token=abc", undefined); // ["--token", "abc"]
137
+ * argument("abc", "--token"); // ["--token", "abc"]
138
+ */
139
+ function argument(arg, before) {
140
+ const equals = arg.indexOf("=");
141
+ if (arg.startsWith("-") && equals > 0) {
142
+ return [arg.slice(0, equals), arg.slice(equals + 1)];
143
+ }
144
+ return [before?.startsWith("-") ? before : undefined, arg];
145
+ }
146
+ /**
147
+ * A tool that needs approval but isn't in `tools.allow` is never offered, so
148
+ * say so. `approve: all` names no tool, so there is nothing to compare.
149
+ */
150
+ function checkApprovedTools(connector) {
151
+ const { allow, approve } = connector.tools;
152
+ const problems = [];
153
+ if (allow === undefined || approve === approveAll) {
154
+ return problems;
155
+ }
156
+ approve.forEach((tool, index) => {
157
+ if (allow.includes(tool)) {
158
+ return;
159
+ }
160
+ problems.push({
161
+ severity: "warning",
162
+ code: "approved-tool-not-allowed",
163
+ path: ["tools", "approve", index],
164
+ message: `Connector "${connector.id}": "${tool}" needs approval but is not in tools.allow, so agents never see it`,
165
+ });
166
+ });
167
+ return problems;
168
+ }
169
+ /** Characters that make a name in `tools.read` look like a pattern, not a tool's name. */
170
+ const patternCharacters = /[*?[\]{}]/;
171
+ /**
172
+ * Said when a name in `tools.read` fails the listed-tool name rule. It
173
+ * doesn't quote the name: the character at fault may be invisible, so the
174
+ * name would look right. Wording: Sofia, HAL-5762.
175
+ */
176
+ const readNameBreaksRule = `"read" needs exact tool names: letters a–z and A–Z, digits 0–9, "_" and "-", up to 64 characters. This one doesn't match, often because of a space, a look-alike letter or an invisible character.`;
177
+ /**
178
+ * `tools.read` takes exact names only, so a pattern is refused rather than
179
+ * matching nothing in silence. A name must also pass the name rule that a
180
+ * server's tool names pass, so a look-alike letter, a space or an invisible
181
+ * character can't make a name read as one tool and be another; it is
182
+ * refused too. A name that `tools.allow` leaves out is never offered, so
183
+ * say so. Without `tools.allow` nothing checks the names against a listing:
184
+ * a name, exactly as written, makes a tool `read` as soon as a server lists
185
+ * a tool by that name. Wording: Sofia, HAL-5582 and HAL-5762.
186
+ */
187
+ function checkReadTools(connector) {
188
+ const { allow, read } = connector.tools;
189
+ const problems = [];
190
+ read?.forEach((tool, index) => {
191
+ const path = ["tools", "read", index];
192
+ if (patternCharacters.test(tool)) {
193
+ problems.push({
194
+ severity: "error",
195
+ code: "read-tool-pattern",
196
+ path,
197
+ message: `"read" needs exact tool names. "${tool}" looks like a pattern.`,
198
+ });
199
+ }
200
+ else if (!passesNameRule(tool)) {
201
+ problems.push({
202
+ severity: "error",
203
+ code: "read-tool-name",
204
+ path,
205
+ message: readNameBreaksRule,
206
+ });
207
+ }
208
+ else if (allow !== undefined && !allow.includes(tool)) {
209
+ problems.push({
210
+ severity: "warning",
211
+ code: "read-tool-not-allowed",
212
+ path,
213
+ message: `"read" lists "${tool}", but this connector has no tool by that name. Check the spelling.`,
214
+ });
215
+ }
216
+ });
217
+ return problems;
218
+ }
@@ -0,0 +1,74 @@
1
+ import { type Infer } from "../../../../schema-kit/src/index.js";
2
+ /** The `tools.approve` value that makes every tool of the connector ask a person first. */
3
+ export declare const approveAll = "all";
4
+ /**
5
+ * `library/connectors/<id>.connector.yaml`: tools for agents from an MCP
6
+ * server or a built-in service. Secrets are referenced by name only.
7
+ */
8
+ export declare const Connector: import("zod").ZodObject<{
9
+ version: import("zod").ZodDefault<import("zod").ZodLiteral<1>>;
10
+ id: import("zod").ZodString;
11
+ name: import("zod").ZodOptional<import("zod").ZodString>;
12
+ description: import("zod").ZodOptional<import("zod").ZodString>;
13
+ transport: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
14
+ http: import("zod").ZodObject<{
15
+ url: import("zod").ZodString;
16
+ headers: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
17
+ }, import("zod/v4/core").$strict>;
18
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
19
+ stdio: import("zod").ZodObject<{
20
+ command: import("zod").ZodString;
21
+ args: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
22
+ env: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
23
+ secretEnv: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
24
+ inheritEnv: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
25
+ cwd: import("zod").ZodOptional<import("zod").ZodString>;
26
+ sites: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
27
+ }, import("zod/v4/core").$strict>;
28
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
29
+ google: import("zod").ZodObject<{
30
+ account: import("zod").ZodString;
31
+ client: import("zod").ZodDefault<import("zod").ZodString>;
32
+ }, import("zod/v4/core").$strict>;
33
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
34
+ integration: import("zod").ZodObject<{
35
+ folder: import("zod").ZodString;
36
+ }, import("zod/v4/core").$strict>;
37
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
38
+ plugin: import("zod").ZodObject<{
39
+ id: import("zod").ZodString;
40
+ }, import("zod/v4/core").$strict>;
41
+ }, import("zod/v4/core").$strict>]>;
42
+ secret: import("zod").ZodOptional<import("zod").ZodString>;
43
+ tools: import("zod").ZodDefault<import("zod").ZodObject<{
44
+ allow: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
45
+ approve: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodArray<import("zod").ZodString>, import("zod").ZodLiteral<"all">]>>;
46
+ read: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
47
+ }, import("zod/v4/core").$strict>>;
48
+ local: import("zod").ZodOptional<import("zod").ZodBoolean>;
49
+ }, import("zod/v4/core").$strict>;
50
+ /** A connector, with defaults filled in. */
51
+ export type Connector = Infer<typeof Connector>;
52
+ /**
53
+ * Whether every call to `tool` waits for a person, as the connector's
54
+ * `tools.approve` says: the tool is listed there, or it says `all`.
55
+ * `tool` is the name the server lists the tool under.
56
+ *
57
+ * @example
58
+ * needsApproval({ approve: "all" }, "delete_file"); // true
59
+ * needsApproval({ approve: ["send_mail"] }, "read_mail"); // false
60
+ */
61
+ export declare function needsApproval(tools: Pick<Connector["tools"], "approve">, tool: string): boolean;
62
+ /**
63
+ * Whether the workspace marks `tool` as only reading, as the connector's
64
+ * `tools.read` says: the list names it exactly, and `tools.approve` doesn't
65
+ * make it ask first, so `approve` wins when both name a tool. `tool` is the
66
+ * name the server lists the tool under. A tool this says `false` for counts
67
+ * as `write`, or `send` when its listing says so.
68
+ *
69
+ * @example
70
+ * marksRead({ approve: [], read: ["search_issues"] }, "search_issues"); // true
71
+ * marksRead({ approve: ["search_issues"], read: ["search_issues"] }, "search_issues"); // false
72
+ * marksRead({ approve: [] }, "search_issues"); // false
73
+ */
74
+ export declare function marksRead(tools: Pick<Connector["tools"], "approve" | "read">, tool: string): boolean;
@@ -0,0 +1,143 @@
1
+ import { s } from "../../../../schema-kit/src/index.js";
2
+ import { id, version } from "../../shared/fields.js";
3
+ import { AllowedSitesInUnion } from "../agent/sandbox-fields.js";
4
+ /** A remote MCP server over HTTP. */
5
+ const HttpTransport = s
6
+ .object({
7
+ http: s
8
+ .object({ url: s.string().url(), headers: s.record(s.string(), s.string()).optional() })
9
+ .strict(),
10
+ })
11
+ .strict();
12
+ /** A local MCP program over standard input and output. */
13
+ const StdioTransport = s
14
+ .object({
15
+ stdio: s
16
+ .object({
17
+ command: s.string().min(1),
18
+ args: s.array(s.string()).default([]),
19
+ /** Plain environment variables; secrets go in `secretEnv`. */
20
+ env: s.record(s.string(), s.string()).optional(),
21
+ /** Environment variable → secret name. */
22
+ secretEnv: s.record(s.string(), s.string()).optional(),
23
+ /**
24
+ * Variables taken from the app's own environment by name, such as
25
+ * `AWS_PROFILE`, on top of the base every program gets. No secret:
26
+ * a key goes in `secretEnv`.
27
+ */
28
+ inheritEnv: s.array(s.string()).optional(),
29
+ /** Working directory, relative to the workspace root. */
30
+ cwd: s.string().optional(),
31
+ /**
32
+ * The sites the program may reach when it runs in a sandbox: host
33
+ * names or `*.` and a domain, with the agent file's `allowedSites`
34
+ * rules. Without a sandbox the program runs as before, unfenced.
35
+ */
36
+ sites: AllowedSitesInUnion.optional(),
37
+ })
38
+ .strict(),
39
+ })
40
+ .strict();
41
+ /** Built-in Gmail and Google Drive for one Google account. */
42
+ const GoogleTransport = s
43
+ .object({
44
+ google: s
45
+ .object({
46
+ /** The Google account the connector acts as. */
47
+ account: s.string().email(),
48
+ /**
49
+ * Kept so older files still read. It names no secret: the OAuth
50
+ * client's ID and secret come from the account's Google setup, which
51
+ * only the host's setup routes write (`@halonicjs/google-setup`).
52
+ */
53
+ client: s.string().default("google"),
54
+ })
55
+ .strict(),
56
+ })
57
+ .strict();
58
+ /**
59
+ * A local integration: a folder under `integrations/` whose code runs in the
60
+ * I5 runner. The tools offered are the ones its permission sheet names.
61
+ */
62
+ const IntegrationTransport = s.object({ integration: s.object({ folder: id }).strict() }).strict();
63
+ /** A plugin's backend, started in the I5 runner. Same rules as a local integration. */
64
+ const PluginTransport = s.object({ plugin: s.object({ id }).strict() }).strict();
65
+ /** The `tools.approve` value that makes every tool of the connector ask a person first. */
66
+ export const approveAll = "all";
67
+ /** Said when `tools.read` isn't a list of tool names. Wording: Sofia, HAL-5582. */
68
+ const readNotAList = '"read" must be a list of tool names.';
69
+ /**
70
+ * `library/connectors/<id>.connector.yaml`: tools for agents from an MCP
71
+ * server or a built-in service. Secrets are referenced by name only.
72
+ */
73
+ export const Connector = s
74
+ .object({
75
+ version,
76
+ id,
77
+ name: s.string().optional(),
78
+ description: s.string().optional(),
79
+ transport: s.union([
80
+ HttpTransport,
81
+ StdioTransport,
82
+ GoogleTransport,
83
+ IntegrationTransport,
84
+ PluginTransport,
85
+ ]),
86
+ /**
87
+ * HTTP: the secret sent as a bearer token. Google: kept so older files
88
+ * still read, but it names no secret: the account's Google setup keeps
89
+ * the refresh token (`@halonicjs/google-setup`).
90
+ */
91
+ secret: s.string().optional(),
92
+ tools: s
93
+ .object({
94
+ /** Only these tools are offered to agents. Leave out to offer every tool. */
95
+ allow: s.array(s.string()).optional(),
96
+ /**
97
+ * Every call to these tools waits for a person to approve or reject
98
+ * it. `all` means every tool the server offers, including tools it
99
+ * adds later: a new MCP connector starts with it.
100
+ */
101
+ approve: s.union([s.array(s.string()), s.literal(approveAll)]).default([]),
102
+ /**
103
+ * Tools listed here run without asking. Only list tools that don't
104
+ * change anything. Exact names only, no patterns: every tool not
105
+ * listed still asks first, and a tool `approve` names asks whatever
106
+ * this list says. Only the person writing this file sets it; nothing
107
+ * a connector's server lists can add a tool to it.
108
+ */
109
+ read: s.array(s.string({ error: readNotAList }), { error: readNotAList }).optional(),
110
+ })
111
+ .strict()
112
+ .default({ approve: [] }),
113
+ /** Runs on this machine or your own network. Default: true for stdio and localhost URLs, false for integrations and plugins, whose sheet can name outside sites. */
114
+ local: s.boolean().optional(),
115
+ })
116
+ .strict();
117
+ /**
118
+ * Whether every call to `tool` waits for a person, as the connector's
119
+ * `tools.approve` says: the tool is listed there, or it says `all`.
120
+ * `tool` is the name the server lists the tool under.
121
+ *
122
+ * @example
123
+ * needsApproval({ approve: "all" }, "delete_file"); // true
124
+ * needsApproval({ approve: ["send_mail"] }, "read_mail"); // false
125
+ */
126
+ export function needsApproval(tools, tool) {
127
+ return tools.approve === approveAll || tools.approve.includes(tool);
128
+ }
129
+ /**
130
+ * Whether the workspace marks `tool` as only reading, as the connector's
131
+ * `tools.read` says: the list names it exactly, and `tools.approve` doesn't
132
+ * make it ask first, so `approve` wins when both name a tool. `tool` is the
133
+ * name the server lists the tool under. A tool this says `false` for counts
134
+ * as `write`, or `send` when its listing says so.
135
+ *
136
+ * @example
137
+ * marksRead({ approve: [], read: ["search_issues"] }, "search_issues"); // true
138
+ * marksRead({ approve: ["search_issues"], read: ["search_issues"] }, "search_issues"); // false
139
+ * marksRead({ approve: [] }, "search_issues"); // false
140
+ */
141
+ export function marksRead(tools, tool) {
142
+ return (tools.read?.includes(tool) ?? false) && !needsApproval(tools, tool);
143
+ }
@@ -0,0 +1,4 @@
1
+ import type { FileKind } from "../../kind.js";
2
+ import { Deployments } from "./schema.js";
3
+ /** `deployments.yaml` at the workspace root. */
4
+ export declare const deploymentsKind: FileKind<Deployments>;
@@ -0,0 +1,49 @@
1
+ import { Deployments } from "./schema.js";
2
+ /** `deployments.yaml` at the workspace root. */
3
+ export const deploymentsKind = {
4
+ name: "deployments",
5
+ about: "The places the workspace runs, each with its own runtime data.",
6
+ syntax: "yaml",
7
+ schema: Deployments,
8
+ places: [{ scope: "workspace", folder: "", name: "deployments.yaml" }],
9
+ idFromPlace: "none",
10
+ check: checkDeployments,
11
+ };
12
+ /**
13
+ * The default deployment, when one is named, must be one of the listed ones,
14
+ * and Cloudflare settings on another host are flagged as unused.
15
+ */
16
+ function checkDeployments(file) {
17
+ return [...checkDefault(file), ...checkUnusedCloudflare(file)];
18
+ }
19
+ /** The default deployment, when one is named, must be one of the listed ones. */
20
+ function checkDefault(file) {
21
+ if (file.default === undefined || Object.hasOwn(file.deployments, file.default)) {
22
+ return [];
23
+ }
24
+ return [
25
+ {
26
+ severity: "error",
27
+ code: "default-deployment-not-listed",
28
+ path: ["default"],
29
+ message: `The default deployment "${file.default}" is not listed`,
30
+ },
31
+ ];
32
+ }
33
+ /**
34
+ * Cloudflare settings on a deployment that runs elsewhere are a warning, not
35
+ * an error: moving a deployment to another host changes only `host:`, so the
36
+ * settings may stay behind for the way back (ADR HAL-35, 2).
37
+ */
38
+ function checkUnusedCloudflare(file) {
39
+ return Object.entries(file.deployments).flatMap(([id, deployment]) => deployment.cloudflare === undefined || deployment.host === "cloudflare"
40
+ ? []
41
+ : [
42
+ {
43
+ severity: "warning",
44
+ code: "cloudflare-settings-unused",
45
+ path: ["deployments", id, "cloudflare"],
46
+ message: `Deployment "${id}" runs on host "${deployment.host}", so its cloudflare settings are not used`,
47
+ },
48
+ ]);
49
+ }
@@ -0,0 +1,77 @@
1
+ import { type Infer } from "../../../../schema-kit/src/index.js";
2
+ /**
3
+ * Non-secret settings for a deployment with `host: cloudflare` (ADR HAL-35,
4
+ * 5.7). They carry no account id, token or key, so the file stays safe to
5
+ * commit and the same file deploys from any account.
6
+ */
7
+ export declare const CloudflareSettings: import("zod").ZodObject<{
8
+ worker: import("zod").ZodString;
9
+ domain: import("zod").ZodOptional<import("zod").ZodString>;
10
+ location: import("zod").ZodOptional<import("zod").ZodEnum<{
11
+ eu: "eu";
12
+ }>>;
13
+ }, import("zod/v4/core").$strict>;
14
+ /** Ceilings the deployment's handler enforces, because Cloudflare has no hard spending cap. */
15
+ export declare const DeploymentLimits: import("zod").ZodObject<{
16
+ dailyRequests: import("zod").ZodOptional<import("zod").ZodNumber>;
17
+ }, import("zod/v4/core").$strict>;
18
+ /** One place the workspace runs, with its own data (runs, Inbox, records, simulations). */
19
+ export declare const Deployment: import("zod").ZodObject<{
20
+ name: import("zod").ZodString;
21
+ description: import("zod").ZodOptional<import("zod").ZodString>;
22
+ host: import("zod").ZodDefault<import("zod").ZodEnum<{
23
+ cloudflare: "cloudflare";
24
+ local: "local";
25
+ }>>;
26
+ stage: import("zod").ZodDefault<import("zod").ZodEnum<{
27
+ development: "development";
28
+ production: "production";
29
+ }>>;
30
+ shadow: import("zod").ZodDefault<import("zod").ZodBoolean>;
31
+ cloudflare: import("zod").ZodOptional<import("zod").ZodObject<{
32
+ worker: import("zod").ZodString;
33
+ domain: import("zod").ZodOptional<import("zod").ZodString>;
34
+ location: import("zod").ZodOptional<import("zod").ZodEnum<{
35
+ eu: "eu";
36
+ }>>;
37
+ }, import("zod/v4/core").$strict>>;
38
+ limits: import("zod").ZodOptional<import("zod").ZodObject<{
39
+ dailyRequests: import("zod").ZodOptional<import("zod").ZodNumber>;
40
+ }, import("zod/v4/core").$strict>>;
41
+ }, import("zod/v4/core").$strict>;
42
+ /** `deployments.yaml`: the places the workspace runs. */
43
+ export declare const Deployments: import("zod").ZodObject<{
44
+ version: import("zod").ZodDefault<import("zod").ZodLiteral<1>>;
45
+ default: import("zod").ZodOptional<import("zod").ZodString>;
46
+ deployments: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
47
+ name: import("zod").ZodString;
48
+ description: import("zod").ZodOptional<import("zod").ZodString>;
49
+ host: import("zod").ZodDefault<import("zod").ZodEnum<{
50
+ cloudflare: "cloudflare";
51
+ local: "local";
52
+ }>>;
53
+ stage: import("zod").ZodDefault<import("zod").ZodEnum<{
54
+ development: "development";
55
+ production: "production";
56
+ }>>;
57
+ shadow: import("zod").ZodDefault<import("zod").ZodBoolean>;
58
+ cloudflare: import("zod").ZodOptional<import("zod").ZodObject<{
59
+ worker: import("zod").ZodString;
60
+ domain: import("zod").ZodOptional<import("zod").ZodString>;
61
+ location: import("zod").ZodOptional<import("zod").ZodEnum<{
62
+ eu: "eu";
63
+ }>>;
64
+ }, import("zod/v4/core").$strict>>;
65
+ limits: import("zod").ZodOptional<import("zod").ZodObject<{
66
+ dailyRequests: import("zod").ZodOptional<import("zod").ZodNumber>;
67
+ }, import("zod/v4/core").$strict>>;
68
+ }, import("zod/v4/core").$strict>>;
69
+ }, import("zod/v4/core").$strict>;
70
+ /** A deployment's Cloudflare settings. */
71
+ export type CloudflareSettings = Infer<typeof CloudflareSettings>;
72
+ /** A deployment's ceilings. */
73
+ export type DeploymentLimits = Infer<typeof DeploymentLimits>;
74
+ /** One deployment, with defaults filled in. */
75
+ export type Deployment = Infer<typeof Deployment>;
76
+ /** The content of `deployments.yaml`, with defaults filled in. */
77
+ export type Deployments = Infer<typeof Deployments>;
@@ -0,0 +1,94 @@
1
+ import { s } from "../../../../schema-kit/src/index.js";
2
+ import { deploymentId, version } from "../../shared/fields.js";
3
+ /**
4
+ * The most characters a Worker name may have: it becomes the first label of
5
+ * `<worker>.<account>.workers.dev`, and a DNS label holds at most 63.
6
+ */
7
+ const WORKER_NAME_MAX_LENGTH = 63;
8
+ /** The most characters a host name may have in DNS. */
9
+ const HOST_NAME_MAX_LENGTH = 253;
10
+ /**
11
+ * A host name: lowercase labels of letters, digits and inner `-`, joined by
12
+ * dots, with a top-level label that isn't all digits. The length cap is a
13
+ * separate `maxLength`, not a lookahead, so the JSON Schema's pattern also
14
+ * works in Go and Rust regex libraries, which have no lookaround.
15
+ */
16
+ const HOST_NAME_PATTERN = /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
17
+ /**
18
+ * Non-secret settings for a deployment with `host: cloudflare` (ADR HAL-35,
19
+ * 5.7). They carry no account id, token or key, so the file stays safe to
20
+ * commit and the same file deploys from any account.
21
+ */
22
+ export const CloudflareSettings = s
23
+ .object({
24
+ /** The Worker's name; it serves at `<worker>.<account>.workers.dev`. */
25
+ worker: s
26
+ .string()
27
+ .min(1)
28
+ .max(WORKER_NAME_MAX_LENGTH, `use at most ${WORKER_NAME_MAX_LENGTH} characters, so the name fits in a workers.dev address`)
29
+ .regex(/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/, "use lowercase letters, digits or '-', not at the start or end"),
30
+ /** A custom domain the Worker also serves at, such as `halonic.example.com`. */
31
+ domain: s
32
+ .string()
33
+ .max(HOST_NAME_MAX_LENGTH, `use at most ${HOST_NAME_MAX_LENGTH} characters`)
34
+ .regex(HOST_NAME_PATTERN, "use a lowercase host name such as halonic.example.com")
35
+ .optional(),
36
+ /**
37
+ * Where the deployment keeps its data. `eu` keeps D1, R2 and Durable
38
+ * Objects in the EU jurisdiction. Cloudflare fixes it when the data is
39
+ * first created, so changing it later needs an export and an import.
40
+ */
41
+ location: s.enum(["eu"]).optional(),
42
+ })
43
+ .strict();
44
+ /** Ceilings the deployment's handler enforces, because Cloudflare has no hard spending cap. */
45
+ export const DeploymentLimits = s
46
+ .object({
47
+ /** The most requests the deployment answers per UTC day; beyond it, it refuses them. */
48
+ dailyRequests: s.number().int().positive().optional(),
49
+ })
50
+ .strict();
51
+ /** One place the workspace runs, with its own data (runs, Inbox, records, simulations). */
52
+ export const Deployment = s
53
+ .object({
54
+ name: s.string().min(1),
55
+ description: s.string().optional(),
56
+ /** Where it runs: `halonic serve` on a machine, or Cloudflare. */
57
+ host: s.enum(["local", "cloudflare"]).default("local"),
58
+ stage: s.enum(["development", "production"]).default("development"),
59
+ /** Every write a connector would make is only recorded, never done. */
60
+ shadow: s.boolean().default(false),
61
+ /** Settings used when `host` is `cloudflare`. */
62
+ cloudflare: CloudflareSettings.optional(),
63
+ /** Ceilings on what the deployment answers, such as requests per day. */
64
+ limits: DeploymentLimits.optional(),
65
+ })
66
+ .strict();
67
+ /** `deployments.yaml`: the places the workspace runs. */
68
+ export const Deployments = s
69
+ .object({
70
+ version,
71
+ /** The deployment `halonic serve` runs when none is named. */
72
+ default: s.string().optional(),
73
+ deployments: s
74
+ .record(deploymentId, Deployment, { error: deploymentIdProblem })
75
+ .refine((named) => Object.keys(named).length > 0, "Name at least one deployment"),
76
+ })
77
+ .strict();
78
+ /**
79
+ * Says why a deployment id was refused. Without it a refused key only reads
80
+ * "Invalid key in record", which doesn't tell the person what to change.
81
+ */
82
+ function deploymentIdProblem(issue) {
83
+ if (issue.code !== "invalid_key" || !Array.isArray(issue.issues)) {
84
+ return undefined;
85
+ }
86
+ const reasons = issue.issues.flatMap((keyIssue) => {
87
+ const isMessage = typeof keyIssue === "object" &&
88
+ keyIssue !== null &&
89
+ "message" in keyIssue &&
90
+ typeof keyIssue.message === "string";
91
+ return isMessage ? [keyIssue.message] : [];
92
+ });
93
+ return `Not a deployment id: ${reasons.join("; ")}`;
94
+ }
@@ -0,0 +1,4 @@
1
+ import type { FileKind } from "../../kind.js";
2
+ import { Hub } from "./schema.js";
3
+ /** `hub.yaml` in each `hubs/<id>/` folder; the folder name is the hub's id when the file has none. */
4
+ export declare const hubKind: FileKind<Hub>;