@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,127 @@
1
+ import type { Usage } from "../../events/src/index.js";
2
+ /** A tool call the model asked for. */
3
+ export interface ToolCall {
4
+ id: string;
5
+ name: string;
6
+ arguments: Record<string, unknown>;
7
+ /** Opaque data a provider needs back with this call in later turns (Gemini's thought signature). */
8
+ signature?: string;
9
+ }
10
+ /**
11
+ * A provider's own record of an assistant turn, which it needs back unchanged
12
+ * in later turns (Anthropic's content blocks with their thinking signatures,
13
+ * OpenAI's reasoning items).
14
+ *
15
+ * Only the provider that wrote it reads `data`. The engine copies `replay`
16
+ * from a {@link ChatResponse} onto the assistant {@link ChatMessage} it
17
+ * stores for that turn, never changes it, and keeps it as JSON. A provider
18
+ * sends `data` back only when `type` is its own; otherwise, as after a model
19
+ * switch, it builds the turn from `content` and `toolCalls`.
20
+ *
21
+ * @example
22
+ * const replay: ProviderReplay = { type: "anthropic", data: body.content };
23
+ */
24
+ export interface ProviderReplay {
25
+ /** The provider that wrote it, such as "anthropic". */
26
+ type: string;
27
+ /** JSON-safe data only that provider understands. */
28
+ data: unknown;
29
+ }
30
+ /** One message of a conversation with a model. */
31
+ export type ChatMessage = {
32
+ role: "system";
33
+ content: string;
34
+ } | {
35
+ role: "user";
36
+ content: string;
37
+ } | {
38
+ role: "assistant";
39
+ content: string;
40
+ toolCalls?: ToolCall[];
41
+ replay?: ProviderReplay;
42
+ } | {
43
+ role: "tool";
44
+ content: string;
45
+ toolCallId: string;
46
+ name: string;
47
+ };
48
+ /** A tool the model may call. */
49
+ export interface ToolDefinition {
50
+ name: string;
51
+ description: string;
52
+ /** JSON Schema of the arguments object. */
53
+ parameters: Record<string, unknown>;
54
+ }
55
+ /** Sampling settings for one model call. Providers ignore what they don't support. */
56
+ export interface ChatParams {
57
+ temperature?: number;
58
+ topP?: number;
59
+ maxTokens?: number;
60
+ stop?: string[];
61
+ reasoningEffort?: "low" | "medium" | "high";
62
+ extra?: Record<string, unknown>;
63
+ }
64
+ /** One model call. */
65
+ export interface ChatRequest {
66
+ model: string;
67
+ messages: ChatMessage[];
68
+ tools?: ToolDefinition[];
69
+ params?: ChatParams;
70
+ responseFormat?: "text" | "json";
71
+ /** Who is asking; used by mocks, logging and routing. Never sent to vendors. */
72
+ meta?: {
73
+ agentId?: string;
74
+ runId?: string;
75
+ };
76
+ signal?: AbortSignal;
77
+ }
78
+ /** The model's answer to one {@link ChatRequest}. */
79
+ export interface ChatResponse {
80
+ content: string;
81
+ /** The model's own summary of its reasoning, where the provider gives one (Gemini thought summaries). */
82
+ reasoning?: string;
83
+ toolCalls: ToolCall[];
84
+ usage: Usage;
85
+ finishReason: "stop" | "tool_calls" | "length" | "error" | "other";
86
+ /** The provider's record of this turn; the engine copies it onto the assistant message unchanged. */
87
+ replay?: ProviderReplay;
88
+ }
89
+ /**
90
+ * One piece of a streamed answer. Deltas arrive in the order the model
91
+ * writes them; the stream ends with exactly one `done`, whose `response` is
92
+ * what `chat()` would have returned for the same request.
93
+ *
94
+ * A tool call arrives in pieces too: the first piece for an `index` carries
95
+ * its `id` and `name`, and the `arguments` pieces join into the JSON text of
96
+ * its arguments. Only `done` holds the parsed {@link ToolCall}.
97
+ *
98
+ * The pieces must add up to `done`: the `text` deltas joined equal
99
+ * `done.response.content`, and the `arguments` pieces for each `index`
100
+ * joined parse to `done.response.toolCalls[index].arguments`. A stream that
101
+ * ends without `done`, or yields anything after it, is an error for the
102
+ * caller. The engine runs tool calls only from `done`, never from deltas.
103
+ *
104
+ * @example
105
+ * if (provider.capabilities.streaming && provider.stream) {
106
+ * for await (const event of provider.stream(request)) {
107
+ * if (event.type === "text") showText(event.delta);
108
+ * if (event.type === "done") return event.response;
109
+ * }
110
+ * }
111
+ */
112
+ export type ChatStreamEvent = {
113
+ type: "text";
114
+ delta: string;
115
+ } | {
116
+ type: "reasoning";
117
+ delta: string;
118
+ } | {
119
+ type: "tool-call";
120
+ index: number;
121
+ id?: string;
122
+ name?: string;
123
+ arguments: string;
124
+ } | {
125
+ type: "done";
126
+ response: ChatResponse;
127
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ /** Version of the {@link Clock} port. A breaking change bumps it and comes with an ADR. */
2
+ export declare const clockVersion = 1;
3
+ /** The current time. Passed in, so tests and replays can fix it. */
4
+ export interface Clock {
5
+ /** The current time. Each call returns a new `Date`, so callers may change it. */
6
+ now(): Date;
7
+ }
@@ -0,0 +1,2 @@
1
+ /** Version of the {@link Clock} port. A breaking change bumps it and comes with an ADR. */
2
+ export const clockVersion = 1;
@@ -0,0 +1,57 @@
1
+ /** Version of the {@link ConnectionSettingsStore} port. A breaking change bumps it and comes with an ADR. */
2
+ export declare const connectionSettingsStoreVersion = 1;
3
+ /** Which connector a setting is for. */
4
+ export interface ConnectionKey {
5
+ /** The workspace's resolved real path, as in a `TrustRecord`. */
6
+ location: string;
7
+ /** The connector's id in the workspace. */
8
+ connector: string;
9
+ }
10
+ /**
11
+ * The settings a person chose for one connector (requirement
12
+ * `ports.connection-settings-store`).
13
+ *
14
+ * @example
15
+ * const settings: ConnectionSettingsRecord = {
16
+ * location: "/workspaces/acme",
17
+ * connector: "mail",
18
+ * allowSending: true,
19
+ * changedAt: "2026-11-09T10:00:00.000Z",
20
+ * };
21
+ */
22
+ export interface ConnectionSettingsRecord extends ConnectionKey {
23
+ /**
24
+ * Whether the connector's tools labelled `send` may run, such as sending
25
+ * a mail. Without a record, sending is off.
26
+ */
27
+ allowSending: boolean;
28
+ /** When the person last changed the settings, as ISO text. */
29
+ changedAt: string;
30
+ }
31
+ /**
32
+ * The settings of each connector, in the user's profile next to the trust
33
+ * records: the profile folder for the CLI and `serve`, the app data folder
34
+ * for the desktop app, memory for tests and the browser demo. **Never
35
+ * inside a workspace**, so an agent that edits the workspace can't switch
36
+ * sending on.
37
+ *
38
+ * The port only stores settings. `ConnectionSettings` in `core/app` reads
39
+ * them, treats a missing record as sending off, and is what the engine and
40
+ * the outside-a-run gate ask. Only a person changes them: no tool the model
41
+ * can call reaches this store.
42
+ *
43
+ * A record that exists but can't be read makes `get` throw, never return
44
+ * `null`: the caller then treats sending as off and tells the user why. The
45
+ * error names the record's key, and `remove` still deletes it.
46
+ */
47
+ export interface ConnectionSettingsStore {
48
+ /** The settings for one connector, or `null` when there are none. */
49
+ get(key: ConnectionKey): Promise<ConnectionSettingsRecord | null>;
50
+ /** Saves settings, replacing any with the same key. */
51
+ save(settings: ConnectionSettingsRecord): Promise<void>;
52
+ /**
53
+ * Deletes the settings for one connector, even ones that can't be read.
54
+ * Removing settings that aren't there is not an error.
55
+ */
56
+ remove(key: ConnectionKey): Promise<void>;
57
+ }
@@ -0,0 +1,2 @@
1
+ /** Version of the {@link ConnectionSettingsStore} port. A breaking change bumps it and comes with an ADR. */
2
+ export const connectionSettingsStoreVersion = 1;
@@ -0,0 +1,303 @@
1
+ import type { HttpClient } from "./http-client.js";
2
+ import type { SandboxSession } from "./sandbox.js";
3
+ import type { Secrets } from "./secrets.js";
4
+ import type { TokenStore } from "./token-store.js";
5
+ /** Version of the {@link ConnectorClient} and {@link ConnectorFactory} ports. A breaking change bumps it and comes with an ADR. */
6
+ export declare const connectorClientVersion = 1;
7
+ /**
8
+ * What calling a tool can do. `read` changes nothing; `write` changes data,
9
+ * such as mail, files or records; `send` reaches people outside, such as
10
+ * sending a mail. Approvals use it.
11
+ */
12
+ export type ToolRisk = "read" | "write" | "send";
13
+ /**
14
+ * Whether a text passes the name rule of `ports.untrusted-tool-listings`:
15
+ * 1 to 64 ASCII letters, digits, `_` or `-`. The model sends tool names
16
+ * back in calls, so they can't be fenced, and the rule keeps them too short
17
+ * and plain to carry much. A connector file's `tools.read` names pass the
18
+ * same rule, so a look-alike letter or an invisible character can't hide
19
+ * in one; widen both together or neither.
20
+ *
21
+ * @example
22
+ * passesNameRule("search_issues"); // true
23
+ * passesNameRule("search_\u0456ssues"); // false: a Cyrillic "і" in "issues"
24
+ * passesNameRule("notes.lookup"); // false
25
+ */
26
+ export declare function passesNameRule(text: unknown): text is string;
27
+ /** A tool a connector offers. */
28
+ export interface ConnectorTool {
29
+ /** The tool's name, unique within its connector. */
30
+ name: string;
31
+ /** What the tool does, written for the model. */
32
+ description: string;
33
+ /** JSON Schema of the arguments object. */
34
+ parameters: Record<string, unknown>;
35
+ /**
36
+ * What calling it can do. Absent means unknown: treat it as `write`. The
37
+ * host ignores it for a tool an `http` or `stdio` connector lists (see
38
+ * {@link ConnectorClient.listTools}).
39
+ */
40
+ risk?: ToolRisk;
41
+ /**
42
+ * Whether its result carries outside content (mail, web pages), which the
43
+ * engine fences off. It covers the result only. For a tool an `http` or
44
+ * `stdio` connector lists, the host fences everything anyway (see
45
+ * {@link ConnectorClient.listTools}).
46
+ */
47
+ untrusted?: boolean;
48
+ }
49
+ /**
50
+ * Hints for one tool call. Each is optional, and an adapter may ignore any
51
+ * of them: no caller's correctness depends on an adapter using one (port
52
+ * list ADR, "Additive after the freeze: optional hints").
53
+ */
54
+ export interface ConnectorCallOptions {
55
+ /**
56
+ * The same for every attempt at one call, such as `<runId>:<callId>`
57
+ * when a person has a run try a call again. An adapter may pass it on,
58
+ * so a server that knows it can drop a duplicate, and may ignore it.
59
+ */
60
+ readonly idempotencyKey?: string;
61
+ }
62
+ /** A connection to one connector: an MCP server over HTTP or a local process, or a built-in one. */
63
+ export interface ConnectorClient {
64
+ /** The connector's id in the workspace. */
65
+ readonly id: string;
66
+ /**
67
+ * Whether the connector runs on this computer, as `connectorIsLocal` in
68
+ * `@halonicjs/format` says. In a local-only workspace the engine uses only
69
+ * the connectors that set it to `true`.
70
+ */
71
+ readonly local?: boolean;
72
+ /**
73
+ * The tools the connector offers now. Connects on the first call.
74
+ *
75
+ * For an `http` or `stdio` connector, a server the workspace chose wrote
76
+ * these tools. The host rebuilds their parameters from an allow-list,
77
+ * fences off their descriptions and results as untrusted text, treats
78
+ * their `risk` as `write`, or `send` when they say so, unless the
79
+ * workspace sets a lower one for a `write` tool, and
80
+ * refuses tools that are too large or whose names it can't check
81
+ * (requirement `ports.untrusted-tool-listings`).
82
+ * Don't fence them here, and don't mark them trusted.
83
+ *
84
+ * @throws when the connector can't be reached or started
85
+ */
86
+ listTools(): Promise<ConnectorTool[]>;
87
+ /**
88
+ * Calls a tool and returns its text result. Throws on transport errors and tool errors.
89
+ *
90
+ * `options` holds hints (`ports.connector-call-hints`): an adapter may
91
+ * use them and may ignore them, and the call must work either way.
92
+ */
93
+ callTool(name: string, args: Record<string, unknown>, options?: ConnectorCallOptions): Promise<string>;
94
+ /** Release the connection (stop a local process). Safe to call twice. */
95
+ close(): Promise<void>;
96
+ }
97
+ /**
98
+ * The exact package version a package-runner connector (`npx`, `uvx` and the
99
+ * others listed on the stdio transport) starts, and the registry it comes
100
+ * from. It is stored in the trust record when a person trusts the workspace,
101
+ * so it is per machine and never in a workspace file.
102
+ *
103
+ * It has no integrity hash, on purpose: the person already trusts the
104
+ * registry, and a Python package has a different file, so a different hash,
105
+ * per platform. See the port list ADR. For a workspace connector,
106
+ * `registryUrl` comes from the user's profile. For a plugin's local tool it
107
+ * comes from the plugin's manifest, or is the runner's public registry, and
108
+ * the person sees it in the trust prompt before trusting the plugin (plugins
109
+ * ADR, section 1.2).
110
+ *
111
+ * @example
112
+ * const pin: ConnectorPin = {
113
+ * registry: "npm",
114
+ * registryUrl: "https://registry.npmjs.org",
115
+ * package: "@acme/mail-mcp",
116
+ * version: "2.3.1",
117
+ * };
118
+ */
119
+ export interface ConnectorPin {
120
+ /** `npm` for the npm runners (`npx`, `pnpm dlx`, `bunx` and so on), `pypi` for the Python ones (`uvx`, `pipx run`, `uv tool run`). */
121
+ registry: "npm" | "pypi";
122
+ /**
123
+ * The registry's base address, such as "https://pypi.org", never its index
124
+ * (the launcher adds `/simple` itself). Never from a workspace: from the
125
+ * user's profile, or for a plugin from its trusted manifest.
126
+ */
127
+ registryUrl: string;
128
+ /** The package name, such as "@acme/mail-mcp". */
129
+ package: string;
130
+ /**
131
+ * An exact version, such as "2.3.1". The adapter refuses to start on a tag
132
+ * or a range (`latest`, `^2.3.1`, `>=2`) instead of resolving it.
133
+ */
134
+ version: string;
135
+ }
136
+ /** How to reach a connector. */
137
+ export type ConnectorTransport = {
138
+ kind: "http";
139
+ url: string;
140
+ headers: Record<string, string>;
141
+ } | {
142
+ kind: "stdio";
143
+ command: string;
144
+ args: string[];
145
+ env: Record<string, string>;
146
+ /**
147
+ * Variables the program takes from the app's own environment by name,
148
+ * on top of the base every program gets (`app.connector-base-env`).
149
+ * Never a secret's name: the format refuses one (`format.connector-inherit-env`).
150
+ */
151
+ inheritEnv?: string[];
152
+ cwd?: string;
153
+ /**
154
+ * The only sites the program may reach when it starts in a sandbox,
155
+ * lowercase and in Punycode (`format.connector-sites`). Absent means
156
+ * none. A program that starts without a sandbox isn't held to them.
157
+ */
158
+ sites?: string[];
159
+ /**
160
+ * The version to start, for package-runner connectors. The app fills it
161
+ * from the trust record, **never from workspace YAML**, so a workspace
162
+ * edit can't choose the version or the registry.
163
+ *
164
+ * A package runner is a `command` whose program name, without its
165
+ * folder, any case and any `.cmd`, `.exe`, `.bat` or `.ps1` ending, is
166
+ * `npx`, `bunx` or `uvx`, or one of `npm exec`, `pnpm dlx`,
167
+ * `yarn dlx`, `pipx run` and `uv tool run`. Without a `pin`, a package
168
+ * runner starts only with a trust grant, like every stdio program, and
169
+ * its `command` and `args` are in the fingerprint the person confirmed.
170
+ * The version it runs is not fixed: the runner may start whatever
171
+ * version is newest. Pinning at trust comes later.
172
+ *
173
+ * When it is set, the adapter starts exactly `package` at `version`,
174
+ * looks it up only at `registryUrl`, starts in an empty folder of its
175
+ * own instead of `cwd`, ignores the workspace's package-manager
176
+ * settings (`.npmrc`, `node_modules`, `uv.toml`, `pyproject.toml`), and
177
+ * refuses to start when the command names any other version.
178
+ *
179
+ * It also refuses to start when `env` sets a variable, in any case,
180
+ * that can move the registry or run code before the package:
181
+ * `NODE_OPTIONS`, `NODE_PATH`, `PYTHONPATH`, `PYTHONSTARTUP`,
182
+ * `PYTHONHOME`, or any name starting with `npm_config_`, `YARN_`,
183
+ * `PNPM_`, `BUN_`, `COREPACK_`, `UV_`, `PIP_` or `PIPX_`; a proxy,
184
+ * `HTTPS_PROXY`, `HTTP_PROXY` or `ALL_PROXY`; a certificate setting,
185
+ * `NODE_EXTRA_CA_CERTS`, `NODE_TLS_REJECT_UNAUTHORIZED`,
186
+ * `SSL_CERT_FILE`, `SSL_CERT_DIR`, `REQUESTS_CA_BUNDLE` or
187
+ * `CURL_CA_BUNDLE`; or a preload, `LD_PRELOAD`, `LD_LIBRARY_PATH`,
188
+ * `DYLD_INSERT_LIBRARIES` or `DYLD_LIBRARY_PATH`. It drops the
189
+ * package-manager and language variables it inherits from its own
190
+ * process and sets the registry from `registryUrl` itself. Of what it
191
+ * inherits it keeps only the base (`app.connector-base-env`), which
192
+ * holds a proxy, certificate or library folder: those are the person's
193
+ * own machine settings, such as a company proxy, not the workspace's.
194
+ *
195
+ * And it refuses to start when an argument is a runner option that
196
+ * fetches from somewhere else: `--registry`, an npm scope's
197
+ * `--@<scope>:registry`, `--userconfig`, `--globalconfig`, `--cache`,
198
+ * `--index-url` (`-i`), `--extra-index-url`, `--index`,
199
+ * `--default-index`, `--find-links` (`-f`), `--config-file`,
200
+ * `--cache-dir` or `--pip-args`.
201
+ *
202
+ * Every stdio launcher checks these rules with `@halonicjs/app`'s
203
+ * `checkPackageRunnerLaunch`, so they live in one place.
204
+ */
205
+ pin?: ConnectorPin;
206
+ }
207
+ /** Built-in Gmail and Drive for one account; `client` names no secret. */
208
+ | {
209
+ kind: "google";
210
+ account: string;
211
+ client: string;
212
+ }
213
+ /** A local integration in the I5 runner: a folder under `integrations/`. */
214
+ | {
215
+ kind: "integration";
216
+ folder: string;
217
+ }
218
+ /** A plugin's backend in the I5 runner. */
219
+ | {
220
+ kind: "plugin";
221
+ id: string;
222
+ };
223
+ /** A connector as the workspace configures it. */
224
+ export interface ConnectorConfig {
225
+ id: string;
226
+ transport: ConnectorTransport;
227
+ /** HTTP bearer token secret name. */
228
+ secret?: string;
229
+ /** stdio: environment variable -> secret name. */
230
+ secretEnv: Record<string, string>;
231
+ }
232
+ /**
233
+ * Proof that a person trusted the workspace a connector comes from.
234
+ * `TrustService` in `core/app` checks the trust record against the
235
+ * workspace's current fingerprint and hands out a grant only when they
236
+ * match; adapters don't compute or compare fingerprints themselves.
237
+ */
238
+ export interface TrustGrant {
239
+ /** The trusted workspace's location: its resolved real path. */
240
+ location: string;
241
+ /** The fingerprint the person trusted, such as "hfp1:9f86d0…". */
242
+ fingerprint: string;
243
+ }
244
+ /** What a factory may use to build a connector client. */
245
+ export interface ConnectorFactoryContext {
246
+ secrets: Secrets;
247
+ /** Where sign-ins keep their tokens, such as Google refresh tokens. */
248
+ tokens: TokenStore;
249
+ http: HttpClient;
250
+ /** The workspace folder, for stdio connectors that run in it. Absent where programs can't start. */
251
+ workspaceRoot?: string;
252
+ /**
253
+ * The absolute working folder of every harness agent in the workspace,
254
+ * resolved to real paths by the caller. A harness agent writes there from
255
+ * inside its sandbox, so a `stdio` connector refuses, right before its
256
+ * program starts, a start that would run or load a file from one of them
257
+ * (requirement `format.working-folder-start`).
258
+ *
259
+ * Absent, or empty, when the workspace has no harness agent with a
260
+ * working folder: there is nothing to protect.
261
+ */
262
+ workingFolders?: readonly string[];
263
+ /**
264
+ * The trust grant for the connector's workspace, or `null` when it isn't
265
+ * trusted. Required, so a caller can't forget it.
266
+ *
267
+ * Without a grant:
268
+ * - a `stdio` connector never starts its program (`listTools` and
269
+ * `callTool` throw);
270
+ * - an `http` connector's `callTool` always throws, because the only
271
+ * `risk` it sees is the one the server wrote;
272
+ * - the built-in `google` connector's `callTool` throws for every tool
273
+ * whose own `risk` isn't `read`;
274
+ * - the host ignores any `risk` the workspace sets, so every tool an
275
+ * `http` or `stdio` connector lists counts as `write`, and it refuses
276
+ * to call a tool whose risk isn't `read`.
277
+ *
278
+ * Both checks hold on their own, so a mistake in one doesn't open the gate
279
+ * (requirement `ports.connector-trust-enforcement`).
280
+ */
281
+ trust: TrustGrant | null;
282
+ /**
283
+ * The sandbox session a `stdio` connector starts its program in, for a
284
+ * plugin's local tool (plugins ADR, sections 3 and 4). Halonic opens it
285
+ * with a profile it builds itself, never the plugin.
286
+ *
287
+ * When it is set, the program starts in this session and nowhere else:
288
+ * - only a factory that starts programs through a session takes it; a
289
+ * factory that starts programs on this computer refuses the context, so
290
+ * a wiring mistake can't run a plugin's program outside the fence;
291
+ * - a session whose fence proof isn't `fenced` starts nothing, and there
292
+ * is no fallback to this computer. A person's yes to run without the
293
+ * sandbox doesn't cover programs.
294
+ *
295
+ * Absent for a workspace's own connectors, which start as before.
296
+ */
297
+ sandbox?: SandboxSession;
298
+ }
299
+ /** Creates connector clients for one transport kind. */
300
+ export interface ConnectorFactory {
301
+ readonly transport: ConnectorTransport["kind"];
302
+ create(config: ConnectorConfig, context: ConnectorFactoryContext): ConnectorClient;
303
+ }
@@ -0,0 +1,19 @@
1
+ /** Version of the {@link ConnectorClient} and {@link ConnectorFactory} ports. A breaking change bumps it and comes with an ADR. */
2
+ export const connectorClientVersion = 1;
3
+ const toolNamePattern = /^[A-Za-z0-9_-]{1,64}$/;
4
+ /**
5
+ * Whether a text passes the name rule of `ports.untrusted-tool-listings`:
6
+ * 1 to 64 ASCII letters, digits, `_` or `-`. The model sends tool names
7
+ * back in calls, so they can't be fenced, and the rule keeps them too short
8
+ * and plain to carry much. A connector file's `tools.read` names pass the
9
+ * same rule, so a look-alike letter or an invisible character can't hide
10
+ * in one; widen both together or neither.
11
+ *
12
+ * @example
13
+ * passesNameRule("search_issues"); // true
14
+ * passesNameRule("search_\u0456ssues"); // false: a Cyrillic "і" in "issues"
15
+ * passesNameRule("notes.lookup"); // false
16
+ */
17
+ export function passesNameRule(text) {
18
+ return typeof text === "string" && toolNamePattern.test(text);
19
+ }
@@ -0,0 +1,84 @@
1
+ /** Version of the {@link Coordination} port. A breaking change bumps it and comes with an ADR. */
2
+ export declare const coordinationVersion = 1;
3
+ /** The right to do something alone until `expiresAt`. A lease is never held across a crash for good. */
4
+ export interface Lease {
5
+ /** The key the lease was taken on. */
6
+ key: string;
7
+ /** Proves who holds the lease; renewing or releasing with an old token does nothing. Renewing keeps it. */
8
+ token: string;
9
+ /**
10
+ * ISO time the lease ends unless it is renewed, by the adapter's clock.
11
+ * For display and logs only: callers don't compare it with their own clock
12
+ * to decide whether they still hold the lease; they renew and check the result.
13
+ */
14
+ expiresAt: string;
15
+ }
16
+ /** What {@link Coordination.increment} did, and the counter's value afterwards. */
17
+ export interface CounterResult {
18
+ /** Whether `by` was added; `false` when it would have gone above the limit. */
19
+ applied: boolean;
20
+ /** The counter's value after the call, whether or not `by` was added. */
21
+ value: number;
22
+ }
23
+ /** What {@link Coordination.countInWindow} decided. */
24
+ export interface WindowCount {
25
+ /** Whether this attempt was within the limit; only allowed attempts are counted. */
26
+ allowed: boolean;
27
+ /** Attempts counted in the current window, this one included when allowed; `limit` when refused. */
28
+ count: number;
29
+ /** ISO time the current window ends and counting starts again. A refused attempt doesn't move it. */
30
+ resetAt: string;
31
+ }
32
+ /**
33
+ * Leases, values and counters shared by every instance of a deployment: a
34
+ * routine fires once, a run advances in one place, login limits and the
35
+ * budget hold. Nothing can hold a lock across an
36
+ * `await`, so locks are leases with a time limit.
37
+ *
38
+ * Leases, values, counters and windows each have their own keys: the same key
39
+ * in two of them names two different things. Every operation is atomic.
40
+ *
41
+ * **Input rules**, the same on every adapter:
42
+ * - Keys are 1 to 256 UTF-8 bytes. Core hashes user input (an email
43
+ * address, a file name) before putting it in a key.
44
+ * - A value set with `compareAndSet` is at most 64 KiB of UTF-8, below
45
+ * the per-value limit of Durable Objects storage.
46
+ * - `ttlMs`, `windowMs`, `limit` and `by` are positive safe whole numbers.
47
+ * Amounts that have fractions, such as the budget, are counted in whole
48
+ * micro-units (1 = 0.000001), so every store adds them up the same way.
49
+ * - Breaking a rule throws a `RangeError` and changes nothing.
50
+ */
51
+ export interface Coordination {
52
+ /**
53
+ * Takes the lease for `ttlMs` milliseconds, or returns `null` while anyone
54
+ * holds it, the caller included.
55
+ */
56
+ tryAcquire(key: string, ttlMs: number): Promise<Lease | null>;
57
+ /**
58
+ * Extends a lease still held to `ttlMs` milliseconds from now, keeping its
59
+ * token, or returns `null` when it ran out or was taken over.
60
+ */
61
+ renew(lease: Lease, ttlMs: number): Promise<Lease | null>;
62
+ /** Gives a lease back. Releasing one that ran out or was taken over does nothing. */
63
+ release(lease: Lease): Promise<void>;
64
+ /** A value, or `null` when it isn't set. */
65
+ read(key: string): Promise<string | null>;
66
+ /**
67
+ * Sets the value only if it is still `expected` (`null`: not set). A `next`
68
+ * of `null` deletes it. Returns whether it changed.
69
+ */
70
+ compareAndSet(key: string, expected: string | null, next: string | null): Promise<boolean>;
71
+ /**
72
+ * Adds `by` to a counter that starts at 0, unless the result would go above
73
+ * `limit`; then it leaves the counter as it is. Counters only go up.
74
+ */
75
+ increment(key: string, by: number, limit?: number): Promise<CounterResult>;
76
+ /**
77
+ * Counts one attempt in a fixed window of `windowMs` milliseconds that
78
+ * starts with its first attempt, if fewer than `limit` were counted in it.
79
+ * The window covers `start` up to but not including `start + windowMs`; an
80
+ * attempt at that moment opens a new window. Parallel attempts never let
81
+ * more than `limit` through.
82
+ */
83
+ countInWindow(key: string, windowMs: number, limit: number): Promise<WindowCount>;
84
+ }
@@ -0,0 +1,2 @@
1
+ /** Version of the {@link Coordination} port. A breaking change bumps it and comes with an ADR. */
2
+ export const coordinationVersion = 1;