@sentropic/h2a-cli 0.75.0 → 0.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (350) hide show
  1. package/dist/index.d.ts +1 -37
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +2 -41
  4. package/dist/index.js.map +1 -1
  5. package/package.json +4 -15
  6. package/dist/bin.d.ts +0 -3
  7. package/dist/bin.d.ts.map +0 -1
  8. package/dist/bin.js +0 -83
  9. package/dist/bin.js.map +0 -1
  10. package/dist/cli-contract.d.ts +0 -62
  11. package/dist/cli-contract.d.ts.map +0 -1
  12. package/dist/cli-contract.js +0 -794
  13. package/dist/cli-contract.js.map +0 -1
  14. package/dist/cli.d.ts +0 -254
  15. package/dist/cli.d.ts.map +0 -1
  16. package/dist/cli.js +0 -4672
  17. package/dist/cli.js.map +0 -1
  18. package/dist/hosts/agy.d.ts +0 -14
  19. package/dist/hosts/agy.d.ts.map +0 -1
  20. package/dist/hosts/agy.js +0 -47
  21. package/dist/hosts/agy.js.map +0 -1
  22. package/dist/hosts/claude.d.ts +0 -12
  23. package/dist/hosts/claude.d.ts.map +0 -1
  24. package/dist/hosts/claude.js +0 -46
  25. package/dist/hosts/claude.js.map +0 -1
  26. package/dist/hosts/codex.d.ts +0 -65
  27. package/dist/hosts/codex.d.ts.map +0 -1
  28. package/dist/hosts/codex.js +0 -45
  29. package/dist/hosts/codex.js.map +0 -1
  30. package/dist/hosts/gemini.d.ts +0 -12
  31. package/dist/hosts/gemini.d.ts.map +0 -1
  32. package/dist/hosts/gemini.js +0 -46
  33. package/dist/hosts/gemini.js.map +0 -1
  34. package/dist/hosts/plugin.d.ts +0 -151
  35. package/dist/hosts/plugin.d.ts.map +0 -1
  36. package/dist/hosts/plugin.js +0 -188
  37. package/dist/hosts/plugin.js.map +0 -1
  38. package/dist/mcp.d.ts +0 -2
  39. package/dist/mcp.d.ts.map +0 -1
  40. package/dist/mcp.js +0 -32
  41. package/dist/mcp.js.map +0 -1
  42. package/dist/runtime/blockage/index.d.ts +0 -3
  43. package/dist/runtime/blockage/index.d.ts.map +0 -1
  44. package/dist/runtime/blockage/index.js +0 -3
  45. package/dist/runtime/blockage/index.js.map +0 -1
  46. package/dist/runtime/blockage/notifiers.d.ts +0 -52
  47. package/dist/runtime/blockage/notifiers.d.ts.map +0 -1
  48. package/dist/runtime/blockage/notifiers.js +0 -74
  49. package/dist/runtime/blockage/notifiers.js.map +0 -1
  50. package/dist/runtime/blockage/registry.d.ts +0 -30
  51. package/dist/runtime/blockage/registry.d.ts.map +0 -1
  52. package/dist/runtime/blockage/registry.js +0 -86
  53. package/dist/runtime/blockage/registry.js.map +0 -1
  54. package/dist/runtime/deploy/k8s-sidecar.d.ts +0 -92
  55. package/dist/runtime/deploy/k8s-sidecar.d.ts.map +0 -1
  56. package/dist/runtime/deploy/k8s-sidecar.js +0 -166
  57. package/dist/runtime/deploy/k8s-sidecar.js.map +0 -1
  58. package/dist/runtime/deploy/k8s-tenant.d.ts +0 -86
  59. package/dist/runtime/deploy/k8s-tenant.d.ts.map +0 -1
  60. package/dist/runtime/deploy/k8s-tenant.js +0 -255
  61. package/dist/runtime/deploy/k8s-tenant.js.map +0 -1
  62. package/dist/runtime/drive/inbox-wake.d.ts +0 -36
  63. package/dist/runtime/drive/inbox-wake.d.ts.map +0 -1
  64. package/dist/runtime/drive/inbox-wake.js +0 -50
  65. package/dist/runtime/drive/inbox-wake.js.map +0 -1
  66. package/dist/runtime/drive/index.d.ts +0 -173
  67. package/dist/runtime/drive/index.d.ts.map +0 -1
  68. package/dist/runtime/drive/index.js +0 -503
  69. package/dist/runtime/drive/index.js.map +0 -1
  70. package/dist/runtime/drumbeat/deciders.d.ts +0 -32
  71. package/dist/runtime/drumbeat/deciders.d.ts.map +0 -1
  72. package/dist/runtime/drumbeat/deciders.js +0 -65
  73. package/dist/runtime/drumbeat/deciders.js.map +0 -1
  74. package/dist/runtime/drumbeat/decisions.d.ts +0 -19
  75. package/dist/runtime/drumbeat/decisions.d.ts.map +0 -1
  76. package/dist/runtime/drumbeat/decisions.js +0 -34
  77. package/dist/runtime/drumbeat/decisions.js.map +0 -1
  78. package/dist/runtime/drumbeat/inbox-relance.d.ts +0 -29
  79. package/dist/runtime/drumbeat/inbox-relance.d.ts.map +0 -1
  80. package/dist/runtime/drumbeat/inbox-relance.js +0 -101
  81. package/dist/runtime/drumbeat/inbox-relance.js.map +0 -1
  82. package/dist/runtime/drumbeat/index.d.ts +0 -8
  83. package/dist/runtime/drumbeat/index.d.ts.map +0 -1
  84. package/dist/runtime/drumbeat/index.js +0 -8
  85. package/dist/runtime/drumbeat/index.js.map +0 -1
  86. package/dist/runtime/drumbeat/registry.d.ts +0 -60
  87. package/dist/runtime/drumbeat/registry.d.ts.map +0 -1
  88. package/dist/runtime/drumbeat/registry.js +0 -115
  89. package/dist/runtime/drumbeat/registry.js.map +0 -1
  90. package/dist/runtime/drumbeat/relaunchers.d.ts +0 -111
  91. package/dist/runtime/drumbeat/relaunchers.d.ts.map +0 -1
  92. package/dist/runtime/drumbeat/relaunchers.js +0 -260
  93. package/dist/runtime/drumbeat/relaunchers.js.map +0 -1
  94. package/dist/runtime/drumbeat/scan.d.ts +0 -36
  95. package/dist/runtime/drumbeat/scan.d.ts.map +0 -1
  96. package/dist/runtime/drumbeat/scan.js +0 -41
  97. package/dist/runtime/drumbeat/scan.js.map +0 -1
  98. package/dist/runtime/drumbeat/watch.d.ts +0 -74
  99. package/dist/runtime/drumbeat/watch.d.ts.map +0 -1
  100. package/dist/runtime/drumbeat/watch.js +0 -216
  101. package/dist/runtime/drumbeat/watch.js.map +0 -1
  102. package/dist/runtime/escalation/index.d.ts +0 -2
  103. package/dist/runtime/escalation/index.d.ts.map +0 -1
  104. package/dist/runtime/escalation/index.js +0 -2
  105. package/dist/runtime/escalation/index.js.map +0 -1
  106. package/dist/runtime/escalation/registry.d.ts +0 -44
  107. package/dist/runtime/escalation/registry.d.ts.map +0 -1
  108. package/dist/runtime/escalation/registry.js +0 -79
  109. package/dist/runtime/escalation/registry.js.map +0 -1
  110. package/dist/runtime/governance/claims.d.ts +0 -43
  111. package/dist/runtime/governance/claims.d.ts.map +0 -1
  112. package/dist/runtime/governance/claims.js +0 -93
  113. package/dist/runtime/governance/claims.js.map +0 -1
  114. package/dist/runtime/governance/conductor.d.ts +0 -79
  115. package/dist/runtime/governance/conductor.d.ts.map +0 -1
  116. package/dist/runtime/governance/conductor.js +0 -106
  117. package/dist/runtime/governance/conductor.js.map +0 -1
  118. package/dist/runtime/governance/index.d.ts +0 -5
  119. package/dist/runtime/governance/index.d.ts.map +0 -1
  120. package/dist/runtime/governance/index.js +0 -5
  121. package/dist/runtime/governance/index.js.map +0 -1
  122. package/dist/runtime/governance/launch-check.d.ts +0 -93
  123. package/dist/runtime/governance/launch-check.d.ts.map +0 -1
  124. package/dist/runtime/governance/launch-check.js +0 -113
  125. package/dist/runtime/governance/launch-check.js.map +0 -1
  126. package/dist/runtime/governance/spawns.d.ts +0 -50
  127. package/dist/runtime/governance/spawns.d.ts.map +0 -1
  128. package/dist/runtime/governance/spawns.js +0 -91
  129. package/dist/runtime/governance/spawns.js.map +0 -1
  130. package/dist/runtime/identity/bindings.d.ts +0 -84
  131. package/dist/runtime/identity/bindings.d.ts.map +0 -1
  132. package/dist/runtime/identity/bindings.js +0 -112
  133. package/dist/runtime/identity/bindings.js.map +0 -1
  134. package/dist/runtime/identity/index.d.ts +0 -11
  135. package/dist/runtime/identity/index.d.ts.map +0 -1
  136. package/dist/runtime/identity/index.js +0 -6
  137. package/dist/runtime/identity/index.js.map +0 -1
  138. package/dist/runtime/identity/live.d.ts +0 -26
  139. package/dist/runtime/identity/live.d.ts.map +0 -1
  140. package/dist/runtime/identity/live.js +0 -232
  141. package/dist/runtime/identity/live.js.map +0 -1
  142. package/dist/runtime/identity/migration.d.ts +0 -55
  143. package/dist/runtime/identity/migration.d.ts.map +0 -1
  144. package/dist/runtime/identity/migration.js +0 -100
  145. package/dist/runtime/identity/migration.js.map +0 -1
  146. package/dist/runtime/identity/readers.d.ts +0 -42
  147. package/dist/runtime/identity/readers.d.ts.map +0 -1
  148. package/dist/runtime/identity/readers.js +0 -248
  149. package/dist/runtime/identity/readers.js.map +0 -1
  150. package/dist/runtime/identity/resolver.d.ts +0 -50
  151. package/dist/runtime/identity/resolver.d.ts.map +0 -1
  152. package/dist/runtime/identity/resolver.js +0 -61
  153. package/dist/runtime/identity/resolver.js.map +0 -1
  154. package/dist/runtime/identity/workspace-id.d.ts +0 -43
  155. package/dist/runtime/identity/workspace-id.d.ts.map +0 -1
  156. package/dist/runtime/identity/workspace-id.js +0 -138
  157. package/dist/runtime/identity/workspace-id.js.map +0 -1
  158. package/dist/runtime/local-files/index.d.ts +0 -8
  159. package/dist/runtime/local-files/index.d.ts.map +0 -1
  160. package/dist/runtime/local-files/index.js +0 -8
  161. package/dist/runtime/local-files/index.js.map +0 -1
  162. package/dist/runtime/local-files/lease.d.ts +0 -62
  163. package/dist/runtime/local-files/lease.d.ts.map +0 -1
  164. package/dist/runtime/local-files/lease.js +0 -249
  165. package/dist/runtime/local-files/lease.js.map +0 -1
  166. package/dist/runtime/local-files/locks.d.ts +0 -43
  167. package/dist/runtime/local-files/locks.d.ts.map +0 -1
  168. package/dist/runtime/local-files/locks.js +0 -197
  169. package/dist/runtime/local-files/locks.js.map +0 -1
  170. package/dist/runtime/local-files/migrate.d.ts +0 -31
  171. package/dist/runtime/local-files/migrate.d.ts.map +0 -1
  172. package/dist/runtime/local-files/migrate.js +0 -104
  173. package/dist/runtime/local-files/migrate.js.map +0 -1
  174. package/dist/runtime/local-files/paths.d.ts +0 -146
  175. package/dist/runtime/local-files/paths.d.ts.map +0 -1
  176. package/dist/runtime/local-files/paths.js +0 -233
  177. package/dist/runtime/local-files/paths.js.map +0 -1
  178. package/dist/runtime/local-files/presence.d.ts +0 -80
  179. package/dist/runtime/local-files/presence.d.ts.map +0 -1
  180. package/dist/runtime/local-files/presence.js +0 -250
  181. package/dist/runtime/local-files/presence.js.map +0 -1
  182. package/dist/runtime/local-files/schema.d.ts +0 -47
  183. package/dist/runtime/local-files/schema.d.ts.map +0 -1
  184. package/dist/runtime/local-files/schema.js +0 -77
  185. package/dist/runtime/local-files/schema.js.map +0 -1
  186. package/dist/runtime/local-files/store.d.ts +0 -132
  187. package/dist/runtime/local-files/store.d.ts.map +0 -1
  188. package/dist/runtime/local-files/store.js +0 -997
  189. package/dist/runtime/local-files/store.js.map +0 -1
  190. package/dist/runtime/loop/index.d.ts +0 -73
  191. package/dist/runtime/loop/index.d.ts.map +0 -1
  192. package/dist/runtime/loop/index.js +0 -107
  193. package/dist/runtime/loop/index.js.map +0 -1
  194. package/dist/runtime/mcp/handlers.d.ts +0 -196
  195. package/dist/runtime/mcp/handlers.d.ts.map +0 -1
  196. package/dist/runtime/mcp/handlers.js +0 -1025
  197. package/dist/runtime/mcp/handlers.js.map +0 -1
  198. package/dist/runtime/mcp/index.d.ts +0 -7
  199. package/dist/runtime/mcp/index.d.ts.map +0 -1
  200. package/dist/runtime/mcp/index.js +0 -7
  201. package/dist/runtime/mcp/index.js.map +0 -1
  202. package/dist/runtime/mcp/notifications.d.ts +0 -47
  203. package/dist/runtime/mcp/notifications.d.ts.map +0 -1
  204. package/dist/runtime/mcp/notifications.js +0 -204
  205. package/dist/runtime/mcp/notifications.js.map +0 -1
  206. package/dist/runtime/mcp/server.d.ts +0 -45
  207. package/dist/runtime/mcp/server.d.ts.map +0 -1
  208. package/dist/runtime/mcp/server.js +0 -94
  209. package/dist/runtime/mcp/server.js.map +0 -1
  210. package/dist/runtime/mcp/sessions.d.ts +0 -68
  211. package/dist/runtime/mcp/sessions.d.ts.map +0 -1
  212. package/dist/runtime/mcp/sessions.js +0 -152
  213. package/dist/runtime/mcp/sessions.js.map +0 -1
  214. package/dist/runtime/mcp/stdio.d.ts +0 -72
  215. package/dist/runtime/mcp/stdio.d.ts.map +0 -1
  216. package/dist/runtime/mcp/stdio.js +0 -274
  217. package/dist/runtime/mcp/stdio.js.map +0 -1
  218. package/dist/runtime/mcp/tools.d.ts +0 -19
  219. package/dist/runtime/mcp/tools.d.ts.map +0 -1
  220. package/dist/runtime/mcp/tools.js +0 -525
  221. package/dist/runtime/mcp/tools.js.map +0 -1
  222. package/dist/runtime/mcp-http/app.d.ts +0 -33
  223. package/dist/runtime/mcp-http/app.d.ts.map +0 -1
  224. package/dist/runtime/mcp-http/app.js +0 -162
  225. package/dist/runtime/mcp-http/app.js.map +0 -1
  226. package/dist/runtime/mcp-http/hosted-mcp-server.d.ts +0 -14
  227. package/dist/runtime/mcp-http/hosted-mcp-server.d.ts.map +0 -1
  228. package/dist/runtime/mcp-http/hosted-mcp-server.js +0 -38
  229. package/dist/runtime/mcp-http/hosted-mcp-server.js.map +0 -1
  230. package/dist/runtime/mcp-http/index.d.ts +0 -18
  231. package/dist/runtime/mcp-http/index.d.ts.map +0 -1
  232. package/dist/runtime/mcp-http/index.js +0 -18
  233. package/dist/runtime/mcp-http/index.js.map +0 -1
  234. package/dist/runtime/mcp-http/main.d.ts +0 -2
  235. package/dist/runtime/mcp-http/main.d.ts.map +0 -1
  236. package/dist/runtime/mcp-http/main.js +0 -14
  237. package/dist/runtime/mcp-http/main.js.map +0 -1
  238. package/dist/runtime/mcp-http/oauth/broker-login.d.ts +0 -50
  239. package/dist/runtime/mcp-http/oauth/broker-login.d.ts.map +0 -1
  240. package/dist/runtime/mcp-http/oauth/broker-login.js +0 -41
  241. package/dist/runtime/mcp-http/oauth/broker-login.js.map +0 -1
  242. package/dist/runtime/mcp-http/oauth/broker-routes.d.ts +0 -45
  243. package/dist/runtime/mcp-http/oauth/broker-routes.d.ts.map +0 -1
  244. package/dist/runtime/mcp-http/oauth/broker-routes.js +0 -54
  245. package/dist/runtime/mcp-http/oauth/broker-routes.js.map +0 -1
  246. package/dist/runtime/mcp-http/oauth/config.d.ts +0 -49
  247. package/dist/runtime/mcp-http/oauth/config.d.ts.map +0 -1
  248. package/dist/runtime/mcp-http/oauth/config.js +0 -69
  249. package/dist/runtime/mcp-http/oauth/config.js.map +0 -1
  250. package/dist/runtime/mcp-http/oauth/crypto.d.ts +0 -14
  251. package/dist/runtime/mcp-http/oauth/crypto.d.ts.map +0 -1
  252. package/dist/runtime/mcp-http/oauth/crypto.js +0 -29
  253. package/dist/runtime/mcp-http/oauth/crypto.js.map +0 -1
  254. package/dist/runtime/mcp-http/oauth/file-store.d.ts +0 -48
  255. package/dist/runtime/mcp-http/oauth/file-store.d.ts.map +0 -1
  256. package/dist/runtime/mcp-http/oauth/file-store.js +0 -101
  257. package/dist/runtime/mcp-http/oauth/file-store.js.map +0 -1
  258. package/dist/runtime/mcp-http/oauth/hono-oauth-router.d.ts +0 -5
  259. package/dist/runtime/mcp-http/oauth/hono-oauth-router.d.ts.map +0 -1
  260. package/dist/runtime/mcp-http/oauth/hono-oauth-router.js +0 -92
  261. package/dist/runtime/mcp-http/oauth/hono-oauth-router.js.map +0 -1
  262. package/dist/runtime/mcp-http/oauth/oidc-rp.d.ts +0 -56
  263. package/dist/runtime/mcp-http/oauth/oidc-rp.d.ts.map +0 -1
  264. package/dist/runtime/mcp-http/oauth/oidc-rp.js +0 -63
  265. package/dist/runtime/mcp-http/oauth/oidc-rp.js.map +0 -1
  266. package/dist/runtime/mcp-http/oauth/redirect-uri.d.ts +0 -11
  267. package/dist/runtime/mcp-http/oauth/redirect-uri.d.ts.map +0 -1
  268. package/dist/runtime/mcp-http/oauth/redirect-uri.js +0 -29
  269. package/dist/runtime/mcp-http/oauth/redirect-uri.js.map +0 -1
  270. package/dist/runtime/mcp-http/oauth/single-tenant-provider.d.ts +0 -70
  271. package/dist/runtime/mcp-http/oauth/single-tenant-provider.d.ts.map +0 -1
  272. package/dist/runtime/mcp-http/oauth/single-tenant-provider.js +0 -247
  273. package/dist/runtime/mcp-http/oauth/single-tenant-provider.js.map +0 -1
  274. package/dist/runtime/mcp-http/oauth/tenancy.d.ts +0 -3
  275. package/dist/runtime/mcp-http/oauth/tenancy.d.ts.map +0 -1
  276. package/dist/runtime/mcp-http/oauth/tenancy.js +0 -18
  277. package/dist/runtime/mcp-http/oauth/tenancy.js.map +0 -1
  278. package/dist/runtime/mcp-http/readonly-allowlist.d.ts +0 -24
  279. package/dist/runtime/mcp-http/readonly-allowlist.d.ts.map +0 -1
  280. package/dist/runtime/mcp-http/readonly-allowlist.js +0 -43
  281. package/dist/runtime/mcp-http/readonly-allowlist.js.map +0 -1
  282. package/dist/runtime/mcp-http/serve.d.ts +0 -39
  283. package/dist/runtime/mcp-http/serve.d.ts.map +0 -1
  284. package/dist/runtime/mcp-http/serve.js +0 -100
  285. package/dist/runtime/mcp-http/serve.js.map +0 -1
  286. package/dist/runtime/mirror/accept.d.ts +0 -57
  287. package/dist/runtime/mirror/accept.d.ts.map +0 -1
  288. package/dist/runtime/mirror/accept.js +0 -70
  289. package/dist/runtime/mirror/accept.js.map +0 -1
  290. package/dist/runtime/mirror/build.d.ts +0 -44
  291. package/dist/runtime/mirror/build.d.ts.map +0 -1
  292. package/dist/runtime/mirror/build.js +0 -37
  293. package/dist/runtime/mirror/build.js.map +0 -1
  294. package/dist/runtime/mirror/index.d.ts +0 -9
  295. package/dist/runtime/mirror/index.d.ts.map +0 -1
  296. package/dist/runtime/mirror/index.js +0 -9
  297. package/dist/runtime/mirror/index.js.map +0 -1
  298. package/dist/runtime/mirror/serve.d.ts +0 -21
  299. package/dist/runtime/mirror/serve.d.ts.map +0 -1
  300. package/dist/runtime/mirror/serve.js +0 -141
  301. package/dist/runtime/mirror/serve.js.map +0 -1
  302. package/dist/runtime/nhi.d.ts +0 -15
  303. package/dist/runtime/nhi.d.ts.map +0 -1
  304. package/dist/runtime/nhi.js +0 -26
  305. package/dist/runtime/nhi.js.map +0 -1
  306. package/dist/runtime/remote/accept.d.ts +0 -50
  307. package/dist/runtime/remote/accept.d.ts.map +0 -1
  308. package/dist/runtime/remote/accept.js +0 -54
  309. package/dist/runtime/remote/accept.js.map +0 -1
  310. package/dist/runtime/remote/client.d.ts +0 -27
  311. package/dist/runtime/remote/client.d.ts.map +0 -1
  312. package/dist/runtime/remote/client.js +0 -34
  313. package/dist/runtime/remote/client.js.map +0 -1
  314. package/dist/runtime/remote/index.d.ts +0 -5
  315. package/dist/runtime/remote/index.d.ts.map +0 -1
  316. package/dist/runtime/remote/index.js +0 -5
  317. package/dist/runtime/remote/index.js.map +0 -1
  318. package/dist/runtime/remote/serve.d.ts +0 -27
  319. package/dist/runtime/remote/serve.d.ts.map +0 -1
  320. package/dist/runtime/remote/serve.js +0 -26
  321. package/dist/runtime/remote/serve.js.map +0 -1
  322. package/dist/runtime/remote/server.d.ts +0 -36
  323. package/dist/runtime/remote/server.d.ts.map +0 -1
  324. package/dist/runtime/remote/server.js +0 -100
  325. package/dist/runtime/remote/server.js.map +0 -1
  326. package/dist/runtime/sysml/client.d.ts +0 -44
  327. package/dist/runtime/sysml/client.d.ts.map +0 -1
  328. package/dist/runtime/sysml/client.js +0 -52
  329. package/dist/runtime/sysml/client.js.map +0 -1
  330. package/dist/runtime/sysml/disclosure.d.ts +0 -23
  331. package/dist/runtime/sysml/disclosure.d.ts.map +0 -1
  332. package/dist/runtime/sysml/disclosure.js +0 -53
  333. package/dist/runtime/sysml/disclosure.js.map +0 -1
  334. package/dist/runtime/sysml/index.d.ts +0 -4
  335. package/dist/runtime/sysml/index.d.ts.map +0 -1
  336. package/dist/runtime/sysml/index.js +0 -4
  337. package/dist/runtime/sysml/index.js.map +0 -1
  338. package/dist/runtime/sysml/verify.d.ts +0 -32
  339. package/dist/runtime/sysml/verify.d.ts.map +0 -1
  340. package/dist/runtime/sysml/verify.js +0 -67
  341. package/dist/runtime/sysml/verify.js.map +0 -1
  342. package/dist/runtime/upgrade/index.d.ts +0 -96
  343. package/dist/runtime/upgrade/index.d.ts.map +0 -1
  344. package/dist/runtime/upgrade/index.js +0 -185
  345. package/dist/runtime/upgrade/index.js.map +0 -1
  346. package/dist/runtime/version/agent-version.d.ts +0 -15
  347. package/dist/runtime/version/agent-version.d.ts.map +0 -1
  348. package/dist/runtime/version/agent-version.js +0 -53
  349. package/dist/runtime/version/agent-version.js.map +0 -1
  350. package/skills/h2a/SKILL.md +0 -345
@@ -1,104 +0,0 @@
1
- import { existsSync, readdirSync, renameSync, statSync } from "node:fs";
2
- import { join } from "node:path";
3
- import { localStorePaths, safePathSegment } from "./paths.js";
4
- /**
5
- * Container directories whose immediate children are named after ids
6
- * (DEC-031). For each, the child entry name is the id (a directory for
7
- * negotiations/contracts/engagements/inbox/outbox, a `<id>.json` file for
8
- * policies, a `<sid>.json` file for presence).
9
- */
10
- const ID_DIR_CHILDREN = [
11
- "negotiations",
12
- "inbox",
13
- "outbox",
14
- "contracts",
15
- "engagements"
16
- ];
17
- const ID_FILE_CHILDREN = ["policies", "presence"];
18
- function sanitizeFileName(name) {
19
- // Split a single trailing extension so `sess:abc.json` → `sess__abc.json`,
20
- // sanitizing only the id portion (the `.json` itself has no forbidden chars).
21
- const dot = name.lastIndexOf(".");
22
- if (dot <= 0)
23
- return safePathSegment(name);
24
- const base = name.slice(0, dot);
25
- const ext = name.slice(dot);
26
- return `${safePathSegment(base)}${ext}`;
27
- }
28
- /**
29
- * DEC-064: rename pre-DEC-062 store entries whose names contain `:` (or other
30
- * Windows-forbidden characters) to their `safePathSegment` form. This makes a
31
- * store created by `@sentropic/h2a-cli@<=0.1.23` usable on Windows and
32
- * consistent with the current layout on every OS.
33
- *
34
- * The pass is conservative:
35
- * - It only renames entries whose sanitized name differs from the original.
36
- * - If the sanitized target already exists, it records a `conflict` and does
37
- * NOT overwrite (the caller decides what to do).
38
- * - With `dryRun`, nothing is written; entries are reported as `would-rename`.
39
- *
40
- * Pure-ish: only filesystem renames, no schema sentinel change (the layout
41
- * version stays "1"; this is a within-version cleanup, not a schema bump).
42
- */
43
- export function sanitizeStorePaths(root, options = {}) {
44
- const dryRun = options.dryRun ?? false;
45
- const paths = localStorePaths(root);
46
- const renamed = [];
47
- const conflicts = [];
48
- function processContainer(container, isFile) {
49
- if (!existsSync(container))
50
- return;
51
- let entries;
52
- try {
53
- entries = readdirSync(container);
54
- }
55
- catch {
56
- return;
57
- }
58
- for (const entry of entries) {
59
- const sanitized = isFile ? sanitizeFileName(entry) : safePathSegment(entry);
60
- if (sanitized === entry)
61
- continue;
62
- const fromPath = join(container, entry);
63
- const toPath = join(container, sanitized);
64
- // Only rename the expected kind (dir vs file) to avoid surprises.
65
- try {
66
- const st = statSync(fromPath);
67
- if (isFile ? !st.isFile() : !st.isDirectory())
68
- continue;
69
- }
70
- catch {
71
- continue;
72
- }
73
- if (existsSync(toPath)) {
74
- conflicts.push({ from: fromPath, to: toPath, status: "conflict" });
75
- continue;
76
- }
77
- if (dryRun) {
78
- renamed.push({ from: fromPath, to: toPath, status: "would-rename" });
79
- continue;
80
- }
81
- try {
82
- renameSync(fromPath, toPath);
83
- renamed.push({ from: fromPath, to: toPath, status: "renamed" });
84
- }
85
- catch {
86
- conflicts.push({ from: fromPath, to: toPath, status: "conflict" });
87
- }
88
- }
89
- }
90
- for (const dir of ID_DIR_CHILDREN) {
91
- processContainer(paths[dir], false);
92
- }
93
- for (const dir of ID_FILE_CHILDREN) {
94
- processContainer(paths[dir], true);
95
- }
96
- return {
97
- ok: conflicts.length === 0,
98
- root,
99
- dryRun,
100
- renamed,
101
- conflicts
102
- };
103
- }
104
- //# sourceMappingURL=migrate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../../src/runtime/local-files/migrate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAgB9D;;;;;GAKG;AACH,MAAM,eAAe,GAAG;IACtB,cAAc;IACd,OAAO;IACP,QAAQ;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AAgB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACnC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,OAAO;QACL,EAAE,EAAE,SAAS,CAAC,MAAM,KAAK,CAAC;QAC1B,IAAI;QACJ,MAAM;QACN,OAAO;QACP,SAAS;KACV,CAAC;AACJ,CAAC"}
@@ -1,146 +0,0 @@
1
- /**
2
- * Map an arbitrary id into a filesystem-safe path segment (DEC-062).
3
- *
4
- * V1 ids use `:` as a separator (e.g. `nego:codex`, `claude:proj-1`,
5
- * `sess:abc123`). On Windows, `:` is the drive-letter separator and is
6
- * forbidden inside path components — any `mkdir <root>/negotiations/nego:codex`
7
- * ENOENTs. The same applies to `/`, `\`, `<`, `>`, `"`, `|`, `?`, `*`
8
- * which are reserved by Windows.
9
- *
10
- * The mapping is `[:\\/<>"|?*]+` → `__`. It is deterministic and lossy
11
- * (we never need to recover the original id from the path segment;
12
- * lookups go id → path, never path → id; on-disk artefacts always
13
- * carry the original id in their JSON body).
14
- *
15
- * Empty input is mapped to `_` so we never produce an empty path
16
- * segment.
17
- */
18
- export declare function safePathSegment(id: string): string;
19
- export interface LocalStorePaths {
20
- root: string;
21
- registry: string;
22
- instances: string;
23
- keys: string;
24
- subagents: string;
25
- subagentAudit: string;
26
- offboard: string;
27
- orgMembership: string;
28
- contracts: string;
29
- policies: string;
30
- engagements: string;
31
- artifacts: string;
32
- negotiations: string;
33
- inbox: string;
34
- outbox: string;
35
- presence: string;
36
- drumbeat: string;
37
- blockage: string;
38
- escalation: string;
39
- }
40
- export declare function localStorePaths(root: string): LocalStorePaths;
41
- export declare function presenceFile(paths: LocalStorePaths, sessionId: string): string;
42
- export declare function negotiationDir(paths: LocalStorePaths, negotiationId: string): string;
43
- export declare function negotiationJournalFile(paths: LocalStorePaths, negotiationId: string): string;
44
- /**
45
- * Canonicalize an addressable instance/channel handle so addressing is
46
- * **case-insensitive** and **label-slug-stable**.
47
- *
48
- * The footgun this closes: `deriveInstanceId` builds `host:slugify(label):uuid`
49
- * (the label is lowercased + slugified), but inbox dirs were keyed on the RAW
50
- * handle via `safePathSegment`. So a sender addressing `claude:matchID` wrote to
51
- * `inbox/claude__matchID` while the agent (registered as `claude:matchid:…`)
52
- * read `inbox/claude__matchid` — the message was silently lost. Routing handles
53
- * through this first makes both forms resolve to the one canonical inbox.
54
- *
55
- * `host:label[:uuid…]` → `lower(host):slugify(label)[:lower(uuid…)]`. A bare
56
- * token with no `:` (not an instance handle) is returned unchanged.
57
- */
58
- export declare function canonicalAddress(addr: string): string;
59
- /**
60
- * True iff `addr` is host-qualified (`host:label[:uuid…]`, optionally a
61
- * subagent `…~name`): a non-empty host segment AND a non-empty label segment.
62
- * A bare token with no ":" (e.g. "radar-immobilier"), ":label" (empty host) or
63
- * "host:" (empty label) is NOT addressable — it mis-routes to an orphan inbox.
64
- */
65
- export declare function isHostQualifiedAddress(addr: string): boolean;
66
- /**
67
- * Throws a user-facing Error if `addr` is not host-qualified. Message names
68
- * the fix. Used to reject bare-label sends (e.g. "radar-immobilier" → must be
69
- * "claude:radar-immobilier"): the same label can exist on several hosts.
70
- */
71
- export declare function assertHostQualifiedAddress(addr: string, role?: string): void;
72
- /** Inbox dir for an actor, keyed on its **canonical** handle (case-folded). */
73
- export declare function inboxDir(paths: LocalStorePaths, actor: string): string;
74
- /**
75
- * Inbox dir keyed on the RAW (pre-canonicalization) handle — read-only fallback
76
- * so envelopes deposited before the case-fold fix are still recovered. Writes
77
- * always go to the canonical dir; these raw dirs drain as messages are popped.
78
- */
79
- export declare function inboxDirRaw(paths: LocalStorePaths, actor: string): string;
80
- export declare function outboxDir(paths: LocalStorePaths, actor: string): string;
81
- /** Outbox dir keyed on the RAW handle — read-only fallback for pre-case-fold copies. */
82
- export declare function outboxDirRaw(paths: LocalStorePaths, actor: string): string;
83
- /**
84
- * The outcome of resolving a send target BEFORE depositing (WP-2).
85
- *
86
- * - `deliver` — full id / subagent / unambiguous bare alias with no live session
87
- * hint: just put (legacy path).
88
- * - `deliver-dormant` — bare alias, 0 live but ≥1 registered instance exists.
89
- * - `deliver-hint` — bare alias with exactly 1 live full-id match; deposit to bare
90
- * dir (UNCHANGED destination), surface the uuid to the caller.
91
- * - `refuse` — phantom (0 live, 0 registered) | ambiguous (>1 live) | malformed.
92
- *
93
- * SAFETY: this function NEVER changes the delivery destination.
94
- * Auto-routing to a live uuid is an interception risk and is explicitly PARKED.
95
- */
96
- export type RecipientResolution = {
97
- kind: "deliver";
98
- reason?: string;
99
- } | {
100
- kind: "deliver-dormant";
101
- reason: string;
102
- } | {
103
- kind: "deliver-hint";
104
- liveCandidate: string;
105
- reason: string;
106
- } | {
107
- kind: "refuse";
108
- reason: string;
109
- candidates?: string[];
110
- };
111
- /**
112
- * Resolve how a SEND to `target` should be handled.
113
- *
114
- * Does NOT deliver — the caller delivers. Never changes the destination.
115
- * The `liveInstances` list comes from `listPresence(root).map(s => s.instance)`.
116
- * The `registeredInstances` list comes from `store.listInstances().map(i => i.instance ?? i.id)`.
117
- */
118
- export declare function resolveRecipient(opts: {
119
- target: string;
120
- liveInstances: readonly string[];
121
- registeredInstances: readonly string[];
122
- }): RecipientResolution;
123
- /**
124
- * Gate for REACHING paths (drumbeat relance / wake-another / remote drive).
125
- *
126
- * Unlike the inbox-put path, liveness is NOT a blocker for reaching: we
127
- * intentionally wake dormant agents. Only a `refuse` outcome (phantom,
128
- * ambiguous, malformed) should block. Wraps `resolveRecipient` so all
129
- * addressing discipline lives in ONE place.
130
- *
131
- * This is the REACH-GUARD CHOKEPOINT — the future governance/conductor gate
132
- * (clearance, conductor-liveness) hooks HERE via the `DrumbeatTickOptions`
133
- * integration in `watch.ts`, so every reach path inherits it.
134
- */
135
- export declare function reachGuard(opts: {
136
- target: string;
137
- liveInstances: readonly string[];
138
- registeredInstances: readonly string[];
139
- }): {
140
- ok: true;
141
- } | {
142
- ok: false;
143
- reason: string;
144
- kind: string;
145
- };
146
- //# sourceMappingURL=paths.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../src/runtime/local-files/paths.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAQlD;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAsB7D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAEpF;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,eAAe,EACtB,aAAa,EAAE,MAAM,GACpB,MAAM,CAER;AAED;;;;;;;;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MAAM,EAAE,CAAC;CACxC,GAAG,mBAAmB,CA2EtB;AAID;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAM7D"}
@@ -1,233 +0,0 @@
1
- import { join } from "node:path";
2
- import { slugify } from "@sentropic/h2a";
3
- /**
4
- * Map an arbitrary id into a filesystem-safe path segment (DEC-062).
5
- *
6
- * V1 ids use `:` as a separator (e.g. `nego:codex`, `claude:proj-1`,
7
- * `sess:abc123`). On Windows, `:` is the drive-letter separator and is
8
- * forbidden inside path components — any `mkdir <root>/negotiations/nego:codex`
9
- * ENOENTs. The same applies to `/`, `\`, `<`, `>`, `"`, `|`, `?`, `*`
10
- * which are reserved by Windows.
11
- *
12
- * The mapping is `[:\\/<>"|?*]+` → `__`. It is deterministic and lossy
13
- * (we never need to recover the original id from the path segment;
14
- * lookups go id → path, never path → id; on-disk artefacts always
15
- * carry the original id in their JSON body).
16
- *
17
- * Empty input is mapped to `_` so we never produce an empty path
18
- * segment.
19
- */
20
- export function safePathSegment(id) {
21
- if (typeof id !== "string" || id.length === 0)
22
- return "_";
23
- const cleaned = id.replace(/[:/\\<>"|?*]+/g, "__");
24
- // A pure-dot segment (".", "..", …) is a path-traversal vector: `join(base,
25
- // "tenants", "..")` escapes to `base`. Neutralize it so no id (e.g. a broker
26
- // `sub=".."` → rootForSub) can climb out of its directory.
27
- if (cleaned.length === 0 || /^\.+$/.test(cleaned))
28
- return "_";
29
- return cleaned;
30
- }
31
- export function localStorePaths(root) {
32
- return {
33
- root,
34
- registry: join(root, "registry"),
35
- instances: join(root, "registry", "instances.jsonl"),
36
- keys: join(root, "registry", "keys.jsonl"),
37
- subagents: join(root, "registry", "subagents.jsonl"),
38
- subagentAudit: join(root, "registry", "subagent-audit.jsonl"),
39
- offboard: join(root, "registry", "offboard.jsonl"),
40
- orgMembership: join(root, "registry", "org-membership.jsonl"),
41
- contracts: join(root, "contracts"),
42
- policies: join(root, "policies"),
43
- engagements: join(root, "engagements"),
44
- artifacts: join(root, "artifacts"),
45
- negotiations: join(root, "negotiations"),
46
- inbox: join(root, "inbox"),
47
- outbox: join(root, "outbox"),
48
- presence: join(root, "presence"),
49
- drumbeat: join(root, "drumbeat"),
50
- blockage: join(root, "blockage"),
51
- escalation: join(root, "escalation")
52
- };
53
- }
54
- export function presenceFile(paths, sessionId) {
55
- return join(paths.presence, `${safePathSegment(sessionId)}.json`);
56
- }
57
- export function negotiationDir(paths, negotiationId) {
58
- return join(paths.negotiations, safePathSegment(negotiationId));
59
- }
60
- export function negotiationJournalFile(paths, negotiationId) {
61
- return join(negotiationDir(paths, negotiationId), "journal.jsonl");
62
- }
63
- /**
64
- * Canonicalize an addressable instance/channel handle so addressing is
65
- * **case-insensitive** and **label-slug-stable**.
66
- *
67
- * The footgun this closes: `deriveInstanceId` builds `host:slugify(label):uuid`
68
- * (the label is lowercased + slugified), but inbox dirs were keyed on the RAW
69
- * handle via `safePathSegment`. So a sender addressing `claude:matchID` wrote to
70
- * `inbox/claude__matchID` while the agent (registered as `claude:matchid:…`)
71
- * read `inbox/claude__matchid` — the message was silently lost. Routing handles
72
- * through this first makes both forms resolve to the one canonical inbox.
73
- *
74
- * `host:label[:uuid…]` → `lower(host):slugify(label)[:lower(uuid…)]`. A bare
75
- * token with no `:` (not an instance handle) is returned unchanged.
76
- */
77
- export function canonicalAddress(addr) {
78
- if (typeof addr !== "string" || addr.length === 0)
79
- return addr;
80
- // Subagent handle `<instance>~<name>` (DEC subagents): the `~name` is
81
- // case-sensitive and charset-unrestricted — canonicalize ONLY the instance
82
- // part and keep `~name` verbatim, else two siblings differing by case
83
- // (…~Researcher vs …~researcher) collapse into one inbox (isolation break).
84
- const tilde = addr.indexOf("~");
85
- if (tilde >= 0) {
86
- return canonicalAddress(addr.slice(0, tilde)) + addr.slice(tilde);
87
- }
88
- const parts = addr.split(":");
89
- if (parts.length < 2)
90
- return addr;
91
- const [host, label, ...rest] = parts;
92
- const canonLabel = label.length === 0 ? label : slugify(label);
93
- return [host.toLowerCase(), canonLabel, ...rest.map((segment) => segment.toLowerCase())].join(":");
94
- }
95
- /**
96
- * True iff `addr` is host-qualified (`host:label[:uuid…]`, optionally a
97
- * subagent `…~name`): a non-empty host segment AND a non-empty label segment.
98
- * A bare token with no ":" (e.g. "radar-immobilier"), ":label" (empty host) or
99
- * "host:" (empty label) is NOT addressable — it mis-routes to an orphan inbox.
100
- */
101
- export function isHostQualifiedAddress(addr) {
102
- if (typeof addr !== "string" || addr.length === 0)
103
- return false;
104
- // Subagent handle `<instance>~<name>`: validate ONLY the instance part before "~".
105
- const tilde = addr.indexOf("~");
106
- const instancePart = tilde >= 0 ? addr.slice(0, tilde) : addr;
107
- const parts = instancePart.split(":");
108
- return parts.length >= 2 && parts[0].length > 0 && parts[1].length > 0;
109
- }
110
- /**
111
- * Throws a user-facing Error if `addr` is not host-qualified. Message names
112
- * the fix. Used to reject bare-label sends (e.g. "radar-immobilier" → must be
113
- * "claude:radar-immobilier"): the same label can exist on several hosts.
114
- */
115
- export function assertHostQualifiedAddress(addr, role = "recipient") {
116
- if (!isHostQualifiedAddress(addr)) {
117
- throw new Error(`h2a: ${role} "${addr}" is not host-qualified — address it as <host>:<label> (e.g. claude:${String(addr).replace(/^:+/, "") || "agent"}). A bare label is ambiguous (the same label can exist on several hosts) and routes to an orphan inbox nobody reads. Resolve the exact peer via discover.`);
118
- }
119
- }
120
- /** Inbox dir for an actor, keyed on its **canonical** handle (case-folded). */
121
- export function inboxDir(paths, actor) {
122
- return join(paths.inbox, safePathSegment(canonicalAddress(actor)));
123
- }
124
- /**
125
- * Inbox dir keyed on the RAW (pre-canonicalization) handle — read-only fallback
126
- * so envelopes deposited before the case-fold fix are still recovered. Writes
127
- * always go to the canonical dir; these raw dirs drain as messages are popped.
128
- */
129
- export function inboxDirRaw(paths, actor) {
130
- return join(paths.inbox, safePathSegment(actor));
131
- }
132
- export function outboxDir(paths, actor) {
133
- return join(paths.outbox, safePathSegment(canonicalAddress(actor)));
134
- }
135
- /** Outbox dir keyed on the RAW handle — read-only fallback for pre-case-fold copies. */
136
- export function outboxDirRaw(paths, actor) {
137
- return join(paths.outbox, safePathSegment(actor));
138
- }
139
- /** Pattern for a valid 12-hex UUID segment (case-insensitive). */
140
- const UUID12_PATTERN = /^[0-9a-f]{12}$/i;
141
- /**
142
- * Compute the canonical `host:label` key for an instance address by taking
143
- * only the first two colon-segments of the canonicalized form.
144
- */
145
- function hostLabelKey(addr) {
146
- const canonical = canonicalAddress(addr);
147
- const parts = canonical.split(":");
148
- return `${parts[0]}:${parts[1]}`;
149
- }
150
- /**
151
- * Resolve how a SEND to `target` should be handled.
152
- *
153
- * Does NOT deliver — the caller delivers. Never changes the destination.
154
- * The `liveInstances` list comes from `listPresence(root).map(s => s.instance)`.
155
- * The `registeredInstances` list comes from `store.listInstances().map(i => i.instance ?? i.id)`.
156
- */
157
- export function resolveRecipient(opts) {
158
- const { target, liveInstances, registeredInstances } = opts;
159
- // 1. Subagent (contains `~`) — pass through unchanged.
160
- if (target.includes("~")) {
161
- return { kind: "deliver" };
162
- }
163
- // 2. Split on `:`. Fewer than 2 segments or empty host/label should already
164
- // be rejected by isHostQualifiedAddress upstream — don't double-gate.
165
- const parts = target.split(":");
166
- if (parts.length < 2 || parts[0].length === 0 || parts[1].length === 0) {
167
- return { kind: "deliver" };
168
- }
169
- // 3. Full id: exactly 3 segments where seg3 is 12-hex.
170
- if (parts.length === 3 && UUID12_PATTERN.test(parts[2])) {
171
- return { kind: "deliver" };
172
- }
173
- // 4. Malformed 3-segment: seg3 is NOT 12-hex.
174
- if (parts.length >= 3) {
175
- const host = parts[0];
176
- const label = parts[1];
177
- return {
178
- kind: "refuse",
179
- reason: `'${target}' has a 3rd segment that is not a uuid — address the channel as ${host}:${label} or a live peer as ${host}:${label}:<uuid> (resolve via discover).`
180
- };
181
- }
182
- // 5. Bare alias (exactly 2 segments).
183
- const key = hostLabelKey(target);
184
- const liveMatches = liveInstances.filter((inst) => hostLabelKey(inst) === key);
185
- const registeredMatches = registeredInstances.filter((inst) => hostLabelKey(inst) === key);
186
- if (liveMatches.length > 1) {
187
- return {
188
- kind: "refuse",
189
- reason: `'${target}' is ambiguous — ${liveMatches.length} live agents share it; address the exact one (resolve via discover).`,
190
- candidates: liveMatches
191
- };
192
- }
193
- if (liveMatches.length === 1) {
194
- const liveCandidate = liveMatches[0];
195
- return {
196
- kind: "deliver-hint",
197
- liveCandidate,
198
- reason: `bare alias resolved to 1 live agent; deposited to the channel — prefer re-sending to ${liveCandidate} for direct delivery.`
199
- };
200
- }
201
- // 0 live
202
- if (registeredMatches.length > 0) {
203
- return {
204
- kind: "deliver-dormant",
205
- reason: `no live session for '${target}'; deposited for wake (a registered agent exists).`
206
- };
207
- }
208
- return {
209
- kind: "refuse",
210
- reason: `'${target}' matches no live or registered agent — likely a phantom/invented id or sub-label. Resolve via discover; do not invent labels.`
211
- };
212
- }
213
- // ─── WP-7: Reach Guard ──────────────────────────────────────────────────────
214
- /**
215
- * Gate for REACHING paths (drumbeat relance / wake-another / remote drive).
216
- *
217
- * Unlike the inbox-put path, liveness is NOT a blocker for reaching: we
218
- * intentionally wake dormant agents. Only a `refuse` outcome (phantom,
219
- * ambiguous, malformed) should block. Wraps `resolveRecipient` so all
220
- * addressing discipline lives in ONE place.
221
- *
222
- * This is the REACH-GUARD CHOKEPOINT — the future governance/conductor gate
223
- * (clearance, conductor-liveness) hooks HERE via the `DrumbeatTickOptions`
224
- * integration in `watch.ts`, so every reach path inherits it.
225
- */
226
- export function reachGuard(opts) {
227
- const r = resolveRecipient(opts);
228
- if (r.kind === "refuse") {
229
- return { ok: false, reason: r.reason, kind: r.kind };
230
- }
231
- return { ok: true };
232
- }
233
- //# sourceMappingURL=paths.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../src/runtime/local-files/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe,CAAC,EAAU;IACxC,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAG,CAAC;IAC1D,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IACnD,4EAA4E;IAC5E,6EAA6E;IAC7E,2DAA2D;IAC3D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;QAAE,OAAO,GAAG,CAAC;IAC9D,OAAO,OAAO,CAAC;AACjB,CAAC;AAwBD,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO;QACL,IAAI;QACJ,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC;QAChC,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,iBAAiB,CAAC;QACpD,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,YAAY,CAAC;QAC1C,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,iBAAiB,CAAC;QACpD,aAAa,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,sBAAsB,CAAC;QAC7D,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,gBAAgB,CAAC;QAClD,aAAa,EAAE,IAAI,CAAC,IAAI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EAA+E;AAE/E;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,UAAU,CAAC,IAI1B;IACC,MAAM,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACxB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACvD,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC"}
@@ -1,80 +0,0 @@
1
- import { type H2ALaunchContext, type H2ASession, type H2ASessionState, type H2AWorkStatus } from "@sentropic/h2a";
2
- export interface PresenceWriteResult {
3
- /** Absolute path of the presence file on disk. */
4
- readonly path: string;
5
- }
6
- /**
7
- * Atomically write a session's presence file under `<root>/.h2a/presence/`.
8
- * Uses a temp file + rename so concurrent readers always see a complete
9
- * JSON document (the session owns its own file, so writer contention is
10
- * not expected, but we keep the rename anyway for partial-write safety).
11
- */
12
- export declare function writePresence(root: string, session: H2ASession): PresenceWriteResult;
13
- /** Read a presence file by session id. Returns undefined if absent or malformed. */
14
- export declare function readPresence(root: string, sessionId: string): H2ASession | undefined;
15
- /**
16
- * Delete a presence file. Idempotent: missing file is not an error.
17
- */
18
- export declare function deletePresence(root: string, sessionId: string): void;
19
- export interface ListPresenceOptions {
20
- /** Reference instant; defaults to Date.now(). */
21
- readonly now?: number;
22
- /** Expiry window in ms; defaults to H2A_SESSION_DEFAULT_EXPIRY_MS. */
23
- readonly expiryMs?: number;
24
- /** Include expired sessions (default false). */
25
- readonly includeExpired?: boolean;
26
- }
27
- /**
28
- * Read all presence files under `<root>/.h2a/presence/`, filter out malformed
29
- * files, and (by default) drop sessions whose heartbeat is older than
30
- * `expiryMs`. Sweep expired files from disk as a side-effect.
31
- */
32
- export declare function listPresence(root: string, options?: ListPresenceOptions): H2ASession[];
33
- /**
34
- * Mutate a session's `heartbeatAt` (or `state`) on disk by reading,
35
- * patching, and re-writing. The session owns its file so this is safe
36
- * without a lock for V1 (DEC-051 acknowledges this constraint).
37
- */
38
- export declare function updatePresence(root: string, sessionId: string, patch: {
39
- heartbeatAt?: string;
40
- state?: H2ASessionState;
41
- workStatus?: H2AWorkStatus;
42
- launchContext?: H2ALaunchContext;
43
- lastMcpActivityAt?: string;
44
- }): H2ASession | undefined;
45
- /**
46
- * Reap presence files for the SAME `instance` whose owning process is provably
47
- * dead — the "false-live" left behind when a host (Claude Code / Codex) drops
48
- * the MCP stdio connection WITHOUT signalling the child: the process lingered
49
- * and its blind heartbeat kept the presence "live", so peers kept routing to an
50
- * agent that could no longer answer. A fresh `mcp-serve` boot calls this at
51
- * auto-open to clear the stale presence of a previous connection of the SAME
52
- * agent.
53
- *
54
- * Reaps an entry iff ALL hold:
55
- * - same `instance` (an instance never migrates machines — it is keyed on the
56
- * provider conversation — so the local pid probe is valid);
57
- * - a DIFFERENT `sessionId` than `keepSessionId` (never reap the caller);
58
- * - a numeric `pid` that `isAlive` reports dead.
59
- *
60
- * Best-effort: never throws. `isAlive` is injectable for deterministic tests.
61
- *
62
- * @returns the sessionIds that were reaped.
63
- */
64
- export declare function reapDeadInstancePresence(root: string, instance: string, keepSessionId: string, isAlive?: (pid: number) => boolean): string[];
65
- /**
66
- * Host-wide janitor: reap EVERY presence file whose owning process is provably
67
- * dead, regardless of instance. The safest possible reap — a dead process
68
- * cannot own a live session — but it assumes presence pids are local to this
69
- * machine (true for a single-host bus). On a bus shared across machines, scope
70
- * with `reapDeadInstancePresence` instead, since a remote pid would read as
71
- * dead here. Best-effort: never throws. `isAlive` is injectable for tests.
72
- *
73
- * @returns the reaped sessionIds (and, for reporting, their instances).
74
- */
75
- export declare function reapAllDeadPresence(root: string, isAlive?: (pid: number) => boolean): Array<{
76
- sessionId: string;
77
- instance: string;
78
- pid: number;
79
- }>;
80
- //# sourceMappingURL=presence.d.ts.map
@@ -1 +0,0 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