@maiaos/cli 0.1.0-canary.9 → 0.1.0-canary.91
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/LICENSE +21 -0
- package/README.md +21 -15
- package/dist/address-space/address-space.js +21 -2
- package/dist/address-space/index.js +1 -1
- package/dist/agents/client.d.ts +48 -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.js +6 -0
- package/dist/agents/output/format.js +11 -0
- package/dist/agents/tree/tree.js +16 -4
- package/dist/bin/maia.NOTICES.txt +1 -1
- package/dist/bin/maia.cdx.json +70 -19
- package/dist/bin/maia.mjs +1 -1
- package/dist/board/client.d.ts +27 -0
- package/dist/board/client.js +40 -0
- package/dist/board/commands.d.ts +28 -0
- package/dist/board/commands.js +52 -0
- package/dist/board/index.d.ts +3 -0
- package/dist/board/index.js +3 -0
- package/dist/board/input.js +339 -0
- package/dist/board/output/format.js +175 -0
- package/dist/board/output/index.js +2 -0
- package/dist/board/plan.js +47 -0
- package/dist/board/tree/index.js +2 -0
- package/dist/board/tree/tree.js +161 -0
- package/dist/cli/cli.d.ts +11 -3
- package/dist/cli/cli.js +215 -12
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/log-level.d.ts +11 -0
- package/dist/cli/log-level.js +14 -0
- package/dist/command-line/context.d.ts +25 -7
- package/dist/command-line/emit/index.d.ts +4 -0
- package/dist/command-line/emit/index.js +4 -0
- package/dist/command-line/{output.d.ts → emit/output.d.ts} +7 -3
- package/dist/command-line/{output.js → emit/output.js} +13 -5
- package/dist/command-line/{rows.d.ts → emit/rows.d.ts} +2 -0
- package/dist/command-line/{rows.js → emit/rows.js} +6 -0
- package/dist/command-line/index.d.ts +6 -6
- package/dist/command-line/index.js +5 -6
- package/dist/command-line/input/arguments.d.ts +6 -0
- package/dist/command-line/input/arguments.js +20 -0
- package/dist/command-line/input/index.d.ts +3 -2
- package/dist/command-line/input/index.js +3 -2
- package/dist/command-line/input/manager-options.d.ts +10 -0
- package/dist/command-line/input/manager-options.js +38 -0
- package/dist/command-line/input/prompt.d.ts +1 -0
- package/dist/command-line/input/prompt.js +1 -0
- package/dist/command-line/two-phase/index.d.ts +2 -0
- package/dist/command-line/two-phase/index.js +2 -0
- package/dist/command-line/{two-phase.d.ts → two-phase/two-phase.d.ts} +14 -14
- package/dist/command-line/{two-phase.js → two-phase/two-phase.js} +11 -11
- package/dist/command-receipt/command.js +1 -1
- package/dist/command-tree/commands.d.ts +1 -1
- package/dist/command-tree/commands.js +1 -5
- package/dist/command-tree/deprecated.d.ts +2 -0
- package/dist/command-tree/deprecated.js +29 -0
- package/dist/command-tree/grammar.js +2 -0
- package/dist/command-tree/help.d.ts +2 -2
- package/dist/command-tree/help.js +13 -15
- package/dist/command-tree/index.d.ts +1 -0
- package/dist/command-tree/index.js +1 -0
- package/dist/command-tree/local.js +27 -7
- package/dist/command-tree/placeholder.js +1 -1
- package/dist/command-tree/row.d.ts +1 -0
- package/dist/command-tree/tree.d.ts +2 -1
- package/dist/command-tree/tree.js +35 -4
- package/dist/connection/client.d.ts +72 -18
- package/dist/connection/client.js +1 -0
- package/dist/connection/executors/executors.d.ts +18 -0
- package/dist/connection/executors/executors.js +95 -0
- package/dist/connection/executors/index.d.ts +2 -0
- package/dist/connection/executors/index.js +2 -0
- package/dist/connection/executors/reading.js +22 -0
- package/dist/connection/index.d.ts +1 -0
- package/dist/connection/index.js +1 -0
- package/dist/connection/input.js +4 -4
- package/dist/connection/login.d.ts +1 -1
- package/dist/connection/login.js +4 -3
- package/dist/connection/output/format.js +6 -3
- package/dist/connection/output/index.d.ts +1 -1
- package/dist/connection/output/index.js +1 -1
- package/dist/connection/resolve.d.ts +5 -0
- package/dist/connection/setup-file.js +227 -0
- package/dist/connection/setup-project.js +138 -0
- package/dist/connection/system.js +126 -61
- package/dist/connection/tree/tree.js +179 -10
- package/dist/container/client.d.ts +2 -0
- package/dist/events/commands.js +65 -0
- package/dist/events/index.js +2 -0
- package/dist/events/tree/index.js +2 -0
- package/dist/events/tree/tree.js +17 -0
- package/dist/fleet/fleet.d.ts +7 -8
- package/dist/fleet/fleet.js +18 -6
- package/dist/fleet/index.d.ts +1 -1
- package/dist/fleet/index.js +1 -1
- package/dist/github/client.d.ts +189 -0
- package/dist/github/client.js +16 -0
- package/dist/github/commands.d.ts +17 -0
- package/dist/github/commands.js +81 -0
- package/dist/github/index.d.ts +3 -0
- package/dist/github/index.js +3 -0
- package/dist/github/input.js +114 -0
- package/dist/github/output/format.js +78 -0
- package/dist/github/output/index.js +2 -0
- package/dist/github/tree/index.js +2 -0
- package/dist/github/tree/tree.js +28 -0
- package/dist/goal/client.d.ts +246 -0
- package/dist/goal/client.js +13 -0
- package/dist/goal/commands.d.ts +22 -0
- package/dist/goal/commands.js +110 -0
- package/dist/goal/index.d.ts +4 -0
- package/dist/goal/index.js +4 -0
- package/dist/goal/input.js +118 -0
- package/dist/goal/output/format.js +29 -0
- package/dist/goal/output/index.js +2 -0
- package/dist/goal/pause.d.ts +16 -0
- package/dist/goal/pause.js +91 -0
- package/dist/goal/tree/index.js +2 -0
- package/dist/goal/tree/tree.js +49 -0
- package/dist/hold/client.d.ts +2 -0
- package/dist/hold/tree/tree.js +2 -2
- package/dist/import/batch/batch.js +196 -0
- package/dist/import/batch/index.js +3 -0
- package/dist/import/batch/manifest.js +108 -0
- package/dist/import/client.d.ts +3 -3
- package/dist/import/client.js +1 -1
- package/dist/import/commands.d.ts +2 -0
- package/dist/import/commands.js +104 -18
- package/dist/import/detach.d.ts +12 -0
- package/dist/import/detach.js +70 -0
- package/dist/import/index.d.ts +2 -1
- package/dist/import/index.js +2 -1
- package/dist/import/input.js +68 -11
- package/dist/import/output.js +57 -8
- package/dist/inbox/client.d.ts +310 -0
- package/dist/inbox/client.js +15 -0
- package/dist/inbox/index.d.ts +2 -0
- package/dist/inbox/index.js +2 -0
- package/dist/integration/client.d.ts +607 -1
- package/dist/integration/client.js +41 -1
- package/dist/integration/commands.d.ts +16 -0
- package/dist/integration/commands.js +93 -10
- package/dist/integration/index.d.ts +1 -1
- package/dist/integration/index.js +1 -1
- package/dist/local-node/client.d.ts +13 -1
- package/dist/local-node/client.js +191 -235
- package/dist/local-node/index.d.ts +1 -1
- package/dist/local-node/index.js +1 -1
- package/dist/local-node/launch/index.d.ts +2 -0
- package/dist/local-node/launch/index.js +2 -0
- package/dist/local-node/launch/launch.d.ts +19 -0
- package/dist/local-node/launch/launch.js +60 -0
- package/dist/login/commands.js +7 -1
- package/dist/login/gateway.js +36 -13
- package/dist/login/menu.js +2 -1
- package/dist/login/vendor-account.js +3 -2
- package/dist/login/vendor-input.js +5 -4
- package/dist/mcp/calls.js +47 -222
- package/dist/mcp/routing.d.ts +3 -2
- package/dist/mcp/routing.js +39 -8
- package/dist/mcp/server.d.ts +10 -1
- package/dist/mcp/server.js +16 -6
- package/dist/migrate/classes.js +158 -0
- package/dist/migrate/commands.js +46 -0
- package/dist/migrate/format.js +199 -0
- package/dist/migrate/index.js +2 -0
- package/dist/migrate/item.js +59 -0
- package/dist/migrate/plan.js +79 -0
- package/dist/migrate/tree/index.js +2 -0
- package/dist/migrate/tree/tree.js +23 -0
- package/dist/node-update/client.d.ts +17 -0
- package/dist/node-update/client.js +27 -0
- package/dist/node-update/commands.d.ts +20 -0
- package/dist/node-update/commands.js +150 -0
- package/dist/node-update/index.d.ts +4 -0
- package/dist/node-update/index.js +4 -0
- package/dist/node-update/output.d.ts +12 -0
- package/dist/node-update/output.js +165 -0
- package/dist/node-update/tree/index.js +2 -0
- package/dist/node-update/tree/tree.js +73 -0
- package/dist/pairing/client.d.ts +13 -0
- package/dist/pairing/client.js +36 -0
- package/dist/pairing/commands.d.ts +15 -0
- package/dist/pairing/commands.js +131 -0
- package/dist/pairing/index.d.ts +4 -0
- package/dist/pairing/index.js +4 -0
- package/dist/pairing/output.d.ts +12 -0
- package/dist/pairing/output.js +53 -0
- package/dist/pairing/tree/index.js +2 -0
- package/dist/pairing/tree/tree.js +35 -0
- package/dist/panel/client.d.ts +9 -0
- package/dist/panel/client.js +24 -0
- package/dist/panel/commands.d.ts +19 -0
- package/dist/panel/commands.js +112 -0
- package/dist/panel/index.d.ts +3 -0
- package/dist/panel/index.js +3 -0
- package/dist/panel/tree/index.js +2 -0
- package/dist/panel/tree/tree.js +14 -0
- package/dist/port-lease/client.d.ts +3 -0
- package/dist/principal/client.d.ts +9 -0
- package/dist/principal/client.js +7 -0
- package/dist/principal/commands.d.ts +14 -0
- package/dist/principal/commands.js +84 -0
- package/dist/principal/index.d.ts +4 -0
- package/dist/principal/index.js +4 -0
- package/dist/principal/output.d.ts +8 -0
- package/dist/principal/output.js +43 -0
- package/dist/principal/tree/index.js +2 -0
- package/dist/principal/tree/tree.js +31 -0
- package/dist/project-guard/client.d.ts +13 -0
- package/dist/project-guard/input.js +15 -1
- package/dist/project-guard/output/format.js +5 -0
- package/dist/project-instructions/client.d.ts +56 -0
- package/dist/project-instructions/client.js +7 -0
- package/dist/project-instructions/commands.d.ts +13 -0
- package/dist/project-instructions/commands.js +89 -0
- package/dist/project-instructions/index.d.ts +3 -0
- package/dist/project-instructions/index.js +3 -0
- package/dist/project-instructions/input.js +33 -0
- package/dist/project-instructions/output/format.js +22 -0
- package/dist/project-instructions/output/index.js +2 -0
- package/dist/project-knowledge/change.js +22 -0
- package/dist/project-knowledge/client.d.ts +127 -0
- package/dist/project-knowledge/client.js +17 -0
- package/dist/project-knowledge/commands.d.ts +14 -0
- package/dist/project-knowledge/commands.js +100 -0
- package/dist/project-knowledge/index.d.ts +3 -0
- package/dist/project-knowledge/index.js +3 -0
- package/dist/project-knowledge/input.js +32 -0
- package/dist/project-knowledge/output/format.js +64 -0
- package/dist/project-knowledge/output/index.js +2 -0
- package/dist/project-knowledge/sources.js +108 -0
- package/dist/project-knowledge/upload.js +27 -0
- package/dist/project-workspace/git-reads.d.ts +12 -0
- package/dist/project-workspace/git-reads.js +71 -0
- package/dist/project-workspace/index.d.ts +1 -0
- package/dist/project-workspace/index.js +1 -0
- package/dist/project-workspace/metadata-client.d.ts +2 -0
- package/dist/project-workspace/output/human.js +1 -1
- package/dist/project-workspace/tree/tree.js +95 -5
- package/dist/reach/client.d.ts +9 -0
- package/dist/reach/client.js +7 -0
- package/dist/reach/commands.d.ts +14 -0
- package/dist/reach/commands.js +72 -0
- package/dist/reach/index.d.ts +3 -0
- package/dist/reach/index.js +3 -0
- package/dist/reach/output.js +41 -0
- package/dist/reach/tree/index.js +2 -0
- package/dist/reach/tree/tree.js +28 -0
- package/dist/reference/resolve.js +2 -1
- package/dist/remote-node/client.d.ts +85 -0
- package/dist/remote-node/commands.d.ts +1 -0
- package/dist/remote-node/commands.js +61 -18
- package/dist/remote-node/connector.d.ts +16 -0
- package/dist/remote-node/connector.js +10 -3
- package/dist/remote-node/index.d.ts +1 -1
- package/dist/remote-node/index.js +1 -1
- package/dist/remote-node/lifecycle.js +66 -0
- package/dist/remote-node/reachability.js +31 -18
- package/dist/remote-node/reading.js +31 -0
- package/dist/remote-node/text.js +68 -5
- package/dist/remote-node/tree/tree.js +26 -3
- package/dist/routine/client.d.ts +547 -13
- package/dist/routine/client.js +19 -1
- package/dist/routine/commands.d.ts +5 -0
- package/dist/routine/commands.js +73 -15
- package/dist/routine/index.d.ts +2 -1
- package/dist/routine/index.js +2 -1
- package/dist/routine/input.js +66 -3
- package/dist/routine/output/format.js +80 -19
- package/dist/routine/output/index.js +1 -1
- package/dist/routine/portable/import-files.js +74 -0
- package/dist/routine/portable/import-output.js +21 -0
- package/dist/routine/portable/import.js +274 -0
- package/dist/routine/portable/index.js +3 -0
- package/dist/routine/portable/portable.js +185 -0
- package/dist/routine/tree/tree.js +80 -8
- package/dist/routine/trigger/commands.d.ts +20 -0
- package/dist/routine/trigger/commands.js +74 -0
- package/dist/routine/trigger/format.js +42 -0
- package/dist/routine/trigger/index.d.ts +2 -0
- package/dist/routine/trigger/index.js +2 -0
- package/dist/routine/trigger/input.js +81 -0
- package/dist/run-ledger/client.d.ts +47 -0
- package/dist/secret/client.d.ts +39 -0
- package/dist/secret/client.js +6 -0
- package/dist/secret/commands.d.ts +12 -0
- package/dist/secret/commands.js +91 -0
- package/dist/secret/index.d.ts +3 -0
- package/dist/secret/index.js +3 -0
- package/dist/secret/input.js +22 -0
- package/dist/secret/output/format.js +10 -0
- package/dist/secret/output/index.js +2 -0
- package/dist/secret/tree/index.js +2 -0
- package/dist/secret/tree/tree.js +16 -0
- package/dist/session/agent-permission.d.ts +3 -2
- package/dist/session/approval/client.d.ts +9 -5
- package/dist/session/approval/client.js +2 -2
- package/dist/session/approval/commands.d.ts +8 -0
- package/dist/session/approval/commands.js +267 -21
- package/dist/session/approval/index.d.ts +1 -1
- package/dist/session/approval/index.js +1 -1
- package/dist/session/approval/output/format.js +53 -1
- package/dist/session/approval/output/index.js +1 -1
- package/dist/session/attach-render.js +6 -0
- package/dist/session/attach.d.ts +1 -1
- package/dist/session/attach.js +7 -2
- package/dist/session/client.d.ts +19 -13
- package/dist/session/client.js +39 -19
- package/dist/session/coding-client.d.ts +2 -0
- package/dist/session/coding-client.js +1 -2
- package/dist/session/coding-commands.js +24 -7
- package/dist/session/command/commands.js +109 -0
- package/dist/session/command/index.js +2 -0
- package/dist/session/commands.d.ts +6 -1
- package/dist/session/commands.js +417 -73
- package/dist/session/create-tasks.js +24 -51
- package/dist/session/creation/creation.js +51 -0
- package/dist/session/creation/index.js +2 -0
- package/dist/session/fork/fork.js +135 -0
- package/dist/session/fork/index.js +2 -0
- package/dist/session/git-status.d.ts +11 -0
- package/dist/session/git-status.js +30 -0
- package/dist/session/index.d.ts +4 -3
- package/dist/session/index.js +3 -2
- package/dist/session/interaction/client.d.ts +3 -0
- package/dist/session/move/index.js +2 -0
- package/dist/session/move/move.js +439 -0
- package/dist/session/output/held.js +28 -0
- package/dist/session/output/human.js +73 -10
- package/dist/session/output/tasks.js +68 -7
- package/dist/session/setup/index.js +2 -0
- package/dist/session/setup/setup.js +69 -0
- package/dist/session/spawn/caps.js +128 -0
- package/dist/session/spawn/index.js +5 -0
- package/dist/session/spawn/spawn.js +203 -0
- package/dist/session/spawn/standing.js +62 -0
- package/dist/session/spawn/supervision.js +62 -0
- package/dist/session/switch/index.js +2 -0
- package/dist/session/switch/switch.js +103 -0
- package/dist/session/tree/tree.js +372 -32
- package/dist/session/turn/attachments.js +54 -0
- package/dist/session/turn/client.d.ts +9 -1
- package/dist/session/turn/client.js +20 -1
- package/dist/session/turn/commands.d.ts +8 -1
- package/dist/session/turn/commands.js +253 -36
- package/dist/session/turn/index.d.ts +3 -3
- package/dist/session/turn/index.js +1 -1
- package/dist/session/turn/output.d.ts +34 -2
- package/dist/session/turn/output.js +52 -2
- package/dist/skills-sync/client.d.ts +9 -0
- package/dist/skills-sync/client.js +7 -0
- package/dist/skills-sync/commands.d.ts +15 -0
- package/dist/skills-sync/commands.js +241 -0
- package/dist/skills-sync/index.d.ts +3 -0
- package/dist/skills-sync/index.js +3 -0
- package/dist/skills-sync/output.js +168 -0
- package/dist/skills-sync/set-file.js +23 -0
- package/dist/skills-sync/tree/index.js +2 -0
- package/dist/skills-sync/tree/tree.js +38 -0
- package/dist/status/client.d.ts +21 -3
- package/dist/status/command.js +6 -3
- package/dist/status/doctor.d.ts +5 -1
- package/dist/status/doctor.js +14 -7
- package/dist/status/output/compact.d.ts +3 -0
- package/dist/status/output/compact.js +17 -7
- package/dist/status/output/human.js +25 -0
- package/dist/team-workspace/client.d.ts +1 -0
- package/dist/terminal/control-commands.js +26 -9
- package/dist/terminal/keys.js +62 -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/dist/text-input/index.js +2 -0
- package/dist/text-input/text-input.js +35 -0
- package/dist/webhooks/client.d.ts +157 -0
- package/dist/webhooks/client.js +8 -0
- package/dist/webhooks/commands.d.ts +17 -0
- package/dist/webhooks/commands.js +76 -0
- package/dist/webhooks/index.d.ts +3 -0
- package/dist/webhooks/index.js +3 -0
- package/dist/webhooks/input.js +125 -0
- package/dist/webhooks/output/format.js +75 -0
- package/dist/webhooks/output/index.js +2 -0
- package/dist/webhooks/tree/index.js +2 -0
- package/dist/webhooks/tree/tree.js +49 -0
- 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 +110 -0
- package/package.json +7 -6
- package/dist/address-space/address-space.d.ts +0 -38
- package/dist/address-space/index.d.ts +0 -2
- package/dist/agents/input.d.ts +0 -130
- package/dist/agents/output/format.d.ts +0 -8
- package/dist/agents/output/index.d.ts +0 -2
- package/dist/agents/tree/index.d.ts +0 -2
- package/dist/agents/tree/tree.d.ts +0 -3
- package/dist/bootstrap/exit.d.ts +0 -14
- package/dist/bootstrap/exit.js +0 -42
- package/dist/bootstrap/index.d.ts +0 -3
- package/dist/bootstrap/index.js +0 -3
- package/dist/bootstrap/process.d.ts +0 -5
- package/dist/bootstrap/process.js +0 -23
- package/dist/bootstrap/run.d.ts +0 -25
- package/dist/bootstrap/run.js +0 -95
- package/dist/bootstrap/stdio.d.ts +0 -4
- package/dist/bootstrap/stdio.js +0 -9
- package/dist/cli/environment.d.ts +0 -8
- package/dist/cli/services.d.ts +0 -4
- package/dist/command-line/context.js +0 -2
- package/dist/command-line/input/stdin-stream.d.ts +0 -4
- package/dist/command-line/json-decoder.d.ts +0 -3
- package/dist/command-receipt/command.d.ts +0 -4
- package/dist/command-receipt/compact-list.d.ts +0 -20
- package/dist/command-receipt/index.d.ts +0 -3
- package/dist/command-tree/completion.d.ts +0 -6
- package/dist/command-tree/local.d.ts +0 -3
- package/dist/command-tree/row.js +0 -2
- package/dist/connection/access/format.d.ts +0 -8
- package/dist/connection/access/input.d.ts +0 -53
- package/dist/connection/input.d.ts +0 -50
- package/dist/connection/signin.d.ts +0 -4
- package/dist/connection/tree/index.d.ts +0 -2
- package/dist/connection/tree/tree.d.ts +0 -3
- package/dist/container/output/format.d.ts +0 -11
- package/dist/container/output/index.d.ts +0 -2
- package/dist/context/client.d.ts +0 -7
- package/dist/context/commands.d.ts +0 -3
- package/dist/context/index.d.ts +0 -3
- package/dist/dashboard/cockpit-client.d.ts +0 -6
- package/dist/dashboard/cockpit-client.js +0 -27
- package/dist/dashboard/cockpits.d.ts +0 -29
- package/dist/dashboard/cockpits.js +0 -65
- package/dist/dashboard/dashboard.d.ts +0 -7
- package/dist/dashboard/draw.d.ts +0 -15
- package/dist/dashboard/frame.d.ts +0 -4
- package/dist/dashboard/index.d.ts +0 -2
- package/dist/dashboard/modes.d.ts +0 -5
- package/dist/dashboard/node-connection.d.ts +0 -15
- package/dist/dashboard/node-connection.js +0 -51
- package/dist/dashboard/pi-tui.d.ts +0 -6
- package/dist/dashboard/status-bar.d.ts +0 -4
- package/dist/dashboard/terminal.d.ts +0 -53
- package/dist/dashboard/tree-model.d.ts +0 -28
- package/dist/dashboard/tree.d.ts +0 -10
- package/dist/development/cli.d.ts +0 -3
- package/dist/development/cli.js +0 -44
- package/dist/execution/tree/index.d.ts +0 -2
- package/dist/execution/tree/tree.d.ts +0 -3
- package/dist/hold/output/format.d.ts +0 -11
- package/dist/hold/output/index.d.ts +0 -2
- package/dist/hold/tree/index.d.ts +0 -2
- package/dist/hold/tree/tree.d.ts +0 -3
- package/dist/import/input.d.ts +0 -16
- package/dist/import/output.d.ts +0 -6
- package/dist/integration/output.d.ts +0 -22
- package/dist/login/failure.d.ts +0 -3
- package/dist/login/gateway.d.ts +0 -12
- package/dist/login/menu.d.ts +0 -4
- package/dist/login/output/format.d.ts +0 -16
- package/dist/login/output/index.d.ts +0 -2
- package/dist/login/vendor-account.d.ts +0 -95
- package/dist/login/vendor-input.d.ts +0 -14
- package/dist/mcp/calls.d.ts +0 -8
- package/dist/orchestration/output/compact-aggregate.d.ts +0 -121
- package/dist/orchestration/output/compact-run-list.d.ts +0 -20
- package/dist/orchestration/output/human.d.ts +0 -80
- package/dist/orchestration/output/index.d.ts +0 -4
- package/dist/orchestration/tree/index.d.ts +0 -2
- package/dist/orchestration/tree/tree.d.ts +0 -3
- package/dist/port-lease/input.d.ts +0 -65
- package/dist/port-lease/output/format.d.ts +0 -11
- package/dist/port-lease/output/index.d.ts +0 -2
- package/dist/presentation/output/format.d.ts +0 -11
- package/dist/presentation/output/index.d.ts +0 -3
- package/dist/project-guard/input.d.ts +0 -18
- package/dist/project-guard/output/format.d.ts +0 -11
- package/dist/project-guard/output/index.d.ts +0 -2
- package/dist/project-workspace/output/human.d.ts +0 -139
- package/dist/project-workspace/output/index.d.ts +0 -3
- package/dist/project-workspace/output/metadata.d.ts +0 -11
- package/dist/project-workspace/tree/index.d.ts +0 -2
- package/dist/project-workspace/tree/tree.d.ts +0 -3
- package/dist/provider/client.d.ts +0 -6
- package/dist/provider/commands.d.ts +0 -3
- package/dist/provider/index.d.ts +0 -3
- package/dist/reference/commands.d.ts +0 -3
- package/dist/reference/index.d.ts +0 -3
- package/dist/reference/resolve.d.ts +0 -31
- package/dist/reference/tree/index.d.ts +0 -2
- package/dist/reference/tree/tree.d.ts +0 -3
- package/dist/remote-node/reachability.d.ts +0 -64
- package/dist/remote-node/text.d.ts +0 -10
- package/dist/remote-node/tree/index.d.ts +0 -2
- package/dist/remote-node/tree/tree.d.ts +0 -3
- package/dist/routine/input.d.ts +0 -28
- package/dist/routine/output/format.d.ts +0 -23
- package/dist/routine/output/index.d.ts +0 -2
- package/dist/routine/tree/index.d.ts +0 -2
- package/dist/routine/tree/tree.d.ts +0 -3
- package/dist/run-ledger/input.d.ts +0 -42
- package/dist/run-ledger/output/format.d.ts +0 -11
- package/dist/run-ledger/output/index.d.ts +0 -2
- package/dist/session/approval/output/format.d.ts +0 -23
- package/dist/session/approval/output/index.d.ts +0 -2
- package/dist/session/attach-render.d.ts +0 -16
- package/dist/session/create-tasks.d.ts +0 -20
- package/dist/session/interaction/input.d.ts +0 -15
- package/dist/session/interaction/output/format.d.ts +0 -11
- package/dist/session/interaction/output/index.d.ts +0 -2
- package/dist/session/output/diff.d.ts +0 -3
- package/dist/session/output/failure.d.ts +0 -11
- package/dist/session/output/human.d.ts +0 -113
- package/dist/session/output/index.d.ts +0 -6
- package/dist/session/output/observe.d.ts +0 -4
- package/dist/session/output/tasks.d.ts +0 -34
- package/dist/session/task-file.d.ts +0 -5
- package/dist/session/tree/index.d.ts +0 -2
- package/dist/session/tree/tree.d.ts +0 -3
- package/dist/team-workspace/ceremony.d.ts +0 -19
- package/dist/team-workspace/confirmation.d.ts +0 -4
- package/dist/team-workspace/dependencies.js +0 -2
- package/dist/team-workspace/output.d.ts +0 -15
- package/dist/terminal/arguments.d.ts +0 -13
- package/dist/terminal/output/compact-list.d.ts +0 -148
- package/dist/terminal/output/human.d.ts +0 -42
- package/dist/terminal/output/index.d.ts +0 -3
- package/dist/terminal/tree/index.d.ts +0 -2
- package/dist/terminal/tree/tree.d.ts +0 -3
- /package/dist/command-line/{json-decoder.js → emit/json-decoder.js} +0 -0
- /package/dist/command-line/{json.d.ts → emit/json.d.ts} +0 -0
- /package/dist/command-line/{json.js → emit/json.js} +0 -0
package/dist/login/gateway.js
CHANGED
|
@@ -6,43 +6,66 @@ import { newCliIdentifier } from "../local-node/index.js";
|
|
|
6
6
|
const readSessionLimit = (value) => {
|
|
7
7
|
if (value === undefined)
|
|
8
8
|
return {};
|
|
9
|
-
if (!/^(?:[1-9]|1[0-6])$/u.test(value))
|
|
10
|
-
throw new CliArgumentError("Option '--max-sessions' must be an integer from 1 to
|
|
9
|
+
if (!/^(?:[1-9]|[1-5][0-9]|6[0-4])$/u.test(value))
|
|
10
|
+
throw new CliArgumentError("Option '--max-sessions' must be an integer from 1 to 64.");
|
|
11
11
|
return { maxConcurrentSessions: Number(value) };
|
|
12
12
|
};
|
|
13
|
+
const GATEWAY_VALUE_OPTIONS = new Set([
|
|
14
|
+
"--api-key-env",
|
|
15
|
+
"--base-url",
|
|
16
|
+
"--command-id",
|
|
17
|
+
"--max-sessions",
|
|
18
|
+
"--name",
|
|
19
|
+
]);
|
|
20
|
+
const requireOneKeySource = (stdin, apiKeyEnvironment) => {
|
|
21
|
+
if (!stdin && apiKeyEnvironment === undefined)
|
|
22
|
+
throw missingArgument();
|
|
23
|
+
if (stdin && apiKeyEnvironment !== undefined)
|
|
24
|
+
throw new CliArgumentError("Give the key with '--api-key-stdin' or '--api-key-env', not both.");
|
|
25
|
+
};
|
|
26
|
+
const requireNoVersionPath = (baseUrl) => {
|
|
27
|
+
if (/\/v1\/?$/u.test(baseUrl))
|
|
28
|
+
throw new CliArgumentError("Leave '/v1' out of '--base-url'; Maia adds it for each request.");
|
|
29
|
+
};
|
|
13
30
|
export const readGatewayLogin = (tokens) => {
|
|
14
|
-
const parsed = parseOptions(tokens,
|
|
31
|
+
const parsed = parseOptions(tokens, GATEWAY_VALUE_OPTIONS, new Set(["--api-key-stdin"]));
|
|
15
32
|
requirePositionals(parsed.positionals, 1);
|
|
33
|
+
const apiKeyEnvironment = parsed.options.get("--api-key-env");
|
|
16
34
|
const commandId = parsed.options.get("--command-id");
|
|
17
35
|
const name = parsed.options.get("--name");
|
|
18
36
|
const baseUrl = parsed.options.get("--base-url");
|
|
19
|
-
if (parsed.positionals[0] !== "gateway" ||
|
|
20
|
-
name === undefined ||
|
|
21
|
-
baseUrl === undefined ||
|
|
22
|
-
!parsed.flags.has("--api-key-stdin"))
|
|
37
|
+
if (parsed.positionals[0] !== "gateway" || name === undefined)
|
|
23
38
|
throw missingArgument();
|
|
24
|
-
if (
|
|
25
|
-
throw
|
|
39
|
+
if (baseUrl === undefined)
|
|
40
|
+
throw missingArgument();
|
|
41
|
+
requireOneKeySource(parsed.flags.has("--api-key-stdin"), apiKeyEnvironment);
|
|
42
|
+
requireNoVersionPath(baseUrl);
|
|
26
43
|
return {
|
|
44
|
+
...(apiKeyEnvironment === undefined
|
|
45
|
+
? {}
|
|
46
|
+
: { apiKeyEnv: apiKeyEnvironment }),
|
|
27
47
|
baseUrl,
|
|
28
48
|
...(commandId === undefined ? {} : { commandId }),
|
|
29
49
|
name,
|
|
30
50
|
...readSessionLimit(parsed.options.get("--max-sessions")),
|
|
31
51
|
};
|
|
32
52
|
};
|
|
33
|
-
const INVALID_GATEWAY = "Invalid gateway: '--base-url' must be https, or http to a loopback host, without credentials, query, fragment, trailing slash or '/v1'; '--name' uses lower-case letters, digits and dashes; the key is one line of 8 to 4096 printable characters.";
|
|
53
|
+
const INVALID_GATEWAY = "Invalid gateway: '--base-url' must be https, or http to a loopback host, without credentials, query, fragment, trailing slash or '/v1'; '--name' uses lower-case letters, digits and dashes; the key is one line of 8 to 4096 printable characters, or '--api-key-env' names MAIA_GATEWAY_API_KEY or a MAIA_GATEWAY_API_KEY_<SUFFIX> variable.";
|
|
34
54
|
const readKey = (context) => {
|
|
35
55
|
const stdin = context.io.stdin;
|
|
36
56
|
return stdin === undefined
|
|
37
57
|
? Effect.fail(new CliArgumentError("Standard input is unavailable."))
|
|
38
58
|
: recoverStdin(stdin({ label: "API key", maxBytes: 8 * 1024, maxChunks: 8 }), () => new CliArgumentError("Maia could not read the key from standard input."));
|
|
39
59
|
};
|
|
40
|
-
const
|
|
60
|
+
const keySource = (input, context) => input.apiKeyEnv === undefined
|
|
61
|
+
? readKey(context).pipe(Effect.map((key) => ({ apiKey: key.trim() })))
|
|
62
|
+
: Effect.succeed({});
|
|
63
|
+
const gatewayParameters = (input, key) => (input.commandId === undefined
|
|
41
64
|
? newCliIdentifier("command")
|
|
42
65
|
: Effect.succeed(input.commandId)).pipe(Effect.flatMap((commandId) => {
|
|
43
66
|
const parameters = connectionGatewayCreateParametersSchema.safeParse({
|
|
44
67
|
...input,
|
|
45
|
-
|
|
68
|
+
...key,
|
|
46
69
|
commandId,
|
|
47
70
|
});
|
|
48
71
|
return parameters.success
|
|
@@ -62,7 +85,7 @@ const withRetryHint = (error, commandId) => error instanceof ConnectionNodeError
|
|
|
62
85
|
})
|
|
63
86
|
: error;
|
|
64
87
|
const createGateway = (context, parameters) => callNode(context.dependencies.createGatewayConnection, (create) => create(parameters)).pipe(Effect.mapError((error) => withRetryHint(error, parameters.commandId)));
|
|
65
|
-
export const gatewayLogin = (tokens, context) => readInput(tokens).pipe(Effect.flatMap((input) =>
|
|
88
|
+
export const gatewayLogin = (tokens, context) => readInput(tokens).pipe(Effect.flatMap((input) => keySource(input, context).pipe(Effect.flatMap((key) => gatewayParameters(input, key)))), Effect.flatMap((parameters) => createGateway(context, parameters)), Effect.map((result) => {
|
|
66
89
|
if (result.keyCustody === "kept" && !context.json)
|
|
67
90
|
context.io.stderr("The gateway already had a key; it keeps that key and ignored the one on stdin.\n");
|
|
68
91
|
writeSuccess({ command: result.method, result: redactConnectionResult(result) }, context, formatConnectionResult);
|
package/dist/login/menu.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EXECUTOR_IDS } from "@maiaos/sdk";
|
|
1
2
|
import { Effect } from "effect";
|
|
2
3
|
import { CliArgumentError, } from "../command-line/index.js";
|
|
3
4
|
import { callNode, describeConnection, redactConnection, } from "../connection/index.js";
|
|
@@ -56,7 +57,7 @@ const signInAgain = (context, accounts) => ask(context, "Account name: ").pipe(E
|
|
|
56
57
|
return say(context, `No account is named '${name}'.`);
|
|
57
58
|
if (account.executor === "gateway")
|
|
58
59
|
return say(context, `'${name}' is a gateway; it signs in with its API key, not a vendor login.`);
|
|
59
|
-
const vendor = account.executor ===
|
|
60
|
+
const vendor = account.executor === EXECUTOR_IDS.codex ? "codex" : "claude";
|
|
60
61
|
return signInHere(context, {
|
|
61
62
|
deviceCode: false,
|
|
62
63
|
executor: account.executor,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EXECUTOR_IDS } from "@maiaos/sdk";
|
|
1
2
|
import { Effect } from "effect";
|
|
2
3
|
import { CliArgumentError, writeSuccess, } from "../command-line/index.js";
|
|
3
4
|
import { callNode, ConnectionNodeError, findConnectionByName, formatConnectionResult, redactConnection, redactConnectionResult, runVendorLogin, } from "../connection/index.js";
|
|
@@ -40,7 +41,7 @@ const vendorSignIn = (context, connection, input) => Effect.suspend(() => (conte
|
|
|
40
41
|
message: `The ${connection.executor} sign-in exited with status ${String(status)}.`,
|
|
41
42
|
retryable: true,
|
|
42
43
|
}))));
|
|
43
|
-
const freshUsage = (context, connection) => connection.executor ===
|
|
44
|
+
const freshUsage = (context, connection) => connection.executor === EXECUTOR_IDS.codex
|
|
44
45
|
? callNode(context.dependencies.showConnectionUsage, (show) => show({ connectionId: connection.connectionId, refresh: true })).pipe(Effect.map((result) => result.connection), Effect.orElseSucceed(() => connection))
|
|
45
46
|
: Effect.succeed(connection);
|
|
46
47
|
export const signInHere = (context, input) => Effect.gen(function* () {
|
|
@@ -65,7 +66,7 @@ const startDeviceCodeLogin = (context, connection) => callNode(context.dependenc
|
|
|
65
66
|
flow: "device-code",
|
|
66
67
|
})));
|
|
67
68
|
export const signInThroughNode = (context, input) => Effect.gen(function* () {
|
|
68
|
-
if (input.executor !==
|
|
69
|
+
if (input.executor !== EXECUTOR_IDS.codex)
|
|
69
70
|
return yield* Effect.fail(new CliArgumentError("Claude Code signs in from a terminal: run 'maia login claude' in one."));
|
|
70
71
|
const connection = yield* signableAccount(context, input);
|
|
71
72
|
const started = yield* startDeviceCodeLogin(context, connection);
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { EXECUTOR_IDS } from "@maiaos/sdk";
|
|
1
2
|
import { CliArgumentError, parseOptions, requirePositionals, } from "../command-line/index.js";
|
|
2
3
|
const EXECUTORS = new Map([
|
|
3
|
-
["claude",
|
|
4
|
-
["codex",
|
|
4
|
+
["claude", EXECUTOR_IDS.claudeCode],
|
|
5
|
+
["codex", EXECUTOR_IDS.codex],
|
|
5
6
|
]);
|
|
6
7
|
export const vendorExecutor = (vendor) => EXECUTORS.get(vendor);
|
|
7
8
|
const readSessionLimit = (value) => {
|
|
8
9
|
if (value === undefined)
|
|
9
10
|
return {};
|
|
10
|
-
if (!/^(?:[1-9]|1[0-6])$/u.test(value))
|
|
11
|
-
throw new CliArgumentError("Option '--max-sessions' must be an integer from 1 to
|
|
11
|
+
if (!/^(?:[1-9]|[1-5][0-9]|6[0-4])$/u.test(value))
|
|
12
|
+
throw new CliArgumentError("Option '--max-sessions' must be an integer from 1 to 64.");
|
|
12
13
|
return { maxConcurrentSessions: Number(value) };
|
|
13
14
|
};
|
|
14
15
|
export const readVendorLogin = (tokens) => {
|
package/dist/mcp/calls.js
CHANGED
|
@@ -1,236 +1,61 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { coordinatorToolDefinitions, localNodeRequestPayloadSchema, workerToolDefinitions, } from "@maiaos/sdk";
|
|
2
2
|
import { Effect, Predicate } from "effect";
|
|
3
3
|
import { invalidNodeInput, } from "../local-node/index.js";
|
|
4
4
|
const recoveryOf = (input) => Predicate.hasProperty(input, "commandId") &&
|
|
5
5
|
Predicate.isString(input.commandId)
|
|
6
6
|
? { commandId: input.commandId }
|
|
7
7
|
: undefined;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
? node.runNodeClientOperation((client, options) => client.status(options))
|
|
12
|
-
: invalidNodeInput();
|
|
13
|
-
const callBound = new Set(LOCAL_NODE_CALL_METHODS);
|
|
14
|
-
const isCallPayload = (payload) => callBound.has(payload.method);
|
|
15
|
-
const isCallBound = (operation) => callBound.has(operation);
|
|
16
|
-
const typedCall = (method) => (node, input) => {
|
|
17
|
-
const payload = localNodeRequestPayloadSchema.safeParse({
|
|
18
|
-
method,
|
|
19
|
-
parameters: input,
|
|
20
|
-
});
|
|
21
|
-
if (!payload.success)
|
|
22
|
-
return invalidNodeInput(payload.error);
|
|
23
|
-
const { data } = payload;
|
|
24
|
-
return isCallPayload(data)
|
|
25
|
-
? node.runNodeClientOperation((client, options) => client.call(data.method, data.parameters, options), recoveryOf(input))
|
|
26
|
-
: invalidNodeInput();
|
|
27
|
-
};
|
|
28
|
-
export const COORDINATOR_CALLS = new Map([
|
|
29
|
-
...COORDINATOR_TOOL_OPERATIONS.filter(isCallBound).map((operation) => [operation, typedCall(operation)]),
|
|
30
|
-
[
|
|
31
|
-
"agents.list",
|
|
32
|
-
validated(agentsListParametersSchema, (client, parameters, options) => client.listAgents(parameters, options)),
|
|
33
|
-
],
|
|
34
|
-
[
|
|
35
|
-
"agents.show",
|
|
36
|
-
validated(agentsShowParametersSchema, (client, parameters, options) => client.showAgent(parameters, options)),
|
|
37
|
-
],
|
|
38
|
-
[
|
|
39
|
-
"approval.list",
|
|
40
|
-
validated(approvalListParametersSchema, (client, parameters, options) => client.listApprovals(parameters, options)),
|
|
41
|
-
],
|
|
42
|
-
[
|
|
43
|
-
"approval.show",
|
|
44
|
-
validated(approvalShowParametersSchema, (client, parameters, options) => client.showApproval(parameters, options)),
|
|
45
|
-
],
|
|
46
|
-
[
|
|
47
|
-
"connection.detect",
|
|
48
|
-
validated(connectionDetectParametersSchema, (client, parameters, options) => client.detectConnections(parameters, options)),
|
|
49
|
-
],
|
|
50
|
-
[
|
|
51
|
-
"connection.list",
|
|
52
|
-
validated(connectionListParametersSchema, (client, parameters, options) => client.listConnections(parameters, options)),
|
|
53
|
-
],
|
|
54
|
-
[
|
|
55
|
-
"connection.models.list",
|
|
56
|
-
validated(connectionModelsListParametersSchema, (client, parameters, options) => client.listConnectionModels(parameters, options)),
|
|
57
|
-
],
|
|
58
|
-
[
|
|
59
|
-
"connection.show",
|
|
60
|
-
validated(connectionShowParametersSchema, (client, parameters, options) => client.showConnection(parameters, options)),
|
|
61
|
-
],
|
|
62
|
-
[
|
|
63
|
-
"connection.usage.show",
|
|
64
|
-
validated(connectionUsageShowParametersSchema, (client, parameters, options) => client.showConnectionUsage(parameters, options)),
|
|
65
|
-
],
|
|
66
|
-
[
|
|
67
|
-
"container.index.list",
|
|
68
|
-
validated(containerIndexListParametersSchema, (client, parameters, options) => client.listContainerIndex(parameters, options)),
|
|
69
|
-
],
|
|
70
|
-
[
|
|
71
|
-
"discovery.sessions.list",
|
|
72
|
-
validated(discoverySessionsListParametersSchema, (client, parameters, options) => client.listDiscoveredSessions(parameters, options)),
|
|
73
|
-
],
|
|
74
|
-
["node.status", status],
|
|
75
|
-
[
|
|
76
|
-
"port.lease.acquire",
|
|
77
|
-
validated(portLeaseAcquireParametersSchema, (client, parameters, options) => client.acquirePortLease(parameters, options)),
|
|
78
|
-
],
|
|
79
|
-
[
|
|
80
|
-
"port.lease.list",
|
|
81
|
-
validated(portLeaseListParametersSchema, (client, parameters, options) => client.listPortLeases(parameters, options)),
|
|
82
|
-
],
|
|
83
|
-
[
|
|
84
|
-
"port.lease.release",
|
|
85
|
-
validated(portLeaseReleaseParametersSchema, (client, parameters, options) => client.releasePortLease(parameters, options)),
|
|
86
|
-
],
|
|
87
|
-
[
|
|
88
|
-
"port.lease.renew",
|
|
89
|
-
validated(portLeaseRenewParametersSchema, (client, parameters, options) => client.renewPortLease(parameters, options)),
|
|
90
|
-
],
|
|
91
|
-
[
|
|
92
|
-
"project.guard.show",
|
|
93
|
-
validated(projectGuardShowParametersSchema, (client, parameters, options) => client.showProjectGuard(parameters, options)),
|
|
94
|
-
],
|
|
95
|
-
[
|
|
96
|
-
"project.list",
|
|
97
|
-
validated(projectListParametersSchema, (client, parameters, options) => client.listProjects(parameters, options)),
|
|
98
|
-
],
|
|
99
|
-
[
|
|
100
|
-
"project.show",
|
|
101
|
-
validated(projectShowParametersSchema, (client, parameters, options) => client.showProject(parameters, options)),
|
|
102
|
-
],
|
|
103
|
-
[
|
|
104
|
-
"receipt.get",
|
|
105
|
-
validated(receiptGetParametersSchema, (client, parameters, options) => client.getReceipt(parameters, options)),
|
|
106
|
-
],
|
|
107
|
-
[
|
|
108
|
-
"routine.list",
|
|
109
|
-
validated(routineListParametersSchema, (client, parameters, options) => client.listRoutines(parameters, options)),
|
|
110
|
-
],
|
|
111
|
-
[
|
|
112
|
-
"routine.show",
|
|
113
|
-
validated(routineShowParametersSchema, (client, parameters, options) => client.showRoutine(parameters, options)),
|
|
114
|
-
],
|
|
115
|
-
[
|
|
116
|
-
"run.ledger.create",
|
|
117
|
-
validated(runLedgerCreateParametersSchema, (client, parameters, options) => client.createRunLedger(parameters, options)),
|
|
118
|
-
],
|
|
119
|
-
[
|
|
120
|
-
"run.ledger.list",
|
|
121
|
-
validated(runLedgerListParametersSchema, (client, parameters, options) => client.listRunLedgers(parameters, options)),
|
|
122
|
-
],
|
|
123
|
-
[
|
|
124
|
-
"run.ledger.task.dispatch",
|
|
125
|
-
validated(runLedgerTaskDispatchParametersSchema, (client, parameters, options) => client.dispatchRunLedgerTask(parameters, options)),
|
|
126
|
-
],
|
|
127
|
-
[
|
|
128
|
-
"run.ledger.task.list",
|
|
129
|
-
validated(runLedgerTaskListParametersSchema, (client, parameters, options) => client.listRunLedgerTasks(parameters, options)),
|
|
130
|
-
],
|
|
131
|
-
[
|
|
132
|
-
"run.ledger.task.settle",
|
|
133
|
-
validated(runLedgerTaskSettleParametersSchema, (client, parameters, options) => client.settleRunLedgerTask(parameters, options)),
|
|
134
|
-
],
|
|
135
|
-
[
|
|
136
|
-
"run.ledger.task.show",
|
|
137
|
-
validated(runLedgerTaskShowParametersSchema, (client, parameters, options) => client.showRunLedgerTask(parameters, options)),
|
|
138
|
-
],
|
|
139
|
-
[
|
|
140
|
-
"session.archive",
|
|
141
|
-
validated(sessionArchiveParametersSchema, (client, parameters, options) => client.archiveSession(parameters, options)),
|
|
142
|
-
],
|
|
143
|
-
[
|
|
144
|
-
"session.create",
|
|
145
|
-
validated(sessionCreateParametersSchema, (client, parameters, options) => client.createSession(parameters, options)),
|
|
146
|
-
],
|
|
147
|
-
[
|
|
148
|
-
"session.diff",
|
|
149
|
-
validated(sessionDiffParametersSchema, (client, parameters, options) => client.diffSession(parameters, options)),
|
|
150
|
-
],
|
|
151
|
-
[
|
|
152
|
-
"session.events.list",
|
|
153
|
-
validated(sessionEventsListParametersSchema, (client, parameters, options) => client.listSessionEvents(parameters, options)),
|
|
154
|
-
],
|
|
155
|
-
[
|
|
156
|
-
"session.history.read",
|
|
157
|
-
validated(sessionHistoryReadParametersSchema, (client, parameters, options) => client.readSessionHistory(parameters, options)),
|
|
158
|
-
],
|
|
159
|
-
[
|
|
160
|
-
"session.list",
|
|
161
|
-
validated(sessionListParametersSchema, (client, parameters, options) => client.listSessions(parameters, options)),
|
|
162
|
-
],
|
|
163
|
-
[
|
|
164
|
-
"session.observe",
|
|
165
|
-
validated(sessionObserveParametersSchema, (client, parameters, options) => client.observeSessions(parameters, options)),
|
|
166
|
-
],
|
|
167
|
-
[
|
|
168
|
-
"session.resume",
|
|
169
|
-
validated(sessionResumeParametersSchema, (client, parameters, options) => client.resumeSession(parameters, options)),
|
|
170
|
-
],
|
|
171
|
-
[
|
|
172
|
-
"session.show",
|
|
173
|
-
validated(sessionShowParametersSchema, (client, parameters, options) => client.showSession(parameters, options)),
|
|
174
|
-
],
|
|
175
|
-
[
|
|
176
|
-
"session.start",
|
|
177
|
-
validated(sessionStartParametersSchema, (client, parameters, options) => client.startSession(parameters, options)),
|
|
178
|
-
],
|
|
179
|
-
[
|
|
180
|
-
"session.stop",
|
|
181
|
-
validated(sessionStopParametersSchema, (client, parameters, options) => client.stopSession(parameters, options)),
|
|
182
|
-
],
|
|
183
|
-
[
|
|
184
|
-
"turn.cancel",
|
|
185
|
-
validated(turnCancelParametersSchema, (client, parameters, options) => client.cancelTurn(parameters, options)),
|
|
186
|
-
],
|
|
187
|
-
[
|
|
188
|
-
"turn.interrupt",
|
|
189
|
-
validated(turnInterruptParametersSchema, (client, parameters, options) => client.interruptTurn(parameters, options)),
|
|
190
|
-
],
|
|
191
|
-
[
|
|
192
|
-
"turn.queue.list",
|
|
193
|
-
validated(turnQueueListParametersSchema, (client, parameters, options) => client.listTurnQueue(parameters, options)),
|
|
194
|
-
],
|
|
195
|
-
[
|
|
196
|
-
"turn.send",
|
|
197
|
-
validated(turnSendParametersSchema, (client, parameters, options) => client.sendTurn(parameters, options)),
|
|
198
|
-
],
|
|
199
|
-
[
|
|
200
|
-
"turn.show",
|
|
201
|
-
validated(turnShowParametersSchema, (client, parameters, options) => client.showTurn(parameters, options)),
|
|
202
|
-
],
|
|
203
|
-
[
|
|
204
|
-
"turn.wait",
|
|
205
|
-
validated(turnWaitParametersSchema, (client, parameters, options) => client.waitTurns(parameters, options)),
|
|
206
|
-
],
|
|
207
|
-
[
|
|
208
|
-
"workspace.list",
|
|
209
|
-
validated(workspaceListParametersSchema, (client, parameters, options) => client.listWorkspaces(parameters, options)),
|
|
210
|
-
],
|
|
211
|
-
[
|
|
212
|
-
"workspace.show",
|
|
213
|
-
validated(workspaceShowParametersSchema, (client, parameters, options) => client.showWorkspace(parameters, options)),
|
|
214
|
-
],
|
|
8
|
+
const WITHOUT_PARAMETERS = new Set([
|
|
9
|
+
"showNodeUpdate",
|
|
10
|
+
"status",
|
|
215
11
|
]);
|
|
12
|
+
const sdkArguments = ({ operation, sdkOperation }, parameters, options) => {
|
|
13
|
+
if (sdkOperation === "call")
|
|
14
|
+
return [operation, parameters, options];
|
|
15
|
+
return WITHOUT_PARAMETERS.has(sdkOperation)
|
|
16
|
+
? [options]
|
|
17
|
+
: [parameters, options];
|
|
18
|
+
};
|
|
19
|
+
const isSdkEffect = (value) => Effect.isEffect(value);
|
|
20
|
+
export const bindSdkOperation = (tool) => (client, parameters, options) => {
|
|
21
|
+
const operation = Reflect.get(client, tool.sdkOperation);
|
|
22
|
+
if (typeof operation !== "function")
|
|
23
|
+
return Effect.die(new Error(`The SDK client has no ${tool.sdkOperation} for ${tool.operation}.`));
|
|
24
|
+
const result = Reflect.apply(operation, client, sdkArguments(tool, parameters, options));
|
|
25
|
+
return isSdkEffect(result)
|
|
26
|
+
? result
|
|
27
|
+
: Effect.die(new Error(`The SDK operation ${tool.sdkOperation} for ${tool.operation} returned no Effect.`));
|
|
28
|
+
};
|
|
29
|
+
const handedOver = ({ operation }, checked, input) => operation === "session.resume" &&
|
|
30
|
+
Predicate.isObject(checked) &&
|
|
31
|
+
Predicate.hasProperty(input, "parent") &&
|
|
32
|
+
input.parent !== undefined
|
|
33
|
+
? { ...checked, parent: input.parent }
|
|
34
|
+
: checked;
|
|
35
|
+
const callFor = (tool) => {
|
|
36
|
+
const run = bindSdkOperation(tool);
|
|
37
|
+
return (node, input) => {
|
|
38
|
+
const payload = localNodeRequestPayloadSchema.safeParse({
|
|
39
|
+
method: tool.operation,
|
|
40
|
+
parameters: input === undefined && WITHOUT_PARAMETERS.has(tool.sdkOperation)
|
|
41
|
+
? {}
|
|
42
|
+
: input,
|
|
43
|
+
});
|
|
44
|
+
return payload.success
|
|
45
|
+
? node.runNodeClientOperation((client, options) => run(client, handedOver(tool, payload.data.parameters, input), options), recoveryOf(input))
|
|
46
|
+
: invalidNodeInput(payload.error);
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
const callsOf = (tools) => new Map(tools.map((tool) => [
|
|
50
|
+
tool.operation,
|
|
51
|
+
callFor(tool),
|
|
52
|
+
]));
|
|
53
|
+
export const COORDINATOR_CALLS = callsOf(coordinatorToolDefinitions());
|
|
216
54
|
export const callCoordinator = (node) => (operation, input) => {
|
|
217
55
|
const call = COORDINATOR_CALLS.get(operation);
|
|
218
56
|
return call === undefined
|
|
219
57
|
? Effect.die(new Error(`No SDK call for ${operation}.`))
|
|
220
58
|
: call(node, input);
|
|
221
59
|
};
|
|
222
|
-
export const WORKER_CALLS = (()
|
|
223
|
-
const available = new Map(COORDINATOR_CALLS);
|
|
224
|
-
available.set("context.show", validated(invocationContextShowParametersSchema, (client, parameters, options) => client.showCurrentContext(parameters, options)));
|
|
225
|
-
available.set("approval.respond", validated(approvalRespondParametersSchema, (client, parameters, options) => client.respondToApproval(parameters, options)));
|
|
226
|
-
available.set("session.inbox.ack", validated(sessionInboxAckParametersSchema, (client, parameters, options) => client.acknowledgeSessionDelivery(parameters, options)));
|
|
227
|
-
available.set("session.inbox.check", validated(sessionInboxCheckParametersSchema, (client, parameters, options) => client.checkSessionInbox(parameters, options)));
|
|
228
|
-
available.set("session.message.send", validated(sessionMessageSendParametersSchema, (client, parameters, options) => client.sendSessionMessage(parameters, options)));
|
|
229
|
-
return new Map(workerToolDefinitions("orchestrator").map(({ operation }) => {
|
|
230
|
-
const call = available.get(operation);
|
|
231
|
-
if (call === undefined)
|
|
232
|
-
throw new Error(`No worker SDK call for ${operation}.`);
|
|
233
|
-
return [operation, call];
|
|
234
|
-
}));
|
|
235
|
-
})();
|
|
60
|
+
export const WORKER_CALLS = callsOf(workerToolDefinitions("orchestrator"));
|
|
236
61
|
//# sourceMappingURL=calls.js.map
|
package/dist/mcp/routing.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type { RouteKind } from "@maiaos/client-core/cockpit";
|
|
2
2
|
import { type CoordinatorToolOperation, type ProtocolError } from "@maiaos/sdk";
|
|
3
|
+
import { type SupervisedResume } from "@maiaos/sdk/node/effect";
|
|
3
4
|
import { type Crypto, Effect } from "effect";
|
|
4
5
|
import { type Fleet } from "../fleet/index.js";
|
|
5
6
|
import { type CliNodeEffect, type CliNodeResult } from "../local-node/index.js";
|
|
6
|
-
export type ToolReach = (operation:
|
|
7
|
+
export type ToolReach = <TOperation extends CoordinatorToolOperation>(operation: TOperation, input: TOperation extends "session.resume" ? SupervisedResume : unknown) => CliNodeEffect<unknown>;
|
|
7
8
|
export type ToolAnswer = CliNodeResult<unknown> | {
|
|
8
9
|
readonly error: ProtocolError;
|
|
9
10
|
readonly ok: false;
|
|
10
11
|
readonly result: unknown;
|
|
11
12
|
};
|
|
12
|
-
type ToolKind = Exclude<RouteKind, "terminal">;
|
|
13
|
+
type ToolKind = Exclude<RouteKind, "inbox" | "terminal">;
|
|
13
14
|
type ToolRoute = {
|
|
14
15
|
readonly held?: {
|
|
15
16
|
readonly ids: (input: object) => unknown;
|
package/dist/mcp/routing.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { localNodeRequestPayloadSchema, } from "@maiaos/sdk";
|
|
1
|
+
import { localNodeRequestPayloadSchema, sessionShowResultSchema, } from "@maiaos/sdk";
|
|
2
|
+
import { resumeSupervised, } from "@maiaos/sdk/node/effect";
|
|
2
3
|
import { Effect, Predicate, Result } from "effect";
|
|
3
4
|
import { askEach, failureOf, fleetNodes, holderIn, mergeLists, refused, routes, } from "../fleet/index.js";
|
|
4
5
|
import { invalidNodeInput, } from "../local-node/index.js";
|
|
@@ -25,6 +26,7 @@ export const TOOL_ROUTES = new Map([
|
|
|
25
26
|
["agents.list", LOCAL],
|
|
26
27
|
["agents.show", LOCAL],
|
|
27
28
|
["approval.list", held("session", "sessionId", true)],
|
|
29
|
+
["approval.respond", held("approval", "approvalId")],
|
|
28
30
|
["approval.show", held("approval", "approvalId")],
|
|
29
31
|
["connection.detect", LOCAL],
|
|
30
32
|
["connection.list", LOCAL],
|
|
@@ -34,6 +36,9 @@ export const TOOL_ROUTES = new Map([
|
|
|
34
36
|
["container.index.list", LOCAL],
|
|
35
37
|
["discovery.sessions.list", LOCAL],
|
|
36
38
|
["node.status", LOCAL],
|
|
39
|
+
["node.update.pause", LOCAL],
|
|
40
|
+
["node.update.resume", LOCAL],
|
|
41
|
+
["node.update.show", LOCAL],
|
|
37
42
|
["port.lease.acquire", LOCAL],
|
|
38
43
|
["port.lease.list", LOCAL],
|
|
39
44
|
["port.lease.release", LOCAL],
|
|
@@ -44,6 +49,7 @@ export const TOOL_ROUTES = new Map([
|
|
|
44
49
|
["receipt.get", held("command", "commandId")],
|
|
45
50
|
["reference.resolve", held("project", "projectId")],
|
|
46
51
|
["routine.list", held("project", "projectId", true)],
|
|
52
|
+
["routine.runs", held("routine", "routineId")],
|
|
47
53
|
["routine.show", held("routine", "routineId")],
|
|
48
54
|
["run.ledger.create", LOCAL],
|
|
49
55
|
["run.ledger.list", LOCAL],
|
|
@@ -52,9 +58,12 @@ export const TOOL_ROUTES = new Map([
|
|
|
52
58
|
["run.ledger.task.settle", LOCAL],
|
|
53
59
|
["run.ledger.task.show", LOCAL],
|
|
54
60
|
["session.archive", held("session", "sessionId")],
|
|
61
|
+
["session.command.list", held("session", "sessionId")],
|
|
62
|
+
["session.command.send", held("session", "sessionId")],
|
|
55
63
|
["session.create", held("workspace", "workspaceId")],
|
|
56
64
|
["session.diff", held("session", "sessionId")],
|
|
57
65
|
["session.events.list", held("session", "sessionId")],
|
|
66
|
+
["session.git.status", held("session", "sessionId")],
|
|
58
67
|
["session.history.read", HISTORY],
|
|
59
68
|
["session.list", held("project", "projectId", true)],
|
|
60
69
|
["session.observe", held("session", "sessionIds", true)],
|
|
@@ -66,9 +75,12 @@ export const TOOL_ROUTES = new Map([
|
|
|
66
75
|
["turn.cancel", held("turn", "turnId")],
|
|
67
76
|
["turn.interrupt", held("turn", "turnId")],
|
|
68
77
|
["turn.queue.list", held("session", "sessionId")],
|
|
78
|
+
["turn.queue.promote", held("turn", "turnId")],
|
|
69
79
|
["turn.send", held("session", "sessionId")],
|
|
70
80
|
["turn.show", held("turn", "turnId")],
|
|
71
81
|
["turn.wait", held("turn", "turnIds")],
|
|
82
|
+
["workspace.branches.list", held("workspace", "workspaceId")],
|
|
83
|
+
["workspace.code-host.show", held("workspace", "workspaceId")],
|
|
72
84
|
["workspace.list", held("project", "projectId")],
|
|
73
85
|
["workspace.show", held("workspace", "workspaceId")],
|
|
74
86
|
]);
|
|
@@ -154,14 +166,29 @@ const mergedAnswer = (operation) => (answers) => {
|
|
|
154
166
|
const mergedList = (nodes, operation, input) => continues(input)
|
|
155
167
|
? Effect.succeed(refused("invalid_argument", `A cursor pages one Node: ${CHOOSE_NODE} to page it.`))
|
|
156
168
|
: Effect.map(askEach(nodes, (reach) => reach(operation, input)), mergedAnswer(operation));
|
|
157
|
-
const
|
|
169
|
+
const shownOn = (reach, sessionId) => Effect.map(reach("session.show", { sessionId }), (answer) => {
|
|
170
|
+
if (!answer.ok)
|
|
171
|
+
return answer;
|
|
172
|
+
const shown = sessionShowResultSchema.safeParse(answer.value);
|
|
173
|
+
return shown.success
|
|
174
|
+
? { ok: true, value: shown.data }
|
|
175
|
+
: refused("internal_error", "A Node answered an unknown Session show.");
|
|
176
|
+
});
|
|
177
|
+
const resumeOn = (nodes, parameters) => ({ reach }) => resumeSupervised({
|
|
178
|
+
claim: () => Effect.succeed({ ok: true, value: parameters.parent }),
|
|
179
|
+
parentShows: (sessionId) => Effect.map(askEach(nodes, (asked) => shownOn(asked, sessionId)), (answers) => ({
|
|
180
|
+
ok: true,
|
|
181
|
+
value: answers.map(({ result }) => result),
|
|
182
|
+
})),
|
|
183
|
+
resumeSession: (resumed) => reach("session.resume", resumed),
|
|
184
|
+
showSession: (sessionId) => shownOn(reach, sessionId),
|
|
185
|
+
}, parameters);
|
|
186
|
+
const routeAmong = (local, nodes, { held, merged }) => (operation, input, send) => {
|
|
158
187
|
const ids = held === undefined ? [] : heldIds(held, input);
|
|
159
188
|
if (held !== undefined && ids.length > 0)
|
|
160
|
-
return Effect.flatMap(holderOfAll(nodes, held.kind, ids), (holder) => holder.ok
|
|
161
|
-
? holder.value.reach(operation, input)
|
|
162
|
-
: Effect.succeed(holder));
|
|
189
|
+
return Effect.flatMap(holderOfAll(nodes, held.kind, ids), (holder) => holder.ok ? send(holder.value) : Effect.succeed(holder));
|
|
163
190
|
return merged === undefined
|
|
164
|
-
? local
|
|
191
|
+
? send(local)
|
|
165
192
|
: mergedList(nodes, operation, input);
|
|
166
193
|
};
|
|
167
194
|
const ROUTED = new Set(TOOL_ROUTES.keys());
|
|
@@ -177,12 +204,16 @@ export const routeToolCall = (fleet, operation, input) => {
|
|
|
177
204
|
});
|
|
178
205
|
if (!checked.success)
|
|
179
206
|
return invalidNodeInput(checked.error);
|
|
207
|
+
const { data } = checked;
|
|
180
208
|
return Effect.flatMap(fleetNodes(fleet), (space) => {
|
|
181
209
|
if (!space.ok)
|
|
182
210
|
return Effect.succeed(space);
|
|
211
|
+
const send = data.method === "session.resume"
|
|
212
|
+
? resumeOn(space.value, data.parameters)
|
|
213
|
+
: ({ reach }) => reach(operation, input);
|
|
183
214
|
return space.value.length === 1
|
|
184
|
-
? local
|
|
185
|
-
: routeAmong(local, space.value, route)(operation, input);
|
|
215
|
+
? send(local)
|
|
216
|
+
: routeAmong(local, space.value, route)(operation, input, send);
|
|
186
217
|
});
|
|
187
218
|
};
|
|
188
219
|
//# sourceMappingURL=routing.js.map
|
package/dist/mcp/server.d.ts
CHANGED
|
@@ -8,13 +8,22 @@ export type ToolFleet = Omit<Fleet<ToolReach>, "local"> & {
|
|
|
8
8
|
readonly node: string;
|
|
9
9
|
};
|
|
10
10
|
export declare const toolResult: (result: ToolAnswer) => McpSchema.CallToolResult;
|
|
11
|
+
declare const SessionRoleUnreadable_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Cause.YieldableError & {
|
|
12
|
+
readonly _tag: "SessionRoleUnreadable";
|
|
13
|
+
} & Readonly<A>;
|
|
14
|
+
export declare class SessionRoleUnreadable extends SessionRoleUnreadable_base<{
|
|
15
|
+
readonly message: string;
|
|
16
|
+
}> {
|
|
17
|
+
}
|
|
18
|
+
type McpStartError = Cause.IllegalArgumentError | SessionRoleUnreadable;
|
|
11
19
|
export declare const coordinatorMcpLayer: (node: CliNodeOperations, version: string, { fleet, worker, }?: {
|
|
12
20
|
readonly fleet?: ToolFleet;
|
|
13
21
|
readonly worker?: boolean;
|
|
14
|
-
}) => Layer.Layer<never,
|
|
22
|
+
}) => Layer.Layer<never, McpStartError, Crypto.Crypto | Stdio>;
|
|
15
23
|
export declare const serveCoordinatorMcp: (node: CliNodeOperations, version: string, options?: {
|
|
16
24
|
readonly fleet?: ToolFleet;
|
|
17
25
|
readonly stdio?: Layer.Layer<Stdio>;
|
|
18
26
|
readonly worker?: boolean;
|
|
19
27
|
}) => Effect.Effect<number, never, Crypto.Crypto>;
|
|
28
|
+
export {};
|
|
20
29
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/mcp/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as NodeStdio from "@effect/platform-node-shared/NodeStdio";
|
|
2
2
|
import { coordinatorToolDefinitions, workerToolDefinitions, } from "@maiaos/sdk";
|
|
3
|
-
import { Cause, Context, Crypto, Effect, Exit, Fiber, Layer, Logger, Predicate, } from "effect";
|
|
3
|
+
import { Cause, Context, Crypto, Data, Effect, Exit, Fiber, Layer, Logger, Predicate, } from "effect";
|
|
4
4
|
import * as McpProtocol from "effect/ai/McpProtocol";
|
|
5
5
|
import * as McpSchema from "effect/ai/McpSchema";
|
|
6
6
|
import * as McpServer from "effect/ai/McpServer";
|
|
@@ -43,15 +43,25 @@ const callFor = (definition) => {
|
|
|
43
43
|
? Effect.die(new Error(`No SDK call for ${definition.operation}.`))
|
|
44
44
|
: Effect.succeed(call);
|
|
45
45
|
};
|
|
46
|
+
export class SessionRoleUnreadable extends Data.TaggedError("SessionRoleUnreadable") {
|
|
47
|
+
}
|
|
48
|
+
const CREDENTIAL_FAILURES = new Set([
|
|
49
|
+
"authentication_failed",
|
|
50
|
+
"configuration_invalid",
|
|
51
|
+
]);
|
|
46
52
|
const sessionRole = (node) => {
|
|
47
53
|
const show = WORKER_CALLS.get("context.show");
|
|
48
54
|
return show === undefined
|
|
49
55
|
? Effect.succeed("worker")
|
|
50
|
-
: show(node, {}).pipe(Effect.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
: show(node, {}).pipe(Effect.flatMap((result) => result.ok || CREDENTIAL_FAILURES.has(result.error.code)
|
|
57
|
+
? Effect.succeed(result.ok &&
|
|
58
|
+
Predicate.hasProperty(result.value, "role") &&
|
|
59
|
+
result.value.role === "orchestrator"
|
|
60
|
+
? "orchestrator"
|
|
61
|
+
: "worker")
|
|
62
|
+
: Effect.fail(new SessionRoleUnreadable({
|
|
63
|
+
message: `This Session's context.show failed (${result.error.code}: ${result.error.message}), so its tools are unknown.`,
|
|
64
|
+
}))), Effect.tapError((error) => Effect.logError(error.message)));
|
|
55
65
|
};
|
|
56
66
|
const answerFor = (node, call, fleet) => (definition) => (payload) => {
|
|
57
67
|
const { operation } = definition;
|