@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,359 @@
1
+ // The permission sheet, `integration.yaml`. This folder imports only
2
+ // schema-kit, so the integration kit and the conformance suite can use the
3
+ // sheet without the YAML reader.
4
+ import { s } from "../../../../schema-kit/src/index.js";
5
+ /**
6
+ * Lower-case words joined by `-`: the integration's id and its secret and
7
+ * token names. The same rule as the kit's `namePattern`.
8
+ */
9
+ export const INTEGRATION_NAME_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
10
+ const name = s
11
+ .string()
12
+ .regex(INTEGRATION_NAME_PATTERN, "use lower-case words joined by '-', such as 'weather-key'");
13
+ /**
14
+ * A host name in lower case, with at least one dot and a top-level name of
15
+ * letters, and an optional `:port`. No scheme, no path, no wildcards and no
16
+ * IP addresses: a host the user picks is `{ fromSetting }` instead.
17
+ */
18
+ export const HOST_PATTERN = /^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z](?:[a-z0-9-]*[a-z0-9])?(?::(?:[1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5]))?$/;
19
+ const fixedHost = s
20
+ .string()
21
+ .regex(HOST_PATTERN, "use an exact lower-case host name with an optional :port, such as 'api.example.com'");
22
+ /**
23
+ * Where the host of a `{ fromSetting }` URL may be, which the sheet declares
24
+ * so the trust check can say it before the setting is filled in:
25
+ * - `loopback`: only on this computer (`localhost`, `127.0.0.0/8`, `::1`);
26
+ * - `private`: only on the home network, as a private IP address;
27
+ * - `public`: any public host name, over `https`.
28
+ *
29
+ * `integrationPolicy` refuses a setting whose URL is outside the class.
30
+ */
31
+ export const ADDRESS_CLASSES = ["loopback", "private", "public"];
32
+ /** A fixed host, or the host of the URL in one of the integration's settings, with its class. */
33
+ const Host = s.union([
34
+ fixedHost,
35
+ s.object({ fromSetting: s.string().min(1), class: s.enum(ADDRESS_CLASSES) }).strict(),
36
+ ]);
37
+ /**
38
+ * A host a secret may go to: a fixed host, or a `{ fromSetting }` host from
39
+ * `hosts`, named by its setting. The class stays with the one in `hosts`.
40
+ */
41
+ const SecretHost = s.union([fixedHost, s.object({ fromSetting: s.string().min(1) }).strict()]);
42
+ /**
43
+ * What every secret says, wherever the kit puts it. A plugin's local tool
44
+ * declares its secrets with these fields, without `as`.
45
+ */
46
+ export const secretFields = {
47
+ /** Why the integration needs it, in words the user understands. */
48
+ purpose: s.string().min(1),
49
+ /** The hosts it may go to. Each must be in the sheet's `hosts`. */
50
+ hosts: s.array(SecretHost).min(1),
51
+ /** Sent only when the workspace has set it up; without it the request goes out bare. */
52
+ optional: s.boolean().default(false),
53
+ };
54
+ /** An HTTP header name. */
55
+ const headerName = s.string().regex(/^[A-Za-z0-9!#$%&'*+.^_`|~-]+$/, "use an HTTP header name");
56
+ /**
57
+ * A sign-in's client secret. It has no `hosts` and no `as`: the sign-in that
58
+ * names it in `clientSecret` gives it its hosts (its `tokenUrl` and
59
+ * `revokeUrl`), and the integration can't place it at all.
60
+ */
61
+ const ClientSecret = s
62
+ .object({ purpose: s.string().min(1), as: s.literal(undefined).optional() })
63
+ .strict();
64
+ /**
65
+ * One entry of `secrets`, told apart by `as`: a secret the integration
66
+ * places and where the kit puts it, as `SecretPlacement` in the ports says
67
+ * (`bearer`, `header` or `form`), or, with no `as`, a client secret.
68
+ */
69
+ const Secret = s.discriminatedUnion("as", [
70
+ s.object({ ...secretFields, as: s.literal("bearer") }).strict(),
71
+ s
72
+ .object({
73
+ ...secretFields,
74
+ as: s.literal("header"),
75
+ header: headerName,
76
+ prefix: s.string().optional(),
77
+ })
78
+ .strict(),
79
+ s.object({ ...secretFields, as: s.literal("form"), field: s.string().min(1) }).strict(),
80
+ ClientSecret,
81
+ ]);
82
+ /**
83
+ * Whether a `secrets` entry is one the integration places. The other kind is
84
+ * a client secret, which only Halonic's sign-in code reads.
85
+ */
86
+ export function isPlacedSecret(entry) {
87
+ return entry.as !== undefined;
88
+ }
89
+ /**
90
+ * The secrets of a sheet the integration places, by name: `secrets` without
91
+ * the client secrets, which have no hosts or placement to show.
92
+ */
93
+ export function placedSecrets(secrets) {
94
+ return Object.entries(secrets).flatMap(([name, entry]) => isPlacedSecret(entry) ? [[name, entry]] : []);
95
+ }
96
+ /** One OAuth scope: a token of visible ASCII without a space, `"` or `\\` (RFC 6749, section 3.3). */
97
+ const SCOPE_PATTERN = /^[\x21\x23-\x5b\x5d-\x7e]+$/;
98
+ /** A path inside a sign-in URL's host: `/`, then anything but a space, `?` or `#`. */
99
+ const urlPath = s.string().regex(/^\/[^\s?#]*$/, "start the path with '/', such as '/oauth/token'");
100
+ /** Visible ASCII, so a client ID can't carry a line break or a space. */
101
+ export const CLIENT_ID_PATTERN = /^[\x21-\x7e]{1,256}$/;
102
+ /**
103
+ * An `https` URL for a sign-in: `https://host[:port]/path?query` with an
104
+ * exact host, no user name, password or `#fragment`. The host is the first
105
+ * group, so the sheet's checks can hold it against `hosts`. Plain `http` is
106
+ * never allowed, not even to this machine.
107
+ */
108
+ export const SIGN_IN_URL_PATTERN = new RegExp(`^https://(${HOST_PATTERN.source.slice(1, -1)})(?:/[^\\s?#]*)?(?:\\?[^\\s#]*)?$`);
109
+ /**
110
+ * Where a sign-in endpoint is: a fixed `https` URL, or the host of the URL in
111
+ * one of the integration's settings plus a fixed path, for a self-hosted
112
+ * service such as GitLab. That setting must be a `public` host in `hosts`.
113
+ */
114
+ const SignInUrl = s.union([
115
+ s
116
+ .string()
117
+ .regex(SIGN_IN_URL_PATTERN, "use an https URL with an exact host, such as 'https://auth.example.com/oauth/token'"),
118
+ s.object({ fromSetting: s.string().min(1), path: urlPath.optional() }).strict(),
119
+ ]);
120
+ /** One scope the sign-in asks for, and why, in words the user reads. */
121
+ const SignInScope = s
122
+ .object({
123
+ scope: s.string().regex(SCOPE_PATTERN, "use one OAuth scope, without spaces"),
124
+ /** Shown to the user as it is. */
125
+ reason: s.string().regex(/\S/, "say why the integration needs the scope"),
126
+ })
127
+ .strict();
128
+ /** Where the sign-in's access token goes: the hosts, and how the kit puts it in. */
129
+ const SignInAccess = s.discriminatedUnion("as", [
130
+ s.object({ hosts: s.array(SecretHost).min(1), as: s.literal("bearer") }).strict(),
131
+ s
132
+ .object({
133
+ hosts: s.array(SecretHost).min(1),
134
+ as: s.literal("header"),
135
+ header: headerName,
136
+ prefix: s.string().optional(),
137
+ })
138
+ .strict(),
139
+ ]);
140
+ /**
141
+ * A sign-in: an OAuth 2.0 flow that Halonic's own code runs, and where the
142
+ * access token may go. The integration can use the token (`{ signIn }` in
143
+ * `auth`) but never read it. Needs `kit: 2`.
144
+ */
145
+ const SignIn = s
146
+ .object({
147
+ /** What the sign-in is for, in words the user understands. */
148
+ purpose: s.string().min(1),
149
+ /** Authorization code with PKCE (S256) and a loopback redirect: the only flow so far. */
150
+ flow: s.literal("oauth-code"),
151
+ /** May carry extra query parameters; the ones Halonic sets itself are refused by the sheet check. */
152
+ authorizeUrl: SignInUrl,
153
+ tokenUrl: SignInUrl,
154
+ /** RFC 7009. Without it, signing out only forgets the tokens. */
155
+ revokeUrl: SignInUrl.optional(),
156
+ /**
157
+ * Say `true` when the server's revoke ends every token of the client and
158
+ * user, not only the one sent (RFC 7009 allows it; Google does it). Signing
159
+ * in again then keeps the old token instead of revoking it, because the
160
+ * revoke would end the new grant too.
161
+ */
162
+ revokeEndsClientGrants: s.boolean().optional(),
163
+ /** Checked against the `iss` of the redirect (RFC 9207). */
164
+ issuer: SignInUrl.optional(),
165
+ /** A fixed ID, or a setting: never a secret, since OAuth sends it in the browser's address bar. */
166
+ clientId: s.union([
167
+ s.string().regex(CLIENT_ID_PATTERN, "use the client ID without spaces"),
168
+ s.object({ fromSetting: s.string().min(1) }).strict(),
169
+ ]),
170
+ /** A secret of this sheet without `hosts`; a public client leaves it out and uses PKCE only. */
171
+ clientSecret: name.optional(),
172
+ /** How the client authenticates at the token endpoint: in the body, or HTTP Basic. */
173
+ clientAuth: s.enum(["post", "basic"]).default("post"),
174
+ scopes: s.array(SignInScope).default([]),
175
+ access: SignInAccess,
176
+ })
177
+ .strict();
178
+ const Token = s.object({ name, purpose: s.string().min(1) }).strict();
179
+ /**
180
+ * A plain noun: letters, with single spaces between words. Only its first
181
+ * letter may be a capital, for a product name such as "Drive file"; the rest
182
+ * is lower case, so a sheet can't shout. No digits or other marks, so it
183
+ * can't carry a secret or an argument value.
184
+ */
185
+ const TOOL_NOUN_PATTERN = /^[A-Za-z][a-z]*(?: [a-z]+)*$/;
186
+ const nounWord = s
187
+ .string()
188
+ .regex(TOOL_NOUN_PATTERN, "use a lower-case noun of letters and spaces, such as 'email', with at most a capital first letter, such as 'Drive file'");
189
+ /**
190
+ * What one call of a tool sends, in the singular and the plural, so a run can
191
+ * say "Sent 1 email" or "Sent 3 emails".
192
+ */
193
+ const ToolNoun = s.object({ one: nounWord, many: nounWord }).strict();
194
+ /**
195
+ * What one call of a tool does to its noun, in the past tense, so a run can
196
+ * say "Saved 1 Drive file" rather than "Sent". A closed list, so a sheet
197
+ * can't word a send as something milder: each verb still says that something
198
+ * was made or changed; `drafted` is only for a `write` tool (`drafted-on-send-tool`).
199
+ * The same list as `ToolVerb` in `@halonicjs/events`.
200
+ */
201
+ const TOOL_VERBS = ["sent", "saved", "created", "updated", "moved", "drafted"];
202
+ /** A tool as a sheet declares it; a plugin's local tools declare theirs the same way. */
203
+ export const IntegrationTool = s
204
+ .object({
205
+ name: s.string().min(1),
206
+ /** Word for word the code's text: it is what the user approves and the model reads. */
207
+ description: s.string().min(1),
208
+ /** Each argument's description, word for word as in the code. */
209
+ arguments: s.record(s.string().min(1), s.string().min(1)).optional(),
210
+ /** `read` changes nothing, `write` changes data, `send` reaches people outside. */
211
+ risk: s.enum(["read", "write", "send"]),
212
+ /** What a `send` tool sends, such as `{ one: email, many: emails }`. */
213
+ noun: ToolNoun.optional(),
214
+ /** What one call does to its noun, such as `saved`; absent means `sent`. Only next to a noun. */
215
+ verb: s.enum(TOOL_VERBS).optional(),
216
+ /** Whether the result carries outside content, such as mail. Always stated. */
217
+ untrusted: s.boolean(),
218
+ })
219
+ .strict();
220
+ /** The secret of Halonic's own Google sign-in; only a sheet with it may have the Google fields. */
221
+ export const GOOGLE_SECRET = "google-account";
222
+ /**
223
+ * A Google scope: `https://www.googleapis.com/auth/<name>`, or one of the
224
+ * sign-in scopes Google names without a URL.
225
+ */
226
+ export const GOOGLE_SCOPE_PATTERN = /^(?:https:\/\/www\.googleapis\.com\/auth\/[a-z][a-z0-9._-]*|openid|email|profile)$/;
227
+ /** A Google API's service name, as the Cloud Console uses it, such as `gmail.googleapis.com`. */
228
+ export const GOOGLE_API_PATTERN = /^[a-z][a-z0-9-]*\.googleapis\.com$/;
229
+ /**
230
+ * Google's name for an API, such as `Gmail API` or `Cloud Pub/Sub API`: up to
231
+ * 80 letters, digits, spaces and `( ) & ' / . , -`, starting with a letter or
232
+ * digit. No `:`, so no link with a scheme fits. The Google setup record keeps
233
+ * this name with the same rule, so a check result for a name this takes is
234
+ * never refused when it is saved.
235
+ */
236
+ export const GOOGLE_API_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9 ()&'/.,-]{0,79}$/;
237
+ /**
238
+ * An `https` URL to a lower-case host without a port, user name, password
239
+ * or `#fragment`. The host is the first group, so the sheet's checks can
240
+ * hold it against `hosts`. The core has no `URL` class (plan 4.1).
241
+ */
242
+ export const GOOGLE_CHECK_URL_PATTERN = /^https:\/\/((?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z](?:[a-z0-9-]*[a-z0-9])?)(?:[/?][^\s#]*)?$/;
243
+ /** One scope the `google-account` token gets, and why, in words the user reads. */
244
+ const GoogleScope = s
245
+ .object({
246
+ scope: s
247
+ .string()
248
+ .regex(GOOGLE_SCOPE_PATTERN, "use a full Google scope URL, such as 'https://www.googleapis.com/auth/drive', or openid, email or profile"),
249
+ /** Shown to the user as it is. */
250
+ reason: s.string().regex(/\S/, "say why the integration needs the scope"),
251
+ /**
252
+ * Only `true`, for a scope Google calls restricted: a scope that isn't
253
+ * leaves the key out, so a `false` can't hide a typo.
254
+ */
255
+ restricted: s.literal(true).optional(),
256
+ })
257
+ .strict();
258
+ /** One API the user switches on in the Google Cloud Console. */
259
+ const GoogleApi = s
260
+ .object({
261
+ api: s
262
+ .string()
263
+ .regex(GOOGLE_API_PATTERN, "use the API's service name, such as 'drive.googleapis.com'"),
264
+ /** Google's name for the API, shown to the user as it is. */
265
+ name: s
266
+ .string()
267
+ .regex(GOOGLE_API_NAME_PATTERN, "use Google's name for the API, such as 'Google Drive API', with no ':' and at most 80 characters"),
268
+ })
269
+ .strict();
270
+ /**
271
+ * The one read the host sends after sign-in to see that the API is on. It
272
+ * only looks, so it is a `GET` without a body.
273
+ */
274
+ const GoogleCheck = s
275
+ .object({
276
+ method: s.literal("GET"),
277
+ url: s
278
+ .string()
279
+ .regex(GOOGLE_CHECK_URL_PATTERN, "use an https URL without a port, user name, password or #fragment, such as 'https://gmail.googleapis.com/gmail/v1/users/me/profile'"),
280
+ })
281
+ .strict();
282
+ /** One hour, the most a timeout may be. */
283
+ export const MAX_TIMEOUT_MS = 3_600_000;
284
+ /** One GiB, the largest response a sheet may allow. */
285
+ export const MAX_RESPONSE_BYTES = 1_073_741_824;
286
+ const timeout = s.number().int().positive().max(MAX_TIMEOUT_MS);
287
+ /** The kit's request limits; each has an upper bound, so a sheet can't switch one off. */
288
+ const Limits = s
289
+ .object({
290
+ /** The whole request, reading the body included. */
291
+ timeoutMs: timeout.optional(),
292
+ /** Waiting for the response headers, redirects included. */
293
+ headersTimeoutMs: timeout.optional(),
294
+ /** Waiting for the next piece of the body. */
295
+ idleTimeoutMs: timeout.optional(),
296
+ maxResponseBytes: s.number().int().positive().max(MAX_RESPONSE_BYTES).optional(),
297
+ })
298
+ .strict();
299
+ /**
300
+ * A field that holds the user's own content, as the recorder reads it:
301
+ * `request.body` or `response.body`, then `.name`, `.*`, `[*]` or `[n]`
302
+ * steps; or `request.query.<name>`, one query parameter.
303
+ */
304
+ export const CONTENT_PATH_PATTERN = /^(?:(?:request|response)\.body(?:\.[^.[\]*\s]+|\.\*|\[(?:\*|\d+)\])*|request\.query\.[^.[\]*\s]+)$/;
305
+ /** What the recorder must scrub beyond the rules every integration gets. */
306
+ const Recording = s
307
+ .object({
308
+ userContent: s
309
+ .array(s
310
+ .string()
311
+ .regex(CONTENT_PATH_PATTERN, "use a path from request.body, response.body or request.query, such as 'response.body.items[*].text'"))
312
+ .optional(),
313
+ /** Query parameters, form fields and JSON field names that carry a secret. */
314
+ secretFields: s.array(s.string().min(1)).optional(),
315
+ /** Content types, such as `text/plain`, that may be saved as plain text. */
316
+ allowContentTypes: s
317
+ .array(s
318
+ .string()
319
+ .regex(/^[a-z0-9][\w!#$&^.+-]*\/[a-z0-9][\w!#$&^.+-]*$/i, "use type/subtype, such as 'text/plain'"))
320
+ .default([]),
321
+ })
322
+ .strict();
323
+ /**
324
+ * `integration.yaml`: what an integration may do, which the user approves
325
+ * before it runs. The kit enforces its hosts and secrets.
326
+ */
327
+ export const IntegrationSheet = s
328
+ .object({
329
+ /** The integration's name. */
330
+ id: name,
331
+ version: s.string().regex(/^\d+\.\d+\.\d+$/, "use major.minor.patch, such as '1.0.0'"),
332
+ /** The `Integration` port version it was built against. */
333
+ kit: s.number().int().positive(),
334
+ provides: s.array(s.enum(["connector", "llm", "knowledge"])).min(1),
335
+ hosts: s.array(Host),
336
+ /**
337
+ * Secret name → why, where it may go and how the kit puts it in; or, for
338
+ * a sign-in's client secret, only why.
339
+ */
340
+ secrets: s.record(name, Secret).default({}),
341
+ /** Sign-in name → how Halonic signs in, and where the access token may go. Needs `kit: 2`. */
342
+ signIns: s.record(name, SignIn).default({}),
343
+ // Studio builds the Google setup steps from the three Google fields
344
+ // (`@halonicjs/google-setup`). Only a sheet with the `google-account`
345
+ // secret may have them.
346
+ /** Each scope the `google-account` token gets, and why. */
347
+ googleScopes: s.array(GoogleScope).optional(),
348
+ /** The APIs to switch on; at least one whenever `googleScopes` is set. */
349
+ googleApis: s.array(GoogleApi).optional(),
350
+ googleCheck: GoogleCheck.optional(),
351
+ /** Values the integration itself writes and reads back later. */
352
+ tokens: s.array(Token).default([]),
353
+ tools: s.array(IntegrationTool).default([]),
354
+ /** Capabilities beyond HTTP. `process` starts a local program. */
355
+ needs: s.array(s.enum(["process"])).default([]),
356
+ limits: Limits.optional(),
357
+ recording: Recording.optional(),
358
+ })
359
+ .strict();
@@ -0,0 +1,13 @@
1
+ import type { KindCheckProblem } from "../../kind.js";
2
+ import { type IntegrationSheet } from "./schema.js";
3
+ /**
4
+ * The rules over a sheet's `signIns` and their client secrets: the sheet
5
+ * says `kit: 2`; the access token goes only to hosts the sheet declares; a
6
+ * `{ fromSetting }` URL reads a public host the sheet declares; Halonic's own
7
+ * authorize parameters stay Halonic's; and a client secret has no hosts of
8
+ * its own and belongs to exactly one sign-in.
9
+ *
10
+ * @example
11
+ * checkSignIns(sheet); // [] for a sheet without signIns
12
+ */
13
+ export declare function checkSignIns(sheet: IntegrationSheet): KindCheckProblem[];
@@ -0,0 +1,120 @@
1
+ import { hostKey } from "./host-key.js";
2
+ import { isPlacedSecret } from "./schema.js";
3
+ import { fixedSignInUrl, queryParameterNames, RESERVED_AUTHORIZE_PARAMETERS, } from "./sign-in-urls.js";
4
+ /** The first `kit` that has `signIns`. */
5
+ const SIGN_IN_KIT = 2;
6
+ /** The URL fields of a sign-in, with whether a query is allowed on each. */
7
+ const URL_FIELDS = [
8
+ { field: "authorizeUrl", query: true },
9
+ { field: "tokenUrl", query: false },
10
+ { field: "revokeUrl", query: false },
11
+ { field: "issuer", query: false },
12
+ ];
13
+ /**
14
+ * The rules over a sheet's `signIns` and their client secrets: the sheet
15
+ * says `kit: 2`; the access token goes only to hosts the sheet declares; a
16
+ * `{ fromSetting }` URL reads a public host the sheet declares; Halonic's own
17
+ * authorize parameters stay Halonic's; and a client secret has no hosts of
18
+ * its own and belongs to exactly one sign-in.
19
+ *
20
+ * @example
21
+ * checkSignIns(sheet); // [] for a sheet without signIns
22
+ */
23
+ export function checkSignIns(sheet) {
24
+ const entries = Object.entries(sheet.signIns);
25
+ const problems = [...kitProblems(sheet, entries.length)];
26
+ for (const [name, signIn] of entries) {
27
+ problems.push(...accessHostProblems(sheet, name, signIn), ...urlProblems(sheet, name, signIn));
28
+ }
29
+ problems.push(...clientSecretProblems(sheet));
30
+ return problems;
31
+ }
32
+ /** A problem in the sheet, with the sheet's name in front of the message. */
33
+ function problemAt(sheet, code, path, message) {
34
+ return { severity: "error", code, path, message: `Integration "${sheet.id}": ${message}` };
35
+ }
36
+ function kitProblems(sheet, signInCount) {
37
+ if (signInCount === 0 || sheet.kit >= SIGN_IN_KIT) {
38
+ return [];
39
+ }
40
+ const message = `signIns need kit: ${SIGN_IN_KIT} or higher, and this sheet says kit: ${sheet.kit}. Set kit: ${SIGN_IN_KIT}`;
41
+ return [problemAt(sheet, "sign-ins-need-kit-2", ["kit"], message)];
42
+ }
43
+ /** The access token goes only to hosts the sheet declares, as a secret does. */
44
+ function accessHostProblems(sheet, name, signIn) {
45
+ const declared = new Set(sheet.hosts.map(hostKey));
46
+ return signIn.access.hosts.flatMap((host, index) => declared.has(hostKey(host))
47
+ ? []
48
+ : [
49
+ problemAt(sheet, "sign-in-host-not-declared", ["signIns", name, "access", "hosts", index], `the sign-in "${name}" may only send its token to hosts in hosts, and ${hostKey(host)} isn't one`),
50
+ ]);
51
+ }
52
+ /** Each URL reads a public setting host, carries a query only where allowed, and leaves Halonic's parameters alone. */
53
+ function urlProblems(sheet, name, signIn) {
54
+ const publicSettings = new Set(sheet.hosts.flatMap((host) => typeof host !== "string" && host.class === "public" ? [host.fromSetting] : []));
55
+ const problems = [];
56
+ for (const { field, query } of URL_FIELDS) {
57
+ const url = signIn[field];
58
+ if (url === undefined) {
59
+ continue;
60
+ }
61
+ const path = ["signIns", name, field];
62
+ if (typeof url !== "string" && !publicSettings.has(url.fromSetting)) {
63
+ problems.push(problemAt(sheet, "sign-in-setting-not-public", path, `the sign-in "${name}" reads its ${field} from the setting "${url.fromSetting}", which must be a host in hosts with class: public`));
64
+ }
65
+ const queryText = fixedSignInUrl(url)?.query ?? "";
66
+ if (!query && queryText !== "") {
67
+ problems.push(problemAt(sheet, "sign-in-url-query", path, `the ${field} of "${name}" can't carry a query`));
68
+ }
69
+ const reserved = query ? reservedIn(queryText) : [];
70
+ for (const parameter of reserved) {
71
+ problems.push(problemAt(sheet, "sign-in-reserved-parameter", path, `the authorizeUrl of "${name}" sets ${parameter}, which Halonic sets itself`));
72
+ }
73
+ }
74
+ return problems;
75
+ }
76
+ /**
77
+ * A client secret is declared without `hosts` and `as`, named by exactly one
78
+ * sign-in, and every such secret is named by one.
79
+ */
80
+ function clientSecretProblems(sheet) {
81
+ const problems = [];
82
+ const namedBy = new Map();
83
+ for (const [name, signIn] of Object.entries(sheet.signIns)) {
84
+ const secret = signIn.clientSecret;
85
+ if (secret === undefined) {
86
+ continue;
87
+ }
88
+ namedBy.set(secret, [...(namedBy.get(secret) ?? []), name]);
89
+ const problem = clientSecretKindProblem(sheet, name, secret);
90
+ if (problem !== undefined) {
91
+ problems.push(problem);
92
+ }
93
+ }
94
+ for (const [secret, signIns] of namedBy) {
95
+ if (signIns.length > 1) {
96
+ problems.push(problemAt(sheet, "client-secret-shared", ["secrets", secret], `the client secret "${secret}" is named by ${signIns.length} sign-ins (${signIns.join(", ")}); give each its own`));
97
+ }
98
+ }
99
+ for (const [name, secret] of Object.entries(sheet.secrets)) {
100
+ if (!isPlacedSecret(secret) && !namedBy.has(name)) {
101
+ problems.push(problemAt(sheet, "client-secret-unused", ["secrets", name], `the secret "${name}" has no hosts and no "as", so it must be the clientSecret of a sign-in, and none names it`));
102
+ }
103
+ }
104
+ return problems;
105
+ }
106
+ function clientSecretKindProblem(sheet, signIn, secret) {
107
+ const entry = Object.hasOwn(sheet.secrets, secret) ? sheet.secrets[secret] : undefined;
108
+ const path = ["signIns", signIn, "clientSecret"];
109
+ if (entry === undefined) {
110
+ return problemAt(sheet, "client-secret-not-declared", path, `the sign-in "${signIn}" names the client secret "${secret}", which secrets doesn't declare`);
111
+ }
112
+ return isPlacedSecret(entry)
113
+ ? problemAt(sheet, "client-secret-has-hosts", path, `the client secret "${secret}" of "${signIn}" must have no hosts and no "as": it goes only to the sign-in's token and revoke hosts`)
114
+ : undefined;
115
+ }
116
+ /** The reserved parameter names a query sets, each once. */
117
+ function reservedIn(query) {
118
+ const set = new Set(queryParameterNames(query));
119
+ return RESERVED_AUTHORIZE_PARAMETERS.filter((name) => set.has(name));
120
+ }
@@ -0,0 +1,19 @@
1
+ import { type IntegrationSignInUrl } from "./schema.js";
2
+ /**
3
+ * Query parameters of an `authorizeUrl` that Halonic sets itself. A sheet
4
+ * that sets one is refused, so a sign-in can't pick its own `redirect_uri`,
5
+ * `state` or PKCE challenge.
6
+ */
7
+ export declare const RESERVED_AUTHORIZE_PARAMETERS: readonly string[];
8
+ /** The pieces of a fixed sign-in URL, or `undefined` for the `{ fromSetting }` form. */
9
+ export declare function fixedSignInUrl(url: IntegrationSignInUrl): {
10
+ readonly host: string;
11
+ readonly query: string;
12
+ } | undefined;
13
+ /**
14
+ * The names a query string sets, lower-cased and percent-decoded, so
15
+ * `%63lient_id` and `Client_ID` count as `client_id`. A name that isn't valid
16
+ * percent-encoding is returned as written: it can't be a reserved name, and
17
+ * the service would not read it as one either.
18
+ */
19
+ export declare function queryParameterNames(query: string): string[];
@@ -0,0 +1,47 @@
1
+ import { SIGN_IN_URL_PATTERN } from "./schema.js";
2
+ /**
3
+ * Query parameters of an `authorizeUrl` that Halonic sets itself. A sheet
4
+ * that sets one is refused, so a sign-in can't pick its own `redirect_uri`,
5
+ * `state` or PKCE challenge.
6
+ */
7
+ export const RESERVED_AUTHORIZE_PARAMETERS = [
8
+ "client_id",
9
+ "redirect_uri",
10
+ "state",
11
+ "code_challenge",
12
+ "code_challenge_method",
13
+ "response_type",
14
+ "response_mode",
15
+ "request",
16
+ "request_uri",
17
+ "scope",
18
+ ];
19
+ /** The pieces of a fixed sign-in URL, or `undefined` for the `{ fromSetting }` form. */
20
+ export function fixedSignInUrl(url) {
21
+ if (typeof url !== "string") {
22
+ return undefined;
23
+ }
24
+ const host = SIGN_IN_URL_PATTERN.exec(url)?.[1] ?? "";
25
+ const queryStart = url.indexOf("?");
26
+ return { host, query: queryStart === -1 ? "" : url.slice(queryStart + 1) };
27
+ }
28
+ /**
29
+ * The names a query string sets, lower-cased and percent-decoded, so
30
+ * `%63lient_id` and `Client_ID` count as `client_id`. A name that isn't valid
31
+ * percent-encoding is returned as written: it can't be a reserved name, and
32
+ * the service would not read it as one either.
33
+ */
34
+ export function queryParameterNames(query) {
35
+ return query
36
+ .split("&")
37
+ .filter((pair) => pair !== "")
38
+ .map((pair) => {
39
+ const name = pair.split("=")[0]?.replaceAll("+", " ") ?? "";
40
+ try {
41
+ return decodeURIComponent(name).toLowerCase();
42
+ }
43
+ catch {
44
+ return name.toLowerCase();
45
+ }
46
+ });
47
+ }
@@ -0,0 +1,4 @@
1
+ import type { FileKind } from "../../kind.js";
2
+ import { KnowledgeSource } from "./schema.js";
3
+ /** `library/knowledge/<id>.yaml`, shared at the root or a hub's own. */
4
+ export declare const knowledgeKind: FileKind<KnowledgeSource>;
@@ -0,0 +1,13 @@
1
+ import { checkKeysIn } from "../../shared/key-in-value.js";
2
+ import { KnowledgeSource } from "./schema.js";
3
+ /** `library/knowledge/<id>.yaml`, shared at the root or a hub's own. */
4
+ export const knowledgeKind = {
5
+ name: "knowledge",
6
+ about: "A knowledge source agents can search, and with files also write notes to.",
7
+ syntax: "yaml",
8
+ schema: KnowledgeSource,
9
+ places: [{ scope: "workspace-and-hub", folder: "library/knowledge", name: "<id>.yaml" }],
10
+ idFromPlace: "fallback",
11
+ /** `config` takes any setting, so a key pasted there is caught here. */
12
+ check: (source) => checkKeysIn(source.config, ["config"], "setting"),
13
+ };
@@ -0,0 +1,18 @@
1
+ import { type Infer } from "../../../../schema-kit/src/index.js";
2
+ /** `library/knowledge/<id>.yaml`: a source agents can search. */
3
+ export declare const KnowledgeSource: import("zod").ZodObject<{
4
+ version: import("zod").ZodDefault<import("zod").ZodLiteral<1>>;
5
+ id: import("zod").ZodString;
6
+ name: import("zod").ZodOptional<import("zod").ZodString>;
7
+ description: import("zod").ZodOptional<import("zod").ZodString>;
8
+ summary: import("zod").ZodOptional<import("zod").ZodString>;
9
+ mode: import("zod").ZodOptional<import("zod").ZodEnum<{
10
+ auto: "auto";
11
+ tools: "tools";
12
+ }>>;
13
+ provider: import("zod").ZodString;
14
+ writable: import("zod").ZodOptional<import("zod").ZodBoolean>;
15
+ config: import("zod").ZodDefault<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
16
+ }, import("zod/v4/core").$strict>;
17
+ /** A knowledge source, with defaults filled in. */
18
+ export type KnowledgeSource = Infer<typeof KnowledgeSource>;
@@ -0,0 +1,25 @@
1
+ import { s } from "../../../../schema-kit/src/index.js";
2
+ import { id, version } from "../../shared/fields.js";
3
+ /** `library/knowledge/<id>.yaml`: a source agents can search. */
4
+ export const KnowledgeSource = s
5
+ .object({
6
+ version,
7
+ id,
8
+ name: s.string().optional(),
9
+ description: s.string().optional(),
10
+ /** What the source covers, written or approved by a person. Agents see it in their prompt. */
11
+ summary: s.string().optional(),
12
+ /**
13
+ * `tools` (the default): agents search when they decide to. `auto`: the
14
+ * task text is also searched before the first model call and the top
15
+ * passages go into the prompt.
16
+ */
17
+ mode: s.enum(["tools", "auto"]).optional(),
18
+ /** Knowledge provider type, such as files, mcp or vector. */
19
+ provider: s.string().min(1),
20
+ /** Files only: agents that list the source may also write notes to it. */
21
+ writable: s.boolean().optional(),
22
+ /** Settings the knowledge provider checks against its own schema. */
23
+ config: s.record(s.string(), s.unknown()).default({}),
24
+ })
25
+ .strict();
@@ -0,0 +1,4 @@
1
+ import type { FileKind } from "../../kind.js";
2
+ import { Models } from "./schema.js";
3
+ /** `models.yaml` at the workspace root. */
4
+ export declare const modelsKind: FileKind<Models>;
@@ -0,0 +1,10 @@
1
+ import { Models } from "./schema.js";
2
+ /** `models.yaml` at the workspace root. */
3
+ export const modelsKind = {
4
+ name: "models",
5
+ about: "The model aliases agents use, each a provider's model with fallbacks and a price.",
6
+ syntax: "yaml",
7
+ schema: Models,
8
+ places: [{ scope: "workspace", folder: "", name: "models.yaml" }],
9
+ idFromPlace: "none",
10
+ };