@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/status.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
1
|
+
import { accessSync, constants, existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { CotalEndpoint, dialerFor, EpEnvelopeError, formatAge, isReachable, mintCreds, mintLifecycleUid, resolveService, realDirNoSymlink, invokeRepairingSplit, standaloneConnectOpts, newIdentity, idFromCreds, principalKey, DEV_OWNER, unansweredRequest, resolveAuthProvider, personaDir, presenceText, } from "@cotal-ai/core";
|
|
5
|
-
import { accountInventory, assessMaintenanceClaim, authDir, isCommandFailure, readMaintenanceJournal, brokerAddressForDisplay, canonicalRoot, CLI_USER_ACTOR, CommandFailure, deliveryCredsKey, DELIVERY_PIDFILE, extensionsDir, findCotalRoot,
|
|
5
|
+
import { stoppedLoopbackListener, accountInventory, assessMaintenanceClaim, authDir, isCommandFailure, readMaintenanceJournal, restoreRolledBackRuns, brokerAddressForDisplay, canonicalRoot, CLI_USER_ACTOR, CommandFailure, deliveryCredsKey, DELIVERY_PIDFILE, extensionsDir, findCotalRoot, folderSpaceOverSelection, MIN_FILE_STORE, stoppedStack, unsettledStackOperation, hasUserAuthState, homeCotalDir, cachedPreferences, resolvePreference, isMeshRegistryError, isWorkspaceTargetError, jsonFlag, loadSoleSpaceAuth, localProcessPath, localProcessVisible, MANAGER_PIDFILE, oneLine, PREFERENCE_KEYS, parsePid, plainFlag, preflightTarget, presentationOf, probeLiveness, probeWebReadiness, readCurrent, readMeshRegistry, preparedRecordSkipped, readPreparedSpaces, readRenewalRecord, renderWorkspaceError, resolveMeshTarget, serverFlag, spaceFlag, userAuthStateDir, WEB_PIDFILE, WEB_READINESS_HEADER, workspaceSecretStore, writeResult, workspaceErrorParts, preferencesPath, preferencesFolderWarning, cotalDirLink, movedProject, spaceStreamsAbsent, spaceStreamsExpected, } from "@cotal-ai/workspace";
|
|
6
6
|
import { localProcessSurface } from "../ext-loader.js";
|
|
7
7
|
import { cliVersion, cliProvenance, readExtensionVersions } from "../lib/version.js";
|
|
8
8
|
import { agentSkillsSkew } from "../lib/agent-skills.js";
|
|
9
9
|
import { managerHasDeliveryMarker } from "../lib/manager-proc.js";
|
|
10
10
|
import { signedInSpace } from "../lib/conversation-identity.js";
|
|
11
11
|
import { connectorHarnesses, connectorStatusRows, machineStatus, recordedWebUrl, resolveRuntimeSpace, webBoundAddress, webInstalled, webSessionSource } from "../lib/status.js";
|
|
12
|
-
import { deliveryResponderFromLease, deliveryResponderState, deliveryRowSuffix, RESPONDER_UNBOUND_CONSEQUENCE } from "../lib/delivery-responder.js";
|
|
12
|
+
import { deliveryResponderFromLease, deliveryResponderState, deliveryRowSuffix, RESPONDER_STALE_TEXT, RESPONDER_UNBOUND_CONSEQUENCE } from "../lib/delivery-responder.js";
|
|
13
|
+
import { brokerStoreWrite, storeFull, storeWriteRepair } from "../lib/broker-store-health.js";
|
|
14
|
+
import { chatStreamGone, stackState } from "../lib/space-streams.js";
|
|
13
15
|
import { pidfileState } from "./down.js";
|
|
14
16
|
import { displayCmd } from "../lib/self-exec.js";
|
|
17
|
+
import { shellWord } from "../lib/endpoint-errors.js";
|
|
15
18
|
import { readPersonas } from "../lib/personas.js";
|
|
16
19
|
import { defaultPersonaFix } from "../lib/default-persona.js";
|
|
17
20
|
import { c } from "../ui.js";
|
|
@@ -21,11 +24,15 @@ import { invalidEnvironmentValues } from "./config.js";
|
|
|
21
24
|
import { onInstance } from "../lib/control.js";
|
|
22
25
|
import { serviceDefinitionProjection, serviceDefinitionStore } from "../lib/service-definitions.js";
|
|
23
26
|
import { instanceProjection, serviceInstances } from "../lib/service-instances.js";
|
|
27
|
+
import { readinessAddressSurvivors } from "../lib/service-process.js";
|
|
24
28
|
import { freshTeamAttemptSettled, listFreshTeamAttempts, listFreshTeamSummaries } from "../lib/team-fresh.js";
|
|
25
29
|
import { additiveTeamRecordedState, listAdditiveTeamAttempts } from "../lib/team-additive-attempt.js";
|
|
26
|
-
import { preservedSourceState, restoreNextStep } from "../lib/restore.js";
|
|
30
|
+
import { maintenanceNextStep, preservedSourceState, restoreNextStep, rolledBackNotes } from "../lib/restore.js";
|
|
27
31
|
import { attemptProcessesGone } from "../lib/isolated-broker.js";
|
|
28
|
-
import { readStackJournal } from "../lib/stack-journal.js";
|
|
32
|
+
import { journalRecordedElsewhere, readStackJournal, serviceHeldRecords, STACK_DEFINITION, stackStartedWithoutManager, stackOperationBlock, goneStackRoot, unfinishedStackOperation, } from "../lib/stack-journal.js";
|
|
33
|
+
import { cotalLinkHere, homeHoldsStack, linkedCotalRemedy } from "../lib/paths.js";
|
|
34
|
+
import { storeWriteProblem } from "../lib/store-dir.js";
|
|
35
|
+
import { natsServerLabel } from "../lib/nats-bin.js";
|
|
29
36
|
/** `--components` is the fail-loud health pass with a machine-readable EXIT DISPOSITION. Bare
|
|
30
37
|
* `status` is a broad, recovery-oriented report: it exits 0, or 4 when it could not read part of what
|
|
31
38
|
* it reports; this explicit mode is for an operator or monitor that needs a component state per
|
|
@@ -116,43 +123,77 @@ export async function status(args) {
|
|
|
116
123
|
const selected = resolveSelected(cwd, values);
|
|
117
124
|
const gaps = new Gaps();
|
|
118
125
|
const hints = [];
|
|
119
|
-
|
|
126
|
+
// A folder this account cannot read hides everything in it, so that is the one gap reported for it.
|
|
127
|
+
const blocked = folderReadProblem(root);
|
|
128
|
+
if (blocked) {
|
|
129
|
+
gaps.add("FOLDER_UNREADABLE", `this folder ${root} cannot be read by this account (${blocked}), so nothing in it was read`, { root });
|
|
130
|
+
hints.push(`make it readable by you, for example with chmod u+rx ${root}`);
|
|
131
|
+
}
|
|
132
|
+
// Every command warns about a preferences folder another account could write; status also lists its fix.
|
|
133
|
+
const preferencesFolder = preferencesFolderWarning();
|
|
134
|
+
if (preferencesFolder)
|
|
135
|
+
hints.push(`protect the preferences folder: ${preferencesFolder.remedy}`);
|
|
136
|
+
const machine = await readMachine(selected, gaps, hints);
|
|
120
137
|
const extensions = readExtensions(gaps);
|
|
121
138
|
// THE RESPONDER AXIS (#1576), read ONCE and threaded into the rows that would otherwise claim
|
|
122
139
|
// health they never checked. It is read before the folder section because that section renders
|
|
123
140
|
// the delivery process row, and a live pid means nothing without it.
|
|
124
141
|
const responder = await readResponderAxis(selected);
|
|
125
|
-
const folder = await readFolder(root, selected, values, responder.state, gaps, hints);
|
|
126
|
-
const meshes = await readMeshes(selected, Boolean(values.all), gaps);
|
|
127
|
-
const target = await readSelected(selected, responder, gaps, hints);
|
|
142
|
+
const folder = blocked ? unreadFolder(root, blocked) : await readFolder(root, selected, values, responder.state, gaps, hints);
|
|
143
|
+
const meshes = await readMeshes(cwd, selected, Boolean(values.all), gaps);
|
|
144
|
+
const target = await readSelected(selected, responder, folder, gaps, hints);
|
|
128
145
|
const services = readOwnedServices(selected, gaps);
|
|
129
|
-
const bootAttempts = readBootAttempts(root, gaps);
|
|
130
|
-
const maintenance = readMaintenance(root, gaps);
|
|
131
|
-
const
|
|
146
|
+
const bootAttempts = blocked ? { root, state: "partial", observedAt: new Date().toISOString(), unsettled: [], additive: [], unreadable: [], elsewhere: [] } : readBootAttempts(root, gaps);
|
|
147
|
+
const maintenance = blocked ? { root, space: null, state: "unreadable", attemptId: null, next: null } : readMaintenance(root, gaps);
|
|
148
|
+
const logged = selected.ok ? brokerStoreWrite(selected.target.root, selected.target.space) : undefined;
|
|
149
|
+
// A store write failure holds until the broker restarts, so it is named before a full store.
|
|
150
|
+
const full = selected.ok && target.resolved && target.storedBytes !== null && logged?.state !== "write-failed" ? storeFull(selected.target.root, selected.target.space, target.storedBytes) : undefined;
|
|
151
|
+
const store = full ?? logged;
|
|
152
|
+
const stackManager = selected.ok ? await readStackManager(selected.target, services) : undefined;
|
|
153
|
+
// Two readers can name the same unreadable record, so each hint is listed once.
|
|
154
|
+
const result = { kind: "infrastructure", machine, extensions, folder, meshes, selected: target, services, bootAttempts, maintenance, ...(store ? { store } : {}), ...(stackManager ? { stackManager } : {}), hints: [...new Set(hints)] };
|
|
132
155
|
const parts = gaps.warnings.length;
|
|
133
156
|
// A preference variable `config set` would refuse is named, but it was read, so the run stays complete.
|
|
134
|
-
|
|
157
|
+
// An unreadable preferences file is already a gap, so the variables are checked without it.
|
|
158
|
+
let preferences;
|
|
159
|
+
try {
|
|
160
|
+
preferences = cachedPreferences();
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
preferences = { schemaVersion: 1, revision: 0, defaults: {}, spaces: {} };
|
|
164
|
+
}
|
|
165
|
+
const context = { preferences, space: selected.ok ? selected.target.space : undefined };
|
|
135
166
|
const invalidValues = invalidEnvironmentValues(PREFERENCE_KEYS.map((key) => resolvePreference(key, context)));
|
|
167
|
+
// An address a saved service's readiness checks that still answers with none of its instances
|
|
168
|
+
// running is named, but it is not a part status failed to read, so the run stays complete.
|
|
169
|
+
const survivors = selected.ok && services.state === "read" ? await readinessAddressSurvivors(selected.target.space) : [];
|
|
136
170
|
writeResult(presentation, {
|
|
137
171
|
command: "status",
|
|
138
|
-
|
|
172
|
+
// A prepared or stopped space is still the one this report is for, so it heads the report too.
|
|
173
|
+
target: { space: result.selected.space ?? null, scope: values.all ? "all" : "selected" },
|
|
139
174
|
result,
|
|
140
175
|
completeness: parts ? "partial" : "complete",
|
|
141
|
-
warnings: [...gaps.warnings, ...invalidValues],
|
|
176
|
+
warnings: [...gaps.warnings, ...invalidValues, ...survivors],
|
|
142
177
|
...(parts ? { partial: { message: `status could not read ${parts === 1 ? "one part" : `${parts} parts`} of what it reports; the warnings name ${parts === 1 ? "it" : "each"}` } } : {}),
|
|
143
178
|
}, (result) => statusView(result, Boolean(values.verbose)));
|
|
144
179
|
if (values.components)
|
|
145
180
|
await printComponentHealth(cwd, values);
|
|
146
181
|
}
|
|
147
|
-
/**
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
182
|
+
/** Why this account cannot list or search `root`, or undefined when it can. */
|
|
183
|
+
function folderReadProblem(root) {
|
|
184
|
+
try {
|
|
185
|
+
accessSync(root, constants.R_OK | constants.X_OK);
|
|
186
|
+
return undefined;
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
const code = error.code;
|
|
190
|
+
return code === "EACCES" || code === "EPERM" ? code : undefined;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/** The folder section for a folder this account cannot read: every part of it is unread. */
|
|
194
|
+
function unreadFolder(root, code) {
|
|
195
|
+
const error = `${root} cannot be read by this account (${code})`;
|
|
196
|
+
return { root, auth: { state: "unreadable", spaces: [], userAuth: false, error }, personas: { root: personaDir(root), default: "unreadable", demo: null, error }, launches: null, processes: null, processSpace: null, storedState: false, controllerStack: false, noManager: false, stackBlock: null };
|
|
156
197
|
}
|
|
157
198
|
/** The folder's maintenance journal, read only. An unreadable one is reported, never taken for none. */
|
|
158
199
|
function readMaintenance(root, gaps) {
|
|
@@ -160,30 +201,31 @@ function readMaintenance(root, gaps) {
|
|
|
160
201
|
const journal = readMaintenanceJournal(root);
|
|
161
202
|
if (!journal)
|
|
162
203
|
return null;
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
: journal.state === "ready" ? readyNextStep(root, journal.source)
|
|
166
|
-
: journal.state === "claimed" ? claimedNextStep(root, journal.claim) : null;
|
|
167
|
-
return { root, space: journal.space, state: journal.state, attemptId, next };
|
|
204
|
+
const rolledBack = "restore" in journal ? restoreRolledBackRuns(journal) : undefined;
|
|
205
|
+
return { root, space: journal.space, state: journal.state, ...maintenanceNextStep(root, journal), ...(rolledBack?.runs.length ? { rolledBackRuns: rolledBack.runs, ...(rolledBack.more ? { rolledBackRunsMore: rolledBack.more } : {}) } : {}) };
|
|
168
206
|
}
|
|
169
207
|
catch {
|
|
170
208
|
gaps.add("MAINTENANCE_JOURNAL_UNREADABLE", "this folder's maintenance journal could not be read; no absent or settled state was inferred", { root });
|
|
171
209
|
return { root, space: null, state: "unreadable", attemptId: null, next: null };
|
|
172
210
|
}
|
|
173
211
|
}
|
|
174
|
-
/** The next step for a cut a backup create still claims: wait while it runs, or release it once it
|
|
175
|
-
* stopped before it finished. */
|
|
176
|
-
function claimedNextStep(root, claim) {
|
|
177
|
-
const recover = `${displayCmd()} backup recover ${claim.attemptId} --yes`;
|
|
178
|
-
if (assessMaintenanceClaim(claim, { unrecordedOwnersDead: attemptProcessesGone(root) }) === "stale")
|
|
179
|
-
return `backup attempt ${claim.attemptId} stopped before it finished: release it with ${recover}`;
|
|
180
|
-
return `backup attempt ${claim.attemptId} holds this root until ${claim.deadline} (process ${claim.coordinator.pid}); if it was stopped, run ${recover} once it has exited`;
|
|
181
|
-
}
|
|
182
212
|
/** Local boot and additive intents are recovery coordinates, not evidence of native state. */
|
|
183
213
|
function readBootAttempts(root, gaps) {
|
|
184
214
|
// A refusal with its own cause, such as a root other local accounts can write, is named.
|
|
185
215
|
const because = (error) => isCommandFailure(error) ? ` (${error.message})` : "";
|
|
186
216
|
const result = { root, state: "not-checked", observedAt: new Date().toISOString(), unsettled: [], additive: [], unreadable: [], elsewhere: [] };
|
|
217
|
+
// A `.cotal` link that leads nowhere leaves this folder no records of its own, and the walk to a
|
|
218
|
+
// root passes over it.
|
|
219
|
+
const here = cotalLinkHere();
|
|
220
|
+
if (here?.dangling)
|
|
221
|
+
gaps.add("COTAL_DIR_DANGLING", `this folder's .cotal links to ${here.target}, which does not exist, so this folder has no records of its own; remove the link and prepare this folder with cotal space create <space> --root ${here.root}`, { root: here.root, path: here.path, link: here.target });
|
|
222
|
+
// Neither inventory is read through a link; the folder it leads to reports its own.
|
|
223
|
+
const link = cotalDirLink(root);
|
|
224
|
+
if (link !== undefined) {
|
|
225
|
+
result.state = "partial";
|
|
226
|
+
gaps.add("COTAL_DIR_LINKED", `this folder's .cotal is a link to ${link}, so its fresh boot and additive attempt inventories were not read through it; ${linkedCotalRemedy(root, link)}`, { root, link });
|
|
227
|
+
return result;
|
|
228
|
+
}
|
|
187
229
|
try {
|
|
188
230
|
if (!realDirNoSymlink(root, ".cotal"))
|
|
189
231
|
return result;
|
|
@@ -232,8 +274,11 @@ function readOwnedServices(selected, gaps) {
|
|
|
232
274
|
const causeCode = isCommandFailure(error) ? error.code : "TARGET_UNAVAILABLE";
|
|
233
275
|
gaps.add("SERVICE_DEFINITIONS_UNAVAILABLE", `the selected space's owned service definitions could not be read (${causeCode}); no empty inventory or repair was inferred`, { space, causeCode });
|
|
234
276
|
}
|
|
277
|
+
// By definition, then instance, as the definitions are listed: the store orders them by their
|
|
278
|
+
// random instance IDs, so the rows changed order whenever a member started under a new one.
|
|
279
|
+
const byName = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
235
280
|
try {
|
|
236
|
-
result.instances = serviceInstances(space).map(instanceProjection);
|
|
281
|
+
result.instances = serviceInstances(space).map(instanceProjection).sort((a, b) => byName(a.definition, b.definition) || byName(a.instanceId, b.instanceId));
|
|
237
282
|
}
|
|
238
283
|
catch (error) {
|
|
239
284
|
const causeCode = isCommandFailure(error) ? error.code : "TARGET_UNAVAILABLE";
|
|
@@ -243,15 +288,18 @@ function readOwnedServices(selected, gaps) {
|
|
|
243
288
|
result.observedAt = new Date().toISOString();
|
|
244
289
|
return result;
|
|
245
290
|
}
|
|
246
|
-
async function readMachine(selected, gaps) {
|
|
291
|
+
async function readMachine(selected, gaps, hints) {
|
|
247
292
|
const m = await machineStatus();
|
|
248
293
|
let defaults = null;
|
|
249
294
|
try {
|
|
250
295
|
const context = { preferences: cachedPreferences(), space: selected.ok ? selected.target.space : undefined };
|
|
251
296
|
defaults = { harness: resolvePreference("harness", context).value, persona: resolvePreference("persona", context).value };
|
|
252
297
|
}
|
|
253
|
-
catch {
|
|
254
|
-
|
|
298
|
+
catch (e) {
|
|
299
|
+
// The refusal names the file and its problem, and its remedy is the next step.
|
|
300
|
+
gaps.add("PREFERENCES_UNREADABLE", `the saved agent defaults could not be read: ${e.message}`, { path: preferencesPath() });
|
|
301
|
+
if (isCommandFailure(e) && e.remedy)
|
|
302
|
+
hints.push(e.remedy);
|
|
255
303
|
}
|
|
256
304
|
let connectors = null;
|
|
257
305
|
const integrations = [];
|
|
@@ -292,6 +340,8 @@ async function readMachine(selected, gaps) {
|
|
|
292
340
|
platform: `${process.platform === "darwin" ? "macOS" : process.platform === "win32" ? "Windows" : process.platform === "linux" ? "Linux" : process.platform} ${process.arch}`,
|
|
293
341
|
install: cliProvenance(),
|
|
294
342
|
nats: m.nats,
|
|
343
|
+
natsServer: m.natsServer,
|
|
344
|
+
natsProblem: m.natsProblem,
|
|
295
345
|
integrations,
|
|
296
346
|
defaults,
|
|
297
347
|
connectors: connectors?.map((h) => ({ name: h.name, requires: [...h.requires], missing: h.missing })) ?? null,
|
|
@@ -438,7 +488,7 @@ async function readResponderAxis(selected) {
|
|
|
438
488
|
}
|
|
439
489
|
async function readFolder(root, selected, values, responder, gaps, hints) {
|
|
440
490
|
const cmd = displayCmd();
|
|
441
|
-
const folder = (auth, processes = null, storedState = false, processSpace = null, controllerStack = false) => ({
|
|
491
|
+
const folder = (auth, processes = null, storedState = false, processSpace = null, controllerStack = false, noManager = false, stackBlock = null, stackUnfinished = null) => ({
|
|
442
492
|
root,
|
|
443
493
|
auth,
|
|
444
494
|
...folderPersonas(root, selected, values, gaps, hints),
|
|
@@ -446,6 +496,9 @@ async function readFolder(root, selected, values, responder, gaps, hints) {
|
|
|
446
496
|
processSpace,
|
|
447
497
|
storedState,
|
|
448
498
|
controllerStack,
|
|
499
|
+
noManager,
|
|
500
|
+
stackBlock,
|
|
501
|
+
stackUnfinished,
|
|
449
502
|
});
|
|
450
503
|
const unreadable = (error, hint) => {
|
|
451
504
|
gaps.add("AUTH_UNREADABLE", `this folder's trust material could not be read: ${error}`, { root });
|
|
@@ -532,16 +585,58 @@ async function readFolder(root, selected, values, responder, gaps, hints) {
|
|
|
532
585
|
}
|
|
533
586
|
// A stopped mesh with a persisted store: name the reset verb. Stale state (e.g. durables from
|
|
534
587
|
// an older Cotal generation) is otherwise invisible until a spawn fails on it. The restart is
|
|
535
|
-
//
|
|
588
|
+
// "your usual flags": a stopped stack's flags are not all recorded. A static-auth broker that
|
|
589
|
+
// exited here is named the repair `up` first, under Next (see `nextActions`).
|
|
536
590
|
// A controller stack's broker has no legacy pidfile, so that heuristic says nothing about it.
|
|
537
|
-
let controllerStack = false;
|
|
591
|
+
let controllerStack = false, journal, elsewhere = false, unusable = false;
|
|
538
592
|
try {
|
|
539
|
-
|
|
593
|
+
journal = readStackJournal(root)?.journal;
|
|
594
|
+
controllerStack = journal?.space === space;
|
|
540
595
|
}
|
|
541
|
-
catch {
|
|
596
|
+
catch (error) {
|
|
542
597
|
controllerStack = false;
|
|
543
|
-
|
|
544
|
-
|
|
598
|
+
// A journal no command can use is named with its way out, in the warnings and under Next; the
|
|
599
|
+
// rest of the report still stands.
|
|
600
|
+
if (isCommandFailure(error) && error.code === "SCHEMA_INVALID") {
|
|
601
|
+
unusable = true;
|
|
602
|
+
gaps.add("STACK_JOURNAL_INVALID", error.remedy ? `${error.message}; ${error.remedy}` : error.message, { root });
|
|
603
|
+
if (error.remedy)
|
|
604
|
+
hints.push(error.remedy);
|
|
605
|
+
}
|
|
606
|
+
// A journal another folder recorded, as a copy or a moved folder keeps it: clean store refuses here.
|
|
607
|
+
elsewhere = isCommandFailure(error) && error.code === "CONFLICT";
|
|
608
|
+
}
|
|
609
|
+
const noManager = journal !== undefined && controllerStack && stackStartedWithoutManager(journal);
|
|
610
|
+
// An operation cut off with no recorded outcome can keep up and down from settling it; status names
|
|
611
|
+
// why and the way out their refusal names. A refusal of another kind is left to them.
|
|
612
|
+
let stackBlock = null;
|
|
613
|
+
if (journal && controllerStack)
|
|
614
|
+
try {
|
|
615
|
+
stackBlock = stackOperationBlock(journal) ?? null;
|
|
616
|
+
}
|
|
617
|
+
catch {
|
|
618
|
+
stackBlock = null;
|
|
619
|
+
}
|
|
620
|
+
// One that left the stack part way is named with the command that finishes it.
|
|
621
|
+
let stackUnfinished = null;
|
|
622
|
+
if (journal && controllerStack && !stackBlock)
|
|
623
|
+
try {
|
|
624
|
+
stackUnfinished = unfinishedStackOperation(journal) ?? null;
|
|
625
|
+
}
|
|
626
|
+
catch {
|
|
627
|
+
stackUnfinished = null;
|
|
628
|
+
}
|
|
629
|
+
// A copy or a moved folder keeps the stack journal another folder recorded, and its store is that
|
|
630
|
+
// stack's. Clean store refuses there with the step the journal's refusal names.
|
|
631
|
+
let copiedStack = false;
|
|
632
|
+
if (!controllerStack)
|
|
633
|
+
try {
|
|
634
|
+
copiedStack = journalRecordedElsewhere(root)?.journal.space === space;
|
|
635
|
+
}
|
|
636
|
+
catch {
|
|
637
|
+
copiedStack = false;
|
|
638
|
+
}
|
|
639
|
+
const storedState = !controllerStack && !elsewhere && !copiedStack && nats?.liveness !== "alive" && existsSync(join(root, ".cotal", "nats"));
|
|
545
640
|
// While a maintenance journal holds the store, clean store refuses, so it is not offered.
|
|
546
641
|
let maintained = false;
|
|
547
642
|
try {
|
|
@@ -550,9 +645,28 @@ async function readFolder(root, selected, values, responder, gaps, hints) {
|
|
|
550
645
|
catch {
|
|
551
646
|
maintained = true;
|
|
552
647
|
}
|
|
553
|
-
|
|
648
|
+
// Its next step is the unusable journal's, which every stack command refuses until it is fixed.
|
|
649
|
+
if (storedState && !maintained && !unusable)
|
|
554
650
|
hints.push(`if the stored JetStream state is stale: ${cmd} clean store --force, then \`up\` with your usual flags (\`clean all\` also resets identity)`);
|
|
555
|
-
|
|
651
|
+
// A stack started with --no-manager can still have a manager: a `manager` preset service run here.
|
|
652
|
+
let managerService = null;
|
|
653
|
+
if (noManager && journal)
|
|
654
|
+
try {
|
|
655
|
+
const held = serviceHeldRecords(root, journal.space).find((row) => row.record.name === "manager");
|
|
656
|
+
managerService = held ? { definition: held.definition, instanceId: held.instanceId } : null;
|
|
657
|
+
}
|
|
658
|
+
catch {
|
|
659
|
+
managerService = null;
|
|
660
|
+
}
|
|
661
|
+
let heldServices = [];
|
|
662
|
+
if (controllerStack && journal)
|
|
663
|
+
try {
|
|
664
|
+
heldServices = serviceHeldRecords(root, journal.space).map((row) => ({ definition: row.definition, instanceId: row.instanceId, record: row.record.name, pid: row.record.pid }));
|
|
665
|
+
}
|
|
666
|
+
catch {
|
|
667
|
+
heldServices = null;
|
|
668
|
+
}
|
|
669
|
+
return { ...folder({ state: auth ? "space" : "none", spaces: auth ? [auth.space] : [], userAuth: userDisk, error: null }, processes, storedState, space, controllerStack, noManager, stackBlock, stackUnfinished), managerService, heldServices };
|
|
556
670
|
}
|
|
557
671
|
/** The folder's persona catalog, which must never let a catalog imply a `spawn` the operator does
|
|
558
672
|
* not have.
|
|
@@ -643,27 +757,43 @@ async function managerProcess(target, state, space, gaps) {
|
|
|
643
757
|
const running = (extra) => ({ name: "manager", state: "running", pid: state.pid ?? null, detail: [...details, ...(extra ? [extra] : [])].join(" · ") });
|
|
644
758
|
if (!target)
|
|
645
759
|
return running();
|
|
760
|
+
const endpoint = await managerEndpoint(target);
|
|
761
|
+
if (endpoint === "not-answering")
|
|
762
|
+
return { name: "manager", state: "not-serving", pid: state.pid ?? null, detail: ["service endpoint not answering", ...details.filter((d) => d.startsWith("delivery-aware marker unreadable"))].join(" · ") };
|
|
763
|
+
return running(endpoint === "unchecked" ? "service unchecked" : undefined);
|
|
764
|
+
}
|
|
765
|
+
/** One probe of the space's manager service endpoint. Only a definitive no-answer is
|
|
766
|
+
* `not-answering`; a refused probe or an `unavailable` user-mode credential is `unchecked`, so a
|
|
767
|
+
* failed probe never reads as a dead rail. The operator's credential calls the class rail, so with
|
|
768
|
+
* `instanceId` an answer from another manager instance is `unchecked` too. */
|
|
769
|
+
async function managerEndpoint(target, instanceId) {
|
|
646
770
|
try {
|
|
647
771
|
let auth;
|
|
648
772
|
if (target.mode === "user") {
|
|
649
773
|
const credential = await componentCredential(target);
|
|
650
774
|
if (credential.kind !== "user")
|
|
651
|
-
return
|
|
775
|
+
return "unchecked";
|
|
652
776
|
auth = { bearer: credential.bearer, sentinelCreds: credential.sentinelCreds, caller: credential.caller };
|
|
653
777
|
}
|
|
654
778
|
else {
|
|
655
779
|
auth = await staticServiceAuth(target.auth);
|
|
656
780
|
}
|
|
657
|
-
await managerServiceHealth(target, auth);
|
|
658
|
-
return
|
|
781
|
+
const status = await managerServiceHealth(target, auth);
|
|
782
|
+
return instanceId === undefined || status.instanceId === instanceId ? "answered" : "unchecked";
|
|
659
783
|
}
|
|
660
784
|
catch (e) {
|
|
661
|
-
|
|
662
|
-
if (noService)
|
|
663
|
-
return { name: "manager", state: "not-serving", pid: state.pid ?? null, detail: ["service endpoint not answering", ...details.filter((d) => d.startsWith("delivery-aware marker unreadable"))].join(" · ") };
|
|
664
|
-
return running("service unchecked");
|
|
785
|
+
return e instanceof EpEnvelopeError && (unansweredRequest(e) || /service registry.*stream not found/i.test(e.message)) ? "not-answering" : "unchecked";
|
|
665
786
|
}
|
|
666
787
|
}
|
|
788
|
+
/** A controller stack's manager is an owned service, and its instance record reads `running` while
|
|
789
|
+
* the process lives, a hung one included. So a running stack manager gets the probe the legacy
|
|
790
|
+
* manager row gets, and only an answer from its own native instance counts. */
|
|
791
|
+
async function readStackManager(target, services) {
|
|
792
|
+
const row = services.instances?.find((item) => item.definition === STACK_DEFINITION.manager && item.observedProcess === "running");
|
|
793
|
+
if (!row?.pid)
|
|
794
|
+
return undefined;
|
|
795
|
+
return { instanceId: row.instanceId, pid: row.pid, endpoint: await managerEndpoint(target, row.nativeEndpoint?.instanceId) };
|
|
796
|
+
}
|
|
667
797
|
/** The delivery row's responder detail (#1576). An unbound responder is not a footnote about a
|
|
668
798
|
* component: while it holds, the mesh cannot spawn, retire or accept a join, and the whole reported
|
|
669
799
|
* incident is that this read as ordinary. `unknown` names `--components`, because an unchecked axis
|
|
@@ -671,12 +801,12 @@ async function managerProcess(target, state, space, gaps) {
|
|
|
671
801
|
function deliveryDetail(live, responder) {
|
|
672
802
|
return deliveryRowSuffix(live, responder, `${displayCmd()} status --components`).replace(/^ · /, "") || null;
|
|
673
803
|
}
|
|
674
|
-
/** The recorded meshes. Only the selected one is checked
|
|
675
|
-
*
|
|
676
|
-
*
|
|
677
|
-
* FAIL1 attack — so a list that only asks "is
|
|
678
|
-
* the record claims. */
|
|
679
|
-
async function readMeshes(selected, all, gaps) {
|
|
804
|
+
/** The recorded meshes. Only the selected one is checked, and only when the command dials its
|
|
805
|
+
* recorded address, unless `--all` asks for every one; each check dials that record's own address
|
|
806
|
+
* with its own recorded TLS requirement. A bare TCP/INFO probe would green-light a plaintext broker
|
|
807
|
+
* that has substituted for a TLS-required mesh — the FAIL1 attack — so a list that only asks "is
|
|
808
|
+
* anything listening" cannot report on the one property the record claims. */
|
|
809
|
+
async function readMeshes(cwd, selected, all, gaps) {
|
|
680
810
|
// A registry file that cannot be read is named, and the readable records are still listed and
|
|
681
811
|
// checked. Only an absent directory or pointer is an empty registry or no current mesh.
|
|
682
812
|
const unreadable = [];
|
|
@@ -705,7 +835,18 @@ async function readMeshes(selected, all, gaps) {
|
|
|
705
835
|
throw e;
|
|
706
836
|
unread(e.file, e.message);
|
|
707
837
|
}
|
|
708
|
-
|
|
838
|
+
// A record this needs that cannot be read is already named above.
|
|
839
|
+
let folder = null;
|
|
840
|
+
try {
|
|
841
|
+
folder = folderSpaceOverSelection(cwd, current) ?? null;
|
|
842
|
+
}
|
|
843
|
+
catch (e) {
|
|
844
|
+
if (!isMeshRegistryError(e))
|
|
845
|
+
throw e;
|
|
846
|
+
}
|
|
847
|
+
const chosen = selected.ok ? selected.target : undefined;
|
|
848
|
+
// A `--server` that names another address is the only broker dialed for the selected space.
|
|
849
|
+
const checked = (m) => all || (m.space === chosen?.space && m.server === chosen.server);
|
|
709
850
|
const items = await Promise.all(entries.map(async (m) => ({
|
|
710
851
|
space: m.space,
|
|
711
852
|
server: displayStatusBroker(m.server, m.space, gaps),
|
|
@@ -714,20 +855,81 @@ async function readMeshes(selected, all, gaps) {
|
|
|
714
855
|
origin: m.origin ?? null,
|
|
715
856
|
tlsRequired: Boolean(m.tlsRequired),
|
|
716
857
|
eventsRequired: m.policy?.events === "required",
|
|
858
|
+
modeChecked: m.unchecked !== true,
|
|
717
859
|
current: m.space === current,
|
|
718
|
-
check:
|
|
860
|
+
check: checked(m) ? ((await isReachable(m.server, m.tlsRequired ? { tls: true } : {})) ? "reachable" : "unreachable") : "not-checked",
|
|
719
861
|
catalog: m.origin === "catalog" ? { name: m.catalogName && m.catalogName !== m.space ? m.catalogName : null, fetchedAt: m.catalogFetchedAt ?? null, error: m.catalogError ?? null } : null,
|
|
720
862
|
})));
|
|
863
|
+
// The prepared spaces folder, or a record in it, that cannot be read is named the same way.
|
|
864
|
+
let currentPrepared = false, currentStopped = false;
|
|
865
|
+
try {
|
|
866
|
+
const prepared = readPreparedSpaces();
|
|
867
|
+
// Named with the warning a command that skips it gives, so a run that also skipped it says it once.
|
|
868
|
+
for (const e of prepared.unusable) {
|
|
869
|
+
const skipped = preparedRecordSkipped(e);
|
|
870
|
+
unreadable.push({ file: e.file, error: e.message });
|
|
871
|
+
gaps.add(skipped.code, skipped.message, skipped.target);
|
|
872
|
+
}
|
|
873
|
+
const selected = current !== null && !entries.some((m) => m.space === current) ? prepared.spaces.find((p) => p.space === current) : undefined;
|
|
874
|
+
currentPrepared = selected !== undefined;
|
|
875
|
+
currentStopped = selected !== undefined && stoppedStack(selected.root, selected.space) !== undefined && unsettledStackOperation(selected.root, selected.space) === undefined;
|
|
876
|
+
}
|
|
877
|
+
catch (e) {
|
|
878
|
+
if (!isMeshRegistryError(e))
|
|
879
|
+
throw e;
|
|
880
|
+
unread(e.file, e.message);
|
|
881
|
+
}
|
|
721
882
|
return {
|
|
722
883
|
current,
|
|
723
884
|
currentRecorded: current === null || entries.some((m) => m.space === current),
|
|
724
|
-
currentPrepared
|
|
885
|
+
currentPrepared,
|
|
886
|
+
currentStopped,
|
|
887
|
+
folder,
|
|
725
888
|
unreadable,
|
|
726
889
|
items,
|
|
727
890
|
catalogs: preparedCatalogDiagnostics().map((r) => ({ idp: r.account.idpUrl, state: r.state, error: r.state === "failed" ? (r.error ?? "refresh failed") : null })),
|
|
728
891
|
};
|
|
729
892
|
}
|
|
730
|
-
|
|
893
|
+
/** The refusal of the stack journal at `root` when it is one no command can use, as `up` and `down`
|
|
894
|
+
* refuse it. Undefined when it reads or is absent. */
|
|
895
|
+
function unusableStackJournal(root) {
|
|
896
|
+
try {
|
|
897
|
+
readStackJournal(root);
|
|
898
|
+
return undefined;
|
|
899
|
+
}
|
|
900
|
+
catch (error) {
|
|
901
|
+
return isCommandFailure(error) && error.code === "SCHEMA_INVALID" ? error : undefined;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
/** The refusal of `space`'s service instance records when one is a record no command can use, as
|
|
905
|
+
* `up` and `down` refuse it. Undefined when they read. */
|
|
906
|
+
function unusableServiceInstances(space) {
|
|
907
|
+
try {
|
|
908
|
+
serviceInstances(space);
|
|
909
|
+
return undefined;
|
|
910
|
+
}
|
|
911
|
+
catch (error) {
|
|
912
|
+
return isCommandFailure(error) && error.code === "SCHEMA_INVALID" ? error : undefined;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
/** Why the broker of the stack at `root` cannot start on its store: the one its stack journal recorded,
|
|
916
|
+
* or `.cotal/nats`. */
|
|
917
|
+
function rootStoreProblem(root) {
|
|
918
|
+
let recorded;
|
|
919
|
+
try {
|
|
920
|
+
recorded = readStackJournal(root)?.journal.broker?.storeDir;
|
|
921
|
+
}
|
|
922
|
+
catch {
|
|
923
|
+
recorded = undefined;
|
|
924
|
+
}
|
|
925
|
+
try {
|
|
926
|
+
return storeWriteProblem(recorded ?? join(root, ".cotal", "nats"));
|
|
927
|
+
}
|
|
928
|
+
catch {
|
|
929
|
+
return undefined;
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
async function readSelected(selected, responder, folder, gaps, hints) {
|
|
731
933
|
const cmd = displayCmd();
|
|
732
934
|
if (!selected.ok) {
|
|
733
935
|
const e = selected.error;
|
|
@@ -738,23 +940,63 @@ async function readSelected(selected, responder, gaps, hints) {
|
|
|
738
940
|
hints.push(e.message);
|
|
739
941
|
return { resolved: false, code: "registry-unreadable", message: e.message };
|
|
740
942
|
}
|
|
943
|
+
// `up` and `down` refuse a root whose `.cotal` is a link, so the step that would start it there is
|
|
944
|
+
// the one their refusal names.
|
|
945
|
+
const unstarted = e instanceof UnregisteredRoot ? e.root : isWorkspaceTargetError(e) && e.code === "not-started" ? e.details.root : undefined;
|
|
946
|
+
const link = unstarted === undefined ? undefined : cotalDirLink(unstarted);
|
|
947
|
+
if (unstarted !== undefined && link !== undefined) {
|
|
948
|
+
hints.push(linkedCotalRemedy(unstarted, link));
|
|
949
|
+
return { resolved: false, code: e instanceof UnregisteredRoot ? "unregistered-root" : "not-started", message: `${join(unstarted, ".cotal")} is a link to ${link}, and a stack runs only from a folder whose .cotal is its own directory, so \`${cmd} up\` and \`${cmd} down\` refuse it there` };
|
|
950
|
+
}
|
|
741
951
|
if (e instanceof UnregisteredRoot) {
|
|
742
952
|
const message = `no space is registered or prepared here for ${e.root}`;
|
|
743
|
-
// A bare `up` in a folder whose records name no space starts
|
|
744
|
-
// then holds
|
|
953
|
+
// A bare `up` in a folder whose records name no space starts a space named after the folder,
|
|
954
|
+
// which then holds it, so the step that brings a forgotten space back is to prepare it again.
|
|
745
955
|
hints.push(e.namesNoSpace
|
|
746
|
-
?
|
|
747
|
-
:
|
|
956
|
+
? `prepare a space with \`${cmd} space create <name> --root ${shellWord(e.root)}\`, or select one with \`${cmd} use <name>\``
|
|
957
|
+
: `run \`${cmd} up\` in ${e.root} to start one, or select a space with \`${cmd} use <name>\``);
|
|
748
958
|
return { resolved: false, code: "unregistered-root", message };
|
|
749
959
|
}
|
|
750
960
|
if (!isWorkspaceTargetError(e))
|
|
751
961
|
throw e;
|
|
752
|
-
// The canonical
|
|
962
|
+
// The canonical parts name the ACTUAL repair per code (`cotal meshes rm`, `--space
|
|
753
963
|
// <name>`, `cotal up --user-auth`, …). A fixed `up --detach` hint would be right for at most one
|
|
754
|
-
// of the codes and point the others at a command that does not fix them.
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
964
|
+
// of the codes and point the others at a command that does not fix them. The section states the
|
|
965
|
+
// selection, and Next gives its repair once.
|
|
966
|
+
const { message, remedy } = workspaceErrorParts({ kind: "target", error: e });
|
|
967
|
+
const d = e.details;
|
|
968
|
+
const storeCap = e.code === "not-started" ? d.stopped?.storeCap : undefined;
|
|
969
|
+
const result = {
|
|
970
|
+
resolved: false, code: e.code, message,
|
|
971
|
+
...(e.code === "not-started" && d.space !== undefined && d.root !== undefined && !d.rootMissing ? { space: d.space, root: d.root } : {}),
|
|
972
|
+
...(storeCap !== undefined && storeCap < MIN_FILE_STORE ? { storeCap } : {}),
|
|
973
|
+
};
|
|
974
|
+
// A start in a root whose broker store this account cannot write fails there, so its next step is
|
|
975
|
+
// the store's, as `up` names it.
|
|
976
|
+
const store = e.code === "not-started" && d.root !== undefined && !d.rootMissing ? rootStoreProblem(d.root) : undefined;
|
|
977
|
+
// A stack journal that no command can use refuses `up` there, so Next names its way out instead.
|
|
978
|
+
const journal = e.code === "not-started" && d.root !== undefined && !d.rootMissing ? unusableStackJournal(d.root) : undefined;
|
|
979
|
+
// So does a service instance record of its space that no command can read, which is also a warning.
|
|
980
|
+
const instances = e.code === "not-started" && !journal && d.space !== undefined ? unusableServiceInstances(d.space) : undefined;
|
|
981
|
+
if (instances)
|
|
982
|
+
gaps.add("SERVICE_INSTANCES_UNAVAILABLE", instances.remedy ? `${instances.message}; ${instances.remedy}` : instances.message, { space: d.space, ...instances.target });
|
|
983
|
+
// This folder's stack cut off with no recorded outcome is named under the selected space, and
|
|
984
|
+
// Next names the step that finishes or settles it. One that neither blocks nor stays part way
|
|
985
|
+
// settles from its members' processes when it starts.
|
|
986
|
+
if (journal) {
|
|
987
|
+
const step = journal.remedy ?? journal.message;
|
|
988
|
+
if (!hints.includes(step))
|
|
989
|
+
hints.push(step);
|
|
990
|
+
}
|
|
991
|
+
else if (instances)
|
|
992
|
+
hints.push(instances.remedy ?? instances.message);
|
|
993
|
+
else if (store)
|
|
994
|
+
hints.push(`${store.message}; ${store.remedy}`);
|
|
995
|
+
else if (!d.unsettled || !servedStack(folder, result))
|
|
996
|
+
hints.push(remedy ?? message);
|
|
997
|
+
else if (!folder.stackBlock && !folder.stackUnfinished)
|
|
998
|
+
hints.push(`start it with \`cotal up\` in ${d.root}`);
|
|
999
|
+
return result;
|
|
758
1000
|
}
|
|
759
1001
|
const target = selected.target;
|
|
760
1002
|
const base = {
|
|
@@ -764,6 +1006,7 @@ async function readSelected(selected, responder, gaps, hints) {
|
|
|
764
1006
|
mode: target.mode,
|
|
765
1007
|
source: target.source,
|
|
766
1008
|
root: target.root,
|
|
1009
|
+
rootGone: stackRootGone(target.space, target.root),
|
|
767
1010
|
tlsRequired: Boolean(target.tlsRequired),
|
|
768
1011
|
eventsRequired: target.policy?.events === "required",
|
|
769
1012
|
idp: target.userAuth?.idp.url ?? null,
|
|
@@ -773,6 +1016,8 @@ async function readSelected(selected, responder, gaps, hints) {
|
|
|
773
1016
|
deliveryResponder: null,
|
|
774
1017
|
channels: null,
|
|
775
1018
|
membershipFeed: null,
|
|
1019
|
+
spaceStreams: { state: "not-checked", root: null, stack: null },
|
|
1020
|
+
storedBytes: null,
|
|
776
1021
|
};
|
|
777
1022
|
if (target.mode === "user") {
|
|
778
1023
|
// Status never static-mints on a user-auth mesh (the flip). Everything here is offline
|
|
@@ -804,16 +1049,34 @@ async function readSelected(selected, responder, gaps, hints) {
|
|
|
804
1049
|
return { ...result, snapshot: { state: "skipped", reason: "broker unreachable" } };
|
|
805
1050
|
if (!granted)
|
|
806
1051
|
return { ...result, snapshot: { state: "skipped", reason: "needs a signed-in, granted login" } };
|
|
807
|
-
return { ...result, ...(await readSnapshot(() => userSnapshotEndpoint(target, stateDir), target.space, gaps)) };
|
|
1052
|
+
return { ...result, ...(await readSnapshot(() => userSnapshotEndpoint(target, stateDir), target.space, true, gaps)) };
|
|
1053
|
+
}
|
|
1054
|
+
// A project folder moved after its stack started there keeps the seed under its new path, where a
|
|
1055
|
+
// probe without it reads as authentication required. Name the move and the way back, as send does.
|
|
1056
|
+
const moved = target.mode === "auth" && !target.auth ? movedProject(target.space, target.root) : undefined;
|
|
1057
|
+
if (moved) {
|
|
1058
|
+
hints.push(moved.remedy);
|
|
1059
|
+
return { resolved: false, code: "moved-folder", message: moved.message };
|
|
808
1060
|
}
|
|
809
1061
|
const preflight = await preflightTarget(target);
|
|
810
|
-
if (!preflight.ok)
|
|
811
|
-
|
|
1062
|
+
if (!preflight.ok) {
|
|
1063
|
+
// A `--server` address that is not the one recorded for the space says nothing about whether its
|
|
1064
|
+
// stack runs, so Next names that address as the refusal of other commands does. A stopped stack
|
|
1065
|
+
// this machine started keeps its registration, as a connect keeps it, so Next names the `up` that
|
|
1066
|
+
// starts it again rather than a registration to repair.
|
|
1067
|
+
const flagged = (target.source === "flag-server" || target.source === "flag-space-override") && target.recordedServer !== target.server;
|
|
1068
|
+
const offline = preflight.kind === "unreachable" && !flagged && target.origin === "up";
|
|
1069
|
+
if (preflight.kind === "unreachable" && (flagged || offline)) {
|
|
1070
|
+
const { message, remedy } = workspaceErrorParts({ kind: "preflight", failure: "unreachable", target, pruned: !offline && preflight.prune });
|
|
1071
|
+
hints.push(remedy === undefined ? message : `${message}; ${remedy}`);
|
|
1072
|
+
}
|
|
1073
|
+
return { ...base, connection: preflight.kind, ...(preflight.pid === undefined ? {} : { brokerPid: preflight.pid }), staleRecord: preflight.prune && !offline, snapshot: { state: "skipped", reason: "broker not connected" } };
|
|
1074
|
+
}
|
|
812
1075
|
// The mesh-level statement of the same axis (#1576). The folder section says what this machine's
|
|
813
1076
|
// delivery PROCESS is doing; this says whether the SPACE currently has a bound responder, which is
|
|
814
1077
|
// the question "can I spawn into this mesh right now" actually reduces to. An operator reading a
|
|
815
1078
|
// reachable broker and a running daemon had, before this, no row that said otherwise.
|
|
816
|
-
return { ...base, connection: "ok", deliveryResponder: target.mode === "open" && !responder.leased ? null : responder.state, ...(await readSnapshot(() => snapshotEndpoint(target), target.space, gaps)) };
|
|
1079
|
+
return { ...base, connection: "ok", deliveryResponder: target.mode === "open" && !responder.leased ? null : responder.state, ...(await readSnapshot(() => snapshotEndpoint(target), target.space, spaceStreamsExpected(target.space, target.mode), gaps)) };
|
|
817
1080
|
}
|
|
818
1081
|
async function snapshotEndpoint(target) {
|
|
819
1082
|
const id = newIdentity();
|
|
@@ -861,9 +1124,15 @@ async function userSnapshotEndpoint(target, stateDir) {
|
|
|
861
1124
|
card: { name: "status", kind: "endpoint" }, // card.id derives from the bearer principal
|
|
862
1125
|
});
|
|
863
1126
|
}
|
|
864
|
-
/** The
|
|
1127
|
+
/** The absent streams of `space`, with this machine's stack of it. */
|
|
1128
|
+
function absentStreams(space) {
|
|
1129
|
+
const local = stackState(space);
|
|
1130
|
+
return { state: "absent", root: local?.root ?? null, stack: local?.stack ?? null };
|
|
1131
|
+
}
|
|
1132
|
+
/** The selected space's channels and membership feed, read over one short-lived connection, and
|
|
1133
|
+
* where `streams` says `cotal up` created them, whether its streams are still on the broker. The
|
|
865
1134
|
* roster is not part of status: who is present is a separate read. */
|
|
866
|
-
async function readSnapshot(endpoint, space, gaps) {
|
|
1135
|
+
async function readSnapshot(endpoint, space, streams, gaps) {
|
|
867
1136
|
let ep;
|
|
868
1137
|
try {
|
|
869
1138
|
ep = await endpoint();
|
|
@@ -876,20 +1145,24 @@ async function readSnapshot(endpoint, space, gaps) {
|
|
|
876
1145
|
}
|
|
877
1146
|
catch (e) {
|
|
878
1147
|
gaps.add("SNAPSHOT_UNAVAILABLE", `the channels of ${space} could not be read: ${e.message}`, { space });
|
|
879
|
-
return { snapshot: { state: "unavailable", reason: e.message }, channels: null, membershipFeed: null };
|
|
1148
|
+
return { snapshot: { state: "unavailable", reason: e.message }, channels: null, membershipFeed: null, spaceStreams: { state: "not-checked", root: null, stack: null }, storedBytes: null };
|
|
880
1149
|
}
|
|
881
1150
|
try {
|
|
882
1151
|
const channels = await ep.listChannels();
|
|
883
1152
|
const feed = await ep.readMembership().catch(() => undefined);
|
|
1153
|
+
const gone = streams && await chatStreamGone(ep);
|
|
1154
|
+
const storedBytes = await ep.storedBytes().catch(() => null);
|
|
884
1155
|
return {
|
|
885
1156
|
snapshot: { state: "read", reason: null },
|
|
886
1157
|
channels: channels.map((ch) => ({ channel: ch.channel, messages: ch.messages })),
|
|
887
1158
|
membershipFeed: feed ? { entries: feed.members.length, asOf: feed.asOf ? new Date(feed.asOf).toISOString() : null } : null,
|
|
1159
|
+
spaceStreams: !streams ? { state: "not-checked", root: null, stack: null } : gone ? absentStreams(space) : { state: "present", root: null, stack: null },
|
|
1160
|
+
storedBytes,
|
|
888
1161
|
};
|
|
889
1162
|
}
|
|
890
1163
|
catch (e) {
|
|
891
1164
|
gaps.add("SNAPSHOT_UNAVAILABLE", `the channels of ${space} could not be read: ${e.message}`, { space });
|
|
892
|
-
return { snapshot: { state: "unavailable", reason: e.message }, channels: null, membershipFeed: null };
|
|
1165
|
+
return { snapshot: { state: "unavailable", reason: e.message }, channels: null, membershipFeed: null, spaceStreams: { state: "not-checked", root: null, stack: null }, storedBytes: null };
|
|
893
1166
|
}
|
|
894
1167
|
finally {
|
|
895
1168
|
await ep.stop().catch(() => { });
|
|
@@ -934,11 +1207,17 @@ function skillsCell(s) {
|
|
|
934
1207
|
return cell(`not installed · ${remedy}`, "hint");
|
|
935
1208
|
return cell(`${s.retired ? `${s.behind} to reconcile (${s.retired} retired)` : `${s.behind}/${s.total} out of date`} · ${remedy}`, "waiting");
|
|
936
1209
|
}
|
|
1210
|
+
/** The nats-server a broker start would run, or why it refuses the one it found. */
|
|
1211
|
+
function brokerExecutable(m) {
|
|
1212
|
+
if (m.natsProblem)
|
|
1213
|
+
return m.natsProblem;
|
|
1214
|
+
return natsServerLabel({ ...m.natsServer, source: m.nats === "path" ? "path" : "bundled" });
|
|
1215
|
+
}
|
|
937
1216
|
function machineSection(m) {
|
|
938
1217
|
const tone = { ok: "ok", warn: "waiting", error: "failed", off: "hint" };
|
|
939
1218
|
const rows = [
|
|
940
1219
|
["cotal-ai", cell(`v${m.version} (${m.install.kind === "source" ? "source checkout" : m.install.kind}: ${m.install.root})`, "ok")],
|
|
941
|
-
["NATS", m.nats === "missing" ? cell("missing", "failed") : cell(m.
|
|
1220
|
+
["NATS", m.nats === "missing" ? cell("missing", "failed") : cell(brokerExecutable(m), m.natsProblem ? "failed" : "ok")],
|
|
942
1221
|
...m.integrations.map((r) => [r.name, cell(r.text, tone[r.state])]),
|
|
943
1222
|
];
|
|
944
1223
|
if (m.connectors === null)
|
|
@@ -967,7 +1246,9 @@ function folderSection(f, selected) {
|
|
|
967
1246
|
const rows = [["root", f.root]];
|
|
968
1247
|
const cwd = canonicalRoot(process.cwd());
|
|
969
1248
|
if (cwd !== canonicalRoot(f.root) && (canonicalRoot(f.root) === canonicalRoot(homedir()) || canonicalRoot(join(f.root, ".cotal")) === canonicalRoot(homeCotalDir())))
|
|
970
|
-
rows.push(["root selection",
|
|
1249
|
+
rows.push(["root selection", homeHoldsStack(f.root)
|
|
1250
|
+
? cell("inherited the machine's home .cotal, which holds a stack; commands here reach that stack until up here makes this folder its own project root", "hint")
|
|
1251
|
+
: cell("inherited the machine's home .cotal; up here makes this folder its own project root", "hint")]);
|
|
971
1252
|
const auth = f.auth;
|
|
972
1253
|
if (auth.state === "unreadable")
|
|
973
1254
|
rows.push(["auth", cell(auth.error ?? "unreadable", "failed")]);
|
|
@@ -1034,7 +1315,7 @@ function meshesSections(m) {
|
|
|
1034
1315
|
})),
|
|
1035
1316
|
});
|
|
1036
1317
|
if (!m.currentRecorded)
|
|
1037
|
-
blocks.push({ kind: "lines", lines: [cell(`note: current mesh "${m.current}" is ${m.currentPrepared ? "prepared, not started" : "not recorded"}`, "hint")] });
|
|
1318
|
+
blocks.push({ kind: "lines", lines: [cell(`note: current mesh "${m.current}" is ${m.currentStopped ? "stopped" : m.currentPrepared ? "prepared, not started" : "not recorded"}`, "hint")] });
|
|
1038
1319
|
if (m.unreadable.length)
|
|
1039
1320
|
blocks.push({ kind: "lines", lines: m.unreadable.map((u) => cell(`unreadable: ${u.error}`, "failed")) });
|
|
1040
1321
|
const sections = [{ title: "Recorded Meshes", blocks }];
|
|
@@ -1046,21 +1327,31 @@ function meshesSections(m) {
|
|
|
1046
1327
|
* state it, so an operator on a manager host away from the broker's folder still sees it. An open
|
|
1047
1328
|
* mesh runs no delivery daemon, so with no lease recorded its row says the responder is not used
|
|
1048
1329
|
* rather than unbound. */
|
|
1049
|
-
function responderText(state, mode) {
|
|
1330
|
+
function responderText(state, mode, stackBlocked = false, deliveryPid, storeFull = false) {
|
|
1050
1331
|
if (state === null && mode === "open")
|
|
1051
1332
|
return { text: "not used - an open mesh runs no delivery daemon", tone: "hint" };
|
|
1333
|
+
// A running delivery member with no lease is starting or not responding. Status cannot ask it which,
|
|
1334
|
+
// and `up` starts no second daemon beside it.
|
|
1335
|
+
if (state === "unbound" && deliveryPid !== undefined)
|
|
1336
|
+
return { text: `no lease · stack-delivery pid ${deliveryPid} is alive but holds no lease, so it is starting or not responding`, tone: "failed" };
|
|
1337
|
+
// While this folder's stack is blocked, `up` refuses, so the row names the block Next clears. A full
|
|
1338
|
+
// store refuses the daemon's lease as every other write, so `up` starts it only once there is room.
|
|
1052
1339
|
if (state === "unbound")
|
|
1053
|
-
return { text: `NOT BOUND - ${RESPONDER_UNBOUND_CONSEQUENCE} · start it with \`${displayCmd()} up
|
|
1340
|
+
return { text: `NOT BOUND - ${RESPONDER_UNBOUND_CONSEQUENCE} · ${stackBlocked ? `\`${displayCmd()} up\` refuses until the stack block is cleared, as Next shows` : storeFull ? `the full store refuses its lease, so \`${displayCmd()} up\` starts it only once there is room, as Next shows` : `start it with \`${displayCmd()} up\``}`, tone: "failed" };
|
|
1054
1341
|
// A stale record is NOT BOUND with a different next move: the slot is occupied by a corpse, so
|
|
1055
1342
|
// starting a daemon now loses the single-flight CAS. Say that, rather than sending the operator
|
|
1056
1343
|
// into a refusal they will read as a second failure.
|
|
1057
1344
|
if (state === "stale")
|
|
1058
|
-
return { text: `NOT BOUND -
|
|
1345
|
+
return { text: `NOT BOUND - ${RESPONDER_STALE_TEXT} · \`${displayCmd()} up\` restarts it, after waiting out the lease`, tone: "failed" };
|
|
1059
1346
|
if (state === "bound")
|
|
1060
1347
|
return { text: "bound", tone: "ok" };
|
|
1061
1348
|
return undefined;
|
|
1062
1349
|
}
|
|
1063
|
-
|
|
1350
|
+
/** The pid of the selected space's running stack delivery member, from its owned service record. */
|
|
1351
|
+
function stackDeliveryPid(r) {
|
|
1352
|
+
return r.services?.instances?.find((item) => item.definition === STACK_DEFINITION.delivery && item.observedProcess === "running")?.pid ?? undefined;
|
|
1353
|
+
}
|
|
1354
|
+
function selectedSection(s, folder, deliveryPid, storeFull = false) {
|
|
1064
1355
|
if (!s.resolved)
|
|
1065
1356
|
return { title: "Selected Mesh", blocks: [{ kind: "fields", rows: [["target", cell(s.code, "failed")]] }] };
|
|
1066
1357
|
const rows = [
|
|
@@ -1097,7 +1388,7 @@ function selectedSection(s) {
|
|
|
1097
1388
|
}
|
|
1098
1389
|
else {
|
|
1099
1390
|
rows.push(["connection", s.connection === "ok" ? cell("ok", "ok") : cell(`${s.connection}${s.staleRecord ? " (stale registry entry)" : ""}`, "failed")]);
|
|
1100
|
-
const responder = responderText(s.deliveryResponder, s.mode);
|
|
1391
|
+
const responder = responderText(s.deliveryResponder, s.mode, Boolean(servedStack(folder, s) && folder.stackBlock), deliveryPid, storeFull);
|
|
1101
1392
|
if (responder)
|
|
1102
1393
|
rows.push(["delivery responder", cell(responder.text, responder.tone)]);
|
|
1103
1394
|
}
|
|
@@ -1125,7 +1416,7 @@ function machineOverview(r) {
|
|
|
1125
1416
|
continue;
|
|
1126
1417
|
rows.push([connector.name, stateCell(connector.missing.length ? `${connector.missing.join(", ")} not on PATH` : connector.requires.length ? "available on PATH" : "in-process", connector.missing.length ? "waiting" : "ok")]);
|
|
1127
1418
|
}
|
|
1128
|
-
rows.push(["Broker executable", stateCell(m.nats === "missing" ? "not installed" : m.nats === "
|
|
1419
|
+
rows.push(["Broker executable", stateCell(m.nats === "missing" ? "not installed" : brokerExecutable(m), m.nats === "missing" ? "waiting" : m.natsProblem ? "failed" : "ok")]);
|
|
1129
1420
|
rows.push(["Agent skills", skillsCell(m.skills)]);
|
|
1130
1421
|
rows.push(["Dashboard", stateCell(m.web.installed === null ? "installation could not be read" : m.web.installed ? "installed" : "not installed · optional", m.web.installed === null ? "failed" : m.web.installed ? "ok" : "hint")]);
|
|
1131
1422
|
if (r.extensions.items === null)
|
|
@@ -1140,12 +1431,18 @@ function machineOverview(r) {
|
|
|
1140
1431
|
],
|
|
1141
1432
|
};
|
|
1142
1433
|
}
|
|
1434
|
+
/** Whether `root` is the gone folder of the stack this machine still records for `space`. */
|
|
1435
|
+
function stackRootGone(space, root) {
|
|
1436
|
+
const gone = goneStackRoot(space);
|
|
1437
|
+
return gone !== undefined && canonicalRoot(gone) === canonicalRoot(root);
|
|
1438
|
+
}
|
|
1143
1439
|
function connectionCell(s) {
|
|
1144
1440
|
if (s.connection === "ok" || s.connection === "reachable")
|
|
1145
1441
|
return stateCell("reachable", "ok");
|
|
1146
1442
|
const states = {
|
|
1147
1443
|
unreachable: "unreachable",
|
|
1148
1444
|
"slow-link": "connection timed out",
|
|
1445
|
+
"broker-stopped": `broker process ${s.brokerPid} is stopped`,
|
|
1149
1446
|
"tls-trust": "TLS could not be verified",
|
|
1150
1447
|
"stale-auth": "credentials need renewal",
|
|
1151
1448
|
"auth-required": "authentication required",
|
|
@@ -1177,10 +1474,12 @@ function brokerOverview(r) {
|
|
|
1177
1474
|
columns: [{ key: "space", label: "Space" }, { key: "state", label: "Connection" }, { key: "detail", label: "Details" }],
|
|
1178
1475
|
rows: entries.map((entry) => {
|
|
1179
1476
|
const selected = r.selected.resolved && entry.space === r.selected.space;
|
|
1180
|
-
const detail = [entry.mode === "user" ? "user sign-in" : entry.mode === "auth" ? "static auth" : "open", entry.origin === "catalog" ? "saved catalog entry" : entry.origin === "manual" ? "registered endpoint" : "local registration", entry.tlsRequired ? "TLS required" : "", entry.catalog?.error ? "catalog refresh failed" : ""].filter(Boolean).join(" · ");
|
|
1477
|
+
const detail = [`${entry.mode === "user" ? "user sign-in" : entry.mode === "auth" ? "static auth" : "open"}${entry.modeChecked ? "" : ", not checked"}`, entry.origin === "catalog" ? "saved catalog entry" : entry.origin === "manual" ? "registered endpoint" : "local registration", entry.tlsRequired ? "TLS required" : "", entry.catalog?.error ? "catalog refresh failed" : ""].filter(Boolean).join(" · ");
|
|
1478
|
+
// The selected connection describes this row only when it dialed the row's address; under
|
|
1479
|
+
// `--all` with a `--server` that names another, the row shows its own address's check.
|
|
1181
1480
|
return {
|
|
1182
1481
|
space: selected ? cell(`→ ${entry.space}`, "selected") : entry.space,
|
|
1183
|
-
state: selected && r.selected.resolved ? connectionCell(r.selected) : entry.check === "not-checked" ? stateCell("not checked", "hint") : stateCell(entry.check === "reachable" ? "reachable" : "unreachable", entry.check === "reachable" ? "ok" : "failed"),
|
|
1482
|
+
state: selected && r.selected.resolved && entry.check !== "not-checked" && r.selected.server !== null && r.selected.server === entry.server ? connectionCell(r.selected) : entry.check === "not-checked" ? stateCell("not checked", "hint") : stateCell(entry.check === "reachable" ? "reachable" : "unreachable", entry.check === "reachable" ? "ok" : "failed"),
|
|
1184
1483
|
detail: cell(detail, "hint"),
|
|
1185
1484
|
};
|
|
1186
1485
|
}),
|
|
@@ -1192,23 +1491,41 @@ function brokerOverview(r) {
|
|
|
1192
1491
|
if (account.error)
|
|
1193
1492
|
blocks.push({ kind: "lines", lines: [stateCell(`Space catalog for ${account.idp}: ${account.error}`, "failed")] });
|
|
1194
1493
|
if (!r.meshes.currentRecorded)
|
|
1195
|
-
blocks.push({ kind: "lines", lines: [cell(`Selected space '${r.meshes.current}' is ${r.meshes.currentPrepared ? "prepared, not started" : "not recorded"}`, "waiting")] });
|
|
1494
|
+
blocks.push({ kind: "lines", lines: [cell(`Selected space '${r.meshes.current}' is ${r.meshes.currentStopped ? "stopped" : r.meshes.currentPrepared ? "prepared, not started" : "not recorded"}${folderTargeted(r) ? "; it applies outside this folder" : ""}`, "waiting")] });
|
|
1196
1495
|
return { title: "Brokers", blocks };
|
|
1197
1496
|
}
|
|
1497
|
+
/** The unresolved selections that mean nothing runs or is selected here, rather than a failure. */
|
|
1498
|
+
const NOTHING_SELECTED = new Set(["no-meshes", "not-started", "unregistered-root"]);
|
|
1499
|
+
/** Whether this report is for this folder's space, which a command without `--space` targets here
|
|
1500
|
+
* instead of the selection. */
|
|
1501
|
+
function folderTargeted(r) {
|
|
1502
|
+
return typeof r.meshes.folder === "string" && r.meshes.folder === r.selected.space;
|
|
1503
|
+
}
|
|
1198
1504
|
function selectedOverview(r) {
|
|
1199
1505
|
const s = r.selected;
|
|
1506
|
+
const title = folderTargeted(r) ? "This folder's space" : "Selected space";
|
|
1507
|
+
// Nothing running or selected is a state to start from, so it does not carry the mark of a live connection.
|
|
1200
1508
|
if (!s.resolved)
|
|
1201
|
-
return { title
|
|
1509
|
+
return { title, blocks: [
|
|
1510
|
+
{ kind: "lines", lines: [stateCell(s.message, NOTHING_SELECTED.has(s.code) ? "hint" : "failed")] },
|
|
1511
|
+
...(s.storeCap !== undefined ? [{ kind: "fields", rows: [["Store cap", cell(`${s.storeCap} bytes recorded, below the ${MIN_FILE_STORE} the space's streams start on`, "failed")]] }] : []),
|
|
1512
|
+
...(servedStack(r.folder, s) ? stackLines(r.folder) : []),
|
|
1513
|
+
] };
|
|
1202
1514
|
// A broker named with `--server` is reported even when nothing on this machine is registered.
|
|
1203
1515
|
if (s.source !== "flag-server" && !r.meshes.items.length && !r.meshes.currentPrepared && r.folder.auth.state === "none" && !r.folder.processes?.some((item) => item.pid !== null))
|
|
1204
1516
|
return undefined;
|
|
1205
|
-
const responder = responderText(s.deliveryResponder, s.mode);
|
|
1517
|
+
const responder = responderText(s.deliveryResponder, s.mode, Boolean(servedStack(r.folder, s) && r.folder.stackBlock), stackDeliveryPid(r), r.store?.state === "full");
|
|
1206
1518
|
const rows = [
|
|
1207
1519
|
["Broker", s.server ?? stateCell("address unavailable", "failed")],
|
|
1208
1520
|
["Connection", connectionCell(s)],
|
|
1521
|
+
...(s.spaceStreams.state === "absent" ? [["Space streams", stateCell(s.spaceStreams.stack === "running" ? "not on the broker · the space was deleted under its running stack" : "not on the broker · a space delete removed them", "failed")]] : []),
|
|
1209
1522
|
...(responder ? [["Delivery responder", stateCell(responder.text, responder.tone)]] : []),
|
|
1523
|
+
...(r.store?.state === "write-failed" ? [["Store", stateCell(`write failed at ${r.store.at}: ${r.store.cause}${r.store.path ? ` · ${r.store.path}` : ""}`, "failed")]] : []),
|
|
1524
|
+
...(r.store?.state === "full" ? [["Store", stateCell(`full · ${r.store.used} bytes stored, over its --max-file-store cap of ${r.store.cap} · ${r.store.path}`, "failed")]] : []),
|
|
1525
|
+
...(r.store?.state === "damaged" ? [["Store", stateCell(`damage logged at ${r.store.at}: ${r.store.warning}`, "failed")]] : []),
|
|
1526
|
+
...(r.stackManager ? [["Manager", r.stackManager.endpoint === "answered" ? stateCell("answering", "ok") : r.stackManager.endpoint === "not-answering" ? stateCell(`not answering · stack-manager pid ${r.stackManager.pid}`, "failed") : stateCell("endpoint not checked", "hint")]] : []),
|
|
1210
1527
|
["Access", s.mode === "user" ? "user sign-in" : s.mode === "auth" ? "static auth" : "open"],
|
|
1211
|
-
["Project", s.root],
|
|
1528
|
+
["Project", s.rootGone ? stateCell(`${s.root} · folder is gone`, "failed") : s.root],
|
|
1212
1529
|
["Default agent", r.machine.defaults ? `${r.machine.defaults.harness ?? "application not set"} · persona ${r.machine.defaults.persona ?? "not set"}` : stateCell("saved defaults could not be read", "failed")],
|
|
1213
1530
|
["Persona catalog", s.personas.default === "valid" ? "default available" : stateCell(s.personas.default === "invalid" ? "default is invalid" : s.personas.default === "unreadable" ? "could not be read" : "no default persona", s.personas.default === "invalid" || s.personas.default === "unreadable" ? "failed" : "hint")],
|
|
1214
1531
|
];
|
|
@@ -1228,9 +1545,15 @@ function selectedOverview(r) {
|
|
|
1228
1545
|
}
|
|
1229
1546
|
if (s.snapshot.state === "unavailable")
|
|
1230
1547
|
rows.push(["Live details", stateCell(`unavailable · ${s.snapshot.reason}`, "waiting")]);
|
|
1548
|
+
if (r.folder.root === s.root && r.folder.processSpace === s.space && r.folder.controllerStack && r.folder.noManager) {
|
|
1549
|
+
const service = r.folder.managerService;
|
|
1550
|
+
rows.push(["Manager", service
|
|
1551
|
+
? stateCell(`the ${service.definition} service · instance ${service.instanceId} · outside this stack, which was started with --no-manager`, "ok")
|
|
1552
|
+
: stateCell("none · this stack was started with --no-manager; bare cotal up adds it", "hint")]);
|
|
1553
|
+
}
|
|
1231
1554
|
const blocks = [{ kind: "fields", rows }];
|
|
1232
1555
|
if (r.folder.root === s.root && r.folder.processSpace === s.space && r.folder.controllerStack) {
|
|
1233
|
-
blocks.push({ kind: "lines", lines: [cell("Controller stack · its members are the stack-* rows under Owned services", "hint")] });
|
|
1556
|
+
blocks.push({ kind: "lines", lines: [cell("Controller stack · its members are the stack-* rows under Owned services", "hint")] }, ...stackLines(r.folder));
|
|
1234
1557
|
}
|
|
1235
1558
|
else if (r.folder.root === s.root && r.folder.processSpace === s.space && r.folder.processes) {
|
|
1236
1559
|
blocks.push({ kind: "lines", lines: [cell("Legacy local process records", "label")] });
|
|
@@ -1247,11 +1570,36 @@ function selectedOverview(r) {
|
|
|
1247
1570
|
blocks.push({ kind: "lines", lines: [cell("Legacy process records not checked here · the selected space has a different or unresolved local process scope", "hint")] });
|
|
1248
1571
|
if (r.folder.launches === false)
|
|
1249
1572
|
blocks.push({ kind: "lines", lines: [cell(`This folder's personas are not used by the selected space. Spawn uses ${s.personas.root}.`, "waiting")] });
|
|
1250
|
-
return { title:
|
|
1573
|
+
return { title: `${title} → ${s.space}`, blocks };
|
|
1574
|
+
}
|
|
1575
|
+
/** The selected space and its root when this folder's controller stack serves it: a resolved one, or
|
|
1576
|
+
* a prepared one that is not started, as an `up` cut off before it registered the space leaves it. */
|
|
1577
|
+
function servedStack(folder, s) {
|
|
1578
|
+
if (s.space === undefined || s.root === undefined)
|
|
1579
|
+
return undefined;
|
|
1580
|
+
return folder.controllerStack && folder.root === s.root && folder.processSpace === s.space ? { space: s.space, root: s.root } : undefined;
|
|
1581
|
+
}
|
|
1582
|
+
/** The lines that name this folder's stack operation cut off with no recorded outcome: one that keeps
|
|
1583
|
+
* `up` and `down` from settling it, or one that left the stack part way. */
|
|
1584
|
+
function stackLines(folder) {
|
|
1585
|
+
const blocks = [];
|
|
1586
|
+
if (folder.stackBlock)
|
|
1587
|
+
blocks.push({ kind: "lines", lines: [stateCell(`Stack blocked · ${folder.stackBlock.reason}`, "waiting")] });
|
|
1588
|
+
const part = folder.stackUnfinished;
|
|
1589
|
+
if (part)
|
|
1590
|
+
blocks.push({ kind: "lines", lines: [stateCell(part.kind === "up"
|
|
1591
|
+
? part.running.length ? `Half started · the last up ended before ${roleList(part.stopped)} started; ${roleList(part.running)} ${part.running.length === 1 ? "runs" : "run"}` : "Start interrupted · the last up ended before any member started"
|
|
1592
|
+
: part.stopped.length ? `Half stopped · the last down ended with ${roleList(part.running)} still running; ${roleList(part.stopped)} ${part.stopped.length === 1 ? "is" : "are"} stopped` : "Stop interrupted · the last down ended before any member stopped", "waiting")] });
|
|
1593
|
+
return blocks;
|
|
1594
|
+
}
|
|
1595
|
+
/** Stack members as a status line names them: `broker`, `delivery and manager`. */
|
|
1596
|
+
function roleList(roles) {
|
|
1597
|
+
return roles.length > 1 ? `${roles.slice(0, -1).join(", ")} and ${roles.at(-1)}` : roles[0] ?? "";
|
|
1251
1598
|
}
|
|
1252
1599
|
function nextActions(r) {
|
|
1253
1600
|
const cmd = displayCmd();
|
|
1254
1601
|
const items = [];
|
|
1602
|
+
const extra = [];
|
|
1255
1603
|
const noApplication = !r.machine.connectors?.length;
|
|
1256
1604
|
if (r.selected.resolved) {
|
|
1257
1605
|
const s = r.selected;
|
|
@@ -1276,14 +1624,103 @@ function nextActions(r) {
|
|
|
1276
1624
|
if (r.meshes.items.length > 1)
|
|
1277
1625
|
items.push({ command: `${cmd} status --all`, description: "Check every registered space" });
|
|
1278
1626
|
}
|
|
1279
|
-
// A
|
|
1280
|
-
// restarts its stopped members from its
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1627
|
+
// A stopped broker is resumed, not restarted. A local controller stack that does not answer,
|
|
1628
|
+
// or one with a member whose process is gone, otherwise restarts its stopped members from its
|
|
1629
|
+
// own records. One whose last operation a member keeps unsettled is named the way out that
|
|
1630
|
+
// `up` and `down` name instead. A stack started with --no-manager leaves its manager out by choice,
|
|
1631
|
+
// so a manager record an earlier up left is not a stopped member, and the restart keeps the flag.
|
|
1632
|
+
const memberGone = r.services?.instances?.some((row) => row.definition.startsWith("stack-") && row.observedProcess === "gone" && !(r.folder.noManager && row.definition === STACK_DEFINITION.manager)) === true;
|
|
1633
|
+
// A connection to a `--server` address other than the recorded one does not say whether the stack
|
|
1634
|
+
// answers; the hint `readSelected` adds names that address. A user-auth space is probed on its own path.
|
|
1635
|
+
const dialed = r.selected.resolved ? r.selected : undefined;
|
|
1636
|
+
const elsewhere = dialed !== undefined && dialed.mode !== "user" && (dialed.source === "flag-server" || dialed.source === "flag-space-override")
|
|
1637
|
+
&& r.meshes.items.find((m) => m.space === dialed.space)?.server !== dialed.server;
|
|
1638
|
+
const stack = servedStack(r.folder, r.selected), own = stack !== undefined;
|
|
1639
|
+
const block = own ? r.folder.stackBlock : undefined;
|
|
1640
|
+
// A legacy static-auth stack started here whose broker or manager exited leaves its pidfile, and a
|
|
1641
|
+
// bare `up` in this folder starts it again on the address and store this machine recorded. An open
|
|
1642
|
+
// refresh restarts no manager, and an open or user-auth broker needs its mode flag again.
|
|
1643
|
+
const local = r.selected.resolved && r.selected.mode === "auth" && !r.folder.controllerStack && r.folder.root === r.selected.root && r.folder.processSpace === r.selected.space
|
|
1644
|
+
&& !["manual", "catalog"].includes(r.meshes.items.find((m) => m.space === r.selected.space)?.origin ?? "up");
|
|
1645
|
+
const exited = local ? (r.folder.processes ?? []).filter((row) => (row.name === "nats" || row.name === "manager") && row.state === "stopped" && row.pid !== null).map((row) => row.name) : [];
|
|
1646
|
+
if (r.selected.resolved && r.selected.connection === "broker-stopped")
|
|
1647
|
+
items.unshift({ command: `kill -CONT ${r.selected.brokerPid}`, description: "Resume the stopped broker process so it answers again" });
|
|
1648
|
+
else if (block && stack) {
|
|
1649
|
+
const inspect = { command: `${cmd} service status ${block.definition} --instance ${block.instanceId} --space ${stack.space}`, description: block.route.kind === "inspect" ? "Inspect the member that keeps up and down from settling" : "Inspect that member" };
|
|
1650
|
+
items.unshift(...(block.route.kind === "abandon" ? [{ command: `${cmd} down --abandon-stop ${block.route.requestId} --yes`, description: `Abandon the unconfirmed stop of ${block.definition}; up and down refuse until then` }, inspect] : [inspect]));
|
|
1651
|
+
}
|
|
1652
|
+
else if (stack && r.folder.stackUnfinished) {
|
|
1653
|
+
const part = r.folder.stackUnfinished;
|
|
1654
|
+
const restart = `${cmd} up --root ${shellWord(stack.root)}${part.noManager ? " --no-manager" : ""}`;
|
|
1655
|
+
// An up that ended before it registered the space cannot be finished: the next up reuses the
|
|
1656
|
+
// running broker, and delivery does not start for a space that is not registered.
|
|
1657
|
+
items.unshift(...(part.kind === "up"
|
|
1658
|
+
? r.selected.resolved || !part.running.length
|
|
1659
|
+
? [{ command: restart, description: `Finish starting the stack: the last up ended before ${roleList(part.stopped)} started` }]
|
|
1660
|
+
: [{ command: `${cmd} down --yes`, description: `Stop what the last up started: it ended before it registered the space, so up cannot finish it` }, { command: restart, description: "Then start the stack again" }]
|
|
1661
|
+
: [{ command: `${cmd} down --yes`, description: `Finish stopping the stack: the last down ended with ${roleList(part.running)} still running` },
|
|
1662
|
+
...(part.stopped.length ? [{ command: `${cmd} up --root ${shellWord(stack.root)}`, description: "Or restart this stack's stopped members from its recorded inputs" }] : [])]));
|
|
1663
|
+
}
|
|
1664
|
+
else if (r.selected.resolved && r.selected.spaceStreams.state === "absent") {
|
|
1665
|
+
// Up creates the streams again only while the stack's other members are stopped.
|
|
1666
|
+
const stack = r.selected.spaceStreams.stack;
|
|
1667
|
+
if (own && stack === "running")
|
|
1668
|
+
items.unshift({ command: `${cmd} down --yes`, description: "Stop the stack its space was deleted under" }, { command: `${cmd} up`, description: "Then start it again; up creates the space's streams, empty" });
|
|
1669
|
+
else if (own)
|
|
1670
|
+
items.unshift({ command: `${cmd} up --root ${shellWord(r.selected.root)}`, description: stack === "stopped" ? "Create the space's streams again, empty, and restart the stack's stopped members" : `Create the space's streams again, empty; while the stack runs, stop it first with ${cmd} down --yes` });
|
|
1671
|
+
else {
|
|
1672
|
+
const absent = spaceStreamsAbsent(r.selected.space, r.selected.spaceStreams.root ?? undefined, stack ?? undefined);
|
|
1673
|
+
extra.push(`${absent.message}; ${absent.remedy}`);
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
else if (own && r.selected.resolved && r.store?.state !== "full" && (memberGone || !elsewhere && r.selected.connection !== "ok" && r.selected.connection !== "reachable")) {
|
|
1677
|
+
// `up` neither adopts nor replaces a service outside the stack that runs one of this root's
|
|
1678
|
+
// records, so each is stopped first, with the stop `up` names.
|
|
1679
|
+
const held = r.folder.heldServices ?? [], space = r.selected.space;
|
|
1680
|
+
items.unshift(...held.map((row) => ({ command: `${cmd} svc stop ${row.definition} --instance ${row.instanceId} --space ${space} --yes`, description: `Stop the ${row.definition} service, which runs this root's ${row.record} (pid ${row.pid}) outside the stack` })), { command: `${cmd} up --root ${shellWord(r.selected.root)}${r.folder.noManager ? " --no-manager" : ""}`, description: held.length ? "Then restart this stack's stopped members from its recorded inputs" : "Restart this stack's stopped members from its recorded inputs" });
|
|
1681
|
+
}
|
|
1682
|
+
else if (exited.length) {
|
|
1683
|
+
const broker = exited.includes("nats"), manager = exited.includes("manager");
|
|
1684
|
+
const notes = [...(broker ? ["up reopens the recorded store"] : []), ...(manager ? ["pass --runtime again if the manager ran on one"] : [])];
|
|
1685
|
+
items.unshift({ command: `${cmd} up`, description: `Restart this folder's ${broker && manager ? "broker and manager" : broker ? "broker" : "manager"}, which exited; ${notes.join("; ")}` });
|
|
1686
|
+
}
|
|
1687
|
+
// A stack whose folder was deleted stops only from this machine's records.
|
|
1688
|
+
if (r.selected.resolved && r.selected.rootGone)
|
|
1689
|
+
items.unshift({ command: `${cmd} down --space ${r.selected.space} --yes`, description: "Stop the stack whose folder is gone and free its name" });
|
|
1284
1690
|
if (r.selected.resolved && r.selected.mode === "user" && r.selected.login && !r.selected.login.subject)
|
|
1285
1691
|
items.unshift({ command: `${cmd} login --idp ${r.selected.login.idp}`, description: "Sign in to the selected space" });
|
|
1286
|
-
|
|
1692
|
+
// A delivery member that runs with no lease is not replaced by `up`; `down` kills one that does not exit.
|
|
1693
|
+
const deliveryPid = stackDeliveryPid(r);
|
|
1694
|
+
if (r.selected.resolved && r.selected.deliveryResponder === "unbound" && deliveryPid !== undefined)
|
|
1695
|
+
items.unshift({ command: `${cmd} service status stack-delivery${own ? "" : ` --space ${r.selected.space}`}`, description: `Read the delivery member's record: pid ${deliveryPid} is alive but holds no lease, so it is starting or not responding` }, { command: own ? `${cmd} down --yes` : `${cmd} down --space ${r.selected.space} --yes`, description: "If it stays that way, stop the stack; down kills a member that does not exit on SIGTERM" }, { command: own ? `${cmd} up` : `${cmd} up --root ${shellWord(r.selected.root)}`, description: "Then start the stack again" });
|
|
1696
|
+
// A manager that does not answer cannot report its stop impact, so no stop route reaches it.
|
|
1697
|
+
if (r.stackManager?.endpoint === "not-answering")
|
|
1698
|
+
items.unshift({ command: `kill -KILL ${r.stackManager.pid}`, description: `The stack manager does not answer, so ${cmd} down cannot stop it. If it stays that way, end its process; ${cmd} down --yes then records it stopped` });
|
|
1699
|
+
// The broker keeps a store write error until it restarts, so messages sent meanwhile may be lost.
|
|
1700
|
+
if (r.store?.state === "write-failed") {
|
|
1701
|
+
const repair = storeWriteRepair(r.store, r.selected.resolved ? r.selected.root : undefined, r.selected.space ?? "");
|
|
1702
|
+
const first = `First ${repair}`;
|
|
1703
|
+
// A broker without JetStream cannot record the manager's stop, and it stops only after the manager.
|
|
1704
|
+
if (r.store.jetStreamDisabled && r.stackManager && r.selected.resolved)
|
|
1705
|
+
items.unshift({ command: `kill -TERM ${r.stackManager.pid}`, description: "The broker disabled JetStream after the write failure and serves none until it restarts, which needs the manager stopped first. On this host, end the manager; it stops its agents by its default policy" }, { command: own ? `${cmd} down --yes` : `${cmd} down --space ${r.selected.space} --yes`, description: "Then stop the other members" }, { command: own ? `${cmd} up` : `${cmd} up --root ${shellWord(r.selected.root)}`, description: `${first}; then up starts the broker again with the history it kept` });
|
|
1706
|
+
else
|
|
1707
|
+
items.unshift({ command: `${cmd} down`, description: `${first}; then ${cmd} up starts the broker again with the history it kept` });
|
|
1708
|
+
}
|
|
1709
|
+
// The broker refuses every write while the store is over its cap, so sends store nothing, and a
|
|
1710
|
+
// stopped member starts again only once there is room. Making room purges the space's channel
|
|
1711
|
+
// history. Raising the cap keeps it but needs the broker restarted, so the manager's own process is
|
|
1712
|
+
// ended first where it runs, as a full store refuses its stop. These are the routes up and down name.
|
|
1713
|
+
if (r.store?.state === "full" && r.selected.resolved) {
|
|
1714
|
+
const { space, root } = r.selected;
|
|
1715
|
+
const manager = r.stackManager;
|
|
1716
|
+
items.unshift({ command: `${cmd} history clear --space ${space} --yes`, description: `Make room in the full store: this purges the space's channel history; --dms also purges its direct messages` }, ...(own && memberGone ? [{ command: `${cmd} up --root ${shellWord(root)}`, description: "Then restart this stack's stopped members from its recorded inputs" }] : []), ...(manager ? [{ command: `kill -TERM ${manager.pid}`, description: "Or keep that history: end the manager on this host, as a full store refuses its stop; it stops its agents by its default policy" }] : []),
|
|
1717
|
+
// `down` stops only the stack of the folder it runs in.
|
|
1718
|
+
{ command: `${cmd} down --yes`, description: `${manager ? "Then stop the other members" : "Or keep that history: stop the stack"}${own ? "" : `; run it in ${root}`}` }, { command: own ? `${cmd} up --max-file-store <bytes>` : `${cmd} up --root ${shellWord(root)} --max-file-store <bytes>`, description: "Then start it again with a larger cap; the store keeps the history" });
|
|
1719
|
+
}
|
|
1720
|
+
// The broker keeps serving a store it found damage in, from what it can still read there.
|
|
1721
|
+
if (r.store?.state === "damaged" && r.selected.resolved && r.services?.instances?.some((row) => row.definition === STACK_DEFINITION.broker))
|
|
1722
|
+
items.unshift({ command: `${cmd} service logs stack-broker${own ? "" : ` --space ${r.selected.space}`}`, description: "Read what the broker logged about the damage it found in its store; history holds only what it could still read" });
|
|
1723
|
+
return { title: "Next", blocks: [{ kind: "commands", items }, ...[...extra, ...r.hints].map((hint) => ({ kind: "lines", lines: [cell(hint, "hint")] }))] };
|
|
1287
1724
|
}
|
|
1288
1725
|
function ownedServicesOverview(services) {
|
|
1289
1726
|
if (!services || services.state === "not-checked")
|
|
@@ -1297,7 +1734,7 @@ function ownedServicesOverview(services) {
|
|
|
1297
1734
|
blocks.push({ kind: "table", columns: [{ key: "service", label: "Service" }, { key: "instance", label: "Full instance" }, { key: "host", label: "Execution host" }, { key: "process", label: "Process observation" }, { key: "readiness", label: "Recorded readiness" }, { key: "supervisor", label: "Supervisor record" }], rows: services.instances.slice(0, 100).map((row) => ({
|
|
1298
1735
|
service: row.definition, instance: row.instanceId, host: row.executionHost,
|
|
1299
1736
|
process: stateCell(row.observedProcess.replaceAll("-", " "), row.observedProcess === "running" ? "ok" : row.observedProcess === "unreadable" || row.observedProcess === "unresolved-launch" || row.observedProcess === "foreign-host" ? "waiting" : "hint"),
|
|
1300
|
-
readiness: cell(`${row.readinessObservation.replaceAll("-", " ")} · ${row.readinessAsOf}`, "hint"),
|
|
1737
|
+
readiness: cell(`${row.startInterrupted ? "start interrupted" : row.readinessObservation.replaceAll("-", " ")} · ${row.readinessAsOf}`, "hint"),
|
|
1301
1738
|
supervisor: row.supervisorRecord.mechanism === "none-recorded" ? "not assigned here" : `${row.supervisorRecord.mechanism} · ${row.supervisorRecord.fileObservation}; OS state not checked`,
|
|
1302
1739
|
})) });
|
|
1303
1740
|
if (services.instances && services.instances.length > 100)
|
|
@@ -1339,6 +1776,7 @@ function maintenanceOverview(maintenance) {
|
|
|
1339
1776
|
return { title: "Maintenance", blocks: [
|
|
1340
1777
|
{ kind: "fields", rows: [["Folder root", maintenance.root], ["Space", maintenance.space ?? "not read"], ["State", maintenance.state], ["Attempt", maintenance.attemptId ?? "not read"]] },
|
|
1341
1778
|
...(maintenance.next ? [{ kind: "lines", lines: [maintenance.next] }] : []),
|
|
1779
|
+
...(maintenance.rolledBackRuns?.length ? [{ kind: "lines", lines: rolledBackNotes({ runs: maintenance.rolledBackRuns, more: maintenance.rolledBackRunsMore ?? 0 }) }] : []),
|
|
1342
1780
|
] };
|
|
1343
1781
|
}
|
|
1344
1782
|
/** The approved screen hierarchy; record-level diagnostics are opt-in. */
|
|
@@ -1349,7 +1787,7 @@ export function statusView(r, verbose = false) {
|
|
|
1349
1787
|
const maintenance = maintenanceOverview(r.maintenance);
|
|
1350
1788
|
const sections = [machineOverview(r), brokerOverview(r), ...(selected ? [selected] : []), ...(maintenance ? [maintenance] : []), ...(attempts ? [attempts] : []), ...(owned ? [owned] : [])];
|
|
1351
1789
|
if (verbose)
|
|
1352
|
-
sections.push(machineSection(r.machine), extensionsSection(r.extensions), folderSection(r.folder, r.selected), ...meshesSections(r.meshes), selectedSection(r.selected));
|
|
1790
|
+
sections.push(machineSection(r.machine), extensionsSection(r.extensions), folderSection(r.folder, r.selected), ...meshesSections(r.meshes), selectedSection(r.selected, r.folder, stackDeliveryPid(r), r.store?.state === "full"));
|
|
1353
1791
|
sections.push(nextActions(r));
|
|
1354
1792
|
return { sections };
|
|
1355
1793
|
}
|
|
@@ -1488,6 +1926,9 @@ async function componentEp(target, credential) {
|
|
|
1488
1926
|
* after its timeout, because the client library does not release a connection it never finished,
|
|
1489
1927
|
* and status could then never exit. */
|
|
1490
1928
|
async function requireGreeting(target) {
|
|
1929
|
+
const stopped = stoppedLoopbackListener(target.server);
|
|
1930
|
+
if (stopped !== undefined)
|
|
1931
|
+
throw new Error(`the broker at ${brokerAddressForDisplay(target.server) ?? "an invalid broker address"} is served by process ${stopped}, which is stopped`);
|
|
1491
1932
|
if (!(await isReachable(target.server, { ...(target.tlsRequired ? { tls: true } : {}), timeoutMs: 3_000 })))
|
|
1492
1933
|
throw new Error(`the broker at ${brokerAddressForDisplay(target.server) ?? "an invalid broker address"} is not answering`);
|
|
1493
1934
|
}
|
|
@@ -1570,7 +2011,6 @@ async function managerHealth(target, context, credential) {
|
|
|
1570
2011
|
facts.push("unattributable pidfile");
|
|
1571
2012
|
if (record.kind === "unknown")
|
|
1572
2013
|
facts.push("pid liveness unestablishable");
|
|
1573
|
-
facts.push("static reconciliation not reported by this manager build");
|
|
1574
2014
|
return { name: "manager", verdict: "refused", facts };
|
|
1575
2015
|
}
|
|
1576
2016
|
if (record.kind === "dead")
|
|
@@ -1582,7 +2022,6 @@ async function managerHealth(target, context, credential) {
|
|
|
1582
2022
|
// A bare probe of an authenticated broker reports an Authorization Violation that describes
|
|
1583
2023
|
// our own missing credential, not the manager's health. `refused` (not absent): the pass
|
|
1584
2024
|
// could not read this component's control surface, which is exactly what that verdict means.
|
|
1585
|
-
facts.push("static reconciliation not reported by this manager build");
|
|
1586
2025
|
facts.push(`probe needs the signed-in login: ${credential.reason}`);
|
|
1587
2026
|
return { name: "manager", verdict: "refused", facts };
|
|
1588
2027
|
}
|
|
@@ -1641,7 +2080,6 @@ async function managerHealth(target, context, credential) {
|
|
|
1641
2080
|
return { name: "manager", verdict: lease || credential.kind === "user" ? "serving" : "not-serving", facts };
|
|
1642
2081
|
}
|
|
1643
2082
|
catch (e) {
|
|
1644
|
-
facts.push("static reconciliation not reported by this manager build");
|
|
1645
2083
|
// A no-responder service rail or an absent manager registry is definitive no-service evidence.
|
|
1646
2084
|
// The lease and PID answer whether that missing service belongs to an extant component (not
|
|
1647
2085
|
// serving) or an absent one; any other failed probe remains a refusal.
|