@maiaos/cli 0.1.0-canary.4 → 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.
- package/README.md +2 -2
- package/dist/agents/client.d.ts +47 -27
- package/dist/agents/client.js +10 -3
- package/dist/agents/commands.d.ts +1 -0
- package/dist/agents/commands.js +24 -2
- package/dist/agents/index.d.ts +1 -1
- package/dist/agents/index.js +1 -1
- package/dist/agents/input.d.ts +3 -1
- package/dist/agents/input.js +6 -0
- package/dist/agents/output/format.d.ts +2 -2
- package/dist/agents/output/format.js +11 -0
- package/dist/agents/tree/tree.js +13 -1
- package/dist/bin/maia.cdx.json +19 -19
- package/dist/bin/maia.mjs +1 -1
- package/dist/bootstrap/run.js +5 -2
- package/dist/cli/cli.d.ts +8 -2
- package/dist/cli/cli.js +19 -6
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/command-line/context.d.ts +1 -0
- package/dist/command-line/index.d.ts +2 -2
- package/dist/command-line/index.js +2 -2
- package/dist/command-line/input/arguments.d.ts +7 -0
- package/dist/command-line/input/arguments.js +22 -10
- package/dist/command-line/input/index.d.ts +1 -1
- package/dist/command-line/input/index.js +1 -1
- package/dist/command-line/rows.d.ts +1 -0
- package/dist/command-line/rows.js +3 -0
- package/dist/command-receipt/command.js +1 -1
- package/dist/connection/input.js +2 -2
- package/dist/connection/system.js +3 -2
- package/dist/connection/tree/tree.js +5 -5
- package/dist/local-node/client.d.ts +1 -0
- package/dist/local-node/client.js +1 -0
- package/dist/local-node/index.d.ts +2 -1
- package/dist/local-node/index.js +2 -1
- package/dist/local-node/wait.d.ts +10 -0
- package/dist/local-node/wait.js +17 -0
- package/dist/login/gateway.js +2 -2
- package/dist/login/vendor-input.js +2 -2
- package/dist/mcp/calls.js +6 -1
- package/dist/mcp/routing.js +1 -0
- package/dist/project-guard/client.d.ts +12 -0
- package/dist/project-guard/input.d.ts +3 -0
- package/dist/project-guard/input.js +15 -1
- package/dist/project-guard/output/format.js +5 -0
- package/dist/project-workspace/tree/tree.js +1 -1
- package/dist/reference/resolve.js +9 -2
- package/dist/remote-node/connector.js +8 -1
- package/dist/session/agent-permission.d.ts +2 -2
- package/dist/session/approval/client.d.ts +5 -2
- package/dist/session/approval/client.js +2 -2
- package/dist/session/approval/commands.js +29 -15
- package/dist/session/client.d.ts +12 -3
- package/dist/session/client.js +14 -2
- package/dist/session/commands.d.ts +1 -0
- package/dist/session/commands.js +87 -9
- package/dist/session/create-tasks.js +4 -1
- package/dist/session/index.d.ts +1 -1
- package/dist/session/index.js +1 -1
- package/dist/session/output/human.d.ts +2 -0
- package/dist/session/output/human.js +6 -3
- package/dist/session/output/index.d.ts +1 -1
- package/dist/session/output/index.js +1 -1
- package/dist/session/output/tasks.js +9 -1
- package/dist/session/tree/tree.js +22 -11
- package/dist/session/turn/client.js +7 -9
- package/dist/session/turn/commands.js +67 -20
- package/dist/session/turn/output.d.ts +6 -0
- package/dist/session/turn/output.js +8 -1
- package/dist/status/client.d.ts +14 -3
- package/dist/status/command.js +3 -1
- package/dist/status/doctor.d.ts +5 -1
- package/dist/status/doctor.js +10 -4
- package/dist/status/output/compact.d.ts +3 -0
- package/dist/status/output/compact.js +17 -7
- package/dist/status/output/human.js +15 -0
- package/dist/terminal/control-commands.js +26 -9
- package/dist/terminal/keys.d.ts +12 -0
- package/dist/terminal/keys.js +62 -0
- package/dist/terminal/output/compact-list.d.ts +1 -0
- package/dist/terminal/output/compact-list.js +3 -0
- package/dist/terminal/output/human.js +2 -2
- package/dist/terminal/tree/tree.js +1 -1
- package/guidance/maia-cli/SKILL.md +1 -1
- package/guidance/maia-node/SKILL.md +54 -0
- package/guidance/maia-orchestration/SKILL.md +1 -2
- package/guidance/maia-sessions/SKILL.md +69 -0
- package/package.json +4 -4
|
@@ -5,11 +5,15 @@ const limitCells = (limits) => [
|
|
|
5
5
|
`maxMessagesPerMinute=${String(limits.maxMessagesPerMinute)}`,
|
|
6
6
|
`maxLeasesPerSession=${String(limits.maxLeasesPerSession)}`,
|
|
7
7
|
];
|
|
8
|
+
const grantCells = (grants) => [
|
|
9
|
+
`approvalCoordinator=${grants.coordinator}`,
|
|
10
|
+
];
|
|
8
11
|
const guardLine = (guard) => [
|
|
9
12
|
guard.projectId,
|
|
10
13
|
`source=${guard.source}`,
|
|
11
14
|
`revision=${guard.revision}`,
|
|
12
15
|
...limitCells(guard.limits),
|
|
16
|
+
...grantCells(guard.approvalGrants),
|
|
13
17
|
].join("\t");
|
|
14
18
|
const previewLines = (result) => [
|
|
15
19
|
`${guardLine(result.current)}\tcurrent`,
|
|
@@ -17,6 +21,7 @@ const previewLines = (result) => [
|
|
|
17
21
|
result.projectId,
|
|
18
22
|
"proposed",
|
|
19
23
|
...limitCells(result.limits),
|
|
24
|
+
...grantCells(result.approvalGrants),
|
|
20
25
|
`command=${result.commandId}`,
|
|
21
26
|
`expires=${result.expiresAt}`,
|
|
22
27
|
].join("\t"),
|
|
@@ -64,7 +64,7 @@ export const PROJECT_TREE = {
|
|
|
64
64
|
{ route: "<project-id>", run: [guard, "runProjectGuardShow"] },
|
|
65
65
|
],
|
|
66
66
|
[
|
|
67
|
-
"project guard set (<project-id> --expected-revision <revision> --max-depth <1..4> --max-live-children <1..64> --max-messages-per-minute <1..600> --max-leases-per-session <1..64> [--command-id <id>] [--dry-run] | --confirm-stdin)",
|
|
67
|
+
"project guard set (<project-id> --expected-revision <revision> --max-depth <1..4> --max-live-children <1..64> --max-messages-per-minute <1..600> --max-leases-per-session <1..64> [--approval-coordinator <none|answer|decide>] [--command-id <id>] [--dry-run] | --confirm-stdin)",
|
|
68
68
|
1,
|
|
69
69
|
["project.guard.preview", "project.guard.confirm"],
|
|
70
70
|
"Set a Project's guards after a preview.",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Data from "effect/Data";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
|
-
import { cell, CliArgumentError, LOCAL_NODE,
|
|
3
|
+
import { cell, CliArgumentError, LOCAL_NODE, parseOptionsWith, reportError, tokenizeArguments, } from "../command-line/index.js";
|
|
4
4
|
import { parseUsage, REFERENCE_PLACEHOLDER, } from "../command-tree/index.js";
|
|
5
5
|
class ReferenceRefused extends Data.TaggedError("ReferenceRefused") {
|
|
6
6
|
}
|
|
@@ -36,6 +36,9 @@ const grammarOf = (arguments_) => ({
|
|
|
36
36
|
: [])),
|
|
37
37
|
positionals: arguments_.filter((argument) => argument.name.startsWith("<")),
|
|
38
38
|
});
|
|
39
|
+
const repeatableOf = (arguments_) => new Set(arguments_.flatMap((argument) => argument.name.startsWith("--") && argument.value?.includes("...") === true
|
|
40
|
+
? [argument.name]
|
|
41
|
+
: []));
|
|
39
42
|
const slotOf = (grammar, position) => {
|
|
40
43
|
const { positionals } = grammar;
|
|
41
44
|
const last = positionals.at(-1);
|
|
@@ -87,7 +90,11 @@ const locate = (arguments_, tokens) => Effect.try({
|
|
|
87
90
|
const grammar = grammarOf(arguments_);
|
|
88
91
|
const valueOptions = new Set(grammar.options.keys());
|
|
89
92
|
const end = tokens.indexOf("--");
|
|
90
|
-
|
|
93
|
+
parseOptionsWith(end === -1 ? tokens : tokens.slice(0, end), {
|
|
94
|
+
allowed: valueOptions,
|
|
95
|
+
allowedFlags: flagsOf(arguments_),
|
|
96
|
+
repeatable: repeatableOf(arguments_),
|
|
97
|
+
});
|
|
91
98
|
const roles = tokenizeArguments(tokens, valueOptions);
|
|
92
99
|
const placements = placementsOf(grammar, tokens, roles);
|
|
93
100
|
return {
|
|
@@ -23,13 +23,20 @@ const unreachable = (name, reason) => new MaiaClientError("transport_failure", r
|
|
|
23
23
|
retryable: true,
|
|
24
24
|
},
|
|
25
25
|
});
|
|
26
|
+
const unknownNode = (name) => new MaiaClientError("transport_failure", "no Node has this name", {
|
|
27
|
+
remoteError: {
|
|
28
|
+
code: "invalid_argument",
|
|
29
|
+
message: `No Node is named '${name}'; see maia node list.`,
|
|
30
|
+
retryable: false,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
26
33
|
export const readRemoteNode = (connector, options, name) => Effect.gen(function* () {
|
|
27
34
|
const local = yield* connector(options);
|
|
28
35
|
const messageId = yield* newCliIdentifier("request");
|
|
29
36
|
const listed = yield* local.client.listRemoteNodes({}, { messageId });
|
|
30
37
|
const node = listed.nodes.find((candidate) => candidate.name === name);
|
|
31
38
|
if (node === undefined)
|
|
32
|
-
return yield* Effect.fail(
|
|
39
|
+
return yield* Effect.fail(unknownNode(name));
|
|
33
40
|
return node;
|
|
34
41
|
});
|
|
35
42
|
const spawnBridge = (node) => ChildProcess.make("ssh", sshCommandArguments({
|
|
@@ -18,7 +18,7 @@ export declare const makeAgentPermissionCliClient: (node: CliNodeOperations) =>
|
|
|
18
18
|
readonly commandId: string;
|
|
19
19
|
readonly grantedAt: string;
|
|
20
20
|
readonly inputDigest: string;
|
|
21
|
-
readonly operationIds: readonly ("agents.change.confirm" | "agents.change.preview" | "agents.list" | "agents.show" | "approval.list" | "approval.respond" | "approval.show" | "connection.capacity.set" | "connection.create" | "connection.detect" | "connection.gateway.create" | "connection.grant.list" | "connection.grant.set.confirm" | "connection.grant.set.preview" | "connection.list" | "connection.login.start" | "connection.models.list" | "connection.pool.list" | "connection.pool.set.confirm" | "connection.pool.set.preview" | "connection.show" | "connection.state.set" | "connection.system.confirm" | "connection.system.preview" | "connection.upkeep.confirm" | "connection.upkeep.preview" | "connection.upkeep.refresh" | "connection.usage.show" | "container.create.confirm" | "container.create.preview" | "container.index.list" | "container.list" | "container.rename.confirm" | "container.rename.preview" | "container.show" | "context.show" | "discovery.sessions.list" | "execution.catalog.get" | "execution.checkpoint.create" | "execution.checkpoint.show" | "execution.command.run" | "execution.file.read" | "execution.placement.create" | "execution.placement.show" | "execution.relocation.apply" | "execution.relocation.plan" | "execution.relocation.reconcile" | "execution.relocation.show" | "execution.worktree.create" | "execution.worktree.import" | "execution.worktree.reconcile" | "execution.worktree.remove.apply" | "execution.worktree.remove.plan" | "execution.worktree.status" | "harness.installed.list" | "hold.list" | "hold.place.confirm" | "hold.place.preview" | "hold.release.confirm" | "hold.release.preview" | "integration.apply.claude-code" | "integration.apply.codex" | "integration.apply.pi-rpc" | "integration.plan.claude-code" | "integration.plan.codex" | "integration.plan.pi-rpc" | "integration.remove.claude-code" | "integration.remove.codex" | "integration.remove.pi-rpc" | "integration.status.claude-code" | "integration.status.codex" | "integration.status.pi-rpc" | "interaction.cancel" | "interaction.create" | "interaction.list" | "interaction.respond" | "interaction.show" | "monitor.bootstrap.create" | "node.remote.install.confirm" | "node.remote.install.preview" | "node.remote.list" | "node.remote.register.confirm" | "node.remote.register.preview" | "node.remote.remove.confirm" | "node.remote.remove.preview" | "node.shutdown" | "node.status" | "port.lease.acquire" | "port.lease.list" | "port.lease.release" | "port.lease.renew" | "presentation.catalog.show" | "presentation.project-list.show" | "presentation.session-list.show" | "presentation.workspace-directory.show" | "project.context.list" | "project.context.record" | "project.context.show" | "project.create.confirm" | "project.create.preview" | "project.guard.confirm" | "project.guard.preview" | "project.guard.show" | "project.list" | "project.register" | "project.rename.confirm" | "project.rename.preview" | "project.show" | "provider.pool.list" | "receipt.get" | "receipt.list" | "reference.resolve" | "routine.create.confirm" | "routine.create.preview" | "routine.disable.confirm" | "routine.disable.preview" | "routine.list" | "routine.pause" | "routine.resume" | "routine.run.confirm" | "routine.run.preview" | "routine.show" | "run.create" | "run.dispatch.settle-terminal" | "run.dispatch.show" | "run.inbox.ack" | "run.inbox.check" | "run.ledger.create" | "run.ledger.list" | "run.ledger.task.dispatch" | "run.ledger.task.list" | "run.ledger.task.settle" | "run.ledger.task.show" | "run.list" | "run.question.cancel" | "run.question.open" | "run.question.reply" | "run.show" | "run.task.list" | "run.task.show" | "runtime.probe" | "session.adopt.confirm" | "session.adopt.preview" | "session.agent-permission.confirm" | "session.agent-permission.preview" | "session.archive" | "session.create" | "session.diff" | "session.events.list" | "session.history.read" | "session.inbox.ack" | "session.inbox.check" | "session.list" | "session.message.send" | "session.observe" | "session.rename" | "session.resume" | "session.show" | "session.spawn" | "session.start" | "session.stop" | "team-workspace.bootstrap.apply" | "team-workspace.bootstrap.preview" | "terminal.controller.acquire" | "terminal.controller.release" | "terminal.controller.renew" | "terminal.controller.request" | "terminal.controller.request.show" | "terminal.create" | "terminal.events.list" | "terminal.input.write" | "terminal.list" | "terminal.mutation.reconcile" | "terminal.observer.attach" | "terminal.observer.check" | "terminal.observer.detach" | "terminal.observer.resync" | "terminal.read" | "terminal.session.close" | "terminal.session.delete" | "terminal.session.resize" | "terminal.session.restart" | "terminal.session.signal" | "terminal.show" | "turn.cancel" | "turn.interrupt" | "turn.queue.list" | "turn.send" | "turn.show" | "turn.wait" | "voice.managed-turn.confirm" | "voice.managed-turn.preview" | "voice.orchestrator.context.show" | "voice.orchestrator.tool.call" | "voice.pi.relay" | "voice.pi.relay.preview" | "voice.pi.relay.reconcile" | "workspace.context.show" | "workspace.execution.configure" | "workspace.execution.show" | "workspace.list" | "workspace.membership.attach" | "workspace.repository.attach" | "workspace.select" | "workspace.show")[];
|
|
21
|
+
readonly operationIds: readonly ("agents.change.confirm" | "agents.change.preview" | "agents.detect" | "agents.list" | "agents.show" | "approval.list" | "approval.respond" | "approval.show" | "connection.capacity.set" | "connection.create" | "connection.detect" | "connection.gateway.create" | "connection.grant.list" | "connection.grant.set.confirm" | "connection.grant.set.preview" | "connection.list" | "connection.login.start" | "connection.models.list" | "connection.pool.list" | "connection.pool.set.confirm" | "connection.pool.set.preview" | "connection.show" | "connection.state.set" | "connection.system.confirm" | "connection.system.preview" | "connection.upkeep.confirm" | "connection.upkeep.preview" | "connection.upkeep.refresh" | "connection.usage.show" | "container.create.confirm" | "container.create.preview" | "container.index.list" | "container.list" | "container.rename.confirm" | "container.rename.preview" | "container.show" | "context.show" | "discovery.sessions.list" | "events.read" | "execution.catalog.get" | "execution.checkpoint.create" | "execution.checkpoint.show" | "execution.command.run" | "execution.file.read" | "execution.placement.create" | "execution.placement.show" | "execution.relocation.apply" | "execution.relocation.plan" | "execution.relocation.reconcile" | "execution.relocation.show" | "execution.worktree.create" | "execution.worktree.import" | "execution.worktree.reconcile" | "execution.worktree.remove.apply" | "execution.worktree.remove.plan" | "execution.worktree.status" | "harness.installed.list" | "hold.list" | "hold.place.confirm" | "hold.place.preview" | "hold.release.confirm" | "hold.release.preview" | "integration.apply.claude-code" | "integration.apply.codex" | "integration.apply.pi-rpc" | "integration.plan.claude-code" | "integration.plan.codex" | "integration.plan.pi-rpc" | "integration.remove.claude-code" | "integration.remove.codex" | "integration.remove.pi-rpc" | "integration.status.claude-code" | "integration.status.codex" | "integration.status.pi-rpc" | "interaction.cancel" | "interaction.create" | "interaction.list" | "interaction.respond" | "interaction.show" | "monitor.bootstrap.create" | "node.remote.install.confirm" | "node.remote.install.preview" | "node.remote.list" | "node.remote.register.confirm" | "node.remote.register.preview" | "node.remote.remove.confirm" | "node.remote.remove.preview" | "node.shutdown" | "node.status" | "port.lease.acquire" | "port.lease.list" | "port.lease.release" | "port.lease.renew" | "presentation.catalog.show" | "presentation.project-list.show" | "presentation.session-list.show" | "presentation.workspace-directory.show" | "project.context.list" | "project.context.record" | "project.context.show" | "project.create.confirm" | "project.create.preview" | "project.guard.confirm" | "project.guard.preview" | "project.guard.show" | "project.list" | "project.register" | "project.rename.confirm" | "project.rename.preview" | "project.show" | "provider.pool.list" | "receipt.get" | "receipt.list" | "reference.resolve" | "routine.create.confirm" | "routine.create.preview" | "routine.disable.confirm" | "routine.disable.preview" | "routine.list" | "routine.pause" | "routine.resume" | "routine.run.confirm" | "routine.run.preview" | "routine.show" | "run.create" | "run.dispatch.settle-terminal" | "run.dispatch.show" | "run.inbox.ack" | "run.inbox.check" | "run.ledger.create" | "run.ledger.list" | "run.ledger.task.dispatch" | "run.ledger.task.list" | "run.ledger.task.settle" | "run.ledger.task.show" | "run.list" | "run.question.cancel" | "run.question.open" | "run.question.reply" | "run.show" | "run.task.list" | "run.task.show" | "runtime.probe" | "session.adopt.confirm" | "session.adopt.preview" | "session.agent-permission.confirm" | "session.agent-permission.preview" | "session.archive" | "session.create" | "session.diff" | "session.events.list" | "session.history.read" | "session.inbox.ack" | "session.inbox.check" | "session.list" | "session.message.send" | "session.observe" | "session.rename" | "session.resume" | "session.show" | "session.spawn" | "session.start" | "session.stop" | "session.wait" | "team-workspace.bootstrap.apply" | "team-workspace.bootstrap.preview" | "terminal.controller.acquire" | "terminal.controller.release" | "terminal.controller.renew" | "terminal.controller.request" | "terminal.controller.request.show" | "terminal.create" | "terminal.events.list" | "terminal.input.write" | "terminal.list" | "terminal.mutation.reconcile" | "terminal.observer.attach" | "terminal.observer.check" | "terminal.observer.detach" | "terminal.observer.resync" | "terminal.read" | "terminal.session.close" | "terminal.session.delete" | "terminal.session.resize" | "terminal.session.restart" | "terminal.session.signal" | "terminal.show" | "turn.cancel" | "turn.interrupt" | "turn.queue.list" | "turn.send" | "turn.show" | "turn.wait" | "voice.managed-turn.confirm" | "voice.managed-turn.preview" | "voice.orchestrator.context.show" | "voice.orchestrator.tool.call" | "voice.pi.relay" | "voice.pi.relay.preview" | "voice.pi.relay.reconcile" | "workspace.context.show" | "workspace.execution.configure" | "workspace.execution.show" | "workspace.list" | "workspace.membership.attach" | "workspace.repository.attach" | "workspace.select" | "workspace.show")[];
|
|
22
22
|
readonly revision: "1";
|
|
23
23
|
};
|
|
24
24
|
readonly method: "session.agent-permission.confirm";
|
|
@@ -55,7 +55,7 @@ export declare const makeAgentPermissionCliClient: (node: CliNodeOperations) =>
|
|
|
55
55
|
readonly inputDigest: string;
|
|
56
56
|
readonly issuedAt: string;
|
|
57
57
|
readonly method: "session.agent-permission.preview";
|
|
58
|
-
readonly operationIds: readonly ("agents.change.confirm" | "agents.change.preview" | "agents.list" | "agents.show" | "approval.list" | "approval.respond" | "approval.show" | "connection.capacity.set" | "connection.create" | "connection.detect" | "connection.gateway.create" | "connection.grant.list" | "connection.grant.set.confirm" | "connection.grant.set.preview" | "connection.list" | "connection.login.start" | "connection.models.list" | "connection.pool.list" | "connection.pool.set.confirm" | "connection.pool.set.preview" | "connection.show" | "connection.state.set" | "connection.system.confirm" | "connection.system.preview" | "connection.upkeep.confirm" | "connection.upkeep.preview" | "connection.upkeep.refresh" | "connection.usage.show" | "container.create.confirm" | "container.create.preview" | "container.index.list" | "container.list" | "container.rename.confirm" | "container.rename.preview" | "container.show" | "context.show" | "discovery.sessions.list" | "execution.catalog.get" | "execution.checkpoint.create" | "execution.checkpoint.show" | "execution.command.run" | "execution.file.read" | "execution.placement.create" | "execution.placement.show" | "execution.relocation.apply" | "execution.relocation.plan" | "execution.relocation.reconcile" | "execution.relocation.show" | "execution.worktree.create" | "execution.worktree.import" | "execution.worktree.reconcile" | "execution.worktree.remove.apply" | "execution.worktree.remove.plan" | "execution.worktree.status" | "harness.installed.list" | "hold.list" | "hold.place.confirm" | "hold.place.preview" | "hold.release.confirm" | "hold.release.preview" | "integration.apply.claude-code" | "integration.apply.codex" | "integration.apply.pi-rpc" | "integration.plan.claude-code" | "integration.plan.codex" | "integration.plan.pi-rpc" | "integration.remove.claude-code" | "integration.remove.codex" | "integration.remove.pi-rpc" | "integration.status.claude-code" | "integration.status.codex" | "integration.status.pi-rpc" | "interaction.cancel" | "interaction.create" | "interaction.list" | "interaction.respond" | "interaction.show" | "monitor.bootstrap.create" | "node.remote.install.confirm" | "node.remote.install.preview" | "node.remote.list" | "node.remote.register.confirm" | "node.remote.register.preview" | "node.remote.remove.confirm" | "node.remote.remove.preview" | "node.shutdown" | "node.status" | "port.lease.acquire" | "port.lease.list" | "port.lease.release" | "port.lease.renew" | "presentation.catalog.show" | "presentation.project-list.show" | "presentation.session-list.show" | "presentation.workspace-directory.show" | "project.context.list" | "project.context.record" | "project.context.show" | "project.create.confirm" | "project.create.preview" | "project.guard.confirm" | "project.guard.preview" | "project.guard.show" | "project.list" | "project.register" | "project.rename.confirm" | "project.rename.preview" | "project.show" | "provider.pool.list" | "receipt.get" | "receipt.list" | "reference.resolve" | "routine.create.confirm" | "routine.create.preview" | "routine.disable.confirm" | "routine.disable.preview" | "routine.list" | "routine.pause" | "routine.resume" | "routine.run.confirm" | "routine.run.preview" | "routine.show" | "run.create" | "run.dispatch.settle-terminal" | "run.dispatch.show" | "run.inbox.ack" | "run.inbox.check" | "run.ledger.create" | "run.ledger.list" | "run.ledger.task.dispatch" | "run.ledger.task.list" | "run.ledger.task.settle" | "run.ledger.task.show" | "run.list" | "run.question.cancel" | "run.question.open" | "run.question.reply" | "run.show" | "run.task.list" | "run.task.show" | "runtime.probe" | "session.adopt.confirm" | "session.adopt.preview" | "session.agent-permission.confirm" | "session.agent-permission.preview" | "session.archive" | "session.create" | "session.diff" | "session.events.list" | "session.history.read" | "session.inbox.ack" | "session.inbox.check" | "session.list" | "session.message.send" | "session.observe" | "session.rename" | "session.resume" | "session.show" | "session.spawn" | "session.start" | "session.stop" | "team-workspace.bootstrap.apply" | "team-workspace.bootstrap.preview" | "terminal.controller.acquire" | "terminal.controller.release" | "terminal.controller.renew" | "terminal.controller.request" | "terminal.controller.request.show" | "terminal.create" | "terminal.events.list" | "terminal.input.write" | "terminal.list" | "terminal.mutation.reconcile" | "terminal.observer.attach" | "terminal.observer.check" | "terminal.observer.detach" | "terminal.observer.resync" | "terminal.read" | "terminal.session.close" | "terminal.session.delete" | "terminal.session.resize" | "terminal.session.restart" | "terminal.session.signal" | "terminal.show" | "turn.cancel" | "turn.interrupt" | "turn.queue.list" | "turn.send" | "turn.show" | "turn.wait" | "voice.managed-turn.confirm" | "voice.managed-turn.preview" | "voice.orchestrator.context.show" | "voice.orchestrator.tool.call" | "voice.pi.relay" | "voice.pi.relay.preview" | "voice.pi.relay.reconcile" | "workspace.context.show" | "workspace.execution.configure" | "workspace.execution.show" | "workspace.list" | "workspace.membership.attach" | "workspace.repository.attach" | "workspace.select" | "workspace.show")[];
|
|
58
|
+
readonly operationIds: readonly ("agents.change.confirm" | "agents.change.preview" | "agents.detect" | "agents.list" | "agents.show" | "approval.list" | "approval.respond" | "approval.show" | "connection.capacity.set" | "connection.create" | "connection.detect" | "connection.gateway.create" | "connection.grant.list" | "connection.grant.set.confirm" | "connection.grant.set.preview" | "connection.list" | "connection.login.start" | "connection.models.list" | "connection.pool.list" | "connection.pool.set.confirm" | "connection.pool.set.preview" | "connection.show" | "connection.state.set" | "connection.system.confirm" | "connection.system.preview" | "connection.upkeep.confirm" | "connection.upkeep.preview" | "connection.upkeep.refresh" | "connection.usage.show" | "container.create.confirm" | "container.create.preview" | "container.index.list" | "container.list" | "container.rename.confirm" | "container.rename.preview" | "container.show" | "context.show" | "discovery.sessions.list" | "events.read" | "execution.catalog.get" | "execution.checkpoint.create" | "execution.checkpoint.show" | "execution.command.run" | "execution.file.read" | "execution.placement.create" | "execution.placement.show" | "execution.relocation.apply" | "execution.relocation.plan" | "execution.relocation.reconcile" | "execution.relocation.show" | "execution.worktree.create" | "execution.worktree.import" | "execution.worktree.reconcile" | "execution.worktree.remove.apply" | "execution.worktree.remove.plan" | "execution.worktree.status" | "harness.installed.list" | "hold.list" | "hold.place.confirm" | "hold.place.preview" | "hold.release.confirm" | "hold.release.preview" | "integration.apply.claude-code" | "integration.apply.codex" | "integration.apply.pi-rpc" | "integration.plan.claude-code" | "integration.plan.codex" | "integration.plan.pi-rpc" | "integration.remove.claude-code" | "integration.remove.codex" | "integration.remove.pi-rpc" | "integration.status.claude-code" | "integration.status.codex" | "integration.status.pi-rpc" | "interaction.cancel" | "interaction.create" | "interaction.list" | "interaction.respond" | "interaction.show" | "monitor.bootstrap.create" | "node.remote.install.confirm" | "node.remote.install.preview" | "node.remote.list" | "node.remote.register.confirm" | "node.remote.register.preview" | "node.remote.remove.confirm" | "node.remote.remove.preview" | "node.shutdown" | "node.status" | "port.lease.acquire" | "port.lease.list" | "port.lease.release" | "port.lease.renew" | "presentation.catalog.show" | "presentation.project-list.show" | "presentation.session-list.show" | "presentation.workspace-directory.show" | "project.context.list" | "project.context.record" | "project.context.show" | "project.create.confirm" | "project.create.preview" | "project.guard.confirm" | "project.guard.preview" | "project.guard.show" | "project.list" | "project.register" | "project.rename.confirm" | "project.rename.preview" | "project.show" | "provider.pool.list" | "receipt.get" | "receipt.list" | "reference.resolve" | "routine.create.confirm" | "routine.create.preview" | "routine.disable.confirm" | "routine.disable.preview" | "routine.list" | "routine.pause" | "routine.resume" | "routine.run.confirm" | "routine.run.preview" | "routine.show" | "run.create" | "run.dispatch.settle-terminal" | "run.dispatch.show" | "run.inbox.ack" | "run.inbox.check" | "run.ledger.create" | "run.ledger.list" | "run.ledger.task.dispatch" | "run.ledger.task.list" | "run.ledger.task.settle" | "run.ledger.task.show" | "run.list" | "run.question.cancel" | "run.question.open" | "run.question.reply" | "run.show" | "run.task.list" | "run.task.show" | "runtime.probe" | "session.adopt.confirm" | "session.adopt.preview" | "session.agent-permission.confirm" | "session.agent-permission.preview" | "session.archive" | "session.create" | "session.diff" | "session.events.list" | "session.history.read" | "session.inbox.ack" | "session.inbox.check" | "session.list" | "session.message.send" | "session.observe" | "session.rename" | "session.resume" | "session.show" | "session.spawn" | "session.start" | "session.stop" | "session.wait" | "team-workspace.bootstrap.apply" | "team-workspace.bootstrap.preview" | "terminal.controller.acquire" | "terminal.controller.release" | "terminal.controller.renew" | "terminal.controller.request" | "terminal.controller.request.show" | "terminal.create" | "terminal.events.list" | "terminal.input.write" | "terminal.list" | "terminal.mutation.reconcile" | "terminal.observer.attach" | "terminal.observer.check" | "terminal.observer.detach" | "terminal.observer.resync" | "terminal.read" | "terminal.session.close" | "terminal.session.delete" | "terminal.session.resize" | "terminal.session.restart" | "terminal.session.signal" | "terminal.show" | "turn.cancel" | "turn.interrupt" | "turn.queue.list" | "turn.send" | "turn.show" | "turn.wait" | "voice.managed-turn.confirm" | "voice.managed-turn.preview" | "voice.orchestrator.context.show" | "voice.orchestrator.tool.call" | "voice.pi.relay" | "voice.pi.relay.preview" | "voice.pi.relay.reconcile" | "workspace.context.show" | "workspace.execution.configure" | "workspace.execution.show" | "workspace.list" | "workspace.membership.attach" | "workspace.repository.attach" | "workspace.select" | "workspace.show")[];
|
|
59
59
|
readonly proof: string;
|
|
60
60
|
}>;
|
|
61
61
|
};
|
|
@@ -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
|
|
@@ -2,7 +2,7 @@ import * as Effect from "effect/Effect";
|
|
|
2
2
|
import { listEach, writeMerged } from "../../address-space/index.js";
|
|
3
3
|
import { CliArgumentError, parseOptions, reportError, requirePositionals, writeNodeResult, } from "../../command-line/index.js";
|
|
4
4
|
import { mergeLists } from "../../fleet/index.js";
|
|
5
|
-
import { commandIdentifier, } from "../../local-node/index.js";
|
|
5
|
+
import { commandIdentifier, holdsSessionCredential, } from "../../local-node/index.js";
|
|
6
6
|
import { describeApproval, formatApprovalResult, formatMergedApprovals, } from "./output/index.js";
|
|
7
7
|
const missing = (name) => Effect.die(new Error(`Missing approval client: ${name}.`));
|
|
8
8
|
const write = (context) => (result) => writeNodeResult(result, context, {
|
|
@@ -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,34 +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
|
-
const runDecision = (verb, tokens, context) => {
|
|
128
|
-
|
|
129
|
-
|
|
134
|
+
const runDecision = (verb, tokens, context) => Effect.gen(function* () {
|
|
135
|
+
const asCoordinator = tokens.includes("--as-coordinator");
|
|
136
|
+
if (!asCoordinator &&
|
|
137
|
+
(verb !== "answer" || !(yield* holdsSessionCredential)))
|
|
138
|
+
requirePerson(context, verb);
|
|
139
|
+
return yield* parseDecision(verb, tokens, context);
|
|
140
|
+
});
|
|
141
|
+
const parseDecision = (verb, tokens, context) => {
|
|
142
|
+
const parsed = parseOptions(tokens, OPTIONS[verb], FLAGS[verb]);
|
|
130
143
|
requirePositionals(parsed.positionals, 1);
|
|
131
144
|
const commandId = parsed.options.get("--command-id");
|
|
132
145
|
return decide(context, {
|
|
133
146
|
approvalId: parsed.positionals[0] ?? "",
|
|
147
|
+
asCoordinator: parsed.flags.has("--as-coordinator"),
|
|
134
148
|
...(commandId === undefined ? {} : { commandId }),
|
|
135
149
|
requested: readDecision(verb, parsed.options, parsed.flags),
|
|
136
150
|
});
|
package/dist/session/client.d.ts
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import type { Session, SessionCreateParameters, SessionCreateResult, SessionCreationInput, SessionCreationOutcome, SessionCreationPlan, SessionEventsListResult, SessionInboxAckResult, SessionInboxCheckResult, SessionListParameters, SessionListResult, SessionMessageSendResult, SessionObserveResult, SessionResumeResult, SessionShowResult, SessionSpawnResult, SessionStartResult, SessionStopResult } from "@maiaos/sdk";
|
|
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
|
+
export type WaitSessionInput = {
|
|
4
|
+
readonly sessionId: string;
|
|
5
|
+
readonly states: readonly string[];
|
|
6
|
+
readonly timeoutMilliseconds: number;
|
|
7
|
+
};
|
|
3
8
|
export type CreateSessionInput = {
|
|
4
9
|
readonly agentId?: SessionCreateParameters["agentId"];
|
|
5
10
|
readonly baseRef?: string;
|
|
6
11
|
readonly commandId?: string;
|
|
7
12
|
readonly connectionId?: string;
|
|
13
|
+
readonly cwd?: string;
|
|
8
14
|
readonly definitionRef?: SessionCreateParameters["definitionRef"];
|
|
9
15
|
readonly effort?: SessionCreateParameters["effort"];
|
|
10
16
|
readonly executor?: SessionCreateParameters["executor"];
|
|
17
|
+
readonly hostAuthority?: SessionCreateParameters["hostAuthority"];
|
|
11
18
|
readonly model?: string;
|
|
19
|
+
readonly permission?: SessionCreateParameters["permission"];
|
|
12
20
|
readonly role?: SessionCreateParameters["role"];
|
|
13
21
|
readonly title?: string;
|
|
14
22
|
readonly workspaceId: string;
|
|
@@ -59,7 +67,7 @@ export declare const makeSessionClient: (node: CliNodeOperations) => {
|
|
|
59
67
|
readonly commandId: string;
|
|
60
68
|
readonly grantedAt: string;
|
|
61
69
|
readonly inputDigest: string;
|
|
62
|
-
readonly operationIds: readonly ("agents.change.confirm" | "agents.change.preview" | "agents.list" | "agents.show" | "approval.list" | "approval.respond" | "approval.show" | "connection.capacity.set" | "connection.create" | "connection.detect" | "connection.gateway.create" | "connection.grant.list" | "connection.grant.set.confirm" | "connection.grant.set.preview" | "connection.list" | "connection.login.start" | "connection.models.list" | "connection.pool.list" | "connection.pool.set.confirm" | "connection.pool.set.preview" | "connection.show" | "connection.state.set" | "connection.system.confirm" | "connection.system.preview" | "connection.upkeep.confirm" | "connection.upkeep.preview" | "connection.upkeep.refresh" | "connection.usage.show" | "container.create.confirm" | "container.create.preview" | "container.index.list" | "container.list" | "container.rename.confirm" | "container.rename.preview" | "container.show" | "context.show" | "discovery.sessions.list" | "execution.catalog.get" | "execution.checkpoint.create" | "execution.checkpoint.show" | "execution.command.run" | "execution.file.read" | "execution.placement.create" | "execution.placement.show" | "execution.relocation.apply" | "execution.relocation.plan" | "execution.relocation.reconcile" | "execution.relocation.show" | "execution.worktree.create" | "execution.worktree.import" | "execution.worktree.reconcile" | "execution.worktree.remove.apply" | "execution.worktree.remove.plan" | "execution.worktree.status" | "harness.installed.list" | "hold.list" | "hold.place.confirm" | "hold.place.preview" | "hold.release.confirm" | "hold.release.preview" | "integration.apply.claude-code" | "integration.apply.codex" | "integration.apply.pi-rpc" | "integration.plan.claude-code" | "integration.plan.codex" | "integration.plan.pi-rpc" | "integration.remove.claude-code" | "integration.remove.codex" | "integration.remove.pi-rpc" | "integration.status.claude-code" | "integration.status.codex" | "integration.status.pi-rpc" | "interaction.cancel" | "interaction.create" | "interaction.list" | "interaction.respond" | "interaction.show" | "monitor.bootstrap.create" | "node.remote.install.confirm" | "node.remote.install.preview" | "node.remote.list" | "node.remote.register.confirm" | "node.remote.register.preview" | "node.remote.remove.confirm" | "node.remote.remove.preview" | "node.shutdown" | "node.status" | "port.lease.acquire" | "port.lease.list" | "port.lease.release" | "port.lease.renew" | "presentation.catalog.show" | "presentation.project-list.show" | "presentation.session-list.show" | "presentation.workspace-directory.show" | "project.context.list" | "project.context.record" | "project.context.show" | "project.create.confirm" | "project.create.preview" | "project.guard.confirm" | "project.guard.preview" | "project.guard.show" | "project.list" | "project.register" | "project.rename.confirm" | "project.rename.preview" | "project.show" | "provider.pool.list" | "receipt.get" | "receipt.list" | "reference.resolve" | "routine.create.confirm" | "routine.create.preview" | "routine.disable.confirm" | "routine.disable.preview" | "routine.list" | "routine.pause" | "routine.resume" | "routine.run.confirm" | "routine.run.preview" | "routine.show" | "run.create" | "run.dispatch.settle-terminal" | "run.dispatch.show" | "run.inbox.ack" | "run.inbox.check" | "run.ledger.create" | "run.ledger.list" | "run.ledger.task.dispatch" | "run.ledger.task.list" | "run.ledger.task.settle" | "run.ledger.task.show" | "run.list" | "run.question.cancel" | "run.question.open" | "run.question.reply" | "run.show" | "run.task.list" | "run.task.show" | "runtime.probe" | "session.adopt.confirm" | "session.adopt.preview" | "session.agent-permission.confirm" | "session.agent-permission.preview" | "session.archive" | "session.create" | "session.diff" | "session.events.list" | "session.history.read" | "session.inbox.ack" | "session.inbox.check" | "session.list" | "session.message.send" | "session.observe" | "session.rename" | "session.resume" | "session.show" | "session.spawn" | "session.start" | "session.stop" | "team-workspace.bootstrap.apply" | "team-workspace.bootstrap.preview" | "terminal.controller.acquire" | "terminal.controller.release" | "terminal.controller.renew" | "terminal.controller.request" | "terminal.controller.request.show" | "terminal.create" | "terminal.events.list" | "terminal.input.write" | "terminal.list" | "terminal.mutation.reconcile" | "terminal.observer.attach" | "terminal.observer.check" | "terminal.observer.detach" | "terminal.observer.resync" | "terminal.read" | "terminal.session.close" | "terminal.session.delete" | "terminal.session.resize" | "terminal.session.restart" | "terminal.session.signal" | "terminal.show" | "turn.cancel" | "turn.interrupt" | "turn.queue.list" | "turn.send" | "turn.show" | "turn.wait" | "voice.managed-turn.confirm" | "voice.managed-turn.preview" | "voice.orchestrator.context.show" | "voice.orchestrator.tool.call" | "voice.pi.relay" | "voice.pi.relay.preview" | "voice.pi.relay.reconcile" | "workspace.context.show" | "workspace.execution.configure" | "workspace.execution.show" | "workspace.list" | "workspace.membership.attach" | "workspace.repository.attach" | "workspace.select" | "workspace.show")[];
|
|
70
|
+
readonly operationIds: readonly ("agents.change.confirm" | "agents.change.preview" | "agents.detect" | "agents.list" | "agents.show" | "approval.list" | "approval.respond" | "approval.show" | "connection.capacity.set" | "connection.create" | "connection.detect" | "connection.gateway.create" | "connection.grant.list" | "connection.grant.set.confirm" | "connection.grant.set.preview" | "connection.list" | "connection.login.start" | "connection.models.list" | "connection.pool.list" | "connection.pool.set.confirm" | "connection.pool.set.preview" | "connection.show" | "connection.state.set" | "connection.system.confirm" | "connection.system.preview" | "connection.upkeep.confirm" | "connection.upkeep.preview" | "connection.upkeep.refresh" | "connection.usage.show" | "container.create.confirm" | "container.create.preview" | "container.index.list" | "container.list" | "container.rename.confirm" | "container.rename.preview" | "container.show" | "context.show" | "discovery.sessions.list" | "events.read" | "execution.catalog.get" | "execution.checkpoint.create" | "execution.checkpoint.show" | "execution.command.run" | "execution.file.read" | "execution.placement.create" | "execution.placement.show" | "execution.relocation.apply" | "execution.relocation.plan" | "execution.relocation.reconcile" | "execution.relocation.show" | "execution.worktree.create" | "execution.worktree.import" | "execution.worktree.reconcile" | "execution.worktree.remove.apply" | "execution.worktree.remove.plan" | "execution.worktree.status" | "harness.installed.list" | "hold.list" | "hold.place.confirm" | "hold.place.preview" | "hold.release.confirm" | "hold.release.preview" | "integration.apply.claude-code" | "integration.apply.codex" | "integration.apply.pi-rpc" | "integration.plan.claude-code" | "integration.plan.codex" | "integration.plan.pi-rpc" | "integration.remove.claude-code" | "integration.remove.codex" | "integration.remove.pi-rpc" | "integration.status.claude-code" | "integration.status.codex" | "integration.status.pi-rpc" | "interaction.cancel" | "interaction.create" | "interaction.list" | "interaction.respond" | "interaction.show" | "monitor.bootstrap.create" | "node.remote.install.confirm" | "node.remote.install.preview" | "node.remote.list" | "node.remote.register.confirm" | "node.remote.register.preview" | "node.remote.remove.confirm" | "node.remote.remove.preview" | "node.shutdown" | "node.status" | "port.lease.acquire" | "port.lease.list" | "port.lease.release" | "port.lease.renew" | "presentation.catalog.show" | "presentation.project-list.show" | "presentation.session-list.show" | "presentation.workspace-directory.show" | "project.context.list" | "project.context.record" | "project.context.show" | "project.create.confirm" | "project.create.preview" | "project.guard.confirm" | "project.guard.preview" | "project.guard.show" | "project.list" | "project.register" | "project.rename.confirm" | "project.rename.preview" | "project.show" | "provider.pool.list" | "receipt.get" | "receipt.list" | "reference.resolve" | "routine.create.confirm" | "routine.create.preview" | "routine.disable.confirm" | "routine.disable.preview" | "routine.list" | "routine.pause" | "routine.resume" | "routine.run.confirm" | "routine.run.preview" | "routine.show" | "run.create" | "run.dispatch.settle-terminal" | "run.dispatch.show" | "run.inbox.ack" | "run.inbox.check" | "run.ledger.create" | "run.ledger.list" | "run.ledger.task.dispatch" | "run.ledger.task.list" | "run.ledger.task.settle" | "run.ledger.task.show" | "run.list" | "run.question.cancel" | "run.question.open" | "run.question.reply" | "run.show" | "run.task.list" | "run.task.show" | "runtime.probe" | "session.adopt.confirm" | "session.adopt.preview" | "session.agent-permission.confirm" | "session.agent-permission.preview" | "session.archive" | "session.create" | "session.diff" | "session.events.list" | "session.history.read" | "session.inbox.ack" | "session.inbox.check" | "session.list" | "session.message.send" | "session.observe" | "session.rename" | "session.resume" | "session.show" | "session.spawn" | "session.start" | "session.stop" | "session.wait" | "team-workspace.bootstrap.apply" | "team-workspace.bootstrap.preview" | "terminal.controller.acquire" | "terminal.controller.release" | "terminal.controller.renew" | "terminal.controller.request" | "terminal.controller.request.show" | "terminal.create" | "terminal.events.list" | "terminal.input.write" | "terminal.list" | "terminal.mutation.reconcile" | "terminal.observer.attach" | "terminal.observer.check" | "terminal.observer.detach" | "terminal.observer.resync" | "terminal.read" | "terminal.session.close" | "terminal.session.delete" | "terminal.session.resize" | "terminal.session.restart" | "terminal.session.signal" | "terminal.show" | "turn.cancel" | "turn.interrupt" | "turn.queue.list" | "turn.send" | "turn.show" | "turn.wait" | "voice.managed-turn.confirm" | "voice.managed-turn.preview" | "voice.orchestrator.context.show" | "voice.orchestrator.tool.call" | "voice.pi.relay" | "voice.pi.relay.preview" | "voice.pi.relay.reconcile" | "workspace.context.show" | "workspace.execution.configure" | "workspace.execution.show" | "workspace.list" | "workspace.membership.attach" | "workspace.repository.attach" | "workspace.select" | "workspace.show")[];
|
|
63
71
|
readonly revision: "1";
|
|
64
72
|
};
|
|
65
73
|
readonly method: "session.agent-permission.confirm";
|
|
@@ -96,7 +104,7 @@ export declare const makeSessionClient: (node: CliNodeOperations) => {
|
|
|
96
104
|
readonly inputDigest: string;
|
|
97
105
|
readonly issuedAt: string;
|
|
98
106
|
readonly method: "session.agent-permission.preview";
|
|
99
|
-
readonly operationIds: readonly ("agents.change.confirm" | "agents.change.preview" | "agents.list" | "agents.show" | "approval.list" | "approval.respond" | "approval.show" | "connection.capacity.set" | "connection.create" | "connection.detect" | "connection.gateway.create" | "connection.grant.list" | "connection.grant.set.confirm" | "connection.grant.set.preview" | "connection.list" | "connection.login.start" | "connection.models.list" | "connection.pool.list" | "connection.pool.set.confirm" | "connection.pool.set.preview" | "connection.show" | "connection.state.set" | "connection.system.confirm" | "connection.system.preview" | "connection.upkeep.confirm" | "connection.upkeep.preview" | "connection.upkeep.refresh" | "connection.usage.show" | "container.create.confirm" | "container.create.preview" | "container.index.list" | "container.list" | "container.rename.confirm" | "container.rename.preview" | "container.show" | "context.show" | "discovery.sessions.list" | "execution.catalog.get" | "execution.checkpoint.create" | "execution.checkpoint.show" | "execution.command.run" | "execution.file.read" | "execution.placement.create" | "execution.placement.show" | "execution.relocation.apply" | "execution.relocation.plan" | "execution.relocation.reconcile" | "execution.relocation.show" | "execution.worktree.create" | "execution.worktree.import" | "execution.worktree.reconcile" | "execution.worktree.remove.apply" | "execution.worktree.remove.plan" | "execution.worktree.status" | "harness.installed.list" | "hold.list" | "hold.place.confirm" | "hold.place.preview" | "hold.release.confirm" | "hold.release.preview" | "integration.apply.claude-code" | "integration.apply.codex" | "integration.apply.pi-rpc" | "integration.plan.claude-code" | "integration.plan.codex" | "integration.plan.pi-rpc" | "integration.remove.claude-code" | "integration.remove.codex" | "integration.remove.pi-rpc" | "integration.status.claude-code" | "integration.status.codex" | "integration.status.pi-rpc" | "interaction.cancel" | "interaction.create" | "interaction.list" | "interaction.respond" | "interaction.show" | "monitor.bootstrap.create" | "node.remote.install.confirm" | "node.remote.install.preview" | "node.remote.list" | "node.remote.register.confirm" | "node.remote.register.preview" | "node.remote.remove.confirm" | "node.remote.remove.preview" | "node.shutdown" | "node.status" | "port.lease.acquire" | "port.lease.list" | "port.lease.release" | "port.lease.renew" | "presentation.catalog.show" | "presentation.project-list.show" | "presentation.session-list.show" | "presentation.workspace-directory.show" | "project.context.list" | "project.context.record" | "project.context.show" | "project.create.confirm" | "project.create.preview" | "project.guard.confirm" | "project.guard.preview" | "project.guard.show" | "project.list" | "project.register" | "project.rename.confirm" | "project.rename.preview" | "project.show" | "provider.pool.list" | "receipt.get" | "receipt.list" | "reference.resolve" | "routine.create.confirm" | "routine.create.preview" | "routine.disable.confirm" | "routine.disable.preview" | "routine.list" | "routine.pause" | "routine.resume" | "routine.run.confirm" | "routine.run.preview" | "routine.show" | "run.create" | "run.dispatch.settle-terminal" | "run.dispatch.show" | "run.inbox.ack" | "run.inbox.check" | "run.ledger.create" | "run.ledger.list" | "run.ledger.task.dispatch" | "run.ledger.task.list" | "run.ledger.task.settle" | "run.ledger.task.show" | "run.list" | "run.question.cancel" | "run.question.open" | "run.question.reply" | "run.show" | "run.task.list" | "run.task.show" | "runtime.probe" | "session.adopt.confirm" | "session.adopt.preview" | "session.agent-permission.confirm" | "session.agent-permission.preview" | "session.archive" | "session.create" | "session.diff" | "session.events.list" | "session.history.read" | "session.inbox.ack" | "session.inbox.check" | "session.list" | "session.message.send" | "session.observe" | "session.rename" | "session.resume" | "session.show" | "session.spawn" | "session.start" | "session.stop" | "team-workspace.bootstrap.apply" | "team-workspace.bootstrap.preview" | "terminal.controller.acquire" | "terminal.controller.release" | "terminal.controller.renew" | "terminal.controller.request" | "terminal.controller.request.show" | "terminal.create" | "terminal.events.list" | "terminal.input.write" | "terminal.list" | "terminal.mutation.reconcile" | "terminal.observer.attach" | "terminal.observer.check" | "terminal.observer.detach" | "terminal.observer.resync" | "terminal.read" | "terminal.session.close" | "terminal.session.delete" | "terminal.session.resize" | "terminal.session.restart" | "terminal.session.signal" | "terminal.show" | "turn.cancel" | "turn.interrupt" | "turn.queue.list" | "turn.send" | "turn.show" | "turn.wait" | "voice.managed-turn.confirm" | "voice.managed-turn.preview" | "voice.orchestrator.context.show" | "voice.orchestrator.tool.call" | "voice.pi.relay" | "voice.pi.relay.preview" | "voice.pi.relay.reconcile" | "workspace.context.show" | "workspace.execution.configure" | "workspace.execution.show" | "workspace.list" | "workspace.membership.attach" | "workspace.repository.attach" | "workspace.select" | "workspace.show")[];
|
|
107
|
+
readonly operationIds: readonly ("agents.change.confirm" | "agents.change.preview" | "agents.detect" | "agents.list" | "agents.show" | "approval.list" | "approval.respond" | "approval.show" | "connection.capacity.set" | "connection.create" | "connection.detect" | "connection.gateway.create" | "connection.grant.list" | "connection.grant.set.confirm" | "connection.grant.set.preview" | "connection.list" | "connection.login.start" | "connection.models.list" | "connection.pool.list" | "connection.pool.set.confirm" | "connection.pool.set.preview" | "connection.show" | "connection.state.set" | "connection.system.confirm" | "connection.system.preview" | "connection.upkeep.confirm" | "connection.upkeep.preview" | "connection.upkeep.refresh" | "connection.usage.show" | "container.create.confirm" | "container.create.preview" | "container.index.list" | "container.list" | "container.rename.confirm" | "container.rename.preview" | "container.show" | "context.show" | "discovery.sessions.list" | "events.read" | "execution.catalog.get" | "execution.checkpoint.create" | "execution.checkpoint.show" | "execution.command.run" | "execution.file.read" | "execution.placement.create" | "execution.placement.show" | "execution.relocation.apply" | "execution.relocation.plan" | "execution.relocation.reconcile" | "execution.relocation.show" | "execution.worktree.create" | "execution.worktree.import" | "execution.worktree.reconcile" | "execution.worktree.remove.apply" | "execution.worktree.remove.plan" | "execution.worktree.status" | "harness.installed.list" | "hold.list" | "hold.place.confirm" | "hold.place.preview" | "hold.release.confirm" | "hold.release.preview" | "integration.apply.claude-code" | "integration.apply.codex" | "integration.apply.pi-rpc" | "integration.plan.claude-code" | "integration.plan.codex" | "integration.plan.pi-rpc" | "integration.remove.claude-code" | "integration.remove.codex" | "integration.remove.pi-rpc" | "integration.status.claude-code" | "integration.status.codex" | "integration.status.pi-rpc" | "interaction.cancel" | "interaction.create" | "interaction.list" | "interaction.respond" | "interaction.show" | "monitor.bootstrap.create" | "node.remote.install.confirm" | "node.remote.install.preview" | "node.remote.list" | "node.remote.register.confirm" | "node.remote.register.preview" | "node.remote.remove.confirm" | "node.remote.remove.preview" | "node.shutdown" | "node.status" | "port.lease.acquire" | "port.lease.list" | "port.lease.release" | "port.lease.renew" | "presentation.catalog.show" | "presentation.project-list.show" | "presentation.session-list.show" | "presentation.workspace-directory.show" | "project.context.list" | "project.context.record" | "project.context.show" | "project.create.confirm" | "project.create.preview" | "project.guard.confirm" | "project.guard.preview" | "project.guard.show" | "project.list" | "project.register" | "project.rename.confirm" | "project.rename.preview" | "project.show" | "provider.pool.list" | "receipt.get" | "receipt.list" | "reference.resolve" | "routine.create.confirm" | "routine.create.preview" | "routine.disable.confirm" | "routine.disable.preview" | "routine.list" | "routine.pause" | "routine.resume" | "routine.run.confirm" | "routine.run.preview" | "routine.show" | "run.create" | "run.dispatch.settle-terminal" | "run.dispatch.show" | "run.inbox.ack" | "run.inbox.check" | "run.ledger.create" | "run.ledger.list" | "run.ledger.task.dispatch" | "run.ledger.task.list" | "run.ledger.task.settle" | "run.ledger.task.show" | "run.list" | "run.question.cancel" | "run.question.open" | "run.question.reply" | "run.show" | "run.task.list" | "run.task.show" | "runtime.probe" | "session.adopt.confirm" | "session.adopt.preview" | "session.agent-permission.confirm" | "session.agent-permission.preview" | "session.archive" | "session.create" | "session.diff" | "session.events.list" | "session.history.read" | "session.inbox.ack" | "session.inbox.check" | "session.list" | "session.message.send" | "session.observe" | "session.rename" | "session.resume" | "session.show" | "session.spawn" | "session.start" | "session.stop" | "session.wait" | "team-workspace.bootstrap.apply" | "team-workspace.bootstrap.preview" | "terminal.controller.acquire" | "terminal.controller.release" | "terminal.controller.renew" | "terminal.controller.request" | "terminal.controller.request.show" | "terminal.create" | "terminal.events.list" | "terminal.input.write" | "terminal.list" | "terminal.mutation.reconcile" | "terminal.observer.attach" | "terminal.observer.check" | "terminal.observer.detach" | "terminal.observer.resync" | "terminal.read" | "terminal.session.close" | "terminal.session.delete" | "terminal.session.resize" | "terminal.session.restart" | "terminal.session.signal" | "terminal.show" | "turn.cancel" | "turn.interrupt" | "turn.queue.list" | "turn.send" | "turn.show" | "turn.wait" | "voice.managed-turn.confirm" | "voice.managed-turn.preview" | "voice.orchestrator.context.show" | "voice.orchestrator.tool.call" | "voice.pi.relay" | "voice.pi.relay.preview" | "voice.pi.relay.reconcile" | "workspace.context.show" | "workspace.execution.configure" | "workspace.execution.show" | "workspace.list" | "workspace.membership.attach" | "workspace.repository.attach" | "workspace.select" | "workspace.show")[];
|
|
100
108
|
readonly proof: string;
|
|
101
109
|
}>;
|
|
102
110
|
attachSession: (input: import("./attach-client.js").AttachSessionInput) => CliNodeEffect<import("./attach-client.js").SessionAttachStream>;
|
|
@@ -129,6 +137,7 @@ export declare const makeSessionClient: (node: CliNodeOperations) => {
|
|
|
129
137
|
spawnSession: (input: SpawnSessionInput) => CliNodeEffect<SessionSpawnResult>;
|
|
130
138
|
startSession: (input: StartSessionInput) => CliNodeEffect<SessionStartResult>;
|
|
131
139
|
stopSession: (input: StartSessionInput) => CliNodeEffect<SessionStopResult>;
|
|
140
|
+
waitSession: (input: WaitSessionInput) => CliNodeEffect<SessionWaitResult>;
|
|
132
141
|
};
|
|
133
142
|
export {};
|
|
134
143
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/session/client.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { sessionCreateParametersSchema, sessionEventsListParametersSchema, sessionInboxAckParametersSchema, sessionInboxCheckParametersSchema, sessionListParametersSchema, sessionMessageSendParametersSchema, sessionObserveParametersSchema, sessionResumeParametersSchema, sessionShowParametersSchema, sessionSpawnParametersSchema, sessionStartParametersSchema, sessionStopParametersSchema, } from "@maiaos/sdk";
|
|
1
|
+
import { MAX_SESSION_WAIT_MILLISECONDS, sessionCreateParametersSchema, sessionEventsListParametersSchema, sessionInboxAckParametersSchema, sessionInboxCheckParametersSchema, sessionListParametersSchema, sessionMessageSendParametersSchema, sessionObserveParametersSchema, sessionResumeParametersSchema, sessionShowParametersSchema, sessionSpawnParametersSchema, sessionStartParametersSchema, sessionStopParametersSchema, sessionWaitParametersSchema, } from "@maiaos/sdk";
|
|
2
2
|
import * as Crypto from "effect/Crypto";
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import { makeRelocateClient } from "../execution/index.js";
|
|
5
|
-
import { commandIdentifier, } from "../local-node/index.js";
|
|
5
|
+
import { commandIdentifier, repeatBoundedWait, } from "../local-node/index.js";
|
|
6
6
|
import { makeAgentPermissionCliClient } from "./agent-permission.js";
|
|
7
7
|
import { makeAttachClient } from "./attach-client.js";
|
|
8
8
|
import { makeCodingSessionClient } from "./coding-client.js";
|
|
@@ -24,6 +24,17 @@ export const makeSessionClient = (node) => {
|
|
|
24
24
|
const showSession = (sessionId) => {
|
|
25
25
|
return node.runValidatedNodeOperation({ sessionId }, sessionShowParametersSchema, (client, parameters, options) => client.showSession(parameters, options));
|
|
26
26
|
};
|
|
27
|
+
const waitSessionOnce = (parameters) => node.runValidatedNodeOperation(parameters, sessionWaitParametersSchema, (client, validated, options) => client.waitSession(validated, options));
|
|
28
|
+
const waitSession = (input) => repeatBoundedWait({
|
|
29
|
+
maxRequestMilliseconds: MAX_SESSION_WAIT_MILLISECONDS,
|
|
30
|
+
once: (waitMilliseconds) => waitSessionOnce({
|
|
31
|
+
sessionId: input.sessionId,
|
|
32
|
+
states: input.states,
|
|
33
|
+
waitMilliseconds,
|
|
34
|
+
}),
|
|
35
|
+
satisfied: (value) => value.satisfied,
|
|
36
|
+
timeoutMilliseconds: input.timeoutMilliseconds,
|
|
37
|
+
});
|
|
27
38
|
const observeSessions = (input) => node.runValidatedNodeOperation(input, sessionObserveParametersSchema, (client, parameters, options) => client.observeSessions(parameters, options));
|
|
28
39
|
const listSessionEvents = (input) => {
|
|
29
40
|
return node.runValidatedNodeOperation(input, sessionEventsListParametersSchema, (client, parameters, options) => client.listSessionEvents(parameters, options));
|
|
@@ -108,6 +119,7 @@ export const makeSessionClient = (node) => {
|
|
|
108
119
|
spawnSession,
|
|
109
120
|
startSession,
|
|
110
121
|
stopSession,
|
|
122
|
+
waitSession,
|
|
111
123
|
...makeRelocateClient(node),
|
|
112
124
|
...makeAgentPermissionCliClient(node),
|
|
113
125
|
...makeCodingSessionClient(node),
|
|
@@ -2,6 +2,7 @@ import { type CommandContext, type CommandEffect } from "../command-line/index.j
|
|
|
2
2
|
export declare const runSessionCreate: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
3
3
|
export declare const runSessionList: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
4
4
|
export declare const runSessionShow: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
5
|
+
export declare const runSessionWait: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
5
6
|
export declare const runSessionStart: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
6
7
|
export declare const runSessionStop: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
7
8
|
export declare const runSessionResume: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|