@cotal-ai/cli 0.100.2 → 0.101.0
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 +263 -129
- 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 +344 -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 +135 -27
- 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 +130 -31
- 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 +45 -4
- package/dist/lib/manager-choice.d.ts.map +1 -1
- package/dist/lib/manager-choice.js +214 -24
- 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-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 +13 -1
- package/dist/lib/service-instances.d.ts.map +1 -1
- package/dist/lib/service-instances.js +56 -12
- package/dist/lib/service-instances.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 +51 -8
- package/dist/lib/service-process.d.ts.map +1 -1
- package/dist/lib/service-process.js +385 -48
- package/dist/lib/service-process.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,26 @@ 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 { managerPin, managersWithPersona, rerunOn } from "../lib/manager-choice.js";
|
|
17
|
+
import { listDeclaredChannels, listDeclaredRoles, listPersonaNames } from "../lib/personas.js";
|
|
18
|
+
import { personaCatalog } from "../lib/persona-files.js";
|
|
19
|
+
import { callerHarness, missingPersona, spawnPersona, spawnUsesManager } from "../lib/spawn-defaults.js";
|
|
18
20
|
import { spawnLaunchPreview } from "./spawn-preview.js";
|
|
19
21
|
import { protectedCredentialReference, readLocalRecordSource } from "../lib/protected-records.js";
|
|
20
22
|
import { attachSeat } from "./agents.js";
|
|
21
23
|
import { extensionNames, materializeExtension } from "../ext-loader.js";
|
|
22
|
-
import { claimManagedHandoff, holdsManagedHandoff } from "../managed-handoff.js";
|
|
24
|
+
import { claimManagedHandoff, holdsManagedHandoff, managedHandoffRefusal } from "../managed-handoff.js";
|
|
23
25
|
import { checkDialPolicy, checkEnforcement, checkServer, checkUserBundle, persistRemoteUserEntry, probeEnforcement, tlsIntent, userExchangeIssuer, verifyUserExchange, } from "./meshes-add.js";
|
|
24
26
|
const ENROLLMENT_URL_ENV = "COTAL_ENROLLMENT_URL";
|
|
25
27
|
const ENROLLMENT_FILE_ENV = "COTAL_ENROLLMENT_FILE";
|
|
@@ -64,6 +66,14 @@ export function scrubEnrollmentEnv(env) {
|
|
|
64
66
|
delete env[key];
|
|
65
67
|
}
|
|
66
68
|
}
|
|
69
|
+
/** Carry the launching manager's validated `COTAL_MANAGER_INSTANCE` onto a managed-handoff
|
|
70
|
+
* child's connector launch spec (`spawnProcess` passes `env: spec.env` only, and `launchEnv`
|
|
71
|
+
* does not forward `COTAL_MANAGER_INSTANCE` from `process.env`). */
|
|
72
|
+
export function applyHandoffManagerInstance(spec, handoffManagerInstanceId) {
|
|
73
|
+
if (handoffManagerInstanceId !== undefined) {
|
|
74
|
+
spec.env = { ...spec.env, COTAL_MANAGER_INSTANCE: handoffManagerInstanceId };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
67
77
|
export function checkEnrollmentBundle(raw, actor) {
|
|
68
78
|
const material = checkRemoteAgentMaterial(raw, actor);
|
|
69
79
|
if (!material.ok)
|
|
@@ -170,8 +180,6 @@ async function registerEnrollmentMesh(stock, root, refusals) {
|
|
|
170
180
|
* personas, not the cwd's. */
|
|
171
181
|
export function spawnComplete(argv) {
|
|
172
182
|
const flag = completingFlagValue(argv, spawnFlags);
|
|
173
|
-
if (flag?.name === "space")
|
|
174
|
-
return { items: loadMeshes().map((m) => ({ value: m.space })), directive: "nofiles" };
|
|
175
183
|
if (flag?.name === "agent" || flag?.name === "harness")
|
|
176
184
|
return { items: registry.all("connector").map((c) => ({ value: c.name })), directive: "nofiles" };
|
|
177
185
|
if (flag?.name === "role")
|
|
@@ -180,12 +188,7 @@ export function spawnComplete(argv) {
|
|
|
180
188
|
const current = argv[argv.length - 1] ?? "";
|
|
181
189
|
if (current.includes("/") || current.includes("\\") || current.endsWith(".md"))
|
|
182
190
|
return { items: [], directive: "default" };
|
|
183
|
-
|
|
184
|
-
return { items: personaItems(argv), directive: "nofiles" };
|
|
185
|
-
}
|
|
186
|
-
catch {
|
|
187
|
-
return { items: [], directive: "nofiles" };
|
|
188
|
-
}
|
|
191
|
+
return { items: personaItems(argv), directive: "nofiles" };
|
|
189
192
|
}
|
|
190
193
|
if (flag && ["subscribe", "allow-subscribe", "allow-publish"].includes(flag.name))
|
|
191
194
|
return { items: declaredFrom(argv, listDeclaredChannels).map((value) => ({ value, description: "declared channel" })), directive: "nofiles" };
|
|
@@ -195,24 +198,28 @@ export function spawnComplete(argv) {
|
|
|
195
198
|
return { items: ["pty", ...extensionNames("runtime")].filter((value, i, all) => all.indexOf(value) === i).map((value) => ({ value })), directive: "nofiles" };
|
|
196
199
|
const positionals = positionalsForCompletion(argv, spawnFlags);
|
|
197
200
|
// 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
|
-
}
|
|
201
|
+
if (positionals.length <= 1 && !hasCompletedFlagValue(argv, spawnFlags, "config") && !hasCompletedFlagValue(argv, spawnFlags, "file"))
|
|
202
|
+
return { items: personaItems(argv), directive: "nofiles" };
|
|
208
203
|
return { items: [], directive: "nofiles" };
|
|
209
204
|
}
|
|
205
|
+
/** The persona catalog root this spawn would read, resolved read-only as `persona show` resolves it,
|
|
206
|
+
* so a prepared space that is not started still lists its personas. */
|
|
207
|
+
const catalogRoot = (argv) => personaCatalog({
|
|
208
|
+
space: completedFlagValue(argv, spawnFlags, "space"),
|
|
209
|
+
server: completedFlagValue(argv, spawnFlags, "server"),
|
|
210
|
+
}).root;
|
|
211
|
+
/** The personas this spawn would launch from. With no single target (no mesh, or several with no
|
|
212
|
+
* `current`) it fails CLOSED and offers none; `cotal spawn --space <TAB>` still lists the running
|
|
213
|
+
* meshes. A catalog folder that cannot be read throws, so the completion fails and names it. */
|
|
210
214
|
function personaItems(argv) {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
|
|
215
|
+
let root;
|
|
216
|
+
try {
|
|
217
|
+
root = catalogRoot(argv);
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
return [];
|
|
221
|
+
}
|
|
222
|
+
return listPersonaNames(root).map((value) => ({ value }));
|
|
216
223
|
}
|
|
217
224
|
/** Channels/roles declared by the TARGET mesh's personas — the same root {@link personaItems}
|
|
218
225
|
* uses, so `--role`/`--subscribe` complete from the personas this spawn would actually launch
|
|
@@ -221,10 +228,7 @@ function personaItems(argv) {
|
|
|
221
228
|
* offer nothing rather than throw into the operator's shell. */
|
|
222
229
|
function declaredFrom(argv, list) {
|
|
223
230
|
try {
|
|
224
|
-
return list(
|
|
225
|
-
space: completedFlagValue(argv, spawnFlags, "space"),
|
|
226
|
-
server: completedFlagValue(argv, spawnFlags, "server"),
|
|
227
|
-
}).root);
|
|
231
|
+
return list(catalogRoot(argv));
|
|
228
232
|
}
|
|
229
233
|
catch {
|
|
230
234
|
return [];
|
|
@@ -265,40 +269,43 @@ async function provisionFreshForeground(requested, autoName, provision) {
|
|
|
265
269
|
}
|
|
266
270
|
}
|
|
267
271
|
}
|
|
268
|
-
/** `cotal spawn`'s grammar:
|
|
269
|
-
* and one positional persona or explicit persona file. Declared `as const` so the values cast
|
|
272
|
+
/** `cotal spawn`'s grammar: the application in this terminal by default, a manager's launch only
|
|
273
|
+
* with `--detach` or `--on`, and one positional persona or explicit persona file. Declared `as const` so the values cast
|
|
270
274
|
* below is compile-checked against exactly these specs. Foreground and detached parse the SAME
|
|
271
275
|
* flags — the old `spawn` vs `start` ability drift is structurally gone. */
|
|
272
276
|
export const spawnFlags = [
|
|
273
277
|
spaceFlag,
|
|
274
278
|
serverFlag,
|
|
275
|
-
{ ...credsFlag, description: "control-caller creds for an off-registry manager (
|
|
279
|
+
{ ...credsFlag, description: "control-caller creds for an off-registry manager (with --detach or --on)" },
|
|
276
280
|
...launchFlags,
|
|
277
281
|
{ 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" },
|
|
282
|
+
{ name: "foreground", type: "boolean", description: "run the application in this terminal, as a spawn without --detach or --on does; terminal exit may end it" },
|
|
283
|
+
{ name: "restarts", type: "string", value: "<n>", description: "with --detach or --on: maximum manager-supervised restarts in the selected restart window" },
|
|
280
284
|
{ name: "restart-window", type: "string", value: "<ms>", description: "time window for --restarts; both flags are required together" },
|
|
281
285
|
jsonFlag, plainFlag,
|
|
282
|
-
{ name: "detach", type: "boolean", short: "d", description: "launch through
|
|
286
|
+
{ name: "detach", type: "boolean", short: "d", description: "launch through a manager, await readiness and return without attaching" },
|
|
283
287
|
{ name: "live-only", type: "boolean", description: "foreground only: skip the durable backstop (no read-ACL row; messages missed while disconnected are not replayed)" },
|
|
284
288
|
{ name: "file", type: "string", short: "f", value: "<persona-file>", description: "persona file on the execution host; never a manifest deploy or implicit upload" },
|
|
285
289
|
{ 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: "
|
|
290
|
+
{ 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
291
|
{ name: "allow-stale", type: "string", value: "<a,b>", description: "refused: a manifest deployment option; use cotal team deploy <file>" },
|
|
288
292
|
{ 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: "
|
|
293
|
+
{ 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
294
|
{ name: "expect-owner", type: "string", value: "<u_…>", description: `with ${MANAGED_HANDOFF_FILE_ENV}: the owner the managed handoff must carry` },
|
|
291
295
|
{ name: "expect-lifecycle-uid", type: "string", value: "<uid>", description: `with ${MANAGED_HANDOFF_FILE_ENV}: the lifecycle UID the managed handoff must carry` },
|
|
292
296
|
];
|
|
293
297
|
/** Check the public mode and spelling before catalog preparation or identity allocation. */
|
|
294
298
|
export function validateSpawnArguments(args) {
|
|
295
299
|
const values = args.values;
|
|
300
|
+
const handoffRefusal = managedHandoffRefusal();
|
|
301
|
+
if (handoffRefusal)
|
|
302
|
+
throw handoffRefusal;
|
|
296
303
|
presentationOf(values);
|
|
297
304
|
// `runCli` has already taken the handoff into custody and deleted its variable.
|
|
298
305
|
const internal = holdsManagedHandoff() || Boolean(process.env[ENROLLMENT_URL_ENV] || process.env[ENROLLMENT_FILE_ENV]);
|
|
299
306
|
if (!holdsManagedHandoff() && (values["expect-owner"] !== undefined || values["expect-lifecycle-uid"] !== undefined))
|
|
300
307
|
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;
|
|
308
|
+
const direct = values.foreground === true || internal || !spawnUsesManager(values);
|
|
302
309
|
if (values.file !== undefined && (args.positionals.length || values.config !== undefined))
|
|
303
310
|
throw new CommandFailure("refused", "USAGE_INVALID", "choose one positional persona or --file/-f, not multiple explicit persona sources");
|
|
304
311
|
if (!internal && values.config !== undefined)
|
|
@@ -315,21 +322,21 @@ export function validateSpawnArguments(args) {
|
|
|
315
322
|
throw new CommandFailure("refused", "USAGE_INVALID", "manifest deployment options belong to cotal team deploy <file>, not spawn");
|
|
316
323
|
if (values["enrollment-file"] !== undefined && !values.space)
|
|
317
324
|
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
|
|
325
|
+
if (values["enrollment-file"] !== undefined && !direct)
|
|
326
|
+
throw new CommandFailure("refused", "UNSUPPORTED", "this native enrollment path runs one foreground seat. It does not substitute for managed enrollment authority");
|
|
320
327
|
if (values["enrollment-file"] !== undefined && (internal || values.detach || values.creds !== undefined || values.on !== undefined))
|
|
321
328
|
throw new CommandFailure("refused", "USAGE_INVALID", "choose one foreground enrollment source without a manager pin, credential override or internal handoff");
|
|
322
329
|
if (values.harness !== undefined && values.agent !== undefined)
|
|
323
330
|
throw new CommandFailure("refused", "USAGE_INVALID", "choose --harness/-H or the legacy --agent spelling, not both");
|
|
324
331
|
if (values.detach && direct)
|
|
325
332
|
throw new CommandFailure("refused", "USAGE_INVALID", "--detach and direct foreground execution are different launch modes");
|
|
326
|
-
if (
|
|
327
|
-
throw new CommandFailure("refused", "USAGE_INVALID", "
|
|
333
|
+
if (direct && ((!values["dry-run"] && (values.json || values.plain)) || values.creds !== undefined || values.on !== undefined))
|
|
334
|
+
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
335
|
if ((values.restarts === undefined) !== (values["restart-window"] === undefined))
|
|
329
336
|
throw new CommandFailure("refused", "USAGE_INVALID", "--restarts and --restart-window must be supplied together");
|
|
330
337
|
if (values.restarts !== undefined) {
|
|
331
338
|
if (direct)
|
|
332
|
-
throw new CommandFailure("refused", "USAGE_INVALID", "restart supervision belongs to a managed launch, not
|
|
339
|
+
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
340
|
for (const field of ["restarts", "restart-window"])
|
|
334
341
|
if (!/^[1-9][0-9]*$/.test(values[field]) || !Number.isSafeInteger(Number(values[field])))
|
|
335
342
|
throw new CommandFailure("refused", "USAGE_INVALID", `--${field} must be a positive safe integer`);
|
|
@@ -337,7 +344,7 @@ export function validateSpawnArguments(args) {
|
|
|
337
344
|
if (values["live-only"] && !direct)
|
|
338
345
|
throw new CommandFailure("refused", "USAGE_INVALID", "--live-only belongs to direct foreground execution");
|
|
339
346
|
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", "
|
|
347
|
+
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
348
|
for (const field of ["harness", "agent", "model", "variant", "name"])
|
|
342
349
|
if (values[field] !== undefined && !values[field].trim())
|
|
343
350
|
throw new CommandFailure("refused", "USAGE_INVALID", `--${field} cannot be empty`);
|
|
@@ -377,6 +384,22 @@ export function validateSpawnArguments(args) {
|
|
|
377
384
|
export function spawnRequiredExtensions(_args) {
|
|
378
385
|
return [];
|
|
379
386
|
}
|
|
387
|
+
/** Whether the installed manifest lists a connector named `name`. An unreadable manifest answers
|
|
388
|
+
* true, so the import's own refusal reports it. */
|
|
389
|
+
function connectorListed(name) {
|
|
390
|
+
try {
|
|
391
|
+
return manifestExtensionNames("connector").includes(name);
|
|
392
|
+
}
|
|
393
|
+
catch {
|
|
394
|
+
return true;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
/** The refusal for a harness with no installed connector, naming the package when it is official. */
|
|
398
|
+
function missingConnector(name, target) {
|
|
399
|
+
const pkg = OFFICIAL_CONNECTORS[name];
|
|
400
|
+
return new CommandFailure("refused", "DEPENDENCY_UNAVAILABLE", `no connector "${name}" is installed`, { target,
|
|
401
|
+
remedy: pkg ? `add it with \`cotal ext add ${pkg}\`` : "install its integration with `cotal ext add <npm-package>`, or check the name" });
|
|
402
|
+
}
|
|
380
403
|
/** Comma-list flag → string[] (shared by both spawn modes). Only an absent flag is `undefined` and
|
|
381
404
|
* defers to the persona; an empty value is the empty list, so `--subscribe ""` clears it. */
|
|
382
405
|
const splitFlag = (v) => (v === undefined ? undefined : v.split(",").map((s) => s.trim()).filter(Boolean));
|
|
@@ -389,16 +412,29 @@ const splitFlag = (v) => (v === undefined ? undefined : v.split(",").map((s) =>
|
|
|
389
412
|
function refuseUnmintableNameOrExit(name, userMode) {
|
|
390
413
|
const refusal = spawnNameError(name, { userMode });
|
|
391
414
|
if (refusal) {
|
|
392
|
-
|
|
415
|
+
stderrLine("✗ ", `${refusal}`, c.red);
|
|
393
416
|
process.exit(1);
|
|
394
417
|
}
|
|
395
418
|
}
|
|
396
|
-
|
|
419
|
+
/** The manager's `acl` launch field: null when the manager sent none, undefined when it cannot be read. */
|
|
420
|
+
export function managedLaunchAcl(value) {
|
|
421
|
+
if (value === undefined)
|
|
422
|
+
return null;
|
|
423
|
+
const lists = (raw) => {
|
|
424
|
+
const { allowSubscribe, allowPublish } = (raw ?? {});
|
|
425
|
+
const channels = (list) => Array.isArray(list) && list.every((channel) => typeof channel === "string");
|
|
426
|
+
return channels(allowSubscribe) && channels(allowPublish) ? { allowSubscribe: [...allowSubscribe], allowPublish: [...allowPublish] } : undefined;
|
|
427
|
+
};
|
|
428
|
+
const requested = lists(value?.requested), effective = lists(value?.effective);
|
|
429
|
+
return requested && effective ? { requested, effective } : undefined;
|
|
430
|
+
}
|
|
431
|
+
const channelList = (channels) => channels.length ? channels.join(", ") : "none";
|
|
432
|
+
export function managedLaunchView(r) {
|
|
397
433
|
const concrete = [r.name, r.space, r.managerInstanceId].every((value) => /^[A-Za-z0-9_-]+$/.test(value));
|
|
398
434
|
const target = concrete ? `${r.name} --space ${r.space} --on ${r.managerInstanceId}` : "<name> --space <space> --on <manager-instance>";
|
|
399
435
|
return { sections: [
|
|
400
436
|
{ 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"]] },
|
|
437
|
+
{ 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
438
|
{ kind: "lines", lines: [{ text: "The manager confirmed presence readiness. This is not proof that the kickoff task completed.", tone: "hint" }] },
|
|
403
439
|
] },
|
|
404
440
|
...(r.detached ? [{ title: "Next", blocks: [{ kind: "commands", items: [
|
|
@@ -414,7 +450,7 @@ export async function launchManagedPersona(values, positionals, events, launchOp
|
|
|
414
450
|
// `COTAL_DEFAULT_PERSONA` > `default`). Identity is separate:
|
|
415
451
|
// when `--name` is given it OVERRIDES the file's `name:` (foreground's `requested`), threaded
|
|
416
452
|
// as the op's `identity` so it is never silently dropped in detached mode.
|
|
417
|
-
const on =
|
|
453
|
+
const on = await managerPin(values, "cotal spawn <persona>");
|
|
418
454
|
// From a managed seat's own shell the launch is the SEAT's, as its `cotal_spawn` tool is: the
|
|
419
455
|
// manager records the seat as the spawner, so the seat can stop the child it asked for (#718).
|
|
420
456
|
// `--on` keeps the pin on that path too.
|
|
@@ -451,7 +487,11 @@ export async function launchManagedPersona(values, positionals, events, launchOp
|
|
|
451
487
|
if (eventsRequired && events === false) {
|
|
452
488
|
throw new CommandFailure("refused", "PERMISSION_DENIED", `space "${t.space}" requires the event plane by registration policy; no launch was submitted`);
|
|
453
489
|
}
|
|
454
|
-
|
|
490
|
+
if (on === undefined && !t.auth.bearer)
|
|
491
|
+
await refuseWithoutLiveManager(t.space, t.server, t.auth, { space: t.space, managerInstanceId: null, managerEpoch: null }, "launch an agent");
|
|
492
|
+
// A pin the registry does not list is refused at once; only a registered manager is waited on.
|
|
493
|
+
if (on !== undefined && !t.auth.bearer)
|
|
494
|
+
await refuseUnregisteredManager(t.space, t.server, t.auth, on);
|
|
455
495
|
const { ref, from: personaFrom } = spawnPersona(values.config, positionals, { space: t.space, preferences: cachedPreferences() });
|
|
456
496
|
const managerConfigRef = values.config ?? (personaFrom !== undefined ? ref : undefined);
|
|
457
497
|
const defaultAgent = callerHarness(t.space);
|
|
@@ -463,8 +503,11 @@ export async function launchManagedPersona(values, positionals, events, launchOp
|
|
|
463
503
|
resumeAgent = values.agent ?? await launchAgentOrExit(t, on, { name: ref, config: managerConfigRef, defaultAgent });
|
|
464
504
|
resumeClaim = await carryTranscriptOrExit(flags, on, values.resume, resumeAgent);
|
|
465
505
|
}
|
|
466
|
-
|
|
467
|
-
|
|
506
|
+
// The report that answers names the mesh in its heading, so this block names it once, in a field.
|
|
507
|
+
const toStdout = !observer && presentationOf(values) !== "json";
|
|
508
|
+
(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)));
|
|
509
|
+
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)))
|
|
510
|
+
console.error(c.dim(line));
|
|
468
511
|
const reply = await askManager(t.space, t.server, "start", {
|
|
469
512
|
name: ref,
|
|
470
513
|
identity: values.name,
|
|
@@ -502,15 +545,42 @@ export async function launchManagedPersona(values, positionals, events, launchOp
|
|
|
502
545
|
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
546
|
const code = reply.code === undefined ? undefined : refusal[reply.code];
|
|
504
547
|
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
|
-
|
|
548
|
+
// The broker attested that no manager received an unpinned launch: none takes the class queue.
|
|
549
|
+
if (on === undefined && !t.auth.bearer && reply.unanswered && reply.nativeOutcome === "not-executed")
|
|
550
|
+
throw await unservedClassLaunch(seat ? undefined : flags, t, values.agent ?? defaultAgent, { target, native });
|
|
551
|
+
// A pinned describe that drew no answer means the launch was never sent, as ps and stop --on say.
|
|
552
|
+
if (on !== undefined && describeUnanswered(reply))
|
|
553
|
+
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>" });
|
|
554
|
+
// So does an unpinned one: no manager answered, and the launch was never published.
|
|
555
|
+
if (on === undefined && describeUnanswered(reply))
|
|
556
|
+
throw unansweredClassLaunch(t, { target, native: { code: reply.code, ...(reply.error ? { detail: oneLine(reply.error) } : {}) } });
|
|
557
|
+
// A manager without the connector: it is added where that manager runs, not on this machine.
|
|
558
|
+
const absent = reply.nativeOutcome === "not-executed" && reply.error !== undefined ? hintedConnector(reply.error) : undefined;
|
|
559
|
+
if (absent !== undefined) {
|
|
560
|
+
const answered = reply.managerInstanceId ?? on;
|
|
561
|
+
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,
|
|
562
|
+
remedy: `add it where that manager runs, such as ${extAddFor(absent)}, then restart that manager; it reads its agent applications when it starts` });
|
|
563
|
+
}
|
|
564
|
+
if (reply.nativeOutcome === "not-executed" && code) {
|
|
565
|
+
// A manager without the persona: it is created on that manager's host, or the spawn goes to
|
|
566
|
+
// another live manager whose catalog has it.
|
|
567
|
+
const missing = managerConfigRef === undefined && reply.error?.startsWith(`no persona "${ref}"`) === true;
|
|
568
|
+
const elsewhere = missing ? await managersWithPersona(flags, reply.managerInstanceId ?? on, ref).catch(() => []) : [];
|
|
569
|
+
throw new CommandFailure("refused", code, reply.error ? oneLine(reply.error) : "the manager refused the launch before execution", { target, native, remedy: elsewhere.length
|
|
570
|
+
? `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 ")}`
|
|
571
|
+
: missing ? "nothing was launched; create that file on the manager's host, then run the spawn again"
|
|
572
|
+
: "nothing was launched; fix what the manager reported, then run the spawn again" });
|
|
573
|
+
}
|
|
507
574
|
const unknown = reply.nativeOutcome !== "executed" || reply.unanswered;
|
|
508
575
|
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
576
|
}
|
|
510
577
|
const d = reply.data;
|
|
511
578
|
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
579
|
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
|
|
580
|
+
const acl = managedLaunchAcl(d.acl);
|
|
581
|
+
if (acl === undefined)
|
|
582
|
+
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" });
|
|
583
|
+
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
584
|
const presentation = presentationOf(values);
|
|
515
585
|
const warnings = d.eventsNotice ? [{ code: "EVENT_PLANE_NOTICE", target, message: d.eventsNotice }] : [];
|
|
516
586
|
if (observer) {
|
|
@@ -538,6 +608,77 @@ export async function launchManagedPersona(values, positionals, events, launchOp
|
|
|
538
608
|
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
609
|
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
610
|
}
|
|
611
|
+
/** Why no manager received an unpinned launch. A manager whose boot inventory found no agent
|
|
612
|
+
* application leaves the class queue, so when every live one that answered reports that on its own
|
|
613
|
+
* instance rail the refusal names the application to add. A manager the broker affirms gone is
|
|
614
|
+
* skipped and named in a warning, so its registration costs no deadline and hides no reason. A seat
|
|
615
|
+
* (`flags` undefined) does not read the census as the operator. `agent` is the harness this caller
|
|
616
|
+
* would choose, for the install hint. */
|
|
617
|
+
async function unservedClassLaunch(flags, t, agent, at) {
|
|
618
|
+
const census = flags ? await classLaunchCensus(flags, t).catch(() => undefined) : undefined;
|
|
619
|
+
for (const instanceId of census?.gone ?? [])
|
|
620
|
+
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)` });
|
|
621
|
+
if (census?.noApplication) {
|
|
622
|
+
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,
|
|
623
|
+
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` });
|
|
624
|
+
}
|
|
625
|
+
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" });
|
|
626
|
+
}
|
|
627
|
+
/** Why no manager answered an unpinned launch's describe, so the launch was never sent. This root's
|
|
628
|
+
* own stack says why when it records one, in the words `ps` uses for the same silence. */
|
|
629
|
+
function unansweredClassLaunch(t, at) {
|
|
630
|
+
const refused = (message, remedy) => new CommandFailure("refused", "TARGET_UNAVAILABLE", `${message}, so the launch was not sent and nothing was launched`, { ...at, remedy });
|
|
631
|
+
if (t.root !== undefined && stackManagerStarting(t.root, t.space))
|
|
632
|
+
return refused("the stack's manager is starting", "run the spawn again once cotal up reports the manager started");
|
|
633
|
+
if (t.root !== undefined && stackManagerAbsent(t.root, t.space))
|
|
634
|
+
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");
|
|
635
|
+
const pid = t.root === undefined ? undefined : runningStackManagerPid(t.root, t.space);
|
|
636
|
+
if (pid !== undefined)
|
|
637
|
+
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`);
|
|
638
|
+
return refused("no manager answered", "cotal ps shows which managers answer; run the spawn again once one does");
|
|
639
|
+
}
|
|
640
|
+
/** What the registered managers say about unpinned launches. `noApplication` holds when one answered
|
|
641
|
+
* and each one that answered says it runs agents but takes no unpinned launch; `gone` lists the
|
|
642
|
+
* managers skipped because the broker affirms nothing subscribed on their rail. Status has no
|
|
643
|
+
* scatter route, so each is read pinned to its instance, racing the rail probe: whichever settles
|
|
644
|
+
* first stops the other, so neither a live manager nor a gone one is waited out. */
|
|
645
|
+
async function classLaunchCensus(flags, t) {
|
|
646
|
+
const gone = [];
|
|
647
|
+
const managers = [];
|
|
648
|
+
for (const instanceId of await liveManagerIds(t.space, t.server, t.auth)) {
|
|
649
|
+
const pinned = await resolveControlTarget(flags, "control-caller-privileged", instanceId, { onRefusal: "throw" });
|
|
650
|
+
const settled = new AbortController();
|
|
651
|
+
const status = await Promise.race([
|
|
652
|
+
managerRailGone(pinned.space, pinned.server, pinned.auth, instanceId, settled.signal).then((isGone) => isGone ? undefined : new Promise(() => { })),
|
|
653
|
+
askManager(pinned.space, pinned.server, "managerStatus", undefined, pinned.auth, "owner", 5_000, { instanceId, signal: settled.signal }),
|
|
654
|
+
]).finally(() => settled.abort());
|
|
655
|
+
if (status === undefined) {
|
|
656
|
+
gone.push(instanceId);
|
|
657
|
+
continue;
|
|
658
|
+
}
|
|
659
|
+
const data = status.data;
|
|
660
|
+
if (!status.ok || data?.classSpawn !== false || data.execution === "none")
|
|
661
|
+
return { noApplication: false, gone, managers };
|
|
662
|
+
managers.push(managerAt(instanceId, data.host));
|
|
663
|
+
}
|
|
664
|
+
return { noApplication: managers.length > 0, gone, managers };
|
|
665
|
+
}
|
|
666
|
+
/** A manager as a refusal names it: its instance id, and the host its own status reports. */
|
|
667
|
+
const managerAt = (instanceId, host) => typeof host === "string" && host ? `manager ${instanceId} on host ${host}` : `manager ${instanceId}`;
|
|
668
|
+
/** {@link managerAt} for one manager, read pinned to it. A seat (`flags` undefined) reads with its
|
|
669
|
+
* own caller, and a status that cannot be read leaves the host out. */
|
|
670
|
+
async function managerNamed(flags, t, instanceId) {
|
|
671
|
+
try {
|
|
672
|
+
const pinned = flags ? await resolveControlTarget(flags, "control-caller-privileged", instanceId, { onRefusal: "throw" }) : t;
|
|
673
|
+
const status = await askManager(pinned.space, pinned.server, "managerStatus", undefined, pinned.auth, "owner", 5_000, { instanceId });
|
|
674
|
+
return managerAt(instanceId, status.ok ? status.data?.host : undefined);
|
|
675
|
+
}
|
|
676
|
+
catch {
|
|
677
|
+
return managerAt(instanceId, undefined);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
/** The `cotal ext add` that installs connector `name`, quoted for a refusal. */
|
|
681
|
+
const extAddFor = (name) => OFFICIAL_CONNECTORS[name] ? `\`cotal ext add ${OFFICIAL_CONNECTORS[name]}\`` : `\`cotal ext add <npm-package>\` for "${name}"`;
|
|
541
682
|
/** The harness the manager's `spawn` resolves for this persona, read with the same fields `start` sends. */
|
|
542
683
|
async function launchAgentOrExit(t, on, fields) {
|
|
543
684
|
const reply = await askManager(t.space, t.server, "resolveAgent", fields, t.auth, "owner", undefined, { instanceId: on });
|
|
@@ -558,13 +699,13 @@ async function carryTranscriptOrExit(flags, on, id, agent) {
|
|
|
558
699
|
found = registry.resolve("connector", agent).resumeTranscript?.find(id, process.env);
|
|
559
700
|
}
|
|
560
701
|
catch (e) {
|
|
561
|
-
|
|
702
|
+
stderrLine("✗ ", `resume: ${e.message}`, c.red);
|
|
562
703
|
process.exit(1);
|
|
563
704
|
}
|
|
564
705
|
if (found === undefined)
|
|
565
706
|
return undefined;
|
|
566
707
|
if (on === undefined) {
|
|
567
|
-
|
|
708
|
+
stderrLine("✗ ", `resume: session ${id} is held on this host, and carrying it needs one manager instance; pass --on <instance>`, c.red);
|
|
568
709
|
process.exit(1);
|
|
569
710
|
}
|
|
570
711
|
const bytes = readFileSync(found.path);
|
|
@@ -604,20 +745,21 @@ async function transferWriterOrExit(flags, t, instanceId, hex) {
|
|
|
604
745
|
return { bearer: view.bearer, sentinelCreds: view.sentinelCreds, tls: conn.tls };
|
|
605
746
|
}
|
|
606
747
|
catch (e) {
|
|
607
|
-
|
|
748
|
+
stderrLine("✗ ", `resume: ${e.message}`, c.red);
|
|
608
749
|
process.exit(1);
|
|
609
750
|
}
|
|
610
751
|
}
|
|
611
752
|
if (t.mode !== "auth" || !t.spaceAuth) {
|
|
612
|
-
|
|
753
|
+
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
754
|
process.exit(1);
|
|
614
755
|
}
|
|
615
756
|
return { creds: await mintCreds(t.spaceAuth, newIdentity(), "transfer-writer", { transferWriter: { instanceId, hex } }), tls: t.auth.tls };
|
|
616
757
|
}
|
|
617
758
|
/**
|
|
618
|
-
* `cotal spawn [<persona>] [--file <persona-file>]`
|
|
619
|
-
*
|
|
620
|
-
*
|
|
759
|
+
* `cotal spawn [<persona>] [--file <persona-file>]` runs the native application in this terminal.
|
|
760
|
+
* `--detach` launches it through a manager and returns after readiness, and `--on <instance>`
|
|
761
|
+
* launches it through that manager and attaches to its allocated incarnation. File validation
|
|
762
|
+
* belongs to the execution host.
|
|
621
763
|
*
|
|
622
764
|
* The launch recipe is the connector's `buildLaunch` (the single source of truth,
|
|
623
765
|
* shared with the manager); only *how the spec runs* differs — foreground exec
|
|
@@ -670,25 +812,28 @@ export async function spawn(args) {
|
|
|
670
812
|
scrubEnrollmentEnv(process.env);
|
|
671
813
|
}
|
|
672
814
|
let redeemedEnrollment;
|
|
815
|
+
let handoffManagerInstanceId;
|
|
673
816
|
if (handoffText !== undefined) {
|
|
674
817
|
const refusal = enrollmentUrl ? `${MANAGED_HANDOFF_FILE_ENV} cannot be combined with ${ENROLLMENT_URL_ENV}/${ENROLLMENT_FILE_ENV}`
|
|
675
818
|
: values.detach || values.file || values.creds ? `${MANAGED_HANDOFF_FILE_ENV} applies only to a foreground persona spawn without --creds`
|
|
676
819
|
: !values.space || !values.name || !values["expect-owner"] || !values["expect-lifecycle-uid"]
|
|
677
820
|
? `${MANAGED_HANDOFF_FILE_ENV} requires --space, --name, --expect-owner and --expect-lifecycle-uid`
|
|
678
821
|
: !values.config ? `${MANAGED_HANDOFF_FILE_ENV} requires --config <persona-file>`
|
|
679
|
-
:
|
|
822
|
+
: !process.env.COTAL_MANAGER_INSTANCE?.trim() ? `${MANAGED_HANDOFF_FILE_ENV} requires COTAL_MANAGER_INSTANCE`
|
|
823
|
+
: undefined;
|
|
680
824
|
if (refusal) {
|
|
681
|
-
|
|
825
|
+
stderrLine("✗ ", `${refusal}`, c.red);
|
|
682
826
|
process.exit(1);
|
|
683
827
|
}
|
|
684
828
|
try {
|
|
685
829
|
loadLaunchPersonaFile(resolvePath(values.config));
|
|
686
830
|
}
|
|
687
831
|
catch (e) {
|
|
688
|
-
|
|
832
|
+
stderrLine("✗ ", `cannot load the managed handoff persona: ${e.message}`, c.red);
|
|
689
833
|
process.exit(1);
|
|
690
834
|
}
|
|
691
835
|
try {
|
|
836
|
+
handoffManagerInstanceId = assertLifecycleToken(process.env.COTAL_MANAGER_INSTANCE.trim(), "COTAL_MANAGER_INSTANCE");
|
|
692
837
|
const handoff = parseManagedLifecycleHandoff(handoffText, {
|
|
693
838
|
space: values.space, owner: values["expect-owner"], actor: values.name, lifecycleUid: values["expect-lifecycle-uid"],
|
|
694
839
|
});
|
|
@@ -711,37 +856,37 @@ export async function spawn(args) {
|
|
|
711
856
|
await registerEnrollmentMesh(stock, resolvePath(values.config, ".."), HANDOFF_REFUSALS);
|
|
712
857
|
}
|
|
713
858
|
catch (e) {
|
|
714
|
-
|
|
859
|
+
stderrLine("✗ ", `${e.message}`, c.red);
|
|
715
860
|
process.exit(1);
|
|
716
861
|
}
|
|
717
862
|
}
|
|
718
863
|
if (enrollmentUrl && values.detach) {
|
|
719
|
-
|
|
864
|
+
stderrLine("✗ ", `${ENROLLMENT_URL_ENV}/${ENROLLMENT_FILE_ENV} apply only to a foreground persona spawn`, c.red);
|
|
720
865
|
process.exit(1);
|
|
721
866
|
}
|
|
722
867
|
if (enrollmentUrl && !values.space) {
|
|
723
|
-
|
|
868
|
+
stderrLine("✗ ", `${ENROLLMENT_URL_ENV}/${ENROLLMENT_FILE_ENV} require --space <s>`, c.red);
|
|
724
869
|
process.exit(1);
|
|
725
870
|
}
|
|
726
|
-
const direct = values.foreground === true || handoffText !== undefined || enrollmentUrl !== undefined;
|
|
871
|
+
const direct = values.foreground === true || handoffText !== undefined || enrollmentUrl !== undefined || !spawnUsesManager(values);
|
|
727
872
|
const enrollmentBootstrap = Boolean(enrollmentUrl && values.space && !findMesh(values.space));
|
|
728
873
|
if (enrollmentBootstrap) {
|
|
729
874
|
if (!values.config || (!values.config.includes("/") && !values.config.includes("\\") && !values.config.endsWith(".md"))) {
|
|
730
|
-
|
|
875
|
+
stderrLine("✗ ", "enrollment bootstrap needs --config <persona-file>; no remote persona catalog exists on this machine yet", c.red);
|
|
731
876
|
process.exit(1);
|
|
732
877
|
}
|
|
733
878
|
try {
|
|
734
879
|
loadLaunchPersonaFile(resolvePath(values.config));
|
|
735
880
|
}
|
|
736
881
|
catch (e) {
|
|
737
|
-
|
|
882
|
+
stderrLine("✗ ", `cannot load the enrollment bootstrap persona: ${e.message}`, c.red);
|
|
738
883
|
process.exit(1);
|
|
739
884
|
}
|
|
740
885
|
}
|
|
741
886
|
// Explicit files retain the execution host's path semantics. A manager pin is meaningful for
|
|
742
887
|
// either managed persona spelling; direct execution has no manager placement to select.
|
|
743
888
|
if (values.on !== undefined && direct) {
|
|
744
|
-
|
|
889
|
+
stderrLine("✗ ", "--on pins a managed imperative launch; a spawn in this terminal does not take that manager selector", c.red);
|
|
745
890
|
process.exit(1);
|
|
746
891
|
}
|
|
747
892
|
// `--resume ""` / `--resume=` means the operator asked to resume but named no session — fail loud
|
|
@@ -773,7 +918,7 @@ export async function spawn(args) {
|
|
|
773
918
|
// grants publish on the channel the connector names. Both are required, which is what stops a
|
|
774
919
|
// hand-written grant from turning events on by itself.
|
|
775
920
|
if (values.events && values["no-events"]) {
|
|
776
|
-
|
|
921
|
+
stderrLine("✗ ", "--events and --no-events are mutually exclusive", c.red);
|
|
777
922
|
process.exit(1);
|
|
778
923
|
}
|
|
779
924
|
// #373: the detached path sends the bit ONLY when the operator chose it. `--events` gives
|
|
@@ -781,15 +926,14 @@ export async function spawn(args) {
|
|
|
781
926
|
// an explicit true from a non-admin caller as operator reach and serves an omission unarmed
|
|
782
927
|
// with a notice, so an unconditional default-true would be refused for an ordinary actor.
|
|
783
928
|
const events = values.events ? true : values["no-events"] ? false : undefined;
|
|
784
|
-
//
|
|
785
|
-
// execution keeps
|
|
929
|
+
// A manager runs it only with --detach or --on, and the persona then stays on the manager's
|
|
930
|
+
// execution host. Every other spawn keeps the native custody path below, in this terminal.
|
|
786
931
|
if (!direct)
|
|
787
932
|
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
933
|
// `--creds` names a CONTROL-CALLER credential (reach an off-registry manager) — meaningless for
|
|
790
934
|
// a foreground launch, which provisions the agent's own creds. Fail loud, never ignore.
|
|
791
935
|
if (values.creds) {
|
|
792
|
-
|
|
936
|
+
stderrLine("✗ ", "--creds is only valid with --detach (it authenticates the manager control call)", c.red);
|
|
793
937
|
process.exit(1);
|
|
794
938
|
}
|
|
795
939
|
// An enrollment may bootstrap the stock remote user-mesh record before normal target resolution.
|
|
@@ -813,7 +957,7 @@ export async function spawn(args) {
|
|
|
813
957
|
await registerEnrollmentMesh(redeemedEnrollment.stock, resolvePath(values.config, ".."));
|
|
814
958
|
}
|
|
815
959
|
catch (e) {
|
|
816
|
-
|
|
960
|
+
stderrLine("✗ ", `${e.message}`, c.red);
|
|
817
961
|
process.exit(1);
|
|
818
962
|
}
|
|
819
963
|
}
|
|
@@ -824,11 +968,11 @@ export async function spawn(args) {
|
|
|
824
968
|
const target = handoffText === undefined
|
|
825
969
|
? await resolveTargetOrExit({ server: values.server, space: values.space })
|
|
826
970
|
: await resolveTargetOrThrow({ server: values.server, space: values.space }).catch(() => {
|
|
827
|
-
|
|
971
|
+
stderrLine("✗ ", `${HANDOFF_REFUSALS.target}`, c.red);
|
|
828
972
|
process.exit(1);
|
|
829
973
|
});
|
|
830
974
|
if (handoffText !== undefined && !(target.mode === "user" && target.userAuth?.remote)) {
|
|
831
|
-
|
|
975
|
+
stderrLine("✗ ", "the managed handoff's space is registered here as a local mesh, so it cannot host a managed handoff", c.red);
|
|
832
976
|
process.exit(1);
|
|
833
977
|
}
|
|
834
978
|
let policy;
|
|
@@ -836,14 +980,14 @@ export async function spawn(args) {
|
|
|
836
980
|
policy = await refreshRegistrationPolicy(target);
|
|
837
981
|
}
|
|
838
982
|
catch (e) {
|
|
839
|
-
|
|
983
|
+
stderrLine("✗ ", `${handoffText === undefined ? e.message : HANDOFF_REFUSALS.policy}`, c.red);
|
|
840
984
|
process.exit(1);
|
|
841
985
|
}
|
|
842
986
|
const eventsRequired = policy?.events === "required";
|
|
843
987
|
// A handoff's space is a value from the document, so its policy refusals name the field instead.
|
|
844
988
|
const policySpace = handoffText === undefined ? `space "${target.space}"` : "the managed handoff's space";
|
|
845
989
|
if (eventsRequired && values["no-events"]) {
|
|
846
|
-
|
|
990
|
+
stderrLine("✗ ", `${policySpace} requires the event plane by registration policy; --no-events is not allowed`, c.red);
|
|
847
991
|
process.exit(1);
|
|
848
992
|
}
|
|
849
993
|
// Foreground is the operator's own in-process launch (no typed door, no epAdminReach) and is
|
|
@@ -865,31 +1009,16 @@ export async function spawn(args) {
|
|
|
865
1009
|
if (e instanceof PersonaSourceError)
|
|
866
1010
|
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
1011
|
const code = e.code;
|
|
868
|
-
const fromEnv = personaFrom === undefined ? "" : ` from ${personaFrom}`;
|
|
869
1012
|
// The not-found text names the mesh's space and server, which for a handoff are its values.
|
|
870
1013
|
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`));
|
|
1014
|
+
stderrLine("✗ ", `cannot load the managed handoff persona: ${e.message}`, c.red);
|
|
876
1015
|
}
|
|
877
1016
|
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`));
|
|
1017
|
+
const missing = missingPersona(target, ref, personaFrom, path);
|
|
1018
|
+
throw new CommandFailure("refused", "TARGET_NOT_FOUND", missing.message, { target: { space, path }, remedy: missing.remedy });
|
|
890
1019
|
}
|
|
891
1020
|
else {
|
|
892
|
-
|
|
1021
|
+
stderrLine("✗ ", `${e.message}`, c.red);
|
|
893
1022
|
}
|
|
894
1023
|
process.exit(1);
|
|
895
1024
|
}
|
|
@@ -907,7 +1036,7 @@ export async function spawn(args) {
|
|
|
907
1036
|
// Opaque connector options: `--opt` flags win per key over the persona's `launchOptions:`.
|
|
908
1037
|
const launchOptions = mergeLaunchOptions(def.launchOptions, cliLaunchOptions);
|
|
909
1038
|
if (redeemedEnrollment && redeemedEnrollment.bundle.actor !== requested) {
|
|
910
|
-
|
|
1039
|
+
stderrLine("✗ ", `the enrollment is for actor "${redeemedEnrollment.bundle.actor}" but this spawn names "${requested}"`, c.red);
|
|
911
1040
|
process.exit(1);
|
|
912
1041
|
}
|
|
913
1042
|
// #867: same door as the detached path — the effective identity (flag or file) must be mintable
|
|
@@ -926,12 +1055,12 @@ export async function spawn(args) {
|
|
|
926
1055
|
launchOptions,
|
|
927
1056
|
});
|
|
928
1057
|
if (refusal) {
|
|
929
|
-
|
|
1058
|
+
stderrLine("✗ ", `${refusal}`, c.red);
|
|
930
1059
|
process.exit(1);
|
|
931
1060
|
}
|
|
932
1061
|
}
|
|
933
1062
|
catch (e) {
|
|
934
|
-
|
|
1063
|
+
stderrLine("✗ ", `${e.message}`, c.red);
|
|
935
1064
|
process.exit(1);
|
|
936
1065
|
}
|
|
937
1066
|
// Preflight: fail with one sentence if the mesh is down or won't take our creds, instead of
|
|
@@ -940,7 +1069,7 @@ export async function spawn(args) {
|
|
|
940
1069
|
await preflightOrExit(target);
|
|
941
1070
|
else
|
|
942
1071
|
await preflightOrThrow(target).catch(() => {
|
|
943
|
-
|
|
1072
|
+
stderrLine("✗ ", `${HANDOFF_REFUSALS.preflight}`, c.red);
|
|
944
1073
|
process.exit(1);
|
|
945
1074
|
});
|
|
946
1075
|
// User mode allocates during guarded provisioning below, without a static operator credential.
|
|
@@ -958,7 +1087,9 @@ export async function spawn(args) {
|
|
|
958
1087
|
await materializeExtension({ kind: "connector", name: agentType });
|
|
959
1088
|
}
|
|
960
1089
|
catch (e) {
|
|
961
|
-
|
|
1090
|
+
if (!connectorListed(agentType))
|
|
1091
|
+
throw missingConnector(agentType, { space, path });
|
|
1092
|
+
stderrLine("✗ ", `${e.message}`, c.red);
|
|
962
1093
|
process.exit(1);
|
|
963
1094
|
}
|
|
964
1095
|
let connector;
|
|
@@ -966,15 +1097,15 @@ export async function spawn(args) {
|
|
|
966
1097
|
connector = registry.resolve("connector", agentType);
|
|
967
1098
|
}
|
|
968
1099
|
catch (e) {
|
|
969
|
-
|
|
1100
|
+
stderrLine("✗ ", `${e.message}`, c.red);
|
|
970
1101
|
process.exit(1);
|
|
971
1102
|
}
|
|
972
1103
|
if (variant && !connector.supportsModelVariant) {
|
|
973
|
-
|
|
1104
|
+
stderrLine("✗ ", `${agentType} connector does not support model variants (variant)`, c.red);
|
|
974
1105
|
process.exit(1);
|
|
975
1106
|
}
|
|
976
1107
|
if (values.prompt !== undefined && !connector.supportsPrompt) {
|
|
977
|
-
|
|
1108
|
+
stderrLine("✗ ", `${agentType} connector does not support an initial prompt (prompt)`, c.red);
|
|
978
1109
|
process.exit(1);
|
|
979
1110
|
}
|
|
980
1111
|
// Which of the operator's personal MCP servers to share with this agent: declared in the cotal
|
|
@@ -1017,7 +1148,7 @@ export async function spawn(args) {
|
|
|
1017
1148
|
allowSubscribe = resolveReadAcl(subscribe ?? [], splitFlag(values["allow-subscribe"]) ?? def.allowSubscribe);
|
|
1018
1149
|
}
|
|
1019
1150
|
catch (e) {
|
|
1020
|
-
|
|
1151
|
+
stderrLine("✗ ", `${e.message}`, c.red);
|
|
1021
1152
|
process.exit(1);
|
|
1022
1153
|
}
|
|
1023
1154
|
let allowPublish = splitFlag(values["allow-publish"]) ?? def.allowPublish;
|
|
@@ -1040,10 +1171,12 @@ export async function spawn(args) {
|
|
|
1040
1171
|
? target.userAuth.endpoints?.agentProvisioningUrl
|
|
1041
1172
|
: undefined;
|
|
1042
1173
|
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 …\`),
|
|
1174
|
+
stderrLine("✗ ", `mesh "${target.space}" runs elsewhere and advertises no agent-provisioning endpoint, so agents cannot be provisioned from this machine`, c.red);
|
|
1175
|
+
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
1176
|
process.exit(1);
|
|
1046
1177
|
}
|
|
1178
|
+
// Said once every check above has passed, so a refusal is never read as a launch that started.
|
|
1179
|
+
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
1180
|
// Auth mode provisions the identity + writes its creds to disk BEFORE the connector validates the
|
|
1048
1181
|
// launch (e.g. `buildLaunch` throws on a rejected `--opt`) and before the child execs. The SAME
|
|
1049
1182
|
// retirement serves a failed provisioning or launch (rollback) and the normal foreground
|
|
@@ -1068,7 +1201,7 @@ export async function spawn(args) {
|
|
|
1068
1201
|
await attemptCleanup(failed, "broker teardown", () => mintCreds(auth, newIdentity(), "deprovisioner", { deprovisionTarget: { principal: targetId, lifecycleUid } })
|
|
1069
1202
|
.then((dc) => deprovisionAgent({ servers: server, space, targetId, lifecycleUid, creds: dc })));
|
|
1070
1203
|
if (failed.length)
|
|
1071
|
-
|
|
1204
|
+
stderrLine("✗ ", `cleaning up after ${name}: ${describeCleanupFailures(failed)}`, c.red);
|
|
1072
1205
|
else
|
|
1073
1206
|
console.error(` ↩ retired creds for ${name} (${why})`);
|
|
1074
1207
|
};
|
|
@@ -1076,7 +1209,7 @@ export async function spawn(args) {
|
|
|
1076
1209
|
if (!redeemedEnrollment) {
|
|
1077
1210
|
// The record alone decides this refusal, and the redemption below spends the enrollment.
|
|
1078
1211
|
if (!target.userAuth.endpoints?.url) {
|
|
1079
|
-
|
|
1212
|
+
stderrLine("✗ ", `${noExchangeEndpoint(space)}`, c.red);
|
|
1080
1213
|
process.exit(1);
|
|
1081
1214
|
}
|
|
1082
1215
|
try {
|
|
@@ -1087,21 +1220,21 @@ export async function spawn(args) {
|
|
|
1087
1220
|
redeemedEnrollment = checkEnrollmentBundle(body, name);
|
|
1088
1221
|
}
|
|
1089
1222
|
catch (e) {
|
|
1090
|
-
|
|
1223
|
+
stderrLine("✗ ", `${e.message}`, c.red);
|
|
1091
1224
|
process.exit(1);
|
|
1092
1225
|
}
|
|
1093
1226
|
}
|
|
1094
1227
|
const enrolled = redeemedEnrollment.bundle;
|
|
1095
1228
|
if (enrolled.space !== space) {
|
|
1096
|
-
|
|
1229
|
+
stderrLine("✗ ", `the enrollment is for space "${enrolled.space}" but this spawn targets "${space}"`, c.red);
|
|
1097
1230
|
process.exit(1);
|
|
1098
1231
|
}
|
|
1099
1232
|
if (enrolled.idp.url !== target.userAuth.idp.url || enrolled.idp.issuer !== target.userAuth.idp.issuer || enrolled.idp.audience !== target.userAuth.idp.audience) {
|
|
1100
|
-
|
|
1233
|
+
stderrLine("✗ ", "the enrollment's IdP pins do not match the registered mesh", c.red);
|
|
1101
1234
|
process.exit(1);
|
|
1102
1235
|
}
|
|
1103
1236
|
if (target.userAuth.endpoints?.url !== enrolled.authServiceUrl) {
|
|
1104
|
-
|
|
1237
|
+
stderrLine("✗ ", "the enrollment's authServiceUrl does not match the registered mesh exchange", c.red);
|
|
1105
1238
|
process.exit(1);
|
|
1106
1239
|
}
|
|
1107
1240
|
const remote = await provisionRemoteUserForeground(target, name, { body: enrolled, exchangeUrl: enrolled.authServiceUrl }, handoffText === undefined ? undefined : HANDOFF_REFUSALS);
|
|
@@ -1266,6 +1399,7 @@ export async function spawn(args) {
|
|
|
1266
1399
|
// construction because its write-ahead log had nowhere to live that a later start would look.
|
|
1267
1400
|
workspaceRoot: target.root,
|
|
1268
1401
|
});
|
|
1402
|
+
applyHandoffManagerInstance(spec, handoffManagerInstanceId);
|
|
1269
1403
|
artifacts = spec.artifacts;
|
|
1270
1404
|
scrubEnrollmentEnv(spec.env);
|
|
1271
1405
|
// What happens next belongs to the CONNECTOR: naming one harness's first-run gate for all of
|
|
@@ -1300,7 +1434,7 @@ export async function spawn(args) {
|
|
|
1300
1434
|
// other's mode): revoke the user-mode actor grant AND roll back the static-auth creds + footprint,
|
|
1301
1435
|
// before rethrowing, so no standing grant survives a spawn that never started.
|
|
1302
1436
|
if (userCleanup)
|
|
1303
|
-
await userCleanup().catch((err) =>
|
|
1437
|
+
await userCleanup().catch((err) => stderrLine("✗ ", `cleaning up after ${name}: ${err.message}`, c.red));
|
|
1304
1438
|
await retireProvision("launch build failed");
|
|
1305
1439
|
// The launch's private files (core launch-artifacts) go too: no child will read them.
|
|
1306
1440
|
discardLaunchArtifacts(artifacts);
|
|
@@ -1310,7 +1444,7 @@ export async function spawn(args) {
|
|
|
1310
1444
|
child.on("error", (e) => {
|
|
1311
1445
|
// The exec never started, so the just-provisioned static-auth identity is orphaned — roll it
|
|
1312
1446
|
// back. (User-mode revoke runs unconditionally once this promise settles, below.)
|
|
1313
|
-
|
|
1447
|
+
stderrLine("✗ ", `failed to launch ${spec.command}: ${e.message}`, (line) => line);
|
|
1314
1448
|
void retireProvision("exec failed").finally(() => {
|
|
1315
1449
|
process.exitCode = 1;
|
|
1316
1450
|
resolve();
|
|
@@ -1331,7 +1465,7 @@ export async function spawn(args) {
|
|
|
1331
1465
|
// (a SIGKILLed CLI can't run this; its retained grant needs operator recovery), loud
|
|
1332
1466
|
// on failure, never blocking the exit code already set above.
|
|
1333
1467
|
if (userCleanup)
|
|
1334
|
-
await userCleanup().catch((e) =>
|
|
1468
|
+
await userCleanup().catch((e) => stderrLine("✗ ", `cleaning up after ${name}: ${e.message}`, c.red));
|
|
1335
1469
|
// The child has exited or never started, so nothing reads the launch's private files any more
|
|
1336
1470
|
// (core launch-artifacts). A SIGKILLed CLI cannot run this; the child's watcher removes those.
|
|
1337
1471
|
discardLaunchArtifacts(spec.artifacts);
|
|
@@ -1420,7 +1554,7 @@ async function provisionRemoteUserForeground(target, name, source, refusals) {
|
|
|
1420
1554
|
const store = workspaceSecretStore(target.root);
|
|
1421
1555
|
const composition = { injected: false, root: target.root };
|
|
1422
1556
|
const fail = (msg) => {
|
|
1423
|
-
|
|
1557
|
+
stderrLine("✗ ", `${msg}`, c.red);
|
|
1424
1558
|
process.exit(1);
|
|
1425
1559
|
};
|
|
1426
1560
|
// Resolved first, as by every consumer of the space's local state: each resolution migrates a
|
|
@@ -1556,7 +1690,7 @@ async function provisionUserForeground(target, name, ref, opts) {
|
|
|
1556
1690
|
const store = workspaceSecretStore(target.root);
|
|
1557
1691
|
const composition = { injected: false, root: target.root };
|
|
1558
1692
|
const fail = (msg) => {
|
|
1559
|
-
|
|
1693
|
+
stderrLine("✗ ", `${msg}`, c.red);
|
|
1560
1694
|
process.exit(1);
|
|
1561
1695
|
};
|
|
1562
1696
|
let provider;
|