@maiaos/cli 0.1.0-canary.38 → 0.1.0-canary.39
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/mcp/calls.js +4 -0
- package/dist/mcp/routing.js +1 -0
- package/dist/session/approval/client.d.ts +5 -2
- package/dist/session/approval/client.js +2 -2
- package/dist/session/approval/commands.js +23 -13
- package/dist/session/tree/tree.js +10 -10
- package/dist/session/turn/commands.js +67 -15
- package/dist/session/turn/output.d.ts +6 -0
- package/dist/session/turn/output.js +8 -1
- package/dist/status/client.d.ts +1 -0
- package/package.json +4 -4
package/dist/mcp/calls.js
CHANGED
|
@@ -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)),
|
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],
|
|
@@ -19,6 +19,7 @@ export declare const makeApprovalClient: (node: CliNodeOperations) => {
|
|
|
19
19
|
readonly actorId: string;
|
|
20
20
|
readonly answer?: string | undefined;
|
|
21
21
|
readonly forSession?: true | undefined;
|
|
22
|
+
readonly guardRevision?: string | undefined;
|
|
22
23
|
readonly reason?: string | undefined;
|
|
23
24
|
readonly resolvedAt: string;
|
|
24
25
|
} | undefined;
|
|
@@ -32,7 +33,7 @@ export declare const makeApprovalClient: (node: CliNodeOperations) => {
|
|
|
32
33
|
}[];
|
|
33
34
|
readonly method: "approval.list";
|
|
34
35
|
}>;
|
|
35
|
-
respondToApproval: (input: ApprovalRespondParameters) => import("../../local-node/client.js").CliNodeEffect<{
|
|
36
|
+
respondToApproval: (input: ApprovalRespondParameters, asCoordinator?: boolean) => import("../../local-node/client.js").CliNodeEffect<{
|
|
36
37
|
readonly approval: {
|
|
37
38
|
readonly approvalId: string;
|
|
38
39
|
readonly createdAt: string;
|
|
@@ -50,6 +51,7 @@ export declare const makeApprovalClient: (node: CliNodeOperations) => {
|
|
|
50
51
|
readonly actorId: string;
|
|
51
52
|
readonly answer?: string | undefined;
|
|
52
53
|
readonly forSession?: true | undefined;
|
|
54
|
+
readonly guardRevision?: string | undefined;
|
|
53
55
|
readonly reason?: string | undefined;
|
|
54
56
|
readonly resolvedAt: string;
|
|
55
57
|
} | undefined;
|
|
@@ -81,7 +83,7 @@ export declare const makeApprovalClient: (node: CliNodeOperations) => {
|
|
|
81
83
|
readonly updatedAt: string;
|
|
82
84
|
};
|
|
83
85
|
}>;
|
|
84
|
-
showApproval: (input: ApprovalShowParameters) => import("../../local-node/client.js").CliNodeEffect<{
|
|
86
|
+
showApproval: (input: ApprovalShowParameters, asCoordinator?: boolean) => import("../../local-node/client.js").CliNodeEffect<{
|
|
85
87
|
readonly approval: {
|
|
86
88
|
readonly approvalId: string;
|
|
87
89
|
readonly createdAt: string;
|
|
@@ -99,6 +101,7 @@ export declare const makeApprovalClient: (node: CliNodeOperations) => {
|
|
|
99
101
|
readonly actorId: string;
|
|
100
102
|
readonly answer?: string | undefined;
|
|
101
103
|
readonly forSession?: true | undefined;
|
|
104
|
+
readonly guardRevision?: string | undefined;
|
|
102
105
|
readonly reason?: string | undefined;
|
|
103
106
|
readonly resolvedAt: string;
|
|
104
107
|
} | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { approvalListParametersSchema, approvalRespondParametersSchema, approvalShowParametersSchema, } from "@maiaos/sdk";
|
|
2
2
|
export const makeApprovalClient = (node) => ({
|
|
3
3
|
listApprovals: (input) => node.runValidatedNodeOperation(input, approvalListParametersSchema, (client, parameters, options) => client.listApprovals(parameters, options)),
|
|
4
|
-
respondToApproval: (input) => node.runValidatedNodeOperation(input, approvalRespondParametersSchema, (client, parameters, options) => client.respondToApproval(parameters, options), { commandId: input.commandId }),
|
|
5
|
-
showApproval: (input) => node.runValidatedNodeOperation(input, approvalShowParametersSchema, (client, parameters, options) => client.showApproval(parameters, options)),
|
|
4
|
+
respondToApproval: (input, asCoordinator = false) => (asCoordinator ? node.asCoordinator() : node).runValidatedNodeOperation(input, approvalRespondParametersSchema, (client, parameters, options) => client.respondToApproval(parameters, options), { commandId: input.commandId }),
|
|
5
|
+
showApproval: (input, asCoordinator = false) => (asCoordinator ? node.asCoordinator() : node).runValidatedNodeOperation(input, approvalShowParametersSchema, (client, parameters, options) => client.showApproval(parameters, options)),
|
|
6
6
|
});
|
|
7
7
|
//# sourceMappingURL=client.js.map
|
|
@@ -85,10 +85,16 @@ const OPTIONS = {
|
|
|
85
85
|
approve: new Set(["--command-id"]),
|
|
86
86
|
deny: new Set(["--command-id", "--reason"]),
|
|
87
87
|
};
|
|
88
|
-
const
|
|
88
|
+
const FLAGS = {
|
|
89
|
+
answer: new Set(["--as-coordinator"]),
|
|
90
|
+
approve: new Set(["--as-coordinator", "--for-session"]),
|
|
91
|
+
deny: new Set(["--as-coordinator"]),
|
|
92
|
+
};
|
|
93
|
+
const confirmed = (context, { approval, asCoordinator, decision }) => {
|
|
89
94
|
context.io.stderr(`${describeApproval(approval)}\n`);
|
|
90
|
-
if (
|
|
91
|
-
decision.decision !== "
|
|
95
|
+
if (asCoordinator ||
|
|
96
|
+
(decision.decision !== "approve" &&
|
|
97
|
+
decision.decision !== "approve_for_session"))
|
|
92
98
|
return Effect.succeed(true);
|
|
93
99
|
const scope = decision.decision === "approve_for_session"
|
|
94
100
|
? "for this Session until its worker restarts"
|
|
@@ -103,38 +109,42 @@ const notConfirmed = (context) => reportError({
|
|
|
103
109
|
message: "Nothing approved; the worker still waits until the request expires.",
|
|
104
110
|
retryable: false,
|
|
105
111
|
}, context);
|
|
106
|
-
const decide = (context,
|
|
112
|
+
const decide = (context, { approvalId, asCoordinator, commandId, requested }) => {
|
|
107
113
|
const { respondToApproval, showApproval } = context.dependencies;
|
|
108
114
|
if (respondToApproval === undefined || showApproval === undefined)
|
|
109
115
|
return missing("decision");
|
|
110
116
|
return Effect.gen(function* () {
|
|
111
|
-
const shown = yield* showApproval({ approvalId
|
|
117
|
+
const shown = yield* showApproval({ approvalId }, asCoordinator);
|
|
112
118
|
if (!shown.ok)
|
|
113
119
|
return write(context)(shown);
|
|
114
120
|
const { approval } = shown.value;
|
|
115
|
-
const decision = resolveAnswer(approval,
|
|
116
|
-
|
|
121
|
+
const decision = resolveAnswer(approval, requested);
|
|
122
|
+
const reading = { approval, asCoordinator, decision };
|
|
123
|
+
if (!(yield* confirmed(context, reading)))
|
|
117
124
|
return notConfirmed(context);
|
|
118
|
-
const
|
|
125
|
+
const id = yield* commandIdentifier(commandId);
|
|
119
126
|
return write(context)(yield* respondToApproval({
|
|
120
127
|
...decision,
|
|
121
|
-
approvalId
|
|
122
|
-
commandId,
|
|
128
|
+
approvalId,
|
|
129
|
+
commandId: id,
|
|
123
130
|
requestDigest: approval.requestDigest,
|
|
124
|
-
}));
|
|
131
|
+
}, asCoordinator));
|
|
125
132
|
});
|
|
126
133
|
};
|
|
127
134
|
const runDecision = (verb, tokens, context) => Effect.gen(function* () {
|
|
128
|
-
|
|
135
|
+
const asCoordinator = tokens.includes("--as-coordinator");
|
|
136
|
+
if (!asCoordinator &&
|
|
137
|
+
(verb !== "answer" || !(yield* holdsSessionCredential)))
|
|
129
138
|
requirePerson(context, verb);
|
|
130
139
|
return yield* parseDecision(verb, tokens, context);
|
|
131
140
|
});
|
|
132
141
|
const parseDecision = (verb, tokens, context) => {
|
|
133
|
-
const parsed = parseOptions(tokens, OPTIONS[verb], verb
|
|
142
|
+
const parsed = parseOptions(tokens, OPTIONS[verb], FLAGS[verb]);
|
|
134
143
|
requirePositionals(parsed.positionals, 1);
|
|
135
144
|
const commandId = parsed.options.get("--command-id");
|
|
136
145
|
return decide(context, {
|
|
137
146
|
approvalId: parsed.positionals[0] ?? "",
|
|
147
|
+
asCoordinator: parsed.flags.has("--as-coordinator"),
|
|
138
148
|
...(commandId === undefined ? {} : { commandId }),
|
|
139
149
|
requested: readDecision(verb, parsed.options, parsed.flags),
|
|
140
150
|
});
|
|
@@ -201,12 +201,12 @@ export const SESSION_TREE = {
|
|
|
201
201
|
{ run: [session, "runSessionInboxAck"] },
|
|
202
202
|
],
|
|
203
203
|
[
|
|
204
|
-
"session turn send --session <session-id> --prompt-stdin --expected-revision <revision> [--command-id <id>]",
|
|
204
|
+
"session turn send --session <session-id> --prompt-stdin --expected-revision <revision> [--wait] [--command-id <id>]",
|
|
205
205
|
1,
|
|
206
206
|
"turn.send",
|
|
207
|
-
"Send a turn from stdin; it queues
|
|
207
|
+
"Send a turn from stdin; it queues. --wait returns once it is done.",
|
|
208
208
|
{
|
|
209
|
-
example: "printf %s 'Explain the build' | maia --json session turn send --session session_1 --prompt-stdin --expected-revision 2 --command-id send-1",
|
|
209
|
+
example: "printf %s 'Explain the build' | maia --json session turn send --session session_1 --prompt-stdin --expected-revision 2 --wait --command-id send-1",
|
|
210
210
|
route: "--session",
|
|
211
211
|
run: [turn, "runTurnSend"],
|
|
212
212
|
},
|
|
@@ -234,13 +234,13 @@ export const SESSION_TREE = {
|
|
|
234
234
|
},
|
|
235
235
|
],
|
|
236
236
|
[
|
|
237
|
-
"session turn show <turn-id> [--include-content]",
|
|
237
|
+
"session turn show (<turn-id> | --session <session-id> --latest) [--include-content]",
|
|
238
238
|
1,
|
|
239
239
|
"turn.show",
|
|
240
|
-
"Show
|
|
240
|
+
"Show a turn or a Session's latest turn; --include-content adds its text.",
|
|
241
241
|
{
|
|
242
|
-
example: "maia --json session turn show
|
|
243
|
-
route: "<turn-id>",
|
|
242
|
+
example: "maia --json session turn show --session session_1 --latest --include-content",
|
|
243
|
+
route: ["<turn-id>", "--session"],
|
|
244
244
|
run: [turn, "runTurnShow"],
|
|
245
245
|
},
|
|
246
246
|
],
|
|
@@ -285,7 +285,7 @@ export const SESSION_TREE = {
|
|
|
285
285
|
{ route: "<approval-id>", run: [approval, "runApprovalShow"] },
|
|
286
286
|
],
|
|
287
287
|
[
|
|
288
|
-
"session approval approve <approval-id> [--for-session] [--command-id <id>]",
|
|
288
|
+
"session approval approve <approval-id> [--for-session] [--as-coordinator] [--command-id <id>]",
|
|
289
289
|
1,
|
|
290
290
|
"approval.respond",
|
|
291
291
|
"Approve a worker's request.",
|
|
@@ -297,7 +297,7 @@ export const SESSION_TREE = {
|
|
|
297
297
|
},
|
|
298
298
|
],
|
|
299
299
|
[
|
|
300
|
-
"session approval deny <approval-id> [--reason <text>] [--command-id <id>]",
|
|
300
|
+
"session approval deny <approval-id> [--reason <text>] [--as-coordinator] [--command-id <id>]",
|
|
301
301
|
1,
|
|
302
302
|
"approval.respond",
|
|
303
303
|
"Deny a worker's request.",
|
|
@@ -308,7 +308,7 @@ export const SESSION_TREE = {
|
|
|
308
308
|
},
|
|
309
309
|
],
|
|
310
310
|
[
|
|
311
|
-
"session approval answer <approval-id> (--text <answer> | --option <option-id>) [--command-id <id>]",
|
|
311
|
+
"session approval answer <approval-id> (--text <answer> | --option <option-id>) [--as-coordinator] [--command-id <id>]",
|
|
312
312
|
1,
|
|
313
313
|
"approval.respond",
|
|
314
314
|
"Answer a worker's question.",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MAX_TURN_INPUT_BYTES, MAX_TURN_WAIT_IDS, } from "@maiaos/sdk";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
|
-
import { CliArgumentError, parseOptions, readExpectedRevision, readRevisionOption, readWaitTimeoutSeconds, requirePositionals, writeNodeResult, } from "../../command-line/index.js";
|
|
4
|
-
import { formatTurnMutation, formatTurnQueue, formatTurnShow, formatTurnWait, turnWaitExitCode, } from "./output.js";
|
|
3
|
+
import { CliArgumentError, parseOptions, readExpectedRevision, readRevisionOption, readWaitTimeoutSeconds, reportError, requirePositionals, writeNodeResult, writeSuccess, } from "../../command-line/index.js";
|
|
4
|
+
import { formatTurnMutation, formatTurnQueue, formatTurnSend, formatTurnShow, formatTurnWait, turnWaitExitCode, } from "./output.js";
|
|
5
5
|
const utf8 = new TextEncoder();
|
|
6
6
|
const summarizeTurnMutation = (result) => ({
|
|
7
7
|
delivery: result.delivery,
|
|
@@ -11,8 +11,9 @@ const summarizeTurnMutation = (result) => ({
|
|
|
11
11
|
state: result.turn.state,
|
|
12
12
|
turnId: result.turn.id,
|
|
13
13
|
});
|
|
14
|
+
const SEND_WAIT_MILLISECONDS = 24 * 60 * 60 * 1000;
|
|
14
15
|
const parseTurnSendArguments = (tokens) => {
|
|
15
|
-
const parsed = parseOptions(tokens, new Set(["--command-id", "--expected-revision", "--session"]), new Set(["--prompt-stdin"]));
|
|
16
|
+
const parsed = parseOptions(tokens, new Set(["--command-id", "--expected-revision", "--session"]), new Set(["--prompt-stdin", "--wait"]));
|
|
16
17
|
requirePositionals(parsed.positionals, 0);
|
|
17
18
|
const sessionId = parsed.options.get("--session");
|
|
18
19
|
if (sessionId === undefined) {
|
|
@@ -25,9 +26,31 @@ const parseTurnSendArguments = (tokens) => {
|
|
|
25
26
|
return {
|
|
26
27
|
expectedRevision: readExpectedRevision(parsed.options.get("--expected-revision")),
|
|
27
28
|
sessionId,
|
|
29
|
+
wait: parsed.flags.has("--wait"),
|
|
28
30
|
...(commandId === undefined ? {} : { commandId }),
|
|
29
31
|
};
|
|
30
32
|
};
|
|
33
|
+
const waitFailure = (turnId, error) => ({
|
|
34
|
+
...error,
|
|
35
|
+
message: `Turn ${turnId} was accepted, but waiting for it failed: ${error.message} Follow it with 'maia session turn wait ${turnId}'.`,
|
|
36
|
+
});
|
|
37
|
+
const waitForSentTurn = (context, sent) => Effect.gen(function* () {
|
|
38
|
+
const { waitTurns } = context.dependencies;
|
|
39
|
+
if (waitTurns === undefined)
|
|
40
|
+
throw new CliArgumentError("Turn wait is unavailable.");
|
|
41
|
+
const waited = yield* waitTurns({
|
|
42
|
+
mode: "all",
|
|
43
|
+
timeoutMilliseconds: SEND_WAIT_MILLISECONDS,
|
|
44
|
+
turnIds: [sent.turn.id],
|
|
45
|
+
});
|
|
46
|
+
if (!waited.ok)
|
|
47
|
+
return reportError(waitFailure(sent.turn.id, waited.error), context);
|
|
48
|
+
writeSuccess({
|
|
49
|
+
command: "turn.send",
|
|
50
|
+
result: { ...summarizeTurnMutation(sent), wait: waited.value },
|
|
51
|
+
}, context, formatTurnSend);
|
|
52
|
+
return turnWaitExitCode(waited.value);
|
|
53
|
+
});
|
|
31
54
|
export const runTurnSend = (tokens, context) => Effect.gen(function* () {
|
|
32
55
|
const input = parseTurnSendArguments(tokens);
|
|
33
56
|
if (context.io.stdin === undefined) {
|
|
@@ -38,14 +61,21 @@ export const runTurnSend = (tokens, context) => Effect.gen(function* () {
|
|
|
38
61
|
maxBytes: MAX_TURN_INPUT_BYTES,
|
|
39
62
|
maxChunks: 1024,
|
|
40
63
|
});
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}),
|
|
47
|
-
toText: formatTurnMutation,
|
|
64
|
+
const sent = yield* context.dependencies.sendTurn({
|
|
65
|
+
...(input.commandId === undefined ? {} : { commandId: input.commandId }),
|
|
66
|
+
expectedRevision: input.expectedRevision,
|
|
67
|
+
prompt,
|
|
68
|
+
sessionId: input.sessionId,
|
|
48
69
|
});
|
|
70
|
+
if (!sent.ok || !input.wait)
|
|
71
|
+
return writeNodeResult(sent, context, {
|
|
72
|
+
toResult: (value) => ({
|
|
73
|
+
command: "turn.send",
|
|
74
|
+
result: summarizeTurnMutation(value),
|
|
75
|
+
}),
|
|
76
|
+
toText: formatTurnSend,
|
|
77
|
+
});
|
|
78
|
+
return yield* waitForSentTurn(context, sent.value);
|
|
49
79
|
});
|
|
50
80
|
const parseTurnMutationArguments = (tokens, revisionOption) => {
|
|
51
81
|
const parsed = parseOptions(tokens, new Set(["--command-id", revisionOption]));
|
|
@@ -106,14 +136,21 @@ export const runTurnQueue = (tokens, context) => Effect.gen(function* () {
|
|
|
106
136
|
});
|
|
107
137
|
});
|
|
108
138
|
const parseTurnShowArguments = (tokens) => {
|
|
109
|
-
const parsed = parseOptions(tokens, new Set(), new Set(["--include-content"]));
|
|
110
|
-
requirePositionals(parsed.positionals, 1);
|
|
139
|
+
const parsed = parseOptions(tokens, new Set(["--session"]), new Set(["--include-content", "--latest"]));
|
|
111
140
|
const includeContent = parsed.flags.has("--include-content");
|
|
141
|
+
const sessionId = parsed.options.get("--session");
|
|
142
|
+
if (sessionId !== undefined || parsed.flags.has("--latest")) {
|
|
143
|
+
if (sessionId === undefined || !parsed.flags.has("--latest"))
|
|
144
|
+
throw new CliArgumentError("Use '--session' and '--latest' together.");
|
|
145
|
+
requirePositionals(parsed.positionals, 0);
|
|
146
|
+
return { includeContent, target: { sessionId, type: "latest" } };
|
|
147
|
+
}
|
|
148
|
+
requirePositionals(parsed.positionals, 1);
|
|
112
149
|
const turnId = parsed.positionals[0];
|
|
113
150
|
if (turnId === undefined) {
|
|
114
151
|
throw new CliArgumentError("The turn identifier is missing.");
|
|
115
152
|
}
|
|
116
|
-
return { includeContent, turnId };
|
|
153
|
+
return { includeContent, target: { turnId, type: "turn" } };
|
|
117
154
|
};
|
|
118
155
|
const turnTerminalProjection = (turn) => {
|
|
119
156
|
if (turn.state === "completed") {
|
|
@@ -145,13 +182,28 @@ const projectTurnWithoutContent = (value) => ({
|
|
|
145
182
|
const summarizeTurnShow = (value, includeContent) => includeContent
|
|
146
183
|
? { ...value, contentIncluded: true }
|
|
147
184
|
: projectTurnWithoutContent(value);
|
|
185
|
+
const turnToShow = (context, target) => {
|
|
186
|
+
const { showSession, showTurn } = context.dependencies;
|
|
187
|
+
if (target.type === "turn")
|
|
188
|
+
return showTurn(target.turnId);
|
|
189
|
+
return Effect.flatMap(showSession(target.sessionId), (shown) => {
|
|
190
|
+
if (!shown.ok)
|
|
191
|
+
return Effect.succeed({ error: shown.error, ok: false });
|
|
192
|
+
const { latestTurnId } = shown.value.session;
|
|
193
|
+
return latestTurnId === undefined
|
|
194
|
+
? Effect.succeed({ ok: true, value: undefined })
|
|
195
|
+
: showTurn(latestTurnId);
|
|
196
|
+
});
|
|
197
|
+
};
|
|
148
198
|
export const runTurnShow = (tokens, context) => Effect.gen(function* () {
|
|
149
199
|
const input = parseTurnShowArguments(tokens);
|
|
150
|
-
const result = yield* context
|
|
200
|
+
const result = yield* turnToShow(context, input.target);
|
|
151
201
|
return writeNodeResult(result, context, {
|
|
152
202
|
toResult: (value) => ({
|
|
153
203
|
command: "turn.show",
|
|
154
|
-
result:
|
|
204
|
+
result: value === undefined
|
|
205
|
+
? { contentIncluded: false, method: "turn.show" }
|
|
206
|
+
: summarizeTurnShow(value, input.includeContent),
|
|
155
207
|
}),
|
|
156
208
|
toText: formatTurnShow,
|
|
157
209
|
});
|
|
@@ -8,6 +8,7 @@ export type CliTurnMutation = {
|
|
|
8
8
|
readonly sessionId: string;
|
|
9
9
|
readonly state: TurnInterruptResult["turn"]["state"];
|
|
10
10
|
readonly turnId: string;
|
|
11
|
+
readonly wait?: TurnWaitResult;
|
|
11
12
|
};
|
|
12
13
|
};
|
|
13
14
|
export type CliTurnShow = {
|
|
@@ -29,6 +30,10 @@ export type CliTurnShow = {
|
|
|
29
30
|
readonly state: TurnShowResult["turn"]["state"];
|
|
30
31
|
readonly tokenUsage?: TurnTokenUsage;
|
|
31
32
|
};
|
|
33
|
+
} | {
|
|
34
|
+
readonly contentIncluded: false;
|
|
35
|
+
readonly method: "turn.show";
|
|
36
|
+
readonly turn?: undefined;
|
|
32
37
|
};
|
|
33
38
|
};
|
|
34
39
|
export type CliTurnWait = {
|
|
@@ -40,6 +45,7 @@ export type CliTurnQueue = {
|
|
|
40
45
|
readonly result: TurnQueueListResult;
|
|
41
46
|
};
|
|
42
47
|
export declare const formatTurnMutation: ({ result }: CliTurnMutation) => string;
|
|
48
|
+
export declare const formatTurnSend: (output: CliTurnMutation) => string;
|
|
43
49
|
export declare const formatTurnQueue: ({ result }: CliTurnQueue) => string;
|
|
44
50
|
export declare const formatTurnShow: ({ result }: CliTurnShow) => string;
|
|
45
51
|
export declare const formatTurnWait: ({ result }: CliTurnWait) => string;
|
|
@@ -5,6 +5,9 @@ export const formatTurnMutation = ({ result }) => fields([
|
|
|
5
5
|
["state", result.state],
|
|
6
6
|
["revision", result.revision],
|
|
7
7
|
]);
|
|
8
|
+
export const formatTurnSend = (output) => output.result.wait === undefined
|
|
9
|
+
? formatTurnMutation(output)
|
|
10
|
+
: formatTurnWait({ command: "turn.wait", result: output.result.wait });
|
|
8
11
|
const turnFields = (turn, reason) => fields([
|
|
9
12
|
["turn", turn.id],
|
|
10
13
|
["state", turn.state],
|
|
@@ -35,9 +38,13 @@ const formatUsage = (usage) => usage === undefined
|
|
|
35
38
|
? ""
|
|
36
39
|
: `tokens: input ${String(usage.inputTokens)} (cached ${String(usage.cachedInputTokens)}), output ${String(usage.outputTokens)} (reasoning ${String(usage.reasoningOutputTokens)}), total ${String(usage.totalTokens)}${usage.modelCallCount === undefined ? "" : `, model calls ${String(usage.modelCallCount)}`}\n`;
|
|
37
40
|
const formatContent = (turn) => `input:\n${block(turn.input.text)}\n${turn.state === "completed" ? `response:\n${block(turn.responseText)}\n` : ""}`;
|
|
38
|
-
const shownContent = (result) => result.contentIncluded
|
|
41
|
+
const shownContent = (result) => result.contentIncluded && result.turn !== undefined
|
|
42
|
+
? formatContent(result.turn)
|
|
43
|
+
: "";
|
|
39
44
|
export const formatTurnShow = ({ result }) => {
|
|
40
45
|
const { turn } = result;
|
|
46
|
+
if (turn === undefined)
|
|
47
|
+
return "no turn with output yet\n";
|
|
41
48
|
const failure = "failure" in turn &&
|
|
42
49
|
(turn.state === "failed" || turn.state === "outcome-unknown")
|
|
43
50
|
? formatFailure(turn.failure, turn.state)
|
package/dist/status/client.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare const makeStatusClient: (node: CliNodeOperations) => {
|
|
|
17
17
|
readonly socat: "found" | "missing";
|
|
18
18
|
readonly userNamespaces: "allowed" | "no_nesting" | "restricted";
|
|
19
19
|
} | undefined;
|
|
20
|
+
readonly headlessApprovals?: "off" | "on" | undefined;
|
|
20
21
|
readonly method: "node.status";
|
|
21
22
|
readonly processResources: {
|
|
22
23
|
readonly activeTrees: number;
|
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.39",
|
|
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.39",
|
|
68
|
+
"@maiaos/client-core": "0.1.0-canary.39",
|
|
69
|
+
"@maiaos/sdk": "0.1.0-canary.39",
|
|
70
70
|
"effect": "4.0.0"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|