@maiaos/cli 0.1.0-canary.2

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 (413) hide show
  1. package/README.md +287 -0
  2. package/dist/bin/maia.NOTICES.txt +59 -0
  3. package/dist/bin/maia.cdx.json +145 -0
  4. package/dist/bin/maia.mjs +2 -0
  5. package/dist/bootstrap/index.d.ts +3 -0
  6. package/dist/bootstrap/index.js +3 -0
  7. package/dist/bootstrap/process.d.ts +5 -0
  8. package/dist/bootstrap/process.js +45 -0
  9. package/dist/bootstrap/run.d.ts +25 -0
  10. package/dist/bootstrap/run.js +95 -0
  11. package/dist/bootstrap/stdio.d.ts +4 -0
  12. package/dist/bootstrap/stdio.js +9 -0
  13. package/dist/cli/cli.d.ts +17 -0
  14. package/dist/cli/cli.js +481 -0
  15. package/dist/cli/environment.d.ts +8 -0
  16. package/dist/cli/environment.js +12 -0
  17. package/dist/cli/index.d.ts +2 -0
  18. package/dist/cli/index.js +2 -0
  19. package/dist/cli/services.d.ts +4 -0
  20. package/dist/cli/services.js +4 -0
  21. package/dist/command-line/context.d.ts +178 -0
  22. package/dist/command-line/context.js +2 -0
  23. package/dist/command-line/index.d.ts +7 -0
  24. package/dist/command-line/index.js +6 -0
  25. package/dist/command-line/input/arguments.d.ts +55 -0
  26. package/dist/command-line/input/arguments.js +220 -0
  27. package/dist/command-line/input/index.d.ts +4 -0
  28. package/dist/command-line/input/index.js +4 -0
  29. package/dist/command-line/input/prompt.d.ts +8 -0
  30. package/dist/command-line/input/prompt.js +44 -0
  31. package/dist/command-line/input/stdin-stream.d.ts +4 -0
  32. package/dist/command-line/input/stdin-stream.js +3 -0
  33. package/dist/command-line/input/stdin.d.ts +11 -0
  34. package/dist/command-line/input/stdin.js +23 -0
  35. package/dist/command-line/json-decoder.d.ts +3 -0
  36. package/dist/command-line/json-decoder.js +3 -0
  37. package/dist/command-line/json.d.ts +3 -0
  38. package/dist/command-line/json.js +4 -0
  39. package/dist/command-line/output.d.ts +57 -0
  40. package/dist/command-line/output.js +94 -0
  41. package/dist/command-line/rows.d.ts +10 -0
  42. package/dist/command-line/rows.js +32 -0
  43. package/dist/command-line/two-phase.d.ts +57 -0
  44. package/dist/command-line/two-phase.js +148 -0
  45. package/dist/command-receipt/command.d.ts +4 -0
  46. package/dist/command-receipt/command.js +59 -0
  47. package/dist/command-receipt/compact-list.d.ts +20 -0
  48. package/dist/command-receipt/compact-list.js +29 -0
  49. package/dist/command-receipt/index.d.ts +3 -0
  50. package/dist/command-receipt/index.js +3 -0
  51. package/dist/command-tree/commands.d.ts +17 -0
  52. package/dist/command-tree/commands.js +41 -0
  53. package/dist/command-tree/completion.d.ts +6 -0
  54. package/dist/command-tree/completion.js +36 -0
  55. package/dist/command-tree/grammar.d.ts +18 -0
  56. package/dist/command-tree/grammar.js +160 -0
  57. package/dist/command-tree/help.d.ts +62 -0
  58. package/dist/command-tree/help.js +219 -0
  59. package/dist/command-tree/index.d.ts +8 -0
  60. package/dist/command-tree/index.js +6 -0
  61. package/dist/command-tree/local.d.ts +3 -0
  62. package/dist/command-tree/local.js +126 -0
  63. package/dist/command-tree/placeholder.d.ts +3 -0
  64. package/dist/command-tree/placeholder.js +4 -0
  65. package/dist/command-tree/row.d.ts +29 -0
  66. package/dist/command-tree/row.js +2 -0
  67. package/dist/command-tree/suggest.d.ts +3 -0
  68. package/dist/command-tree/suggest.js +81 -0
  69. package/dist/command-tree/tree.d.ts +34 -0
  70. package/dist/command-tree/tree.js +124 -0
  71. package/dist/connection/client.d.ts +692 -0
  72. package/dist/connection/client.js +28 -0
  73. package/dist/connection/commands.d.ts +15 -0
  74. package/dist/connection/commands.js +118 -0
  75. package/dist/connection/index.d.ts +7 -0
  76. package/dist/connection/index.js +7 -0
  77. package/dist/connection/input.d.ts +50 -0
  78. package/dist/connection/input.js +90 -0
  79. package/dist/connection/login.d.ts +13 -0
  80. package/dist/connection/login.js +69 -0
  81. package/dist/connection/output/format.d.ts +32 -0
  82. package/dist/connection/output/format.js +94 -0
  83. package/dist/connection/output/index.d.ts +2 -0
  84. package/dist/connection/output/index.js +2 -0
  85. package/dist/connection/resolve.d.ts +60 -0
  86. package/dist/connection/resolve.js +30 -0
  87. package/dist/connection/signin.d.ts +4 -0
  88. package/dist/connection/signin.js +32 -0
  89. package/dist/connection/system.d.ts +4 -0
  90. package/dist/connection/system.js +190 -0
  91. package/dist/connection/tree/index.d.ts +2 -0
  92. package/dist/connection/tree/index.js +2 -0
  93. package/dist/connection/tree/tree.d.ts +3 -0
  94. package/dist/connection/tree/tree.js +209 -0
  95. package/dist/container/client.d.ts +142 -0
  96. package/dist/container/client.js +11 -0
  97. package/dist/container/commands.d.ts +7 -0
  98. package/dist/container/commands.js +100 -0
  99. package/dist/container/index.d.ts +3 -0
  100. package/dist/container/index.js +3 -0
  101. package/dist/container/output/format.d.ts +11 -0
  102. package/dist/container/output/format.js +28 -0
  103. package/dist/container/output/index.d.ts +2 -0
  104. package/dist/container/output/index.js +2 -0
  105. package/dist/context/client.d.ts +7 -0
  106. package/dist/context/client.js +21 -0
  107. package/dist/context/commands.d.ts +3 -0
  108. package/dist/context/commands.js +27 -0
  109. package/dist/context/index.d.ts +3 -0
  110. package/dist/context/index.js +3 -0
  111. package/dist/development/cli.d.ts +3 -0
  112. package/dist/development/cli.js +44 -0
  113. package/dist/execution/client.d.ts +25 -0
  114. package/dist/execution/client.js +24 -0
  115. package/dist/execution/index.d.ts +3 -0
  116. package/dist/execution/index.js +3 -0
  117. package/dist/execution/relocation.d.ts +6 -0
  118. package/dist/execution/relocation.js +123 -0
  119. package/dist/execution/tree/index.d.ts +2 -0
  120. package/dist/execution/tree/index.js +2 -0
  121. package/dist/execution/tree/tree.d.ts +3 -0
  122. package/dist/execution/tree/tree.js +137 -0
  123. package/dist/hold/client.d.ts +137 -0
  124. package/dist/hold/client.js +12 -0
  125. package/dist/hold/commands.d.ts +5 -0
  126. package/dist/hold/commands.js +91 -0
  127. package/dist/hold/index.d.ts +3 -0
  128. package/dist/hold/index.js +3 -0
  129. package/dist/hold/output/format.d.ts +11 -0
  130. package/dist/hold/output/format.js +29 -0
  131. package/dist/hold/output/index.d.ts +2 -0
  132. package/dist/hold/output/index.js +2 -0
  133. package/dist/hold/tree/index.d.ts +2 -0
  134. package/dist/hold/tree/index.js +2 -0
  135. package/dist/hold/tree/tree.d.ts +3 -0
  136. package/dist/hold/tree/tree.js +96 -0
  137. package/dist/import/client.d.ts +14 -0
  138. package/dist/import/client.js +16 -0
  139. package/dist/import/commands.d.ts +5 -0
  140. package/dist/import/commands.js +76 -0
  141. package/dist/import/index.d.ts +3 -0
  142. package/dist/import/index.js +3 -0
  143. package/dist/import/input.d.ts +16 -0
  144. package/dist/import/input.js +92 -0
  145. package/dist/import/output.d.ts +6 -0
  146. package/dist/import/output.js +40 -0
  147. package/dist/index.d.ts +2 -0
  148. package/dist/index.js +2 -0
  149. package/dist/integration/client.d.ts +1284 -0
  150. package/dist/integration/client.js +24 -0
  151. package/dist/integration/commands.d.ts +10 -0
  152. package/dist/integration/commands.js +104 -0
  153. package/dist/integration/index.d.ts +3 -0
  154. package/dist/integration/index.js +3 -0
  155. package/dist/integration/output.d.ts +22 -0
  156. package/dist/integration/output.js +20 -0
  157. package/dist/local-node/call.d.ts +7 -0
  158. package/dist/local-node/call.js +13 -0
  159. package/dist/local-node/client.d.ts +67 -0
  160. package/dist/local-node/client.js +241 -0
  161. package/dist/local-node/index.d.ts +3 -0
  162. package/dist/local-node/index.js +3 -0
  163. package/dist/login/agent-provider.d.ts +20 -0
  164. package/dist/login/agent-provider.js +109 -0
  165. package/dist/login/commands.d.ts +4 -0
  166. package/dist/login/commands.js +93 -0
  167. package/dist/login/failure.d.ts +3 -0
  168. package/dist/login/failure.js +14 -0
  169. package/dist/login/gateway.d.ts +12 -0
  170. package/dist/login/gateway.js +71 -0
  171. package/dist/login/index.d.ts +3 -0
  172. package/dist/login/index.js +2 -0
  173. package/dist/login/menu.d.ts +4 -0
  174. package/dist/login/menu.js +105 -0
  175. package/dist/login/output/format.d.ts +16 -0
  176. package/dist/login/output/format.js +31 -0
  177. package/dist/login/output/index.d.ts +2 -0
  178. package/dist/login/output/index.js +2 -0
  179. package/dist/login/vendor-account.d.ts +95 -0
  180. package/dist/login/vendor-account.js +75 -0
  181. package/dist/login/vendor-input.d.ts +14 -0
  182. package/dist/login/vendor-input.js +36 -0
  183. package/dist/mcp/calls.d.ts +7 -0
  184. package/dist/mcp/calls.js +202 -0
  185. package/dist/mcp/commands.d.ts +9 -0
  186. package/dist/mcp/commands.js +21 -0
  187. package/dist/mcp/index.d.ts +2 -0
  188. package/dist/mcp/index.js +2 -0
  189. package/dist/mcp/server.d.ts +11 -0
  190. package/dist/mcp/server.js +57 -0
  191. package/dist/orchestration/client.d.ts +78 -0
  192. package/dist/orchestration/client.js +89 -0
  193. package/dist/orchestration/commands.d.ts +14 -0
  194. package/dist/orchestration/commands.js +312 -0
  195. package/dist/orchestration/index.d.ts +3 -0
  196. package/dist/orchestration/index.js +3 -0
  197. package/dist/orchestration/output/compact-aggregate.d.ts +121 -0
  198. package/dist/orchestration/output/compact-aggregate.js +110 -0
  199. package/dist/orchestration/output/compact-run-list.d.ts +20 -0
  200. package/dist/orchestration/output/compact-run-list.js +16 -0
  201. package/dist/orchestration/output/human.d.ts +80 -0
  202. package/dist/orchestration/output/human.js +252 -0
  203. package/dist/orchestration/output/index.d.ts +4 -0
  204. package/dist/orchestration/output/index.js +4 -0
  205. package/dist/orchestration/tree/index.d.ts +2 -0
  206. package/dist/orchestration/tree/index.js +2 -0
  207. package/dist/orchestration/tree/tree.d.ts +3 -0
  208. package/dist/orchestration/tree/tree.js +142 -0
  209. package/dist/port-lease/client.d.ts +160 -0
  210. package/dist/port-lease/client.js +11 -0
  211. package/dist/port-lease/commands.d.ts +6 -0
  212. package/dist/port-lease/commands.js +17 -0
  213. package/dist/port-lease/index.d.ts +3 -0
  214. package/dist/port-lease/index.js +3 -0
  215. package/dist/port-lease/input.d.ts +65 -0
  216. package/dist/port-lease/input.js +67 -0
  217. package/dist/port-lease/output/format.d.ts +11 -0
  218. package/dist/port-lease/output/format.js +24 -0
  219. package/dist/port-lease/output/index.d.ts +2 -0
  220. package/dist/port-lease/output/index.js +2 -0
  221. package/dist/presentation/client.d.ts +10 -0
  222. package/dist/presentation/client.js +9 -0
  223. package/dist/presentation/commands.d.ts +6 -0
  224. package/dist/presentation/commands.js +78 -0
  225. package/dist/presentation/index.d.ts +4 -0
  226. package/dist/presentation/index.js +3 -0
  227. package/dist/presentation/output/format.d.ts +11 -0
  228. package/dist/presentation/output/format.js +32 -0
  229. package/dist/presentation/output/index.d.ts +3 -0
  230. package/dist/presentation/output/index.js +2 -0
  231. package/dist/project-guard/client.d.ts +88 -0
  232. package/dist/project-guard/client.js +7 -0
  233. package/dist/project-guard/commands.d.ts +4 -0
  234. package/dist/project-guard/commands.js +39 -0
  235. package/dist/project-guard/index.d.ts +3 -0
  236. package/dist/project-guard/index.js +3 -0
  237. package/dist/project-guard/input.d.ts +18 -0
  238. package/dist/project-guard/input.js +47 -0
  239. package/dist/project-guard/output/format.d.ts +11 -0
  240. package/dist/project-guard/output/format.js +35 -0
  241. package/dist/project-guard/output/index.d.ts +2 -0
  242. package/dist/project-guard/output/index.js +2 -0
  243. package/dist/project-workspace/client.d.ts +86 -0
  244. package/dist/project-workspace/client.js +159 -0
  245. package/dist/project-workspace/commands.d.ts +30 -0
  246. package/dist/project-workspace/commands.js +700 -0
  247. package/dist/project-workspace/index.d.ts +5 -0
  248. package/dist/project-workspace/index.js +5 -0
  249. package/dist/project-workspace/metadata-client.d.ts +99 -0
  250. package/dist/project-workspace/metadata-client.js +8 -0
  251. package/dist/project-workspace/metadata-commands.d.ts +4 -0
  252. package/dist/project-workspace/metadata-commands.js +56 -0
  253. package/dist/project-workspace/output/human.d.ts +126 -0
  254. package/dist/project-workspace/output/human.js +103 -0
  255. package/dist/project-workspace/output/index.d.ts +3 -0
  256. package/dist/project-workspace/output/index.js +3 -0
  257. package/dist/project-workspace/output/metadata.d.ts +11 -0
  258. package/dist/project-workspace/output/metadata.js +17 -0
  259. package/dist/project-workspace/tree/index.d.ts +2 -0
  260. package/dist/project-workspace/tree/index.js +2 -0
  261. package/dist/project-workspace/tree/tree.d.ts +3 -0
  262. package/dist/project-workspace/tree/tree.js +197 -0
  263. package/dist/provider/client.d.ts +6 -0
  264. package/dist/provider/client.js +5 -0
  265. package/dist/provider/commands.d.ts +3 -0
  266. package/dist/provider/commands.js +38 -0
  267. package/dist/provider/index.d.ts +3 -0
  268. package/dist/provider/index.js +3 -0
  269. package/dist/reference/commands.d.ts +3 -0
  270. package/dist/reference/commands.js +39 -0
  271. package/dist/reference/index.d.ts +3 -0
  272. package/dist/reference/index.js +3 -0
  273. package/dist/reference/resolve.d.ts +29 -0
  274. package/dist/reference/resolve.js +294 -0
  275. package/dist/reference/tree/index.d.ts +2 -0
  276. package/dist/reference/tree/index.js +2 -0
  277. package/dist/reference/tree/tree.d.ts +3 -0
  278. package/dist/reference/tree/tree.js +17 -0
  279. package/dist/remote-node/client.d.ts +258 -0
  280. package/dist/remote-node/client.js +12 -0
  281. package/dist/remote-node/commands.d.ts +6 -0
  282. package/dist/remote-node/commands.js +264 -0
  283. package/dist/remote-node/connector.d.ts +59 -0
  284. package/dist/remote-node/connector.js +122 -0
  285. package/dist/remote-node/index.d.ts +4 -0
  286. package/dist/remote-node/index.js +4 -0
  287. package/dist/remote-node/reachability.d.ts +22 -0
  288. package/dist/remote-node/reachability.js +34 -0
  289. package/dist/remote-node/text.d.ts +9 -0
  290. package/dist/remote-node/text.js +64 -0
  291. package/dist/remote-node/tree/index.d.ts +2 -0
  292. package/dist/remote-node/tree/index.js +2 -0
  293. package/dist/remote-node/tree/tree.d.ts +3 -0
  294. package/dist/remote-node/tree/tree.js +51 -0
  295. package/dist/run-ledger/client.d.ts +358 -0
  296. package/dist/run-ledger/client.js +13 -0
  297. package/dist/run-ledger/commands.d.ts +8 -0
  298. package/dist/run-ledger/commands.js +19 -0
  299. package/dist/run-ledger/index.d.ts +3 -0
  300. package/dist/run-ledger/index.js +3 -0
  301. package/dist/run-ledger/input.d.ts +42 -0
  302. package/dist/run-ledger/input.js +107 -0
  303. package/dist/run-ledger/output/format.d.ts +11 -0
  304. package/dist/run-ledger/output/format.js +49 -0
  305. package/dist/run-ledger/output/index.d.ts +2 -0
  306. package/dist/run-ledger/output/index.js +2 -0
  307. package/dist/session/agent-permission.d.ts +63 -0
  308. package/dist/session/agent-permission.js +20 -0
  309. package/dist/session/approval/client.d.ts +117 -0
  310. package/dist/session/approval/client.js +7 -0
  311. package/dist/session/approval/commands.d.ts +7 -0
  312. package/dist/session/approval/commands.js +123 -0
  313. package/dist/session/approval/index.d.ts +3 -0
  314. package/dist/session/approval/index.js +3 -0
  315. package/dist/session/approval/output/format.d.ts +12 -0
  316. package/dist/session/approval/output/format.js +25 -0
  317. package/dist/session/approval/output/index.d.ts +2 -0
  318. package/dist/session/approval/output/index.js +2 -0
  319. package/dist/session/attach-client.d.ts +16 -0
  320. package/dist/session/attach-client.js +8 -0
  321. package/dist/session/attach-render.d.ts +16 -0
  322. package/dist/session/attach-render.js +154 -0
  323. package/dist/session/attach.d.ts +5 -0
  324. package/dist/session/attach.js +106 -0
  325. package/dist/session/client.d.ts +132 -0
  326. package/dist/session/client.js +128 -0
  327. package/dist/session/coding-client.d.ts +16 -0
  328. package/dist/session/coding-client.js +15 -0
  329. package/dist/session/coding-commands.d.ts +4 -0
  330. package/dist/session/coding-commands.js +50 -0
  331. package/dist/session/commands.d.ts +13 -0
  332. package/dist/session/commands.js +488 -0
  333. package/dist/session/create-tasks.d.ts +20 -0
  334. package/dist/session/create-tasks.js +110 -0
  335. package/dist/session/index.d.ts +9 -0
  336. package/dist/session/index.js +7 -0
  337. package/dist/session/interaction/client.d.ts +347 -0
  338. package/dist/session/interaction/client.js +15 -0
  339. package/dist/session/interaction/commands.d.ts +7 -0
  340. package/dist/session/interaction/commands.js +101 -0
  341. package/dist/session/interaction/index.d.ts +3 -0
  342. package/dist/session/interaction/index.js +3 -0
  343. package/dist/session/interaction/input.d.ts +15 -0
  344. package/dist/session/interaction/input.js +46 -0
  345. package/dist/session/interaction/output/format.d.ts +11 -0
  346. package/dist/session/interaction/output/format.js +3 -0
  347. package/dist/session/interaction/output/index.d.ts +2 -0
  348. package/dist/session/interaction/output/index.js +2 -0
  349. package/dist/session/output/diff.d.ts +3 -0
  350. package/dist/session/output/diff.js +30 -0
  351. package/dist/session/output/failure.d.ts +11 -0
  352. package/dist/session/output/failure.js +24 -0
  353. package/dist/session/output/human.d.ts +112 -0
  354. package/dist/session/output/human.js +71 -0
  355. package/dist/session/output/index.d.ts +6 -0
  356. package/dist/session/output/index.js +6 -0
  357. package/dist/session/output/observe.d.ts +4 -0
  358. package/dist/session/output/observe.js +46 -0
  359. package/dist/session/output/tasks.d.ts +19 -0
  360. package/dist/session/output/tasks.js +34 -0
  361. package/dist/session/rename.d.ts +3 -0
  362. package/dist/session/rename.js +37 -0
  363. package/dist/session/task-file.d.ts +5 -0
  364. package/dist/session/task-file.js +23 -0
  365. package/dist/session/tree/index.d.ts +2 -0
  366. package/dist/session/tree/index.js +2 -0
  367. package/dist/session/tree/tree.d.ts +3 -0
  368. package/dist/session/tree/tree.js +309 -0
  369. package/dist/session/turn/client.d.ts +25 -0
  370. package/dist/session/turn/client.js +40 -0
  371. package/dist/session/turn/commands.d.ts +6 -0
  372. package/dist/session/turn/commands.js +157 -0
  373. package/dist/session/turn/index.d.ts +4 -0
  374. package/dist/session/turn/index.js +3 -0
  375. package/dist/session/turn/output.d.ts +42 -0
  376. package/dist/session/turn/output.js +38 -0
  377. package/dist/status/client.d.ts +119 -0
  378. package/dist/status/client.js +5 -0
  379. package/dist/status/command.d.ts +4 -0
  380. package/dist/status/command.js +40 -0
  381. package/dist/status/doctor.d.ts +15 -0
  382. package/dist/status/doctor.js +111 -0
  383. package/dist/status/index.d.ts +5 -0
  384. package/dist/status/index.js +4 -0
  385. package/dist/status/output/compact.d.ts +31 -0
  386. package/dist/status/output/compact.js +46 -0
  387. package/dist/status/output/human.d.ts +7 -0
  388. package/dist/status/output/human.js +30 -0
  389. package/dist/status/output/index.d.ts +3 -0
  390. package/dist/status/output/index.js +3 -0
  391. package/dist/terminal/arguments.d.ts +13 -0
  392. package/dist/terminal/arguments.js +79 -0
  393. package/dist/terminal/client.d.ts +79 -0
  394. package/dist/terminal/client.js +68 -0
  395. package/dist/terminal/commands.d.ts +7 -0
  396. package/dist/terminal/commands.js +131 -0
  397. package/dist/terminal/control-commands.d.ts +10 -0
  398. package/dist/terminal/control-commands.js +212 -0
  399. package/dist/terminal/index.d.ts +4 -0
  400. package/dist/terminal/index.js +4 -0
  401. package/dist/terminal/output/compact-list.d.ts +147 -0
  402. package/dist/terminal/output/compact-list.js +152 -0
  403. package/dist/terminal/output/human.d.ts +59 -0
  404. package/dist/terminal/output/human.js +55 -0
  405. package/dist/terminal/output/index.d.ts +3 -0
  406. package/dist/terminal/output/index.js +3 -0
  407. package/dist/terminal/tree/index.d.ts +2 -0
  408. package/dist/terminal/tree/index.js +2 -0
  409. package/dist/terminal/tree/tree.d.ts +3 -0
  410. package/dist/terminal/tree/tree.js +104 -0
  411. package/guidance/maia-cli/SKILL.md +58 -0
  412. package/guidance/maia-orchestration/SKILL.md +54 -0
  413. package/package.json +76 -0
@@ -0,0 +1,65 @@
1
+ import * as Effect from "effect/Effect";
2
+ export declare const readPortLease: (tokens: readonly string[]) => Effect.Effect<{
3
+ commandId: string;
4
+ } & ({
5
+ count?: undefined;
6
+ preferred?: undefined;
7
+ sessionId?: undefined;
8
+ purpose: string;
9
+ } | {
10
+ count?: undefined;
11
+ preferred?: undefined;
12
+ sessionId: string;
13
+ purpose: string;
14
+ } | {
15
+ count?: undefined;
16
+ preferred: number;
17
+ sessionId?: undefined;
18
+ purpose: string;
19
+ } | {
20
+ count?: undefined;
21
+ preferred: number;
22
+ sessionId: string;
23
+ purpose: string;
24
+ } | {
25
+ count: number;
26
+ preferred?: undefined;
27
+ sessionId?: undefined;
28
+ purpose: string;
29
+ } | {
30
+ count: number;
31
+ preferred?: undefined;
32
+ sessionId: string;
33
+ purpose: string;
34
+ } | {
35
+ count: number;
36
+ preferred: number;
37
+ sessionId?: undefined;
38
+ purpose: string;
39
+ } | {
40
+ count: number;
41
+ preferred: number;
42
+ sessionId: string;
43
+ purpose: string;
44
+ }), never, import("effect/Crypto").Crypto>;
45
+ export declare const readPortRenew: (tokens: readonly string[]) => Effect.Effect<{
46
+ commandId: string;
47
+ } & {
48
+ expectedRevision: string;
49
+ leaseId: string;
50
+ }, never, import("effect/Crypto").Crypto>;
51
+ export declare const readPortRelease: (tokens: readonly string[]) => Effect.Effect<{
52
+ commandId: string;
53
+ } & {
54
+ leaseId: string;
55
+ }, never, import("effect/Crypto").Crypto>;
56
+ export declare const readPortList: (tokens: readonly string[]) => Effect.Effect<{
57
+ sessionId?: undefined;
58
+ limit: number;
59
+ afterCursor?: string | undefined;
60
+ } | {
61
+ sessionId: string;
62
+ limit: number;
63
+ afterCursor?: string | undefined;
64
+ }, never, never>;
65
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1,67 @@
1
+ import * as Effect from "effect/Effect";
2
+ import { CliArgumentError, parseOptions, readExpectedRevision, readPageSize, requirePositionals, } from "../command-line/index.js";
3
+ import { commandIdentifier } from "../local-node/index.js";
4
+ const withCommandId = (options, input) => Effect.map(commandIdentifier(options.get("--command-id")), (commandId) => ({
5
+ commandId,
6
+ ...input,
7
+ }));
8
+ const readCount = (value) => {
9
+ if (value === undefined)
10
+ return {};
11
+ if (!/^[1-8]$/u.test(value))
12
+ throw new CliArgumentError("Option '--count' must be an integer from 1 to 8.");
13
+ return { count: Number(value) };
14
+ };
15
+ const readPreferred = (value) => {
16
+ if (value === undefined)
17
+ return {};
18
+ if (!/^[1-9]\d{3,4}$/u.test(value) || Number(value) > 65_535)
19
+ throw new CliArgumentError("Option '--preferred' must be a port from 1024 to 65535.");
20
+ return { preferred: Number(value) };
21
+ };
22
+ const readSession = (value) => value === undefined ? {} : { sessionId: value };
23
+ export const readPortLease = (tokens) => {
24
+ const parsed = parseOptions(tokens, new Set([
25
+ "--command-id",
26
+ "--count",
27
+ "--preferred",
28
+ "--purpose",
29
+ "--session",
30
+ ]));
31
+ requirePositionals(parsed.positionals, 0);
32
+ const purpose = parsed.options.get("--purpose");
33
+ if (purpose === undefined)
34
+ throw new CliArgumentError("Option '--purpose' is required.");
35
+ return withCommandId(parsed.options, {
36
+ purpose,
37
+ ...readCount(parsed.options.get("--count")),
38
+ ...readPreferred(parsed.options.get("--preferred")),
39
+ ...readSession(parsed.options.get("--session")),
40
+ });
41
+ };
42
+ export const readPortRenew = (tokens) => {
43
+ const parsed = parseOptions(tokens, new Set(["--command-id", "--expected-revision"]));
44
+ requirePositionals(parsed.positionals, 1);
45
+ return withCommandId(parsed.options, {
46
+ expectedRevision: readExpectedRevision(parsed.options.get("--expected-revision")),
47
+ leaseId: parsed.positionals[0] ?? "",
48
+ });
49
+ };
50
+ export const readPortRelease = (tokens) => {
51
+ const parsed = parseOptions(tokens, new Set(["--command-id"]));
52
+ requirePositionals(parsed.positionals, 1);
53
+ return withCommandId(parsed.options, {
54
+ leaseId: parsed.positionals[0] ?? "",
55
+ });
56
+ };
57
+ export const readPortList = (tokens) => {
58
+ const parsed = parseOptions(tokens, new Set(["--after", "--limit", "--session"]));
59
+ requirePositionals(parsed.positionals, 0);
60
+ const afterCursor = parsed.options.get("--after");
61
+ return Effect.succeed({
62
+ limit: readPageSize(parsed.options.get("--limit")),
63
+ ...(afterCursor === undefined ? {} : { afterCursor }),
64
+ ...readSession(parsed.options.get("--session")),
65
+ });
66
+ };
67
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1,11 @@
1
+ import type { PortLeaseAcquireResult, PortLeaseListResult, PortLeaseReleaseResult, PortLeaseRenewResult } from "@maiaos/sdk";
2
+ export type PortLeaseCliResult = PortLeaseAcquireResult | PortLeaseListResult | PortLeaseReleaseResult | PortLeaseRenewResult;
3
+ export type CliPortLeaseResult = {
4
+ readonly command: PortLeaseCliResult["method"];
5
+ readonly result: PortLeaseCliResult;
6
+ };
7
+ export declare const isPortLeaseResult: (result: {
8
+ readonly command: string;
9
+ }) => result is CliPortLeaseResult;
10
+ export declare const formatPortLeaseResult: ({ result, }: CliPortLeaseResult) => string;
11
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1,24 @@
1
+ import { formatRows, withNextPage } from "../../command-line/index.js";
2
+ export const isPortLeaseResult = (result) => result.command.startsWith("port.lease.");
3
+ const ownerText = (owner) => owner.kind === "session" ? `session:${owner.sessionId}` : "self";
4
+ const leaseLine = (lease, ports) => `${lease.leaseId}\t${ports}\t${lease.state}\t${ownerText(lease.owner)}\t${lease.purpose}\trevision=${lease.revision}\texpires=${lease.expiresAt}`;
5
+ const leaseRow = (lease, ports) => `${lease.leaseId}\t${ports}\t${lease.state}\t${ownerText(lease.owner)}\t${lease.purpose}\t${lease.revision}\t${lease.expiresAt}`;
6
+ const probedPorts = (item) => item.probes
7
+ .map((probe) => `${String(probe.port)}${probe.inUse ? "*" : ""}`)
8
+ .join(",");
9
+ const formatList = (result) => withNextPage(formatRows(result.items, (item) => leaseRow(item.lease, probedPorts(item)), {
10
+ empty: `No active port leases in ${String(result.range.start)}-${String(result.range.end)}.`,
11
+ headers: [
12
+ "LEASE",
13
+ "PORTS",
14
+ "STATE",
15
+ "OWNER",
16
+ "PURPOSE",
17
+ "REVISION",
18
+ "EXPIRES",
19
+ ],
20
+ }), result.nextCursor);
21
+ export const formatPortLeaseResult = ({ result, }) => result.method === "port.lease.list"
22
+ ? formatList(result)
23
+ : `${leaseLine(result.lease, result.lease.ports.join(","))}\n`;
24
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1,2 @@
1
+ export { type CliPortLeaseResult, formatPortLeaseResult, isPortLeaseResult, type PortLeaseCliResult, } from "./format.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { formatPortLeaseResult, isPortLeaseResult, } from "./format.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,10 @@
1
+ import { type PresentationCatalogParameters, type PresentationCatalogResult, type PresentationDirectoryParameters, type PresentationDirectoryResult, type PresentationProjectListParameters, type PresentationProjectListResult, type PresentationSessionListParameters, type PresentationSessionListResult } from "@maiaos/sdk";
2
+ import type { CliNodeEffect, CliNodeOperations } from "../local-node/index.js";
3
+ export type PresentationCliDependencies = {
4
+ readonly showPresentationCatalog: (input: PresentationCatalogParameters) => CliNodeEffect<PresentationCatalogResult>;
5
+ readonly showProjectList: (input: PresentationProjectListParameters) => CliNodeEffect<PresentationProjectListResult>;
6
+ readonly showSessionList: (input: PresentationSessionListParameters) => CliNodeEffect<PresentationSessionListResult>;
7
+ readonly showWorkspaceDirectory: (input: PresentationDirectoryParameters) => CliNodeEffect<PresentationDirectoryResult>;
8
+ };
9
+ export declare const makePresentationClient: (node: CliNodeOperations) => PresentationCliDependencies;
10
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { presentationCatalogParametersSchema, presentationDirectoryParametersSchema, presentationProjectListParametersSchema, presentationSessionListParametersSchema, } from "@maiaos/sdk";
2
+ const catalog = (node, input) => node.runValidatedNodeOperation(input, presentationCatalogParametersSchema, (client, parameters, options) => client.showPresentationCatalog(parameters, options));
3
+ export const makePresentationClient = (node) => ({
4
+ showPresentationCatalog: (input) => catalog(node, input),
5
+ showProjectList: (input) => node.runValidatedNodeOperation(input, presentationProjectListParametersSchema, (client, parameters, options) => client.showProjectList(parameters, options)),
6
+ showSessionList: (input) => node.runValidatedNodeOperation(input, presentationSessionListParametersSchema, (client, parameters, options) => client.showSessionList(parameters, options)),
7
+ showWorkspaceDirectory: (input) => node.runValidatedNodeOperation(input, presentationDirectoryParametersSchema, (client, parameters, options) => client.showWorkspaceDirectory(parameters, options)),
8
+ });
9
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1,6 @@
1
+ import { type CommandContext, type CommandEffect } from "../command-line/index.js";
2
+ export declare const runCatalogShow: (tokens: readonly string[], context: CommandContext) => CommandEffect;
3
+ export declare const runWorkspaceDirectoryShow: (tokens: readonly string[], context: CommandContext) => CommandEffect;
4
+ export declare const runProjectListShow: (tokens: readonly string[], context: CommandContext) => CommandEffect;
5
+ export declare const runSessionListShow: (tokens: readonly string[], context: CommandContext) => CommandEffect;
6
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1,78 @@
1
+ import { presentationDirectoryParametersSchema, presentationProjectListParametersSchema, presentationSessionListParametersSchema, protocolErrorSchema, } from "@maiaos/sdk";
2
+ import { Effect } from "effect";
3
+ import { CliArgumentError, decodeJsonText, parseOptions, recoverStdin, reportError, requireNoArguments, requirePositionals, writeSuccess, } from "../command-line/index.js";
4
+ import { formatPresentationResult, } from "./output/index.js";
5
+ const invalidInput = () => new CliArgumentError("Invalid presentation input.");
6
+ const readPresentationOptions = (tokens) => {
7
+ const value = parseOptions(tokens, new Set(), new Set(["--input-stdin"]));
8
+ requirePositionals(value.positionals, 0);
9
+ return value;
10
+ };
11
+ const writeResponse = (response, context) => {
12
+ if (!response.ok) {
13
+ const error = protocolErrorSchema.parse(response.error);
14
+ return reportError({ ...error, message: "Presentation operation failed." }, context);
15
+ }
16
+ writeSuccess({ command: response.value.method, result: response.value }, context, formatPresentationResult);
17
+ return 0;
18
+ };
19
+ const readPresentationInput = (tokens, context) => Effect.gen(function* () {
20
+ const parsed = yield* Effect.try({
21
+ catch: invalidInput,
22
+ try: () => readPresentationOptions(tokens),
23
+ });
24
+ const stdin = context.io.stdin;
25
+ if (!parsed.flags.has("--input-stdin") || stdin === undefined)
26
+ return yield* Effect.fail(invalidInput());
27
+ const text = yield* recoverStdin(stdin({ label: "presentation input", maxBytes: 8192, maxChunks: 32 }), invalidInput);
28
+ return yield* decodeJsonText(text, invalidInput);
29
+ });
30
+ const invoke = (operation, parameters, context) => Effect.gen(function* () {
31
+ if (operation === undefined)
32
+ return yield* Effect.fail(new Error("Missing presentation client."));
33
+ const response = yield* Effect.suspend(() => operation(parameters)).pipe(Effect.catchDefect(() => Effect.fail(new Error("Presentation request failed."))));
34
+ return yield* Effect.try({
35
+ catch: () => new Error("Invalid presentation result."),
36
+ try: () => writeResponse(response, context),
37
+ });
38
+ });
39
+ const catalog = (tokens, context) => Effect.gen(function* () {
40
+ yield* Effect.try({
41
+ catch: invalidInput,
42
+ try: () => {
43
+ requireNoArguments(tokens, "Presentation catalog");
44
+ },
45
+ });
46
+ return yield* invoke(context.dependencies.showPresentationCatalog, {}, context);
47
+ });
48
+ const readPage = (tokens, context, { operation, schema, }) => Effect.gen(function* () {
49
+ const input = yield* readPresentationInput(tokens, context);
50
+ const parameters = yield* Effect.try({
51
+ catch: invalidInput,
52
+ try: () => schema.parse(input),
53
+ });
54
+ return yield* invoke(operation, parameters, context);
55
+ });
56
+ const reportFailure = (context) => (error) => Effect.sync(() => reportError({
57
+ code: error instanceof CliArgumentError
58
+ ? "invalid_argument"
59
+ : "internal_error",
60
+ message: error instanceof CliArgumentError
61
+ ? error.message
62
+ : "Presentation command failed.",
63
+ retryable: false,
64
+ }, context));
65
+ export const runCatalogShow = (tokens, context) => catalog(tokens, context).pipe(Effect.catch(reportFailure(context)));
66
+ export const runWorkspaceDirectoryShow = (tokens, context) => readPage(tokens, context, {
67
+ operation: context.dependencies.showWorkspaceDirectory,
68
+ schema: presentationDirectoryParametersSchema,
69
+ }).pipe(Effect.catch(reportFailure(context)));
70
+ export const runProjectListShow = (tokens, context) => readPage(tokens, context, {
71
+ operation: context.dependencies.showProjectList,
72
+ schema: presentationProjectListParametersSchema,
73
+ }).pipe(Effect.catch(reportFailure(context)));
74
+ export const runSessionListShow = (tokens, context) => readPage(tokens, context, {
75
+ operation: context.dependencies.showSessionList,
76
+ schema: presentationSessionListParametersSchema,
77
+ }).pipe(Effect.catch(reportFailure(context)));
78
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1,4 @@
1
+ export type { PresentationCliDependencies } from "./client.js";
2
+ export { makePresentationClient } from "./client.js";
3
+ export { runCatalogShow, runProjectListShow, runSessionListShow, runWorkspaceDirectoryShow, } from "./commands.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export { makePresentationClient } from "./client.js";
2
+ export { runCatalogShow, runProjectListShow, runSessionListShow, runWorkspaceDirectoryShow, } from "./commands.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,11 @@
1
+ import type { PresentationCatalogResult, PresentationDirectoryResult, PresentationProjectListResult, PresentationSessionListResult } from "@maiaos/sdk";
2
+ export type PresentationResult = PresentationCatalogResult | PresentationDirectoryResult | PresentationProjectListResult | PresentationSessionListResult;
3
+ export type CliPresentationResult = {
4
+ readonly command: PresentationResult["method"];
5
+ readonly result: PresentationResult;
6
+ };
7
+ export declare const isPresentationResult: (result: {
8
+ readonly command: string;
9
+ }) => result is CliPresentationResult;
10
+ export declare const formatPresentationResult: ({ result, }: CliPresentationResult) => string;
11
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1,32 @@
1
+ export const isPresentationResult = (result) => result.command === "presentation.catalog.show" ||
2
+ result.command === "presentation.workspace-directory.show" ||
3
+ result.command === "presentation.project-list.show" ||
4
+ result.command === "presentation.session-list.show";
5
+ const cell = (value) => JSON.stringify(value).replaceAll(/\p{Control}/gu, " ");
6
+ const page = (result) => {
7
+ if (result.method === "presentation.session-list.show")
8
+ return {
9
+ heading: "Sessions",
10
+ rows: result.resources.items
11
+ .map((item) => `${item.id}\t${item.state}\t${item.revision}\n`)
12
+ .join(""),
13
+ };
14
+ const items = result.method === "presentation.project-list.show"
15
+ ? result.resources.projects
16
+ : result.resources.items;
17
+ return {
18
+ heading: result.method === "presentation.project-list.show"
19
+ ? "Projects"
20
+ : "Workspace directory",
21
+ rows: items
22
+ .map((item) => `${item.id}\t${cell(item.name)}\t${item.revision}\n`)
23
+ .join(""),
24
+ };
25
+ };
26
+ export const formatPresentationResult = ({ result, }) => {
27
+ if (result.method === "presentation.catalog.show")
28
+ return `${result.catalogVersion}\t${result.catalogDigest}\toperator-local\n`;
29
+ const { heading, rows } = page(result);
30
+ return `${heading} (operator-local)\n${rows}${result.resources.nextCursor === undefined ? "" : `Next: ${cell(result.resources.nextCursor)}\n`}`;
31
+ };
32
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1,3 @@
1
+ export type { CliPresentationResult, PresentationResult } from "./format.js";
2
+ export { formatPresentationResult, isPresentationResult } from "./format.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { formatPresentationResult, isPresentationResult } from "./format.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,88 @@
1
+ import { type ProjectGuardConfirmParameters, type ProjectGuardPreviewParameters, type ProjectGuardShowParameters } from "@maiaos/sdk";
2
+ import type { CliNodeOperations } from "../local-node/index.js";
3
+ export declare const makeProjectGuardClient: (node: CliNodeOperations) => {
4
+ confirmProjectGuard: (input: ProjectGuardConfirmParameters) => import("../local-node/client.js").CliNodeEffect<{
5
+ readonly commandId: string;
6
+ readonly delivery: "duplicate" | "new";
7
+ readonly expectedRevision: string;
8
+ readonly guard: {
9
+ readonly limits: {
10
+ readonly maxDepth: number;
11
+ readonly maxLeasesPerSession: number;
12
+ readonly maxLiveChildren: number;
13
+ readonly maxMessagesPerMinute: number;
14
+ };
15
+ readonly projectId: string;
16
+ readonly revision: string;
17
+ readonly schemaVersion: "maia.session-guard/v1";
18
+ readonly source: "default" | "project";
19
+ readonly updatedAt?: string | undefined;
20
+ };
21
+ readonly inputDigest: string;
22
+ readonly method: "project.guard.confirm";
23
+ readonly receipt: {
24
+ readonly actorId: string;
25
+ readonly aggregateRevision: string;
26
+ readonly commandId: string;
27
+ readonly createdAt: string;
28
+ readonly eventCursor: string;
29
+ readonly method: string;
30
+ readonly receiptId: string;
31
+ readonly schemaVersion: 1;
32
+ readonly state: "succeeded";
33
+ readonly target: {
34
+ readonly id: string;
35
+ readonly type: string;
36
+ };
37
+ readonly updatedAt: string;
38
+ };
39
+ }>;
40
+ previewProjectGuard: (input: ProjectGuardPreviewParameters) => import("../local-node/client.js").CliNodeEffect<{
41
+ readonly inputDigest: string;
42
+ readonly proof: string;
43
+ readonly actorId: string;
44
+ readonly commandId: string;
45
+ readonly current: {
46
+ readonly limits: {
47
+ readonly maxDepth: number;
48
+ readonly maxLeasesPerSession: number;
49
+ readonly maxLiveChildren: number;
50
+ readonly maxMessagesPerMinute: number;
51
+ };
52
+ readonly projectId: string;
53
+ readonly revision: string;
54
+ readonly schemaVersion: "maia.session-guard/v1";
55
+ readonly source: "default" | "project";
56
+ readonly updatedAt?: string | undefined;
57
+ };
58
+ readonly expectedRevision: string;
59
+ readonly expiresAt: string;
60
+ readonly issuedAt: string;
61
+ readonly limits: {
62
+ readonly maxDepth: number;
63
+ readonly maxLeasesPerSession: number;
64
+ readonly maxLiveChildren: number;
65
+ readonly maxMessagesPerMinute: number;
66
+ };
67
+ readonly method: "project.guard.preview";
68
+ readonly projectId: string;
69
+ }>;
70
+ showProjectGuard: (input: ProjectGuardShowParameters) => import("../local-node/client.js").CliNodeEffect<{
71
+ readonly guard: {
72
+ readonly limits: {
73
+ readonly maxDepth: number;
74
+ readonly maxLeasesPerSession: number;
75
+ readonly maxLiveChildren: number;
76
+ readonly maxMessagesPerMinute: number;
77
+ };
78
+ readonly projectId: string;
79
+ readonly revision: string;
80
+ readonly schemaVersion: "maia.session-guard/v1";
81
+ readonly source: "default" | "project";
82
+ readonly updatedAt?: string | undefined;
83
+ };
84
+ readonly method: "project.guard.show";
85
+ }>;
86
+ };
87
+ export type ProjectGuardCliDependencies = ReturnType<typeof makeProjectGuardClient>;
88
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { projectGuardConfirmParametersSchema, projectGuardPreviewParametersSchema, projectGuardShowParametersSchema, } from "@maiaos/sdk";
2
+ export const makeProjectGuardClient = (node) => ({
3
+ confirmProjectGuard: (input) => node.runValidatedNodeOperation(input, projectGuardConfirmParametersSchema, (client, parameters, options) => client.confirmProjectGuard(parameters, options), { commandId: input.commandId }),
4
+ previewProjectGuard: (input) => node.runValidatedNodeOperation(input, projectGuardPreviewParametersSchema, (client, parameters, options) => client.previewProjectGuard(parameters, options)),
5
+ showProjectGuard: (input) => node.runValidatedNodeOperation(input, projectGuardShowParametersSchema, (client, parameters, options) => client.showProjectGuard(parameters, options)),
6
+ });
7
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1,4 @@
1
+ import { type CommandContext, type CommandEffect } from "../command-line/index.js";
2
+ export declare const runProjectGuardShow: (tokens: readonly string[], context: CommandContext) => CommandEffect;
3
+ export declare const runProjectGuardSet: (tokens: readonly string[], context: CommandContext) => CommandEffect;
4
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1,39 @@
1
+ import { projectGuardConfirmParametersSchema, } from "@maiaos/sdk";
2
+ import * as Effect from "effect/Effect";
3
+ import { CliArgumentError, confirmParameters, parseOptions, readTwoPhaseMode, requirePositionals, runTwoPhase, TWO_PHASE_FLAGS, writeNodeResult, } from "../command-line/index.js";
4
+ import { GUARD_OPTIONS, readGuardPreview, readGuardShow } from "./input.js";
5
+ import { formatProjectGuardResult, } from "./output/index.js";
6
+ const write = (context) => (result) => writeNodeResult(result, context, {
7
+ toResult: (value) => ({ command: value.method, result: value }),
8
+ toText: formatProjectGuardResult,
9
+ });
10
+ export const runProjectGuardShow = (tokens, context) => Effect.gen(function* () {
11
+ const show = context.dependencies.showProjectGuard;
12
+ if (show === undefined)
13
+ return yield* Effect.die(new Error("Missing Project guard client."));
14
+ return write(context)(yield* show(readGuardShow(tokens)));
15
+ });
16
+ const confirmGuardParameters = (preview) => confirmParameters(projectGuardConfirmParametersSchema, preview, ["current"]);
17
+ const GUARD_PROMPT = {
18
+ describe: (preview) => formatProjectGuardResult({ command: preview.method, result: preview }),
19
+ question: "Set these guards?",
20
+ };
21
+ export const runProjectGuardSet = (tokens, context) => Effect.gen(function* () {
22
+ const parsed = parseOptions(tokens, GUARD_OPTIONS, new Set(TWO_PHASE_FLAGS));
23
+ const mode = readTwoPhaseMode(parsed.flags, context);
24
+ if (mode === "confirm-stdin")
25
+ requirePositionals(parsed.positionals, 0);
26
+ const { confirmProjectGuard, previewProjectGuard } = context.dependencies;
27
+ if (confirmProjectGuard === undefined || previewProjectGuard === undefined)
28
+ return yield* new CliArgumentError("Project guards are unavailable.");
29
+ return yield* runTwoPhase({
30
+ confirm: (preview) => Effect.flatMap(confirmGuardParameters(preview), confirmProjectGuard),
31
+ context,
32
+ mode,
33
+ preview: () => Effect.flatMap(readGuardPreview(parsed), previewProjectGuard),
34
+ prompt: GUARD_PROMPT,
35
+ writeConfirm: write(context),
36
+ writePreview: write(context),
37
+ });
38
+ });
39
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1,3 @@
1
+ export { makeProjectGuardClient, type ProjectGuardCliDependencies, } from "./client.js";
2
+ export { runProjectGuardSet, runProjectGuardShow } from "./commands.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export { makeProjectGuardClient, } from "./client.js";
2
+ export { runProjectGuardSet, runProjectGuardShow } from "./commands.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,18 @@
1
+ import * as Effect from "effect/Effect";
2
+ import { type ParsedOptions } from "../command-line/index.js";
3
+ export declare const readGuardShow: (tokens: readonly string[]) => {
4
+ projectId: string;
5
+ };
6
+ export declare const GUARD_OPTIONS: ReadonlySet<string>;
7
+ export declare const readGuardPreview: (parsed: ParsedOptions) => Effect.Effect<{
8
+ commandId: string;
9
+ expectedRevision: string;
10
+ limits: {
11
+ readonly maxDepth: number;
12
+ readonly maxLeasesPerSession: number;
13
+ readonly maxLiveChildren: number;
14
+ readonly maxMessagesPerMinute: number;
15
+ };
16
+ projectId: string;
17
+ }, never, import("effect/Crypto").Crypto>;
18
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1,47 @@
1
+ import { SESSION_GUARD_BOUNDS } from "@maiaos/sdk";
2
+ import * as Effect from "effect/Effect";
3
+ import { CliArgumentError, parseOptions, readExpectedRevision, requirePositionals, } from "../command-line/index.js";
4
+ import { commandIdentifier } from "../local-node/index.js";
5
+ const LIMIT_OPTIONS = {
6
+ maxDepth: "--max-depth",
7
+ maxLeasesPerSession: "--max-leases-per-session",
8
+ maxLiveChildren: "--max-live-children",
9
+ maxMessagesPerMinute: "--max-messages-per-minute",
10
+ };
11
+ const readLimit = (options, limit) => {
12
+ const option = LIMIT_OPTIONS[limit];
13
+ const value = options.get(option) ?? "";
14
+ const { maximum, minimum } = SESSION_GUARD_BOUNDS[limit];
15
+ const parsed = /^\d{1,4}$/u.test(value) ? Number(value) : 0;
16
+ if (parsed < minimum || parsed > maximum)
17
+ throw new CliArgumentError(`Option '${option}' must be an integer from ${String(minimum)} to ${String(maximum)}.`);
18
+ return parsed;
19
+ };
20
+ const readLimits = (options) => ({
21
+ maxDepth: readLimit(options, "maxDepth"),
22
+ maxLeasesPerSession: readLimit(options, "maxLeasesPerSession"),
23
+ maxLiveChildren: readLimit(options, "maxLiveChildren"),
24
+ maxMessagesPerMinute: readLimit(options, "maxMessagesPerMinute"),
25
+ });
26
+ export const readGuardShow = (tokens) => {
27
+ const parsed = parseOptions(tokens, new Set());
28
+ requirePositionals(parsed.positionals, 1);
29
+ return { projectId: parsed.positionals[0] ?? "" };
30
+ };
31
+ export const GUARD_OPTIONS = new Set([
32
+ "--command-id",
33
+ "--expected-revision",
34
+ ...Object.values(LIMIT_OPTIONS),
35
+ ]);
36
+ export const readGuardPreview = (parsed) => {
37
+ requirePositionals(parsed.positionals, 1);
38
+ const expectedRevision = readExpectedRevision(parsed.options.get("--expected-revision"));
39
+ const limits = readLimits(parsed.options);
40
+ return Effect.map(commandIdentifier(parsed.options.get("--command-id")), (commandId) => ({
41
+ commandId,
42
+ expectedRevision,
43
+ limits,
44
+ projectId: parsed.positionals[0] ?? "",
45
+ }));
46
+ };
47
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1,11 @@
1
+ import type { ProjectGuardConfirmResult, ProjectGuardPreviewResult, ProjectGuardShowResult } from "@maiaos/sdk";
2
+ export type ProjectGuardResult = ProjectGuardConfirmResult | ProjectGuardPreviewResult | ProjectGuardShowResult;
3
+ export type CliProjectGuardResult = {
4
+ readonly command: ProjectGuardResult["method"];
5
+ readonly result: ProjectGuardResult;
6
+ };
7
+ export declare const isProjectGuardResult: (result: {
8
+ readonly command: string;
9
+ }) => result is CliProjectGuardResult;
10
+ export declare const formatProjectGuardResult: ({ result, }: CliProjectGuardResult) => string;
11
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1,35 @@
1
+ export const isProjectGuardResult = (result) => result.command.startsWith("project.guard.");
2
+ const limitCells = (limits) => [
3
+ `maxDepth=${String(limits.maxDepth)}`,
4
+ `maxLiveChildren=${String(limits.maxLiveChildren)}`,
5
+ `maxMessagesPerMinute=${String(limits.maxMessagesPerMinute)}`,
6
+ `maxLeasesPerSession=${String(limits.maxLeasesPerSession)}`,
7
+ ];
8
+ const guardLine = (guard) => [
9
+ guard.projectId,
10
+ `source=${guard.source}`,
11
+ `revision=${guard.revision}`,
12
+ ...limitCells(guard.limits),
13
+ ].join("\t");
14
+ const previewLines = (result) => [
15
+ `${guardLine(result.current)}\tcurrent`,
16
+ [
17
+ result.projectId,
18
+ "proposed",
19
+ ...limitCells(result.limits),
20
+ `command=${result.commandId}`,
21
+ `expires=${result.expiresAt}`,
22
+ ].join("\t"),
23
+ ].join("\n");
24
+ const formatLines = (result) => {
25
+ switch (result.method) {
26
+ case "project.guard.show":
27
+ return guardLine(result.guard);
28
+ case "project.guard.preview":
29
+ return previewLines(result);
30
+ case "project.guard.confirm":
31
+ return `${guardLine(result.guard)}\t${result.receipt.receiptId}\t${result.delivery}`;
32
+ }
33
+ };
34
+ export const formatProjectGuardResult = ({ result, }) => `${formatLines(result)}\n`;
35
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1,2 @@
1
+ export { type CliProjectGuardResult, formatProjectGuardResult, isProjectGuardResult, type ProjectGuardResult, } from "./format.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { formatProjectGuardResult, isProjectGuardResult, } from "./format.js";
2
+ //# sourceMappingURL=index.js.map