@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,312 @@
1
+ /**
2
+ * A harness agent writes in its working folder from inside the sandbox. A
3
+ * local connector's program runs outside it, with the connector's secrets.
4
+ * The workspace check `workspace.working-folders` refuses a working folder
5
+ * that holds what a connector names, but it only sees paths as written. This
6
+ * is the same rule again on the real file system, right before a program
7
+ * starts (HAL-4739, HAL-4759): through symbolic links and Windows short
8
+ * names, for absolute paths into the workspace, for the program as found on
9
+ * `PATH`, for packages linked into `node_modules`, and for the files a
10
+ * program loads from next to its script without naming them.
11
+ */
12
+ import { moduleIn, pathsIn, pathsNamedBy } from "../../shared/program-start.js";
13
+ import { foldName } from "../../shared/relative-path.js";
14
+ /**
15
+ * The message for a start that was refused because of `reach`.
16
+ *
17
+ * @example
18
+ * workingFolderRefusal({ folder: "/w/tools", how: "runs '/w/tools/mail.js'" });
19
+ * // "Halonic didn't start the program: it runs '/w/tools/mail.js', in the agent working folder '/w/tools'. …"
20
+ */
21
+ export function workingFolderRefusal(reach) {
22
+ return (`Halonic didn't start the program: it ${reach.how}, in the agent working folder ` +
23
+ `'${reach.folder}'. An agent could change it, and it would run outside the sandbox`);
24
+ }
25
+ /**
26
+ * Whether a start would run or load a file from a harness agent's working
27
+ * folder, checked on real paths. It looks at:
28
+ *
29
+ * 1. the start folder, the program and every path its arguments and `env`
30
+ * values name, as resolved from the start folder and through symbolic
31
+ * links (a path that doesn't exist yet is followed as far as it does);
32
+ * 2. the program as given, so the caller checks again with the absolute
33
+ * path it found on `PATH`;
34
+ * 3. every package in the `node_modules` folders from the start folder and
35
+ * from the folder of each script it runs up to the workspace root, where
36
+ * `npx` and `require()` look without being told: npm and pnpm workspaces
37
+ * link these to folders in the workspace. A package that is such a
38
+ * workspace folder has its own `node_modules` folders looked at too;
39
+ * 4. the folder of each script it runs and the folder it starts in, unless
40
+ * that is the workspace root: a program loads files from there without
41
+ * naming them. A script is the program, an argument or a piece of one
42
+ * that is a file, an argument that is a file once Node or Python add an
43
+ * ending (`node server`, `python -m mail`), or an argument that is a
44
+ * folder, which Node and Python run from inside (`node .`).
45
+ *
46
+ * Paths are compared without regard to case, with `\` as `/`, as Windows
47
+ * and macOS read them. Reading too much as a path only makes it stricter.
48
+ * Inline code (`node -e`) isn't read, and packages in pnpm's store aren't
49
+ * followed into their own `node_modules`: see the requirement's limits.
50
+ *
51
+ * @param start - the start, with absolute `cwd`
52
+ * @param workspaceRoot - the workspace's absolute path
53
+ * @param workingFolders - the absolute working folder of every harness agent in the workspace
54
+ * @returns the first reach found, or `null` when the start reaches none
55
+ */
56
+ export async function touchesWorkingFolder(start, workspaceRoot, workingFolders, lookup) {
57
+ if (workingFolders.length === 0)
58
+ return null;
59
+ const folders = await Promise.all(workingFolders.map(async (folder) => ({
60
+ folder,
61
+ forms: await formsOf(folder, folder, lookup),
62
+ })));
63
+ const root = await realPath(workspaceRoot, lookup);
64
+ const scripts = await scriptsRun(start, lookup);
65
+ const finds = [
66
+ () => namedPart(start, folders, lookup),
67
+ () => linkedPackage(start, scripts, root, folders, lookup),
68
+ () => scriptFolder(start, scripts, root, folders, lookup),
69
+ ];
70
+ for (const find of finds) {
71
+ const reach = await find();
72
+ if (reach !== null)
73
+ return reach;
74
+ }
75
+ return null;
76
+ }
77
+ /** The endings Node and Python add to a script or module name that names no file. */
78
+ const SCRIPT_ENDINGS = [".js", ".mjs", ".cjs", ".ts", ".json", ".node", ".py"];
79
+ /** Rule 1 and 2: a path the start names, read from its folder, inside a working folder. */
80
+ async function namedPart(start, folders, lookup) {
81
+ // A path written as the program is checked once, as what the start runs.
82
+ const used = pathsNamedBy(start).filter(({ path }) => path !== start.program);
83
+ const named = [
84
+ { shown: start.cwd, how: "starts in" },
85
+ { shown: start.program, how: "runs" },
86
+ ...used.map(({ path }) => ({ shown: path, how: "uses" })),
87
+ ];
88
+ for (const { shown, how } of named) {
89
+ const folder = holding(await formsOf(start.cwd, shown, lookup), folders);
90
+ if (folder !== undefined)
91
+ return { folder, how: `${how} '${shown}'` };
92
+ }
93
+ return null;
94
+ }
95
+ /**
96
+ * Rule 3: a `node_modules` folder, or a package, `.bin` entry or scoped
97
+ * package in one, that really lives in a working folder. `require()` looks
98
+ * from the folder of the file that asks, so the folders listed are those from
99
+ * the start folder, from each script's folder and from each workspace package
100
+ * found on the way, up to the workspace root. Anything above the workspace is
101
+ * out of an agent's reach, and a start outside it (such as a pinned package's
102
+ * new empty folder) has none to list.
103
+ */
104
+ async function linkedPackage(start, scripts, root, folders, lookup) {
105
+ const listed = new Set();
106
+ const from = [await realPath(start.cwd, lookup), ...scripts.map((script) => script.folder)];
107
+ for (let next = from.shift(); next !== undefined; next = from.shift()) {
108
+ for (const folder of foldersUpTo(next, root, lookup)) {
109
+ const modules = lookup.resolve(folder, "node_modules");
110
+ if (listed.has(comparable(modules)))
111
+ continue;
112
+ listed.add(comparable(modules));
113
+ const found = await modulesFolder(modules, root, folders, lookup);
114
+ if (found.reach !== null)
115
+ return found.reach;
116
+ from.push(...found.workspacePackages);
117
+ }
118
+ }
119
+ return null;
120
+ }
121
+ /**
122
+ * One `node_modules` folder for rule 3: the first entry that really lives
123
+ * in a working folder, and the real folders of the workspace packages in it.
124
+ */
125
+ async function modulesFolder(modules, root, folders, lookup) {
126
+ const entries = [modules, ...(await packagesIn(modules, lookup))];
127
+ const reals = await Promise.all(entries.map((entry) => realPath(entry, lookup)));
128
+ for (const [index, real] of reals.entries()) {
129
+ const holder = holding([real], folders);
130
+ if (holder !== undefined) {
131
+ return { reach: { folder: holder, how: `loads '${entries[index]}'` }, workspacePackages: [] };
132
+ }
133
+ }
134
+ return { reach: null, workspacePackages: reals.filter((real) => isWorkspacePackage(real, root)) };
135
+ }
136
+ /**
137
+ * Whether a real path is in the workspace's own folders and not in a
138
+ * `node_modules` folder, as a workspace package linked into one is.
139
+ * `require()` in that package reads its own `node_modules` folders.
140
+ */
141
+ function isWorkspacePackage(path, root) {
142
+ if (!isInside(path, root))
143
+ return false;
144
+ return !comparable(path).slice(comparable(root).length).split("/").includes("node_modules");
145
+ }
146
+ /** The entries of a `node_modules` folder, with those inside `.bin` and `@scope` folders. */
147
+ async function packagesIn(modules, lookup) {
148
+ const entries = [];
149
+ for (const name of await lookup.list(modules)) {
150
+ const entry = lookup.resolve(modules, name);
151
+ entries.push(entry);
152
+ if (name === ".bin" || name.startsWith("@")) {
153
+ const inner = await lookup.list(entry);
154
+ entries.push(...inner.map((innerName) => lookup.resolve(entry, innerName)));
155
+ }
156
+ }
157
+ return entries;
158
+ }
159
+ /** A real `folder` and each folder above it up to the real workspace root, or none when it's outside. */
160
+ function foldersUpTo(folder, root, lookup) {
161
+ if (!isInside(folder, root))
162
+ return [];
163
+ const chain = [folder];
164
+ let current = folder;
165
+ while (!isSame(current, root)) {
166
+ const parent = lookup.resolve(current, "..");
167
+ if (parent === current)
168
+ break;
169
+ current = parent;
170
+ chain.push(current);
171
+ }
172
+ return chain;
173
+ }
174
+ /**
175
+ * The scripts a start runs (see rule 4): the program and each piece of an
176
+ * argument when it is a file, and each argument and `-m` module also when
177
+ * it is a file once an ending is added, or a folder. Empty inline code
178
+ * (`node -e ""`) is no script. Any other empty argument is read as the start
179
+ * folder, as Python does: `python ""` runs `__main__.py` from there.
180
+ */
181
+ async function scriptsRun(start, lookup) {
182
+ const exact = [
183
+ start.program,
184
+ ...start.args.flatMap((arg) => pathsIn(arg).filter((piece) => piece !== arg)),
185
+ ];
186
+ const named = start.args.flatMap((arg, index) => isEmptyInlineCode(start.args, index) ? [] : [{ arg, index }]);
187
+ const filled = named.flatMap(({ arg, index }) => [
188
+ { shown: arg, path: arg },
189
+ ...moduleIn(start.args, index).map((path) => ({ shown: arg, path })),
190
+ ]);
191
+ const scripts = [];
192
+ for (const shown of exact) {
193
+ const folder = await fileFolder([lookup.resolve(start.cwd, shown)], lookup);
194
+ if (folder !== null)
195
+ scripts.push({ shown, folder });
196
+ }
197
+ for (const { shown, path } of filled) {
198
+ const folder = await loadFolder(lookup.resolve(start.cwd, path), lookup);
199
+ if (folder !== null)
200
+ scripts.push({ shown, folder });
201
+ }
202
+ return scripts;
203
+ }
204
+ /** The flags that take inline code as their next argument: Node's `-e` and `-p`, and `-c` for Python and shells. */
205
+ const INLINE_CODE_FLAGS = new Set(["-e", "--eval", "-p", "--print", "-c"]);
206
+ /**
207
+ * Python flags that take the next argument as their value. In `python -W -c ""`
208
+ * the `-c` is the value of `-W`, so the `""` is the script, not inline code.
209
+ */
210
+ const VALUE_FLAGS = new Set(["-W", "-X"]);
211
+ /** Whether the argument at `index` is empty inline code, such as the `""` in `node -e ""`. */
212
+ function isEmptyInlineCode(args, index) {
213
+ return (args[index] === "" &&
214
+ INLINE_CODE_FLAGS.has(args[index - 1] ?? "") &&
215
+ !VALUE_FLAGS.has(args[index - 2] ?? ""));
216
+ }
217
+ /** The real folder of the first of `paths` that is a file, or `null`. */
218
+ async function fileFolder(paths, lookup) {
219
+ for (const path of paths) {
220
+ if (await lookup.isFile(path))
221
+ return lookup.resolve(await realPath(path, lookup), "..");
222
+ }
223
+ return null;
224
+ }
225
+ /**
226
+ * The real folder a script named by `path` loads files from: the folder of
227
+ * the file it names, with or without an ending Node or Python adds, or the
228
+ * folder itself when it names one. `null` when nothing is there.
229
+ */
230
+ async function loadFolder(path, lookup) {
231
+ const file = await fileFolder([path, ...SCRIPT_ENDINGS.map((ending) => path + ending)], lookup);
232
+ if (file !== null)
233
+ return file;
234
+ try {
235
+ return await lookup.realpath(path);
236
+ }
237
+ catch {
238
+ return null;
239
+ }
240
+ }
241
+ /**
242
+ * Rule 4: a working folder inside the folder of a script the start runs, or
243
+ * inside the folder it starts in. The workspace root counts as a script's
244
+ * folder, but not as a start folder: every working folder is inside the
245
+ * root, and the static check already refuses a `node_modules` working folder.
246
+ */
247
+ async function scriptFolder(start, scripts, root, folders, lookup) {
248
+ for (const script of scripts) {
249
+ const inside = folders.find((folder) => folder.forms.some((form) => isInside(form, script.folder)));
250
+ if (inside !== undefined) {
251
+ return {
252
+ folder: inside.folder,
253
+ how: `runs '${script.shown}', which loads files from next to it`,
254
+ };
255
+ }
256
+ }
257
+ const cwd = await realPath(start.cwd, lookup);
258
+ if (isSame(cwd, root))
259
+ return null;
260
+ const inside = folders.find((folder) => folder.forms.some((form) => isInside(form, cwd)));
261
+ return inside === undefined
262
+ ? null
263
+ : { folder: inside.folder, how: `starts in '${start.cwd}' and reads files from there` };
264
+ }
265
+ /** The first working folder that holds one of `forms`. */
266
+ function holding(forms, folders) {
267
+ return folders.find((folder) => folder.forms.some((folderForm) => forms.some((form) => isInside(form, folderForm))))?.folder;
268
+ }
269
+ /** A path resolved from `cwd`, and where it really is. */
270
+ async function formsOf(cwd, path, lookup) {
271
+ const resolved = lookup.resolve(cwd, path);
272
+ return [resolved, await realPath(resolved, lookup)];
273
+ }
274
+ /**
275
+ * Where an absolute path really is, through links and Windows short names.
276
+ * When it doesn't exist (yet), the nearest folder above it that does is
277
+ * followed, and the rest is added back, so `out/new.json` in a linked
278
+ * `out` folder is still found.
279
+ */
280
+ async function realPath(path, lookup) {
281
+ try {
282
+ return await lookup.realpath(path);
283
+ }
284
+ catch {
285
+ const parent = lookup.resolve(path, "..");
286
+ if (parent === path)
287
+ return path;
288
+ const rest = path.slice(parent.length).replace(/^[\\/]+/, "");
289
+ return lookup.resolve(await realPath(parent, lookup), rest);
290
+ }
291
+ }
292
+ /** Whether `path` is `folder` or inside it, as a file system that ignores case reads them. */
293
+ function isInside(path, folder) {
294
+ const comparablePath = comparable(path);
295
+ const comparableFolder = comparable(folder);
296
+ return comparablePath === comparableFolder || comparablePath.startsWith(`${comparableFolder}/`);
297
+ }
298
+ function isSame(path, other) {
299
+ return comparable(path) === comparable(other);
300
+ }
301
+ /**
302
+ * An absolute path as Windows and macOS compare it: folded case, `/` between
303
+ * parts, no trailing dots and spaces on a part, and no `/` at the end.
304
+ */
305
+ function comparable(path) {
306
+ return foldName(path)
307
+ .replaceAll("\\", "/")
308
+ .split("/")
309
+ .map((part) => (part === "." || part === ".." ? part : part.replace(/[. ]+$/, "")))
310
+ .join("/")
311
+ .replace(/\/+$/, "");
312
+ }
@@ -0,0 +1,8 @@
1
+ import type { FileKind } from "../../kind.js";
2
+ import { Collection } from "./schema.js";
3
+ /**
4
+ * `library/collections/<id>.collection.yaml` at the workspace root. Checking
5
+ * and folding records is runtime work for the records service, not part of
6
+ * the file format.
7
+ */
8
+ export declare const collectionKind: FileKind<Collection>;
@@ -0,0 +1,14 @@
1
+ import { Collection } from "./schema.js";
2
+ /**
3
+ * `library/collections/<id>.collection.yaml` at the workspace root. Checking
4
+ * and folding records is runtime work for the records service, not part of
5
+ * the file format.
6
+ */
7
+ export const collectionKind = {
8
+ name: "collection",
9
+ about: "A typed list of records agents read and write, with views and seed records.",
10
+ syntax: "yaml",
11
+ schema: Collection,
12
+ places: [{ scope: "workspace", folder: "library/collections", name: "<id>.collection.yaml" }],
13
+ idFromPlace: "fallback",
14
+ };
@@ -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 || "integration" in transport || "plugin" 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>;