@maiaos/cli 0.1.0-canary.100 → 0.1.0-canary.101
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 +24 -24
- package/dist/bin/maia.mjs +1 -1
- package/dist/cli/cli.js +12 -3
- package/dist/cli/environment.js +1 -0
- package/dist/command-line/emit/index.d.ts +1 -0
- package/dist/command-line/emit/index.js +1 -0
- package/dist/command-line/emit/output.d.ts +2 -0
- package/dist/command-line/emit/tone.d.ts +8 -0
- package/dist/command-line/emit/tone.js +15 -0
- package/dist/command-line/index.d.ts +1 -0
- package/dist/command-line/index.js +1 -0
- package/dist/command-line/input/index.d.ts +1 -1
- package/dist/command-line/input/index.js +1 -1
- package/dist/command-line/input/prompt.d.ts +1 -0
- package/dist/command-line/input/prompt.js +1 -0
- package/dist/connection/system.js +20 -5
- package/package.json +4 -4
package/dist/cli/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Cause from "effect/Cause";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as References from "effect/References";
|
|
4
|
-
import { argumentsAreBounded, CliArgumentError, LOCAL_NODE, parseArguments, readGlobalValue, reportError, writeSuccess, } from "../command-line/index.js";
|
|
4
|
+
import { argumentsAreBounded, CliArgumentError, colorOn, LOCAL_NODE, parseArguments, readGlobalValue, reportError, writeSuccess, } from "../command-line/index.js";
|
|
5
5
|
import { createHelpTree, createNodeHelp, currentOptionSpellings, findNode, formatNodeHelp, formatRootHelp, isNodeBacked, REFERENCE_USAGE, unknownPathMessage, usageHint, } from "../command-tree/index.js";
|
|
6
6
|
const createArgumentError = (message) => ({
|
|
7
7
|
code: "invalid_argument",
|
|
@@ -194,17 +194,26 @@ const runResolved = (leaf, rest, context) => {
|
|
|
194
194
|
};
|
|
195
195
|
return withCliServices(Effect.flatMap(Effect.promise(() => import("../address-space/index.js")), (module) => module.routeLeaf(context, routed, prepared)));
|
|
196
196
|
};
|
|
197
|
+
const withColor = (input, { environment, leaf, parsed, }) => ({
|
|
198
|
+
...input,
|
|
199
|
+
io: {
|
|
200
|
+
...input.io,
|
|
201
|
+
color: isNodeBacked(leaf) && colorOn(parsed.json, environment, input.io),
|
|
202
|
+
},
|
|
203
|
+
});
|
|
197
204
|
const runParsed = (input, parsed) => {
|
|
198
205
|
if (isHelpInvocation(parsed))
|
|
199
206
|
return runHelp(input, parsed);
|
|
200
207
|
return Effect.gen(function* () {
|
|
201
208
|
const { node: leaf, rest } = resolveCommand(parsed);
|
|
202
|
-
const
|
|
209
|
+
const environment = yield* readEnvironment(leaf);
|
|
210
|
+
const resolved = resolveOptions(parsed, leaf, environment);
|
|
203
211
|
if (parsed.node === undefined &&
|
|
204
212
|
resolved.node !== undefined &&
|
|
205
213
|
!parsed.json)
|
|
206
214
|
input.io.stderr(`node: ${resolved.node} (MAIA_NODE)\n`);
|
|
207
|
-
const
|
|
215
|
+
const invocation = withColor(input, { environment, leaf, parsed });
|
|
216
|
+
const run = (scope) => Effect.suspend(() => runResolved(leaf, rest, commandContext(invocation, resolved, scope)));
|
|
208
217
|
return yield* atConfiguredLogLevel(isNodeBacked(leaf) ? input.logLevel : undefined, { io: input.io, json: parsed.json }, Effect.scoped(Effect.flatMap(Effect.scope, run)));
|
|
209
218
|
});
|
|
210
219
|
};
|
package/dist/cli/environment.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as Option from "effect/Option";
|
|
|
4
4
|
const readVariable = (name) => Effect.map(Effect.orElseSucceed(Config.option(Config.String(name)), Option.none), (value) => Option.getOrUndefined(value));
|
|
5
5
|
export const environmentOptions = Effect.gen(function* () {
|
|
6
6
|
return {
|
|
7
|
+
noColor: yield* readVariable("NO_COLOR"),
|
|
7
8
|
node: yield* readVariable("MAIA_NODE"),
|
|
8
9
|
noInput: yield* readVariable("MAIA_NO_INPUT"),
|
|
9
10
|
profile: yield* readVariable("MAIA_PROFILE"),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { decodeJsonText, jsonLine } from "./json.js";
|
|
2
2
|
export { type CliCommandOutput, type CliErrorOutput, type CliIo, type CliResolution, type CliSuccessOutput, type CliSuccessResult, exitCodeOf, type NodeResultPresenter, type OutputContext, reportError, writeNodeResult, writeSuccess, } from "./output.js";
|
|
3
3
|
export { block, cell, type CliTable, fields, formatRows, labelCells, tab, withNextPage, withPrunedHistory, } from "./rows.js";
|
|
4
|
+
export { colorOn, toneText } from "./tone.js";
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { decodeJsonText, jsonLine } from "./json.js";
|
|
2
2
|
export { exitCodeOf, reportError, writeNodeResult, writeSuccess, } from "./output.js";
|
|
3
3
|
export { block, cell, fields, formatRows, labelCells, tab, withNextPage, withPrunedHistory, } from "./rows.js";
|
|
4
|
+
export { colorOn, toneText } from "./tone.js";
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -4,6 +4,7 @@ import type * as Effect from "effect/Effect";
|
|
|
4
4
|
import type { CliMutationRecovery, CliNodeResult } from "../../local-node/index.js";
|
|
5
5
|
import type { BoundedStdinRequest, CliArgumentError, PromptOptions } from "../input/index.js";
|
|
6
6
|
export type CliIo = {
|
|
7
|
+
readonly color?: boolean;
|
|
7
8
|
readonly cwd?: string;
|
|
8
9
|
readonly interactive?: boolean;
|
|
9
10
|
readonly prompt?: (question: string, options?: PromptOptions) => Effect.Effect<string | undefined>;
|
|
@@ -11,6 +12,7 @@ export type CliIo = {
|
|
|
11
12
|
readonly stdin?: (request: BoundedStdinRequest) => Effect.Effect<string, CliArgumentError>;
|
|
12
13
|
readonly stdinIsTerminal?: boolean;
|
|
13
14
|
readonly stdout: (text: string) => void;
|
|
15
|
+
readonly stdoutIsTerminal?: boolean;
|
|
14
16
|
};
|
|
15
17
|
export type CliSuccessResult = {
|
|
16
18
|
readonly command: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StatusTone } from "@maiaos/client-core/status-tone";
|
|
2
|
+
export declare const toneText: (text: string, tone: StatusTone, color: boolean) => string;
|
|
3
|
+
export declare const colorOn: (json: boolean, { noColor }: {
|
|
4
|
+
readonly noColor?: string;
|
|
5
|
+
}, { stdoutIsTerminal }: {
|
|
6
|
+
readonly stdoutIsTerminal?: boolean;
|
|
7
|
+
}) => boolean;
|
|
8
|
+
//# sourceMappingURL=tone.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const TONE_SGR = {
|
|
2
|
+
broken: "31",
|
|
3
|
+
busy: undefined,
|
|
4
|
+
"needs-you": "33",
|
|
5
|
+
off: "90",
|
|
6
|
+
ok: "32",
|
|
7
|
+
};
|
|
8
|
+
export const toneText = (text, tone, color) => {
|
|
9
|
+
const sgr = TONE_SGR[tone];
|
|
10
|
+
return color && sgr !== undefined ? `\u001B[${sgr}m${text}\u001B[0m` : text;
|
|
11
|
+
};
|
|
12
|
+
export const colorOn = (json, { noColor }, { stdoutIsTerminal }) => stdoutIsTerminal === true &&
|
|
13
|
+
!json &&
|
|
14
|
+
(noColor === undefined || noColor === "");
|
|
15
|
+
//# sourceMappingURL=tone.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { type CliDependencies, type CliServices, type CommandContext, type CommandEffect, } from "./context.js";
|
|
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
|
+
export { colorOn, toneText } from "./emit/index.js";
|
|
4
5
|
export { block, cell, type CliTable, fields, formatRows, labelCells, tab, withNextPage, withPrunedHistory, } from "./emit/index.js";
|
|
5
6
|
export { argumentsAreBounded, type ArgumentToken, CliArgumentError, LABEL_OPTION, LOCAL_NODE, missingArgument, type OptionSpec, parseArguments, type ParsedArguments, type ParsedOptions, parseOptions, parseOptionsWith, readBoundedStdin, readCursor, readDuration, readExpectedRevision, readGlobalValue, readLabels, readNodeName, readOptionalRevision, readPageSize, readPermission, readRevisionOption, readSessionRole, readSessionTitle, readWaitTimeoutSeconds, recoverStdin, requireNoArguments, requireOneLabelPerOption, requirePositionals, tokenizeArguments, unknownCommand, } from "./input/index.js";
|
|
6
7
|
export { askToConfirm, canPrompt, confirmationOf, confirmParameters, EXIT_CANCELLED, peekStdin, promptOrRefuse, readInputMode, readPipedPreview, readTwoPhaseMode, requestedTwoPhaseMode, runInputTwoPhase, runTwoPhase, TWO_PHASE_FLAGS, type TwoPhaseMode, } from "./two-phase/index.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { decodeJsonText, jsonLine } from "./emit/index.js";
|
|
2
2
|
export { exitCodeOf, reportError, writeNodeResult, writeSuccess, } from "./emit/index.js";
|
|
3
|
+
export { colorOn, toneText } from "./emit/index.js";
|
|
3
4
|
export { block, cell, fields, formatRows, labelCells, tab, withNextPage, withPrunedHistory, } from "./emit/index.js";
|
|
4
5
|
export { argumentsAreBounded, CliArgumentError, LABEL_OPTION, LOCAL_NODE, missingArgument, parseArguments, parseOptions, parseOptionsWith, readBoundedStdin, readCursor, readDuration, readExpectedRevision, readGlobalValue, readLabels, readNodeName, readOptionalRevision, readPageSize, readPermission, readRevisionOption, readSessionRole, readSessionTitle, readWaitTimeoutSeconds, recoverStdin, requireNoArguments, requireOneLabelPerOption, requirePositionals, tokenizeArguments, unknownCommand, } from "./input/index.js";
|
|
5
6
|
export { askToConfirm, canPrompt, confirmationOf, confirmParameters, EXIT_CANCELLED, peekStdin, promptOrRefuse, readInputMode, readPipedPreview, readTwoPhaseMode, requestedTwoPhaseMode, runInputTwoPhase, runTwoPhase, TWO_PHASE_FLAGS, } from "./two-phase/index.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { argumentsAreBounded, type ArgumentToken, CliArgumentError, LOCAL_NODE, missingArgument, type OptionSpec, parseArguments, type ParsedArguments, type ParsedOptions, parseOptions, parseOptionsWith, readCursor, readDuration, readExpectedRevision, readGlobalValue, readNodeName, readOptionalRevision, readPageSize, readPermission, readRevisionOption, readWaitTimeoutSeconds, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./arguments.js";
|
|
2
2
|
export { LABEL_OPTION, readLabels, readSessionRole, readSessionTitle, requireOneLabelPerOption, } from "./manager-options.js";
|
|
3
|
-
export { promptLine, type PromptOptions, standardInputIsTerminal, terminalIsInteractive, } from "./prompt.js";
|
|
3
|
+
export { promptLine, type PromptOptions, standardInputIsTerminal, standardOutputIsTerminal, terminalIsInteractive, } from "./prompt.js";
|
|
4
4
|
export { type BoundedStdinRequest, readBoundedStdin, recoverStdin, replayStdin, } from "./stdin.js";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { argumentsAreBounded, CliArgumentError, LOCAL_NODE, missingArgument, parseArguments, parseOptions, parseOptionsWith, readCursor, readDuration, readExpectedRevision, readGlobalValue, readNodeName, readOptionalRevision, readPageSize, readPermission, readRevisionOption, readWaitTimeoutSeconds, requireNoArguments, requirePositionals, tokenizeArguments, unknownCommand, } from "./arguments.js";
|
|
2
2
|
export { LABEL_OPTION, readLabels, readSessionRole, readSessionTitle, requireOneLabelPerOption, } from "./manager-options.js";
|
|
3
|
-
export { promptLine, standardInputIsTerminal, terminalIsInteractive, } from "./prompt.js";
|
|
3
|
+
export { promptLine, standardInputIsTerminal, standardOutputIsTerminal, terminalIsInteractive, } from "./prompt.js";
|
|
4
4
|
export { readBoundedStdin, recoverStdin, replayStdin, } from "./stdin.js";
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -6,4 +6,5 @@ export type PromptOptions = {
|
|
|
6
6
|
export declare const promptLine: (question: string, options?: PromptOptions) => Effect.Effect<string | undefined>;
|
|
7
7
|
export declare const terminalIsInteractive: () => boolean;
|
|
8
8
|
export declare const standardInputIsTerminal: () => boolean;
|
|
9
|
+
export declare const standardOutputIsTerminal: () => boolean;
|
|
9
10
|
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -42,4 +42,5 @@ export const promptLine = (question, options = {}) => Effect.acquireUseRelease(o
|
|
|
42
42
|
const isTerminal = (stream) => stream.isTTY === true;
|
|
43
43
|
export const terminalIsInteractive = () => isTerminal(process.stdin) && isTerminal(process.stderr);
|
|
44
44
|
export const standardInputIsTerminal = () => isTerminal(process.stdin);
|
|
45
|
+
export const standardOutputIsTerminal = () => isTerminal(process.stdout);
|
|
45
46
|
//# sourceMappingURL=prompt.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { EXECUTOR_READINESS, executorReadinessOf, } from "@maiaos/client-core/status-tone";
|
|
1
2
|
import { connectionSystemConfirmParametersSchema, connectionUpkeepConfirmParametersSchema, EXECUTOR_IDS, } from "@maiaos/sdk";
|
|
2
3
|
import * as Effect from "effect/Effect";
|
|
3
|
-
import { askToConfirm, CliArgumentError, confirmParameters, EXIT_CANCELLED, exitCodeOf, jsonLine, parseOptions, promptOrRefuse, readPipedPreview, reportError, requestedTwoPhaseMode, requirePositionals, TWO_PHASE_FLAGS, writeSuccess, } from "../command-line/index.js";
|
|
4
|
+
import { askToConfirm, CliArgumentError, confirmParameters, EXIT_CANCELLED, exitCodeOf, jsonLine, parseOptions, promptOrRefuse, readPipedPreview, reportError, requestedTwoPhaseMode, requirePositionals, toneText, TWO_PHASE_FLAGS, writeSuccess, } from "../command-line/index.js";
|
|
4
5
|
import { commandIdentifier } from "../local-node/index.js";
|
|
5
6
|
import { personError, pipedPlan, planSetup, planText, readSetupFile, } from "./setup-file.js";
|
|
6
7
|
import { applyProject, projectAppliedText, readProject, recheckProject, required, SetupNodeError, } from "./setup-project.js";
|
|
@@ -56,15 +57,27 @@ const upkeepText = ({ upkeep }) => {
|
|
|
56
57
|
: [` next: ${PROPOSALS[proposal.kind](proposal.command)}`]),
|
|
57
58
|
];
|
|
58
59
|
};
|
|
59
|
-
const
|
|
60
|
+
const readinessText = (item, color) => {
|
|
61
|
+
const { label, tone } = EXECUTOR_READINESS[executorReadinessOf({
|
|
62
|
+
...(item.connection === undefined
|
|
63
|
+
? {}
|
|
64
|
+
: { account: { usable: item.connection.state === "enabled" } }),
|
|
65
|
+
approved: item.executableApproved,
|
|
66
|
+
customEndpoint: item.auth === "custom-endpoint",
|
|
67
|
+
installed: item.binary.found,
|
|
68
|
+
updateAvailable: item.upkeep?.proposal?.kind === "update-available",
|
|
69
|
+
})];
|
|
70
|
+
return toneText(label, tone, color);
|
|
71
|
+
};
|
|
72
|
+
const detectedText = (item, color) => {
|
|
60
73
|
if (!item.binary.found)
|
|
61
|
-
return `${item.executor}:
|
|
74
|
+
return `${item.executor}: ${readinessText(item, color)}\n`;
|
|
62
75
|
const { onNodePath, path, version } = item.binary;
|
|
63
76
|
const account = item.connection === undefined
|
|
64
77
|
? "no system-default account"
|
|
65
78
|
: `account ${item.connection.name} (${item.connection.state})`;
|
|
66
79
|
return [
|
|
67
|
-
`${item.executor} ${version ?? "(version unknown)"} ${path}${onNodePath ? "" : " (not on the Node's PATH)"}`,
|
|
80
|
+
`${item.executor} ${version ?? "(version unknown)"} ${path}${onNodePath ? "" : " (not on the Node's PATH)"}: ${readinessText(item, color)}`,
|
|
68
81
|
` ${signIn(item)}; ${account}; executable ${item.executableApproved ? "approved" : "not approved"}`,
|
|
69
82
|
...(item.endpoint?.credential === "helper" && item.connection === undefined
|
|
70
83
|
? [
|
|
@@ -92,7 +105,9 @@ export const runConnectionDetect = (tokens, context) => Effect.gen(function* ()
|
|
|
92
105
|
if (parsed.flags.has("--refresh"))
|
|
93
106
|
yield* refreshNewest(context);
|
|
94
107
|
const detected = yield* required(context.dependencies.detectConnections?.({ upkeep: true }));
|
|
95
|
-
write(context, { command: "connection.detect", result: markDetected(detected) }, detected.executors
|
|
108
|
+
write(context, { command: "connection.detect", result: markDetected(detected) }, detected.executors
|
|
109
|
+
.map((item) => detectedText(item, context.io.color === true))
|
|
110
|
+
.join(""));
|
|
96
111
|
return 0;
|
|
97
112
|
}).pipe(Effect.catch(reportSetupFailure(context)));
|
|
98
113
|
const SKIPPED = new Map([
|
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.101",
|
|
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",
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@earendil-works/pi-tui": "1.0.0",
|
|
67
67
|
"@effect/platform-node-shared": "4.0.0",
|
|
68
|
-
"@maiaos/agent": "0.1.0-canary.
|
|
69
|
-
"@maiaos/client-core": "0.1.0-canary.
|
|
70
|
-
"@maiaos/sdk": "0.1.0-canary.
|
|
68
|
+
"@maiaos/agent": "0.1.0-canary.101",
|
|
69
|
+
"@maiaos/client-core": "0.1.0-canary.101",
|
|
70
|
+
"@maiaos/sdk": "0.1.0-canary.101",
|
|
71
71
|
"effect": "4.0.0"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|