@maiaos/cli 0.1.0-canary.10

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 (513) hide show
  1. package/README.md +60 -0
  2. package/dist/address-space/address-space.d.ts +38 -0
  3. package/dist/address-space/address-space.js +130 -0
  4. package/dist/address-space/index.d.ts +2 -0
  5. package/dist/address-space/index.js +2 -0
  6. package/dist/agents/client.d.ts +171 -0
  7. package/dist/agents/client.js +8 -0
  8. package/dist/agents/commands.d.ts +7 -0
  9. package/dist/agents/commands.js +65 -0
  10. package/dist/agents/index.d.ts +3 -0
  11. package/dist/agents/index.js +3 -0
  12. package/dist/agents/input.d.ts +130 -0
  13. package/dist/agents/input.js +99 -0
  14. package/dist/agents/output/format.d.ts +8 -0
  15. package/dist/agents/output/format.js +47 -0
  16. package/dist/agents/output/index.d.ts +2 -0
  17. package/dist/agents/output/index.js +2 -0
  18. package/dist/agents/tree/index.d.ts +2 -0
  19. package/dist/agents/tree/index.js +2 -0
  20. package/dist/agents/tree/tree.d.ts +3 -0
  21. package/dist/agents/tree/tree.js +43 -0
  22. package/dist/bin/maia.NOTICES.txt +59 -0
  23. package/dist/bin/maia.cdx.json +168 -0
  24. package/dist/bin/maia.mjs +2 -0
  25. package/dist/bootstrap/exit.d.ts +14 -0
  26. package/dist/bootstrap/exit.js +42 -0
  27. package/dist/bootstrap/index.d.ts +3 -0
  28. package/dist/bootstrap/index.js +3 -0
  29. package/dist/bootstrap/process.d.ts +5 -0
  30. package/dist/bootstrap/process.js +23 -0
  31. package/dist/bootstrap/run.d.ts +25 -0
  32. package/dist/bootstrap/run.js +95 -0
  33. package/dist/bootstrap/stdio.d.ts +4 -0
  34. package/dist/bootstrap/stdio.js +9 -0
  35. package/dist/cli/cli.d.ts +17 -0
  36. package/dist/cli/cli.js +545 -0
  37. package/dist/cli/environment.d.ts +8 -0
  38. package/dist/cli/environment.js +12 -0
  39. package/dist/cli/index.d.ts +2 -0
  40. package/dist/cli/index.js +2 -0
  41. package/dist/cli/services.d.ts +4 -0
  42. package/dist/cli/services.js +4 -0
  43. package/dist/command-line/context.d.ts +188 -0
  44. package/dist/command-line/context.js +2 -0
  45. package/dist/command-line/index.d.ts +7 -0
  46. package/dist/command-line/index.js +7 -0
  47. package/dist/command-line/input/arguments.d.ts +62 -0
  48. package/dist/command-line/input/arguments.js +232 -0
  49. package/dist/command-line/input/index.d.ts +4 -0
  50. package/dist/command-line/input/index.js +4 -0
  51. package/dist/command-line/input/prompt.d.ts +8 -0
  52. package/dist/command-line/input/prompt.js +44 -0
  53. package/dist/command-line/input/stdin-stream.d.ts +4 -0
  54. package/dist/command-line/input/stdin-stream.js +3 -0
  55. package/dist/command-line/input/stdin.d.ts +12 -0
  56. package/dist/command-line/input/stdin.js +24 -0
  57. package/dist/command-line/json-decoder.d.ts +3 -0
  58. package/dist/command-line/json-decoder.js +3 -0
  59. package/dist/command-line/json.d.ts +4 -0
  60. package/dist/command-line/json.js +27 -0
  61. package/dist/command-line/output.d.ts +64 -0
  62. package/dist/command-line/output.js +113 -0
  63. package/dist/command-line/rows.d.ts +12 -0
  64. package/dist/command-line/rows.js +41 -0
  65. package/dist/command-line/two-phase.d.ts +62 -0
  66. package/dist/command-line/two-phase.js +173 -0
  67. package/dist/command-receipt/command.d.ts +4 -0
  68. package/dist/command-receipt/command.js +59 -0
  69. package/dist/command-receipt/compact-list.d.ts +20 -0
  70. package/dist/command-receipt/compact-list.js +29 -0
  71. package/dist/command-receipt/index.d.ts +3 -0
  72. package/dist/command-receipt/index.js +3 -0
  73. package/dist/command-tree/commands.d.ts +17 -0
  74. package/dist/command-tree/commands.js +41 -0
  75. package/dist/command-tree/completion.d.ts +6 -0
  76. package/dist/command-tree/completion.js +36 -0
  77. package/dist/command-tree/grammar.d.ts +18 -0
  78. package/dist/command-tree/grammar.js +160 -0
  79. package/dist/command-tree/help.d.ts +62 -0
  80. package/dist/command-tree/help.js +220 -0
  81. package/dist/command-tree/index.d.ts +8 -0
  82. package/dist/command-tree/index.js +6 -0
  83. package/dist/command-tree/local.d.ts +3 -0
  84. package/dist/command-tree/local.js +138 -0
  85. package/dist/command-tree/placeholder.d.ts +4 -0
  86. package/dist/command-tree/placeholder.js +5 -0
  87. package/dist/command-tree/row.d.ts +31 -0
  88. package/dist/command-tree/row.js +2 -0
  89. package/dist/command-tree/suggest.d.ts +3 -0
  90. package/dist/command-tree/suggest.js +81 -0
  91. package/dist/command-tree/tree.d.ts +35 -0
  92. package/dist/command-tree/tree.js +140 -0
  93. package/dist/connection/access/client.d.ts +13 -0
  94. package/dist/connection/access/client.js +19 -0
  95. package/dist/connection/access/commands.d.ts +6 -0
  96. package/dist/connection/access/commands.js +60 -0
  97. package/dist/connection/access/format.d.ts +8 -0
  98. package/dist/connection/access/format.js +61 -0
  99. package/dist/connection/access/index.d.ts +3 -0
  100. package/dist/connection/access/index.js +3 -0
  101. package/dist/connection/access/input.d.ts +53 -0
  102. package/dist/connection/access/input.js +83 -0
  103. package/dist/connection/client.d.ts +790 -0
  104. package/dist/connection/client.js +36 -0
  105. package/dist/connection/commands.d.ts +15 -0
  106. package/dist/connection/commands.js +118 -0
  107. package/dist/connection/index.d.ts +8 -0
  108. package/dist/connection/index.js +8 -0
  109. package/dist/connection/input.d.ts +50 -0
  110. package/dist/connection/input.js +90 -0
  111. package/dist/connection/login.d.ts +13 -0
  112. package/dist/connection/login.js +69 -0
  113. package/dist/connection/output/format.d.ts +32 -0
  114. package/dist/connection/output/format.js +94 -0
  115. package/dist/connection/output/index.d.ts +2 -0
  116. package/dist/connection/output/index.js +2 -0
  117. package/dist/connection/resolve.d.ts +60 -0
  118. package/dist/connection/resolve.js +30 -0
  119. package/dist/connection/signin.d.ts +4 -0
  120. package/dist/connection/signin.js +32 -0
  121. package/dist/connection/system.d.ts +5 -0
  122. package/dist/connection/system.js +294 -0
  123. package/dist/connection/tree/index.d.ts +2 -0
  124. package/dist/connection/tree/index.js +2 -0
  125. package/dist/connection/tree/tree.d.ts +3 -0
  126. package/dist/connection/tree/tree.js +260 -0
  127. package/dist/container/client.d.ts +142 -0
  128. package/dist/container/client.js +11 -0
  129. package/dist/container/commands.d.ts +7 -0
  130. package/dist/container/commands.js +100 -0
  131. package/dist/container/index.d.ts +3 -0
  132. package/dist/container/index.js +3 -0
  133. package/dist/container/output/format.d.ts +11 -0
  134. package/dist/container/output/format.js +27 -0
  135. package/dist/container/output/index.d.ts +2 -0
  136. package/dist/container/output/index.js +2 -0
  137. package/dist/context/client.d.ts +7 -0
  138. package/dist/context/client.js +21 -0
  139. package/dist/context/commands.d.ts +3 -0
  140. package/dist/context/commands.js +27 -0
  141. package/dist/context/index.d.ts +3 -0
  142. package/dist/context/index.js +3 -0
  143. package/dist/dashboard/cockpit-client.d.ts +6 -0
  144. package/dist/dashboard/cockpit-client.js +27 -0
  145. package/dist/dashboard/cockpits.d.ts +29 -0
  146. package/dist/dashboard/cockpits.js +65 -0
  147. package/dist/dashboard/dashboard.d.ts +7 -0
  148. package/dist/dashboard/dashboard.js +47 -0
  149. package/dist/dashboard/draw.d.ts +15 -0
  150. package/dist/dashboard/draw.js +30 -0
  151. package/dist/dashboard/frame.d.ts +4 -0
  152. package/dist/dashboard/frame.js +15 -0
  153. package/dist/dashboard/index.d.ts +2 -0
  154. package/dist/dashboard/index.js +2 -0
  155. package/dist/dashboard/modes.d.ts +5 -0
  156. package/dist/dashboard/modes.js +16 -0
  157. package/dist/dashboard/node-connection.d.ts +15 -0
  158. package/dist/dashboard/node-connection.js +51 -0
  159. package/dist/dashboard/pi-tui.d.ts +6 -0
  160. package/dist/dashboard/pi-tui.js +35 -0
  161. package/dist/dashboard/status-bar.d.ts +4 -0
  162. package/dist/dashboard/status-bar.js +60 -0
  163. package/dist/dashboard/terminal.d.ts +53 -0
  164. package/dist/dashboard/terminal.js +165 -0
  165. package/dist/dashboard/tree-model.d.ts +28 -0
  166. package/dist/dashboard/tree-model.js +97 -0
  167. package/dist/dashboard/tree.d.ts +10 -0
  168. package/dist/dashboard/tree.js +76 -0
  169. package/dist/development/cli.d.ts +3 -0
  170. package/dist/development/cli.js +44 -0
  171. package/dist/execution/client.d.ts +25 -0
  172. package/dist/execution/client.js +24 -0
  173. package/dist/execution/index.d.ts +3 -0
  174. package/dist/execution/index.js +3 -0
  175. package/dist/execution/relocation.d.ts +6 -0
  176. package/dist/execution/relocation.js +123 -0
  177. package/dist/execution/tree/index.d.ts +2 -0
  178. package/dist/execution/tree/index.js +2 -0
  179. package/dist/execution/tree/tree.d.ts +3 -0
  180. package/dist/execution/tree/tree.js +137 -0
  181. package/dist/fleet/fleet.d.ts +70 -0
  182. package/dist/fleet/fleet.js +91 -0
  183. package/dist/fleet/index.d.ts +2 -0
  184. package/dist/fleet/index.js +2 -0
  185. package/dist/hold/client.d.ts +137 -0
  186. package/dist/hold/client.js +12 -0
  187. package/dist/hold/commands.d.ts +5 -0
  188. package/dist/hold/commands.js +91 -0
  189. package/dist/hold/index.d.ts +3 -0
  190. package/dist/hold/index.js +3 -0
  191. package/dist/hold/output/format.d.ts +11 -0
  192. package/dist/hold/output/format.js +25 -0
  193. package/dist/hold/output/index.d.ts +2 -0
  194. package/dist/hold/output/index.js +2 -0
  195. package/dist/hold/tree/index.d.ts +2 -0
  196. package/dist/hold/tree/index.js +2 -0
  197. package/dist/hold/tree/tree.d.ts +3 -0
  198. package/dist/hold/tree/tree.js +97 -0
  199. package/dist/import/client.d.ts +14 -0
  200. package/dist/import/client.js +16 -0
  201. package/dist/import/commands.d.ts +5 -0
  202. package/dist/import/commands.js +75 -0
  203. package/dist/import/index.d.ts +3 -0
  204. package/dist/import/index.js +3 -0
  205. package/dist/import/input.d.ts +16 -0
  206. package/dist/import/input.js +92 -0
  207. package/dist/import/output.d.ts +6 -0
  208. package/dist/import/output.js +37 -0
  209. package/dist/index.d.ts +2 -0
  210. package/dist/index.js +2 -0
  211. package/dist/integration/client.d.ts +1284 -0
  212. package/dist/integration/client.js +24 -0
  213. package/dist/integration/commands.d.ts +10 -0
  214. package/dist/integration/commands.js +104 -0
  215. package/dist/integration/index.d.ts +3 -0
  216. package/dist/integration/index.js +3 -0
  217. package/dist/integration/output.d.ts +22 -0
  218. package/dist/integration/output.js +20 -0
  219. package/dist/local-node/call.d.ts +7 -0
  220. package/dist/local-node/call.js +13 -0
  221. package/dist/local-node/client.d.ts +72 -0
  222. package/dist/local-node/client.js +253 -0
  223. package/dist/local-node/index.d.ts +4 -0
  224. package/dist/local-node/index.js +4 -0
  225. package/dist/local-node/wait.d.ts +10 -0
  226. package/dist/local-node/wait.js +17 -0
  227. package/dist/login/agent-provider.d.ts +20 -0
  228. package/dist/login/agent-provider.js +109 -0
  229. package/dist/login/commands.d.ts +4 -0
  230. package/dist/login/commands.js +94 -0
  231. package/dist/login/failure.d.ts +3 -0
  232. package/dist/login/failure.js +14 -0
  233. package/dist/login/gateway.d.ts +12 -0
  234. package/dist/login/gateway.js +71 -0
  235. package/dist/login/index.d.ts +3 -0
  236. package/dist/login/index.js +2 -0
  237. package/dist/login/menu.d.ts +4 -0
  238. package/dist/login/menu.js +105 -0
  239. package/dist/login/output/format.d.ts +16 -0
  240. package/dist/login/output/format.js +31 -0
  241. package/dist/login/output/index.d.ts +2 -0
  242. package/dist/login/output/index.js +2 -0
  243. package/dist/login/vendor-account.d.ts +95 -0
  244. package/dist/login/vendor-account.js +75 -0
  245. package/dist/login/vendor-input.d.ts +14 -0
  246. package/dist/login/vendor-input.js +36 -0
  247. package/dist/mcp/calls.d.ts +8 -0
  248. package/dist/mcp/calls.js +236 -0
  249. package/dist/mcp/commands.d.ts +12 -0
  250. package/dist/mcp/commands.js +47 -0
  251. package/dist/mcp/index.d.ts +2 -0
  252. package/dist/mcp/index.js +2 -0
  253. package/dist/mcp/routing.d.ts +24 -0
  254. package/dist/mcp/routing.js +188 -0
  255. package/dist/mcp/server.d.ts +20 -0
  256. package/dist/mcp/server.js +80 -0
  257. package/dist/orchestration/client.d.ts +78 -0
  258. package/dist/orchestration/client.js +89 -0
  259. package/dist/orchestration/commands.d.ts +14 -0
  260. package/dist/orchestration/commands.js +312 -0
  261. package/dist/orchestration/index.d.ts +3 -0
  262. package/dist/orchestration/index.js +3 -0
  263. package/dist/orchestration/output/compact-aggregate.d.ts +121 -0
  264. package/dist/orchestration/output/compact-aggregate.js +110 -0
  265. package/dist/orchestration/output/compact-run-list.d.ts +20 -0
  266. package/dist/orchestration/output/compact-run-list.js +16 -0
  267. package/dist/orchestration/output/human.d.ts +80 -0
  268. package/dist/orchestration/output/human.js +252 -0
  269. package/dist/orchestration/output/index.d.ts +4 -0
  270. package/dist/orchestration/output/index.js +4 -0
  271. package/dist/orchestration/tree/index.d.ts +2 -0
  272. package/dist/orchestration/tree/index.js +2 -0
  273. package/dist/orchestration/tree/tree.d.ts +3 -0
  274. package/dist/orchestration/tree/tree.js +142 -0
  275. package/dist/port-lease/client.d.ts +160 -0
  276. package/dist/port-lease/client.js +11 -0
  277. package/dist/port-lease/commands.d.ts +6 -0
  278. package/dist/port-lease/commands.js +17 -0
  279. package/dist/port-lease/index.d.ts +3 -0
  280. package/dist/port-lease/index.js +3 -0
  281. package/dist/port-lease/input.d.ts +65 -0
  282. package/dist/port-lease/input.js +67 -0
  283. package/dist/port-lease/output/format.d.ts +11 -0
  284. package/dist/port-lease/output/format.js +24 -0
  285. package/dist/port-lease/output/index.d.ts +2 -0
  286. package/dist/port-lease/output/index.js +2 -0
  287. package/dist/presentation/client.d.ts +10 -0
  288. package/dist/presentation/client.js +9 -0
  289. package/dist/presentation/commands.d.ts +6 -0
  290. package/dist/presentation/commands.js +78 -0
  291. package/dist/presentation/index.d.ts +4 -0
  292. package/dist/presentation/index.js +3 -0
  293. package/dist/presentation/output/format.d.ts +11 -0
  294. package/dist/presentation/output/format.js +33 -0
  295. package/dist/presentation/output/index.d.ts +3 -0
  296. package/dist/presentation/output/index.js +2 -0
  297. package/dist/project-guard/client.d.ts +88 -0
  298. package/dist/project-guard/client.js +7 -0
  299. package/dist/project-guard/commands.d.ts +4 -0
  300. package/dist/project-guard/commands.js +48 -0
  301. package/dist/project-guard/index.d.ts +3 -0
  302. package/dist/project-guard/index.js +3 -0
  303. package/dist/project-guard/input.d.ts +18 -0
  304. package/dist/project-guard/input.js +47 -0
  305. package/dist/project-guard/output/format.d.ts +11 -0
  306. package/dist/project-guard/output/format.js +35 -0
  307. package/dist/project-guard/output/index.d.ts +2 -0
  308. package/dist/project-guard/output/index.js +2 -0
  309. package/dist/project-workspace/client.d.ts +86 -0
  310. package/dist/project-workspace/client.js +159 -0
  311. package/dist/project-workspace/commands.d.ts +30 -0
  312. package/dist/project-workspace/commands.js +710 -0
  313. package/dist/project-workspace/index.d.ts +5 -0
  314. package/dist/project-workspace/index.js +5 -0
  315. package/dist/project-workspace/metadata-client.d.ts +99 -0
  316. package/dist/project-workspace/metadata-client.js +8 -0
  317. package/dist/project-workspace/metadata-commands.d.ts +4 -0
  318. package/dist/project-workspace/metadata-commands.js +56 -0
  319. package/dist/project-workspace/output/human.d.ts +139 -0
  320. package/dist/project-workspace/output/human.js +115 -0
  321. package/dist/project-workspace/output/index.d.ts +3 -0
  322. package/dist/project-workspace/output/index.js +3 -0
  323. package/dist/project-workspace/output/metadata.d.ts +11 -0
  324. package/dist/project-workspace/output/metadata.js +17 -0
  325. package/dist/project-workspace/tree/index.d.ts +2 -0
  326. package/dist/project-workspace/tree/index.js +2 -0
  327. package/dist/project-workspace/tree/tree.d.ts +3 -0
  328. package/dist/project-workspace/tree/tree.js +212 -0
  329. package/dist/provider/client.d.ts +6 -0
  330. package/dist/provider/client.js +5 -0
  331. package/dist/provider/commands.d.ts +3 -0
  332. package/dist/provider/commands.js +38 -0
  333. package/dist/provider/index.d.ts +3 -0
  334. package/dist/provider/index.js +3 -0
  335. package/dist/reference/commands.d.ts +3 -0
  336. package/dist/reference/commands.js +41 -0
  337. package/dist/reference/index.d.ts +3 -0
  338. package/dist/reference/index.js +3 -0
  339. package/dist/reference/resolve.d.ts +31 -0
  340. package/dist/reference/resolve.js +304 -0
  341. package/dist/reference/tree/index.d.ts +2 -0
  342. package/dist/reference/tree/index.js +2 -0
  343. package/dist/reference/tree/tree.d.ts +3 -0
  344. package/dist/reference/tree/tree.js +17 -0
  345. package/dist/remote-node/client.d.ts +338 -0
  346. package/dist/remote-node/client.js +17 -0
  347. package/dist/remote-node/commands.d.ts +15 -0
  348. package/dist/remote-node/commands.js +342 -0
  349. package/dist/remote-node/connector.d.ts +67 -0
  350. package/dist/remote-node/connector.js +143 -0
  351. package/dist/remote-node/index.d.ts +4 -0
  352. package/dist/remote-node/index.js +4 -0
  353. package/dist/remote-node/reachability.d.ts +64 -0
  354. package/dist/remote-node/reachability.js +44 -0
  355. package/dist/remote-node/text.d.ts +10 -0
  356. package/dist/remote-node/text.js +111 -0
  357. package/dist/remote-node/tree/index.d.ts +2 -0
  358. package/dist/remote-node/tree/index.js +2 -0
  359. package/dist/remote-node/tree/tree.d.ts +3 -0
  360. package/dist/remote-node/tree/tree.js +71 -0
  361. package/dist/routine/client.d.ts +398 -0
  362. package/dist/routine/client.js +28 -0
  363. package/dist/routine/commands.d.ts +9 -0
  364. package/dist/routine/commands.js +109 -0
  365. package/dist/routine/index.d.ts +3 -0
  366. package/dist/routine/index.js +3 -0
  367. package/dist/routine/input.d.ts +28 -0
  368. package/dist/routine/input.js +44 -0
  369. package/dist/routine/output/format.d.ts +23 -0
  370. package/dist/routine/output/format.js +83 -0
  371. package/dist/routine/output/index.d.ts +2 -0
  372. package/dist/routine/output/index.js +2 -0
  373. package/dist/routine/tree/index.d.ts +2 -0
  374. package/dist/routine/tree/index.js +2 -0
  375. package/dist/routine/tree/tree.d.ts +3 -0
  376. package/dist/routine/tree/tree.js +70 -0
  377. package/dist/run-ledger/client.d.ts +358 -0
  378. package/dist/run-ledger/client.js +13 -0
  379. package/dist/run-ledger/commands.d.ts +8 -0
  380. package/dist/run-ledger/commands.js +19 -0
  381. package/dist/run-ledger/index.d.ts +3 -0
  382. package/dist/run-ledger/index.js +3 -0
  383. package/dist/run-ledger/input.d.ts +42 -0
  384. package/dist/run-ledger/input.js +107 -0
  385. package/dist/run-ledger/output/format.d.ts +11 -0
  386. package/dist/run-ledger/output/format.js +49 -0
  387. package/dist/run-ledger/output/index.d.ts +2 -0
  388. package/dist/run-ledger/output/index.js +2 -0
  389. package/dist/session/agent-permission.d.ts +63 -0
  390. package/dist/session/agent-permission.js +20 -0
  391. package/dist/session/approval/client.d.ts +117 -0
  392. package/dist/session/approval/client.js +7 -0
  393. package/dist/session/approval/commands.d.ts +7 -0
  394. package/dist/session/approval/commands.js +145 -0
  395. package/dist/session/approval/index.d.ts +3 -0
  396. package/dist/session/approval/index.js +3 -0
  397. package/dist/session/approval/output/format.d.ts +23 -0
  398. package/dist/session/approval/output/format.js +33 -0
  399. package/dist/session/approval/output/index.d.ts +2 -0
  400. package/dist/session/approval/output/index.js +2 -0
  401. package/dist/session/attach-client.d.ts +16 -0
  402. package/dist/session/attach-client.js +17 -0
  403. package/dist/session/attach-render.d.ts +16 -0
  404. package/dist/session/attach-render.js +162 -0
  405. package/dist/session/attach.d.ts +5 -0
  406. package/dist/session/attach.js +120 -0
  407. package/dist/session/client.d.ts +140 -0
  408. package/dist/session/client.js +129 -0
  409. package/dist/session/coding-client.d.ts +16 -0
  410. package/dist/session/coding-client.js +15 -0
  411. package/dist/session/coding-commands.d.ts +4 -0
  412. package/dist/session/coding-commands.js +50 -0
  413. package/dist/session/commands.d.ts +14 -0
  414. package/dist/session/commands.js +585 -0
  415. package/dist/session/create-tasks.d.ts +20 -0
  416. package/dist/session/create-tasks.js +128 -0
  417. package/dist/session/index.d.ts +9 -0
  418. package/dist/session/index.js +8 -0
  419. package/dist/session/interaction/client.d.ts +347 -0
  420. package/dist/session/interaction/client.js +15 -0
  421. package/dist/session/interaction/commands.d.ts +7 -0
  422. package/dist/session/interaction/commands.js +101 -0
  423. package/dist/session/interaction/index.d.ts +3 -0
  424. package/dist/session/interaction/index.js +3 -0
  425. package/dist/session/interaction/input.d.ts +15 -0
  426. package/dist/session/interaction/input.js +46 -0
  427. package/dist/session/interaction/output/format.d.ts +11 -0
  428. package/dist/session/interaction/output/format.js +4 -0
  429. package/dist/session/interaction/output/index.d.ts +2 -0
  430. package/dist/session/interaction/output/index.js +2 -0
  431. package/dist/session/output/diff.d.ts +3 -0
  432. package/dist/session/output/diff.js +23 -0
  433. package/dist/session/output/failure.d.ts +11 -0
  434. package/dist/session/output/failure.js +17 -0
  435. package/dist/session/output/human.d.ts +113 -0
  436. package/dist/session/output/human.js +82 -0
  437. package/dist/session/output/index.d.ts +6 -0
  438. package/dist/session/output/index.js +6 -0
  439. package/dist/session/output/observe.d.ts +4 -0
  440. package/dist/session/output/observe.js +46 -0
  441. package/dist/session/output/tasks.d.ts +34 -0
  442. package/dist/session/output/tasks.js +48 -0
  443. package/dist/session/rename.d.ts +3 -0
  444. package/dist/session/rename.js +37 -0
  445. package/dist/session/task-file.d.ts +5 -0
  446. package/dist/session/task-file.js +23 -0
  447. package/dist/session/tree/index.d.ts +2 -0
  448. package/dist/session/tree/index.js +2 -0
  449. package/dist/session/tree/tree.d.ts +3 -0
  450. package/dist/session/tree/tree.js +368 -0
  451. package/dist/session/turn/client.d.ts +28 -0
  452. package/dist/session/turn/client.js +51 -0
  453. package/dist/session/turn/commands.d.ts +8 -0
  454. package/dist/session/turn/commands.js +185 -0
  455. package/dist/session/turn/index.d.ts +4 -0
  456. package/dist/session/turn/index.js +3 -0
  457. package/dist/session/turn/output.d.ts +47 -0
  458. package/dist/session/turn/output.js +61 -0
  459. package/dist/status/client.d.ts +124 -0
  460. package/dist/status/client.js +5 -0
  461. package/dist/status/command.d.ts +4 -0
  462. package/dist/status/command.js +40 -0
  463. package/dist/status/doctor.d.ts +15 -0
  464. package/dist/status/doctor.js +111 -0
  465. package/dist/status/index.d.ts +5 -0
  466. package/dist/status/index.js +4 -0
  467. package/dist/status/output/compact.d.ts +32 -0
  468. package/dist/status/output/compact.js +49 -0
  469. package/dist/status/output/human.d.ts +7 -0
  470. package/dist/status/output/human.js +87 -0
  471. package/dist/status/output/index.d.ts +3 -0
  472. package/dist/status/output/index.js +3 -0
  473. package/dist/team-workspace/ceremony.d.ts +19 -0
  474. package/dist/team-workspace/ceremony.js +141 -0
  475. package/dist/team-workspace/client.d.ts +58 -0
  476. package/dist/team-workspace/client.js +6 -0
  477. package/dist/team-workspace/commands.d.ts +3 -0
  478. package/dist/team-workspace/commands.js +85 -0
  479. package/dist/team-workspace/confirmation.d.ts +4 -0
  480. package/dist/team-workspace/confirmation.js +8 -0
  481. package/dist/team-workspace/dependencies.d.ts +8 -0
  482. package/dist/team-workspace/dependencies.js +2 -0
  483. package/dist/team-workspace/index.d.ts +6 -0
  484. package/dist/team-workspace/index.js +5 -0
  485. package/dist/team-workspace/launcher.d.ts +17 -0
  486. package/dist/team-workspace/launcher.js +30 -0
  487. package/dist/team-workspace/output.d.ts +15 -0
  488. package/dist/team-workspace/output.js +28 -0
  489. package/dist/team-workspace/terminal.d.ts +9 -0
  490. package/dist/team-workspace/terminal.js +46 -0
  491. package/dist/terminal/arguments.d.ts +13 -0
  492. package/dist/terminal/arguments.js +79 -0
  493. package/dist/terminal/client.d.ts +83 -0
  494. package/dist/terminal/client.js +71 -0
  495. package/dist/terminal/commands.d.ts +7 -0
  496. package/dist/terminal/commands.js +143 -0
  497. package/dist/terminal/control-commands.d.ts +10 -0
  498. package/dist/terminal/control-commands.js +212 -0
  499. package/dist/terminal/index.d.ts +4 -0
  500. package/dist/terminal/index.js +4 -0
  501. package/dist/terminal/output/compact-list.d.ts +148 -0
  502. package/dist/terminal/output/compact-list.js +153 -0
  503. package/dist/terminal/output/human.d.ts +42 -0
  504. package/dist/terminal/output/human.js +55 -0
  505. package/dist/terminal/output/index.d.ts +3 -0
  506. package/dist/terminal/output/index.js +3 -0
  507. package/dist/terminal/tree/index.d.ts +2 -0
  508. package/dist/terminal/tree/index.js +2 -0
  509. package/dist/terminal/tree/tree.d.ts +3 -0
  510. package/dist/terminal/tree/tree.js +104 -0
  511. package/guidance/maia-cli/SKILL.md +58 -0
  512. package/guidance/maia-orchestration/SKILL.md +54 -0
  513. package/package.json +78 -0
@@ -0,0 +1,141 @@
1
+ import { TEAM_WORKSPACE_BOOTSTRAP_PREVIEW_TTL_MILLISECONDS, teamWorkspaceBootstrapApplyResultSchema, } from "@maiaos/sdk";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Predicate from "effect/Predicate";
4
+ import * as Ref from "effect/Ref";
5
+ import * as Schedule from "effect/Schedule";
6
+ import { CliArgumentError, EXIT_CANCELLED, reportError, writeNodeResult, } from "../command-line/index.js";
7
+ import { confirmationFrame, confirmationPhrase } from "./confirmation.js";
8
+ import { describePreview, formatBootstrapOutput, toBootstrapOutput, } from "./output.js";
9
+ const READY_DEADLINE = "30 seconds";
10
+ const READY_INTERVAL = "100 millis";
11
+ const DEFINITE_REFUSALS = new Set([
12
+ "bootstrap_authority_unavailable",
13
+ "bootstrap_binding_mismatch",
14
+ "bootstrap_confirmation_required",
15
+ "bootstrap_preview_expired",
16
+ ]);
17
+ const RESERVED_IDENTIFIERS = [
18
+ "clientId",
19
+ "deviceId",
20
+ "nodeId",
21
+ "teamWorkspaceId",
22
+ "userId",
23
+ ];
24
+ export const nodeUnavailable = (message) => ({
25
+ code: "node_unavailable",
26
+ message,
27
+ retryable: true,
28
+ });
29
+ const failed = (error) => ({
30
+ error,
31
+ ok: false,
32
+ });
33
+ const integrityFailed = (message) => failed({ code: "bootstrap_integrity_failed", message, retryable: false });
34
+ const previewWhenReady = (ceremony) => Effect.suspend(() => ceremony.dependencies.previewBootstrap(ceremony.parameters)).pipe(Effect.repeat({
35
+ schedule: Schedule.spaced(READY_INTERVAL),
36
+ until: (result) => result.ok || result.error.code !== "node_unavailable",
37
+ }), Effect.timeoutOrElse({
38
+ duration: READY_DEADLINE,
39
+ orElse: () => Effect.succeed(failed(nodeUnavailable("The Node did not become ready in 30 seconds."))),
40
+ }));
41
+ const askPerson = (ceremony, preview) => ceremony.dependencies
42
+ .confirmOnTerminal({
43
+ description: describePreview({
44
+ ownerDisplayName: ceremony.parameters.ownerDisplayName,
45
+ preview,
46
+ profile: ceremony.profile,
47
+ workspaceName: ceremony.parameters.workspaceName,
48
+ }),
49
+ expected: confirmationPhrase(preview),
50
+ })
51
+ .pipe(Effect.timeoutOrElse({
52
+ duration: TEAM_WORKSPACE_BOOTSTRAP_PREVIEW_TTL_MILLISECONDS,
53
+ orElse: () => Effect.succeed("expired"),
54
+ }));
55
+ const withoutApproval = (ceremony, answer) => {
56
+ const { context } = ceremony;
57
+ if (answer === "unavailable")
58
+ return Effect.fail(new CliArgumentError("No controlling terminal: run this command in a terminal. A pipe or redirect cannot confirm."));
59
+ if (answer === "expired")
60
+ return Effect.succeed(reportError({
61
+ code: "bootstrap_preview_expired",
62
+ message: "The preview expired before it was confirmed; run the command again.",
63
+ retryable: false,
64
+ }, context));
65
+ return Effect.sync(() => {
66
+ context.io.stderr("Cancelled; nothing changed.\n");
67
+ return EXIT_CANCELLED;
68
+ });
69
+ };
70
+ const matchesPreview = (result, preview) => result.commandId === preview.commandId &&
71
+ result.inputDigest === preview.inputDigest &&
72
+ result.previewId === preview.previewId &&
73
+ RESERVED_IDENTIFIERS.every((key) => result[key] === preview[key]);
74
+ const settle = (result, preview) => result.ok && !matchesPreview(result.value, preview)
75
+ ? integrityFailed("The Node's result does not match the confirmed preview.")
76
+ : result;
77
+ const recovered = (receipt, preview) => {
78
+ const parsed = Predicate.isObject(receipt.result)
79
+ ? teamWorkspaceBootstrapApplyResultSchema.safeParse({
80
+ ...receipt.result,
81
+ receipt: receipt.receipt,
82
+ })
83
+ : { success: false };
84
+ return parsed.success
85
+ ? settle({ ok: true, value: parsed.data }, preview)
86
+ : integrityFailed("The stored receipt is not this bootstrap's result.");
87
+ };
88
+ const afterRetry = (result, unknown) => {
89
+ if (result.ok)
90
+ return result;
91
+ const { code } = result.error;
92
+ if (code === "bootstrap_already_completed")
93
+ return integrityFailed("The Node is owned but holds no receipt for this command; bootstrap is not repeated.");
94
+ return DEFINITE_REFUSALS.has(code) ? result : unknown;
95
+ };
96
+ const applyParametersFor = (parameters, preview) => ({
97
+ ...parameters,
98
+ inputDigest: preview.inputDigest,
99
+ previewId: preview.previewId,
100
+ });
101
+ const reconcile = (ceremony, preview, unknown) => Effect.gen(function* () {
102
+ const { dependencies, parameters } = ceremony;
103
+ const receipt = yield* Effect.suspend(() => dependencies.getReceipt(parameters.commandId));
104
+ if (receipt.ok)
105
+ return recovered(receipt.value, preview);
106
+ if (receipt.error.code !== "resource_not_found")
107
+ return unknown;
108
+ const retried = yield* Effect.suspend(() => dependencies.applyBootstrap(applyParametersFor(parameters, preview)));
109
+ return settle(afterRetry(retried, unknown), preview);
110
+ });
111
+ const applyOnce = (ceremony, preview) => Effect.suspend(() => ceremony.dependencies.applyBootstrap(applyParametersFor(ceremony.parameters, preview))).pipe(Effect.flatMap((result) => !result.ok && result.error.code === "outcome_unknown"
112
+ ? reconcile(ceremony, preview, result)
113
+ : Effect.succeed(settle(result, preview))));
114
+ export const recoveryFor = ({ parameters, profile, }) => ({
115
+ commandId: parameters.commandId,
116
+ profile,
117
+ });
118
+ const withRecovery = (result, ceremony) => !result.ok && result.recovery !== undefined
119
+ ? { ...result, recovery: recoveryFor(ceremony) }
120
+ : result;
121
+ const confirmAndApply = (ceremony, preview) => ceremony.node.sendConfirmation(confirmationFrame(preview)).pipe(Effect.matchEffect({
122
+ onFailure: (error) => Effect.succeed(reportError({
123
+ code: "bootstrap_channel_invalid",
124
+ message: error.message,
125
+ retryable: false,
126
+ }, ceremony.context)),
127
+ onSuccess: () => Ref.set(ceremony.sent, true).pipe(Effect.andThen(applyOnce(ceremony, preview)), Effect.map((result) => writeNodeResult(withRecovery(result, ceremony), ceremony.context, {
128
+ toResult: toBootstrapOutput,
129
+ toText: formatBootstrapOutput,
130
+ }))),
131
+ }));
132
+ export const runCeremony = (ceremony) => Effect.gen(function* () {
133
+ const previewed = yield* previewWhenReady(ceremony);
134
+ if (!previewed.ok)
135
+ return reportError(previewed.error, ceremony.context);
136
+ const answer = yield* askPerson(ceremony, previewed.value);
137
+ return answer === "confirmed"
138
+ ? yield* confirmAndApply(ceremony, previewed.value)
139
+ : yield* withoutApproval(ceremony, answer);
140
+ });
141
+ //# sourceMappingURL=ceremony.js.map
@@ -0,0 +1,58 @@
1
+ import { type TeamWorkspaceBootstrapApplyParameters, type TeamWorkspaceBootstrapPreviewParameters } from "@maiaos/sdk";
2
+ import type { CliNodeOperations } from "../local-node/index.js";
3
+ export declare const makeBootstrapClient: (node: CliNodeOperations) => {
4
+ applyBootstrap: (input: TeamWorkspaceBootstrapApplyParameters) => import("../local-node/client.js").CliNodeEffect<{
5
+ readonly clientId: string;
6
+ readonly deviceId: string;
7
+ readonly nodeId: string;
8
+ readonly teamWorkspaceId: string;
9
+ readonly userId: string;
10
+ readonly authoritySource: "local-os-profile-owner";
11
+ readonly bootstrapRevision: "1";
12
+ readonly commandId: string;
13
+ readonly delivery: "duplicate" | "new";
14
+ readonly inputDigest: string;
15
+ readonly method: "team-workspace.bootstrap.apply";
16
+ readonly previewId: string;
17
+ readonly receipt: {
18
+ readonly actorId: string;
19
+ readonly aggregateRevision: string;
20
+ readonly commandId: string;
21
+ readonly createdAt: string;
22
+ readonly eventCursor: string;
23
+ readonly method: string;
24
+ readonly receiptId: string;
25
+ readonly schemaVersion: 1;
26
+ readonly state: "succeeded";
27
+ readonly target: {
28
+ readonly id: string;
29
+ readonly type: string;
30
+ };
31
+ readonly updatedAt: string;
32
+ };
33
+ readonly releaseQualified: false;
34
+ readonly role: "owner";
35
+ readonly schemaVersion: 1;
36
+ }>;
37
+ previewBootstrap: (input: TeamWorkspaceBootstrapPreviewParameters) => import("../local-node/client.js").CliNodeEffect<{
38
+ readonly clientId: string;
39
+ readonly deviceId: string;
40
+ readonly nodeId: string;
41
+ readonly teamWorkspaceId: string;
42
+ readonly userId: string;
43
+ readonly authoritySource: "local-os-profile-owner";
44
+ readonly commandId: string;
45
+ readonly expectedBootstrapRevision: "0";
46
+ readonly expiresAt: string;
47
+ readonly inputDigest: string;
48
+ readonly issuedAt: string;
49
+ readonly method: "team-workspace.bootstrap.preview";
50
+ readonly nodeEpoch: string;
51
+ readonly previewId: string;
52
+ readonly releaseQualified: false;
53
+ readonly role: "owner";
54
+ readonly schemaVersion: 1;
55
+ }>;
56
+ };
57
+ export type BootstrapClientDependencies = ReturnType<typeof makeBootstrapClient>;
58
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { teamWorkspaceBootstrapApplyParametersSchema, teamWorkspaceBootstrapPreviewParametersSchema, } from "@maiaos/sdk";
2
+ export const makeBootstrapClient = (node) => ({
3
+ applyBootstrap: (input) => node.runValidatedNodeOperation(input, teamWorkspaceBootstrapApplyParametersSchema, (client, parameters, options) => client.applyTeamWorkspaceBootstrap(parameters, options), { commandId: input.commandId }),
4
+ previewBootstrap: (input) => node.runValidatedNodeOperation(input, teamWorkspaceBootstrapPreviewParametersSchema, (client, parameters, options) => client.previewTeamWorkspaceBootstrap(parameters, options)),
5
+ });
6
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1,3 @@
1
+ import { type CommandContext, type CommandEffect } from "../command-line/index.js";
2
+ export declare const runNodeBootstrap: (tokens: readonly string[], context: CommandContext) => CommandEffect;
3
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1,85 @@
1
+ import { TEAM_WORKSPACE_BOOTSTRAP_SCHEMA_VERSION, teamWorkspaceBootstrapPreviewParametersSchema, } from "@maiaos/sdk";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Ref from "effect/Ref";
4
+ import { CliArgumentError, parseOptions, reportError, requirePositionals, } from "../command-line/index.js";
5
+ import { commandIdentifier } from "../local-node/index.js";
6
+ import { nodeUnavailable, recoveryFor, runCeremony, } from "./ceremony.js";
7
+ const OPTIONS = new Set(["--command-id", "--owner-name", "--workspace-name"]);
8
+ const requiredOption = (options, name) => {
9
+ const value = options.get(name);
10
+ if (value === undefined)
11
+ throw new CliArgumentError(`Option '${name}' is required.`);
12
+ return value;
13
+ };
14
+ const requiredProfile = (context) => {
15
+ if (context.profile === undefined)
16
+ throw new CliArgumentError("Option '--profile' is required: it names the profile whose Node this command starts.");
17
+ return context.profile;
18
+ };
19
+ const requireTerminalSession = (context) => {
20
+ if (context.io.interactive !== true)
21
+ throw new CliArgumentError("A person must confirm at a terminal: run this with standard input and error attached to a terminal and without '--no-input'.");
22
+ };
23
+ const readRequest = (tokens, context) => {
24
+ const parsed = parseOptions(tokens, OPTIONS);
25
+ requirePositionals(parsed.positionals, 0);
26
+ const profile = requiredProfile(context);
27
+ requireTerminalSession(context);
28
+ const commandId = parsed.options.get("--command-id");
29
+ return {
30
+ ...(commandId === undefined ? {} : { commandId }),
31
+ ownerDisplayName: requiredOption(parsed.options, "--owner-name"),
32
+ profile,
33
+ workspaceName: requiredOption(parsed.options, "--workspace-name"),
34
+ };
35
+ };
36
+ const requireDependencies = (context) => {
37
+ const { applyBootstrap, confirmOnTerminal, getReceipt, previewBootstrap, startBootstrapNode, } = context.dependencies;
38
+ if (applyBootstrap === undefined ||
39
+ confirmOnTerminal === undefined ||
40
+ previewBootstrap === undefined ||
41
+ startBootstrapNode === undefined)
42
+ throw new CliArgumentError("This CLI cannot bootstrap a Node.");
43
+ return {
44
+ applyBootstrap,
45
+ confirmOnTerminal,
46
+ getReceipt,
47
+ previewBootstrap,
48
+ startBootstrapNode,
49
+ };
50
+ };
51
+ const previewParametersFor = (request) => Effect.gen(function* () {
52
+ const parsed = teamWorkspaceBootstrapPreviewParametersSchema.safeParse({
53
+ commandId: yield* commandIdentifier(request.commandId),
54
+ expectedBootstrapRevision: "0",
55
+ ownerDisplayName: request.ownerDisplayName,
56
+ schemaVersion: TEAM_WORKSPACE_BOOTSTRAP_SCHEMA_VERSION,
57
+ workspaceName: request.workspaceName,
58
+ });
59
+ return parsed.success
60
+ ? parsed.data
61
+ : yield* new CliArgumentError("The bootstrap input is invalid: a name is 1 to 160 UTF-8 bytes of NFC text without control characters or edge whitespace, and '--command-id' is a protocol identifier.");
62
+ });
63
+ const reportExit = (node, ceremony) => node.exited.pipe(Effect.catch((error) => Effect.map(Ref.get(ceremony.sent), (confirmed) => reportError(nodeUnavailable(error.message), {
64
+ ...ceremony.context,
65
+ ...(confirmed ? { recovery: recoveryFor(ceremony) } : {}),
66
+ }))));
67
+ const supervise = (plan) => plan.dependencies.startBootstrapNode(plan.profile).pipe(Effect.matchEffect({
68
+ onFailure: (error) => Effect.succeed(reportError(nodeUnavailable(error.message), plan.context)),
69
+ onSuccess: (node) => Effect.flatMap(Ref.make(false), (sent) => {
70
+ const ceremony = { ...plan, node, sent };
71
+ return Effect.raceFirst(runCeremony(ceremony), reportExit(node, ceremony));
72
+ }),
73
+ }));
74
+ const plan = (request, context, parameters) => ({
75
+ context,
76
+ dependencies: requireDependencies(context),
77
+ parameters,
78
+ profile: request.profile,
79
+ });
80
+ export const runNodeBootstrap = (tokens, context) => Effect.gen(function* () {
81
+ const request = readRequest(tokens, context);
82
+ const parameters = yield* previewParametersFor(request);
83
+ return yield* Effect.scoped(supervise(plan(request, context, parameters)));
84
+ });
85
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1,4 @@
1
+ import type { TeamWorkspaceBootstrapPreviewResult } from "@maiaos/sdk";
2
+ export declare const confirmationFrame: (preview: Pick<TeamWorkspaceBootstrapPreviewResult, "commandId" | "inputDigest" | "nodeEpoch" | "previewId">) => string;
3
+ export declare const confirmationPhrase: (preview: Pick<TeamWorkspaceBootstrapPreviewResult, "previewId">) => string;
4
+ //# sourceMappingURL=confirmation.d.ts.map
@@ -0,0 +1,8 @@
1
+ export const confirmationFrame = (preview) => JSON.stringify({
2
+ commandId: preview.commandId,
3
+ inputDigest: preview.inputDigest,
4
+ nodeEpoch: preview.nodeEpoch,
5
+ previewId: preview.previewId,
6
+ });
7
+ export const confirmationPhrase = (preview) => `YES ${preview.previewId}`;
8
+ //# sourceMappingURL=confirmation.js.map
@@ -0,0 +1,8 @@
1
+ import type { BootstrapClientDependencies } from "./client.js";
2
+ import type { StartBootstrapNode } from "./launcher.js";
3
+ import type { ConfirmOnTerminal } from "./terminal.js";
4
+ export type BootstrapCliDependencies = BootstrapClientDependencies & {
5
+ readonly confirmOnTerminal: ConfirmOnTerminal;
6
+ readonly startBootstrapNode: StartBootstrapNode;
7
+ };
8
+ //# sourceMappingURL=dependencies.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=dependencies.js.map
@@ -0,0 +1,6 @@
1
+ export { makeBootstrapClient } from "./client.js";
2
+ export { runNodeBootstrap } from "./commands.js";
3
+ export type { BootstrapCliDependencies } from "./dependencies.js";
4
+ export { startBootstrapNode } from "./launcher.js";
5
+ export { confirmOnControllingTerminal } from "./terminal.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,5 @@
1
+ export { makeBootstrapClient } from "./client.js";
2
+ export { runNodeBootstrap } from "./commands.js";
3
+ export { startBootstrapNode } from "./launcher.js";
4
+ export { confirmOnControllingTerminal } from "./terminal.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,17 @@
1
+ import * as Effect from "effect/Effect";
2
+ import type * as Scope from "effect/Scope";
3
+ declare const BootstrapNodeError_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]; }>) => import("effect/Cause").YieldableError & {
4
+ readonly _tag: "BootstrapNodeError";
5
+ } & Readonly<A>;
6
+ export declare class BootstrapNodeError extends BootstrapNodeError_base<{
7
+ readonly message: string;
8
+ }> {
9
+ }
10
+ export type BootstrapNode = {
11
+ readonly exited: Effect.Effect<never, BootstrapNodeError>;
12
+ readonly sendConfirmation: (frame: string) => Effect.Effect<void, BootstrapNodeError>;
13
+ };
14
+ export type StartBootstrapNode = (profile: string) => Effect.Effect<BootstrapNode, BootstrapNodeError, Scope.Scope>;
15
+ export declare const startBootstrapNode: StartBootstrapNode;
16
+ export {};
17
+ //# sourceMappingURL=launcher.d.ts.map
@@ -0,0 +1,30 @@
1
+ import * as NodeChildProcessSpawner from "@effect/platform-node-shared/NodeChildProcessSpawner";
2
+ import * as NodeFileSystem from "@effect/platform-node-shared/NodeFileSystem";
3
+ import * as NodePath from "@effect/platform-node-shared/NodePath";
4
+ import * as Data from "effect/Data";
5
+ import * as Effect from "effect/Effect";
6
+ import * as Layer from "effect/Layer";
7
+ import * as ChildProcess from "effect/process/ChildProcess";
8
+ import * as Stream from "effect/Stream";
9
+ export class BootstrapNodeError extends Data.TaggedError("BootstrapNodeError") {
10
+ }
11
+ const CHANNEL_DESCRIPTOR = 3;
12
+ const FORCE_KILL_AFTER = "10 seconds";
13
+ const NODE_EXECUTABLE = "maia-node";
14
+ const spawner = NodeChildProcessSpawner.layer.pipe(Layer.provide(Layer.merge(NodeFileSystem.layer, NodePath.layer)));
15
+ const failure = (message) => new BootstrapNodeError({ message });
16
+ const spawnNode = (profile) => ChildProcess.make(NODE_EXECUTABLE, ["--desktop", "--profile", profile, "--bootstrap-channel"], {
17
+ additionalFds: { fd3: { type: "input" } },
18
+ detached: false,
19
+ env: { ["MAIA_DESKTOP_PARENT_PIPE"]: "1" },
20
+ extendEnv: true,
21
+ forceKillAfter: FORCE_KILL_AFTER,
22
+ stderr: "ignore",
23
+ stdin: "pipe",
24
+ stdout: "ignore",
25
+ });
26
+ export const startBootstrapNode = (profile) => spawnNode(profile).pipe(Effect.map((handle) => ({
27
+ exited: handle.exitCode.pipe(Effect.mapError(() => failure("The Node could not be supervised.")), Effect.flatMap((code) => Effect.fail(failure(`The Node exited with code ${String(code)}.`)))),
28
+ sendConfirmation: (frame) => Stream.make(new TextEncoder().encode(frame)).pipe(Stream.run(handle.getInputFd(CHANNEL_DESCRIPTOR)), Effect.mapError(() => failure("The Node closed its confirmation channel."))),
29
+ })), Effect.mapError(() => failure("The Node could not be started.")), Effect.provide(spawner));
30
+ //# sourceMappingURL=launcher.js.map
@@ -0,0 +1,15 @@
1
+ import type { TeamWorkspaceBootstrapApplyResult, TeamWorkspaceBootstrapPreviewResult } from "@maiaos/sdk";
2
+ export type BootstrapPreviewView = {
3
+ readonly ownerDisplayName: string;
4
+ readonly preview: TeamWorkspaceBootstrapPreviewResult;
5
+ readonly profile: string;
6
+ readonly workspaceName: string;
7
+ };
8
+ export declare const describePreview: ({ ownerDisplayName, preview, profile, workspaceName, }: BootstrapPreviewView) => string;
9
+ export type BootstrapOutput = {
10
+ readonly command: TeamWorkspaceBootstrapApplyResult["method"];
11
+ readonly result: TeamWorkspaceBootstrapApplyResult;
12
+ };
13
+ export declare const toBootstrapOutput: (result: TeamWorkspaceBootstrapApplyResult) => BootstrapOutput;
14
+ export declare const formatBootstrapOutput: ({ result }: BootstrapOutput) => string;
15
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1,28 @@
1
+ const LABEL_WIDTH = 16;
2
+ const row = (label, value) => ` ${label.padEnd(LABEL_WIDTH)}${value}`;
3
+ export const describePreview = ({ ownerDisplayName, preview, profile, workspaceName, }) => [
4
+ "Bootstrap the first owner of this Node. This cannot be repeated or undone.",
5
+ row("profile", profile),
6
+ row("node", `${preview.nodeId} (epoch ${preview.nodeEpoch})`),
7
+ row("owner", `${JSON.stringify(ownerDisplayName)} as ${preview.userId}`),
8
+ row("device", preview.deviceId),
9
+ row("client", preview.clientId),
10
+ row("team workspace", `${JSON.stringify(workspaceName)} as ${preview.teamWorkspaceId}`),
11
+ row("role", preview.role),
12
+ row("command", preview.commandId),
13
+ row("digest", preview.inputDigest),
14
+ row("preview", preview.previewId),
15
+ row("expires", preview.expiresAt),
16
+ ].join("\n");
17
+ export const toBootstrapOutput = (result) => ({ command: result.method, result });
18
+ export const formatBootstrapOutput = ({ result }) => `${[
19
+ `bootstrapped\t${result.delivery}`,
20
+ `node\t${result.nodeId}`,
21
+ `owner\t${result.userId}`,
22
+ `device\t${result.deviceId}`,
23
+ `client\t${result.clientId}`,
24
+ `team workspace\t${result.teamWorkspaceId}`,
25
+ `role\t${result.role}`,
26
+ `receipt\t${result.receipt.receiptId}`,
27
+ ].join("\n")}\n`;
28
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1,9 @@
1
+ import * as Effect from "effect/Effect";
2
+ export type TerminalAnswer = "confirmed" | "declined" | "unavailable";
3
+ export type TerminalRequest = {
4
+ readonly description: string;
5
+ readonly expected: string;
6
+ };
7
+ export type ConfirmOnTerminal = (request: TerminalRequest) => Effect.Effect<TerminalAnswer>;
8
+ export declare const confirmOnControllingTerminal: ConfirmOnTerminal;
9
+ //# sourceMappingURL=terminal.d.ts.map
@@ -0,0 +1,46 @@
1
+ import { closeSync, openSync } from "node:fs";
2
+ import { createInterface } from "node:readline";
3
+ import { isatty, ReadStream, WriteStream } from "node:tty";
4
+ import * as Effect from "effect/Effect";
5
+ const CONTROLLING_TERMINAL = "/dev/tty";
6
+ const openDescriptor = (flags) => {
7
+ const descriptor = openSync(CONTROLLING_TERMINAL, flags);
8
+ if (isatty(descriptor))
9
+ return descriptor;
10
+ closeSync(descriptor);
11
+ throw new TypeError("The controlling terminal is not a terminal.");
12
+ };
13
+ const destroyOnRelease = (stream) => Effect.sync(() => {
14
+ stream.destroy();
15
+ });
16
+ const openInput = Effect.acquireRelease(Effect.try(() => new ReadStream(openDescriptor("r"))), destroyOnRelease);
17
+ const openOutput = Effect.acquireRelease(Effect.try(() => new WriteStream(openDescriptor("w"))), destroyOnRelease);
18
+ const openLines = Effect.gen(function* () {
19
+ const input = yield* openInput;
20
+ const output = yield* openOutput;
21
+ return yield* Effect.acquireRelease(Effect.sync(() => createInterface({ input, output, terminal: true })), (lines) => Effect.sync(() => {
22
+ lines.close();
23
+ }));
24
+ });
25
+ const readAnswer = (lines, question) => Effect.callback((resume) => {
26
+ const ended = () => {
27
+ resume(Effect.undefined);
28
+ };
29
+ lines.once("close", ended);
30
+ lines.once("SIGINT", ended);
31
+ lines.question(question, (answer) => {
32
+ resume(Effect.succeed(answer));
33
+ });
34
+ return Effect.sync(() => {
35
+ lines.off("close", ended);
36
+ lines.off("SIGINT", ended);
37
+ });
38
+ });
39
+ export const confirmOnControllingTerminal = ({ description, expected, }) => Effect.gen(function* () {
40
+ const lines = yield* openLines;
41
+ const answer = yield* readAnswer(lines, `${description}\nType ${expected} to confirm, or anything else to cancel: `);
42
+ return answer?.trim() === expected
43
+ ? "confirmed"
44
+ : "declined";
45
+ }).pipe(Effect.scoped, Effect.orElseSucceed(() => "unavailable"));
46
+ //# sourceMappingURL=terminal.js.map
@@ -0,0 +1,13 @@
1
+ import type { LiveTerminalCloseParameters } from "@maiaos/sdk";
2
+ import { type ParsedOptions } from "../command-line/index.js";
3
+ export declare const readTerminalColumns: (value: string | undefined, fallback?: number) => number;
4
+ export declare const readTerminalRows: (value: string | undefined, fallback?: number) => number;
5
+ export declare const readTerminalGeneration: (parsed: ParsedOptions) => number;
6
+ export declare const readTerminalLeaseDuration: (parsed: ParsedOptions) => number;
7
+ export declare const readTerminalInputSequence: (parsed: ParsedOptions) => number;
8
+ export declare const readTerminalExpectedRevision: (parsed: ParsedOptions) => string;
9
+ type TerminalControllerFenceInput = Omit<LiveTerminalCloseParameters, "commandId">;
10
+ export declare const readTerminalControllerFence: (parsed: ParsedOptions, terminalId: string) => TerminalControllerFenceInput;
11
+ export declare const terminalControllerFenceOptionNames: readonly ["--command-id", "--controller-epoch", "--controller-expires-at", "--controller-id", "--controller-revision", "--expected-revision", "--terminal-generation"];
12
+ export {};
13
+ //# sourceMappingURL=arguments.d.ts.map
@@ -0,0 +1,79 @@
1
+ import { MAX_TERMINAL_COLUMNS, MAX_TERMINAL_CONTROLLER_LEASE_MS, MAX_TERMINAL_GENERATION, MAX_TERMINAL_INPUT_SEQUENCE, MAX_TERMINAL_ROWS, MIN_TERMINAL_COLUMNS, MIN_TERMINAL_CONTROLLER_LEASE_MS, MIN_TERMINAL_ROWS, } from "@maiaos/sdk";
2
+ import { CliArgumentError } from "../command-line/index.js";
3
+ const MAX_SIGNED_SQLITE_INTEGER = 9223372036854775807n;
4
+ const requiredOption = (parsed, name) => {
5
+ const value = parsed.options.get(name);
6
+ if (value === undefined) {
7
+ throw new CliArgumentError(`Option '${name}' is required.`);
8
+ }
9
+ return value;
10
+ };
11
+ const readBoundedInteger = (value, bounds) => {
12
+ const { maximum, minimum, name } = bounds;
13
+ if (!/^[1-9]\d*$/u.test(value)) {
14
+ throw new CliArgumentError(`Option '${name}' must be an integer from ${String(minimum)} to ${String(maximum)}.`);
15
+ }
16
+ const parsed = Number(value);
17
+ if (!Number.isSafeInteger(parsed) || parsed < minimum || parsed > maximum) {
18
+ throw new CliArgumentError(`Option '${name}' must be an integer from ${String(minimum)} to ${String(maximum)}.`);
19
+ }
20
+ return parsed;
21
+ };
22
+ const readRevision = (value, name) => {
23
+ if (!/^(?:0|[1-9]\d*)$/u.test(value) ||
24
+ BigInt(value) > MAX_SIGNED_SQLITE_INTEGER) {
25
+ throw new CliArgumentError(`Option '${name}' must be a non-negative signed 64-bit integer.`);
26
+ }
27
+ return value;
28
+ };
29
+ export const readTerminalColumns = (value, fallback) => readBoundedInteger(value ?? String(fallback), {
30
+ maximum: MAX_TERMINAL_COLUMNS,
31
+ minimum: MIN_TERMINAL_COLUMNS,
32
+ name: "--columns",
33
+ });
34
+ export const readTerminalRows = (value, fallback) => readBoundedInteger(value ?? String(fallback), {
35
+ maximum: MAX_TERMINAL_ROWS,
36
+ minimum: MIN_TERMINAL_ROWS,
37
+ name: "--rows",
38
+ });
39
+ export const readTerminalGeneration = (parsed) => readBoundedInteger(requiredOption(parsed, "--terminal-generation"), {
40
+ maximum: MAX_TERMINAL_GENERATION,
41
+ minimum: 1,
42
+ name: "--terminal-generation",
43
+ });
44
+ export const readTerminalLeaseDuration = (parsed) => readBoundedInteger(requiredOption(parsed, "--lease-ms"), {
45
+ maximum: MAX_TERMINAL_CONTROLLER_LEASE_MS,
46
+ minimum: MIN_TERMINAL_CONTROLLER_LEASE_MS,
47
+ name: "--lease-ms",
48
+ });
49
+ export const readTerminalInputSequence = (parsed) => readBoundedInteger(requiredOption(parsed, "--input-sequence"), {
50
+ maximum: MAX_TERMINAL_INPUT_SEQUENCE,
51
+ minimum: 1,
52
+ name: "--input-sequence",
53
+ });
54
+ export const readTerminalExpectedRevision = (parsed) => readRevision(requiredOption(parsed, "--expected-revision"), "--expected-revision");
55
+ export const readTerminalControllerFence = (parsed, terminalId) => {
56
+ const terminalGeneration = readTerminalGeneration(parsed);
57
+ return {
58
+ controller: {
59
+ epoch: readRevision(requiredOption(parsed, "--controller-epoch"), "--controller-epoch"),
60
+ expiresAt: requiredOption(parsed, "--controller-expires-at"),
61
+ id: requiredOption(parsed, "--controller-id"),
62
+ revision: readRevision(requiredOption(parsed, "--controller-revision"), "--controller-revision"),
63
+ terminalGeneration,
64
+ terminalId,
65
+ },
66
+ expectedTerminalRevision: readTerminalExpectedRevision(parsed),
67
+ terminalId,
68
+ };
69
+ };
70
+ export const terminalControllerFenceOptionNames = [
71
+ "--command-id",
72
+ "--controller-epoch",
73
+ "--controller-expires-at",
74
+ "--controller-id",
75
+ "--controller-revision",
76
+ "--expected-revision",
77
+ "--terminal-generation",
78
+ ];
79
+ //# sourceMappingURL=arguments.js.map