@cotal-ai/cli 0.90.0 → 0.91.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 +17 -0
- package/dist/chat/chat-view.d.ts.map +1 -0
- package/dist/chat/chat-view.js +179 -0
- package/dist/chat/chat-view.js.map +1 -0
- package/dist/chat/controller.d.ts +19 -0
- package/dist/chat/controller.d.ts.map +1 -0
- package/dist/chat/controller.js +116 -0
- package/dist/chat/controller.js.map +1 -0
- package/dist/chat/engine.d.ts +108 -0
- package/dist/chat/engine.d.ts.map +1 -0
- package/dist/chat/engine.js +226 -0
- package/dist/chat/engine.js.map +1 -0
- package/dist/chat/frontend.d.ts +35 -0
- package/dist/chat/frontend.d.ts.map +1 -0
- package/dist/chat/frontend.js +151 -0
- package/dist/chat/frontend.js.map +1 -0
- package/dist/chat/native-session.d.ts +71 -0
- package/dist/chat/native-session.d.ts.map +1 -0
- package/dist/chat/native-session.js +348 -0
- package/dist/chat/native-session.js.map +1 -0
- package/dist/chat/open-session.d.ts +8 -0
- package/dist/chat/open-session.d.ts.map +1 -0
- package/dist/chat/open-session.js +120 -0
- package/dist/chat/open-session.js.map +1 -0
- package/dist/chat/picker.d.ts +34 -0
- package/dist/chat/picker.d.ts.map +1 -0
- package/dist/chat/picker.js +97 -0
- package/dist/chat/picker.js.map +1 -0
- package/dist/chat/plain.d.ts +15 -0
- package/dist/chat/plain.d.ts.map +1 -0
- package/dist/chat/plain.js +242 -0
- package/dist/chat/plain.js.map +1 -0
- package/dist/chat/session.d.ts +217 -0
- package/dist/chat/session.d.ts.map +1 -0
- package/dist/chat/session.js +2 -0
- package/dist/chat/session.js.map +1 -0
- package/dist/chat/static-session.d.ts +61 -0
- package/dist/chat/static-session.d.ts.map +1 -0
- package/dist/chat/static-session.js +212 -0
- package/dist/chat/static-session.js.map +1 -0
- package/dist/chat/stdio-io.d.ts +34 -0
- package/dist/chat/stdio-io.d.ts.map +1 -0
- package/dist/chat/stdio-io.js +175 -0
- package/dist/chat/stdio-io.js.map +1 -0
- package/dist/chat/stdio.d.ts +173 -0
- package/dist/chat/stdio.d.ts.map +1 -0
- package/dist/chat/stdio.js +400 -0
- package/dist/chat/stdio.js.map +1 -0
- package/dist/chat/user-session.d.ts +21 -0
- package/dist/chat/user-session.d.ts.map +1 -0
- package/dist/chat/user-session.js +180 -0
- package/dist/chat/user-session.js.map +1 -0
- package/dist/chat/view.d.ts +186 -0
- package/dist/chat/view.d.ts.map +1 -0
- package/dist/chat/view.js +386 -0
- package/dist/chat/view.js.map +1 -0
- package/dist/command.d.ts +11 -3
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +392 -147
- package/dist/command.js.map +1 -1
- package/dist/commands/agents.d.ts +103 -11
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +501 -251
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/app-identity.d.ts.map +1 -1
- package/dist/commands/app-identity.js +10 -1
- package/dist/commands/app-identity.js.map +1 -1
- package/dist/commands/backup-maintenance.d.ts +4 -0
- package/dist/commands/backup-maintenance.d.ts.map +1 -0
- package/dist/commands/backup-maintenance.js +92 -0
- package/dist/commands/backup-maintenance.js.map +1 -0
- package/dist/commands/backup-read.d.ts +4 -0
- package/dist/commands/backup-read.d.ts.map +1 -0
- package/dist/commands/backup-read.js +27 -0
- package/dist/commands/backup-read.js.map +1 -0
- package/dist/commands/backup-restore.d.ts +7 -0
- package/dist/commands/backup-restore.d.ts.map +1 -0
- package/dist/commands/backup-restore.js +81 -0
- package/dist/commands/backup-restore.js.map +1 -0
- package/dist/commands/backup.d.ts +2 -1
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +102 -24
- package/dist/commands/backup.js.map +1 -1
- package/dist/commands/channel-members.d.ts +8 -0
- package/dist/commands/channel-members.d.ts.map +1 -0
- package/dist/commands/channel-members.js +144 -0
- package/dist/commands/channel-members.js.map +1 -0
- package/dist/commands/channels.d.ts +75 -22
- package/dist/commands/channels.d.ts.map +1 -1
- package/dist/commands/channels.js +181 -100
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/chat.d.ts +109 -0
- package/dist/commands/chat.d.ts.map +1 -0
- package/dist/commands/chat.js +227 -0
- package/dist/commands/chat.js.map +1 -0
- package/dist/commands/clean.d.ts +43 -1
- package/dist/commands/clean.d.ts.map +1 -1
- package/dist/commands/clean.js +90 -47
- package/dist/commands/clean.js.map +1 -1
- package/dist/commands/completion.d.ts +39 -1
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +211 -87
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/config.d.ts +33 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +159 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/console.d.ts.map +1 -1
- package/dist/commands/console.js +25 -7
- package/dist/commands/console.js.map +1 -1
- package/dist/commands/describe.d.ts +63 -31
- package/dist/commands/describe.d.ts.map +1 -1
- package/dist/commands/describe.js +264 -136
- package/dist/commands/describe.js.map +1 -1
- package/dist/commands/doctor.d.ts +11 -6
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +195 -288
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/down-services.d.ts +29 -0
- package/dist/commands/down-services.d.ts.map +1 -0
- package/dist/commands/down-services.js +129 -0
- package/dist/commands/down-services.js.map +1 -0
- package/dist/commands/down.d.ts +37 -11
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +276 -115
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/endpoint-authoring.d.ts +4 -0
- package/dist/commands/endpoint-authoring.d.ts.map +1 -0
- package/dist/commands/endpoint-authoring.js +125 -0
- package/dist/commands/endpoint-authoring.js.map +1 -0
- package/dist/commands/endpoint-deregister.d.ts +5 -0
- package/dist/commands/endpoint-deregister.d.ts.map +1 -0
- package/dist/commands/endpoint-deregister.js +70 -0
- package/dist/commands/endpoint-deregister.js.map +1 -0
- package/dist/commands/endpoint.d.ts +118 -0
- package/dist/commands/endpoint.d.ts.map +1 -0
- package/dist/commands/endpoint.js +177 -0
- package/dist/commands/endpoint.js.map +1 -0
- package/dist/commands/endpoints.d.ts +27 -1
- package/dist/commands/endpoints.d.ts.map +1 -1
- package/dist/commands/endpoints.js +42 -30
- package/dist/commands/endpoints.js.map +1 -1
- package/dist/commands/ext.d.ts +38 -1
- package/dist/commands/ext.d.ts.map +1 -1
- package/dist/commands/ext.js +84 -49
- package/dist/commands/ext.js.map +1 -1
- package/dist/commands/feedback.d.ts +58 -1
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +119 -47
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/help.d.ts +20 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +52 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/history-clear.d.ts +14 -0
- package/dist/commands/history-clear.d.ts.map +1 -0
- package/dist/commands/history-clear.js +73 -0
- package/dist/commands/history-clear.js.map +1 -0
- package/dist/commands/history.d.ts +146 -4
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +443 -19
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/join.d.ts.map +1 -1
- package/dist/commands/join.js +7 -3
- package/dist/commands/join.js.map +1 -1
- package/dist/commands/meshes-add.d.ts +3 -0
- package/dist/commands/meshes-add.d.ts.map +1 -1
- package/dist/commands/meshes-add.js +41 -34
- package/dist/commands/meshes-add.js.map +1 -1
- package/dist/commands/meshes-wizard.js +3 -3
- package/dist/commands/meshes-wizard.js.map +1 -1
- package/dist/commands/mint-endpoint-caller.d.ts +5 -0
- package/dist/commands/mint-endpoint-caller.d.ts.map +1 -0
- package/dist/commands/mint-endpoint-caller.js +130 -0
- package/dist/commands/mint-endpoint-caller.js.map +1 -0
- package/dist/commands/mint.d.ts +2 -37
- package/dist/commands/mint.d.ts.map +1 -1
- package/dist/commands/mint.js +142 -325
- package/dist/commands/mint.js.map +1 -1
- package/dist/commands/models.d.ts +30 -8
- package/dist/commands/models.d.ts.map +1 -1
- package/dist/commands/models.js +72 -41
- package/dist/commands/models.js.map +1 -1
- package/dist/commands/persona-remote.d.ts +5 -0
- package/dist/commands/persona-remote.d.ts.map +1 -0
- package/dist/commands/persona-remote.js +237 -0
- package/dist/commands/persona-remote.js.map +1 -0
- package/dist/commands/persona.d.ts +91 -0
- package/dist/commands/persona.d.ts.map +1 -0
- package/dist/commands/persona.js +200 -0
- package/dist/commands/persona.js.map +1 -0
- package/dist/commands/personas.d.ts.map +1 -1
- package/dist/commands/personas.js +16 -59
- package/dist/commands/personas.js.map +1 -1
- package/dist/commands/reset-space-apply.d.ts +5 -0
- package/dist/commands/reset-space-apply.d.ts.map +1 -0
- package/dist/commands/reset-space-apply.js +140 -0
- package/dist/commands/reset-space-apply.js.map +1 -0
- package/dist/commands/reset-store-apply.d.ts +11 -0
- package/dist/commands/reset-store-apply.d.ts.map +1 -0
- package/dist/commands/reset-store-apply.js +154 -0
- package/dist/commands/reset-store-apply.js.map +1 -0
- package/dist/commands/reset.d.ts +26 -0
- package/dist/commands/reset.d.ts.map +1 -0
- package/dist/commands/reset.js +143 -0
- package/dist/commands/reset.js.map +1 -0
- package/dist/commands/runtimes.d.ts +26 -1
- package/dist/commands/runtimes.d.ts.map +1 -1
- package/dist/commands/runtimes.js +68 -32
- package/dist/commands/runtimes.js.map +1 -1
- package/dist/commands/send.d.ts +91 -6
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +180 -106
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/service-actions.d.ts +6 -0
- package/dist/commands/service-actions.d.ts.map +1 -0
- package/dist/commands/service-actions.js +405 -0
- package/dist/commands/service-actions.js.map +1 -0
- package/dist/commands/service-log-follow.d.ts +5 -0
- package/dist/commands/service-log-follow.d.ts.map +1 -0
- package/dist/commands/service-log-follow.js +106 -0
- package/dist/commands/service-log-follow.js.map +1 -0
- package/dist/commands/service-registry.d.ts +67 -0
- package/dist/commands/service-registry.d.ts.map +1 -0
- package/dist/commands/service-registry.js +275 -0
- package/dist/commands/service-registry.js.map +1 -0
- package/dist/commands/service-set-stop.d.ts +6 -0
- package/dist/commands/service-set-stop.d.ts.map +1 -0
- package/dist/commands/service-set-stop.js +161 -0
- package/dist/commands/service-set-stop.js.map +1 -0
- package/dist/commands/service-unit-entry.d.ts +5 -0
- package/dist/commands/service-unit-entry.d.ts.map +1 -0
- package/dist/commands/service-unit-entry.js +113 -0
- package/dist/commands/service-unit-entry.js.map +1 -0
- package/dist/commands/setup-start.d.ts +21 -0
- package/dist/commands/setup-start.d.ts.map +1 -0
- package/dist/commands/setup-start.js +95 -0
- package/dist/commands/setup-start.js.map +1 -0
- package/dist/commands/setup.d.ts +86 -100
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +766 -487
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/space-delete.d.ts +3 -0
- package/dist/commands/space-delete.d.ts.map +1 -0
- package/dist/commands/space-delete.js +341 -0
- package/dist/commands/space-delete.js.map +1 -0
- package/dist/commands/space-registration.d.ts +92 -0
- package/dist/commands/space-registration.d.ts.map +1 -0
- package/dist/commands/space-registration.js +388 -0
- package/dist/commands/space-registration.js.map +1 -0
- package/dist/commands/space.d.ts +128 -0
- package/dist/commands/space.d.ts.map +1 -0
- package/dist/commands/space.js +230 -0
- package/dist/commands/space.js.map +1 -0
- package/dist/commands/spawn-manifest.d.ts.map +1 -1
- package/dist/commands/spawn-manifest.js +2 -2
- package/dist/commands/spawn-manifest.js.map +1 -1
- package/dist/commands/spawn-preview.d.ts +9 -0
- package/dist/commands/spawn-preview.d.ts.map +1 -0
- package/dist/commands/spawn-preview.js +68 -0
- package/dist/commands/spawn-preview.js.map +1 -0
- package/dist/commands/spawn.d.ts +78 -18
- package/dist/commands/spawn.d.ts.map +1 -1
- package/dist/commands/spawn.js +236 -96
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/stack-down.d.ts +6 -0
- package/dist/commands/stack-down.d.ts.map +1 -0
- package/dist/commands/stack-down.js +206 -0
- package/dist/commands/stack-down.js.map +1 -0
- package/dist/commands/stack-up.d.ts +149 -0
- package/dist/commands/stack-up.d.ts.map +1 -0
- package/dist/commands/stack-up.js +459 -0
- package/dist/commands/stack-up.js.map +1 -0
- package/dist/commands/stack-user-auth.d.ts +52 -0
- package/dist/commands/stack-user-auth.d.ts.map +1 -0
- package/dist/commands/stack-user-auth.js +128 -0
- package/dist/commands/stack-user-auth.js.map +1 -0
- package/dist/commands/status.d.ts +232 -5
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +989 -406
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/sync.d.ts +23 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +69 -17
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/team-agent-apply.d.ts +5 -0
- package/dist/commands/team-agent-apply.d.ts.map +1 -0
- package/dist/commands/team-agent-apply.js +204 -0
- package/dist/commands/team-agent-apply.js.map +1 -0
- package/dist/commands/team-agent-remove.d.ts +87 -0
- package/dist/commands/team-agent-remove.d.ts.map +1 -0
- package/dist/commands/team-agent-remove.js +348 -0
- package/dist/commands/team-agent-remove.js.map +1 -0
- package/dist/commands/team-boot-controller.d.ts +11 -0
- package/dist/commands/team-boot-controller.d.ts.map +1 -0
- package/dist/commands/team-boot-controller.js +176 -0
- package/dist/commands/team-boot-controller.js.map +1 -0
- package/dist/commands/team-channel-remove.d.ts +167 -0
- package/dist/commands/team-channel-remove.d.ts.map +1 -0
- package/dist/commands/team-channel-remove.js +486 -0
- package/dist/commands/team-channel-remove.js.map +1 -0
- package/dist/commands/team-deploy-apply.d.ts +11 -0
- package/dist/commands/team-deploy-apply.d.ts.map +1 -0
- package/dist/commands/team-deploy-apply.js +320 -0
- package/dist/commands/team-deploy-apply.js.map +1 -0
- package/dist/commands/team-mixed-remove.d.ts +8 -0
- package/dist/commands/team-mixed-remove.d.ts.map +1 -0
- package/dist/commands/team-mixed-remove.js +207 -0
- package/dist/commands/team-mixed-remove.js.map +1 -0
- package/dist/commands/team.d.ts +51 -0
- package/dist/commands/team.d.ts.map +1 -0
- package/dist/commands/team.js +727 -0
- package/dist/commands/team.js.map +1 -0
- package/dist/commands/topology.d.ts +4 -0
- package/dist/commands/topology.d.ts.map +1 -1
- package/dist/commands/topology.js +8 -0
- package/dist/commands/topology.js.map +1 -1
- package/dist/commands/up.d.ts +144 -5
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +1015 -124
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/update.d.ts +11 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +72 -15
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/use.d.ts +16 -3
- package/dist/commands/use.d.ts.map +1 -1
- package/dist/commands/use.js +45 -19
- package/dist/commands/use.js.map +1 -1
- package/dist/commands/watch.d.ts +37 -0
- package/dist/commands/watch.d.ts.map +1 -0
- package/dist/commands/watch.js +106 -0
- package/dist/commands/watch.js.map +1 -0
- package/dist/commands/who.d.ts +79 -0
- package/dist/commands/who.d.ts.map +1 -0
- package/dist/commands/who.js +193 -0
- package/dist/commands/who.js.map +1 -0
- package/dist/commands/whoami.d.ts +56 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +106 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/console/app.d.ts.map +1 -1
- package/dist/console/app.js +8 -4
- package/dist/console/app.js.map +1 -1
- package/dist/console/commands.d.ts.map +1 -1
- package/dist/console/commands.js +12 -6
- package/dist/console/commands.js.map +1 -1
- package/dist/exec-endpoint/definition.d.ts +15 -0
- package/dist/exec-endpoint/definition.d.ts.map +1 -0
- package/dist/exec-endpoint/definition.js +56 -0
- package/dist/exec-endpoint/definition.js.map +1 -0
- package/dist/exec-endpoint/handler.d.ts +13 -0
- package/dist/exec-endpoint/handler.d.ts.map +1 -0
- package/dist/exec-endpoint/handler.js +155 -0
- package/dist/exec-endpoint/handler.js.map +1 -0
- package/dist/exec-endpoint/registration.d.ts +34 -0
- package/dist/exec-endpoint/registration.d.ts.map +1 -0
- package/dist/exec-endpoint/registration.js +148 -0
- package/dist/exec-endpoint/registration.js.map +1 -0
- package/dist/exec-endpoint/serve.d.ts +8 -0
- package/dist/exec-endpoint/serve.d.ts.map +1 -0
- package/dist/exec-endpoint/serve.js +159 -0
- package/dist/exec-endpoint/serve.js.map +1 -0
- package/dist/exec-endpoint/service-adapter.d.ts +6 -0
- package/dist/exec-endpoint/service-adapter.d.ts.map +1 -0
- package/dist/exec-endpoint/service-adapter.js +110 -0
- package/dist/exec-endpoint/service-adapter.js.map +1 -0
- package/dist/ext-loader.d.ts +10 -0
- package/dist/ext-loader.d.ts.map +1 -1
- package/dist/ext-loader.js +61 -13
- package/dist/ext-loader.js.map +1 -1
- package/dist/help.d.ts +18 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/help.js +256 -0
- package/dist/help.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +444 -118
- package/dist/index.js.map +1 -1
- package/dist/lib/assist.d.ts.map +1 -1
- package/dist/lib/assist.js +3 -2
- package/dist/lib/assist.js.map +1 -1
- package/dist/lib/attach-client.d.ts +7 -6
- package/dist/lib/attach-client.d.ts.map +1 -1
- package/dist/lib/attach-client.js +14 -15
- package/dist/lib/attach-client.js.map +1 -1
- package/dist/lib/auth-proc.d.ts +3 -3
- package/dist/lib/auth-proc.d.ts.map +1 -1
- package/dist/lib/auth-proc.js +8 -8
- package/dist/lib/auth-proc.js.map +1 -1
- package/dist/lib/backup-artifact.d.ts +34 -1
- package/dist/lib/backup-artifact.d.ts.map +1 -1
- package/dist/lib/backup-artifact.js +67 -17
- package/dist/lib/backup-artifact.js.map +1 -1
- package/dist/lib/broker-service.d.ts +10 -0
- package/dist/lib/broker-service.d.ts.map +1 -0
- package/dist/lib/broker-service.js +329 -0
- package/dist/lib/broker-service.js.map +1 -0
- package/dist/lib/cancel.js +1 -1
- package/dist/lib/cancel.js.map +1 -1
- package/dist/lib/choose-target.d.ts +10 -0
- package/dist/lib/choose-target.d.ts.map +1 -0
- package/dist/lib/choose-target.js +42 -0
- package/dist/lib/choose-target.js.map +1 -0
- package/dist/lib/command-path.d.ts +13 -0
- package/dist/lib/command-path.d.ts.map +1 -0
- package/dist/lib/command-path.js +40 -0
- package/dist/lib/command-path.js.map +1 -0
- package/dist/lib/completion-install.d.ts +29 -0
- package/dist/lib/completion-install.d.ts.map +1 -0
- package/dist/lib/completion-install.js +369 -0
- package/dist/lib/completion-install.js.map +1 -0
- package/dist/lib/completion-scripts.d.ts +4 -0
- package/dist/lib/completion-scripts.d.ts.map +1 -0
- package/dist/lib/completion-scripts.js +15 -0
- package/dist/lib/completion-scripts.js.map +1 -0
- package/dist/lib/completion.d.ts.map +1 -1
- package/dist/lib/completion.js +4 -1
- package/dist/lib/completion.js.map +1 -1
- package/dist/lib/control.d.ts +65 -6
- package/dist/lib/control.d.ts.map +1 -1
- package/dist/lib/control.js +121 -27
- package/dist/lib/control.js.map +1 -1
- package/dist/lib/controller-preserve.d.ts +12 -0
- package/dist/lib/controller-preserve.d.ts.map +1 -0
- package/dist/lib/controller-preserve.js +373 -0
- package/dist/lib/controller-preserve.js.map +1 -0
- package/dist/lib/controller-restore.d.ts +38 -0
- package/dist/lib/controller-restore.d.ts.map +1 -0
- package/dist/lib/controller-restore.js +205 -0
- package/dist/lib/controller-restore.js.map +1 -0
- package/dist/lib/controller-resume.d.ts +92 -0
- package/dist/lib/controller-resume.d.ts.map +1 -0
- package/dist/lib/controller-resume.js +300 -0
- package/dist/lib/controller-resume.js.map +1 -0
- package/dist/lib/credential-authority.d.ts +17 -0
- package/dist/lib/credential-authority.d.ts.map +1 -0
- package/dist/lib/credential-authority.js +28 -0
- package/dist/lib/credential-authority.js.map +1 -0
- package/dist/lib/default-persona.d.ts +38 -0
- package/dist/lib/default-persona.d.ts.map +1 -0
- package/dist/lib/default-persona.js +85 -0
- package/dist/lib/default-persona.js.map +1 -0
- package/dist/lib/delivery-proc.d.ts +9 -9
- package/dist/lib/delivery-proc.d.ts.map +1 -1
- package/dist/lib/delivery-proc.js +9 -19
- package/dist/lib/delivery-proc.js.map +1 -1
- package/dist/lib/endpoint-capability-gates.d.ts +10 -0
- package/dist/lib/endpoint-capability-gates.d.ts.map +1 -0
- package/dist/lib/endpoint-capability-gates.js +70 -0
- package/dist/lib/endpoint-capability-gates.js.map +1 -0
- package/dist/lib/endpoint-client.d.ts +20 -0
- package/dist/lib/endpoint-client.d.ts.map +1 -0
- package/dist/lib/endpoint-client.js +42 -0
- package/dist/lib/endpoint-client.js.map +1 -0
- package/dist/lib/endpoint-errors.d.ts +11 -0
- package/dist/lib/endpoint-errors.d.ts.map +1 -0
- package/dist/lib/endpoint-errors.js +30 -0
- package/dist/lib/endpoint-errors.js.map +1 -0
- package/dist/lib/endpoint-goal.d.ts +19 -0
- package/dist/lib/endpoint-goal.d.ts.map +1 -0
- package/dist/lib/endpoint-goal.js +31 -0
- package/dist/lib/endpoint-goal.js.map +1 -0
- package/dist/lib/endpoint-inventory.d.ts +30 -0
- package/dist/lib/endpoint-inventory.d.ts.map +1 -0
- package/dist/lib/endpoint-inventory.js +79 -0
- package/dist/lib/endpoint-inventory.js.map +1 -0
- package/dist/lib/endpoint-references.d.ts +22 -0
- package/dist/lib/endpoint-references.d.ts.map +1 -0
- package/dist/lib/endpoint-references.js +44 -0
- package/dist/lib/endpoint-references.js.map +1 -0
- package/dist/lib/endpoint-scatter.d.ts +57 -0
- package/dist/lib/endpoint-scatter.d.ts.map +1 -0
- package/dist/lib/endpoint-scatter.js +75 -0
- package/dist/lib/endpoint-scatter.js.map +1 -0
- package/dist/lib/endpoint-selection.d.ts +35 -0
- package/dist/lib/endpoint-selection.d.ts.map +1 -0
- package/dist/lib/endpoint-selection.js +80 -0
- package/dist/lib/endpoint-selection.js.map +1 -0
- package/dist/lib/install-umask.d.ts +6 -0
- package/dist/lib/install-umask.d.ts.map +1 -0
- package/dist/lib/install-umask.js +15 -0
- package/dist/lib/install-umask.js.map +1 -0
- package/dist/lib/isolated-broker.d.ts.map +1 -1
- package/dist/lib/isolated-broker.js +9 -5
- package/dist/lib/isolated-broker.js.map +1 -1
- package/dist/lib/local-process-stop.d.ts.map +1 -1
- package/dist/lib/local-process-stop.js +7 -1
- package/dist/lib/local-process-stop.js.map +1 -1
- package/dist/lib/manager-proc.d.ts +11 -5
- package/dist/lib/manager-proc.d.ts.map +1 -1
- package/dist/lib/manager-proc.js +12 -17
- package/dist/lib/manager-proc.js.map +1 -1
- package/dist/lib/manifest/apply.d.ts +4 -1
- package/dist/lib/manifest/apply.d.ts.map +1 -1
- package/dist/lib/manifest/apply.js +1 -1
- package/dist/lib/manifest/apply.js.map +1 -1
- package/dist/lib/manifest/ledger.d.ts +3 -1
- package/dist/lib/manifest/ledger.d.ts.map +1 -1
- package/dist/lib/manifest/ledger.js +16 -3
- package/dist/lib/manifest/ledger.js.map +1 -1
- package/dist/lib/manifest/schema.d.ts +1 -117
- package/dist/lib/manifest/schema.d.ts.map +1 -1
- package/dist/lib/manifest/schema.js +1 -95
- package/dist/lib/manifest/schema.js.map +1 -1
- package/dist/lib/offline-recipient.d.ts +5 -0
- package/dist/lib/offline-recipient.d.ts.map +1 -0
- package/dist/lib/offline-recipient.js +7 -0
- package/dist/lib/offline-recipient.js.map +1 -0
- package/dist/lib/onboard.js +3 -3
- package/dist/lib/onboard.js.map +1 -1
- package/dist/lib/persona-files.d.ts +29 -0
- package/dist/lib/persona-files.d.ts.map +1 -0
- package/dist/lib/persona-files.js +154 -0
- package/dist/lib/persona-files.js.map +1 -0
- package/dist/lib/personas.d.ts +3 -0
- package/dist/lib/personas.d.ts.map +1 -1
- package/dist/lib/personas.js +14 -2
- package/dist/lib/personas.js.map +1 -1
- package/dist/lib/prompts.d.ts +16 -0
- package/dist/lib/prompts.d.ts.map +1 -0
- package/dist/lib/prompts.js +35 -0
- package/dist/lib/prompts.js.map +1 -0
- package/dist/lib/protected-records.d.ts +2 -0
- package/dist/lib/protected-records.d.ts.map +1 -0
- package/dist/lib/protected-records.js +3 -0
- package/dist/lib/protected-records.js.map +1 -0
- package/dist/lib/registry-errors.d.ts +4 -0
- package/dist/lib/registry-errors.d.ts.map +1 -0
- package/dist/lib/registry-errors.js +6 -0
- package/dist/lib/registry-errors.js.map +1 -0
- package/dist/lib/reset-space-plan.d.ts +36 -0
- package/dist/lib/reset-space-plan.d.ts.map +1 -0
- package/dist/lib/reset-space-plan.js +181 -0
- package/dist/lib/reset-space-plan.js.map +1 -0
- package/dist/lib/restore.d.ts +3 -1
- package/dist/lib/restore.d.ts.map +1 -1
- package/dist/lib/restore.js +38 -10
- package/dist/lib/restore.js.map +1 -1
- package/dist/lib/seat-resume.d.ts +4 -1
- package/dist/lib/seat-resume.d.ts.map +1 -1
- package/dist/lib/seat-resume.js +7 -4
- package/dist/lib/seat-resume.js.map +1 -1
- package/dist/lib/service-adapters.d.ts +32 -0
- package/dist/lib/service-adapters.d.ts.map +1 -0
- package/dist/lib/service-adapters.js +55 -0
- package/dist/lib/service-adapters.js.map +1 -0
- package/dist/lib/service-census.d.ts +73 -0
- package/dist/lib/service-census.d.ts.map +1 -0
- package/dist/lib/service-census.js +42 -0
- package/dist/lib/service-census.js.map +1 -0
- package/dist/lib/service-definitions.d.ts +49 -0
- package/dist/lib/service-definitions.d.ts.map +1 -0
- package/dist/lib/service-definitions.js +61 -0
- package/dist/lib/service-definitions.js.map +1 -0
- package/dist/lib/service-install-intent.d.ts +48 -0
- package/dist/lib/service-install-intent.d.ts.map +1 -0
- package/dist/lib/service-install-intent.js +95 -0
- package/dist/lib/service-install-intent.js.map +1 -0
- package/dist/lib/service-instances.d.ts +143 -0
- package/dist/lib/service-instances.d.ts.map +1 -0
- package/dist/lib/service-instances.js +193 -0
- package/dist/lib/service-instances.js.map +1 -0
- package/dist/lib/service-journal.d.ts +38 -0
- package/dist/lib/service-journal.d.ts.map +1 -0
- package/dist/lib/service-journal.js +210 -0
- package/dist/lib/service-journal.js.map +1 -0
- package/dist/lib/service-launchd-plan.d.ts +21 -0
- package/dist/lib/service-launchd-plan.d.ts.map +1 -0
- package/dist/lib/service-launchd-plan.js +69 -0
- package/dist/lib/service-launchd-plan.js.map +1 -0
- package/dist/lib/service-launchd-unit.d.ts +20 -0
- package/dist/lib/service-launchd-unit.d.ts.map +1 -0
- package/dist/lib/service-launchd-unit.js +66 -0
- package/dist/lib/service-launchd-unit.js.map +1 -0
- package/dist/lib/service-presets.d.ts +17 -0
- package/dist/lib/service-presets.d.ts.map +1 -0
- package/dist/lib/service-presets.js +138 -0
- package/dist/lib/service-presets.js.map +1 -0
- package/dist/lib/service-private-seed.d.ts +7 -0
- package/dist/lib/service-private-seed.d.ts.map +1 -0
- package/dist/lib/service-private-seed.js +64 -0
- package/dist/lib/service-private-seed.js.map +1 -0
- package/dist/lib/service-private-tree.d.ts +6 -0
- package/dist/lib/service-private-tree.d.ts.map +1 -0
- package/dist/lib/service-private-tree.js +100 -0
- package/dist/lib/service-private-tree.js.map +1 -0
- package/dist/lib/service-process.d.ts +121 -0
- package/dist/lib/service-process.d.ts.map +1 -0
- package/dist/lib/service-process.js +742 -0
- package/dist/lib/service-process.js.map +1 -0
- package/dist/lib/service-stopped-allocation.d.ts +6 -0
- package/dist/lib/service-stopped-allocation.d.ts.map +1 -0
- package/dist/lib/service-stopped-allocation.js +42 -0
- package/dist/lib/service-stopped-allocation.js.map +1 -0
- package/dist/lib/service-supervision.d.ts +59 -0
- package/dist/lib/service-supervision.d.ts.map +1 -0
- package/dist/lib/service-supervision.js +71 -0
- package/dist/lib/service-supervision.js.map +1 -0
- package/dist/lib/service-systemd-attempt-read.d.ts +40 -0
- package/dist/lib/service-systemd-attempt-read.d.ts.map +1 -0
- package/dist/lib/service-systemd-attempt-read.js +80 -0
- package/dist/lib/service-systemd-attempt-read.js.map +1 -0
- package/dist/lib/service-systemd-control.d.ts +38 -0
- package/dist/lib/service-systemd-control.d.ts.map +1 -0
- package/dist/lib/service-systemd-control.js +141 -0
- package/dist/lib/service-systemd-control.js.map +1 -0
- package/dist/lib/service-systemd-files.d.ts +8 -0
- package/dist/lib/service-systemd-files.d.ts.map +1 -0
- package/dist/lib/service-systemd-files.js +63 -0
- package/dist/lib/service-systemd-files.js.map +1 -0
- package/dist/lib/service-systemd-install.d.ts +17 -0
- package/dist/lib/service-systemd-install.d.ts.map +1 -0
- package/dist/lib/service-systemd-install.js +146 -0
- package/dist/lib/service-systemd-install.js.map +1 -0
- package/dist/lib/service-systemd-plan.d.ts +28 -0
- package/dist/lib/service-systemd-plan.d.ts.map +1 -0
- package/dist/lib/service-systemd-plan.js +56 -0
- package/dist/lib/service-systemd-plan.js.map +1 -0
- package/dist/lib/service-systemd-reseed.d.ts +16 -0
- package/dist/lib/service-systemd-reseed.d.ts.map +1 -0
- package/dist/lib/service-systemd-reseed.js +106 -0
- package/dist/lib/service-systemd-reseed.js.map +1 -0
- package/dist/lib/service-systemd-uninstall-plan.d.ts +29 -0
- package/dist/lib/service-systemd-uninstall-plan.d.ts.map +1 -0
- package/dist/lib/service-systemd-uninstall-plan.js +56 -0
- package/dist/lib/service-systemd-uninstall-plan.js.map +1 -0
- package/dist/lib/service-systemd-uninstall.d.ts +17 -0
- package/dist/lib/service-systemd-uninstall.d.ts.map +1 -0
- package/dist/lib/service-systemd-uninstall.js +106 -0
- package/dist/lib/service-systemd-uninstall.js.map +1 -0
- package/dist/lib/service-systemd-unit.d.ts +28 -0
- package/dist/lib/service-systemd-unit.d.ts.map +1 -0
- package/dist/lib/service-systemd-unit.js +73 -0
- package/dist/lib/service-systemd-unit.js.map +1 -0
- package/dist/lib/service-systemd.d.ts +49 -0
- package/dist/lib/service-systemd.d.ts.map +1 -0
- package/dist/lib/service-systemd.js +134 -0
- package/dist/lib/service-systemd.js.map +1 -0
- package/dist/lib/service-uninstall-intent.d.ts +38 -0
- package/dist/lib/service-uninstall-intent.d.ts.map +1 -0
- package/dist/lib/service-uninstall-intent.js +74 -0
- package/dist/lib/service-uninstall-intent.js.map +1 -0
- package/dist/lib/service-unit-action.d.ts +24 -0
- package/dist/lib/service-unit-action.d.ts.map +1 -0
- package/dist/lib/service-unit-action.js +61 -0
- package/dist/lib/service-unit-action.js.map +1 -0
- package/dist/lib/setup-log.d.ts +5 -4
- package/dist/lib/setup-log.d.ts.map +1 -1
- package/dist/lib/setup-log.js +18 -9
- package/dist/lib/setup-log.js.map +1 -1
- package/dist/lib/space-schema-inspection.d.ts +73 -0
- package/dist/lib/space-schema-inspection.d.ts.map +1 -0
- package/dist/lib/space-schema-inspection.js +118 -0
- package/dist/lib/space-schema-inspection.js.map +1 -0
- package/dist/lib/space-schema-report.d.ts +82 -0
- package/dist/lib/space-schema-report.d.ts.map +1 -0
- package/dist/lib/space-schema-report.js +109 -0
- package/dist/lib/space-schema-report.js.map +1 -0
- package/dist/lib/spawn-defaults.d.ts +14 -0
- package/dist/lib/spawn-defaults.d.ts.map +1 -0
- package/dist/lib/spawn-defaults.js +20 -0
- package/dist/lib/spawn-defaults.js.map +1 -0
- package/dist/lib/stack-journal.d.ts +92 -0
- package/dist/lib/stack-journal.d.ts.map +1 -0
- package/dist/lib/stack-journal.js +199 -0
- package/dist/lib/stack-journal.js.map +1 -0
- package/dist/lib/stack-resume.d.ts +35 -0
- package/dist/lib/stack-resume.d.ts.map +1 -0
- package/dist/lib/stack-resume.js +123 -0
- package/dist/lib/stack-resume.js.map +1 -0
- package/dist/lib/status.d.ts +19 -20
- package/dist/lib/status.d.ts.map +1 -1
- package/dist/lib/status.js +41 -40
- package/dist/lib/status.js.map +1 -1
- package/dist/lib/steps.d.ts.map +1 -1
- package/dist/lib/steps.js +3 -2
- package/dist/lib/steps.js.map +1 -1
- package/dist/lib/systemd-supervision.d.ts +11 -4
- package/dist/lib/systemd-supervision.d.ts.map +1 -1
- package/dist/lib/systemd-supervision.js +19 -8
- package/dist/lib/systemd-supervision.js.map +1 -1
- package/dist/lib/team-additive-attempt.d.ts +286 -0
- package/dist/lib/team-additive-attempt.d.ts.map +1 -0
- package/dist/lib/team-additive-attempt.js +387 -0
- package/dist/lib/team-additive-attempt.js.map +1 -0
- package/dist/lib/team-additive-native.d.ts +17 -0
- package/dist/lib/team-additive-native.d.ts.map +1 -0
- package/dist/lib/team-additive-native.js +29 -0
- package/dist/lib/team-additive-native.js.map +1 -0
- package/dist/lib/team-agent-removal.d.ts +104 -0
- package/dist/lib/team-agent-removal.d.ts.map +1 -0
- package/dist/lib/team-agent-removal.js +121 -0
- package/dist/lib/team-agent-removal.js.map +1 -0
- package/dist/lib/team-channel-removal.d.ts +220 -0
- package/dist/lib/team-channel-removal.d.ts.map +1 -0
- package/dist/lib/team-channel-removal.js +258 -0
- package/dist/lib/team-channel-removal.js.map +1 -0
- package/dist/lib/team-deploy-inspection.d.ts +59 -0
- package/dist/lib/team-deploy-inspection.d.ts.map +1 -0
- package/dist/lib/team-deploy-inspection.js +177 -0
- package/dist/lib/team-deploy-inspection.js.map +1 -0
- package/dist/lib/team-fresh.d.ts +73 -0
- package/dist/lib/team-fresh.d.ts.map +1 -0
- package/dist/lib/team-fresh.js +207 -0
- package/dist/lib/team-fresh.js.map +1 -0
- package/dist/lib/team-removal-reconcile.d.ts +118 -0
- package/dist/lib/team-removal-reconcile.d.ts.map +1 -0
- package/dist/lib/team-removal-reconcile.js +90 -0
- package/dist/lib/team-removal-reconcile.js.map +1 -0
- package/dist/lib/team-removal-record.d.ts +7 -0
- package/dist/lib/team-removal-record.d.ts.map +1 -0
- package/dist/lib/team-removal-record.js +46 -0
- package/dist/lib/team-removal-record.js.map +1 -0
- package/dist/lib/team-retained.d.ts +33 -0
- package/dist/lib/team-retained.d.ts.map +1 -0
- package/dist/lib/team-retained.js +55 -0
- package/dist/lib/team-retained.js.map +1 -0
- package/dist/lib/theme.d.ts.map +1 -1
- package/dist/lib/theme.js +9 -8
- package/dist/lib/theme.js.map +1 -1
- package/dist/lib/transient.d.ts +14 -9
- package/dist/lib/transient.d.ts.map +1 -1
- package/dist/lib/transient.js +25 -18
- package/dist/lib/transient.js.map +1 -1
- package/dist/lib/up-report.d.ts +1 -0
- package/dist/lib/up-report.d.ts.map +1 -1
- package/dist/lib/up-report.js +2 -1
- package/dist/lib/up-report.js.map +1 -1
- package/dist/lib/version.d.ts +8 -2
- package/dist/lib/version.d.ts.map +1 -1
- package/dist/lib/version.js +16 -9
- package/dist/lib/version.js.map +1 -1
- package/dist/seed/paths.d.ts +1 -1
- package/dist/seed/paths.js +1 -1
- package/dist/seed/reconcile.d.ts.map +1 -1
- package/dist/seed/reconcile.js +19 -3
- package/dist/seed/reconcile.js.map +1 -1
- package/dist/ui.d.ts +6 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +12 -1
- package/dist/ui.js.map +1 -1
- package/dist/watch-data.d.ts +15 -0
- package/dist/watch-data.d.ts.map +1 -0
- package/dist/watch-data.js +66 -0
- package/dist/watch-data.js.map +1 -0
- package/dist/watch-json.d.ts +5 -0
- package/dist/watch-json.d.ts.map +1 -0
- package/dist/watch-json.js +131 -0
- package/dist/watch-json.js.map +1 -0
- package/dist/watch-view.d.ts +8 -0
- package/dist/watch-view.d.ts.map +1 -0
- package/dist/watch-view.js +65 -0
- package/dist/watch-view.js.map +1 -0
- package/package.json +8 -5
- package/dist/commands/service.d.ts +0 -17
- package/dist/commands/service.d.ts.map +0 -1
- package/dist/commands/service.js +0 -589
- package/dist/commands/service.js.map +0 -1
package/dist/commands/status.js
CHANGED
|
@@ -1,153 +1,280 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
2
3
|
import { join } from "node:path";
|
|
3
|
-
import { CotalEndpoint, dialerFor, EpEnvelopeError, isReachable, mintCreds, mintLifecycleUid, resolveService, invokeRepairingSplit, standaloneConnectOpts, newIdentity, idFromCreds, principalKey, DEV_OWNER, unansweredRequest, resolveAuthProvider,
|
|
4
|
-
import { accountInventory, authDir, canonicalRoot, CLI_USER_ACTOR, deliveryCredsKey, DELIVERY_PIDFILE, extensionsDir, findCotalRoot,
|
|
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, authDir, isCommandFailure, brokerAddressForDisplay, canonicalRoot, CLI_USER_ACTOR, CommandFailure, deliveryCredsKey, DELIVERY_PIDFILE, extensionsDir, findCotalRoot, findPreparedSpace, hasUserAuthState, homeCotalDir, cachedPreferences, resolvePreference, isMeshRegistryError, isWorkspaceTargetError, jsonFlag, loadSoleSpaceAuth, localProcessPath, localProcessVisible, MANAGER_PIDFILE, oneLine, parsePid, plainFlag, preflightTarget, presentationOf, probeLiveness, probeWebReadiness, readCurrent, readMeshRegistry, readRenewalRecord, renderWorkspaceError, resolveMeshTarget, serverFlag, spaceFlag, userAuthStateDir, WEB_PIDFILE, WEB_READINESS_HEADER, workspaceSecretStore, writeResult } from "@cotal-ai/workspace";
|
|
5
6
|
import { localProcessSurface } from "../ext-loader.js";
|
|
6
|
-
import { cliVersion, cliProvenance,
|
|
7
|
+
import { cliVersion, cliProvenance, readExtensionVersions } from "../lib/version.js";
|
|
7
8
|
import { agentSkillsSkew } from "../lib/agent-skills.js";
|
|
8
9
|
import { managerHasDeliveryMarker } from "../lib/manager-proc.js";
|
|
9
|
-
import { connectorHarnesses, connectorStatusRows, machineStatus, recordedWebUrl, resolveRuntimeSpace, webBoundAddress, webInstalled } from "../lib/status.js";
|
|
10
|
+
import { connectorHarnesses, connectorStatusRows, machineStatus, recordedWebUrl, resolveRuntimeSpace, webBoundAddress, webInstalled, webSessionSource } from "../lib/status.js";
|
|
10
11
|
import { deliveryResponderFromLease, deliveryResponderState, deliveryRowSuffix, RESPONDER_UNBOUND_CONSEQUENCE } from "../lib/delivery-responder.js";
|
|
11
12
|
import { pidfileState } from "./down.js";
|
|
12
13
|
import { displayCmd } from "../lib/self-exec.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
14
|
+
import { readPersonas } from "../lib/personas.js";
|
|
15
|
+
import { defaultPersonaFix } from "../lib/default-persona.js";
|
|
16
|
+
import { c } from "../ui.js";
|
|
15
17
|
import { preparedCatalogDiagnostics } from "./sync.js";
|
|
18
|
+
import { agentStatus } from "./agents.js";
|
|
19
|
+
import { onInstance } from "../lib/control.js";
|
|
20
|
+
import { serviceDefinitionProjection, serviceDefinitionStore } from "../lib/service-definitions.js";
|
|
21
|
+
import { instanceProjection, serviceInstances } from "../lib/service-instances.js";
|
|
22
|
+
import { freshTeamAttemptSettled, listFreshTeamAttempts, listFreshTeamSummaries } from "../lib/team-fresh.js";
|
|
23
|
+
import { additiveTeamRecordedState, listAdditiveTeamAttempts } from "../lib/team-additive-attempt.js";
|
|
16
24
|
/** `--components` is the fail-loud health pass with a machine-readable EXIT DISPOSITION. Bare
|
|
17
|
-
* `status`
|
|
18
|
-
* an operator or monitor that needs a component state per
|
|
25
|
+
* `status` is a broad, recovery-oriented report: it exits 0, or 4 when it could not read part of what
|
|
26
|
+
* it reports; this explicit mode is for an operator or monitor that needs a component state per
|
|
27
|
+
* component and an exit code to branch on.
|
|
19
28
|
*
|
|
20
29
|
* THAT DIVISION IS ABOUT EXIT CODES AND COMPLETENESS, NOT ABOUT TRUTHFULNESS, and #1576 is where the
|
|
21
30
|
* difference bit. Bare status printed `delivery running (pid N)` over a daemon whose responder had
|
|
22
31
|
* never bound — not a broad answer but a specific and wrong one, identical to the line it prints
|
|
23
32
|
* when delivery is fully healthy, for 22 hours, while spawn/retirement/join all failed. A broad
|
|
24
|
-
* diagnostic may omit an axis; it may not claim one it never checked. So bare status stays broad
|
|
25
|
-
*
|
|
26
|
-
*
|
|
33
|
+
* diagnostic may omit an axis; it may not claim one it never checked. So bare status stays broad,
|
|
34
|
+
* and the delivery row names the responder state it actually read (or says plainly that it did not
|
|
35
|
+
* read it, and points here). */
|
|
27
36
|
export const statusFlags = [
|
|
28
37
|
spaceFlag,
|
|
29
38
|
serverFlag,
|
|
39
|
+
{ name: "on", type: "string", value: "<manager-instance>", description: "named agent: inspect one manager instance" },
|
|
40
|
+
{ name: "creds", type: "string", value: "<file>", description: "named agent: use an explicit connection credential" },
|
|
41
|
+
{ name: "all", type: "boolean", description: "check every recorded mesh, not only the selected one" },
|
|
42
|
+
{ name: "verbose", short: "v", type: "boolean", description: "include installation paths, local records and detailed diagnostics" },
|
|
30
43
|
{ name: "components", type: "boolean", description: "probe manager, delivery, web, and registered broker component health (exit: 0 serving; 1 absent; 2 present but not serving; 3 probe refused)" },
|
|
44
|
+
jsonFlag,
|
|
45
|
+
plainFlag,
|
|
31
46
|
];
|
|
47
|
+
/** A project root with no registration or prepared space here, such as one whose space was
|
|
48
|
+
* forgotten. The resolver gives it the default broker address, which any broker may hold, so
|
|
49
|
+
* status selects no space for it and dials nothing. */
|
|
50
|
+
class UnregisteredRoot {
|
|
51
|
+
root;
|
|
52
|
+
constructor(root) {
|
|
53
|
+
this.root = root;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
32
56
|
function resolveSelected(cwd, values) {
|
|
33
57
|
try {
|
|
34
|
-
|
|
58
|
+
const target = resolveMeshTarget(cwd, { server: values.server, space: values.space });
|
|
59
|
+
return target.source === "local-space" ? { ok: false, error: new UnregisteredRoot(target.root) } : { ok: true, target };
|
|
35
60
|
}
|
|
36
61
|
catch (e) {
|
|
37
62
|
return { ok: false, error: e };
|
|
38
63
|
}
|
|
39
64
|
}
|
|
65
|
+
/** Collects what each reader could not read, so the report names it on its row and the run is
|
|
66
|
+
* reported partial rather than complete. */
|
|
67
|
+
class Gaps {
|
|
68
|
+
warnings = [];
|
|
69
|
+
/** Two readers that hit the same part, such as one catalog read as the folder's and the selected
|
|
70
|
+
* mesh's, name it once. */
|
|
71
|
+
add(code, message, target = null) {
|
|
72
|
+
if (this.warnings.some((w) => w.code === code && w.message === message))
|
|
73
|
+
return;
|
|
74
|
+
this.warnings.push({ code, target, message });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/** Keep unsafe stored addresses explicit without exposing their original text. */
|
|
78
|
+
function displayStatusBroker(server, space, gaps) {
|
|
79
|
+
const display = brokerAddressForDisplay(server);
|
|
80
|
+
if (display !== undefined)
|
|
81
|
+
return display;
|
|
82
|
+
gaps.add("BROKER_ADDRESS_INVALID", `broker address for '${space}' cannot be displayed`, { space });
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
/** Named-agent and infrastructure inputs choose different reads. */
|
|
86
|
+
export function validateStatusArguments(args) {
|
|
87
|
+
if (args.positionals.length > 1 || args.positionals.length && !args.positionals[0]?.trim())
|
|
88
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "status takes at most one agent name");
|
|
89
|
+
if (args.positionals.length && (args.values.all || args.values.components))
|
|
90
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "a named agent status takes no --all or --components");
|
|
91
|
+
if (typeof args.values.on === "string")
|
|
92
|
+
onInstance(args.values.on, "cotal status");
|
|
93
|
+
if (!args.positionals.length && (args.values.on !== undefined || args.values.creds !== undefined))
|
|
94
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "--on and --creds select a named agent read, not infrastructure status");
|
|
95
|
+
}
|
|
40
96
|
/** `cotal status` — detailed, read-only diagnostics for the local machine + selected mesh. */
|
|
41
97
|
export async function status(args) {
|
|
98
|
+
validateStatusArguments(args);
|
|
99
|
+
if (args.positionals.length)
|
|
100
|
+
return agentStatus(args);
|
|
42
101
|
const values = args.values;
|
|
102
|
+
const presentation = presentationOf(values);
|
|
103
|
+
if (values.components && (presentation !== "rich" || values.all))
|
|
104
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "--components checks the selected mesh and writes its own records - it takes no --json, --plain or --all", {
|
|
105
|
+
remedy: `run \`${displayCmd()} status --components\` on its own`,
|
|
106
|
+
});
|
|
43
107
|
const cwd = process.cwd();
|
|
44
108
|
const root = findCotalRoot(cwd);
|
|
45
|
-
const cmd = displayCmd();
|
|
46
|
-
console.log(c.bold("cotal status"));
|
|
47
109
|
const selected = resolveSelected(cwd, values);
|
|
48
|
-
|
|
49
|
-
|
|
110
|
+
const gaps = new Gaps();
|
|
111
|
+
const hints = [];
|
|
112
|
+
const machine = await readMachine(selected, gaps);
|
|
113
|
+
const extensions = readExtensions(gaps);
|
|
50
114
|
// THE RESPONDER AXIS (#1576), read ONCE and threaded into the rows that would otherwise claim
|
|
51
115
|
// health they never checked. It is read before the folder section because that section renders
|
|
52
116
|
// the delivery process row, and a live pid means nothing without it.
|
|
53
117
|
const responder = await readResponderAxis(selected);
|
|
54
|
-
await
|
|
55
|
-
await
|
|
56
|
-
await
|
|
118
|
+
const folder = await readFolder(root, selected, values, responder, gaps, hints);
|
|
119
|
+
const meshes = await readMeshes(selected, Boolean(values.all), gaps);
|
|
120
|
+
const target = await readSelected(selected, responder, gaps, hints);
|
|
121
|
+
const services = readOwnedServices(selected, gaps);
|
|
122
|
+
const bootAttempts = readBootAttempts(root, gaps);
|
|
123
|
+
const result = { kind: "infrastructure", machine, extensions, folder, meshes, selected: target, services, bootAttempts, hints };
|
|
124
|
+
const parts = gaps.warnings.length;
|
|
125
|
+
writeResult(presentation, {
|
|
126
|
+
command: "status",
|
|
127
|
+
target: { space: selected.ok ? selected.target.space : null, scope: values.all ? "all" : "selected" },
|
|
128
|
+
result,
|
|
129
|
+
completeness: parts ? "partial" : "complete",
|
|
130
|
+
warnings: gaps.warnings,
|
|
131
|
+
...(parts ? { partial: { message: `status could not read ${parts === 1 ? "one part" : `${parts} parts`} of what it reports; the warnings name ${parts === 1 ? "it" : "each"}` } } : {}),
|
|
132
|
+
}, (result) => statusView(result, Boolean(values.verbose)));
|
|
57
133
|
if (values.components)
|
|
58
134
|
await printComponentHealth(cwd, values);
|
|
59
135
|
}
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
136
|
+
/** Local boot and additive intents are recovery coordinates, not evidence of native state. */
|
|
137
|
+
function readBootAttempts(root, gaps) {
|
|
138
|
+
const result = { root, state: "not-checked", observedAt: new Date().toISOString(), unsettled: [], additive: [], unreadable: [] };
|
|
139
|
+
try {
|
|
140
|
+
if (!realDirNoSymlink(root, ".cotal"))
|
|
141
|
+
return result;
|
|
142
|
+
const attempts = listFreshTeamAttempts(root), summaries = listFreshTeamSummaries(root);
|
|
143
|
+
const byId = new Map(summaries.valid.map((summary) => [summary.deploymentId, summary]));
|
|
144
|
+
result.unsettled = attempts.valid.filter((attempt) => !freshTeamAttemptSettled(attempt, byId.get(attempt.deploymentId)))
|
|
145
|
+
.map(({ deploymentId, space, server, createdAt }) => ({ deploymentId, space, server: brokerAddressForDisplay(server) ?? "not displayable", createdAt }));
|
|
146
|
+
const unreadable = [...attempts.refused, ...summaries.refused].map(({ path }) => path);
|
|
147
|
+
result.unreadable.push(...unreadable);
|
|
148
|
+
if (unreadable.length)
|
|
149
|
+
gaps.add("FRESH_BOOT_RECORD_UNREADABLE", "one or more fresh boot attempts or returned summaries are unreadable; their outcomes were not treated as absent", { root, paths: unreadable });
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
result.state = "partial";
|
|
153
|
+
gaps.add("FRESH_BOOT_RECORD_UNAVAILABLE", "this folder's fresh boot attempt inventory could not be read; no empty inventory was inferred", { root });
|
|
71
154
|
}
|
|
72
|
-
for (const e of exts)
|
|
73
|
-
row(e.label, c.green(`v${e.version}`) + (e.pkg === e.label ? "" : c.dim(` · ${e.pkg}`)));
|
|
74
|
-
}
|
|
75
|
-
/** Cotal's authored skills reach non-Claude harnesses through the cross-vendor `~/.agents/skills`
|
|
76
|
-
* directory (Codex, Cursor, OpenCode, Gemini CLI, Windsurf). Those harnesses have no remote update, so
|
|
77
|
-
* surface a stale/missing/retired drop here and point at the skills-only write (`cotal setup --skills`).
|
|
78
|
-
* A corrupt skills bundle throws (fail-loud); we render that as a red integrity error rather than "none shipped". */
|
|
79
|
-
function skillsSkewRow() {
|
|
80
|
-
let skew;
|
|
81
155
|
try {
|
|
82
|
-
|
|
156
|
+
const additive = listAdditiveTeamAttempts(root);
|
|
157
|
+
result.additive = additive.valid.map((attempt) => ({ deploymentId: attempt.deploymentId, space: attempt.space, server: brokerAddressForDisplay(attempt.server) ?? "not displayable", createdAt: attempt.createdAt, recordedState: additiveTeamRecordedState(attempt, additive) }));
|
|
158
|
+
const unreadable = additive.refused.map(({ path }) => path);
|
|
159
|
+
result.unreadable.push(...unreadable);
|
|
160
|
+
if (unreadable.length)
|
|
161
|
+
gaps.add("ADDITIVE_ATTEMPT_UNREADABLE", "one or more additive attempts are unreadable; their effects were not treated as absent", { root, paths: unreadable });
|
|
83
162
|
}
|
|
84
|
-
catch
|
|
85
|
-
|
|
163
|
+
catch {
|
|
164
|
+
result.state = "partial";
|
|
165
|
+
gaps.add("ADDITIVE_ATTEMPT_UNAVAILABLE", "this folder's additive attempt inventory could not be read; no empty inventory was inferred", { root });
|
|
86
166
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return c.dim(`not installed · ${displayCmd()} setup --skills`);
|
|
92
|
-
const retired = behind.filter((s) => s.state === "retired").length;
|
|
93
|
-
const label = retired ? `${behind.length} to reconcile (${retired} retired)` : `${behind.length}/${skew.length} out of date`;
|
|
94
|
-
return c.yellow(`${label} · ${displayCmd()} setup --skills`);
|
|
167
|
+
if (result.state !== "partial")
|
|
168
|
+
result.state = result.unreadable.length ? "partial" : "read";
|
|
169
|
+
result.observedAt = new Date().toISOString();
|
|
170
|
+
return result;
|
|
95
171
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
172
|
+
/** Separate the new owned-controller records from legacy pidfiles and remote registrations.
|
|
173
|
+
* An unreadable family is null and makes the report partial, never a complete empty list. */
|
|
174
|
+
function readOwnedServices(selected, gaps) {
|
|
175
|
+
const result = { space: selected.ok ? selected.target.space : null, state: "not-checked", observedAt: new Date().toISOString(), atomicSnapshot: false, definitions: null, instances: null, scope: "selected-space local owned records; no remote registration or fresh endpoint probe" };
|
|
176
|
+
if (!selected.ok)
|
|
177
|
+
return result;
|
|
178
|
+
const space = selected.target.space;
|
|
179
|
+
try {
|
|
180
|
+
result.definitions = serviceDefinitionStore(space).list().map(serviceDefinitionProjection);
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
const causeCode = isCommandFailure(error) ? error.code : "TARGET_UNAVAILABLE";
|
|
184
|
+
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 });
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
result.instances = serviceInstances(space).map(instanceProjection);
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
const causeCode = isCommandFailure(error) ? error.code : "TARGET_UNAVAILABLE";
|
|
191
|
+
gaps.add("SERVICE_INSTANCES_UNAVAILABLE", `the selected space's owned service instance observations could not be established (${causeCode}); no stopped, empty or serving state was inferred`, { space, causeCode });
|
|
192
|
+
}
|
|
193
|
+
result.state = result.definitions === null || result.instances === null ? "partial" : "read";
|
|
194
|
+
result.observedAt = new Date().toISOString();
|
|
195
|
+
return result;
|
|
100
196
|
}
|
|
101
|
-
async function
|
|
197
|
+
async function readMachine(selected, gaps) {
|
|
102
198
|
const m = await machineStatus();
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
199
|
+
let defaults = null;
|
|
200
|
+
try {
|
|
201
|
+
const context = { preferences: cachedPreferences(), space: selected.ok ? selected.target.space : undefined };
|
|
202
|
+
defaults = { harness: resolvePreference("harness", context).value, persona: resolvePreference("persona", context).value };
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
gaps.add("PREFERENCES_UNREADABLE", "the saved agent defaults could not be read");
|
|
206
|
+
}
|
|
207
|
+
let connectors = null;
|
|
208
|
+
const integrations = [];
|
|
109
209
|
try {
|
|
110
|
-
|
|
111
|
-
row("Web extension", webExt ? c.green("installed") : c.dim("not installed"));
|
|
210
|
+
connectors = connectorHarnesses();
|
|
112
211
|
}
|
|
113
212
|
catch (e) {
|
|
114
|
-
|
|
213
|
+
gaps.add("CONNECTORS_UNREADABLE", `the installed connectors could not be listed: ${e.message}`);
|
|
115
214
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
* absence is `not installed`. */
|
|
122
|
-
function webProcessRow(selected, installed) {
|
|
123
|
-
let url;
|
|
215
|
+
if (connectors)
|
|
216
|
+
for (const r of await connectorStatusRows(connectors))
|
|
217
|
+
integrations.push({ name: r.label, state: r.state, text: r.text });
|
|
218
|
+
let installed = null;
|
|
219
|
+
let installedError = null;
|
|
124
220
|
try {
|
|
125
|
-
|
|
221
|
+
installed = webInstalled();
|
|
126
222
|
}
|
|
127
223
|
catch (e) {
|
|
128
|
-
|
|
224
|
+
installedError = e.message;
|
|
225
|
+
gaps.add("WEB_UNREADABLE", `the web extension's record could not be read: ${installedError}`);
|
|
129
226
|
}
|
|
130
|
-
|
|
227
|
+
let url = null;
|
|
228
|
+
let urlError = null;
|
|
229
|
+
try {
|
|
230
|
+
url = (selected.ok ? recordedWebUrl({ root: selected.target.root, space: selected.target.space }) : undefined) ?? null;
|
|
231
|
+
}
|
|
232
|
+
catch (e) {
|
|
233
|
+
// An unreadable `web.pid` or session record is named on the row, like the folder's process rows,
|
|
234
|
+
// so the rest of status still prints.
|
|
235
|
+
urlError = e.message;
|
|
236
|
+
gaps.add("WEB_UNREADABLE", `the dashboard's records could not be read: ${urlError}`);
|
|
237
|
+
}
|
|
238
|
+
return {
|
|
239
|
+
version: cliVersion(),
|
|
240
|
+
node: process.version,
|
|
241
|
+
platform: `${process.platform === "darwin" ? "macOS" : process.platform === "win32" ? "Windows" : process.platform === "linux" ? "Linux" : process.platform} ${process.arch}`,
|
|
242
|
+
install: cliProvenance(),
|
|
243
|
+
nats: m.nats,
|
|
244
|
+
integrations,
|
|
245
|
+
defaults,
|
|
246
|
+
connectors: connectors?.map((h) => ({ name: h.name, requires: [...h.requires], missing: h.missing })) ?? null,
|
|
247
|
+
skills: readSkills(gaps),
|
|
248
|
+
web: { installed, installedError, url, urlError },
|
|
249
|
+
};
|
|
131
250
|
}
|
|
132
|
-
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
|
|
136
|
-
|
|
251
|
+
/** Cotal's authored skills reach non-Claude harnesses through the cross-vendor `~/.agents/skills`
|
|
252
|
+
* directory (Codex, Cursor, OpenCode, Gemini CLI, Windsurf). Those harnesses have no remote update, so
|
|
253
|
+
* surface a stale/missing/retired drop here and point at the skills-only write (`cotal setup --skills`).
|
|
254
|
+
* A corrupt skills bundle throws (fail-loud); we report that as an integrity error rather than "none shipped". */
|
|
255
|
+
function readSkills(gaps) {
|
|
256
|
+
let skew;
|
|
137
257
|
try {
|
|
138
|
-
|
|
258
|
+
skew = agentSkillsSkew();
|
|
139
259
|
}
|
|
140
260
|
catch (e) {
|
|
141
|
-
|
|
142
|
-
return;
|
|
261
|
+
gaps.add("SKILLS_UNREADABLE", `the skills bundle could not be read: ${e.message}`);
|
|
262
|
+
return { state: "unreadable", total: 0, behind: 0, retired: 0, error: e.message };
|
|
143
263
|
}
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
264
|
+
const behind = skew.filter((s) => s.state !== "current");
|
|
265
|
+
const retired = behind.filter((s) => s.state === "retired").length;
|
|
266
|
+
const state = !behind.length ? "current" : behind.every((s) => s.state === "missing") ? "not-installed" : "behind";
|
|
267
|
+
return { state, total: skew.length, behind: behind.length, retired, error: null };
|
|
268
|
+
}
|
|
269
|
+
/** The installed extensions (seeded built-in connectors + operator `ext add`s) with their pinned
|
|
270
|
+
* versions. The root plus an explicit empty state answers "where do these live / is anything
|
|
271
|
+
* installed", which is ambiguous on a fresh binary before its first seed. Versions are the manifest
|
|
272
|
+
* pin (add-time), not a live on-disk/host-compat check. */
|
|
273
|
+
function readExtensions(gaps) {
|
|
274
|
+
const { versions, unreadable } = readExtensionVersions();
|
|
275
|
+
if (unreadable !== undefined)
|
|
276
|
+
gaps.add("EXTENSIONS_UNREADABLE", `the extensions manifest could not be read: ${unreadable}`);
|
|
277
|
+
return { root: extensionsDir(), items: unreadable === undefined ? versions.map((e) => ({ package: e.pkg, label: e.label, version: e.version })) : null };
|
|
151
278
|
}
|
|
152
279
|
/** The lease `holder` the delivery daemon THIS WORKSPACE launched would write, or `undefined` when it
|
|
153
280
|
* cannot be known (#1576, and the reason is #837).
|
|
@@ -249,46 +376,47 @@ async function readResponderAxis(selected) {
|
|
|
249
376
|
return "unknown";
|
|
250
377
|
}
|
|
251
378
|
}
|
|
252
|
-
async function
|
|
253
|
-
|
|
254
|
-
|
|
379
|
+
async function readFolder(root, selected, values, responder, gaps, hints) {
|
|
380
|
+
const cmd = displayCmd();
|
|
381
|
+
const folder = (auth, processes = null, storedState = false, processSpace = null) => ({
|
|
382
|
+
root,
|
|
383
|
+
auth,
|
|
384
|
+
...folderPersonas(root, selected, values, gaps, hints),
|
|
385
|
+
processes,
|
|
386
|
+
processSpace,
|
|
387
|
+
storedState,
|
|
388
|
+
});
|
|
389
|
+
const unreadable = (error, hint) => {
|
|
390
|
+
gaps.add("AUTH_UNREADABLE", `this folder's trust material could not be read: ${error}`, { root });
|
|
391
|
+
hints.push(hint);
|
|
392
|
+
return folder({ state: "unreadable", spaces: [], userAuth: false, error });
|
|
393
|
+
};
|
|
255
394
|
// The inventory READ itself can throw (an EACCES/ELOOP on `.cotal/auth`, not just a bad record):
|
|
256
395
|
// `accountInventory` lets that propagate so the broker-wide guards fail CLOSED, but status is the
|
|
257
|
-
// recovery command and must
|
|
258
|
-
//
|
|
396
|
+
// recovery command and must report any trust material it cannot read. Frame the unreadable auth
|
|
397
|
+
// dir and stop.
|
|
259
398
|
let spaces;
|
|
260
399
|
let corrupt;
|
|
261
400
|
try {
|
|
262
401
|
({ spaces, corrupt } = accountInventory(authDir(root)));
|
|
263
402
|
}
|
|
264
403
|
catch (e) {
|
|
265
|
-
|
|
266
|
-
row("hint", `check permissions on ${authDir(root)} - broker-wide commands refuse while the tenant list cannot be read`);
|
|
267
|
-
printPersonas(root, cmd, selected, values);
|
|
268
|
-
return;
|
|
404
|
+
return unreadable(`auth dir unreadable · ${e.message}`, `check permissions on ${authDir(root)} - broker-wide commands refuse while the tenant list cannot be read`);
|
|
269
405
|
}
|
|
270
406
|
// Status is the command the broker-wide refusals send the operator to, so it must DESCRIBE every
|
|
271
407
|
// state those refusals can name - crashing on one is a dead end in the exact recovery flow. An
|
|
272
408
|
// unreadable record means the tenant list is uncertain: report it (the space-blind sole-load
|
|
273
409
|
// below would throw on it).
|
|
274
|
-
if (corrupt.length > 0)
|
|
275
|
-
|
|
276
|
-
row("hint", `repair or remove ${corrupt.map((f) => join(authDir(root), f)).join(", ")} - broker-wide commands refuse while the tenant list is uncertain`);
|
|
277
|
-
printPersonas(root, cmd, selected, values);
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
410
|
+
if (corrupt.length > 0)
|
|
411
|
+
return unreadable(`${corrupt.length} unreadable account record(s) · ${corrupt.join(", ")}`, `repair or remove ${corrupt.map((f) => join(authDir(root), f)).join(", ")} - broker-wide commands refuse while the tenant list is uncertain`);
|
|
280
412
|
// A root holding several accounts has no single "this folder's space", and the process rows below
|
|
281
413
|
// are keyed by one. Report the tenant list instead of letting the space-blind read throw.
|
|
282
|
-
if (spaces.length > 1)
|
|
283
|
-
|
|
284
|
-
printPersonas(root, cmd, selected, values);
|
|
285
|
-
console.log(c.dim(" per-space process state is not reported on a multi-space root yet"));
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
414
|
+
if (spaces.length > 1)
|
|
415
|
+
return folder({ state: "spaces", spaces, userAuth: false, error: null });
|
|
288
416
|
// The inventory shape-check is necessary but not sufficient: a record can carry non-empty
|
|
289
417
|
// account fields yet fail COMPOSITION (a malformed account JWT, or one signed by a foreign
|
|
290
418
|
// operator - `composeSpaceAuth` throws on both). Status is the recovery command the broker-wide
|
|
291
|
-
// refusals point at, so it must
|
|
419
|
+
// refusals point at, so it must report any record it cannot load with guidance, not crash on
|
|
292
420
|
// the ones the cheap shape gate lets through. Frame the load failure the same as an unreadable
|
|
293
421
|
// record and stop.
|
|
294
422
|
let auth;
|
|
@@ -296,12 +424,9 @@ async function printProject(root, cmd, selected, values, responder = "unknown")
|
|
|
296
424
|
auth = loadSoleSpaceAuth(authDir(root));
|
|
297
425
|
}
|
|
298
426
|
catch (e) {
|
|
299
|
-
|
|
300
|
-
row("hint", `${e.message}`);
|
|
301
|
-
printPersonas(root, cmd, selected, values);
|
|
302
|
-
return;
|
|
427
|
+
return unreadable(`unreadable trust material · ${e.message.split(" - ")[0]}`, e.message);
|
|
303
428
|
}
|
|
304
|
-
const userDisk = auth && hasUserAuthState(root, auth.space);
|
|
429
|
+
const userDisk = Boolean(auth && hasUserAuthState(root, auth.space));
|
|
305
430
|
// An open mesh has no account record to name its space, so the folder's space is read off its
|
|
306
431
|
// runtime records - and a root whose records show two spaces RUNNING has no single answer, the
|
|
307
432
|
// same shape as the multi-account case above. The process rows below are keyed by one space, so
|
|
@@ -311,114 +436,263 @@ async function printProject(root, cmd, selected, values, responder = "unknown")
|
|
|
311
436
|
space = auth?.space ?? resolveRuntimeSpace(root);
|
|
312
437
|
}
|
|
313
438
|
catch (e) {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
row("personas", personaSummary(root));
|
|
317
|
-
return;
|
|
439
|
+
hints.push(e.message);
|
|
440
|
+
return folder({ state: "none", spaces: [], userAuth: false, error: null });
|
|
318
441
|
}
|
|
319
|
-
const context = { root, space, userAuth:
|
|
320
|
-
|
|
321
|
-
printPersonas(root, cmd, selected, values);
|
|
442
|
+
const context = { root, space, userAuth: userDisk };
|
|
443
|
+
const processes = [];
|
|
322
444
|
let nats;
|
|
323
445
|
for (const component of localProcessSurface().filter((component) => localProcessVisible(component, context)).sort((a, b) => (a.order ?? 50) - (b.order ?? 50))) {
|
|
324
446
|
let state;
|
|
325
447
|
try {
|
|
326
|
-
state =
|
|
448
|
+
state = pidfileState(localProcessPath(component.pidFile, context));
|
|
327
449
|
}
|
|
328
450
|
catch (e) {
|
|
329
451
|
// `localProcessPath` throws on an ambiguous record and `pidfileState` on one it cannot read, so
|
|
330
452
|
// `clean` and `down` refuse to act on either. Status is the recovery command: name the failed
|
|
331
453
|
// read on this row and report the rest.
|
|
332
|
-
|
|
454
|
+
gaps.add("PIDFILE_UNREADABLE", `the ${component.name} pidfile could not be read: ${e.message}`, { root, space, process: component.name });
|
|
455
|
+
processes.push({ name: component.name, state: "unreadable", pid: null, detail: `pidfile unreadable · ${e.message}` });
|
|
333
456
|
continue;
|
|
334
457
|
}
|
|
335
458
|
if (component.name === "nats")
|
|
336
459
|
nats = state;
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
continue;
|
|
343
|
-
}
|
|
460
|
+
// #2073: a live manager pid used to print green `running` on the pidfile alone, which is how
|
|
461
|
+
// a manager whose service rail had died read as healthy for hours. One probe of the service
|
|
462
|
+
// endpoint now decides the row; see `managerProcess`.
|
|
463
|
+
if (component.name === "manager")
|
|
464
|
+
processes.push(await managerProcess(selected.ok ? selected.target : undefined, state, context.space, gaps));
|
|
344
465
|
// THE #1576 ROW. A live delivery PID is not the fact an operator needs; the responder is.
|
|
345
|
-
//
|
|
346
|
-
//
|
|
347
|
-
//
|
|
348
|
-
|
|
349
|
-
|
|
466
|
+
// A live pid alone read as `delivery running (pid N)` identically over a bound responder and one
|
|
467
|
+
// that never bound. The detail names which it is, and when unbound it names the CONSEQUENCE
|
|
468
|
+
// rather than a reconcile that has not happened yet.
|
|
469
|
+
else
|
|
470
|
+
processes.push(processRow(component.name, state, component.name === "delivery" ? deliveryDetail(state.liveness === "alive", responder) : null));
|
|
350
471
|
}
|
|
351
472
|
// A stopped mesh with a persisted store: name the reset verb. Stale state (e.g. durables from
|
|
352
473
|
// an older Cotal generation) is otherwise invisible until a spawn fails on it. The restart is
|
|
353
474
|
// deliberately "your usual flags", never a bare `up` (mode/name/store-dir aren't recorded).
|
|
354
|
-
|
|
355
|
-
|
|
475
|
+
const storedState = nats?.liveness !== "alive" && existsSync(join(root, ".cotal", "nats"));
|
|
476
|
+
if (storedState)
|
|
477
|
+
hints.push(`if the stored JetStream state is stale: ${cmd} clean store --force, then \`up\` with your usual flags (\`clean all\` also resets identity)`);
|
|
478
|
+
return folder({ state: auth ? "space" : "none", spaces: auth ? [auth.space] : [], userAuth: userDisk, error: null }, processes, storedState, space);
|
|
356
479
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
480
|
+
/** The folder's persona catalog, which must never let a catalog imply a `spawn` the operator does
|
|
481
|
+
* not have.
|
|
482
|
+
*
|
|
483
|
+
* The row used to read `personas default` in green under "This Folder" while `cotal spawn` in the
|
|
484
|
+
* same second refused with "no default persona yet". Both were right about their OWN root and
|
|
485
|
+
* neither NAMED it: the folder's catalog is `<cwd-root>/.cotal/agents`, and spawn loads the
|
|
486
|
+
* RESOLVED mesh's `target.personaRoot`, which is a different directory whenever `cotal use`, a
|
|
487
|
+
* `--space`, or the registry's sole entry points elsewhere. The listed names and the launchable
|
|
488
|
+
* names were disjoint sets.
|
|
489
|
+
*
|
|
490
|
+
* So: always name the root each summary describes, and say whether the folder's catalog is the one
|
|
491
|
+
* a bare spawn launches from (`launches`): true when the two roots are one directory, false when the
|
|
492
|
+
* selected mesh's root differs, null when no mesh resolves and nothing is launchable here. */
|
|
493
|
+
function folderPersonas(root, selected, values, gaps, hints) {
|
|
494
|
+
const personas = personaCatalog(root, gaps);
|
|
495
|
+
if (!selected.ok)
|
|
496
|
+
return { personas, launches: null };
|
|
497
|
+
if (sameDir(personaDir(root), selected.target.personaRoot))
|
|
498
|
+
return { personas, launches: true };
|
|
499
|
+
hints.push(`a bare \`${displayCmd()} spawn\` uses the selected mesh, NOT this folder - personas in ${personaDir(root)} will not launch until you run it from that mesh's root or select it (\`${displayCmd()} use <space>\`${values.space ? "" : ", or pass `--space`"})`);
|
|
500
|
+
return { personas, launches: false };
|
|
501
|
+
}
|
|
502
|
+
/** Summarize the catalog through the shipped loader. A file is launchable only when
|
|
503
|
+
* {@link readPersonas} parsed it with the same {@code loadAgentFile} path spawn uses. Only an absent
|
|
504
|
+
* directory is an empty catalog: one that cannot be read is a gap, not `missing`. */
|
|
505
|
+
function personaCatalog(root, gaps) {
|
|
506
|
+
let personas;
|
|
507
|
+
try {
|
|
508
|
+
personas = readPersonas(root);
|
|
509
|
+
}
|
|
510
|
+
catch (e) {
|
|
511
|
+
const error = e.message;
|
|
512
|
+
gaps.add("PERSONAS_UNREADABLE", `the persona catalog ${personaDir(root)} could not be read: ${error}`, { root: personaDir(root) });
|
|
513
|
+
return { root: personaDir(root), default: "unreadable", demo: null, error };
|
|
514
|
+
}
|
|
515
|
+
const byName = new Map(personas.map((persona) => [persona.name, persona]));
|
|
516
|
+
const def = byName.get("default");
|
|
517
|
+
return {
|
|
518
|
+
root: personaDir(root),
|
|
519
|
+
default: def?.def ? "valid" : def?.error ? "invalid" : "missing",
|
|
520
|
+
demo: ["david", "sven", "me"].filter((name) => byName.get(name)?.def !== undefined).length,
|
|
521
|
+
error: null,
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
/** Do two catalog paths denote the SAME directory? `canonicalRoot` (realpath, `resolve` fallback
|
|
525
|
+
* for a path not on disk) is the repo's one spelling for this: a raw `===` reads a symlinked or
|
|
526
|
+
* 8.3-short-name spelling of one directory as two, which here would fabricate a divergence and
|
|
527
|
+
* send the operator chasing a split that does not exist. */
|
|
528
|
+
function sameDir(a, b) {
|
|
529
|
+
return canonicalRoot(a) === canonicalRoot(b);
|
|
530
|
+
}
|
|
531
|
+
function processRow(name, p, detail) {
|
|
532
|
+
if (p.liveness === "alive")
|
|
533
|
+
return { name, state: "running", pid: p.pid ?? null, detail };
|
|
534
|
+
return { name, state: p.liveness === "unknown" ? "unknown" : "stopped", pid: p.pid ?? null, detail: p.note ?? null };
|
|
535
|
+
}
|
|
536
|
+
/** Bare status's manager row, #2073: a live pid alone is not proof the manager serves — that was
|
|
537
|
+
* exactly the incident (a lease holder whose service rail had died stayed `running` for hours).
|
|
538
|
+
* So a live manager pid gets ONE probe of its own service endpoint before the row is reported. This
|
|
539
|
+
* adds one request to every bare `status` call for a live manager pid.
|
|
540
|
+
*
|
|
541
|
+
* Three outcomes:
|
|
542
|
+
* - answered: `running` with the delivery-aware detail.
|
|
543
|
+
* - a DEFINITIVE no-answer — the same predicate `managerHealth`'s not-serving branch uses
|
|
544
|
+
* (`unansweredRequest`, or the service-registry-missing text): `not-serving` with
|
|
545
|
+
* `service endpoint not answering`, plus the marker error when the marker could not be read.
|
|
546
|
+
* - any other failure (a refused probe, an `unavailable` user-mode credential): `running` with
|
|
547
|
+
* `service unchecked`, so a failed probe never reads as a dead rail.
|
|
548
|
+
*
|
|
549
|
+
* A dead/stopped pid never reaches the probe at all (the early return below), so a stopped manager
|
|
550
|
+
* still reads as stopped, not `not-serving` — a dead pid is not a live pid that will not answer. */
|
|
551
|
+
async function managerProcess(target, state, space, gaps) {
|
|
552
|
+
if (state.liveness !== "alive")
|
|
553
|
+
return processRow("manager", state, null);
|
|
554
|
+
const details = [];
|
|
555
|
+
let deliveryAware = false;
|
|
556
|
+
try {
|
|
557
|
+
deliveryAware = managerHasDeliveryMarker(state.pid, space);
|
|
558
|
+
details.push(deliveryAware ? "delivery-aware" : "old/unknown build");
|
|
364
559
|
}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
console.log(c.dim(` note: current mesh "${current}" is not recorded`));
|
|
385
|
-
const catalogs = preparedCatalogDiagnostics();
|
|
386
|
-
if (catalogs.length) {
|
|
387
|
-
section("Space Catalog Accounts");
|
|
388
|
-
for (const result of catalogs) {
|
|
389
|
-
const detail = result.state === "failed" ? `: ${result.error ?? "refresh failed"}` : "";
|
|
390
|
-
console.log(` ${result.account.idpUrl} ${result.state}${detail}`);
|
|
560
|
+
catch (e) {
|
|
561
|
+
// The marker reader throws so `up` and the delivery preflight refuse to act on a marker they
|
|
562
|
+
// cannot read. Status is the recovery command: name the failed read on this row and report the rest.
|
|
563
|
+
details.push(`delivery-aware marker unreadable: ${e.message}`);
|
|
564
|
+
gaps.add("MARKER_UNREADABLE", `the manager's delivery-aware marker could not be read: ${e.message}`, { space, process: "manager" });
|
|
565
|
+
}
|
|
566
|
+
const running = (extra) => ({ name: "manager", state: "running", pid: state.pid ?? null, detail: [...details, ...(extra ? [extra] : [])].join(" · ") });
|
|
567
|
+
if (!target)
|
|
568
|
+
return running();
|
|
569
|
+
try {
|
|
570
|
+
let auth;
|
|
571
|
+
if (target.mode === "user") {
|
|
572
|
+
const credential = await componentCredential(target);
|
|
573
|
+
if (credential.kind !== "user")
|
|
574
|
+
return running("service unchecked");
|
|
575
|
+
auth = { bearer: credential.bearer, sentinelCreds: credential.sentinelCreds, caller: credential.caller };
|
|
576
|
+
}
|
|
577
|
+
else {
|
|
578
|
+
auth = await staticServiceAuth(target.auth);
|
|
391
579
|
}
|
|
580
|
+
await managerServiceHealth(target, auth);
|
|
581
|
+
return running();
|
|
582
|
+
}
|
|
583
|
+
catch (e) {
|
|
584
|
+
const noService = e instanceof EpEnvelopeError && (unansweredRequest(e) || /service registry.*stream not found/i.test(e.message));
|
|
585
|
+
if (noService)
|
|
586
|
+
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(" · ") };
|
|
587
|
+
return running("service unchecked");
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
/** The delivery row's responder detail (#1576). An unbound responder is not a footnote about a
|
|
591
|
+
* component: while it holds, the mesh cannot spawn, retire or accept a join, and the whole reported
|
|
592
|
+
* incident is that this read as ordinary. `unknown` names `--components`, because an unchecked axis
|
|
593
|
+
* must not look like a diagnosis in either direction. */
|
|
594
|
+
function deliveryDetail(live, responder) {
|
|
595
|
+
return deliveryRowSuffix(live, responder, `${displayCmd()} status --components`).replace(/^ · /, "") || null;
|
|
596
|
+
}
|
|
597
|
+
/** The recorded meshes. Only the selected one is checked unless `--all` asks for every one; each
|
|
598
|
+
* check dials that record's own address with its own recorded TLS requirement. A bare TCP/INFO
|
|
599
|
+
* probe would green-light a plaintext broker that has substituted for a TLS-required mesh — the
|
|
600
|
+
* FAIL1 attack — so a list that only asks "is anything listening" cannot report on the one property
|
|
601
|
+
* the record claims. */
|
|
602
|
+
async function readMeshes(selected, all, gaps) {
|
|
603
|
+
// A registry file that cannot be read is named, and the readable records are still listed and
|
|
604
|
+
// checked. Only an absent directory or pointer is an empty registry or no current mesh.
|
|
605
|
+
const unreadable = [];
|
|
606
|
+
const unread = (file, error) => {
|
|
607
|
+
unreadable.push({ file, error });
|
|
608
|
+
gaps.add("MESH_REGISTRY_UNREADABLE", error, { file });
|
|
609
|
+
};
|
|
610
|
+
let entries = [];
|
|
611
|
+
try {
|
|
612
|
+
const registry = readMeshRegistry();
|
|
613
|
+
entries = registry.entries;
|
|
614
|
+
for (const e of registry.unusable)
|
|
615
|
+
unread(e.file, e.message);
|
|
616
|
+
}
|
|
617
|
+
catch (e) {
|
|
618
|
+
if (!isMeshRegistryError(e))
|
|
619
|
+
throw e;
|
|
620
|
+
unread(e.file, e.message);
|
|
621
|
+
}
|
|
622
|
+
let current = null;
|
|
623
|
+
try {
|
|
624
|
+
current = readCurrent() ?? null;
|
|
625
|
+
}
|
|
626
|
+
catch (e) {
|
|
627
|
+
if (!isMeshRegistryError(e))
|
|
628
|
+
throw e;
|
|
629
|
+
unread(e.file, e.message);
|
|
392
630
|
}
|
|
631
|
+
const chosen = selected.ok ? selected.target.space : undefined;
|
|
632
|
+
const items = await Promise.all(entries.map(async (m) => ({
|
|
633
|
+
space: m.space,
|
|
634
|
+
server: displayStatusBroker(m.server, m.space, gaps),
|
|
635
|
+
mode: m.mode,
|
|
636
|
+
root: m.root,
|
|
637
|
+
origin: m.origin ?? null,
|
|
638
|
+
tlsRequired: Boolean(m.tlsRequired),
|
|
639
|
+
eventsRequired: m.policy?.events === "required",
|
|
640
|
+
current: m.space === current,
|
|
641
|
+
check: all || m.space === chosen ? ((await isReachable(m.server, m.tlsRequired ? { tls: true } : {})) ? "reachable" : "unreachable") : "not-checked",
|
|
642
|
+
catalog: m.origin === "catalog" ? { name: m.catalogName && m.catalogName !== m.space ? m.catalogName : null, fetchedAt: m.catalogFetchedAt ?? null, error: m.catalogError ?? null } : null,
|
|
643
|
+
})));
|
|
644
|
+
return {
|
|
645
|
+
current,
|
|
646
|
+
currentRecorded: current === null || entries.some((m) => m.space === current),
|
|
647
|
+
currentPrepared: current !== null && !entries.some((m) => m.space === current) && findPreparedSpace(current) !== undefined,
|
|
648
|
+
unreadable,
|
|
649
|
+
items,
|
|
650
|
+
catalogs: preparedCatalogDiagnostics().map((r) => ({ idp: r.account.idpUrl, state: r.state, error: r.state === "failed" ? (r.error ?? "refresh failed") : null })),
|
|
651
|
+
};
|
|
393
652
|
}
|
|
394
|
-
async function
|
|
395
|
-
|
|
653
|
+
async function readSelected(selected, responder, gaps, hints) {
|
|
654
|
+
const cmd = displayCmd();
|
|
396
655
|
if (!selected.ok) {
|
|
397
656
|
const e = selected.error;
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
row("hint", renderWorkspaceError({ kind: "target", error: e }).replace(/^✗ /, ""));
|
|
405
|
-
return;
|
|
657
|
+
// Resolution reads the whole registry and refuses a directory or record it cannot use. The meshes
|
|
658
|
+
// reader has already named it, so this is the same gap, and the selection is unresolved.
|
|
659
|
+
if (isMeshRegistryError(e)) {
|
|
660
|
+
gaps.add("MESH_REGISTRY_UNREADABLE", e.message, { file: e.file });
|
|
661
|
+
hints.push(e.message);
|
|
662
|
+
return { resolved: false, code: "registry-unreadable", message: e.message };
|
|
406
663
|
}
|
|
407
|
-
|
|
664
|
+
if (e instanceof UnregisteredRoot) {
|
|
665
|
+
const message = `no space is registered or prepared here for ${e.root}`;
|
|
666
|
+
hints.push(`${message} - run \`${cmd} up\` there to start one, or select a space with \`${cmd} use <name>\``);
|
|
667
|
+
return { resolved: false, code: "unregistered-root", message };
|
|
668
|
+
}
|
|
669
|
+
if (!isWorkspaceTargetError(e))
|
|
670
|
+
throw e;
|
|
671
|
+
// The canonical renderer names the ACTUAL repair per code (`cotal meshes rm`, `--space
|
|
672
|
+
// <name>`, `cotal up --user-auth`, …). A fixed `up --detach` hint would be right for at most one
|
|
673
|
+
// of the codes and point the others at a command that does not fix them.
|
|
674
|
+
const message = renderWorkspaceError({ kind: "target", error: e }).replace(/^✗ /, "");
|
|
675
|
+
hints.push(message);
|
|
676
|
+
return { resolved: false, code: e.code, message };
|
|
408
677
|
}
|
|
409
678
|
const target = selected.target;
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
679
|
+
const base = {
|
|
680
|
+
resolved: true,
|
|
681
|
+
space: target.space,
|
|
682
|
+
server: displayStatusBroker(target.server, target.space, gaps),
|
|
683
|
+
mode: target.mode,
|
|
684
|
+
source: target.source,
|
|
685
|
+
root: target.root,
|
|
686
|
+
tlsRequired: Boolean(target.tlsRequired),
|
|
687
|
+
eventsRequired: target.policy?.events === "required",
|
|
688
|
+
idp: target.userAuth?.idp.url ?? null,
|
|
689
|
+
personas: personaCatalog(target.root, gaps),
|
|
690
|
+
staleRecord: false,
|
|
691
|
+
login: null,
|
|
692
|
+
deliveryResponder: null,
|
|
693
|
+
channels: null,
|
|
694
|
+
membershipFeed: null,
|
|
695
|
+
};
|
|
422
696
|
if (target.mode === "user") {
|
|
423
697
|
// Status never static-mints on a user-auth mesh (the flip). Everything here is offline
|
|
424
698
|
// introspection — the login cache + the locally-readable ledger — plus, only when this
|
|
@@ -426,93 +700,74 @@ async function printTarget(selected, cmd, responder = "unknown") {
|
|
|
426
700
|
// Same transport discipline as the open/auth path below: a recorded TLS requirement must
|
|
427
701
|
// not collapse to a bare reachability probe (that green-lights a plaintext substitute).
|
|
428
702
|
const live = await isReachable(target.server, target.tlsRequired ? { tls: true } : {});
|
|
429
|
-
row("connection", live ? c.green("reachable") : c.red("unreachable"));
|
|
430
703
|
const stateDir = userAuthStateDir(target.root, target.space);
|
|
431
704
|
let st;
|
|
432
705
|
try {
|
|
433
706
|
st = await resolveAuthProvider().userStatus({ store: workspaceSecretStore(target.root), dir: stateDir, space: target.space, actor: CLI_USER_ACTOR });
|
|
434
707
|
}
|
|
435
708
|
catch (e) {
|
|
436
|
-
|
|
437
|
-
}
|
|
438
|
-
if (st && !st.login)
|
|
439
|
-
row("login", c.yellow(`not signed in - ${cmd} login --idp ${st.idpUrl}`));
|
|
440
|
-
if (st?.login) {
|
|
441
|
-
row("login", c.green(st.login.sub) + c.dim(` · session until ${new Date(st.login.expiresAt * 1000).toISOString()}`));
|
|
442
|
-
if (st.grant === "not-granted")
|
|
443
|
-
row("actor", c.yellow(`"${CLI_USER_ACTOR}" not granted - ${cmd} actor grant ${CLI_USER_ACTOR} --sub ${st.login.sub} --full`));
|
|
444
|
-
else if (st.grant)
|
|
445
|
-
row("actor", c.green(`"${CLI_USER_ACTOR}" granted${st.grant.label ? ` (${st.grant.label})` : ""}`) +
|
|
446
|
-
c.dim(` - read [${st.grant.allowSubscribe.join(", ")}], post [${st.grant.allowPublish.join(", ")}]${st.grant.scope.length ? `, scope [${st.grant.scope.join(", ")}]` : ""}`));
|
|
447
|
-
else
|
|
448
|
-
row("actor", c.dim("grant not checkable on this machine (no local ledger)"));
|
|
709
|
+
gaps.add("LOGIN_UNREADABLE", `the login for ${target.space} could not be read: ${e.message}`, { space: target.space });
|
|
449
710
|
}
|
|
711
|
+
const login = st
|
|
712
|
+
? {
|
|
713
|
+
idp: st.idpUrl,
|
|
714
|
+
subject: st.login?.sub ?? null,
|
|
715
|
+
expiresAt: st.login ? new Date(st.login.expiresAt * 1000).toISOString() : null,
|
|
716
|
+
actor: !st.login ? null : st.grant === "not-granted" ? "not-granted" : st.grant ? "granted" : "not-checkable",
|
|
717
|
+
grant: st.login && st.grant && st.grant !== "not-granted" ? { label: st.grant.label ?? null, read: [...st.grant.allowSubscribe], post: [...st.grant.allowPublish], scope: [...st.grant.scope] } : null,
|
|
718
|
+
}
|
|
719
|
+
: null;
|
|
450
720
|
const granted = Boolean(st?.login && st.grant && st.grant !== "not-granted");
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
}
|
|
457
|
-
return;
|
|
721
|
+
const result = { ...base, connection: live ? "reachable" : "unreachable", login };
|
|
722
|
+
if (!live)
|
|
723
|
+
return { ...result, snapshot: { state: "skipped", reason: "broker unreachable" } };
|
|
724
|
+
if (!granted)
|
|
725
|
+
return { ...result, snapshot: { state: "skipped", reason: "needs a signed-in, granted login" } };
|
|
726
|
+
return { ...result, ...(await readSnapshot(() => userSnapshotEndpoint(target, stateDir), target.space, gaps)) };
|
|
458
727
|
}
|
|
459
728
|
const preflight = await preflightTarget(target);
|
|
460
|
-
if (!preflight.ok)
|
|
461
|
-
|
|
462
|
-
return;
|
|
463
|
-
}
|
|
464
|
-
row("connection", c.green("ok"));
|
|
729
|
+
if (!preflight.ok)
|
|
730
|
+
return { ...base, connection: preflight.kind, staleRecord: preflight.prune, snapshot: { state: "skipped", reason: "broker not connected" } };
|
|
465
731
|
// The mesh-level statement of the same axis (#1576). The folder section says what this machine's
|
|
466
732
|
// delivery PROCESS is doing; this says whether the SPACE currently has a bound responder, which is
|
|
467
733
|
// the question "can I spawn into this mesh right now" actually reduces to. An operator reading a
|
|
468
734
|
// reachable broker and a running daemon had, before this, no row that said otherwise.
|
|
469
|
-
|
|
470
|
-
row("delivery responder", c.red(`NOT BOUND - ${RESPONDER_UNBOUND_CONSEQUENCE}`) + c.dim(` · start it with \`${cmd} up\` (or \`${cmd} deliver --space <space>\`)`));
|
|
471
|
-
else if (responder === "stale")
|
|
472
|
-
// A stale record is NOT BOUND with a different next move: the slot is occupied by a corpse, so
|
|
473
|
-
// starting a daemon now loses the single-flight CAS. Say that, rather than sending the operator
|
|
474
|
-
// into a refusal they will read as a second failure.
|
|
475
|
-
row("delivery responder", c.red(`NOT BOUND - a DEAD daemon's ready record still holds the lease - ${RESPONDER_UNBOUND_CONSEQUENCE}`) + c.dim(" · it expires on its own; a replacement can then take the shard"));
|
|
476
|
-
else if (responder === "bound")
|
|
477
|
-
row("delivery responder", c.green("bound"));
|
|
478
|
-
await liveSnapshot(target).catch((e) => row("live snapshot", c.dim(`unavailable (${e.message})`)));
|
|
735
|
+
return { ...base, connection: "ok", deliveryResponder: responder, ...(await readSnapshot(() => snapshotEndpoint(target), target.space, gaps)) };
|
|
479
736
|
}
|
|
480
|
-
async function
|
|
737
|
+
async function snapshotEndpoint(target) {
|
|
481
738
|
const id = newIdentity();
|
|
482
739
|
const creds = target.auth ? await mintCreds(target.auth, id, "observer") : undefined;
|
|
483
|
-
|
|
484
|
-
const ep = new CotalEndpoint({
|
|
740
|
+
return new CotalEndpoint({
|
|
485
741
|
space: target.space,
|
|
486
742
|
servers: target.server,
|
|
487
|
-
// The recorded requirement, for the same reason as the preflight probe
|
|
488
|
-
//
|
|
489
|
-
//
|
|
490
|
-
//
|
|
743
|
+
// The recorded requirement, for the same reason as the preflight probe: a monitoring command
|
|
744
|
+
// that connects to whatever answers on the address cannot report on the one property this
|
|
745
|
+
// feature provides, and reporting "ok" against a substituted plaintext broker is worse than
|
|
746
|
+
// reporting nothing.
|
|
491
747
|
tls: target.tlsRequired,
|
|
492
748
|
creds,
|
|
493
749
|
channels: [],
|
|
494
750
|
consume: false,
|
|
495
751
|
registerPresence: false,
|
|
496
752
|
// In open mode the endpoint lazily creates KV buckets for watches. Keep status read-only.
|
|
497
|
-
watchPresence:
|
|
498
|
-
watchChannels:
|
|
753
|
+
watchPresence: false,
|
|
754
|
+
watchChannels: Boolean(target.auth),
|
|
499
755
|
card: { id: id.id, name: "status", kind: "endpoint" },
|
|
500
756
|
});
|
|
501
|
-
await renderSnapshot(ep, watchBrokerState);
|
|
502
757
|
}
|
|
503
|
-
/** The user-auth
|
|
504
|
-
*
|
|
505
|
-
async function
|
|
758
|
+
/** The user-auth snapshot endpoint, connected as THIS machine's signed-in, ledger-granted login
|
|
759
|
+
* (bearer + sentinel — the flip forbids a status mint). */
|
|
760
|
+
async function userSnapshotEndpoint(target, stateDir) {
|
|
506
761
|
const { bearer, sentinelCreds } = await resolveAuthProvider().userCredentials({
|
|
507
762
|
store: workspaceSecretStore(target.root),
|
|
508
763
|
dir: stateDir,
|
|
509
764
|
space: target.space,
|
|
510
765
|
actor: CLI_USER_ACTOR,
|
|
511
766
|
});
|
|
512
|
-
|
|
767
|
+
return new CotalEndpoint({
|
|
513
768
|
space: target.space,
|
|
514
769
|
servers: target.server,
|
|
515
|
-
// Same reason as
|
|
770
|
+
// Same reason as the static path: the recorded requirement is the primary fence against a
|
|
516
771
|
// forged INFO, and a monitoring snapshot that auto-upgrades cannot report on it.
|
|
517
772
|
tls: target.tlsRequired,
|
|
518
773
|
bearer,
|
|
@@ -520,190 +775,466 @@ async function userLiveSnapshot(target, stateDir) {
|
|
|
520
775
|
channels: [],
|
|
521
776
|
consume: false,
|
|
522
777
|
registerPresence: false,
|
|
523
|
-
watchPresence:
|
|
778
|
+
watchPresence: false,
|
|
524
779
|
watchChannels: true,
|
|
525
780
|
card: { name: "status", kind: "endpoint" }, // card.id derives from the bearer principal
|
|
526
781
|
});
|
|
527
|
-
await renderSnapshot(ep, true);
|
|
528
782
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
783
|
+
/** The selected space's channels and membership feed, read over one short-lived connection. The
|
|
784
|
+
* roster is not part of status: who is present is a separate read. */
|
|
785
|
+
async function readSnapshot(endpoint, space, gaps) {
|
|
786
|
+
let ep;
|
|
787
|
+
try {
|
|
788
|
+
ep = await endpoint();
|
|
789
|
+
ep.on("error", () => { });
|
|
790
|
+
// This endpoint is a one-shot read. Awaited reads and their per-row unavailable results own the
|
|
791
|
+
// verdict, so a recoverable side channel is deliberately quiet rather than duplicated.
|
|
792
|
+
const ignoreSnapshotWarning = () => { };
|
|
793
|
+
ep.on("warning", ignoreSnapshotWarning);
|
|
794
|
+
await ep.start();
|
|
795
|
+
}
|
|
796
|
+
catch (e) {
|
|
797
|
+
gaps.add("SNAPSHOT_UNAVAILABLE", `the channels of ${space} could not be read: ${e.message}`, { space });
|
|
798
|
+
return { snapshot: { state: "unavailable", reason: e.message }, channels: null, membershipFeed: null };
|
|
799
|
+
}
|
|
536
800
|
try {
|
|
537
|
-
const roster = watchBrokerState ? ep.getRoster() : [];
|
|
538
801
|
const channels = await ep.listChannels();
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
:
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
console.log(c.dim(` +${roster.length - 8} more`));
|
|
550
|
-
row("channels", channels.length ? channels.map((ch) => `${ch.channel}(${ch.messages})`).join(", ") : "none");
|
|
551
|
-
if (membership)
|
|
552
|
-
row("membership feed", membership.asOf ? c.green(`${membership.members.length} entries · ${new Date(membership.asOf).toISOString()}`) : c.dim("no heartbeat"));
|
|
802
|
+
const feed = await ep.readMembership().catch(() => undefined);
|
|
803
|
+
return {
|
|
804
|
+
snapshot: { state: "read", reason: null },
|
|
805
|
+
channels: channels.map((ch) => ({ channel: ch.channel, messages: ch.messages })),
|
|
806
|
+
membershipFeed: feed ? { entries: feed.members.length, asOf: feed.asOf ? new Date(feed.asOf).toISOString() : null } : null,
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
catch (e) {
|
|
810
|
+
gaps.add("SNAPSHOT_UNAVAILABLE", `the channels of ${space} could not be read: ${e.message}`, { space });
|
|
811
|
+
return { snapshot: { state: "unavailable", reason: e.message }, channels: null, membershipFeed: null };
|
|
553
812
|
}
|
|
554
813
|
finally {
|
|
555
|
-
await ep.stop();
|
|
814
|
+
await ep.stop().catch(() => { });
|
|
556
815
|
}
|
|
557
816
|
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
function
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
if (demo)
|
|
567
|
-
parts.push(c.dim(`demo team ${demo}/3`));
|
|
817
|
+
// ---- the report ------------------------------------------------------------------------------
|
|
818
|
+
const cell = (text, tone) => (tone ? { text, tone } : text);
|
|
819
|
+
function personaText(p) {
|
|
820
|
+
if (p.default === "unreadable")
|
|
821
|
+
return `unreadable: ${p.error}`;
|
|
822
|
+
const parts = [p.default === "valid" ? "default" : p.default === "invalid" ? "invalid default" : "no default"];
|
|
823
|
+
if (p.demo)
|
|
824
|
+
parts.push(`demo team ${p.demo}/3`);
|
|
568
825
|
return parts.join(" · ");
|
|
569
826
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
*
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
827
|
+
function personaTone(p) {
|
|
828
|
+
return p.default === "valid" ? "ok" : p.default === "invalid" || p.default === "unreadable" ? "failed" : "hint";
|
|
829
|
+
}
|
|
830
|
+
/** A catalog's summary and root. Green only for a `default` that loads, and never for a catalog
|
|
831
|
+
* `dim` marks as not the one spawn launches from. */
|
|
832
|
+
function personaCell(p, dim = false) {
|
|
833
|
+
const tone = dim ? "hint" : personaTone(p);
|
|
834
|
+
return cell(`${personaText(p)} · ${p.root}`, tone);
|
|
835
|
+
}
|
|
836
|
+
function processCell(p) {
|
|
837
|
+
const detail = p.detail ? ` · ${p.detail}` : "";
|
|
838
|
+
if (p.state === "unreadable")
|
|
839
|
+
return cell(p.detail ?? "pidfile unreadable", "failed");
|
|
840
|
+
if (p.state === "not-serving")
|
|
841
|
+
return cell(`not serving (pid ${p.pid})${detail}`, "failed");
|
|
842
|
+
if (p.state === "running")
|
|
843
|
+
return cell(`running (pid ${p.pid})${detail}`, /NOT BOUND|unreadable/.test(detail) ? "failed" : "ok");
|
|
844
|
+
return cell(p.pid ? `${p.detail ?? "stopped"} (${p.pid})` : (p.detail ?? "down"), "hint");
|
|
845
|
+
}
|
|
846
|
+
function skillsCell(s) {
|
|
847
|
+
const remedy = `${displayCmd()} setup --skills`;
|
|
848
|
+
if (s.state === "unreadable")
|
|
849
|
+
return cell(`bundle error: ${s.error}`, "failed");
|
|
850
|
+
if (s.state === "current")
|
|
851
|
+
return cell(`current (${s.total})`, "ok");
|
|
852
|
+
if (s.state === "not-installed")
|
|
853
|
+
return cell(`not installed · ${remedy}`, "hint");
|
|
854
|
+
return cell(`${s.retired ? `${s.behind} to reconcile (${s.retired} retired)` : `${s.behind}/${s.total} out of date`} · ${remedy}`, "waiting");
|
|
855
|
+
}
|
|
856
|
+
function machineSection(m) {
|
|
857
|
+
const tone = { ok: "ok", warn: "waiting", error: "failed", off: "hint" };
|
|
858
|
+
const rows = [
|
|
859
|
+
["cotal-ai", cell(`v${m.version} (${m.install.kind === "source" ? "source checkout" : m.install.kind}: ${m.install.root})`, "ok")],
|
|
860
|
+
["NATS", m.nats === "missing" ? cell("missing", "failed") : cell(m.nats === "path" ? "nats-server on PATH" : "bundled nats-server", "ok")],
|
|
861
|
+
...m.integrations.map((r) => [r.name, cell(r.text, tone[r.state])]),
|
|
862
|
+
];
|
|
863
|
+
if (m.connectors === null)
|
|
864
|
+
rows.push(["Connectors", cell("unreadable - see the warning below", "failed")]);
|
|
865
|
+
else if (!m.connectors.length)
|
|
866
|
+
rows.push(["Connectors", cell(`none installed · ${displayCmd()} setup`, "hint")]);
|
|
867
|
+
for (const h of m.connectors ?? [])
|
|
868
|
+
rows.push([h.name, h.missing.length ? cell(`${h.missing.join(", ")} not on PATH`, "hint") : cell(h.requires.length ? `${h.requires.join(", ")} on PATH` : "in-process", "ok")]);
|
|
869
|
+
rows.push(["Skills (.agents)", skillsCell(m.skills)]);
|
|
870
|
+
rows.push(["Web extension", m.web.installed === null ? cell(m.web.installedError ?? "unreadable", "failed") : m.web.installed ? cell("installed", "ok") : cell("not installed", "hint")]);
|
|
871
|
+
// An install state that could not be read reads `down`, since only a known absence is `not installed`.
|
|
872
|
+
rows.push(["Web process", m.web.url ? cell(m.web.url, "ok") : m.web.urlError ? cell(m.web.urlError, "failed") : cell(m.web.installed === false ? "not installed" : "down", "hint")]);
|
|
873
|
+
return { title: "Machine", blocks: [{ kind: "fields", rows }] };
|
|
874
|
+
}
|
|
875
|
+
function extensionsSection(e) {
|
|
876
|
+
const rows = [["root", e.root]];
|
|
877
|
+
if (e.items === null)
|
|
878
|
+
rows.push(["installed", cell("manifest unreadable - see the warning below", "failed")]);
|
|
879
|
+
else if (!e.items.length)
|
|
880
|
+
rows.push(["installed", cell("none", "hint")]);
|
|
881
|
+
for (const x of e.items ?? [])
|
|
882
|
+
rows.push([x.label, cell(`v${x.version}${x.package === x.label ? "" : ` · ${x.package}`}`, "ok")]);
|
|
883
|
+
return { title: "Extensions", blocks: [{ kind: "fields", rows }] };
|
|
884
|
+
}
|
|
885
|
+
function folderSection(f, selected) {
|
|
886
|
+
const rows = [["root", f.root]];
|
|
887
|
+
const cwd = canonicalRoot(process.cwd());
|
|
888
|
+
if (cwd !== canonicalRoot(f.root) && (canonicalRoot(f.root) === canonicalRoot(homedir()) || canonicalRoot(join(f.root, ".cotal")) === canonicalRoot(homeCotalDir())))
|
|
889
|
+
rows.push(["root selection", cell("inherited the machine's home .cotal; unqualified up refuses before starting there. Prepare this folder with space create <space> --root . before starting it", "waiting")]);
|
|
890
|
+
const auth = f.auth;
|
|
891
|
+
if (auth.state === "unreadable")
|
|
892
|
+
rows.push(["auth", cell(auth.error ?? "unreadable", "failed")]);
|
|
893
|
+
else if (auth.state === "spaces")
|
|
894
|
+
rows.push(["auth", cell(`${auth.spaces.length} spaces · ${auth.spaces.join(", ")}`, "ok")]);
|
|
895
|
+
else if (auth.state === "space")
|
|
896
|
+
rows.push(["auth", cell(`space ${auth.spaces[0]}${auth.userAuth ? " · user-auth" : ""}`, "ok")]);
|
|
897
|
+
else
|
|
898
|
+
rows.push(["auth", cell("none (open/local only)", "hint")]);
|
|
899
|
+
if (f.launches === null) {
|
|
900
|
+
rows.push(["personas", personaCell(f.personas)]);
|
|
901
|
+
rows.push(["spawn root", cell("unresolved - see Selected Mesh below; until it resolves, no persona here is launchable", "waiting")]);
|
|
596
902
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
//
|
|
601
|
-
|
|
602
|
-
|
|
903
|
+
else if (f.launches)
|
|
904
|
+
rows.push(["personas", personaCell(f.personas)]);
|
|
905
|
+
else {
|
|
906
|
+
// The divergence. The folder's catalog is real and worth reporting, but it is NOT the spawn
|
|
907
|
+
// catalog, so its `default` must not be green: green here is the false capability claim.
|
|
908
|
+
rows.push(["personas", personaCell(f.personas, true)]);
|
|
909
|
+
if (selected.resolved) {
|
|
910
|
+
rows.push(["spawn root", cell(`differs · ${selected.personas.root}`, "waiting")]);
|
|
911
|
+
rows.push(["→ launches", cell(`${personaText(selected.personas)} · space ${selected.space} · via ${selected.source}`, personaTone(selected.personas))]);
|
|
912
|
+
}
|
|
603
913
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
row("hint", `a bare \`${cmd} spawn\` uses the mesh above, NOT this folder - personas in ${folder} will not launch until you run it from that mesh's root or select it (\`${cmd} use <space>\`${values.space ? "" : ", or pass `--space`"})`);
|
|
914
|
+
if (auth.state === "spaces")
|
|
915
|
+
rows.push(["processes", cell("not reported per space on a multi-space root", "hint")]);
|
|
916
|
+
for (const p of f.processes ?? [])
|
|
917
|
+
rows.push([p.name, processCell(p)]);
|
|
918
|
+
if (f.storedState)
|
|
919
|
+
rows.push(["stored state", cell("JetStream store persists across down/up", "hint")]);
|
|
920
|
+
return { title: "This Folder", blocks: [{ kind: "fields", rows }] };
|
|
612
921
|
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
922
|
+
function meshesSections(m) {
|
|
923
|
+
const check = { reachable: cell("reachable", "ok"), unreachable: cell("down", "failed"), "not-checked": cell("not checked", "hint") };
|
|
924
|
+
const blocks = [];
|
|
925
|
+
if (!m.items.length && !m.unreadable.length)
|
|
926
|
+
blocks.push({ kind: "lines", lines: [cell("none", "hint")] });
|
|
927
|
+
else
|
|
928
|
+
blocks.push({
|
|
929
|
+
kind: "table",
|
|
930
|
+
columns: [
|
|
931
|
+
{ key: "space", label: "SPACE" },
|
|
932
|
+
{ key: "check", label: "CHECK" },
|
|
933
|
+
{ key: "mode", label: "MODE" },
|
|
934
|
+
{ key: "server", label: "SERVER" },
|
|
935
|
+
{ key: "root", label: "ROOT" },
|
|
936
|
+
{ key: "note", label: "NOTE" },
|
|
937
|
+
],
|
|
938
|
+
rows: m.items.map((x) => ({
|
|
939
|
+
space: x.current ? cell(`* ${x.space}`, "selected") : ` ${x.space}`,
|
|
940
|
+
check: check[x.check],
|
|
941
|
+
mode: x.mode,
|
|
942
|
+
server: x.server ?? cell("unavailable", "failed"),
|
|
943
|
+
root: x.root,
|
|
944
|
+
// A `down` record means two different things, and the repair differs: a mesh this machine
|
|
945
|
+
// started can be re-`up`ed here, one registered by hand runs somewhere this machine doesn't
|
|
946
|
+
// control (and, unlike the others, its record is never swept away for it).
|
|
947
|
+
note: [
|
|
948
|
+
x.origin === "manual" ? "registered" : x.origin === "catalog" ? "discovered" : "",
|
|
949
|
+
x.tlsRequired ? "tls-required" : "",
|
|
950
|
+
x.eventsRequired ? "events: required" : "",
|
|
951
|
+
x.catalog ? `${x.catalog.name ? `${x.catalog.name} ` : ""}catalog ${x.catalog.error ? `stale since ${x.catalog.fetchedAt ?? "unknown"}: ${x.catalog.error}` : `snapshot ${x.catalog.fetchedAt ?? "unknown"}`}` : "",
|
|
952
|
+
].filter(Boolean).join(" "),
|
|
953
|
+
})),
|
|
954
|
+
});
|
|
955
|
+
if (!m.currentRecorded)
|
|
956
|
+
blocks.push({ kind: "lines", lines: [cell(`note: current mesh "${m.current}" is ${m.currentPrepared ? "prepared, not started" : "not recorded"}`, "hint")] });
|
|
957
|
+
if (m.unreadable.length)
|
|
958
|
+
blocks.push({ kind: "lines", lines: m.unreadable.map((u) => cell(`unreadable: ${u.error}`, "failed")) });
|
|
959
|
+
const sections = [{ title: "Recorded Meshes", blocks }];
|
|
960
|
+
if (m.catalogs.length)
|
|
961
|
+
sections.push({ title: "Space Catalog Accounts", blocks: [{ kind: "lines", lines: m.catalogs.map((r) => `${r.idp} ${r.state}${r.error ? `: ${r.error}` : ""}`) }] });
|
|
962
|
+
return sections;
|
|
963
|
+
}
|
|
964
|
+
function selectedSection(s) {
|
|
965
|
+
if (!s.resolved)
|
|
966
|
+
return { title: "Selected Mesh", blocks: [{ kind: "fields", rows: [["target", cell(s.code, "failed")]] }] };
|
|
967
|
+
const rows = [
|
|
968
|
+
["space", s.space],
|
|
969
|
+
["server", s.server ?? cell("unavailable", "failed")],
|
|
970
|
+
["mode", s.mode],
|
|
971
|
+
];
|
|
972
|
+
if (s.eventsRequired)
|
|
973
|
+
rows.push(["events", "required"]);
|
|
974
|
+
if (s.tlsRequired)
|
|
975
|
+
rows.push(["transport", "tls-required"]);
|
|
976
|
+
if (s.idp)
|
|
977
|
+
rows.push(["idp", s.idp]);
|
|
978
|
+
rows.push(["source", s.source], ["root", s.root], ["personas", personaCell(s.personas)]);
|
|
979
|
+
if (s.mode === "user") {
|
|
980
|
+
rows.push(["connection", s.connection === "reachable" ? cell("reachable", "ok") : cell("unreachable", "failed")]);
|
|
981
|
+
const l = s.login;
|
|
982
|
+
if (!l)
|
|
983
|
+
rows.push(["login", cell("unreadable - see the warning below", "failed")]);
|
|
984
|
+
if (l && !l.subject)
|
|
985
|
+
rows.push(["login", cell(`not signed in - ${displayCmd()} login --idp ${l.idp}`, "waiting")]);
|
|
986
|
+
if (l?.subject) {
|
|
987
|
+
rows.push(["login", cell(`${l.subject} · session until ${l.expiresAt}`, "ok")]);
|
|
988
|
+
if (l.actor === "not-granted")
|
|
989
|
+
rows.push(["actor", cell(`"${CLI_USER_ACTOR}" not granted - ${displayCmd()} actor grant ${CLI_USER_ACTOR} --sub ${l.subject} --full`, "waiting")]);
|
|
990
|
+
else if (l.actor === "granted" && l.grant)
|
|
991
|
+
rows.push([
|
|
992
|
+
"actor",
|
|
993
|
+
cell(`"${CLI_USER_ACTOR}" granted${l.grant.label ? ` (${l.grant.label})` : ""} - read [${l.grant.read.join(", ")}], post [${l.grant.post.join(", ")}]${l.grant.scope.length ? `, scope [${l.grant.scope.join(", ")}]` : ""}`, "ok"),
|
|
994
|
+
]);
|
|
995
|
+
else
|
|
996
|
+
rows.push(["actor", cell("grant not checkable on this machine (no local ledger)", "hint")]);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
else {
|
|
1000
|
+
rows.push(["connection", s.connection === "ok" ? cell("ok", "ok") : cell(`${s.connection}${s.staleRecord ? " (stale registry entry)" : ""}`, "failed")]);
|
|
1001
|
+
if (s.deliveryResponder === "unbound")
|
|
1002
|
+
rows.push(["delivery responder", cell(`NOT BOUND - ${RESPONDER_UNBOUND_CONSEQUENCE} · start it with \`${displayCmd()} up\` (or \`${displayCmd()} deliver --space <space>\`)`, "failed")]);
|
|
1003
|
+
// A stale record is NOT BOUND with a different next move: the slot is occupied by a corpse, so
|
|
1004
|
+
// starting a daemon now loses the single-flight CAS. Say that, rather than sending the operator
|
|
1005
|
+
// into a refusal they will read as a second failure.
|
|
1006
|
+
else if (s.deliveryResponder === "stale")
|
|
1007
|
+
rows.push(["delivery responder", cell(`NOT BOUND - a DEAD daemon's ready record still holds the lease - ${RESPONDER_UNBOUND_CONSEQUENCE} · it expires on its own; a replacement can then take the shard`, "failed")]);
|
|
1008
|
+
else if (s.deliveryResponder === "bound")
|
|
1009
|
+
rows.push(["delivery responder", cell("bound", "ok")]);
|
|
1010
|
+
}
|
|
1011
|
+
if (s.snapshot.state === "unavailable" || (s.mode === "user" && s.snapshot.state === "skipped"))
|
|
1012
|
+
rows.push(["live snapshot", cell(`${s.snapshot.state === "unavailable" ? "unavailable" : "not read"} (${s.snapshot.reason})`, s.snapshot.state === "unavailable" ? "failed" : "hint")]);
|
|
1013
|
+
if (s.channels)
|
|
1014
|
+
rows.push(["channels", s.channels.length ? s.channels.map((ch) => `${ch.channel}(${ch.messages})`).join(", ") : "none"]);
|
|
1015
|
+
if (s.membershipFeed)
|
|
1016
|
+
rows.push(["membership feed", s.membershipFeed.asOf ? cell(`${s.membershipFeed.entries} entries · updated ${formatAge(Math.max(0, Date.now() - Date.parse(s.membershipFeed.asOf)))} ago`, "ok") : cell("no heartbeat", "hint")]);
|
|
1017
|
+
return { title: "Selected Mesh", blocks: [{ kind: "fields", rows }] };
|
|
619
1018
|
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
* stripping leaves the inner green intact (the reset ends it early) and the row still reads
|
|
623
|
-
* "launchable". */
|
|
624
|
-
function stripColor(s) {
|
|
625
|
-
return s.replace(/\x1b\[[0-9;]*m/g, "");
|
|
1019
|
+
function stateCell(text, tone) {
|
|
1020
|
+
return { text, tone, mark: tone === "hint" ? "○" : "●" };
|
|
626
1021
|
}
|
|
627
|
-
function
|
|
628
|
-
|
|
1022
|
+
function machineOverview(r) {
|
|
1023
|
+
const m = r.machine;
|
|
1024
|
+
const tones = { ok: "ok", warn: "waiting", error: "failed", off: "hint" };
|
|
1025
|
+
const rows = m.integrations.map((item) => [item.name, stateCell(item.text, tones[item.state])]);
|
|
1026
|
+
if (m.connectors === null)
|
|
1027
|
+
rows.push(["Agent applications", stateCell("could not be read", "failed")]);
|
|
1028
|
+
else if (!m.connectors.length)
|
|
1029
|
+
rows.push(["Agent applications", stateCell("not set up", "hint")]);
|
|
1030
|
+
for (const connector of m.connectors ?? []) {
|
|
1031
|
+
if (m.integrations.some((item) => item.name.toLowerCase().includes(connector.name.toLowerCase())))
|
|
1032
|
+
continue;
|
|
1033
|
+
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")]);
|
|
1034
|
+
}
|
|
1035
|
+
rows.push(["Broker executable", stateCell(m.nats === "missing" ? "not installed" : m.nats === "path" ? "available on PATH" : "bundled", m.nats === "missing" ? "waiting" : "ok")]);
|
|
1036
|
+
rows.push(["Agent skills", skillsCell(m.skills)]);
|
|
1037
|
+
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")]);
|
|
1038
|
+
if (r.extensions.items === null)
|
|
1039
|
+
rows.push(["Extensions", stateCell("manifest could not be read", "failed")]);
|
|
1040
|
+
else if (r.extensions.items.length)
|
|
1041
|
+
rows.push(["Extensions", r.extensions.items.map((item) => `${item.label} v${item.version}`).join(" · ")]);
|
|
1042
|
+
return {
|
|
1043
|
+
title: "This machine",
|
|
1044
|
+
blocks: [
|
|
1045
|
+
{ kind: "lines", lines: [`cotal ${m.version} · Node ${m.node} · ${m.platform}`] },
|
|
1046
|
+
{ kind: "fields", rows },
|
|
1047
|
+
],
|
|
1048
|
+
};
|
|
629
1049
|
}
|
|
630
|
-
function
|
|
631
|
-
if (
|
|
632
|
-
return
|
|
633
|
-
|
|
1050
|
+
function connectionCell(s) {
|
|
1051
|
+
if (s.connection === "ok" || s.connection === "reachable")
|
|
1052
|
+
return stateCell("reachable", "ok");
|
|
1053
|
+
const states = {
|
|
1054
|
+
unreachable: "unreachable",
|
|
1055
|
+
"slow-link": "connection timed out",
|
|
1056
|
+
"tls-trust": "TLS could not be verified",
|
|
1057
|
+
"stale-auth": "credentials need renewal",
|
|
1058
|
+
"auth-required": "authentication required",
|
|
1059
|
+
"open-wants-auth": "authentication required",
|
|
1060
|
+
"registry-open-now-auth": "authentication required",
|
|
1061
|
+
"creds-rejected": "credentials rejected",
|
|
1062
|
+
"registry-creds-rejected": "credentials rejected",
|
|
1063
|
+
};
|
|
1064
|
+
return stateCell(`${states[s.connection] ?? s.connection.replaceAll("-", " ")}${s.staleRecord ? " · saved registration needs attention" : ""}`, "failed");
|
|
634
1065
|
}
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
* ` · service endpoint not answering`, plus the marker error when the marker could not be read.
|
|
646
|
-
* - any other failure (a refused probe, an `unavailable` user-mode credential): `running (pid N)`
|
|
647
|
-
* as today with a dim ` · service unchecked`, so a failed probe never reads as a dead rail.
|
|
648
|
-
*
|
|
649
|
-
* Bare status keeps exit 0 in every case; this only changes what the row says. A dead/stopped pid
|
|
650
|
-
* never reaches the probe at all (the early return below), so a stopped manager still reads as the
|
|
651
|
-
* dim stopped row, not `not serving` — a dead pid is not a live pid that will not answer. */
|
|
652
|
-
async function managerRowState(target, state, space) {
|
|
653
|
-
if (state.liveness !== "alive")
|
|
654
|
-
return formatProc(state);
|
|
655
|
-
let deliveryAware = false;
|
|
656
|
-
let markerUnreadable = "";
|
|
657
|
-
try {
|
|
658
|
-
deliveryAware = managerHasDeliveryMarker(state.pid, space);
|
|
1066
|
+
function brokerOverview(r) {
|
|
1067
|
+
const blocks = [];
|
|
1068
|
+
const groups = new Map();
|
|
1069
|
+
for (const entry of r.meshes.items) {
|
|
1070
|
+
const key = entry.server ?? `unavailable:${entry.space}`;
|
|
1071
|
+
const group = groups.get(key);
|
|
1072
|
+
if (group)
|
|
1073
|
+
group.push(entry);
|
|
1074
|
+
else
|
|
1075
|
+
groups.set(key, [entry]);
|
|
659
1076
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
1077
|
+
if (!groups.size && !r.meshes.unreadable.length)
|
|
1078
|
+
blocks.push({ kind: "lines", lines: [cell("No spaces registered", "hint")] });
|
|
1079
|
+
for (const entries of groups.values()) {
|
|
1080
|
+
blocks.push({ kind: "lines", lines: [cell(entries[0].server ?? "Broker address unavailable", "title")] });
|
|
1081
|
+
blocks.push({
|
|
1082
|
+
kind: "table",
|
|
1083
|
+
header: false,
|
|
1084
|
+
columns: [{ key: "space", label: "Space" }, { key: "state", label: "Connection" }, { key: "detail", label: "Details" }],
|
|
1085
|
+
rows: entries.map((entry) => {
|
|
1086
|
+
const selected = r.selected.resolved && entry.space === r.selected.space;
|
|
1087
|
+
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(" · ");
|
|
1088
|
+
return {
|
|
1089
|
+
space: selected ? cell(`→ ${entry.space}`, "selected") : entry.space,
|
|
1090
|
+
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"),
|
|
1091
|
+
detail: cell(detail, "hint"),
|
|
1092
|
+
};
|
|
1093
|
+
}),
|
|
1094
|
+
});
|
|
664
1095
|
}
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
1096
|
+
for (const unreadable of r.meshes.unreadable)
|
|
1097
|
+
blocks.push({ kind: "lines", lines: [stateCell(`Registration could not be read: ${unreadable.error}`, "failed")] });
|
|
1098
|
+
for (const account of r.meshes.catalogs)
|
|
1099
|
+
if (account.error)
|
|
1100
|
+
blocks.push({ kind: "lines", lines: [stateCell(`Space catalog for ${account.idp}: ${account.error}`, "failed")] });
|
|
1101
|
+
if (!r.meshes.currentRecorded)
|
|
1102
|
+
blocks.push({ kind: "lines", lines: [cell(`Selected space '${r.meshes.current}' is ${r.meshes.currentPrepared ? "prepared, not started" : "not recorded"}`, "waiting")] });
|
|
1103
|
+
return { title: "Brokers", blocks };
|
|
1104
|
+
}
|
|
1105
|
+
function selectedOverview(r) {
|
|
1106
|
+
const s = r.selected;
|
|
1107
|
+
if (!s.resolved)
|
|
1108
|
+
return { title: "Selected space", blocks: [{ kind: "lines", lines: [stateCell(s.message, "failed")] }] };
|
|
1109
|
+
if (!r.meshes.items.length && !r.meshes.currentPrepared && r.folder.auth.state === "none" && !r.folder.processes?.some((item) => item.pid !== null))
|
|
1110
|
+
return undefined;
|
|
1111
|
+
const rows = [
|
|
1112
|
+
["Broker", s.server ?? stateCell("address unavailable", "failed")],
|
|
1113
|
+
["Connection", connectionCell(s)],
|
|
1114
|
+
["Access", s.mode === "user" ? "user sign-in" : s.mode === "auth" ? "static auth" : "open"],
|
|
1115
|
+
["Project", s.root],
|
|
1116
|
+
["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")],
|
|
1117
|
+
["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")],
|
|
1118
|
+
];
|
|
1119
|
+
if (s.tlsRequired)
|
|
1120
|
+
rows.push(["Transport", "TLS required"]);
|
|
1121
|
+
if (s.eventsRequired)
|
|
1122
|
+
rows.push(["Events", "required"]);
|
|
1123
|
+
if (s.mode === "user") {
|
|
1124
|
+
if (!s.login)
|
|
1125
|
+
rows.push(["Account", stateCell("could not be read", "failed")]);
|
|
1126
|
+
else if (!s.login.subject)
|
|
1127
|
+
rows.push(["Account", stateCell("not signed in", "waiting")]);
|
|
676
1128
|
else {
|
|
677
|
-
|
|
1129
|
+
rows.push(["Account", `${s.login.subject} · session until ${s.login.expiresAt}`]);
|
|
1130
|
+
rows.push(["Grant", stateCell(s.login.actor === "granted" ? "granted" : s.login.actor === "not-granted" ? "not granted" : "not checkable on this machine", s.login.actor === "granted" ? "ok" : s.login.actor === "not-granted" ? "waiting" : "hint")]);
|
|
678
1131
|
}
|
|
679
|
-
await managerServiceHealth(target, auth);
|
|
680
|
-
return unprobed;
|
|
681
1132
|
}
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
1133
|
+
if (s.snapshot.state === "unavailable")
|
|
1134
|
+
rows.push(["Live details", stateCell(`unavailable · ${s.snapshot.reason}`, "waiting")]);
|
|
1135
|
+
const blocks = [{ kind: "fields", rows }];
|
|
1136
|
+
if (r.folder.root === s.root && r.folder.processSpace === s.space && r.folder.processes) {
|
|
1137
|
+
blocks.push({ kind: "lines", lines: [cell("Legacy local process records", "label")] });
|
|
1138
|
+
blocks.push({
|
|
1139
|
+
kind: "table", header: false,
|
|
1140
|
+
columns: [{ key: "name", label: "Service" }, { key: "state", label: "State" }],
|
|
1141
|
+
rows: r.folder.processes.map((item) => ({
|
|
1142
|
+
name: item.name === "nats" ? "Broker" : item.name === "manager" ? "Manager" : item.name === "delivery" ? "Delivery" : item.name === "web" ? "Web" : item.name,
|
|
1143
|
+
state: item.state === "running" || item.state === "not-serving" || item.state === "unreadable" ? processCell(item) : stateCell(item.pid === null ? "not started" : item.detail ?? "stopped", "hint"),
|
|
1144
|
+
})),
|
|
1145
|
+
});
|
|
687
1146
|
}
|
|
1147
|
+
else
|
|
1148
|
+
blocks.push({ kind: "lines", lines: [cell("Legacy process records not checked here · the selected space has a different or unresolved local process scope", "hint")] });
|
|
1149
|
+
if (r.folder.launches === false)
|
|
1150
|
+
blocks.push({ kind: "lines", lines: [cell(`This folder's personas are not used by the selected space. Spawn uses ${s.personas.root}.`, "waiting")] });
|
|
1151
|
+
return { title: `Selected space → ${s.space}`, blocks };
|
|
688
1152
|
}
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
1153
|
+
function nextActions(r) {
|
|
1154
|
+
const cmd = displayCmd();
|
|
1155
|
+
const items = [];
|
|
1156
|
+
if (!r.machine.connectors?.length)
|
|
1157
|
+
items.push({ command: `${cmd} setup`, description: "Set up an agent application and a space" });
|
|
1158
|
+
else {
|
|
1159
|
+
if (r.selected.resolved) {
|
|
1160
|
+
const s = r.selected;
|
|
1161
|
+
// Name what fixes the default persona alone; setup does far more than that.
|
|
1162
|
+
if (s.personas.default === "missing") {
|
|
1163
|
+
const fix = defaultPersonaFix({ space: s.space, root: s.root, origin: r.meshes.items.find((m) => m.space === s.space)?.origin }, cmd);
|
|
1164
|
+
items.push({ command: fix.command, description: fix.cwd ? `Write the default persona; run it in ${fix.cwd}` : "Create the default persona" });
|
|
1165
|
+
}
|
|
1166
|
+
else if (s.personas.default !== "valid")
|
|
1167
|
+
items.push({ command: `${cmd} persona show default --space ${s.space}`, description: "See what is wrong with the default persona" });
|
|
1168
|
+
else
|
|
1169
|
+
items.push({ command: `${cmd} spawn`, description: "Open your default agent" });
|
|
1170
|
+
items.push({ command: `${cmd} ps`, description: "See the agent roster" });
|
|
1171
|
+
}
|
|
1172
|
+
items.push({ command: `${cmd} use`, description: "Choose another space" });
|
|
1173
|
+
if (r.meshes.items.length > 1)
|
|
1174
|
+
items.push({ command: `${cmd} status --all`, description: "Check every registered space" });
|
|
1175
|
+
}
|
|
1176
|
+
if (r.selected.resolved && r.selected.mode === "user" && r.selected.login && !r.selected.login.subject)
|
|
1177
|
+
items.unshift({ command: `${cmd} login --idp ${r.selected.login.idp}`, description: "Sign in to the selected space" });
|
|
1178
|
+
return { title: "Next", blocks: [{ kind: "commands", items }, ...r.hints.map((hint) => ({ kind: "lines", lines: [cell(hint, "hint")] }))] };
|
|
1179
|
+
}
|
|
1180
|
+
function ownedServicesOverview(services) {
|
|
1181
|
+
if (!services || services.state === "not-checked")
|
|
1182
|
+
return undefined;
|
|
1183
|
+
const blocks = [];
|
|
1184
|
+
if (services.definitions === null)
|
|
1185
|
+
blocks.push({ kind: "lines", lines: [stateCell("Saved service definitions unavailable", "waiting")] });
|
|
1186
|
+
if (services.instances === null)
|
|
1187
|
+
blocks.push({ kind: "lines", lines: [stateCell("Owned service instances unavailable; no stopped state inferred", "waiting")] });
|
|
1188
|
+
if (services.instances?.length)
|
|
1189
|
+
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) => ({
|
|
1190
|
+
service: row.definition, instance: row.instanceId, host: row.executionHost,
|
|
1191
|
+
process: stateCell(row.observedProcess.replaceAll("-", " "), row.observedProcess === "running" ? "ok" : row.observedProcess === "unreadable" || row.observedProcess === "unresolved-launch" || row.observedProcess === "foreign-host" ? "waiting" : "hint"),
|
|
1192
|
+
readiness: cell(`${row.readinessObservation.replaceAll("-", " ")} · ${row.readinessAsOf}`, "hint"),
|
|
1193
|
+
supervisor: row.supervisorRecord.mechanism === "none-recorded" ? "not assigned here" : `${row.supervisorRecord.mechanism} · ${row.supervisorRecord.fileObservation}; OS state not checked`,
|
|
1194
|
+
})) });
|
|
1195
|
+
if (services.instances && services.instances.length > 100)
|
|
1196
|
+
blocks.push({ kind: "lines", lines: [cell(`${services.instances.length - 100} instance rows omitted; --json retains the complete readable inventory.`, "hint")] });
|
|
1197
|
+
const instantiated = new Set(services.instances?.map((row) => row.definition));
|
|
1198
|
+
const saved = services.instances === null ? [] : services.definitions?.filter((row) => !instantiated.has(row.name)) ?? [];
|
|
1199
|
+
if (saved.length)
|
|
1200
|
+
blocks.push({ kind: "table", columns: [{ key: "service", label: "Saved service" }, { key: "type", label: "Launch type" }, { key: "observation", label: "Instance records" }], rows: saved.slice(0, 100).map((row) => ({ service: row.name, type: row.launch.type === "adapter" ? row.launch.adapter : "process", observation: "no owned instance recorded" })) });
|
|
1201
|
+
if (saved.length > 100)
|
|
1202
|
+
blocks.push({ kind: "lines", lines: [cell(`${saved.length - 100} saved definitions omitted; --json retains the complete readable inventory.`, "hint")] });
|
|
1203
|
+
if (services.definitions?.length === 0 && services.instances?.length === 0)
|
|
1204
|
+
blocks.push({ kind: "lines", lines: [cell("No saved definitions or owned instance records in this selected space.", "hint")] });
|
|
1205
|
+
blocks.push({ kind: "lines", lines: [cell(`Local records and process observations as of ${services.observedAt}; non-atomic. Recorded readiness is historical, not a fresh endpoint response. No OS unit query, service control, adoption or remote process ownership is implied.`, "hint")] });
|
|
1206
|
+
// The space is known here, and a sole instance names its service and full ID as well.
|
|
1207
|
+
const sole = services.instances?.length === 1 ? services.instances[0] : undefined;
|
|
1208
|
+
const inspect = sole ? `${displayCmd()} svc status ${sole.definition} --instance ${sole.instanceId} --space ${services.space}` : `${displayCmd()} svc status <service> --instance <full-id> --space ${services.space}`;
|
|
1209
|
+
if (services.instances?.length || services.definitions?.length)
|
|
1210
|
+
blocks.push({ kind: "commands", items: [{ command: inspect, description: "Inspect one exact owned instance and its recorded supervisor" }, { command: `${displayCmd()} svc`, description: "Read the full saved-service inventory" }] });
|
|
1211
|
+
return { title: `Owned services → ${services.space}`, blocks };
|
|
1212
|
+
}
|
|
1213
|
+
function bootAttemptOverview(snapshot) {
|
|
1214
|
+
if (!snapshot || !snapshot.unsettled.length && !snapshot.additive.length && !snapshot.unreadable.length)
|
|
1215
|
+
return undefined;
|
|
1216
|
+
return { title: "Deployment attempts", blocks: [
|
|
1217
|
+
{ kind: "fields", rows: [["Folder root", snapshot.root], ["Local read", snapshot.state], ["Unsettled fresh", String(snapshot.unsettled.length)], ["Additive attempts", String(snapshot.additive.length)], ["Unreadable records", String(snapshot.unreadable.length)]] },
|
|
1218
|
+
snapshot.unsettled.length ? { kind: "table", columns: [{ key: "id", label: "Fresh boot" }, { key: "space", label: "Space" }, { key: "broker", label: "Recorded broker" }], rows: snapshot.unsettled.slice(0, 100).map((row) => ({ id: row.deploymentId, space: row.space, broker: row.server })) } : { kind: "lines", lines: ["No readable unsettled fresh attempt in this folder."] },
|
|
1219
|
+
snapshot.additive.length ? { kind: "table", columns: [{ key: "id", label: "Additive intent" }, { key: "space", label: "Space" }, { key: "state", label: "Recorded state" }], rows: snapshot.additive.slice(0, 100).map((row) => ({ id: row.deploymentId, space: row.space, state: row.recordedState })) } : { kind: "lines", lines: ["No readable additive attempt in this folder."] },
|
|
1220
|
+
{ kind: "lines", lines: [...snapshot.unreadable.slice(0, 100).map((path) => `Unreadable record: ${path}`), ...(snapshot.unsettled.length > 100 || snapshot.additive.length > 100 || snapshot.unreadable.length > 100 ? ["Additional records are in JSON."] : []), "A fresh intent may have started a broker; an additive intent may have changed its resources. No retry or stop authority follows from this read."] },
|
|
1221
|
+
{ kind: "commands", items: [{ command: `${displayCmd()} team show <deployment-id>`, description: "Inspect the original attempt from its recorded root" }] },
|
|
1222
|
+
] };
|
|
1223
|
+
}
|
|
1224
|
+
/** The approved screen hierarchy; record-level diagnostics are opt-in. */
|
|
1225
|
+
export function statusView(r, verbose = false) {
|
|
1226
|
+
const selected = selectedOverview(r);
|
|
1227
|
+
const owned = ownedServicesOverview(r.services);
|
|
1228
|
+
const attempts = bootAttemptOverview(r.bootAttempts);
|
|
1229
|
+
const sections = [machineOverview(r), brokerOverview(r), ...(selected ? [selected] : []), ...(attempts ? [attempts] : []), ...(owned ? [owned] : [])];
|
|
1230
|
+
if (verbose)
|
|
1231
|
+
sections.push(machineSection(r.machine), extensionsSection(r.extensions), folderSection(r.folder, r.selected), ...meshesSections(r.meshes), selectedSection(r.selected));
|
|
1232
|
+
sections.push(nextActions(r));
|
|
1233
|
+
return { sections };
|
|
700
1234
|
}
|
|
701
1235
|
function section(name) {
|
|
702
1236
|
console.log(`\n${c.bold(name)}`);
|
|
703
1237
|
}
|
|
704
|
-
function row(name, value) {
|
|
705
|
-
console.log(` ${name.padEnd(16)} ${value}`);
|
|
706
|
-
}
|
|
707
1238
|
const COMPONENT_EXIT = {
|
|
708
1239
|
serving: 0,
|
|
709
1240
|
absent: 1,
|
|
@@ -839,6 +1370,39 @@ async function staticServiceAuth(auth) {
|
|
|
839
1370
|
caller: { owner: "local", actor: serviceIdentity.id, uid: serviceUid },
|
|
840
1371
|
};
|
|
841
1372
|
}
|
|
1373
|
+
/** Display only. A status observation never authorizes process control or proves cleanup. */
|
|
1374
|
+
function managerStopImpactFacts(input) {
|
|
1375
|
+
if (!input || typeof input !== "object" || Array.isArray(input))
|
|
1376
|
+
return ["stop impact not reported by this manager build"];
|
|
1377
|
+
const impact = input;
|
|
1378
|
+
if (!["manager", "owner-filtered"].includes(String(impact.agentScope)) || typeof impact.observedAt !== "string" || impact.observedAt.length > 100 || !Number.isFinite(Date.parse(impact.observedAt)) || !Array.isArray(impact.agents))
|
|
1379
|
+
return ["stop impact could not be interpreted; no safe stop inferred"];
|
|
1380
|
+
const facts = [`stop impact ${impact.agentScope === "manager" ? "manager-owned rows" : "owner-filtered; full scope unknown"} as of ${new Date(impact.observedAt).toISOString()}`];
|
|
1381
|
+
const actions = { stop: 0, release: 0, retained: 0, unknown: 0 };
|
|
1382
|
+
for (const row of impact.agents) {
|
|
1383
|
+
const action = row && typeof row === "object" && !Array.isArray(row) ? row.defaultAction : undefined;
|
|
1384
|
+
if (action === "stop")
|
|
1385
|
+
actions.stop++;
|
|
1386
|
+
else if (action === "release-custody")
|
|
1387
|
+
actions.release++;
|
|
1388
|
+
else if (action === "stop-retaining-state")
|
|
1389
|
+
actions.retained++;
|
|
1390
|
+
else
|
|
1391
|
+
actions.unknown++;
|
|
1392
|
+
}
|
|
1393
|
+
facts.push(`default stop policy: stop ${actions.stop}, release custody ${actions.release}, stop retaining state ${actions.retained}, unknown ${actions.unknown} visible seats`);
|
|
1394
|
+
for (const [key, label] of [["lifecycleInFlight", "lifecycle work"], ["reservedLaunches", "reserved launches"], ["retirementsPending", "pending retirements"], ["deprovisioningInFlight", "cleanup in flight"], ["staticReconciliationInFlight", "reconciliation in flight"]]) {
|
|
1395
|
+
const count = impact[key];
|
|
1396
|
+
if (!Number.isSafeInteger(count) || Number(count) < 0)
|
|
1397
|
+
facts.push(`${label} unknown`);
|
|
1398
|
+
else if (Number(count) > 0)
|
|
1399
|
+
facts.push(`${label} ${count}`);
|
|
1400
|
+
}
|
|
1401
|
+
if (impact.stopping === true)
|
|
1402
|
+
facts.push("native manager stop already in progress");
|
|
1403
|
+
facts.push("stop not reserved; seat exit and cleanup not checked");
|
|
1404
|
+
return facts;
|
|
1405
|
+
}
|
|
842
1406
|
/** A service registration is the health target itself. Calling its `status` command through a
|
|
843
1407
|
* generic endpoint does not work on this base because a passive status endpoint has no v0.4 caller
|
|
844
1408
|
* rail; a one-shot standalone caller does. */
|
|
@@ -919,6 +1483,7 @@ async function managerHealth(target, context, credential) {
|
|
|
919
1483
|
const served = await managerServiceHealth(target, serviceAuth);
|
|
920
1484
|
facts.push(`service instance ${served.instanceId ?? "unreported"}`);
|
|
921
1485
|
facts.push(`runtime ${served.runtime ?? "unreported"}`);
|
|
1486
|
+
facts.push(...managerStopImpactFacts(served.stopImpact));
|
|
922
1487
|
const reconcile = served.staticReconciliation;
|
|
923
1488
|
if (!reconcile) {
|
|
924
1489
|
facts.push("static reconciliation not reported by this manager build");
|
|
@@ -1061,12 +1626,21 @@ async function webHealth(context) {
|
|
|
1061
1626
|
if (record.kind !== "live")
|
|
1062
1627
|
throw new Error("web component record lost its live pid after classification");
|
|
1063
1628
|
const pid = record.pid;
|
|
1629
|
+
let source;
|
|
1630
|
+
try {
|
|
1631
|
+
source = webSessionSource(context, pid);
|
|
1632
|
+
}
|
|
1633
|
+
catch (e) {
|
|
1634
|
+
return { name: "web", verdict: "refused", facts: [...facts, `service instance records unreadable: ${e.message}`] };
|
|
1635
|
+
}
|
|
1636
|
+
if (source.instance !== undefined)
|
|
1637
|
+
facts.push(`service instance ${source.instance}`);
|
|
1064
1638
|
let bound;
|
|
1065
1639
|
try {
|
|
1066
|
-
bound = webBoundAddress(
|
|
1640
|
+
bound = webBoundAddress(source.path);
|
|
1067
1641
|
}
|
|
1068
1642
|
catch (e) {
|
|
1069
|
-
return { name: "web", verdict: "refused", facts: [...facts, `${
|
|
1643
|
+
return { name: "web", verdict: "refused", facts: [...facts, `${source.label} unreadable: ${e.message}`] };
|
|
1070
1644
|
}
|
|
1071
1645
|
if (!bound)
|
|
1072
1646
|
return { name: "web", verdict: "refused", facts: [...facts, "probe refused (no bound address recorded)"] };
|
|
@@ -1085,14 +1659,17 @@ async function webHealth(context) {
|
|
|
1085
1659
|
return { name: "web", verdict: "not-serving", facts: [...facts, `host ${bound.host}`, `port ${bound.port}`, "http not answered"] };
|
|
1086
1660
|
}
|
|
1087
1661
|
async function brokerHealth(target) {
|
|
1662
|
+
const address = brokerAddressForDisplay(target.server);
|
|
1663
|
+
if (address === undefined)
|
|
1664
|
+
return { name: "broker", verdict: "refused", facts: ["registered address unavailable", "invalid broker address"] };
|
|
1088
1665
|
try {
|
|
1089
1666
|
const reachable = await isReachable(target.server, target.tlsRequired ? { tls: true } : {});
|
|
1090
1667
|
return reachable
|
|
1091
|
-
? { name: "broker", verdict: "serving", facts: [`registered ${
|
|
1092
|
-
: { name: "broker", verdict: "not-serving", facts: [`registered ${
|
|
1668
|
+
? { name: "broker", verdict: "serving", facts: [`registered ${address}`, "reachable"] }
|
|
1669
|
+
: { name: "broker", verdict: "not-serving", facts: [`registered ${address}`, "unreachable"] };
|
|
1093
1670
|
}
|
|
1094
1671
|
catch (e) {
|
|
1095
|
-
return { name: "broker", verdict: "refused", facts: [`registered ${
|
|
1672
|
+
return { name: "broker", verdict: "refused", facts: [`registered ${address}`, `probe refused: ${e.message}`] };
|
|
1096
1673
|
}
|
|
1097
1674
|
}
|
|
1098
1675
|
async function printComponentHealth(cwd, values) {
|
|
@@ -1109,6 +1686,12 @@ async function printComponentHealth(cwd, values) {
|
|
|
1109
1686
|
}
|
|
1110
1687
|
throw e;
|
|
1111
1688
|
}
|
|
1689
|
+
// The report's own rule: an unregistered project root is given no broker to probe.
|
|
1690
|
+
if (target.source === "local-space") {
|
|
1691
|
+
printComponent({ name: "target", verdict: "refused", facts: ["unregistered-root", `no space is registered or prepared here for ${target.root}`] });
|
|
1692
|
+
process.exitCode = COMPONENT_EXIT.refused;
|
|
1693
|
+
return;
|
|
1694
|
+
}
|
|
1112
1695
|
const context = { root: target.root, space: target.space, userAuth: target.mode === "user" };
|
|
1113
1696
|
// ONE credential read for the whole pass (user mode resolves the signed-in login once; the
|
|
1114
1697
|
// static shape is just the target's own auth material), shared by the manager and delivery
|