@maiaos/cli 0.1.0-canary.9 → 0.1.0-canary.90

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 (537) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +21 -15
  3. package/dist/address-space/address-space.js +21 -2
  4. package/dist/address-space/index.js +1 -1
  5. package/dist/agents/client.d.ts +48 -27
  6. package/dist/agents/client.js +10 -3
  7. package/dist/agents/commands.d.ts +1 -0
  8. package/dist/agents/commands.js +24 -2
  9. package/dist/agents/index.d.ts +1 -1
  10. package/dist/agents/index.js +1 -1
  11. package/dist/agents/input.js +6 -0
  12. package/dist/agents/output/format.js +11 -0
  13. package/dist/agents/tree/tree.js +16 -4
  14. package/dist/bin/maia.NOTICES.txt +1 -1
  15. package/dist/bin/maia.cdx.json +70 -19
  16. package/dist/bin/maia.mjs +1 -1
  17. package/dist/board/client.d.ts +27 -0
  18. package/dist/board/client.js +40 -0
  19. package/dist/board/commands.d.ts +28 -0
  20. package/dist/board/commands.js +52 -0
  21. package/dist/board/index.d.ts +3 -0
  22. package/dist/board/index.js +3 -0
  23. package/dist/board/input.js +339 -0
  24. package/dist/board/output/format.js +175 -0
  25. package/dist/board/output/index.js +2 -0
  26. package/dist/board/plan.js +47 -0
  27. package/dist/board/tree/index.js +2 -0
  28. package/dist/board/tree/tree.js +161 -0
  29. package/dist/cli/cli.d.ts +11 -3
  30. package/dist/cli/cli.js +215 -12
  31. package/dist/cli/index.d.ts +1 -1
  32. package/dist/cli/index.js +1 -1
  33. package/dist/cli/log-level.d.ts +11 -0
  34. package/dist/cli/log-level.js +14 -0
  35. package/dist/command-line/context.d.ts +25 -7
  36. package/dist/command-line/emit/index.d.ts +4 -0
  37. package/dist/command-line/emit/index.js +4 -0
  38. package/dist/command-line/{output.d.ts → emit/output.d.ts} +7 -3
  39. package/dist/command-line/{output.js → emit/output.js} +13 -5
  40. package/dist/command-line/{rows.d.ts → emit/rows.d.ts} +2 -0
  41. package/dist/command-line/{rows.js → emit/rows.js} +6 -0
  42. package/dist/command-line/index.d.ts +6 -6
  43. package/dist/command-line/index.js +5 -6
  44. package/dist/command-line/input/arguments.d.ts +6 -0
  45. package/dist/command-line/input/arguments.js +20 -0
  46. package/dist/command-line/input/index.d.ts +3 -2
  47. package/dist/command-line/input/index.js +3 -2
  48. package/dist/command-line/input/manager-options.d.ts +10 -0
  49. package/dist/command-line/input/manager-options.js +38 -0
  50. package/dist/command-line/input/prompt.d.ts +1 -0
  51. package/dist/command-line/input/prompt.js +1 -0
  52. package/dist/command-line/two-phase/index.d.ts +2 -0
  53. package/dist/command-line/two-phase/index.js +2 -0
  54. package/dist/command-line/{two-phase.d.ts → two-phase/two-phase.d.ts} +14 -14
  55. package/dist/command-line/{two-phase.js → two-phase/two-phase.js} +11 -11
  56. package/dist/command-receipt/command.js +1 -1
  57. package/dist/command-tree/commands.d.ts +1 -1
  58. package/dist/command-tree/commands.js +1 -5
  59. package/dist/command-tree/deprecated.d.ts +2 -0
  60. package/dist/command-tree/deprecated.js +29 -0
  61. package/dist/command-tree/grammar.js +2 -0
  62. package/dist/command-tree/help.d.ts +2 -2
  63. package/dist/command-tree/help.js +13 -15
  64. package/dist/command-tree/index.d.ts +1 -0
  65. package/dist/command-tree/index.js +1 -0
  66. package/dist/command-tree/local.js +27 -7
  67. package/dist/command-tree/placeholder.js +1 -1
  68. package/dist/command-tree/row.d.ts +1 -0
  69. package/dist/command-tree/tree.d.ts +2 -1
  70. package/dist/command-tree/tree.js +35 -4
  71. package/dist/connection/client.d.ts +72 -18
  72. package/dist/connection/client.js +1 -0
  73. package/dist/connection/executors/executors.d.ts +18 -0
  74. package/dist/connection/executors/executors.js +95 -0
  75. package/dist/connection/executors/index.d.ts +2 -0
  76. package/dist/connection/executors/index.js +2 -0
  77. package/dist/connection/executors/reading.js +22 -0
  78. package/dist/connection/index.d.ts +1 -0
  79. package/dist/connection/index.js +1 -0
  80. package/dist/connection/input.js +4 -4
  81. package/dist/connection/login.d.ts +1 -1
  82. package/dist/connection/login.js +4 -3
  83. package/dist/connection/output/format.js +6 -3
  84. package/dist/connection/output/index.d.ts +1 -1
  85. package/dist/connection/output/index.js +1 -1
  86. package/dist/connection/resolve.d.ts +5 -0
  87. package/dist/connection/setup-file.js +227 -0
  88. package/dist/connection/setup-project.js +138 -0
  89. package/dist/connection/system.js +126 -61
  90. package/dist/connection/tree/tree.js +179 -10
  91. package/dist/container/client.d.ts +2 -0
  92. package/dist/events/commands.js +65 -0
  93. package/dist/events/index.js +2 -0
  94. package/dist/events/tree/index.js +2 -0
  95. package/dist/events/tree/tree.js +17 -0
  96. package/dist/fleet/fleet.d.ts +7 -8
  97. package/dist/fleet/fleet.js +18 -6
  98. package/dist/fleet/index.d.ts +1 -1
  99. package/dist/fleet/index.js +1 -1
  100. package/dist/github/client.d.ts +189 -0
  101. package/dist/github/client.js +16 -0
  102. package/dist/github/commands.d.ts +17 -0
  103. package/dist/github/commands.js +81 -0
  104. package/dist/github/index.d.ts +3 -0
  105. package/dist/github/index.js +3 -0
  106. package/dist/github/input.js +114 -0
  107. package/dist/github/output/format.js +78 -0
  108. package/dist/github/output/index.js +2 -0
  109. package/dist/github/tree/index.js +2 -0
  110. package/dist/github/tree/tree.js +28 -0
  111. package/dist/goal/client.d.ts +246 -0
  112. package/dist/goal/client.js +13 -0
  113. package/dist/goal/commands.d.ts +22 -0
  114. package/dist/goal/commands.js +110 -0
  115. package/dist/goal/index.d.ts +4 -0
  116. package/dist/goal/index.js +4 -0
  117. package/dist/goal/input.js +118 -0
  118. package/dist/goal/output/format.js +29 -0
  119. package/dist/goal/output/index.js +2 -0
  120. package/dist/goal/pause.d.ts +16 -0
  121. package/dist/goal/pause.js +91 -0
  122. package/dist/goal/tree/index.js +2 -0
  123. package/dist/goal/tree/tree.js +49 -0
  124. package/dist/hold/client.d.ts +2 -0
  125. package/dist/hold/tree/tree.js +2 -2
  126. package/dist/import/batch/batch.js +196 -0
  127. package/dist/import/batch/index.js +3 -0
  128. package/dist/import/batch/manifest.js +108 -0
  129. package/dist/import/client.d.ts +3 -3
  130. package/dist/import/client.js +1 -1
  131. package/dist/import/commands.d.ts +2 -0
  132. package/dist/import/commands.js +104 -18
  133. package/dist/import/detach.d.ts +12 -0
  134. package/dist/import/detach.js +70 -0
  135. package/dist/import/index.d.ts +2 -1
  136. package/dist/import/index.js +2 -1
  137. package/dist/import/input.js +68 -11
  138. package/dist/import/output.js +57 -8
  139. package/dist/inbox/client.d.ts +310 -0
  140. package/dist/inbox/client.js +15 -0
  141. package/dist/inbox/index.d.ts +2 -0
  142. package/dist/inbox/index.js +2 -0
  143. package/dist/integration/client.d.ts +607 -1
  144. package/dist/integration/client.js +41 -1
  145. package/dist/integration/commands.d.ts +16 -0
  146. package/dist/integration/commands.js +93 -10
  147. package/dist/integration/index.d.ts +1 -1
  148. package/dist/integration/index.js +1 -1
  149. package/dist/local-node/client.d.ts +13 -1
  150. package/dist/local-node/client.js +191 -235
  151. package/dist/local-node/index.d.ts +1 -1
  152. package/dist/local-node/index.js +1 -1
  153. package/dist/local-node/launch/index.d.ts +2 -0
  154. package/dist/local-node/launch/index.js +2 -0
  155. package/dist/local-node/launch/launch.d.ts +19 -0
  156. package/dist/local-node/launch/launch.js +49 -0
  157. package/dist/login/commands.js +7 -1
  158. package/dist/login/gateway.js +36 -13
  159. package/dist/login/menu.js +2 -1
  160. package/dist/login/vendor-account.js +3 -2
  161. package/dist/login/vendor-input.js +5 -4
  162. package/dist/mcp/calls.js +47 -222
  163. package/dist/mcp/routing.d.ts +3 -2
  164. package/dist/mcp/routing.js +39 -8
  165. package/dist/mcp/server.d.ts +10 -1
  166. package/dist/mcp/server.js +16 -6
  167. package/dist/migrate/classes.js +158 -0
  168. package/dist/migrate/commands.js +46 -0
  169. package/dist/migrate/format.js +199 -0
  170. package/dist/migrate/index.js +2 -0
  171. package/dist/migrate/item.js +59 -0
  172. package/dist/migrate/plan.js +79 -0
  173. package/dist/migrate/tree/index.js +2 -0
  174. package/dist/migrate/tree/tree.js +23 -0
  175. package/dist/node-update/client.d.ts +17 -0
  176. package/dist/node-update/client.js +27 -0
  177. package/dist/node-update/commands.d.ts +20 -0
  178. package/dist/node-update/commands.js +150 -0
  179. package/dist/node-update/index.d.ts +4 -0
  180. package/dist/node-update/index.js +4 -0
  181. package/dist/node-update/output.d.ts +12 -0
  182. package/dist/node-update/output.js +165 -0
  183. package/dist/node-update/tree/index.js +2 -0
  184. package/dist/node-update/tree/tree.js +73 -0
  185. package/dist/pairing/client.d.ts +13 -0
  186. package/dist/pairing/client.js +36 -0
  187. package/dist/pairing/commands.d.ts +15 -0
  188. package/dist/pairing/commands.js +131 -0
  189. package/dist/pairing/index.d.ts +4 -0
  190. package/dist/pairing/index.js +4 -0
  191. package/dist/pairing/output.d.ts +12 -0
  192. package/dist/pairing/output.js +53 -0
  193. package/dist/pairing/tree/index.js +2 -0
  194. package/dist/pairing/tree/tree.js +35 -0
  195. package/dist/panel/client.d.ts +9 -0
  196. package/dist/panel/client.js +24 -0
  197. package/dist/panel/commands.d.ts +19 -0
  198. package/dist/panel/commands.js +112 -0
  199. package/dist/panel/index.d.ts +3 -0
  200. package/dist/panel/index.js +3 -0
  201. package/dist/panel/tree/index.js +2 -0
  202. package/dist/panel/tree/tree.js +14 -0
  203. package/dist/port-lease/client.d.ts +3 -0
  204. package/dist/principal/client.d.ts +9 -0
  205. package/dist/principal/client.js +7 -0
  206. package/dist/principal/commands.d.ts +14 -0
  207. package/dist/principal/commands.js +84 -0
  208. package/dist/principal/index.d.ts +4 -0
  209. package/dist/principal/index.js +4 -0
  210. package/dist/principal/output.d.ts +8 -0
  211. package/dist/principal/output.js +43 -0
  212. package/dist/principal/tree/index.js +2 -0
  213. package/dist/principal/tree/tree.js +31 -0
  214. package/dist/project-guard/client.d.ts +13 -0
  215. package/dist/project-guard/input.js +15 -1
  216. package/dist/project-guard/output/format.js +5 -0
  217. package/dist/project-instructions/client.d.ts +56 -0
  218. package/dist/project-instructions/client.js +7 -0
  219. package/dist/project-instructions/commands.d.ts +13 -0
  220. package/dist/project-instructions/commands.js +89 -0
  221. package/dist/project-instructions/index.d.ts +3 -0
  222. package/dist/project-instructions/index.js +3 -0
  223. package/dist/project-instructions/input.js +33 -0
  224. package/dist/project-instructions/output/format.js +22 -0
  225. package/dist/project-instructions/output/index.js +2 -0
  226. package/dist/project-knowledge/change.js +22 -0
  227. package/dist/project-knowledge/client.d.ts +127 -0
  228. package/dist/project-knowledge/client.js +17 -0
  229. package/dist/project-knowledge/commands.d.ts +14 -0
  230. package/dist/project-knowledge/commands.js +100 -0
  231. package/dist/project-knowledge/index.d.ts +3 -0
  232. package/dist/project-knowledge/index.js +3 -0
  233. package/dist/project-knowledge/input.js +32 -0
  234. package/dist/project-knowledge/output/format.js +64 -0
  235. package/dist/project-knowledge/output/index.js +2 -0
  236. package/dist/project-knowledge/sources.js +108 -0
  237. package/dist/project-knowledge/upload.js +27 -0
  238. package/dist/project-workspace/git-reads.d.ts +12 -0
  239. package/dist/project-workspace/git-reads.js +71 -0
  240. package/dist/project-workspace/index.d.ts +1 -0
  241. package/dist/project-workspace/index.js +1 -0
  242. package/dist/project-workspace/metadata-client.d.ts +2 -0
  243. package/dist/project-workspace/output/human.js +1 -1
  244. package/dist/project-workspace/tree/tree.js +95 -5
  245. package/dist/reach/client.d.ts +9 -0
  246. package/dist/reach/client.js +7 -0
  247. package/dist/reach/commands.d.ts +14 -0
  248. package/dist/reach/commands.js +72 -0
  249. package/dist/reach/index.d.ts +3 -0
  250. package/dist/reach/index.js +3 -0
  251. package/dist/reach/output.js +41 -0
  252. package/dist/reach/tree/index.js +2 -0
  253. package/dist/reach/tree/tree.js +28 -0
  254. package/dist/reference/resolve.js +2 -1
  255. package/dist/remote-node/client.d.ts +85 -0
  256. package/dist/remote-node/commands.d.ts +1 -0
  257. package/dist/remote-node/commands.js +60 -18
  258. package/dist/remote-node/connector.d.ts +16 -0
  259. package/dist/remote-node/connector.js +10 -3
  260. package/dist/remote-node/index.d.ts +1 -1
  261. package/dist/remote-node/index.js +1 -1
  262. package/dist/remote-node/lifecycle.js +66 -0
  263. package/dist/remote-node/reachability.js +31 -18
  264. package/dist/remote-node/reading.js +31 -0
  265. package/dist/remote-node/text.js +68 -5
  266. package/dist/remote-node/tree/tree.js +26 -3
  267. package/dist/routine/client.d.ts +547 -13
  268. package/dist/routine/client.js +19 -1
  269. package/dist/routine/commands.d.ts +5 -0
  270. package/dist/routine/commands.js +73 -15
  271. package/dist/routine/index.d.ts +2 -1
  272. package/dist/routine/index.js +2 -1
  273. package/dist/routine/input.js +66 -3
  274. package/dist/routine/output/format.js +80 -19
  275. package/dist/routine/output/index.js +1 -1
  276. package/dist/routine/portable/import-files.js +74 -0
  277. package/dist/routine/portable/import-output.js +21 -0
  278. package/dist/routine/portable/import.js +274 -0
  279. package/dist/routine/portable/index.js +3 -0
  280. package/dist/routine/portable/portable.js +185 -0
  281. package/dist/routine/tree/tree.js +80 -8
  282. package/dist/routine/trigger/commands.d.ts +20 -0
  283. package/dist/routine/trigger/commands.js +74 -0
  284. package/dist/routine/trigger/format.js +42 -0
  285. package/dist/routine/trigger/index.d.ts +2 -0
  286. package/dist/routine/trigger/index.js +2 -0
  287. package/dist/routine/trigger/input.js +81 -0
  288. package/dist/run-ledger/client.d.ts +47 -0
  289. package/dist/secret/client.d.ts +39 -0
  290. package/dist/secret/client.js +6 -0
  291. package/dist/secret/commands.d.ts +12 -0
  292. package/dist/secret/commands.js +91 -0
  293. package/dist/secret/index.d.ts +3 -0
  294. package/dist/secret/index.js +3 -0
  295. package/dist/secret/input.js +22 -0
  296. package/dist/secret/output/format.js +10 -0
  297. package/dist/secret/output/index.js +2 -0
  298. package/dist/secret/tree/index.js +2 -0
  299. package/dist/secret/tree/tree.js +16 -0
  300. package/dist/session/agent-permission.d.ts +3 -2
  301. package/dist/session/approval/client.d.ts +9 -5
  302. package/dist/session/approval/client.js +2 -2
  303. package/dist/session/approval/commands.d.ts +8 -0
  304. package/dist/session/approval/commands.js +267 -21
  305. package/dist/session/approval/index.d.ts +1 -1
  306. package/dist/session/approval/index.js +1 -1
  307. package/dist/session/approval/output/format.js +53 -1
  308. package/dist/session/approval/output/index.js +1 -1
  309. package/dist/session/attach-render.js +6 -0
  310. package/dist/session/attach.d.ts +1 -1
  311. package/dist/session/attach.js +7 -2
  312. package/dist/session/client.d.ts +19 -13
  313. package/dist/session/client.js +39 -19
  314. package/dist/session/coding-client.d.ts +2 -0
  315. package/dist/session/coding-client.js +1 -2
  316. package/dist/session/coding-commands.js +24 -7
  317. package/dist/session/command/commands.js +109 -0
  318. package/dist/session/command/index.js +2 -0
  319. package/dist/session/commands.d.ts +6 -1
  320. package/dist/session/commands.js +417 -73
  321. package/dist/session/create-tasks.js +24 -51
  322. package/dist/session/creation/creation.js +51 -0
  323. package/dist/session/creation/index.js +2 -0
  324. package/dist/session/fork/fork.js +135 -0
  325. package/dist/session/fork/index.js +2 -0
  326. package/dist/session/git-status.d.ts +11 -0
  327. package/dist/session/git-status.js +30 -0
  328. package/dist/session/index.d.ts +4 -3
  329. package/dist/session/index.js +3 -2
  330. package/dist/session/interaction/client.d.ts +3 -0
  331. package/dist/session/move/index.js +2 -0
  332. package/dist/session/move/move.js +439 -0
  333. package/dist/session/output/held.js +28 -0
  334. package/dist/session/output/human.js +64 -10
  335. package/dist/session/output/tasks.js +68 -7
  336. package/dist/session/setup/index.js +2 -0
  337. package/dist/session/setup/setup.js +69 -0
  338. package/dist/session/spawn/caps.js +128 -0
  339. package/dist/session/spawn/index.js +5 -0
  340. package/dist/session/spawn/spawn.js +203 -0
  341. package/dist/session/spawn/standing.js +62 -0
  342. package/dist/session/spawn/supervision.js +62 -0
  343. package/dist/session/switch/index.js +2 -0
  344. package/dist/session/switch/switch.js +103 -0
  345. package/dist/session/tree/tree.js +372 -32
  346. package/dist/session/turn/attachments.js +54 -0
  347. package/dist/session/turn/client.d.ts +9 -1
  348. package/dist/session/turn/client.js +20 -1
  349. package/dist/session/turn/commands.d.ts +8 -1
  350. package/dist/session/turn/commands.js +253 -36
  351. package/dist/session/turn/index.d.ts +3 -3
  352. package/dist/session/turn/index.js +1 -1
  353. package/dist/session/turn/output.d.ts +34 -2
  354. package/dist/session/turn/output.js +52 -2
  355. package/dist/skills-sync/client.d.ts +9 -0
  356. package/dist/skills-sync/client.js +7 -0
  357. package/dist/skills-sync/commands.d.ts +15 -0
  358. package/dist/skills-sync/commands.js +241 -0
  359. package/dist/skills-sync/index.d.ts +3 -0
  360. package/dist/skills-sync/index.js +3 -0
  361. package/dist/skills-sync/output.js +168 -0
  362. package/dist/skills-sync/set-file.js +23 -0
  363. package/dist/skills-sync/tree/index.js +2 -0
  364. package/dist/skills-sync/tree/tree.js +38 -0
  365. package/dist/status/client.d.ts +21 -3
  366. package/dist/status/command.js +6 -3
  367. package/dist/status/doctor.d.ts +5 -1
  368. package/dist/status/doctor.js +14 -7
  369. package/dist/status/output/compact.d.ts +3 -0
  370. package/dist/status/output/compact.js +17 -7
  371. package/dist/status/output/human.js +25 -0
  372. package/dist/team-workspace/client.d.ts +1 -0
  373. package/dist/terminal/control-commands.js +26 -9
  374. package/dist/terminal/keys.js +62 -0
  375. package/dist/terminal/output/compact-list.js +3 -0
  376. package/dist/terminal/output/human.js +2 -2
  377. package/dist/terminal/tree/tree.js +1 -1
  378. package/dist/text-input/index.js +2 -0
  379. package/dist/text-input/text-input.js +35 -0
  380. package/dist/webhooks/client.d.ts +157 -0
  381. package/dist/webhooks/client.js +8 -0
  382. package/dist/webhooks/commands.d.ts +17 -0
  383. package/dist/webhooks/commands.js +76 -0
  384. package/dist/webhooks/index.d.ts +3 -0
  385. package/dist/webhooks/index.js +3 -0
  386. package/dist/webhooks/input.js +125 -0
  387. package/dist/webhooks/output/format.js +75 -0
  388. package/dist/webhooks/output/index.js +2 -0
  389. package/dist/webhooks/tree/index.js +2 -0
  390. package/dist/webhooks/tree/tree.js +49 -0
  391. package/guidance/maia-cli/SKILL.md +1 -1
  392. package/guidance/maia-node/SKILL.md +54 -0
  393. package/guidance/maia-orchestration/SKILL.md +1 -2
  394. package/guidance/maia-sessions/SKILL.md +110 -0
  395. package/package.json +7 -6
  396. package/dist/address-space/address-space.d.ts +0 -38
  397. package/dist/address-space/index.d.ts +0 -2
  398. package/dist/agents/input.d.ts +0 -130
  399. package/dist/agents/output/format.d.ts +0 -8
  400. package/dist/agents/output/index.d.ts +0 -2
  401. package/dist/agents/tree/index.d.ts +0 -2
  402. package/dist/agents/tree/tree.d.ts +0 -3
  403. package/dist/bootstrap/exit.d.ts +0 -14
  404. package/dist/bootstrap/exit.js +0 -42
  405. package/dist/bootstrap/index.d.ts +0 -3
  406. package/dist/bootstrap/index.js +0 -3
  407. package/dist/bootstrap/process.d.ts +0 -5
  408. package/dist/bootstrap/process.js +0 -23
  409. package/dist/bootstrap/run.d.ts +0 -25
  410. package/dist/bootstrap/run.js +0 -95
  411. package/dist/bootstrap/stdio.d.ts +0 -4
  412. package/dist/bootstrap/stdio.js +0 -9
  413. package/dist/cli/environment.d.ts +0 -8
  414. package/dist/cli/services.d.ts +0 -4
  415. package/dist/command-line/context.js +0 -2
  416. package/dist/command-line/input/stdin-stream.d.ts +0 -4
  417. package/dist/command-line/json-decoder.d.ts +0 -3
  418. package/dist/command-receipt/command.d.ts +0 -4
  419. package/dist/command-receipt/compact-list.d.ts +0 -20
  420. package/dist/command-receipt/index.d.ts +0 -3
  421. package/dist/command-tree/completion.d.ts +0 -6
  422. package/dist/command-tree/local.d.ts +0 -3
  423. package/dist/command-tree/row.js +0 -2
  424. package/dist/connection/access/format.d.ts +0 -8
  425. package/dist/connection/access/input.d.ts +0 -53
  426. package/dist/connection/input.d.ts +0 -50
  427. package/dist/connection/signin.d.ts +0 -4
  428. package/dist/connection/tree/index.d.ts +0 -2
  429. package/dist/connection/tree/tree.d.ts +0 -3
  430. package/dist/container/output/format.d.ts +0 -11
  431. package/dist/container/output/index.d.ts +0 -2
  432. package/dist/context/client.d.ts +0 -7
  433. package/dist/context/commands.d.ts +0 -3
  434. package/dist/context/index.d.ts +0 -3
  435. package/dist/dashboard/cockpit-client.d.ts +0 -6
  436. package/dist/dashboard/cockpit-client.js +0 -27
  437. package/dist/dashboard/cockpits.d.ts +0 -29
  438. package/dist/dashboard/cockpits.js +0 -65
  439. package/dist/dashboard/dashboard.d.ts +0 -7
  440. package/dist/dashboard/draw.d.ts +0 -15
  441. package/dist/dashboard/frame.d.ts +0 -4
  442. package/dist/dashboard/index.d.ts +0 -2
  443. package/dist/dashboard/modes.d.ts +0 -5
  444. package/dist/dashboard/node-connection.d.ts +0 -15
  445. package/dist/dashboard/node-connection.js +0 -51
  446. package/dist/dashboard/pi-tui.d.ts +0 -6
  447. package/dist/dashboard/status-bar.d.ts +0 -4
  448. package/dist/dashboard/terminal.d.ts +0 -53
  449. package/dist/dashboard/tree-model.d.ts +0 -28
  450. package/dist/dashboard/tree.d.ts +0 -10
  451. package/dist/development/cli.d.ts +0 -3
  452. package/dist/development/cli.js +0 -44
  453. package/dist/execution/tree/index.d.ts +0 -2
  454. package/dist/execution/tree/tree.d.ts +0 -3
  455. package/dist/hold/output/format.d.ts +0 -11
  456. package/dist/hold/output/index.d.ts +0 -2
  457. package/dist/hold/tree/index.d.ts +0 -2
  458. package/dist/hold/tree/tree.d.ts +0 -3
  459. package/dist/import/input.d.ts +0 -16
  460. package/dist/import/output.d.ts +0 -6
  461. package/dist/integration/output.d.ts +0 -22
  462. package/dist/login/failure.d.ts +0 -3
  463. package/dist/login/gateway.d.ts +0 -12
  464. package/dist/login/menu.d.ts +0 -4
  465. package/dist/login/output/format.d.ts +0 -16
  466. package/dist/login/output/index.d.ts +0 -2
  467. package/dist/login/vendor-account.d.ts +0 -95
  468. package/dist/login/vendor-input.d.ts +0 -14
  469. package/dist/mcp/calls.d.ts +0 -8
  470. package/dist/orchestration/output/compact-aggregate.d.ts +0 -121
  471. package/dist/orchestration/output/compact-run-list.d.ts +0 -20
  472. package/dist/orchestration/output/human.d.ts +0 -80
  473. package/dist/orchestration/output/index.d.ts +0 -4
  474. package/dist/orchestration/tree/index.d.ts +0 -2
  475. package/dist/orchestration/tree/tree.d.ts +0 -3
  476. package/dist/port-lease/input.d.ts +0 -65
  477. package/dist/port-lease/output/format.d.ts +0 -11
  478. package/dist/port-lease/output/index.d.ts +0 -2
  479. package/dist/presentation/output/format.d.ts +0 -11
  480. package/dist/presentation/output/index.d.ts +0 -3
  481. package/dist/project-guard/input.d.ts +0 -18
  482. package/dist/project-guard/output/format.d.ts +0 -11
  483. package/dist/project-guard/output/index.d.ts +0 -2
  484. package/dist/project-workspace/output/human.d.ts +0 -139
  485. package/dist/project-workspace/output/index.d.ts +0 -3
  486. package/dist/project-workspace/output/metadata.d.ts +0 -11
  487. package/dist/project-workspace/tree/index.d.ts +0 -2
  488. package/dist/project-workspace/tree/tree.d.ts +0 -3
  489. package/dist/provider/client.d.ts +0 -6
  490. package/dist/provider/commands.d.ts +0 -3
  491. package/dist/provider/index.d.ts +0 -3
  492. package/dist/reference/commands.d.ts +0 -3
  493. package/dist/reference/index.d.ts +0 -3
  494. package/dist/reference/resolve.d.ts +0 -31
  495. package/dist/reference/tree/index.d.ts +0 -2
  496. package/dist/reference/tree/tree.d.ts +0 -3
  497. package/dist/remote-node/reachability.d.ts +0 -64
  498. package/dist/remote-node/text.d.ts +0 -10
  499. package/dist/remote-node/tree/index.d.ts +0 -2
  500. package/dist/remote-node/tree/tree.d.ts +0 -3
  501. package/dist/routine/input.d.ts +0 -28
  502. package/dist/routine/output/format.d.ts +0 -23
  503. package/dist/routine/output/index.d.ts +0 -2
  504. package/dist/routine/tree/index.d.ts +0 -2
  505. package/dist/routine/tree/tree.d.ts +0 -3
  506. package/dist/run-ledger/input.d.ts +0 -42
  507. package/dist/run-ledger/output/format.d.ts +0 -11
  508. package/dist/run-ledger/output/index.d.ts +0 -2
  509. package/dist/session/approval/output/format.d.ts +0 -23
  510. package/dist/session/approval/output/index.d.ts +0 -2
  511. package/dist/session/attach-render.d.ts +0 -16
  512. package/dist/session/create-tasks.d.ts +0 -20
  513. package/dist/session/interaction/input.d.ts +0 -15
  514. package/dist/session/interaction/output/format.d.ts +0 -11
  515. package/dist/session/interaction/output/index.d.ts +0 -2
  516. package/dist/session/output/diff.d.ts +0 -3
  517. package/dist/session/output/failure.d.ts +0 -11
  518. package/dist/session/output/human.d.ts +0 -113
  519. package/dist/session/output/index.d.ts +0 -6
  520. package/dist/session/output/observe.d.ts +0 -4
  521. package/dist/session/output/tasks.d.ts +0 -34
  522. package/dist/session/task-file.d.ts +0 -5
  523. package/dist/session/tree/index.d.ts +0 -2
  524. package/dist/session/tree/tree.d.ts +0 -3
  525. package/dist/team-workspace/ceremony.d.ts +0 -19
  526. package/dist/team-workspace/confirmation.d.ts +0 -4
  527. package/dist/team-workspace/dependencies.js +0 -2
  528. package/dist/team-workspace/output.d.ts +0 -15
  529. package/dist/terminal/arguments.d.ts +0 -13
  530. package/dist/terminal/output/compact-list.d.ts +0 -148
  531. package/dist/terminal/output/human.d.ts +0 -42
  532. package/dist/terminal/output/index.d.ts +0 -3
  533. package/dist/terminal/tree/index.d.ts +0 -2
  534. package/dist/terminal/tree/tree.d.ts +0 -3
  535. /package/dist/command-line/{json-decoder.js → emit/json-decoder.js} +0 -0
  536. /package/dist/command-line/{json.d.ts → emit/json.d.ts} +0 -0
  537. /package/dist/command-line/{json.js → emit/json.js} +0 -0
@@ -6,43 +6,66 @@ import { newCliIdentifier } from "../local-node/index.js";
6
6
  const readSessionLimit = (value) => {
7
7
  if (value === undefined)
8
8
  return {};
9
- if (!/^(?:[1-9]|1[0-6])$/u.test(value))
10
- throw new CliArgumentError("Option '--max-sessions' must be an integer from 1 to 16.");
9
+ if (!/^(?:[1-9]|[1-5][0-9]|6[0-4])$/u.test(value))
10
+ throw new CliArgumentError("Option '--max-sessions' must be an integer from 1 to 64.");
11
11
  return { maxConcurrentSessions: Number(value) };
12
12
  };
13
+ const GATEWAY_VALUE_OPTIONS = new Set([
14
+ "--api-key-env",
15
+ "--base-url",
16
+ "--command-id",
17
+ "--max-sessions",
18
+ "--name",
19
+ ]);
20
+ const requireOneKeySource = (stdin, apiKeyEnvironment) => {
21
+ if (!stdin && apiKeyEnvironment === undefined)
22
+ throw missingArgument();
23
+ if (stdin && apiKeyEnvironment !== undefined)
24
+ throw new CliArgumentError("Give the key with '--api-key-stdin' or '--api-key-env', not both.");
25
+ };
26
+ const requireNoVersionPath = (baseUrl) => {
27
+ if (/\/v1\/?$/u.test(baseUrl))
28
+ throw new CliArgumentError("Leave '/v1' out of '--base-url'; Maia adds it for each request.");
29
+ };
13
30
  export const readGatewayLogin = (tokens) => {
14
- const parsed = parseOptions(tokens, new Set(["--base-url", "--command-id", "--max-sessions", "--name"]), new Set(["--api-key-stdin"]));
31
+ const parsed = parseOptions(tokens, GATEWAY_VALUE_OPTIONS, new Set(["--api-key-stdin"]));
15
32
  requirePositionals(parsed.positionals, 1);
33
+ const apiKeyEnvironment = parsed.options.get("--api-key-env");
16
34
  const commandId = parsed.options.get("--command-id");
17
35
  const name = parsed.options.get("--name");
18
36
  const baseUrl = parsed.options.get("--base-url");
19
- if (parsed.positionals[0] !== "gateway" ||
20
- name === undefined ||
21
- baseUrl === undefined ||
22
- !parsed.flags.has("--api-key-stdin"))
37
+ if (parsed.positionals[0] !== "gateway" || name === undefined)
23
38
  throw missingArgument();
24
- if (/\/v1\/?$/u.test(baseUrl))
25
- throw new CliArgumentError("Leave '/v1' out of '--base-url'; Maia adds it for each request.");
39
+ if (baseUrl === undefined)
40
+ throw missingArgument();
41
+ requireOneKeySource(parsed.flags.has("--api-key-stdin"), apiKeyEnvironment);
42
+ requireNoVersionPath(baseUrl);
26
43
  return {
44
+ ...(apiKeyEnvironment === undefined
45
+ ? {}
46
+ : { apiKeyEnv: apiKeyEnvironment }),
27
47
  baseUrl,
28
48
  ...(commandId === undefined ? {} : { commandId }),
29
49
  name,
30
50
  ...readSessionLimit(parsed.options.get("--max-sessions")),
31
51
  };
32
52
  };
33
- const INVALID_GATEWAY = "Invalid gateway: '--base-url' must be https, or http to a loopback host, without credentials, query, fragment, trailing slash or '/v1'; '--name' uses lower-case letters, digits and dashes; the key is one line of 8 to 4096 printable characters.";
53
+ const INVALID_GATEWAY = "Invalid gateway: '--base-url' must be https, or http to a loopback host, without credentials, query, fragment, trailing slash or '/v1'; '--name' uses lower-case letters, digits and dashes; the key is one line of 8 to 4096 printable characters, or '--api-key-env' names MAIA_GATEWAY_API_KEY or a MAIA_GATEWAY_API_KEY_<SUFFIX> variable.";
34
54
  const readKey = (context) => {
35
55
  const stdin = context.io.stdin;
36
56
  return stdin === undefined
37
57
  ? Effect.fail(new CliArgumentError("Standard input is unavailable."))
38
58
  : recoverStdin(stdin({ label: "API key", maxBytes: 8 * 1024, maxChunks: 8 }), () => new CliArgumentError("Maia could not read the key from standard input."));
39
59
  };
40
- const gatewayParameters = (input, apiKey) => (input.commandId === undefined
60
+ const keySource = (input, context) => input.apiKeyEnv === undefined
61
+ ? readKey(context).pipe(Effect.map((key) => ({ apiKey: key.trim() })))
62
+ : Effect.succeed({});
63
+ const gatewayParameters = (input, key) => (input.commandId === undefined
41
64
  ? newCliIdentifier("command")
42
65
  : Effect.succeed(input.commandId)).pipe(Effect.flatMap((commandId) => {
43
66
  const parameters = connectionGatewayCreateParametersSchema.safeParse({
44
67
  ...input,
45
- apiKey: apiKey.trim(),
68
+ ...key,
46
69
  commandId,
47
70
  });
48
71
  return parameters.success
@@ -62,7 +85,7 @@ const withRetryHint = (error, commandId) => error instanceof ConnectionNodeError
62
85
  })
63
86
  : error;
64
87
  const createGateway = (context, parameters) => callNode(context.dependencies.createGatewayConnection, (create) => create(parameters)).pipe(Effect.mapError((error) => withRetryHint(error, parameters.commandId)));
65
- export const gatewayLogin = (tokens, context) => readInput(tokens).pipe(Effect.flatMap((input) => readKey(context).pipe(Effect.flatMap((key) => gatewayParameters(input, key)))), Effect.flatMap((parameters) => createGateway(context, parameters)), Effect.map((result) => {
88
+ export const gatewayLogin = (tokens, context) => readInput(tokens).pipe(Effect.flatMap((input) => keySource(input, context).pipe(Effect.flatMap((key) => gatewayParameters(input, key)))), Effect.flatMap((parameters) => createGateway(context, parameters)), Effect.map((result) => {
66
89
  if (result.keyCustody === "kept" && !context.json)
67
90
  context.io.stderr("The gateway already had a key; it keeps that key and ignored the one on stdin.\n");
68
91
  writeSuccess({ command: result.method, result: redactConnectionResult(result) }, context, formatConnectionResult);
@@ -1,3 +1,4 @@
1
+ import { EXECUTOR_IDS } from "@maiaos/sdk";
1
2
  import { Effect } from "effect";
2
3
  import { CliArgumentError, } from "../command-line/index.js";
3
4
  import { callNode, describeConnection, redactConnection, } from "../connection/index.js";
@@ -56,7 +57,7 @@ const signInAgain = (context, accounts) => ask(context, "Account name: ").pipe(E
56
57
  return say(context, `No account is named '${name}'.`);
57
58
  if (account.executor === "gateway")
58
59
  return say(context, `'${name}' is a gateway; it signs in with its API key, not a vendor login.`);
59
- const vendor = account.executor === "codex-cli" ? "codex" : "claude";
60
+ const vendor = account.executor === EXECUTOR_IDS.codex ? "codex" : "claude";
60
61
  return signInHere(context, {
61
62
  deviceCode: false,
62
63
  executor: account.executor,
@@ -1,3 +1,4 @@
1
+ import { EXECUTOR_IDS } from "@maiaos/sdk";
1
2
  import { Effect } from "effect";
2
3
  import { CliArgumentError, writeSuccess, } from "../command-line/index.js";
3
4
  import { callNode, ConnectionNodeError, findConnectionByName, formatConnectionResult, redactConnection, redactConnectionResult, runVendorLogin, } from "../connection/index.js";
@@ -40,7 +41,7 @@ const vendorSignIn = (context, connection, input) => Effect.suspend(() => (conte
40
41
  message: `The ${connection.executor} sign-in exited with status ${String(status)}.`,
41
42
  retryable: true,
42
43
  }))));
43
- const freshUsage = (context, connection) => connection.executor === "codex-cli"
44
+ const freshUsage = (context, connection) => connection.executor === EXECUTOR_IDS.codex
44
45
  ? callNode(context.dependencies.showConnectionUsage, (show) => show({ connectionId: connection.connectionId, refresh: true })).pipe(Effect.map((result) => result.connection), Effect.orElseSucceed(() => connection))
45
46
  : Effect.succeed(connection);
46
47
  export const signInHere = (context, input) => Effect.gen(function* () {
@@ -65,7 +66,7 @@ const startDeviceCodeLogin = (context, connection) => callNode(context.dependenc
65
66
  flow: "device-code",
66
67
  })));
67
68
  export const signInThroughNode = (context, input) => Effect.gen(function* () {
68
- if (input.executor !== "codex-cli")
69
+ if (input.executor !== EXECUTOR_IDS.codex)
69
70
  return yield* Effect.fail(new CliArgumentError("Claude Code signs in from a terminal: run 'maia login claude' in one."));
70
71
  const connection = yield* signableAccount(context, input);
71
72
  const started = yield* startDeviceCodeLogin(context, connection);
@@ -1,14 +1,15 @@
1
+ import { EXECUTOR_IDS } from "@maiaos/sdk";
1
2
  import { CliArgumentError, parseOptions, requirePositionals, } from "../command-line/index.js";
2
3
  const EXECUTORS = new Map([
3
- ["claude", "claude-code"],
4
- ["codex", "codex-cli"],
4
+ ["claude", EXECUTOR_IDS.claudeCode],
5
+ ["codex", EXECUTOR_IDS.codex],
5
6
  ]);
6
7
  export const vendorExecutor = (vendor) => EXECUTORS.get(vendor);
7
8
  const readSessionLimit = (value) => {
8
9
  if (value === undefined)
9
10
  return {};
10
- if (!/^(?:[1-9]|1[0-6])$/u.test(value))
11
- throw new CliArgumentError("Option '--max-sessions' must be an integer from 1 to 16.");
11
+ if (!/^(?:[1-9]|[1-5][0-9]|6[0-4])$/u.test(value))
12
+ throw new CliArgumentError("Option '--max-sessions' must be an integer from 1 to 64.");
12
13
  return { maxConcurrentSessions: Number(value) };
13
14
  };
14
15
  export const readVendorLogin = (tokens) => {
package/dist/mcp/calls.js CHANGED
@@ -1,236 +1,61 @@
1
- import { agentsListParametersSchema, agentsShowParametersSchema, approvalListParametersSchema, approvalRespondParametersSchema, approvalShowParametersSchema, connectionDetectParametersSchema, connectionListParametersSchema, connectionModelsListParametersSchema, connectionShowParametersSchema, connectionUsageShowParametersSchema, containerIndexListParametersSchema, COORDINATOR_TOOL_OPERATIONS, discoverySessionsListParametersSchema, invocationContextShowParametersSchema, LOCAL_NODE_CALL_METHODS, localNodeRequestPayloadSchema, portLeaseAcquireParametersSchema, portLeaseListParametersSchema, portLeaseReleaseParametersSchema, portLeaseRenewParametersSchema, projectGuardShowParametersSchema, projectListParametersSchema, projectShowParametersSchema, receiptGetParametersSchema, routineListParametersSchema, routineShowParametersSchema, runLedgerCreateParametersSchema, runLedgerListParametersSchema, runLedgerTaskDispatchParametersSchema, runLedgerTaskListParametersSchema, runLedgerTaskSettleParametersSchema, runLedgerTaskShowParametersSchema, sessionArchiveParametersSchema, sessionCreateParametersSchema, sessionDiffParametersSchema, sessionEventsListParametersSchema, sessionHistoryReadParametersSchema, sessionInboxAckParametersSchema, sessionInboxCheckParametersSchema, sessionListParametersSchema, sessionMessageSendParametersSchema, sessionObserveParametersSchema, sessionResumeParametersSchema, sessionShowParametersSchema, sessionStartParametersSchema, sessionStopParametersSchema, turnCancelParametersSchema, turnInterruptParametersSchema, turnQueueListParametersSchema, turnSendParametersSchema, turnShowParametersSchema, turnWaitParametersSchema, workerToolDefinitions, workspaceListParametersSchema, workspaceShowParametersSchema, } from "@maiaos/sdk";
1
+ import { coordinatorToolDefinitions, localNodeRequestPayloadSchema, workerToolDefinitions, } from "@maiaos/sdk";
2
2
  import { Effect, Predicate } from "effect";
3
3
  import { invalidNodeInput, } from "../local-node/index.js";
4
4
  const recoveryOf = (input) => Predicate.hasProperty(input, "commandId") &&
5
5
  Predicate.isString(input.commandId)
6
6
  ? { commandId: input.commandId }
7
7
  : undefined;
8
- const validated = (schema, run) => (node, input) => node.runValidatedNodeOperation(input, schema, run, recoveryOf(input));
9
- const status = (node, input) => input === undefined ||
10
- (Predicate.isObject(input) && Object.keys(input).length === 0)
11
- ? node.runNodeClientOperation((client, options) => client.status(options))
12
- : invalidNodeInput();
13
- const callBound = new Set(LOCAL_NODE_CALL_METHODS);
14
- const isCallPayload = (payload) => callBound.has(payload.method);
15
- const isCallBound = (operation) => callBound.has(operation);
16
- const typedCall = (method) => (node, input) => {
17
- const payload = localNodeRequestPayloadSchema.safeParse({
18
- method,
19
- parameters: input,
20
- });
21
- if (!payload.success)
22
- return invalidNodeInput(payload.error);
23
- const { data } = payload;
24
- return isCallPayload(data)
25
- ? node.runNodeClientOperation((client, options) => client.call(data.method, data.parameters, options), recoveryOf(input))
26
- : invalidNodeInput();
27
- };
28
- export const COORDINATOR_CALLS = new Map([
29
- ...COORDINATOR_TOOL_OPERATIONS.filter(isCallBound).map((operation) => [operation, typedCall(operation)]),
30
- [
31
- "agents.list",
32
- validated(agentsListParametersSchema, (client, parameters, options) => client.listAgents(parameters, options)),
33
- ],
34
- [
35
- "agents.show",
36
- validated(agentsShowParametersSchema, (client, parameters, options) => client.showAgent(parameters, options)),
37
- ],
38
- [
39
- "approval.list",
40
- validated(approvalListParametersSchema, (client, parameters, options) => client.listApprovals(parameters, options)),
41
- ],
42
- [
43
- "approval.show",
44
- validated(approvalShowParametersSchema, (client, parameters, options) => client.showApproval(parameters, options)),
45
- ],
46
- [
47
- "connection.detect",
48
- validated(connectionDetectParametersSchema, (client, parameters, options) => client.detectConnections(parameters, options)),
49
- ],
50
- [
51
- "connection.list",
52
- validated(connectionListParametersSchema, (client, parameters, options) => client.listConnections(parameters, options)),
53
- ],
54
- [
55
- "connection.models.list",
56
- validated(connectionModelsListParametersSchema, (client, parameters, options) => client.listConnectionModels(parameters, options)),
57
- ],
58
- [
59
- "connection.show",
60
- validated(connectionShowParametersSchema, (client, parameters, options) => client.showConnection(parameters, options)),
61
- ],
62
- [
63
- "connection.usage.show",
64
- validated(connectionUsageShowParametersSchema, (client, parameters, options) => client.showConnectionUsage(parameters, options)),
65
- ],
66
- [
67
- "container.index.list",
68
- validated(containerIndexListParametersSchema, (client, parameters, options) => client.listContainerIndex(parameters, options)),
69
- ],
70
- [
71
- "discovery.sessions.list",
72
- validated(discoverySessionsListParametersSchema, (client, parameters, options) => client.listDiscoveredSessions(parameters, options)),
73
- ],
74
- ["node.status", status],
75
- [
76
- "port.lease.acquire",
77
- validated(portLeaseAcquireParametersSchema, (client, parameters, options) => client.acquirePortLease(parameters, options)),
78
- ],
79
- [
80
- "port.lease.list",
81
- validated(portLeaseListParametersSchema, (client, parameters, options) => client.listPortLeases(parameters, options)),
82
- ],
83
- [
84
- "port.lease.release",
85
- validated(portLeaseReleaseParametersSchema, (client, parameters, options) => client.releasePortLease(parameters, options)),
86
- ],
87
- [
88
- "port.lease.renew",
89
- validated(portLeaseRenewParametersSchema, (client, parameters, options) => client.renewPortLease(parameters, options)),
90
- ],
91
- [
92
- "project.guard.show",
93
- validated(projectGuardShowParametersSchema, (client, parameters, options) => client.showProjectGuard(parameters, options)),
94
- ],
95
- [
96
- "project.list",
97
- validated(projectListParametersSchema, (client, parameters, options) => client.listProjects(parameters, options)),
98
- ],
99
- [
100
- "project.show",
101
- validated(projectShowParametersSchema, (client, parameters, options) => client.showProject(parameters, options)),
102
- ],
103
- [
104
- "receipt.get",
105
- validated(receiptGetParametersSchema, (client, parameters, options) => client.getReceipt(parameters, options)),
106
- ],
107
- [
108
- "routine.list",
109
- validated(routineListParametersSchema, (client, parameters, options) => client.listRoutines(parameters, options)),
110
- ],
111
- [
112
- "routine.show",
113
- validated(routineShowParametersSchema, (client, parameters, options) => client.showRoutine(parameters, options)),
114
- ],
115
- [
116
- "run.ledger.create",
117
- validated(runLedgerCreateParametersSchema, (client, parameters, options) => client.createRunLedger(parameters, options)),
118
- ],
119
- [
120
- "run.ledger.list",
121
- validated(runLedgerListParametersSchema, (client, parameters, options) => client.listRunLedgers(parameters, options)),
122
- ],
123
- [
124
- "run.ledger.task.dispatch",
125
- validated(runLedgerTaskDispatchParametersSchema, (client, parameters, options) => client.dispatchRunLedgerTask(parameters, options)),
126
- ],
127
- [
128
- "run.ledger.task.list",
129
- validated(runLedgerTaskListParametersSchema, (client, parameters, options) => client.listRunLedgerTasks(parameters, options)),
130
- ],
131
- [
132
- "run.ledger.task.settle",
133
- validated(runLedgerTaskSettleParametersSchema, (client, parameters, options) => client.settleRunLedgerTask(parameters, options)),
134
- ],
135
- [
136
- "run.ledger.task.show",
137
- validated(runLedgerTaskShowParametersSchema, (client, parameters, options) => client.showRunLedgerTask(parameters, options)),
138
- ],
139
- [
140
- "session.archive",
141
- validated(sessionArchiveParametersSchema, (client, parameters, options) => client.archiveSession(parameters, options)),
142
- ],
143
- [
144
- "session.create",
145
- validated(sessionCreateParametersSchema, (client, parameters, options) => client.createSession(parameters, options)),
146
- ],
147
- [
148
- "session.diff",
149
- validated(sessionDiffParametersSchema, (client, parameters, options) => client.diffSession(parameters, options)),
150
- ],
151
- [
152
- "session.events.list",
153
- validated(sessionEventsListParametersSchema, (client, parameters, options) => client.listSessionEvents(parameters, options)),
154
- ],
155
- [
156
- "session.history.read",
157
- validated(sessionHistoryReadParametersSchema, (client, parameters, options) => client.readSessionHistory(parameters, options)),
158
- ],
159
- [
160
- "session.list",
161
- validated(sessionListParametersSchema, (client, parameters, options) => client.listSessions(parameters, options)),
162
- ],
163
- [
164
- "session.observe",
165
- validated(sessionObserveParametersSchema, (client, parameters, options) => client.observeSessions(parameters, options)),
166
- ],
167
- [
168
- "session.resume",
169
- validated(sessionResumeParametersSchema, (client, parameters, options) => client.resumeSession(parameters, options)),
170
- ],
171
- [
172
- "session.show",
173
- validated(sessionShowParametersSchema, (client, parameters, options) => client.showSession(parameters, options)),
174
- ],
175
- [
176
- "session.start",
177
- validated(sessionStartParametersSchema, (client, parameters, options) => client.startSession(parameters, options)),
178
- ],
179
- [
180
- "session.stop",
181
- validated(sessionStopParametersSchema, (client, parameters, options) => client.stopSession(parameters, options)),
182
- ],
183
- [
184
- "turn.cancel",
185
- validated(turnCancelParametersSchema, (client, parameters, options) => client.cancelTurn(parameters, options)),
186
- ],
187
- [
188
- "turn.interrupt",
189
- validated(turnInterruptParametersSchema, (client, parameters, options) => client.interruptTurn(parameters, options)),
190
- ],
191
- [
192
- "turn.queue.list",
193
- validated(turnQueueListParametersSchema, (client, parameters, options) => client.listTurnQueue(parameters, options)),
194
- ],
195
- [
196
- "turn.send",
197
- validated(turnSendParametersSchema, (client, parameters, options) => client.sendTurn(parameters, options)),
198
- ],
199
- [
200
- "turn.show",
201
- validated(turnShowParametersSchema, (client, parameters, options) => client.showTurn(parameters, options)),
202
- ],
203
- [
204
- "turn.wait",
205
- validated(turnWaitParametersSchema, (client, parameters, options) => client.waitTurns(parameters, options)),
206
- ],
207
- [
208
- "workspace.list",
209
- validated(workspaceListParametersSchema, (client, parameters, options) => client.listWorkspaces(parameters, options)),
210
- ],
211
- [
212
- "workspace.show",
213
- validated(workspaceShowParametersSchema, (client, parameters, options) => client.showWorkspace(parameters, options)),
214
- ],
8
+ const WITHOUT_PARAMETERS = new Set([
9
+ "showNodeUpdate",
10
+ "status",
215
11
  ]);
12
+ const sdkArguments = ({ operation, sdkOperation }, parameters, options) => {
13
+ if (sdkOperation === "call")
14
+ return [operation, parameters, options];
15
+ return WITHOUT_PARAMETERS.has(sdkOperation)
16
+ ? [options]
17
+ : [parameters, options];
18
+ };
19
+ const isSdkEffect = (value) => Effect.isEffect(value);
20
+ export const bindSdkOperation = (tool) => (client, parameters, options) => {
21
+ const operation = Reflect.get(client, tool.sdkOperation);
22
+ if (typeof operation !== "function")
23
+ return Effect.die(new Error(`The SDK client has no ${tool.sdkOperation} for ${tool.operation}.`));
24
+ const result = Reflect.apply(operation, client, sdkArguments(tool, parameters, options));
25
+ return isSdkEffect(result)
26
+ ? result
27
+ : Effect.die(new Error(`The SDK operation ${tool.sdkOperation} for ${tool.operation} returned no Effect.`));
28
+ };
29
+ const handedOver = ({ operation }, checked, input) => operation === "session.resume" &&
30
+ Predicate.isObject(checked) &&
31
+ Predicate.hasProperty(input, "parent") &&
32
+ input.parent !== undefined
33
+ ? { ...checked, parent: input.parent }
34
+ : checked;
35
+ const callFor = (tool) => {
36
+ const run = bindSdkOperation(tool);
37
+ return (node, input) => {
38
+ const payload = localNodeRequestPayloadSchema.safeParse({
39
+ method: tool.operation,
40
+ parameters: input === undefined && WITHOUT_PARAMETERS.has(tool.sdkOperation)
41
+ ? {}
42
+ : input,
43
+ });
44
+ return payload.success
45
+ ? node.runNodeClientOperation((client, options) => run(client, handedOver(tool, payload.data.parameters, input), options), recoveryOf(input))
46
+ : invalidNodeInput(payload.error);
47
+ };
48
+ };
49
+ const callsOf = (tools) => new Map(tools.map((tool) => [
50
+ tool.operation,
51
+ callFor(tool),
52
+ ]));
53
+ export const COORDINATOR_CALLS = callsOf(coordinatorToolDefinitions());
216
54
  export const callCoordinator = (node) => (operation, input) => {
217
55
  const call = COORDINATOR_CALLS.get(operation);
218
56
  return call === undefined
219
57
  ? Effect.die(new Error(`No SDK call for ${operation}.`))
220
58
  : call(node, input);
221
59
  };
222
- export const WORKER_CALLS = (() => {
223
- const available = new Map(COORDINATOR_CALLS);
224
- available.set("context.show", validated(invocationContextShowParametersSchema, (client, parameters, options) => client.showCurrentContext(parameters, options)));
225
- available.set("approval.respond", validated(approvalRespondParametersSchema, (client, parameters, options) => client.respondToApproval(parameters, options)));
226
- available.set("session.inbox.ack", validated(sessionInboxAckParametersSchema, (client, parameters, options) => client.acknowledgeSessionDelivery(parameters, options)));
227
- available.set("session.inbox.check", validated(sessionInboxCheckParametersSchema, (client, parameters, options) => client.checkSessionInbox(parameters, options)));
228
- available.set("session.message.send", validated(sessionMessageSendParametersSchema, (client, parameters, options) => client.sendSessionMessage(parameters, options)));
229
- return new Map(workerToolDefinitions("orchestrator").map(({ operation }) => {
230
- const call = available.get(operation);
231
- if (call === undefined)
232
- throw new Error(`No worker SDK call for ${operation}.`);
233
- return [operation, call];
234
- }));
235
- })();
60
+ export const WORKER_CALLS = callsOf(workerToolDefinitions("orchestrator"));
236
61
  //# sourceMappingURL=calls.js.map
@@ -1,15 +1,16 @@
1
1
  import type { RouteKind } from "@maiaos/client-core/cockpit";
2
2
  import { type CoordinatorToolOperation, type ProtocolError } from "@maiaos/sdk";
3
+ import { type SupervisedResume } from "@maiaos/sdk/node/effect";
3
4
  import { type Crypto, Effect } from "effect";
4
5
  import { type Fleet } from "../fleet/index.js";
5
6
  import { type CliNodeEffect, type CliNodeResult } from "../local-node/index.js";
6
- export type ToolReach = (operation: CoordinatorToolOperation, input: unknown) => CliNodeEffect<unknown>;
7
+ export type ToolReach = <TOperation extends CoordinatorToolOperation>(operation: TOperation, input: TOperation extends "session.resume" ? SupervisedResume : unknown) => CliNodeEffect<unknown>;
7
8
  export type ToolAnswer = CliNodeResult<unknown> | {
8
9
  readonly error: ProtocolError;
9
10
  readonly ok: false;
10
11
  readonly result: unknown;
11
12
  };
12
- type ToolKind = Exclude<RouteKind, "terminal">;
13
+ type ToolKind = Exclude<RouteKind, "inbox" | "terminal">;
13
14
  type ToolRoute = {
14
15
  readonly held?: {
15
16
  readonly ids: (input: object) => unknown;
@@ -1,4 +1,5 @@
1
- import { localNodeRequestPayloadSchema, } from "@maiaos/sdk";
1
+ import { localNodeRequestPayloadSchema, sessionShowResultSchema, } from "@maiaos/sdk";
2
+ import { resumeSupervised, } from "@maiaos/sdk/node/effect";
2
3
  import { Effect, Predicate, Result } from "effect";
3
4
  import { askEach, failureOf, fleetNodes, holderIn, mergeLists, refused, routes, } from "../fleet/index.js";
4
5
  import { invalidNodeInput, } from "../local-node/index.js";
@@ -25,6 +26,7 @@ export const TOOL_ROUTES = new Map([
25
26
  ["agents.list", LOCAL],
26
27
  ["agents.show", LOCAL],
27
28
  ["approval.list", held("session", "sessionId", true)],
29
+ ["approval.respond", held("approval", "approvalId")],
28
30
  ["approval.show", held("approval", "approvalId")],
29
31
  ["connection.detect", LOCAL],
30
32
  ["connection.list", LOCAL],
@@ -34,6 +36,9 @@ export const TOOL_ROUTES = new Map([
34
36
  ["container.index.list", LOCAL],
35
37
  ["discovery.sessions.list", LOCAL],
36
38
  ["node.status", LOCAL],
39
+ ["node.update.pause", LOCAL],
40
+ ["node.update.resume", LOCAL],
41
+ ["node.update.show", LOCAL],
37
42
  ["port.lease.acquire", LOCAL],
38
43
  ["port.lease.list", LOCAL],
39
44
  ["port.lease.release", LOCAL],
@@ -44,6 +49,7 @@ export const TOOL_ROUTES = new Map([
44
49
  ["receipt.get", held("command", "commandId")],
45
50
  ["reference.resolve", held("project", "projectId")],
46
51
  ["routine.list", held("project", "projectId", true)],
52
+ ["routine.runs", held("routine", "routineId")],
47
53
  ["routine.show", held("routine", "routineId")],
48
54
  ["run.ledger.create", LOCAL],
49
55
  ["run.ledger.list", LOCAL],
@@ -52,9 +58,12 @@ export const TOOL_ROUTES = new Map([
52
58
  ["run.ledger.task.settle", LOCAL],
53
59
  ["run.ledger.task.show", LOCAL],
54
60
  ["session.archive", held("session", "sessionId")],
61
+ ["session.command.list", held("session", "sessionId")],
62
+ ["session.command.send", held("session", "sessionId")],
55
63
  ["session.create", held("workspace", "workspaceId")],
56
64
  ["session.diff", held("session", "sessionId")],
57
65
  ["session.events.list", held("session", "sessionId")],
66
+ ["session.git.status", held("session", "sessionId")],
58
67
  ["session.history.read", HISTORY],
59
68
  ["session.list", held("project", "projectId", true)],
60
69
  ["session.observe", held("session", "sessionIds", true)],
@@ -66,9 +75,12 @@ export const TOOL_ROUTES = new Map([
66
75
  ["turn.cancel", held("turn", "turnId")],
67
76
  ["turn.interrupt", held("turn", "turnId")],
68
77
  ["turn.queue.list", held("session", "sessionId")],
78
+ ["turn.queue.promote", held("turn", "turnId")],
69
79
  ["turn.send", held("session", "sessionId")],
70
80
  ["turn.show", held("turn", "turnId")],
71
81
  ["turn.wait", held("turn", "turnIds")],
82
+ ["workspace.branches.list", held("workspace", "workspaceId")],
83
+ ["workspace.code-host.show", held("workspace", "workspaceId")],
72
84
  ["workspace.list", held("project", "projectId")],
73
85
  ["workspace.show", held("workspace", "workspaceId")],
74
86
  ]);
@@ -154,14 +166,29 @@ const mergedAnswer = (operation) => (answers) => {
154
166
  const mergedList = (nodes, operation, input) => continues(input)
155
167
  ? Effect.succeed(refused("invalid_argument", `A cursor pages one Node: ${CHOOSE_NODE} to page it.`))
156
168
  : Effect.map(askEach(nodes, (reach) => reach(operation, input)), mergedAnswer(operation));
157
- const routeAmong = (local, nodes, { held, merged }) => (operation, input) => {
169
+ const shownOn = (reach, sessionId) => Effect.map(reach("session.show", { sessionId }), (answer) => {
170
+ if (!answer.ok)
171
+ return answer;
172
+ const shown = sessionShowResultSchema.safeParse(answer.value);
173
+ return shown.success
174
+ ? { ok: true, value: shown.data }
175
+ : refused("internal_error", "A Node answered an unknown Session show.");
176
+ });
177
+ const resumeOn = (nodes, parameters) => ({ reach }) => resumeSupervised({
178
+ claim: () => Effect.succeed({ ok: true, value: parameters.parent }),
179
+ parentShows: (sessionId) => Effect.map(askEach(nodes, (asked) => shownOn(asked, sessionId)), (answers) => ({
180
+ ok: true,
181
+ value: answers.map(({ result }) => result),
182
+ })),
183
+ resumeSession: (resumed) => reach("session.resume", resumed),
184
+ showSession: (sessionId) => shownOn(reach, sessionId),
185
+ }, parameters);
186
+ const routeAmong = (local, nodes, { held, merged }) => (operation, input, send) => {
158
187
  const ids = held === undefined ? [] : heldIds(held, input);
159
188
  if (held !== undefined && ids.length > 0)
160
- return Effect.flatMap(holderOfAll(nodes, held.kind, ids), (holder) => holder.ok
161
- ? holder.value.reach(operation, input)
162
- : Effect.succeed(holder));
189
+ return Effect.flatMap(holderOfAll(nodes, held.kind, ids), (holder) => holder.ok ? send(holder.value) : Effect.succeed(holder));
163
190
  return merged === undefined
164
- ? local.reach(operation, input)
191
+ ? send(local)
165
192
  : mergedList(nodes, operation, input);
166
193
  };
167
194
  const ROUTED = new Set(TOOL_ROUTES.keys());
@@ -177,12 +204,16 @@ export const routeToolCall = (fleet, operation, input) => {
177
204
  });
178
205
  if (!checked.success)
179
206
  return invalidNodeInput(checked.error);
207
+ const { data } = checked;
180
208
  return Effect.flatMap(fleetNodes(fleet), (space) => {
181
209
  if (!space.ok)
182
210
  return Effect.succeed(space);
211
+ const send = data.method === "session.resume"
212
+ ? resumeOn(space.value, data.parameters)
213
+ : ({ reach }) => reach(operation, input);
183
214
  return space.value.length === 1
184
- ? local.reach(operation, input)
185
- : routeAmong(local, space.value, route)(operation, input);
215
+ ? send(local)
216
+ : routeAmong(local, space.value, route)(operation, input, send);
186
217
  });
187
218
  };
188
219
  //# sourceMappingURL=routing.js.map
@@ -8,13 +8,22 @@ export type ToolFleet = Omit<Fleet<ToolReach>, "local"> & {
8
8
  readonly node: string;
9
9
  };
10
10
  export declare const toolResult: (result: ToolAnswer) => McpSchema.CallToolResult;
11
+ declare const SessionRoleUnreadable_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Cause.YieldableError & {
12
+ readonly _tag: "SessionRoleUnreadable";
13
+ } & Readonly<A>;
14
+ export declare class SessionRoleUnreadable extends SessionRoleUnreadable_base<{
15
+ readonly message: string;
16
+ }> {
17
+ }
18
+ type McpStartError = Cause.IllegalArgumentError | SessionRoleUnreadable;
11
19
  export declare const coordinatorMcpLayer: (node: CliNodeOperations, version: string, { fleet, worker, }?: {
12
20
  readonly fleet?: ToolFleet;
13
21
  readonly worker?: boolean;
14
- }) => Layer.Layer<never, Cause.IllegalArgumentError, Crypto.Crypto | Stdio>;
22
+ }) => Layer.Layer<never, McpStartError, Crypto.Crypto | Stdio>;
15
23
  export declare const serveCoordinatorMcp: (node: CliNodeOperations, version: string, options?: {
16
24
  readonly fleet?: ToolFleet;
17
25
  readonly stdio?: Layer.Layer<Stdio>;
18
26
  readonly worker?: boolean;
19
27
  }) => Effect.Effect<number, never, Crypto.Crypto>;
28
+ export {};
20
29
  //# sourceMappingURL=server.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import * as NodeStdio from "@effect/platform-node-shared/NodeStdio";
2
2
  import { coordinatorToolDefinitions, workerToolDefinitions, } from "@maiaos/sdk";
3
- import { Cause, Context, Crypto, Effect, Exit, Fiber, Layer, Logger, Predicate, } from "effect";
3
+ import { Cause, Context, Crypto, Data, Effect, Exit, Fiber, Layer, Logger, Predicate, } from "effect";
4
4
  import * as McpProtocol from "effect/ai/McpProtocol";
5
5
  import * as McpSchema from "effect/ai/McpSchema";
6
6
  import * as McpServer from "effect/ai/McpServer";
@@ -43,15 +43,25 @@ const callFor = (definition) => {
43
43
  ? Effect.die(new Error(`No SDK call for ${definition.operation}.`))
44
44
  : Effect.succeed(call);
45
45
  };
46
+ export class SessionRoleUnreadable extends Data.TaggedError("SessionRoleUnreadable") {
47
+ }
48
+ const CREDENTIAL_FAILURES = new Set([
49
+ "authentication_failed",
50
+ "configuration_invalid",
51
+ ]);
46
52
  const sessionRole = (node) => {
47
53
  const show = WORKER_CALLS.get("context.show");
48
54
  return show === undefined
49
55
  ? Effect.succeed("worker")
50
- : show(node, {}).pipe(Effect.map((result) => result.ok &&
51
- Predicate.hasProperty(result.value, "role") &&
52
- result.value.role === "orchestrator"
53
- ? "orchestrator"
54
- : "worker"));
56
+ : show(node, {}).pipe(Effect.flatMap((result) => result.ok || CREDENTIAL_FAILURES.has(result.error.code)
57
+ ? Effect.succeed(result.ok &&
58
+ Predicate.hasProperty(result.value, "role") &&
59
+ result.value.role === "orchestrator"
60
+ ? "orchestrator"
61
+ : "worker")
62
+ : Effect.fail(new SessionRoleUnreadable({
63
+ message: `This Session's context.show failed (${result.error.code}: ${result.error.message}), so its tools are unknown.`,
64
+ }))), Effect.tapError((error) => Effect.logError(error.message)));
55
65
  };
56
66
  const answerFor = (node, call, fleet) => (definition) => (payload) => {
57
67
  const { operation } = definition;