@maiaos/cli 0.1.0-canary.42 → 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.
@@ -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
@@ -28,6 +28,9 @@ const summarizeSessionCreation = (result) => ({
28
28
  ...(result.session.containment === undefined
29
29
  ? {}
30
30
  : { containment: result.session.containment }),
31
+ ...(result.session.permission === undefined
32
+ ? {}
33
+ : { permission: result.session.permission }),
31
34
  ...(result.session.agentDefinitionRef === undefined
32
35
  ? {}
33
36
  : { agentDefinitionRef: result.session.agentDefinitionRef }),
@@ -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;
@@ -8,6 +8,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,7 @@ export const formatSessionShow = ({ session, }) => `${fields([
38
39
  ["revision", session.revision],
39
40
  ["workspace", session.workspaceId],
40
41
  ["containment", session.containment],
42
+ ["permission", session.permission],
41
43
  [
42
44
  "labels",
43
45
  session.labels === undefined ? undefined : labelCells(session.labels),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiaos/cli",
3
- "version": "0.1.0-canary.42",
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.42",
68
- "@maiaos/client-core": "0.1.0-canary.42",
69
- "@maiaos/sdk": "0.1.0-canary.42",
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