@maiaos/cli 0.1.0-canary.41 → 0.1.0-canary.43

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.
Files changed (35) hide show
  1. package/dist/bin/maia.cdx.json +19 -19
  2. package/dist/bin/maia.mjs +1 -1
  3. package/dist/command-line/context.d.ts +1 -1
  4. package/dist/command-line/emit/index.d.ts +4 -0
  5. package/dist/command-line/emit/index.js +4 -0
  6. package/dist/command-line/{output.d.ts → emit/output.d.ts} +2 -2
  7. package/dist/command-line/index.d.ts +3 -3
  8. package/dist/command-line/index.js +3 -3
  9. package/dist/command-line/two-phase.js +1 -1
  10. package/dist/command-tree/tree.d.ts +1 -1
  11. package/dist/command-tree/tree.js +3 -1
  12. package/dist/events/commands.d.ts +11 -0
  13. package/dist/events/commands.js +64 -0
  14. package/dist/events/index.d.ts +2 -0
  15. package/dist/events/index.js +2 -0
  16. package/dist/events/tree/index.d.ts +2 -0
  17. package/dist/events/tree/index.js +2 -0
  18. package/dist/events/tree/tree.d.ts +10 -0
  19. package/dist/events/tree/tree.js +17 -0
  20. package/dist/session/client.d.ts +1 -0
  21. package/dist/session/commands.js +40 -1
  22. package/dist/session/create-tasks.js +8 -4
  23. package/dist/session/output/human.d.ts +1 -0
  24. package/dist/session/output/human.js +8 -1
  25. package/dist/session/output/tasks.d.ts +1 -0
  26. package/dist/session/output/tasks.js +9 -0
  27. package/dist/session/tree/tree.js +1 -1
  28. package/package.json +4 -4
  29. /package/dist/command-line/{json-decoder.d.ts → emit/json-decoder.d.ts} +0 -0
  30. /package/dist/command-line/{json-decoder.js → emit/json-decoder.js} +0 -0
  31. /package/dist/command-line/{json.d.ts → emit/json.d.ts} +0 -0
  32. /package/dist/command-line/{json.js → emit/json.js} +0 -0
  33. /package/dist/command-line/{output.js → emit/output.js} +0 -0
  34. /package/dist/command-line/{rows.d.ts → emit/rows.d.ts} +0 -0
  35. /package/dist/command-line/{rows.js → emit/rows.js} +0 -0
@@ -25,8 +25,8 @@ import type { InteractionCliDependencies } from "../session/interaction/index.js
25
25
  import type { CancelTurnInput, InterruptTurnInput, SendTurnInput, WaitTurnsInput } from "../session/turn/index.js";
26
26
  import type { BootstrapCliDependencies } from "../team-workspace/index.js";
27
27
  import type { CreateTerminalInput, makeTerminalClient } from "../terminal/index.js";
28
+ import type { CliIo, CliResolution } from "./emit/index.js";
28
29
  import type { CliArgumentError } from "./input/index.js";
29
- import type { CliIo, CliResolution } from "./output.js";
30
30
  type OrchestrationClient = ReturnType<typeof makeOrchestrationClient>;
31
31
  type SessionClient = ReturnType<typeof makeSessionClient>;
32
32
  type TerminalClient = ReturnType<typeof makeTerminalClient>;
@@ -0,0 +1,4 @@
1
+ export { decodeJsonText, jsonLine } from "./json.js";
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
+ export { block, cell, type CliTable, fields, formatRows, tab, withNextPage, withPrunedHistory, } from "./rows.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ export { decodeJsonText, jsonLine } from "./json.js";
2
+ export { exitCodeOf, reportError, writeNodeResult, writeSuccess, } from "./output.js";
3
+ export { block, cell, fields, formatRows, tab, withNextPage, withPrunedHistory, } from "./rows.js";
4
+ //# sourceMappingURL=index.js.map
@@ -1,8 +1,8 @@
1
1
  import type { NodeHolding } from "@maiaos/client-core/cockpit";
2
2
  import type { ProtocolError } from "@maiaos/sdk";
3
3
  import type * as Effect from "effect/Effect";
4
- import type { CliMutationRecovery, CliNodeResult } from "../local-node/index.js";
5
- import type { BoundedStdinRequest, CliArgumentError, PromptOptions } from "./input/index.js";
4
+ import type { CliMutationRecovery, CliNodeResult } from "../../local-node/index.js";
5
+ import type { BoundedStdinRequest, CliArgumentError, PromptOptions } from "../input/index.js";
6
6
  export type CliIo = {
7
7
  readonly cwd?: string;
8
8
  readonly interactive?: boolean;
@@ -1,7 +1,7 @@
1
1
  export { type CliDependencies, type CliServices, type CommandContext, type CommandEffect, LOCAL_NODE, } from "./context.js";
2
+ export { decodeJsonText, jsonLine } from "./emit/index.js";
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 { block, cell, type CliTable, fields, formatRows, tab, withNextPage, withPrunedHistory, } from "./emit/index.js";
2
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";
3
- export { decodeJsonText, jsonLine } from "./json.js";
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, 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 { decodeJsonText, jsonLine } from "./emit/index.js";
3
+ export { exitCodeOf, reportError, writeNodeResult, writeSuccess, } from "./emit/index.js";
4
+ export { block, cell, fields, formatRows, tab, withNextPage, withPrunedHistory, } from "./emit/index.js";
2
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";
3
- export { decodeJsonText, jsonLine } from "./json.js";
4
- export { exitCodeOf, reportError, writeNodeResult, writeSuccess, } from "./output.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
@@ -1,8 +1,8 @@
1
1
  import * as Cause from "effect/Cause";
2
2
  import * as Effect from "effect/Effect";
3
3
  import * as Exit from "effect/Exit";
4
+ import { decodeJsonText } from "./emit/index.js";
4
5
  import { CliArgumentError, parseOptions, recoverStdin, replayStdin, requirePositionals, } from "./input/index.js";
5
- import { decodeJsonText } from "./json.js";
6
6
  export const TWO_PHASE_FLAGS = [
7
7
  "--confirm-stdin",
8
8
  "--dry-run",
@@ -20,7 +20,7 @@ export type TreeNode = {
20
20
  readonly summary: string;
21
21
  };
22
22
  export declare const TREE_FRAGMENTS: readonly TreeFragment[];
23
- export declare const TREE_SECTIONS: readonly [readonly ["Start and sign in", readonly ["setup", "login", "status"]], readonly ["Work", readonly ["session", "run", "routine", "import"]], readonly ["Resources", readonly ["project", "workspace", "container", "terminal", "execution", "port", "reference", "agents"]], readonly ["Accounts and Nodes", readonly ["connection", "integration", "provider", "node"]], readonly ["Safety and audit", readonly ["hold", "receipt", "context"]], readonly ["Clients and local", readonly ["presentation", "mcp", "dashboard", "agent", "help", "version", "doctor", "completion"]]];
23
+ export declare const TREE_SECTIONS: readonly [readonly ["Start and sign in", readonly ["setup", "login", "status"]], readonly ["Work", readonly ["session", "run", "routine", "import"]], readonly ["Resources", readonly ["project", "workspace", "container", "terminal", "execution", "port", "reference", "agents"]], readonly ["Accounts and Nodes", readonly ["connection", "integration", "provider", "node"]], readonly ["Safety and audit", readonly ["hold", "receipt", "events", "context"]], readonly ["Clients and local", readonly ["presentation", "mcp", "dashboard", "agent", "help", "version", "doctor", "completion"]]];
24
24
  export declare const usagePath: (usage: string) => readonly string[];
25
25
  export declare const COMMAND_TREE: TreeNode;
26
26
  export declare const commandTree: () => TreeNode;
@@ -1,6 +1,7 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import { AGENTS_TREE } from "../agents/tree/index.js";
3
3
  import { CONNECTION_TREE } from "../connection/tree/index.js";
4
+ import { EVENTS_TREE } from "../events/tree/index.js";
4
5
  import { EXECUTION_TREE } from "../execution/tree/index.js";
5
6
  import { SAFETY_TREE } from "../hold/tree/index.js";
6
7
  import { RUN_TREE } from "../orchestration/tree/index.js";
@@ -19,6 +20,7 @@ export const TREE_FRAGMENTS = [
19
20
  ROUTINE_TREE,
20
21
  PROJECT_TREE,
21
22
  REFERENCE_TREE,
23
+ EVENTS_TREE,
22
24
  TERMINAL_TREE,
23
25
  EXECUTION_TREE,
24
26
  SAFETY_TREE,
@@ -42,7 +44,7 @@ export const TREE_SECTIONS = [
42
44
  ],
43
45
  ],
44
46
  ["Accounts and Nodes", ["connection", "integration", "provider", "node"]],
45
- ["Safety and audit", ["hold", "receipt", "context"]],
47
+ ["Safety and audit", ["hold", "receipt", "events", "context"]],
46
48
  [
47
49
  "Clients and local",
48
50
  [
@@ -0,0 +1,11 @@
1
+ import * as Effect from "effect/Effect";
2
+ import { type OutputContext } from "../command-line/emit/index.js";
3
+ import type { CliNodeCall } from "../local-node/index.js";
4
+ type EventsContext = OutputContext & {
5
+ readonly dependencies: {
6
+ readonly call?: CliNodeCall;
7
+ };
8
+ };
9
+ export declare const runEventsRead: (tokens: readonly string[], context: EventsContext) => Effect.Effect<number, never, import("effect/Crypto").Crypto>;
10
+ export {};
11
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1,64 @@
1
+ import { findEventKind, localNodeRequestPayloadSchema, SESSION_ACTIVITY_SUBJECT_TYPE, } from "@maiaos/sdk";
2
+ import * as Effect from "effect/Effect";
3
+ import { cell, writeNodeResult, } from "../command-line/emit/index.js";
4
+ import { CliArgumentError, parseOptionsWith, readPageSize, requirePositionals, } from "../command-line/input/index.js";
5
+ const MAX_LIMIT = 100;
6
+ const readSubject = (value) => {
7
+ const split = value.indexOf(":");
8
+ if (split < 1 || split === value.length - 1)
9
+ throw new CliArgumentError("Option '--subject' must be <type>:<id>.");
10
+ const type = value.slice(0, split);
11
+ if (type !== SESSION_ACTIVITY_SUBJECT_TYPE)
12
+ throw new CliArgumentError(`Option '--subject' type must be ${SESSION_ACTIVITY_SUBJECT_TYPE}.`);
13
+ return { id: value.slice(split + 1), type };
14
+ };
15
+ const readKinds = (value) => {
16
+ const kinds = value.split(",");
17
+ const unknown = kinds.find((kind) => findEventKind(kind) === undefined);
18
+ if (unknown !== undefined)
19
+ throw new CliArgumentError(`Unknown event kind '${unknown}'.`);
20
+ return kinds;
21
+ };
22
+ const readParameters = (tokens) => {
23
+ const parsed = parseOptionsWith(tokens, {
24
+ allowed: new Set(["--kind", "--limit", "--since", "--subject"]),
25
+ allowedFlags: new Set(),
26
+ repeatable: new Set(["--kind"]),
27
+ });
28
+ requirePositionals(parsed.positionals, 0);
29
+ const kind = parsed.options.get("--kind");
30
+ const limit = parsed.options.get("--limit");
31
+ const since = parsed.options.get("--since");
32
+ const subject = parsed.options.get("--subject");
33
+ const parameters = {
34
+ ...(kind === undefined ? {} : { kinds: readKinds(kind) }),
35
+ ...(limit === undefined ? {} : { limit: readPageSize(limit, MAX_LIMIT) }),
36
+ ...(since === undefined ? {} : { since }),
37
+ ...(subject === undefined ? {} : { subject: readSubject(subject) }),
38
+ };
39
+ if (!localNodeRequestPayloadSchema.safeParse({
40
+ method: "events.read",
41
+ parameters,
42
+ }).success)
43
+ throw new CliArgumentError("Options '--kind', '--since' and '--subject' must be valid event filters.");
44
+ return parameters;
45
+ };
46
+ const formatResult = (value) => {
47
+ if (value.status === "invalid_cursor")
48
+ return "invalid cursor; read again without --since\n";
49
+ if (value.status === "cursor_reset_required")
50
+ return `cursor reset (${value.reason}); resume with --since ${value.next}\n`;
51
+ const lines = value.events.map((event) => `${event.seq}\t${event.kind}\t${cell(event.subject.id)}\t${event.ts}\n`);
52
+ return `${lines.join("")}next ${value.next}\n`;
53
+ };
54
+ export const runEventsRead = (tokens, context) => {
55
+ const parameters = readParameters(tokens);
56
+ const { call } = context.dependencies;
57
+ if (call === undefined)
58
+ return Effect.die(new Error("Missing the typed Node call."));
59
+ return Effect.map(call("events.read", parameters), (result) => writeNodeResult(result, context, {
60
+ toResult: (value) => ({ command: "events.read", result: value }),
61
+ toText: ({ result: value }) => formatResult(value),
62
+ }));
63
+ };
64
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1,2 @@
1
+ export { runEventsRead } from "./commands.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { runEventsRead } from "./commands.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ export { EVENTS_TREE } from "./tree.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { EVENTS_TREE } from "./tree.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,10 @@
1
+ declare const events: () => Promise<typeof import("../index.js")>;
2
+ export declare const EVENTS_TREE: {
3
+ readonly groups: readonly [readonly ["events", "The Node's public events, read by cursor."]];
4
+ readonly leaves: readonly [readonly ["events read [--kind <kind>]... [--since <cursor>] [--subject <type>:<id>] [--limit <1..100>]", 1, "events.read", "Read one page of public events after a cursor.", {
5
+ readonly example: "maia --json events read --since <cursor> --limit 50";
6
+ readonly run: readonly [typeof events, "runEventsRead"];
7
+ }]];
8
+ };
9
+ export {};
10
+ //# sourceMappingURL=tree.d.ts.map
@@ -0,0 +1,17 @@
1
+ const events = () => import("../index.js");
2
+ export const EVENTS_TREE = {
3
+ groups: [["events", "The Node's public events, read by cursor."]],
4
+ leaves: [
5
+ [
6
+ "events read [--kind <kind>]... [--since <cursor>] [--subject <type>:<id>] [--limit <1..100>]",
7
+ 1,
8
+ "events.read",
9
+ "Read one page of public events after a cursor.",
10
+ {
11
+ example: "maia --json events read --since <cursor> --limit 50",
12
+ run: [events, "runEventsRead"],
13
+ },
14
+ ],
15
+ ],
16
+ };
17
+ //# sourceMappingURL=tree.js.map
@@ -15,6 +15,7 @@ export type CreateSessionInput = {
15
15
  readonly effort?: SessionCreateParameters["effort"];
16
16
  readonly executor?: SessionCreateParameters["executor"];
17
17
  readonly hostAuthority?: SessionCreateParameters["hostAuthority"];
18
+ readonly labels?: SessionCreateParameters["labels"];
18
19
  readonly model?: string;
19
20
  readonly permission?: SessionCreateParameters["permission"];
20
21
  readonly role?: SessionCreateParameters["role"];
@@ -14,6 +14,7 @@ const SESSION_CREATE_OPTIONS = new Set([
14
14
  "--cwd",
15
15
  "--effort",
16
16
  "--executor",
17
+ "--label",
17
18
  "--model",
18
19
  "--name",
19
20
  "--permission",
@@ -27,6 +28,9 @@ const summarizeSessionCreation = (result) => ({
27
28
  ...(result.session.containment === undefined
28
29
  ? {}
29
30
  : { containment: result.session.containment }),
31
+ ...(result.session.permission === undefined
32
+ ? {}
33
+ : { permission: result.session.permission }),
30
34
  ...(result.session.agentDefinitionRef === undefined
31
35
  ? {}
32
36
  : { agentDefinitionRef: result.session.agentDefinitionRef }),
@@ -38,6 +42,9 @@ const summarizeSessionCreation = (result) => ({
38
42
  revision: result.session.revision,
39
43
  sessionId: result.session.id,
40
44
  state: result.session.state,
45
+ ...(result.session.labels === undefined
46
+ ? {}
47
+ : { labels: result.session.labels }),
41
48
  ...(result.session.title === undefined
42
49
  ? {}
43
50
  : { title: result.session.title }),
@@ -124,6 +131,30 @@ const readAgentId = (options) => {
124
131
  throw new CliArgumentError(`Option '--agent' fixes the harness, Connection, model and effort; drop '${clash}'.`);
125
132
  return { agentId };
126
133
  };
134
+ const LABEL_OPTION = new Set(["--label"]);
135
+ const requireOneLabelPerOption = (tokens) => {
136
+ const given = tokens.flatMap((token, index) => {
137
+ if (tokens[index - 1] === "--label")
138
+ return [token];
139
+ return token.startsWith("--label=") ? [token.slice("--label=".length)] : [];
140
+ });
141
+ if (given.some((value) => value.includes(",")))
142
+ throw new CliArgumentError("Option '--label' takes one key=value; repeat the option for more.");
143
+ };
144
+ const readLabels = (value) => {
145
+ if (value === undefined)
146
+ return {};
147
+ const pairs = value.split(",").map((pair) => {
148
+ const separator = pair.indexOf("=");
149
+ if (separator < 1)
150
+ throw new CliArgumentError("Option '--label' takes key=value.");
151
+ return [pair.slice(0, separator), pair.slice(separator + 1)];
152
+ });
153
+ const duplicate = pairs.find(([key], index) => pairs.findIndex(([other]) => other === key) !== index);
154
+ if (duplicate !== undefined)
155
+ throw new CliArgumentError(`Label '${duplicate[0]}' is given twice.`);
156
+ return { labels: Object.fromEntries(pairs) };
157
+ };
127
158
  const readSessionTitle = (options) => {
128
159
  if (options.has("--name") && options.has("--title"))
129
160
  throw new CliArgumentError("Use one of '--name' or '--title'.");
@@ -146,6 +177,7 @@ const readSessionSelection = ({ flags, options }, workspaceId) => {
146
177
  ...(effort === undefined ? {} : { effort }),
147
178
  ...(executor === undefined ? {} : { executor }),
148
179
  ...(model === undefined ? {} : { model }),
180
+ ...readLabels(options.get("--label")),
149
181
  ...readSessionRole(options.get("--role")),
150
182
  ...(title === undefined ? {} : { title }),
151
183
  ...readHostAuthority({ flags, options }),
@@ -239,6 +271,8 @@ const taskSource = (parsed) => {
239
271
  if (file !== undefined &&
240
272
  (parsed.options.has("--title") || parsed.options.has("--name")))
241
273
  throw new CliArgumentError("Option '--title' or '--name' names one Session; with '--from-file' each Session takes its task's first line.");
274
+ if (file !== undefined && parsed.options.has("--label"))
275
+ throw new CliArgumentError("Option '--label' labels one Session; it cannot be used with '--from-file'.");
242
276
  if (file !== undefined)
243
277
  return { kind: "file", path: file };
244
278
  if (message !== undefined)
@@ -271,7 +305,12 @@ const readSessionTasks = (parsed, source) => {
271
305
  };
272
306
  };
273
307
  export const runSessionCreate = (tokens, context) => {
274
- const parsed = parseOptions(tokens, TASK_OPTIONS, new Set(["--host-authority", "--prompt-stdin"]));
308
+ requireOneLabelPerOption(tokens);
309
+ const parsed = parseOptionsWith(tokens, {
310
+ allowed: TASK_OPTIONS,
311
+ allowedFlags: new Set(["--host-authority", "--prompt-stdin"]),
312
+ repeatable: LABEL_OPTION,
313
+ });
275
314
  const source = taskSource(parsed);
276
315
  if (source !== undefined)
277
316
  return runSessionTasks(readSessionTasks(parsed, source), context);
@@ -21,17 +21,21 @@ const readText = (source, context) => {
21
21
  const refusalMessage = (refusal) => refusal.reason === "too_long"
22
22
  ? `Task line ${String(refusal.line)} exceeds ${String(MAX_TURN_INPUT_BYTES)} bytes.`
23
23
  : `A batch holds at most ${String(MAX_SESSION_CREATION_TASKS)} tasks; line ${String(refusal.line)} is beyond it.`;
24
+ const toStartFields = ({ cwd, hostAuthority, permission, }) => ({
25
+ ...(cwd === undefined ? {} : { cwd }),
26
+ ...(hostAuthority === undefined ? {} : { hostAuthority }),
27
+ ...(permission === undefined ? {} : { permission }),
28
+ });
24
29
  const toTemplate = (selection) => {
25
- const { agentId, baseRef, connectionId, cwd, effort, executor, hostAuthority, model, permission, role, title, } = selection;
30
+ const { agentId, baseRef, connectionId, effort, executor, labels, model, role, title, } = selection;
26
31
  return {
27
32
  ...(agentId === undefined ? {} : { agentId }),
28
33
  ...(connectionId === undefined ? {} : { connectionId }),
29
- ...(cwd === undefined ? {} : { cwd }),
34
+ ...toStartFields(selection),
30
35
  ...(effort === undefined ? {} : { effort }),
31
36
  ...(executor === undefined ? {} : { executor }),
32
- ...(hostAuthority === undefined ? {} : { hostAuthority }),
37
+ ...(labels === undefined ? {} : { labels }),
33
38
  ...(model === undefined ? {} : { model }),
34
- ...(permission === undefined ? {} : { permission }),
35
39
  ...(role === undefined ? {} : { role }),
36
40
  ...(title === undefined ? {} : { title }),
37
41
  ...(baseRef === undefined ? {} : { worktree: { baseRef } }),
@@ -33,6 +33,7 @@ export type CliSessionResult = {
33
33
  readonly containment?: SessionCreateResult["session"]["containment"];
34
34
  readonly delivery: SessionCreateResult["delivery"];
35
35
  readonly executor?: SessionCreateResult["session"]["executor"];
36
+ readonly permission?: SessionCreateResult["session"]["permission"];
36
37
  readonly receipt: SessionCreateResult["receipt"];
37
38
  readonly revision: string;
38
39
  readonly sessionId: string;
@@ -2,12 +2,13 @@ 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, } from "./tasks.js";
5
+ import { 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],
9
9
  ["account", result.executor?.connectionId],
10
10
  ["containment", result.containment],
11
+ ["permission", result.permission],
11
12
  [
12
13
  "workspace",
13
14
  result.worktree === undefined ? undefined : result.workspaceId,
@@ -38,6 +39,12 @@ export const formatSessionShow = ({ session, }) => `${fields([
38
39
  ["revision", session.revision],
39
40
  ["workspace", session.workspaceId],
40
41
  ["containment", session.containment],
42
+ ["permission", session.permission],
43
+ [
44
+ "labels",
45
+ session.labels === undefined ? undefined : labelCells(session.labels),
46
+ ],
47
+ ["updated", session.updatedAt],
41
48
  ])}${formatFailure(session.failure)}`;
42
49
  const formatLifecycle = ({ revision, sessionId, state, }) => `${fields([
43
50
  ["session", sessionId],
@@ -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 labelCells: (labels: Readonly<Record<string, string>> | undefined) => string;
20
21
  export declare const formatSessionList: (result: SessionListResult) => string;
21
22
  type Labeled<TValue> = TValue & {
22
23
  readonly node: string;
@@ -32,7 +32,14 @@ const SESSION_HEADERS = [
32
32
  "ATTENTION",
33
33
  "CONTAINMENT",
34
34
  "TITLE",
35
+ "LABELS",
36
+ "LAST ACTIVE",
35
37
  ];
38
+ export const labelCells = (labels) => labels === undefined
39
+ ? "-"
40
+ : Object.entries(labels)
41
+ .map(([key, value]) => `${key}=${value}`)
42
+ .join(",");
36
43
  const sessionCells = (session, attention) => [
37
44
  session.id,
38
45
  session.state,
@@ -40,6 +47,8 @@ const sessionCells = (session, attention) => [
40
47
  attention ?? "-",
41
48
  session.containment ?? "-",
42
49
  cell(session.title ?? "-"),
50
+ labelCells(session.labels),
51
+ session.updatedAt,
43
52
  ];
44
53
  export const formatSessionList = (result) => {
45
54
  const attention = new Map((result.attention ?? []).map((item) => [item.sessionId, item.attention]));
@@ -18,7 +18,7 @@ export const SESSION_TREE = {
18
18
  ],
19
19
  leaves: [
20
20
  [
21
- "session create (--workspace <workspace-id> | --project <project-id>) [--command-id <id>] [--role <worker|orchestrator>] [--connection <connection-id> [--executor <codex-cli|claude-code>] [--model <id>] | --executor <codex-cli|claude-code> | --agent <agent-id> | --agent-definition <key> --agent-definition-version <version> --agent-definition-digest <sha256>] [--effort <low|medium|high|xhigh|max|ultra>] [--base <branch-tag-or-commit> | --host-authority [--permission <mode>]] [--cwd <path>] [--title <text> | --name <text>] [--message <text> | --prompt-stdin | --from-file <path>]",
21
+ "session create (--workspace <workspace-id> | --project <project-id>) [--command-id <id>] [--role <worker|orchestrator>] [--connection <connection-id> [--executor <codex-cli|claude-code>] [--model <id>] | --executor <codex-cli|claude-code> | --agent <agent-id> | --agent-definition <key> --agent-definition-version <version> --agent-definition-digest <sha256>] [--effort <low|medium|high|xhigh|max|ultra>] [--base <branch-tag-or-commit> | --host-authority [--permission <mode>]] [--cwd <path>] [--title <text> | --name <text>] [--label <key=value>...] [--message <text> | --prompt-stdin | --from-file <path>]",
22
22
  0,
23
23
  "session.create",
24
24
  "Create a Session, optionally starting it with a first message.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiaos/cli",
3
- "version": "0.1.0-canary.41",
3
+ "version": "0.1.0-canary.43",
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.41",
68
- "@maiaos/client-core": "0.1.0-canary.41",
69
- "@maiaos/sdk": "0.1.0-canary.41",
67
+ "@maiaos/agent": "0.1.0-canary.43",
68
+ "@maiaos/client-core": "0.1.0-canary.43",
69
+ "@maiaos/sdk": "0.1.0-canary.43",
70
70
  "effect": "4.0.0"
71
71
  },
72
72
  "scripts": {
File without changes
File without changes
File without changes
File without changes
File without changes