@maiaos/cli 0.1.0-canary.46 → 0.1.0-canary.48
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/dist/bin/maia.cdx.json +19 -19
- package/dist/bin/maia.mjs +1 -1
- package/dist/command-line/index.d.ts +1 -1
- package/dist/command-line/index.js +1 -1
- package/dist/command-line/input/arguments.d.ts +3 -0
- package/dist/command-line/input/arguments.js +8 -0
- package/dist/command-line/input/index.d.ts +1 -1
- package/dist/command-line/input/index.js +1 -1
- package/dist/import/commands.js +1 -1
- package/dist/import/input.d.ts +4 -1
- package/dist/import/input.js +23 -2
- package/dist/import/output.js +3 -1
- package/dist/session/commands.js +4 -8
- package/dist/session/tree/tree.js +1 -1
- package/package.json +4 -4
|
@@ -2,6 +2,6 @@ export { type CliDependencies, type CliServices, type CommandContext, type Comma
|
|
|
2
2
|
export { decodeJsonText, jsonLine } from "./emit/index.js";
|
|
3
3
|
export { type CliCommandOutput, type CliErrorOutput, type CliIo, type CliResolution, type CliSuccessOutput, type CliSuccessResult, exitCodeOf, type NodeResultPresenter, reportError, writeNodeResult, writeSuccess, } from "./emit/index.js";
|
|
4
4
|
export { block, cell, type CliTable, fields, formatRows, tab, withNextPage, withPrunedHistory, } from "./emit/index.js";
|
|
5
|
-
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";
|
|
5
|
+
export { argumentsAreBounded, type ArgumentToken, CliArgumentError, missingArgument, parseArguments, type ParsedArguments, type ParsedOptions, parseOptions, parseOptionsWith, readBoundedStdin, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readPermission, readRevisionOption, readWaitTimeoutSeconds, recoverStdin, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./input/index.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
|
|
@@ -2,6 +2,6 @@ export { LOCAL_NODE, } from "./context.js";
|
|
|
2
2
|
export { decodeJsonText, jsonLine } from "./emit/index.js";
|
|
3
3
|
export { exitCodeOf, reportError, writeNodeResult, writeSuccess, } from "./emit/index.js";
|
|
4
4
|
export { block, cell, fields, formatRows, tab, withNextPage, withPrunedHistory, } from "./emit/index.js";
|
|
5
|
-
export { argumentsAreBounded, CliArgumentError, missingArgument, parseArguments, parseOptions, parseOptionsWith, readBoundedStdin, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readRevisionOption, readWaitTimeoutSeconds, recoverStdin, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./input/index.js";
|
|
5
|
+
export { argumentsAreBounded, CliArgumentError, missingArgument, parseArguments, parseOptions, parseOptionsWith, readBoundedStdin, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readPermission, readRevisionOption, readWaitTimeoutSeconds, recoverStdin, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./input/index.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
|
|
@@ -38,6 +38,9 @@ export declare const requireNoArguments: (tokens: readonly string[], command: st
|
|
|
38
38
|
export declare const readPageSize: (value: string | undefined, maximum?: number) => number;
|
|
39
39
|
export declare const readCursor: (value?: string) => string;
|
|
40
40
|
export declare const readRevisionOption: (value: string | undefined, option: `--${string}`) => string;
|
|
41
|
+
export declare const readPermission: <TPermission extends string>(permission: string | undefined, validate: (permission: string) => TPermission | undefined) => {
|
|
42
|
+
readonly permission?: TPermission;
|
|
43
|
+
};
|
|
41
44
|
export declare const readExpectedRevision: (value: string | undefined) => string;
|
|
42
45
|
export declare const readDuration: (value: string, option: `--${string}`, range: {
|
|
43
46
|
readonly max: number;
|
|
@@ -177,6 +177,14 @@ export const readRevisionOption = (value, option) => {
|
|
|
177
177
|
}
|
|
178
178
|
return readInt64(value, `Option '${option}' must be a non-negative signed 64-bit integer.`);
|
|
179
179
|
};
|
|
180
|
+
export const readPermission = (permission, validate) => {
|
|
181
|
+
if (permission === undefined)
|
|
182
|
+
return {};
|
|
183
|
+
const valid = validate(permission);
|
|
184
|
+
if (valid === undefined)
|
|
185
|
+
throw new CliArgumentError("Option '--permission' must be a permission mode Claude Code or Codex defines.");
|
|
186
|
+
return { permission: valid };
|
|
187
|
+
};
|
|
180
188
|
export const readExpectedRevision = (value) => readRevisionOption(value, "--expected-revision");
|
|
181
189
|
const DURATION = /^([1-9]\d{0,5})(s|m|h)$/u;
|
|
182
190
|
const unitSeconds = (unit) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
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";
|
|
1
|
+
export { argumentsAreBounded, type ArgumentToken, CliArgumentError, missingArgument, parseArguments, type ParsedArguments, type ParsedOptions, parseOptions, parseOptionsWith, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readPermission, 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, parseOptionsWith, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readRevisionOption, readWaitTimeoutSeconds, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./arguments.js";
|
|
1
|
+
export { argumentsAreBounded, CliArgumentError, missingArgument, parseArguments, parseOptions, parseOptionsWith, readCursor, readDuration, readExpectedRevision, readGlobalValue, readPageSize, readPermission, 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
|
package/dist/import/commands.js
CHANGED
|
@@ -46,7 +46,7 @@ const previewIdOf = (preview) => {
|
|
|
46
46
|
return previewId;
|
|
47
47
|
};
|
|
48
48
|
const readAdoptMode = (tokens, context) => {
|
|
49
|
-
const parsed = parseOptions(tokens, new Set(["--command-id", "--workspace"]), new Set(["--attest-ended", ...TWO_PHASE_FLAGS]));
|
|
49
|
+
const parsed = parseOptions(tokens, new Set(["--command-id", "--permission", "--workspace"]), new Set(["--attest-ended", "--host-authority", ...TWO_PHASE_FLAGS]));
|
|
50
50
|
const mode = readTwoPhaseMode(parsed.flags, context);
|
|
51
51
|
if (mode === "confirm-stdin")
|
|
52
52
|
requirePositionals(parsed.positionals, 0);
|
package/dist/import/input.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type DiscoverySessionsListParameters, type SessionCreateParameters, type SessionHistoryReadParameters } from "@maiaos/sdk";
|
|
2
2
|
import { type ParsedOptions } from "../command-line/index.js";
|
|
3
|
+
export declare const validPermission: (permission: string, executor: SessionCreateParameters["executor"]) => SessionCreateParameters["permission"];
|
|
3
4
|
export declare const readScan: (tokens: readonly string[]) => DiscoverySessionsListParameters;
|
|
4
5
|
export declare const readNativeTarget: (value: string) => {
|
|
5
6
|
executor: "claude-code" | "codex-cli";
|
|
@@ -11,6 +12,8 @@ export declare const readAdopt: (parsed: ParsedOptions) => {
|
|
|
11
12
|
nativeId: string;
|
|
12
13
|
attestEnded?: true | undefined;
|
|
13
14
|
commandId?: string | undefined;
|
|
15
|
+
hostAuthority?: true | undefined;
|
|
14
16
|
workspaceId: string;
|
|
17
|
+
permission?: "acceptEdits" | "bypassPermissions" | "default" | "dontAsk" | "never" | "on-request" | "plan" | "untrusted" | undefined;
|
|
15
18
|
};
|
|
16
19
|
//# sourceMappingURL=input.d.ts.map
|
package/dist/import/input.js
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { sessionCreateParametersSchema, } from "@maiaos/sdk";
|
|
2
|
+
import { CliArgumentError, parseOptions, readPageSize, readPermission, requirePositionals, } from "../command-line/index.js";
|
|
3
|
+
export const validPermission = (permission, executor) => {
|
|
4
|
+
const valid = sessionCreateParametersSchema.safeParse({
|
|
5
|
+
commandId: "command_validate",
|
|
6
|
+
...(executor === undefined
|
|
7
|
+
? { connectionId: "connection_validate" }
|
|
8
|
+
: { executor }),
|
|
9
|
+
expectedRevision: "0",
|
|
10
|
+
hostAuthority: true,
|
|
11
|
+
permission,
|
|
12
|
+
workspaceId: "workspace_validate",
|
|
13
|
+
});
|
|
14
|
+
return valid.success ? valid.data.permission : undefined;
|
|
15
|
+
};
|
|
2
16
|
const SOURCES = ["claude", "codex"];
|
|
3
17
|
const readSources = (value) => {
|
|
4
18
|
if (value === undefined)
|
|
@@ -80,12 +94,19 @@ export const readAdopt = (parsed) => {
|
|
|
80
94
|
if (workspaceId === undefined)
|
|
81
95
|
throw new CliArgumentError("Option '--workspace' is required.");
|
|
82
96
|
const commandId = parsed.options.get("--command-id");
|
|
97
|
+
const permission = parsed.options.get("--permission");
|
|
98
|
+
const hostAuthority = parsed.flags.has("--host-authority");
|
|
99
|
+
if (permission !== undefined && !hostAuthority)
|
|
100
|
+
throw new CliArgumentError("Option '--permission' needs '--host-authority'.");
|
|
101
|
+
const target = readNativeTarget(parsed.positionals[0] ?? "");
|
|
83
102
|
return {
|
|
84
103
|
...(parsed.flags.has("--attest-ended")
|
|
85
104
|
? { attestEnded: true }
|
|
86
105
|
: {}),
|
|
87
106
|
...(commandId === undefined ? {} : { commandId }),
|
|
88
|
-
...
|
|
107
|
+
...(hostAuthority ? { hostAuthority: true } : {}),
|
|
108
|
+
...readPermission(permission, (value) => validPermission(value, target.executor)),
|
|
109
|
+
...target,
|
|
89
110
|
workspaceId,
|
|
90
111
|
};
|
|
91
112
|
};
|
package/dist/import/output.js
CHANGED
|
@@ -19,7 +19,9 @@ export const formatScan = (result) => {
|
|
|
19
19
|
].join("");
|
|
20
20
|
};
|
|
21
21
|
export const formatAdoptPreview = (preview) => [
|
|
22
|
-
line(`adopt ${nativeName(preview)}`, `workspace ${preview.workspaceId}`, `${preview.workingDirectory} (${preview.workingDirectoryOrigin})`, `account ${preview.connectionId}`, `${preview.liveness}/${preview.livenessEvidence}
|
|
22
|
+
line(`adopt ${nativeName(preview)}`, `workspace ${preview.workspaceId}`, `${preview.workingDirectory} (${preview.workingDirectoryOrigin})`, `account ${preview.connectionId}`, `${preview.liveness}/${preview.livenessEvidence}`, ...(preview.hostAuthority === true
|
|
23
|
+
? ["containment none (host authority)"]
|
|
24
|
+
: [])),
|
|
23
25
|
line("confirm", `printf '{"previewId":"${preview.previewId}"}' | maia session adopt --confirm-stdin`, `expires ${preview.expiresAt}`),
|
|
24
26
|
].join("");
|
|
25
27
|
export const formatAdoptConfirm = (result) => [
|
package/dist/session/commands.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MAX_SESSION_INBOX_CHECK_LIMIT, MAX_SESSION_MESSAGE_BODY_BYTES, MAX_SESSION_OBSERVE_IDS, MAX_SESSION_STALL_AFTER_SECONDS, MIN_SESSION_STALL_AFTER_SECONDS, SESSION_EFFORT_LEVELS, sessionBaseRefSchema, sessionCreateParametersSchema, } from "@maiaos/sdk";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
import { listEach, writeMerged } from "../address-space/index.js";
|
|
4
|
-
import { CliArgumentError, parseOptions, parseOptionsWith, readCursor, readDuration, readExpectedRevision, readPageSize, readWaitTimeoutSeconds, requirePositionals, writeNodeResult, } from "../command-line/index.js";
|
|
4
|
+
import { CliArgumentError, parseOptions, parseOptionsWith, readCursor, readDuration, readExpectedRevision, readPageSize, readPermission, readWaitTimeoutSeconds, requirePositionals, writeNodeResult, } from "../command-line/index.js";
|
|
5
5
|
import { mergeLists } from "../fleet/index.js";
|
|
6
6
|
import { runSessionTasks, } from "./create-tasks.js";
|
|
7
7
|
import { formatMergedSessions, formatSessionShow, writeSessionResult, } from "./output/index.js";
|
|
@@ -186,9 +186,7 @@ const readSessionSelection = ({ flags, options }, workspaceId) => {
|
|
|
186
186
|
const baseRef = readBaseRef(options.get("--base"), selection);
|
|
187
187
|
return { ...selection, ...(baseRef === undefined ? {} : { baseRef }) };
|
|
188
188
|
};
|
|
189
|
-
const
|
|
190
|
-
if (permission === undefined)
|
|
191
|
-
return {};
|
|
189
|
+
const validPermission = (permission, executor) => {
|
|
192
190
|
const valid = sessionCreateParametersSchema.safeParse({
|
|
193
191
|
commandId: "command_validate",
|
|
194
192
|
...(executor === undefined
|
|
@@ -199,9 +197,7 @@ const readPermission = (permission, executor) => {
|
|
|
199
197
|
permission,
|
|
200
198
|
workspaceId: "workspace_validate",
|
|
201
199
|
});
|
|
202
|
-
|
|
203
|
-
throw new CliArgumentError("Option '--permission' must be a permission mode Claude Code or Codex defines.");
|
|
204
|
-
return { permission: valid.data.permission };
|
|
200
|
+
return valid.success ? valid.data.permission : undefined;
|
|
205
201
|
};
|
|
206
202
|
const readHostAuthority = ({ flags, options, }) => {
|
|
207
203
|
const permission = options.get("--permission");
|
|
@@ -216,7 +212,7 @@ const readHostAuthority = ({ flags, options, }) => {
|
|
|
216
212
|
throw new CliArgumentError("Option '--host-authority' needs '--connection' or '--executor'.");
|
|
217
213
|
return {
|
|
218
214
|
hostAuthority: true,
|
|
219
|
-
...readPermission(permission, readExecutorKind(options.get("--executor"))),
|
|
215
|
+
...readPermission(permission, (value) => validPermission(value, readExecutorKind(options.get("--executor")))),
|
|
220
216
|
};
|
|
221
217
|
};
|
|
222
218
|
const readBaseRef = (value, selection) => {
|
|
@@ -162,7 +162,7 @@ export const SESSION_TREE = {
|
|
|
162
162
|
},
|
|
163
163
|
],
|
|
164
164
|
[
|
|
165
|
-
"session adopt (<claude|codex>:<native-id> --workspace <workspace-id> [--attest-ended] [--command-id <id>] [--dry-run] | --confirm-stdin)",
|
|
165
|
+
"session adopt (<claude|codex>:<native-id> --workspace <workspace-id> [--attest-ended] [--host-authority [--permission <mode>]] [--command-id <id>] [--dry-run] | --confirm-stdin)",
|
|
166
166
|
1,
|
|
167
167
|
["session.adopt.preview", "session.adopt.confirm"],
|
|
168
168
|
"Adopt a Claude Code or Codex session after a preview.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maiaos/cli",
|
|
3
|
-
"version": "0.1.0-canary.
|
|
3
|
+
"version": "0.1.0-canary.48",
|
|
4
4
|
"description": "The maia CLI and MCP server: start, drive, observe and stop swarms of Claude Code and Codex agents from a terminal, a script or another agent.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"maia",
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@earendil-works/pi-tui": "1.0.0",
|
|
66
66
|
"@effect/platform-node-shared": "4.0.0",
|
|
67
|
-
"@maiaos/agent": "0.1.0-canary.
|
|
68
|
-
"@maiaos/client-core": "0.1.0-canary.
|
|
69
|
-
"@maiaos/sdk": "0.1.0-canary.
|
|
67
|
+
"@maiaos/agent": "0.1.0-canary.48",
|
|
68
|
+
"@maiaos/client-core": "0.1.0-canary.48",
|
|
69
|
+
"@maiaos/sdk": "0.1.0-canary.48",
|
|
70
70
|
"effect": "4.0.0"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|