@maiaos/cli 0.1.0-canary.2 → 0.1.0-canary.4

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 (226) hide show
  1. package/README.md +38 -265
  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.cdx.json +37 -14
  23. package/dist/bin/maia.mjs +1 -1
  24. package/dist/bootstrap/exit.d.ts +14 -0
  25. package/dist/bootstrap/exit.js +42 -0
  26. package/dist/bootstrap/process.js +4 -26
  27. package/dist/cli/cli.js +76 -13
  28. package/dist/command-line/context.d.ts +13 -4
  29. package/dist/command-line/context.js +1 -1
  30. package/dist/command-line/index.d.ts +5 -5
  31. package/dist/command-line/index.js +5 -4
  32. package/dist/command-line/input/index.d.ts +1 -1
  33. package/dist/command-line/input/index.js +1 -1
  34. package/dist/command-line/input/stdin.d.ts +1 -0
  35. package/dist/command-line/input/stdin.js +1 -0
  36. package/dist/command-line/json.d.ts +1 -0
  37. package/dist/command-line/json.js +23 -0
  38. package/dist/command-line/output.d.ts +8 -1
  39. package/dist/command-line/output.js +33 -14
  40. package/dist/command-line/rows.d.ts +2 -0
  41. package/dist/command-line/rows.js +10 -1
  42. package/dist/command-line/two-phase.d.ts +5 -0
  43. package/dist/command-line/two-phase.js +33 -8
  44. package/dist/command-tree/help.d.ts +1 -1
  45. package/dist/command-tree/help.js +1 -0
  46. package/dist/command-tree/index.d.ts +2 -2
  47. package/dist/command-tree/index.js +1 -1
  48. package/dist/command-tree/local.js +12 -0
  49. package/dist/command-tree/placeholder.d.ts +1 -0
  50. package/dist/command-tree/placeholder.js +1 -0
  51. package/dist/command-tree/row.d.ts +2 -0
  52. package/dist/command-tree/tree.d.ts +3 -2
  53. package/dist/command-tree/tree.js +18 -2
  54. package/dist/connection/access/client.d.ts +13 -0
  55. package/dist/connection/access/client.js +19 -0
  56. package/dist/connection/access/commands.d.ts +6 -0
  57. package/dist/connection/access/commands.js +60 -0
  58. package/dist/connection/access/format.d.ts +8 -0
  59. package/dist/connection/access/format.js +61 -0
  60. package/dist/connection/access/index.d.ts +3 -0
  61. package/dist/connection/access/index.js +3 -0
  62. package/dist/connection/access/input.d.ts +53 -0
  63. package/dist/connection/access/input.js +83 -0
  64. package/dist/connection/client.d.ts +99 -1
  65. package/dist/connection/client.js +9 -1
  66. package/dist/connection/index.d.ts +2 -1
  67. package/dist/connection/index.js +2 -1
  68. package/dist/connection/system.d.ts +1 -0
  69. package/dist/connection/system.js +109 -5
  70. package/dist/connection/tree/tree.js +59 -8
  71. package/dist/container/output/format.js +1 -2
  72. package/dist/dashboard/cockpit-client.d.ts +6 -0
  73. package/dist/dashboard/cockpit-client.js +27 -0
  74. package/dist/dashboard/cockpits.d.ts +29 -0
  75. package/dist/dashboard/cockpits.js +65 -0
  76. package/dist/dashboard/dashboard.d.ts +7 -0
  77. package/dist/dashboard/dashboard.js +47 -0
  78. package/dist/dashboard/draw.d.ts +15 -0
  79. package/dist/dashboard/draw.js +30 -0
  80. package/dist/dashboard/frame.d.ts +4 -0
  81. package/dist/dashboard/frame.js +15 -0
  82. package/dist/dashboard/index.d.ts +2 -0
  83. package/dist/dashboard/index.js +2 -0
  84. package/dist/dashboard/modes.d.ts +5 -0
  85. package/dist/dashboard/modes.js +16 -0
  86. package/dist/dashboard/node-connection.d.ts +15 -0
  87. package/dist/dashboard/node-connection.js +51 -0
  88. package/dist/dashboard/pi-tui.d.ts +6 -0
  89. package/dist/dashboard/pi-tui.js +35 -0
  90. package/dist/dashboard/status-bar.d.ts +4 -0
  91. package/dist/dashboard/status-bar.js +60 -0
  92. package/dist/dashboard/terminal.d.ts +53 -0
  93. package/dist/dashboard/terminal.js +165 -0
  94. package/dist/dashboard/tree-model.d.ts +28 -0
  95. package/dist/dashboard/tree-model.js +97 -0
  96. package/dist/dashboard/tree.d.ts +10 -0
  97. package/dist/dashboard/tree.js +76 -0
  98. package/dist/fleet/fleet.d.ts +70 -0
  99. package/dist/fleet/fleet.js +91 -0
  100. package/dist/fleet/index.d.ts +2 -0
  101. package/dist/fleet/index.js +2 -0
  102. package/dist/hold/output/format.js +1 -5
  103. package/dist/hold/tree/tree.js +1 -0
  104. package/dist/import/commands.js +3 -4
  105. package/dist/import/output.js +1 -4
  106. package/dist/local-node/client.d.ts +8 -4
  107. package/dist/local-node/client.js +20 -9
  108. package/dist/local-node/index.d.ts +1 -1
  109. package/dist/local-node/index.js +1 -1
  110. package/dist/login/commands.js +2 -1
  111. package/dist/mcp/calls.d.ts +1 -0
  112. package/dist/mcp/calls.js +36 -3
  113. package/dist/mcp/commands.d.ts +5 -2
  114. package/dist/mcp/commands.js +30 -4
  115. package/dist/mcp/routing.d.ts +24 -0
  116. package/dist/mcp/routing.js +188 -0
  117. package/dist/mcp/server.d.ts +13 -4
  118. package/dist/mcp/server.js +35 -12
  119. package/dist/presentation/output/format.js +4 -3
  120. package/dist/project-guard/commands.js +11 -2
  121. package/dist/project-workspace/commands.js +16 -6
  122. package/dist/project-workspace/output/human.d.ts +13 -0
  123. package/dist/project-workspace/output/human.js +17 -5
  124. package/dist/project-workspace/output/index.d.ts +1 -1
  125. package/dist/project-workspace/output/index.js +1 -1
  126. package/dist/project-workspace/output/metadata.js +1 -1
  127. package/dist/project-workspace/tree/tree.js +27 -12
  128. package/dist/reference/commands.js +4 -2
  129. package/dist/reference/index.d.ts +1 -1
  130. package/dist/reference/index.js +1 -1
  131. package/dist/reference/resolve.d.ts +2 -0
  132. package/dist/reference/resolve.js +20 -17
  133. package/dist/remote-node/client.d.ts +89 -9
  134. package/dist/remote-node/client.js +6 -1
  135. package/dist/remote-node/commands.d.ts +9 -0
  136. package/dist/remote-node/commands.js +96 -18
  137. package/dist/remote-node/connector.d.ts +12 -4
  138. package/dist/remote-node/connector.js +46 -25
  139. package/dist/remote-node/index.d.ts +2 -2
  140. package/dist/remote-node/index.js +2 -2
  141. package/dist/remote-node/reachability.d.ts +43 -1
  142. package/dist/remote-node/reachability.js +13 -3
  143. package/dist/remote-node/text.d.ts +2 -1
  144. package/dist/remote-node/text.js +74 -27
  145. package/dist/remote-node/tree/tree.js +21 -1
  146. package/dist/routine/client.d.ts +398 -0
  147. package/dist/routine/client.js +28 -0
  148. package/dist/routine/commands.d.ts +9 -0
  149. package/dist/routine/commands.js +109 -0
  150. package/dist/routine/index.d.ts +3 -0
  151. package/dist/routine/index.js +3 -0
  152. package/dist/routine/input.d.ts +28 -0
  153. package/dist/routine/input.js +44 -0
  154. package/dist/routine/output/format.d.ts +23 -0
  155. package/dist/routine/output/format.js +83 -0
  156. package/dist/routine/output/index.d.ts +2 -0
  157. package/dist/routine/output/index.js +2 -0
  158. package/dist/routine/tree/index.d.ts +2 -0
  159. package/dist/routine/tree/index.js +2 -0
  160. package/dist/routine/tree/tree.d.ts +3 -0
  161. package/dist/routine/tree/tree.js +70 -0
  162. package/dist/session/agent-permission.d.ts +2 -2
  163. package/dist/session/approval/commands.js +24 -6
  164. package/dist/session/approval/output/format.d.ts +11 -0
  165. package/dist/session/approval/output/format.js +8 -0
  166. package/dist/session/approval/output/index.d.ts +1 -1
  167. package/dist/session/approval/output/index.js +1 -1
  168. package/dist/session/attach-client.d.ts +1 -1
  169. package/dist/session/attach-client.js +12 -3
  170. package/dist/session/attach-render.js +15 -7
  171. package/dist/session/attach.js +17 -3
  172. package/dist/session/client.d.ts +4 -2
  173. package/dist/session/client.js +4 -15
  174. package/dist/session/commands.js +76 -9
  175. package/dist/session/create-tasks.js +29 -11
  176. package/dist/session/index.d.ts +1 -1
  177. package/dist/session/index.js +1 -0
  178. package/dist/session/interaction/output/format.js +2 -1
  179. package/dist/session/output/diff.js +3 -10
  180. package/dist/session/output/failure.js +3 -10
  181. package/dist/session/output/human.js +21 -10
  182. package/dist/session/output/index.d.ts +1 -1
  183. package/dist/session/output/index.js +1 -1
  184. package/dist/session/output/tasks.d.ts +16 -1
  185. package/dist/session/output/tasks.js +41 -27
  186. package/dist/session/tree/tree.js +56 -8
  187. package/dist/session/turn/client.d.ts +4 -1
  188. package/dist/session/turn/client.js +15 -2
  189. package/dist/session/turn/commands.d.ts +2 -0
  190. package/dist/session/turn/commands.js +38 -5
  191. package/dist/session/turn/index.d.ts +3 -3
  192. package/dist/session/turn/index.js +1 -1
  193. package/dist/session/turn/output.d.ts +7 -2
  194. package/dist/session/turn/output.js +36 -13
  195. package/dist/status/client.d.ts +7 -2
  196. package/dist/status/output/compact.d.ts +1 -0
  197. package/dist/status/output/compact.js +3 -0
  198. package/dist/status/output/human.d.ts +1 -1
  199. package/dist/status/output/human.js +71 -14
  200. package/dist/team-workspace/ceremony.d.ts +19 -0
  201. package/dist/team-workspace/ceremony.js +141 -0
  202. package/dist/team-workspace/client.d.ts +58 -0
  203. package/dist/team-workspace/client.js +6 -0
  204. package/dist/team-workspace/commands.d.ts +3 -0
  205. package/dist/team-workspace/commands.js +85 -0
  206. package/dist/team-workspace/confirmation.d.ts +4 -0
  207. package/dist/team-workspace/confirmation.js +8 -0
  208. package/dist/team-workspace/dependencies.d.ts +8 -0
  209. package/dist/team-workspace/dependencies.js +2 -0
  210. package/dist/team-workspace/index.d.ts +6 -0
  211. package/dist/team-workspace/index.js +5 -0
  212. package/dist/team-workspace/launcher.d.ts +17 -0
  213. package/dist/team-workspace/launcher.js +30 -0
  214. package/dist/team-workspace/output.d.ts +15 -0
  215. package/dist/team-workspace/output.js +28 -0
  216. package/dist/team-workspace/terminal.d.ts +9 -0
  217. package/dist/team-workspace/terminal.js +46 -0
  218. package/dist/terminal/client.d.ts +4 -0
  219. package/dist/terminal/client.js +3 -0
  220. package/dist/terminal/commands.js +37 -25
  221. package/dist/terminal/output/compact-list.d.ts +1 -0
  222. package/dist/terminal/output/compact-list.js +1 -0
  223. package/dist/terminal/output/human.d.ts +2 -19
  224. package/dist/terminal/output/human.js +6 -6
  225. package/dist/terminal/tree/tree.js +15 -15
  226. package/package.json +10 -8
@@ -1,6 +1,12 @@
1
- import { type ConnectionCapacitySetParameters, type ConnectionCreateParameters, type ConnectionDetectParameters, type ConnectionGatewayCreateParameters, type ConnectionListParameters, type ConnectionLoginStartParameters, type ConnectionModelsListParameters, type ConnectionShowParameters, type ConnectionStateSetParameters, type ConnectionSystemConfirmParameters, type ConnectionSystemPreviewParameters, type ConnectionUsageShowParameters } from "@maiaos/sdk";
1
+ import { type ConnectionCapacitySetParameters, type ConnectionCreateParameters, type ConnectionDetectParameters, type ConnectionGatewayCreateParameters, type ConnectionListParameters, type ConnectionLoginStartParameters, type ConnectionModelsListParameters, type ConnectionShowParameters, type ConnectionStateSetParameters, type ConnectionSystemConfirmParameters, type ConnectionSystemPreviewParameters, type ConnectionUpkeepConfirmParameters, type ConnectionUpkeepPreviewParameters, type ConnectionUpkeepRefreshParameters, type ConnectionUsageShowParameters } from "@maiaos/sdk";
2
2
  import type { CliNodeOperations } from "../local-node/index.js";
3
3
  export declare const makeConnectionClient: (node: CliNodeOperations) => {
4
+ confirmConnectionGrant: import("./access/client.js").Operation<import("@maiaos/sdk").ConnectionGrantSetConfirmParameters, import("@maiaos/sdk").ConnectionGrantSetConfirmResult>;
5
+ confirmConnectionPool: import("./access/client.js").Operation<import("@maiaos/sdk").ConnectionPoolSetConfirmParameters, import("@maiaos/sdk").ConnectionPoolSetConfirmResult>;
6
+ listConnectionGrants: import("./access/client.js").Operation<import("@maiaos/sdk").ConnectionGrantListParameters, import("@maiaos/sdk").ConnectionGrantListResult>;
7
+ listConnectionPools: import("./access/client.js").Operation<import("@maiaos/sdk").ConnectionPoolListParameters, import("@maiaos/sdk").ConnectionPoolListResult>;
8
+ previewConnectionGrant: import("./access/client.js").Operation<import("@maiaos/sdk").ConnectionGrantSetPreviewParameters, import("@maiaos/sdk").ConnectionGrantSetPreviewResult>;
9
+ previewConnectionPool: import("./access/client.js").Operation<import("@maiaos/sdk").ConnectionPoolSetPreviewParameters, import("@maiaos/sdk").ConnectionPoolSetPreviewResult>;
4
10
  listConnectionModels: (input: ConnectionModelsListParameters) => import("../local-node/client.js").CliNodeEffect<{
5
11
  readonly connectionId: string;
6
12
  readonly format: "anthropic" | "openai";
@@ -600,6 +606,22 @@ export declare const makeConnectionClient: (node: CliNodeOperations) => {
600
606
  } | undefined;
601
607
  readonly executableApproved: boolean;
602
608
  readonly executor: "claude-code" | "codex-cli";
609
+ readonly upkeep?: {
610
+ readonly approved?: {
611
+ readonly launchable: "unknown" | "yes";
612
+ readonly version?: string | undefined;
613
+ } | undefined;
614
+ readonly available?: {
615
+ readonly checkedAt: string;
616
+ readonly source: "npm-registry";
617
+ readonly version: string;
618
+ } | undefined;
619
+ readonly policy: "notify" | "off";
620
+ readonly proposal?: {
621
+ readonly command: string;
622
+ readonly kind: "approve-installed" | "update-available";
623
+ } | undefined;
624
+ } | undefined;
603
625
  readonly workerPrompt?: "failed" | "inconclusive" | "ok" | undefined;
604
626
  }, {
605
627
  readonly accountKind?: string | undefined;
@@ -624,6 +646,22 @@ export declare const makeConnectionClient: (node: CliNodeOperations) => {
624
646
  } | undefined;
625
647
  readonly executableApproved: boolean;
626
648
  readonly executor: "claude-code" | "codex-cli";
649
+ readonly upkeep?: {
650
+ readonly approved?: {
651
+ readonly launchable: "unknown" | "yes";
652
+ readonly version?: string | undefined;
653
+ } | undefined;
654
+ readonly available?: {
655
+ readonly checkedAt: string;
656
+ readonly source: "npm-registry";
657
+ readonly version: string;
658
+ } | undefined;
659
+ readonly policy: "notify" | "off";
660
+ readonly proposal?: {
661
+ readonly command: string;
662
+ readonly kind: "approve-installed" | "update-available";
663
+ } | undefined;
664
+ } | undefined;
627
665
  readonly workerPrompt?: "failed" | "inconclusive" | "ok" | undefined;
628
666
  }];
629
667
  readonly method: "connection.detect";
@@ -687,6 +725,66 @@ export declare const makeConnectionClient: (node: CliNodeOperations) => {
687
725
  readonly method: "connection.system.preview";
688
726
  readonly proof: string;
689
727
  }>;
728
+ confirmConnectionUpkeep: (input: ConnectionUpkeepConfirmParameters) => import("../local-node/client.js").CliNodeEffect<{
729
+ readonly actorId: string;
730
+ readonly commandId: string;
731
+ readonly delivery: "duplicate" | "new";
732
+ readonly executor: "claude-code" | "codex-cli";
733
+ readonly inputDigest: string;
734
+ readonly method: "connection.upkeep.confirm";
735
+ readonly policy: "notify" | "off";
736
+ readonly policyRevision: number;
737
+ readonly receipt: {
738
+ readonly actorId: string;
739
+ readonly aggregateRevision: string;
740
+ readonly commandId: string;
741
+ readonly createdAt: string;
742
+ readonly eventCursor: string;
743
+ readonly method: string;
744
+ readonly receiptId: string;
745
+ readonly schemaVersion: 1;
746
+ readonly state: "succeeded";
747
+ readonly target: {
748
+ readonly id: string;
749
+ readonly type: string;
750
+ };
751
+ readonly updatedAt: string;
752
+ };
753
+ }>;
754
+ previewConnectionUpkeep: (input: ConnectionUpkeepPreviewParameters) => import("../local-node/client.js").CliNodeEffect<{
755
+ readonly actorId: string;
756
+ readonly authorizationRevision: number;
757
+ readonly commandId: string;
758
+ readonly current: "notify" | "off";
759
+ readonly executor: "claude-code" | "codex-cli";
760
+ readonly expiresAt: string;
761
+ readonly inputDigest: string;
762
+ readonly issuedAt: string;
763
+ readonly method: "connection.upkeep.preview";
764
+ readonly policy: "notify" | "off";
765
+ readonly policyRevision: number;
766
+ readonly proof: string;
767
+ }>;
768
+ refreshConnectionUpkeep: (input: ConnectionUpkeepRefreshParameters) => import("../local-node/client.js").CliNodeEffect<{
769
+ readonly executors: readonly [{
770
+ readonly available?: {
771
+ readonly checkedAt: string;
772
+ readonly source: "npm-registry";
773
+ readonly version: string;
774
+ } | undefined;
775
+ readonly executor: "claude-code" | "codex-cli";
776
+ readonly refreshed: boolean;
777
+ }, {
778
+ readonly available?: {
779
+ readonly checkedAt: string;
780
+ readonly source: "npm-registry";
781
+ readonly version: string;
782
+ } | undefined;
783
+ readonly executor: "claude-code" | "codex-cli";
784
+ readonly refreshed: boolean;
785
+ }];
786
+ readonly method: "connection.upkeep.refresh";
787
+ }>;
690
788
  };
691
789
  export type ConnectionCliDependencies = ReturnType<typeof makeConnectionClient>;
692
790
  //# sourceMappingURL=client.d.ts.map
@@ -1,4 +1,5 @@
1
- import { connectionCapacitySetParametersSchema, connectionCreateParametersSchema, connectionDetectParametersSchema, connectionGatewayCreateParametersSchema, connectionListParametersSchema, connectionLoginStartParametersSchema, connectionModelsListParametersSchema, connectionShowParametersSchema, connectionStateSetParametersSchema, connectionSystemConfirmParametersSchema, connectionSystemPreviewParametersSchema, connectionUsageShowParametersSchema, } from "@maiaos/sdk";
1
+ import { connectionCapacitySetParametersSchema, connectionCreateParametersSchema, connectionDetectParametersSchema, connectionGatewayCreateParametersSchema, connectionListParametersSchema, connectionLoginStartParametersSchema, connectionModelsListParametersSchema, connectionShowParametersSchema, connectionStateSetParametersSchema, connectionSystemConfirmParametersSchema, connectionSystemPreviewParametersSchema, connectionUpkeepConfirmParametersSchema, connectionUpkeepPreviewParametersSchema, connectionUpkeepRefreshParametersSchema, connectionUsageShowParametersSchema, } from "@maiaos/sdk";
2
+ import { makeConnectionAccessClient } from "./access/index.js";
2
3
  const readClient = (node) => ({
3
4
  listConnectionModels: (input) => node.runValidatedNodeOperation(input, connectionModelsListParametersSchema, (client, parameters, options) => client.listConnectionModels(parameters, options)),
4
5
  listConnections: (input) => node.runValidatedNodeOperation(input, connectionListParametersSchema, (client, parameters, options) => client.listConnections(parameters, options)),
@@ -19,10 +20,17 @@ const systemClient = (node) => ({
19
20
  detectConnections: (input) => node.runValidatedNodeOperation(input, connectionDetectParametersSchema, (client, parameters, options) => client.detectConnections(parameters, options)),
20
21
  previewSystemConnections: (input) => node.runValidatedNodeOperation(input, connectionSystemPreviewParametersSchema, (client, parameters, options) => client.previewSystemConnections(parameters, options)),
21
22
  });
23
+ const upkeepClient = (node) => ({
24
+ confirmConnectionUpkeep: (input) => node.runValidatedNodeOperation(input, connectionUpkeepConfirmParametersSchema, (client, parameters, options) => client.confirmConnectionUpkeep(parameters, options), { commandId: input.commandId }),
25
+ previewConnectionUpkeep: (input) => node.runValidatedNodeOperation(input, connectionUpkeepPreviewParametersSchema, (client, parameters, options) => client.previewConnectionUpkeep(parameters, options)),
26
+ refreshConnectionUpkeep: (input) => node.runValidatedNodeOperation(input, connectionUpkeepRefreshParametersSchema, (client, parameters, options) => client.refreshConnectionUpkeep(parameters, options)),
27
+ });
22
28
  export const makeConnectionClient = (node) => ({
29
+ ...makeConnectionAccessClient(node),
23
30
  ...readClient(node),
24
31
  ...mutationClient(node),
25
32
  ...signInClient(node),
26
33
  ...systemClient(node),
34
+ ...upkeepClient(node),
27
35
  });
28
36
  //# sourceMappingURL=client.js.map
@@ -1,7 +1,8 @@
1
+ export { runConnectionGrantList, runConnectionGrantSet, runConnectionPoolList, runConnectionPoolSet, } from "./access/index.js";
1
2
  export { type ConnectionCliDependencies, makeConnectionClient, } from "./client.js";
2
3
  export { runConnectionCapacitySet, runConnectionCreate, runConnectionDisable, runConnectionEnable, runConnectionList, runConnectionLoginStart, runConnectionModelsList, runConnectionShow, runConnectionUsageShow, type VendorLogin, } from "./commands.js";
3
4
  export { runVendorLogin } from "./login.js";
4
5
  export { describeConnection, formatConnectionResult, redactConnection, redactConnectionResult, } from "./output/index.js";
5
6
  export { callNode, ConnectionNodeError, findConnectionByName, } from "./resolve.js";
6
- export { runConnectionDetect, runSetup } from "./system.js";
7
+ export { runConnectionDetect, runConnectionUpdatePolicySet, runSetup, } from "./system.js";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1,7 +1,8 @@
1
+ export { runConnectionGrantList, runConnectionGrantSet, runConnectionPoolList, runConnectionPoolSet, } from "./access/index.js";
1
2
  export { makeConnectionClient, } from "./client.js";
2
3
  export { runConnectionCapacitySet, runConnectionCreate, runConnectionDisable, runConnectionEnable, runConnectionList, runConnectionLoginStart, runConnectionModelsList, runConnectionShow, runConnectionUsageShow, } from "./commands.js";
3
4
  export { runVendorLogin } from "./login.js";
4
5
  export { describeConnection, formatConnectionResult, redactConnection, redactConnectionResult, } from "./output/index.js";
5
6
  export { callNode, ConnectionNodeError, findConnectionByName, } from "./resolve.js";
6
- export { runConnectionDetect, runSetup } from "./system.js";
7
+ export { runConnectionDetect, runConnectionUpdatePolicySet, runSetup, } from "./system.js";
7
8
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,5 @@
1
1
  import { type CommandContext, type CommandEffect } from "../command-line/index.js";
2
2
  export declare const runConnectionDetect: (tokens: readonly string[], context: CommandContext) => CommandEffect;
3
3
  export declare const runSetup: (tokens: readonly string[], context: CommandContext) => CommandEffect;
4
+ export declare const runConnectionUpdatePolicySet: (tokens: readonly string[], context: CommandContext) => CommandEffect;
4
5
  //# sourceMappingURL=system.d.ts.map
@@ -1,7 +1,7 @@
1
- import { connectionSystemConfirmParametersSchema, } from "@maiaos/sdk";
1
+ import { connectionSystemConfirmParametersSchema, connectionUpkeepConfirmParametersSchema, } from "@maiaos/sdk";
2
2
  import * as Data from "effect/Data";
3
3
  import * as Effect from "effect/Effect";
4
- import { askToConfirm, CliArgumentError, confirmParameters, EXIT_CANCELLED, parseOptions, promptOrRefuse, readPipedPreview, reportError, requestedTwoPhaseMode, requirePositionals, TWO_PHASE_FLAGS, } from "../command-line/index.js";
4
+ import { askToConfirm, CliArgumentError, confirmParameters, EXIT_CANCELLED, jsonLine, parseOptions, promptOrRefuse, readPipedPreview, reportError, requestedTwoPhaseMode, requirePositionals, TWO_PHASE_FLAGS, } from "../command-line/index.js";
5
5
  import { commandIdentifier, } from "../local-node/index.js";
6
6
  class SetupNodeError extends Data.TaggedError("SetupNodeError") {
7
7
  }
@@ -11,7 +11,7 @@ const required = (effect) => effect === undefined
11
11
  ? Effect.succeed(result.value)
12
12
  : Effect.fail(new SetupNodeError({ error: result.error })));
13
13
  const write = (context, output, text) => {
14
- context.io.stdout(context.json ? `${JSON.stringify({ ok: true, result: output })}\n` : text);
14
+ context.io.stdout(context.json ? jsonLine({ ok: true, result: output }) : text);
15
15
  };
16
16
  const nodeLocal = (value) => ({
17
17
  ...value,
@@ -35,6 +35,33 @@ const signIn = (item) => {
35
35
  return `signed in${kind}`;
36
36
  return item.auth === "none" ? "signed out" : "sign-in unknown";
37
37
  };
38
+ const APPROVED_BUILD = {
39
+ unknown: "not checked",
40
+ yes: "launches",
41
+ };
42
+ const PROPOSALS = {
43
+ ["approve-installed"]: (command) => `the installed build is not the approved one; review it with '${command}'`,
44
+ ["update-available"]: (command) => `a newer version is out; update with '${command}' (Maia never runs the vendor's updater)`,
45
+ };
46
+ const newestText = (available) => available === undefined
47
+ ? "not checked; run 'maia connection detect --refresh'"
48
+ : `${available.version} on the npm registry, a proxy for the vendor's own channel (checked ${available.checkedAt})`;
49
+ const upkeepText = ({ upkeep }) => {
50
+ if (upkeep === undefined)
51
+ return [];
52
+ const { approved, available, policy, proposal } = upkeep;
53
+ return [
54
+ ` newest version: ${newestText(available)}; update policy: ${policy}`,
55
+ ...(approved === undefined
56
+ ? []
57
+ : [
58
+ ` approved build: ${approved.version === undefined ? "" : `${approved.version} `}${APPROVED_BUILD[approved.launchable]}`,
59
+ ]),
60
+ ...(proposal === undefined
61
+ ? []
62
+ : [` next: ${PROPOSALS[proposal.kind](proposal.command)}`]),
63
+ ];
64
+ };
38
65
  const detectedText = (item) => {
39
66
  if (!item.binary.found)
40
67
  return `${item.executor}: not installed\n`;
@@ -46,12 +73,24 @@ const detectedText = (item) => {
46
73
  `${item.executor} ${version ?? "(version unknown)"} ${path}${onNodePath ? "" : " (not on the Node's PATH)"}`,
47
74
  ` ${signIn(item)}; ${account}; executable ${item.executableApproved ? "approved" : "not approved"}`,
48
75
  ...(item.endpoint?.hint === undefined ? [] : [` ${item.endpoint.hint}`]),
76
+ ...upkeepText(item),
49
77
  "",
50
78
  ].join("\n");
51
79
  };
80
+ const refreshNewest = (context) => required(context.dependencies.refreshConnectionUpkeep?.({})).pipe(Effect.map(({ executors }) => executors
81
+ .filter((item) => !item.refreshed)
82
+ .map((item) => `a newer ${item.executor} version`)), Effect.catch(() => Effect.succeed(["newer versions"])), Effect.map((unchecked) => {
83
+ if (unchecked.length > 0)
84
+ context.io.stderr(unchecked
85
+ .map((what) => `Could not check for ${what}; showing the last answer.\n`)
86
+ .join(""));
87
+ }));
52
88
  export const runConnectionDetect = (tokens, context) => Effect.gen(function* () {
53
- requirePositionals(tokens, 0);
54
- const detected = yield* required(context.dependencies.detectConnections?.({}));
89
+ const parsed = parseOptions(tokens, new Set(), new Set(["--refresh"]));
90
+ requirePositionals(parsed.positionals, 0);
91
+ if (parsed.flags.has("--refresh"))
92
+ yield* refreshNewest(context);
93
+ const detected = yield* required(context.dependencies.detectConnections?.({ upkeep: true }));
55
94
  write(context, { command: "connection.detect", result: markDetected(detected) }, detected.executors.map(detectedText).join(""));
56
95
  return 0;
57
96
  }).pipe(Effect.catch(reportSetupFailure(context)));
@@ -176,6 +215,71 @@ export const runSetup = (tokens, context) => Effect.gen(function* () {
176
215
  }
177
216
  return writeConfirmed(context, yield* confirm(context, plan), plan);
178
217
  }).pipe(Effect.catch(reportSetupFailure(context)));
218
+ const readPolicyChange = (parsed) => {
219
+ const [executor, policy] = parsed.positionals;
220
+ if (executor !== "claude-code" && executor !== "codex-cli")
221
+ throw new CliArgumentError("The CLI must be claude-code or codex-cli.");
222
+ if (policy !== "off" && policy !== "notify")
223
+ throw new CliArgumentError("The update policy must be off or notify.");
224
+ return { executor, policy };
225
+ };
226
+ const POLICY_EFFECT = {
227
+ notify: "Maia proposes updates in 'maia connection detect'.",
228
+ off: "Maia stops proposing updates; detection still shows the facts.",
229
+ };
230
+ const policyText = (plan) => `${plan.executor}: update policy ${plan.current} -> ${plan.policy}. ${POLICY_EFFECT[plan.policy]}\n`;
231
+ const policyConfirmedText = (result) => `${result.executor}: update policy ${result.policy} (receipt ${result.receipt.receiptId})\n`;
232
+ const confirmPolicy = (context, preview) => Effect.gen(function* () {
233
+ const parameters = yield* confirmParameters(connectionUpkeepConfirmParametersSchema, preview, ["authorizationRevision", "current", "policyRevision"]);
234
+ return yield* required(context.dependencies.confirmConnectionUpkeep?.(parameters));
235
+ });
236
+ const previewPolicy = (context, parsed, change) => Effect.flatMap(commandIdentifier(parsed.options.get("--command-id")), (commandId) => required(context.dependencies.previewConnectionUpkeep?.({
237
+ commandId,
238
+ ...change,
239
+ })));
240
+ const writePolicySet = (context, result, plan) => {
241
+ write(context, {
242
+ command: "connection.update-policy.set",
243
+ result: { ...(plan === undefined ? {} : { preview: plan }), result },
244
+ }, policyConfirmedText(result));
245
+ return 0;
246
+ };
247
+ const writePolicyUnchanged = (context, plan) => {
248
+ write(context, { command: "connection.update-policy.set", result: { preview: plan } }, `${plan.executor}: update policy is already ${plan.policy}; nothing changed.\n`);
249
+ return 0;
250
+ };
251
+ const writePolicyDryRun = (context, plan) => {
252
+ write(context, { command: "connection.upkeep.preview", result: plan }, `${policyText(plan)}Confirm with: maia --json connection update-policy set ${plan.executor} ${plan.policy} --dry-run | maia connection update-policy set --confirm-stdin\n`);
253
+ return 0;
254
+ };
255
+ const readPolicyRequest = (tokens) => {
256
+ const parsed = parseOptions(tokens, new Set(["--command-id"]), new Set(["--yes", ...TWO_PHASE_FLAGS]));
257
+ const requested = requestedTwoPhaseMode(parsed.flags, true);
258
+ requirePositionals(parsed.positionals, requested === "confirm-stdin" ? 0 : 2);
259
+ return { parsed, requested };
260
+ };
261
+ const approvedByPerson = (context, requested, plan) => Effect.gen(function* () {
262
+ const mode = requested ?? promptOrRefuse(context, true);
263
+ if (!context.json)
264
+ context.io.stdout(policyText(plan));
265
+ if (mode !== "prompt" || (yield* askToConfirm(context, "Change it?")))
266
+ return true;
267
+ context.io.stderr("Cancelled; nothing changed.\n");
268
+ return false;
269
+ });
270
+ export const runConnectionUpdatePolicySet = (tokens, context) => Effect.gen(function* () {
271
+ const { parsed, requested } = readPolicyRequest(tokens);
272
+ if (requested === "confirm-stdin")
273
+ return writePolicySet(context, yield* confirmPolicy(context, yield* readPipedPreview(context)));
274
+ const plan = yield* previewPolicy(context, parsed, readPolicyChange(parsed));
275
+ if (requested === "dry-run")
276
+ return writePolicyDryRun(context, plan);
277
+ if (plan.current === plan.policy)
278
+ return writePolicyUnchanged(context, plan);
279
+ if (!(yield* approvedByPerson(context, requested, plan)))
280
+ return EXIT_CANCELLED;
281
+ return writePolicySet(context, yield* confirmPolicy(context, plan), plan);
282
+ }).pipe(Effect.catch(reportSetupFailure(context)));
179
283
  const reportSetupFailure = (context) => (error) => Effect.sync(() => reportError(error instanceof SetupNodeError
180
284
  ? error.error
181
285
  : {
@@ -10,6 +10,9 @@ export const CONNECTION_TREE = {
10
10
  ["connection usage", "A Connection's usage."],
11
11
  ["connection models", "Models a Connection offers."],
12
12
  ["connection capacity", "A Connection's Session limit."],
13
+ ["connection grant", "Grants."],
14
+ ["connection pool", "Pools."],
15
+ ["connection update-policy", "Vendor CLI update proposals."],
13
16
  ["integration", "Approve vendor executables."],
14
17
  ["integration plan", "Plan approving a vendor executable."],
15
18
  ["integration status", "A vendor integration's status."],
@@ -23,7 +26,7 @@ export const CONNECTION_TREE = {
23
26
  "setup [--max-sessions <1..16>] [--command-id <id>] [--dry-run | --confirm-stdin | --yes]",
24
27
  1,
25
28
  ["connection.system.preview", "connection.system.confirm"],
26
- "Use the installed vendor CLIs as system-default accounts.",
29
+ "Use installed vendor CLIs as system-default accounts.",
27
30
  {
28
31
  example: "maia setup --max-sessions 4",
29
32
  kind: "two-phase",
@@ -59,7 +62,7 @@ export const CONNECTION_TREE = {
59
62
  "login gateway --name <name> --base-url <url> --api-key-stdin [--max-sessions <1..16>] [--command-id <id>]",
60
63
  1,
61
64
  "connection.gateway.create",
62
- "Add an AI gateway Connection with its API key.",
65
+ "Add a gateway Connection with its API key.",
63
66
  { run: [login, "runLoginGateway"] },
64
67
  ],
65
68
  [
@@ -87,20 +90,32 @@ export const CONNECTION_TREE = {
87
90
  { run: [connection, "runConnectionShow"] },
88
91
  ],
89
92
  [
90
- "connection detect",
93
+ "connection detect [--refresh]",
91
94
  1,
92
- "connection.detect",
93
- "Detect the installed vendor CLIs.",
95
+ ["connection.detect", "connection.upkeep.refresh"],
96
+ "Detect installed vendor CLIs and newer versions.",
94
97
  {
95
- example: "maia --json connection detect",
98
+ example: "maia --json connection detect --refresh",
99
+ kind: "composite",
96
100
  run: [connection, "runConnectionDetect"],
97
101
  },
98
102
  ],
103
+ [
104
+ "connection update-policy set <claude-code|codex-cli> <off|notify> [--command-id <id>] [--dry-run | --confirm-stdin | --yes]",
105
+ 1,
106
+ ["connection.upkeep.preview", "connection.upkeep.confirm"],
107
+ "Set a vendor CLI's update policy.",
108
+ {
109
+ example: "maia connection update-policy set codex-cli off",
110
+ kind: "two-phase",
111
+ run: [connection, "runConnectionUpdatePolicySet"],
112
+ },
113
+ ],
99
114
  [
100
115
  "connection login start <connection> [--device-code] [--command-id <id>]",
101
116
  1,
102
117
  "connection.login.start",
103
- "Start a Node-side sign-in for a Connection.",
118
+ "Start a Node-side sign-in.",
104
119
  { run: [connection, "runConnectionLoginStart"] },
105
120
  ],
106
121
  [
@@ -114,7 +129,7 @@ export const CONNECTION_TREE = {
114
129
  "connection models list --connection <connection>",
115
130
  1,
116
131
  "connection.models.list",
117
- "List the models a Connection offers.",
132
+ "List a Connection's models.",
118
133
  { run: [connection, "runConnectionModelsList"] },
119
134
  ],
120
135
  [
@@ -124,6 +139,42 @@ export const CONNECTION_TREE = {
124
139
  "Set a Connection's Session limit.",
125
140
  { run: [connection, "runConnectionCapacitySet"] },
126
141
  ],
142
+ [
143
+ "connection grant list [--connection <connection>] [--project <project-id> | --container <container-id>] [--state <active|revoked>] [--limit <1..100>] [--after <cursor>]",
144
+ 1,
145
+ "connection.grant.list",
146
+ "List grants.",
147
+ { run: [connection, "runConnectionGrantList"] },
148
+ ],
149
+ [
150
+ "connection grant set <connection> (--project <project-id> | --container <container-id> | --confirm-stdin) [--revoke] [--command-id <id>] [--dry-run]",
151
+ 1,
152
+ ["connection.grant.set.preview", "connection.grant.set.confirm"],
153
+ "Grant or revoke a Connection.",
154
+ {
155
+ example: "maia connection grant set claude-a --project maiaos",
156
+ kind: "two-phase",
157
+ run: [connection, "runConnectionGrantSet"],
158
+ },
159
+ ],
160
+ [
161
+ "connection pool list [--project <project-id> | --container <container-id>] [--limit <1..100>] [--after <cursor>]",
162
+ 1,
163
+ "connection.pool.list",
164
+ "List pools.",
165
+ { run: [connection, "runConnectionPoolList"] },
166
+ ],
167
+ [
168
+ "connection pool set (--project <project-id> | --container <container-id> | --confirm-stdin) --mode <off|rotate|single> [<connection>...] [--command-id <id>] [--dry-run]",
169
+ 1,
170
+ ["connection.pool.set.preview", "connection.pool.set.confirm"],
171
+ "Pin, rotate or clear a pool.",
172
+ {
173
+ example: "maia connection pool set --project maiaos --mode rotate claude-a claude-b",
174
+ kind: "two-phase",
175
+ run: [connection, "runConnectionPoolSet"],
176
+ },
177
+ ],
127
178
  [
128
179
  "connection enable <connection> --expected-revision <revision> [--command-id <id>]",
129
180
  1,
@@ -1,6 +1,5 @@
1
- import { formatRows } from "../../command-line/index.js";
1
+ import { cell, formatRows } from "../../command-line/index.js";
2
2
  export const isContainerResult = (result) => result.command.startsWith("container.");
3
- const cell = (value) => value.replaceAll(/[\u0000-\u001F\u007F-\u009F]/gu, " ");
4
3
  const projectCount = (count) => `${String(count)} ${count === 1 ? "Project" : "Projects"}`;
5
4
  const formatIndex = (result) => result.items.length === 0
6
5
  ? "No containers.\n"
@@ -0,0 +1,6 @@
1
+ import { type CockpitClient } from "@maiaos/client-core/cockpit";
2
+ import type * as Context from "effect/Context";
3
+ import type * as Crypto from "effect/Crypto";
4
+ import { type HeldConnection } from "./node-connection.js";
5
+ export declare const makeCockpitClient: (held: HeldConnection, context: Context.Context<Crypto.Crypto>) => CockpitClient;
6
+ //# sourceMappingURL=cockpit-client.d.ts.map
@@ -0,0 +1,27 @@
1
+ import { COCKPIT_CLIENT_METHODS, } from "@maiaos/client-core/cockpit";
2
+ import { classifyClientError } from "@maiaos/sdk";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Exit from "effect/Exit";
5
+ import { newCliIdentifier, retryBriefSaturation, } from "../local-node/index.js";
6
+ import { noConnection } from "./node-connection.js";
7
+ const rejectsCredential = (error) => {
8
+ const { code } = classifyClientError(error, { mutation: false });
9
+ return code === "authentication_failed" || code === "credential_invalid";
10
+ };
11
+ const connectionLost = (error) => {
12
+ const { code, kind } = classifyClientError(error, { mutation: false });
13
+ return ((kind === "offline" && code !== "saturated") ||
14
+ kind === "outcome_unknown" ||
15
+ code === "node_unavailable" ||
16
+ rejectsCredential(error));
17
+ };
18
+ const failedOn = (held, connection) => (error) => Effect.andThen(connectionLost(error) ? held.lose(connection) : Effect.void, Effect.fail(rejectsCredential(error) ? noConnection("node_connecting") : error));
19
+ const operationOf = (client, name) => Reflect.get(client, name);
20
+ export const makeCockpitClient = (held, context) => Object.fromEntries(COCKPIT_CLIENT_METHODS.map((name) => [
21
+ name,
22
+ (parameters, options) => Effect.runPromiseWith(context)(Effect.flatMap(held.current, (connection) => retryBriefSaturation(Effect.flatMap(newCliIdentifier("request"), (messageId) => operationOf(connection.client, name)(parameters, {
23
+ ...options,
24
+ messageId,
25
+ })), options?.deadlineAt).pipe(Effect.onExit((exit) => held.heard(connection, !Exit.hasInterrupts(exit))), Effect.catch(failedOn(held, connection)))), options?.signal === undefined ? {} : { signal: options.signal }),
26
+ ]));
27
+ //# sourceMappingURL=cockpit-client.js.map
@@ -0,0 +1,29 @@
1
+ import { type Cockpit, type CockpitClient, type CockpitState, type NodeCockpitState, type ReadAdmissionService } from "@maiaos/client-core/cockpit";
2
+ import { type NodeEntry, type NodeRegistry, type NodeView } from "@maiaos/client-core/node-registry";
3
+ import type { NodeApiEffectDiscoveryOptions } from "@maiaos/sdk/node/effect";
4
+ import type * as Crypto from "effect/Crypto";
5
+ import * as Effect from "effect/Effect";
6
+ import type * as Scope from "effect/Scope";
7
+ import * as Stream from "effect/Stream";
8
+ import type { CliNodeConnector } from "../local-node/index.js";
9
+ import { type OpenConnection } from "./node-connection.js";
10
+ export declare const READS_IN_FLIGHT = 3;
11
+ export type NodeCockpit = {
12
+ readonly admit: ReadAdmissionService;
13
+ readonly client: CockpitClient;
14
+ readonly cockpit: Cockpit;
15
+ readonly node: NodeEntry;
16
+ };
17
+ export declare const openNodeCockpit: (registry: NodeRegistry, node: NodeEntry, open: OpenConnection) => Effect.Effect<NodeCockpit, never, Crypto.Crypto | Scope.Scope>;
18
+ export type DashboardNodes = {
19
+ readonly local: CliNodeConnector;
20
+ readonly options: NodeApiEffectDiscoveryOptions;
21
+ readonly remote: (name: string, scope: Scope.Scope) => CliNodeConnector;
22
+ };
23
+ export type DashboardCockpits = {
24
+ readonly combined: Stream.Stream<CockpitState>;
25
+ readonly nodes: Stream.Stream<readonly NodeView[]>;
26
+ readonly states: Stream.Stream<readonly NodeCockpitState[]>;
27
+ };
28
+ export declare const dashboardCockpits: (nodes: DashboardNodes) => Effect.Effect<DashboardCockpits, never, Crypto.Crypto | Scope.Scope>;
29
+ //# sourceMappingURL=cockpits.d.ts.map
@@ -0,0 +1,65 @@
1
+ import { CockpitError, combineCockpits, makeCockpit, ReadAdmission, readRemoteNodes, } from "@maiaos/client-core/cockpit";
2
+ import { LOCAL_NODE, makeNodeRegistry, remoteNodeEntry, } from "@maiaos/client-core/node-registry";
3
+ import { pollingNodeChangesLayer } from "@maiaos/client-core/presentation";
4
+ import * as Effect from "effect/Effect";
5
+ import * as Option from "effect/Option";
6
+ import * as Schedule from "effect/Schedule";
7
+ import * as Semaphore from "effect/Semaphore";
8
+ import * as Stream from "effect/Stream";
9
+ import * as SubscriptionRef from "effect/SubscriptionRef";
10
+ import { makeCockpitClient } from "./cockpit-client.js";
11
+ import { holdConnection, } from "./node-connection.js";
12
+ export const READS_IN_FLIGHT = 3;
13
+ const RELOAD_EVERY = "15 seconds";
14
+ const REMOTE_LIST_EVERY = "60 seconds";
15
+ const instanceOf = (held) => held.current.pipe(Effect.map(({ status }) => status.instanceId), Effect.mapError(() => new CockpitError({
16
+ message: "The Node has no live connection.",
17
+ operation: "node.status",
18
+ reason: "offline",
19
+ })));
20
+ export const openNodeCockpit = (registry, node, open) => Effect.gen(function* () {
21
+ const held = yield* holdConnection(open);
22
+ const client = makeCockpitClient(held, yield* Effect.context());
23
+ const admit = (yield* Semaphore.make(READS_IN_FLIGHT)).withPermits(1);
24
+ const cockpit = yield* makeCockpit({
25
+ client,
26
+ instance: instanceOf(held),
27
+ nodeId: node.nodeId,
28
+ registry,
29
+ }).pipe(Effect.provide(pollingNodeChangesLayer(RELOAD_EVERY)), Effect.provideService(ReadAdmission, admit));
30
+ const reload = Effect.provideService(cockpit.reload, ReadAdmission, admit);
31
+ return { admit, client, cockpit: { ...cockpit, reload }, node };
32
+ });
33
+ const mirror = (states, { cockpit, node }) => Effect.forkScoped(Stream.runForEach(cockpit.changes, (state) => SubscriptionRef.update(states, (previous) => new Map(previous).set(node.nodeId, { node, state }))));
34
+ const startRemote = ({ nodes, registry, states }, remote) => {
35
+ const node = remoteNodeEntry(remote);
36
+ const open = (scope) => nodes.remote(remote.name, scope)(nodes.options);
37
+ return remote.state === "ready"
38
+ ? Effect.flatMap(openNodeCockpit(registry, node, open), (opened) => mirror(states, opened))
39
+ : Effect.ignore(registry.recordFailure(node.nodeId, `It is ${remote.state}, not ready.`));
40
+ };
41
+ const runRemotes = (dashboard, remotes) => Effect.scoped(Effect.gen(function* () {
42
+ yield* SubscriptionRef.update(dashboard.states, (previous) => new Map([...previous].filter(([id]) => id === LOCAL_NODE.nodeId)));
43
+ yield* dashboard.registry.setEntries([
44
+ LOCAL_NODE,
45
+ ...remotes.map(remoteNodeEntry),
46
+ ]);
47
+ yield* Effect.forEach(remotes, (remote) => startRemote(dashboard, remote), { concurrency: "unbounded", discard: true });
48
+ return yield* Effect.never;
49
+ }));
50
+ const sameRemotes = (left, right) => JSON.stringify(left) === JSON.stringify(right);
51
+ const followRemotes = (dashboard, local) => Stream.fromEffect(Effect.option(Effect.provideService(readRemoteNodes(local.client), ReadAdmission, local.admit))).pipe(Stream.repeat(Schedule.spaced(REMOTE_LIST_EVERY)), Stream.filter(Option.isSome), Stream.map(({ value }) => value), Stream.changesWith(sameRemotes), Stream.switchMap((remotes) => Stream.fromEffect(runRemotes(dashboard, remotes))), Stream.runDrain);
52
+ export const dashboardCockpits = (nodes) => Effect.gen(function* () {
53
+ const registry = yield* makeNodeRegistry([LOCAL_NODE]);
54
+ const states = yield* SubscriptionRef.make(new Map());
55
+ const local = yield* openNodeCockpit(registry, LOCAL_NODE, () => nodes.local(nodes.options));
56
+ yield* mirror(states, local);
57
+ yield* Effect.forkScoped(followRemotes({ nodes, registry, states }, local));
58
+ const parts = SubscriptionRef.changes(states).pipe(Stream.map((held) => [...held.values()]));
59
+ return {
60
+ combined: parts.pipe(Stream.map(combineCockpits)),
61
+ nodes: registry.watch,
62
+ states: parts,
63
+ };
64
+ });
65
+ //# sourceMappingURL=cockpits.js.map
@@ -0,0 +1,7 @@
1
+ import * as Effect from "effect/Effect";
2
+ import { CliArgumentError, type CommandContext, type CommandEffect } from "../command-line/index.js";
3
+ import { DashboardTerminal, type Screen } from "./terminal.js";
4
+ export declare const showScreen: (screen: Screen, context: CommandContext) => Effect.Effect<number, CliArgumentError, DashboardTerminal>;
5
+ export declare const showDashboard: (tokens: readonly string[], context: CommandContext) => Effect.Effect<number, CliArgumentError, DashboardTerminal>;
6
+ export declare const runDashboard: (tokens: readonly string[], context: CommandContext) => CommandEffect;
7
+ //# sourceMappingURL=dashboard.d.ts.map