@halonicjs/testing 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (384) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +1 -0
  3. package/README.md +41 -1
  4. package/dist/adapters/http-kit/src/address-class.d.ts +34 -0
  5. package/dist/adapters/http-kit/src/address-class.js +109 -0
  6. package/dist/adapters/http-kit/src/index.d.ts +2 -0
  7. package/dist/adapters/http-kit/src/index.js +2 -0
  8. package/dist/adapters/http-kit/src/ip-address.d.ts +23 -0
  9. package/dist/adapters/http-kit/src/ip-address.js +89 -0
  10. package/dist/adapters/integration-kit/src/declaration.d.ts +14 -0
  11. package/dist/adapters/integration-kit/src/declaration.js +77 -0
  12. package/dist/adapters/integration-kit/src/host.d.ts +28 -0
  13. package/dist/adapters/integration-kit/src/host.js +30 -0
  14. package/dist/adapters/integration-kit/src/index.d.ts +14 -0
  15. package/dist/adapters/integration-kit/src/index.js +21 -0
  16. package/dist/adapters/integration-kit/src/leak-attempt.d.ts +14 -0
  17. package/dist/adapters/integration-kit/src/leak-attempt.js +16 -0
  18. package/dist/adapters/integration-kit/src/limited-http.d.ts +49 -0
  19. package/dist/adapters/integration-kit/src/limited-http.js +182 -0
  20. package/dist/adapters/integration-kit/src/load-problem.d.ts +20 -0
  21. package/dist/adapters/integration-kit/src/load-problem.js +1 -0
  22. package/dist/adapters/integration-kit/src/loader.d.ts +104 -0
  23. package/dist/adapters/integration-kit/src/loader.js +219 -0
  24. package/dist/adapters/integration-kit/src/local-address.d.ts +15 -0
  25. package/dist/adapters/integration-kit/src/local-address.js +25 -0
  26. package/dist/adapters/integration-kit/src/own-request.d.ts +33 -0
  27. package/dist/adapters/integration-kit/src/own-request.js +36 -0
  28. package/dist/adapters/integration-kit/src/plugin-load.d.ts +14 -0
  29. package/dist/adapters/integration-kit/src/plugin-load.js +58 -0
  30. package/dist/adapters/integration-kit/src/policy.d.ts +55 -0
  31. package/dist/adapters/integration-kit/src/policy.js +37 -0
  32. package/dist/adapters/integration-kit/src/request-body.d.ts +38 -0
  33. package/dist/adapters/integration-kit/src/request-body.js +68 -0
  34. package/dist/adapters/integration-kit/src/request-log.d.ts +25 -0
  35. package/dist/adapters/integration-kit/src/request-log.js +17 -0
  36. package/dist/adapters/integration-kit/src/response-body.d.ts +23 -0
  37. package/dist/adapters/integration-kit/src/response-body.js +117 -0
  38. package/dist/adapters/integration-kit/src/scoped-tokens.d.ts +14 -0
  39. package/dist/adapters/integration-kit/src/scoped-tokens.js +27 -0
  40. package/dist/adapters/integration-kit/src/secret-filter.d.ts +84 -0
  41. package/dist/adapters/integration-kit/src/secret-filter.js +205 -0
  42. package/dist/adapters/integration-kit/src/secret-in-request.d.ts +59 -0
  43. package/dist/adapters/integration-kit/src/secret-in-request.js +133 -0
  44. package/dist/adapters/integration-kit/src/secret-placement.d.ts +36 -0
  45. package/dist/adapters/integration-kit/src/secret-placement.js +190 -0
  46. package/dist/adapters/integration-kit/src/wait.d.ts +16 -0
  47. package/dist/adapters/integration-kit/src/wait.js +35 -0
  48. package/dist/core/events/src/add-usage.d.ts +10 -0
  49. package/dist/core/events/src/add-usage.js +27 -0
  50. package/dist/core/events/src/agent-resume.d.ts +24 -0
  51. package/dist/core/events/src/agent-resume.js +1 -0
  52. package/dist/core/events/src/home-path.d.ts +13 -0
  53. package/dist/core/events/src/home-path.js +26 -0
  54. package/dist/core/events/src/index.d.ts +13 -0
  55. package/dist/core/events/src/index.js +7 -0
  56. package/dist/core/events/src/run-basics.d.ts +205 -0
  57. package/dist/core/events/src/run-basics.js +1 -0
  58. package/dist/core/events/src/run-event.d.ts +434 -0
  59. package/dist/core/events/src/run-event.js +1 -0
  60. package/dist/core/events/src/run-summary.d.ts +108 -0
  61. package/dist/core/events/src/run-summary.js +1 -0
  62. package/dist/core/events/src/sandbox-blocked.d.ts +42 -0
  63. package/dist/core/events/src/sandbox-blocked.js +26 -0
  64. package/dist/core/events/src/sandbox-opened-read.d.ts +17 -0
  65. package/dist/core/events/src/sandbox-opened-read.js +63 -0
  66. package/dist/core/events/src/sandbox-opened.d.ts +94 -0
  67. package/dist/core/events/src/sandbox-opened.js +52 -0
  68. package/dist/core/events/src/summarize.d.ts +14 -0
  69. package/dist/core/events/src/summarize.js +188 -0
  70. package/dist/core/events/src/timeline-entry.d.ts +21 -0
  71. package/dist/core/events/src/timeline-entry.js +105 -0
  72. package/dist/core/events/src/upgrade.d.ts +23 -0
  73. package/dist/core/events/src/upgrade.js +49 -0
  74. package/dist/core/format/src/compact.d.ts +30 -0
  75. package/dist/core/format/src/compact.js +72 -0
  76. package/dist/core/format/src/index.d.ts +37 -0
  77. package/dist/core/format/src/index.js +23 -0
  78. package/dist/core/format/src/integration/index.d.ts +6 -0
  79. package/dist/core/format/src/integration/index.js +9 -0
  80. package/dist/core/format/src/json-schema.d.ts +26 -0
  81. package/dist/core/format/src/json-schema.js +48 -0
  82. package/dist/core/format/src/kind.d.ts +65 -0
  83. package/dist/core/format/src/kind.js +1 -0
  84. package/dist/core/format/src/kinds/agent/kind.d.ts +4 -0
  85. package/dist/core/format/src/kinds/agent/kind.js +10 -0
  86. package/dist/core/format/src/kinds/agent/sandbox-fields.d.ts +89 -0
  87. package/dist/core/format/src/kinds/agent/sandbox-fields.js +197 -0
  88. package/dist/core/format/src/kinds/agent/schema.d.ts +147 -0
  89. package/dist/core/format/src/kinds/agent/schema.js +107 -0
  90. package/dist/core/format/src/kinds/agent/working-folder-start.d.ts +74 -0
  91. package/dist/core/format/src/kinds/agent/working-folder-start.js +312 -0
  92. package/dist/core/format/src/kinds/collection/kind.d.ts +8 -0
  93. package/dist/core/format/src/kinds/collection/kind.js +14 -0
  94. package/dist/core/format/src/kinds/collection/schema.d.ts +89 -0
  95. package/dist/core/format/src/kinds/collection/schema.js +90 -0
  96. package/dist/core/format/src/kinds/connector/is-local.d.ts +10 -0
  97. package/dist/core/format/src/kinds/connector/is-local.js +43 -0
  98. package/dist/core/format/src/kinds/connector/kind.d.ts +4 -0
  99. package/dist/core/format/src/kinds/connector/kind.js +119 -0
  100. package/dist/core/format/src/kinds/connector/schema.d.ts +50 -0
  101. package/dist/core/format/src/kinds/connector/schema.js +92 -0
  102. package/dist/core/format/src/kinds/deployments/kind.d.ts +4 -0
  103. package/dist/core/format/src/kinds/deployments/kind.js +25 -0
  104. package/dist/core/format/src/kinds/deployments/schema.d.ts +37 -0
  105. package/dist/core/format/src/kinds/deployments/schema.js +42 -0
  106. package/dist/core/format/src/kinds/hub/kind.d.ts +4 -0
  107. package/dist/core/format/src/kinds/hub/kind.js +10 -0
  108. package/dist/core/format/src/kinds/hub/schema.d.ts +54 -0
  109. package/dist/core/format/src/kinds/hub/schema.js +34 -0
  110. package/dist/core/format/src/kinds/integration/kind.d.ts +16 -0
  111. package/dist/core/format/src/kinds/integration/kind.js +138 -0
  112. package/dist/core/format/src/kinds/integration/parse-sheet.d.ts +19 -0
  113. package/dist/core/format/src/kinds/integration/parse-sheet.js +24 -0
  114. package/dist/core/format/src/kinds/integration/policy.d.ts +67 -0
  115. package/dist/core/format/src/kinds/integration/policy.js +268 -0
  116. package/dist/core/format/src/kinds/integration/schema.d.ts +233 -0
  117. package/dist/core/format/src/kinds/integration/schema.js +233 -0
  118. package/dist/core/format/src/kinds/knowledge/kind.d.ts +4 -0
  119. package/dist/core/format/src/kinds/knowledge/kind.js +13 -0
  120. package/dist/core/format/src/kinds/knowledge/schema.d.ts +18 -0
  121. package/dist/core/format/src/kinds/knowledge/schema.js +25 -0
  122. package/dist/core/format/src/kinds/models/kind.d.ts +4 -0
  123. package/dist/core/format/src/kinds/models/kind.js +10 -0
  124. package/dist/core/format/src/kinds/models/schema.d.ts +92 -0
  125. package/dist/core/format/src/kinds/models/schema.js +38 -0
  126. package/dist/core/format/src/kinds/plugin/backend.d.ts +22 -0
  127. package/dist/core/format/src/kinds/plugin/backend.js +31 -0
  128. package/dist/core/format/src/kinds/plugin/checks.d.ts +13 -0
  129. package/dist/core/format/src/kinds/plugin/checks.js +131 -0
  130. package/dist/core/format/src/kinds/plugin/kind.d.ts +8 -0
  131. package/dist/core/format/src/kinds/plugin/kind.js +16 -0
  132. package/dist/core/format/src/kinds/plugin/problems.d.ts +24 -0
  133. package/dist/core/format/src/kinds/plugin/problems.js +65 -0
  134. package/dist/core/format/src/kinds/plugin/schema.d.ts +542 -0
  135. package/dist/core/format/src/kinds/plugin/schema.js +261 -0
  136. package/dist/core/format/src/kinds/plugin/setting-values.d.ts +17 -0
  137. package/dist/core/format/src/kinds/plugin/setting-values.js +38 -0
  138. package/dist/core/format/src/kinds/plugin/ui-checks.d.ts +8 -0
  139. package/dist/core/format/src/kinds/plugin/ui-checks.js +94 -0
  140. package/dist/core/format/src/kinds/provider/kind.d.ts +4 -0
  141. package/dist/core/format/src/kinds/provider/kind.js +24 -0
  142. package/dist/core/format/src/kinds/provider/schema.d.ts +17 -0
  143. package/dist/core/format/src/kinds/provider/schema.js +22 -0
  144. package/dist/core/format/src/kinds/routine/kind.d.ts +8 -0
  145. package/dist/core/format/src/kinds/routine/kind.js +25 -0
  146. package/dist/core/format/src/kinds/routine/schema.d.ts +84 -0
  147. package/dist/core/format/src/kinds/routine/schema.js +93 -0
  148. package/dist/core/format/src/kinds/runtime/kind.d.ts +4 -0
  149. package/dist/core/format/src/kinds/runtime/kind.js +13 -0
  150. package/dist/core/format/src/kinds/runtime/schema.d.ts +10 -0
  151. package/dist/core/format/src/kinds/runtime/schema.js +12 -0
  152. package/dist/core/format/src/kinds/skill/kind.d.ts +4 -0
  153. package/dist/core/format/src/kinds/skill/kind.js +10 -0
  154. package/dist/core/format/src/kinds/skill/schema.d.ts +17 -0
  155. package/dist/core/format/src/kinds/skill/schema.js +17 -0
  156. package/dist/core/format/src/kinds/skill/scripts-folder.d.ts +27 -0
  157. package/dist/core/format/src/kinds/skill/scripts-folder.js +37 -0
  158. package/dist/core/format/src/kinds/workflow/kind.d.ts +8 -0
  159. package/dist/core/format/src/kinds/workflow/kind.js +14 -0
  160. package/dist/core/format/src/kinds/workflow/schema.d.ts +162 -0
  161. package/dist/core/format/src/kinds/workflow/schema.js +106 -0
  162. package/dist/core/format/src/kinds/workflow-test/kind.d.ts +4 -0
  163. package/dist/core/format/src/kinds/workflow-test/kind.js +14 -0
  164. package/dist/core/format/src/kinds/workflow-test/schema.d.ts +67 -0
  165. package/dist/core/format/src/kinds/workflow-test/schema.js +59 -0
  166. package/dist/core/format/src/kinds/workspace/kind.d.ts +4 -0
  167. package/dist/core/format/src/kinds/workspace/kind.js +10 -0
  168. package/dist/core/format/src/kinds/workspace/schema.d.ts +72 -0
  169. package/dist/core/format/src/kinds/workspace/schema.js +66 -0
  170. package/dist/core/format/src/parse-file.d.ts +69 -0
  171. package/dist/core/format/src/parse-file.js +105 -0
  172. package/dist/core/format/src/recording/format.d.ts +81 -0
  173. package/dist/core/format/src/recording/format.js +102 -0
  174. package/dist/core/format/src/recording/index.d.ts +1 -0
  175. package/dist/core/format/src/recording/index.js +3 -0
  176. package/dist/core/format/src/registry.d.ts +64 -0
  177. package/dist/core/format/src/registry.js +61 -0
  178. package/dist/core/format/src/reserved.d.ts +20 -0
  179. package/dist/core/format/src/reserved.js +30 -0
  180. package/dist/core/format/src/shared/fields.d.ts +37 -0
  181. package/dist/core/format/src/shared/fields.js +54 -0
  182. package/dist/core/format/src/shared/guard.d.ts +32 -0
  183. package/dist/core/format/src/shared/guard.js +16 -0
  184. package/dist/core/format/src/shared/key-in-value.d.ts +28 -0
  185. package/dist/core/format/src/shared/key-in-value.js +82 -0
  186. package/dist/core/format/src/shared/legacy-keys.d.ts +8 -0
  187. package/dist/core/format/src/shared/legacy-keys.js +17 -0
  188. package/dist/core/format/src/shared/program-start.d.ts +60 -0
  189. package/dist/core/format/src/shared/program-start.js +99 -0
  190. package/dist/core/format/src/shared/relative-path.d.ts +29 -0
  191. package/dist/core/format/src/shared/relative-path.js +50 -0
  192. package/dist/core/format/src/shared/secret-name.d.ts +24 -0
  193. package/dist/core/format/src/shared/secret-name.js +107 -0
  194. package/dist/core/format/src/source.d.ts +16 -0
  195. package/dist/core/format/src/source.js +73 -0
  196. package/dist/core/ports/src/agent-placement-store.d.ts +74 -0
  197. package/dist/core/ports/src/agent-placement-store.js +27 -0
  198. package/dist/core/ports/src/blob-store.d.ts +33 -0
  199. package/dist/core/ports/src/blob-store.js +2 -0
  200. package/dist/core/ports/src/cant-try-error.d.ts +35 -0
  201. package/dist/core/ports/src/cant-try-error.js +44 -0
  202. package/dist/core/ports/src/chat.d.ts +127 -0
  203. package/dist/core/ports/src/chat.js +1 -0
  204. package/dist/core/ports/src/clock.d.ts +7 -0
  205. package/dist/core/ports/src/clock.js +2 -0
  206. package/dist/core/ports/src/connection-settings-store.d.ts +57 -0
  207. package/dist/core/ports/src/connection-settings-store.js +2 -0
  208. package/dist/core/ports/src/connector-client.d.ts +259 -0
  209. package/dist/core/ports/src/connector-client.js +2 -0
  210. package/dist/core/ports/src/coordination.d.ts +84 -0
  211. package/dist/core/ports/src/coordination.js +2 -0
  212. package/dist/core/ports/src/definition-store.d.ts +208 -0
  213. package/dist/core/ports/src/definition-store.js +122 -0
  214. package/dist/core/ports/src/digest.d.ts +14 -0
  215. package/dist/core/ports/src/digest.js +2 -0
  216. package/dist/core/ports/src/folder-reader.d.ts +89 -0
  217. package/dist/core/ports/src/folder-reader.js +2 -0
  218. package/dist/core/ports/src/harness-bridge-server.d.ts +189 -0
  219. package/dist/core/ports/src/harness-bridge-server.js +37 -0
  220. package/dist/core/ports/src/harness.d.ts +250 -0
  221. package/dist/core/ports/src/harness.js +45 -0
  222. package/dist/core/ports/src/http-client.d.ts +27 -0
  223. package/dist/core/ports/src/http-client.js +2 -0
  224. package/dist/core/ports/src/id-generator.d.ts +14 -0
  225. package/dist/core/ports/src/id-generator.js +2 -0
  226. package/dist/core/ports/src/index.d.ts +37 -0
  227. package/dist/core/ports/src/index.js +36 -0
  228. package/dist/core/ports/src/integration.d.ts +178 -0
  229. package/dist/core/ports/src/integration.js +13 -0
  230. package/dist/core/ports/src/knowledge-provider.d.ts +65 -0
  231. package/dist/core/ports/src/knowledge-provider.js +2 -0
  232. package/dist/core/ports/src/llm-cache.d.ts +13 -0
  233. package/dist/core/ports/src/llm-cache.js +2 -0
  234. package/dist/core/ports/src/llm-provider.d.ts +184 -0
  235. package/dist/core/ports/src/llm-provider.js +136 -0
  236. package/dist/core/ports/src/model-price.d.ts +34 -0
  237. package/dist/core/ports/src/model-price.js +25 -0
  238. package/dist/core/ports/src/password-hasher.d.ts +47 -0
  239. package/dist/core/ports/src/password-hasher.js +2 -0
  240. package/dist/core/ports/src/plugin-folder-writer.d.ts +104 -0
  241. package/dist/core/ports/src/plugin-folder-writer.js +95 -0
  242. package/dist/core/ports/src/port-versions.d.ts +44 -0
  243. package/dist/core/ports/src/port-versions.js +74 -0
  244. package/dist/core/ports/src/program-probe.d.ts +46 -0
  245. package/dist/core/ports/src/program-probe.js +2 -0
  246. package/dist/core/ports/src/record-store.d.ts +62 -0
  247. package/dist/core/ports/src/record-store.js +38 -0
  248. package/dist/core/ports/src/resource-probe.d.ts +59 -0
  249. package/dist/core/ports/src/resource-probe.js +2 -0
  250. package/dist/core/ports/src/run-executor.d.ts +302 -0
  251. package/dist/core/ports/src/run-executor.js +2 -0
  252. package/dist/core/ports/src/run-failure-error.d.ts +49 -0
  253. package/dist/core/ports/src/run-failure-error.js +47 -0
  254. package/dist/core/ports/src/run-store.d.ts +194 -0
  255. package/dist/core/ports/src/run-store.js +131 -0
  256. package/dist/core/ports/src/sandbox.d.ts +247 -0
  257. package/dist/core/ports/src/sandbox.js +34 -0
  258. package/dist/core/ports/src/scheduler.d.ts +85 -0
  259. package/dist/core/ports/src/scheduler.js +2 -0
  260. package/dist/core/ports/src/secrets.d.ts +128 -0
  261. package/dist/core/ports/src/secrets.js +144 -0
  262. package/dist/core/ports/src/token-store.d.ts +19 -0
  263. package/dist/core/ports/src/token-store.js +2 -0
  264. package/dist/core/ports/src/tool-approval-store.d.ts +211 -0
  265. package/dist/core/ports/src/tool-approval-store.js +57 -0
  266. package/dist/core/ports/src/trust-store.d.ts +72 -0
  267. package/dist/core/ports/src/trust-store.js +2 -0
  268. package/dist/core/ports/src/unfenced-run-consent-store.d.ts +43 -0
  269. package/dist/core/ports/src/unfenced-run-consent-store.js +2 -0
  270. package/dist/core/ports/src/vcs.d.ts +394 -0
  271. package/dist/core/ports/src/vcs.js +48 -0
  272. package/dist/core/schema-kit/src/builders.d.ts +50 -0
  273. package/dist/core/schema-kit/src/builders.js +72 -0
  274. package/dist/core/schema-kit/src/depth.d.ts +15 -0
  275. package/dist/core/schema-kit/src/depth.js +37 -0
  276. package/dist/core/schema-kit/src/index.d.ts +6 -0
  277. package/dist/core/schema-kit/src/index.js +6 -0
  278. package/dist/core/schema-kit/src/issue.d.ts +22 -0
  279. package/dist/core/schema-kit/src/issue.js +23 -0
  280. package/dist/core/schema-kit/src/json-schema.d.ts +23 -0
  281. package/dist/core/schema-kit/src/json-schema.js +22 -0
  282. package/dist/core/schema-kit/src/parse.d.ts +17 -0
  283. package/dist/core/schema-kit/src/parse.js +25 -0
  284. package/dist/core/schema-kit/src/schema.d.ts +12 -0
  285. package/dist/core/schema-kit/src/schema.js +1 -0
  286. package/dist/core/std/src/ascii-host.d.ts +18 -0
  287. package/dist/core/std/src/ascii-host.js +110 -0
  288. package/dist/core/std/src/assert.d.ts +39 -0
  289. package/dist/core/std/src/assert.js +59 -0
  290. package/dist/core/std/src/base64url.d.ts +23 -0
  291. package/dist/core/std/src/base64url.js +65 -0
  292. package/dist/core/std/src/canonical-json.d.ts +18 -0
  293. package/dist/core/std/src/canonical-json.js +56 -0
  294. package/dist/core/std/src/clock.d.ts +27 -0
  295. package/dist/core/std/src/clock.js +33 -0
  296. package/dist/core/std/src/constant-time.d.ts +16 -0
  297. package/dist/core/std/src/constant-time.js +26 -0
  298. package/dist/core/std/src/content-digest.d.ts +24 -0
  299. package/dist/core/std/src/content-digest.js +28 -0
  300. package/dist/core/std/src/deep-clone.d.ts +15 -0
  301. package/dist/core/std/src/deep-clone.js +59 -0
  302. package/dist/core/std/src/deep-equal.d.ts +23 -0
  303. package/dist/core/std/src/deep-equal.js +64 -0
  304. package/dist/core/std/src/emitter.d.ts +42 -0
  305. package/dist/core/std/src/emitter.js +74 -0
  306. package/dist/core/std/src/error-kind.d.ts +88 -0
  307. package/dist/core/std/src/error-kind.js +98 -0
  308. package/dist/core/std/src/hex.d.ts +10 -0
  309. package/dist/core/std/src/hex.js +16 -0
  310. package/dist/core/std/src/ids.d.ts +45 -0
  311. package/dist/core/std/src/ids.js +49 -0
  312. package/dist/core/std/src/index.d.ts +25 -0
  313. package/dist/core/std/src/index.js +26 -0
  314. package/dist/core/std/src/keyed-queue.d.ts +18 -0
  315. package/dist/core/std/src/keyed-queue.js +32 -0
  316. package/dist/core/std/src/line-diff.d.ts +83 -0
  317. package/dist/core/std/src/line-diff.js +179 -0
  318. package/dist/core/std/src/line-merge.d.ts +63 -0
  319. package/dist/core/std/src/line-merge.js +138 -0
  320. package/dist/core/std/src/plain-data.d.ts +32 -0
  321. package/dist/core/std/src/plain-data.js +57 -0
  322. package/dist/core/std/src/posix-path.d.ts +61 -0
  323. package/dist/core/std/src/posix-path.js +121 -0
  324. package/dist/core/std/src/result.d.ts +55 -0
  325. package/dist/core/std/src/result.js +52 -0
  326. package/dist/core/std/src/secret-scrubber.d.ts +54 -0
  327. package/dist/core/std/src/secret-scrubber.js +124 -0
  328. package/dist/core/std/src/secret-shape.d.ts +20 -0
  329. package/dist/core/std/src/secret-shape.js +53 -0
  330. package/dist/core/std/src/stop-signal.d.ts +44 -0
  331. package/dist/core/std/src/stop-signal.js +77 -0
  332. package/dist/core/std/src/text.d.ts +28 -0
  333. package/dist/core/std/src/text.js +54 -0
  334. package/dist/core/std/src/utf8.d.ts +23 -0
  335. package/dist/core/std/src/utf8.js +110 -0
  336. package/dist/core/std/src/version.d.ts +48 -0
  337. package/dist/core/std/src/version.js +103 -0
  338. package/dist/core/yaml/src/depth.d.ts +14 -0
  339. package/dist/core/yaml/src/depth.js +140 -0
  340. package/dist/core/yaml/src/edit-data.d.ts +47 -0
  341. package/dist/core/yaml/src/edit-data.js +286 -0
  342. package/dist/core/yaml/src/edit-text.d.ts +92 -0
  343. package/dist/core/yaml/src/edit-text.js +267 -0
  344. package/dist/core/yaml/src/edit.d.ts +47 -0
  345. package/dist/core/yaml/src/edit.js +198 -0
  346. package/dist/core/yaml/src/index.d.ts +5 -0
  347. package/dist/core/yaml/src/index.js +4 -0
  348. package/dist/core/yaml/src/problem.d.ts +20 -0
  349. package/dist/core/yaml/src/problem.js +1 -0
  350. package/dist/core/yaml/src/read.d.ts +47 -0
  351. package/dist/core/yaml/src/read.js +130 -0
  352. package/dist/core/yaml/src/splice-node.d.ts +47 -0
  353. package/dist/core/yaml/src/splice-node.js +333 -0
  354. package/dist/core/yaml/src/splice.d.ts +13 -0
  355. package/dist/core/yaml/src/splice.js +174 -0
  356. package/dist/core/yaml/src/unsupported.d.ts +26 -0
  357. package/dist/core/yaml/src/unsupported.js +70 -0
  358. package/dist/core/yaml/src/write.d.ts +35 -0
  359. package/dist/core/yaml/src/write.js +44 -0
  360. package/dist/testing/integration/src/canaries.d.ts +14 -0
  361. package/dist/testing/integration/src/canaries.js +17 -0
  362. package/dist/testing/integration/src/checks.d.ts +37 -0
  363. package/dist/testing/integration/src/checks.js +195 -0
  364. package/dist/testing/integration/src/describe.d.ts +35 -0
  365. package/dist/testing/integration/src/describe.js +74 -0
  366. package/dist/testing/integration/src/failure.d.ts +6 -0
  367. package/dist/testing/integration/src/failure.js +8 -0
  368. package/dist/testing/integration/src/fake-wait.d.ts +18 -0
  369. package/dist/testing/integration/src/fake-wait.js +21 -0
  370. package/dist/testing/integration/src/index.d.ts +10 -0
  371. package/dist/testing/integration/src/index.js +11 -0
  372. package/dist/testing/integration/src/load.d.ts +14 -0
  373. package/dist/testing/integration/src/load.js +45 -0
  374. package/dist/testing/integration/src/plugin-folder.d.ts +23 -0
  375. package/dist/testing/integration/src/plugin-folder.js +59 -0
  376. package/dist/testing/integration/src/plugin.d.ts +32 -0
  377. package/dist/testing/integration/src/plugin.js +57 -0
  378. package/dist/testing/integration/src/recording.d.ts +84 -0
  379. package/dist/testing/integration/src/recording.js +164 -0
  380. package/dist/testing/integration/src/run.d.ts +60 -0
  381. package/dist/testing/integration/src/run.js +81 -0
  382. package/dist/testing/integration/src/source-scan.d.ts +16 -0
  383. package/dist/testing/integration/src/source-scan.js +40 -0
  384. package/package.json +34 -3
@@ -0,0 +1,89 @@
1
+ import { type Infer } from "../../../../schema-kit/src/index.js";
2
+ /** The value types a collection field can hold. */
3
+ export declare const FIELD_TYPES: readonly ["text", "number", "money", "date", "month", "choice", "boolean", "ref"];
4
+ /** One field of a collection's records. */
5
+ export declare const CollectionField: import("zod").ZodObject<{
6
+ type: import("zod").ZodEnum<{
7
+ boolean: "boolean";
8
+ choice: "choice";
9
+ date: "date";
10
+ money: "money";
11
+ month: "month";
12
+ number: "number";
13
+ ref: "ref";
14
+ text: "text";
15
+ }>;
16
+ description: import("zod").ZodOptional<import("zod").ZodString>;
17
+ required: import("zod").ZodDefault<import("zod").ZodBoolean>;
18
+ values: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
19
+ collection: import("zod").ZodOptional<import("zod").ZodString>;
20
+ min: import("zod").ZodOptional<import("zod").ZodNumber>;
21
+ max: import("zod").ZodOptional<import("zod").ZodNumber>;
22
+ default: import("zod").ZodOptional<import("zod").ZodUnknown>;
23
+ compute: import("zod").ZodOptional<import("zod").ZodString>;
24
+ }, import("zod/v4/core").$strict>;
25
+ /** A named, filtered list of records, with an optional total. */
26
+ export declare const CollectionView: import("zod").ZodObject<{
27
+ description: import("zod").ZodOptional<import("zod").ZodString>;
28
+ where: import("zod").ZodDefault<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber, import("zod").ZodBoolean, import("zod").ZodNull, import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber, import("zod").ZodBoolean, import("zod").ZodNull]>>, import("zod").ZodObject<{
29
+ gt: import("zod").ZodOptional<import("zod").ZodUnknown>;
30
+ gte: import("zod").ZodOptional<import("zod").ZodUnknown>;
31
+ lt: import("zod").ZodOptional<import("zod").ZodUnknown>;
32
+ lte: import("zod").ZodOptional<import("zod").ZodUnknown>;
33
+ not: import("zod").ZodOptional<import("zod").ZodUnknown>;
34
+ }, import("zod/v4/core").$strict>]>>>;
35
+ total: import("zod").ZodOptional<import("zod").ZodString>;
36
+ sort: import("zod").ZodOptional<import("zod").ZodString>;
37
+ }, import("zod/v4/core").$strict>;
38
+ /**
39
+ * `library/collections/<id>.collection.yaml`: a typed list of records agents
40
+ * read and write. The file defines it; the records are runtime data.
41
+ */
42
+ export declare const Collection: import("zod").ZodObject<{
43
+ version: import("zod").ZodDefault<import("zod").ZodLiteral<1>>;
44
+ id: import("zod").ZodString;
45
+ name: import("zod").ZodString;
46
+ description: import("zod").ZodOptional<import("zod").ZodString>;
47
+ implements: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
48
+ fields: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
49
+ type: import("zod").ZodEnum<{
50
+ boolean: "boolean";
51
+ choice: "choice";
52
+ date: "date";
53
+ money: "money";
54
+ month: "month";
55
+ number: "number";
56
+ ref: "ref";
57
+ text: "text";
58
+ }>;
59
+ description: import("zod").ZodOptional<import("zod").ZodString>;
60
+ required: import("zod").ZodDefault<import("zod").ZodBoolean>;
61
+ values: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
62
+ collection: import("zod").ZodOptional<import("zod").ZodString>;
63
+ min: import("zod").ZodOptional<import("zod").ZodNumber>;
64
+ max: import("zod").ZodOptional<import("zod").ZodNumber>;
65
+ default: import("zod").ZodOptional<import("zod").ZodUnknown>;
66
+ compute: import("zod").ZodOptional<import("zod").ZodString>;
67
+ }, import("zod/v4/core").$strict>>;
68
+ views: import("zod").ZodDefault<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
69
+ description: import("zod").ZodOptional<import("zod").ZodString>;
70
+ where: import("zod").ZodDefault<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber, import("zod").ZodBoolean, import("zod").ZodNull, import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber, import("zod").ZodBoolean, import("zod").ZodNull]>>, import("zod").ZodObject<{
71
+ gt: import("zod").ZodOptional<import("zod").ZodUnknown>;
72
+ gte: import("zod").ZodOptional<import("zod").ZodUnknown>;
73
+ lt: import("zod").ZodOptional<import("zod").ZodUnknown>;
74
+ lte: import("zod").ZodOptional<import("zod").ZodUnknown>;
75
+ not: import("zod").ZodOptional<import("zod").ZodUnknown>;
76
+ }, import("zod/v4/core").$strict>]>>>;
77
+ total: import("zod").ZodOptional<import("zod").ZodString>;
78
+ sort: import("zod").ZodOptional<import("zod").ZodString>;
79
+ }, import("zod/v4/core").$strict>>>;
80
+ seed: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodIntersection<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>, import("zod").ZodObject<{
81
+ id: import("zod").ZodString;
82
+ }, import("zod/v4/core").$strip>>>>;
83
+ }, import("zod/v4/core").$strict>;
84
+ /** A collection definition, with defaults filled in. */
85
+ export type Collection = Infer<typeof Collection>;
86
+ /** One field of a collection. */
87
+ export type CollectionField = Infer<typeof CollectionField>;
88
+ /** A named view of a collection. */
89
+ export type CollectionView = Infer<typeof CollectionView>;
@@ -0,0 +1,90 @@
1
+ import { s } from "../../../../schema-kit/src/index.js";
2
+ import { collectionId } from "../../shared/fields.js";
3
+ /** The value types a collection field can hold. */
4
+ export const FIELD_TYPES = [
5
+ "text",
6
+ "number",
7
+ "money",
8
+ "date",
9
+ "month",
10
+ "choice",
11
+ "boolean",
12
+ "ref",
13
+ ];
14
+ const fieldName = s.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/, "Field names: letters, digits and _");
15
+ /** One field of a collection's records. */
16
+ export const CollectionField = s
17
+ .object({
18
+ type: s.enum(FIELD_TYPES),
19
+ description: s.string().optional(),
20
+ required: s.boolean().default(false),
21
+ /** choice: the allowed values. */
22
+ values: s.array(s.string()).optional(),
23
+ /** ref: the collection whose record ids the value holds. */
24
+ collection: collectionId.optional(),
25
+ min: s.number().optional(),
26
+ max: s.number().optional(),
27
+ default: s.unknown().optional(),
28
+ /** Computed from other fields, such as "amount * sharePct / 100". Never set by an agent. */
29
+ compute: s.string().optional(),
30
+ })
31
+ .strict()
32
+ .superRefine((field, context) => {
33
+ if (field.type === "choice" && !field.values?.length) {
34
+ context.addIssue({ code: "custom", message: "A choice field needs values" });
35
+ }
36
+ if (field.type === "ref" && !field.collection) {
37
+ context.addIssue({ code: "custom", message: "A ref field needs a collection" });
38
+ }
39
+ });
40
+ const scalar = () => s.union([s.string(), s.number(), s.boolean(), s.null()]);
41
+ /** A filter value: equal to, one of a list, null for empty, or a comparison. "today" is today's date. */
42
+ const WhereValue = s.union([
43
+ s.string(),
44
+ s.number(),
45
+ s.boolean(),
46
+ s.null(),
47
+ s.array(scalar()),
48
+ s
49
+ .object({
50
+ gt: s.unknown(),
51
+ gte: s.unknown(),
52
+ lt: s.unknown(),
53
+ lte: s.unknown(),
54
+ not: s.unknown(),
55
+ })
56
+ .partial()
57
+ .strict(),
58
+ ]);
59
+ /** A named, filtered list of records, with an optional total. */
60
+ export const CollectionView = s
61
+ .object({
62
+ description: s.string().optional(),
63
+ where: s.record(s.string(), WhereValue).default({}),
64
+ /** A number or money field summed over the view. */
65
+ total: s.string().optional(),
66
+ sort: s.string().optional(),
67
+ })
68
+ .strict();
69
+ /**
70
+ * `library/collections/<id>.collection.yaml`: a typed list of records agents
71
+ * read and write. The file defines it; the records are runtime data.
72
+ */
73
+ export const Collection = s
74
+ .object({
75
+ version: s.literal(1).default(1),
76
+ id: collectionId,
77
+ name: s.string().min(1),
78
+ description: s.string().optional(),
79
+ /** Requirement ids this collection serves. */
80
+ implements: s.array(s.string()).default([]),
81
+ fields: s
82
+ .record(fieldName, CollectionField)
83
+ .refine((fields) => Object.keys(fields).length > 0, "A collection needs fields"),
84
+ views: s.record(s.string(), CollectionView).default({}),
85
+ /** Records added once when no record with their id exists yet. */
86
+ seed: s
87
+ .array(s.record(s.string(), s.unknown()).and(s.object({ id: s.string().min(1) })))
88
+ .default([]),
89
+ })
90
+ .strict();
@@ -0,0 +1,10 @@
1
+ import type { Connector } from "./schema.js";
2
+ /**
3
+ * Whether a connector counts as local for `privacy.localOnly`: its own
4
+ * `local` setting when it has one, otherwise true for a program on this
5
+ * machine (stdio) and for an HTTP server on a loopback address.
6
+ *
7
+ * @example
8
+ * connectorIsLocal(connector); // true for { transport: { http: { url: "http://127.0.0.1:3000" } } }
9
+ */
10
+ export declare function connectorIsLocal(connector: Connector): boolean;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Whether a connector counts as local for `privacy.localOnly`: its own
3
+ * `local` setting when it has one, otherwise true for a program on this
4
+ * machine (stdio) and for an HTTP server on a loopback address.
5
+ *
6
+ * @example
7
+ * connectorIsLocal(connector); // true for { transport: { http: { url: "http://127.0.0.1:3000" } } }
8
+ */
9
+ export function connectorIsLocal(connector) {
10
+ if (connector.local !== undefined) {
11
+ return connector.local;
12
+ }
13
+ const transport = connector.transport;
14
+ if ("stdio" in transport) {
15
+ return true;
16
+ }
17
+ if ("google" in transport) {
18
+ return false;
19
+ }
20
+ const host = hostOf(transport.http.url);
21
+ if (host === undefined) {
22
+ return false;
23
+ }
24
+ return (host === "localhost" || host.endsWith(".localhost") || host === "::1" || /^127\./.test(host));
25
+ }
26
+ /**
27
+ * The host of an absolute URL, lowercased and without brackets, port or user
28
+ * info. The core has no `URL` class (plan 4.1), so this reads it by hand.
29
+ */
30
+ function hostOf(url) {
31
+ const afterScheme = /^[a-z][a-z0-9+.-]*:\/\/([^/?#]*)/i.exec(url);
32
+ if (afterScheme === null) {
33
+ return undefined;
34
+ }
35
+ const authority = afterScheme[1] ?? "";
36
+ const hostAndPort = authority.slice(authority.lastIndexOf("@") + 1).toLowerCase();
37
+ if (hostAndPort.startsWith("[")) {
38
+ const end = hostAndPort.indexOf("]");
39
+ return end === -1 ? undefined : hostAndPort.slice(1, end);
40
+ }
41
+ const colon = hostAndPort.indexOf(":");
42
+ return colon === -1 ? hostAndPort : hostAndPort.slice(0, colon);
43
+ }
@@ -0,0 +1,4 @@
1
+ import type { FileKind } from "../../kind.js";
2
+ import { Connector } from "./schema.js";
3
+ /** `library/connectors/<id>.connector.yaml`, shared at the root or a hub's own. */
4
+ export declare const connectorKind: FileKind<Connector>;
@@ -0,0 +1,119 @@
1
+ import { checkKeysIn } from "../../shared/key-in-value.js";
2
+ import { checkSecretName, looksLikeKey } from "../../shared/secret-name.js";
3
+ import { approveAll, Connector } from "./schema.js";
4
+ /** `library/connectors/<id>.connector.yaml`, shared at the root or a hub's own. */
5
+ export const connectorKind = {
6
+ name: "connector",
7
+ about: "Tools for agents from an MCP server or a built-in service such as Google.",
8
+ syntax: "yaml",
9
+ schema: Connector,
10
+ places: [
11
+ { scope: "workspace-and-hub", folder: "library/connectors", name: "<id>.connector.yaml" },
12
+ ],
13
+ idFromPlace: "fallback",
14
+ check: (connector) => [
15
+ ...checkSecretNames(connector),
16
+ ...checkGoogleValues(connector),
17
+ ...checkPastedKeys(connector),
18
+ ...checkApprovedTools(connector),
19
+ ],
20
+ };
21
+ /**
22
+ * Every value the connector gives as a secret's name: its own `secret` (the
23
+ * HTTP bearer token) and, for a local program, each `secretEnv` value. A
24
+ * Google connector names no secret: see {@link checkGoogleValues}.
25
+ */
26
+ function secretNames(connector) {
27
+ const names = [];
28
+ if (connector.secret !== undefined && !("google" in connector.transport)) {
29
+ names.push([connector.secret, ["secret"]]);
30
+ }
31
+ if ("stdio" in connector.transport) {
32
+ for (const [variable, name] of Object.entries(connector.transport.stdio.secretEnv ?? {})) {
33
+ names.push([name, ["transport", "stdio", "secretEnv", variable]]);
34
+ }
35
+ }
36
+ return names;
37
+ }
38
+ /** The secrets are named in the file, so a bad name or a pasted key is caught here, not at run time. */
39
+ function checkSecretNames(connector) {
40
+ return secretNames(connector).flatMap(([name, path]) => checkSecretName(name, path) ?? []);
41
+ }
42
+ /**
43
+ * A Google connector's `client` and `secret` name no secret. The account's
44
+ * Google setup decides which OAuth client a sign-in uses and keeps the
45
+ * refresh token as `google-account-<accountRef>` (`google-setup.store-names`).
46
+ * Both stay so older files still read, and both are refused only when they
47
+ * hold a pasted key, since the file may be committed or shared.
48
+ */
49
+ function checkGoogleValues(connector) {
50
+ if (!("google" in connector.transport)) {
51
+ return [];
52
+ }
53
+ const values = [
54
+ [connector.transport.google.client, ["transport", "google", "client"]],
55
+ [connector.secret, ["secret"]],
56
+ ];
57
+ return values.flatMap(([value, path]) => value !== undefined && looksLikeKey(value) ? (checkSecretName(value, path) ?? []) : []);
58
+ }
59
+ /**
60
+ * HTTP headers and a local program's `env` and `args` take any text, so a
61
+ * key pasted there would be saved in the file. The connector's `secret` and
62
+ * `secretEnv` name the secrets instead.
63
+ */
64
+ function checkPastedKeys(connector) {
65
+ const { transport } = connector;
66
+ if ("http" in transport) {
67
+ return checkKeysIn(transport.http.headers, ["transport", "http", "headers"], "header");
68
+ }
69
+ if ("stdio" in transport) {
70
+ const path = ["transport", "stdio"];
71
+ return [
72
+ ...checkKeysIn(transport.stdio.env, [...path, "env"], "env"),
73
+ ...transport.stdio.args.flatMap((arg, index) => {
74
+ const [name, value] = argument(arg, transport.stdio.args[index - 1]);
75
+ return checkKeysIn(value, [...path, "args", index], "arg", name);
76
+ }),
77
+ ];
78
+ }
79
+ return [];
80
+ }
81
+ /**
82
+ * An argument's value and the option it belongs to: `--api-key=…` and
83
+ * `--api-key …` both name the value, so a key without a known format is
84
+ * still caught after a flag that says it is one.
85
+ *
86
+ * @example
87
+ * argument("--token=abc", undefined); // ["--token", "abc"]
88
+ * argument("abc", "--token"); // ["--token", "abc"]
89
+ */
90
+ function argument(arg, before) {
91
+ const equals = arg.indexOf("=");
92
+ if (arg.startsWith("-") && equals > 0) {
93
+ return [arg.slice(0, equals), arg.slice(equals + 1)];
94
+ }
95
+ return [before?.startsWith("-") ? before : undefined, arg];
96
+ }
97
+ /**
98
+ * A tool that needs approval but isn't in `tools.allow` is never offered, so
99
+ * say so. `approve: all` names no tool, so there is nothing to compare.
100
+ */
101
+ function checkApprovedTools(connector) {
102
+ const { allow, approve } = connector.tools;
103
+ const problems = [];
104
+ if (allow === undefined || approve === approveAll) {
105
+ return problems;
106
+ }
107
+ approve.forEach((tool, index) => {
108
+ if (allow.includes(tool)) {
109
+ return;
110
+ }
111
+ problems.push({
112
+ severity: "warning",
113
+ code: "approved-tool-not-allowed",
114
+ path: ["tools", "approve", index],
115
+ message: `Connector "${connector.id}": "${tool}" needs approval but is not in tools.allow, so agents never see it`,
116
+ });
117
+ });
118
+ return problems;
119
+ }
@@ -0,0 +1,50 @@
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
+ cwd: import("zod").ZodOptional<import("zod").ZodString>;
25
+ }, import("zod/v4/core").$strict>;
26
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
27
+ google: import("zod").ZodObject<{
28
+ account: import("zod").ZodString;
29
+ client: import("zod").ZodDefault<import("zod").ZodString>;
30
+ }, import("zod/v4/core").$strict>;
31
+ }, import("zod/v4/core").$strict>]>;
32
+ secret: import("zod").ZodOptional<import("zod").ZodString>;
33
+ tools: import("zod").ZodDefault<import("zod").ZodObject<{
34
+ allow: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
35
+ approve: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodArray<import("zod").ZodString>, import("zod").ZodLiteral<"all">]>>;
36
+ }, import("zod/v4/core").$strict>>;
37
+ local: import("zod").ZodOptional<import("zod").ZodBoolean>;
38
+ }, import("zod/v4/core").$strict>;
39
+ /** A connector, with defaults filled in. */
40
+ export type Connector = Infer<typeof Connector>;
41
+ /**
42
+ * Whether every call to `tool` waits for a person, as the connector's
43
+ * `tools.approve` says: the tool is listed there, or it says `all`.
44
+ * `tool` is the name the server lists the tool under.
45
+ *
46
+ * @example
47
+ * needsApproval({ approve: "all" }, "delete_file"); // true
48
+ * needsApproval({ approve: ["send_mail"] }, "read_mail"); // false
49
+ */
50
+ export declare function needsApproval(tools: Pick<Connector["tools"], "approve">, tool: string): boolean;
@@ -0,0 +1,92 @@
1
+ import { s } from "../../../../schema-kit/src/index.js";
2
+ import { id, version } from "../../shared/fields.js";
3
+ /** A remote MCP server over HTTP. */
4
+ const HttpTransport = s
5
+ .object({
6
+ http: s
7
+ .object({ url: s.string().url(), headers: s.record(s.string(), s.string()).optional() })
8
+ .strict(),
9
+ })
10
+ .strict();
11
+ /** A local MCP program over standard input and output. */
12
+ const StdioTransport = s
13
+ .object({
14
+ stdio: s
15
+ .object({
16
+ command: s.string().min(1),
17
+ args: s.array(s.string()).default([]),
18
+ /** Plain environment variables; secrets go in `secretEnv`. */
19
+ env: s.record(s.string(), s.string()).optional(),
20
+ /** Environment variable → secret name. */
21
+ secretEnv: s.record(s.string(), s.string()).optional(),
22
+ /** Working directory, relative to the workspace root. */
23
+ cwd: s.string().optional(),
24
+ })
25
+ .strict(),
26
+ })
27
+ .strict();
28
+ /** Built-in Gmail and Google Drive for one Google account. */
29
+ const GoogleTransport = s
30
+ .object({
31
+ google: s
32
+ .object({
33
+ /** The Google account the connector acts as. */
34
+ account: s.string().email(),
35
+ /**
36
+ * Kept so older files still read. It names no secret: the OAuth
37
+ * client's ID and secret come from the account's Google setup, which
38
+ * only the host's setup routes write (`@halonicjs/google-setup`).
39
+ */
40
+ client: s.string().default("google"),
41
+ })
42
+ .strict(),
43
+ })
44
+ .strict();
45
+ /** The `tools.approve` value that makes every tool of the connector ask a person first. */
46
+ export const approveAll = "all";
47
+ /**
48
+ * `library/connectors/<id>.connector.yaml`: tools for agents from an MCP
49
+ * server or a built-in service. Secrets are referenced by name only.
50
+ */
51
+ export const Connector = s
52
+ .object({
53
+ version,
54
+ id,
55
+ name: s.string().optional(),
56
+ description: s.string().optional(),
57
+ transport: s.union([HttpTransport, StdioTransport, GoogleTransport]),
58
+ /**
59
+ * HTTP: the secret sent as a bearer token. Google: kept so older files
60
+ * still read, but it names no secret: the account's Google setup keeps
61
+ * the refresh token (`@halonicjs/google-setup`).
62
+ */
63
+ secret: s.string().optional(),
64
+ tools: s
65
+ .object({
66
+ /** Only these tools are offered to agents. Leave out to offer every tool. */
67
+ allow: s.array(s.string()).optional(),
68
+ /**
69
+ * Every call to these tools waits for a person to approve or reject
70
+ * it. `all` means every tool the server offers, including tools it
71
+ * adds later: a new MCP connector starts with it.
72
+ */
73
+ approve: s.union([s.array(s.string()), s.literal(approveAll)]).default([]),
74
+ })
75
+ .strict()
76
+ .default({ approve: [] }),
77
+ /** Runs on this machine or your own network. Default: true for stdio and localhost URLs. */
78
+ local: s.boolean().optional(),
79
+ })
80
+ .strict();
81
+ /**
82
+ * Whether every call to `tool` waits for a person, as the connector's
83
+ * `tools.approve` says: the tool is listed there, or it says `all`.
84
+ * `tool` is the name the server lists the tool under.
85
+ *
86
+ * @example
87
+ * needsApproval({ approve: "all" }, "delete_file"); // true
88
+ * needsApproval({ approve: ["send_mail"] }, "read_mail"); // false
89
+ */
90
+ export function needsApproval(tools, tool) {
91
+ return tools.approve === approveAll || tools.approve.includes(tool);
92
+ }
@@ -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,25 @@
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
+ /** The default deployment, when one is named, must be one of the listed ones. */
13
+ function checkDeployments(file) {
14
+ if (file.default === undefined || Object.hasOwn(file.deployments, file.default)) {
15
+ return [];
16
+ }
17
+ return [
18
+ {
19
+ severity: "error",
20
+ code: "default-deployment-not-listed",
21
+ path: ["default"],
22
+ message: `The default deployment "${file.default}" is not listed`,
23
+ },
24
+ ];
25
+ }
@@ -0,0 +1,37 @@
1
+ import { type Infer } from "../../../../schema-kit/src/index.js";
2
+ /** One place the workspace runs, with its own data (runs, Inbox, records, simulations). */
3
+ export declare const Deployment: import("zod").ZodObject<{
4
+ name: import("zod").ZodString;
5
+ description: import("zod").ZodOptional<import("zod").ZodString>;
6
+ host: import("zod").ZodDefault<import("zod").ZodEnum<{
7
+ cloudflare: "cloudflare";
8
+ local: "local";
9
+ }>>;
10
+ stage: import("zod").ZodDefault<import("zod").ZodEnum<{
11
+ development: "development";
12
+ production: "production";
13
+ }>>;
14
+ shadow: import("zod").ZodDefault<import("zod").ZodBoolean>;
15
+ }, import("zod/v4/core").$strict>;
16
+ /** `deployments.yaml`: the places the workspace runs. */
17
+ export declare const Deployments: import("zod").ZodObject<{
18
+ version: import("zod").ZodDefault<import("zod").ZodLiteral<1>>;
19
+ default: import("zod").ZodOptional<import("zod").ZodString>;
20
+ deployments: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
21
+ name: import("zod").ZodString;
22
+ description: import("zod").ZodOptional<import("zod").ZodString>;
23
+ host: import("zod").ZodDefault<import("zod").ZodEnum<{
24
+ cloudflare: "cloudflare";
25
+ local: "local";
26
+ }>>;
27
+ stage: import("zod").ZodDefault<import("zod").ZodEnum<{
28
+ development: "development";
29
+ production: "production";
30
+ }>>;
31
+ shadow: import("zod").ZodDefault<import("zod").ZodBoolean>;
32
+ }, import("zod/v4/core").$strict>>;
33
+ }, import("zod/v4/core").$strict>;
34
+ /** One deployment, with defaults filled in. */
35
+ export type Deployment = Infer<typeof Deployment>;
36
+ /** The content of `deployments.yaml`, with defaults filled in. */
37
+ export type Deployments = Infer<typeof Deployments>;
@@ -0,0 +1,42 @@
1
+ import { s } from "../../../../schema-kit/src/index.js";
2
+ import { deploymentId, version } from "../../shared/fields.js";
3
+ /** One place the workspace runs, with its own data (runs, Inbox, records, simulations). */
4
+ export const Deployment = s
5
+ .object({
6
+ name: s.string().min(1),
7
+ description: s.string().optional(),
8
+ /** Where it runs: `halonic serve` on a machine, or Cloudflare. */
9
+ host: s.enum(["local", "cloudflare"]).default("local"),
10
+ stage: s.enum(["development", "production"]).default("development"),
11
+ /** Every write a connector would make is only recorded, never done. */
12
+ shadow: s.boolean().default(false),
13
+ })
14
+ .strict();
15
+ /** `deployments.yaml`: the places the workspace runs. */
16
+ export const Deployments = s
17
+ .object({
18
+ version,
19
+ /** The deployment `halonic serve` runs when none is named. */
20
+ default: s.string().optional(),
21
+ deployments: s
22
+ .record(deploymentId, Deployment, { error: deploymentIdProblem })
23
+ .refine((named) => Object.keys(named).length > 0, "Name at least one deployment"),
24
+ })
25
+ .strict();
26
+ /**
27
+ * Says why a deployment id was refused. Without it a refused key only reads
28
+ * "Invalid key in record", which doesn't tell the person what to change.
29
+ */
30
+ function deploymentIdProblem(issue) {
31
+ if (issue.code !== "invalid_key" || !Array.isArray(issue.issues)) {
32
+ return undefined;
33
+ }
34
+ const reasons = issue.issues.flatMap((keyIssue) => {
35
+ const isMessage = typeof keyIssue === "object" &&
36
+ keyIssue !== null &&
37
+ "message" in keyIssue &&
38
+ typeof keyIssue.message === "string";
39
+ return isMessage ? [keyIssue.message] : [];
40
+ });
41
+ return `Not a deployment id: ${reasons.join("; ")}`;
42
+ }
@@ -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>;
@@ -0,0 +1,10 @@
1
+ import { Hub } from "./schema.js";
2
+ /** `hub.yaml` in each `hubs/<id>/` folder; the folder name is the hub's id when the file has none. */
3
+ export const hubKind = {
4
+ name: "hub",
5
+ about: "A hub: a group of agents and workflows with its own defaults.",
6
+ syntax: "yaml",
7
+ schema: Hub,
8
+ places: [{ scope: "hub", folder: "", name: "hub.yaml" }],
9
+ idFromPlace: "fallback",
10
+ };