@maiaos/cli 0.1.0-canary.45 → 0.1.0-canary.46
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/session/client.d.ts +2 -1
- package/dist/session/client.js +4 -1
- package/dist/session/commands.js +8 -5
- package/dist/session/output/human.js +7 -1
- package/dist/session/output/tasks.d.ts +1 -0
- package/dist/session/output/tasks.js +5 -0
- package/dist/session/tree/tree.js +3 -3
- package/package.json +4 -4
package/dist/session/client.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Session, SessionCreateParameters, SessionCreateResult, SessionCreationInput, SessionCreationOutcome, SessionCreationPlan, SessionEventsListResult, SessionInboxAckResult, SessionInboxCheckResult, SessionListParameters, SessionListResult, SessionMessageSendResult, SessionObserveResult, SessionResumeResult, SessionShowResult, SessionSpawnResult, SessionStartResult, SessionStopResult, SessionWaitResult } from "@maiaos/sdk";
|
|
2
2
|
import { type CliNodeEffect, type CliNodeOperations } from "../local-node/index.js";
|
|
3
3
|
export type WaitSessionInput = {
|
|
4
|
+
readonly activities?: readonly string[];
|
|
4
5
|
readonly sessionId: string;
|
|
5
|
-
readonly states
|
|
6
|
+
readonly states?: readonly string[];
|
|
6
7
|
readonly timeoutMilliseconds: number;
|
|
7
8
|
};
|
|
8
9
|
export type CreateSessionInput = {
|
package/dist/session/client.js
CHANGED
|
@@ -28,8 +28,11 @@ export const makeSessionClient = (node) => {
|
|
|
28
28
|
const waitSession = (input) => repeatBoundedWait({
|
|
29
29
|
maxRequestMilliseconds: MAX_SESSION_WAIT_MILLISECONDS,
|
|
30
30
|
once: (waitMilliseconds) => waitSessionOnce({
|
|
31
|
+
...(input.activities === undefined
|
|
32
|
+
? {}
|
|
33
|
+
: { activities: input.activities }),
|
|
31
34
|
sessionId: input.sessionId,
|
|
32
|
-
states: input.states,
|
|
35
|
+
...(input.states === undefined ? {} : { states: input.states }),
|
|
33
36
|
waitMilliseconds,
|
|
34
37
|
}),
|
|
35
38
|
satisfied: (value) => value.satisfied,
|
package/dist/session/commands.js
CHANGED
|
@@ -377,18 +377,21 @@ export const runSessionShow = (tokens, context) => Effect.gen(function* () {
|
|
|
377
377
|
});
|
|
378
378
|
const readWaitInput = (tokens) => {
|
|
379
379
|
const parsed = parseOptionsWith(tokens, {
|
|
380
|
-
allowed: new Set(["--timeout", "--until"]),
|
|
380
|
+
allowed: new Set(["--activity", "--timeout", "--until"]),
|
|
381
381
|
allowedFlags: new Set(),
|
|
382
|
-
repeatable: new Set(["--until"]),
|
|
382
|
+
repeatable: new Set(["--activity", "--until"]),
|
|
383
383
|
});
|
|
384
384
|
requirePositionals(parsed.positionals, 1);
|
|
385
385
|
const [sessionId] = parsed.positionals;
|
|
386
386
|
const states = parsed.options.get("--until")?.split(",");
|
|
387
|
-
|
|
388
|
-
|
|
387
|
+
const activities = parsed.options.get("--activity")?.split(",");
|
|
388
|
+
if (sessionId === undefined ||
|
|
389
|
+
(states === undefined && activities === undefined))
|
|
390
|
+
throw new CliArgumentError("Name the Session and the states ('--until') or activities ('--activity') to wait for.");
|
|
389
391
|
return {
|
|
392
|
+
...(activities === undefined ? {} : { activities }),
|
|
390
393
|
sessionId,
|
|
391
|
-
states,
|
|
394
|
+
...(states === undefined ? {} : { states }),
|
|
392
395
|
timeoutMilliseconds: readWaitTimeoutSeconds(parsed.options.get("--timeout")) * 1000,
|
|
393
396
|
};
|
|
394
397
|
};
|
|
@@ -2,7 +2,7 @@ import { cell, fields, formatRows, tab, withPrunedHistory, writeNodeResult, } fr
|
|
|
2
2
|
import { formatSessionDiff } from "./diff.js";
|
|
3
3
|
import { formatFailure, formatSessionEvents } from "./failure.js";
|
|
4
4
|
import { formatSessionObservation } from "./observe.js";
|
|
5
|
-
import { formatSessionList, formatSessionTasks, labelCells, } from "./tasks.js";
|
|
5
|
+
import { activityLabel, formatSessionList, formatSessionTasks, labelCells, } from "./tasks.js";
|
|
6
6
|
const formatSessionInbox = (deliveries) => formatRows(deliveries, (delivery) => `${delivery.deliveryId}\t${delivery.sequence}\t${cell(delivery.message.senderSessionId)}\t${cell(delivery.message.subject)}\t${cell(delivery.message.body)}`);
|
|
7
7
|
const formatSessionCreation = (result) => `${fields([
|
|
8
8
|
["session", result.sessionId],
|
|
@@ -36,6 +36,12 @@ const formatAgentPermission = (result) => result.command === "session.agent-perm
|
|
|
36
36
|
export const formatSessionShow = ({ session, }) => `${fields([
|
|
37
37
|
["session", session.id],
|
|
38
38
|
["state", session.state],
|
|
39
|
+
...(session.activity === undefined
|
|
40
|
+
? []
|
|
41
|
+
: [["activity", activityLabel(session)]]),
|
|
42
|
+
...(session.latestTurnState === undefined
|
|
43
|
+
? []
|
|
44
|
+
: [["latest-turn", session.latestTurnState]]),
|
|
39
45
|
["revision", session.revision],
|
|
40
46
|
["workspace", session.workspaceId],
|
|
41
47
|
["containment", session.containment],
|
|
@@ -17,6 +17,7 @@ export type CliSessionTasksResult = {
|
|
|
17
17
|
};
|
|
18
18
|
export declare const formatSessionTasks: ({ items }: CliSessionTasksResult) => string;
|
|
19
19
|
type ListedSession = SessionListResult["items"][number];
|
|
20
|
+
export declare const activityLabel: (session: Pick<ListedSession, "activity" | "latestTurnState">) => string;
|
|
20
21
|
export declare const labelCells: (labels: Readonly<Record<string, string>> | undefined) => string;
|
|
21
22
|
export declare const formatSessionList: (result: SessionListResult) => string;
|
|
22
23
|
type Labeled<TValue> = TValue & {
|
|
@@ -36,6 +36,7 @@ export const formatSessionTasks = ({ items }) => items.length === 1
|
|
|
36
36
|
const SESSION_HEADERS = [
|
|
37
37
|
"SESSION",
|
|
38
38
|
"STATE",
|
|
39
|
+
"ACTIVITY",
|
|
39
40
|
"WORKSPACE",
|
|
40
41
|
"ATTENTION",
|
|
41
42
|
"CONTAINMENT",
|
|
@@ -43,6 +44,9 @@ const SESSION_HEADERS = [
|
|
|
43
44
|
"LABELS",
|
|
44
45
|
"LAST ACTIVE",
|
|
45
46
|
];
|
|
47
|
+
export const activityLabel = (session) => session.activity === "idle" && session.latestTurnState === "completed"
|
|
48
|
+
? "done"
|
|
49
|
+
: (session.activity ?? "-");
|
|
46
50
|
export const labelCells = (labels) => labels === undefined
|
|
47
51
|
? "-"
|
|
48
52
|
: Object.entries(labels)
|
|
@@ -51,6 +55,7 @@ export const labelCells = (labels) => labels === undefined
|
|
|
51
55
|
const sessionCells = (session, attention) => [
|
|
52
56
|
session.id,
|
|
53
57
|
session.state,
|
|
58
|
+
activityLabel(session),
|
|
54
59
|
session.workspaceId,
|
|
55
60
|
attention ?? "-",
|
|
56
61
|
session.containment ?? "-",
|
|
@@ -51,12 +51,12 @@ export const SESSION_TREE = {
|
|
|
51
51
|
},
|
|
52
52
|
],
|
|
53
53
|
[
|
|
54
|
-
"session wait <session-id> --until <state>[,<state>...] [--timeout <duration>]",
|
|
54
|
+
"session wait <session-id> [--until <state>[,<state>...]] [--activity <activity>[,<activity>...]] [--timeout <duration>]",
|
|
55
55
|
1,
|
|
56
56
|
"session.wait",
|
|
57
|
-
"Wait until a Session reaches
|
|
57
|
+
"Wait until a Session reaches a state or activity; exits 74 on timeout.",
|
|
58
58
|
{
|
|
59
|
-
example: "maia --json session wait session_1 --
|
|
59
|
+
example: "maia --json session wait session_1 --activity idle,waiting_approval,stopped --timeout 10m",
|
|
60
60
|
route: "<session-id>",
|
|
61
61
|
run: [session, "runSessionWait"],
|
|
62
62
|
},
|
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.46",
|
|
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.46",
|
|
68
|
+
"@maiaos/client-core": "0.1.0-canary.46",
|
|
69
|
+
"@maiaos/sdk": "0.1.0-canary.46",
|
|
70
70
|
"effect": "4.0.0"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|