@maiaos/cli 0.1.0-canary.8 → 0.1.0-canary.80

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 (527) 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 +211 -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 +20 -6
  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 +189 -234
  151. package/dist/local-node/index.d.ts +1 -1
  152. package/dist/local-node/index.js +1 -1
  153. package/dist/login/commands.js +7 -1
  154. package/dist/login/gateway.js +36 -13
  155. package/dist/login/menu.js +2 -1
  156. package/dist/login/vendor-account.js +3 -2
  157. package/dist/login/vendor-input.js +5 -4
  158. package/dist/mcp/calls.js +47 -221
  159. package/dist/mcp/routing.d.ts +3 -2
  160. package/dist/mcp/routing.js +38 -8
  161. package/dist/mcp/server.d.ts +10 -1
  162. package/dist/mcp/server.js +16 -6
  163. package/dist/migrate/classes.js +158 -0
  164. package/dist/migrate/commands.js +46 -0
  165. package/dist/migrate/format.js +199 -0
  166. package/dist/migrate/index.js +2 -0
  167. package/dist/migrate/item.js +59 -0
  168. package/dist/migrate/plan.js +79 -0
  169. package/dist/migrate/tree/index.js +2 -0
  170. package/dist/migrate/tree/tree.js +23 -0
  171. package/dist/node-update/client.d.ts +17 -0
  172. package/dist/node-update/client.js +27 -0
  173. package/dist/node-update/commands.d.ts +20 -0
  174. package/dist/node-update/commands.js +150 -0
  175. package/dist/node-update/index.d.ts +4 -0
  176. package/dist/node-update/index.js +4 -0
  177. package/dist/node-update/output.d.ts +12 -0
  178. package/dist/node-update/output.js +165 -0
  179. package/dist/node-update/tree/index.js +2 -0
  180. package/dist/node-update/tree/tree.js +73 -0
  181. package/dist/pairing/client.d.ts +13 -0
  182. package/dist/pairing/client.js +36 -0
  183. package/dist/pairing/commands.d.ts +15 -0
  184. package/dist/pairing/commands.js +131 -0
  185. package/dist/pairing/index.d.ts +4 -0
  186. package/dist/pairing/index.js +4 -0
  187. package/dist/pairing/output.d.ts +12 -0
  188. package/dist/pairing/output.js +53 -0
  189. package/dist/pairing/tree/index.js +2 -0
  190. package/dist/pairing/tree/tree.js +35 -0
  191. package/dist/panel/client.d.ts +9 -0
  192. package/dist/panel/client.js +24 -0
  193. package/dist/panel/commands.d.ts +19 -0
  194. package/dist/panel/commands.js +112 -0
  195. package/dist/panel/index.d.ts +3 -0
  196. package/dist/panel/index.js +3 -0
  197. package/dist/panel/tree/index.js +2 -0
  198. package/dist/panel/tree/tree.js +14 -0
  199. package/dist/port-lease/client.d.ts +3 -0
  200. package/dist/principal/client.d.ts +9 -0
  201. package/dist/principal/client.js +7 -0
  202. package/dist/principal/commands.d.ts +14 -0
  203. package/dist/principal/commands.js +84 -0
  204. package/dist/principal/index.d.ts +4 -0
  205. package/dist/principal/index.js +4 -0
  206. package/dist/principal/output.d.ts +8 -0
  207. package/dist/principal/output.js +43 -0
  208. package/dist/principal/tree/index.js +2 -0
  209. package/dist/principal/tree/tree.js +31 -0
  210. package/dist/project-guard/client.d.ts +13 -0
  211. package/dist/project-guard/input.js +15 -1
  212. package/dist/project-guard/output/format.js +5 -0
  213. package/dist/project-instructions/client.d.ts +56 -0
  214. package/dist/project-instructions/client.js +7 -0
  215. package/dist/project-instructions/commands.d.ts +13 -0
  216. package/dist/project-instructions/commands.js +89 -0
  217. package/dist/project-instructions/index.d.ts +3 -0
  218. package/dist/project-instructions/index.js +3 -0
  219. package/dist/project-instructions/input.js +33 -0
  220. package/dist/project-instructions/output/format.js +22 -0
  221. package/dist/project-instructions/output/index.js +2 -0
  222. package/dist/project-knowledge/change.js +22 -0
  223. package/dist/project-knowledge/client.d.ts +127 -0
  224. package/dist/project-knowledge/client.js +17 -0
  225. package/dist/project-knowledge/commands.d.ts +14 -0
  226. package/dist/project-knowledge/commands.js +100 -0
  227. package/dist/project-knowledge/index.d.ts +3 -0
  228. package/dist/project-knowledge/index.js +3 -0
  229. package/dist/project-knowledge/input.js +32 -0
  230. package/dist/project-knowledge/output/format.js +64 -0
  231. package/dist/project-knowledge/output/index.js +2 -0
  232. package/dist/project-knowledge/sources.js +108 -0
  233. package/dist/project-knowledge/upload.js +27 -0
  234. package/dist/project-workspace/git-reads.d.ts +12 -0
  235. package/dist/project-workspace/git-reads.js +71 -0
  236. package/dist/project-workspace/index.d.ts +1 -0
  237. package/dist/project-workspace/index.js +1 -0
  238. package/dist/project-workspace/metadata-client.d.ts +2 -0
  239. package/dist/project-workspace/output/human.js +1 -1
  240. package/dist/project-workspace/tree/tree.js +95 -5
  241. package/dist/reach/client.d.ts +9 -0
  242. package/dist/reach/client.js +7 -0
  243. package/dist/reach/commands.d.ts +14 -0
  244. package/dist/reach/commands.js +72 -0
  245. package/dist/reach/index.d.ts +3 -0
  246. package/dist/reach/index.js +3 -0
  247. package/dist/reach/output.js +41 -0
  248. package/dist/reach/tree/index.js +2 -0
  249. package/dist/reach/tree/tree.js +28 -0
  250. package/dist/remote-node/client.d.ts +85 -0
  251. package/dist/remote-node/commands.js +32 -17
  252. package/dist/remote-node/connector.d.ts +16 -0
  253. package/dist/remote-node/connector.js +10 -3
  254. package/dist/remote-node/reachability.js +31 -18
  255. package/dist/remote-node/reading.js +31 -0
  256. package/dist/remote-node/text.js +68 -5
  257. package/dist/remote-node/tree/tree.js +14 -3
  258. package/dist/routine/client.d.ts +547 -13
  259. package/dist/routine/client.js +19 -1
  260. package/dist/routine/commands.d.ts +5 -0
  261. package/dist/routine/commands.js +73 -15
  262. package/dist/routine/index.d.ts +2 -1
  263. package/dist/routine/index.js +2 -1
  264. package/dist/routine/input.js +66 -3
  265. package/dist/routine/output/format.js +80 -19
  266. package/dist/routine/output/index.js +1 -1
  267. package/dist/routine/portable/import-files.js +74 -0
  268. package/dist/routine/portable/import-output.js +21 -0
  269. package/dist/routine/portable/import.js +274 -0
  270. package/dist/routine/portable/index.js +3 -0
  271. package/dist/routine/portable/portable.js +185 -0
  272. package/dist/routine/tree/tree.js +80 -8
  273. package/dist/routine/trigger/commands.d.ts +20 -0
  274. package/dist/routine/trigger/commands.js +74 -0
  275. package/dist/routine/trigger/format.js +42 -0
  276. package/dist/routine/trigger/index.d.ts +2 -0
  277. package/dist/routine/trigger/index.js +2 -0
  278. package/dist/routine/trigger/input.js +81 -0
  279. package/dist/run-ledger/client.d.ts +47 -0
  280. package/dist/secret/client.d.ts +39 -0
  281. package/dist/secret/client.js +6 -0
  282. package/dist/secret/commands.d.ts +12 -0
  283. package/dist/secret/commands.js +91 -0
  284. package/dist/secret/index.d.ts +3 -0
  285. package/dist/secret/index.js +3 -0
  286. package/dist/secret/input.js +22 -0
  287. package/dist/secret/output/format.js +10 -0
  288. package/dist/secret/output/index.js +2 -0
  289. package/dist/secret/tree/index.js +2 -0
  290. package/dist/secret/tree/tree.js +16 -0
  291. package/dist/session/agent-permission.d.ts +3 -2
  292. package/dist/session/approval/client.d.ts +9 -5
  293. package/dist/session/approval/client.js +2 -2
  294. package/dist/session/approval/commands.d.ts +8 -0
  295. package/dist/session/approval/commands.js +272 -22
  296. package/dist/session/approval/index.d.ts +1 -1
  297. package/dist/session/approval/index.js +1 -1
  298. package/dist/session/approval/output/format.js +53 -1
  299. package/dist/session/approval/output/index.js +1 -1
  300. package/dist/session/attach.d.ts +1 -1
  301. package/dist/session/attach.js +7 -2
  302. package/dist/session/client.d.ts +18 -13
  303. package/dist/session/client.js +39 -19
  304. package/dist/session/coding-client.d.ts +2 -0
  305. package/dist/session/coding-client.js +1 -2
  306. package/dist/session/coding-commands.js +24 -7
  307. package/dist/session/command/commands.js +109 -0
  308. package/dist/session/command/index.js +2 -0
  309. package/dist/session/commands.d.ts +5 -1
  310. package/dist/session/commands.js +366 -67
  311. package/dist/session/create-tasks.js +10 -47
  312. package/dist/session/creation/creation.js +51 -0
  313. package/dist/session/creation/index.js +2 -0
  314. package/dist/session/fork/fork.js +135 -0
  315. package/dist/session/fork/index.js +2 -0
  316. package/dist/session/git-status.d.ts +11 -0
  317. package/dist/session/git-status.js +30 -0
  318. package/dist/session/index.d.ts +4 -3
  319. package/dist/session/index.js +3 -2
  320. package/dist/session/interaction/client.d.ts +3 -0
  321. package/dist/session/move/index.js +2 -0
  322. package/dist/session/move/move.js +439 -0
  323. package/dist/session/output/held.js +28 -0
  324. package/dist/session/output/human.js +64 -10
  325. package/dist/session/output/tasks.js +68 -7
  326. package/dist/session/setup/index.js +2 -0
  327. package/dist/session/setup/setup.js +69 -0
  328. package/dist/session/spawn/caps.js +128 -0
  329. package/dist/session/spawn/index.js +5 -0
  330. package/dist/session/spawn/spawn.js +203 -0
  331. package/dist/session/spawn/standing.js +62 -0
  332. package/dist/session/spawn/supervision.js +62 -0
  333. package/dist/session/switch/index.js +2 -0
  334. package/dist/session/switch/switch.js +103 -0
  335. package/dist/session/tree/tree.js +316 -32
  336. package/dist/session/turn/attachments.js +54 -0
  337. package/dist/session/turn/client.d.ts +3 -1
  338. package/dist/session/turn/client.js +6 -1
  339. package/dist/session/turn/commands.d.ts +5 -1
  340. package/dist/session/turn/commands.js +204 -31
  341. package/dist/session/turn/index.d.ts +2 -2
  342. package/dist/session/turn/index.js +1 -1
  343. package/dist/session/turn/output.d.ts +31 -1
  344. package/dist/session/turn/output.js +45 -2
  345. package/dist/skills-sync/client.d.ts +9 -0
  346. package/dist/skills-sync/client.js +7 -0
  347. package/dist/skills-sync/commands.d.ts +15 -0
  348. package/dist/skills-sync/commands.js +241 -0
  349. package/dist/skills-sync/index.d.ts +3 -0
  350. package/dist/skills-sync/index.js +3 -0
  351. package/dist/skills-sync/output.js +168 -0
  352. package/dist/skills-sync/set-file.js +23 -0
  353. package/dist/skills-sync/tree/index.js +2 -0
  354. package/dist/skills-sync/tree/tree.js +38 -0
  355. package/dist/status/client.d.ts +21 -3
  356. package/dist/status/command.js +6 -3
  357. package/dist/status/doctor.d.ts +5 -1
  358. package/dist/status/doctor.js +14 -7
  359. package/dist/status/output/compact.d.ts +3 -0
  360. package/dist/status/output/compact.js +17 -7
  361. package/dist/status/output/human.js +25 -0
  362. package/dist/team-workspace/client.d.ts +1 -0
  363. package/dist/terminal/control-commands.js +26 -9
  364. package/dist/terminal/keys.js +62 -0
  365. package/dist/terminal/output/compact-list.js +3 -0
  366. package/dist/terminal/output/human.js +2 -2
  367. package/dist/terminal/tree/tree.js +1 -1
  368. package/dist/text-input/index.js +2 -0
  369. package/dist/text-input/text-input.js +35 -0
  370. package/dist/webhooks/client.d.ts +157 -0
  371. package/dist/webhooks/client.js +8 -0
  372. package/dist/webhooks/commands.d.ts +17 -0
  373. package/dist/webhooks/commands.js +76 -0
  374. package/dist/webhooks/index.d.ts +3 -0
  375. package/dist/webhooks/index.js +3 -0
  376. package/dist/webhooks/input.js +125 -0
  377. package/dist/webhooks/output/format.js +75 -0
  378. package/dist/webhooks/output/index.js +2 -0
  379. package/dist/webhooks/tree/index.js +2 -0
  380. package/dist/webhooks/tree/tree.js +49 -0
  381. package/guidance/maia-cli/SKILL.md +1 -1
  382. package/guidance/maia-node/SKILL.md +54 -0
  383. package/guidance/maia-orchestration/SKILL.md +1 -2
  384. package/guidance/maia-sessions/SKILL.md +103 -0
  385. package/package.json +7 -6
  386. package/dist/address-space/address-space.d.ts +0 -38
  387. package/dist/address-space/index.d.ts +0 -2
  388. package/dist/agents/input.d.ts +0 -130
  389. package/dist/agents/output/format.d.ts +0 -8
  390. package/dist/agents/output/index.d.ts +0 -2
  391. package/dist/agents/tree/index.d.ts +0 -2
  392. package/dist/agents/tree/tree.d.ts +0 -3
  393. package/dist/bootstrap/exit.d.ts +0 -14
  394. package/dist/bootstrap/exit.js +0 -42
  395. package/dist/bootstrap/index.d.ts +0 -3
  396. package/dist/bootstrap/index.js +0 -3
  397. package/dist/bootstrap/process.d.ts +0 -5
  398. package/dist/bootstrap/process.js +0 -23
  399. package/dist/bootstrap/run.d.ts +0 -25
  400. package/dist/bootstrap/run.js +0 -95
  401. package/dist/bootstrap/stdio.d.ts +0 -4
  402. package/dist/bootstrap/stdio.js +0 -9
  403. package/dist/cli/environment.d.ts +0 -8
  404. package/dist/cli/services.d.ts +0 -4
  405. package/dist/command-line/context.js +0 -2
  406. package/dist/command-line/input/stdin-stream.d.ts +0 -4
  407. package/dist/command-line/json-decoder.d.ts +0 -3
  408. package/dist/command-receipt/command.d.ts +0 -4
  409. package/dist/command-receipt/compact-list.d.ts +0 -20
  410. package/dist/command-receipt/index.d.ts +0 -3
  411. package/dist/command-tree/completion.d.ts +0 -6
  412. package/dist/command-tree/local.d.ts +0 -3
  413. package/dist/command-tree/row.js +0 -2
  414. package/dist/connection/access/format.d.ts +0 -8
  415. package/dist/connection/access/input.d.ts +0 -53
  416. package/dist/connection/input.d.ts +0 -50
  417. package/dist/connection/signin.d.ts +0 -4
  418. package/dist/connection/tree/index.d.ts +0 -2
  419. package/dist/connection/tree/tree.d.ts +0 -3
  420. package/dist/container/output/format.d.ts +0 -11
  421. package/dist/container/output/index.d.ts +0 -2
  422. package/dist/context/client.d.ts +0 -7
  423. package/dist/context/commands.d.ts +0 -3
  424. package/dist/context/index.d.ts +0 -3
  425. package/dist/dashboard/cockpit-client.d.ts +0 -6
  426. package/dist/dashboard/cockpit-client.js +0 -27
  427. package/dist/dashboard/cockpits.d.ts +0 -29
  428. package/dist/dashboard/cockpits.js +0 -65
  429. package/dist/dashboard/dashboard.d.ts +0 -7
  430. package/dist/dashboard/draw.d.ts +0 -15
  431. package/dist/dashboard/frame.d.ts +0 -4
  432. package/dist/dashboard/index.d.ts +0 -2
  433. package/dist/dashboard/modes.d.ts +0 -5
  434. package/dist/dashboard/node-connection.d.ts +0 -15
  435. package/dist/dashboard/node-connection.js +0 -51
  436. package/dist/dashboard/pi-tui.d.ts +0 -6
  437. package/dist/dashboard/status-bar.d.ts +0 -4
  438. package/dist/dashboard/terminal.d.ts +0 -53
  439. package/dist/dashboard/tree-model.d.ts +0 -28
  440. package/dist/dashboard/tree.d.ts +0 -10
  441. package/dist/development/cli.d.ts +0 -3
  442. package/dist/development/cli.js +0 -44
  443. package/dist/execution/tree/index.d.ts +0 -2
  444. package/dist/execution/tree/tree.d.ts +0 -3
  445. package/dist/hold/output/format.d.ts +0 -11
  446. package/dist/hold/output/index.d.ts +0 -2
  447. package/dist/hold/tree/index.d.ts +0 -2
  448. package/dist/hold/tree/tree.d.ts +0 -3
  449. package/dist/import/input.d.ts +0 -16
  450. package/dist/import/output.d.ts +0 -6
  451. package/dist/integration/output.d.ts +0 -22
  452. package/dist/login/failure.d.ts +0 -3
  453. package/dist/login/gateway.d.ts +0 -12
  454. package/dist/login/menu.d.ts +0 -4
  455. package/dist/login/output/format.d.ts +0 -16
  456. package/dist/login/output/index.d.ts +0 -2
  457. package/dist/login/vendor-account.d.ts +0 -95
  458. package/dist/login/vendor-input.d.ts +0 -14
  459. package/dist/mcp/calls.d.ts +0 -8
  460. package/dist/orchestration/output/compact-aggregate.d.ts +0 -121
  461. package/dist/orchestration/output/compact-run-list.d.ts +0 -20
  462. package/dist/orchestration/output/human.d.ts +0 -80
  463. package/dist/orchestration/output/index.d.ts +0 -4
  464. package/dist/orchestration/tree/index.d.ts +0 -2
  465. package/dist/orchestration/tree/tree.d.ts +0 -3
  466. package/dist/port-lease/input.d.ts +0 -65
  467. package/dist/port-lease/output/format.d.ts +0 -11
  468. package/dist/port-lease/output/index.d.ts +0 -2
  469. package/dist/presentation/output/format.d.ts +0 -11
  470. package/dist/presentation/output/index.d.ts +0 -3
  471. package/dist/project-guard/input.d.ts +0 -18
  472. package/dist/project-guard/output/format.d.ts +0 -11
  473. package/dist/project-guard/output/index.d.ts +0 -2
  474. package/dist/project-workspace/output/human.d.ts +0 -139
  475. package/dist/project-workspace/output/index.d.ts +0 -3
  476. package/dist/project-workspace/output/metadata.d.ts +0 -11
  477. package/dist/project-workspace/tree/index.d.ts +0 -2
  478. package/dist/project-workspace/tree/tree.d.ts +0 -3
  479. package/dist/provider/client.d.ts +0 -6
  480. package/dist/provider/commands.d.ts +0 -3
  481. package/dist/provider/index.d.ts +0 -3
  482. package/dist/reference/commands.d.ts +0 -3
  483. package/dist/reference/index.d.ts +0 -3
  484. package/dist/reference/resolve.d.ts +0 -31
  485. package/dist/reference/tree/index.d.ts +0 -2
  486. package/dist/reference/tree/tree.d.ts +0 -3
  487. package/dist/remote-node/reachability.d.ts +0 -64
  488. package/dist/remote-node/text.d.ts +0 -10
  489. package/dist/remote-node/tree/index.d.ts +0 -2
  490. package/dist/remote-node/tree/tree.d.ts +0 -3
  491. package/dist/routine/input.d.ts +0 -28
  492. package/dist/routine/output/format.d.ts +0 -23
  493. package/dist/routine/output/index.d.ts +0 -2
  494. package/dist/routine/tree/index.d.ts +0 -2
  495. package/dist/routine/tree/tree.d.ts +0 -3
  496. package/dist/run-ledger/input.d.ts +0 -42
  497. package/dist/run-ledger/output/format.d.ts +0 -11
  498. package/dist/run-ledger/output/index.d.ts +0 -2
  499. package/dist/session/approval/output/format.d.ts +0 -23
  500. package/dist/session/approval/output/index.d.ts +0 -2
  501. package/dist/session/attach-render.d.ts +0 -16
  502. package/dist/session/create-tasks.d.ts +0 -20
  503. package/dist/session/interaction/input.d.ts +0 -15
  504. package/dist/session/interaction/output/format.d.ts +0 -11
  505. package/dist/session/interaction/output/index.d.ts +0 -2
  506. package/dist/session/output/diff.d.ts +0 -3
  507. package/dist/session/output/failure.d.ts +0 -11
  508. package/dist/session/output/human.d.ts +0 -113
  509. package/dist/session/output/index.d.ts +0 -6
  510. package/dist/session/output/observe.d.ts +0 -4
  511. package/dist/session/output/tasks.d.ts +0 -34
  512. package/dist/session/task-file.d.ts +0 -5
  513. package/dist/session/tree/index.d.ts +0 -2
  514. package/dist/session/tree/tree.d.ts +0 -3
  515. package/dist/team-workspace/ceremony.d.ts +0 -19
  516. package/dist/team-workspace/confirmation.d.ts +0 -4
  517. package/dist/team-workspace/dependencies.js +0 -2
  518. package/dist/team-workspace/output.d.ts +0 -15
  519. package/dist/terminal/arguments.d.ts +0 -13
  520. package/dist/terminal/output/compact-list.d.ts +0 -148
  521. package/dist/terminal/output/human.d.ts +0 -42
  522. package/dist/terminal/output/index.d.ts +0 -3
  523. package/dist/terminal/tree/index.d.ts +0 -2
  524. package/dist/terminal/tree/tree.d.ts +0 -3
  525. /package/dist/command-line/{json-decoder.js → emit/json-decoder.js} +0 -0
  526. /package/dist/command-line/{json.d.ts → emit/json.d.ts} +0 -0
  527. /package/dist/command-line/{json.js → emit/json.js} +0 -0
@@ -0,0 +1,46 @@
1
+ import { resolve } from "node:path";
2
+ import * as Effect from "effect/Effect";
3
+ import { cell, reportError, writeSuccess } from "../command-line/emit/index.js";
4
+ import { CliArgumentError, parseOptions, requirePositionals, } from "../command-line/input/index.js";
5
+ import { readManifestFile } from "../import/batch/index.js";
6
+ import { MAX_MIGRATION_BYTES, parseMigrationFile } from "./format.js";
7
+ import { PLAN_CLASSES, planMigration } from "./plan.js";
8
+ const line = (...cells) => cells.map(cell).join("\t");
9
+ const NO_MATCH = "no match found; the Node may still refuse";
10
+ const noteOf = (item) => {
11
+ if (item.action === "exists")
12
+ return `${item.id} by ${item.matchedBy}`;
13
+ return item.action === "skip" ? item.reason : NO_MATCH;
14
+ };
15
+ const formatPlan = ({ result: { classes, digest, node }, }) => [
16
+ ...PLAN_CLASSES.flatMap((kind) => {
17
+ const { create, exists, items, notImportable, skip } = classes[kind];
18
+ return items.length === 0
19
+ ? []
20
+ : [
21
+ line(kind, String(items.length), notImportable === undefined
22
+ ? `create ${String(create)}, exists ${String(exists)}, skip ${String(skip)}`
23
+ : `not importable yet: ${notImportable.reason}`),
24
+ ...items.map((item) => line("", item.action, item.sourceId, item.contentHash, noteOf(item))),
25
+ ];
26
+ }),
27
+ line("digest", digest, `Node ${node.name}`, node.instanceId),
28
+ "",
29
+ ].join("\n");
30
+ const readFrom = (tokens) => {
31
+ const parsed = parseOptions(tokens, new Set(["--from"]));
32
+ requirePositionals(parsed.positionals, 0);
33
+ const from = parsed.options.get("--from");
34
+ if (from === undefined)
35
+ throw new CliArgumentError("Option '--from' is required.");
36
+ return from;
37
+ };
38
+ export const runMigratePlan = (tokens, context) => Effect.gen(function* () {
39
+ const from = resolve(context.io.cwd ?? process.cwd(), readFrom(tokens));
40
+ const file = yield* Effect.flatMap(readManifestFile(from, MAX_MIGRATION_BYTES), parseMigrationFile);
41
+ return yield* planMigration(file, context).pipe(Effect.map((result) => {
42
+ writeSuccess({ command: "migrate.plan", result }, context, formatPlan);
43
+ return 0;
44
+ }), Effect.catch((error) => Effect.sync(() => reportError(error, context))));
45
+ });
46
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1,199 @@
1
+ import { routineScheduleSchema, secretNameSchema } from "@maiaos/sdk";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Predicate from "effect/Predicate";
4
+ import * as Schema from "effect/Schema";
5
+ import { CliArgumentError } from "../command-line/input/index.js";
6
+ import { issuesOf } from "../routine/portable/index.js";
7
+ export const MIGRATION_SCHEMA = "maia.migration/v1";
8
+ export const MAX_MIGRATION_BYTES = 1024 * 1024;
9
+ export const MAX_MIGRATION_ITEMS = 64;
10
+ const text = (maximum) => Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(maximum));
11
+ const list = (item) => Schema.optionalKey(Schema.Array(item).check(Schema.isMaxLength(MAX_MIGRATION_ITEMS)));
12
+ const sourceId = Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u));
13
+ const name = text(160);
14
+ const instant = Schema.String.check(Schema.isPattern(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/u), Schema.makeFilter((value) => !Number.isNaN(Date.parse(value))));
15
+ const taken = (parser) => Schema.makeFilter((value) => parser.safeParse(value).success);
16
+ const secretName = Schema.String.check(Schema.isPattern(/^(?![\s\S]*[A-Za-z0-9]{17})(?!(?:\D*\d){9})/u), taken(secretNameSchema));
17
+ const credential = Schema.Struct({ secret: secretName }).pipe(Schema.annotate({
18
+ description: "A credential by the name of a secret, never its value: the importing person stores the value with `maia secret`.",
19
+ }));
20
+ const USER = String.raw `(?![A-Za-z0-9._-]*[A-Za-z0-9]{17})[A-Za-z_][A-Za-z0-9._-]{0,31}@`;
21
+ const HOST = String.raw `[A-Za-z0-9][A-Za-z0-9.-]{0,252}(?::\d{1,5})?`;
22
+ const SEGMENTS = "[A-Za-z0-9._~/-]";
23
+ const remote = Schema.String.check(Schema.isMaxLength(2048), Schema.isPattern(new RegExp(`^(?:(?:https?|git)://${HOST}(?:/${SEGMENTS}*)?|ssh://(?:${USER})?${HOST}(?:/${SEGMENTS}*)?|${USER}${HOST}:${SEGMENTS}+)$`, "u")));
24
+ const address = Schema.String.check(Schema.isMaxLength(255), Schema.isPattern(new RegExp(`^(?:${USER})?${HOST}$`, "u")));
25
+ const NO_CLIMB = String.raw `(?![\s\S]*(?:^|/)\.\.(?:/|$))`;
26
+ const path = (start) => Schema.String.check(Schema.isMaxLength(4096), Schema.isPattern(new RegExp(`^${NO_CLIMB}${start}`, "u")));
27
+ const absolutePath = path("/");
28
+ const relativePath = path("[^/]");
29
+ const project = Schema.Struct({
30
+ credential: Schema.optionalKey(credential),
31
+ defaultBranch: Schema.optionalKey(text(255)),
32
+ name,
33
+ path: Schema.optionalKey(absolutePath),
34
+ remote: Schema.optionalKey(remote),
35
+ sourceId,
36
+ }).pipe(Schema.annotate({
37
+ description: "A project and its repository: a folder on the Node's machine (`path`, absolute), a remote, or both.",
38
+ }));
39
+ const memory = Schema.Struct({
40
+ createdAt: Schema.optionalKey(instant),
41
+ sourceId,
42
+ text: text(16_384),
43
+ });
44
+ const agent = Schema.Struct({
45
+ executor: Schema.optionalKey(text(64)),
46
+ instructions: text(16_384),
47
+ memory: list(memory),
48
+ name,
49
+ project: Schema.optionalKey(sourceId),
50
+ sourceId,
51
+ }).pipe(Schema.annotate({
52
+ description: "An agent or persona: its instructions, the project it works in, the executor that runs it, and what it remembers.",
53
+ }));
54
+ const schedule = Schema.Union([
55
+ Schema.Struct({ expression: Schema.String, timezone: Schema.String }),
56
+ Schema.Struct({ everyMinutes: Schema.Int, startsAt: Schema.String }),
57
+ Schema.Struct({ at: Schema.String }),
58
+ Schema.Struct({ event: Schema.String }),
59
+ ])
60
+ .check(taken(routineScheduleSchema))
61
+ .pipe(Schema.annotate({
62
+ description: "A schedule as a Maia routine takes one: a cron `expression` in a `timezone`, `everyMinutes` from `startsAt`, one time `at`, or an `event` kind. An instant is UTC with milliseconds.",
63
+ }));
64
+ const routine = Schema.Struct({
65
+ agent: Schema.optionalKey(sourceId),
66
+ enabled: Schema.optionalKey(Schema.Boolean),
67
+ executor: Schema.optionalKey(text(64)),
68
+ name,
69
+ project: sourceId,
70
+ prompt: text(65_536),
71
+ schedule,
72
+ sourceId,
73
+ }).pipe(Schema.annotate({
74
+ description: "A scheduled prompt in a project, run by an agent of this file or by an executor.",
75
+ }));
76
+ const skill = Schema.Struct({
77
+ contentHash: Schema.String.check(Schema.isPattern(/^sha256:[0-9a-f]{64}$/u)),
78
+ credential: Schema.optionalKey(credential),
79
+ name,
80
+ source: Schema.Union([
81
+ Schema.Struct({ folder: relativePath }),
82
+ Schema.Struct({
83
+ path: Schema.optionalKey(relativePath),
84
+ repository: remote,
85
+ revision: Schema.optionalKey(text(255)),
86
+ }),
87
+ ]),
88
+ sourceId,
89
+ }).pipe(Schema.annotate({
90
+ description: "A skill by reference, and the hash of its content: a `folder` relative to the folder of the migration file, or a `repository` with a `path` relative to its root.",
91
+ }));
92
+ const session = Schema.Struct({
93
+ endedAt: Schema.optionalKey(instant),
94
+ project: Schema.optionalKey(sourceId),
95
+ sourceId,
96
+ startedAt: Schema.optionalKey(instant),
97
+ title: Schema.optionalKey(text(256)),
98
+ transcript: Schema.Union([
99
+ Schema.Struct({ executor: text(64), nativeId: text(128) }),
100
+ Schema.Struct({ location: relativePath }),
101
+ ]),
102
+ }).pipe(Schema.annotate({
103
+ description: "A pointer to one session's history, never the transcript: an executor's native session, or a transcript file at a `location` relative to the folder of the migration file.",
104
+ }));
105
+ const host = Schema.Struct({
106
+ name,
107
+ reach: Schema.Struct({
108
+ address,
109
+ credential: Schema.optionalKey(credential),
110
+ transport: text(32),
111
+ }),
112
+ role: Schema.optionalKey(text(64)),
113
+ sourceId,
114
+ }).pipe(Schema.annotate({
115
+ description: "A machine of the set-up and how another machine reaches it.",
116
+ }));
117
+ export const migrationFile = Schema.Struct({
118
+ agents: list(agent),
119
+ hosts: list(host),
120
+ origin: sourceId.pipe(Schema.annotate({
121
+ description: "The name of the set-up the file describes, the same on every export: a `sourceId` names an item within its origin and its list.",
122
+ })),
123
+ projects: list(project),
124
+ routines: list(routine),
125
+ schema: Schema.Literal(MIGRATION_SCHEMA),
126
+ sessions: list(session),
127
+ skills: list(skill),
128
+ }).pipe(Schema.annotate({
129
+ description: "A set-up to import with `maia migrate`: the file names its `origin`, and every item carries a `sourceId` that stays the same on every export.",
130
+ title: MIGRATION_SCHEMA,
131
+ }));
132
+ export const migrationJsonSchema = () => ({
133
+ $schema: "https://json-schema.org/draft/2020-12/schema",
134
+ ...Schema.toJsonSchemaDocument(migrationFile, { onExcessProperty: "error" })
135
+ .schema,
136
+ });
137
+ const invalid = (message) => new CliArgumentError(message);
138
+ const decodeJson = Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Unknown));
139
+ const decodeFile = Schema.decodeUnknownEffect(migrationFile, {
140
+ onExcessProperty: "error",
141
+ });
142
+ const repeats = (where, items = []) => items.flatMap(({ sourceId: id }, index) => items.findIndex((item) => item.sourceId === id) === index
143
+ ? []
144
+ : [`${where} ${String(index)} sourceId repeats an earlier item`]);
145
+ const dangling = ([where, field], references, known) => references.flatMap((reference, index) => reference === undefined ||
146
+ known.some(({ sourceId: id }) => id === reference)
147
+ ? []
148
+ : [`${where} ${String(index)} ${field} names no item of this file`]);
149
+ const repeated = ({ agents = [], hosts, projects, routines, sessions, skills, }) => [
150
+ ...Object.entries({
151
+ agents,
152
+ hosts,
153
+ projects,
154
+ routines,
155
+ sessions,
156
+ skills,
157
+ }).flatMap(([where, items]) => repeats(where, items)),
158
+ ...agents.flatMap(({ memory: entries }, index) => repeats(`agents ${String(index)} memory`, entries)),
159
+ ];
160
+ const projectOf = ({ project: reference }) => reference;
161
+ const unresolved = ({ agents = [], projects = [], routines = [], sessions = [], }) => [
162
+ ...dangling(["agents", "project"], agents.map(projectOf), projects),
163
+ ...dangling(["routines", "project"], routines.map(projectOf), projects),
164
+ ...dangling(["sessions", "project"], sessions.map(projectOf), projects),
165
+ ...dangling(["routines", "agent"], routines.map(({ agent: reference }) => reference), agents),
166
+ ];
167
+ const incomplete = ({ agents = [], projects = [], routines = [], }) => [
168
+ ...projects.flatMap(({ path: folder, remote: from }, index) => folder === undefined && from === undefined
169
+ ? [`projects ${String(index)} needs path or remote`]
170
+ : []),
171
+ ...routines.flatMap((item, index) => {
172
+ if (item.agent === undefined)
173
+ return [];
174
+ if (item.executor !== undefined)
175
+ return [`routines ${String(index)} gives agent and executor: give one`];
176
+ const home = agents.find(({ sourceId: id }) => id === item.agent)?.project;
177
+ return home === undefined || home === item.project
178
+ ? []
179
+ : [`routines ${String(index)} agent works in another project`];
180
+ }),
181
+ ];
182
+ const MAX_PROBLEM_CHARACTERS = 300;
183
+ const refused = (problem) => new CliArgumentError(`The file is not a ${MIGRATION_SCHEMA} document: ${problem.slice(0, MAX_PROBLEM_CHARACTERS)}.`);
184
+ const OTHER_VERSION = invalid(`The file is of another version of the format: this CLI reads ${MIGRATION_SCHEMA}.`);
185
+ const decodeTagged = (document) => Predicate.hasProperty(document, "schema") &&
186
+ document.schema !== MIGRATION_SCHEMA
187
+ ? Effect.fail(OTHER_VERSION)
188
+ : Effect.mapError(decodeFile(document), ({ issue }) => refused(issuesOf(issue)));
189
+ export const parseMigrationFile = (content) => decodeJson(content).pipe(Effect.mapError(() => invalid("The migration file is not valid JSON.")), Effect.flatMap(decodeTagged), Effect.flatMap((file) => {
190
+ const [problem] = [
191
+ ...repeated(file),
192
+ ...unresolved(file),
193
+ ...incomplete(file),
194
+ ];
195
+ return problem === undefined
196
+ ? Effect.succeed(file)
197
+ : Effect.fail(refused(problem));
198
+ }));
199
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1,2 @@
1
+ export { runMigratePlan } from "./commands.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,59 @@
1
+ import { createHash } from "node:crypto";
2
+ import * as Effect from "effect/Effect";
3
+ import { commandIdOf } from "../routine/portable/index.js";
4
+ import { MIGRATION_SCHEMA } from "./format.js";
5
+ const missing = () => Effect.die(new Error("Missing migrate client."));
6
+ export const ask = (effect) => Effect.flatMap(effect ?? missing(), (answer) => answer.ok ? Effect.succeed(answer.value) : Effect.fail(answer.error));
7
+ export const pages = (read, cursor) => Effect.flatMap(read(cursor), ({ items, nextCursor }) => nextCursor === undefined
8
+ ? Effect.succeed(items)
9
+ : Effect.map(pages(read, nextCursor), (rest) => [...items, ...rest]));
10
+ const canonical = (value) => JSON.stringify(value, (_key, nested) => typeof nested !== "object" || nested === null || Array.isArray(nested)
11
+ ? nested
12
+ : Object.fromEntries(Object.entries(nested).toSorted(([left], [right]) => left < right ? -1 : 1)));
13
+ export const hashOf = (value) => `sha256:${createHash("sha256").update(canonical(value)).digest("hex")}`;
14
+ export const CREATE = { action: "create" };
15
+ export const skip = (reason) => ({ action: "skip", reason });
16
+ export const held = (id, matchedBy) => ({ action: "exists", id, matchedBy });
17
+ const DEPENDENCY_SKIPPED = skip("The plan skips an item it refers to.");
18
+ const GONE = skip("An earlier import made this item and the Node no longer lists it.");
19
+ export const listedIn = (ids, unlisted = GONE) => (item) => {
20
+ if (item.action !== "exists" || item.matchedBy !== "source-id")
21
+ return item;
22
+ if (ids.includes(item.id))
23
+ return item;
24
+ const { commandId, contentHash, sourceId } = item;
25
+ return { ...unlisted, commandId, contentHash, sourceId };
26
+ };
27
+ export const named = (items, sourceId) => items.find((item) => item.sourceId === sourceId);
28
+ export const idOf = (item) => item?.action === "exists" ? item.id : undefined;
29
+ const appliedBy = (context, commandId) => Effect.flatMap(context.dependencies.getReceipt?.(commandId) ?? missing(), (answer) => {
30
+ if (answer.ok)
31
+ return Effect.succeed([answer.value.receipt.target.id]);
32
+ return answer.error.code === "resource_not_found"
33
+ ? Effect.succeed([])
34
+ : Effect.fail(answer.error);
35
+ });
36
+ export const planned = (context, [kind, items, blocked = () => false], decide) => Effect.forEach(items, (item) => {
37
+ const { sourceId } = item;
38
+ const commandId = commandIdOf({
39
+ class: kind,
40
+ origin: context.origin,
41
+ schema: MIGRATION_SCHEMA,
42
+ sourceId,
43
+ });
44
+ const decisionOf = (id) => {
45
+ if (blocked(item))
46
+ return DEPENDENCY_SKIPPED;
47
+ return id === undefined
48
+ ? decide(item, commandId)
49
+ : { action: "exists", id, matchedBy: "source-id" };
50
+ };
51
+ return Effect.map(appliedBy(context, commandId), ([id]) => ({
52
+ ...decisionOf(id),
53
+ commandId,
54
+ contentHash: hashOf(item),
55
+ sourceId,
56
+ }));
57
+ });
58
+ export const unsupported = (sourceId, content, reason) => ({ ...skip(reason), contentHash: hashOf(content), sourceId });
59
+ //# sourceMappingURL=item.js.map
@@ -0,0 +1,79 @@
1
+ import * as Effect from "effect/Effect";
2
+ import { LOCAL_NODE } from "../command-line/input/index.js";
3
+ import { operationError } from "../local-node/index.js";
4
+ import { planAgents, planHosts, planProjects, planRoutines, planSessions, } from "./classes.js";
5
+ import { MIGRATION_SCHEMA } from "./format.js";
6
+ import { hashOf, unsupported, } from "./item.js";
7
+ export const PLAN_CLASSES = [
8
+ "projects",
9
+ "agents",
10
+ "memory",
11
+ "routines",
12
+ "skills",
13
+ "sessions",
14
+ "hosts",
15
+ ];
16
+ const NOT_IMPORTABLE = {
17
+ memory: { reason: "Maia has no Agent memory store yet." },
18
+ skills: {
19
+ reason: "A Node takes its skills as one set pinned by digest; no operation adds one referenced skill yet.",
20
+ },
21
+ };
22
+ const count = (items, action) => items.filter((item) => item.action === action).length;
23
+ const classOf = (items, notImportable) => ({
24
+ count: items.length,
25
+ create: count(items, "create"),
26
+ exists: count(items, "exists"),
27
+ items,
28
+ ...(notImportable === undefined || items.length === 0
29
+ ? {}
30
+ : { notImportable }),
31
+ skip: count(items, "skip"),
32
+ });
33
+ const unsupportedOf = ({ agents = [], skills = [] }) => ({
34
+ memory: classOf(agents.flatMap(({ memory = [], sourceId }) => memory.map((entry) => unsupported(`${sourceId}/${entry.sourceId}`, entry, NOT_IMPORTABLE.memory.reason))), NOT_IMPORTABLE.memory),
35
+ skills: classOf(skills.map((item) => unsupported(item.sourceId, item, NOT_IMPORTABLE.skills.reason)), NOT_IMPORTABLE.skills),
36
+ });
37
+ const UNIDENTIFIED = {
38
+ code: "node_unavailable",
39
+ message: "The Node did not say which Node it is, so no plan binds to it.",
40
+ retryable: true,
41
+ };
42
+ const nodeOf = (context) => {
43
+ const { readStatus } = context.dependencies;
44
+ return readStatus === undefined
45
+ ? Effect.fail(UNIDENTIFIED)
46
+ : Effect.suspend(readStatus).pipe(Effect.map(({ instanceId, profile }) => ({
47
+ instanceId,
48
+ name: context.node ?? LOCAL_NODE,
49
+ profile,
50
+ })), Effect.mapError(operationError));
51
+ };
52
+ const classesOf = (file, context) => Effect.gen(function* () {
53
+ const { hosts = [], origin, routines = [], sessions = [] } = file;
54
+ const { agents: personas = [], projects: folders = [] } = file;
55
+ const scope = { ...context, origin };
56
+ const projects = yield* planProjects(scope, folders);
57
+ const agents = yield* planAgents(scope, personas, projects);
58
+ const plans = { agents, projects };
59
+ return {
60
+ ...unsupportedOf(file),
61
+ agents: classOf(agents),
62
+ hosts: classOf(yield* planHosts(scope, hosts)),
63
+ projects: classOf(projects),
64
+ routines: classOf(yield* planRoutines(scope, routines, plans)),
65
+ sessions: classOf(yield* planSessions(scope, sessions, projects)),
66
+ };
67
+ });
68
+ export const planMigration = (file, context) => Effect.gen(function* () {
69
+ const classes = yield* classesOf(file, context);
70
+ const node = yield* nodeOf(context);
71
+ const body = {
72
+ classes,
73
+ fileHash: hashOf(file),
74
+ node,
75
+ schema: MIGRATION_SCHEMA,
76
+ };
77
+ return { ...body, digest: hashOf(body) };
78
+ });
79
+ //# sourceMappingURL=plan.js.map
@@ -0,0 +1,2 @@
1
+ export { MIGRATE_TREE } from "./tree.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,23 @@
1
+ const migrate = () => import("../index.js");
2
+ export const MIGRATE_TREE = {
3
+ groups: [["migrate", "Import a set-up from one maia.migration/v1 file."]],
4
+ leaves: [
5
+ [
6
+ "migrate plan --from <file>",
7
+ 1,
8
+ [
9
+ "agents.list",
10
+ "routine.list",
11
+ "discovery.sessions.list",
12
+ "node.remote.list",
13
+ ],
14
+ "Preview what a migration file would import; it writes nothing.",
15
+ {
16
+ example: "maia --json migrate plan --from migration.json",
17
+ kind: "composite",
18
+ run: [migrate, "runMigratePlan"],
19
+ },
20
+ ],
21
+ ],
22
+ };
23
+ //# sourceMappingURL=tree.js.map
@@ -0,0 +1,17 @@
1
+ import { type NodeUpdateApplyConfirmParameters, type NodeUpdateApplyConfirmResult, type NodeUpdateApplyPreviewParameters, type NodeUpdateApplyPreviewResult, type NodeUpdateCheckResult, type NodeUpdatePauseParameters, type NodeUpdatePauseResult, type NodeUpdatePolicyGetResult, type NodeUpdatePolicySetParameters, type NodeUpdatePolicySetResult, type NodeUpdateResumeParameters, type NodeUpdateResumeResult, type NodeUpdateRollbackConfirmParameters, type NodeUpdateRollbackConfirmResult, type NodeUpdateRollbackPreviewParameters, type NodeUpdateRollbackPreviewResult, type NodeUpdateShowResult, type NodeUpdateStatusResult } from "@maiaos/sdk";
2
+ import type { CliNodeEffect, CliNodeOperations } from "../local-node/index.js";
3
+ export declare const makeNodeUpdateClient: (node: CliNodeOperations) => {
4
+ confirmNodeUpdateApply: (input: NodeUpdateApplyConfirmParameters) => CliNodeEffect<NodeUpdateApplyConfirmResult>;
5
+ previewNodeUpdateApply: (input: NodeUpdateApplyPreviewParameters) => CliNodeEffect<NodeUpdateApplyPreviewResult>;
6
+ confirmNodeUpdateRollback: (input: NodeUpdateRollbackConfirmParameters) => CliNodeEffect<NodeUpdateRollbackConfirmResult>;
7
+ previewNodeUpdateRollback: (input: NodeUpdateRollbackPreviewParameters) => CliNodeEffect<NodeUpdateRollbackPreviewResult>;
8
+ pauseNodeUpdate: (input: NodeUpdatePauseParameters) => CliNodeEffect<NodeUpdatePauseResult>;
9
+ resumeNodeUpdate: (input: NodeUpdateResumeParameters) => CliNodeEffect<NodeUpdateResumeResult>;
10
+ showNodeUpdate: () => CliNodeEffect<NodeUpdateShowResult>;
11
+ checkNodeUpdate: () => CliNodeEffect<NodeUpdateCheckResult>;
12
+ getNodeUpdatePolicy: () => CliNodeEffect<NodeUpdatePolicyGetResult>;
13
+ setNodeUpdatePolicy: (input: NodeUpdatePolicySetParameters) => CliNodeEffect<NodeUpdatePolicySetResult>;
14
+ showNodeUpdateStatus: () => CliNodeEffect<NodeUpdateStatusResult>;
15
+ };
16
+ export type NodeUpdateCliDependencies = ReturnType<typeof makeNodeUpdateClient>;
17
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1,27 @@
1
+ import { nodeUpdateApplyConfirmParametersSchema, nodeUpdateApplyPreviewParametersSchema, nodeUpdatePauseParametersSchema, nodeUpdatePolicySetParametersSchema, nodeUpdateResumeParametersSchema, nodeUpdateRollbackConfirmParametersSchema, nodeUpdateRollbackPreviewParametersSchema, } from "@maiaos/sdk";
2
+ const applyOperations = (node) => ({
3
+ confirmNodeUpdateApply: (input) => node.runValidatedNodeOperation(input, nodeUpdateApplyConfirmParametersSchema, (client, parameters, options) => client.confirmNodeUpdateApply(parameters, options), { commandId: input.commandId }),
4
+ previewNodeUpdateApply: (input) => node.runValidatedNodeOperation(input, nodeUpdateApplyPreviewParametersSchema, (client, parameters, options) => client.previewNodeUpdateApply(parameters, options)),
5
+ });
6
+ const rollbackOperations = (node) => ({
7
+ confirmNodeUpdateRollback: (input) => node.runValidatedNodeOperation(input, nodeUpdateRollbackConfirmParametersSchema, (client, parameters, options) => client.confirmNodeUpdateRollback(parameters, options), { commandId: input.commandId }),
8
+ previewNodeUpdateRollback: (input) => node.runValidatedNodeOperation(input, nodeUpdateRollbackPreviewParametersSchema, (client, parameters, options) => client.previewNodeUpdateRollback(parameters, options)),
9
+ });
10
+ const pauseOperations = (node) => ({
11
+ pauseNodeUpdate: (input) => node.runValidatedNodeOperation(input, nodeUpdatePauseParametersSchema, (client, parameters, options) => client.pauseNodeUpdate(parameters, options), { commandId: input.commandId }),
12
+ resumeNodeUpdate: (input) => node.runValidatedNodeOperation(input, nodeUpdateResumeParametersSchema, (client, parameters, options) => client.resumeNodeUpdate(parameters, options), { commandId: input.commandId }),
13
+ showNodeUpdate: () => node.runNodeClientOperation((client, options) => client.showNodeUpdate(options)),
14
+ });
15
+ const policyOperations = (node) => ({
16
+ checkNodeUpdate: () => node.runNodeClientOperation((client, options) => client.checkNodeUpdate(options)),
17
+ getNodeUpdatePolicy: () => node.runNodeClientOperation((client, options) => client.getNodeUpdatePolicy(options)),
18
+ setNodeUpdatePolicy: (input) => node.runValidatedNodeOperation(input, nodeUpdatePolicySetParametersSchema, (client, parameters, options) => client.setNodeUpdatePolicy(parameters, options), { commandId: input.commandId }),
19
+ showNodeUpdateStatus: () => node.runNodeClientOperation((client, options) => client.showNodeUpdateStatus(options)),
20
+ });
21
+ export const makeNodeUpdateClient = (node) => ({
22
+ ...applyOperations(node),
23
+ ...pauseOperations(node),
24
+ ...policyOperations(node),
25
+ ...rollbackOperations(node),
26
+ });
27
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1,20 @@
1
+ import type * as Crypto from "effect/Crypto";
2
+ import * as Effect from "effect/Effect";
3
+ import { type OutputContext } from "../command-line/emit/index.js";
4
+ import { CliArgumentError } from "../command-line/input/index.js";
5
+ import type { NodeUpdateCliDependencies } from "./client.js";
6
+ type CommandContext = OutputContext & {
7
+ readonly dependencies: NodeUpdateCliDependencies;
8
+ };
9
+ type CommandEffect = Effect.Effect<number, CliArgumentError, Crypto.Crypto>;
10
+ export declare const runNodeUpdateShow: (tokens: readonly string[], context: CommandContext) => CommandEffect;
11
+ export declare const runNodeUpdateCheck: (tokens: readonly string[], context: CommandContext) => CommandEffect;
12
+ export declare const runNodeUpdateStatus: (tokens: readonly string[], context: CommandContext) => CommandEffect;
13
+ export declare const runNodeUpdatePolicyShow: (tokens: readonly string[], context: CommandContext) => CommandEffect;
14
+ export declare const runNodeUpdatePolicySet: (tokens: readonly string[], context: CommandContext) => CommandEffect;
15
+ export declare const runNodeUpdatePause: (tokens: readonly string[], context: CommandContext) => CommandEffect;
16
+ export declare const runNodeUpdateResume: (tokens: readonly string[], context: CommandContext) => CommandEffect;
17
+ export declare const runNodeUpdateRollback: (tokens: readonly string[], context: CommandContext) => CommandEffect;
18
+ export declare const runNodeUpdateApply: (tokens: readonly string[], context: CommandContext) => CommandEffect;
19
+ export {};
20
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1,150 @@
1
+ import { nodeUpdateApplyConfirmParametersSchema, nodeUpdateRollbackConfirmParametersSchema, } from "@maiaos/sdk";
2
+ import * as Effect from "effect/Effect";
3
+ import { writeNodeResult, } from "../command-line/emit/index.js";
4
+ import { CliArgumentError, parseOptions, parseOptionsWith, readOptionalRevision, requirePositionals, } from "../command-line/input/index.js";
5
+ import { confirmParameters, readTwoPhaseMode, runTwoPhase, TWO_PHASE_FLAGS, } from "../command-line/two-phase/index.js";
6
+ import { changeAtRevision, commandIdentifier } from "../local-node/index.js";
7
+ import { formatNodeUpdateResult, } from "./output.js";
8
+ const write = (context) => (result) => writeNodeResult(result, context, {
9
+ toResult: (value) => ({
10
+ command: value.method,
11
+ result: value,
12
+ }),
13
+ toText: formatNodeUpdateResult,
14
+ });
15
+ const missingClient = () => Effect.die(new Error("Missing node update client."));
16
+ export const runNodeUpdateShow = (tokens, context) => Effect.gen(function* () {
17
+ requirePositionals(parseOptions(tokens, new Set()).positionals, 0);
18
+ const { showNodeUpdate } = context.dependencies;
19
+ if (showNodeUpdate === undefined)
20
+ return yield* missingClient();
21
+ return write(context)(yield* showNodeUpdate());
22
+ });
23
+ export const runNodeUpdateCheck = (tokens, context) => Effect.gen(function* () {
24
+ requirePositionals(parseOptions(tokens, new Set()).positionals, 0);
25
+ const { checkNodeUpdate } = context.dependencies;
26
+ if (checkNodeUpdate === undefined)
27
+ return yield* missingClient();
28
+ return write(context)(yield* checkNodeUpdate());
29
+ });
30
+ export const runNodeUpdateStatus = (tokens, context) => Effect.gen(function* () {
31
+ requirePositionals(parseOptions(tokens, new Set()).positionals, 0);
32
+ const { showNodeUpdateStatus } = context.dependencies;
33
+ if (showNodeUpdateStatus === undefined)
34
+ return yield* missingClient();
35
+ return write(context)(yield* showNodeUpdateStatus());
36
+ });
37
+ export const runNodeUpdatePolicyShow = (tokens, context) => Effect.gen(function* () {
38
+ requirePositionals(parseOptions(tokens, new Set()).positionals, 0);
39
+ const { getNodeUpdatePolicy } = context.dependencies;
40
+ if (getNodeUpdatePolicy === undefined)
41
+ return yield* missingClient();
42
+ return write(context)(yield* getNodeUpdatePolicy());
43
+ });
44
+ const POLICY_SET_OPTIONS = new Set(["--command-id", "--expected-revision"]);
45
+ const POLICIES = ["automatic", "notify", "manual"];
46
+ const readPolicyWord = (word) => {
47
+ const policy = POLICIES.find((candidate) => candidate === word);
48
+ if (policy === undefined)
49
+ throw new CliArgumentError("The update policy must be 'automatic', 'notify' or 'manual'.");
50
+ return policy;
51
+ };
52
+ export const runNodeUpdatePolicySet = (tokens, context) => Effect.gen(function* () {
53
+ const { options, positionals } = parseOptions(tokens, POLICY_SET_OPTIONS);
54
+ requirePositionals(positionals, 1);
55
+ const { getNodeUpdatePolicy, setNodeUpdatePolicy } = context.dependencies;
56
+ if (getNodeUpdatePolicy === undefined || setNodeUpdatePolicy === undefined)
57
+ return yield* missingClient();
58
+ const value = readPolicyWord(positionals[0]);
59
+ const named = readOptionalRevision(options);
60
+ const commandId = yield* commandIdentifier(options.get("--command-id"));
61
+ const changed = yield* changeAtRevision(named, {
62
+ change: (revision) => setNodeUpdatePolicy({ commandId, revision, value }),
63
+ read: getNodeUpdatePolicy,
64
+ retry: `node update policy set ${value}`,
65
+ revisionOf: ({ revision }) => ({ ok: true, value: revision }),
66
+ });
67
+ return write(context)(changed);
68
+ });
69
+ const PAUSE_OPTIONS = new Set(["--command-id", "--reason"]);
70
+ export const runNodeUpdatePause = (tokens, context) => Effect.gen(function* () {
71
+ const { options, positionals } = parseOptions(tokens, PAUSE_OPTIONS);
72
+ requirePositionals(positionals, 0);
73
+ const { pauseNodeUpdate } = context.dependencies;
74
+ if (pauseNodeUpdate === undefined)
75
+ return yield* missingClient();
76
+ const commandId = yield* commandIdentifier(options.get("--command-id"));
77
+ const reason = options.get("--reason");
78
+ return write(context)(yield* pauseNodeUpdate({
79
+ commandId,
80
+ ...(reason === undefined ? {} : { reason }),
81
+ }));
82
+ });
83
+ export const runNodeUpdateResume = (tokens, context) => Effect.gen(function* () {
84
+ const { options, positionals } = parseOptions(tokens, new Set(["--command-id"]));
85
+ requirePositionals(positionals, 0);
86
+ const { resumeNodeUpdate } = context.dependencies;
87
+ if (resumeNodeUpdate === undefined)
88
+ return yield* missingClient();
89
+ const commandId = yield* commandIdentifier(options.get("--command-id"));
90
+ return write(context)(yield* resumeNodeUpdate({ commandId }));
91
+ });
92
+ const TWO_PHASE_OPTIONS = {
93
+ allowed: new Set(["--command-id"]),
94
+ allowedFlags: new Set(TWO_PHASE_FLAGS),
95
+ repeatable: new Set(),
96
+ };
97
+ const previewInput = (parsed) => Effect.map(commandIdentifier(parsed.options.get("--command-id")), (commandId) => ({ commandId, node: parsed.positionals[0] ?? "" }));
98
+ const ROLLBACK_PROMPT = {
99
+ describe: (preview) => formatNodeUpdateResult({ command: preview.method, result: preview }),
100
+ question: "Roll this Node back to its last good release?",
101
+ };
102
+ const APPLY_PROMPT = {
103
+ describe: (preview) => formatNodeUpdateResult({ command: preview.method, result: preview }),
104
+ question: "Ask the updater to install this release on this Node?",
105
+ };
106
+ const rollbackCalls = (client, parsed) => ({
107
+ confirm: (preview) => Effect.flatMap(confirmParameters(nodeUpdateRollbackConfirmParametersSchema, preview), client.confirmNodeUpdateRollback),
108
+ preview: () => Effect.flatMap(previewInput(parsed), client.previewNodeUpdateRollback),
109
+ });
110
+ const applyCalls = (client, parsed) => ({
111
+ confirm: (preview) => Effect.flatMap(confirmParameters(nodeUpdateApplyConfirmParametersSchema, preview), client.confirmNodeUpdateApply),
112
+ preview: () => Effect.flatMap(previewInput(parsed), client.previewNodeUpdateApply),
113
+ });
114
+ export const runNodeUpdateRollback = (tokens, context) => Effect.gen(function* () {
115
+ const parsed = parseOptionsWith(tokens, TWO_PHASE_OPTIONS);
116
+ const mode = readTwoPhaseMode(parsed.flags, context);
117
+ requirePositionals(parsed.positionals, mode === "confirm-stdin" ? 0 : 1);
118
+ const { confirmNodeUpdateRollback, previewNodeUpdateRollback } = context.dependencies;
119
+ if (confirmNodeUpdateRollback === undefined ||
120
+ previewNodeUpdateRollback === undefined)
121
+ return yield* missingClient();
122
+ const client = { confirmNodeUpdateRollback, previewNodeUpdateRollback };
123
+ return yield* runTwoPhase({
124
+ ...rollbackCalls(client, parsed),
125
+ context,
126
+ mode,
127
+ prompt: ROLLBACK_PROMPT,
128
+ writeConfirm: write(context),
129
+ writePreview: write(context),
130
+ });
131
+ });
132
+ export const runNodeUpdateApply = (tokens, context) => Effect.gen(function* () {
133
+ const parsed = parseOptionsWith(tokens, TWO_PHASE_OPTIONS);
134
+ const mode = readTwoPhaseMode(parsed.flags, context);
135
+ requirePositionals(parsed.positionals, mode === "confirm-stdin" ? 0 : 1);
136
+ const { confirmNodeUpdateApply, previewNodeUpdateApply } = context.dependencies;
137
+ if (confirmNodeUpdateApply === undefined ||
138
+ previewNodeUpdateApply === undefined)
139
+ return yield* missingClient();
140
+ const client = { confirmNodeUpdateApply, previewNodeUpdateApply };
141
+ return yield* runTwoPhase({
142
+ ...applyCalls(client, parsed),
143
+ context,
144
+ mode,
145
+ prompt: APPLY_PROMPT,
146
+ writeConfirm: write(context),
147
+ writePreview: write(context),
148
+ });
149
+ });
150
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1,4 @@
1
+ export { makeNodeUpdateClient, type NodeUpdateCliDependencies, } from "./client.js";
2
+ export { runNodeUpdateApply, runNodeUpdateCheck, runNodeUpdatePause, runNodeUpdatePolicySet, runNodeUpdatePolicyShow, runNodeUpdateResume, runNodeUpdateRollback, runNodeUpdateShow, runNodeUpdateStatus, } from "./commands.js";
3
+ export { pendingPhrases, repairLines } from "./output.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ export { makeNodeUpdateClient, } from "./client.js";
2
+ export { runNodeUpdateApply, runNodeUpdateCheck, runNodeUpdatePause, runNodeUpdatePolicySet, runNodeUpdatePolicyShow, runNodeUpdateResume, runNodeUpdateRollback, runNodeUpdateShow, runNodeUpdateStatus, } from "./commands.js";
3
+ export { pendingPhrases, repairLines } from "./output.js";
4
+ //# sourceMappingURL=index.js.map