@cotal-ai/cli 0.100.2 → 0.101.1
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/dist/chat/chat-view.d.ts.map +1 -1
- package/dist/chat/chat-view.js +5 -1
- package/dist/chat/chat-view.js.map +1 -1
- package/dist/chat/engine.d.ts +2 -1
- package/dist/chat/engine.d.ts.map +1 -1
- package/dist/chat/engine.js +2 -1
- package/dist/chat/engine.js.map +1 -1
- package/dist/chat/frontend.d.ts.map +1 -1
- package/dist/chat/frontend.js +13 -7
- package/dist/chat/frontend.js.map +1 -1
- package/dist/chat/native-session.d.ts +22 -3
- package/dist/chat/native-session.d.ts.map +1 -1
- package/dist/chat/native-session.js +91 -19
- package/dist/chat/native-session.js.map +1 -1
- package/dist/chat/open-session.d.ts +1 -0
- package/dist/chat/open-session.d.ts.map +1 -1
- package/dist/chat/open-session.js +1 -1
- package/dist/chat/open-session.js.map +1 -1
- package/dist/chat/picker.d.ts +5 -0
- package/dist/chat/picker.d.ts.map +1 -1
- package/dist/chat/picker.js +23 -10
- package/dist/chat/picker.js.map +1 -1
- package/dist/chat/plain.d.ts.map +1 -1
- package/dist/chat/plain.js +36 -10
- package/dist/chat/plain.js.map +1 -1
- package/dist/chat/session.d.ts +5 -0
- package/dist/chat/session.d.ts.map +1 -1
- package/dist/chat/static-session.d.ts +1 -0
- package/dist/chat/static-session.d.ts.map +1 -1
- package/dist/chat/static-session.js +24 -8
- package/dist/chat/static-session.js.map +1 -1
- package/dist/chat/stdio-io.d.ts +2 -0
- package/dist/chat/stdio-io.d.ts.map +1 -1
- package/dist/chat/stdio-io.js +6 -6
- package/dist/chat/stdio-io.js.map +1 -1
- package/dist/chat/stdio.d.ts +3 -2
- package/dist/chat/stdio.d.ts.map +1 -1
- package/dist/chat/stdio.js +26 -25
- package/dist/chat/stdio.js.map +1 -1
- package/dist/chat/user-session.d.ts +1 -0
- package/dist/chat/user-session.d.ts.map +1 -1
- package/dist/chat/user-session.js +1 -1
- package/dist/chat/user-session.js.map +1 -1
- package/dist/chat/view.d.ts +5 -4
- package/dist/chat/view.d.ts.map +1 -1
- package/dist/chat/view.js +10 -8
- package/dist/chat/view.js.map +1 -1
- package/dist/command.d.ts +5 -0
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +295 -82
- package/dist/command.js.map +1 -1
- package/dist/commands/agents.d.ts +29 -5
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +100 -35
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/backup-maintenance.d.ts.map +1 -1
- package/dist/commands/backup-maintenance.js +54 -21
- package/dist/commands/backup-maintenance.js.map +1 -1
- package/dist/commands/backup-read.d.ts.map +1 -1
- package/dist/commands/backup-read.js +12 -15
- package/dist/commands/backup-read.js.map +1 -1
- package/dist/commands/backup-restore.d.ts.map +1 -1
- package/dist/commands/backup-restore.js +20 -4
- package/dist/commands/backup-restore.js.map +1 -1
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +156 -28
- package/dist/commands/backup.js.map +1 -1
- package/dist/commands/channel-members.d.ts +1 -1
- package/dist/commands/channel-members.d.ts.map +1 -1
- package/dist/commands/channel-members.js +115 -29
- package/dist/commands/channel-members.js.map +1 -1
- package/dist/commands/channels.d.ts +11 -1
- package/dist/commands/channels.d.ts.map +1 -1
- package/dist/commands/channels.js +109 -20
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/chat.d.ts +11 -3
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +50 -22
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/clean.d.ts +10 -5
- package/dist/commands/clean.d.ts.map +1 -1
- package/dist/commands/clean.js +245 -42
- package/dist/commands/clean.js.map +1 -1
- package/dist/commands/completion.d.ts +15 -2
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +91 -26
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/config.d.ts +24 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +65 -13
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/console.d.ts.map +1 -1
- package/dist/commands/console.js +5 -4
- package/dist/commands/console.js.map +1 -1
- package/dist/commands/describe.d.ts +4 -2
- package/dist/commands/describe.d.ts.map +1 -1
- package/dist/commands/describe.js +4 -4
- package/dist/commands/describe.js.map +1 -1
- package/dist/commands/doctor.d.ts +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +261 -34
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/down-manifest.d.ts.map +1 -1
- package/dist/commands/down-manifest.js +9 -6
- package/dist/commands/down-manifest.js.map +1 -1
- package/dist/commands/down-services.d.ts +17 -16
- package/dist/commands/down-services.d.ts.map +1 -1
- package/dist/commands/down-services.js +29 -53
- package/dist/commands/down-services.js.map +1 -1
- package/dist/commands/down.d.ts +2 -2
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +96 -67
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/endpoint-deregister.d.ts.map +1 -1
- package/dist/commands/endpoint-deregister.js +2 -2
- package/dist/commands/endpoint-deregister.js.map +1 -1
- package/dist/commands/endpoint.d.ts +2 -1
- package/dist/commands/endpoint.d.ts.map +1 -1
- package/dist/commands/endpoint.js +2 -2
- package/dist/commands/endpoint.js.map +1 -1
- package/dist/commands/endpoints.d.ts +1 -0
- package/dist/commands/endpoints.d.ts.map +1 -1
- package/dist/commands/endpoints.js +20 -5
- package/dist/commands/endpoints.js.map +1 -1
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +40 -2
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/help.d.ts.map +1 -1
- package/dist/commands/help.js +2 -1
- package/dist/commands/help.js.map +1 -1
- package/dist/commands/history-clear.d.ts.map +1 -1
- package/dist/commands/history-clear.js +67 -51
- package/dist/commands/history-clear.js.map +1 -1
- package/dist/commands/history.d.ts +17 -2
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +221 -34
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/join.d.ts +2 -0
- package/dist/commands/join.d.ts.map +1 -1
- package/dist/commands/join.js +132 -80
- package/dist/commands/join.js.map +1 -1
- package/dist/commands/meshes-add.d.ts +19 -4
- package/dist/commands/meshes-add.d.ts.map +1 -1
- package/dist/commands/meshes-add.js +114 -15
- package/dist/commands/meshes-add.js.map +1 -1
- package/dist/commands/meshes-wizard.d.ts +1 -0
- package/dist/commands/meshes-wizard.d.ts.map +1 -1
- package/dist/commands/meshes-wizard.js +45 -13
- package/dist/commands/meshes-wizard.js.map +1 -1
- package/dist/commands/meshes.d.ts +1 -1
- package/dist/commands/meshes.d.ts.map +1 -1
- package/dist/commands/meshes.js +76 -47
- package/dist/commands/meshes.js.map +1 -1
- package/dist/commands/mint.d.ts.map +1 -1
- package/dist/commands/mint.js +212 -19
- package/dist/commands/mint.js.map +1 -1
- package/dist/commands/models.d.ts +5 -1
- package/dist/commands/models.d.ts.map +1 -1
- package/dist/commands/models.js +21 -13
- package/dist/commands/models.js.map +1 -1
- package/dist/commands/persona-remote.d.ts.map +1 -1
- package/dist/commands/persona-remote.js +24 -13
- package/dist/commands/persona-remote.js.map +1 -1
- package/dist/commands/persona.d.ts +1 -1
- package/dist/commands/persona.d.ts.map +1 -1
- package/dist/commands/persona.js +92 -23
- package/dist/commands/persona.js.map +1 -1
- package/dist/commands/personas.d.ts.map +1 -1
- package/dist/commands/personas.js +59 -40
- package/dist/commands/personas.js.map +1 -1
- package/dist/commands/reset-space-apply.d.ts.map +1 -1
- package/dist/commands/reset-space-apply.js +69 -17
- package/dist/commands/reset-space-apply.js.map +1 -1
- package/dist/commands/reset-store-apply.d.ts +16 -0
- package/dist/commands/reset-store-apply.d.ts.map +1 -1
- package/dist/commands/reset-store-apply.js +122 -23
- package/dist/commands/reset-store-apply.js.map +1 -1
- package/dist/commands/reset.d.ts.map +1 -1
- package/dist/commands/reset.js +8 -7
- package/dist/commands/reset.js.map +1 -1
- package/dist/commands/revoke-credential.d.ts +5 -0
- package/dist/commands/revoke-credential.d.ts.map +1 -0
- package/dist/commands/revoke-credential.js +128 -0
- package/dist/commands/revoke-credential.js.map +1 -0
- package/dist/commands/send.d.ts +11 -3
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +284 -47
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/service-actions.d.ts +2 -1
- package/dist/commands/service-actions.d.ts.map +1 -1
- package/dist/commands/service-actions.js +117 -21
- package/dist/commands/service-actions.js.map +1 -1
- package/dist/commands/service-log-follow.js +1 -1
- package/dist/commands/service-log-follow.js.map +1 -1
- package/dist/commands/service-registry.d.ts +1 -1
- package/dist/commands/service-registry.d.ts.map +1 -1
- package/dist/commands/service-registry.js +74 -30
- package/dist/commands/service-registry.js.map +1 -1
- package/dist/commands/service-set-stop.d.ts.map +1 -1
- package/dist/commands/service-set-stop.js +3 -2
- package/dist/commands/service-set-stop.js.map +1 -1
- package/dist/commands/setup-start.d.ts.map +1 -1
- package/dist/commands/setup-start.js +46 -5
- package/dist/commands/setup-start.js.map +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +28 -13
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/space-delete.d.ts.map +1 -1
- package/dist/commands/space-delete.js +130 -41
- package/dist/commands/space-delete.js.map +1 -1
- package/dist/commands/space-registration.d.ts +13 -6
- package/dist/commands/space-registration.d.ts.map +1 -1
- package/dist/commands/space-registration.js +167 -46
- package/dist/commands/space-registration.js.map +1 -1
- package/dist/commands/space.d.ts +15 -1
- package/dist/commands/space.d.ts.map +1 -1
- package/dist/commands/space.js +66 -24
- package/dist/commands/space.js.map +1 -1
- package/dist/commands/spawn-preview.d.ts.map +1 -1
- package/dist/commands/spawn-preview.js +48 -10
- package/dist/commands/spawn-preview.js.map +1 -1
- package/dist/commands/spawn.d.ts +36 -13
- package/dist/commands/spawn.d.ts.map +1 -1
- package/dist/commands/spawn.js +306 -130
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/stack-down.d.ts +9 -3
- package/dist/commands/stack-down.d.ts.map +1 -1
- package/dist/commands/stack-down.js +348 -64
- package/dist/commands/stack-down.js.map +1 -1
- package/dist/commands/stack-gone.d.ts +17 -0
- package/dist/commands/stack-gone.d.ts.map +1 -0
- package/dist/commands/stack-gone.js +218 -0
- package/dist/commands/stack-gone.js.map +1 -0
- package/dist/commands/stack-up.d.ts +64 -4
- package/dist/commands/stack-up.d.ts.map +1 -1
- package/dist/commands/stack-up.js +482 -55
- package/dist/commands/stack-up.js.map +1 -1
- package/dist/commands/status.d.ts +76 -2
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +550 -112
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/team-agent-apply.d.ts.map +1 -1
- package/dist/commands/team-agent-apply.js +4 -3
- package/dist/commands/team-agent-apply.js.map +1 -1
- package/dist/commands/team-agent-remove.d.ts.map +1 -1
- package/dist/commands/team-agent-remove.js +4 -4
- package/dist/commands/team-agent-remove.js.map +1 -1
- package/dist/commands/team-boot-controller.d.ts.map +1 -1
- package/dist/commands/team-boot-controller.js +8 -2
- package/dist/commands/team-boot-controller.js.map +1 -1
- package/dist/commands/team-channel-remove.d.ts.map +1 -1
- package/dist/commands/team-channel-remove.js +26 -10
- package/dist/commands/team-channel-remove.js.map +1 -1
- package/dist/commands/team-deploy-apply.d.ts.map +1 -1
- package/dist/commands/team-deploy-apply.js +4 -3
- package/dist/commands/team-deploy-apply.js.map +1 -1
- package/dist/commands/team-mixed-remove.js +5 -5
- package/dist/commands/team-mixed-remove.js.map +1 -1
- package/dist/commands/team.d.ts.map +1 -1
- package/dist/commands/team.js +94 -32
- package/dist/commands/team.js.map +1 -1
- package/dist/commands/telemetry.d.ts.map +1 -1
- package/dist/commands/telemetry.js +3 -1
- package/dist/commands/telemetry.js.map +1 -1
- package/dist/commands/topology.d.ts.map +1 -1
- package/dist/commands/topology.js +11 -7
- package/dist/commands/topology.js.map +1 -1
- package/dist/commands/up.d.ts +6 -6
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +963 -240
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +9 -3
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/use.d.ts +5 -1
- package/dist/commands/use.d.ts.map +1 -1
- package/dist/commands/use.js +55 -12
- package/dist/commands/use.js.map +1 -1
- package/dist/commands/watch.d.ts +4 -1
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +15 -3
- package/dist/commands/watch.js.map +1 -1
- package/dist/commands/who.d.ts +2 -0
- package/dist/commands/who.d.ts.map +1 -1
- package/dist/commands/who.js +18 -5
- package/dist/commands/who.js.map +1 -1
- package/dist/commands/whoami.d.ts +44 -5
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +168 -16
- package/dist/commands/whoami.js.map +1 -1
- package/dist/console/app.d.ts +1 -1
- package/dist/console/app.d.ts.map +1 -1
- package/dist/console/app.js +15 -9
- package/dist/console/app.js.map +1 -1
- package/dist/console/launch.d.ts +25 -0
- package/dist/console/launch.d.ts.map +1 -0
- package/dist/console/launch.js +56 -0
- package/dist/console/launch.js.map +1 -0
- package/dist/console/ui/CommandPalette.d.ts +5 -4
- package/dist/console/ui/CommandPalette.d.ts.map +1 -1
- package/dist/console/ui/CommandPalette.js +136 -45
- package/dist/console/ui/CommandPalette.js.map +1 -1
- package/dist/console/ui/Help.js +1 -1
- package/dist/console/ui/Help.js.map +1 -1
- package/dist/console/ui/Modal.d.ts +10 -0
- package/dist/console/ui/Modal.d.ts.map +1 -0
- package/dist/console/ui/Modal.js +8 -0
- package/dist/console/ui/Modal.js.map +1 -0
- package/dist/console/ui/NewAgent.d.ts +14 -0
- package/dist/console/ui/NewAgent.d.ts.map +1 -0
- package/dist/console/ui/NewAgent.js +114 -0
- package/dist/console/ui/NewAgent.js.map +1 -0
- package/dist/console/ui/StatusBar.d.ts +1 -2
- package/dist/console/ui/StatusBar.d.ts.map +1 -1
- package/dist/console/ui/StatusBar.js +6 -8
- package/dist/console/ui/StatusBar.js.map +1 -1
- package/dist/console/ui/topo/Map.d.ts.map +1 -1
- package/dist/console/ui/topo/Map.js +1 -2
- package/dist/console/ui/topo/Map.js.map +1 -1
- package/dist/console/ui/topo/Matrix.js +2 -2
- package/dist/console/ui/topo/Matrix.js.map +1 -1
- package/dist/console/ui/topo/Sequence.d.ts.map +1 -1
- package/dist/console/ui/topo/Sequence.js +5 -4
- package/dist/console/ui/topo/Sequence.js.map +1 -1
- package/dist/console/ui/topo/model.d.ts +2 -1
- package/dist/console/ui/topo/model.d.ts.map +1 -1
- package/dist/console/ui/topo/model.js +4 -3
- package/dist/console/ui/topo/model.js.map +1 -1
- package/dist/exec-endpoint/service-adapter.d.ts.map +1 -1
- package/dist/exec-endpoint/service-adapter.js +13 -3
- package/dist/exec-endpoint/service-adapter.js.map +1 -1
- package/dist/ext-loader.d.ts +4 -0
- package/dist/ext-loader.d.ts.map +1 -1
- package/dist/ext-loader.js +6 -0
- package/dist/ext-loader.js.map +1 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +44 -23
- package/dist/help.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +59 -54
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-skills.d.ts.map +1 -1
- package/dist/lib/agent-skills.js +2 -1
- package/dist/lib/agent-skills.js.map +1 -1
- package/dist/lib/attach-client.js +2 -2
- package/dist/lib/attach-client.js.map +1 -1
- package/dist/lib/backup-artifact.d.ts +29 -8
- package/dist/lib/backup-artifact.d.ts.map +1 -1
- package/dist/lib/backup-artifact.js +147 -26
- package/dist/lib/backup-artifact.js.map +1 -1
- package/dist/lib/broker-service.d.ts +27 -3
- package/dist/lib/broker-service.d.ts.map +1 -1
- package/dist/lib/broker-service.js +142 -29
- package/dist/lib/broker-service.js.map +1 -1
- package/dist/lib/broker-store-health.d.ts +89 -0
- package/dist/lib/broker-store-health.d.ts.map +1 -0
- package/dist/lib/broker-store-health.js +171 -0
- package/dist/lib/broker-store-health.js.map +1 -0
- package/dist/lib/cancel.d.ts +4 -4
- package/dist/lib/cancel.d.ts.map +1 -1
- package/dist/lib/cancel.js +5 -5
- package/dist/lib/cancel.js.map +1 -1
- package/dist/lib/completion-install.d.ts +11 -2
- package/dist/lib/completion-install.d.ts.map +1 -1
- package/dist/lib/completion-install.js +79 -21
- package/dist/lib/completion-install.js.map +1 -1
- package/dist/lib/completion-scripts.d.ts.map +1 -1
- package/dist/lib/completion-scripts.js +2 -2
- package/dist/lib/completion-scripts.js.map +1 -1
- package/dist/lib/completion.d.ts +5 -1
- package/dist/lib/completion.d.ts.map +1 -1
- package/dist/lib/completion.js +10 -0
- package/dist/lib/completion.js.map +1 -1
- package/dist/lib/concrete-channel.d.ts +6 -0
- package/dist/lib/concrete-channel.d.ts.map +1 -0
- package/dist/lib/concrete-channel.js +17 -0
- package/dist/lib/concrete-channel.js.map +1 -0
- package/dist/lib/confirmation-required.d.ts +3 -12
- package/dist/lib/confirmation-required.d.ts.map +1 -1
- package/dist/lib/confirmation-required.js +9 -8
- package/dist/lib/confirmation-required.js.map +1 -1
- package/dist/lib/connect.d.ts +9 -0
- package/dist/lib/connect.d.ts.map +1 -1
- package/dist/lib/connect.js +27 -0
- package/dist/lib/connect.js.map +1 -1
- package/dist/lib/control.d.ts +42 -12
- package/dist/lib/control.d.ts.map +1 -1
- package/dist/lib/control.js +148 -34
- package/dist/lib/control.js.map +1 -1
- package/dist/lib/controller-restore.d.ts.map +1 -1
- package/dist/lib/controller-restore.js +12 -7
- package/dist/lib/controller-restore.js.map +1 -1
- package/dist/lib/credential-authority.d.ts.map +1 -1
- package/dist/lib/credential-authority.js +3 -0
- package/dist/lib/credential-authority.js.map +1 -1
- package/dist/lib/credential-exports.d.ts +17 -0
- package/dist/lib/credential-exports.d.ts.map +1 -0
- package/dist/lib/credential-exports.js +21 -0
- package/dist/lib/credential-exports.js.map +1 -0
- package/dist/lib/debug-flag.d.ts +4 -0
- package/dist/lib/debug-flag.d.ts.map +1 -0
- package/dist/lib/debug-flag.js +7 -0
- package/dist/lib/debug-flag.js.map +1 -0
- package/dist/lib/default-persona.d.ts +2 -0
- package/dist/lib/default-persona.d.ts.map +1 -1
- package/dist/lib/default-persona.js +2 -0
- package/dist/lib/default-persona.js.map +1 -1
- package/dist/lib/delivery-proc.d.ts +1 -1
- package/dist/lib/delivery-proc.d.ts.map +1 -1
- package/dist/lib/delivery-proc.js +5 -4
- package/dist/lib/delivery-proc.js.map +1 -1
- package/dist/lib/delivery-responder.d.ts +7 -3
- package/dist/lib/delivery-responder.d.ts.map +1 -1
- package/dist/lib/delivery-responder.js +8 -4
- package/dist/lib/delivery-responder.js.map +1 -1
- package/dist/lib/denied-write.d.ts +8 -0
- package/dist/lib/denied-write.d.ts.map +1 -0
- package/dist/lib/denied-write.js +24 -0
- package/dist/lib/denied-write.js.map +1 -0
- package/dist/lib/endpoint-capability-gates.js +2 -2
- package/dist/lib/endpoint-capability-gates.js.map +1 -1
- package/dist/lib/flag-value-refusal.d.ts +8 -0
- package/dist/lib/flag-value-refusal.d.ts.map +1 -0
- package/dist/lib/flag-value-refusal.js +10 -0
- package/dist/lib/flag-value-refusal.js.map +1 -0
- package/dist/lib/install-umask.d.ts +5 -0
- package/dist/lib/install-umask.d.ts.map +1 -1
- package/dist/lib/install-umask.js +25 -0
- package/dist/lib/install-umask.js.map +1 -1
- package/dist/lib/interrupt-notice.d.ts +23 -1
- package/dist/lib/interrupt-notice.d.ts.map +1 -1
- package/dist/lib/interrupt-notice.js +27 -6
- package/dist/lib/interrupt-notice.js.map +1 -1
- package/dist/lib/interrupt-report.d.ts +7 -0
- package/dist/lib/interrupt-report.d.ts.map +1 -0
- package/dist/lib/interrupt-report.js +24 -0
- package/dist/lib/interrupt-report.js.map +1 -0
- package/dist/lib/isolated-broker.d.ts +1 -1
- package/dist/lib/isolated-broker.d.ts.map +1 -1
- package/dist/lib/isolated-broker.js +17 -8
- package/dist/lib/isolated-broker.js.map +1 -1
- package/dist/lib/legacy-start.d.ts +8 -6
- package/dist/lib/legacy-start.d.ts.map +1 -1
- package/dist/lib/legacy-start.js +36 -36
- package/dist/lib/legacy-start.js.map +1 -1
- package/dist/lib/manager-choice.d.ts +92 -4
- package/dist/lib/manager-choice.d.ts.map +1 -1
- package/dist/lib/manager-choice.js +338 -23
- package/dist/lib/manager-choice.js.map +1 -1
- package/dist/lib/manager-proc.d.ts.map +1 -1
- package/dist/lib/manager-proc.js +7 -6
- package/dist/lib/manager-proc.js.map +1 -1
- package/dist/lib/manifest/index.d.ts +5 -1
- package/dist/lib/manifest/index.d.ts.map +1 -1
- package/dist/lib/manifest/index.js +50 -5
- package/dist/lib/manifest/index.js.map +1 -1
- package/dist/lib/manifest/preflight.d.ts +4 -0
- package/dist/lib/manifest/preflight.d.ts.map +1 -1
- package/dist/lib/manifest/preflight.js +18 -1
- package/dist/lib/manifest/preflight.js.map +1 -1
- package/dist/lib/manifest/resolve.d.ts +8 -0
- package/dist/lib/manifest/resolve.d.ts.map +1 -1
- package/dist/lib/manifest/resolve.js +104 -11
- package/dist/lib/manifest/resolve.js.map +1 -1
- package/dist/lib/missing-flags.js +1 -1
- package/dist/lib/missing-flags.js.map +1 -1
- package/dist/lib/nats-bin.d.ts +28 -5
- package/dist/lib/nats-bin.d.ts.map +1 -1
- package/dist/lib/nats-bin.js +85 -7
- package/dist/lib/nats-bin.js.map +1 -1
- package/dist/lib/nearest-word.d.ts +14 -0
- package/dist/lib/nearest-word.d.ts.map +1 -0
- package/dist/lib/nearest-word.js +76 -0
- package/dist/lib/nearest-word.js.map +1 -0
- package/dist/lib/no-expiry-record.d.ts +8 -0
- package/dist/lib/no-expiry-record.d.ts.map +1 -0
- package/dist/lib/no-expiry-record.js +27 -0
- package/dist/lib/no-expiry-record.js.map +1 -0
- package/dist/lib/paths.d.ts +31 -0
- package/dist/lib/paths.d.ts.map +1 -1
- package/dist/lib/paths.js +92 -2
- package/dist/lib/paths.js.map +1 -1
- package/dist/lib/persona-files.d.ts +29 -6
- package/dist/lib/persona-files.d.ts.map +1 -1
- package/dist/lib/persona-files.js +179 -36
- package/dist/lib/persona-files.js.map +1 -1
- package/dist/lib/personas.d.ts +18 -1
- package/dist/lib/personas.d.ts.map +1 -1
- package/dist/lib/personas.js +65 -6
- package/dist/lib/personas.js.map +1 -1
- package/dist/lib/prompts.d.ts +7 -1
- package/dist/lib/prompts.d.ts.map +1 -1
- package/dist/lib/prompts.js +43 -3
- package/dist/lib/prompts.js.map +1 -1
- package/dist/lib/registry-errors.d.ts +2 -1
- package/dist/lib/registry-errors.d.ts.map +1 -1
- package/dist/lib/registry-errors.js +6 -2
- package/dist/lib/registry-errors.js.map +1 -1
- package/dist/lib/reset-space-plan.d.ts +2 -0
- package/dist/lib/reset-space-plan.d.ts.map +1 -1
- package/dist/lib/reset-space-plan.js +1 -1
- package/dist/lib/reset-space-plan.js.map +1 -1
- package/dist/lib/restore.d.ts +45 -3
- package/dist/lib/restore.d.ts.map +1 -1
- package/dist/lib/restore.js +233 -39
- package/dist/lib/restore.js.map +1 -1
- package/dist/lib/rolled-back-runs.d.ts +36 -0
- package/dist/lib/rolled-back-runs.d.ts.map +1 -0
- package/dist/lib/rolled-back-runs.js +96 -0
- package/dist/lib/rolled-back-runs.js.map +1 -0
- package/dist/lib/service-custody-win32.d.ts +25 -0
- package/dist/lib/service-custody-win32.d.ts.map +1 -0
- package/dist/lib/service-custody-win32.js +67 -0
- package/dist/lib/service-custody-win32.js.map +1 -0
- package/dist/lib/service-definitions.d.ts +16 -3
- package/dist/lib/service-definitions.d.ts.map +1 -1
- package/dist/lib/service-definitions.js +99 -27
- package/dist/lib/service-definitions.js.map +1 -1
- package/dist/lib/service-instances.d.ts +46 -5
- package/dist/lib/service-instances.d.ts.map +1 -1
- package/dist/lib/service-instances.js +112 -18
- package/dist/lib/service-instances.js.map +1 -1
- package/dist/lib/service-journal.js +1 -1
- package/dist/lib/service-journal.js.map +1 -1
- package/dist/lib/service-presets.d.ts.map +1 -1
- package/dist/lib/service-presets.js +16 -0
- package/dist/lib/service-presets.js.map +1 -1
- package/dist/lib/service-process.d.ts +53 -15
- package/dist/lib/service-process.d.ts.map +1 -1
- package/dist/lib/service-process.js +533 -86
- package/dist/lib/service-process.js.map +1 -1
- package/dist/lib/service-systemd-install.js +1 -1
- package/dist/lib/service-systemd-install.js.map +1 -1
- package/dist/lib/space-streams.d.ts +18 -0
- package/dist/lib/space-streams.d.ts.map +1 -0
- package/dist/lib/space-streams.js +35 -0
- package/dist/lib/space-streams.js.map +1 -0
- package/dist/lib/spawn-defaults.d.ts +25 -1
- package/dist/lib/spawn-defaults.d.ts.map +1 -1
- package/dist/lib/spawn-defaults.js +37 -1
- package/dist/lib/spawn-defaults.js.map +1 -1
- package/dist/lib/stack-journal.d.ts +157 -14
- package/dist/lib/stack-journal.d.ts.map +1 -1
- package/dist/lib/stack-journal.js +406 -49
- package/dist/lib/stack-journal.js.map +1 -1
- package/dist/lib/stack-listeners.d.ts +17 -0
- package/dist/lib/stack-listeners.d.ts.map +1 -0
- package/dist/lib/stack-listeners.js +54 -0
- package/dist/lib/stack-listeners.js.map +1 -0
- package/dist/lib/stack-members.d.ts +13 -0
- package/dist/lib/stack-members.d.ts.map +1 -0
- package/dist/lib/stack-members.js +24 -0
- package/dist/lib/stack-members.js.map +1 -0
- package/dist/lib/stack-resume.d.ts.map +1 -1
- package/dist/lib/stack-resume.js +5 -2
- package/dist/lib/stack-resume.js.map +1 -1
- package/dist/lib/stack-runs.d.ts +34 -0
- package/dist/lib/stack-runs.d.ts.map +1 -0
- package/dist/lib/stack-runs.js +75 -0
- package/dist/lib/stack-runs.js.map +1 -0
- package/dist/lib/status.d.ts +11 -0
- package/dist/lib/status.d.ts.map +1 -1
- package/dist/lib/status.js +4 -5
- package/dist/lib/status.js.map +1 -1
- package/dist/lib/stdout-owner.d.ts +12 -3
- package/dist/lib/stdout-owner.d.ts.map +1 -1
- package/dist/lib/stdout-owner.js +33 -5
- package/dist/lib/stdout-owner.js.map +1 -1
- package/dist/lib/store-dir.d.ts +68 -4
- package/dist/lib/store-dir.d.ts.map +1 -1
- package/dist/lib/store-dir.js +253 -17
- package/dist/lib/store-dir.js.map +1 -1
- package/dist/lib/team-additive-attempt.d.ts +1 -1
- package/dist/lib/team-channel-removal.d.ts.map +1 -1
- package/dist/lib/team-channel-removal.js +4 -0
- package/dist/lib/team-channel-removal.js.map +1 -1
- package/dist/lib/team-deploy-inspection.d.ts +13 -0
- package/dist/lib/team-deploy-inspection.d.ts.map +1 -1
- package/dist/lib/team-deploy-inspection.js +12 -0
- package/dist/lib/team-deploy-inspection.js.map +1 -1
- package/dist/lib/team-text.d.ts +6 -0
- package/dist/lib/team-text.d.ts.map +1 -0
- package/dist/lib/team-text.js +36 -0
- package/dist/lib/team-text.js.map +1 -0
- package/dist/lib/transient.d.ts +14 -8
- package/dist/lib/transient.d.ts.map +1 -1
- package/dist/lib/transient.js +72 -11
- package/dist/lib/transient.js.map +1 -1
- package/dist/lib/unusable-file.d.ts +13 -0
- package/dist/lib/unusable-file.d.ts.map +1 -0
- package/dist/lib/unusable-file.js +12 -0
- package/dist/lib/unusable-file.js.map +1 -0
- package/dist/lib/up-report.d.ts +6 -0
- package/dist/lib/up-report.d.ts.map +1 -1
- package/dist/lib/up-report.js +13 -0
- package/dist/lib/up-report.js.map +1 -1
- package/dist/lib/verdict.d.ts +14 -0
- package/dist/lib/verdict.d.ts.map +1 -0
- package/dist/lib/verdict.js +15 -0
- package/dist/lib/verdict.js.map +1 -0
- package/dist/managed-handoff.d.ts +11 -6
- package/dist/managed-handoff.d.ts.map +1 -1
- package/dist/managed-handoff.js +27 -18
- package/dist/managed-handoff.js.map +1 -1
- package/dist/render.d.ts +5 -2
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +44 -10
- package/dist/render.js.map +1 -1
- package/dist/telemetry.d.ts +4 -3
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +14 -6
- package/dist/telemetry.js.map +1 -1
- package/dist/ui.d.ts +3 -2
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +6 -4
- package/dist/ui.js.map +1 -1
- package/dist/view/mesh-view.d.ts.map +1 -1
- package/dist/view/mesh-view.js +4 -1
- package/dist/view/mesh-view.js.map +1 -1
- package/dist/watch-data.d.ts +9 -1
- package/dist/watch-data.d.ts.map +1 -1
- package/dist/watch-data.js +17 -3
- package/dist/watch-data.js.map +1 -1
- package/dist/watch-json.js +4 -3
- package/dist/watch-json.js.map +1 -1
- package/package.json +5 -5
package/dist/commands/spawn.js
CHANGED
|
@@ -2,24 +2,27 @@ import { spawn as spawnProcess } from "node:child_process";
|
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { readFileSync, rmSync, statSync } from "node:fs";
|
|
4
4
|
import { hostname } from "node:os";
|
|
5
|
-
import {
|
|
6
|
-
import { assertValidRole, agentFilePath, AgentGrantConflictError, connectorServers, spawnEnvAllow, deprovisionAgent, discardLaunchArtifacts, firstFreeName, isReachable, reclaimWithChild, loadCotalConfig, modelPolicyRefusal, mintCreds, newIdentity, DEV_OWNER, parseShareSelection, principalKey, mintLifecycleUid, MANAGED_HANDOFF_FILE_ENV, parseManagedLifecycleHandoff, spawnNameError, provisionAgent, provisionAgentDurables, registry, resolveAuthProvider, resolveReadAcl, runAgentBearer, CotalEndpoint, acquireLock, inspectLock, localConsumerClaimPath, transferBucket, writeTransfer, peerLabel, } from "@cotal-ai/core";
|
|
7
|
-
import { CommandFailure, loadLaunchPersonaFile, personaFileReference, PersonaSourceError, inputDisabledByFlag, jsonFlag, plainFlag, presentationOf, renderReport, terminalWidth, writeResult, agentActorTokenKey, agentCredsKey, agentSecretFilePaths, agentSentinelCredsKey, authDir, cachedPreferences, credsFlag, launchFlags,
|
|
8
|
-
import { c } from "../ui.js";
|
|
5
|
+
import { resolve as resolvePath } from "node:path";
|
|
6
|
+
import { assertValidRole, agentFilePath, AgentGrantConflictError, connectorServers, spawnEnvAllow, deprovisionAgent, discardLaunchArtifacts, firstFreeName, isReachable, reclaimWithChild, loadCotalConfig, modelPolicyRefusal, mintCreds, newIdentity, DEV_OWNER, parseShareSelection, principalKey, assertLifecycleToken, mintLifecycleUid, MANAGED_HANDOFF_FILE_ENV, parseManagedLifecycleHandoff, spawnNameError, provisionAgent, provisionAgentDurables, registry, resolveAuthProvider, resolveReadAcl, runAgentBearer, CotalEndpoint, acquireLock, inspectLock, localConsumerClaimPath, transferBucket, writeTransfer, peerLabel, } from "@cotal-ai/core";
|
|
7
|
+
import { CommandFailure, loadLaunchPersonaFile, personaFileReference, PersonaSourceError, inputDisabledByFlag, jsonFlag, plainFlag, presentationOf, recordOperationWarning, renderReport, terminalWidth, wrapWords, writeResult, agentActorTokenKey, agentCredsKey, agentSecretFilePaths, agentSentinelCredsKey, authDir, cachedPreferences, credsFlag, launchFlags, findMesh, getSpaceAuth, materializeSecretToFile, mergeLaunchOptions, parseLaunchOptions, preflightOrThrow, provenance, resolveAgentType, resolvePreference, resolveTargetOrThrow, serverFlag, spaceAccountPath, spaceFlag, spaceKey, userAuthStateDir, workspaceSecretStore, refreshRegistrationPolicy, resolveSeatControlTarget, connectUserControlOrExit, userViewAuth, oneLine, DEFAULT_CONNECTOR, hintedConnector, manifestExtensionNames, OFFICIAL_CONNECTORS, recordOperationSpace, } from "@cotal-ai/workspace";
|
|
8
|
+
import { c, stderrLine } from "../ui.js";
|
|
9
9
|
import { liveMeshNames } from "../lib/live-names.js";
|
|
10
10
|
import { displayCmd } from "../lib/self-exec.js";
|
|
11
11
|
import { entryScript } from "../seed/paths.js";
|
|
12
12
|
import { completedFlagValue, completingFlagValue, hasCompletedFlagValue, positionalsForCompletion } from "../lib/completion.js";
|
|
13
13
|
import { preflightOrExit, resolveTargetOrExit } from "../lib/connect.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
14
|
+
import { runningStackManagerPid, stackManagerAbsent, stackManagerStarting } from "../lib/stack-journal.js";
|
|
15
|
+
import { askManager, describeUnanswered, failIfNotOk, liveManagerIds, managerRailGone, onInstance, refuseUnregisteredManager, refuseWithoutLiveManager, resolveControlTarget, START_TIMEOUT_MS, withControlConnection } from "../lib/control.js";
|
|
16
|
+
import { askManagerFolder, askSpawnPlace, managerPin, managerSelection, managersWithPersona, rerunOn } from "../lib/manager-choice.js";
|
|
17
|
+
import { canPrompt } from "./meshes-wizard.js";
|
|
18
|
+
import { listDeclaredChannels, listDeclaredRoles, listPersonaNames } from "../lib/personas.js";
|
|
19
|
+
import { personaCatalog } from "../lib/persona-files.js";
|
|
20
|
+
import { callerHarness, missingPersona, spawnPersona, spawnUsesManager } from "../lib/spawn-defaults.js";
|
|
18
21
|
import { spawnLaunchPreview } from "./spawn-preview.js";
|
|
19
22
|
import { protectedCredentialReference, readLocalRecordSource } from "../lib/protected-records.js";
|
|
20
23
|
import { attachSeat } from "./agents.js";
|
|
21
24
|
import { extensionNames, materializeExtension } from "../ext-loader.js";
|
|
22
|
-
import { claimManagedHandoff, holdsManagedHandoff } from "../managed-handoff.js";
|
|
25
|
+
import { claimManagedHandoff, holdsManagedHandoff, managedHandoffRefusal } from "../managed-handoff.js";
|
|
23
26
|
import { checkDialPolicy, checkEnforcement, checkServer, checkUserBundle, persistRemoteUserEntry, probeEnforcement, tlsIntent, userExchangeIssuer, verifyUserExchange, } from "./meshes-add.js";
|
|
24
27
|
const ENROLLMENT_URL_ENV = "COTAL_ENROLLMENT_URL";
|
|
25
28
|
const ENROLLMENT_FILE_ENV = "COTAL_ENROLLMENT_FILE";
|
|
@@ -64,6 +67,14 @@ export function scrubEnrollmentEnv(env) {
|
|
|
64
67
|
delete env[key];
|
|
65
68
|
}
|
|
66
69
|
}
|
|
70
|
+
/** Carry the launching manager's validated `COTAL_MANAGER_INSTANCE` onto a managed-handoff
|
|
71
|
+
* child's connector launch spec (`spawnProcess` passes `env: spec.env` only, and `launchEnv`
|
|
72
|
+
* does not forward `COTAL_MANAGER_INSTANCE` from `process.env`). */
|
|
73
|
+
export function applyHandoffManagerInstance(spec, handoffManagerInstanceId) {
|
|
74
|
+
if (handoffManagerInstanceId !== undefined) {
|
|
75
|
+
spec.env = { ...spec.env, COTAL_MANAGER_INSTANCE: handoffManagerInstanceId };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
67
78
|
export function checkEnrollmentBundle(raw, actor) {
|
|
68
79
|
const material = checkRemoteAgentMaterial(raw, actor);
|
|
69
80
|
if (!material.ok)
|
|
@@ -170,8 +181,6 @@ async function registerEnrollmentMesh(stock, root, refusals) {
|
|
|
170
181
|
* personas, not the cwd's. */
|
|
171
182
|
export function spawnComplete(argv) {
|
|
172
183
|
const flag = completingFlagValue(argv, spawnFlags);
|
|
173
|
-
if (flag?.name === "space")
|
|
174
|
-
return { items: loadMeshes().map((m) => ({ value: m.space })), directive: "nofiles" };
|
|
175
184
|
if (flag?.name === "agent" || flag?.name === "harness")
|
|
176
185
|
return { items: registry.all("connector").map((c) => ({ value: c.name })), directive: "nofiles" };
|
|
177
186
|
if (flag?.name === "role")
|
|
@@ -180,12 +189,7 @@ export function spawnComplete(argv) {
|
|
|
180
189
|
const current = argv[argv.length - 1] ?? "";
|
|
181
190
|
if (current.includes("/") || current.includes("\\") || current.endsWith(".md"))
|
|
182
191
|
return { items: [], directive: "default" };
|
|
183
|
-
|
|
184
|
-
return { items: personaItems(argv), directive: "nofiles" };
|
|
185
|
-
}
|
|
186
|
-
catch {
|
|
187
|
-
return { items: [], directive: "nofiles" };
|
|
188
|
-
}
|
|
192
|
+
return { items: personaItems(argv), directive: "nofiles" };
|
|
189
193
|
}
|
|
190
194
|
if (flag && ["subscribe", "allow-subscribe", "allow-publish"].includes(flag.name))
|
|
191
195
|
return { items: declaredFrom(argv, listDeclaredChannels).map((value) => ({ value, description: "declared channel" })), directive: "nofiles" };
|
|
@@ -195,24 +199,28 @@ export function spawnComplete(argv) {
|
|
|
195
199
|
return { items: ["pty", ...extensionNames("runtime")].filter((value, i, all) => all.indexOf(value) === i).map((value) => ({ value })), directive: "nofiles" };
|
|
196
200
|
const positionals = positionalsForCompletion(argv, spawnFlags);
|
|
197
201
|
// Only the first word after `spawn` is the persona positional; once it's typed, defer to the shell.
|
|
198
|
-
if (positionals.length <= 1 && !hasCompletedFlagValue(argv, spawnFlags, "config") && !hasCompletedFlagValue(argv, spawnFlags, "file"))
|
|
199
|
-
|
|
200
|
-
return { items: personaItems(argv), directive: "nofiles" };
|
|
201
|
-
}
|
|
202
|
-
catch {
|
|
203
|
-
// No single target (no mesh, or several with no `current`) — fail CLOSED: offer no personas
|
|
204
|
-
// rather than throw. `cotal spawn --space <TAB>` still lists the running meshes.
|
|
205
|
-
return { items: [], directive: "nofiles" };
|
|
206
|
-
}
|
|
207
|
-
}
|
|
202
|
+
if (positionals.length <= 1 && !hasCompletedFlagValue(argv, spawnFlags, "config") && !hasCompletedFlagValue(argv, spawnFlags, "file"))
|
|
203
|
+
return { items: personaItems(argv), directive: "nofiles" };
|
|
208
204
|
return { items: [], directive: "nofiles" };
|
|
209
205
|
}
|
|
206
|
+
/** The persona catalog root this spawn would read, resolved read-only as `persona show` resolves it,
|
|
207
|
+
* so a prepared space that is not started still lists its personas. */
|
|
208
|
+
const catalogRoot = (argv) => personaCatalog({
|
|
209
|
+
space: completedFlagValue(argv, spawnFlags, "space"),
|
|
210
|
+
server: completedFlagValue(argv, spawnFlags, "server"),
|
|
211
|
+
}).root;
|
|
212
|
+
/** The personas this spawn would launch from. With no single target (no mesh, or several with no
|
|
213
|
+
* `current`) it fails CLOSED and offers none; `cotal spawn --space <TAB>` still lists the running
|
|
214
|
+
* meshes. A catalog folder that cannot be read throws, so the completion fails and names it. */
|
|
210
215
|
function personaItems(argv) {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
+
let root;
|
|
217
|
+
try {
|
|
218
|
+
root = catalogRoot(argv);
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
return [];
|
|
222
|
+
}
|
|
223
|
+
return listPersonaNames(root).map((value) => ({ value }));
|
|
216
224
|
}
|
|
217
225
|
/** Channels/roles declared by the TARGET mesh's personas — the same root {@link personaItems}
|
|
218
226
|
* uses, so `--role`/`--subscribe` complete from the personas this spawn would actually launch
|
|
@@ -221,10 +229,7 @@ function personaItems(argv) {
|
|
|
221
229
|
* offer nothing rather than throw into the operator's shell. */
|
|
222
230
|
function declaredFrom(argv, list) {
|
|
223
231
|
try {
|
|
224
|
-
return list(
|
|
225
|
-
space: completedFlagValue(argv, spawnFlags, "space"),
|
|
226
|
-
server: completedFlagValue(argv, spawnFlags, "server"),
|
|
227
|
-
}).root);
|
|
232
|
+
return list(catalogRoot(argv));
|
|
228
233
|
}
|
|
229
234
|
catch {
|
|
230
235
|
return [];
|
|
@@ -265,40 +270,43 @@ async function provisionFreshForeground(requested, autoName, provision) {
|
|
|
265
270
|
}
|
|
266
271
|
}
|
|
267
272
|
}
|
|
268
|
-
/** `cotal spawn`'s grammar:
|
|
269
|
-
* and one positional persona or explicit persona file. Declared `as const` so the values cast
|
|
273
|
+
/** `cotal spawn`'s grammar: the application in this terminal by default, a manager's launch only
|
|
274
|
+
* with `--detach` or `--on`, and one positional persona or explicit persona file. Declared `as const` so the values cast
|
|
270
275
|
* below is compile-checked against exactly these specs. Foreground and detached parse the SAME
|
|
271
276
|
* flags — the old `spawn` vs `start` ability drift is structurally gone. */
|
|
272
277
|
export const spawnFlags = [
|
|
273
278
|
spaceFlag,
|
|
274
279
|
serverFlag,
|
|
275
|
-
{ ...credsFlag, description: "control-caller creds for an off-registry manager (
|
|
280
|
+
{ ...credsFlag, description: "control-caller creds for an off-registry manager (with --detach or --on)" },
|
|
276
281
|
...launchFlags,
|
|
277
282
|
{ name: "harness", short: "H", type: "string", value: "<connector>", description: "application connector; an explicit flag wins over persona and saved defaults" },
|
|
278
|
-
{ name: "foreground", type: "boolean", description: "run the
|
|
279
|
-
{ name: "restarts", type: "string", value: "<n>", description: "maximum manager-supervised restarts in the selected restart window" },
|
|
283
|
+
{ name: "foreground", type: "boolean", description: "run the application in this terminal, as a spawn without --detach or --on does; terminal exit may end it" },
|
|
284
|
+
{ name: "restarts", type: "string", value: "<n>", description: "with --detach or --on: maximum manager-supervised restarts in the selected restart window" },
|
|
280
285
|
{ name: "restart-window", type: "string", value: "<ms>", description: "time window for --restarts; both flags are required together" },
|
|
281
286
|
jsonFlag, plainFlag,
|
|
282
|
-
{ name: "detach", type: "boolean", short: "d", description: "launch through
|
|
287
|
+
{ name: "detach", type: "boolean", short: "d", description: "launch through a manager, await readiness and return without attaching" },
|
|
283
288
|
{ name: "live-only", type: "boolean", description: "foreground only: skip the durable backstop (no read-ACL row; messages missed while disconnected are not replayed)" },
|
|
284
289
|
{ name: "file", type: "string", short: "f", value: "<persona-file>", description: "persona file on the execution host; never a manifest deploy or implicit upload" },
|
|
285
290
|
{ name: "dry-run", type: "boolean", description: "preview the launch without allocation, provisioning or starting an application" },
|
|
286
|
-
{ name: "enrollment-file", type: "string", value: "<private-file>", description: "
|
|
291
|
+
{ name: "enrollment-file", type: "string", value: "<private-file>", description: "foreground only: protected file holding this one seat's enrollment URL; never print or forward it" },
|
|
287
292
|
{ name: "allow-stale", type: "string", value: "<a,b>", description: "refused: a manifest deployment option; use cotal team deploy <file>" },
|
|
288
293
|
{ name: "runtime", type: "string", value: "<name>", description: "refused: a manifest deployment option; use cotal team deploy <file>" },
|
|
289
|
-
{ name: "on", type: "string", value: "<instance>", description: "
|
|
294
|
+
{ name: "on", type: "string", value: "<instance>", description: "launch through this manager instance, by the id `ps` prints, and attach; with --detach, return once it joins" },
|
|
290
295
|
{ name: "expect-owner", type: "string", value: "<u_…>", description: `with ${MANAGED_HANDOFF_FILE_ENV}: the owner the managed handoff must carry` },
|
|
291
296
|
{ name: "expect-lifecycle-uid", type: "string", value: "<uid>", description: `with ${MANAGED_HANDOFF_FILE_ENV}: the lifecycle UID the managed handoff must carry` },
|
|
292
297
|
];
|
|
293
298
|
/** Check the public mode and spelling before catalog preparation or identity allocation. */
|
|
294
299
|
export function validateSpawnArguments(args) {
|
|
295
300
|
const values = args.values;
|
|
301
|
+
const handoffRefusal = managedHandoffRefusal();
|
|
302
|
+
if (handoffRefusal)
|
|
303
|
+
throw handoffRefusal;
|
|
296
304
|
presentationOf(values);
|
|
297
305
|
// `runCli` has already taken the handoff into custody and deleted its variable.
|
|
298
306
|
const internal = holdsManagedHandoff() || Boolean(process.env[ENROLLMENT_URL_ENV] || process.env[ENROLLMENT_FILE_ENV]);
|
|
299
307
|
if (!holdsManagedHandoff() && (values["expect-owner"] !== undefined || values["expect-lifecycle-uid"] !== undefined))
|
|
300
308
|
throw new CommandFailure("refused", "USAGE_INVALID", `--expect-owner and --expect-lifecycle-uid apply only with ${MANAGED_HANDOFF_FILE_ENV}`);
|
|
301
|
-
const direct = values.foreground === true || internal;
|
|
309
|
+
const direct = values.foreground === true || internal || !spawnUsesManager(values);
|
|
302
310
|
if (values.file !== undefined && (args.positionals.length || values.config !== undefined))
|
|
303
311
|
throw new CommandFailure("refused", "USAGE_INVALID", "choose one positional persona or --file/-f, not multiple explicit persona sources");
|
|
304
312
|
if (!internal && values.config !== undefined)
|
|
@@ -315,21 +323,21 @@ export function validateSpawnArguments(args) {
|
|
|
315
323
|
throw new CommandFailure("refused", "USAGE_INVALID", "manifest deployment options belong to cotal team deploy <file>, not spawn");
|
|
316
324
|
if (values["enrollment-file"] !== undefined && !values.space)
|
|
317
325
|
throw new CommandFailure("refused", "USAGE_INVALID", "--enrollment-file requires an explicit --space");
|
|
318
|
-
if (values["enrollment-file"] !== undefined && !
|
|
319
|
-
throw new CommandFailure("refused", "UNSUPPORTED", "this native enrollment path runs one foreground seat
|
|
326
|
+
if (values["enrollment-file"] !== undefined && !direct)
|
|
327
|
+
throw new CommandFailure("refused", "UNSUPPORTED", "this native enrollment path runs one foreground seat. It does not substitute for managed enrollment authority");
|
|
320
328
|
if (values["enrollment-file"] !== undefined && (internal || values.detach || values.creds !== undefined || values.on !== undefined))
|
|
321
329
|
throw new CommandFailure("refused", "USAGE_INVALID", "choose one foreground enrollment source without a manager pin, credential override or internal handoff");
|
|
322
330
|
if (values.harness !== undefined && values.agent !== undefined)
|
|
323
331
|
throw new CommandFailure("refused", "USAGE_INVALID", "choose --harness/-H or the legacy --agent spelling, not both");
|
|
324
332
|
if (values.detach && direct)
|
|
325
333
|
throw new CommandFailure("refused", "USAGE_INVALID", "--detach and direct foreground execution are different launch modes");
|
|
326
|
-
if (
|
|
327
|
-
throw new CommandFailure("refused", "USAGE_INVALID", "
|
|
334
|
+
if (direct && ((!values["dry-run"] && (values.json || values.plain)) || values.creds !== undefined || values.on !== undefined))
|
|
335
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "a spawn in this terminal takes no structured receipt, manager credential or manager pin", { remedy: "add -d to launch it through a manager, which returns a receipt once the agent joins", selfContained: true });
|
|
328
336
|
if ((values.restarts === undefined) !== (values["restart-window"] === undefined))
|
|
329
337
|
throw new CommandFailure("refused", "USAGE_INVALID", "--restarts and --restart-window must be supplied together");
|
|
330
338
|
if (values.restarts !== undefined) {
|
|
331
339
|
if (direct)
|
|
332
|
-
throw new CommandFailure("refused", "USAGE_INVALID", "restart supervision belongs to a managed launch, not
|
|
340
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "restart supervision belongs to a managed launch, not a spawn in this terminal", { remedy: "add -d, or --on <instance>, to launch it through a manager" });
|
|
333
341
|
for (const field of ["restarts", "restart-window"])
|
|
334
342
|
if (!/^[1-9][0-9]*$/.test(values[field]) || !Number.isSafeInteger(Number(values[field])))
|
|
335
343
|
throw new CommandFailure("refused", "USAGE_INVALID", `--${field} must be a positive safe integer`);
|
|
@@ -337,7 +345,7 @@ export function validateSpawnArguments(args) {
|
|
|
337
345
|
if (values["live-only"] && !direct)
|
|
338
346
|
throw new CommandFailure("refused", "USAGE_INVALID", "--live-only belongs to direct foreground execution");
|
|
339
347
|
if (!values["dry-run"] && !direct && !values.detach && (values.json || values.plain || inputDisabledByFlag() || !process.stdin.isTTY || !process.stdout.isTTY))
|
|
340
|
-
throw new CommandFailure("refused", "USAGE_INVALID", "
|
|
348
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "attaching to a manager's launch needs usable input and output terminals before an identity is allocated", { remedy: "add -d to wait for readiness without attaching, or drop --on to run it in this terminal", selfContained: true });
|
|
341
349
|
for (const field of ["harness", "agent", "model", "variant", "name"])
|
|
342
350
|
if (values[field] !== undefined && !values[field].trim())
|
|
343
351
|
throw new CommandFailure("refused", "USAGE_INVALID", `--${field} cannot be empty`);
|
|
@@ -377,6 +385,22 @@ export function validateSpawnArguments(args) {
|
|
|
377
385
|
export function spawnRequiredExtensions(_args) {
|
|
378
386
|
return [];
|
|
379
387
|
}
|
|
388
|
+
/** Whether the installed manifest lists a connector named `name`. An unreadable manifest answers
|
|
389
|
+
* true, so the import's own refusal reports it. */
|
|
390
|
+
function connectorListed(name) {
|
|
391
|
+
try {
|
|
392
|
+
return manifestExtensionNames("connector").includes(name);
|
|
393
|
+
}
|
|
394
|
+
catch {
|
|
395
|
+
return true;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
/** The refusal for a harness with no installed connector, naming the package when it is official. */
|
|
399
|
+
function missingConnector(name, target) {
|
|
400
|
+
const pkg = OFFICIAL_CONNECTORS[name];
|
|
401
|
+
return new CommandFailure("refused", "DEPENDENCY_UNAVAILABLE", `no connector "${name}" is installed`, { target,
|
|
402
|
+
remedy: pkg ? `add it with \`cotal ext add ${pkg}\`` : "install its integration with `cotal ext add <npm-package>`, or check the name" });
|
|
403
|
+
}
|
|
380
404
|
/** Comma-list flag → string[] (shared by both spawn modes). Only an absent flag is `undefined` and
|
|
381
405
|
* defers to the persona; an empty value is the empty list, so `--subscribe ""` clears it. */
|
|
382
406
|
const splitFlag = (v) => (v === undefined ? undefined : v.split(",").map((s) => s.trim()).filter(Boolean));
|
|
@@ -389,16 +413,29 @@ const splitFlag = (v) => (v === undefined ? undefined : v.split(",").map((s) =>
|
|
|
389
413
|
function refuseUnmintableNameOrExit(name, userMode) {
|
|
390
414
|
const refusal = spawnNameError(name, { userMode });
|
|
391
415
|
if (refusal) {
|
|
392
|
-
|
|
416
|
+
stderrLine("✗ ", `${refusal}`, c.red);
|
|
393
417
|
process.exit(1);
|
|
394
418
|
}
|
|
395
419
|
}
|
|
396
|
-
|
|
420
|
+
/** The manager's `acl` launch field: null when the manager sent none, undefined when it cannot be read. */
|
|
421
|
+
export function managedLaunchAcl(value) {
|
|
422
|
+
if (value === undefined)
|
|
423
|
+
return null;
|
|
424
|
+
const lists = (raw) => {
|
|
425
|
+
const { allowSubscribe, allowPublish } = (raw ?? {});
|
|
426
|
+
const channels = (list) => Array.isArray(list) && list.every((channel) => typeof channel === "string");
|
|
427
|
+
return channels(allowSubscribe) && channels(allowPublish) ? { allowSubscribe: [...allowSubscribe], allowPublish: [...allowPublish] } : undefined;
|
|
428
|
+
};
|
|
429
|
+
const requested = lists(value?.requested), effective = lists(value?.effective);
|
|
430
|
+
return requested && effective ? { requested, effective } : undefined;
|
|
431
|
+
}
|
|
432
|
+
const channelList = (channels) => channels.length ? channels.join(", ") : "none";
|
|
433
|
+
export function managedLaunchView(r) {
|
|
397
434
|
const concrete = [r.name, r.space, r.managerInstanceId].every((value) => /^[A-Za-z0-9_-]+$/.test(value));
|
|
398
435
|
const target = concrete ? `${r.name} --space ${r.space} --on ${r.managerInstanceId}` : "<name> --space <space> --on <manager-instance>";
|
|
399
436
|
return { sections: [
|
|
400
437
|
{ title: "Agent joined", blocks: [
|
|
401
|
-
{ kind: "fields", rows: [["Agent", r.name], ["Identity", r.id], ["Lifecycle", r.lifecycleUid], ["Space", r.space], ["Manager receipt", r.managerInstanceId], ["Original request", r.intent?.requestId ?? r.request?.requestId ?? "not recorded"], ["Accepted goal", r.request?.goalId ?? "not reported"], ["Application", r.harness], ["Runtime", r.runtime], ["Role", r.role ?? "not recorded"], ["Model request", r.requestedModel ?? "persona/manager precedence; not inspected"], ["View", r.detached ? "not attached" : "attaching to the allocated incarnation"]] },
|
|
438
|
+
{ kind: "fields", rows: [["Agent", r.name], ["Identity", r.id], ["Lifecycle", r.lifecycleUid], ["Space", r.space], ["Manager receipt", r.managerInstanceId], ["Original request", r.intent?.requestId ?? r.request?.requestId ?? "not recorded"], ["Accepted goal", r.request?.goalId ?? "not reported"], ["Application", r.harness], ["Runtime", r.runtime], ["Role", r.role ?? "not recorded"], ...(r.acl ? [["Granted", `read ${channelList(r.acl.effective.allowSubscribe)} · post ${channelList(r.acl.effective.allowPublish)}; asked for read ${channelList(r.acl.requested.allowSubscribe)} · post ${channelList(r.acl.requested.allowPublish)}`]] : []), ["Model request", r.requestedModel ?? "persona/manager precedence; not inspected"], ["View", r.detached ? "not attached" : "attaching to the allocated incarnation"]] },
|
|
402
439
|
{ kind: "lines", lines: [{ text: "The manager confirmed presence readiness. This is not proof that the kickoff task completed.", tone: "hint" }] },
|
|
403
440
|
] },
|
|
404
441
|
...(r.detached ? [{ title: "Next", blocks: [{ kind: "commands", items: [
|
|
@@ -414,7 +451,7 @@ export async function launchManagedPersona(values, positionals, events, launchOp
|
|
|
414
451
|
// `COTAL_DEFAULT_PERSONA` > `default`). Identity is separate:
|
|
415
452
|
// when `--name` is given it OVERRIDES the file's `name:` (foreground's `requested`), threaded
|
|
416
453
|
// as the op's `identity` so it is never silently dropped in detached mode.
|
|
417
|
-
const on =
|
|
454
|
+
const on = await managerPin(values, "cotal spawn <persona>");
|
|
418
455
|
// From a managed seat's own shell the launch is the SEAT's, as its `cotal_spawn` tool is: the
|
|
419
456
|
// manager records the seat as the spawner, so the seat can stop the child it asked for (#718).
|
|
420
457
|
// `--on` keeps the pin on that path too.
|
|
@@ -422,6 +459,20 @@ export async function launchManagedPersona(values, positionals, events, launchOp
|
|
|
422
459
|
const seatIntent = Boolean(process.env.COTAL_NAME || process.env.COTAL_ID || process.env.COTAL_LIFECYCLE_UID || process.env.COTAL_ACCEPTED_TOKEN);
|
|
423
460
|
if (seatIntent && values.creds !== undefined)
|
|
424
461
|
throw new CommandFailure("refused", "USAGE_INVALID", "a managed seat's child launch uses that seat's own caller, not a --creds override");
|
|
462
|
+
// On a terminal, a pinned manager that is not known to run on this host is asked which of its
|
|
463
|
+
// folders the agent works in, unless -C names one. The question holds no manager credential: a
|
|
464
|
+
// typed folder is checked under a view of that manager acquired after it is answered, and the
|
|
465
|
+
// launch acquires its own below.
|
|
466
|
+
let cwd = values.cwd;
|
|
467
|
+
if (cwd === undefined && on !== undefined && !seatIntent && canPrompt()) {
|
|
468
|
+
const selection = await managerSelection(values, on);
|
|
469
|
+
if (selection.manager.host !== hostname()) {
|
|
470
|
+
const folder = await askManagerFolder(selection, process.argv.slice(2), (path) => checkFolder(flags, on, path));
|
|
471
|
+
if (folder === null)
|
|
472
|
+
process.exit(0);
|
|
473
|
+
cwd = folder;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
425
476
|
let seat;
|
|
426
477
|
if (seatIntent) {
|
|
427
478
|
try {
|
|
@@ -451,7 +502,11 @@ export async function launchManagedPersona(values, positionals, events, launchOp
|
|
|
451
502
|
if (eventsRequired && events === false) {
|
|
452
503
|
throw new CommandFailure("refused", "PERMISSION_DENIED", `space "${t.space}" requires the event plane by registration policy; no launch was submitted`);
|
|
453
504
|
}
|
|
454
|
-
|
|
505
|
+
if (on === undefined && !t.auth.bearer)
|
|
506
|
+
await refuseWithoutLiveManager(t.space, t.server, t.auth, { space: t.space, managerInstanceId: null, managerEpoch: null }, "launch an agent");
|
|
507
|
+
// A pin the registry does not list is refused at once; only a registered manager is waited on.
|
|
508
|
+
if (on !== undefined && !t.auth.bearer)
|
|
509
|
+
await refuseUnregisteredManager(t.space, t.server, t.auth, on);
|
|
455
510
|
const { ref, from: personaFrom } = spawnPersona(values.config, positionals, { space: t.space, preferences: cachedPreferences() });
|
|
456
511
|
const managerConfigRef = values.config ?? (personaFrom !== undefined ? ref : undefined);
|
|
457
512
|
const defaultAgent = callerHarness(t.space);
|
|
@@ -463,8 +518,11 @@ export async function launchManagedPersona(values, positionals, events, launchOp
|
|
|
463
518
|
resumeAgent = values.agent ?? await launchAgentOrExit(t, on, { name: ref, config: managerConfigRef, defaultAgent });
|
|
464
519
|
resumeClaim = await carryTranscriptOrExit(flags, on, values.resume, resumeAgent);
|
|
465
520
|
}
|
|
466
|
-
|
|
467
|
-
|
|
521
|
+
// The report that answers names the mesh in its heading, so this block names it once, in a field.
|
|
522
|
+
const toStdout = !observer && presentationOf(values) !== "json";
|
|
523
|
+
(toStdout ? console.log : console.error)(renderReport({ sections: [{ title: "Managed launch", blocks: [{ kind: "fields", rows: [["Space", t.space], ["Manager selector", on ?? t.auth.managerInstanceId ?? "native class selection"], ["Persona", ref], ["File source", managerConfigRef ? `${managerConfigRef} · manager execution host` : "selected manager's persona catalog"], ["File transfer", "none"]] }, { kind: "lines", lines: [{ text: "The accepting manager validates its own visible file before allocation. No local file is uploaded, and a pin never selects a replacement manager.", tone: "hint" }] }] }] }, presentationOf(values) === "plain" ? "plain" : "rich", terminalWidth(toStdout ? process.stdout : process.stderr)));
|
|
524
|
+
for (const line of wrapWords("waiting for the manager: it answers when it refuses the launch, or when the agent joins or exits (at most about 30s) …", terminalWidth(process.stderr)))
|
|
525
|
+
console.error(c.dim(line));
|
|
468
526
|
const reply = await askManager(t.space, t.server, "start", {
|
|
469
527
|
name: ref,
|
|
470
528
|
identity: values.name,
|
|
@@ -481,7 +539,7 @@ export async function launchManagedPersona(values, positionals, events, launchOp
|
|
|
481
539
|
variant: values.variant,
|
|
482
540
|
...(values.restarts !== undefined ? { supervise: { restarts: Number(values.restarts), windowMs: Number(values["restart-window"]) } } : {}),
|
|
483
541
|
launchOptions,
|
|
484
|
-
cwd
|
|
542
|
+
cwd,
|
|
485
543
|
resume: values.resume, // host-local session id; the manager preflights connector resume support
|
|
486
544
|
...(resumeClaim !== undefined ? { resumeClaim, resumeAgent } : {}),
|
|
487
545
|
prompt: values.prompt,
|
|
@@ -502,15 +560,42 @@ export async function launchManagedPersona(values, positionals, events, launchOp
|
|
|
502
560
|
const refusal = { "permission-denied": "PERMISSION_DENIED", "unauthenticated": "AUTH_REQUIRED", "not-found": "TARGET_NOT_FOUND", "unavailable": "TARGET_UNAVAILABLE", "bad-request": "SCHEMA_INVALID", "failed-precondition": "LIFECYCLE_BLOCKED", "already-exists": "CONFLICT", "unimplemented": "UNSUPPORTED" };
|
|
503
561
|
const code = reply.code === undefined ? undefined : refusal[reply.code];
|
|
504
562
|
const native = { code: reply.code, outcome: reply.nativeOutcome, ...(reply.request || reply.intent ? { detail: { request: reply.request ?? null, intent: reply.intent ?? null, observation: reply.observationCause ?? null } } : {}) };
|
|
505
|
-
|
|
506
|
-
|
|
563
|
+
// The broker attested that no manager received an unpinned launch: none takes the class queue.
|
|
564
|
+
if (on === undefined && !t.auth.bearer && reply.unanswered && reply.nativeOutcome === "not-executed")
|
|
565
|
+
throw await unservedClassLaunch(seat ? undefined : flags, t, values.agent ?? defaultAgent, { target, native });
|
|
566
|
+
// A pinned describe that drew no answer means the launch was never sent, as ps and stop --on say.
|
|
567
|
+
if (on !== undefined && describeUnanswered(reply))
|
|
568
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", `manager instance ${on} did not answer, so the launch was not sent and nothing was launched`, { target, native: { code: reply.code, ...(reply.error ? { detail: oneLine(reply.error) } : {}) }, remedy: "cotal ps shows which managers answer; rerun the spawn on one of them with --on <instance>" });
|
|
569
|
+
// So does an unpinned one: no manager answered, and the launch was never published.
|
|
570
|
+
if (on === undefined && describeUnanswered(reply))
|
|
571
|
+
throw unansweredClassLaunch(t, { target, native: { code: reply.code, ...(reply.error ? { detail: oneLine(reply.error) } : {}) } });
|
|
572
|
+
// A manager without the connector: it is added where that manager runs, not on this machine.
|
|
573
|
+
const absent = reply.nativeOutcome === "not-executed" && reply.error !== undefined ? hintedConnector(reply.error) : undefined;
|
|
574
|
+
if (absent !== undefined) {
|
|
575
|
+
const answered = reply.managerInstanceId ?? on;
|
|
576
|
+
throw new CommandFailure("refused", "DEPENDENCY_UNAVAILABLE", `no connector "${absent}" is installed on ${answered ? await managerNamed(seat ? undefined : flags, t, answered) : "the manager"}; nothing was launched`, { target, native,
|
|
577
|
+
remedy: `add it where that manager runs, such as ${extAddFor(absent)}, then restart that manager; it reads its agent applications when it starts` });
|
|
578
|
+
}
|
|
579
|
+
if (reply.nativeOutcome === "not-executed" && code) {
|
|
580
|
+
// A manager without the persona: it is created on that manager's host, or the spawn goes to
|
|
581
|
+
// another live manager whose catalog has it.
|
|
582
|
+
const missing = managerConfigRef === undefined && reply.error?.startsWith(`no persona "${ref}"`) === true;
|
|
583
|
+
const elsewhere = missing ? await managersWithPersona(flags, reply.managerInstanceId ?? on, ref).catch(() => []) : [];
|
|
584
|
+
throw new CommandFailure("refused", code, reply.error ? oneLine(reply.error) : "the manager refused the launch before execution", { target, native, remedy: elsewhere.length
|
|
585
|
+
? `nothing was launched; ${elsewhere.length === 1 ? "this manager of yours has" : "these managers of yours have"} ${ref === "default" ? "a default persona" : `persona "${ref}"`}: ${elsewhere.map((selector) => rerunOn(process.argv.slice(2), selector)).join(" or ")}`
|
|
586
|
+
: missing ? "nothing was launched; create that file on the manager's host, then run the spawn again"
|
|
587
|
+
: "nothing was launched; fix what the manager reported, then run the spawn again" });
|
|
588
|
+
}
|
|
507
589
|
const unknown = reply.nativeOutcome !== "executed" || reply.unanswered;
|
|
508
590
|
throw new CommandFailure(unknown ? "unknown" : "failed", unknown ? "OPERATION_UNKNOWN" : "OPERATION_FAILED", reply.error ? oneLine(reply.error) : "the manager did not confirm launch readiness", { target, native, remedy: "inspect cotal ps and the selected manager before retrying; this launch was not submitted again" });
|
|
509
591
|
}
|
|
510
592
|
const d = reply.data;
|
|
511
593
|
if (!d || typeof d.name !== "string" || typeof d.id !== "string" || typeof d.lifecycleUid !== "string" || typeof d.agent !== "string" || typeof d.mode !== "string" || !reply.managerInstanceId)
|
|
512
594
|
throw new CommandFailure("partial", "OPERATION_PARTIAL", "the manager reported a successful launch but did not supply the identity and manager needed for a safe handoff", { target, changed: [{ kind: "managed-launch", readinessReported: true }], remedy: "inspect cotal ps before doing anything else; do not relaunch" });
|
|
513
|
-
const
|
|
595
|
+
const acl = managedLaunchAcl(d.acl);
|
|
596
|
+
if (acl === undefined)
|
|
597
|
+
throw new CommandFailure("partial", "OPERATION_PARTIAL", "the agent joined, but the manager's report of the channels its host granted could not be read; no replacement was launched", { target, changed: [{ kind: "managed-launch", readinessReported: true }], remedy: "inspect cotal ps before doing anything else; do not relaunch" });
|
|
598
|
+
const result = { kind: "managed-launch", name: d.name, id: d.id, lifecycleUid: d.lifecycleUid, space: t.space, managerInstanceId: reply.managerInstanceId, harness: d.agent, runtime: d.mode, role: d.role ?? null, request: reply.request ?? null, intent: reply.intent ?? null, readiness: "joined", requestedModel: values.model ?? null, detached: values.detach === true, acl };
|
|
514
599
|
const presentation = presentationOf(values);
|
|
515
600
|
const warnings = d.eventsNotice ? [{ code: "EVENT_PLANE_NOTICE", target, message: d.eventsNotice }] : [];
|
|
516
601
|
if (observer) {
|
|
@@ -538,6 +623,93 @@ export async function launchManagedPersona(values, positionals, events, launchOp
|
|
|
538
623
|
throw new CommandFailure("partial", "OPERATION_PARTIAL", "the agent joined, but its exact native terminal was unavailable before setup could open the view; no replacement was launched", { target, changed: [result], remedy: "inspect the original lifecycle and manager before another startup" });
|
|
539
624
|
console.error(renderReport({ sections: [{ title: verdict.kind === "gone" ? "Attach target unavailable" : verdict.reason === "detached" ? "Detached" : "Attach session ended", blocks: [{ kind: "fields", rows: [["Agent", d.name], ["Identity", d.id], ["Manager", reply.managerInstanceId]] }, { kind: "lines", lines: [{ text: "Leaving the view sent no stop request. The original lifecycle was not replaced.", tone: "hint" }] }] }] }, "rich", terminalWidth(process.stderr)));
|
|
540
625
|
}
|
|
626
|
+
/** Whether the manager `on` pins can launch an agent in `path`, answered by its `resolve-cwd` over
|
|
627
|
+
* a view of that manager acquired for this check alone. A path it cannot use is its refusal; a
|
|
628
|
+
* check it does not answer refuses the launch. */
|
|
629
|
+
async function checkFolder(flags, on, path) {
|
|
630
|
+
const t = await resolveControlTarget(flags, "control-caller-privileged", on, { onRefusal: "throw" });
|
|
631
|
+
const reply = await askManager(t.space, t.server, "resolveCwd", { cwd: path }, t.auth, "owner", undefined, { instanceId: on });
|
|
632
|
+
const cwd = reply.ok ? reply.data?.cwd : undefined;
|
|
633
|
+
if (typeof cwd === "string")
|
|
634
|
+
return { cwd };
|
|
635
|
+
if (!reply.ok && reply.code === "failed-precondition" && reply.error)
|
|
636
|
+
return { refusal: oneLine(reply.error) };
|
|
637
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", `manager instance ${on} did not check the folder ${JSON.stringify(path)}${reply.error ? ` (${oneLine(reply.error)})` : ""}, so nothing was launched`, {
|
|
638
|
+
target: { space: t.space, managerInstanceId: on },
|
|
639
|
+
remedy: "cotal ps shows which managers answer; run the spawn again",
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
/** Why no manager received an unpinned launch. A manager whose boot inventory found no agent
|
|
643
|
+
* application leaves the class queue, so when every live one that answered reports that on its own
|
|
644
|
+
* instance rail the refusal names the application to add. A manager the broker affirms gone is
|
|
645
|
+
* skipped and named in a warning, so its registration costs no deadline and hides no reason. A seat
|
|
646
|
+
* (`flags` undefined) does not read the census as the operator. `agent` is the harness this caller
|
|
647
|
+
* would choose, for the install hint. */
|
|
648
|
+
async function unservedClassLaunch(flags, t, agent, at) {
|
|
649
|
+
const census = flags ? await classLaunchCensus(flags, t).catch(() => undefined) : undefined;
|
|
650
|
+
for (const instanceId of census?.gone ?? [])
|
|
651
|
+
recordOperationWarning({ code: "MANAGER_SILENT", target: { space: t.space, managerInstanceId: instanceId }, message: `manager ${instanceId} was skipped: its registration is stale (the broker reports nothing subscribed on its rail; its host is gone and never deregistered)` });
|
|
652
|
+
if (census?.noApplication) {
|
|
653
|
+
return new CommandFailure("refused", "DEPENDENCY_UNAVAILABLE", `no manager of yours takes unpinned launches: none ${census.gone.length ? "that answered " : ""}has an agent application installed${census.managers.length ? ` (${census.managers.join(", ")})` : ""}; nothing was launched`, { ...at,
|
|
654
|
+
remedy: `add one where ${census.managers.length > 1 ? "one of them" : "that manager"} runs, such as ${extAddFor(agent ?? DEFAULT_CONNECTOR)}, then restart that manager; it reads its agent applications when it starts` });
|
|
655
|
+
}
|
|
656
|
+
return new CommandFailure("refused", "TARGET_UNAVAILABLE", "no manager of yours received this unpinned launch; nothing was launched", { ...at, remedy: "run the spawn again, or pin one manager with --on <instance> from cotal ps" });
|
|
657
|
+
}
|
|
658
|
+
/** Why no manager answered an unpinned launch's describe, so the launch was never sent. This root's
|
|
659
|
+
* own stack says why when it records one, in the words `ps` uses for the same silence. */
|
|
660
|
+
function unansweredClassLaunch(t, at) {
|
|
661
|
+
const refused = (message, remedy) => new CommandFailure("refused", "TARGET_UNAVAILABLE", `${message}, so the launch was not sent and nothing was launched`, { ...at, remedy });
|
|
662
|
+
if (t.root !== undefined && stackManagerStarting(t.root, t.space))
|
|
663
|
+
return refused("the stack's manager is starting", "run the spawn again once cotal up reports the manager started");
|
|
664
|
+
if (t.root !== undefined && stackManagerAbsent(t.root, t.space))
|
|
665
|
+
return refused("no manager is running for this space", "start the stack's manager with bare cotal up; a stack started with --no-manager has none");
|
|
666
|
+
const pid = t.root === undefined ? undefined : runningStackManagerPid(t.root, t.space);
|
|
667
|
+
if (pid !== undefined)
|
|
668
|
+
return refused(`this space's stack manager (pid ${pid}) is running but did not answer`, `if it stays unresponsive, end that process with kill -KILL ${pid}; then bare cotal up starts the manager again`);
|
|
669
|
+
return refused("no manager answered", "cotal ps shows which managers answer; run the spawn again once one does");
|
|
670
|
+
}
|
|
671
|
+
/** What the registered managers say about unpinned launches. `noApplication` holds when one answered
|
|
672
|
+
* and each one that answered says it runs agents but takes no unpinned launch; `gone` lists the
|
|
673
|
+
* managers skipped because the broker affirms nothing subscribed on their rail. Status has no
|
|
674
|
+
* scatter route, so each is read pinned to its instance, racing the rail probe: whichever settles
|
|
675
|
+
* first stops the other, so neither a live manager nor a gone one is waited out. */
|
|
676
|
+
async function classLaunchCensus(flags, t) {
|
|
677
|
+
const gone = [];
|
|
678
|
+
const managers = [];
|
|
679
|
+
for (const instanceId of await liveManagerIds(t.space, t.server, t.auth)) {
|
|
680
|
+
const pinned = await resolveControlTarget(flags, "control-caller-privileged", instanceId, { onRefusal: "throw" });
|
|
681
|
+
const settled = new AbortController();
|
|
682
|
+
const status = await Promise.race([
|
|
683
|
+
managerRailGone(pinned.space, pinned.server, pinned.auth, instanceId, settled.signal).then((isGone) => isGone ? undefined : new Promise(() => { })),
|
|
684
|
+
askManager(pinned.space, pinned.server, "managerStatus", undefined, pinned.auth, "owner", 5_000, { instanceId, signal: settled.signal }),
|
|
685
|
+
]).finally(() => settled.abort());
|
|
686
|
+
if (status === undefined) {
|
|
687
|
+
gone.push(instanceId);
|
|
688
|
+
continue;
|
|
689
|
+
}
|
|
690
|
+
const data = status.data;
|
|
691
|
+
if (!status.ok || data?.classSpawn !== false || data.execution === "none")
|
|
692
|
+
return { noApplication: false, gone, managers };
|
|
693
|
+
managers.push(managerAt(instanceId, data.host));
|
|
694
|
+
}
|
|
695
|
+
return { noApplication: managers.length > 0, gone, managers };
|
|
696
|
+
}
|
|
697
|
+
/** A manager as a refusal names it: its instance id, and the host its own status reports. */
|
|
698
|
+
const managerAt = (instanceId, host) => typeof host === "string" && host ? `manager ${instanceId} on host ${host}` : `manager ${instanceId}`;
|
|
699
|
+
/** {@link managerAt} for one manager, read pinned to it. A seat (`flags` undefined) reads with its
|
|
700
|
+
* own caller, and a status that cannot be read leaves the host out. */
|
|
701
|
+
async function managerNamed(flags, t, instanceId) {
|
|
702
|
+
try {
|
|
703
|
+
const pinned = flags ? await resolveControlTarget(flags, "control-caller-privileged", instanceId, { onRefusal: "throw" }) : t;
|
|
704
|
+
const status = await askManager(pinned.space, pinned.server, "managerStatus", undefined, pinned.auth, "owner", 5_000, { instanceId });
|
|
705
|
+
return managerAt(instanceId, status.ok ? status.data?.host : undefined);
|
|
706
|
+
}
|
|
707
|
+
catch {
|
|
708
|
+
return managerAt(instanceId, undefined);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
/** The `cotal ext add` that installs connector `name`, quoted for a refusal. */
|
|
712
|
+
const extAddFor = (name) => OFFICIAL_CONNECTORS[name] ? `\`cotal ext add ${OFFICIAL_CONNECTORS[name]}\`` : `\`cotal ext add <npm-package>\` for "${name}"`;
|
|
541
713
|
/** The harness the manager's `spawn` resolves for this persona, read with the same fields `start` sends. */
|
|
542
714
|
async function launchAgentOrExit(t, on, fields) {
|
|
543
715
|
const reply = await askManager(t.space, t.server, "resolveAgent", fields, t.auth, "owner", undefined, { instanceId: on });
|
|
@@ -558,13 +730,13 @@ async function carryTranscriptOrExit(flags, on, id, agent) {
|
|
|
558
730
|
found = registry.resolve("connector", agent).resumeTranscript?.find(id, process.env);
|
|
559
731
|
}
|
|
560
732
|
catch (e) {
|
|
561
|
-
|
|
733
|
+
stderrLine("✗ ", `resume: ${e.message}`, c.red);
|
|
562
734
|
process.exit(1);
|
|
563
735
|
}
|
|
564
736
|
if (found === undefined)
|
|
565
737
|
return undefined;
|
|
566
738
|
if (on === undefined) {
|
|
567
|
-
|
|
739
|
+
stderrLine("✗ ", `resume: session ${id} is held on this host, and carrying it needs one manager instance; pass --on <instance>`, c.red);
|
|
568
740
|
process.exit(1);
|
|
569
741
|
}
|
|
570
742
|
const bytes = readFileSync(found.path);
|
|
@@ -604,20 +776,21 @@ async function transferWriterOrExit(flags, t, instanceId, hex) {
|
|
|
604
776
|
return { bearer: view.bearer, sentinelCreds: view.sentinelCreds, tls: conn.tls };
|
|
605
777
|
}
|
|
606
778
|
catch (e) {
|
|
607
|
-
|
|
779
|
+
stderrLine("✗ ", `resume: ${e.message}`, c.red);
|
|
608
780
|
process.exit(1);
|
|
609
781
|
}
|
|
610
782
|
}
|
|
611
783
|
if (t.mode !== "auth" || !t.spaceAuth) {
|
|
612
|
-
|
|
784
|
+
stderrLine("✗ ", "resume: carrying a session mints a transfer writer from this mesh's signing seed, and this host holds none for it (an off-registry connection)", c.red);
|
|
613
785
|
process.exit(1);
|
|
614
786
|
}
|
|
615
787
|
return { creds: await mintCreds(t.spaceAuth, newIdentity(), "transfer-writer", { transferWriter: { instanceId, hex } }), tls: t.auth.tls };
|
|
616
788
|
}
|
|
617
789
|
/**
|
|
618
|
-
* `cotal spawn [<persona>] [--file <persona-file>]`
|
|
619
|
-
*
|
|
620
|
-
*
|
|
790
|
+
* `cotal spawn [<persona>] [--file <persona-file>]` runs the native application in this terminal.
|
|
791
|
+
* `--detach` launches it through a manager and returns after readiness, and `--on <instance>`
|
|
792
|
+
* launches it through that manager and attaches to its allocated incarnation. File validation
|
|
793
|
+
* belongs to the execution host.
|
|
621
794
|
*
|
|
622
795
|
* The launch recipe is the connector's `buildLaunch` (the single source of truth,
|
|
623
796
|
* shared with the manager); only *how the spec runs* differs — foreground exec
|
|
@@ -670,25 +843,28 @@ export async function spawn(args) {
|
|
|
670
843
|
scrubEnrollmentEnv(process.env);
|
|
671
844
|
}
|
|
672
845
|
let redeemedEnrollment;
|
|
846
|
+
let handoffManagerInstanceId;
|
|
673
847
|
if (handoffText !== undefined) {
|
|
674
848
|
const refusal = enrollmentUrl ? `${MANAGED_HANDOFF_FILE_ENV} cannot be combined with ${ENROLLMENT_URL_ENV}/${ENROLLMENT_FILE_ENV}`
|
|
675
849
|
: values.detach || values.file || values.creds ? `${MANAGED_HANDOFF_FILE_ENV} applies only to a foreground persona spawn without --creds`
|
|
676
850
|
: !values.space || !values.name || !values["expect-owner"] || !values["expect-lifecycle-uid"]
|
|
677
851
|
? `${MANAGED_HANDOFF_FILE_ENV} requires --space, --name, --expect-owner and --expect-lifecycle-uid`
|
|
678
852
|
: !values.config ? `${MANAGED_HANDOFF_FILE_ENV} requires --config <persona-file>`
|
|
679
|
-
:
|
|
853
|
+
: !process.env.COTAL_MANAGER_INSTANCE?.trim() ? `${MANAGED_HANDOFF_FILE_ENV} requires COTAL_MANAGER_INSTANCE`
|
|
854
|
+
: undefined;
|
|
680
855
|
if (refusal) {
|
|
681
|
-
|
|
856
|
+
stderrLine("✗ ", `${refusal}`, c.red);
|
|
682
857
|
process.exit(1);
|
|
683
858
|
}
|
|
684
859
|
try {
|
|
685
860
|
loadLaunchPersonaFile(resolvePath(values.config));
|
|
686
861
|
}
|
|
687
862
|
catch (e) {
|
|
688
|
-
|
|
863
|
+
stderrLine("✗ ", `cannot load the managed handoff persona: ${e.message}`, c.red);
|
|
689
864
|
process.exit(1);
|
|
690
865
|
}
|
|
691
866
|
try {
|
|
867
|
+
handoffManagerInstanceId = assertLifecycleToken(process.env.COTAL_MANAGER_INSTANCE.trim(), "COTAL_MANAGER_INSTANCE");
|
|
692
868
|
const handoff = parseManagedLifecycleHandoff(handoffText, {
|
|
693
869
|
space: values.space, owner: values["expect-owner"], actor: values.name, lifecycleUid: values["expect-lifecycle-uid"],
|
|
694
870
|
});
|
|
@@ -711,37 +887,48 @@ export async function spawn(args) {
|
|
|
711
887
|
await registerEnrollmentMesh(stock, resolvePath(values.config, ".."), HANDOFF_REFUSALS);
|
|
712
888
|
}
|
|
713
889
|
catch (e) {
|
|
714
|
-
|
|
890
|
+
stderrLine("✗ ", `${e.message}`, c.red);
|
|
715
891
|
process.exit(1);
|
|
716
892
|
}
|
|
717
893
|
}
|
|
718
894
|
if (enrollmentUrl && values.detach) {
|
|
719
|
-
|
|
895
|
+
stderrLine("✗ ", `${ENROLLMENT_URL_ENV}/${ENROLLMENT_FILE_ENV} apply only to a foreground persona spawn`, c.red);
|
|
720
896
|
process.exit(1);
|
|
721
897
|
}
|
|
722
898
|
if (enrollmentUrl && !values.space) {
|
|
723
|
-
|
|
899
|
+
stderrLine("✗ ", `${ENROLLMENT_URL_ENV}/${ENROLLMENT_FILE_ENV} require --space <s>`, c.red);
|
|
724
900
|
process.exit(1);
|
|
725
901
|
}
|
|
726
|
-
|
|
902
|
+
// On a terminal, a spawn that names no launch mode, persona file or terminal-only option asks
|
|
903
|
+
// where it runs when several of your managers are live. This terminal is the default; a manager
|
|
904
|
+
// launches it and attaches here, as --on does.
|
|
905
|
+
if (handoffText === undefined && enrollmentUrl === undefined && values.foreground !== true && !spawnUsesManager(values) && values.file === undefined
|
|
906
|
+
&& values.config === undefined && !values["live-only"] && !values.json && !values.plain && canPrompt()) {
|
|
907
|
+
const place = await askSpawnPlace(values, process.argv.slice(2));
|
|
908
|
+
if (place === null)
|
|
909
|
+
process.exit(0);
|
|
910
|
+
if (place)
|
|
911
|
+
values.on = place.instanceId;
|
|
912
|
+
}
|
|
913
|
+
const direct = values.foreground === true || handoffText !== undefined || enrollmentUrl !== undefined || !spawnUsesManager(values);
|
|
727
914
|
const enrollmentBootstrap = Boolean(enrollmentUrl && values.space && !findMesh(values.space));
|
|
728
915
|
if (enrollmentBootstrap) {
|
|
729
916
|
if (!values.config || (!values.config.includes("/") && !values.config.includes("\\") && !values.config.endsWith(".md"))) {
|
|
730
|
-
|
|
917
|
+
stderrLine("✗ ", "enrollment bootstrap needs --config <persona-file>; no remote persona catalog exists on this machine yet", c.red);
|
|
731
918
|
process.exit(1);
|
|
732
919
|
}
|
|
733
920
|
try {
|
|
734
921
|
loadLaunchPersonaFile(resolvePath(values.config));
|
|
735
922
|
}
|
|
736
923
|
catch (e) {
|
|
737
|
-
|
|
924
|
+
stderrLine("✗ ", `cannot load the enrollment bootstrap persona: ${e.message}`, c.red);
|
|
738
925
|
process.exit(1);
|
|
739
926
|
}
|
|
740
927
|
}
|
|
741
928
|
// Explicit files retain the execution host's path semantics. A manager pin is meaningful for
|
|
742
929
|
// either managed persona spelling; direct execution has no manager placement to select.
|
|
743
930
|
if (values.on !== undefined && direct) {
|
|
744
|
-
|
|
931
|
+
stderrLine("✗ ", "--on pins a managed imperative launch; a spawn in this terminal does not take that manager selector", c.red);
|
|
745
932
|
process.exit(1);
|
|
746
933
|
}
|
|
747
934
|
// `--resume ""` / `--resume=` means the operator asked to resume but named no session — fail loud
|
|
@@ -773,7 +960,7 @@ export async function spawn(args) {
|
|
|
773
960
|
// grants publish on the channel the connector names. Both are required, which is what stops a
|
|
774
961
|
// hand-written grant from turning events on by itself.
|
|
775
962
|
if (values.events && values["no-events"]) {
|
|
776
|
-
|
|
963
|
+
stderrLine("✗ ", "--events and --no-events are mutually exclusive", c.red);
|
|
777
964
|
process.exit(1);
|
|
778
965
|
}
|
|
779
966
|
// #373: the detached path sends the bit ONLY when the operator chose it. `--events` gives
|
|
@@ -781,15 +968,14 @@ export async function spawn(args) {
|
|
|
781
968
|
// an explicit true from a non-admin caller as operator reach and serves an omission unarmed
|
|
782
969
|
// with a notice, so an unconditional default-true would be refused for an ordinary actor.
|
|
783
970
|
const events = values.events ? true : values["no-events"] ? false : undefined;
|
|
784
|
-
//
|
|
785
|
-
// execution keeps
|
|
971
|
+
// A manager runs it only with --detach or --on, and the persona then stays on the manager's
|
|
972
|
+
// execution host. Every other spawn keeps the native custody path below, in this terminal.
|
|
786
973
|
if (!direct)
|
|
787
974
|
return launchManagedPersona(values, positionals, events, cliLaunchOptions);
|
|
788
|
-
console.error(renderReport({ sections: [{ title: "Direct application", blocks: [{ kind: "lines", lines: ["This is native foreground execution, not a detachable Cotal view.", { text: "Native exit, Ctrl-C or terminal loss may end this process. No crash or reboot survival is promised.", tone: "hint" }] }] }] }, "rich", terminalWidth(process.stderr)));
|
|
789
975
|
// `--creds` names a CONTROL-CALLER credential (reach an off-registry manager) — meaningless for
|
|
790
976
|
// a foreground launch, which provisions the agent's own creds. Fail loud, never ignore.
|
|
791
977
|
if (values.creds) {
|
|
792
|
-
|
|
978
|
+
stderrLine("✗ ", "--creds is only valid with --detach (it authenticates the manager control call)", c.red);
|
|
793
979
|
process.exit(1);
|
|
794
980
|
}
|
|
795
981
|
// An enrollment may bootstrap the stock remote user-mesh record before normal target resolution.
|
|
@@ -813,7 +999,7 @@ export async function spawn(args) {
|
|
|
813
999
|
await registerEnrollmentMesh(redeemedEnrollment.stock, resolvePath(values.config, ".."));
|
|
814
1000
|
}
|
|
815
1001
|
catch (e) {
|
|
816
|
-
|
|
1002
|
+
stderrLine("✗ ", `${e.message}`, c.red);
|
|
817
1003
|
process.exit(1);
|
|
818
1004
|
}
|
|
819
1005
|
}
|
|
@@ -824,11 +1010,11 @@ export async function spawn(args) {
|
|
|
824
1010
|
const target = handoffText === undefined
|
|
825
1011
|
? await resolveTargetOrExit({ server: values.server, space: values.space })
|
|
826
1012
|
: await resolveTargetOrThrow({ server: values.server, space: values.space }).catch(() => {
|
|
827
|
-
|
|
1013
|
+
stderrLine("✗ ", `${HANDOFF_REFUSALS.target}`, c.red);
|
|
828
1014
|
process.exit(1);
|
|
829
1015
|
});
|
|
830
1016
|
if (handoffText !== undefined && !(target.mode === "user" && target.userAuth?.remote)) {
|
|
831
|
-
|
|
1017
|
+
stderrLine("✗ ", "the managed handoff's space is registered here as a local mesh, so it cannot host a managed handoff", c.red);
|
|
832
1018
|
process.exit(1);
|
|
833
1019
|
}
|
|
834
1020
|
let policy;
|
|
@@ -836,14 +1022,14 @@ export async function spawn(args) {
|
|
|
836
1022
|
policy = await refreshRegistrationPolicy(target);
|
|
837
1023
|
}
|
|
838
1024
|
catch (e) {
|
|
839
|
-
|
|
1025
|
+
stderrLine("✗ ", `${handoffText === undefined ? e.message : HANDOFF_REFUSALS.policy}`, c.red);
|
|
840
1026
|
process.exit(1);
|
|
841
1027
|
}
|
|
842
1028
|
const eventsRequired = policy?.events === "required";
|
|
843
1029
|
// A handoff's space is a value from the document, so its policy refusals name the field instead.
|
|
844
1030
|
const policySpace = handoffText === undefined ? `space "${target.space}"` : "the managed handoff's space";
|
|
845
1031
|
if (eventsRequired && values["no-events"]) {
|
|
846
|
-
|
|
1032
|
+
stderrLine("✗ ", `${policySpace} requires the event plane by registration policy; --no-events is not allowed`, c.red);
|
|
847
1033
|
process.exit(1);
|
|
848
1034
|
}
|
|
849
1035
|
// Foreground is the operator's own in-process launch (no typed door, no epAdminReach) and is
|
|
@@ -865,31 +1051,16 @@ export async function spawn(args) {
|
|
|
865
1051
|
if (e instanceof PersonaSourceError)
|
|
866
1052
|
throw new CommandFailure("refused", "SCHEMA_INVALID", e.message, { target: { space, path }, remedy: "use cotal team deploy <file> for a Mesh manifest; use a native persona file for spawn" });
|
|
867
1053
|
const code = e.code;
|
|
868
|
-
const fromEnv = personaFrom === undefined ? "" : ` from ${personaFrom}`;
|
|
869
1054
|
// The not-found text names the mesh's space and server, which for a handoff are its values.
|
|
870
1055
|
if (handoffText !== undefined) {
|
|
871
|
-
|
|
872
|
-
}
|
|
873
|
-
else if (code === "ENOENT" && path !== join(target.personaRoot, `${ref}.md`)) {
|
|
874
|
-
// A path reference opened that one file and never read the catalog, so name the file.
|
|
875
|
-
console.error(c.red(`✗ no persona "${ref}"${fromEnv} - ${path} not found`));
|
|
1056
|
+
stderrLine("✗ ", `cannot load the managed handoff persona: ${e.message}`, c.red);
|
|
876
1057
|
}
|
|
877
1058
|
else if (code === "ENOENT") {
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
// had looked — so when setup seeded a cwd-derived root and spawn read the resolved mesh's,
|
|
881
|
-
// the message survived running the exact command it named and pointed at nothing to check.
|
|
882
|
-
// Name the absolute directory checked and the mesh that root came from: the two facts that
|
|
883
|
-
// make the disagreement visible in one read.
|
|
884
|
-
const where = `${target.personaRoot} (mesh "${target.space}" at ${target.server}${target.source === "current" ? ", your current mesh" : target.source === "registry" ? ", the only mesh running" : ""})`;
|
|
885
|
-
const fix = defaultPersonaFix(target);
|
|
886
|
-
const write = fix.cwd ? `run \`${fix.command}\` in ${fix.cwd} to write one` : `create one with \`${fix.command}\``;
|
|
887
|
-
console.error(c.red(ref === "default" && personaFrom === undefined
|
|
888
|
-
? `✗ no default persona in ${where} - ${write}, or name a persona: \`cotal spawn <name>\``
|
|
889
|
-
: `✗ no persona "${ref}"${fromEnv} in ${where} - pass a catalog name, or use \`--config <path>\` for a file elsewhere`));
|
|
1059
|
+
const missing = missingPersona(target, ref, personaFrom, path);
|
|
1060
|
+
throw new CommandFailure("refused", "TARGET_NOT_FOUND", missing.message, { target: { space, path }, remedy: missing.remedy });
|
|
890
1061
|
}
|
|
891
1062
|
else {
|
|
892
|
-
|
|
1063
|
+
stderrLine("✗ ", `${e.message}`, c.red);
|
|
893
1064
|
}
|
|
894
1065
|
process.exit(1);
|
|
895
1066
|
}
|
|
@@ -907,7 +1078,7 @@ export async function spawn(args) {
|
|
|
907
1078
|
// Opaque connector options: `--opt` flags win per key over the persona's `launchOptions:`.
|
|
908
1079
|
const launchOptions = mergeLaunchOptions(def.launchOptions, cliLaunchOptions);
|
|
909
1080
|
if (redeemedEnrollment && redeemedEnrollment.bundle.actor !== requested) {
|
|
910
|
-
|
|
1081
|
+
stderrLine("✗ ", `the enrollment is for actor "${redeemedEnrollment.bundle.actor}" but this spawn names "${requested}"`, c.red);
|
|
911
1082
|
process.exit(1);
|
|
912
1083
|
}
|
|
913
1084
|
// #867: same door as the detached path — the effective identity (flag or file) must be mintable
|
|
@@ -926,12 +1097,12 @@ export async function spawn(args) {
|
|
|
926
1097
|
launchOptions,
|
|
927
1098
|
});
|
|
928
1099
|
if (refusal) {
|
|
929
|
-
|
|
1100
|
+
stderrLine("✗ ", `${refusal}`, c.red);
|
|
930
1101
|
process.exit(1);
|
|
931
1102
|
}
|
|
932
1103
|
}
|
|
933
1104
|
catch (e) {
|
|
934
|
-
|
|
1105
|
+
stderrLine("✗ ", `${e.message}`, c.red);
|
|
935
1106
|
process.exit(1);
|
|
936
1107
|
}
|
|
937
1108
|
// Preflight: fail with one sentence if the mesh is down or won't take our creds, instead of
|
|
@@ -940,7 +1111,7 @@ export async function spawn(args) {
|
|
|
940
1111
|
await preflightOrExit(target);
|
|
941
1112
|
else
|
|
942
1113
|
await preflightOrThrow(target).catch(() => {
|
|
943
|
-
|
|
1114
|
+
stderrLine("✗ ", `${HANDOFF_REFUSALS.preflight}`, c.red);
|
|
944
1115
|
process.exit(1);
|
|
945
1116
|
});
|
|
946
1117
|
// User mode allocates during guarded provisioning below, without a static operator credential.
|
|
@@ -958,7 +1129,9 @@ export async function spawn(args) {
|
|
|
958
1129
|
await materializeExtension({ kind: "connector", name: agentType });
|
|
959
1130
|
}
|
|
960
1131
|
catch (e) {
|
|
961
|
-
|
|
1132
|
+
if (!connectorListed(agentType))
|
|
1133
|
+
throw missingConnector(agentType, { space, path });
|
|
1134
|
+
stderrLine("✗ ", `${e.message}`, c.red);
|
|
962
1135
|
process.exit(1);
|
|
963
1136
|
}
|
|
964
1137
|
let connector;
|
|
@@ -966,15 +1139,15 @@ export async function spawn(args) {
|
|
|
966
1139
|
connector = registry.resolve("connector", agentType);
|
|
967
1140
|
}
|
|
968
1141
|
catch (e) {
|
|
969
|
-
|
|
1142
|
+
stderrLine("✗ ", `${e.message}`, c.red);
|
|
970
1143
|
process.exit(1);
|
|
971
1144
|
}
|
|
972
1145
|
if (variant && !connector.supportsModelVariant) {
|
|
973
|
-
|
|
1146
|
+
stderrLine("✗ ", `${agentType} connector does not support model variants (variant)`, c.red);
|
|
974
1147
|
process.exit(1);
|
|
975
1148
|
}
|
|
976
1149
|
if (values.prompt !== undefined && !connector.supportsPrompt) {
|
|
977
|
-
|
|
1150
|
+
stderrLine("✗ ", `${agentType} connector does not support an initial prompt (prompt)`, c.red);
|
|
978
1151
|
process.exit(1);
|
|
979
1152
|
}
|
|
980
1153
|
// Which of the operator's personal MCP servers to share with this agent: declared in the cotal
|
|
@@ -1017,7 +1190,7 @@ export async function spawn(args) {
|
|
|
1017
1190
|
allowSubscribe = resolveReadAcl(subscribe ?? [], splitFlag(values["allow-subscribe"]) ?? def.allowSubscribe);
|
|
1018
1191
|
}
|
|
1019
1192
|
catch (e) {
|
|
1020
|
-
|
|
1193
|
+
stderrLine("✗ ", `${e.message}`, c.red);
|
|
1021
1194
|
process.exit(1);
|
|
1022
1195
|
}
|
|
1023
1196
|
let allowPublish = splitFlag(values["allow-publish"]) ?? def.allowPublish;
|
|
@@ -1040,10 +1213,12 @@ export async function spawn(args) {
|
|
|
1040
1213
|
? target.userAuth.endpoints?.agentProvisioningUrl
|
|
1041
1214
|
: undefined;
|
|
1042
1215
|
if (target.mode === "user" && target.userAuth?.remote && !remoteProvisioningUrl && !enrollmentUrl && !redeemedEnrollment) {
|
|
1043
|
-
|
|
1044
|
-
console.error(c.dim(` a user-mode agent's credentials are granted where the mesh's signer lives; ask the mesh operator to advertise one (\`cotal up --agent-provisioning-url …\`),
|
|
1216
|
+
stderrLine("✗ ", `mesh "${target.space}" runs elsewhere and advertises no agent-provisioning endpoint, so agents cannot be provisioned from this machine`, c.red);
|
|
1217
|
+
console.error(c.dim(` a user-mode agent's credentials are granted where the mesh's signer lives; ask the mesh operator to advertise one (\`cotal up --agent-provisioning-url …\`), run the agent there, or add -d to launch it through one of your managers`));
|
|
1045
1218
|
process.exit(1);
|
|
1046
1219
|
}
|
|
1220
|
+
// Said once every check above has passed, so a refusal is never read as a launch that started.
|
|
1221
|
+
console.error(renderReport({ sections: [{ title: "Direct application", blocks: [{ kind: "lines", lines: ["This is native foreground execution, not a detachable Cotal view.", { text: "Native exit, Ctrl-C or terminal loss may end this process. No crash or reboot survival is promised.", tone: "hint" }] }] }] }, "rich", terminalWidth(process.stderr)));
|
|
1047
1222
|
// Auth mode provisions the identity + writes its creds to disk BEFORE the connector validates the
|
|
1048
1223
|
// launch (e.g. `buildLaunch` throws on a rejected `--opt`) and before the child execs. The SAME
|
|
1049
1224
|
// retirement serves a failed provisioning or launch (rollback) and the normal foreground
|
|
@@ -1068,7 +1243,7 @@ export async function spawn(args) {
|
|
|
1068
1243
|
await attemptCleanup(failed, "broker teardown", () => mintCreds(auth, newIdentity(), "deprovisioner", { deprovisionTarget: { principal: targetId, lifecycleUid } })
|
|
1069
1244
|
.then((dc) => deprovisionAgent({ servers: server, space, targetId, lifecycleUid, creds: dc })));
|
|
1070
1245
|
if (failed.length)
|
|
1071
|
-
|
|
1246
|
+
stderrLine("✗ ", `cleaning up after ${name}: ${describeCleanupFailures(failed)}`, c.red);
|
|
1072
1247
|
else
|
|
1073
1248
|
console.error(` ↩ retired creds for ${name} (${why})`);
|
|
1074
1249
|
};
|
|
@@ -1076,7 +1251,7 @@ export async function spawn(args) {
|
|
|
1076
1251
|
if (!redeemedEnrollment) {
|
|
1077
1252
|
// The record alone decides this refusal, and the redemption below spends the enrollment.
|
|
1078
1253
|
if (!target.userAuth.endpoints?.url) {
|
|
1079
|
-
|
|
1254
|
+
stderrLine("✗ ", `${noExchangeEndpoint(space)}`, c.red);
|
|
1080
1255
|
process.exit(1);
|
|
1081
1256
|
}
|
|
1082
1257
|
try {
|
|
@@ -1087,21 +1262,21 @@ export async function spawn(args) {
|
|
|
1087
1262
|
redeemedEnrollment = checkEnrollmentBundle(body, name);
|
|
1088
1263
|
}
|
|
1089
1264
|
catch (e) {
|
|
1090
|
-
|
|
1265
|
+
stderrLine("✗ ", `${e.message}`, c.red);
|
|
1091
1266
|
process.exit(1);
|
|
1092
1267
|
}
|
|
1093
1268
|
}
|
|
1094
1269
|
const enrolled = redeemedEnrollment.bundle;
|
|
1095
1270
|
if (enrolled.space !== space) {
|
|
1096
|
-
|
|
1271
|
+
stderrLine("✗ ", `the enrollment is for space "${enrolled.space}" but this spawn targets "${space}"`, c.red);
|
|
1097
1272
|
process.exit(1);
|
|
1098
1273
|
}
|
|
1099
1274
|
if (enrolled.idp.url !== target.userAuth.idp.url || enrolled.idp.issuer !== target.userAuth.idp.issuer || enrolled.idp.audience !== target.userAuth.idp.audience) {
|
|
1100
|
-
|
|
1275
|
+
stderrLine("✗ ", "the enrollment's IdP pins do not match the registered mesh", c.red);
|
|
1101
1276
|
process.exit(1);
|
|
1102
1277
|
}
|
|
1103
1278
|
if (target.userAuth.endpoints?.url !== enrolled.authServiceUrl) {
|
|
1104
|
-
|
|
1279
|
+
stderrLine("✗ ", "the enrollment's authServiceUrl does not match the registered mesh exchange", c.red);
|
|
1105
1280
|
process.exit(1);
|
|
1106
1281
|
}
|
|
1107
1282
|
const remote = await provisionRemoteUserForeground(target, name, { body: enrolled, exchangeUrl: enrolled.authServiceUrl }, handoffText === undefined ? undefined : HANDOFF_REFUSALS);
|
|
@@ -1266,6 +1441,7 @@ export async function spawn(args) {
|
|
|
1266
1441
|
// construction because its write-ahead log had nowhere to live that a later start would look.
|
|
1267
1442
|
workspaceRoot: target.root,
|
|
1268
1443
|
});
|
|
1444
|
+
applyHandoffManagerInstance(spec, handoffManagerInstanceId);
|
|
1269
1445
|
artifacts = spec.artifacts;
|
|
1270
1446
|
scrubEnrollmentEnv(spec.env);
|
|
1271
1447
|
// What happens next belongs to the CONNECTOR: naming one harness's first-run gate for all of
|
|
@@ -1300,7 +1476,7 @@ export async function spawn(args) {
|
|
|
1300
1476
|
// other's mode): revoke the user-mode actor grant AND roll back the static-auth creds + footprint,
|
|
1301
1477
|
// before rethrowing, so no standing grant survives a spawn that never started.
|
|
1302
1478
|
if (userCleanup)
|
|
1303
|
-
await userCleanup().catch((err) =>
|
|
1479
|
+
await userCleanup().catch((err) => stderrLine("✗ ", `cleaning up after ${name}: ${err.message}`, c.red));
|
|
1304
1480
|
await retireProvision("launch build failed");
|
|
1305
1481
|
// The launch's private files (core launch-artifacts) go too: no child will read them.
|
|
1306
1482
|
discardLaunchArtifacts(artifacts);
|
|
@@ -1310,7 +1486,7 @@ export async function spawn(args) {
|
|
|
1310
1486
|
child.on("error", (e) => {
|
|
1311
1487
|
// The exec never started, so the just-provisioned static-auth identity is orphaned — roll it
|
|
1312
1488
|
// back. (User-mode revoke runs unconditionally once this promise settles, below.)
|
|
1313
|
-
|
|
1489
|
+
stderrLine("✗ ", `failed to launch ${spec.command}: ${e.message}`, (line) => line);
|
|
1314
1490
|
void retireProvision("exec failed").finally(() => {
|
|
1315
1491
|
process.exitCode = 1;
|
|
1316
1492
|
resolve();
|
|
@@ -1331,7 +1507,7 @@ export async function spawn(args) {
|
|
|
1331
1507
|
// (a SIGKILLed CLI can't run this; its retained grant needs operator recovery), loud
|
|
1332
1508
|
// on failure, never blocking the exit code already set above.
|
|
1333
1509
|
if (userCleanup)
|
|
1334
|
-
await userCleanup().catch((e) =>
|
|
1510
|
+
await userCleanup().catch((e) => stderrLine("✗ ", `cleaning up after ${name}: ${e.message}`, c.red));
|
|
1335
1511
|
// The child has exited or never started, so nothing reads the launch's private files any more
|
|
1336
1512
|
// (core launch-artifacts). A SIGKILLed CLI cannot run this; the child's watcher removes those.
|
|
1337
1513
|
discardLaunchArtifacts(spec.artifacts);
|
|
@@ -1420,7 +1596,7 @@ async function provisionRemoteUserForeground(target, name, source, refusals) {
|
|
|
1420
1596
|
const store = workspaceSecretStore(target.root);
|
|
1421
1597
|
const composition = { injected: false, root: target.root };
|
|
1422
1598
|
const fail = (msg) => {
|
|
1423
|
-
|
|
1599
|
+
stderrLine("✗ ", `${msg}`, c.red);
|
|
1424
1600
|
process.exit(1);
|
|
1425
1601
|
};
|
|
1426
1602
|
// Resolved first, as by every consumer of the space's local state: each resolution migrates a
|
|
@@ -1556,7 +1732,7 @@ async function provisionUserForeground(target, name, ref, opts) {
|
|
|
1556
1732
|
const store = workspaceSecretStore(target.root);
|
|
1557
1733
|
const composition = { injected: false, root: target.root };
|
|
1558
1734
|
const fail = (msg) => {
|
|
1559
|
-
|
|
1735
|
+
stderrLine("✗ ", `${msg}`, c.red);
|
|
1560
1736
|
process.exit(1);
|
|
1561
1737
|
};
|
|
1562
1738
|
let provider;
|