@songsid/agend 2.3.4 → 2.3.5-alpha.11

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 (1538) hide show
  1. package/README.md +2 -0
  2. package/README.zh-TW.md +2 -0
  3. package/THIRD_PARTY_NOTICES.md +67 -0
  4. package/dist/accounts-profiles.d.ts +102 -0
  5. package/dist/accounts-profiles.js +194 -0
  6. package/dist/accounts-profiles.js.map +1 -0
  7. package/dist/accounts-signout.d.ts +59 -0
  8. package/dist/accounts-signout.js +181 -0
  9. package/dist/accounts-signout.js.map +1 -0
  10. package/dist/accounts-view.d.ts +182 -0
  11. package/dist/accounts-view.js +204 -0
  12. package/dist/accounts-view.js.map +1 -0
  13. package/dist/agent-cli-instructions.md +3 -3
  14. package/dist/agent-cli.js +5 -2
  15. package/dist/agent-cli.js.map +1 -1
  16. package/dist/agent-endpoint.d.ts +5 -1
  17. package/dist/agent-endpoint.js +12 -2
  18. package/dist/agent-endpoint.js.map +1 -1
  19. package/dist/agent-file-read.js +1 -1
  20. package/dist/agent-file-read.js.map +1 -1
  21. package/dist/agent-runtime-api.d.ts +4 -0
  22. package/dist/agent-runtime-api.js +59 -0
  23. package/dist/agent-runtime-api.js.map +1 -0
  24. package/dist/agent-runtime-change.d.ts +76 -0
  25. package/dist/agent-runtime-change.js +114 -0
  26. package/dist/agent-runtime-change.js.map +1 -0
  27. package/dist/agent-whats-new.js +5 -0
  28. package/dist/agent-whats-new.js.map +1 -1
  29. package/dist/agent-workspace.d.ts +104 -0
  30. package/dist/agent-workspace.js +381 -0
  31. package/dist/agent-workspace.js.map +1 -0
  32. package/dist/apply-job.d.ts +5 -0
  33. package/dist/apply-job.js +10 -3
  34. package/dist/apply-job.js.map +1 -1
  35. package/dist/auth-api.d.ts +81 -1
  36. package/dist/auth-api.js +365 -14
  37. package/dist/auth-api.js.map +1 -1
  38. package/dist/authority/company-join.d.ts +16 -0
  39. package/dist/authority/company-join.js +37 -0
  40. package/dist/authority/company-join.js.map +1 -0
  41. package/dist/authority/hub-initialization.d.ts +13 -0
  42. package/dist/authority/hub-initialization.js +30 -0
  43. package/dist/authority/hub-initialization.js.map +1 -0
  44. package/dist/authority/session-authorizations.d.ts +2 -0
  45. package/dist/authority/session-authorizations.js +7 -1
  46. package/dist/authority/session-authorizations.js.map +1 -1
  47. package/dist/authority/settings-role.d.ts +56 -0
  48. package/dist/authority/settings-role.js +48 -0
  49. package/dist/authority/settings-role.js.map +1 -0
  50. package/dist/authority/web-authority.d.ts +25 -2
  51. package/dist/authority/web-authority.js +37 -4
  52. package/dist/authority/web-authority.js.map +1 -1
  53. package/dist/backend/claude-code.d.ts +18 -12
  54. package/dist/backend/claude-code.js +228 -145
  55. package/dist/backend/claude-code.js.map +1 -1
  56. package/dist/backend/cli-env-probe.js +6 -2
  57. package/dist/backend/cli-env-probe.js.map +1 -1
  58. package/dist/backend/codex-footer-hints.d.ts +3 -0
  59. package/dist/backend/codex-footer-hints.js +14 -0
  60. package/dist/backend/codex-footer-hints.js.map +1 -1
  61. package/dist/backend/codex-package.d.ts +5 -2
  62. package/dist/backend/codex-package.js +1 -5
  63. package/dist/backend/codex-package.js.map +1 -1
  64. package/dist/backend/codex-quota-history.d.ts +7 -0
  65. package/dist/backend/codex-quota-history.js +57 -0
  66. package/dist/backend/codex-quota-history.js.map +1 -0
  67. package/dist/backend/codex-session-lookup.d.ts +6 -0
  68. package/dist/backend/codex-session-lookup.js +1 -1
  69. package/dist/backend/codex-session-lookup.js.map +1 -1
  70. package/dist/backend/codex.d.ts +148 -116
  71. package/dist/backend/codex.js +1355 -1225
  72. package/dist/backend/codex.js.map +1 -1
  73. package/dist/backend/credential-profile.d.ts +2 -0
  74. package/dist/backend/credential-profile.js +4 -1
  75. package/dist/backend/credential-profile.js.map +1 -1
  76. package/dist/backend/grok-model-cache.d.ts +7 -0
  77. package/dist/backend/grok-model-cache.js +65 -0
  78. package/dist/backend/grok-model-cache.js.map +1 -0
  79. package/dist/backend/grok-weekly-reset.d.ts +24 -0
  80. package/dist/backend/grok-weekly-reset.js +95 -0
  81. package/dist/backend/grok-weekly-reset.js.map +1 -0
  82. package/dist/backend/grok.d.ts +32 -1
  83. package/dist/backend/grok.js +323 -54
  84. package/dist/backend/grok.js.map +1 -1
  85. package/dist/backend/kiro.js +1 -1
  86. package/dist/backend/kiro.js.map +1 -1
  87. package/dist/backend/native-pane.d.ts +11 -0
  88. package/dist/backend/native-pane.js +59 -0
  89. package/dist/backend/native-pane.js.map +1 -0
  90. package/dist/backend/types.d.ts +25 -1
  91. package/dist/backend/types.js.map +1 -1
  92. package/dist/backend-availability.d.ts +15 -0
  93. package/dist/backend-availability.js +37 -1
  94. package/dist/backend-availability.js.map +1 -1
  95. package/dist/backend-signin-pending.d.ts +8 -2
  96. package/dist/backend-signin-pending.js +6 -2
  97. package/dist/backend-signin-pending.js.map +1 -1
  98. package/dist/browser-backend-signins.d.ts +2 -1
  99. package/dist/browser-backend-signins.js +1 -1
  100. package/dist/browser-backend-signins.js.map +1 -1
  101. package/dist/build-provenance-cli.d.ts +3 -0
  102. package/dist/build-provenance-cli.js +11 -0
  103. package/dist/build-provenance-cli.js.map +1 -0
  104. package/dist/build-provenance.d.ts +20 -0
  105. package/dist/build-provenance.js +67 -0
  106. package/dist/build-provenance.js.map +1 -0
  107. package/dist/build-provenance.json +1 -0
  108. package/dist/bundled-tmux-guard.d.ts +23 -0
  109. package/dist/bundled-tmux-guard.js +90 -0
  110. package/dist/bundled-tmux-guard.js.map +1 -0
  111. package/dist/cache-service.d.ts +6 -0
  112. package/dist/cache-service.js +105 -0
  113. package/dist/cache-service.js.map +1 -1
  114. package/dist/channel/access-manager.d.ts +1 -6
  115. package/dist/channel/access-manager.js +4 -94
  116. package/dist/channel/access-manager.js.map +1 -1
  117. package/dist/channel/adapters/discord.d.ts +0 -2
  118. package/dist/channel/adapters/discord.js +0 -8
  119. package/dist/channel/adapters/discord.js.map +1 -1
  120. package/dist/channel/adapters/telegram.d.ts +0 -3
  121. package/dist/channel/adapters/telegram.js +1 -30
  122. package/dist/channel/adapters/telegram.js.map +1 -1
  123. package/dist/channel/ipc-bridge.d.ts +2 -0
  124. package/dist/channel/mcp-tools.js +7 -7
  125. package/dist/channel/mcp-tools.js.map +1 -1
  126. package/dist/channel/types.d.ts +0 -2
  127. package/dist/classic-bindings.d.ts +13 -0
  128. package/dist/classic-bindings.js +28 -2
  129. package/dist/classic-bindings.js.map +1 -1
  130. package/dist/classic-channel-manager.d.ts +2 -0
  131. package/dist/classic-channel-manager.js +5 -1
  132. package/dist/classic-channel-manager.js.map +1 -1
  133. package/dist/claude-auth-status.d.ts +60 -0
  134. package/dist/claude-auth-status.js +165 -0
  135. package/dist/claude-auth-status.js.map +1 -0
  136. package/dist/claude-model-minimum.d.ts +7 -0
  137. package/dist/claude-model-minimum.js +16 -0
  138. package/dist/claude-model-minimum.js.map +1 -0
  139. package/dist/cli-audited.d.ts +60 -0
  140. package/dist/cli-audited.js +84 -0
  141. package/dist/cli-audited.js.map +1 -0
  142. package/dist/cli-capability.d.ts +217 -0
  143. package/dist/cli-capability.js +55 -0
  144. package/dist/cli-capability.js.map +1 -0
  145. package/dist/cli-caps-module.d.ts +33 -0
  146. package/dist/cli-caps-module.js +45 -0
  147. package/dist/cli-caps-module.js.map +1 -0
  148. package/dist/cli-registry-check.d.ts +28 -0
  149. package/dist/cli-registry-check.js +237 -0
  150. package/dist/cli-registry-check.js.map +1 -0
  151. package/dist/cli-registry.d.ts +578 -0
  152. package/dist/cli-registry.js +83 -0
  153. package/dist/cli-registry.js.map +1 -0
  154. package/dist/cli-spec-antigravity.d.ts +71 -0
  155. package/dist/cli-spec-antigravity.js +47 -0
  156. package/dist/cli-spec-antigravity.js.map +1 -0
  157. package/dist/cli-spec-claude-code.d.ts +93 -0
  158. package/dist/cli-spec-claude-code.js +37 -0
  159. package/dist/cli-spec-claude-code.js.map +1 -0
  160. package/dist/cli-spec-codex.d.ts +87 -0
  161. package/dist/cli-spec-codex.js +40 -0
  162. package/dist/cli-spec-codex.js.map +1 -0
  163. package/dist/cli-spec-grok.d.ts +64 -0
  164. package/dist/cli-spec-grok.js +40 -0
  165. package/dist/cli-spec-grok.js.map +1 -0
  166. package/dist/cli-spec-kiro-cli.d.ts +79 -0
  167. package/dist/cli-spec-kiro-cli.js +40 -0
  168. package/dist/cli-spec-kiro-cli.js.map +1 -0
  169. package/dist/cli-spec-muse.d.ts +54 -0
  170. package/dist/cli-spec-muse.js +40 -0
  171. package/dist/cli-spec-muse.js.map +1 -0
  172. package/dist/cli-spec-opencode.d.ts +60 -0
  173. package/dist/cli-spec-opencode.js +42 -0
  174. package/dist/cli-spec-opencode.js.map +1 -0
  175. package/dist/cli.js +286 -68
  176. package/dist/cli.js.map +1 -1
  177. package/dist/config-validator.js +99 -2
  178. package/dist/config-validator.js.map +1 -1
  179. package/dist/config.js +19 -1
  180. package/dist/config.js.map +1 -1
  181. package/dist/daemon.d.ts +165 -7
  182. package/dist/daemon.js +1307 -307
  183. package/dist/daemon.js.map +1 -1
  184. package/dist/dashboard-permissions.d.ts +8 -0
  185. package/dist/dashboard-permissions.js +16 -0
  186. package/dist/dashboard-permissions.js.map +1 -1
  187. package/dist/decision-list.d.ts +2 -0
  188. package/dist/decision-list.js +1 -1
  189. package/dist/decision-list.js.map +1 -1
  190. package/dist/delivery-consumed-watch.d.ts +15 -3
  191. package/dist/delivery-consumed-watch.js +23 -1
  192. package/dist/delivery-consumed-watch.js.map +1 -1
  193. package/dist/delivery-outbox.d.ts +5 -0
  194. package/dist/delivery-outbox.js +32 -4
  195. package/dist/delivery-outbox.js.map +1 -1
  196. package/dist/delivery-reconciliation.d.ts +2 -42
  197. package/dist/delivery-reconciliation.js +2 -164
  198. package/dist/delivery-reconciliation.js.map +1 -1
  199. package/dist/doctor.js +19 -9
  200. package/dist/doctor.js.map +1 -1
  201. package/dist/e2e-isolation.js +5 -2
  202. package/dist/e2e-isolation.js.map +1 -1
  203. package/dist/fleet-context.d.ts +7 -3
  204. package/dist/fleet-control-audit.d.ts +1 -1
  205. package/dist/fleet-level-config.d.ts +1 -1
  206. package/dist/fleet-level-config.js +2 -0
  207. package/dist/fleet-level-config.js.map +1 -1
  208. package/dist/fleet-manager.d.ts +1108 -27
  209. package/dist/fleet-manager.js +5735 -462
  210. package/dist/fleet-manager.js.map +1 -1
  211. package/dist/fleet-process-handlers.d.ts +1 -1
  212. package/dist/fleet-process-handlers.js +3 -2
  213. package/dist/fleet-process-handlers.js.map +1 -1
  214. package/dist/fleet-windows-runtime.d.ts +98 -0
  215. package/dist/fleet-windows-runtime.js +467 -0
  216. package/dist/fleet-windows-runtime.js.map +1 -0
  217. package/dist/general-binding.d.ts +85 -0
  218. package/dist/general-binding.js +298 -0
  219. package/dist/general-binding.js.map +1 -0
  220. package/dist/general-host-owner.d.ts +8 -0
  221. package/dist/general-host-owner.js +26 -0
  222. package/dist/general-host-owner.js.map +1 -0
  223. package/dist/general-instance.d.ts +7 -0
  224. package/dist/general-instance.js +20 -3
  225. package/dist/general-instance.js.map +1 -1
  226. package/dist/general-knowledge/skills/concepts/SKILL.md +101 -39
  227. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +23 -9
  228. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +9 -1
  229. package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +4 -1
  230. package/dist/general-knowledge/skills/fleet-config/SKILL.md +12 -0
  231. package/dist/general-knowledge/skills/fleet-health/SKILL.md +3 -3
  232. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +4 -0
  233. package/dist/general-knowledge/skills/session-management/SKILL.md +1 -1
  234. package/dist/general-knowledge/skills/tui-effort/SKILL.md +10 -10
  235. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +51 -33
  236. package/dist/general-knowledge/steering/core-rules.md +7 -5
  237. package/dist/general-role.d.ts +5 -0
  238. package/dist/general-role.js +27 -0
  239. package/dist/general-role.js.map +1 -0
  240. package/dist/hub/admission.d.ts +28 -0
  241. package/dist/hub/admission.js +62 -0
  242. package/dist/hub/admission.js.map +1 -0
  243. package/dist/hub/attachments/limits.d.ts +20 -0
  244. package/dist/hub/attachments/limits.js +48 -0
  245. package/dist/hub/attachments/limits.js.map +1 -0
  246. package/dist/hub/attachments/store.d.ts +116 -0
  247. package/dist/hub/attachments/store.js +246 -0
  248. package/dist/hub/attachments/store.js.map +1 -0
  249. package/dist/hub/audit/index.d.ts +62 -0
  250. package/dist/hub/audit/index.js +344 -0
  251. package/dist/hub/audit/index.js.map +1 -0
  252. package/dist/hub/browser-certificate.d.ts +38 -0
  253. package/dist/hub/browser-certificate.js +247 -0
  254. package/dist/hub/browser-certificate.js.map +1 -0
  255. package/dist/hub/buttons-model.d.ts +9 -0
  256. package/dist/hub/buttons-model.js +42 -0
  257. package/dist/hub/buttons-model.js.map +1 -0
  258. package/dist/hub/buttons.d.ts +54 -0
  259. package/dist/hub/buttons.js +348 -0
  260. package/dist/hub/buttons.js.map +1 -0
  261. package/dist/hub/catalog.d.ts +74 -0
  262. package/dist/hub/catalog.js +380 -0
  263. package/dist/hub/catalog.js.map +1 -0
  264. package/dist/hub/client.d.ts +69 -0
  265. package/dist/hub/client.js +304 -0
  266. package/dist/hub/client.js.map +1 -0
  267. package/dist/hub/compose/member.d.ts +145 -0
  268. package/dist/hub/compose/member.js +458 -0
  269. package/dist/hub/compose/member.js.map +1 -0
  270. package/dist/hub/compose/server.d.ts +167 -0
  271. package/dist/hub/compose/server.js +477 -0
  272. package/dist/hub/compose/server.js.map +1 -0
  273. package/dist/hub/compose/storage.d.ts +5 -0
  274. package/dist/hub/compose/storage.js +28 -0
  275. package/dist/hub/compose/storage.js.map +1 -0
  276. package/dist/hub/compose/views.d.ts +12 -0
  277. package/dist/hub/compose/views.js +4 -0
  278. package/dist/hub/compose/views.js.map +1 -0
  279. package/dist/hub/db.d.ts +58 -0
  280. package/dist/hub/db.js +215 -0
  281. package/dist/hub/db.js.map +1 -0
  282. package/dist/hub/directory/config.d.ts +39 -0
  283. package/dist/hub/directory/config.js +108 -0
  284. package/dist/hub/directory/config.js.map +1 -0
  285. package/dist/hub/directory/directory.d.ts +25 -0
  286. package/dist/hub/directory/directory.js +526 -0
  287. package/dist/hub/directory/directory.js.map +1 -0
  288. package/dist/hub/directory/groups.d.ts +41 -0
  289. package/dist/hub/directory/groups.js +30 -0
  290. package/dist/hub/directory/groups.js.map +1 -0
  291. package/dist/hub/directory/index.d.ts +8 -0
  292. package/dist/hub/directory/index.js +4 -0
  293. package/dist/hub/directory/index.js.map +1 -0
  294. package/dist/hub/directory/profiles.d.ts +41 -0
  295. package/dist/hub/directory/profiles.js +90 -0
  296. package/dist/hub/directory/profiles.js.map +1 -0
  297. package/dist/hub/directory/types.d.ts +83 -0
  298. package/dist/hub/directory/types.js +14 -0
  299. package/dist/hub/directory/types.js.map +1 -0
  300. package/dist/hub/directory-response-owner.d.ts +38 -0
  301. package/dist/hub/directory-response-owner.js +191 -0
  302. package/dist/hub/directory-response-owner.js.map +1 -0
  303. package/dist/hub/enrollment-budget.d.ts +6 -0
  304. package/dist/hub/enrollment-budget.js +24 -0
  305. package/dist/hub/enrollment-budget.js.map +1 -0
  306. package/dist/hub/execution/cli-provider.d.ts +23 -0
  307. package/dist/hub/execution/cli-provider.js +341 -0
  308. package/dist/hub/execution/cli-provider.js.map +1 -0
  309. package/dist/hub/execution/index.d.ts +13 -0
  310. package/dist/hub/execution/index.js +8 -0
  311. package/dist/hub/execution/index.js.map +1 -0
  312. package/dist/hub/execution/model-broker.d.ts +24 -0
  313. package/dist/hub/execution/model-broker.js +208 -0
  314. package/dist/hub/execution/model-broker.js.map +1 -0
  315. package/dist/hub/execution/provider-setup.d.ts +11 -0
  316. package/dist/hub/execution/provider-setup.js +21 -0
  317. package/dist/hub/execution/provider-setup.js.map +1 -0
  318. package/dist/hub/execution/sandbox-runner.d.ts +1 -0
  319. package/dist/hub/execution/sandbox-runner.js +221 -0
  320. package/dist/hub/execution/sandbox-runner.js.map +1 -0
  321. package/dist/hub/execution/service.d.ts +136 -0
  322. package/dist/hub/execution/service.js +459 -0
  323. package/dist/hub/execution/service.js.map +1 -0
  324. package/dist/hub/execution/store.d.ts +61 -0
  325. package/dist/hub/execution/store.js +182 -0
  326. package/dist/hub/execution/store.js.map +1 -0
  327. package/dist/hub/execution/views.d.ts +20 -0
  328. package/dist/hub/execution/views.js +48 -0
  329. package/dist/hub/execution/views.js.map +1 -0
  330. package/dist/hub/group-policy/admin-api.d.ts +30 -0
  331. package/dist/hub/group-policy/admin-api.js +83 -0
  332. package/dist/hub/group-policy/admin-api.js.map +1 -0
  333. package/dist/hub/group-policy/admin-context.d.ts +23 -0
  334. package/dist/hub/group-policy/admin-context.js +52 -0
  335. package/dist/hub/group-policy/admin-context.js.map +1 -0
  336. package/dist/hub/group-policy/admin-control.d.ts +34 -0
  337. package/dist/hub/group-policy/admin-control.js +258 -0
  338. package/dist/hub/group-policy/admin-control.js.map +1 -0
  339. package/dist/hub/group-policy/admin-dto.d.ts +249 -0
  340. package/dist/hub/group-policy/admin-dto.js +55 -0
  341. package/dist/hub/group-policy/admin-dto.js.map +1 -0
  342. package/dist/hub/group-policy/admin-facts.d.ts +17 -0
  343. package/dist/hub/group-policy/admin-facts.js +33 -0
  344. package/dist/hub/group-policy/admin-facts.js.map +1 -0
  345. package/dist/hub/group-policy/admin-impact.d.ts +51 -0
  346. package/dist/hub/group-policy/admin-impact.js +88 -0
  347. package/dist/hub/group-policy/admin-impact.js.map +1 -0
  348. package/dist/hub/group-policy/admin-inventory.d.ts +24 -0
  349. package/dist/hub/group-policy/admin-inventory.js +72 -0
  350. package/dist/hub/group-policy/admin-inventory.js.map +1 -0
  351. package/dist/hub/group-policy/admin-read.d.ts +21 -0
  352. package/dist/hub/group-policy/admin-read.js +95 -0
  353. package/dist/hub/group-policy/admin-read.js.map +1 -0
  354. package/dist/hub/group-policy/authorization.d.ts +65 -0
  355. package/dist/hub/group-policy/authorization.js +315 -0
  356. package/dist/hub/group-policy/authorization.js.map +1 -0
  357. package/dist/hub/group-policy/impact-inventory.d.ts +21 -0
  358. package/dist/hub/group-policy/impact-inventory.js +75 -0
  359. package/dist/hub/group-policy/impact-inventory.js.map +1 -0
  360. package/dist/hub/group-policy/model.d.ts +56 -0
  361. package/dist/hub/group-policy/model.js +46 -0
  362. package/dist/hub/group-policy/model.js.map +1 -0
  363. package/dist/hub/group-policy/resources.d.ts +72 -0
  364. package/dist/hub/group-policy/resources.js +260 -0
  365. package/dist/hub/group-policy/resources.js.map +1 -0
  366. package/dist/hub/group-policy/store.d.ts +69 -0
  367. package/dist/hub/group-policy/store.js +210 -0
  368. package/dist/hub/group-policy/store.js.map +1 -0
  369. package/dist/hub/group-policy/welcome.d.ts +36 -0
  370. package/dist/hub/group-policy/welcome.js +55 -0
  371. package/dist/hub/group-policy/welcome.js.map +1 -0
  372. package/dist/hub/http/compose.d.ts +24 -0
  373. package/dist/hub/http/compose.js +739 -0
  374. package/dist/hub/http/compose.js.map +1 -0
  375. package/dist/hub/http/core.d.ts +71 -0
  376. package/dist/hub/http/core.js +266 -0
  377. package/dist/hub/http/core.js.map +1 -0
  378. package/dist/hub/http/deps.d.ts +79 -0
  379. package/dist/hub/http/deps.js +2 -0
  380. package/dist/hub/http/deps.js.map +1 -0
  381. package/dist/hub/http/schema.d.ts +14 -0
  382. package/dist/hub/http/schema.js +84 -0
  383. package/dist/hub/http/schema.js.map +1 -0
  384. package/dist/hub/identity.d.ts +32 -0
  385. package/dist/hub/identity.js +80 -0
  386. package/dist/hub/identity.js.map +1 -0
  387. package/dist/hub/init/browser-certificate.d.ts +14 -0
  388. package/dist/hub/init/browser-certificate.js +99 -0
  389. package/dist/hub/init/browser-certificate.js.map +1 -0
  390. package/dist/hub/init/browser-tls.d.ts +18 -0
  391. package/dist/hub/init/browser-tls.js +62 -0
  392. package/dist/hub/init/browser-tls.js.map +1 -0
  393. package/dist/hub/init/cli.d.ts +3 -0
  394. package/dist/hub/init/cli.js +83 -0
  395. package/dist/hub/init/cli.js.map +1 -0
  396. package/dist/hub/init/directory-certificate.d.ts +24 -0
  397. package/dist/hub/init/directory-certificate.js +229 -0
  398. package/dist/hub/init/directory-certificate.js.map +1 -0
  399. package/dist/hub/init/existing-fleet.d.ts +6 -0
  400. package/dist/hub/init/existing-fleet.js +58 -0
  401. package/dist/hub/init/existing-fleet.js.map +1 -0
  402. package/dist/hub/init/handoff.d.ts +8 -0
  403. package/dist/hub/init/handoff.js +36 -0
  404. package/dist/hub/init/handoff.js.map +1 -0
  405. package/dist/hub/init/identity.d.ts +5 -0
  406. package/dist/hub/init/identity.js +24 -0
  407. package/dist/hub/init/identity.js.map +1 -0
  408. package/dist/hub/init/initializer.d.ts +34 -0
  409. package/dist/hub/init/initializer.js +504 -0
  410. package/dist/hub/init/initializer.js.map +1 -0
  411. package/dist/hub/init/inventory.d.ts +17 -0
  412. package/dist/hub/init/inventory.js +33 -0
  413. package/dist/hub/init/inventory.js.map +1 -0
  414. package/dist/hub/init/layout.d.ts +32 -0
  415. package/dist/hub/init/layout.js +53 -0
  416. package/dist/hub/init/layout.js.map +1 -0
  417. package/dist/hub/init/network.d.ts +18 -0
  418. package/dist/hub/init/network.js +104 -0
  419. package/dist/hub/init/network.js.map +1 -0
  420. package/dist/hub/init/plan-digest.d.ts +5 -0
  421. package/dist/hub/init/plan-digest.js +47 -0
  422. package/dist/hub/init/plan-digest.js.map +1 -0
  423. package/dist/hub/init/prompt.d.ts +26 -0
  424. package/dist/hub/init/prompt.js +110 -0
  425. package/dist/hub/init/prompt.js.map +1 -0
  426. package/dist/hub/init/secret-file.d.ts +1 -0
  427. package/dist/hub/init/secret-file.js +59 -0
  428. package/dist/hub/init/secret-file.js.map +1 -0
  429. package/dist/hub/init/text.d.ts +127 -0
  430. package/dist/hub/init/text.js +247 -0
  431. package/dist/hub/init/text.js.map +1 -0
  432. package/dist/hub/init/types.d.ts +142 -0
  433. package/dist/hub/init/types.js +9 -0
  434. package/dist/hub/init/types.js.map +1 -0
  435. package/dist/hub/init/web-audit-import.d.ts +12 -0
  436. package/dist/hub/init/web-audit-import.js +39 -0
  437. package/dist/hub/init/web-audit-import.js.map +1 -0
  438. package/dist/hub/init/web-audit.d.ts +30 -0
  439. package/dist/hub/init/web-audit.js +42 -0
  440. package/dist/hub/init/web-audit.js.map +1 -0
  441. package/dist/hub/init/web-error.d.ts +6 -0
  442. package/dist/hub/init/web-error.js +8 -0
  443. package/dist/hub/init/web-error.js.map +1 -0
  444. package/dist/hub/init/web-http.d.ts +9 -0
  445. package/dist/hub/init/web-http.js +103 -0
  446. package/dist/hub/init/web-http.js.map +1 -0
  447. package/dist/hub/init/web.d.ts +118 -0
  448. package/dist/hub/init/web.js +428 -0
  449. package/dist/hub/init/web.js.map +1 -0
  450. package/dist/hub/init/wizard.d.ts +34 -0
  451. package/dist/hub/init/wizard.js +552 -0
  452. package/dist/hub/init/wizard.js.map +1 -0
  453. package/dist/hub/initialization.d.ts +23 -0
  454. package/dist/hub/initialization.js +28 -0
  455. package/dist/hub/initialization.js.map +1 -0
  456. package/dist/hub/join/client.d.ts +35 -0
  457. package/dist/hub/join/client.js +112 -0
  458. package/dist/hub/join/client.js.map +1 -0
  459. package/dist/hub/join/descriptor.d.ts +45 -0
  460. package/dist/hub/join/descriptor.js +52 -0
  461. package/dist/hub/join/descriptor.js.map +1 -0
  462. package/dist/hub/join/fleet-authority.d.ts +2 -0
  463. package/dist/hub/join/fleet-authority.js +3 -0
  464. package/dist/hub/join/fleet-authority.js.map +1 -0
  465. package/dist/hub/join/http.d.ts +8 -0
  466. package/dist/hub/join/http.js +112 -0
  467. package/dist/hub/join/http.js.map +1 -0
  468. package/dist/hub/join/invitation.d.ts +28 -0
  469. package/dist/hub/join/invitation.js +28 -0
  470. package/dist/hub/join/invitation.js.map +1 -0
  471. package/dist/hub/join/local-journal.d.ts +84 -0
  472. package/dist/hub/join/local-journal.js +65 -0
  473. package/dist/hub/join/local-journal.js.map +1 -0
  474. package/dist/hub/join/local.d.ts +116 -0
  475. package/dist/hub/join/local.js +419 -0
  476. package/dist/hub/join/local.js.map +1 -0
  477. package/dist/hub/join/private.d.ts +3 -0
  478. package/dist/hub/join/private.js +46 -0
  479. package/dist/hub/join/private.js.map +1 -0
  480. package/dist/hub/join/protocol.d.ts +69 -0
  481. package/dist/hub/join/protocol.js +96 -0
  482. package/dist/hub/join/protocol.js.map +1 -0
  483. package/dist/hub/join/receipt.d.ts +42 -0
  484. package/dist/hub/join/receipt.js +75 -0
  485. package/dist/hub/join/receipt.js.map +1 -0
  486. package/dist/hub/join/service.d.ts +177 -0
  487. package/dist/hub/join/service.js +564 -0
  488. package/dist/hub/join/service.js.map +1 -0
  489. package/dist/hub/join/store.d.ts +97 -0
  490. package/dist/hub/join/store.js +87 -0
  491. package/dist/hub/join/store.js.map +1 -0
  492. package/dist/hub/join/trust.d.ts +13 -0
  493. package/dist/hub/join/trust.js +68 -0
  494. package/dist/hub/join/trust.js.map +1 -0
  495. package/dist/hub/member/agent-mode.d.ts +6 -0
  496. package/dist/hub/member/agent-mode.js +23 -0
  497. package/dist/hub/member/agent-mode.js.map +1 -0
  498. package/dist/hub/member/attachments.d.ts +29 -0
  499. package/dist/hub/member/attachments.js +107 -0
  500. package/dist/hub/member/attachments.js.map +1 -0
  501. package/dist/hub/member/exposure-api.d.ts +87 -0
  502. package/dist/hub/member/exposure-api.js +64 -0
  503. package/dist/hub/member/exposure-api.js.map +1 -0
  504. package/dist/hub/member/exposures.d.ts +123 -0
  505. package/dist/hub/member/exposures.js +282 -0
  506. package/dist/hub/member/exposures.js.map +1 -0
  507. package/dist/hub/member/pairing-api.d.ts +87 -0
  508. package/dist/hub/member/pairing-api.js +391 -0
  509. package/dist/hub/member/pairing-api.js.map +1 -0
  510. package/dist/hub/member/pairing-notices.d.ts +18 -0
  511. package/dist/hub/member/pairing-notices.js +60 -0
  512. package/dist/hub/member/pairing-notices.js.map +1 -0
  513. package/dist/hub/member/quota.d.ts +20 -0
  514. package/dist/hub/member/quota.js +98 -0
  515. package/dist/hub/member/quota.js.map +1 -0
  516. package/dist/hub/member-journal.d.ts +104 -0
  517. package/dist/hub/member-journal.js +336 -0
  518. package/dist/hub/member-journal.js.map +1 -0
  519. package/dist/hub/member-reconciliation.d.ts +14 -0
  520. package/dist/hub/member-reconciliation.js +97 -0
  521. package/dist/hub/member-reconciliation.js.map +1 -0
  522. package/dist/hub/mount.d.ts +48 -0
  523. package/dist/hub/mount.js +146 -0
  524. package/dist/hub/mount.js.map +1 -0
  525. package/dist/hub/pairing-client.d.ts +17 -0
  526. package/dist/hub/pairing-client.js +108 -0
  527. package/dist/hub/pairing-client.js.map +1 -0
  528. package/dist/hub/pairing-notices.d.ts +47 -0
  529. package/dist/hub/pairing-notices.js +246 -0
  530. package/dist/hub/pairing-notices.js.map +1 -0
  531. package/dist/hub/pairing.d.ts +105 -0
  532. package/dist/hub/pairing.js +514 -0
  533. package/dist/hub/pairing.js.map +1 -0
  534. package/dist/hub/policy.d.ts +65 -0
  535. package/dist/hub/policy.js +154 -0
  536. package/dist/hub/policy.js.map +1 -0
  537. package/dist/hub/preview.d.ts +32 -0
  538. package/dist/hub/preview.js +64 -0
  539. package/dist/hub/preview.js.map +1 -0
  540. package/dist/hub/private-files.d.ts +5 -0
  541. package/dist/hub/private-files.js +44 -0
  542. package/dist/hub/private-files.js.map +1 -0
  543. package/dist/hub/profile.d.ts +59 -0
  544. package/dist/hub/profile.js +73 -0
  545. package/dist/hub/profile.js.map +1 -0
  546. package/dist/hub/protocol.d.ts +840 -0
  547. package/dist/hub/protocol.js +100 -0
  548. package/dist/hub/protocol.js.map +1 -0
  549. package/dist/hub/quota.d.ts +24 -0
  550. package/dist/hub/quota.js +112 -0
  551. package/dist/hub/quota.js.map +1 -0
  552. package/dist/hub/representative.d.ts +141 -0
  553. package/dist/hub/representative.js +528 -0
  554. package/dist/hub/representative.js.map +1 -0
  555. package/dist/hub/retention.d.ts +17 -0
  556. package/dist/hub/retention.js +45 -0
  557. package/dist/hub/retention.js.map +1 -0
  558. package/dist/hub/room-read-pacer.d.ts +14 -0
  559. package/dist/hub/room-read-pacer.js +51 -0
  560. package/dist/hub/room-read-pacer.js.map +1 -0
  561. package/dist/hub/rooms.d.ts +127 -0
  562. package/dist/hub/rooms.js +597 -0
  563. package/dist/hub/rooms.js.map +1 -0
  564. package/dist/hub/runtime.d.ts +155 -0
  565. package/dist/hub/runtime.js +651 -0
  566. package/dist/hub/runtime.js.map +1 -0
  567. package/dist/hub/server.d.ts +61 -0
  568. package/dist/hub/server.js +235 -0
  569. package/dist/hub/server.js.map +1 -0
  570. package/dist/hub/service-start.d.ts +17 -0
  571. package/dist/hub/service-start.js +109 -0
  572. package/dist/hub/service-start.js.map +1 -0
  573. package/dist/hub/session-directory-transition.d.ts +48 -0
  574. package/dist/hub/session-directory-transition.js +118 -0
  575. package/dist/hub/session-directory-transition.js.map +1 -0
  576. package/dist/hub/session-epoch.d.ts +16 -0
  577. package/dist/hub/session-epoch.js +50 -0
  578. package/dist/hub/session-epoch.js.map +1 -0
  579. package/dist/hub/sessions.d.ts +66 -0
  580. package/dist/hub/sessions.js +217 -0
  581. package/dist/hub/sessions.js.map +1 -0
  582. package/dist/hub/settings-api.d.ts +50 -0
  583. package/dist/hub/settings-api.js +92 -0
  584. package/dist/hub/settings-api.js.map +1 -0
  585. package/dist/hub/settings-commit.d.ts +102 -0
  586. package/dist/hub/settings-commit.js +522 -0
  587. package/dist/hub/settings-commit.js.map +1 -0
  588. package/dist/hub/settings-directory-ca.d.ts +31 -0
  589. package/dist/hub/settings-directory-ca.js +115 -0
  590. package/dist/hub/settings-directory-ca.js.map +1 -0
  591. package/dist/hub/settings-directory-control.d.ts +58 -0
  592. package/dist/hub/settings-directory-control.js +117 -0
  593. package/dist/hub/settings-directory-control.js.map +1 -0
  594. package/dist/hub/settings-directory-decision.d.ts +465 -0
  595. package/dist/hub/settings-directory-decision.js +322 -0
  596. package/dist/hub/settings-directory-decision.js.map +1 -0
  597. package/dist/hub/settings-directory-host-http.d.ts +9 -0
  598. package/dist/hub/settings-directory-host-http.js +75 -0
  599. package/dist/hub/settings-directory-host-http.js.map +1 -0
  600. package/dist/hub/settings-directory-host-notice-http.d.ts +9 -0
  601. package/dist/hub/settings-directory-host-notice-http.js +78 -0
  602. package/dist/hub/settings-directory-host-notice-http.js.map +1 -0
  603. package/dist/hub/settings-directory-host-notices.d.ts +11 -0
  604. package/dist/hub/settings-directory-host-notices.js +39 -0
  605. package/dist/hub/settings-directory-host-notices.js.map +1 -0
  606. package/dist/hub/settings-directory-http.d.ts +33 -0
  607. package/dist/hub/settings-directory-http.js +109 -0
  608. package/dist/hub/settings-directory-http.js.map +1 -0
  609. package/dist/hub/settings-directory-mount.d.ts +24 -0
  610. package/dist/hub/settings-directory-mount.js +77 -0
  611. package/dist/hub/settings-directory-mount.js.map +1 -0
  612. package/dist/hub/settings-directory-notices.d.ts +61 -0
  613. package/dist/hub/settings-directory-notices.js +132 -0
  614. package/dist/hub/settings-directory-notices.js.map +1 -0
  615. package/dist/hub/settings-directory-proof.d.ts +77 -0
  616. package/dist/hub/settings-directory-proof.js +313 -0
  617. package/dist/hub/settings-directory-proof.js.map +1 -0
  618. package/dist/hub/settings-directory-recovery-intent.d.ts +13 -0
  619. package/dist/hub/settings-directory-recovery-intent.js +29 -0
  620. package/dist/hub/settings-directory-recovery-intent.js.map +1 -0
  621. package/dist/hub/settings-directory-recovery.d.ts +37 -0
  622. package/dist/hub/settings-directory-recovery.js +173 -0
  623. package/dist/hub/settings-directory-recovery.js.map +1 -0
  624. package/dist/hub/settings-directory-runtime.d.ts +17 -0
  625. package/dist/hub/settings-directory-runtime.js +2 -0
  626. package/dist/hub/settings-directory-runtime.js.map +1 -0
  627. package/dist/hub/settings-directory-save.d.ts +37 -0
  628. package/dist/hub/settings-directory-save.js +175 -0
  629. package/dist/hub/settings-directory-save.js.map +1 -0
  630. package/dist/hub/socket.d.ts +24 -0
  631. package/dist/hub/socket.js +79 -0
  632. package/dist/hub/socket.js.map +1 -0
  633. package/dist/hub/store.d.ts +87 -0
  634. package/dist/hub/store.js +92 -0
  635. package/dist/hub/store.js.map +1 -0
  636. package/dist/hub/tls.d.ts +31 -0
  637. package/dist/hub/tls.js +135 -0
  638. package/dist/hub/tls.js.map +1 -0
  639. package/dist/hub/types.d.ts +416 -0
  640. package/dist/hub/types.js +2 -0
  641. package/dist/hub/types.js.map +1 -0
  642. package/dist/hub/validation.d.ts +33 -0
  643. package/dist/hub/validation.js +136 -0
  644. package/dist/hub/validation.js.map +1 -0
  645. package/dist/hub/version-floor.d.ts +10 -0
  646. package/dist/hub/version-floor.js +45 -0
  647. package/dist/hub/version-floor.js.map +1 -0
  648. package/dist/hub-browser-certificate-policy.d.ts +31 -0
  649. package/dist/hub-browser-certificate-policy.js +25 -0
  650. package/dist/hub-browser-certificate-policy.js.map +1 -0
  651. package/dist/hub-host-settings.d.ts +48 -0
  652. package/dist/hub-host-settings.js +85 -0
  653. package/dist/hub-host-settings.js.map +1 -0
  654. package/dist/hub-membership-settings.d.ts +6 -0
  655. package/dist/hub-membership-settings.js +21 -0
  656. package/dist/hub-membership-settings.js.map +1 -0
  657. package/dist/hub-mode.d.ts +15 -0
  658. package/dist/hub-mode.js +17 -0
  659. package/dist/hub-mode.js.map +1 -0
  660. package/dist/hub-pairing-summary.d.ts +48 -0
  661. package/dist/hub-pairing-summary.js +36 -0
  662. package/dist/hub-pairing-summary.js.map +1 -0
  663. package/dist/hub-report-target.d.ts +32 -0
  664. package/dist/hub-report-target.js +33 -0
  665. package/dist/hub-report-target.js.map +1 -0
  666. package/dist/hub-retention-policy.d.ts +14 -0
  667. package/dist/hub-retention-policy.js +15 -0
  668. package/dist/hub-retention-policy.js.map +1 -0
  669. package/dist/instance-config-impact.js +9 -3
  670. package/dist/instance-config-impact.js.map +1 -1
  671. package/dist/instance-lifecycle.d.ts +52 -5
  672. package/dist/instance-lifecycle.js +493 -200
  673. package/dist/instance-lifecycle.js.map +1 -1
  674. package/dist/instructions.d.ts +2 -0
  675. package/dist/instructions.js +35 -6
  676. package/dist/instructions.js.map +1 -1
  677. package/dist/kiro-history-scan.d.ts +26 -0
  678. package/dist/kiro-history-scan.js +141 -0
  679. package/dist/kiro-history-scan.js.map +1 -0
  680. package/dist/kiro-history-worker.d.ts +1 -0
  681. package/dist/kiro-history-worker.js +9 -0
  682. package/dist/kiro-history-worker.js.map +1 -0
  683. package/dist/kiro-history.d.ts +20 -0
  684. package/dist/kiro-history.js +96 -0
  685. package/dist/kiro-history.js.map +1 -0
  686. package/dist/kiro-usage-run.d.ts +2 -0
  687. package/dist/kiro-usage-run.js +4 -1
  688. package/dist/kiro-usage-run.js.map +1 -1
  689. package/dist/launchd-service-domain.d.ts +5 -0
  690. package/dist/launchd-service-domain.js +21 -0
  691. package/dist/launchd-service-domain.js.map +1 -0
  692. package/dist/local-pane-endpoint.d.ts +46 -0
  693. package/dist/local-pane-endpoint.js +189 -0
  694. package/dist/local-pane-endpoint.js.map +1 -0
  695. package/dist/local-pane-launcher.d.ts +2 -0
  696. package/dist/local-pane-launcher.js +38 -0
  697. package/dist/local-pane-launcher.js.map +1 -0
  698. package/dist/local-pane-stage.ps1 +101 -0
  699. package/dist/locale.js +345 -99
  700. package/dist/locale.js.map +1 -1
  701. package/dist/logger.d.ts +5 -3
  702. package/dist/logger.js +323 -85
  703. package/dist/logger.js.map +1 -1
  704. package/dist/login-controller.d.ts +14 -1
  705. package/dist/login-controller.js +31 -1
  706. package/dist/login-controller.js.map +1 -1
  707. package/dist/login-flows.d.ts +21 -8
  708. package/dist/login-flows.js +40 -18
  709. package/dist/login-flows.js.map +1 -1
  710. package/dist/login-manager.d.ts +2 -2
  711. package/dist/login-manager.js +28 -6
  712. package/dist/login-manager.js.map +1 -1
  713. package/dist/login-window-lock.d.ts +2 -1
  714. package/dist/login-window-lock.js.map +1 -1
  715. package/dist/ls-rows.d.ts +1 -1
  716. package/dist/ls-rows.js +3 -4
  717. package/dist/ls-rows.js.map +1 -1
  718. package/dist/machine-accounts.d.ts +110 -0
  719. package/dist/machine-accounts.js +229 -0
  720. package/dist/machine-accounts.js.map +1 -0
  721. package/dist/machine-signins.d.ts +89 -0
  722. package/dist/machine-signins.js +182 -0
  723. package/dist/machine-signins.js.map +1 -0
  724. package/dist/model-catalog-defaults.d.ts +14 -0
  725. package/dist/model-catalog-defaults.js +20 -0
  726. package/dist/model-catalog-defaults.js.map +1 -0
  727. package/dist/muse-usage-relay.d.ts +2 -0
  728. package/dist/muse-usage-relay.js +5 -3
  729. package/dist/muse-usage-relay.js.map +1 -1
  730. package/dist/native-agent-admission.d.ts +7 -0
  731. package/dist/native-agent-admission.js +26 -0
  732. package/dist/native-agent-admission.js.map +1 -0
  733. package/dist/native-daemon-client.d.ts +13 -0
  734. package/dist/native-daemon-client.js +28 -0
  735. package/dist/native-daemon-client.js.map +1 -0
  736. package/dist/native-instance-api.d.ts +13 -0
  737. package/dist/native-instance-api.js +217 -0
  738. package/dist/native-instance-api.js.map +1 -0
  739. package/dist/native-instance-input.d.ts +87 -0
  740. package/dist/native-instance-input.js +59 -0
  741. package/dist/native-instance-input.js.map +1 -0
  742. package/dist/native-instance-registry.d.ts +38 -0
  743. package/dist/native-instance-registry.js +129 -0
  744. package/dist/native-instance-registry.js.map +1 -0
  745. package/dist/native-mcp.d.ts +43 -0
  746. package/dist/native-mcp.js +291 -0
  747. package/dist/native-mcp.js.map +1 -0
  748. package/dist/native-model-catalog.d.ts +25 -0
  749. package/dist/native-model-catalog.js +181 -0
  750. package/dist/native-model-catalog.js.map +1 -0
  751. package/dist/native-pane-crash-budget.d.ts +20 -0
  752. package/dist/native-pane-crash-budget.js +60 -0
  753. package/dist/native-pane-crash-budget.js.map +1 -0
  754. package/dist/native-pane-create.d.ts +26 -0
  755. package/dist/native-pane-create.js +53 -0
  756. package/dist/native-pane-create.js.map +1 -0
  757. package/dist/native-pane-lifecycle.d.ts +73 -0
  758. package/dist/native-pane-lifecycle.js +239 -0
  759. package/dist/native-pane-lifecycle.js.map +1 -0
  760. package/dist/native-pane-manager.d.ts +59 -0
  761. package/dist/native-pane-manager.js +592 -0
  762. package/dist/native-pane-manager.js.map +1 -0
  763. package/dist/native-pane-output-log.d.ts +15 -0
  764. package/dist/native-pane-output-log.js +108 -0
  765. package/dist/native-pane-output-log.js.map +1 -0
  766. package/dist/native-pane-reconciliation.d.ts +4 -0
  767. package/dist/native-pane-reconciliation.js +40 -0
  768. package/dist/native-pane-reconciliation.js.map +1 -0
  769. package/dist/native-pane-recovery.d.ts +12 -0
  770. package/dist/native-pane-recovery.js +10 -0
  771. package/dist/native-pane-recovery.js.map +1 -0
  772. package/dist/native-pane-tools.d.ts +2 -0
  773. package/dist/native-pane-tools.js +14 -0
  774. package/dist/native-pane-tools.js.map +1 -0
  775. package/dist/needs-you-hub.d.ts +8 -0
  776. package/dist/needs-you-hub.js +29 -3
  777. package/dist/needs-you-hub.js.map +1 -1
  778. package/dist/needs-you.d.ts +78 -2
  779. package/dist/needs-you.js +45 -2
  780. package/dist/needs-you.js.map +1 -1
  781. package/dist/office-levels.d.ts +4 -3
  782. package/dist/office-levels.js +3 -3
  783. package/dist/office-levels.js.map +1 -1
  784. package/dist/office-share-page.js +3 -3
  785. package/dist/office-share-page.js.map +1 -1
  786. package/dist/office-share.d.ts +11 -0
  787. package/dist/office-share.js +14 -0
  788. package/dist/office-share.js.map +1 -1
  789. package/dist/office-talk.d.ts +26 -0
  790. package/dist/office-talk.js +50 -0
  791. package/dist/office-talk.js.map +1 -0
  792. package/dist/outbound-handlers.d.ts +30 -2
  793. package/dist/outbound-handlers.js +156 -18
  794. package/dist/outbound-handlers.js.map +1 -1
  795. package/dist/outbound-schemas.d.ts +94 -1
  796. package/dist/outbound-schemas.js +44 -16
  797. package/dist/outbound-schemas.js.map +1 -1
  798. package/dist/pane-port.d.ts +118 -0
  799. package/dist/pane-port.js +2 -0
  800. package/dist/pane-port.js.map +1 -0
  801. package/dist/pane-quota-history.d.ts +9 -0
  802. package/dist/pane-quota-history.js +67 -0
  803. package/dist/pane-quota-history.js.map +1 -0
  804. package/dist/pause-marker.d.ts +1 -1
  805. package/dist/pause-marker.js +1 -1
  806. package/dist/pause-marker.js.map +1 -1
  807. package/dist/platform-general.d.ts +46 -0
  808. package/dist/platform-general.js +91 -0
  809. package/dist/platform-general.js.map +1 -0
  810. package/dist/profile-signins.d.ts +107 -0
  811. package/dist/profile-signins.js +249 -0
  812. package/dist/profile-signins.js.map +1 -0
  813. package/dist/public-web-gateway.js +17 -1
  814. package/dist/public-web-gateway.js.map +1 -1
  815. package/dist/public-web-link.d.ts +11 -0
  816. package/dist/public-web-link.js +13 -0
  817. package/dist/public-web-link.js.map +1 -1
  818. package/dist/quickstart-api.js +11 -7
  819. package/dist/quickstart-api.js.map +1 -1
  820. package/dist/quickstart.d.ts +14 -0
  821. package/dist/quickstart.js +72 -4
  822. package/dist/quickstart.js.map +1 -1
  823. package/dist/quiet-run.d.ts +31 -0
  824. package/dist/quiet-run.js +50 -0
  825. package/dist/quiet-run.js.map +1 -0
  826. package/dist/quota-notice-config.d.ts +22 -0
  827. package/dist/quota-notice-config.js +41 -0
  828. package/dist/quota-notice-config.js.map +1 -0
  829. package/dist/quota-notice.d.ts +7 -0
  830. package/dist/quota-notice.js +40 -0
  831. package/dist/quota-notice.js.map +1 -1
  832. package/dist/reply-buttons-controller.d.ts +5 -1
  833. package/dist/reply-buttons-controller.js +18 -10
  834. package/dist/reply-buttons-controller.js.map +1 -1
  835. package/dist/reply-buttons.d.ts +6 -2
  836. package/dist/reply-buttons.js +7 -3
  837. package/dist/reply-buttons.js.map +1 -1
  838. package/dist/reply-polls.d.ts +2 -2
  839. package/dist/reply-polls.js +3 -3
  840. package/dist/reply-polls.js.map +1 -1
  841. package/dist/runtime-api.d.ts +23 -0
  842. package/dist/runtime-api.js +413 -0
  843. package/dist/runtime-api.js.map +1 -0
  844. package/dist/runtime-assets/@xterm/addon-serialize/LICENSE +21 -0
  845. package/dist/runtime-assets/@xterm/addon-serialize/lib/addon-serialize.js +2 -0
  846. package/dist/runtime-assets/@xterm/addon-serialize/lib/addon-serialize.mjs +19 -0
  847. package/dist/runtime-assets/@xterm/addon-serialize/package.json +29 -0
  848. package/dist/runtime-assets/@xterm/headless/LICENSE +21 -0
  849. package/dist/runtime-assets/@xterm/headless/lib-headless/xterm-headless.js +2 -0
  850. package/dist/runtime-assets/@xterm/headless/lib-headless/xterm-headless.mjs +46 -0
  851. package/dist/runtime-assets/@xterm/headless/package.json +29 -0
  852. package/dist/runtime-assets/node-pty/CONPTY-LICENSE +21 -0
  853. package/dist/runtime-assets/node-pty/CONPTY-NOTICE.md +503 -0
  854. package/dist/runtime-assets/node-pty/LICENSE +69 -0
  855. package/dist/runtime-assets/node-pty/lib/conpty_console_list_agent.js +16 -0
  856. package/dist/runtime-assets/node-pty/lib/eventEmitter2.js +47 -0
  857. package/dist/runtime-assets/node-pty/lib/index.js +52 -0
  858. package/dist/runtime-assets/node-pty/lib/interfaces.js +7 -0
  859. package/dist/runtime-assets/node-pty/lib/shared/conout.js +11 -0
  860. package/dist/runtime-assets/node-pty/lib/terminal.js +190 -0
  861. package/dist/runtime-assets/node-pty/lib/types.js +7 -0
  862. package/dist/runtime-assets/node-pty/lib/unixTerminal.js +346 -0
  863. package/dist/runtime-assets/node-pty/lib/utils.js +39 -0
  864. package/dist/runtime-assets/node-pty/lib/windowsConoutConnection.js +125 -0
  865. package/dist/runtime-assets/node-pty/lib/windowsPtyAgent.js +320 -0
  866. package/dist/runtime-assets/node-pty/lib/windowsTerminal.js +199 -0
  867. package/dist/runtime-assets/node-pty/lib/worker/conoutSocketWorker.js +22 -0
  868. package/dist/runtime-assets/node-pty/package.json +64 -0
  869. package/dist/runtime-assets/node-pty/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
  870. package/dist/runtime-assets/node-pty/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
  871. package/dist/runtime-assets/node-pty/prebuilds/win32-arm64/conpty.node +0 -0
  872. package/dist/runtime-assets/node-pty/prebuilds/win32-arm64/conpty_console_list.node +0 -0
  873. package/dist/runtime-assets/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
  874. package/dist/runtime-assets/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
  875. package/dist/runtime-assets/node-pty/prebuilds/win32-x64/conpty.node +0 -0
  876. package/dist/runtime-assets/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
  877. package/dist/runtime-autostart.d.ts +61 -0
  878. package/dist/runtime-autostart.js +161 -0
  879. package/dist/runtime-autostart.js.map +1 -0
  880. package/dist/runtime-background.d.ts +200 -0
  881. package/dist/runtime-background.js +480 -0
  882. package/dist/runtime-background.js.map +1 -0
  883. package/dist/runtime-build-info.d.ts +10 -0
  884. package/dist/runtime-build-info.js +64 -0
  885. package/dist/runtime-build-info.js.map +1 -0
  886. package/dist/runtime-bundle.d.ts +22 -0
  887. package/dist/runtime-bundle.js +158 -0
  888. package/dist/runtime-bundle.js.map +1 -0
  889. package/dist/runtime-cli-background.d.ts +92 -0
  890. package/dist/runtime-cli-background.js +336 -0
  891. package/dist/runtime-cli-background.js.map +1 -0
  892. package/dist/runtime-cli-install.d.ts +295 -0
  893. package/dist/runtime-cli-install.js +869 -0
  894. package/dist/runtime-cli-install.js.map +1 -0
  895. package/dist/runtime-cli.d.ts +21 -0
  896. package/dist/runtime-cli.js +578 -0
  897. package/dist/runtime-cli.js.map +1 -0
  898. package/dist/runtime-client-store.d.ts +86 -0
  899. package/dist/runtime-client-store.js +387 -0
  900. package/dist/runtime-client-store.js.map +1 -0
  901. package/dist/runtime-client.d.ts +258 -0
  902. package/dist/runtime-client.js +1353 -0
  903. package/dist/runtime-client.js.map +1 -0
  904. package/dist/runtime-connection.d.ts +22 -0
  905. package/dist/runtime-connection.js +93 -0
  906. package/dist/runtime-connection.js.map +1 -0
  907. package/dist/runtime-coordinator.d.ts +201 -0
  908. package/dist/runtime-coordinator.js +1514 -0
  909. package/dist/runtime-coordinator.js.map +1 -0
  910. package/dist/runtime-credential-profiles.d.ts +89 -0
  911. package/dist/runtime-credential-profiles.js +304 -0
  912. package/dist/runtime-credential-profiles.js.map +1 -0
  913. package/dist/runtime-enroll-notice.d.ts +4 -0
  914. package/dist/runtime-enroll-notice.js +21 -0
  915. package/dist/runtime-enroll-notice.js.map +1 -0
  916. package/dist/runtime-enrollment.d.ts +21 -0
  917. package/dist/runtime-enrollment.js +52 -0
  918. package/dist/runtime-enrollment.js.map +1 -0
  919. package/dist/runtime-general-protocol.d.ts +22 -0
  920. package/dist/runtime-general-protocol.js +57 -0
  921. package/dist/runtime-general-protocol.js.map +1 -0
  922. package/dist/runtime-general-workspace.d.ts +17 -0
  923. package/dist/runtime-general-workspace.js +213 -0
  924. package/dist/runtime-general-workspace.js.map +1 -0
  925. package/dist/runtime-install.d.ts +50 -0
  926. package/dist/runtime-install.js +189 -0
  927. package/dist/runtime-install.js.map +1 -0
  928. package/dist/runtime-pane-assets.d.ts +17 -0
  929. package/dist/runtime-pane-assets.js +23 -0
  930. package/dist/runtime-pane-assets.js.map +1 -0
  931. package/dist/runtime-pane-boot.d.ts +9 -0
  932. package/dist/runtime-pane-boot.js +47 -0
  933. package/dist/runtime-pane-boot.js.map +1 -0
  934. package/dist/runtime-pane-codex-index.d.ts +10 -0
  935. package/dist/runtime-pane-codex-index.js +151 -0
  936. package/dist/runtime-pane-codex-index.js.map +1 -0
  937. package/dist/runtime-pane-config.d.ts +16 -0
  938. package/dist/runtime-pane-config.js +54 -0
  939. package/dist/runtime-pane-config.js.map +1 -0
  940. package/dist/runtime-pane-host.d.ts +63 -0
  941. package/dist/runtime-pane-host.js +467 -0
  942. package/dist/runtime-pane-host.js.map +1 -0
  943. package/dist/runtime-pane-job-owner.d.ts +1 -0
  944. package/dist/runtime-pane-job-owner.js +29 -0
  945. package/dist/runtime-pane-job-owner.js.map +1 -0
  946. package/dist/runtime-pane-job.ps1 +116 -0
  947. package/dist/runtime-pane-link.d.ts +47 -0
  948. package/dist/runtime-pane-link.js +338 -0
  949. package/dist/runtime-pane-link.js.map +1 -0
  950. package/dist/runtime-pane-mcp-protocol.d.ts +32 -0
  951. package/dist/runtime-pane-mcp-protocol.js +39 -0
  952. package/dist/runtime-pane-mcp-protocol.js.map +1 -0
  953. package/dist/runtime-pane-mcp-relay.d.ts +18 -0
  954. package/dist/runtime-pane-mcp-relay.js +80 -0
  955. package/dist/runtime-pane-mcp-relay.js.map +1 -0
  956. package/dist/runtime-pane-mcp.d.ts +55 -0
  957. package/dist/runtime-pane-mcp.js +153 -0
  958. package/dist/runtime-pane-mcp.js.map +1 -0
  959. package/dist/runtime-pane-native.d.ts +75 -0
  960. package/dist/runtime-pane-native.js +114 -0
  961. package/dist/runtime-pane-native.js.map +1 -0
  962. package/dist/runtime-pane-output.d.ts +19 -0
  963. package/dist/runtime-pane-output.js +53 -0
  964. package/dist/runtime-pane-output.js.map +1 -0
  965. package/dist/runtime-pane-port.d.ts +144 -0
  966. package/dist/runtime-pane-port.js +574 -0
  967. package/dist/runtime-pane-port.js.map +1 -0
  968. package/dist/runtime-pane-private.d.ts +14 -0
  969. package/dist/runtime-pane-private.js +51 -0
  970. package/dist/runtime-pane-private.js.map +1 -0
  971. package/dist/runtime-pane-private.ps1 +14 -0
  972. package/dist/runtime-pane-process.d.ts +4 -0
  973. package/dist/runtime-pane-process.js +117 -0
  974. package/dist/runtime-pane-process.js.map +1 -0
  975. package/dist/runtime-pane-protocol.d.ts +182 -0
  976. package/dist/runtime-pane-protocol.js +217 -0
  977. package/dist/runtime-pane-protocol.js.map +1 -0
  978. package/dist/runtime-pane-quota-history.d.ts +6 -0
  979. package/dist/runtime-pane-quota-history.js +44 -0
  980. package/dist/runtime-pane-quota-history.js.map +1 -0
  981. package/dist/runtime-pane-screen.d.ts +19 -0
  982. package/dist/runtime-pane-screen.js +76 -0
  983. package/dist/runtime-pane-screen.js.map +1 -0
  984. package/dist/runtime-pane-service.d.ts +16 -0
  985. package/dist/runtime-pane-service.js +256 -0
  986. package/dist/runtime-pane-service.js.map +1 -0
  987. package/dist/runtime-pane-stdio-protocol.d.ts +54 -0
  988. package/dist/runtime-pane-stdio-protocol.js +94 -0
  989. package/dist/runtime-pane-stdio-protocol.js.map +1 -0
  990. package/dist/runtime-pane-stdio.d.ts +3 -0
  991. package/dist/runtime-pane-stdio.js +123 -0
  992. package/dist/runtime-pane-stdio.js.map +1 -0
  993. package/dist/runtime-pane-store.d.ts +43 -0
  994. package/dist/runtime-pane-store.js +176 -0
  995. package/dist/runtime-pane-store.js.map +1 -0
  996. package/dist/runtime-pane-transcript-protocol.d.ts +43 -0
  997. package/dist/runtime-pane-transcript-protocol.js +58 -0
  998. package/dist/runtime-pane-transcript-protocol.js.map +1 -0
  999. package/dist/runtime-pane-transcript.d.ts +50 -0
  1000. package/dist/runtime-pane-transcript.js +666 -0
  1001. package/dist/runtime-pane-transcript.js.map +1 -0
  1002. package/dist/runtime-pane-worker.d.ts +1 -0
  1003. package/dist/runtime-pane-worker.js +167 -0
  1004. package/dist/runtime-pane-worker.js.map +1 -0
  1005. package/dist/runtime-profile-ownership.d.ts +66 -0
  1006. package/dist/runtime-profile-ownership.js +391 -0
  1007. package/dist/runtime-profile-ownership.js.map +1 -0
  1008. package/dist/runtime-protocol.d.ts +340 -0
  1009. package/dist/runtime-protocol.js +179 -0
  1010. package/dist/runtime-protocol.js.map +1 -0
  1011. package/dist/runtime-remote-accounts.d.ts +209 -0
  1012. package/dist/runtime-remote-accounts.js +714 -0
  1013. package/dist/runtime-remote-accounts.js.map +1 -0
  1014. package/dist/runtime-remote-setup.d.ts +108 -0
  1015. package/dist/runtime-remote-setup.js +532 -0
  1016. package/dist/runtime-remote-setup.js.map +1 -0
  1017. package/dist/runtime-signin-transport.d.ts +39 -0
  1018. package/dist/runtime-signin-transport.js +111 -0
  1019. package/dist/runtime-signin-transport.js.map +1 -0
  1020. package/dist/runtime-signin.d.ts +132 -0
  1021. package/dist/runtime-signin.js +290 -0
  1022. package/dist/runtime-signin.js.map +1 -0
  1023. package/dist/runtime-switches.d.ts +79 -0
  1024. package/dist/runtime-switches.js +90 -0
  1025. package/dist/runtime-switches.js.map +1 -0
  1026. package/dist/runtime-transcript-delta-reader.d.ts +23 -0
  1027. package/dist/runtime-transcript-delta-reader.js +74 -0
  1028. package/dist/runtime-transcript-delta-reader.js.map +1 -0
  1029. package/dist/runtime-transcript-source.d.ts +36 -0
  1030. package/dist/runtime-transcript-source.js +189 -0
  1031. package/dist/runtime-transcript-source.js.map +1 -0
  1032. package/dist/runtime-update-activity.d.ts +21 -0
  1033. package/dist/runtime-update-activity.js +51 -0
  1034. package/dist/runtime-update-activity.js.map +1 -0
  1035. package/dist/runtime-update-artifact.d.ts +31 -0
  1036. package/dist/runtime-update-artifact.js +252 -0
  1037. package/dist/runtime-update-artifact.js.map +1 -0
  1038. package/dist/runtime-update-attention.d.ts +4 -0
  1039. package/dist/runtime-update-attention.js +11 -0
  1040. package/dist/runtime-update-attention.js.map +1 -0
  1041. package/dist/runtime-update-controller.d.ts +86 -0
  1042. package/dist/runtime-update-controller.js +743 -0
  1043. package/dist/runtime-update-controller.js.map +1 -0
  1044. package/dist/runtime-update-install.d.ts +31 -0
  1045. package/dist/runtime-update-install.js +205 -0
  1046. package/dist/runtime-update-install.js.map +1 -0
  1047. package/dist/runtime-update-ipc.d.ts +42 -0
  1048. package/dist/runtime-update-ipc.js +144 -0
  1049. package/dist/runtime-update-ipc.js.map +1 -0
  1050. package/dist/runtime-update-journal.d.ts +49 -0
  1051. package/dist/runtime-update-journal.js +128 -0
  1052. package/dist/runtime-update-journal.js.map +1 -0
  1053. package/dist/runtime-update-lock.d.ts +48 -0
  1054. package/dist/runtime-update-lock.js +232 -0
  1055. package/dist/runtime-update-lock.js.map +1 -0
  1056. package/dist/runtime-update-owners.d.ts +29 -0
  1057. package/dist/runtime-update-owners.js +240 -0
  1058. package/dist/runtime-update-owners.js.map +1 -0
  1059. package/dist/runtime-update-protocol.d.ts +15 -0
  1060. package/dist/runtime-update-protocol.js +13 -0
  1061. package/dist/runtime-update-protocol.js.map +1 -0
  1062. package/dist/runtime-update-status.d.ts +30 -0
  1063. package/dist/runtime-update-status.js +31 -0
  1064. package/dist/runtime-update-status.js.map +1 -0
  1065. package/dist/runtime-windows-bridge.d.ts +42 -0
  1066. package/dist/runtime-windows-bridge.js +167 -0
  1067. package/dist/runtime-windows-bridge.js.map +1 -0
  1068. package/dist/scheduler/db.d.ts +10 -0
  1069. package/dist/scheduler/db.js +38 -11
  1070. package/dist/scheduler/db.js.map +1 -1
  1071. package/dist/scheduler/task-board-text.js +1 -1
  1072. package/dist/scheduler/task-board-text.js.map +1 -1
  1073. package/dist/scheduler/task-board.d.ts +13 -0
  1074. package/dist/scheduler/task-board.js +28 -3
  1075. package/dist/scheduler/task-board.js.map +1 -1
  1076. package/dist/scheduler/types.d.ts +6 -1
  1077. package/dist/service-drain.d.ts +19 -0
  1078. package/dist/service-drain.js +64 -0
  1079. package/dist/service-drain.js.map +1 -0
  1080. package/dist/service-installer.d.ts +7 -2
  1081. package/dist/service-installer.js +13 -10
  1082. package/dist/service-installer.js.map +1 -1
  1083. package/dist/settings-api.d.ts +36 -2
  1084. package/dist/settings-api.js +734 -9
  1085. package/dist/settings-api.js.map +1 -1
  1086. package/dist/settings-baseline.d.ts +7 -0
  1087. package/dist/settings-baseline.js +3 -1
  1088. package/dist/settings-baseline.js.map +1 -1
  1089. package/dist/settings-change.d.ts +5 -3
  1090. package/dist/settings-change.js +61 -1
  1091. package/dist/settings-change.js.map +1 -1
  1092. package/dist/settings-confirmation.d.ts +44 -7
  1093. package/dist/settings-confirmation.js +56 -14
  1094. package/dist/settings-confirmation.js.map +1 -1
  1095. package/dist/settings-effect.d.ts +22 -0
  1096. package/dist/settings-effect.js +294 -4
  1097. package/dist/settings-effect.js.map +1 -1
  1098. package/dist/settings-http-confirmation.d.ts +35 -0
  1099. package/dist/settings-http-confirmation.js +153 -13
  1100. package/dist/settings-http-confirmation.js.map +1 -1
  1101. package/dist/settings-instance-patch.js +1 -1
  1102. package/dist/settings-instance-patch.js.map +1 -1
  1103. package/dist/settings-request-capability.d.ts +14 -0
  1104. package/dist/settings-request-capability.js +12 -1
  1105. package/dist/settings-request-capability.js.map +1 -1
  1106. package/dist/settings-route-lifetime.d.ts +14 -0
  1107. package/dist/settings-route-lifetime.js +48 -0
  1108. package/dist/settings-route-lifetime.js.map +1 -0
  1109. package/dist/settings-transaction.d.ts +4 -0
  1110. package/dist/settings-transaction.js +9 -0
  1111. package/dist/settings-transaction.js.map +1 -1
  1112. package/dist/setup-form.js +6 -3
  1113. package/dist/setup-form.js.map +1 -1
  1114. package/dist/setup-host.js +1 -1
  1115. package/dist/setup-host.js.map +1 -1
  1116. package/dist/setup-i18n.js +7 -4
  1117. package/dist/setup-i18n.js.map +1 -1
  1118. package/dist/setup-wizard.js +4 -2
  1119. package/dist/setup-wizard.js.map +1 -1
  1120. package/dist/signin-keepalive.d.ts +207 -0
  1121. package/dist/signin-keepalive.js +682 -0
  1122. package/dist/signin-keepalive.js.map +1 -0
  1123. package/dist/structured-signin-transport.d.ts +20 -2
  1124. package/dist/structured-signin-transport.js +57 -2
  1125. package/dist/structured-signin-transport.js.map +1 -1
  1126. package/dist/structured-signin.d.ts +11 -2
  1127. package/dist/structured-signin.js +8 -8
  1128. package/dist/structured-signin.js.map +1 -1
  1129. package/dist/subagent-records.d.ts +45 -0
  1130. package/dist/subagent-records.js +214 -0
  1131. package/dist/subagent-records.js.map +1 -0
  1132. package/dist/subagent-service.d.ts +27 -0
  1133. package/dist/subagent-service.js +199 -0
  1134. package/dist/subagent-service.js.map +1 -0
  1135. package/dist/task-board-tool.d.ts +13 -1
  1136. package/dist/task-board-tool.js +104 -4
  1137. package/dist/task-board-tool.js.map +1 -1
  1138. package/dist/task-board-waker.d.ts +6 -0
  1139. package/dist/task-board-waker.js +4 -0
  1140. package/dist/task-board-waker.js.map +1 -1
  1141. package/dist/team-membership.d.ts +7 -0
  1142. package/dist/team-membership.js +10 -0
  1143. package/dist/team-membership.js.map +1 -0
  1144. package/dist/tips.js +4 -4
  1145. package/dist/tips.js.map +1 -1
  1146. package/dist/tmux-binary.d.ts +59 -0
  1147. package/dist/tmux-binary.js +189 -0
  1148. package/dist/tmux-binary.js.map +1 -0
  1149. package/dist/tmux-control.d.ts +2 -1
  1150. package/dist/tmux-control.js +4 -4
  1151. package/dist/tmux-control.js.map +1 -1
  1152. package/dist/tmux-exec-helper.js +32 -1
  1153. package/dist/tmux-exec-helper.js.map +1 -1
  1154. package/dist/tmux-legacy.d.ts +94 -0
  1155. package/dist/tmux-legacy.js +309 -0
  1156. package/dist/tmux-legacy.js.map +1 -0
  1157. package/dist/tmux-manager.d.ts +11 -4
  1158. package/dist/tmux-manager.js +64 -40
  1159. package/dist/tmux-manager.js.map +1 -1
  1160. package/dist/tmux-pane-host.d.ts +26 -0
  1161. package/dist/tmux-pane-host.js +25 -0
  1162. package/dist/tmux-pane-host.js.map +1 -0
  1163. package/dist/tmux-read.js +4 -3
  1164. package/dist/tmux-read.js.map +1 -1
  1165. package/dist/tmux-rollback.d.ts +31 -0
  1166. package/dist/tmux-rollback.js +72 -0
  1167. package/dist/tmux-rollback.js.map +1 -0
  1168. package/dist/tmux-server.d.ts +102 -0
  1169. package/dist/tmux-server.js +248 -0
  1170. package/dist/tmux-server.js.map +1 -0
  1171. package/dist/tool-permissions.d.ts +2 -3
  1172. package/dist/tool-permissions.js +5 -4
  1173. package/dist/tool-permissions.js.map +1 -1
  1174. package/dist/topic-commands.js +10 -6
  1175. package/dist/topic-commands.js.map +1 -1
  1176. package/dist/transcript-delta-reader.d.ts +1 -1
  1177. package/dist/transcript-delta-reader.js +1 -1
  1178. package/dist/transcript-delta-reader.js.map +1 -1
  1179. package/dist/transcript-monitor.d.ts +23 -0
  1180. package/dist/transcript-monitor.js +107 -49
  1181. package/dist/transcript-monitor.js.map +1 -1
  1182. package/dist/transcript-needles.d.ts +42 -0
  1183. package/dist/transcript-needles.js +166 -0
  1184. package/dist/transcript-needles.js.map +1 -0
  1185. package/dist/transcript-records.d.ts +22 -0
  1186. package/dist/transcript-records.js +144 -0
  1187. package/dist/transcript-records.js.map +1 -0
  1188. package/dist/transcript-sources.d.ts +5 -0
  1189. package/dist/transcript-sources.js +11 -79
  1190. package/dist/transcript-sources.js.map +1 -1
  1191. package/dist/types.d.ts +34 -0
  1192. package/dist/types.js.map +1 -1
  1193. package/dist/ui/account-identity.js +29 -0
  1194. package/dist/ui/accounts-keepalive.js +118 -0
  1195. package/dist/ui/accounts-manage.js +256 -0
  1196. package/dist/ui/accounts-view.js +460 -0
  1197. package/dist/ui/agent-proposals.js +90 -0
  1198. package/dist/ui/agent-runtime-settings.js +69 -0
  1199. package/dist/ui/agent-runtime.js +124 -0
  1200. package/dist/ui/app.html +8 -1
  1201. package/dist/ui/backend-signin.js +169 -97
  1202. package/dist/ui/chat-ambient.js +1 -1
  1203. package/dist/ui/chat-commands.js +7 -0
  1204. package/dist/ui/chat-md-strings.js +3 -9
  1205. package/dist/ui/chat-msg-actions.js +50 -4
  1206. package/dist/ui/chat-quote.js +256 -0
  1207. package/dist/ui/chat-render.js +3 -670
  1208. package/dist/ui/chat-store.js +23 -7
  1209. package/dist/ui/chat-strings.js +3 -285
  1210. package/dist/ui/chat-thread.js +3 -969
  1211. package/dist/ui/chat-time.js +3 -80
  1212. package/dist/ui/chat-tour.js +1 -1
  1213. package/dist/ui/cli-caps.js +15 -0
  1214. package/dist/ui/cli-picker.js +42 -0
  1215. package/dist/ui/credential-profile-select.js +54 -0
  1216. package/dist/ui/fleet-cache.js +3 -3
  1217. package/dist/ui/fleet-canvas.js +2 -2
  1218. package/dist/ui/fleet-office-dialogue.d.ts +30 -0
  1219. package/dist/ui/fleet-office-dialogue.js +382 -0
  1220. package/dist/ui/fleet-office-editor.js +1 -1
  1221. package/dist/ui/fleet-office-pack.d.ts +9 -0
  1222. package/dist/ui/fleet-office-pack.js +76 -4
  1223. package/dist/ui/fleet-office-skin.js +23 -5
  1224. package/dist/ui/fleet-office-store.js +5 -0
  1225. package/dist/ui/fleet-office.js +174 -7
  1226. package/dist/ui/fleet-org.js +2 -2
  1227. package/dist/ui/fleet-task-card.js +11 -7
  1228. package/dist/ui/fleet-task-common.js +18 -8
  1229. package/dist/ui/fleet-task-menu.js +188 -0
  1230. package/dist/ui/fleet-task-stats.js +124 -0
  1231. package/dist/ui/fleet-task-view.js +340 -0
  1232. package/dist/ui/fleet-tasks.js +131 -43
  1233. package/dist/ui/general-location.js +85 -0
  1234. package/dist/ui/host-install.js +290 -0
  1235. package/dist/ui/html-attachment.js +3 -40
  1236. package/dist/ui/hub-agent-copy.js +23 -0
  1237. package/dist/ui/hub-attachments.js +90 -0
  1238. package/dist/ui/hub-button-actions.js +65 -0
  1239. package/dist/ui/hub-chat-store.js +168 -0
  1240. package/dist/ui/hub-chat-strings.js +79 -0
  1241. package/dist/ui/hub-client.js +410 -0
  1242. package/dist/ui/hub-company-join-strings.js +77 -0
  1243. package/dist/ui/hub-company-join.js +137 -0
  1244. package/dist/ui/hub-directory-editor-strings.js +56 -0
  1245. package/dist/ui/hub-directory-editor.js +163 -0
  1246. package/dist/ui/hub-directory-notice-strings.js +28 -0
  1247. package/dist/ui/hub-directory-notices.js +66 -0
  1248. package/dist/ui/hub-grant-strings.js +13 -0
  1249. package/dist/ui/hub-group-policy.js +183 -0
  1250. package/dist/ui/hub-group-strings.js +110 -0
  1251. package/dist/ui/hub-host-security-notices.js +28 -0
  1252. package/dist/ui/hub-owner-strings.js +56 -0
  1253. package/dist/ui/hub-pairing-progress-strings.js +15 -0
  1254. package/dist/ui/hub-preview.js +101 -0
  1255. package/dist/ui/hub-provider-guidance.js +31 -0
  1256. package/dist/ui/hub-quick-pairing.js +209 -0
  1257. package/dist/ui/hub-quick-strings.js +43 -0
  1258. package/dist/ui/hub-quota.js +85 -0
  1259. package/dist/ui/hub-read-strings.js +7 -0
  1260. package/dist/ui/hub-strings.js +164 -0
  1261. package/dist/ui/hub-switcher.js +27 -0
  1262. package/dist/ui/hub-this-hub.js +113 -0
  1263. package/dist/ui/hub-welcome.js +102 -0
  1264. package/dist/ui/machine-signin.js +56 -0
  1265. package/dist/ui/model-picker.js +68 -0
  1266. package/dist/ui/native-instance-settings.js +44 -0
  1267. package/dist/ui/native-pane-recovery.js +45 -0
  1268. package/dist/ui/office-share-page.js +4 -2
  1269. package/dist/ui/panel-chat.js +167 -87
  1270. package/dist/ui/panel-details.js +3 -2
  1271. package/dist/ui/panel-fleet.js +183 -32
  1272. package/dist/ui/panel-hub.js +974 -0
  1273. package/dist/ui/panel-log.js +4 -4
  1274. package/dist/ui/panel-needs.js +179 -13
  1275. package/dist/ui/panel-notices.js +4 -3
  1276. package/dist/ui/panel-runtimes.js +645 -0
  1277. package/dist/ui/panel-settings.js +292 -201
  1278. package/dist/ui/panel-windows-agent.js +87 -0
  1279. package/dist/ui/panel-windows-cli.js +189 -0
  1280. package/dist/ui/preview-pages.js +3 -41
  1281. package/dist/ui/preview-panel-actions.js +3 -161
  1282. package/dist/ui/preview-panel.js +11 -548
  1283. package/dist/ui/preview-versions.js +3 -155
  1284. package/dist/ui/preview.js +3 -476
  1285. package/dist/ui/provider-marks.js +83 -0
  1286. package/dist/ui/runtime-catalog.js +55 -0
  1287. package/dist/ui/runtime-cli-install.js +214 -0
  1288. package/dist/ui/runtime-commands.d.ts +6 -0
  1289. package/dist/ui/runtime-commands.js +92 -0
  1290. package/dist/ui/runtime-update-commands.d.ts +2 -0
  1291. package/dist/ui/runtime-update-commands.js +11 -0
  1292. package/dist/ui/runtime-update-status.js +53 -0
  1293. package/dist/ui/search-dialog.js +6 -2
  1294. package/dist/ui/settings-access-strings.js +42 -0
  1295. package/dist/ui/settings-agent-filters.js +94 -0
  1296. package/dist/ui/settings-appearance.js +122 -23
  1297. package/dist/ui/settings-apply.js +12 -5
  1298. package/dist/ui/settings-build-version.js +35 -0
  1299. package/dist/ui/settings-catalog.js +57 -13
  1300. package/dist/ui/settings-confirm.js +108 -10
  1301. package/dist/ui/settings-devices.js +283 -0
  1302. package/dist/ui/settings-dialogs.js +72 -28
  1303. package/dist/ui/settings-guests.js +29 -14
  1304. package/dist/ui/settings-hub-browser-certificate.js +76 -0
  1305. package/dist/ui/settings-hub-company-join.js +165 -0
  1306. package/dist/ui/settings-hub-connection.js +121 -0
  1307. package/dist/ui/settings-hub-directory.js +29 -0
  1308. package/dist/ui/settings-hub-membership.js +93 -0
  1309. package/dist/ui/settings-hub-preview.js +74 -0
  1310. package/dist/ui/settings-hub-retention.js +54 -0
  1311. package/dist/ui/settings-hub-run.js +61 -0
  1312. package/dist/ui/settings-hub-section.js +63 -0
  1313. package/dist/ui/settings-hub-setup-strings.js +70 -0
  1314. package/dist/ui/settings-hub-setup.js +195 -0
  1315. package/dist/ui/settings-hub.js +266 -0
  1316. package/dist/ui/settings-layout.js +246 -0
  1317. package/dist/ui/settings-model.js +10 -1
  1318. package/dist/ui/settings-named-test.js +2 -2
  1319. package/dist/ui/settings-outside.js +310 -0
  1320. package/dist/ui/settings-quota-notice.js +102 -0
  1321. package/dist/ui/settings-registry.js +26 -6
  1322. package/dist/ui/settings-restart-strings.js +17 -0
  1323. package/dist/ui/settings-revoke-strings.js +28 -0
  1324. package/dist/ui/settings-shared-strings.js +143 -0
  1325. package/dist/ui/settings-shared.js +345 -0
  1326. package/dist/ui/settings-shortcuts.js +65 -0
  1327. package/dist/ui/settings-strings.js +146 -71
  1328. package/dist/ui/settings-update.js +69 -0
  1329. package/dist/ui/settings-web-authority.js +29 -15
  1330. package/dist/ui/shared/accounts-keepalive.css +12 -0
  1331. package/dist/ui/shared/accounts.css +88 -0
  1332. package/dist/ui/shared/agend-auth.js +8 -1
  1333. package/dist/ui/shared/app-i18n.js +25 -18
  1334. package/dist/ui/shared/app-route.js +12 -3
  1335. package/dist/ui/shared/app-session.js +13 -12
  1336. package/dist/ui/shared/app-shell.js +320 -48
  1337. package/dist/ui/shared/app-store.js +3 -2
  1338. package/dist/ui/shared/app-stream.js +3 -1
  1339. package/dist/ui/shared/app-update.js +215 -0
  1340. package/dist/ui/shared/app.css +1542 -8
  1341. package/dist/ui/shared/app.js +18 -4
  1342. package/dist/ui/shared/chat-composer.js +68 -0
  1343. package/dist/ui/shared/chat-md-strings.js +9 -0
  1344. package/dist/ui/shared/chat-render.js +682 -0
  1345. package/dist/ui/shared/chat-strings.js +333 -0
  1346. package/dist/ui/shared/chat-thread.js +969 -0
  1347. package/dist/ui/shared/chat-time.js +80 -0
  1348. package/dist/ui/shared/device-roles.js +27 -0
  1349. package/dist/ui/shared/header-tools.js +9 -9
  1350. package/dist/ui/shared/host-install.css +10 -0
  1351. package/dist/ui/shared/html-attachment.js +42 -0
  1352. package/dist/ui/shared/hub-chat.css +98 -0
  1353. package/dist/ui/shared/hub-groups.css +28 -0
  1354. package/dist/ui/shared/hub-owner.css +57 -0
  1355. package/dist/ui/shared/hub-quota.css +8 -0
  1356. package/dist/ui/shared/hub-signin.css +24 -0
  1357. package/dist/ui/shared/hub.css +78 -0
  1358. package/dist/ui/shared/instance-nav.js +35 -8
  1359. package/dist/ui/shared/instance-switch.js +4 -3
  1360. package/dist/ui/shared/loading.css +37 -0
  1361. package/dist/ui/shared/machine-name.js +13 -0
  1362. package/dist/ui/shared/model-picker.css +21 -0
  1363. package/dist/ui/shared/page-head.js +8 -0
  1364. package/dist/ui/shared/preview-pages.js +41 -0
  1365. package/dist/ui/shared/preview-panel-actions.js +168 -0
  1366. package/dist/ui/shared/preview-panel.js +565 -0
  1367. package/dist/ui/shared/preview-versions.js +155 -0
  1368. package/dist/ui/shared/preview.js +476 -0
  1369. package/dist/ui/shared/qrcode.module.js +2237 -0
  1370. package/dist/ui/shared/runtime-install.css +55 -0
  1371. package/dist/ui/shared/settings-width.js +31 -0
  1372. package/dist/ui/shared/setup-host-text.js +8 -5
  1373. package/dist/ui/shared/side-rail.js +15 -0
  1374. package/dist/ui/shared/signin-authenticator.js +60 -0
  1375. package/dist/ui/shared/signin.js +315 -25
  1376. package/dist/ui/shared/subagent-row.css +15 -0
  1377. package/dist/ui/shared/task-board.css +95 -0
  1378. package/dist/ui/shared/tokens.css +1 -0
  1379. package/dist/ui/shared/ui-dialog.js +2 -2
  1380. package/dist/ui/shared/ui-menu.js +30 -10
  1381. package/dist/ui/shared/ui-states.js +14 -3
  1382. package/dist/ui/shared/usage-dialog.js +4 -73
  1383. package/dist/ui/shared/usage-meter.js +84 -0
  1384. package/dist/ui/shared/vendor/qrcode-generator.LICENSE +27 -0
  1385. package/dist/ui/shared/vendor/vendor.json +19 -2
  1386. package/dist/ui/shared/view-strings.js +26 -18
  1387. package/dist/ui/shared/web-authorize.js +55 -5
  1388. package/dist/ui/shared/workspace-follow.css +19 -0
  1389. package/dist/ui/shared/workspace.css +20 -0
  1390. package/dist/ui/signin-authenticator.html +60 -0
  1391. package/dist/ui/signin.html +27 -2
  1392. package/dist/ui/structured-signin.js +89 -39
  1393. package/dist/ui/subagent-row.js +72 -0
  1394. package/dist/ui/web-terminal/terminal.js +9 -9
  1395. package/dist/ui/windows-agents-nav.js +2 -0
  1396. package/dist/ui/windows-cli-catalog.js +108 -0
  1397. package/dist/ui/workspace-follow-strings.js +28 -0
  1398. package/dist/ui/workspace-panel.js +378 -0
  1399. package/dist/ui/workspace-strings.js +35 -0
  1400. package/dist/unattended-install.d.ts +11 -2
  1401. package/dist/unattended-install.js +41 -6
  1402. package/dist/unattended-install.js.map +1 -1
  1403. package/dist/update-dispatch.d.ts +32 -4
  1404. package/dist/update-dispatch.js +146 -16
  1405. package/dist/update-dispatch.js.map +1 -1
  1406. package/dist/update-install.d.ts +7 -0
  1407. package/dist/update-install.js +23 -0
  1408. package/dist/update-install.js.map +1 -1
  1409. package/dist/update-launch.d.ts +1 -1
  1410. package/dist/update-launch.js +6 -3
  1411. package/dist/update-launch.js.map +1 -1
  1412. package/dist/update-marker.d.ts +4 -2
  1413. package/dist/update-marker.js +4 -3
  1414. package/dist/update-marker.js.map +1 -1
  1415. package/dist/update-npm-env.d.ts +70 -0
  1416. package/dist/update-npm-env.js +128 -0
  1417. package/dist/update-npm-env.js.map +1 -0
  1418. package/dist/usage/providers.d.ts +8 -0
  1419. package/dist/usage/providers.js +36 -26
  1420. package/dist/usage/providers.js.map +1 -1
  1421. package/dist/usage/quota-notices.d.ts +38 -0
  1422. package/dist/usage/quota-notices.js +160 -0
  1423. package/dist/usage/quota-notices.js.map +1 -0
  1424. package/dist/usage/usage-api.d.ts +2 -1
  1425. package/dist/usage/usage-api.js +19 -10
  1426. package/dist/usage/usage-api.js.map +1 -1
  1427. package/dist/usage-rollup.d.ts +3 -0
  1428. package/dist/usage-rollup.js +2 -0
  1429. package/dist/usage-rollup.js.map +1 -1
  1430. package/dist/view-api.d.ts +2 -8
  1431. package/dist/view-api.js +8 -16
  1432. package/dist/view-api.js.map +1 -1
  1433. package/dist/web-api.d.ts +163 -3
  1434. package/dist/web-api.js +1391 -32
  1435. package/dist/web-api.js.map +1 -1
  1436. package/dist/web-auth.js +2 -1
  1437. package/dist/web-auth.js.map +1 -1
  1438. package/dist/web-backend-login.d.ts +39 -3
  1439. package/dist/web-backend-login.js +25 -17
  1440. package/dist/web-backend-login.js.map +1 -1
  1441. package/dist/web-channel-echo.js +3 -1
  1442. package/dist/web-channel-echo.js.map +1 -1
  1443. package/dist/web-chat-history.d.ts +19 -2
  1444. package/dist/web-chat-history.js +72 -3
  1445. package/dist/web-chat-history.js.map +1 -1
  1446. package/dist/web-commands.d.ts +9 -1
  1447. package/dist/web-commands.js +7 -1
  1448. package/dist/web-commands.js.map +1 -1
  1449. package/dist/web-device-login.d.ts +153 -0
  1450. package/dist/web-device-login.js +278 -0
  1451. package/dist/web-device-login.js.map +1 -0
  1452. package/dist/web-host-install.d.ts +127 -0
  1453. package/dist/web-host-install.js +165 -0
  1454. package/dist/web-host-install.js.map +1 -0
  1455. package/dist/web-login.d.ts +35 -1
  1456. package/dist/web-login.js +51 -5
  1457. package/dist/web-login.js.map +1 -1
  1458. package/dist/web-notices.d.ts +9 -0
  1459. package/dist/web-notices.js +19 -0
  1460. package/dist/web-notices.js.map +1 -1
  1461. package/dist/web-office-skins.d.ts +9 -0
  1462. package/dist/web-office-skins.js +16 -1
  1463. package/dist/web-office-skins.js.map +1 -1
  1464. package/dist/web-only-fleet.d.ts +20 -0
  1465. package/dist/web-only-fleet.js +21 -0
  1466. package/dist/web-only-fleet.js.map +1 -1
  1467. package/dist/web-remote-access.d.ts +273 -0
  1468. package/dist/web-remote-access.js +610 -0
  1469. package/dist/web-remote-access.js.map +1 -0
  1470. package/dist/web-session.d.ts +61 -0
  1471. package/dist/web-session.js +47 -1
  1472. package/dist/web-session.js.map +1 -1
  1473. package/dist/web-settings-patch.d.ts +3 -1
  1474. package/dist/web-settings-patch.js +4 -1
  1475. package/dist/web-settings-patch.js.map +1 -1
  1476. package/dist/web-shell-routes.d.ts +10 -1
  1477. package/dist/web-shell-routes.js +14 -2
  1478. package/dist/web-shell-routes.js.map +1 -1
  1479. package/dist/web-signin-device.d.ts +16 -0
  1480. package/dist/web-signin-device.js +81 -0
  1481. package/dist/web-signin-device.js.map +1 -0
  1482. package/dist/web-signin-link.d.ts +42 -0
  1483. package/dist/web-signin-link.js +110 -0
  1484. package/dist/web-signin-link.js.map +1 -0
  1485. package/dist/web-terminal.d.ts +11 -30
  1486. package/dist/web-terminal.js +23 -8
  1487. package/dist/web-terminal.js.map +1 -1
  1488. package/dist/web-update.d.ts +78 -0
  1489. package/dist/web-update.js +106 -0
  1490. package/dist/web-update.js.map +1 -0
  1491. package/dist/windows-agents.d.ts +127 -0
  1492. package/dist/windows-agents.js +491 -0
  1493. package/dist/windows-agents.js.map +1 -0
  1494. package/dist/windows-cli-api.d.ts +48 -0
  1495. package/dist/windows-cli-api.js +207 -0
  1496. package/dist/windows-cli-api.js.map +1 -0
  1497. package/dist/windows-cli-providers.d.ts +109 -0
  1498. package/dist/windows-cli-providers.js +396 -0
  1499. package/dist/windows-cli-providers.js.map +1 -0
  1500. package/dist/windows-cli-worker.d.ts +99 -0
  1501. package/dist/windows-cli-worker.js +729 -0
  1502. package/dist/windows-cli-worker.js.map +1 -0
  1503. package/dist/windows-cli.d.ts +130 -0
  1504. package/dist/windows-cli.js +424 -0
  1505. package/dist/windows-cli.js.map +1 -0
  1506. package/dist/windows-native-mcp.d.ts +19 -0
  1507. package/dist/windows-native-mcp.js +143 -0
  1508. package/dist/windows-native-mcp.js.map +1 -0
  1509. package/dist/windows-pane-mcp.d.ts +26 -0
  1510. package/dist/windows-pane-mcp.js +187 -0
  1511. package/dist/windows-pane-mcp.js.map +1 -0
  1512. package/dist/workspace-follow-parse.d.ts +36 -0
  1513. package/dist/workspace-follow-parse.js +208 -0
  1514. package/dist/workspace-follow-parse.js.map +1 -0
  1515. package/dist/workspace-follow-records.d.ts +17 -0
  1516. package/dist/workspace-follow-records.js +88 -0
  1517. package/dist/workspace-follow-records.js.map +1 -0
  1518. package/dist/workspace-follow.d.ts +41 -0
  1519. package/dist/workspace-follow.js +143 -0
  1520. package/dist/workspace-follow.js.map +1 -0
  1521. package/dist/wsl-detect.d.ts +1 -0
  1522. package/dist/wsl-detect.js +20 -0
  1523. package/dist/wsl-detect.js.map +1 -0
  1524. package/dist/yaml-shared-nodes.js +8 -3
  1525. package/dist/yaml-shared-nodes.js.map +1 -1
  1526. package/launcher/agend-install.cjs +24 -4
  1527. package/launcher/launchd-session-type.cjs +14 -0
  1528. package/launcher/postinstall.cjs +27 -2
  1529. package/launcher/tmux-bundle.cjs +263 -0
  1530. package/package.json +16 -4
  1531. package/templates/launchd.plist.ejs +3 -1
  1532. package/templates/runtime-assets/conpty-LICENSE +21 -0
  1533. package/templates/runtime-assets/conpty-NOTICE.md +503 -0
  1534. package/templates/runtime-assets/local-pane-stage.ps1 +101 -0
  1535. package/templates/runtime-assets/runtime-pane-job.ps1 +116 -0
  1536. package/templates/runtime-assets/runtime-pane-private.ps1 +14 -0
  1537. package/templates/runtime-assets/xterm-LICENSE +21 -0
  1538. package/templates/runtime-install/install.ps1 +618 -0
@@ -0,0 +1,1353 @@
1
+ /** Standalone, outbound-only native runtime. Imports no Fleet, database, bot or Linux native dependency. */
2
+ import WebSocket from "ws";
3
+ import { readPaneSystemBootId, reusedRuntimeLockPid } from "./runtime-pane-boot.js";
4
+ import { createServer } from "node:http";
5
+ import { hostname } from "node:os";
6
+ import { randomBytes, randomUUID } from "node:crypto";
7
+ import { join } from "node:path";
8
+ import { readFileSync } from "node:fs";
9
+ import { WindowsCliBridge, nativeWindowsTransport, WINDOWS_CLI_INVENTORY_FILE } from "./windows-cli.js";
10
+ import { refreshNativeModels, probeCredentialProfileStatus, validateNativeTask, validWindowsAgentId } from "./windows-cli-worker.js";
11
+ import { validNativeSessionId } from "./windows-cli-providers.js";
12
+ import { RUNTIME_CREDENTIAL_CAPABILITY, credentialLoginRequired, credentialProfileReport, isCredentialProfileCli, listCredentialProfileNames, rememberCredentialStatus, requireCredentialProfile, credentialCacheStamp, assertCredentialProfileName, assertCredentialProfileCli } from "./runtime-credential-profiles.js";
13
+ import { runtimeJobDigest, validateRuntimeServer } from "./runtime-client-store.js";
14
+ import { RUNTIME_ROTATE_PATH, RUNTIME_REINSTALL_CLOSE_PREFIX, runtimeClaimFingerprint, RUNTIME_ENROLL_HELLO_PATH, RUNTIME_ENROLL_PATH, RUNTIME_ENROLL_TOKEN_PATTERN, RUNTIME_SERVER_FINGERPRINT_PATTERN, RUNTIME_ENROLL_REFUSALS, runtimeEnrollHelloMessage, verifyRuntimeServerProof, runtimeEnrollTokenId, newRuntimeEnrollEphemeral, runtimeEnrollChannel, sealRuntimeEnroll, openRuntimeEnroll } from "./runtime-protocol.js";
15
+ import { readRuntimeInfo } from "./runtime-build-info.js";
16
+ import { ProcessNotConfirmedEnded, RemoteAccounts } from "./runtime-remote-accounts.js";
17
+ import { isCreatedProfile } from "./runtime-profile-ownership.js";
18
+ import { killTree } from "./runtime-signin.js";
19
+ import { CLI_INSTALL_CAPABILITY, CLI_UPDATE_CAPABILITY, MODEL_REFRESH_CAPABILITY, REMOTE_SIGNIN_CAPABILITY } from "./runtime-remote-setup.js";
20
+ import { managedCliRoot, managedInstaller, nativeInstallSupported } from "./runtime-cli-install.js";
21
+ import { isRuntimeRemoteOperation } from "./runtime-protocol.js";
22
+ import { PANE_IN_PROCESS_DIRECTORY, paneLedgerFiles } from "./runtime-pane-store.js";
23
+ import { findCli, nativeCliEnvironment } from "./windows-cli-worker.js";
24
+ import { spawn as childSpawn } from "./child-process.js";
25
+ import { RuntimeUpdateActivity } from "./runtime-update-activity.js";
26
+ import { parseRuntimeUpdateControl, RUNTIME_MANAGED_UPDATE_CAPABILITY, validRuntimeUpdateId } from "./runtime-update-protocol.js";
27
+ import { parseRuntimeUpdateStatus, RUNTIME_UPDATE_STATUS_CAPABILITY } from "./runtime-update-status.js";
28
+ import { validatePaneMcpBody } from "./runtime-pane-mcp-protocol.js";
29
+ import { validateRuntimePaneRequest, validateRuntimePaneShutdown } from "./runtime-pane-protocol.js";
30
+ export { RUNTIME_PANE_MODULES } from "./runtime-pane-assets.js";
31
+ /** The line the client reports each time AgEnD welcomes it; the background launcher waits for it to say "connected". */
32
+ export const RUNTIME_CONNECTED_REPORT = "Connected to AgEnD.";
33
+ const REPAIR = "run .\\agend-runtime.cmd disconnect in this folder (add the same --profile if you used one), then double-click connect-agend.bat and enter a new pairing code, or paste a new one-time install command from AgEnD Settings -> Runtime -> Connect a computer (no pairing code needed).";
34
+ /** Plain-language cause and next step for a stop AgEnD caused. AgEnD answers an unknown and a revoked credential with the same bare 401, so "refused" covers both. */
35
+ export function describeRuntimeStop(reason) {
36
+ switch (reason.kind) {
37
+ case "refused": return `${reason.detail === "HTTP 403" ? "The connection was refused with HTTP 403. If AgEnD's address goes through a proxy, check the proxy's settings too. " : ""}AgEnD did not accept this computer's saved connection, so the Runtime stopped. Open AgEnD Settings -> Runtime: if this computer is missing or revoked, or AgEnD's data was reset, it must be paired again; ${REPAIR} If the pairing was made against a different AgEnD address than this folder's, use the download that matches it.`;
38
+ case "reinstall": return "AgEnD refused this Runtime because its version is not compatible with this AgEnD (it was installed from a different AgEnD release). Your pairing is kept. Re-run the install command shown in AgEnD Settings -> Runtime -> Connect a computer (Windows PowerShell tab) on this computer; it installs the matching Runtime next to this one and never deletes the version that is running. Then start it again with agend-runtime run (add the same --profile if you used one). If you installed from the ZIP, download the ZIP from the same page and double-click connect-agend.bat.";
39
+ case "revoked": return `This computer was revoked in AgEnD Settings -> Runtime, so the Runtime stopped. To connect it again, ${REPAIR}`;
40
+ case "replaced": return "This computer connected to AgEnD again from somewhere else, so AgEnD closed this connection. A pairing allows one live connection. Close the other Runtime window (or the other computer that uses a copy of this profile), then double-click connect-agend.bat again. Each computer needs its own pairing code.";
41
+ case "incompatible": return "This Runtime could not understand a message from AgEnD, so it stopped. This usually means the Runtime and AgEnD are different versions, or the address points at something that is not this AgEnD. Download the Windows Runtime again from AgEnD Settings -> Runtime, extract it, and double-click connect-agend.bat.";
42
+ case "rejected": return `AgEnD rejected a message from this Runtime${reason.detail ? ` (${reason.detail})` : ""}. Usual causes: leftover data from pairing this profile with a different AgEnD server, or a Runtime/AgEnD version mismatch. If this profile was used with another AgEnD server, ${REPAIR} If pairing reports an unfinished job from another pairing, follow that message: check that no CLI it started is still running, delete jobs.json in the profile folder, then pair again. Otherwise download the Windows Runtime again from AgEnD Settings -> Runtime, extract it, and double-click connect-agend.bat.`;
43
+ }
44
+ }
45
+ const MAX_FRAME = 256 * 1024;
46
+ const MAX_TOOL = 64 * 1024;
47
+ function object(value) { return !!value && typeof value === "object" && !Array.isArray(value); }
48
+ function message(error) { return error instanceof Error ? error.message.slice(0, 1000) : "Runtime operation failed"; }
49
+ function checkedRun(value) {
50
+ if (!object(value) || Object.keys(value).some(key => !["task", "resumeSessionId", "context", "mcp", "credentialProfile"].includes(key)))
51
+ throw new Error("Invalid runtime run payload");
52
+ const task = validateNativeTask(value.task);
53
+ // A name and nothing else: a path, a drive letter or a control byte is not a profile name and is refused here, not "cleaned".
54
+ if (value.credentialProfile !== undefined) {
55
+ assertCredentialProfileName(value.credentialProfile);
56
+ assertCredentialProfileCli(task.cli);
57
+ }
58
+ if (value.resumeSessionId !== undefined && !validNativeSessionId(task.cli, value.resumeSessionId))
59
+ throw new Error("Invalid native conversation ID");
60
+ if (value.context !== undefined && (typeof value.context !== "string" || value.context.length > 2000 || value.context.includes("\0")))
61
+ throw new Error("Invalid native context");
62
+ if (value.mcp !== undefined && (!object(value.mcp) || Object.keys(value.mcp).some(key => key !== "tools")
63
+ || !Array.isArray(value.mcp.tools) || !value.mcp.tools.length || value.mcp.tools.length > 64
64
+ || value.mcp.tools.some(tool => typeof tool !== "string" || !/^[a-z][a-z0-9_]{0,63}$/.test(tool))))
65
+ throw new Error("Invalid scoped MCP request");
66
+ return { task, resumeSessionId: value.resumeSessionId, context: value.context,
67
+ mcp: value.mcp, ...(value.credentialProfile !== undefined ? { credentialProfile: value.credentialProfile } : {}) };
68
+ }
69
+ function jsonBody(req) {
70
+ return new Promise((accept, reject) => {
71
+ let text = "", bytes = 0;
72
+ req.setTimeout(10_000, () => { reject(new Error("MCP request timed out")); req.destroy(); });
73
+ req.setEncoding("utf8");
74
+ req.on("data", (part) => { bytes += Buffer.byteLength(part); if (bytes > MAX_TOOL) {
75
+ reject(new Error("MCP request is too large"));
76
+ req.destroy();
77
+ }
78
+ else
79
+ text += part; });
80
+ req.on("error", reject);
81
+ req.on("end", () => { try {
82
+ accept(JSON.parse(text));
83
+ }
84
+ catch {
85
+ reject(new Error("Invalid MCP JSON"));
86
+ } });
87
+ });
88
+ }
89
+ /**
90
+ * `claude auth logout` for a profile. Output is not read, kept or logged: only whether the command ended well. A program that never started (no pid) has
91
+ * ended; for one that exists, ONLY its `close` is evidence that it ended (an `error` event can also mean it could not be killed). On the 30 s limit the
92
+ * whole process tree is killed and `close` is waited for up to five more seconds; if it still has not come the result is a ProcessNotConfirmedEnded, whose
93
+ * `ended` settles when the process really ends, so that whoever owns the profile keeps it busy until then.
94
+ */
95
+ export function runLogoutProcess(executable, args, env, limitMs = 30_000, waitMs = 5_000, spawnChild = childSpawn, kill = killTree) {
96
+ return new Promise((done, fail) => {
97
+ const child = spawnChild(executable.command, [...executable.args, ...args], { env, shell: false, stdio: "ignore", windowsHide: true });
98
+ let ended = false, timer;
99
+ const closed = new Promise(accept => { child.on("close", () => accept()); });
100
+ closed.then(() => { ended = true; });
101
+ child.on("error", () => { if (child.pid === undefined) {
102
+ clearTimeout(timer);
103
+ ended = true;
104
+ done(null);
105
+ } });
106
+ child.on("close", code => { clearTimeout(timer); done(code); });
107
+ timer = setTimeout(() => {
108
+ kill(child);
109
+ const gave = setTimeout(() => { if (!ended)
110
+ fail(new ProcessNotConfirmedEnded(closed)); }, waitMs);
111
+ gave.unref?.();
112
+ }, limitMs);
113
+ timer.unref?.();
114
+ });
115
+ }
116
+ export class RuntimeClient {
117
+ options;
118
+ bootId = randomUUID();
119
+ runtimeInfo;
120
+ bridge;
121
+ socket = null;
122
+ welcomed = false;
123
+ stopped = true;
124
+ closed = false;
125
+ unlock = null;
126
+ reconnectTimer = null;
127
+ reconnectAttempt = 0;
128
+ graceTimer = null;
129
+ pollTimer = null;
130
+ credentialWatch = null;
131
+ credentialStamp = "";
132
+ credentials = null;
133
+ startupRotation = null;
134
+ paneHost = null;
135
+ paneOpening = null;
136
+ machinePaneLimit = 4;
137
+ paneEpoch = randomUUID();
138
+ active = new Set();
139
+ /** Run id -> the credential profile it runs under, so removing or signing out a profile waits for its runs. */
140
+ activeProfiles = new Map();
141
+ /** Terminals being opened right now, by profile (lower-case): they are not in the pane ledger until the host has answered. */
142
+ openingPanes = new Map();
143
+ remoteAccounts = null;
144
+ /** Ends a CLI install that is still running when this Runtime stops (the install's child process is the exact one it started). */
145
+ installAbort = new AbortController();
146
+ /** The Runtime's own installer (native Windows only): its closed table, its pinned versions and one install at a time. */
147
+ managed;
148
+ snapshots = new Map();
149
+ pendingPaneTools = new Map();
150
+ pendingTools = new Map();
151
+ mcpTokens = new Map();
152
+ mcpServer = null;
153
+ mcpOpening = null;
154
+ mcpPort = 0;
155
+ inventory = null;
156
+ stoppedListeners = new Set();
157
+ activity = new RuntimeUpdateActivity();
158
+ stopPromise;
159
+ /** A stop that could not finish (an account process was not confirmed gone): everything is still held, and stop() may be called again. */
160
+ stopIncomplete = false;
161
+ /** A stop asked for the durable panes to be retired (a revocation does): that stays true across a stop that failed and is called again, a plain one included (Ctrl+C), until a stop has completed. */
162
+ retirePanesRequested = false;
163
+ generation = 0;
164
+ updateProtocol = false;
165
+ updateStatusProtocol = false;
166
+ updateStatus;
167
+ preparingUpdate = false;
168
+ trialFence;
169
+ activatedTrialId;
170
+ updateWait;
171
+ /** Set only when AgEnD ended the connection and the person must act; a local stop (Ctrl+C) leaves it undefined. */
172
+ stopReason;
173
+ /** The socket this Runtime itself closed with 1008 because it could not read AgEnD's frame; that is not AgEnD refusing us. */
174
+ selfClosed = null;
175
+ constructor(options) {
176
+ this.options = options;
177
+ this.managed = nativeInstallSupported() ? managedInstaller({ root: managedCliRoot(options.store.directory), ...(options.installRoot ? { installRoot: options.installRoot } : {}) }, () => this.installAbort.signal) : null;
178
+ this.updateStatus = options.updateStatus === undefined ? undefined : parseRuntimeUpdateStatus(options.updateStatus);
179
+ const info = readRuntimeInfo({ panes: process.platform === "win32" || !!options.createPaneHost || !!options.openPaneLink, install: !!options.remoteAccounts?.installer || nativeInstallSupported() });
180
+ // Offered only when this client has a profile root to resolve names under; otherwise AgEnD must not ask for a profile.
181
+ if (options.managedUpdate?.trialId !== undefined && !validRuntimeUpdateId(options.managedUpdate.trialId))
182
+ throw Error("Invalid Runtime update trial");
183
+ this.runtimeInfo = { ...info, capabilities: [...info.capabilities.filter(name => options.credentialProfilesRoot || name !== RUNTIME_CREDENTIAL_CAPABILITY), ...(options.managedUpdate ? [RUNTIME_MANAGED_UPDATE_CAPABILITY] : []), ...(this.updateStatus ? [RUNTIME_UPDATE_STATUS_CAPABILITY] : [])] };
184
+ // Remote account operations need the profile folder, and a way to run the Windows CLI (native Windows, or a test's own). `cli-install` also needs an installer.
185
+ const remote = !!options.credentialProfilesRoot && (process.platform === "win32" || !!options.remoteAccounts);
186
+ this.runtimeInfo = { ...this.runtimeInfo, capabilities: this.runtimeInfo.capabilities.filter(name => (name === REMOTE_SIGNIN_CAPABILITY || name === MODEL_REFRESH_CAPABILITY) ? remote : (name === CLI_INSTALL_CAPABILITY || name === CLI_UPDATE_CAPABILITY) ? remote && !!(options.remoteAccounts?.installer || nativeInstallSupported()) : true) };
187
+ this.bridge = options.bridge ?? new WindowsCliBridge(nativeWindowsTransport, join(options.store.directory, WINDOWS_CLI_INVENTORY_FILE));
188
+ }
189
+ report(text) { this.options.report?.(text); }
190
+ online() { return !this.trialFence && this.welcomed && this.socket?.readyState === WebSocket.OPEN; }
191
+ setUpdateStatus(value) { this.updateStatus = parseRuntimeUpdateStatus(value); this.publishUpdateStatus(); }
192
+ publishUpdateStatus() {
193
+ if (this.updateStatus && this.updateStatusProtocol && this.online() && this.runtimeInfo.capabilities.includes(RUNTIME_UPDATE_STATUS_CAPABILITY))
194
+ this.send({ v: 1, type: "update.status", bootId: this.bootId, generation: this.generation, status: this.updateStatus });
195
+ }
196
+ waitUntilStopped() { return this.stopPromise ?? (this.stopped && this.closed ? Promise.resolve() : new Promise(done => this.stoppedListeners.add(done))); }
197
+ async start() {
198
+ if (!this.stopped)
199
+ return;
200
+ if (this.stopPromise) {
201
+ await this.stopPromise;
202
+ this.stopPromise = undefined;
203
+ this.activity = new RuntimeUpdateActivity();
204
+ }
205
+ // A previous stop that was not completed still owns a pairing lock and possibly a sign-in or logout process that was not confirmed ended: nothing starts
206
+ // over it, and its account module is never replaced while it holds anything.
207
+ if (this.stopIncomplete || this.unlock !== null || (this.remoteAccounts && !this.remoteAccounts.idle()))
208
+ throw new Error("The previous stop was not completed (an account process was not confirmed ended). Call stop() again, or inspect processes, before starting");
209
+ this.retirePanesRequested = false; // fully closed: whatever an earlier stop asked for is over
210
+ let credentials = this.options.store.credentials();
211
+ if (!credentials)
212
+ throw new Error("Pair this runtime before connecting");
213
+ validateRuntimeServer(credentials.server);
214
+ this.stopped = false;
215
+ this.closed = false;
216
+ this.stopReason = undefined;
217
+ this.activatedTrialId = undefined;
218
+ this.remoteAccounts = null; // a stopped one is closed to new work for good
219
+ try {
220
+ const systemBootId = process.platform === "win32" ? await readPaneSystemBootId() : undefined;
221
+ if (this.stopped)
222
+ throw Error("Runtime start was cancelled");
223
+ const reused = process.platform === "win32" ? await reusedRuntimeLockPid(this.options.store.lockHolder()) : undefined;
224
+ if (this.stopped)
225
+ throw Error("Runtime start was cancelled");
226
+ this.unlock = this.options.store.lock(this.bootId, systemBootId, reused);
227
+ if (credentials.pendingCredential) {
228
+ const rotating = this.startupRotation = rotateRuntimeCredentials({ store: this.options.store });
229
+ try {
230
+ credentials = await rotating;
231
+ }
232
+ finally {
233
+ if (this.startupRotation === rotating)
234
+ this.startupRotation = null;
235
+ }
236
+ }
237
+ if (this.stopped)
238
+ throw Error("Runtime start was cancelled");
239
+ this.options.store.adoptMachine(credentials.machineId);
240
+ this.options.store.recoverInterrupted();
241
+ this.credentials = credentials;
242
+ if (this.options.managedUpdate?.trialId) {
243
+ this.trialFence = this.activity.tryFence(this.options.managedUpdate.trialId, () => !this.stopped, () => true);
244
+ if (!this.trialFence)
245
+ throw Error("Runtime trial admission is unavailable");
246
+ }
247
+ // Connect immediately, then publish the last administrator detection from the private profile.
248
+ // A cached read starts no CLI. Only an explicit probe command with force:true performs detection.
249
+ this.connect();
250
+ // A foreground runtime must remain alive while an idle connection is down. Promises and unref'ed retry
251
+ // timers do not keep Node running after the last socket closes; stop() owns and clears this liveness ref.
252
+ this.pollTimer = setInterval(() => this.poll(), this.options.pollMs ?? 250);
253
+ if (!this.trialFence)
254
+ this.beginDiscovery();
255
+ }
256
+ catch (error) {
257
+ this.stopped = true;
258
+ this.unlock?.();
259
+ this.unlock = null;
260
+ throw error;
261
+ }
262
+ }
263
+ connect() {
264
+ if (this.stopped || !this.credentials)
265
+ return;
266
+ // A previous connection's positive check cannot vouch for this server generation.
267
+ if (this.updateStatus?.state === "current")
268
+ this.updateStatus = { state: "unknown" };
269
+ const url = validateRuntimeServer(this.credentials.server);
270
+ url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
271
+ url.pathname = "/runtime/v1/connect";
272
+ const socket = this.socket = this.options.socketFactory?.(url.href, this.credentials.credential)
273
+ ?? new WebSocket(url.href, { headers: { Authorization: `Bearer ${this.credentials.credential}` }, followRedirects: false,
274
+ maxPayload: MAX_FRAME, handshakeTimeout: 15_000, perMessageDeflate: false });
275
+ this.welcomed = false;
276
+ this.updateProtocol = false;
277
+ this.updateStatusProtocol = false;
278
+ this.paneEpoch = randomUUID();
279
+ socket.on("open", () => {
280
+ if (this.stopped || this.socket !== socket) {
281
+ socket.close();
282
+ return;
283
+ }
284
+ this.send({ v: 1, type: "hello", bootId: this.bootId, name: this.credentials.name, platform: process.platform, runtimeInfo: this.runtimeInfo,
285
+ ...(this.trialFence ? { updateTrialId: this.trialFence.id } : {}),
286
+ ...(process.platform === "win32" || this.options.createPaneHost || this.options.openPaneLink ? { paneProtocol: 1 } : {}),
287
+ ...(this.inventory ? { inventory: this.inventory } : {}) });
288
+ });
289
+ socket.on("message", (bytes, binary) => {
290
+ const size = Array.isArray(bytes) ? bytes.reduce((sum, part) => sum + part.byteLength, 0) : bytes.byteLength;
291
+ if (binary || size > MAX_FRAME || this.socket !== socket) {
292
+ this.selfClosed = socket;
293
+ socket.close(1008, "Invalid runtime frame");
294
+ return;
295
+ }
296
+ void this.receive(bytes.toString()).catch(() => { this.selfClosed = socket; socket.close(1008, "Invalid runtime protocol"); });
297
+ });
298
+ socket.on("error", () => { });
299
+ socket.on("unexpected-response", (_req, response) => {
300
+ response.resume();
301
+ if (response.statusCode === 401 || response.statusCode === 403) {
302
+ this.report("Runtime credential was refused. Re-pair after the machine is authorized.");
303
+ this.stopReason = { kind: "refused", ...(response.statusCode === 403 ? { detail: "HTTP 403" } : {}) };
304
+ void this.stop().catch(error => this.report(error instanceof Error ? error.message : "Runtime stop was not completed"));
305
+ }
306
+ else
307
+ socket.terminate();
308
+ });
309
+ socket.on("close", (code, reason) => {
310
+ if (this.socket !== socket)
311
+ return;
312
+ this.socket = null;
313
+ this.welcomed = false;
314
+ this.paneEpoch = randomUUID();
315
+ // Whatever the old connection started over account requests is over with it: a sign-in it opened is ended, and what it still has in flight may not start more.
316
+ this.remoteAccounts?.connectionChanged();
317
+ if (this.updateWait) {
318
+ const pending = this.updateWait;
319
+ this.updateWait = undefined;
320
+ clearTimeout(pending.timer);
321
+ pending.reject(Error("Runtime update connection changed"));
322
+ }
323
+ if (this.paneHost && "connectionChanged" in this.paneHost)
324
+ this.paneHost.connectionChanged();
325
+ this.rejectTools();
326
+ if (this.stopped)
327
+ return;
328
+ if (code === 1008) {
329
+ const why = reason.toString().replace(/[^ -~]/g, "?").slice(0, 120);
330
+ this.report(this.selfClosed === socket ? "This Runtime could not read a message from AgEnD and closed the connection." : `AgEnD closed the connection (code 1008${why ? `: ${why}` : ""}).`);
331
+ this.stopReason = this.selfClosed === socket ? { kind: "incompatible" } : { kind: why === "Machine revoked" ? "revoked" : why === "Connection replaced" ? "replaced" : why.startsWith(RUNTIME_REINSTALL_CLOSE_PREFIX) ? "reinstall" : "rejected", ...(why ? { detail: why } : {}) };
332
+ void this.stop({ retirePanes: why === "Machine revoked" }).catch(error => this.report(error instanceof Error ? error.message : "Runtime stop was not completed"));
333
+ return;
334
+ }
335
+ this.report("Disconnected. Existing execution is not replayed; reconnecting…");
336
+ if (!this.graceTimer)
337
+ this.graceTimer = setTimeout(() => {
338
+ this.graceTimer = null;
339
+ for (const id of this.active) {
340
+ try {
341
+ this.bridge.cancel(id);
342
+ }
343
+ catch { /* state reconciles in poll */ }
344
+ }
345
+ this.report("The coordinator remained disconnected; cancellation was requested for the active execution.");
346
+ }, this.options.disconnectGraceMs ?? 45_000);
347
+ this.graceTimer.unref?.();
348
+ const base = Math.min(30_000, 2000 * 2 ** Math.min(this.reconnectAttempt++, 4));
349
+ const delay = this.options.reconnectMs ?? Math.min(30_000, Math.round(base * (0.75 + Math.random() * 0.5)));
350
+ this.reconnectTimer = setTimeout(() => { this.reconnectTimer = null; this.connect(); }, delay);
351
+ this.reconnectTimer.unref?.();
352
+ });
353
+ }
354
+ send(value) {
355
+ if (this.socket?.readyState !== WebSocket.OPEN)
356
+ return;
357
+ const frame = JSON.stringify(value);
358
+ if (Buffer.byteLength(frame) > MAX_FRAME)
359
+ throw new Error("Runtime frame limit exceeded");
360
+ if (this.socket.bufferedAmount > 2 * MAX_FRAME) {
361
+ this.socket.close(1013, "Runtime backpressure");
362
+ return;
363
+ }
364
+ this.socket.send(frame);
365
+ }
366
+ async receive(text) {
367
+ const value = JSON.parse(text);
368
+ if (!object(value) || value.v !== 1 || typeof value.type !== "string")
369
+ throw new Error("Unsupported runtime protocol");
370
+ if (value.type === "welcome") {
371
+ if (value.machineId !== this.credentials?.machineId || !Number.isSafeInteger(value.generation))
372
+ throw new Error("Runtime machine identity mismatch");
373
+ this.welcomed = true;
374
+ this.generation = value.generation;
375
+ this.updateProtocol = value.updateProtocol === 1;
376
+ this.updateStatusProtocol = value.updateStatusProtocol === 1;
377
+ this.reconnectAttempt = 0;
378
+ if (this.graceTimer) {
379
+ clearTimeout(this.graceTimer);
380
+ this.graceTimer = null;
381
+ }
382
+ this.report(RUNTIME_CONNECTED_REPORT);
383
+ if (!this.trialFence)
384
+ for (const job of this.options.store.list())
385
+ this.publish(job);
386
+ this.publishUpdateStatus();
387
+ this.options.managedUpdate?.authenticated?.({ bootId: this.bootId, generation: this.generation, ...(this.updateProtocol ? { updateProtocol: 1 } : {}), runtimeInfo: this.runtimeInfo });
388
+ return;
389
+ }
390
+ if (value.type === "update.control") {
391
+ const control = parseRuntimeUpdateControl(value, "server"), pending = this.updateWait;
392
+ if (!pending || control.bootId !== this.bootId || control.generation !== this.generation || control.id !== pending.id || !pending.phases.includes(control.phase))
393
+ return;
394
+ if (control.phase === "activated") {
395
+ if (this.trialFence?.id !== control.id || !this.trialFence.current() || !this.locallyIdle())
396
+ throw Error("Runtime trial is no longer idle");
397
+ this.activatedTrialId = control.id;
398
+ this.trialFence.release();
399
+ this.trialFence = undefined;
400
+ // Release synchronously: the server's next ordered frame may already contain ordinary work.
401
+ for (const job of this.options.store.list())
402
+ this.publish(job);
403
+ this.beginDiscovery();
404
+ }
405
+ this.updateWait = undefined;
406
+ clearTimeout(pending.timer);
407
+ pending.accept(control.phase);
408
+ return;
409
+ }
410
+ if (value.type === "revoked") {
411
+ this.report("This machine was revoked by AgEnD.");
412
+ this.stopReason = { kind: "revoked" };
413
+ await this.stop({ retirePanes: true }).catch(error => this.report(error instanceof Error ? error.message : "Runtime stop was not completed"));
414
+ return;
415
+ }
416
+ if (!this.welcomed)
417
+ throw new Error("Runtime handshake is incomplete");
418
+ if (value.type === "ping") {
419
+ this.send({ v: 1, type: "pong" });
420
+ return;
421
+ }
422
+ if (value.type === "tool.result") {
423
+ if (typeof value.id !== "string")
424
+ throw new Error("Invalid tool reply");
425
+ const pending = this.pendingTools.get(value.id);
426
+ if (!pending)
427
+ return;
428
+ clearTimeout(pending.timer);
429
+ this.pendingTools.delete(value.id);
430
+ if (value.ok === true)
431
+ pending.accept(value.result);
432
+ else
433
+ pending.reject(new Error("AgEnD MCP request was refused"));
434
+ return;
435
+ }
436
+ if (value.type === "pane.tool.result") {
437
+ if (Object.keys(value).some(key => !["v", "type", "id", "ok", "result"].includes(key)) || !validWindowsAgentId(value.id) || typeof value.ok !== "boolean")
438
+ throw Error("Invalid pane MCP reply");
439
+ const pending = this.pendingPaneTools.get(value.id);
440
+ if (!pending)
441
+ return;
442
+ this.pendingPaneTools.delete(value.id);
443
+ clearTimeout(pending.timer);
444
+ if (value.ok)
445
+ pending.accept(value.result);
446
+ else
447
+ pending.reject(Error("Pane MCP request was refused"));
448
+ return;
449
+ }
450
+ if (value.type === "pane.request") {
451
+ if (Object.keys(value).some(key => !["v", "type", "id", "maxAgents", "request"].includes(key))
452
+ || typeof value.id !== "string" || !validWindowsAgentId(value.id) || !Number.isInteger(value.maxAgents)
453
+ || value.maxAgents < 1 || value.maxAgents > 16)
454
+ throw Error("Invalid pane transport envelope");
455
+ const request = validateRuntimePaneRequest(value.request);
456
+ this.machinePaneLimit = value.maxAgents;
457
+ const epoch = this.paneEpoch;
458
+ let leave, opening;
459
+ try {
460
+ leave = this.activity.enter();
461
+ // A terminal that would run under a profile that AgEnD is signing out, removing or signing in right now is not started; and from here until the host
462
+ // has answered it counts as using its profile, because the pane ledger does not show it yet.
463
+ if (request.action === "open") {
464
+ const profile = request.launch.credentialProfile ?? this.credentialProfileFor(request.launch.cli, undefined);
465
+ if (profile !== undefined) {
466
+ if (this.remoteAccounts?.profileReserved(profile))
467
+ throw new Error(`Credential profile "${profile}" is being changed from AgEnD; try again in a moment`);
468
+ opening = profile.toLowerCase();
469
+ this.openingPanes.set(opening, (this.openingPanes.get(opening) ?? 0) + 1);
470
+ }
471
+ }
472
+ const host = await this.panes();
473
+ // A terminal for an agent with no profile of its own starts under this pairing's default profile, when there is one. The default is passed
474
+ // beside the launch, not inside it: the host decides with it only for a pane that is new, so a pane that is already running reattaches
475
+ // whatever the default has become since.
476
+ const fallback = request.action === "open" && request.launch.credentialProfile === undefined ? this.credentialProfileFor(request.launch.cli, undefined) : undefined;
477
+ const forHost = request.action === "open" && fallback !== undefined ? { ...request, defaultCredentialProfile: fallback } : request;
478
+ const result = await host.request(forHost, () => epoch === this.paneEpoch && this.online());
479
+ if (request.action === "shutdown") {
480
+ validateRuntimePaneShutdown(result, request.hostBootId);
481
+ // Explicit coordinator disable, not a disconnect: the next enabled request discovers a new host boot.
482
+ // Retire this cache before sending the reply, including when that reply is lost under backpressure.
483
+ if (this.paneHost === host) {
484
+ this.paneHost = null;
485
+ this.paneOpening = null;
486
+ }
487
+ await host.stop();
488
+ }
489
+ this.send({ v: 1, type: "pane.response", id: value.id, ok: true, result });
490
+ }
491
+ catch (error) {
492
+ this.send({ v: 1, type: "pane.response", id: value.id, ok: false, error: message(error) });
493
+ }
494
+ finally {
495
+ if (opening !== undefined) {
496
+ const left = (this.openingPanes.get(opening) ?? 1) - 1;
497
+ if (left > 0)
498
+ this.openingPanes.set(opening, left);
499
+ else
500
+ this.openingPanes.delete(opening);
501
+ }
502
+ leave?.();
503
+ }
504
+ return;
505
+ }
506
+ if (value.type === "account.request") {
507
+ // Not journaled by AgEnD and not stored here: a sign-in's URL and code travel in these frames and nowhere else.
508
+ if (Object.keys(value).some(key => !["v", "type", "id", "operation", "payload"].includes(key)) || typeof value.id !== "string" || !/^[A-Za-z0-9._:-]{1,128}$/.test(value.id)
509
+ || !isRuntimeRemoteOperation(value.operation))
510
+ throw new Error("Invalid account request");
511
+ // The answer belongs to the connection that asked: it is sent only while that very connection (socket and AgEnD's generation for it) is still the live
512
+ // one, never to a later connection, and the request is refused outright while a managed update is holding new work.
513
+ const socket = this.socket, generation = this.generation, id = value.id;
514
+ const sameConnection = () => !this.stopped && !!socket && this.socket === socket && this.generation === generation && this.welcomed && socket.readyState === WebSocket.OPEN;
515
+ const current = () => sameConnection() && this.online();
516
+ const reply = (frame) => { if (sameConnection())
517
+ this.send(frame); };
518
+ let leave;
519
+ try {
520
+ if (this.trialFence)
521
+ throw new Error("Runtime update is holding new work");
522
+ leave = this.activity.enter();
523
+ reply({ v: 1, type: "account.response", id, ok: true, result: await this.remote().handle(value.operation, value.payload, current) });
524
+ }
525
+ catch (error) {
526
+ reply({ v: 1, type: "account.response", id, ok: false, error: message(error) });
527
+ }
528
+ finally {
529
+ leave?.();
530
+ }
531
+ return;
532
+ }
533
+ if (value.type !== "request" || typeof value.id !== "string" || !/^[A-Za-z0-9._:-]{1,128}$/.test(value.id)
534
+ || typeof value.operation !== "string" || !object(value.payload))
535
+ throw new Error("Invalid runtime request");
536
+ const command = value;
537
+ try {
538
+ this.send({ v: 1, type: "response", id: command.id, ok: true, result: await this.operation(command.operation, command.payload) });
539
+ }
540
+ catch (error) {
541
+ this.send({ v: 1, type: "response", id: command.id, ok: false, error: message(error) });
542
+ }
543
+ }
544
+ publish(job) { if (this.online())
545
+ this.send({ v: 1, type: "task", seq: job.seq, task: job.task }); }
546
+ panes() {
547
+ // A detached host link is not a live cache. Rediscover on the next independent request; never replay this RPC.
548
+ if (this.paneHost && "connected" in this.paneHost && !this.paneHost.connected()) {
549
+ this.paneHost = null;
550
+ this.paneOpening = null;
551
+ }
552
+ if (!this.paneOpening) {
553
+ const output = snapshot => { if (this.online())
554
+ this.send({ v: 1, type: "pane.output", snapshot }); };
555
+ if (this.options.createPaneHost)
556
+ this.paneOpening = import("./runtime-pane-store.js").then(({ RuntimePaneStore }) => {
557
+ const store = new RuntimePaneStore(join(this.options.store.directory, PANE_IN_PROCESS_DIRECTORY));
558
+ store.recoverInterrupted();
559
+ return this.paneHost = this.options.createPaneHost({ store, bootId: this.bootId, online: () => !this.stopped && this.online(), maxAgents: () => this.machinePaneLimit, output });
560
+ });
561
+ else
562
+ this.paneOpening = import("./runtime-pane-link.js").then(({ RuntimePaneLink }) => (this.options.openPaneLink ?? RuntimePaneLink.open.bind(RuntimePaneLink))({
563
+ directory: this.options.store.directory, server: this.credentials.server, machineId: this.credentials.machineId,
564
+ ...(this.options.credentialProfilesRoot ? { credentialRoot: this.options.credentialProfilesRoot } : {}),
565
+ online: () => !this.stopped && this.online(), maxAgents: () => this.machinePaneLimit, epoch: () => this.paneEpoch, output, mcp: (body, current) => this.paneMcp(body, current),
566
+ })).then(host => this.paneHost = host);
567
+ const opening = this.paneOpening;
568
+ void opening.catch(() => { if (this.paneOpening === opening)
569
+ this.paneOpening = null; });
570
+ }
571
+ return this.paneOpening;
572
+ }
573
+ paneMcp(raw, current) { return this.activity.run(() => this.forwardPaneMcp(raw, current)); }
574
+ forwardPaneMcp(raw, current) {
575
+ const body = validatePaneMcpBody(raw), epoch = this.paneEpoch;
576
+ if (!current() || !this.online() || this.pendingPaneTools.size >= 32)
577
+ return Promise.reject(Error("Pane MCP transport is unavailable"));
578
+ const id = randomUUID();
579
+ return new Promise((accept, reject) => {
580
+ const timer = setTimeout(() => { this.pendingPaneTools.delete(id); reject(Error("Pane MCP response is unconfirmed")); }, 85_000);
581
+ timer.unref();
582
+ this.pendingPaneTools.set(id, { timer, reject, accept: value => current() && this.online() && this.paneEpoch === epoch ? accept(value) : reject(Error("Pane MCP lease expired")) });
583
+ try {
584
+ this.send({ v: 1, type: "pane.tool.request", id, body });
585
+ }
586
+ catch {
587
+ this.pendingPaneTools.delete(id);
588
+ clearTimeout(timer);
589
+ reject(Error("Pane MCP response is unconfirmed"));
590
+ }
591
+ });
592
+ }
593
+ update(task) {
594
+ if (this.closed)
595
+ return;
596
+ const serialized = JSON.stringify(task);
597
+ if (this.snapshots.get(task.id) === serialized)
598
+ return;
599
+ try {
600
+ const job = this.options.store.update(task);
601
+ this.snapshots.set(task.id, serialized);
602
+ this.publish(job);
603
+ if (task.finishedAt) {
604
+ this.active.delete(task.id);
605
+ this.activeProfiles.delete(task.id);
606
+ this.closeMcp(task.id);
607
+ }
608
+ }
609
+ catch {
610
+ // A process whose state could not be committed must not continue accepting commands.
611
+ this.report("Runtime execution state could not be saved. Stop and inspect the private runtime profile.");
612
+ try {
613
+ this.bridge.cancel(task.id);
614
+ }
615
+ catch { /* leave durable accepted state blocked */ }
616
+ this.socket?.close(1011, "Runtime storage failed");
617
+ }
618
+ }
619
+ poll() { for (const id of this.active) {
620
+ const task = this.bridge.get(id);
621
+ if (task)
622
+ this.update(task);
623
+ } }
624
+ /** Which profile a run uses: the one the agent named, else this pairing's default (Claude Code only), else none (the Runtime's own environment). */
625
+ credentialProfileFor(cli, named) {
626
+ if (named !== undefined)
627
+ return named;
628
+ return cli === "claude-code" && this.options.credentialProfilesRoot ? this.options.store.credentialDefault() : undefined;
629
+ }
630
+ stamp() { return credentialCacheStamp(this.options.credentialProfilesRoot, join(this.options.store.directory, "credential-default.json")); }
631
+ /**
632
+ * Re-report on its own after `agend-runtime login` / `profile default` (run in another window) changed the sign-in cache: the account shown
633
+ * in AgEnD follows a profile that was signed in to another account, without an administrator pressing "Detect again". Reads the cache only.
634
+ */
635
+ watchCredentialCache() {
636
+ if (!this.options.credentialProfilesRoot)
637
+ return;
638
+ this.credentialStamp = this.stamp();
639
+ this.credentialWatch = setInterval(() => {
640
+ if (!this.activity.accepting)
641
+ return;
642
+ const now = this.stamp();
643
+ if (now === this.credentialStamp)
644
+ return;
645
+ this.credentialStamp = now;
646
+ void this.refreshInventory(false).catch(() => { });
647
+ }, this.options.credentialWatchMs ?? 5000);
648
+ this.credentialWatch.unref?.();
649
+ }
650
+ statusOf(cli, directory, authorized) {
651
+ if (this.options.credentialStatus)
652
+ return authorized ? this.options.credentialStatus(cli, directory, authorized) : this.options.credentialStatus(cli, directory);
653
+ if (this.options.credentialLogin)
654
+ return this.options.credentialLogin(cli, directory).then(loggedIn => ({ loggedIn }));
655
+ // The lookup of the CLI is the Runtime's own (a test or the install work may supply one); production leaves it to `findCli`.
656
+ const find = this.options.remoteAccounts?.find;
657
+ return probeCredentialProfileStatus(cli, directory, find ? id => find(id) : undefined, undefined, authorized);
658
+ }
659
+ remember(root, cli, name, answer) {
660
+ rememberCredentialStatus(root, cli, name, answer);
661
+ this.credentialStamp = this.stamp(); // our own write is not "another window"
662
+ }
663
+ /** The folder of a profile that exists AND is signed in on this computer; anything else refuses, never the default account. */
664
+ async credentialHome(cli, name) {
665
+ const root = this.options.credentialProfilesRoot;
666
+ if (!root)
667
+ throw new Error("This Runtime has no credential profile folder, so it cannot select an account. Update or restart the Runtime.");
668
+ if (!isCredentialProfileCli(cli))
669
+ throw new Error("Credential profiles on a Windows Runtime support Claude Code only");
670
+ const directory = requireCredentialProfile(root, cli, name);
671
+ const answer = await this.statusOf(cli, directory);
672
+ this.remember(root, cli, name, answer);
673
+ if (answer.loggedIn !== true)
674
+ throw credentialLoginRequired(cli, name, answer.loggedIn);
675
+ return directory;
676
+ }
677
+ /** Names and signed-in yes/no only. `force` (an explicit "Detect again") asks each profile's CLI; otherwise the last known answer is reported. */
678
+ async credentialReport(force, authorized) {
679
+ const root = this.options.credentialProfilesRoot;
680
+ if (!root)
681
+ return undefined;
682
+ // `authorized` (an install's live consent and connection check) is asked before each profile's status is started and again before its answer is written to the cache.
683
+ const still = () => { if (authorized && !authorized())
684
+ throw new Error("Authorization expired during CLI discovery"); };
685
+ if (force)
686
+ for (const name of listCredentialProfileNames(root, "claude-code")) {
687
+ still();
688
+ try {
689
+ const answer = await this.statusOf("claude-code", requireCredentialProfile(root, "claude-code", name), authorized);
690
+ still();
691
+ this.remember(root, "claude-code", name, answer);
692
+ }
693
+ catch {
694
+ still();
695
+ this.remember(root, "claude-code", name, { loggedIn: null });
696
+ }
697
+ }
698
+ let name;
699
+ try {
700
+ name = this.options.store.credentialDefault();
701
+ }
702
+ catch { /* reported as no default; a run refuses with the real error */ }
703
+ return credentialProfileReport(root, name, profile => isCreatedProfile(root, "claude-code", profile));
704
+ }
705
+ computerBoot;
706
+ computerBootValue;
707
+ /** The computer's boot identity, read once (it cannot change while this Runtime runs). Unknown is never evidence either way. */
708
+ systemBoot() { return this.computerBoot ??= (this.options.remoteAccounts?.systemBootId ?? readPaneSystemBootId)().catch(() => undefined).then(value => this.computerBootValue = value); }
709
+ /**
710
+ * Whether a task or terminal is running under this profile (case-insensitively: on Windows `Work` and `work` are one folder). Terminals come from the
711
+ * pane ledgers (`paneLedgerFiles`: the pane host's own state folder in production, the in-process folder in tests; a missing ledger is "none") and from
712
+ * the terminals this Runtime is opening right now. A row recorded under another boot of the computer is a terminal that cannot still be running (the pane
713
+ * store treats it the same way). A ledger that cannot be read, or a default profile that cannot be read while a terminal needs it, is `unknown`: the
714
+ * caller refuses with a message that says the state could not be confirmed. A Claude Code terminal that names no profile runs under this pairing's
715
+ * default, which the ledger does not hold.
716
+ */
717
+ async profileInUse(name) { await this.systemBoot(); return this.profileInUseNow(name); }
718
+ /** The same answer with no await, from the boot identity read earlier (before it is read, a row with a boot id is counted as running: the safe side). */
719
+ profileInUseNow(name) {
720
+ const same = (other) => typeof other === "string" && other.toLowerCase() === name.toLowerCase();
721
+ for (const used of this.activeProfiles.values())
722
+ if (same(used))
723
+ return "task";
724
+ if (this.openingPanes.has(name.toLowerCase()))
725
+ return "pane";
726
+ let fallback, fallbackReadable = true;
727
+ try {
728
+ fallback = this.options.store.credentialDefault();
729
+ }
730
+ catch {
731
+ fallbackReadable = false;
732
+ }
733
+ const boot = this.computerBootValue;
734
+ let unknown = false;
735
+ for (const file of paneLedgerFiles(this.options.store.directory)) {
736
+ try {
737
+ const raw = JSON.parse(readFileSync(file, "utf8"));
738
+ for (const row of object(raw) && object(raw.panes) ? Object.values(raw.panes) : []) {
739
+ const launch = object(row) && object(row.launch) ? row.launch : undefined, snapshot = object(row) && object(row.snapshot) ? row.snapshot : undefined;
740
+ if (!launch || snapshot?.state === "exited")
741
+ continue;
742
+ if (typeof row.systemBootId === "string" && boot && boot !== row.systemBootId)
743
+ continue;
744
+ if (same(launch.credentialProfile))
745
+ return "pane";
746
+ if (launch.credentialProfile === undefined && launch.cli === "claude-code") {
747
+ if (!fallbackReadable)
748
+ unknown = true;
749
+ else if (same(fallback))
750
+ return "pane";
751
+ }
752
+ }
753
+ }
754
+ catch (error) {
755
+ if (error.code !== "ENOENT")
756
+ unknown = true;
757
+ }
758
+ }
759
+ return unknown ? "unknown" : undefined;
760
+ }
761
+ /** #3190 Part 3a: the remote account operations (switches, sign-in, sign-out, remove, install), built on first use. */
762
+ remote() {
763
+ const root = this.options.credentialProfilesRoot, extra = this.options.remoteAccounts;
764
+ if (!root)
765
+ throw new Error("This Runtime has no credential profile folder, so it cannot manage accounts. Update or restart the Runtime.");
766
+ if (process.platform !== "win32" && !extra)
767
+ throw new Error("Managing accounts from AgEnD needs native Windows Node, under the Windows user whose Claude Code this Runtime uses.");
768
+ return this.remoteAccounts ??= new RemoteAccounts({
769
+ pairingDirectory: this.options.store.directory, credentialRoot: root,
770
+ models: extra?.models ?? ((cli, directory, authorized) => refreshNativeModels({ cli, directory, authorized, environment: extra?.environment?.() ?? nativeCliEnvironment() })),
771
+ status: (cli, directory) => this.statusOf(cli, directory),
772
+ find: extra?.find ?? ((cli) => findCli(cli)),
773
+ environment: extra?.environment ?? (() => nativeCliEnvironment()),
774
+ runLogout: extra?.runLogout ?? ((executable, args, env) => runLogoutProcess(executable, args, env)),
775
+ inUse: name => this.profileInUse(name), inUseNow: name => this.profileInUseNow(name), report: text => this.report(text),
776
+ // Throws when `credential-default.json` cannot be read: an unreadable default is not "no default" (the remove then answers `unconfirmed`).
777
+ defaultProfile: () => this.options.store.credentialDefault(),
778
+ enter: () => this.activity.enter(),
779
+ // With `authorized` (an account operation still waiting for its answer, which already holds a share of the Runtime's activity) the new inventory is sent over the same
780
+ // connection BEFORE the answer, so the dashboard that reads it on the answer sees the change; a revoked consent sends nothing. Without it (an install) it is only started.
781
+ changed: authorized => {
782
+ this.credentialStamp = this.stamp();
783
+ if (authorized)
784
+ return authorized() ? this.readInventory(false, authorized).then(() => { }, () => { }) : undefined;
785
+ void this.refreshInventory(false).catch(() => { });
786
+ },
787
+ // A CLI was just installed: the cached list is stale, so detect for real and send it (this request already holds a share of the Runtime's activity).
788
+ installed: async (authorized) => { await this.readInventory(true, authorized); },
789
+ // Native Windows installs from the Runtime's own closed table (3b); a test supplies its own installer.
790
+ ...(extra?.installer ? { installer: extra.installer } : this.managed ? { installer: this.managed } : {}),
791
+ ...(extra?.switchWatchMs ? { switchWatchMs: extra.switchWatchMs } : {}), ...(extra?.signIn ? { signIn: extra.signIn } : {}), ...(extra?.ownership ? { ownership: extra.ownership } : {}),
792
+ ...(extra?.now ? { now: extra.now } : {}),
793
+ });
794
+ }
795
+ beginDiscovery() {
796
+ void this.refreshInventory().catch(() => this.report("CLI discovery failed; refresh it from AgEnD after checking the local installation."));
797
+ this.watchCredentialCache();
798
+ }
799
+ refreshInventory(force = false) { return this.activity.run(() => this.readInventory(force)); }
800
+ async readInventory(force, authorized) {
801
+ const still = (when) => { if (authorized && !authorized())
802
+ throw new Error(`Authorization expired ${when} CLI discovery`); };
803
+ still("before");
804
+ const probed = await (authorized ? this.bridge.probe({ force }, authorized) : this.bridge.probe({ force }));
805
+ still("during");
806
+ const credentialProfiles = await this.credentialReport(force, authorized);
807
+ still("during");
808
+ const inventory = credentialProfiles ? { ...probed, credentialProfiles } : probed;
809
+ this.inventory = inventory;
810
+ if (this.online())
811
+ this.send({ v: 1, type: "inventory", inventory });
812
+ return inventory;
813
+ }
814
+ /** Testable command surface. Mutation identity is committed before calling the native bridge. */
815
+ operation(operation, payload) { return this.activity.run(() => this.ownedOperation(operation, payload)); }
816
+ async ownedOperation(operation, payload) {
817
+ if (operation === "probe") {
818
+ if (Object.keys(payload).some(key => key !== "force") || (payload.force !== undefined && typeof payload.force !== "boolean"))
819
+ throw new Error("Invalid discovery request");
820
+ return this.refreshInventory(payload.force === true);
821
+ }
822
+ if (operation === "workspace") {
823
+ if (Object.keys(payload).some(key => key !== "agentId") || !validWindowsAgentId(payload.agentId))
824
+ throw new Error("Invalid workspace request");
825
+ return { agentId: payload.agentId, cwd: await this.bridge.prepareWorkspace(payload.agentId) };
826
+ }
827
+ if (operation === "reconcile") {
828
+ if (Object.keys(payload).length)
829
+ throw new Error("Invalid reconciliation request");
830
+ return { jobs: this.options.store.list().map(row => ({ seq: row.seq, task: row.task })) };
831
+ }
832
+ if (operation === "cancel" || operation === "recover") {
833
+ if (typeof payload.runId !== "string" || Object.keys(payload).some(key => !["runId", ...(operation === "recover" ? ["confirmedStopped", "original"] : [])].includes(key)))
834
+ throw new Error("Invalid execution operation");
835
+ const stored = this.options.store.get(payload.runId);
836
+ if (operation === "recover") {
837
+ if (this.active.has(payload.runId))
838
+ throw new Error("The native execution is still connected; wait for cancellation");
839
+ if (payload.confirmedStopped !== true)
840
+ throw new Error("Confirm the execution stopped before recovery");
841
+ const original = payload.original === undefined ? null : checkedRun(payload.original);
842
+ if (original && original.task.requestId !== payload.runId)
843
+ throw new Error("Recovery execution identity does not match the original run");
844
+ const digest = original ? runtimeJobDigest(original) : null;
845
+ if (stored && digest && stored.digest !== digest)
846
+ throw new Error("Recovery arguments do not match the accepted execution");
847
+ if (!stored) {
848
+ if (!original || !digest)
849
+ throw new Error("Unknown execution recovery needs its trusted original run");
850
+ if (this.active.size)
851
+ throw new Error("Wait for the active native execution before recovery");
852
+ const task = original.task;
853
+ // The coordinator may have durably submitted a run that never reached this client. Explicit manual
854
+ // confirmation creates a terminal tombstone, never an execution, so a delayed retry cannot launch it.
855
+ const accepted = this.options.store.accept({ id: task.requestId, cli: task.cli, cwd: task.cwd, sandbox: task.sandbox,
856
+ ...(task.model ? { model: task.model } : {}), status: "failed", startedAt: Date.now(), finishedAt: Date.now(),
857
+ outcomeConfirmed: true, output: "", error: "The unconfirmed execution was manually confirmed stopped before local acceptance; it will not be replayed." }, digest);
858
+ this.publish(accepted.job);
859
+ return accepted.job.task;
860
+ }
861
+ if (stored.task.finishedAt && stored.task.outcomeConfirmed === true)
862
+ return stored.task;
863
+ this.bridge.releaseUnknown(payload.runId);
864
+ const job = this.options.store.recover(payload.runId, true);
865
+ this.publish(job);
866
+ return job.task;
867
+ }
868
+ if (!stored)
869
+ throw new Error("Runtime execution not found");
870
+ if (!this.active.has(payload.runId))
871
+ return stored.task;
872
+ const task = this.bridge.cancel(payload.runId);
873
+ this.update(task);
874
+ return task;
875
+ }
876
+ if (operation !== "run")
877
+ throw new Error("Unknown runtime operation");
878
+ const run = checkedRun(payload), task = run.task;
879
+ const digest = runtimeJobDigest(run);
880
+ const accepted = this.options.store.accept({ id: task.requestId, cli: task.cli, cwd: task.cwd, sandbox: task.sandbox,
881
+ ...(task.model ? { model: task.model } : {}), status: "starting", startedAt: Date.now(), output: "" }, digest);
882
+ if (accepted.duplicate)
883
+ return accepted.job.task;
884
+ this.publish(accepted.job);
885
+ try {
886
+ // Fail closed, and as a confirmed failed turn: an unknown, unsigned or unusable profile never falls back to another account.
887
+ const profile = this.credentialProfileFor(task.cli, run.credentialProfile);
888
+ // Registered (or refused) in one synchronous step with the look at AgEnD's own change of that profile, so a sign-out or removal that has reserved the
889
+ // profile is never raced by a task, and one that has not yet reserved it finds this task in `activeProfiles`.
890
+ if (profile && this.remoteAccounts?.profileReserved(profile))
891
+ throw new Error(`Credential profile "${profile}" is being changed from AgEnD; try again in a moment`);
892
+ if (profile)
893
+ this.activeProfiles.set(task.requestId, profile);
894
+ const credentialHome = profile ? await this.credentialHome(task.cli, profile) : undefined;
895
+ const mcp = payload.mcp ? await this.openMcp(task.requestId, payload.mcp.tools) : undefined;
896
+ if (this.stopped || !this.online())
897
+ throw new Error("Runtime disconnected before native execution started");
898
+ this.active.add(task.requestId);
899
+ const initial = this.bridge.start(task, () => !this.stopped && this.online(), {
900
+ ...(payload.resumeSessionId ? { resumeSessionId: payload.resumeSessionId } : {}),
901
+ ...(payload.context ? { context: payload.context } : {}), ...(mcp ? { mcp } : {}), ...(credentialHome ? { credentialHome } : {}),
902
+ onSettled: settled => this.update(settled),
903
+ });
904
+ this.update(initial);
905
+ return this.options.store.get(task.requestId).task;
906
+ }
907
+ catch (error) {
908
+ this.active.delete(task.requestId);
909
+ this.activeProfiles.delete(task.requestId);
910
+ this.closeMcp(task.requestId);
911
+ const failed = { ...accepted.job.task, status: "failed", error: message(error), finishedAt: Date.now(), outcomeConfirmed: true };
912
+ this.update(failed);
913
+ return failed;
914
+ }
915
+ }
916
+ locallyIdle() {
917
+ return this.activity.pending === 0 && this.active.size === 0 && !this.options.store.blocked()
918
+ && this.bridge.idleForUpdate?.() === true && this.pendingTools.size === 0 && this.pendingPaneTools.size === 0
919
+ && !(this.paneOpening && !this.paneHost) && (this.socket?.bufferedAmount ?? 1) === 0 && (this.remoteAccounts?.idle() ?? true);
920
+ }
921
+ updateRpc(phase, id, phases) {
922
+ if (!this.welcomed || !this.updateProtocol || this.socket?.readyState !== WebSocket.OPEN || this.updateWait)
923
+ return Promise.reject(Error("Runtime update negotiation is unavailable"));
924
+ return new Promise((accept, reject) => {
925
+ const pending = { id, phases, accept, reject, timer: setTimeout(() => {
926
+ if (this.updateWait === pending)
927
+ this.updateWait = undefined;
928
+ reject(Error("Runtime update acknowledgement is unconfirmed"));
929
+ }, 10_000) };
930
+ pending.timer.unref();
931
+ this.updateWait = pending;
932
+ try {
933
+ this.send({ v: 1, type: "update.control", id, bootId: this.bootId, generation: this.generation, phase });
934
+ }
935
+ catch (error) {
936
+ this.updateWait = undefined;
937
+ clearTimeout(pending.timer);
938
+ reject(error);
939
+ }
940
+ });
941
+ }
942
+ /** Called only by the local supervisor. A timeout or disconnect never authorizes process replacement. */
943
+ async prepareUpdate(id) {
944
+ if (!validRuntimeUpdateId(id) || !this.options.managedUpdate || this.trialFence || this.preparingUpdate || !this.online() || !this.updateProtocol)
945
+ return false;
946
+ const socket = this.socket, generation = this.generation;
947
+ const current = () => !this.stopped && this.socket === socket && socket.readyState === WebSocket.OPEN && this.generation === generation;
948
+ const fence = this.activity.tryFence(id, current, () => this.locallyIdle());
949
+ if (!fence)
950
+ return false;
951
+ this.preparingUpdate = true;
952
+ let committed = false;
953
+ try {
954
+ if (await this.updateRpc("prepare", id, ["prepared", "busy", "cancelled"]) !== "prepared")
955
+ return false;
956
+ if (this.options.drainPaneHostForUpdate)
957
+ await this.options.drainPaneHostForUpdate(() => fence.current());
958
+ else {
959
+ const { RuntimePaneLink } = await import("./runtime-pane-link.js");
960
+ const existing = this.paneHost instanceof RuntimePaneLink && this.paneHost.connected() ? this.paneHost : undefined;
961
+ if (!existing && (this.options.createPaneHost || this.options.openPaneLink))
962
+ throw Error("Injected pane host requires its own positive idle proof");
963
+ await RuntimePaneLink.drainExistingForUpdate({ directory: this.options.store.directory, server: this.credentials.server, machineId: this.credentials.machineId,
964
+ online: () => current(), maxAgents: () => this.machinePaneLimit, epoch: () => this.paneEpoch, mcp: (body, owned) => this.paneMcp(body, owned) }, () => fence.current(), existing);
965
+ }
966
+ if (!fence.current() || !this.locallyIdle())
967
+ return false;
968
+ if (await this.updateRpc("ready", id, ["commit", "busy", "cancelled"]) !== "commit")
969
+ return false;
970
+ fence.commit();
971
+ committed = true;
972
+ await this.stop();
973
+ return true;
974
+ }
975
+ catch (error) {
976
+ if (committed)
977
+ throw error;
978
+ return false;
979
+ }
980
+ finally {
981
+ this.preparingUpdate = false;
982
+ if (!committed) {
983
+ try {
984
+ if (!current() || await this.updateRpc("cancel", id, ["cancelled", "commit"]) !== "cancelled")
985
+ socket.terminate();
986
+ }
987
+ catch {
988
+ socket.terminate();
989
+ }
990
+ fence.release();
991
+ }
992
+ }
993
+ }
994
+ /** The parent persists activation intent before this call; an unconfirmed answer is never rollback permission. */
995
+ async activateTrial(id) {
996
+ // A received exact acknowledgement is a durable fact for this process lifetime, not a second admission.
997
+ if (this.activatedTrialId === id && this.options.managedUpdate?.trialId === id)
998
+ return true;
999
+ if (this.trialFence?.id !== id || !this.locallyIdle())
1000
+ return false;
1001
+ return await this.updateRpc("activate", id, ["activated", "busy", "cancelled"]) === "activated";
1002
+ }
1003
+ async openMcp(runId, tools) {
1004
+ if (!this.mcpOpening)
1005
+ this.mcpOpening = new Promise((accept, reject) => {
1006
+ const server = this.mcpServer = createServer((req, res) => {
1007
+ const reply = (status, value) => { if (!res.writableEnded && !res.destroyed) {
1008
+ res.writeHead(status, { "Content-Type": "application/json", "Cache-Control": "no-store" });
1009
+ res.end(JSON.stringify(value));
1010
+ } };
1011
+ const header = req.headers["x-agend-native-token"];
1012
+ const entry = typeof header === "string" && /^[a-f0-9]{64}$/.test(header) ? this.mcpTokens.get(header) : undefined;
1013
+ if (req.method !== "POST" || req.url !== "/agent" || req.headers.origin !== undefined || req.headers.cookie !== undefined
1014
+ || !["127.0.0.1", "::1", "::ffff:127.0.0.1"].includes(req.socket.remoteAddress ?? "") || !entry
1015
+ || !this.active.has(entry.runId) || !this.online()) {
1016
+ req.resume();
1017
+ reply(403, { error: "Runtime MCP capability is unavailable" });
1018
+ return;
1019
+ }
1020
+ let leave;
1021
+ try {
1022
+ leave = this.activity.enter();
1023
+ }
1024
+ catch {
1025
+ req.resume();
1026
+ reply(503, { error: "Runtime update is pending" });
1027
+ return;
1028
+ }
1029
+ const finished = new Promise(done => {
1030
+ const settle = () => { res.off("finish", settle); res.off("close", settle); done(); };
1031
+ res.once("finish", settle);
1032
+ res.once("close", settle);
1033
+ if (res.destroyed || res.writableFinished)
1034
+ settle();
1035
+ });
1036
+ void jsonBody(req).then(async (body) => {
1037
+ if (!object(body) || body.op !== "native-mcp" || !["tools/list", "tools/call"].includes(String(body.method))
1038
+ || !object(body.params) || Object.keys(body).some(key => !["op", "method", "params", "callId"].includes(key)))
1039
+ throw new Error("Invalid runtime MCP request");
1040
+ if (body.method === "tools/call" && (!entry.tools.includes(String(body.params.name)) || !object(body.params.arguments)
1041
+ || typeof body.callId !== "string" || !/^[A-Za-z0-9._:-]{1,128}$/.test(body.callId)))
1042
+ throw new Error("Runtime MCP tool is unavailable");
1043
+ const result = await this.toolCall(entry.runId, body);
1044
+ if (!this.active.has(entry.runId) || !this.online()) {
1045
+ reply(401, { error: "Runtime MCP capability expired" });
1046
+ return;
1047
+ }
1048
+ if (Buffer.byteLength(JSON.stringify(result) ?? "") > MAX_TOOL)
1049
+ throw new Error("Runtime MCP result is too large");
1050
+ reply(200, result);
1051
+ }).catch(() => reply(403, { error: "Runtime MCP request was refused or its execution expired" })).finally(async () => { await finished; leave(); });
1052
+ });
1053
+ server.on("error", reject);
1054
+ server.listen(0, "127.0.0.1", () => { const address = server.address(); if (!address || typeof address === "string") {
1055
+ reject(new Error("Runtime MCP could not bind"));
1056
+ return;
1057
+ } this.mcpPort = address.port; accept(address.port); });
1058
+ });
1059
+ await this.mcpOpening;
1060
+ const token = randomBytes(32).toString("hex");
1061
+ this.mcpTokens.set(token, { runId, tools: [...tools] });
1062
+ return { endpoint: `http://127.0.0.1:${this.mcpPort}/agent`, token, tools: [...tools] };
1063
+ }
1064
+ closeMcp(runId) { for (const [token, entry] of this.mcpTokens)
1065
+ if (entry.runId === runId)
1066
+ this.mcpTokens.delete(token); }
1067
+ toolCall(runId, body) {
1068
+ if (!this.online())
1069
+ return Promise.reject(new Error("Runtime is disconnected"));
1070
+ if (this.pendingTools.size >= 64)
1071
+ return Promise.reject(new Error("Runtime MCP call capacity reached"));
1072
+ const id = randomUUID();
1073
+ return new Promise((accept, reject) => {
1074
+ const timer = setTimeout(() => { this.pendingTools.delete(id); reject(new Error("AgEnD MCP request timed out")); }, 90_000);
1075
+ timer.unref?.();
1076
+ this.pendingTools.set(id, { accept, reject, timer });
1077
+ this.send({ v: 1, type: "tool.call", id, runId, body });
1078
+ });
1079
+ }
1080
+ rejectTools() {
1081
+ for (const pending of this.pendingPaneTools.values()) {
1082
+ clearTimeout(pending.timer);
1083
+ pending.reject(Error("Pane MCP disconnected; no call was replayed"));
1084
+ }
1085
+ this.pendingPaneTools.clear();
1086
+ for (const pending of this.pendingTools.values()) {
1087
+ clearTimeout(pending.timer);
1088
+ pending.reject(new Error("Runtime disconnected"));
1089
+ }
1090
+ this.pendingTools.clear();
1091
+ }
1092
+ stop(options = {}) {
1093
+ // The request is remembered before anything else: a stop already running (it may be a plain one) picks it up when it reaches the panes, and a stop that fails
1094
+ // before the panes (an account process not confirmed ended) keeps it for the plain stop() that tries again.
1095
+ if (options.retirePanes)
1096
+ this.retirePanesRequested = true;
1097
+ if (this.stopPromise)
1098
+ return this.stopPromise;
1099
+ if (this.stopped && !this.stopIncomplete)
1100
+ return Promise.resolve();
1101
+ this.stopped = true;
1102
+ this.welcomed = false;
1103
+ this.stopIncomplete = false;
1104
+ this.installAbort.abort();
1105
+ this.activity.close();
1106
+ // Own cleanup before callbacks (bridge.close, pane cleanup) can re-enter stop(). A stop that fails leaves the lock and the account module held and can be
1107
+ // called again.
1108
+ const stopping = Promise.resolve().then(() => this.stopOwned(options)).catch(error => { if (this.stopPromise === stopping)
1109
+ this.stopPromise = undefined; this.stopIncomplete = true; throw error; });
1110
+ return this.stopPromise = stopping;
1111
+ }
1112
+ async stopOwned(options) {
1113
+ if (this.updateWait) {
1114
+ const pending = this.updateWait;
1115
+ this.updateWait = undefined;
1116
+ clearTimeout(pending.timer);
1117
+ pending.reject(Error("Runtime update stopped"));
1118
+ }
1119
+ if (this.reconnectTimer)
1120
+ clearTimeout(this.reconnectTimer);
1121
+ if (this.graceTimer)
1122
+ clearTimeout(this.graceTimer);
1123
+ if (this.pollTimer)
1124
+ clearInterval(this.pollTimer);
1125
+ if (this.credentialWatch)
1126
+ clearInterval(this.credentialWatch);
1127
+ this.reconnectTimer = null;
1128
+ this.graceTimer = null;
1129
+ this.pollTimer = null;
1130
+ this.credentialWatch = null;
1131
+ this.rejectTools();
1132
+ this.mcpTokens.clear();
1133
+ this.bridge.close();
1134
+ const socket = this.socket;
1135
+ this.socket = null;
1136
+ if (socket) {
1137
+ socket.close();
1138
+ if (socket.readyState !== WebSocket.CLOSED)
1139
+ socket.terminate();
1140
+ }
1141
+ // A cancelled start may still finish its durable credential write. Do not release the profile to another writer.
1142
+ await this.startupRotation?.catch(() => { });
1143
+ // A sign-in that is open ends with the connection (its child is killed), and the folded counts of the audit log are written. A login or logout process that
1144
+ // is not confirmed gone fails the stop HERE, before the pairing's lock is let go, so no other client can start over a process that may still be writing.
1145
+ if (this.remoteAccounts) {
1146
+ await this.remoteAccounts.stop();
1147
+ if (!this.remoteAccounts.idle())
1148
+ throw new Error("Account process shutdown was not confirmed; inspect processes before stopping or restarting");
1149
+ }
1150
+ await this.paneOpening?.then(async (host) => {
1151
+ try {
1152
+ if ((options.retirePanes || this.retirePanesRequested) && "retireOwned" in host)
1153
+ await host.retireOwned();
1154
+ }
1155
+ finally {
1156
+ await host.stop();
1157
+ }
1158
+ }).catch(() => this.report("Pane cleanup is unconfirmed; its durable reservations remain held."));
1159
+ // Keep the profile lock until cancellation is confirmed or the journal is explicitly marked uncertain.
1160
+ const deadline = Date.now() + 5000;
1161
+ while (this.active.size && Date.now() < deadline) {
1162
+ this.poll();
1163
+ if (!this.active.size)
1164
+ break;
1165
+ await new Promise(done => setTimeout(done, 50));
1166
+ }
1167
+ for (const id of this.active) {
1168
+ const old = this.options.store.get(id);
1169
+ if (old)
1170
+ this.update({ ...old.task, status: "failed", finishedAt: Date.now(), outcomeConfirmed: false,
1171
+ error: "Runtime stopped before native process shutdown was confirmed. Inspect processes before recovery." });
1172
+ }
1173
+ if (this.mcpServer) {
1174
+ const server = this.mcpServer;
1175
+ this.mcpServer = null;
1176
+ server.closeAllConnections();
1177
+ await new Promise(done => server.close(() => done()));
1178
+ }
1179
+ this.unlock?.();
1180
+ this.unlock = null;
1181
+ this.closed = true;
1182
+ this.retirePanesRequested = false;
1183
+ for (const done of this.stoppedListeners)
1184
+ done();
1185
+ this.stoppedListeners.clear();
1186
+ }
1187
+ }
1188
+ async function post(server, path, body, signal, credential) {
1189
+ const response = await fetch(new URL(path, server), { method: "POST", redirect: "error", headers: { "Content-Type": "application/json", ...(credential ? { Authorization: `Bearer ${credential}` } : {}) },
1190
+ body: JSON.stringify(body), signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(15_000)]) : AbortSignal.timeout(15_000) });
1191
+ let text = "", bytes = 0;
1192
+ if (response.body)
1193
+ for await (const part of response.body) {
1194
+ bytes += part.byteLength;
1195
+ if (bytes > MAX_TOOL)
1196
+ throw new Error("Runtime pairing response is too large");
1197
+ text += new TextDecoder().decode(part);
1198
+ }
1199
+ let data;
1200
+ try {
1201
+ data = JSON.parse(text);
1202
+ }
1203
+ catch {
1204
+ throw new Error("Invalid runtime pairing response");
1205
+ }
1206
+ if (!object(data))
1207
+ throw new Error("Invalid runtime pairing response");
1208
+ return { status: response.status, data };
1209
+ }
1210
+ /** Caller holds the profile lock. Persist the candidate before wire; either credential can recover a lost response. */
1211
+ export async function rotateRuntimeCredentials(input) {
1212
+ let saved = input.store.credentials();
1213
+ if (!saved)
1214
+ throw Error("Pair this runtime before rotating its credential");
1215
+ if (!saved.pendingCredential) {
1216
+ saved = { ...saved, pendingCredential: randomBytes(32).toString("hex") };
1217
+ input.store.saveCredentials(saved);
1218
+ }
1219
+ const server = validateRuntimeServer(saved.server), candidate = saved.pendingCredential;
1220
+ for (const credential of [saved.credential, candidate]) {
1221
+ const response = await post(server, RUNTIME_ROTATE_PATH, { machineId: saved.machineId, credential: candidate }, input.signal, credential);
1222
+ if (response.status === 200 && response.data.status === "rotated" && response.data.machineId === saved.machineId) {
1223
+ const { pendingCredential: _, ...current } = saved;
1224
+ const completed = { ...current, credential: candidate };
1225
+ input.store.saveCredentials(completed);
1226
+ return completed;
1227
+ }
1228
+ if (response.status !== 401 && response.status !== 429)
1229
+ break;
1230
+ }
1231
+ throw Error("Runtime credential rotation was not confirmed. The saved candidate is retained; retry rotate before connecting.");
1232
+ }
1233
+ export async function pairRuntime(input) {
1234
+ const server = validateRuntimeServer(input.server);
1235
+ if (!input.code.trim() || input.code.length > 256 || /[\x00-\x1f]/.test(input.code) || !input.name.trim() || input.name.length > 100)
1236
+ throw new Error("Enter a valid pairing code and machine name");
1237
+ input.store.assertCanPair();
1238
+ const paired = await post(server, "/runtime/v1/pair", { code: input.code.trim(), name: input.name.trim(), platform: process.platform, hostname: hostname() }, input.signal);
1239
+ if (paired.status !== 201 || paired.data.status !== "pending" || typeof paired.data.machineId !== "string" || typeof paired.data.claimSecret !== "string")
1240
+ throw new Error(`Runtime pairing was refused (HTTP ${paired.status})`);
1241
+ const deadline = Math.min(Date.now() + 10 * 60_000, typeof paired.data.expiresAt === "number" ? paired.data.expiresAt : Infinity);
1242
+ const fingerprint = runtimeClaimFingerprint(paired.data.claimSecret);
1243
+ input.report?.(`Pairing fingerprint: ${fingerprint}. Compare it with AgEnD Settings → Runtime before approving this machine; waiting for approval…`);
1244
+ while (!input.signal?.aborted && Date.now() < deadline) {
1245
+ const claimed = await post(server, "/runtime/v1/claim", { machineId: paired.data.machineId, claimSecret: paired.data.claimSecret }, input.signal);
1246
+ if (claimed.status === 200 && claimed.data.status === "approved" && claimed.data.machineId === paired.data.machineId
1247
+ && typeof claimed.data.credential === "string" && /^[A-Za-z0-9._-]{16,256}$/.test(claimed.data.credential)) {
1248
+ const credentials = { server: server.origin, machineId: paired.data.machineId, credential: claimed.data.credential, name: input.name.trim() };
1249
+ // Save first: the one-time credential cannot be issued again. A ledger that changed since the check above is reported after it is safe.
1250
+ input.store.saveCredentials(credentials);
1251
+ try {
1252
+ input.store.adoptMachine(credentials.machineId, true);
1253
+ }
1254
+ catch (error) {
1255
+ throw new Error(`The computer was paired and its credential is saved. ${error instanceof Error ? error.message : "Its job ledger could not be updated."}`);
1256
+ }
1257
+ input.report?.("Runtime paired. Its machine credential was saved in the private local profile.");
1258
+ return credentials;
1259
+ }
1260
+ if (claimed.status !== 202 || claimed.data.status !== "pending")
1261
+ throw new Error(`Runtime approval was refused or expired (HTTP ${claimed.status})`);
1262
+ await new Promise((accept, reject) => {
1263
+ const timer = setTimeout(() => { input.signal?.removeEventListener("abort", abort); accept(); }, input.pollMs ?? 1500);
1264
+ const abort = () => { clearTimeout(timer); reject(new Error("Runtime pairing cancelled")); };
1265
+ input.signal?.addEventListener("abort", abort, { once: true });
1266
+ });
1267
+ }
1268
+ throw new Error(input.signal?.aborted ? "Runtime pairing was cancelled" : "Runtime pairing expired before the computer was approved. Open AgEnD Settings -> Runtime, then double-click connect-agend.bat again and enter a new pairing code.");
1269
+ }
1270
+ /** Where a person is sent in every enrollment failure: the one place that makes a new token. */
1271
+ const ENROLL_NEXT = "Open AgEnD Settings -> Runtime -> Connect a computer, generate a new install command there and run it again.";
1272
+ const ENROLL_REFUSALS = {
1273
+ invalid: `This install command's one-time token is not valid for this AgEnD (it may be incomplete, mistyped, or from another AgEnD). ${ENROLL_NEXT}`,
1274
+ expired: `This install command's one-time token has expired (it lasts 15 minutes). ${ENROLL_NEXT}`,
1275
+ used: `This install command's one-time token was already used; each token works once. If this computer is already connected, run agend-runtime run (or double-click connect-agend.bat). Otherwise ${ENROLL_NEXT.replace(/^Open/, "open")}`,
1276
+ revoked: `This install command's one-time token was revoked in AgEnD. ${ENROLL_NEXT}`,
1277
+ mismatch: `This install command's token was issued by a different AgEnD than the one at this address. Nothing was sent anywhere else. ${ENROLL_NEXT}`,
1278
+ limit: "This AgEnD has reached its limit of connected computers. Revoke a computer you no longer use in AgEnD Settings -> Runtime, then run the install command again.",
1279
+ };
1280
+ /** One plain sentence plus the next step for each reason AgEnD refuses an install-command token, and for a token or fingerprint that is malformed here. */
1281
+ export function describeEnrollRefusal(reason) { return ENROLL_REFUSALS[RUNTIME_ENROLL_REFUSALS.includes(reason) ? reason : "invalid"]; }
1282
+ /**
1283
+ * joins this computer to AgEnD with the one-time token from the install command. No pairing code and no approval step: the token is the
1284
+ * authorisation, and it could only come from an administrator's signed-in AgEnD page.
1285
+ * Order matters, and nothing secret goes out in the clear. (1) The server proves it is the AgEnD the command pinned: an Ed25519 signature, by the key whose
1286
+ * fingerprint is in the command, over a fresh nonce AND a fresh X25519 key it made for this request. (2) Only then is the token sent, sealed (AES-256-GCM under a
1287
+ * key from X25519 with that fresh key) so that only the server that holds the fresh private key can read it: a relay that forwards step 1 to the real server gets a
1288
+ * valid proof and still cannot read the token. (3) The answer carrying the new credential is sealed under the other direction's key, so the relay cannot read it or
1289
+ * forge one; it is opened and checked before anything is saved. The token is used once and is not kept anywhere here.
1290
+ */
1291
+ export async function enrollRuntime(input) {
1292
+ const server = validateRuntimeServer(input.server);
1293
+ if (!RUNTIME_ENROLL_TOKEN_PATTERN.test(input.token))
1294
+ throw new Error(describeEnrollRefusal("invalid"));
1295
+ if (!RUNTIME_SERVER_FINGERPRINT_PATTERN.test(input.fingerprint))
1296
+ throw new Error("The server fingerprint in this install command is not valid (it is 64 hexadecimal characters). " + ENROLL_NEXT);
1297
+ if (!input.name.trim() || input.name.length > 100)
1298
+ throw new Error("Enter a valid machine name");
1299
+ input.store.assertCanPair();
1300
+ const nonce = randomBytes(24).toString("hex"), tid = runtimeEnrollTokenId(input.token); // tid: the token's non-secret id, only so AgEnD can rate-limit this token's own traffic apart from everyone else's
1301
+ // Something that is not an AgEnD answering (an HTML page, an old AgEnD without this route) is the same failure as a wrong fingerprint: the token stays unsent.
1302
+ const hello = await post(server, RUNTIME_ENROLL_HELLO_PATH, { nonce, tid }, input.signal).catch((error) => {
1303
+ if (error instanceof Error && /^Invalid runtime pairing response$|is too large$/.test(error.message))
1304
+ return { status: 0, data: {} };
1305
+ throw error;
1306
+ });
1307
+ if (hello.status === 429)
1308
+ throw new Error("AgEnD is receiving too many requests from this address. Wait a minute, then run the same command again; the one-time token was NOT sent.");
1309
+ const ephemeral = hello.data.ephemeral;
1310
+ let helloMessage = null;
1311
+ try {
1312
+ helloMessage = typeof ephemeral === "string" ? runtimeEnrollHelloMessage(nonce, ephemeral) : null;
1313
+ }
1314
+ catch {
1315
+ helloMessage = null;
1316
+ }
1317
+ if (hello.status !== 200 || typeof ephemeral !== "string" || !helloMessage || !verifyRuntimeServerProof(input.fingerprint, hello.data.publicKey, hello.data.signature, helloMessage)) {
1318
+ throw new Error(`The AgEnD at ${server.origin} did not prove it is the AgEnD this install command was made for (its server fingerprint differs from the one in the command). The one-time token was NOT sent. Check the address; if it is right, ${ENROLL_NEXT.replace(/^Open/, "open")}`);
1319
+ }
1320
+ input.report?.(`AgEnD server verified (fingerprint ${input.fingerprint.slice(0, 16)}…).`);
1321
+ const mine = newRuntimeEnrollEphemeral(), channel = runtimeEnrollChannel(mine.privateKey, ephemeral, nonce, tid, ephemeral, mine.publicKey);
1322
+ const request = sealRuntimeEnroll(channel.requestKey, channel.context, "request", Buffer.from(JSON.stringify({ token: input.token, fingerprint: input.fingerprint, name: input.name.trim(), platform: process.platform, hostname: hostname() }), "utf8"));
1323
+ const granted = await post(server, RUNTIME_ENROLL_PATH, { nonce, tid, clientKey: mine.publicKey, ...request }, input.signal);
1324
+ if (granted.status !== 201) {
1325
+ if ([400, 403, 409].includes(granted.status) && typeof granted.data.reason === "string")
1326
+ throw new Error(describeEnrollRefusal(granted.data.reason));
1327
+ throw new Error(granted.status === 429 ? "AgEnD is receiving too many requests from this address; wait a minute, then run the same command again." : `Joining AgEnD was refused (HTTP ${granted.status}). ${ENROLL_NEXT}`);
1328
+ }
1329
+ const opened = openRuntimeEnroll(channel.replyKey, channel.context, "reply", granted.data.box);
1330
+ let grant = {};
1331
+ try {
1332
+ grant = opened ? JSON.parse(opened.toString("utf8")) : {};
1333
+ }
1334
+ catch {
1335
+ grant = {};
1336
+ }
1337
+ const { machineId, credential } = grant;
1338
+ if (!opened || grant.status !== "enrolled" || typeof machineId !== "string" || !/^[a-f0-9-]{36}$/i.test(machineId) || typeof credential !== "string" || !/^[A-Za-z0-9._-]{16,256}$/.test(credential)) {
1339
+ throw new Error(`AgEnD's answer could not be verified, so nothing was saved on this computer. The token may have been used up: ${ENROLL_NEXT.replace(/^Open/, "open")} If a computer with this name shows up connected-but-never-online in Settings, revoke it there.`);
1340
+ }
1341
+ const credentials = { server: server.origin, machineId, credential, name: input.name.trim() };
1342
+ // Save first: the credential is only ever sent once. A ledger that changed since the check above is reported after it is safe.
1343
+ input.store.saveCredentials(credentials);
1344
+ try {
1345
+ input.store.adoptMachine(credentials.machineId, true);
1346
+ }
1347
+ catch (error) {
1348
+ throw new Error(`The computer joined AgEnD and its credential is saved. ${error instanceof Error ? error.message : "Its job ledger could not be updated."}`);
1349
+ }
1350
+ input.report?.("This computer joined AgEnD with the one-time token. Its machine credential was saved in the private local profile.");
1351
+ return credentials;
1352
+ }
1353
+ //# sourceMappingURL=runtime-client.js.map