@maiaos/cli 0.1.0-canary.4 → 0.1.0-canary.41
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 +2 -2
- package/dist/agents/client.d.ts +47 -27
- package/dist/agents/client.js +10 -3
- package/dist/agents/commands.d.ts +1 -0
- package/dist/agents/commands.js +24 -2
- package/dist/agents/index.d.ts +1 -1
- package/dist/agents/index.js +1 -1
- package/dist/agents/input.d.ts +3 -1
- package/dist/agents/input.js +6 -0
- package/dist/agents/output/format.d.ts +2 -2
- package/dist/agents/output/format.js +11 -0
- package/dist/agents/tree/tree.js +13 -1
- package/dist/bin/maia.cdx.json +19 -19
- package/dist/bin/maia.mjs +1 -1
- package/dist/bootstrap/run.js +5 -2
- package/dist/cli/cli.d.ts +8 -2
- package/dist/cli/cli.js +19 -6
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/command-line/context.d.ts +1 -0
- package/dist/command-line/index.d.ts +2 -2
- package/dist/command-line/index.js +2 -2
- package/dist/command-line/input/arguments.d.ts +7 -0
- package/dist/command-line/input/arguments.js +22 -10
- package/dist/command-line/input/index.d.ts +1 -1
- package/dist/command-line/input/index.js +1 -1
- package/dist/command-line/rows.d.ts +1 -0
- package/dist/command-line/rows.js +3 -0
- package/dist/command-receipt/command.js +1 -1
- package/dist/connection/input.js +2 -2
- package/dist/connection/system.js +3 -2
- package/dist/connection/tree/tree.js +5 -5
- package/dist/local-node/client.d.ts +1 -0
- package/dist/local-node/client.js +1 -0
- package/dist/local-node/index.d.ts +2 -1
- package/dist/local-node/index.js +2 -1
- package/dist/local-node/wait.d.ts +10 -0
- package/dist/local-node/wait.js +17 -0
- package/dist/login/gateway.js +2 -2
- package/dist/login/vendor-input.js +2 -2
- package/dist/mcp/calls.js +6 -1
- package/dist/mcp/routing.js +1 -0
- package/dist/project-guard/client.d.ts +12 -0
- package/dist/project-guard/input.d.ts +3 -0
- package/dist/project-guard/input.js +15 -1
- package/dist/project-guard/output/format.js +5 -0
- package/dist/project-workspace/tree/tree.js +1 -1
- package/dist/reference/resolve.js +9 -2
- package/dist/remote-node/connector.js +8 -1
- package/dist/session/agent-permission.d.ts +2 -2
- package/dist/session/approval/client.d.ts +5 -2
- package/dist/session/approval/client.js +2 -2
- package/dist/session/approval/commands.js +29 -15
- package/dist/session/client.d.ts +12 -3
- package/dist/session/client.js +14 -2
- package/dist/session/commands.d.ts +1 -0
- package/dist/session/commands.js +87 -9
- package/dist/session/create-tasks.js +4 -1
- package/dist/session/index.d.ts +1 -1
- package/dist/session/index.js +1 -1
- package/dist/session/output/human.d.ts +2 -0
- package/dist/session/output/human.js +6 -3
- package/dist/session/output/index.d.ts +1 -1
- package/dist/session/output/index.js +1 -1
- package/dist/session/output/tasks.js +9 -1
- package/dist/session/tree/tree.js +22 -11
- package/dist/session/turn/client.js +7 -9
- package/dist/session/turn/commands.js +67 -20
- package/dist/session/turn/output.d.ts +6 -0
- package/dist/session/turn/output.js +8 -1
- package/dist/status/client.d.ts +14 -3
- package/dist/status/command.js +3 -1
- package/dist/status/doctor.d.ts +5 -1
- package/dist/status/doctor.js +10 -4
- package/dist/status/output/compact.d.ts +3 -0
- package/dist/status/output/compact.js +17 -7
- package/dist/status/output/human.js +15 -0
- package/dist/terminal/control-commands.js +26 -9
- package/dist/terminal/keys.d.ts +12 -0
- package/dist/terminal/keys.js +62 -0
- package/dist/terminal/output/compact-list.d.ts +1 -0
- package/dist/terminal/output/compact-list.js +3 -0
- package/dist/terminal/output/human.js +2 -2
- package/dist/terminal/tree/tree.js +1 -1
- package/guidance/maia-cli/SKILL.md +1 -1
- package/guidance/maia-node/SKILL.md +54 -0
- package/guidance/maia-orchestration/SKILL.md +1 -2
- package/guidance/maia-sessions/SKILL.md +69 -0
- package/package.json +4 -4
package/dist/bootstrap/run.js
CHANGED
|
@@ -17,12 +17,15 @@ const probePayloads = (dependencies) => Effect.all([
|
|
|
17
17
|
probe(dependencies.loadAgent, (module) => typeof module.runMaiaAgent === "function"),
|
|
18
18
|
]).pipe(Effect.map(([cliPayload, agent]) => ({ agent, cliPayload })));
|
|
19
19
|
const formatInstallation = (checks) => `Maia doctor failed\n${checks
|
|
20
|
-
.map((check) => ` ${check.code}: ${check.ok ? "ok" : "failed; next: reinstall Maia"}`)
|
|
20
|
+
.map((check) => ` ${check.code} (this machine): ${check.ok ? "ok" : "failed; next: reinstall Maia"}`)
|
|
21
21
|
.join("\n")}\n`;
|
|
22
22
|
const writeInstallationFailure = (output) => {
|
|
23
23
|
const { arguments_, checks, input } = output;
|
|
24
24
|
const result = {
|
|
25
|
-
checks: checks.map((check) =>
|
|
25
|
+
checks: checks.map((check) => ({
|
|
26
|
+
...(check.ok ? check : { ...check, next: "reinstall Maia" }),
|
|
27
|
+
scope: "machine",
|
|
28
|
+
})),
|
|
26
29
|
command: "doctor",
|
|
27
30
|
ok: false,
|
|
28
31
|
version: input.version,
|
package/dist/cli/cli.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
2
|
import type * as Scope from "effect/Scope";
|
|
3
|
-
import { type CliDependencies, type CliIo } from "../command-line/index.js";
|
|
3
|
+
import { type CliDependencies, type CliIo, type ParsedArguments } from "../command-line/index.js";
|
|
4
|
+
import { type TreeNode } from "../command-tree/index.js";
|
|
4
5
|
import type { CliNodeConnector } from "../local-node/index.js";
|
|
6
|
+
import type { SshLayer } from "../remote-node/index.js";
|
|
5
7
|
export type { CliDependencies, CliErrorOutput, CliIo, CliSuccessOutput, CliSuccessResult, } from "../command-line/index.js";
|
|
6
8
|
export type { CliHelpResult, CliVersionResult } from "../command-tree/index.js";
|
|
7
9
|
export type { CliStatusResult } from "../status/index.js";
|
|
@@ -11,7 +13,11 @@ export type CliRemoteNode = {
|
|
|
11
13
|
};
|
|
12
14
|
export type CliDependencyResolver = (profile: string | undefined, remote?: CliRemoteNode) => CliDependencies;
|
|
13
15
|
type CliDependencySource = CliDependencies | CliDependencyResolver;
|
|
16
|
+
export declare const resolveCommand: (parsed: ParsedArguments) => {
|
|
17
|
+
readonly node: TreeNode;
|
|
18
|
+
readonly rest: readonly string[];
|
|
19
|
+
};
|
|
14
20
|
export declare const makeCli: (dependencies: CliDependencySource) => (arguments_: readonly string[], version: string, io: CliIo) => Effect.Effect<number>;
|
|
15
|
-
export declare const makeCliDependencies: (connector?: CliNodeConnector) => CliDependencyResolver;
|
|
21
|
+
export declare const makeCliDependencies: (connector?: CliNodeConnector, ssh?: SshLayer) => CliDependencyResolver;
|
|
16
22
|
export declare const runCli: (arguments_: readonly string[], version: string, io: CliIo) => Effect.Effect<number>;
|
|
17
23
|
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cli/cli.js
CHANGED
|
@@ -49,7 +49,6 @@ const noInputFrom = (value) => value !== undefined && value !== "" && value !==
|
|
|
49
49
|
const resolveOptions = (parsed, leaf, environment) => {
|
|
50
50
|
const nodeBacked = isNodeBacked(leaf);
|
|
51
51
|
const remote = nodeBacked && leaf.remote !== false;
|
|
52
|
-
checkGlobalOptions(parsed, leaf, remote);
|
|
53
52
|
const node = parsed.node ??
|
|
54
53
|
(remote ? fromEnvironment("--node", environment.node) : undefined);
|
|
55
54
|
const profile = parsed.profile ??
|
|
@@ -104,7 +103,7 @@ const reportFailures = (effect, context, tokens) => effect.pipe(Effect.catchDefe
|
|
|
104
103
|
? Effect.interrupt
|
|
105
104
|
: Effect.sync(() => reportFailure(Cause.squash(cause), context, tokens))));
|
|
106
105
|
const isHelpInvocation = (parsed) => parsed.help || parsed.tokens[0] === undefined || parsed.tokens[0] === "help";
|
|
107
|
-
const
|
|
106
|
+
const helpNode = (parsed) => {
|
|
108
107
|
const strict = parsed.tokens[0] === "help";
|
|
109
108
|
const end = parsed.tokens.indexOf("--");
|
|
110
109
|
const tokens = end === -1 ? parsed.tokens : parsed.tokens.slice(0, end);
|
|
@@ -112,6 +111,10 @@ const runHelp = (input, parsed) => Effect.sync(() => {
|
|
|
112
111
|
const { consumed, node } = findNode(path);
|
|
113
112
|
if (consumed < path.length && (strict || node.forms.length === 0))
|
|
114
113
|
throw new CliArgumentError(unknownPathMessage(path));
|
|
114
|
+
return node;
|
|
115
|
+
};
|
|
116
|
+
const runHelp = (input, parsed) => Effect.sync(() => {
|
|
117
|
+
const node = helpNode(parsed);
|
|
115
118
|
const root = node.path.length === 0;
|
|
116
119
|
writeSuccess(root
|
|
117
120
|
? createHelpTree(input.version)
|
|
@@ -125,6 +128,13 @@ const findLeaf = (typed) => {
|
|
|
125
128
|
throw new CliArgumentError(unknownPathMessage(tokens));
|
|
126
129
|
return { leaf: node, rest: tokens.slice(consumed) };
|
|
127
130
|
};
|
|
131
|
+
export const resolveCommand = (parsed) => {
|
|
132
|
+
if (isHelpInvocation(parsed))
|
|
133
|
+
return { node: helpNode(parsed), rest: [] };
|
|
134
|
+
const { leaf, rest } = findLeaf(parsed.tokens);
|
|
135
|
+
checkGlobalOptions(parsed, leaf, isNodeBacked(leaf) && leaf.remote !== false);
|
|
136
|
+
return { node: leaf, rest };
|
|
137
|
+
};
|
|
128
138
|
const leafProgram = (leaf, rest, context) => {
|
|
129
139
|
const reference = leaf.run;
|
|
130
140
|
if (reference === undefined)
|
|
@@ -167,7 +177,7 @@ const runParsed = (input, parsed) => {
|
|
|
167
177
|
if (isHelpInvocation(parsed))
|
|
168
178
|
return runHelp(input, parsed);
|
|
169
179
|
return Effect.gen(function* () {
|
|
170
|
-
const { leaf, rest } =
|
|
180
|
+
const { node: leaf, rest } = resolveCommand(parsed);
|
|
171
181
|
const resolved = resolveOptions(parsed, leaf, yield* readEnvironment(leaf));
|
|
172
182
|
if (parsed.node === undefined &&
|
|
173
183
|
resolved.node !== undefined &&
|
|
@@ -419,6 +429,7 @@ const makeDefaultCliDependencies = (binding) => ({
|
|
|
419
429
|
"sendAttachedSessionMessage",
|
|
420
430
|
"showExecutionRelocation",
|
|
421
431
|
"showSession",
|
|
432
|
+
"waitSession",
|
|
422
433
|
"startSession",
|
|
423
434
|
"stopSession",
|
|
424
435
|
],
|
|
@@ -485,6 +496,7 @@ const makeDefaultCliDependencies = (binding) => ({
|
|
|
485
496
|
...binding,
|
|
486
497
|
names: [
|
|
487
498
|
"confirmAgentChange",
|
|
499
|
+
"detectAgents",
|
|
488
500
|
"listAgents",
|
|
489
501
|
"previewAgentChange",
|
|
490
502
|
"showAgent",
|
|
@@ -512,19 +524,20 @@ const makeDefaultCliDependencies = (binding) => ({
|
|
|
512
524
|
}),
|
|
513
525
|
...lazyDependencies(loadStatus, (module, node) => module.makeStatusClient(node), { ...binding, names: ["createMonitorBootstrap", "readStatus"] }),
|
|
514
526
|
});
|
|
515
|
-
const remoteConnector = (remote, local) => {
|
|
527
|
+
const remoteConnector = (remote, local, ssh) => {
|
|
516
528
|
const cache = {};
|
|
517
529
|
return (options) => Effect.promise(loadRemoteNode).pipe(Effect.flatMap((module) => {
|
|
518
530
|
cache.connector ??= module.makeRemoteNodeConnector({
|
|
519
531
|
...(local === undefined ? {} : { local }),
|
|
520
532
|
name: remote.name,
|
|
521
533
|
scope: remote.scope,
|
|
534
|
+
...(ssh === undefined ? {} : { ssh }),
|
|
522
535
|
});
|
|
523
536
|
return cache.connector(options);
|
|
524
537
|
}));
|
|
525
538
|
};
|
|
526
539
|
const remoteSignIn = (remote, binding) => (connection) => Effect.promise(loadRemoteNode).pipe(Effect.flatMap((module) => module.remoteVendorLogin({ ...binding, name: remote.name })(connection)));
|
|
527
|
-
export const makeCliDependencies = (connector) => (profile, remote) => {
|
|
540
|
+
export const makeCliDependencies = (connector, ssh) => (profile, remote) => {
|
|
528
541
|
const binding = {
|
|
529
542
|
...(connector === undefined ? {} : { connector }),
|
|
530
543
|
...(profile === undefined ? {} : { profile }),
|
|
@@ -534,7 +547,7 @@ export const makeCliDependencies = (connector) => (profile, remote) => {
|
|
|
534
547
|
: {
|
|
535
548
|
...makeDefaultCliDependencies({
|
|
536
549
|
...binding,
|
|
537
|
-
connector: remoteConnector(remote, connector),
|
|
550
|
+
connector: remoteConnector(remote, connector, ssh),
|
|
538
551
|
remote: true,
|
|
539
552
|
}),
|
|
540
553
|
runVendorLogin: remoteSignIn(remote, binding),
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { type CliDependencies, type CliDependencyResolver, type CliErrorOutput, type CliHelpResult, type CliIo, type CliStatusResult, type CliSuccessOutput, type CliSuccessResult, type CliVersionResult, makeCli, makeCliDependencies, runCli, } from "./cli.js";
|
|
1
|
+
export { type CliDependencies, type CliDependencyResolver, type CliErrorOutput, type CliHelpResult, type CliIo, type CliStatusResult, type CliSuccessOutput, type CliSuccessResult, type CliVersionResult, makeCli, makeCliDependencies, resolveCommand, runCli, } from "./cli.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cli/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { makeCli, makeCliDependencies, runCli, } from "./cli.js";
|
|
1
|
+
export { makeCli, makeCliDependencies, resolveCommand, runCli, } from "./cli.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -166,6 +166,7 @@ export type CliDependencies = Partial<AgentsCliDependencies & ApprovalCliDepende
|
|
|
166
166
|
readonly sshLayer?: SshLayer;
|
|
167
167
|
readonly startSession: (input: StartSessionInput) => CliNodeEffect<SessionStartResult>;
|
|
168
168
|
readonly stopSession?: (input: StartSessionInput) => CliNodeEffect<SessionStopResult>;
|
|
169
|
+
readonly waitSession?: SessionClient["waitSession"];
|
|
169
170
|
readonly waitTurns?: (input: WaitTurnsInput) => CliNodeEffect<TurnWaitResult>;
|
|
170
171
|
readonly writeTerminalInput: (input: Parameters<TerminalClient["writeTerminalInput"]>[0]) => CliNodeEffect<LiveTerminalWriteResult>;
|
|
171
172
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { type CliDependencies, type CliServices, type CommandContext, type CommandEffect, LOCAL_NODE, } from "./context.js";
|
|
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";
|
|
2
|
+
export { argumentsAreBounded, type ArgumentToken, CliArgumentError, missingArgument, parseArguments, type ParsedArguments, type ParsedOptions, parseOptions, parseOptionsWith, readBoundedStdin, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readRevisionOption, readWaitTimeoutSeconds, recoverStdin, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./input/index.js";
|
|
3
3
|
export { decodeJsonText, jsonLine } from "./json.js";
|
|
4
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";
|
|
5
|
+
export { block, cell, type CliTable, fields, formatRows, tab, withNextPage, withPrunedHistory, } from "./rows.js";
|
|
6
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,7 +1,7 @@
|
|
|
1
1
|
export { LOCAL_NODE, } from "./context.js";
|
|
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 { argumentsAreBounded, CliArgumentError, missingArgument, parseArguments, parseOptions, parseOptionsWith, readBoundedStdin, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readRevisionOption, readWaitTimeoutSeconds, recoverStdin, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./input/index.js";
|
|
3
3
|
export { decodeJsonText, jsonLine } from "./json.js";
|
|
4
4
|
export { exitCodeOf, reportError, writeNodeResult, writeSuccess, } from "./output.js";
|
|
5
|
-
export { block, cell, fields, formatRows, tab, withNextPage, } from "./rows.js";
|
|
5
|
+
export { block, cell, fields, formatRows, tab, withNextPage, withPrunedHistory, } from "./rows.js";
|
|
6
6
|
export { askToConfirm, canPrompt, confirmationOf, confirmParameters, EXIT_CANCELLED, peekStdin, promptOrRefuse, readInputMode, readPipedPreview, readTwoPhaseMode, requestedTwoPhaseMode, runInputTwoPhase, runTwoPhase, TWO_PHASE_FLAGS, } from "./two-phase.js";
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -24,6 +24,12 @@ export declare const argumentsAreBounded: (arguments_: readonly string[]) => boo
|
|
|
24
24
|
type ValueOption = "--node" | "--profile";
|
|
25
25
|
export declare const readGlobalValue: (option: ValueOption, value: string | undefined) => string;
|
|
26
26
|
export declare const parseArguments: (arguments_: readonly string[]) => ParsedArguments;
|
|
27
|
+
export type OptionSpec = {
|
|
28
|
+
readonly allowed: ReadonlySet<string>;
|
|
29
|
+
readonly allowedFlags: ReadonlySet<string>;
|
|
30
|
+
readonly repeatable: ReadonlySet<string>;
|
|
31
|
+
};
|
|
32
|
+
export declare const parseOptionsWith: (tokens: readonly string[], spec: OptionSpec) => ParsedOptions;
|
|
27
33
|
export declare const parseOptions: (tokens: readonly string[], allowed: ReadonlySet<string>, allowedFlags?: ReadonlySet<string>) => ParsedOptions;
|
|
28
34
|
export declare const requirePositionals: (positionals: readonly string[], count: number) => void;
|
|
29
35
|
export declare const missingArgument: () => CliArgumentError;
|
|
@@ -37,6 +43,7 @@ export declare const readDuration: (value: string, option: `--${string}`, range:
|
|
|
37
43
|
readonly max: number;
|
|
38
44
|
readonly min: number;
|
|
39
45
|
}) => number;
|
|
46
|
+
export declare const readWaitTimeoutSeconds: (value: string | undefined) => number;
|
|
40
47
|
export type ArgumentToken = {
|
|
41
48
|
readonly index: number;
|
|
42
49
|
readonly inline: boolean;
|
|
@@ -77,13 +77,20 @@ export const parseArguments = (arguments_) => {
|
|
|
77
77
|
tokens: [...scan.tokens, ...(end === -1 ? [] : arguments_.slice(end))],
|
|
78
78
|
};
|
|
79
79
|
};
|
|
80
|
+
const takeOptionValue = (state, token) => {
|
|
81
|
+
const { options, pendingOption } = state;
|
|
82
|
+
if (pendingOption === undefined)
|
|
83
|
+
return;
|
|
84
|
+
if (token.startsWith("--")) {
|
|
85
|
+
throw new CliArgumentError(`Option '${pendingOption}' requires a value.`);
|
|
86
|
+
}
|
|
87
|
+
const earlier = options.get(pendingOption);
|
|
88
|
+
options.set(pendingOption, earlier === undefined ? token : `${earlier},${token}`);
|
|
89
|
+
delete state.pendingOption;
|
|
90
|
+
};
|
|
80
91
|
const parseOptionToken = (state, token) => {
|
|
81
92
|
if (state.pendingOption !== undefined) {
|
|
82
|
-
|
|
83
|
-
throw new CliArgumentError(`Option '${state.pendingOption}' requires a value.`);
|
|
84
|
-
}
|
|
85
|
-
state.options.set(state.pendingOption, token);
|
|
86
|
-
delete state.pendingOption;
|
|
93
|
+
takeOptionValue(state, token);
|
|
87
94
|
return;
|
|
88
95
|
}
|
|
89
96
|
if (!token.startsWith("--")) {
|
|
@@ -100,7 +107,7 @@ const parseOptionToken = (state, token) => {
|
|
|
100
107
|
if (!state.allowed.has(token)) {
|
|
101
108
|
throw new CliArgumentError("The command contains an unknown option.");
|
|
102
109
|
}
|
|
103
|
-
if (state.options.has(token)) {
|
|
110
|
+
if (state.options.has(token) && !state.repeatable.has(token)) {
|
|
104
111
|
throw new CliArgumentError(`Option '${token}' may be used only once.`);
|
|
105
112
|
}
|
|
106
113
|
state.pendingOption = token;
|
|
@@ -112,16 +119,15 @@ const splitInlineValue = (token, allowed) => {
|
|
|
112
119
|
const name = token.slice(0, separator);
|
|
113
120
|
return allowed.has(name) ? [name, token.slice(separator + 1)] : [token];
|
|
114
121
|
};
|
|
115
|
-
export const
|
|
122
|
+
export const parseOptionsWith = (tokens, spec) => {
|
|
116
123
|
const state = {
|
|
117
|
-
|
|
118
|
-
allowedFlags,
|
|
124
|
+
...spec,
|
|
119
125
|
flags: new Set(),
|
|
120
126
|
options: new Map(),
|
|
121
127
|
positionals: [],
|
|
122
128
|
};
|
|
123
129
|
tokens
|
|
124
|
-
.flatMap((token) => splitInlineValue(token, allowed))
|
|
130
|
+
.flatMap((token) => splitInlineValue(token, spec.allowed))
|
|
125
131
|
.forEach((token) => {
|
|
126
132
|
parseOptionToken(state, token);
|
|
127
133
|
});
|
|
@@ -134,6 +140,7 @@ export const parseOptions = (tokens, allowed, allowedFlags = new Set()) => {
|
|
|
134
140
|
positionals: state.positionals,
|
|
135
141
|
};
|
|
136
142
|
};
|
|
143
|
+
export const parseOptions = (tokens, allowed, allowedFlags = new Set()) => parseOptionsWith(tokens, { allowed, allowedFlags, repeatable: new Set() });
|
|
137
144
|
export const requirePositionals = (positionals, count) => {
|
|
138
145
|
if (positionals.length === count)
|
|
139
146
|
return;
|
|
@@ -191,6 +198,11 @@ export const readDuration = (value, option, range) => {
|
|
|
191
198
|
throw new CliArgumentError(`Option '${option}' must be a duration from ${describeSeconds(range.min)} to ${describeSeconds(range.max)}, such as 30s, 10m or 1h.`);
|
|
192
199
|
return seconds;
|
|
193
200
|
};
|
|
201
|
+
const DEFAULT_WAIT_SECONDS = 600;
|
|
202
|
+
const MAX_WAIT_SECONDS = 86_400;
|
|
203
|
+
export const readWaitTimeoutSeconds = (value) => value === undefined
|
|
204
|
+
? DEFAULT_WAIT_SECONDS
|
|
205
|
+
: readDuration(value, "--timeout", { max: MAX_WAIT_SECONDS, min: 1 });
|
|
194
206
|
const tokenRole = (token, index, valueOptions) => {
|
|
195
207
|
if (!token.startsWith("--"))
|
|
196
208
|
return { index, kind: "positional" };
|
|
@@ -1,4 +1,4 @@
|
|
|
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";
|
|
1
|
+
export { argumentsAreBounded, type ArgumentToken, CliArgumentError, missingArgument, parseArguments, type ParsedArguments, type ParsedOptions, parseOptions, parseOptionsWith, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readRevisionOption, readWaitTimeoutSeconds, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./arguments.js";
|
|
2
2
|
export { promptLine, type PromptOptions, terminalIsInteractive, } from "./prompt.js";
|
|
3
3
|
export { type BoundedStdinRequest, readBoundedStdin, recoverStdin, replayStdin, } from "./stdin.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { argumentsAreBounded, CliArgumentError, missingArgument, parseArguments, parseOptions, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readRevisionOption, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./arguments.js";
|
|
1
|
+
export { argumentsAreBounded, CliArgumentError, missingArgument, parseArguments, parseOptions, parseOptionsWith, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readRevisionOption, readWaitTimeoutSeconds, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./arguments.js";
|
|
2
2
|
export { promptLine, terminalIsInteractive, } from "./prompt.js";
|
|
3
3
|
export { readBoundedStdin, recoverStdin, replayStdin, } from "./stdin.js";
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -8,5 +8,6 @@ export type CliTable = {
|
|
|
8
8
|
readonly headers: readonly string[];
|
|
9
9
|
};
|
|
10
10
|
export declare const formatRows: <TValue>(items: readonly TValue[], format: (value: TValue) => string, text?: CliTable | string) => string;
|
|
11
|
+
export declare const withPrunedHistory: (text: string, oldest?: string) => string;
|
|
11
12
|
export declare const withNextPage: (text: string, nextCursor?: string) => string;
|
|
12
13
|
//# sourceMappingURL=rows.d.ts.map
|
|
@@ -37,5 +37,8 @@ export const formatRows = (items, format, text) => {
|
|
|
37
37
|
? align([text.headers, ...lines.map((line) => line.split("\t"))])
|
|
38
38
|
: `${lines.join("\n")}\n`;
|
|
39
39
|
};
|
|
40
|
+
export const withPrunedHistory = (text, oldest) => oldest === undefined
|
|
41
|
+
? text
|
|
42
|
+
: `earlier history pruned; oldest retained cursor ${oldest}\n${text}`;
|
|
40
43
|
export const withNextPage = (text, nextCursor) => nextCursor === undefined ? text : `${text}next: --after ${nextCursor}\n`;
|
|
41
44
|
//# sourceMappingURL=rows.js.map
|
|
@@ -53,7 +53,7 @@ export const runReceiptShow = (tokens, context) => Effect.gen(function* () {
|
|
|
53
53
|
command: "receipt.show",
|
|
54
54
|
result: value,
|
|
55
55
|
}),
|
|
56
|
-
toText: ({ result: { receipt } }) => `${receipt.receiptId}\t${receipt.state}\t${receipt.target.type}:${receipt.target.id}\n`,
|
|
56
|
+
toText: ({ result: { eventsPruned, receipt } }) => `${receipt.receiptId}\t${receipt.state}\t${receipt.target.type}:${receipt.target.id}${eventsPruned === true ? "\tevents-pruned" : ""}\n`,
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
//# sourceMappingURL=command.js.map
|
package/dist/connection/input.js
CHANGED
|
@@ -2,8 +2,8 @@ import { CliArgumentError, parseOptions, readExpectedRevision, readPageSize, req
|
|
|
2
2
|
const readSessionLimit = (value) => {
|
|
3
3
|
if (value === undefined)
|
|
4
4
|
return {};
|
|
5
|
-
if (!/^(?:[1-9]|1[0-6])$/u.test(value))
|
|
6
|
-
throw new CliArgumentError("Option '--max-sessions' must be an integer from 1 to
|
|
5
|
+
if (!/^(?:[1-9]|[1-5][0-9]|6[0-4])$/u.test(value))
|
|
6
|
+
throw new CliArgumentError("Option '--max-sessions' must be an integer from 1 to 64.");
|
|
7
7
|
return { maxConcurrentSessions: Number(value) };
|
|
8
8
|
};
|
|
9
9
|
const requireOption = (options, name) => {
|
|
@@ -146,8 +146,9 @@ const confirmedText = (result) => result.items
|
|
|
146
146
|
const readSetup = (parsed) => {
|
|
147
147
|
requirePositionals(parsed.positionals, 0);
|
|
148
148
|
const sessions = parsed.options.get("--max-sessions");
|
|
149
|
-
if (sessions !== undefined &&
|
|
150
|
-
|
|
149
|
+
if (sessions !== undefined &&
|
|
150
|
+
!/^(?:[1-9]|[1-5][0-9]|6[0-4])$/u.test(sessions))
|
|
151
|
+
throw new CliArgumentError("--max-sessions must be 1 to 64.");
|
|
151
152
|
return {
|
|
152
153
|
commandId: parsed.options.get("--command-id"),
|
|
153
154
|
...(sessions === undefined
|
|
@@ -23,7 +23,7 @@ export const CONNECTION_TREE = {
|
|
|
23
23
|
],
|
|
24
24
|
leaves: [
|
|
25
25
|
[
|
|
26
|
-
"setup [--max-sessions <1..
|
|
26
|
+
"setup [--max-sessions <1..64>] [--command-id <id>] [--dry-run | --confirm-stdin | --yes]",
|
|
27
27
|
1,
|
|
28
28
|
["connection.system.preview", "connection.system.confirm"],
|
|
29
29
|
"Use installed vendor CLIs as system-default accounts.",
|
|
@@ -41,7 +41,7 @@ export const CONNECTION_TREE = {
|
|
|
41
41
|
{ kind: "composite", run: loginRunner },
|
|
42
42
|
],
|
|
43
43
|
[
|
|
44
|
-
"login <claude|codex> [--name <name>] [--device-code] [--max-sessions <1..
|
|
44
|
+
"login <claude|codex> [--name <name>] [--device-code] [--max-sessions <1..64>]",
|
|
45
45
|
1,
|
|
46
46
|
"",
|
|
47
47
|
"Add or re-sign a Claude Code or Codex account.",
|
|
@@ -59,14 +59,14 @@ export const CONNECTION_TREE = {
|
|
|
59
59
|
{ kind: "composite", run: loginRunner },
|
|
60
60
|
],
|
|
61
61
|
[
|
|
62
|
-
"login gateway --name <name> --base-url <url> --api-key-stdin [--max-sessions <1..
|
|
62
|
+
"login gateway --name <name> --base-url <url> --api-key-stdin [--max-sessions <1..64>] [--command-id <id>]",
|
|
63
63
|
1,
|
|
64
64
|
"connection.gateway.create",
|
|
65
65
|
"Add a gateway Connection with its API key.",
|
|
66
66
|
{ run: [login, "runLoginGateway"] },
|
|
67
67
|
],
|
|
68
68
|
[
|
|
69
|
-
"connection create --name <name> --executor <codex-cli|claude-code> --root <maia-managed|system-default> [--max-sessions <1..
|
|
69
|
+
"connection create --name <name> --executor <codex-cli|claude-code> --root <maia-managed|system-default> [--max-sessions <1..64>] [--command-id <id>]",
|
|
70
70
|
1,
|
|
71
71
|
"connection.create",
|
|
72
72
|
"Create a worker account Connection.",
|
|
@@ -133,7 +133,7 @@ export const CONNECTION_TREE = {
|
|
|
133
133
|
{ run: [connection, "runConnectionModelsList"] },
|
|
134
134
|
],
|
|
135
135
|
[
|
|
136
|
-
"connection capacity set <connection> --max-sessions <1..
|
|
136
|
+
"connection capacity set <connection> --max-sessions <1..64> --expected-revision <revision> [--command-id <id>]",
|
|
137
137
|
1,
|
|
138
138
|
"connection.capacity.set",
|
|
139
139
|
"Set a Connection's Session limit.",
|
|
@@ -22,6 +22,7 @@ export declare const newCliIdentifier: (prefix: "command" | "request") => Effect
|
|
|
22
22
|
export declare const commandIdentifier: (commandId: string | undefined) => Effect.Effect<string, never, Crypto.Crypto>;
|
|
23
23
|
export declare const fillCommandIdentifier: (input: unknown) => Effect.Effect<unknown, never, Crypto.Crypto>;
|
|
24
24
|
export declare const connectLocalNode: CliNodeConnector;
|
|
25
|
+
export declare const holdsSessionCredential: Effect.Effect<boolean>;
|
|
25
26
|
export declare const outcomeCanBeAmbiguous: (error: unknown) => boolean;
|
|
26
27
|
export declare const invalidNodeInput: <TValue>(schemaError?: unknown) => Effect.Effect<CliNodeResult<TValue>>;
|
|
27
28
|
export type ParameterSchema<TParameters> = {
|
|
@@ -70,6 +70,7 @@ const sessionAttachmentDenied = () => new CliLocalNodeError({
|
|
|
70
70
|
retryable: false,
|
|
71
71
|
},
|
|
72
72
|
});
|
|
73
|
+
export const holdsSessionCredential = Effect.map(Config.option(Config.String(SESSION_CREDENTIAL_VARIABLE)), Option.isSome).pipe(Effect.orElseSucceed(() => false));
|
|
73
74
|
const sessionLaunch = Effect.gen(function* () {
|
|
74
75
|
const credential = yield* Config.option(Config.String(SESSION_CREDENTIAL_VARIABLE));
|
|
75
76
|
const origin = yield* Config.option(Config.String(SESSION_NODE_ORIGIN_VARIABLE));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { type CliNodeCall, makeCallClient } from "./call.js";
|
|
2
|
-
export { type CliMutationRecovery, type CliNodeBinding, type CliNodeConnection, type CliNodeConnector, type CliNodeEffect, type CliNodeOperations, type CliNodeOperationsOptions, type CliNodeResult, commandIdentifier, connectLocalNode, discoveryOptionsFor, fillCommandIdentifier, invalidNodeInput, makeCliNodeOperations, newCliIdentifier, outcomeCanBeAmbiguous, type ParameterSchema, retryBriefSaturation, runLazyNodeDependency, } from "./client.js";
|
|
2
|
+
export { type CliMutationRecovery, type CliNodeBinding, type CliNodeConnection, type CliNodeConnector, type CliNodeEffect, type CliNodeOperations, type CliNodeOperationsOptions, type CliNodeResult, commandIdentifier, connectLocalNode, discoveryOptionsFor, fillCommandIdentifier, holdsSessionCredential, invalidNodeInput, makeCliNodeOperations, newCliIdentifier, outcomeCanBeAmbiguous, type ParameterSchema, retryBriefSaturation, runLazyNodeDependency, } from "./client.js";
|
|
3
|
+
export { repeatBoundedWait } from "./wait.js";
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/local-node/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { makeCallClient } from "./call.js";
|
|
2
|
-
export { commandIdentifier, connectLocalNode, discoveryOptionsFor, fillCommandIdentifier, invalidNodeInput, makeCliNodeOperations, newCliIdentifier, outcomeCanBeAmbiguous, retryBriefSaturation, runLazyNodeDependency, } from "./client.js";
|
|
2
|
+
export { commandIdentifier, connectLocalNode, discoveryOptionsFor, fillCommandIdentifier, holdsSessionCredential, invalidNodeInput, makeCliNodeOperations, newCliIdentifier, outcomeCanBeAmbiguous, retryBriefSaturation, runLazyNodeDependency, } from "./client.js";
|
|
3
|
+
export { repeatBoundedWait } from "./wait.js";
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CliNodeEffect } from "./client.js";
|
|
2
|
+
type BoundedWait<TValue> = {
|
|
3
|
+
readonly maxRequestMilliseconds: number;
|
|
4
|
+
readonly once: (waitMilliseconds: number) => CliNodeEffect<TValue>;
|
|
5
|
+
readonly satisfied: (value: TValue) => boolean;
|
|
6
|
+
readonly timeoutMilliseconds: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const repeatBoundedWait: <TValue>(input: BoundedWait<TValue>) => CliNodeEffect<TValue>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=wait.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as Clock from "effect/Clock";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
const monotonicMilliseconds = Effect.map(Clock.monotonicTimeNanos, (nanos) => Number(nanos / 1000000n));
|
|
4
|
+
export const repeatBoundedWait = (input) => Effect.gen(function* () {
|
|
5
|
+
const deadline = (yield* monotonicMilliseconds) + input.timeoutMilliseconds;
|
|
6
|
+
const next = () => Effect.gen(function* () {
|
|
7
|
+
const remaining = deadline - (yield* monotonicMilliseconds);
|
|
8
|
+
const result = yield* input.once(Math.max(0, Math.min(input.maxRequestMilliseconds, remaining)));
|
|
9
|
+
if (!result.ok || input.satisfied(result.value))
|
|
10
|
+
return result;
|
|
11
|
+
return (yield* monotonicMilliseconds) >= deadline
|
|
12
|
+
? result
|
|
13
|
+
: yield* next();
|
|
14
|
+
});
|
|
15
|
+
return yield* next();
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=wait.js.map
|
package/dist/login/gateway.js
CHANGED
|
@@ -6,8 +6,8 @@ import { newCliIdentifier } from "../local-node/index.js";
|
|
|
6
6
|
const readSessionLimit = (value) => {
|
|
7
7
|
if (value === undefined)
|
|
8
8
|
return {};
|
|
9
|
-
if (!/^(?:[1-9]|1[0-6])$/u.test(value))
|
|
10
|
-
throw new CliArgumentError("Option '--max-sessions' must be an integer from 1 to
|
|
9
|
+
if (!/^(?:[1-9]|[1-5][0-9]|6[0-4])$/u.test(value))
|
|
10
|
+
throw new CliArgumentError("Option '--max-sessions' must be an integer from 1 to 64.");
|
|
11
11
|
return { maxConcurrentSessions: Number(value) };
|
|
12
12
|
};
|
|
13
13
|
export const readGatewayLogin = (tokens) => {
|
|
@@ -7,8 +7,8 @@ export const vendorExecutor = (vendor) => EXECUTORS.get(vendor);
|
|
|
7
7
|
const readSessionLimit = (value) => {
|
|
8
8
|
if (value === undefined)
|
|
9
9
|
return {};
|
|
10
|
-
if (!/^(?:[1-9]|1[0-6])$/u.test(value))
|
|
11
|
-
throw new CliArgumentError("Option '--max-sessions' must be an integer from 1 to
|
|
10
|
+
if (!/^(?:[1-9]|[1-5][0-9]|6[0-4])$/u.test(value))
|
|
11
|
+
throw new CliArgumentError("Option '--max-sessions' must be an integer from 1 to 64.");
|
|
12
12
|
return { maxConcurrentSessions: Number(value) };
|
|
13
13
|
};
|
|
14
14
|
export const readVendorLogin = (tokens) => {
|
package/dist/mcp/calls.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { agentsListParametersSchema, agentsShowParametersSchema, approvalListParametersSchema, approvalShowParametersSchema, connectionDetectParametersSchema, connectionListParametersSchema, connectionModelsListParametersSchema, connectionShowParametersSchema, connectionUsageShowParametersSchema, containerIndexListParametersSchema, COORDINATOR_TOOL_OPERATIONS, discoverySessionsListParametersSchema, invocationContextShowParametersSchema, LOCAL_NODE_CALL_METHODS, localNodeRequestPayloadSchema, portLeaseAcquireParametersSchema, portLeaseListParametersSchema, portLeaseReleaseParametersSchema, portLeaseRenewParametersSchema, projectGuardShowParametersSchema, projectListParametersSchema, projectShowParametersSchema, receiptGetParametersSchema, routineListParametersSchema, routineShowParametersSchema, runLedgerCreateParametersSchema, runLedgerListParametersSchema, runLedgerTaskDispatchParametersSchema, runLedgerTaskListParametersSchema, runLedgerTaskSettleParametersSchema, runLedgerTaskShowParametersSchema, sessionArchiveParametersSchema, sessionCreateParametersSchema, sessionDiffParametersSchema, sessionEventsListParametersSchema, sessionHistoryReadParametersSchema, sessionInboxAckParametersSchema, sessionInboxCheckParametersSchema, sessionListParametersSchema, sessionMessageSendParametersSchema, sessionObserveParametersSchema, sessionResumeParametersSchema, sessionShowParametersSchema, sessionStartParametersSchema, sessionStopParametersSchema, turnCancelParametersSchema, turnInterruptParametersSchema, turnQueueListParametersSchema, turnSendParametersSchema, turnShowParametersSchema, turnWaitParametersSchema, workerToolDefinitions, workspaceListParametersSchema, workspaceShowParametersSchema, } from "@maiaos/sdk";
|
|
1
|
+
import { agentsListParametersSchema, agentsShowParametersSchema, approvalListParametersSchema, approvalRespondParametersSchema, approvalShowParametersSchema, connectionDetectParametersSchema, connectionListParametersSchema, connectionModelsListParametersSchema, connectionShowParametersSchema, connectionUsageShowParametersSchema, containerIndexListParametersSchema, COORDINATOR_TOOL_OPERATIONS, discoverySessionsListParametersSchema, invocationContextShowParametersSchema, LOCAL_NODE_CALL_METHODS, localNodeRequestPayloadSchema, portLeaseAcquireParametersSchema, portLeaseListParametersSchema, portLeaseReleaseParametersSchema, portLeaseRenewParametersSchema, projectGuardShowParametersSchema, projectListParametersSchema, projectShowParametersSchema, receiptGetParametersSchema, routineListParametersSchema, routineShowParametersSchema, runLedgerCreateParametersSchema, runLedgerListParametersSchema, runLedgerTaskDispatchParametersSchema, runLedgerTaskListParametersSchema, runLedgerTaskSettleParametersSchema, runLedgerTaskShowParametersSchema, sessionArchiveParametersSchema, sessionCreateParametersSchema, sessionDiffParametersSchema, sessionEventsListParametersSchema, sessionHistoryReadParametersSchema, sessionInboxAckParametersSchema, sessionInboxCheckParametersSchema, sessionListParametersSchema, sessionMessageSendParametersSchema, sessionObserveParametersSchema, sessionResumeParametersSchema, sessionShowParametersSchema, sessionStartParametersSchema, sessionStopParametersSchema, turnCancelParametersSchema, turnInterruptParametersSchema, turnQueueListParametersSchema, turnSendParametersSchema, turnShowParametersSchema, turnWaitParametersSchema, workerToolDefinitions, workspaceListParametersSchema, workspaceShowParametersSchema, } from "@maiaos/sdk";
|
|
2
2
|
import { Effect, Predicate } from "effect";
|
|
3
3
|
import { invalidNodeInput, } from "../local-node/index.js";
|
|
4
4
|
const recoveryOf = (input) => Predicate.hasProperty(input, "commandId") &&
|
|
@@ -39,6 +39,10 @@ export const COORDINATOR_CALLS = new Map([
|
|
|
39
39
|
"approval.list",
|
|
40
40
|
validated(approvalListParametersSchema, (client, parameters, options) => client.listApprovals(parameters, options)),
|
|
41
41
|
],
|
|
42
|
+
[
|
|
43
|
+
"approval.respond",
|
|
44
|
+
validated(approvalRespondParametersSchema, (client, parameters, options) => client.respondToApproval(parameters, options)),
|
|
45
|
+
],
|
|
42
46
|
[
|
|
43
47
|
"approval.show",
|
|
44
48
|
validated(approvalShowParametersSchema, (client, parameters, options) => client.showApproval(parameters, options)),
|
|
@@ -222,6 +226,7 @@ export const callCoordinator = (node) => (operation, input) => {
|
|
|
222
226
|
export const WORKER_CALLS = (() => {
|
|
223
227
|
const available = new Map(COORDINATOR_CALLS);
|
|
224
228
|
available.set("context.show", validated(invocationContextShowParametersSchema, (client, parameters, options) => client.showCurrentContext(parameters, options)));
|
|
229
|
+
available.set("approval.respond", validated(approvalRespondParametersSchema, (client, parameters, options) => client.respondToApproval(parameters, options)));
|
|
225
230
|
available.set("session.inbox.ack", validated(sessionInboxAckParametersSchema, (client, parameters, options) => client.acknowledgeSessionDelivery(parameters, options)));
|
|
226
231
|
available.set("session.inbox.check", validated(sessionInboxCheckParametersSchema, (client, parameters, options) => client.checkSessionInbox(parameters, options)));
|
|
227
232
|
available.set("session.message.send", validated(sessionMessageSendParametersSchema, (client, parameters, options) => client.sendSessionMessage(parameters, options)));
|
package/dist/mcp/routing.js
CHANGED
|
@@ -25,6 +25,7 @@ export const TOOL_ROUTES = new Map([
|
|
|
25
25
|
["agents.list", LOCAL],
|
|
26
26
|
["agents.show", LOCAL],
|
|
27
27
|
["approval.list", held("session", "sessionId", true)],
|
|
28
|
+
["approval.respond", held("approval", "approvalId")],
|
|
28
29
|
["approval.show", held("approval", "approvalId")],
|
|
29
30
|
["connection.detect", LOCAL],
|
|
30
31
|
["connection.list", LOCAL],
|
|
@@ -6,6 +6,9 @@ export declare const makeProjectGuardClient: (node: CliNodeOperations) => {
|
|
|
6
6
|
readonly delivery: "duplicate" | "new";
|
|
7
7
|
readonly expectedRevision: string;
|
|
8
8
|
readonly guard: {
|
|
9
|
+
readonly approvalGrants: {
|
|
10
|
+
readonly coordinator: "answer" | "decide" | "none";
|
|
11
|
+
};
|
|
9
12
|
readonly limits: {
|
|
10
13
|
readonly maxDepth: number;
|
|
11
14
|
readonly maxLeasesPerSession: number;
|
|
@@ -41,8 +44,14 @@ export declare const makeProjectGuardClient: (node: CliNodeOperations) => {
|
|
|
41
44
|
readonly inputDigest: string;
|
|
42
45
|
readonly proof: string;
|
|
43
46
|
readonly actorId: string;
|
|
47
|
+
readonly approvalGrants: {
|
|
48
|
+
readonly coordinator: "answer" | "decide" | "none";
|
|
49
|
+
};
|
|
44
50
|
readonly commandId: string;
|
|
45
51
|
readonly current: {
|
|
52
|
+
readonly approvalGrants: {
|
|
53
|
+
readonly coordinator: "answer" | "decide" | "none";
|
|
54
|
+
};
|
|
46
55
|
readonly limits: {
|
|
47
56
|
readonly maxDepth: number;
|
|
48
57
|
readonly maxLeasesPerSession: number;
|
|
@@ -69,6 +78,9 @@ export declare const makeProjectGuardClient: (node: CliNodeOperations) => {
|
|
|
69
78
|
}>;
|
|
70
79
|
showProjectGuard: (input: ProjectGuardShowParameters) => import("../local-node/client.js").CliNodeEffect<{
|
|
71
80
|
readonly guard: {
|
|
81
|
+
readonly approvalGrants: {
|
|
82
|
+
readonly coordinator: "answer" | "decide" | "none";
|
|
83
|
+
};
|
|
72
84
|
readonly limits: {
|
|
73
85
|
readonly maxDepth: number;
|
|
74
86
|
readonly maxLeasesPerSession: number;
|
|
@@ -5,6 +5,9 @@ export declare const readGuardShow: (tokens: readonly string[]) => {
|
|
|
5
5
|
};
|
|
6
6
|
export declare const GUARD_OPTIONS: ReadonlySet<string>;
|
|
7
7
|
export declare const readGuardPreview: (parsed: ParsedOptions) => Effect.Effect<{
|
|
8
|
+
approvalGrants?: Partial<{
|
|
9
|
+
readonly coordinator: "answer" | "decide" | "none";
|
|
10
|
+
}> | undefined;
|
|
8
11
|
commandId: string;
|
|
9
12
|
expectedRevision: string;
|
|
10
13
|
limits: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SESSION_GUARD_BOUNDS } from "@maiaos/sdk";
|
|
1
|
+
import { COORDINATOR_APPROVAL_GRANTS, SESSION_GUARD_BOUNDS, } from "@maiaos/sdk";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import { CliArgumentError, parseOptions, readExpectedRevision, requirePositionals, } from "../command-line/index.js";
|
|
4
4
|
import { commandIdentifier } from "../local-node/index.js";
|
|
@@ -23,6 +23,17 @@ const readLimits = (options) => ({
|
|
|
23
23
|
maxLiveChildren: readLimit(options, "maxLiveChildren"),
|
|
24
24
|
maxMessagesPerMinute: readLimit(options, "maxMessagesPerMinute"),
|
|
25
25
|
});
|
|
26
|
+
const GRANT_OPTIONS = { coordinator: "--approval-coordinator" };
|
|
27
|
+
const readGrants = (options) => {
|
|
28
|
+
const option = GRANT_OPTIONS.coordinator;
|
|
29
|
+
const value = options.get(option);
|
|
30
|
+
if (value === undefined)
|
|
31
|
+
return undefined;
|
|
32
|
+
const levels = COORDINATOR_APPROVAL_GRANTS;
|
|
33
|
+
if (!levels.includes(value))
|
|
34
|
+
throw new CliArgumentError(`Option '${option}' must be ${levels.join(", ")}.`);
|
|
35
|
+
return { coordinator: value };
|
|
36
|
+
};
|
|
26
37
|
export const readGuardShow = (tokens) => {
|
|
27
38
|
const parsed = parseOptions(tokens, new Set());
|
|
28
39
|
requirePositionals(parsed.positionals, 1);
|
|
@@ -32,12 +43,15 @@ export const GUARD_OPTIONS = new Set([
|
|
|
32
43
|
"--command-id",
|
|
33
44
|
"--expected-revision",
|
|
34
45
|
...Object.values(LIMIT_OPTIONS),
|
|
46
|
+
...Object.values(GRANT_OPTIONS),
|
|
35
47
|
]);
|
|
36
48
|
export const readGuardPreview = (parsed) => {
|
|
37
49
|
requirePositionals(parsed.positionals, 1);
|
|
38
50
|
const expectedRevision = readExpectedRevision(parsed.options.get("--expected-revision"));
|
|
39
51
|
const limits = readLimits(parsed.options);
|
|
52
|
+
const approvalGrants = readGrants(parsed.options);
|
|
40
53
|
return Effect.map(commandIdentifier(parsed.options.get("--command-id")), (commandId) => ({
|
|
54
|
+
...(approvalGrants === undefined ? {} : { approvalGrants }),
|
|
41
55
|
commandId,
|
|
42
56
|
expectedRevision,
|
|
43
57
|
limits,
|