@maiaos/cli 0.1.0-canary.55 → 0.1.0-canary.56

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 (179) hide show
  1. package/README.md +4 -3
  2. package/dist/bin/maia.cdx.json +19 -19
  3. package/dist/bin/maia.mjs +1 -1
  4. package/dist/command-line/emit/index.d.ts +1 -1
  5. package/dist/command-line/emit/index.js +1 -1
  6. package/dist/command-line/emit/rows.d.ts +1 -0
  7. package/dist/command-line/emit/rows.js +5 -0
  8. package/dist/command-line/index.d.ts +2 -2
  9. package/dist/command-line/index.js +2 -2
  10. package/dist/command-line/input/index.d.ts +1 -0
  11. package/dist/command-line/input/index.js +1 -0
  12. package/dist/command-line/input/manager-options.d.ts +10 -0
  13. package/dist/command-line/input/manager-options.js +38 -0
  14. package/dist/events/commands.js +4 -3
  15. package/dist/import/batch.js +196 -0
  16. package/dist/import/client.d.ts +3 -3
  17. package/dist/import/client.js +1 -1
  18. package/dist/import/commands.d.ts +1 -0
  19. package/dist/import/commands.js +82 -8
  20. package/dist/import/index.d.ts +1 -1
  21. package/dist/import/index.js +1 -1
  22. package/dist/import/input.js +16 -2
  23. package/dist/import/manifest.js +107 -0
  24. package/dist/import/output.js +44 -2
  25. package/dist/session/approval/commands.d.ts +1 -0
  26. package/dist/session/approval/commands.js +75 -9
  27. package/dist/session/approval/index.d.ts +1 -1
  28. package/dist/session/approval/index.js +1 -1
  29. package/dist/session/coding-client.d.ts +2 -0
  30. package/dist/session/coding-client.js +1 -2
  31. package/dist/session/coding-commands.js +24 -7
  32. package/dist/session/commands.js +36 -39
  33. package/dist/session/output/human.js +14 -3
  34. package/dist/session/output/tasks.js +25 -11
  35. package/dist/session/tree/tree.js +31 -9
  36. package/package.json +5 -5
  37. package/dist/address-space/address-space.d.ts +0 -38
  38. package/dist/address-space/index.d.ts +0 -2
  39. package/dist/agents/input.d.ts +0 -132
  40. package/dist/agents/output/format.d.ts +0 -8
  41. package/dist/agents/output/index.d.ts +0 -2
  42. package/dist/agents/tree/index.d.ts +0 -2
  43. package/dist/agents/tree/tree.d.ts +0 -3
  44. package/dist/bootstrap/exit.d.ts +0 -14
  45. package/dist/bootstrap/exit.js +0 -42
  46. package/dist/bootstrap/index.d.ts +0 -3
  47. package/dist/bootstrap/index.js +0 -3
  48. package/dist/bootstrap/process.d.ts +0 -5
  49. package/dist/bootstrap/process.js +0 -23
  50. package/dist/bootstrap/run.d.ts +0 -25
  51. package/dist/bootstrap/run.js +0 -98
  52. package/dist/bootstrap/stdio.d.ts +0 -4
  53. package/dist/bootstrap/stdio.js +0 -9
  54. package/dist/cli/environment.d.ts +0 -8
  55. package/dist/cli/services.d.ts +0 -4
  56. package/dist/command-line/emit/json-decoder.d.ts +0 -3
  57. package/dist/command-line/input/stdin-stream.d.ts +0 -4
  58. package/dist/command-receipt/command.d.ts +0 -4
  59. package/dist/command-receipt/compact-list.d.ts +0 -20
  60. package/dist/command-receipt/index.d.ts +0 -3
  61. package/dist/command-tree/completion.d.ts +0 -6
  62. package/dist/command-tree/local.d.ts +0 -3
  63. package/dist/command-tree/row.js +0 -2
  64. package/dist/connection/access/format.d.ts +0 -8
  65. package/dist/connection/access/input.d.ts +0 -53
  66. package/dist/connection/input.d.ts +0 -50
  67. package/dist/connection/signin.d.ts +0 -4
  68. package/dist/connection/tree/index.d.ts +0 -2
  69. package/dist/connection/tree/tree.d.ts +0 -3
  70. package/dist/container/output/format.d.ts +0 -11
  71. package/dist/container/output/index.d.ts +0 -2
  72. package/dist/context/client.d.ts +0 -7
  73. package/dist/context/commands.d.ts +0 -3
  74. package/dist/context/index.d.ts +0 -3
  75. package/dist/dashboard/cockpit-client.d.ts +0 -6
  76. package/dist/dashboard/cockpit-client.js +0 -27
  77. package/dist/dashboard/cockpits.d.ts +0 -29
  78. package/dist/dashboard/cockpits.js +0 -65
  79. package/dist/dashboard/dashboard.d.ts +0 -7
  80. package/dist/dashboard/draw.d.ts +0 -15
  81. package/dist/dashboard/frame.d.ts +0 -4
  82. package/dist/dashboard/index.d.ts +0 -2
  83. package/dist/dashboard/modes.d.ts +0 -5
  84. package/dist/dashboard/node-connection.d.ts +0 -15
  85. package/dist/dashboard/node-connection.js +0 -51
  86. package/dist/dashboard/pi-tui.d.ts +0 -6
  87. package/dist/dashboard/status-bar.d.ts +0 -4
  88. package/dist/dashboard/terminal.d.ts +0 -53
  89. package/dist/dashboard/tree-model.d.ts +0 -28
  90. package/dist/dashboard/tree.d.ts +0 -10
  91. package/dist/development/cli.d.ts +0 -3
  92. package/dist/development/cli.js +0 -44
  93. package/dist/events/commands.d.ts +0 -11
  94. package/dist/events/index.d.ts +0 -2
  95. package/dist/events/tree/index.d.ts +0 -2
  96. package/dist/events/tree/tree.d.ts +0 -10
  97. package/dist/execution/tree/index.d.ts +0 -2
  98. package/dist/execution/tree/tree.d.ts +0 -3
  99. package/dist/hold/output/format.d.ts +0 -11
  100. package/dist/hold/output/index.d.ts +0 -2
  101. package/dist/hold/tree/index.d.ts +0 -2
  102. package/dist/hold/tree/tree.d.ts +0 -3
  103. package/dist/import/input.d.ts +0 -19
  104. package/dist/import/output.d.ts +0 -6
  105. package/dist/integration/output.d.ts +0 -22
  106. package/dist/login/failure.d.ts +0 -3
  107. package/dist/login/gateway.d.ts +0 -12
  108. package/dist/login/menu.d.ts +0 -4
  109. package/dist/login/output/format.d.ts +0 -16
  110. package/dist/login/output/index.d.ts +0 -2
  111. package/dist/login/vendor-account.d.ts +0 -95
  112. package/dist/login/vendor-input.d.ts +0 -14
  113. package/dist/mcp/calls.d.ts +0 -8
  114. package/dist/orchestration/output/compact-aggregate.d.ts +0 -121
  115. package/dist/orchestration/output/compact-run-list.d.ts +0 -20
  116. package/dist/orchestration/output/human.d.ts +0 -80
  117. package/dist/orchestration/output/index.d.ts +0 -4
  118. package/dist/orchestration/tree/index.d.ts +0 -2
  119. package/dist/orchestration/tree/tree.d.ts +0 -3
  120. package/dist/port-lease/input.d.ts +0 -65
  121. package/dist/port-lease/output/format.d.ts +0 -11
  122. package/dist/port-lease/output/index.d.ts +0 -2
  123. package/dist/presentation/output/format.d.ts +0 -11
  124. package/dist/presentation/output/index.d.ts +0 -3
  125. package/dist/project-guard/input.d.ts +0 -21
  126. package/dist/project-guard/output/format.d.ts +0 -11
  127. package/dist/project-guard/output/index.d.ts +0 -2
  128. package/dist/project-workspace/output/human.d.ts +0 -139
  129. package/dist/project-workspace/output/index.d.ts +0 -3
  130. package/dist/project-workspace/output/metadata.d.ts +0 -11
  131. package/dist/project-workspace/tree/index.d.ts +0 -2
  132. package/dist/project-workspace/tree/tree.d.ts +0 -3
  133. package/dist/provider/client.d.ts +0 -6
  134. package/dist/provider/commands.d.ts +0 -3
  135. package/dist/provider/index.d.ts +0 -3
  136. package/dist/reference/commands.d.ts +0 -3
  137. package/dist/reference/index.d.ts +0 -3
  138. package/dist/reference/resolve.d.ts +0 -31
  139. package/dist/reference/tree/index.d.ts +0 -2
  140. package/dist/reference/tree/tree.d.ts +0 -3
  141. package/dist/remote-node/reachability.d.ts +0 -64
  142. package/dist/remote-node/text.d.ts +0 -10
  143. package/dist/remote-node/tree/index.d.ts +0 -2
  144. package/dist/remote-node/tree/tree.d.ts +0 -3
  145. package/dist/routine/input.d.ts +0 -28
  146. package/dist/routine/output/format.d.ts +0 -23
  147. package/dist/routine/output/index.d.ts +0 -2
  148. package/dist/routine/tree/index.d.ts +0 -2
  149. package/dist/routine/tree/tree.d.ts +0 -3
  150. package/dist/run-ledger/input.d.ts +0 -42
  151. package/dist/run-ledger/output/format.d.ts +0 -11
  152. package/dist/run-ledger/output/index.d.ts +0 -2
  153. package/dist/session/approval/output/format.d.ts +0 -23
  154. package/dist/session/approval/output/index.d.ts +0 -2
  155. package/dist/session/attach-render.d.ts +0 -16
  156. package/dist/session/create-tasks.d.ts +0 -20
  157. package/dist/session/interaction/input.d.ts +0 -15
  158. package/dist/session/interaction/output/format.d.ts +0 -11
  159. package/dist/session/interaction/output/index.d.ts +0 -2
  160. package/dist/session/output/diff.d.ts +0 -3
  161. package/dist/session/output/failure.d.ts +0 -11
  162. package/dist/session/output/human.d.ts +0 -115
  163. package/dist/session/output/index.d.ts +0 -6
  164. package/dist/session/output/observe.d.ts +0 -4
  165. package/dist/session/output/tasks.d.ts +0 -36
  166. package/dist/session/task-file.d.ts +0 -5
  167. package/dist/session/tree/index.d.ts +0 -2
  168. package/dist/session/tree/tree.d.ts +0 -3
  169. package/dist/team-workspace/ceremony.d.ts +0 -19
  170. package/dist/team-workspace/confirmation.d.ts +0 -4
  171. package/dist/team-workspace/dependencies.js +0 -2
  172. package/dist/team-workspace/output.d.ts +0 -15
  173. package/dist/terminal/arguments.d.ts +0 -13
  174. package/dist/terminal/keys.d.ts +0 -12
  175. package/dist/terminal/output/compact-list.d.ts +0 -149
  176. package/dist/terminal/output/human.d.ts +0 -42
  177. package/dist/terminal/output/index.d.ts +0 -3
  178. package/dist/terminal/tree/index.d.ts +0 -2
  179. package/dist/terminal/tree/tree.d.ts +0 -3
@@ -1,3 +0,0 @@
1
- import type { TreeFragment } from "./row.js";
2
- export declare const LOCAL_TREE: TreeFragment;
3
- //# sourceMappingURL=local.d.ts.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=row.js.map
@@ -1,8 +0,0 @@
1
- import type { ConnectionGrantListResult, ConnectionGrantSetConfirmResult, ConnectionGrantSetPreviewResult, ConnectionPoolListResult, ConnectionPoolSetConfirmResult, ConnectionPoolSetPreviewResult } from "@maiaos/sdk";
2
- export type ConnectionAccessResult = ConnectionGrantListResult | ConnectionGrantSetConfirmResult | ConnectionGrantSetPreviewResult | ConnectionPoolListResult | ConnectionPoolSetConfirmResult | ConnectionPoolSetPreviewResult;
3
- export type CliConnectionAccessResult = {
4
- readonly command: ConnectionAccessResult["method"];
5
- readonly result: ConnectionAccessResult;
6
- };
7
- export declare const formatConnectionAccessResult: ({ result, }: CliConnectionAccessResult) => string;
8
- //# sourceMappingURL=format.d.ts.map
@@ -1,53 +0,0 @@
1
- import * as Effect from "effect/Effect";
2
- import { type ParsedOptions } from "../../command-line/index.js";
3
- type PoolMode = "off" | "rotate" | "single";
4
- export declare const readGrantList: (tokens: readonly string[]) => {
5
- afterCursor?: string | undefined;
6
- limit: number;
7
- scope?: undefined;
8
- connectionId?: string | undefined;
9
- state?: "active" | "revoked" | undefined;
10
- } | {
11
- afterCursor?: string | undefined;
12
- limit: number;
13
- scope: {
14
- readonly id: string;
15
- readonly kind: "project" | "workspace";
16
- };
17
- connectionId?: string | undefined;
18
- state?: "active" | "revoked" | undefined;
19
- };
20
- export declare const readPoolList: (tokens: readonly string[]) => {
21
- afterCursor?: string | undefined;
22
- limit: number;
23
- scope?: undefined;
24
- } | {
25
- afterCursor?: string | undefined;
26
- limit: number;
27
- scope: {
28
- readonly id: string;
29
- readonly kind: "project" | "workspace";
30
- };
31
- };
32
- export declare const GRANT_SET_OPTIONS: ReadonlySet<string>;
33
- export declare const readGrantPreview: (parsed: ParsedOptions) => Effect.Effect<{
34
- commandId: string;
35
- connectionId: string;
36
- granted: boolean;
37
- scope: {
38
- readonly id: string;
39
- readonly kind: "project" | "workspace";
40
- };
41
- }, never, import("effect/Crypto").Crypto>;
42
- export declare const POOL_SET_OPTIONS: ReadonlySet<string>;
43
- export declare const readPoolPreview: (parsed: ParsedOptions) => Effect.Effect<{
44
- commandId: string;
45
- members: readonly string[];
46
- mode: PoolMode;
47
- scope: {
48
- readonly id: string;
49
- readonly kind: "project" | "workspace";
50
- };
51
- }, never, import("effect/Crypto").Crypto>;
52
- export {};
53
- //# sourceMappingURL=input.d.ts.map
@@ -1,50 +0,0 @@
1
- export declare const readConnectionCreate: (tokens: readonly string[]) => {
2
- maxConcurrentSessions?: undefined;
3
- commandId: string | undefined;
4
- configRootKind: string;
5
- executor: string;
6
- name: string;
7
- } | {
8
- maxConcurrentSessions: number;
9
- commandId: string | undefined;
10
- configRootKind: string;
11
- executor: string;
12
- name: string;
13
- };
14
- export declare const readConnectionList: (tokens: readonly string[]) => {
15
- limit: number;
16
- afterCursor?: string | undefined;
17
- };
18
- export declare const readConnectionTarget: (tokens: readonly string[]) => {
19
- connectionId: string | undefined;
20
- };
21
- export declare const readConnectionCapacity: (tokens: readonly string[]) => {
22
- maxConcurrentSessions?: undefined;
23
- commandId: string | undefined;
24
- connectionId: string | undefined;
25
- expectedRevision: string;
26
- } | {
27
- maxConcurrentSessions: number;
28
- commandId: string | undefined;
29
- connectionId: string | undefined;
30
- expectedRevision: string;
31
- };
32
- export declare const readConnectionUsage: (tokens: readonly string[]) => {
33
- connection: string;
34
- refresh: boolean;
35
- };
36
- export declare const readConnectionSignin: (tokens: readonly string[]) => {
37
- commandId: string | undefined;
38
- connection: string;
39
- flow: "browser" | "device-code";
40
- };
41
- export declare const readConnectionState: (tokens: readonly string[], state: "disabled" | "enabled") => {
42
- commandId: string | undefined;
43
- connectionId: string | undefined;
44
- expectedRevision: string;
45
- state: "disabled" | "enabled";
46
- };
47
- export declare const readConnectionModels: (tokens: readonly string[]) => {
48
- connectionId: string;
49
- };
50
- //# sourceMappingURL=input.d.ts.map
@@ -1,4 +0,0 @@
1
- import { Effect } from "effect";
2
- import { CliArgumentError, type CommandContext } from "../command-line/index.js";
3
- export declare const signInThroughNode: (tokens: readonly string[], context: CommandContext) => Effect.Effect<number, CliArgumentError | Error, import("effect/Crypto").Crypto>;
4
- //# sourceMappingURL=signin.d.ts.map
@@ -1,2 +0,0 @@
1
- export { CONNECTION_TREE } from "./tree.js";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +0,0 @@
1
- import type { TreeFragment } from "../../command-tree/index.js";
2
- export declare const CONNECTION_TREE: TreeFragment;
3
- //# sourceMappingURL=tree.d.ts.map
@@ -1,11 +0,0 @@
1
- import type { ContainerCreateConfirmResult, ContainerCreatePreviewResult, ContainerIndexListResult, ContainerListResult, ContainerRenameConfirmResult, ContainerRenamePreviewResult, ContainerShowResult } from "@maiaos/sdk";
2
- export type ContainerResult = ContainerCreateConfirmResult | ContainerCreatePreviewResult | ContainerIndexListResult | ContainerListResult | ContainerRenameConfirmResult | ContainerRenamePreviewResult | ContainerShowResult;
3
- export type CliContainerResult = {
4
- readonly command: ContainerResult["method"];
5
- readonly result: ContainerResult;
6
- };
7
- export declare const isContainerResult: (result: {
8
- readonly command: string;
9
- }) => result is CliContainerResult;
10
- export declare const formatContainerResult: ({ result, }: CliContainerResult) => string;
11
- //# sourceMappingURL=format.d.ts.map
@@ -1,2 +0,0 @@
1
- export { type CliContainerResult, type ContainerResult, formatContainerResult, isContainerResult, } from "./format.js";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,7 +0,0 @@
1
- import type { InvocationContextShowResult } from "@maiaos/sdk";
2
- import type { CliNodeEffect, CliNodeOperations } from "../local-node/index.js";
3
- export declare const makeContextClient: (node: CliNodeOperations) => {
4
- showAttachedCurrentContext: () => CliNodeEffect<InvocationContextShowResult>;
5
- showCurrentContext: () => CliNodeEffect<InvocationContextShowResult>;
6
- };
7
- //# sourceMappingURL=client.d.ts.map
@@ -1,3 +0,0 @@
1
- import { type CommandContext, type CommandEffect } from "../command-line/index.js";
2
- export declare const runContextShow: (tokens: readonly string[], context: CommandContext) => CommandEffect;
3
- //# sourceMappingURL=commands.d.ts.map
@@ -1,3 +0,0 @@
1
- export { makeContextClient } from "./client.js";
2
- export { runContextShow } from "./commands.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1,6 +0,0 @@
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
@@ -1,27 +0,0 @@
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
@@ -1,29 +0,0 @@
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
@@ -1,65 +0,0 @@
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
@@ -1,7 +0,0 @@
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
@@ -1,15 +0,0 @@
1
- export type Width = (text: string) => number;
2
- export type Span = readonly [text: string, style?: string];
3
- export type Draw = {
4
- readonly clip: (text: string, size: number) => string;
5
- readonly column: (text: string, size: number) => string;
6
- readonly columns: number;
7
- readonly line: (spans: readonly Span[]) => string;
8
- readonly width: Width;
9
- };
10
- export declare const makeDraw: (options: {
11
- readonly color: boolean;
12
- readonly columns: number;
13
- readonly width: Width;
14
- }) => Draw;
15
- //# sourceMappingURL=draw.d.ts.map
@@ -1,4 +0,0 @@
1
- import type { ScreenSize } from "./terminal.js";
2
- export declare const plainLines: (profile: string) => readonly string[];
3
- export declare const frameLines: (profile: string, size: ScreenSize) => readonly string[];
4
- //# sourceMappingURL=frame.d.ts.map
@@ -1,2 +0,0 @@
1
- export { runDashboard } from "./dashboard.js";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,5 +0,0 @@
1
- export type ModeLedger = readonly string[];
2
- export declare const NO_MODES: ModeLedger;
3
- export declare const observe: (ledger: ModeLedger, chunk: string) => ModeLedger;
4
- export declare const resetBytes: (ledger: ModeLedger) => string;
5
- //# sourceMappingURL=modes.d.ts.map
@@ -1,15 +0,0 @@
1
- import { MaiaClientError } from "@maiaos/sdk";
2
- import type * as Crypto from "effect/Crypto";
3
- import * as Effect from "effect/Effect";
4
- import type * as Scope from "effect/Scope";
5
- import type { CliNodeConnection } from "../local-node/index.js";
6
- export declare const UNANSWERED_BEFORE_LOST = 3;
7
- export type OpenConnection = (scope: Scope.Scope) => Effect.Effect<CliNodeConnection, unknown, Crypto.Crypto>;
8
- export declare const noConnection: (reason: "node_connecting" | "node_unreachable", detail?: string) => MaiaClientError;
9
- export type HeldConnection = {
10
- readonly current: Effect.Effect<CliNodeConnection, MaiaClientError>;
11
- readonly heard: (connection: CliNodeConnection, answered: boolean) => Effect.Effect<void>;
12
- readonly lose: (connection: CliNodeConnection) => Effect.Effect<void>;
13
- };
14
- export declare const holdConnection: (open: OpenConnection) => Effect.Effect<HeldConnection, never, Crypto.Crypto | Scope.Scope>;
15
- //# sourceMappingURL=node-connection.d.ts.map
@@ -1,51 +0,0 @@
1
- import { MaiaClientError } from "@maiaos/sdk";
2
- import * as Duration from "effect/Duration";
3
- import * as Effect from "effect/Effect";
4
- import * as Latch from "effect/Latch";
5
- import * as Ref from "effect/Ref";
6
- import * as Schedule from "effect/Schedule";
7
- const RECONNECT_BACKOFF = Schedule.min([
8
- Schedule.exponential(Duration.seconds(2)),
9
- Schedule.spaced(Duration.seconds(30)),
10
- ]);
11
- export const UNANSWERED_BEFORE_LOST = 3;
12
- export const noConnection = (reason, detail) => new MaiaClientError("transport_failure", "The Node has no live connection; nothing was sent.", { cause: { reason, ...(detail === undefined ? {} : { detail }) } });
13
- const ifHeld = (state) => (connection, change) => Effect.asVoid(Effect.flatten(Ref.modify(state, (held) => "connection" in held && held.connection === connection
14
- ? change(held)
15
- : [Effect.void, held])));
16
- const view = (state) => {
17
- const onHeld = ifHeld(state);
18
- return {
19
- current: Effect.flatMap(Ref.get(state), (held) => "connection" in held
20
- ? Effect.succeed(held.connection)
21
- : Effect.fail(held.failure)),
22
- heard: (connection, answered) => onHeld(connection, (live) => {
23
- const unanswered = answered ? 0 : live.unanswered + 1;
24
- return [
25
- unanswered >= UNANSWERED_BEFORE_LOST ? live.lost.open : Effect.void,
26
- { ...live, unanswered },
27
- ];
28
- }),
29
- lose: (connection) => onHeld(connection, (live) => [live.lost.open, live]),
30
- };
31
- };
32
- const generation = (open, state, attempted) => Effect.scoped(Effect.gen(function* () {
33
- const connection = yield* Effect.flatMap(Effect.scope, open).pipe(Effect.tapError((error) => Ref.set(state, {
34
- failure: noConnection("node_unreachable", error instanceof MaiaClientError ? error.message : undefined),
35
- }).pipe(Effect.andThen(attempted.open))));
36
- const lost = yield* Latch.make();
37
- yield* Ref.set(state, { connection, lost, unanswered: 0 });
38
- yield* attempted.open;
39
- yield* lost.await;
40
- yield* Ref.set(state, { failure: noConnection("node_connecting") });
41
- }));
42
- export const holdConnection = (open) => Effect.gen(function* () {
43
- const state = yield* Ref.make({
44
- failure: noConnection("node_connecting"),
45
- });
46
- const attempted = yield* Latch.make();
47
- yield* Effect.forkScoped(Effect.forever(generation(open, state, attempted).pipe(Effect.retry(RECONNECT_BACKOFF))));
48
- yield* attempted.await;
49
- return view(state);
50
- });
51
- //# sourceMappingURL=node-connection.js.map
@@ -1,6 +0,0 @@
1
- import type * as PiTui from "@earendil-works/pi-tui";
2
- import { type LoadSurface } from "./terminal.js";
3
- type Library = Pick<typeof PiTui, "isKeyRelease" | "isKeyRepeat" | "matchesKey" | "ProcessTerminal" | "TuiAltScreen">;
4
- export declare const loadPiTui: (importLibrary?: () => Promise<Library>) => LoadSurface;
5
- export {};
6
- //# sourceMappingURL=pi-tui.d.ts.map
@@ -1,4 +0,0 @@
1
- import type { Draw, Span } from "./draw.js";
2
- import { type Row, type TreeInput } from "./tree-model.js";
3
- export declare const statusBar: (input: TreeInput, rows: readonly Row[], draw: Draw) => readonly Span[];
4
- //# sourceMappingURL=status-bar.d.ts.map
@@ -1,53 +0,0 @@
1
- import type { KeyId } from "@earendil-works/pi-tui";
2
- import * as Context from "effect/Context";
3
- import * as Effect from "effect/Effect";
4
- import * as Layer from "effect/Layer";
5
- export type ScreenSize = {
6
- readonly columns: number;
7
- readonly rows: number;
8
- };
9
- export type Screen = {
10
- readonly quitKeys: readonly KeyId[];
11
- readonly render: (size: ScreenSize) => readonly string[];
12
- };
13
- export type Surface = {
14
- readonly drain: () => Promise<void>;
15
- readonly matches: (input: string, key: KeyId) => boolean;
16
- readonly show: (paint: () => string[], onInput: (input: string) => void) => void;
17
- readonly size: () => ScreenSize;
18
- readonly start: () => void;
19
- readonly stop: () => void;
20
- };
21
- type Write = (chunk: string, callback?: () => void) => unknown;
22
- export type TerminalHost = {
23
- readonly env: Readonly<NodeJS.ProcessEnv>;
24
- readonly kill: (pid: number, signal: "SIGTSTP") => unknown;
25
- readonly off: (event: string, listener: () => void) => unknown;
26
- readonly on: (event: string, listener: () => void) => unknown;
27
- readonly platform: NodeJS.Platform;
28
- readonly stdin: {
29
- readonly isTTY?: boolean;
30
- readonly setRawMode?: (mode: boolean) => unknown;
31
- };
32
- readonly stdout: {
33
- readonly isTTY?: boolean;
34
- write: Write;
35
- };
36
- };
37
- declare const TerminalFailure_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
38
- readonly _tag: "TerminalFailure";
39
- } & Readonly<A>;
40
- export declare class TerminalFailure extends TerminalFailure_base<{
41
- readonly cause?: unknown;
42
- readonly reason: "callback" | "missing" | "no-terminal";
43
- }> {
44
- }
45
- declare const DashboardTerminal_base: Context.ServiceClass<DashboardTerminal, "maia/cli/DashboardTerminal", {
46
- readonly run: (screen: Screen) => Effect.Effect<number, TerminalFailure>;
47
- }>;
48
- export declare class DashboardTerminal extends DashboardTerminal_base {
49
- }
50
- export type LoadSurface = Effect.Effect<Surface, TerminalFailure>;
51
- export declare const terminalLayer: (host: TerminalHost, load: LoadSurface) => Layer.Layer<DashboardTerminal, never, never>;
52
- export {};
53
- //# sourceMappingURL=terminal.d.ts.map
@@ -1,28 +0,0 @@
1
- import { type AttentionReason, type CockpitState } from "@maiaos/client-core/cockpit";
2
- import type { NodeView } from "@maiaos/client-core/node-registry";
3
- import type { Routine } from "@maiaos/sdk";
4
- export type TreeNode = NodeView & Pick<CockpitState, "partial" | "stale">;
5
- export type TreeInput = {
6
- readonly accounts?: ReadonlyMap<string, string>;
7
- readonly nodes: readonly TreeNode[];
8
- readonly now: number;
9
- readonly profile: string;
10
- readonly routines?: readonly Routine[];
11
- readonly state: CockpitState;
12
- };
13
- export type Row = {
14
- readonly at: string;
15
- readonly cells: readonly string[];
16
- readonly children: readonly Row[];
17
- readonly code: string;
18
- readonly depth: number;
19
- readonly id: string;
20
- readonly marker: boolean;
21
- readonly name: string;
22
- };
23
- export declare const ALARM = "1;31";
24
- export declare const WARNING = "33";
25
- export declare const codeStyle: (code: string) => string | undefined;
26
- export declare const attentionStyle: (reason: AttentionReason) => string | undefined;
27
- export declare const treeRows: (input: TreeInput) => readonly Row[];
28
- //# sourceMappingURL=tree-model.d.ts.map
@@ -1,10 +0,0 @@
1
- import { type Width } from "./draw.js";
2
- import type { ScreenSize } from "./terminal.js";
3
- import { type TreeInput } from "./tree-model.js";
4
- export type TreeOptions = {
5
- readonly color: boolean;
6
- readonly width: Width;
7
- };
8
- export declare const tooSmall: ({ columns, rows }: ScreenSize) => string | undefined;
9
- export declare const renderTree: (input: TreeInput, size: ScreenSize, { color, width }: TreeOptions) => readonly string[];
10
- //# sourceMappingURL=tree.d.ts.map
@@ -1,3 +0,0 @@
1
- import * as Effect from "effect/Effect";
2
- export declare const runDevelopmentCli: (arguments_?: readonly string[]) => Effect.Effect<number>;
3
- //# sourceMappingURL=cli.d.ts.map
@@ -1,44 +0,0 @@
1
- import { dirname, join } from "node:path";
2
- import process from "node:process";
3
- import { fileURLToPath, pathToFileURL } from "node:url";
4
- import * as NodeFileSystem from "@effect/platform-node-shared/NodeFileSystem";
5
- import * as Effect from "effect/Effect";
6
- import * as FileSystem from "effect/FileSystem";
7
- import { processIo, runMaiaBootstrap, runProcessMain, } from "../bootstrap/index.js";
8
- import { decodeJsonText } from "../command-line/index.js";
9
- const packageDirectory = dirname(fileURLToPath(import.meta.url));
10
- const invalidManifest = () => new TypeError("The CLI package manifest is invalid.");
11
- const invalidVersion = () => new TypeError("The CLI package version is invalid.");
12
- const manifestVersion = (manifest) => {
13
- if (typeof manifest !== "object" || manifest === null)
14
- return Effect.fail(invalidManifest());
15
- return "version" in manifest &&
16
- typeof manifest.version === "string" &&
17
- manifest.version.length > 0
18
- ? Effect.succeed(manifest.version)
19
- : Effect.fail(invalidVersion());
20
- };
21
- const readPackageVersion = Effect.gen(function* () {
22
- const fileSystem = yield* FileSystem.FileSystem;
23
- const text = yield* fileSystem.readFileString(join(packageDirectory, "../../package.json"));
24
- return yield* manifestVersion(yield* decodeJsonText(text, invalidManifest));
25
- }).pipe(Effect.provide(NodeFileSystem.layer));
26
- const reportStartFailure = (error) => Effect.sync(() => {
27
- const message = error instanceof Error ? error.message : String(error);
28
- process.stderr.write(`${message}\n`);
29
- return 1;
30
- });
31
- export const runDevelopmentCli = (arguments_ = process.argv.slice(2)) => readPackageVersion.pipe(Effect.flatMap((version) => runMaiaBootstrap({
32
- arguments_,
33
- currentNodeVersion: process.versions.node,
34
- expectedNodeVersion: "24.22.1",
35
- io: processIo(),
36
- version,
37
- }, {
38
- loadAgent: () => import("@maiaos/agent"),
39
- loadProductCli: () => import("../index.js"),
40
- })), Effect.catch(reportStartFailure));
41
- if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {
42
- runProcessMain(runDevelopmentCli());
43
- }
44
- //# sourceMappingURL=cli.js.map
@@ -1,11 +0,0 @@
1
- import * as Effect from "effect/Effect";
2
- import { type OutputContext } from "../command-line/emit/index.js";
3
- import type { CliNodeCall } from "../local-node/index.js";
4
- type EventsContext = OutputContext & {
5
- readonly dependencies: {
6
- readonly call?: CliNodeCall;
7
- };
8
- };
9
- export declare const runEventsRead: (tokens: readonly string[], context: EventsContext) => Effect.Effect<number, never, import("effect/Crypto").Crypto>;
10
- export {};
11
- //# sourceMappingURL=commands.d.ts.map
@@ -1,2 +0,0 @@
1
- export { runEventsRead } from "./commands.js";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,2 +0,0 @@
1
- export { EVENTS_TREE } from "./tree.js";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,10 +0,0 @@
1
- declare const events: () => Promise<typeof import("../index.js")>;
2
- export declare const EVENTS_TREE: {
3
- readonly groups: readonly [readonly ["events", "The Node's public events, read by cursor."]];
4
- readonly leaves: readonly [readonly ["events read [--kind <kind>]... [--since <cursor>] [--subject <type>:<id>] [--limit <1..100>]", 1, "events.read", "Read one page of public events after a cursor.", {
5
- readonly example: "maia --json events read --since <cursor> --limit 50";
6
- readonly run: readonly [typeof events, "runEventsRead"];
7
- }]];
8
- };
9
- export {};
10
- //# sourceMappingURL=tree.d.ts.map
@@ -1,2 +0,0 @@
1
- export { EXECUTION_TREE } from "./tree.js";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +0,0 @@
1
- import type { TreeFragment } from "../../command-tree/index.js";
2
- export declare const EXECUTION_TREE: TreeFragment;
3
- //# sourceMappingURL=tree.d.ts.map
@@ -1,11 +0,0 @@
1
- import type { HoldListResult, HoldPlaceConfirmResult, HoldPlacePreviewResult, HoldReleaseConfirmResult, HoldReleasePreviewResult } from "@maiaos/sdk";
2
- export type HoldResult = HoldListResult | HoldPlaceConfirmResult | HoldPlacePreviewResult | HoldReleaseConfirmResult | HoldReleasePreviewResult;
3
- export type CliHoldResult = {
4
- readonly command: HoldResult["method"];
5
- readonly result: HoldResult;
6
- };
7
- export declare const isHoldResult: (result: {
8
- readonly command: string;
9
- }) => result is CliHoldResult;
10
- export declare const formatHoldResult: ({ result }: CliHoldResult) => string;
11
- //# sourceMappingURL=format.d.ts.map