@maiaos/cli 0.1.0-canary.39 → 0.1.0-canary.40

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.
@@ -14,7 +14,9 @@ export type CreateSessionInput = {
14
14
  readonly definitionRef?: SessionCreateParameters["definitionRef"];
15
15
  readonly effort?: SessionCreateParameters["effort"];
16
16
  readonly executor?: SessionCreateParameters["executor"];
17
+ readonly hostAuthority?: SessionCreateParameters["hostAuthority"];
17
18
  readonly model?: string;
19
+ readonly permission?: SessionCreateParameters["permission"];
18
20
  readonly role?: SessionCreateParameters["role"];
19
21
  readonly title?: string;
20
22
  readonly workspaceId: string;
@@ -16,6 +16,7 @@ const SESSION_CREATE_OPTIONS = new Set([
16
16
  "--executor",
17
17
  "--model",
18
18
  "--name",
19
+ "--permission",
19
20
  "--agent-definition",
20
21
  "--agent-definition-version",
21
22
  "--agent-definition-digest",
@@ -23,6 +24,9 @@ const SESSION_CREATE_OPTIONS = new Set([
23
24
  "--title",
24
25
  ]);
25
26
  const summarizeSessionCreation = (result) => ({
27
+ ...(result.session.containment === undefined
28
+ ? {}
29
+ : { containment: result.session.containment }),
26
30
  ...(result.session.agentDefinitionRef === undefined
27
31
  ? {}
28
32
  : { agentDefinitionRef: result.session.agentDefinitionRef }),
@@ -65,7 +69,7 @@ const readSessionCreateOptions = (parsed) => {
65
69
  throw new CliArgumentError(parsed.options.has("--project")
66
70
  ? "Option '--project' needs '--message', '--prompt-stdin' or '--from-file'; name a Workspace with '--workspace' otherwise."
67
71
  : "Option '--workspace' is required.");
68
- const input = readSessionSelection(parsed.options, workspaceId);
72
+ const input = readSessionSelection(parsed, workspaceId);
69
73
  const definition = readDefinitionSelection(parsed.options, input);
70
74
  requireOneSelection({ ...input, ...definition });
71
75
  return { ...input, ...definition };
@@ -125,7 +129,7 @@ const readSessionTitle = (options) => {
125
129
  throw new CliArgumentError("Use one of '--name' or '--title'.");
126
130
  return options.get("--title") ?? options.get("--name");
127
131
  };
128
- const readSessionSelection = (options, workspaceId) => {
132
+ const readSessionSelection = ({ flags, options }, workspaceId) => {
129
133
  const agent = readAgentId(options);
130
134
  const commandId = options.get("--command-id");
131
135
  const connectionId = options.get("--connection");
@@ -144,11 +148,45 @@ const readSessionSelection = (options, workspaceId) => {
144
148
  ...(model === undefined ? {} : { model }),
145
149
  ...readSessionRole(options.get("--role")),
146
150
  ...(title === undefined ? {} : { title }),
151
+ ...readHostAuthority({ flags, options }),
147
152
  workspaceId,
148
153
  };
149
154
  const baseRef = readBaseRef(options.get("--base"), selection);
150
155
  return { ...selection, ...(baseRef === undefined ? {} : { baseRef }) };
151
156
  };
157
+ const readPermission = (permission, executor) => {
158
+ if (permission === undefined)
159
+ return {};
160
+ const valid = sessionCreateParametersSchema.safeParse({
161
+ commandId: "command_validate",
162
+ ...(executor === undefined
163
+ ? { connectionId: "connection_validate" }
164
+ : { executor }),
165
+ expectedRevision: "0",
166
+ hostAuthority: true,
167
+ permission,
168
+ workspaceId: "workspace_validate",
169
+ });
170
+ if (!valid.success || valid.data.permission === undefined)
171
+ throw new CliArgumentError("Option '--permission' must be a permission mode Claude Code or Codex defines.");
172
+ return { permission: valid.data.permission };
173
+ };
174
+ const readHostAuthority = ({ flags, options, }) => {
175
+ const permission = options.get("--permission");
176
+ if (!flags.has("--host-authority")) {
177
+ if (permission !== undefined)
178
+ throw new CliArgumentError("Option '--permission' needs '--host-authority'.");
179
+ return {};
180
+ }
181
+ if (options.has("--base"))
182
+ throw new CliArgumentError("Option '--host-authority' runs in an existing '--cwd', not a Maia worktree; drop '--base'.");
183
+ if (!options.has("--connection") && !options.has("--executor"))
184
+ throw new CliArgumentError("Option '--host-authority' needs '--connection' or '--executor'.");
185
+ return {
186
+ hostAuthority: true,
187
+ ...readPermission(permission, readExecutorKind(options.get("--executor"))),
188
+ };
189
+ };
152
190
  const readBaseRef = (value, selection) => {
153
191
  if (value === undefined)
154
192
  return;
@@ -222,7 +260,7 @@ const readSessionTasks = (parsed, source) => {
222
260
  const workspaceId = readTaskWorkspace(parsed, source);
223
261
  const projectId = parsed.options.get("--project");
224
262
  const commandId = parsed.options.get("--command-id");
225
- const { workspaceId: _placeholder, ...selection } = readSessionSelection(parsed.options, workspaceId ?? "workspace_default");
263
+ const { workspaceId: _placeholder, ...selection } = readSessionSelection(parsed, workspaceId ?? "workspace_default");
226
264
  requireOneSelection({ ...selection, workspaceId: _placeholder });
227
265
  return {
228
266
  ...(commandId === undefined ? {} : { commandId }),
@@ -233,7 +271,7 @@ const readSessionTasks = (parsed, source) => {
233
271
  };
234
272
  };
235
273
  export const runSessionCreate = (tokens, context) => {
236
- const parsed = parseOptions(tokens, TASK_OPTIONS, new Set(["--prompt-stdin"]));
274
+ const parsed = parseOptions(tokens, TASK_OPTIONS, new Set(["--host-authority", "--prompt-stdin"]));
237
275
  const source = taskSource(parsed);
238
276
  if (source !== undefined)
239
277
  return runSessionTasks(readSessionTasks(parsed, source), context);
@@ -22,13 +22,16 @@ 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
24
  const toTemplate = (selection) => {
25
- const { agentId, baseRef, connectionId, effort, executor, model, role, title, } = selection;
25
+ const { agentId, baseRef, connectionId, cwd, effort, executor, hostAuthority, model, permission, role, title, } = selection;
26
26
  return {
27
27
  ...(agentId === undefined ? {} : { agentId }),
28
28
  ...(connectionId === undefined ? {} : { connectionId }),
29
+ ...(cwd === undefined ? {} : { cwd }),
29
30
  ...(effort === undefined ? {} : { effort }),
30
31
  ...(executor === undefined ? {} : { executor }),
32
+ ...(hostAuthority === undefined ? {} : { hostAuthority }),
31
33
  ...(model === undefined ? {} : { model }),
34
+ ...(permission === undefined ? {} : { permission }),
32
35
  ...(role === undefined ? {} : { role }),
33
36
  ...(title === undefined ? {} : { title }),
34
37
  ...(baseRef === undefined ? {} : { worktree: { baseRef } }),
@@ -30,6 +30,7 @@ export type CliSessionResult = {
30
30
  } | {
31
31
  readonly command: "session.create";
32
32
  readonly result: {
33
+ readonly containment?: SessionCreateResult["session"]["containment"];
33
34
  readonly delivery: SessionCreateResult["delivery"];
34
35
  readonly executor?: SessionCreateResult["session"]["executor"];
35
36
  readonly receipt: SessionCreateResult["receipt"];
@@ -7,6 +7,7 @@ const formatSessionInbox = (deliveries) => formatRows(deliveries, (delivery) =>
7
7
  const formatSessionCreation = (result) => `${fields([
8
8
  ["session", result.sessionId],
9
9
  ["account", result.executor?.connectionId],
10
+ ["containment", result.containment],
10
11
  [
11
12
  "workspace",
12
13
  result.worktree === undefined ? undefined : result.workspaceId,
@@ -36,6 +37,7 @@ export const formatSessionShow = ({ session, }) => `${fields([
36
37
  ["state", session.state],
37
38
  ["revision", session.revision],
38
39
  ["workspace", session.workspaceId],
40
+ ["containment", session.containment],
39
41
  ])}${formatFailure(session.failure)}`;
40
42
  const formatLifecycle = ({ revision, sessionId, state, }) => `${fields([
41
43
  ["session", sessionId],
@@ -25,12 +25,20 @@ export const formatSessionTasks = ({ items }) => items.length === 1
25
25
  empty: "",
26
26
  headers: ["LINE", "STAGE", "SESSION", "TURN", "COMMAND", "ERROR"],
27
27
  });
28
- const SESSION_HEADERS = ["SESSION", "STATE", "WORKSPACE", "ATTENTION", "TITLE"];
28
+ const SESSION_HEADERS = [
29
+ "SESSION",
30
+ "STATE",
31
+ "WORKSPACE",
32
+ "ATTENTION",
33
+ "CONTAINMENT",
34
+ "TITLE",
35
+ ];
29
36
  const sessionCells = (session, attention) => [
30
37
  session.id,
31
38
  session.state,
32
39
  session.workspaceId,
33
40
  attention ?? "-",
41
+ session.containment ?? "-",
34
42
  cell(session.title ?? "-"),
35
43
  ];
36
44
  export const formatSessionList = (result) => {
@@ -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>] [--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>] [--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.",
@@ -18,6 +18,7 @@ export declare const makeStatusClient: (node: CliNodeOperations) => {
18
18
  readonly userNamespaces: "allowed" | "no_nesting" | "restricted";
19
19
  } | undefined;
20
20
  readonly headlessApprovals?: "off" | "on" | undefined;
21
+ readonly hostAuthority?: "disabled" | "enabled" | undefined;
21
22
  readonly method: "node.status";
22
23
  readonly processResources: {
23
24
  readonly activeTrees: number;
@@ -4,6 +4,7 @@ export type CliCompactStatusResult = {
4
4
  readonly admissionCaps?: LocalNodeStatusResult["admissionCaps"];
5
5
  readonly command: "status";
6
6
  readonly executorHost?: LocalNodeStatusResult["executorHost"];
7
+ readonly hostAuthority?: LocalNodeStatusResult["hostAuthority"];
7
8
  readonly instanceId: LocalNodeStatusResult["instanceId"];
8
9
  readonly lifecycle: LocalNodeStatusResult["lifecycle"];
9
10
  readonly pid: LocalNodeStatusResult["pid"];
@@ -39,6 +39,9 @@ export const projectStatusResult = (node) => ({
39
39
  ...(node.executorHost === undefined
40
40
  ? {}
41
41
  : { executorHost: node.executorHost }),
42
+ ...(node.hostAuthority === undefined
43
+ ? {}
44
+ : { hostAuthority: node.hostAuthority }),
42
45
  instanceId: node.instanceId,
43
46
  lifecycle: node.lifecycle,
44
47
  pid: node.pid,
@@ -90,6 +90,9 @@ export const formatHumanStatus = ({ node }) => {
90
90
  `pid: ${String(node.pid)}`,
91
91
  `instance: ${node.instanceId}`,
92
92
  `storage: ${node.storage.integrity} (${node.storage.journalMode})`,
93
+ ...(node.hostAuthority === undefined
94
+ ? []
95
+ : [`host authority: ${node.hostAuthority}`]),
93
96
  ...eventLines(node.storage.events),
94
97
  ...processResourceLines(node.processResources),
95
98
  ...executorHostLines(node.executorHost),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiaos/cli",
3
- "version": "0.1.0-canary.39",
3
+ "version": "0.1.0-canary.40",
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.39",
68
- "@maiaos/client-core": "0.1.0-canary.39",
69
- "@maiaos/sdk": "0.1.0-canary.39",
67
+ "@maiaos/agent": "0.1.0-canary.40",
68
+ "@maiaos/client-core": "0.1.0-canary.40",
69
+ "@maiaos/sdk": "0.1.0-canary.40",
70
70
  "effect": "4.0.0"
71
71
  },
72
72
  "scripts": {