@maiaos/cli 0.1.0-canary.2 → 0.1.0-canary.3
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.
- package/README.md +38 -265
- package/dist/address-space/address-space.d.ts +38 -0
- package/dist/address-space/address-space.js +130 -0
- package/dist/address-space/index.d.ts +2 -0
- package/dist/address-space/index.js +2 -0
- package/dist/agents/client.d.ts +171 -0
- package/dist/agents/client.js +8 -0
- package/dist/agents/commands.d.ts +7 -0
- package/dist/agents/commands.js +65 -0
- package/dist/agents/index.d.ts +3 -0
- package/dist/agents/index.js +3 -0
- package/dist/agents/input.d.ts +130 -0
- package/dist/agents/input.js +99 -0
- package/dist/agents/output/format.d.ts +8 -0
- package/dist/agents/output/format.js +47 -0
- package/dist/agents/output/index.d.ts +2 -0
- package/dist/agents/output/index.js +2 -0
- package/dist/agents/tree/index.d.ts +2 -0
- package/dist/agents/tree/index.js +2 -0
- package/dist/agents/tree/tree.d.ts +3 -0
- package/dist/agents/tree/tree.js +43 -0
- package/dist/bin/maia.cdx.json +37 -14
- package/dist/bin/maia.mjs +1 -1
- package/dist/bootstrap/exit.d.ts +14 -0
- package/dist/bootstrap/exit.js +42 -0
- package/dist/bootstrap/process.js +4 -26
- package/dist/cli/cli.js +70 -13
- package/dist/command-line/context.d.ts +13 -4
- package/dist/command-line/context.js +1 -1
- package/dist/command-line/index.d.ts +5 -5
- package/dist/command-line/index.js +5 -4
- package/dist/command-line/input/index.d.ts +1 -1
- package/dist/command-line/input/index.js +1 -1
- package/dist/command-line/input/stdin.d.ts +1 -0
- package/dist/command-line/input/stdin.js +1 -0
- package/dist/command-line/json.d.ts +1 -0
- package/dist/command-line/json.js +23 -0
- package/dist/command-line/output.d.ts +8 -1
- package/dist/command-line/output.js +33 -14
- package/dist/command-line/rows.d.ts +2 -0
- package/dist/command-line/rows.js +10 -1
- package/dist/command-line/two-phase.d.ts +5 -0
- package/dist/command-line/two-phase.js +33 -8
- package/dist/command-tree/help.d.ts +1 -1
- package/dist/command-tree/help.js +1 -0
- package/dist/command-tree/index.d.ts +2 -2
- package/dist/command-tree/index.js +1 -1
- package/dist/command-tree/local.js +12 -0
- package/dist/command-tree/placeholder.d.ts +1 -0
- package/dist/command-tree/placeholder.js +1 -0
- package/dist/command-tree/row.d.ts +2 -0
- package/dist/command-tree/tree.d.ts +3 -2
- package/dist/command-tree/tree.js +18 -2
- package/dist/connection/client.d.ts +93 -1
- package/dist/connection/client.js +7 -1
- package/dist/connection/index.d.ts +1 -1
- package/dist/connection/index.js +1 -1
- package/dist/connection/system.d.ts +1 -0
- package/dist/connection/system.js +109 -5
- package/dist/connection/tree/tree.js +17 -4
- package/dist/container/output/format.js +1 -2
- package/dist/dashboard/cockpit-client.d.ts +6 -0
- package/dist/dashboard/cockpit-client.js +27 -0
- package/dist/dashboard/cockpits.d.ts +29 -0
- package/dist/dashboard/cockpits.js +65 -0
- package/dist/dashboard/dashboard.d.ts +7 -0
- package/dist/dashboard/dashboard.js +47 -0
- package/dist/dashboard/draw.d.ts +15 -0
- package/dist/dashboard/draw.js +30 -0
- package/dist/dashboard/frame.d.ts +4 -0
- package/dist/dashboard/frame.js +15 -0
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.js +2 -0
- package/dist/dashboard/modes.d.ts +5 -0
- package/dist/dashboard/modes.js +16 -0
- package/dist/dashboard/node-connection.d.ts +15 -0
- package/dist/dashboard/node-connection.js +51 -0
- package/dist/dashboard/pi-tui.d.ts +6 -0
- package/dist/dashboard/pi-tui.js +35 -0
- package/dist/dashboard/status-bar.d.ts +4 -0
- package/dist/dashboard/status-bar.js +60 -0
- package/dist/dashboard/terminal.d.ts +53 -0
- package/dist/dashboard/terminal.js +165 -0
- package/dist/dashboard/tree-model.d.ts +28 -0
- package/dist/dashboard/tree-model.js +97 -0
- package/dist/dashboard/tree.d.ts +10 -0
- package/dist/dashboard/tree.js +76 -0
- package/dist/fleet/fleet.d.ts +70 -0
- package/dist/fleet/fleet.js +91 -0
- package/dist/fleet/index.d.ts +2 -0
- package/dist/fleet/index.js +2 -0
- package/dist/hold/output/format.js +1 -5
- package/dist/hold/tree/tree.js +1 -0
- package/dist/import/commands.js +3 -4
- package/dist/import/output.js +1 -4
- package/dist/local-node/client.d.ts +8 -4
- package/dist/local-node/client.js +20 -9
- package/dist/local-node/index.d.ts +1 -1
- package/dist/local-node/index.js +1 -1
- package/dist/login/commands.js +2 -1
- package/dist/mcp/calls.d.ts +1 -0
- package/dist/mcp/calls.js +36 -3
- package/dist/mcp/commands.d.ts +5 -2
- package/dist/mcp/commands.js +30 -4
- package/dist/mcp/routing.d.ts +24 -0
- package/dist/mcp/routing.js +188 -0
- package/dist/mcp/server.d.ts +13 -4
- package/dist/mcp/server.js +35 -12
- package/dist/presentation/output/format.js +4 -3
- package/dist/project-guard/commands.js +11 -2
- package/dist/project-workspace/commands.js +16 -6
- package/dist/project-workspace/output/human.d.ts +13 -0
- package/dist/project-workspace/output/human.js +17 -5
- package/dist/project-workspace/output/index.d.ts +1 -1
- package/dist/project-workspace/output/index.js +1 -1
- package/dist/project-workspace/output/metadata.js +1 -1
- package/dist/project-workspace/tree/tree.js +27 -12
- package/dist/reference/commands.js +4 -2
- package/dist/reference/index.d.ts +1 -1
- package/dist/reference/index.js +1 -1
- package/dist/reference/resolve.d.ts +2 -0
- package/dist/reference/resolve.js +20 -17
- package/dist/remote-node/client.d.ts +89 -9
- package/dist/remote-node/client.js +6 -1
- package/dist/remote-node/commands.d.ts +9 -0
- package/dist/remote-node/commands.js +96 -18
- package/dist/remote-node/connector.d.ts +12 -4
- package/dist/remote-node/connector.js +46 -25
- package/dist/remote-node/index.d.ts +2 -2
- package/dist/remote-node/index.js +2 -2
- package/dist/remote-node/reachability.d.ts +43 -1
- package/dist/remote-node/reachability.js +13 -3
- package/dist/remote-node/text.d.ts +2 -1
- package/dist/remote-node/text.js +74 -27
- package/dist/remote-node/tree/tree.js +21 -1
- package/dist/routine/client.d.ts +398 -0
- package/dist/routine/client.js +28 -0
- package/dist/routine/commands.d.ts +9 -0
- package/dist/routine/commands.js +109 -0
- package/dist/routine/index.d.ts +3 -0
- package/dist/routine/index.js +3 -0
- package/dist/routine/input.d.ts +28 -0
- package/dist/routine/input.js +44 -0
- package/dist/routine/output/format.d.ts +23 -0
- package/dist/routine/output/format.js +83 -0
- package/dist/routine/output/index.d.ts +2 -0
- package/dist/routine/output/index.js +2 -0
- package/dist/routine/tree/index.d.ts +2 -0
- package/dist/routine/tree/index.js +2 -0
- package/dist/routine/tree/tree.d.ts +3 -0
- package/dist/routine/tree/tree.js +70 -0
- package/dist/session/agent-permission.d.ts +2 -2
- package/dist/session/approval/commands.js +24 -6
- package/dist/session/approval/output/format.d.ts +11 -0
- package/dist/session/approval/output/format.js +8 -0
- package/dist/session/approval/output/index.d.ts +1 -1
- package/dist/session/approval/output/index.js +1 -1
- package/dist/session/attach-client.d.ts +1 -1
- package/dist/session/attach-client.js +12 -3
- package/dist/session/attach-render.js +15 -7
- package/dist/session/attach.js +17 -3
- package/dist/session/client.d.ts +4 -2
- package/dist/session/client.js +4 -15
- package/dist/session/commands.js +76 -9
- package/dist/session/create-tasks.js +29 -11
- package/dist/session/index.d.ts +1 -1
- package/dist/session/index.js +1 -0
- package/dist/session/interaction/output/format.js +2 -1
- package/dist/session/output/diff.js +3 -10
- package/dist/session/output/failure.js +3 -10
- package/dist/session/output/human.js +21 -10
- package/dist/session/output/index.d.ts +1 -1
- package/dist/session/output/index.js +1 -1
- package/dist/session/output/tasks.d.ts +16 -1
- package/dist/session/output/tasks.js +41 -27
- package/dist/session/tree/tree.js +56 -8
- package/dist/session/turn/client.d.ts +4 -1
- package/dist/session/turn/client.js +15 -2
- package/dist/session/turn/commands.d.ts +2 -0
- package/dist/session/turn/commands.js +38 -5
- package/dist/session/turn/index.d.ts +3 -3
- package/dist/session/turn/index.js +1 -1
- package/dist/session/turn/output.d.ts +7 -2
- package/dist/session/turn/output.js +36 -13
- package/dist/status/client.d.ts +7 -2
- package/dist/status/output/compact.d.ts +1 -0
- package/dist/status/output/compact.js +3 -0
- package/dist/status/output/human.d.ts +1 -1
- package/dist/status/output/human.js +71 -14
- package/dist/team-workspace/ceremony.d.ts +19 -0
- package/dist/team-workspace/ceremony.js +141 -0
- package/dist/team-workspace/client.d.ts +58 -0
- package/dist/team-workspace/client.js +6 -0
- package/dist/team-workspace/commands.d.ts +3 -0
- package/dist/team-workspace/commands.js +85 -0
- package/dist/team-workspace/confirmation.d.ts +4 -0
- package/dist/team-workspace/confirmation.js +8 -0
- package/dist/team-workspace/dependencies.d.ts +8 -0
- package/dist/team-workspace/dependencies.js +2 -0
- package/dist/team-workspace/index.d.ts +6 -0
- package/dist/team-workspace/index.js +5 -0
- package/dist/team-workspace/launcher.d.ts +17 -0
- package/dist/team-workspace/launcher.js +30 -0
- package/dist/team-workspace/output.d.ts +15 -0
- package/dist/team-workspace/output.js +28 -0
- package/dist/team-workspace/terminal.d.ts +9 -0
- package/dist/team-workspace/terminal.js +46 -0
- package/dist/terminal/client.d.ts +4 -0
- package/dist/terminal/client.js +3 -0
- package/dist/terminal/commands.js +37 -25
- package/dist/terminal/output/compact-list.d.ts +1 -0
- package/dist/terminal/output/compact-list.js +1 -0
- package/dist/terminal/output/human.d.ts +2 -19
- package/dist/terminal/output/human.js +6 -6
- package/dist/terminal/tree/tree.js +15 -15
- package/package.json +8 -6
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
type Output = {
|
|
3
|
+
readonly on: (event: "close" | "error", listener: () => void) => unknown;
|
|
4
|
+
readonly writableLength: number;
|
|
5
|
+
readonly write: (chunk: string, callback?: () => void) => unknown;
|
|
6
|
+
};
|
|
7
|
+
type ExitingProcess = {
|
|
8
|
+
readonly exit: (code: number) => void;
|
|
9
|
+
readonly stderr: Output;
|
|
10
|
+
readonly stdout: Output;
|
|
11
|
+
};
|
|
12
|
+
export declare const exitAfterOutput: (program: Effect.Effect<number>, host: ExitingProcess) => Effect.Effect<void>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=exit.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as Cause from "effect/Cause";
|
|
2
|
+
import * as Deferred from "effect/Deferred";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Exit from "effect/Exit";
|
|
5
|
+
import * as Fiber from "effect/Fiber";
|
|
6
|
+
const EXIT_INTERRUPTED = 130;
|
|
7
|
+
const watch = (output) => Effect.gen(function* () {
|
|
8
|
+
const ended = yield* Deferred.make();
|
|
9
|
+
const end = () => {
|
|
10
|
+
Deferred.doneUnsafe(ended, Effect.succeed(true));
|
|
11
|
+
};
|
|
12
|
+
output.on("error", end);
|
|
13
|
+
output.on("close", end);
|
|
14
|
+
const flushed = Effect.callback((resume) => {
|
|
15
|
+
if (output.writableLength === 0) {
|
|
16
|
+
resume(Effect.succeed(true));
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
output.write("", () => {
|
|
20
|
+
resume(Effect.succeed(true));
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
return Effect.raceFirst(Deferred.await(ended), flushed);
|
|
24
|
+
});
|
|
25
|
+
const exitCode = (exit, stderr) => {
|
|
26
|
+
if (Exit.isSuccess(exit))
|
|
27
|
+
return exit.value;
|
|
28
|
+
if (Cause.hasInterruptsOnly(exit.cause))
|
|
29
|
+
return EXIT_INTERRUPTED;
|
|
30
|
+
stderr.write(`${Cause.pretty(exit.cause)}\n`);
|
|
31
|
+
return 1;
|
|
32
|
+
};
|
|
33
|
+
export const exitAfterOutput = (program, host) => Effect.gen(function* () {
|
|
34
|
+
const drains = [yield* watch(host.stdout), yield* watch(host.stderr)];
|
|
35
|
+
const running = yield* Effect.forkChild(program, {
|
|
36
|
+
startImmediately: true,
|
|
37
|
+
});
|
|
38
|
+
const code = exitCode(yield* Fiber.await(running), host.stderr);
|
|
39
|
+
yield* Effect.all(drains, { concurrency: "unbounded", discard: true });
|
|
40
|
+
host.exit(code);
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=exit.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import process from "node:process";
|
|
2
|
-
import * as Cause from "effect/Cause";
|
|
3
2
|
import * as Effect from "effect/Effect";
|
|
4
|
-
import
|
|
3
|
+
import { constVoid } from "effect/Function";
|
|
5
4
|
import * as Runtime from "effect/Runtime";
|
|
6
5
|
import { promptLine, terminalIsInteractive, } from "../command-line/input/index.js";
|
|
6
|
+
import { exitAfterOutput } from "./exit.js";
|
|
7
7
|
const readProcessStdin = (request) => Effect.promise(() => import("./stdio.js")).pipe(Effect.flatMap((stdio) => stdio.readStdin(request)));
|
|
8
8
|
export const processIo = () => ({
|
|
9
9
|
interactive: terminalIsInteractive(),
|
|
@@ -16,30 +16,8 @@ export const processIo = () => ({
|
|
|
16
16
|
process.stdout.write(text);
|
|
17
17
|
},
|
|
18
18
|
});
|
|
19
|
-
const
|
|
20
|
-
const runMain = Runtime.makeRunMain(({ fiber, teardown }) => {
|
|
21
|
-
fiber.addObserver((exit) => {
|
|
22
|
-
teardown(exit, (code) => {
|
|
23
|
-
process.exitCode = code;
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
});
|
|
19
|
+
const runMain = Runtime.makeRunMain(constVoid);
|
|
27
20
|
export const runProcessMain = (program) => {
|
|
28
|
-
runMain(program, {
|
|
29
|
-
disableErrorReporting: true,
|
|
30
|
-
teardown: (exit, onExit) => {
|
|
31
|
-
if (Exit.isSuccess(exit) && typeof exit.value === "number") {
|
|
32
|
-
onExit(exit.value);
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
if (Exit.isFailure(exit) && Cause.hasInterruptsOnly(exit.cause)) {
|
|
36
|
-
onExit(EXIT_INTERRUPTED);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
if (Exit.isFailure(exit))
|
|
40
|
-
process.stderr.write(`${Cause.pretty(exit.cause)}\n`);
|
|
41
|
-
onExit(1);
|
|
42
|
-
},
|
|
43
|
-
});
|
|
21
|
+
runMain(exitAfterOutput(program, process), { disableErrorReporting: true });
|
|
44
22
|
};
|
|
45
23
|
//# sourceMappingURL=process.js.map
|
package/dist/cli/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Cause from "effect/Cause";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
|
-
import { argumentsAreBounded, CliArgumentError, parseArguments, readGlobalValue, reportError, writeSuccess, } from "../command-line/index.js";
|
|
3
|
+
import { argumentsAreBounded, CliArgumentError, LOCAL_NODE, parseArguments, readGlobalValue, reportError, writeSuccess, } from "../command-line/index.js";
|
|
4
4
|
import { createHelpTree, createNodeHelp, findNode, formatNodeHelp, formatRootHelp, isNodeBacked, REFERENCE_USAGE, unknownPathMessage, usageHint, } from "../command-tree/index.js";
|
|
5
5
|
const createArgumentError = (message) => ({
|
|
6
6
|
code: "invalid_argument",
|
|
@@ -64,17 +64,23 @@ const resolveOptions = (parsed, leaf, environment) => {
|
|
|
64
64
|
...(profile === undefined ? {} : { profile }),
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
|
+
const remoteName = (parsed) => parsed.node === LOCAL_NODE ? undefined : parsed.node;
|
|
67
68
|
const resolveInvocationDependencies = (source, parsed, scope) => {
|
|
69
|
+
const name = remoteName(parsed);
|
|
68
70
|
if (typeof source !== "function") {
|
|
69
|
-
if (parsed.profile !== undefined ||
|
|
71
|
+
if (parsed.profile !== undefined || name !== undefined)
|
|
70
72
|
throw new CliArgumentError("This CLI dependency binding does not support '--profile' or '--node'.");
|
|
71
73
|
return source;
|
|
72
74
|
}
|
|
73
|
-
return
|
|
75
|
+
return name === undefined || scope === undefined
|
|
74
76
|
? source(parsed.profile)
|
|
75
|
-
: source(parsed.profile, { name
|
|
77
|
+
: source(parsed.profile, { name, scope });
|
|
76
78
|
};
|
|
79
|
+
const nodeBinder = (source, profile, scope) => typeof source === "function" && scope !== undefined
|
|
80
|
+
? { bindNode: (name) => source(profile, { name, scope }) }
|
|
81
|
+
: {};
|
|
77
82
|
const commandContext = (input, parsed, scope) => ({
|
|
83
|
+
...nodeBinder(input.dependencies, parsed.profile, scope),
|
|
78
84
|
dependencies: resolveInvocationDependencies(input.dependencies, parsed, scope),
|
|
79
85
|
io: parsed.noInput ? { ...input.io, interactive: false } : input.io,
|
|
80
86
|
json: parsed.json,
|
|
@@ -132,11 +138,11 @@ const leafProgram = (leaf, rest, context) => {
|
|
|
132
138
|
});
|
|
133
139
|
};
|
|
134
140
|
const withCliServices = (program) => Effect.promise(() => import("./services.js")).pipe(Effect.flatMap((services) => services.provideCliServices(program)));
|
|
135
|
-
const
|
|
141
|
+
const runPrepared = (leaf, rest, context) => {
|
|
136
142
|
const usage = leaf.forms[0]?.usage ?? "";
|
|
137
143
|
if (!REFERENCE_USAGE.test(usage) || context.dependencies.call === undefined)
|
|
138
|
-
return
|
|
139
|
-
|
|
144
|
+
return leafProgram(leaf, rest, context);
|
|
145
|
+
return Effect.promise(() => import("../reference/index.js")).pipe(Effect.flatMap((module) => module.prepareLeaf({
|
|
140
146
|
context,
|
|
141
147
|
cwd: module.workingFolder(context.io.cwd),
|
|
142
148
|
tokens: rest,
|
|
@@ -144,7 +150,18 @@ const runResolved = (leaf, rest, context) => {
|
|
|
144
150
|
})), Effect.flatMap((prepared) => prepared.ok
|
|
145
151
|
? leafProgram(leaf, prepared.tokens, prepared.context)
|
|
146
152
|
: Effect.succeed(prepared.exitCode)));
|
|
147
|
-
|
|
153
|
+
};
|
|
154
|
+
const runResolved = (leaf, rest, context) => {
|
|
155
|
+
const { forms, route } = leaf;
|
|
156
|
+
const prepared = (bound) => runPrepared(leaf, rest, bound);
|
|
157
|
+
if (route === undefined)
|
|
158
|
+
return withCliServices(prepared(context));
|
|
159
|
+
const routed = {
|
|
160
|
+
argument: route,
|
|
161
|
+
tokens: rest,
|
|
162
|
+
usage: forms[0]?.usage ?? "",
|
|
163
|
+
};
|
|
164
|
+
return withCliServices(Effect.flatMap(Effect.promise(() => import("../address-space/index.js")), (module) => module.routeLeaf(context, routed, prepared)));
|
|
148
165
|
};
|
|
149
166
|
const runParsed = (input, parsed) => {
|
|
150
167
|
if (isHelpInvocation(parsed))
|
|
@@ -157,9 +174,7 @@ const runParsed = (input, parsed) => {
|
|
|
157
174
|
!parsed.json)
|
|
158
175
|
input.io.stderr(`node: ${resolved.node} (MAIA_NODE)\n`);
|
|
159
176
|
const run = (scope) => Effect.suspend(() => runResolved(leaf, rest, commandContext(input, resolved, scope)));
|
|
160
|
-
return yield*
|
|
161
|
-
? run()
|
|
162
|
-
: Effect.scoped(Effect.flatMap(Effect.scope, run));
|
|
177
|
+
return yield* Effect.scoped(Effect.flatMap(Effect.scope, run));
|
|
163
178
|
});
|
|
164
179
|
};
|
|
165
180
|
const executeCli = (input) => Effect.suspend(() => {
|
|
@@ -185,6 +200,7 @@ const loadStatus = () => import("../status/index.js");
|
|
|
185
200
|
const loadContext = () => import("../context/index.js");
|
|
186
201
|
const loadContainer = () => import("../container/index.js");
|
|
187
202
|
const loadHold = () => import("../hold/index.js");
|
|
203
|
+
const loadRoutine = () => import("../routine/index.js");
|
|
188
204
|
const loadImport = () => import("../import/index.js");
|
|
189
205
|
const loadInteraction = () => import("../session/interaction/index.js");
|
|
190
206
|
const loadConnection = () => import("../connection/index.js");
|
|
@@ -196,7 +212,9 @@ const loadApproval = () => import("../session/approval/index.js");
|
|
|
196
212
|
const loadRemoteNode = () => import("../remote-node/index.js");
|
|
197
213
|
const loadRunLedger = () => import("../run-ledger/index.js");
|
|
198
214
|
const loadProjectGuard = () => import("../project-guard/index.js");
|
|
215
|
+
const loadAgents = () => import("../agents/index.js");
|
|
199
216
|
const loadLocalNode = () => import("../local-node/index.js");
|
|
217
|
+
const loadBootstrap = () => import("../team-workspace/index.js");
|
|
200
218
|
const lazyDependencies = (load, makeClient, binding) => Object.fromEntries(binding.names.map((name) => [
|
|
201
219
|
name,
|
|
202
220
|
(...arguments_) => Effect.promise(() => import("../local-node/index.js")).pipe(Effect.flatMap((module) => module.runLazyNodeDependency({
|
|
@@ -249,6 +267,9 @@ const makeDefaultCliDependencies = (binding) => ({
|
|
|
249
267
|
"detectConnections",
|
|
250
268
|
"previewSystemConnections",
|
|
251
269
|
"confirmSystemConnections",
|
|
270
|
+
"refreshConnectionUpkeep",
|
|
271
|
+
"previewConnectionUpkeep",
|
|
272
|
+
"confirmConnectionUpkeep",
|
|
252
273
|
],
|
|
253
274
|
}),
|
|
254
275
|
...lazyDependencies(loadInteraction, (module, node) => module.makeInteractionClient(node), {
|
|
@@ -292,6 +313,21 @@ const makeDefaultCliDependencies = (binding) => ({
|
|
|
292
313
|
"confirmHoldRelease",
|
|
293
314
|
],
|
|
294
315
|
}),
|
|
316
|
+
...lazyDependencies(loadRoutine, (module, node) => module.makeRoutineCliClient(node), {
|
|
317
|
+
...binding,
|
|
318
|
+
names: [
|
|
319
|
+
"listRoutines",
|
|
320
|
+
"showRoutine",
|
|
321
|
+
"previewRoutineCreate",
|
|
322
|
+
"confirmRoutineCreate",
|
|
323
|
+
"pauseRoutine",
|
|
324
|
+
"resumeRoutine",
|
|
325
|
+
"previewRoutineDisable",
|
|
326
|
+
"confirmRoutineDisable",
|
|
327
|
+
"previewRoutineRun",
|
|
328
|
+
"confirmRoutineRun",
|
|
329
|
+
],
|
|
330
|
+
}),
|
|
295
331
|
...lazyDependencies(() => import("../project-workspace/index.js"), (module, node) => module.makeProjectMetadataClient(node), {
|
|
296
332
|
...binding,
|
|
297
333
|
names: [
|
|
@@ -401,7 +437,14 @@ const makeDefaultCliDependencies = (binding) => ({
|
|
|
401
437
|
}),
|
|
402
438
|
...lazyDependencies(loadTurn, (module, node) => module.makeTurnClient(node), {
|
|
403
439
|
...binding,
|
|
404
|
-
names: [
|
|
440
|
+
names: [
|
|
441
|
+
"cancelTurn",
|
|
442
|
+
"interruptTurn",
|
|
443
|
+
"listTurnQueue",
|
|
444
|
+
"sendTurn",
|
|
445
|
+
"showTurn",
|
|
446
|
+
"waitTurns",
|
|
447
|
+
],
|
|
405
448
|
}),
|
|
406
449
|
...lazyDependencies(loadContext, (module, node) => module.makeContextClient(node), { ...binding, names: ["showAttachedCurrentContext", "showCurrentContext"] }),
|
|
407
450
|
...lazyDependencies(loadApproval, (module, node) => module.makeApprovalClient(node), {
|
|
@@ -432,20 +475,34 @@ const makeDefaultCliDependencies = (binding) => ({
|
|
|
432
475
|
...binding,
|
|
433
476
|
names: ["confirmProjectGuard", "previewProjectGuard", "showProjectGuard"],
|
|
434
477
|
}),
|
|
478
|
+
...lazyDependencies(loadAgents, (module, node) => module.makeAgentsClient(node), {
|
|
479
|
+
...binding,
|
|
480
|
+
names: [
|
|
481
|
+
"confirmAgentChange",
|
|
482
|
+
"listAgents",
|
|
483
|
+
"previewAgentChange",
|
|
484
|
+
"showAgent",
|
|
485
|
+
],
|
|
486
|
+
}),
|
|
435
487
|
...lazyDependencies(loadRemoteNode, (module, node) => module.makeRemoteNodeClient(node), {
|
|
436
488
|
...binding,
|
|
437
489
|
names: [
|
|
438
490
|
"confirmRemoteNodeInstall",
|
|
491
|
+
"confirmRemoteNodeRegister",
|
|
439
492
|
"confirmRemoteNodeRemove",
|
|
440
493
|
"listRemoteNodes",
|
|
441
494
|
"previewRemoteNodeInstall",
|
|
495
|
+
"previewRemoteNodeRegister",
|
|
442
496
|
"previewRemoteNodeRemove",
|
|
443
497
|
],
|
|
444
498
|
}),
|
|
445
499
|
...lazyDependencies(loadLocalNode, (module, node) => module.makeCallClient(node), { ...binding, names: ["call"] }),
|
|
500
|
+
...lazyDependencies(loadBootstrap, (module, node) => module.makeBootstrapClient(node), { ...binding, names: ["applyBootstrap", "previewBootstrap"] }),
|
|
501
|
+
confirmOnTerminal: (request) => Effect.promise(loadBootstrap).pipe(Effect.flatMap((module) => module.confirmOnControllingTerminal(request))),
|
|
502
|
+
startBootstrapNode: (profile) => Effect.promise(loadBootstrap).pipe(Effect.flatMap((module) => module.startBootstrapNode(profile))),
|
|
446
503
|
...lazyDependencies(loadMcp, (module, node) => module.makeMcpClient(node), {
|
|
447
504
|
...binding,
|
|
448
|
-
names: ["serveMcp"],
|
|
505
|
+
names: ["callCoordinatorTool", "serveMcp"],
|
|
449
506
|
}),
|
|
450
507
|
...lazyDependencies(loadStatus, (module, node) => module.makeStatusClient(node), { ...binding, names: ["createMonitorBootstrap", "readStatus"] }),
|
|
451
508
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { AgentPermissionConfirmParameters, AgentPermissionConfirmResult, AgentPermissionPreviewParameters, AgentPermissionPreviewResult, ExecutionCatalogGetResult, ExecutionCommandRunResult, ExecutionFileReadResult, ExecutionPlacementCreateResult, ExecutionPlacementShowResult, ExecutionRelocationApplyResult, ExecutionRelocationPlanResult, ExecutionRelocationReconcileResult, ExecutionRelocationShowResult, ExecutionWorktreeCheckpointCreateResult, ExecutionWorktreeCheckpointShowResult, ExecutionWorktreeCreateResult, ExecutionWorktreeImportResult, ExecutionWorktreeReconcileResult, ExecutionWorktreeRemoveApplyResult, ExecutionWorktreeRemovePlanResult, ExecutionWorktreeStatusResult, InvocationContextShowResult, LiveTerminalCloseResult, LiveTerminalControllerAcquireResult, LiveTerminalControllerReleaseResult, LiveTerminalControllerRequestResult, LiveTerminalControllerRequestShowResult, LiveTerminalResizeResult, LiveTerminalSignalResult, LiveTerminalWriteResult, LocalNodeStatusResult, MonitorBootstrapCreateResult, OrchestrationDispatchSettleTerminalResult, OrchestrationDispatchShowResult, OrchestrationInboxAckResult, OrchestrationInboxCheckResult, OrchestrationQuestionCancelResult, OrchestrationQuestionOpenResult, OrchestrationQuestionReplyResult, OrchestrationRunCreateResult, OrchestrationRunListResult, OrchestrationRunShowResult, OrchestrationTaskListResult, OrchestrationTaskShowResult, ProjectContextListResult, ProjectContextRecordResult, ProjectContextShowResult, ProjectListResult, ProjectRegisterResult, ProjectShowResult, ProviderPoolListResult, ReceiptGetResult, ReceiptListParameters, ReceiptListResult, SessionArchiveResult, SessionCreateResult, SessionDiffResult, SessionEventsListResult, SessionInboxAckResult, SessionInboxCheckResult, SessionListResult, SessionMessageSendResult, SessionObserveResult, SessionResumeResult, SessionShowResult, SessionStartResult, SessionStopResult, TerminalCreateResult, TerminalEventsListResult, TerminalListResult, TerminalReadResult, TerminalShowResult, TurnInterruptResult, TurnSendResult, TurnShowResult, TurnWaitResult, WorkspaceContextShowResult, WorkspaceExecutionConfigureResult, WorkspaceExecutionShowResult, WorkspaceListResult, WorkspaceMembershipAttachResult, WorkspaceRepositoryAttachResult, WorkspaceSelectResult, WorkspaceShowResult } from "@maiaos/sdk";
|
|
1
|
+
import type { AgentPermissionConfirmParameters, AgentPermissionConfirmResult, AgentPermissionPreviewParameters, AgentPermissionPreviewResult, ExecutionCatalogGetResult, ExecutionCommandRunResult, ExecutionFileReadResult, ExecutionPlacementCreateResult, ExecutionPlacementShowResult, ExecutionRelocationApplyResult, ExecutionRelocationPlanResult, ExecutionRelocationReconcileResult, ExecutionRelocationShowResult, ExecutionWorktreeCheckpointCreateResult, ExecutionWorktreeCheckpointShowResult, ExecutionWorktreeCreateResult, ExecutionWorktreeImportResult, ExecutionWorktreeReconcileResult, ExecutionWorktreeRemoveApplyResult, ExecutionWorktreeRemovePlanResult, ExecutionWorktreeStatusResult, InvocationContextShowResult, LiveTerminalCloseResult, LiveTerminalControllerAcquireResult, LiveTerminalControllerReleaseResult, LiveTerminalControllerRequestResult, LiveTerminalControllerRequestShowResult, LiveTerminalResizeResult, LiveTerminalSignalResult, LiveTerminalWriteResult, LocalNodeStatusResult, MonitorBootstrapCreateResult, OrchestrationDispatchSettleTerminalResult, OrchestrationDispatchShowResult, OrchestrationInboxAckResult, OrchestrationInboxCheckResult, OrchestrationQuestionCancelResult, OrchestrationQuestionOpenResult, OrchestrationQuestionReplyResult, OrchestrationRunCreateResult, OrchestrationRunListResult, OrchestrationRunShowResult, OrchestrationTaskListResult, OrchestrationTaskShowResult, ProjectContextListResult, ProjectContextRecordResult, ProjectContextShowResult, ProjectListResult, ProjectRegisterResult, ProjectShowResult, ProviderPoolListResult, ReceiptGetResult, ReceiptListParameters, ReceiptListResult, SessionArchiveResult, SessionCreateResult, SessionDiffResult, SessionEventsListResult, SessionInboxAckResult, SessionInboxCheckResult, SessionListResult, SessionMessageSendResult, SessionObserveResult, SessionResumeResult, SessionShowResult, SessionStartResult, SessionStopResult, TerminalCreateResult, TerminalEventsListResult, TerminalListResult, TerminalReadResult, TerminalShowResult, TurnCancelResult, TurnInterruptResult, TurnQueueListResult, TurnSendResult, TurnShowResult, TurnWaitResult, WorkspaceContextShowResult, WorkspaceExecutionConfigureResult, WorkspaceExecutionShowResult, WorkspaceListResult, WorkspaceMembershipAttachResult, WorkspaceRepositoryAttachResult, WorkspaceSelectResult, WorkspaceShowResult } from "@maiaos/sdk";
|
|
2
2
|
import type * as Crypto from "effect/Crypto";
|
|
3
3
|
import type * as Effect from "effect/Effect";
|
|
4
|
+
import type { AgentsCliDependencies } from "../agents/index.js";
|
|
4
5
|
import type { ConnectionCliDependencies, VendorLogin } from "../connection/index.js";
|
|
5
6
|
import type { ContainerCliDependencies } from "../container/index.js";
|
|
6
7
|
import type { ApplyExecutionRelocationInput, PlanExecutionRelocationInput, ReconcileExecutionRelocationInput } from "../execution/index.js";
|
|
@@ -15,19 +16,21 @@ import type { PortLeaseCliDependencies } from "../port-lease/index.js";
|
|
|
15
16
|
import type { PresentationCliDependencies } from "../presentation/index.js";
|
|
16
17
|
import type { ProjectGuardCliDependencies } from "../project-guard/index.js";
|
|
17
18
|
import type { AttachRepositoryInput, AttachWorkspaceMembershipInput, ConfigureWorkspaceExecutionInput, CreateExecutionCheckpointInput, CreateExecutionPlacementInput, CreateExecutionWorktreeInput, ImportExecutionWorktreeInput, ProjectMetadataCliDependencies, ReadExecutionFileInput, ReconcileExecutionWorktreeInput, RecordProjectContextInput, RegisterProjectInput, RemoveExecutionWorktreeInput, RunExecutionCommandInput, SelectWorkspaceInput } from "../project-workspace/index.js";
|
|
18
|
-
import type { RemoteNodeCliDependencies } from "../remote-node/index.js";
|
|
19
|
+
import type { RemoteNodeCliDependencies, SshLayer } from "../remote-node/index.js";
|
|
20
|
+
import type { RoutineCliDependencies } from "../routine/index.js";
|
|
19
21
|
import type { RunLedgerCliDependencies } from "../run-ledger/index.js";
|
|
20
22
|
import type { ApprovalCliDependencies } from "../session/approval/index.js";
|
|
21
23
|
import type { ArchiveSessionInput, AttachSessionInput, CreateSessionInput, DiffSessionInput, ListSessionsInput, makeSessionClient, SessionAttachStream, StartSessionInput } from "../session/index.js";
|
|
22
24
|
import type { InteractionCliDependencies } from "../session/interaction/index.js";
|
|
23
|
-
import type { InterruptTurnInput, SendTurnInput, WaitTurnsInput } from "../session/turn/index.js";
|
|
25
|
+
import type { CancelTurnInput, InterruptTurnInput, SendTurnInput, WaitTurnsInput } from "../session/turn/index.js";
|
|
26
|
+
import type { BootstrapCliDependencies } from "../team-workspace/index.js";
|
|
24
27
|
import type { CreateTerminalInput, makeTerminalClient } from "../terminal/index.js";
|
|
25
28
|
import type { CliArgumentError } from "./input/index.js";
|
|
26
29
|
import type { CliIo, CliResolution } from "./output.js";
|
|
27
30
|
type OrchestrationClient = ReturnType<typeof makeOrchestrationClient>;
|
|
28
31
|
type SessionClient = ReturnType<typeof makeSessionClient>;
|
|
29
32
|
type TerminalClient = ReturnType<typeof makeTerminalClient>;
|
|
30
|
-
export type CliDependencies = Partial<ApprovalCliDependencies & ConnectionCliDependencies & ContainerCliDependencies & HoldCliDependencies & DiscoveryCliDependencies & IntegrationCliDependencies & PresentationCliDependencies & McpCliDependencies & InteractionCliDependencies & PortLeaseCliDependencies & ProjectGuardCliDependencies & ProjectMetadataCliDependencies & RemoteNodeCliDependencies & RunLedgerCliDependencies> & {
|
|
33
|
+
export type CliDependencies = Partial<AgentsCliDependencies & ApprovalCliDependencies & BootstrapCliDependencies & ConnectionCliDependencies & ContainerCliDependencies & HoldCliDependencies & DiscoveryCliDependencies & IntegrationCliDependencies & PresentationCliDependencies & McpCliDependencies & InteractionCliDependencies & PortLeaseCliDependencies & ProjectGuardCliDependencies & ProjectMetadataCliDependencies & RemoteNodeCliDependencies & RoutineCliDependencies & RunLedgerCliDependencies> & {
|
|
31
34
|
readonly acknowledgeAttachedSessionDelivery?: (input: Parameters<SessionClient["acknowledgeAttachedSessionDelivery"]>[0]) => CliNodeEffect<SessionInboxAckResult>;
|
|
32
35
|
readonly acknowledgeRunDelivery: (input: Parameters<OrchestrationClient["acknowledgeRunDelivery"]>[0]) => CliNodeEffect<OrchestrationInboxAckResult>;
|
|
33
36
|
readonly acquireTerminalController: (input: Parameters<TerminalClient["acquireTerminalController"]>[0]) => CliNodeEffect<LiveTerminalControllerAcquireResult>;
|
|
@@ -40,6 +43,7 @@ export type CliDependencies = Partial<ApprovalCliDependencies & ConnectionCliDep
|
|
|
40
43
|
readonly awaitSessionRunning?: SessionClient["awaitSessionRunning"];
|
|
41
44
|
readonly call?: CliNodeCall;
|
|
42
45
|
readonly cancelRunQuestion: (input: Parameters<OrchestrationClient["cancelRunQuestion"]>[0]) => CliNodeEffect<OrchestrationQuestionCancelResult>;
|
|
46
|
+
readonly cancelTurn?: (input: CancelTurnInput) => CliNodeEffect<TurnCancelResult>;
|
|
43
47
|
readonly checkAttachedSessionInbox?: (input: Parameters<SessionClient["checkAttachedSessionInbox"]>[0]) => CliNodeEffect<SessionInboxCheckResult>;
|
|
44
48
|
readonly checkRunInbox: (input: Parameters<OrchestrationClient["checkRunInbox"]>[0]) => CliNodeEffect<OrchestrationInboxCheckResult>;
|
|
45
49
|
readonly closeTerminal: (input: Parameters<TerminalClient["closeTerminal"]>[0]) => CliNodeEffect<LiveTerminalCloseResult>;
|
|
@@ -93,6 +97,7 @@ export type CliDependencies = Partial<ApprovalCliDependencies & ConnectionCliDep
|
|
|
93
97
|
readonly limit: number;
|
|
94
98
|
readonly workspaceId: string;
|
|
95
99
|
}) => CliNodeEffect<TerminalListResult>;
|
|
100
|
+
readonly listTurnQueue?: (sessionId: string) => CliNodeEffect<TurnQueueListResult>;
|
|
96
101
|
readonly listWorkspaces: (input: {
|
|
97
102
|
readonly afterCursor: string;
|
|
98
103
|
readonly limit: number;
|
|
@@ -158,6 +163,7 @@ export type CliDependencies = Partial<ApprovalCliDependencies & ConnectionCliDep
|
|
|
158
163
|
readonly showWorkspaceContext?: () => CliNodeEffect<WorkspaceContextShowResult>;
|
|
159
164
|
readonly showWorkspaceExecution?: (workspaceId: string) => CliNodeEffect<WorkspaceExecutionShowResult>;
|
|
160
165
|
readonly signalTerminal: (input: Parameters<TerminalClient["signalTerminal"]>[0]) => CliNodeEffect<LiveTerminalSignalResult>;
|
|
166
|
+
readonly sshLayer?: SshLayer;
|
|
161
167
|
readonly startSession: (input: StartSessionInput) => CliNodeEffect<SessionStartResult>;
|
|
162
168
|
readonly stopSession?: (input: StartSessionInput) => CliNodeEffect<SessionStopResult>;
|
|
163
169
|
readonly waitTurns?: (input: WaitTurnsInput) => CliNodeEffect<TurnWaitResult>;
|
|
@@ -165,11 +171,14 @@ export type CliDependencies = Partial<ApprovalCliDependencies & ConnectionCliDep
|
|
|
165
171
|
};
|
|
166
172
|
export type CliServices = Crypto.Crypto;
|
|
167
173
|
export type CommandEffect = Effect.Effect<number, CliArgumentError, CliServices>;
|
|
174
|
+
export declare const LOCAL_NODE = "local";
|
|
168
175
|
export type CommandContext = {
|
|
176
|
+
readonly bindNode?: (name: string) => CliDependencies;
|
|
169
177
|
readonly dependencies: CliDependencies;
|
|
170
178
|
readonly io: CliIo;
|
|
171
179
|
readonly json: boolean;
|
|
172
180
|
readonly node?: string;
|
|
181
|
+
readonly notFoundHint?: string;
|
|
173
182
|
readonly profile?: string;
|
|
174
183
|
readonly resolved?: readonly CliResolution[];
|
|
175
184
|
readonly version: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const LOCAL_NODE = "local";
|
|
2
2
|
//# sourceMappingURL=context.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { type CliDependencies, type CliServices, type CommandContext, type CommandEffect, } from "./context.js";
|
|
1
|
+
export { type CliDependencies, type CliServices, type CommandContext, type CommandEffect, LOCAL_NODE, } from "./context.js";
|
|
2
2
|
export { argumentsAreBounded, type ArgumentToken, CliArgumentError, missingArgument, parseArguments, type ParsedArguments, type ParsedOptions, parseOptions, readBoundedStdin, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readRevisionOption, recoverStdin, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./input/index.js";
|
|
3
|
-
export { decodeJsonText } from "./json.js";
|
|
4
|
-
export { type CliCommandOutput, type CliErrorOutput, type CliIo, type CliResolution, type CliSuccessOutput, type CliSuccessResult, type NodeResultPresenter, reportError, writeNodeResult, writeSuccess, } from "./output.js";
|
|
5
|
-
export { cell, formatRows, tab, withNextPage } from "./rows.js";
|
|
6
|
-
export { askToConfirm, canPrompt, confirmationOf, confirmParameters, EXIT_CANCELLED, promptOrRefuse, readPipedPreview, readTwoPhaseMode, requestedTwoPhaseMode, runInputTwoPhase, runTwoPhase, TWO_PHASE_FLAGS, type TwoPhaseMode, } from "./two-phase.js";
|
|
3
|
+
export { decodeJsonText, jsonLine } from "./json.js";
|
|
4
|
+
export { type CliCommandOutput, type CliErrorOutput, type CliIo, type CliResolution, type CliSuccessOutput, type CliSuccessResult, exitCodeOf, type NodeResultPresenter, reportError, writeNodeResult, writeSuccess, } from "./output.js";
|
|
5
|
+
export { block, cell, type CliTable, fields, formatRows, tab, withNextPage, } from "./rows.js";
|
|
6
|
+
export { askToConfirm, canPrompt, confirmationOf, confirmParameters, EXIT_CANCELLED, peekStdin, promptOrRefuse, readInputMode, readPipedPreview, readTwoPhaseMode, requestedTwoPhaseMode, runInputTwoPhase, runTwoPhase, TWO_PHASE_FLAGS, type TwoPhaseMode, } from "./two-phase.js";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export { LOCAL_NODE, } from "./context.js";
|
|
1
2
|
export { argumentsAreBounded, CliArgumentError, missingArgument, parseArguments, parseOptions, readBoundedStdin, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readRevisionOption, recoverStdin, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./input/index.js";
|
|
2
|
-
export { decodeJsonText } from "./json.js";
|
|
3
|
-
export { reportError, writeNodeResult, writeSuccess, } from "./output.js";
|
|
4
|
-
export { cell, formatRows, tab, withNextPage } from "./rows.js";
|
|
5
|
-
export { askToConfirm, canPrompt, confirmationOf, confirmParameters, EXIT_CANCELLED, promptOrRefuse, readPipedPreview, readTwoPhaseMode, requestedTwoPhaseMode, runInputTwoPhase, runTwoPhase, TWO_PHASE_FLAGS, } from "./two-phase.js";
|
|
3
|
+
export { decodeJsonText, jsonLine } from "./json.js";
|
|
4
|
+
export { exitCodeOf, reportError, writeNodeResult, writeSuccess, } from "./output.js";
|
|
5
|
+
export { block, cell, fields, formatRows, tab, withNextPage, } from "./rows.js";
|
|
6
|
+
export { askToConfirm, canPrompt, confirmationOf, confirmParameters, EXIT_CANCELLED, peekStdin, promptOrRefuse, readInputMode, readPipedPreview, readTwoPhaseMode, requestedTwoPhaseMode, runInputTwoPhase, runTwoPhase, TWO_PHASE_FLAGS, } from "./two-phase.js";
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { argumentsAreBounded, type ArgumentToken, CliArgumentError, missingArgument, parseArguments, type ParsedArguments, type ParsedOptions, parseOptions, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readRevisionOption, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./arguments.js";
|
|
2
2
|
export { promptLine, type PromptOptions, terminalIsInteractive, } from "./prompt.js";
|
|
3
|
-
export { type BoundedStdinRequest, readBoundedStdin, recoverStdin, } from "./stdin.js";
|
|
3
|
+
export { type BoundedStdinRequest, readBoundedStdin, recoverStdin, replayStdin, } from "./stdin.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { argumentsAreBounded, CliArgumentError, missingArgument, parseArguments, parseOptions, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readRevisionOption, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./arguments.js";
|
|
2
2
|
export { promptLine, terminalIsInteractive, } from "./prompt.js";
|
|
3
|
-
export { readBoundedStdin, recoverStdin, } from "./stdin.js";
|
|
3
|
+
export { readBoundedStdin, recoverStdin, replayStdin, } from "./stdin.js";
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -7,5 +7,6 @@ export type BoundedStdinRequest = {
|
|
|
7
7
|
readonly maxChunks: number;
|
|
8
8
|
};
|
|
9
9
|
export declare const readBoundedStdin: (input: Stream.Stream<string | Uint8Array, unknown>, request: BoundedStdinRequest) => Effect.Effect<string, CliArgumentError>;
|
|
10
|
+
export declare const replayStdin: (text: string) => (request: BoundedStdinRequest) => Effect.Effect<string, CliArgumentError>;
|
|
10
11
|
export declare const recoverStdin: <TError>(read: Effect.Effect<string, CliArgumentError>, recover: (error: unknown) => TError) => Effect.Effect<string, TError>;
|
|
11
12
|
//# sourceMappingURL=stdin.d.ts.map
|
|
@@ -17,6 +17,7 @@ const decodeUtf8 = (collected) => Effect.try({
|
|
|
17
17
|
});
|
|
18
18
|
const loadStreamFold = () => import("./stdin-stream.js");
|
|
19
19
|
export const readBoundedStdin = (input, request) => Effect.promise(loadStreamFold).pipe(Effect.flatMap(({ foldStream }) => foldStream(input, () => ({ bytes: 0, chunks: [] }), (collected, chunk) => collectChunk(request, collected, chunk))), Effect.flatMap(decodeUtf8));
|
|
20
|
+
export const replayStdin = (text) => (request) => Effect.as(collectChunk(request, { bytes: 0, chunks: [] }, text), text);
|
|
20
21
|
export const recoverStdin = (read, recover) => read.pipe(Effect.catchCause((cause) => Cause.hasInterruptsOnly(cause)
|
|
21
22
|
? Effect.interrupt
|
|
22
23
|
: Effect.fail(recover(Cause.squash(cause)))));
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
|
+
import { isTerminalControl } from "./rows.js";
|
|
2
3
|
const loadDecoder = () => import("./json-decoder.js");
|
|
4
|
+
const DEL = 127;
|
|
5
|
+
const ASTRAL = 65_536;
|
|
6
|
+
const HIGH_SURROGATE = 55_296;
|
|
7
|
+
const LOW_SURROGATE = 56_320;
|
|
8
|
+
const SURROGATE_SPAN = 1024;
|
|
9
|
+
const unitEscape = (unit) => `\\u${unit.toString(16).padStart(4, "0")}`;
|
|
10
|
+
const escapeCharacter = (point) => {
|
|
11
|
+
if (point < ASTRAL)
|
|
12
|
+
return unitEscape(point);
|
|
13
|
+
const offset = point - ASTRAL;
|
|
14
|
+
return (unitEscape(HIGH_SURROGATE + Math.floor(offset / SURROGATE_SPAN)) +
|
|
15
|
+
unitEscape(LOW_SURROGATE + (offset % SURROGATE_SPAN)));
|
|
16
|
+
};
|
|
17
|
+
export const jsonLine = (value) => {
|
|
18
|
+
const escaped = Array.from(JSON.stringify(value), (character) => {
|
|
19
|
+
const point = character.codePointAt(0) ?? 0;
|
|
20
|
+
return point >= DEL && isTerminalControl(character)
|
|
21
|
+
? escapeCharacter(point)
|
|
22
|
+
: character;
|
|
23
|
+
}).join("");
|
|
24
|
+
return `${escaped}\n`;
|
|
25
|
+
};
|
|
3
26
|
export const decodeJsonText = (text, failure) => Effect.promise(loadDecoder).pipe(Effect.flatMap((decoder) => decoder.decodeJson(text)), Effect.mapError(failure));
|
|
4
27
|
//# sourceMappingURL=json.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { NodeHolding } from "@maiaos/client-core/cockpit";
|
|
1
2
|
import type { ProtocolError } from "@maiaos/sdk";
|
|
2
3
|
import type * as Effect from "effect/Effect";
|
|
3
4
|
import type { CliMutationRecovery, CliNodeResult } from "../local-node/index.js";
|
|
@@ -22,6 +23,7 @@ export type CliResolution = {
|
|
|
22
23
|
readonly reference?: string;
|
|
23
24
|
};
|
|
24
25
|
export type CliSuccessOutput = {
|
|
26
|
+
readonly error?: ProtocolError;
|
|
25
27
|
readonly ok: boolean;
|
|
26
28
|
readonly resolved?: readonly CliResolution[];
|
|
27
29
|
readonly result: CliSuccessResult;
|
|
@@ -32,22 +34,27 @@ export type CliUsageHint = {
|
|
|
32
34
|
};
|
|
33
35
|
export type CliErrorOutput = Partial<CliUsageHint> & {
|
|
34
36
|
readonly error: ProtocolError;
|
|
37
|
+
readonly nodes?: readonly NodeHolding[];
|
|
35
38
|
readonly ok: false;
|
|
36
39
|
readonly recovery?: CliMutationRecovery;
|
|
37
40
|
};
|
|
38
41
|
export type OutputContext = {
|
|
42
|
+
readonly error?: ProtocolError;
|
|
39
43
|
readonly io: CliIo;
|
|
40
44
|
readonly json: boolean;
|
|
41
45
|
readonly ok?: boolean;
|
|
42
46
|
readonly resolved?: readonly CliResolution[];
|
|
43
47
|
};
|
|
44
48
|
type ErrorContext = OutputContext & {
|
|
49
|
+
readonly nodes?: readonly NodeHolding[];
|
|
50
|
+
readonly notFoundHint?: string;
|
|
45
51
|
readonly recovery?: CliMutationRecovery;
|
|
46
52
|
readonly usage?: CliUsageHint;
|
|
47
53
|
};
|
|
48
54
|
export type CliCommandOutput = CliSuccessResult;
|
|
49
|
-
export declare const writeSuccess: <TResult extends CliCommandOutput>(result: TResult, { io, json, ok, resolved }: OutputContext, human: (result: TResult) => string) => void;
|
|
55
|
+
export declare const writeSuccess: <TResult extends CliCommandOutput>(result: TResult, { error, io, json, ok, resolved }: OutputContext, human: (result: TResult) => string) => void;
|
|
50
56
|
export declare const reportError: (error: ProtocolError, context: ErrorContext) => number;
|
|
57
|
+
export declare const exitCodeOf: (error: ProtocolError) => number;
|
|
51
58
|
export type NodeResultPresenter<TValue, TResult extends CliCommandOutput> = {
|
|
52
59
|
readonly toResult: (value: TValue) => TResult;
|
|
53
60
|
readonly toText: (result: TResult) => string;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { jsonLine } from "./json.js";
|
|
2
|
+
import { cell } from "./rows.js";
|
|
1
3
|
const EXIT_DATA_NOT_FOUND = 66;
|
|
2
4
|
const EXIT_USAGE = 64;
|
|
3
5
|
const EXIT_UNAVAILABLE = 69;
|
|
@@ -6,14 +8,15 @@ const EXIT_DEADLINE = 74;
|
|
|
6
8
|
const EXIT_TEMPORARY = 75;
|
|
7
9
|
const EXIT_OUTCOME_UNKNOWN = 76;
|
|
8
10
|
const EXIT_PERMISSION = 77;
|
|
9
|
-
export const writeSuccess = (result, { io, json, ok = true, resolved = [] }, human) => {
|
|
11
|
+
export const writeSuccess = (result, { error, io, json, ok = true, resolved = [] }, human) => {
|
|
10
12
|
if (json) {
|
|
11
13
|
const output = {
|
|
14
|
+
...(ok || error === undefined ? {} : { error }),
|
|
12
15
|
ok,
|
|
13
16
|
...(resolved.length === 0 ? {} : { resolved }),
|
|
14
17
|
result,
|
|
15
18
|
};
|
|
16
|
-
io.stdout(
|
|
19
|
+
io.stdout(jsonLine(output));
|
|
17
20
|
return;
|
|
18
21
|
}
|
|
19
22
|
io.stdout(human(result));
|
|
@@ -26,23 +29,28 @@ const formatUsageHint = (error, hint) => {
|
|
|
26
29
|
? "Run 'maia --help' for usage.\n"
|
|
27
30
|
: "";
|
|
28
31
|
};
|
|
32
|
+
const formatRecovery = ({ commandId, profile }) => profile === undefined
|
|
33
|
+
? `Outcome unknown. Recover with:\n maia receipt show ${commandId}\n`
|
|
34
|
+
: `Outcome unknown. Start the Node of profile ${profile}, then read the receipt:\n maia-node --desktop --profile ${profile}\n maia --profile ${profile} receipt show ${commandId}\n`;
|
|
29
35
|
const writeError = (error, context) => {
|
|
30
|
-
const { io, json, recovery, usage: hint } = context;
|
|
36
|
+
const { io, json, nodes, notFoundHint, recovery, usage: hint } = context;
|
|
37
|
+
const notFound = error.code === "resource_not_found" ? notFoundHint : undefined;
|
|
31
38
|
if (json) {
|
|
32
39
|
const output = {
|
|
33
40
|
error,
|
|
34
41
|
ok: false,
|
|
42
|
+
...(nodes === undefined ? {} : { nodes }),
|
|
35
43
|
...(recovery === undefined ? {} : { recovery }),
|
|
44
|
+
...(notFound === undefined ? {} : { hint: notFound }),
|
|
36
45
|
...hint,
|
|
37
46
|
};
|
|
38
|
-
io.stderr(
|
|
47
|
+
io.stderr(jsonLine(output));
|
|
39
48
|
return;
|
|
40
49
|
}
|
|
41
50
|
const usage = formatUsageHint(error, hint);
|
|
42
|
-
const recoveryHint = recovery === undefined
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
io.stderr(`maia: ${error.message}\n${recoveryHint}${usage}`);
|
|
51
|
+
const recoveryHint = recovery === undefined ? "" : formatRecovery(recovery);
|
|
52
|
+
const notFoundLine = notFound === undefined ? "" : `${notFound}\n`;
|
|
53
|
+
io.stderr(`maia: ${cell(error.message)}\n${notFoundLine}${recoveryHint}${usage}`);
|
|
46
54
|
};
|
|
47
55
|
const TEMPORARY_ERROR_CODES = new Set([
|
|
48
56
|
"guard_leases_per_session_exceeded",
|
|
@@ -55,22 +63,33 @@ const PERMISSION_ERROR_CODES = new Set([
|
|
|
55
63
|
"authentication_failed",
|
|
56
64
|
"context_override_forbidden",
|
|
57
65
|
"role_denied",
|
|
66
|
+
"terminal_program_not_admitted",
|
|
67
|
+
]);
|
|
68
|
+
const USAGE_ERROR_CODES = new Set([
|
|
69
|
+
"command_not_implemented",
|
|
70
|
+
"invalid_argument",
|
|
71
|
+
"node_ambiguous",
|
|
72
|
+
]);
|
|
73
|
+
const UNAVAILABLE_ERROR_CODES = new Set([
|
|
74
|
+
"node_context_unavailable",
|
|
75
|
+
"node_unavailable",
|
|
76
|
+
"platform_unsupported",
|
|
77
|
+
"terminal_containment_unsupported",
|
|
58
78
|
]);
|
|
59
79
|
export const reportError = (error, context) => {
|
|
60
80
|
writeError(error, context);
|
|
61
|
-
|
|
62
|
-
|
|
81
|
+
return exitCodeOf(error);
|
|
82
|
+
};
|
|
83
|
+
export const exitCodeOf = (error) => {
|
|
84
|
+
if (USAGE_ERROR_CODES.has(error.code))
|
|
63
85
|
return EXIT_USAGE;
|
|
64
|
-
}
|
|
65
86
|
if (error.code === "resource_not_found" ||
|
|
66
87
|
error.code === "port_lease_not_found")
|
|
67
88
|
return EXIT_DATA_NOT_FOUND;
|
|
68
89
|
if (PERMISSION_ERROR_CODES.has(error.code))
|
|
69
90
|
return EXIT_PERMISSION;
|
|
70
|
-
if (error.code
|
|
71
|
-
error.code === "node_context_unavailable") {
|
|
91
|
+
if (UNAVAILABLE_ERROR_CODES.has(error.code))
|
|
72
92
|
return EXIT_UNAVAILABLE;
|
|
73
|
-
}
|
|
74
93
|
if (error.code === "deadline_exceeded")
|
|
75
94
|
return EXIT_DEADLINE;
|
|
76
95
|
if (error.code === "outcome_unknown")
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare const isTerminalControl: (character: string) => boolean;
|
|
2
2
|
export declare const cell: (value: string) => string;
|
|
3
|
+
export declare const block: (value: string) => string;
|
|
3
4
|
export declare const tab: (values: readonly unknown[]) => string;
|
|
5
|
+
export declare const fields: (entries: readonly (readonly [label: string, value: string | undefined])[]) => string;
|
|
4
6
|
export type CliTable = {
|
|
5
7
|
readonly empty: string;
|
|
6
8
|
readonly headers: readonly string[];
|