@sentropic/h2a-cli 0.75.0 → 0.79.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 +0,0 @@
1
- {"version":3,"file":"watch.js","sourceRoot":"","sources":["../../../src/runtime/drumbeat/watch.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAqD,MAAM,WAAW,CAAC;AAC5F,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EAErB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAQxD,6EAA6E;AAC7E,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,OAAO;QACL,OAAO,CAAC,OAAO;YACb,KAAK,CACH,2BAA2B,OAAO,CAAC,QAAQ,YAAY,OAAO,CAAC,MAAM,WAAW,OAAO,CAAC,YAAY,GAAG,CACxG,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AA6CD,0EAA0E;AAC1E,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,IAAY,EACZ,UAAyB,EACzB,UAA+B,EAAE;IAEjC,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;IACjD,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,YAAY,CAAC,IAAI,EAAE;QACjD,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,aAAa,E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,CAAC,CAAC;QAC7D,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,OAAO,CAAC,MAAM,EAAE,OAAO;YAAE,MAAM;QACnC,MAAM,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC"}
@@ -1,2 +0,0 @@
1
- export { recordEscalation, readEscalation, listEscalations, clearEscalation, type H2AEscalationRecord, type H2AEscalationReason, type RecordEscalationInput } from "./registry.js";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/escalation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC3B,MAAM,eAAe,CAAC"}
@@ -1,2 +0,0 @@
1
- export { recordEscalation, readEscalation, listEscalations, clearEscalation } from "./registry.js";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/escalation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,eAAe,EAIhB,MAAM,eAAe,CAAC"}
@@ -1,44 +0,0 @@
1
- /**
2
- * Durable escalation registry (DEC-095, Drumbeat D7). When an agent exhausts its
3
- * relance budget (DEC-086 `scanDrumbeat` → `exhausted`), the daemon must stop
4
- * looping and **escalate to the PRINCIPAL** (DEC-084: the engagement owner, not
5
- * EXECUTIF) over the `alert` channel (DEC-040). The relance cap is the anti-loop
6
- * guard; this registry is the escalation that replaces further relances.
7
- *
8
- * Parallel to the drumbeat/blockage registries: `<root>/.h2a/escalation/<safe-instance>.json`.
9
- */
10
- /**
11
- * Why the escalation fired. `relance-exhausted` (D7, relance budget spent);
12
- * `watchdog-escalate` / `reroute-suggested` (D5, the reflexive watchdog decided
13
- * a human must look, or that the work should be reassigned).
14
- */
15
- export type H2AEscalationReason = "relance-exhausted" | "watchdog-escalate" | "reroute-suggested";
16
- export interface H2AEscalationRecord {
17
- readonly instance: string;
18
- readonly reason: H2AEscalationReason;
19
- /** Relance count at the time the budget was exhausted. */
20
- readonly relanceCount: number;
21
- /** Escalation channel (DEC-040). Defaults to `alert`. */
22
- readonly channel: string;
23
- /** Symbolic target — the scope's competent authority. Defaults to `PRINCIPAL` (DEC-084). */
24
- readonly to: string;
25
- readonly at: string;
26
- }
27
- export interface RecordEscalationInput {
28
- readonly instance: string;
29
- readonly reason: H2AEscalationReason;
30
- readonly relanceCount: number;
31
- readonly channel?: string;
32
- readonly to?: string;
33
- }
34
- /**
35
- * Record (upsert) an escalation. Idempotent per instance: a repeated escalation
36
- * for the same exhausted instance overwrites with the latest count/time rather
37
- * than piling up — the PRINCIPAL needs one open alert per agent, not a flood.
38
- */
39
- export declare function recordEscalation(root: string, input: RecordEscalationInput, now?: number): H2AEscalationRecord;
40
- export declare function readEscalation(root: string, instance: string): H2AEscalationRecord | undefined;
41
- export declare function listEscalations(root: string): H2AEscalationRecord[];
42
- /** Clear an escalation — call when the agent is cleanly resumed/finished. */
43
- export declare function clearEscalation(root: string, instance: string): void;
44
- //# sourceMappingURL=registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/runtime/escalation/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,mBAAmB,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AAElG,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,0DAA0D;IAC1D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAMD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,qBAAqB,EAC5B,GAAG,GAAE,MAAmB,GACvB,mBAAmB,CAYrB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAQ9F;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAmBnE;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAMpE"}
@@ -1,79 +0,0 @@
1
- /**
2
- * Durable escalation registry (DEC-095, Drumbeat D7). When an agent exhausts its
3
- * relance budget (DEC-086 `scanDrumbeat` → `exhausted`), the daemon must stop
4
- * looping and **escalate to the PRINCIPAL** (DEC-084: the engagement owner, not
5
- * EXECUTIF) over the `alert` channel (DEC-040). The relance cap is the anti-loop
6
- * guard; this registry is the escalation that replaces further relances.
7
- *
8
- * Parallel to the drumbeat/blockage registries: `<root>/.h2a/escalation/<safe-instance>.json`.
9
- */
10
- import { existsSync, mkdirSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from "node:fs";
11
- import { join } from "node:path";
12
- import { localStorePaths, safePathSegment } from "../local-files/paths.js";
13
- function entryFile(root, instance) {
14
- return join(localStorePaths(root).escalation, `${safePathSegment(instance)}.json`);
15
- }
16
- /**
17
- * Record (upsert) an escalation. Idempotent per instance: a repeated escalation
18
- * for the same exhausted instance overwrites with the latest count/time rather
19
- * than piling up — the PRINCIPAL needs one open alert per agent, not a flood.
20
- */
21
- export function recordEscalation(root, input, now = Date.now()) {
22
- mkdirSync(localStorePaths(root).escalation, { recursive: true });
23
- const record = {
24
- instance: input.instance,
25
- reason: input.reason,
26
- relanceCount: input.relanceCount,
27
- channel: input.channel ?? "alert",
28
- to: input.to ?? "PRINCIPAL",
29
- at: new Date(now).toISOString()
30
- };
31
- writeFileSync(entryFile(root, input.instance), `${JSON.stringify(record, null, 2)}\n`, "utf8");
32
- return record;
33
- }
34
- export function readEscalation(root, instance) {
35
- const file = entryFile(root, instance);
36
- if (!existsSync(file))
37
- return undefined;
38
- try {
39
- return JSON.parse(readFileSync(file, "utf8"));
40
- }
41
- catch {
42
- return undefined;
43
- }
44
- }
45
- export function listEscalations(root) {
46
- const dir = localStorePaths(root).escalation;
47
- let names;
48
- try {
49
- names = readdirSync(dir);
50
- }
51
- catch (err) {
52
- if (err.code === "ENOENT")
53
- return [];
54
- throw err;
55
- }
56
- const out = [];
57
- for (const name of names) {
58
- if (!name.endsWith(".json"))
59
- continue;
60
- try {
61
- out.push(JSON.parse(readFileSync(join(dir, name), "utf8")));
62
- }
63
- catch {
64
- // skip malformed
65
- }
66
- }
67
- return out;
68
- }
69
- /** Clear an escalation — call when the agent is cleanly resumed/finished. */
70
- export function clearEscalation(root, instance) {
71
- try {
72
- unlinkSync(entryFile(root, instance));
73
- }
74
- catch (err) {
75
- if (err.code !== "ENOENT")
76
- throw err;
77
- }
78
- }
79
- //# sourceMappingURL=registry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/runtime/escalation/registry.ts"],"names":[],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CAAC,IAAI,KAAK,QAAQ;YAAE,MAAM,GAAG,CAAC;IAClE,CAAC;AACH,CAAC"}
@@ -1,43 +0,0 @@
1
- /**
2
- * Governance primitive: append-only conductor-claims store (WP-G1b).
3
- *
4
- * A claim event signals that an instance is asserting the conductor role for
5
- * a workspace; a release event cancels it. The store is a plain JSONL file at
6
- * `<root>/.h2a/governance/conductor-claims.jsonl`. The fold over events is
7
- * `activeConductorClaims`: an instance has an active claim iff its latest event
8
- * (by `at`) for (workspaceId, instance) is a `claim` (a `release` cancels it).
9
- *
10
- * This is additive/reversible — append-only, no deletion, no enforcement.
11
- */
12
- export interface ConductorClaimEvent {
13
- readonly type: "claim" | "release";
14
- readonly workspaceId: string;
15
- readonly instance: string;
16
- /** ISO 8601 timestamp of the event. */
17
- readonly at: string;
18
- }
19
- /**
20
- * Append a conductor claim or release event to the JSONL store.
21
- * Creates the governance directory if it does not exist.
22
- */
23
- export declare function appendConductorClaim(root: string, event: ConductorClaimEvent): void;
24
- /**
25
- * Read all conductor claim/release events from the store.
26
- * Returns an empty array if the file does not exist. Skips malformed lines.
27
- */
28
- export declare function listConductorClaims(root: string): ConductorClaimEvent[];
29
- /**
30
- * Fold the claim/release log to find active claimants for a workspace.
31
- *
32
- * An instance has an **active** claim for `workspaceId` iff its latest event
33
- * (by `at`) for the pair `(workspaceId, instance)` is a `claim` (a subsequent
34
- * `release` cancels it).
35
- *
36
- * Returns active claimants sorted by their claim `at` ASCENDING (earliest
37
- * claimant first — the tiebreaker for the conductor election).
38
- */
39
- export declare function activeConductorClaims(root: string, workspaceId: string): Array<{
40
- instance: string;
41
- at: string;
42
- }>;
43
- //# sourceMappingURL=claims.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"claims.d.ts","sourceRoot":"","sources":["../../../src/runtime/governance/claims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAWH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,uCAAuC;IACvC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAkBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,mBAAmB,GACzB,IAAI,CAIN;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAavE;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CA4BzC"}
@@ -1,93 +0,0 @@
1
- /**
2
- * Governance primitive: append-only conductor-claims store (WP-G1b).
3
- *
4
- * A claim event signals that an instance is asserting the conductor role for
5
- * a workspace; a release event cancels it. The store is a plain JSONL file at
6
- * `<root>/.h2a/governance/conductor-claims.jsonl`. The fold over events is
7
- * `activeConductorClaims`: an instance has an active claim iff its latest event
8
- * (by `at`) for (workspaceId, instance) is a `claim` (a `release` cancels it).
9
- *
10
- * This is additive/reversible — append-only, no deletion, no enforcement.
11
- */
12
- import { appendFileSync, existsSync, mkdirSync, readFileSync } from "node:fs";
13
- import { join } from "node:path";
14
- import { canonicalAddress, localStorePaths } from "../local-files/index.js";
15
- // ---------------------------------------------------------------------------
16
- // Paths
17
- // ---------------------------------------------------------------------------
18
- function governanceDir(root) {
19
- return join(localStorePaths(root).root, "governance");
20
- }
21
- function claimsFile(root) {
22
- return join(governanceDir(root), "conductor-claims.jsonl");
23
- }
24
- // ---------------------------------------------------------------------------
25
- // Store operations
26
- // ---------------------------------------------------------------------------
27
- /**
28
- * Append a conductor claim or release event to the JSONL store.
29
- * Creates the governance directory if it does not exist.
30
- */
31
- export function appendConductorClaim(root, event) {
32
- const dir = governanceDir(root);
33
- mkdirSync(dir, { recursive: true });
34
- appendFileSync(claimsFile(root), `${JSON.stringify(event)}\n`, "utf8");
35
- }
36
- /**
37
- * Read all conductor claim/release events from the store.
38
- * Returns an empty array if the file does not exist. Skips malformed lines.
39
- */
40
- export function listConductorClaims(root) {
41
- const file = claimsFile(root);
42
- if (!existsSync(file))
43
- return [];
44
- const out = [];
45
- for (const line of readFileSync(file, "utf8").split("\n")) {
46
- if (!line.trim())
47
- continue;
48
- try {
49
- out.push(JSON.parse(line));
50
- }
51
- catch {
52
- // skip malformed line
53
- }
54
- }
55
- return out;
56
- }
57
- /**
58
- * Fold the claim/release log to find active claimants for a workspace.
59
- *
60
- * An instance has an **active** claim for `workspaceId` iff its latest event
61
- * (by `at`) for the pair `(workspaceId, instance)` is a `claim` (a subsequent
62
- * `release` cancels it).
63
- *
64
- * Returns active claimants sorted by their claim `at` ASCENDING (earliest
65
- * claimant first — the tiebreaker for the conductor election).
66
- */
67
- export function activeConductorClaims(root, workspaceId) {
68
- const events = listConductorClaims(root);
69
- // Compare workspace ids CANONICALLY so a claim stored raw still matches a
70
- // canonicalized lookup (conductorFor passes canonicalAddress(workspaceId)).
71
- const wantWs = canonicalAddress(workspaceId);
72
- // Build a map: instance → { type, at } of the LATEST event for this workspaceId.
73
- const latest = new Map();
74
- for (const ev of events) {
75
- if (canonicalAddress(ev.workspaceId) !== wantWs)
76
- continue;
77
- const prev = latest.get(ev.instance);
78
- if (!prev || ev.at >= prev.at) {
79
- latest.set(ev.instance, { type: ev.type, at: ev.at });
80
- }
81
- }
82
- // Retain only instances whose latest event is a `claim`.
83
- const active = [];
84
- for (const [instance, { type, at }] of latest) {
85
- if (type === "claim") {
86
- active.push({ instance, at });
87
- }
88
- }
89
- // Sort ascending by `at` so the earliest claimant is first.
90
- active.sort((a, b) => a.at.localeCompare(b.at));
91
- return active;
92
- }
93
- //# sourceMappingURL=claims.js.map
@@ -1 +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C;YACrB,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED,4DAA4D;IAC5D,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,79 +0,0 @@
1
- /**
2
- * Governance primitive: conductor/owner resolver for a workspace.
3
- *
4
- * WP-G1 — Read-only, pure over presence + registry + claims. No writes.
5
- *
6
- * The "CONDUCTOR of workspace W" is resolved in precedence order:
7
- * 1. The EARLIEST active-claim instance (from activeConductorClaims) that is
8
- * also a live in-workspace candidate (WP-G1b — claim-based election).
9
- * 2. (back-compat) A live candidate whose registration roles include
10
- * "CONDUCTOR" (WP-G1a — role-based).
11
- * 3. null (the common state: agents auto-register as AGENTS).
12
- */
13
- /** One live in-workspace agent. */
14
- export interface ConductorCandidate {
15
- /** Perennial instance id (host:slug:uuid12). */
16
- readonly instance: string;
17
- /** Host (claude, codex, gemini, agy, remote, …). */
18
- readonly host?: string;
19
- /** Display name, if set on the session. */
20
- readonly name?: string;
21
- /**
22
- * Roles from the registry registration. Empty array if the instance has no
23
- * registration (unregistered presence).
24
- */
25
- readonly roles: string[];
26
- /** ISO timestamp when the session was opened. */
27
- readonly startedAt: string;
28
- /** ISO timestamp of the last heartbeat. */
29
- readonly heartbeatAt: string;
30
- }
31
- export interface ConductorResolution {
32
- /** The workspace id that was resolved (canonical form). */
33
- readonly workspaceId: string;
34
- /**
35
- * The live CONDUCTOR: resolved in precedence order (claim > role > null).
36
- * null if no live in-workspace candidate holds either a claim or the role.
37
- */
38
- readonly conductor: string | null;
39
- /**
40
- * The instance that holds an active claim and is live in-workspace, or null
41
- * if the conductor was resolved by role or is null. Exposes claim provenance.
42
- */
43
- readonly claimedBy: string | null;
44
- /**
45
- * All live sessions whose workspace.id matches (canonical-compared) the
46
- * requested workspaceId. The conductor (if any) is also in this list.
47
- */
48
- readonly candidates: ConductorCandidate[];
49
- /** true if at least one candidate is live (candidates.length > 0). */
50
- readonly live: boolean;
51
- }
52
- export interface ConductorForOptions {
53
- readonly root: string;
54
- readonly workspaceId: string;
55
- /** Optional: override the freshness expiry window in ms (default 90000). */
56
- readonly expiryMs?: number;
57
- /** Optional: reference instant for freshness (default Date.now()). */
58
- readonly now?: number;
59
- }
60
- /**
61
- * Resolve the live conductor/owner of a workspace.
62
- *
63
- * Algorithm:
64
- * 1. List all fresh presence records (90s freshness by default).
65
- * 2. Retain sessions whose `workspace.id` matches the requested workspaceId
66
- * (case-insensitive / slug-stable via canonicalAddress on both sides).
67
- * 3. For each candidate, look up the registry to read its roles.
68
- * 4. Read active conductor claims for the workspace.
69
- * 5. conductor =
70
- * a. The EARLIEST active-claim instance (by claim `at`) that is also a
71
- * live in-workspace candidate (claim-based election, WP-G1b); OR
72
- * b. (back-compat) the FIRST (by startedAt) live candidate whose roles
73
- * include "CONDUCTOR" (role-based, WP-G1a); OR
74
- * c. null.
75
- * 6. claimedBy = the instance resolved via path (a), or null.
76
- * 7. live = candidates.length > 0.
77
- */
78
- export declare function conductorFor(opts: ConductorForOptions): ConductorResolution;
79
- //# sourceMappingURL=conductor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"conductor.d.ts","sourceRoot":"","sources":["../../../src/runtime/governance/conductor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,mCAAmC;AACnC,MAAM,WAAW,kBAAkB;IACjC,gDAAgD;IAChD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,oDAAoD;IACpD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IACzB,iDAAiD;IACjD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,2CAA2C;IAC3C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,2DAA2D;IAC3D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,kBAAkB,EAAE,CAAC;IAC1C,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,sEAAsE;IACtE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,mBAAmB,GAAG,mBAAmB,CA4E3E"}
@@ -1,106 +0,0 @@
1
- /**
2
- * Governance primitive: conductor/owner resolver for a workspace.
3
- *
4
- * WP-G1 — Read-only, pure over presence + registry + claims. No writes.
5
- *
6
- * The "CONDUCTOR of workspace W" is resolved in precedence order:
7
- * 1. The EARLIEST active-claim instance (from activeConductorClaims) that is
8
- * also a live in-workspace candidate (WP-G1b — claim-based election).
9
- * 2. (back-compat) A live candidate whose registration roles include
10
- * "CONDUCTOR" (WP-G1a — role-based).
11
- * 3. null (the common state: agents auto-register as AGENTS).
12
- */
13
- import { canonicalAddress, listPresence } from "../local-files/index.js";
14
- import { createLocalStore } from "../local-files/store.js";
15
- import { activeConductorClaims } from "./claims.js";
16
- /**
17
- * Resolve the live conductor/owner of a workspace.
18
- *
19
- * Algorithm:
20
- * 1. List all fresh presence records (90s freshness by default).
21
- * 2. Retain sessions whose `workspace.id` matches the requested workspaceId
22
- * (case-insensitive / slug-stable via canonicalAddress on both sides).
23
- * 3. For each candidate, look up the registry to read its roles.
24
- * 4. Read active conductor claims for the workspace.
25
- * 5. conductor =
26
- * a. The EARLIEST active-claim instance (by claim `at`) that is also a
27
- * live in-workspace candidate (claim-based election, WP-G1b); OR
28
- * b. (back-compat) the FIRST (by startedAt) live candidate whose roles
29
- * include "CONDUCTOR" (role-based, WP-G1a); OR
30
- * c. null.
31
- * 6. claimedBy = the instance resolved via path (a), or null.
32
- * 7. live = candidates.length > 0.
33
- */
34
- export function conductorFor(opts) {
35
- const { root, expiryMs, now } = opts;
36
- const targetId = canonicalAddress(opts.workspaceId);
37
- // Read live sessions
38
- const sessions = listPresence(root, {
39
- ...(expiryMs !== undefined ? { expiryMs } : {}),
40
- ...(now !== undefined ? { now } : {})
41
- });
42
- // Filter to sessions in the target workspace
43
- const inWorkspace = sessions.filter((s) => {
44
- if (!s.workspace?.id)
45
- return false;
46
- return canonicalAddress(s.workspace.id) === targetId;
47
- });
48
- // Read registry lazily (only if there are candidates; avoids I/O on empty)
49
- // Build a map: canonical(instance) → roles[]
50
- const rolesMap = new Map();
51
- if (inWorkspace.length > 0) {
52
- try {
53
- const store = createLocalStore({ root, allowVersionMismatch: true });
54
- for (const reg of store.listInstances()) {
55
- rolesMap.set(canonicalAddress(reg.id), reg.roles ?? []);
56
- }
57
- }
58
- catch {
59
- // If the store is unreadable, proceed with empty roles
60
- }
61
- }
62
- // Build candidates
63
- const candidates = inWorkspace.map((s) => ({
64
- instance: s.instance,
65
- ...(s.host !== undefined ? { host: s.host } : {}),
66
- ...(s.name !== undefined ? { name: s.name } : {}),
67
- roles: rolesMap.get(canonicalAddress(s.instance)) ?? [],
68
- startedAt: s.startedAt,
69
- heartbeatAt: s.heartbeatAt
70
- }));
71
- // Build a set of live in-workspace instance canonical ids for quick lookup.
72
- const liveSet = new Set(candidates.map((c) => canonicalAddress(c.instance)));
73
- // 5a. Claim-based election: earliest active claim from a live candidate.
74
- let conductor = null;
75
- let claimedBy = null;
76
- try {
77
- const claims = activeConductorClaims(root, targetId);
78
- for (const claim of claims) {
79
- if (liveSet.has(canonicalAddress(claim.instance))) {
80
- conductor = claim.instance;
81
- claimedBy = claim.instance;
82
- break;
83
- }
84
- }
85
- }
86
- catch {
87
- // If claims are unreadable, fall through to role-based resolution
88
- }
89
- // 5b. Role-based election (back-compat): earliest-startedAt with role CONDUCTOR.
90
- if (conductor === null) {
91
- const conductorCandidates = candidates
92
- .filter((c) => c.roles.includes("CONDUCTOR"))
93
- .sort((a, b) => a.startedAt.localeCompare(b.startedAt));
94
- if (conductorCandidates.length > 0) {
95
- conductor = conductorCandidates[0].instance;
96
- }
97
- }
98
- return {
99
- workspaceId: targetId,
100
- conductor,
101
- claimedBy,
102
- candidates,
103
- live: candidates.length > 0
104
- };
105
- }
106
- //# sourceMappingURL=conductor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"conductor.js","sourceRoot":"","sources":["../../../src/runtime/governance/conductor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAoDpD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,YAAY,CAAC,IAAyB;IACpD,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACrC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAEpD,qBAAqB;IACrB,MAAM,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,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;aAC5C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;QAC1D,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnC,SAAS,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC9C,CAAC;IACH,CAAC;IAED,OAAO;QACL,WAAW,EAAE,QAAQ;QACrB,SAAS;QACT,SAAS;QACT,UAAU;QACV,IAAI,EAAE,UAAU,CAAC,MAAM,GAAG,CAAC;KAC5B,CAAC;AACJ,CAAC"}
@@ -1,5 +0,0 @@
1
- export { conductorFor, type ConductorCandidate, type ConductorForOptions, type ConductorResolution } from "./conductor.js";
2
- export { appendConductorClaim, listConductorClaims, activeConductorClaims, type ConductorClaimEvent } from "./claims.js";
3
- export { recommendConductorLaunch, conductorLaunchCheck, type ConductorLaunchRecommendation, type ConductorLaunchCheckOpts, type ConductorLaunchCheckResult, type RecommendConductorLaunchOpts, type StalledItem } from "./launch-check.js";
4
- export { recordSpawnRequest, lastSpawnRequestAt, spawnAllowed, type SpawnRequestEvent, type SpawnAllowedOpts } from "./spawns.js";
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/governance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EACjC,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,aAAa,CAAC"}
@@ -1,5 +0,0 @@
1
- export { conductorFor } from "./conductor.js";
2
- export { appendConductorClaim, listConductorClaims, activeConductorClaims } from "./claims.js";
3
- export { recommendConductorLaunch, conductorLaunchCheck } from "./launch-check.js";
4
- export { recordSpawnRequest, lastSpawnRequestAt, spawnAllowed } from "./spawns.js";
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/governance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAIb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EAEtB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EAMrB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EAGb,MAAM,aAAa,CAAC"}
@@ -1,93 +0,0 @@
1
- /**
2
- * Governance D3 — Conductor Launch Check (DRY-RUN, read-only).
3
- *
4
- * h2a polls `track workspace-activity` and RECOMMENDS launching a conductor
5
- * where work is durably stalled and no conductor is live.
6
- *
7
- * The module has two layers:
8
- *
9
- * 1. `recommendConductorLaunch` — pure function, no I/O. Derives the
10
- * recommendation from two booleans: whether a conductor is already live and
11
- * how many stalled items were found.
12
- *
13
- * 2. `conductorLaunchCheck` — the I/O gatherer. Calls `track
14
- * workspace-activity`, calls `conductorFor`, computes the recommendation,
15
- * and returns a single result object. Never writes, never spawns.
16
- *
17
- * IMPORTANT — DRY-RUN policy
18
- * --------------------------
19
- * h2a does NOT spawn anything. A `recommendation === "launch"` output is
20
- * purely advisory. The actual conductor launch is **parked** pending a
21
- * spawn-policy decision and remote-trigger support.
22
- */
23
- export interface RecommendConductorLaunchOpts {
24
- /** true when conductorFor returned a non-null conductor that is live. */
25
- readonly conductorLive: boolean;
26
- /** Number of stalled items returned by track workspace-activity. */
27
- readonly stalledCount: number;
28
- }
29
- export interface ConductorLaunchRecommendation {
30
- /** "launch" = h2a recommends someone starts a conductor; "none" = no action needed. */
31
- readonly recommendation: "launch" | "none";
32
- /** Human-readable reason behind the recommendation. */
33
- readonly reason: string;
34
- /** Preferred host order for the launch (only present when recommendation === "launch"). */
35
- readonly suggestedHosts?: string[];
36
- }
37
- /**
38
- * Pure function: derive a conductor-launch recommendation from pre-gathered
39
- * facts. No I/O.
40
- *
41
- * Rules (in precedence order):
42
- * 1. conductorLive === true → none (a live conductor already owns the workspace).
43
- * 2. conductorLive === false AND stalledCount > 0 → launch.
44
- * 3. else → none (no stalled work detected).
45
- */
46
- export declare function recommendConductorLaunch(opts: RecommendConductorLaunchOpts): ConductorLaunchRecommendation;
47
- export interface StalledItem {
48
- readonly id?: string;
49
- readonly title?: string;
50
- readonly reason?: string;
51
- readonly since?: string;
52
- }
53
- export interface ConductorLaunchCheckOpts {
54
- /** h2a store root (the `.h2a` directory). */
55
- readonly root: string;
56
- /** Workspace id in `ws:<uuid>` form. */
57
- readonly workspaceId: string;
58
- /** Idle threshold passed to `track workspace-activity --idle-ms`. Default 86400000 (24h). */
59
- readonly idleMs?: number;
60
- /** Override `Date.now()` for test determinism. */
61
- readonly now?: () => number;
62
- /**
63
- * Injectable replacement for the real `track workspace-activity` call.
64
- * When absent, the default implementation runs the `track` binary.
65
- * Return `undefined` to signal that track is unavailable / errored.
66
- */
67
- readonly runTrackActivity?: (workspaceId: string, idleMs: number) => {
68
- pending: number;
69
- stalled: StalledItem[];
70
- latestEventAt?: string;
71
- } | undefined;
72
- }
73
- export interface ConductorLaunchCheckResult {
74
- readonly workspaceId: string;
75
- /** false when track is absent or errored (graceful degradation). */
76
- readonly trackAvailable: boolean;
77
- /** The live conductor instance id, or null. */
78
- readonly conductor: string | null;
79
- readonly conductorLive: boolean;
80
- readonly pending: number;
81
- readonly stalled: StalledItem[];
82
- readonly latestEventAt?: string;
83
- readonly recommendation: "launch" | "none";
84
- readonly reason: string;
85
- readonly suggestedHosts?: string[];
86
- }
87
- /**
88
- * Gather all facts and derive a conductor-launch recommendation.
89
- *
90
- * Read-only: no writes, no spawns.
91
- */
92
- export declare function conductorLaunchCheck(opts: ConductorLaunchCheckOpts): ConductorLaunchCheckResult;
93
- //# sourceMappingURL=launch-check.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"launch-check.d.ts","sourceRoot":"","sources":["../../../src/runtime/governance/launch-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AASH,MAAM,WAAW,4BAA4B;IAC3C,yEAAyE;IACzE,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,oEAAoE;IACpE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,6BAA6B;IAC5C,uFAAuF;IACvF,QAAQ,CAAC,cAAc,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC3C,uDAAuD;IACvD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,2FAA2F;IAC3F,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CACpC;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,4BAA4B,GACjC,6BAA6B,CAsB/B;AAMD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;A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