@cotal-ai/cli 0.100.1 → 0.101.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/chat-view.d.ts.map +1 -1
- package/dist/chat/chat-view.js +5 -1
- package/dist/chat/chat-view.js.map +1 -1
- package/dist/chat/engine.d.ts +2 -1
- package/dist/chat/engine.d.ts.map +1 -1
- package/dist/chat/engine.js +2 -1
- package/dist/chat/engine.js.map +1 -1
- package/dist/chat/frontend.d.ts.map +1 -1
- package/dist/chat/frontend.js +13 -7
- package/dist/chat/frontend.js.map +1 -1
- package/dist/chat/native-session.d.ts +22 -3
- package/dist/chat/native-session.d.ts.map +1 -1
- package/dist/chat/native-session.js +91 -19
- package/dist/chat/native-session.js.map +1 -1
- package/dist/chat/open-session.d.ts +1 -0
- package/dist/chat/open-session.d.ts.map +1 -1
- package/dist/chat/open-session.js +1 -1
- package/dist/chat/open-session.js.map +1 -1
- package/dist/chat/picker.d.ts +5 -0
- package/dist/chat/picker.d.ts.map +1 -1
- package/dist/chat/picker.js +23 -10
- package/dist/chat/picker.js.map +1 -1
- package/dist/chat/plain.d.ts.map +1 -1
- package/dist/chat/plain.js +36 -10
- package/dist/chat/plain.js.map +1 -1
- package/dist/chat/session.d.ts +5 -0
- package/dist/chat/session.d.ts.map +1 -1
- package/dist/chat/static-session.d.ts +1 -0
- package/dist/chat/static-session.d.ts.map +1 -1
- package/dist/chat/static-session.js +24 -8
- package/dist/chat/static-session.js.map +1 -1
- package/dist/chat/stdio-io.d.ts +2 -0
- package/dist/chat/stdio-io.d.ts.map +1 -1
- package/dist/chat/stdio-io.js +6 -6
- package/dist/chat/stdio-io.js.map +1 -1
- package/dist/chat/stdio.d.ts +3 -2
- package/dist/chat/stdio.d.ts.map +1 -1
- package/dist/chat/stdio.js +26 -25
- package/dist/chat/stdio.js.map +1 -1
- package/dist/chat/user-session.d.ts +1 -0
- package/dist/chat/user-session.d.ts.map +1 -1
- package/dist/chat/user-session.js +1 -1
- package/dist/chat/user-session.js.map +1 -1
- package/dist/chat/view.d.ts +5 -4
- package/dist/chat/view.d.ts.map +1 -1
- package/dist/chat/view.js +10 -8
- package/dist/chat/view.js.map +1 -1
- package/dist/command.d.ts +5 -0
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +295 -82
- package/dist/command.js.map +1 -1
- package/dist/commands/agents.d.ts +29 -5
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +100 -35
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/backup-maintenance.d.ts.map +1 -1
- package/dist/commands/backup-maintenance.js +54 -21
- package/dist/commands/backup-maintenance.js.map +1 -1
- package/dist/commands/backup-read.d.ts.map +1 -1
- package/dist/commands/backup-read.js +13 -16
- package/dist/commands/backup-read.js.map +1 -1
- package/dist/commands/backup-restore.d.ts.map +1 -1
- package/dist/commands/backup-restore.js +20 -4
- package/dist/commands/backup-restore.js.map +1 -1
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +157 -29
- package/dist/commands/backup.js.map +1 -1
- package/dist/commands/channel-members.d.ts +1 -1
- package/dist/commands/channel-members.d.ts.map +1 -1
- package/dist/commands/channel-members.js +115 -29
- package/dist/commands/channel-members.js.map +1 -1
- package/dist/commands/channels.d.ts +11 -1
- package/dist/commands/channels.d.ts.map +1 -1
- package/dist/commands/channels.js +109 -20
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/chat.d.ts +11 -3
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +50 -22
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/clean.d.ts +10 -5
- package/dist/commands/clean.d.ts.map +1 -1
- package/dist/commands/clean.js +245 -42
- package/dist/commands/clean.js.map +1 -1
- package/dist/commands/completion.d.ts +15 -2
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +91 -26
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/config.d.ts +24 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +91 -15
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/console.d.ts.map +1 -1
- package/dist/commands/console.js +5 -4
- package/dist/commands/console.js.map +1 -1
- package/dist/commands/describe.d.ts +4 -2
- package/dist/commands/describe.d.ts.map +1 -1
- package/dist/commands/describe.js +4 -4
- package/dist/commands/describe.js.map +1 -1
- package/dist/commands/doctor.d.ts +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +261 -34
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/down-manifest.d.ts.map +1 -1
- package/dist/commands/down-manifest.js +9 -6
- package/dist/commands/down-manifest.js.map +1 -1
- package/dist/commands/down-services.d.ts +17 -16
- package/dist/commands/down-services.d.ts.map +1 -1
- package/dist/commands/down-services.js +29 -53
- package/dist/commands/down-services.js.map +1 -1
- package/dist/commands/down.d.ts +2 -2
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +96 -67
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/endpoint-deregister.d.ts.map +1 -1
- package/dist/commands/endpoint-deregister.js +2 -2
- package/dist/commands/endpoint-deregister.js.map +1 -1
- package/dist/commands/endpoint.d.ts +2 -1
- package/dist/commands/endpoint.d.ts.map +1 -1
- package/dist/commands/endpoint.js +2 -2
- package/dist/commands/endpoint.js.map +1 -1
- package/dist/commands/endpoints.d.ts +1 -0
- package/dist/commands/endpoints.d.ts.map +1 -1
- package/dist/commands/endpoints.js +20 -5
- package/dist/commands/endpoints.js.map +1 -1
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +40 -2
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/help.d.ts.map +1 -1
- package/dist/commands/help.js +2 -1
- package/dist/commands/help.js.map +1 -1
- package/dist/commands/history-clear.d.ts.map +1 -1
- package/dist/commands/history-clear.js +67 -51
- package/dist/commands/history-clear.js.map +1 -1
- package/dist/commands/history.d.ts +17 -2
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +221 -34
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/join.d.ts +2 -0
- package/dist/commands/join.d.ts.map +1 -1
- package/dist/commands/join.js +132 -80
- package/dist/commands/join.js.map +1 -1
- package/dist/commands/meshes-add.d.ts +19 -4
- package/dist/commands/meshes-add.d.ts.map +1 -1
- package/dist/commands/meshes-add.js +114 -15
- package/dist/commands/meshes-add.js.map +1 -1
- package/dist/commands/meshes-wizard.d.ts +1 -0
- package/dist/commands/meshes-wizard.d.ts.map +1 -1
- package/dist/commands/meshes-wizard.js +45 -13
- package/dist/commands/meshes-wizard.js.map +1 -1
- package/dist/commands/meshes.d.ts +1 -1
- package/dist/commands/meshes.d.ts.map +1 -1
- package/dist/commands/meshes.js +76 -47
- package/dist/commands/meshes.js.map +1 -1
- package/dist/commands/mint.d.ts.map +1 -1
- package/dist/commands/mint.js +212 -19
- package/dist/commands/mint.js.map +1 -1
- package/dist/commands/models.d.ts +5 -1
- package/dist/commands/models.d.ts.map +1 -1
- package/dist/commands/models.js +21 -13
- package/dist/commands/models.js.map +1 -1
- package/dist/commands/persona-remote.d.ts.map +1 -1
- package/dist/commands/persona-remote.js +38 -19
- package/dist/commands/persona-remote.js.map +1 -1
- package/dist/commands/persona.d.ts +1 -1
- package/dist/commands/persona.d.ts.map +1 -1
- package/dist/commands/persona.js +92 -23
- package/dist/commands/persona.js.map +1 -1
- package/dist/commands/personas.d.ts.map +1 -1
- package/dist/commands/personas.js +59 -40
- package/dist/commands/personas.js.map +1 -1
- package/dist/commands/reset-space-apply.d.ts.map +1 -1
- package/dist/commands/reset-space-apply.js +69 -17
- package/dist/commands/reset-space-apply.js.map +1 -1
- package/dist/commands/reset-store-apply.d.ts +16 -0
- package/dist/commands/reset-store-apply.d.ts.map +1 -1
- package/dist/commands/reset-store-apply.js +122 -23
- package/dist/commands/reset-store-apply.js.map +1 -1
- package/dist/commands/reset.d.ts.map +1 -1
- package/dist/commands/reset.js +8 -7
- package/dist/commands/reset.js.map +1 -1
- package/dist/commands/revoke-credential.d.ts +5 -0
- package/dist/commands/revoke-credential.d.ts.map +1 -0
- package/dist/commands/revoke-credential.js +128 -0
- package/dist/commands/revoke-credential.js.map +1 -0
- package/dist/commands/send.d.ts +11 -3
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +284 -47
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/service-actions.d.ts +2 -1
- package/dist/commands/service-actions.d.ts.map +1 -1
- package/dist/commands/service-actions.js +117 -21
- package/dist/commands/service-actions.js.map +1 -1
- package/dist/commands/service-log-follow.js +1 -1
- package/dist/commands/service-log-follow.js.map +1 -1
- package/dist/commands/service-registry.d.ts +1 -1
- package/dist/commands/service-registry.d.ts.map +1 -1
- package/dist/commands/service-registry.js +74 -30
- package/dist/commands/service-registry.js.map +1 -1
- package/dist/commands/service-set-stop.d.ts.map +1 -1
- package/dist/commands/service-set-stop.js +3 -2
- package/dist/commands/service-set-stop.js.map +1 -1
- package/dist/commands/setup-start.d.ts.map +1 -1
- package/dist/commands/setup-start.js +46 -5
- package/dist/commands/setup-start.js.map +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +28 -13
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/space-delete.d.ts.map +1 -1
- package/dist/commands/space-delete.js +130 -41
- package/dist/commands/space-delete.js.map +1 -1
- package/dist/commands/space-registration.d.ts +13 -6
- package/dist/commands/space-registration.d.ts.map +1 -1
- package/dist/commands/space-registration.js +167 -46
- package/dist/commands/space-registration.js.map +1 -1
- package/dist/commands/space.d.ts +15 -1
- package/dist/commands/space.d.ts.map +1 -1
- package/dist/commands/space.js +66 -24
- package/dist/commands/space.js.map +1 -1
- package/dist/commands/spawn-preview.d.ts.map +1 -1
- package/dist/commands/spawn-preview.js +48 -10
- package/dist/commands/spawn-preview.js.map +1 -1
- package/dist/commands/spawn.d.ts +36 -13
- package/dist/commands/spawn.d.ts.map +1 -1
- package/dist/commands/spawn.js +263 -129
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/stack-down.d.ts +9 -3
- package/dist/commands/stack-down.d.ts.map +1 -1
- package/dist/commands/stack-down.js +344 -64
- package/dist/commands/stack-down.js.map +1 -1
- package/dist/commands/stack-gone.d.ts +17 -0
- package/dist/commands/stack-gone.d.ts.map +1 -0
- package/dist/commands/stack-gone.js +218 -0
- package/dist/commands/stack-gone.js.map +1 -0
- package/dist/commands/stack-up.d.ts +64 -4
- package/dist/commands/stack-up.d.ts.map +1 -1
- package/dist/commands/stack-up.js +482 -55
- package/dist/commands/stack-up.js.map +1 -1
- package/dist/commands/status.d.ts +76 -2
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +550 -112
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/team-agent-apply.d.ts.map +1 -1
- package/dist/commands/team-agent-apply.js +4 -3
- package/dist/commands/team-agent-apply.js.map +1 -1
- package/dist/commands/team-agent-remove.d.ts.map +1 -1
- package/dist/commands/team-agent-remove.js +4 -4
- package/dist/commands/team-agent-remove.js.map +1 -1
- package/dist/commands/team-boot-controller.d.ts.map +1 -1
- package/dist/commands/team-boot-controller.js +8 -2
- package/dist/commands/team-boot-controller.js.map +1 -1
- package/dist/commands/team-channel-remove.d.ts.map +1 -1
- package/dist/commands/team-channel-remove.js +26 -10
- package/dist/commands/team-channel-remove.js.map +1 -1
- package/dist/commands/team-deploy-apply.d.ts.map +1 -1
- package/dist/commands/team-deploy-apply.js +4 -3
- package/dist/commands/team-deploy-apply.js.map +1 -1
- package/dist/commands/team-mixed-remove.js +5 -5
- package/dist/commands/team-mixed-remove.js.map +1 -1
- package/dist/commands/team.d.ts.map +1 -1
- package/dist/commands/team.js +94 -32
- package/dist/commands/team.js.map +1 -1
- package/dist/commands/telemetry.d.ts +1 -1
- package/dist/commands/telemetry.d.ts.map +1 -1
- package/dist/commands/telemetry.js +5 -3
- package/dist/commands/telemetry.js.map +1 -1
- package/dist/commands/topology.d.ts.map +1 -1
- package/dist/commands/topology.js +11 -7
- package/dist/commands/topology.js.map +1 -1
- package/dist/commands/up.d.ts +6 -6
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +963 -240
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +9 -3
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/use.d.ts +5 -1
- package/dist/commands/use.d.ts.map +1 -1
- package/dist/commands/use.js +55 -12
- package/dist/commands/use.js.map +1 -1
- package/dist/commands/watch.d.ts +4 -1
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +15 -3
- package/dist/commands/watch.js.map +1 -1
- package/dist/commands/who.d.ts +2 -0
- package/dist/commands/who.d.ts.map +1 -1
- package/dist/commands/who.js +18 -5
- package/dist/commands/who.js.map +1 -1
- package/dist/commands/whoami.d.ts +44 -5
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +168 -16
- package/dist/commands/whoami.js.map +1 -1
- package/dist/console/app.d.ts +1 -1
- package/dist/console/app.d.ts.map +1 -1
- package/dist/console/app.js +15 -9
- package/dist/console/app.js.map +1 -1
- package/dist/console/launch.d.ts +25 -0
- package/dist/console/launch.d.ts.map +1 -0
- package/dist/console/launch.js +56 -0
- package/dist/console/launch.js.map +1 -0
- package/dist/console/ui/CommandPalette.d.ts +5 -4
- package/dist/console/ui/CommandPalette.d.ts.map +1 -1
- package/dist/console/ui/CommandPalette.js +136 -45
- package/dist/console/ui/CommandPalette.js.map +1 -1
- package/dist/console/ui/Help.js +1 -1
- package/dist/console/ui/Help.js.map +1 -1
- package/dist/console/ui/Modal.d.ts +10 -0
- package/dist/console/ui/Modal.d.ts.map +1 -0
- package/dist/console/ui/Modal.js +8 -0
- package/dist/console/ui/Modal.js.map +1 -0
- package/dist/console/ui/NewAgent.d.ts +14 -0
- package/dist/console/ui/NewAgent.d.ts.map +1 -0
- package/dist/console/ui/NewAgent.js +114 -0
- package/dist/console/ui/NewAgent.js.map +1 -0
- package/dist/console/ui/StatusBar.d.ts +1 -2
- package/dist/console/ui/StatusBar.d.ts.map +1 -1
- package/dist/console/ui/StatusBar.js +6 -8
- package/dist/console/ui/StatusBar.js.map +1 -1
- package/dist/console/ui/topo/Map.d.ts.map +1 -1
- package/dist/console/ui/topo/Map.js +1 -2
- package/dist/console/ui/topo/Map.js.map +1 -1
- package/dist/console/ui/topo/Matrix.js +2 -2
- package/dist/console/ui/topo/Matrix.js.map +1 -1
- package/dist/console/ui/topo/Sequence.d.ts.map +1 -1
- package/dist/console/ui/topo/Sequence.js +5 -4
- package/dist/console/ui/topo/Sequence.js.map +1 -1
- package/dist/console/ui/topo/model.d.ts +2 -1
- package/dist/console/ui/topo/model.d.ts.map +1 -1
- package/dist/console/ui/topo/model.js +4 -3
- package/dist/console/ui/topo/model.js.map +1 -1
- package/dist/exec-endpoint/service-adapter.d.ts.map +1 -1
- package/dist/exec-endpoint/service-adapter.js +13 -3
- package/dist/exec-endpoint/service-adapter.js.map +1 -1
- package/dist/ext-loader.d.ts +4 -0
- package/dist/ext-loader.d.ts.map +1 -1
- package/dist/ext-loader.js +6 -0
- package/dist/ext-loader.js.map +1 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +44 -23
- package/dist/help.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +59 -54
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-skills.d.ts.map +1 -1
- package/dist/lib/agent-skills.js +2 -1
- package/dist/lib/agent-skills.js.map +1 -1
- package/dist/lib/attach-client.js +2 -2
- package/dist/lib/attach-client.js.map +1 -1
- package/dist/lib/backup-artifact.d.ts +36 -8
- package/dist/lib/backup-artifact.d.ts.map +1 -1
- package/dist/lib/backup-artifact.js +156 -26
- package/dist/lib/backup-artifact.js.map +1 -1
- package/dist/lib/broker-service.d.ts +27 -3
- package/dist/lib/broker-service.d.ts.map +1 -1
- package/dist/lib/broker-service.js +135 -27
- package/dist/lib/broker-service.js.map +1 -1
- package/dist/lib/broker-store-health.d.ts +89 -0
- package/dist/lib/broker-store-health.d.ts.map +1 -0
- package/dist/lib/broker-store-health.js +171 -0
- package/dist/lib/broker-store-health.js.map +1 -0
- package/dist/lib/cancel.d.ts +4 -4
- package/dist/lib/cancel.d.ts.map +1 -1
- package/dist/lib/cancel.js +5 -5
- package/dist/lib/cancel.js.map +1 -1
- package/dist/lib/completion-install.d.ts +11 -2
- package/dist/lib/completion-install.d.ts.map +1 -1
- package/dist/lib/completion-install.js +79 -21
- package/dist/lib/completion-install.js.map +1 -1
- package/dist/lib/completion-scripts.d.ts.map +1 -1
- package/dist/lib/completion-scripts.js +2 -2
- package/dist/lib/completion-scripts.js.map +1 -1
- package/dist/lib/completion.d.ts +5 -1
- package/dist/lib/completion.d.ts.map +1 -1
- package/dist/lib/completion.js +10 -0
- package/dist/lib/completion.js.map +1 -1
- package/dist/lib/concrete-channel.d.ts +6 -0
- package/dist/lib/concrete-channel.d.ts.map +1 -0
- package/dist/lib/concrete-channel.js +17 -0
- package/dist/lib/concrete-channel.js.map +1 -0
- package/dist/lib/confirmation-required.d.ts +3 -12
- package/dist/lib/confirmation-required.d.ts.map +1 -1
- package/dist/lib/confirmation-required.js +9 -8
- package/dist/lib/confirmation-required.js.map +1 -1
- package/dist/lib/connect.d.ts +9 -0
- package/dist/lib/connect.d.ts.map +1 -1
- package/dist/lib/connect.js +27 -0
- package/dist/lib/connect.js.map +1 -1
- package/dist/lib/control.d.ts +42 -12
- package/dist/lib/control.d.ts.map +1 -1
- package/dist/lib/control.js +130 -31
- package/dist/lib/control.js.map +1 -1
- package/dist/lib/controller-restore.d.ts.map +1 -1
- package/dist/lib/controller-restore.js +12 -7
- package/dist/lib/controller-restore.js.map +1 -1
- package/dist/lib/credential-authority.d.ts.map +1 -1
- package/dist/lib/credential-authority.js +3 -0
- package/dist/lib/credential-authority.js.map +1 -1
- package/dist/lib/credential-exports.d.ts +17 -0
- package/dist/lib/credential-exports.d.ts.map +1 -0
- package/dist/lib/credential-exports.js +21 -0
- package/dist/lib/credential-exports.js.map +1 -0
- package/dist/lib/debug-flag.d.ts +4 -0
- package/dist/lib/debug-flag.d.ts.map +1 -0
- package/dist/lib/debug-flag.js +7 -0
- package/dist/lib/debug-flag.js.map +1 -0
- package/dist/lib/default-persona.d.ts +2 -0
- package/dist/lib/default-persona.d.ts.map +1 -1
- package/dist/lib/default-persona.js +2 -0
- package/dist/lib/default-persona.js.map +1 -1
- package/dist/lib/delivery-proc.d.ts +1 -1
- package/dist/lib/delivery-proc.d.ts.map +1 -1
- package/dist/lib/delivery-proc.js +5 -4
- package/dist/lib/delivery-proc.js.map +1 -1
- package/dist/lib/delivery-responder.d.ts +7 -3
- package/dist/lib/delivery-responder.d.ts.map +1 -1
- package/dist/lib/delivery-responder.js +8 -4
- package/dist/lib/delivery-responder.js.map +1 -1
- package/dist/lib/denied-write.d.ts +8 -0
- package/dist/lib/denied-write.d.ts.map +1 -0
- package/dist/lib/denied-write.js +24 -0
- package/dist/lib/denied-write.js.map +1 -0
- package/dist/lib/endpoint-capability-gates.js +2 -2
- package/dist/lib/endpoint-capability-gates.js.map +1 -1
- package/dist/lib/flag-value-refusal.d.ts +8 -0
- package/dist/lib/flag-value-refusal.d.ts.map +1 -0
- package/dist/lib/flag-value-refusal.js +10 -0
- package/dist/lib/flag-value-refusal.js.map +1 -0
- package/dist/lib/install-umask.d.ts +5 -0
- package/dist/lib/install-umask.d.ts.map +1 -1
- package/dist/lib/install-umask.js +25 -0
- package/dist/lib/install-umask.js.map +1 -1
- package/dist/lib/interrupt-notice.d.ts +23 -1
- package/dist/lib/interrupt-notice.d.ts.map +1 -1
- package/dist/lib/interrupt-notice.js +27 -6
- package/dist/lib/interrupt-notice.js.map +1 -1
- package/dist/lib/interrupt-report.d.ts +7 -0
- package/dist/lib/interrupt-report.d.ts.map +1 -0
- package/dist/lib/interrupt-report.js +24 -0
- package/dist/lib/interrupt-report.js.map +1 -0
- package/dist/lib/isolated-broker.d.ts +1 -1
- package/dist/lib/isolated-broker.d.ts.map +1 -1
- package/dist/lib/isolated-broker.js +17 -8
- package/dist/lib/isolated-broker.js.map +1 -1
- package/dist/lib/legacy-start.d.ts +8 -6
- package/dist/lib/legacy-start.d.ts.map +1 -1
- package/dist/lib/legacy-start.js +36 -36
- package/dist/lib/legacy-start.js.map +1 -1
- package/dist/lib/manager-choice.d.ts +45 -4
- package/dist/lib/manager-choice.d.ts.map +1 -1
- package/dist/lib/manager-choice.js +214 -24
- package/dist/lib/manager-choice.js.map +1 -1
- package/dist/lib/manager-proc.d.ts.map +1 -1
- package/dist/lib/manager-proc.js +7 -6
- package/dist/lib/manager-proc.js.map +1 -1
- package/dist/lib/manifest/index.d.ts +5 -1
- package/dist/lib/manifest/index.d.ts.map +1 -1
- package/dist/lib/manifest/index.js +50 -5
- package/dist/lib/manifest/index.js.map +1 -1
- package/dist/lib/manifest/preflight.d.ts +4 -0
- package/dist/lib/manifest/preflight.d.ts.map +1 -1
- package/dist/lib/manifest/preflight.js +18 -1
- package/dist/lib/manifest/preflight.js.map +1 -1
- package/dist/lib/manifest/resolve.d.ts +8 -0
- package/dist/lib/manifest/resolve.d.ts.map +1 -1
- package/dist/lib/manifest/resolve.js +104 -11
- package/dist/lib/manifest/resolve.js.map +1 -1
- package/dist/lib/missing-flags.js +1 -1
- package/dist/lib/missing-flags.js.map +1 -1
- package/dist/lib/nats-bin.d.ts +28 -5
- package/dist/lib/nats-bin.d.ts.map +1 -1
- package/dist/lib/nats-bin.js +85 -7
- package/dist/lib/nats-bin.js.map +1 -1
- package/dist/lib/nearest-word.d.ts +14 -0
- package/dist/lib/nearest-word.d.ts.map +1 -0
- package/dist/lib/nearest-word.js +76 -0
- package/dist/lib/nearest-word.js.map +1 -0
- package/dist/lib/no-expiry-record.d.ts +8 -0
- package/dist/lib/no-expiry-record.d.ts.map +1 -0
- package/dist/lib/no-expiry-record.js +27 -0
- package/dist/lib/no-expiry-record.js.map +1 -0
- package/dist/lib/paths.d.ts +31 -0
- package/dist/lib/paths.d.ts.map +1 -1
- package/dist/lib/paths.js +92 -2
- package/dist/lib/paths.js.map +1 -1
- package/dist/lib/persona-files.d.ts +29 -6
- package/dist/lib/persona-files.d.ts.map +1 -1
- package/dist/lib/persona-files.js +179 -36
- package/dist/lib/persona-files.js.map +1 -1
- package/dist/lib/personas.d.ts +18 -1
- package/dist/lib/personas.d.ts.map +1 -1
- package/dist/lib/personas.js +65 -6
- package/dist/lib/personas.js.map +1 -1
- package/dist/lib/prompts.d.ts +7 -1
- package/dist/lib/prompts.d.ts.map +1 -1
- package/dist/lib/prompts.js +43 -3
- package/dist/lib/prompts.js.map +1 -1
- package/dist/lib/registry-errors.d.ts +2 -1
- package/dist/lib/registry-errors.d.ts.map +1 -1
- package/dist/lib/registry-errors.js +6 -2
- package/dist/lib/registry-errors.js.map +1 -1
- package/dist/lib/reset-space-plan.d.ts +2 -0
- package/dist/lib/reset-space-plan.d.ts.map +1 -1
- package/dist/lib/reset-space-plan.js +1 -1
- package/dist/lib/reset-space-plan.js.map +1 -1
- package/dist/lib/restore.d.ts +45 -3
- package/dist/lib/restore.d.ts.map +1 -1
- package/dist/lib/restore.js +248 -35
- package/dist/lib/restore.js.map +1 -1
- package/dist/lib/rolled-back-runs.d.ts +36 -0
- package/dist/lib/rolled-back-runs.d.ts.map +1 -0
- package/dist/lib/rolled-back-runs.js +96 -0
- package/dist/lib/rolled-back-runs.js.map +1 -0
- package/dist/lib/service-definitions.d.ts +16 -3
- package/dist/lib/service-definitions.d.ts.map +1 -1
- package/dist/lib/service-definitions.js +99 -27
- package/dist/lib/service-definitions.js.map +1 -1
- package/dist/lib/service-instances.d.ts +13 -1
- package/dist/lib/service-instances.d.ts.map +1 -1
- package/dist/lib/service-instances.js +56 -12
- package/dist/lib/service-instances.js.map +1 -1
- package/dist/lib/service-presets.d.ts.map +1 -1
- package/dist/lib/service-presets.js +16 -0
- package/dist/lib/service-presets.js.map +1 -1
- package/dist/lib/service-process.d.ts +51 -8
- package/dist/lib/service-process.d.ts.map +1 -1
- package/dist/lib/service-process.js +385 -48
- package/dist/lib/service-process.js.map +1 -1
- package/dist/lib/space-streams.d.ts +18 -0
- package/dist/lib/space-streams.d.ts.map +1 -0
- package/dist/lib/space-streams.js +35 -0
- package/dist/lib/space-streams.js.map +1 -0
- package/dist/lib/spawn-defaults.d.ts +25 -1
- package/dist/lib/spawn-defaults.d.ts.map +1 -1
- package/dist/lib/spawn-defaults.js +37 -1
- package/dist/lib/spawn-defaults.js.map +1 -1
- package/dist/lib/stack-journal.d.ts +157 -14
- package/dist/lib/stack-journal.d.ts.map +1 -1
- package/dist/lib/stack-journal.js +406 -49
- package/dist/lib/stack-journal.js.map +1 -1
- package/dist/lib/stack-listeners.d.ts +17 -0
- package/dist/lib/stack-listeners.d.ts.map +1 -0
- package/dist/lib/stack-listeners.js +54 -0
- package/dist/lib/stack-listeners.js.map +1 -0
- package/dist/lib/stack-members.d.ts +13 -0
- package/dist/lib/stack-members.d.ts.map +1 -0
- package/dist/lib/stack-members.js +24 -0
- package/dist/lib/stack-members.js.map +1 -0
- package/dist/lib/stack-resume.d.ts.map +1 -1
- package/dist/lib/stack-resume.js +5 -2
- package/dist/lib/stack-resume.js.map +1 -1
- package/dist/lib/stack-runs.d.ts +34 -0
- package/dist/lib/stack-runs.d.ts.map +1 -0
- package/dist/lib/stack-runs.js +75 -0
- package/dist/lib/stack-runs.js.map +1 -0
- package/dist/lib/status.d.ts +11 -0
- package/dist/lib/status.d.ts.map +1 -1
- package/dist/lib/status.js +4 -5
- package/dist/lib/status.js.map +1 -1
- package/dist/lib/stdout-owner.d.ts +12 -3
- package/dist/lib/stdout-owner.d.ts.map +1 -1
- package/dist/lib/stdout-owner.js +33 -5
- package/dist/lib/stdout-owner.js.map +1 -1
- package/dist/lib/store-dir.d.ts +68 -4
- package/dist/lib/store-dir.d.ts.map +1 -1
- package/dist/lib/store-dir.js +253 -17
- package/dist/lib/store-dir.js.map +1 -1
- package/dist/lib/team-additive-attempt.d.ts +1 -1
- package/dist/lib/team-channel-removal.d.ts.map +1 -1
- package/dist/lib/team-channel-removal.js +4 -0
- package/dist/lib/team-channel-removal.js.map +1 -1
- package/dist/lib/team-deploy-inspection.d.ts +13 -0
- package/dist/lib/team-deploy-inspection.d.ts.map +1 -1
- package/dist/lib/team-deploy-inspection.js +12 -0
- package/dist/lib/team-deploy-inspection.js.map +1 -1
- package/dist/lib/team-text.d.ts +6 -0
- package/dist/lib/team-text.d.ts.map +1 -0
- package/dist/lib/team-text.js +36 -0
- package/dist/lib/team-text.js.map +1 -0
- package/dist/lib/transient.d.ts +14 -8
- package/dist/lib/transient.d.ts.map +1 -1
- package/dist/lib/transient.js +72 -11
- package/dist/lib/transient.js.map +1 -1
- package/dist/lib/unusable-file.d.ts +13 -0
- package/dist/lib/unusable-file.d.ts.map +1 -0
- package/dist/lib/unusable-file.js +12 -0
- package/dist/lib/unusable-file.js.map +1 -0
- package/dist/lib/up-report.d.ts +6 -0
- package/dist/lib/up-report.d.ts.map +1 -1
- package/dist/lib/up-report.js +13 -0
- package/dist/lib/up-report.js.map +1 -1
- package/dist/lib/verdict.d.ts +14 -0
- package/dist/lib/verdict.d.ts.map +1 -0
- package/dist/lib/verdict.js +15 -0
- package/dist/lib/verdict.js.map +1 -0
- package/dist/managed-handoff.d.ts +11 -6
- package/dist/managed-handoff.d.ts.map +1 -1
- package/dist/managed-handoff.js +27 -18
- package/dist/managed-handoff.js.map +1 -1
- package/dist/render.d.ts +5 -2
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +44 -10
- package/dist/render.js.map +1 -1
- package/dist/telemetry.d.ts +4 -3
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +14 -6
- package/dist/telemetry.js.map +1 -1
- package/dist/ui.d.ts +3 -2
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +6 -4
- package/dist/ui.js.map +1 -1
- package/dist/view/mesh-view.d.ts.map +1 -1
- package/dist/view/mesh-view.js +4 -1
- package/dist/view/mesh-view.js.map +1 -1
- package/dist/watch-data.d.ts +9 -1
- package/dist/watch-data.d.ts.map +1 -1
- package/dist/watch-data.js +17 -3
- package/dist/watch-data.js.map +1 -1
- package/dist/watch-json.js +4 -3
- package/dist/watch-json.js.map +1 -1
- package/package.json +5 -5
package/dist/commands/doctor.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
2
2
|
import { hostname } from "node:os";
|
|
3
3
|
import { basename, join } from "node:path";
|
|
4
|
-
import { credentialLifetime, credsProblem, CotalEndpoint, inspectCredHealth, mintCreds, mintLifecycleUid, newIdentity, probeConnect, } from "@cotal-ai/core";
|
|
5
|
-
import { CommandFailure, accountInventory, canonicalRoot, credentialFileExposure, isCommandFailure, jsonFlag, plainFlag, presentationOf, readLocalRecordSource, renewalRecordPath, writeResult, agentCredsDir, authDir, CONNECTION_EVICTOR_CREDS_KIND, DELIVERY_CREDS_KIND, findCotalRoot, getSoleSpaceAuth, getSpaceAuth, hasUserAuthState, legacyRenewalRecord, MEMBERSHIP_OBSERVER_CREDS_KIND, MEMBERSHIP_RW_CREDS_KIND, MeshTargetError, migrateLegacyCotalMaterial, preflightTarget, remintDaemonCreds, resolveMeshTarget, spaceAccountPath, staleSystemCreds, workspaceSecretStore, writeRenewalRecord, recordOperationSpace, } from "@cotal-ai/workspace";
|
|
4
|
+
import { accountRevocations, credentialLifetime, credsClaims, credsProblem, CotalEndpoint, inspectCredHealth, mintCreds, mintLifecycleUid, newIdentity, probeConnect, } from "@cotal-ai/core";
|
|
5
|
+
import { CommandFailure, accountInventory, canonicalRoot, credentialFileExposure, isCommandFailure, jsonFlag, plainFlag, presentationOf, readLocalRecordSource, renewalRecordPath, writeResult, agentCredsDir, authDir, CONNECTION_EVICTOR_CREDS_KIND, DELIVERY_CREDS_KIND, findCotalRoot, getSoleSpaceAuth, getSpaceAuth, hasUserAuthState, legacyRenewalRecord, MEMBERSHIP_OBSERVER_CREDS_KIND, MEMBERSHIP_RW_CREDS_KIND, MeshTargetError, migrateLegacyCotalMaterial, preflightTarget, remintDaemonCreds, REMINTABLE_DAEMON_CREDS, resolveMeshTarget, spaceAccountPath, staleSystemCreds, STORE_CONTENTS, storeContentsText, unparsableDaemonCreds, workspaceSecretStore, writeRenewalRecord, recordOperationSpace, agentGrants, grantMintFlags, } from "@cotal-ai/workspace";
|
|
6
6
|
import { displayCmd } from "../lib/self-exec.js";
|
|
7
7
|
import { RESPONDER_UNBOUND_CONSEQUENCE } from "../lib/delivery-responder.js";
|
|
8
|
+
import { noExpiryRecordPath, noExpiryRequestedAt } from "../lib/no-expiry-record.js";
|
|
9
|
+
import { credentialExportStore } from "../lib/credential-exports.js";
|
|
8
10
|
export const doctorFlags = [jsonFlag, plainFlag,
|
|
9
|
-
{ name: "fix", type: "boolean", description: "execute the safe repairs (re-sign the manager-remintable daemon creds; needs the local signer)" },
|
|
11
|
+
{ name: "fix", type: "boolean", description: "execute the safe repairs (re-sign the manager-remintable daemon creds, or mint one again that holds no key while its broker does not answer; needs the local signer)" },
|
|
10
12
|
{ name: "space", type: "string", description: "target space on a multi-space root (default: the sole space)" },
|
|
11
13
|
];
|
|
12
14
|
export function validateDoctorArguments(args) {
|
|
@@ -14,6 +16,33 @@ export function validateDoctorArguments(args) {
|
|
|
14
16
|
if (args.positionals.length !== 1 || args.positionals[0] !== "auth")
|
|
15
17
|
throw new CommandFailure("refused", "USAGE_INVALID", "use doctor auth [--fix] [--space <space>] [--json|--plain]");
|
|
16
18
|
}
|
|
19
|
+
/** The space registered as open at this root, if any. Missing signing trust alone is never read as
|
|
20
|
+
* an open space. */
|
|
21
|
+
function recordedOpenSpace(root, space) {
|
|
22
|
+
try {
|
|
23
|
+
const target = resolveMeshTarget(root, { ...(space === undefined ? {} : { space }), readOnly: true });
|
|
24
|
+
return target.mode === "open" && target.origin !== undefined && canonicalRoot(target.root) === canonicalRoot(root) ? target.space : undefined;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** Where to run doctor auth when this folder's root holds no signing trust for the scope it names:
|
|
31
|
+
* the root `space` is registered at, when that is another folder, or else a space's root. The
|
|
32
|
+
* report stays root-local, so the step names the folder instead of reading another root's trust. */
|
|
33
|
+
function trustRootStep(root, space, fix) {
|
|
34
|
+
const command = `cotal doctor auth${space === undefined ? "" : ` --space ${space}`}${fix ? " --fix" : ""}`;
|
|
35
|
+
let registered;
|
|
36
|
+
if (space !== undefined) {
|
|
37
|
+
try {
|
|
38
|
+
const target = resolveMeshTarget(root, { space, readOnly: true });
|
|
39
|
+
if (canonicalRoot(target.root) !== canonicalRoot(root))
|
|
40
|
+
registered = target.root;
|
|
41
|
+
}
|
|
42
|
+
catch { /* not registered here: the general step */ }
|
|
43
|
+
}
|
|
44
|
+
return registered ? `run \`${command}\` in the folder space ${space} is registered at: ${registered}` : `run \`${command}\` in ${space === undefined ? "a" : "that"} space's root folder; \`cotal space\` lists each space's root`;
|
|
45
|
+
}
|
|
17
46
|
/** Local credential observations only; native repair remains an explicit, separately labeled phase. */
|
|
18
47
|
export async function doctor(args) {
|
|
19
48
|
validateDoctorArguments(args);
|
|
@@ -41,8 +70,13 @@ export async function doctor(args) {
|
|
|
41
70
|
throw new CommandFailure("refused", "SCHEMA_INVALID", "the local authority inventory could not be validated; no repair was attempted", { target: { root, space: values.space ?? null } });
|
|
42
71
|
}
|
|
43
72
|
if (!auth) {
|
|
73
|
+
const open = values.fix ? undefined : recordedOpenSpace(root, values.space);
|
|
74
|
+
if (open !== undefined) {
|
|
75
|
+
writeResult(presentationOf(values), { command: "doctor auth", target: { root, space: open }, result: { kind: "credential-health", root, space: open, localFindings: null, credentialScope: "open-space", brokerAuthorization: "not-checked", repair }, noOp: true }, () => ({ sections: [{ title: "No credentials to check", blocks: [{ kind: "fields", rows: [["Root", root], ["Space", open], ["Mode", "open, as registered"]] }, { kind: "lines", lines: [{ text: "This space is open: it authenticates no one and issues no credentials, so there are none to check.", tone: "hint" }] }] }] }));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
44
78
|
if (values.fix || values.space)
|
|
45
|
-
throw new CommandFailure("refused", "AUTH_REQUIRED", "no validated signing trust for the named local diagnostic scope is present; no open mode or broader authority was inferred", { target: { root, space: values.space ?? null } });
|
|
79
|
+
throw new CommandFailure("refused", "AUTH_REQUIRED", "no validated signing trust for the named local diagnostic scope is present; no open mode or broader authority was inferred", { target: { root, space: values.space ?? null }, remedy: trustRootStep(root, values.space, values.fix === true) });
|
|
46
80
|
writeResult(presentationOf(values), { command: "doctor auth", target: { root }, result: { kind: "credential-health", root, space: null, localFindings: null, credentialScope: "not-established", brokerAuthorization: "not-checked", repair }, completeness: "not-checked", partial: { message: "No local static authority was established. This is not proof of an open or healthy mesh.", remedy: "run `cotal doctor auth` in a space's root folder; `cotal space` lists each space's root" } }, () => ({ sections: [{ title: "Local credential scope not established", blocks: [{ kind: "fields", rows: [["Root", root], ["Space", "not established"], ["Live authorization", "not checked"], ["Repair", "not requested"]] }] }] }));
|
|
47
81
|
return;
|
|
48
82
|
}
|
|
@@ -54,11 +88,12 @@ export async function doctor(args) {
|
|
|
54
88
|
if (values.fix && userMode)
|
|
55
89
|
throw new CommandFailure("refused", "UNSUPPORTED", "this static daemon repair cannot replace a user-auth space's supported issuer authority", { target });
|
|
56
90
|
repair.migrationAttempted = values.fix === true;
|
|
57
|
-
|
|
91
|
+
const revocations = accountRevocations(auth.account.jwt);
|
|
92
|
+
reports = inventory(root, auth.space, auth.sys.pub, !values.fix, (receipt) => repair.migrations.push(receipt), revocations);
|
|
58
93
|
if (values.fix && reports.some((row) => row.problem && isRemintable(row.kind)))
|
|
59
|
-
await repairDoctorCredentials(root, auth, repair);
|
|
94
|
+
await repairDoctorCredentials(root, auth, repair, new Set(reports.filter((row) => row.unparsable && isRemintable(row.kind)).map((row) => row.label)));
|
|
60
95
|
if (repair.attempted)
|
|
61
|
-
reports = inventory(root, auth.space, auth.sys.pub, true);
|
|
96
|
+
reports = inventory(root, auth.space, auth.sys.pub, true, undefined, revocations);
|
|
62
97
|
}
|
|
63
98
|
catch (error) {
|
|
64
99
|
const changed = [...repair.migrations.map((receipt) => ({ kind: "credential-material-migrated", materialKind: receipt.kind, from: receipt.from, to: receipt.to, space: receipt.space })), ...repair.results.filter((row) => row.ok).map((row) => ({ kind: "daemon-credential-resigned", file: row.file, space: auth.space }))];
|
|
@@ -70,35 +105,54 @@ export async function doctor(args) {
|
|
|
70
105
|
}
|
|
71
106
|
const renewal = renewalObservation(root, auth.space);
|
|
72
107
|
const items = reports.map((row) => ({
|
|
73
|
-
label: row.label, kind: row.kind, path: row.path, state: row.superseded ? "superseded-local-file" : row.health?.state ?? "not-provisioned-here",
|
|
108
|
+
label: row.label, kind: row.kind, path: row.path, state: row.revokedAt !== undefined ? "revoked" : row.superseded ? "superseded-local-file" : row.health?.state ?? (row.problem ? "missing" : "not-provisioned-here"),
|
|
74
109
|
issuedAt: Number.isFinite(row.health?.iat) ? row.health.iat : null,
|
|
75
110
|
expiresAt: Number.isFinite(row.health?.exp) ? row.health.exp : null,
|
|
76
111
|
renewAt: Number.isFinite(row.health?.renewAt) ? row.health.renewAt : null,
|
|
77
|
-
problem: row.problem ?? null,
|
|
78
|
-
repair: row.repair ?? null, superseded: row.superseded === true,
|
|
112
|
+
problem: row.problem ?? null, warning: row.warning ?? null,
|
|
113
|
+
repair: row.repair ?? null, superseded: row.superseded === true, revokedAt: row.revokedAt ?? null,
|
|
79
114
|
}));
|
|
115
|
+
let exported;
|
|
116
|
+
try {
|
|
117
|
+
exported = exportedCredentials(root, auth);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
exported = null;
|
|
121
|
+
}
|
|
122
|
+
const warnings = [
|
|
123
|
+
...items.filter((row) => row.warning !== null).map((row) => ({ code: "CREDENTIAL_UNBOUNDED_BY_REQUEST", target: { path: row.path }, message: `${row.label}: ${row.warning}` })),
|
|
124
|
+
...(exported ?? []).filter((row) => row.state === "expired").map((row) => ({ code: "EXPORTED_CREDENTIAL_EXPIRED", target: { path: row.path }, message: `${row.label}: ${row.path} expired at ${at(row.expiresAt ?? undefined)}; ${row.repair}` })),
|
|
125
|
+
...(exported === null ? [{ code: "EXPORTED_CREDENTIALS_UNREAD", target: { space: auth.space }, message: "the records of the files auth mint --out wrote could not be read, so those files are not listed" }] : []),
|
|
126
|
+
];
|
|
80
127
|
const findings = items.filter((row) => row.problem !== null).length;
|
|
81
128
|
const refused = renewal.state === "present" && renewal.brokerAcceptance === "recorded-refusal";
|
|
82
129
|
const incomplete = renewal.state === "unreadable";
|
|
83
|
-
const result = { kind: "credential-health", root, space: auth.space, mode: userMode ? "user" : "static", scope: "local credential claims and recorded renewal only", items, findings, renewal, repair, brokerAuthorization: "not-checked", liveAgentHealth: "not-checked", systemAccountRotated: false, agentCredentialsReminted: false };
|
|
130
|
+
const result = { kind: "credential-health", root, space: auth.space, mode: userMode ? "user" : "static", scope: "local credential claims and recorded renewal only", items, exported, findings, renewal, repair, brokerAuthorization: "not-checked", liveAgentHealth: "not-checked", systemAccountRotated: false, agentCredentialsReminted: false };
|
|
84
131
|
// A recorded refusal names the renewal owner to repair, so the finding keeps its next step.
|
|
85
132
|
const failure = incomplete ? new CommandFailure("partial", "OPERATION_PARTIAL", "credential observations were collected but the renewal record is unreadable; a complete healthy verdict was not inferred", { target }) : findings || refused ? new CommandFailure(repair.results.some((row) => row.ok) || repair.migrations.length ? "partial" : "failed", repair.results.some((row) => row.ok) || repair.migrations.length ? "OPERATION_PARTIAL" : "OPERATION_FAILED", refused ? "the recorded renewal was not broker-accepted; local re-signing alone cannot clear that finding" : "local credential findings remain; per-file native repair guidance is retained", { target, ...(refused ? { remedy: "start or repair this space's manager, the renewal owner, so it re-signs the daemon credentials and the broker accepts them; do not respawn agents for this finding" } : {}) }) : undefined;
|
|
86
|
-
writeResult(presentationOf(values), { command: "doctor auth", target, result, completeness: incomplete ? "partial" : "complete", failure, noOp: failure === undefined && values.fix === true && !repair.attempted && !repair.migrations.length }, (data) => ({ sections: [
|
|
87
|
-
{ title: data.findings || refused || incomplete ? "Credential findings" :
|
|
133
|
+
writeResult(presentationOf(values), { command: "doctor auth", target, result, completeness: incomplete ? "partial" : "complete", warnings, failure, noOp: failure === undefined && values.fix === true && !repair.attempted && !repair.migrations.length }, (data) => ({ sections: [
|
|
134
|
+
{ title: data.findings || refused || incomplete ? "Credential findings" : noFindingsTitle(data.items, data.exported), blocks: [
|
|
88
135
|
{ kind: "fields", rows: [["Root", data.root], ["Space", data.space], ["Mode", data.mode], ["Scope", data.scope], ["Current broker authorization", { text: "not checked", tone: "waiting" }], ["Live agent health", { text: "not checked", tone: "waiting" }], ["Repair requested", data.repair.requested ? "yes" : "no"], ["Acknowledged local migrations", String(data.repair.migrations.length)], ["Repair coordination", data.repair.authority ?? "not used"]] },
|
|
89
136
|
{ kind: "lines", lines: [{ text: "Credential expiry/claim inspection is not live broker acceptance, daemon adoption, process health or task progress. Locally ordered superseded files are not proof that their successor is connected. No agent was respawned and no system account was rotated.", tone: "hint" }] },
|
|
137
|
+
...(data.repair.results.some((row) => row.reminted || (!row.ok && !row.skipped)) ? [{ kind: "lines", lines: data.repair.results.filter((row) => row.reminted || (!row.ok && !row.skipped)).map((row) => row.reminted ? `${row.file}: minted again under a new identity, because ${row.reason}` : `${row.file}: not repaired, because ${row.reason}`) }] : []),
|
|
90
138
|
] },
|
|
91
139
|
{ title: "Local credential files", blocks: [
|
|
92
140
|
{ kind: "table", columns: [{ key: "name", label: "Credential" }, { key: "state", label: "Local state" }, { key: "issued", label: "Issued" }, { key: "expiry", label: "Expiry" }], rows: data.items.slice(0, 200).map((row) => ({ name: row.label, state: row.state, issued: at(row.issuedAt ?? undefined), expiry: at(row.expiresAt ?? undefined) })) },
|
|
93
141
|
...(data.items.length > 200 ? [{ kind: "lines", lines: [`${data.items.length - 200} credential rows are not shown; JSON retains every public diagnostic row.`] }] : []),
|
|
94
142
|
] },
|
|
143
|
+
...(data.exported?.length ? [{ title: "Exported credential files", blocks: [
|
|
144
|
+
{ kind: "table", columns: [{ key: "name", label: "Credential" }, { key: "file", label: "File" }, { key: "state", label: "Local state" }, { key: "expiry", label: "Expiry" }], rows: data.exported.slice(0, 200).map((row) => ({ name: row.label, file: row.path, state: row.state, expiry: at(row.expiresAt ?? undefined) })) },
|
|
145
|
+
...(data.exported.length > 200 ? [{ kind: "lines", lines: [`${data.exported.length - 200} exported rows are not shown; JSON retains every row.`] }] : []),
|
|
146
|
+
...(data.exported.some((row) => row.repair !== null) ? [{ kind: "lines", lines: data.exported.filter((row) => row.repair !== null).slice(0, 200).map((row) => `${row.label}: ${row.repair}`) }] : []),
|
|
147
|
+
] }] : []),
|
|
95
148
|
{ title: "Recorded renewal", blocks: [{ kind: "fields", rows: [["Record", data.renewal.state], ["Recorded time", data.renewal.recordedAt ?? "not established"], ["Recorded owner", data.renewal.recordedOwner ?? "not established"], ["Broker acceptance at that pass", data.renewal.brokerAcceptance], ["Recorded coordination", data.renewal.authority ?? "not recorded"], ["Delivery responder at that pass", data.renewal.deliveryResponderUnbound ? "reported unbound" : "not established by this view"]] }, ...(data.renewal.deliveryResponderUnbound ? [{ kind: "lines", lines: [RESPONDER_UNBOUND_CONSEQUENCE, "Repair the original delivery responder and inspect status; do not respawn agents merely because a responder was absent at that recorded pass."] }] : []),
|
|
96
149
|
// The leftover root-scoped record is named, never read as this space's verdict.
|
|
97
150
|
...("legacyRecordPresent" in data.renewal && data.renewal.legacyRecordPresent ? [{ kind: "lines", lines: [`This root also holds .cotal/renewal.json, a pre-per-space renewal record. It names no space, so it is not read as this space's verdict. ${displayCmd()} clean all --force removes it when this root is reset.`] }] : [])] },
|
|
98
|
-
...(data.items.some((row) => row.problem !== null || row.superseded) ? [{ title: "Inspect before changing identities", blocks: [{ kind: "table", columns: [{ key: "name", label: "Credential" }, { key: "finding", label: "Finding" }, { key: "next", label: "Native guidance" }], rows: data.items.filter((row) => row.problem !== null || row.superseded).slice(0, 200).map((row) => ({ name: row.label, finding: row.problem ?? "superseded in local credential family; not a broken-agent verdict", next: row.repair ?? "inspect the original file and authority" })) }] }] : []),
|
|
151
|
+
...(data.items.some((row) => row.problem !== null || row.warning !== null || row.superseded) ? [{ title: "Inspect before changing identities", blocks: [{ kind: "table", columns: [{ key: "name", label: "Credential" }, { key: "finding", label: "Finding" }, { key: "next", label: "Native guidance" }], rows: data.items.filter((row) => row.problem !== null || row.warning !== null || row.superseded).slice(0, 200).map((row) => ({ name: row.label, finding: row.problem ?? (row.warning !== null ? `warning: ${row.warning}` : "superseded in local credential family; not a broken-agent verdict"), next: row.repair ?? "inspect the original file and authority" })) }] }] : []),
|
|
99
152
|
] }));
|
|
100
153
|
}
|
|
101
|
-
|
|
154
|
+
/** `unparsable` names the daemon files the inventory read but the NATS client cannot parse. */
|
|
155
|
+
async function repairDoctorCredentials(root, auth, observed, unparsable) {
|
|
102
156
|
let target;
|
|
103
157
|
try {
|
|
104
158
|
target = resolveMeshTarget(root, { space: auth.space, readOnly: true });
|
|
@@ -122,7 +176,8 @@ async function repairDoctorCredentials(root, auth, observed) {
|
|
|
122
176
|
if (prior.state === "unreadable")
|
|
123
177
|
throw new CommandFailure("refused", "SCHEMA_INVALID", "the prior renewal record is unreadable; a possible broker refusal was not overwritten");
|
|
124
178
|
let results;
|
|
125
|
-
const
|
|
179
|
+
const reminted = new Set();
|
|
180
|
+
const retain = (rows) => { observed.results = rows.map((row) => ({ file: row.file, ok: row.ok === true, skipped: row.skipped !== undefined, reminted: reminted.has(row.file), reason: repairReason(row, reminted, unparsable) })); };
|
|
126
181
|
if (target) {
|
|
127
182
|
const uid = mintLifecycleUid(), identity = newIdentity();
|
|
128
183
|
const ep = new CotalEndpoint({ space: target.space, servers: target.server, tls: target.tlsRequired, creds: await mintCreds(auth, identity, "supervisor", { lifecycleUid: uid }), lifecycleUid: uid, channels: [], consume: false, registerPresence: false, watchPresence: false, watchChannels: false, card: { id: identity.id, name: "doctor-auth-fix", kind: "endpoint" } });
|
|
@@ -132,7 +187,7 @@ async function repairDoctorCredentials(root, auth, observed) {
|
|
|
132
187
|
await ep.start();
|
|
133
188
|
held = await ep.holdDaemonRenewalLease(`doctor:${hostname()}:${process.pid}`);
|
|
134
189
|
if (!held)
|
|
135
|
-
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", "another native renewal owner holds the lease; no daemon credential was re-signed");
|
|
190
|
+
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", "another native renewal owner holds the lease; no daemon credential was re-signed", { target: { root, space: auth.space }, remedy: `the renewal owner re-signs these credentials itself while it runs; for one that holds no key to re-sign, stop the stack with \`${displayCmd()} down\`, then run \`${displayCmd()} doctor auth --fix\`` });
|
|
136
191
|
observed.authority = "lease";
|
|
137
192
|
observed.attempted = true;
|
|
138
193
|
results = await remintDaemonCreds(root, auth.space, undefined, { preflight: async (creds) => (await probeConnect(target.server, { creds, tls: target.tlsRequired })).ok === true });
|
|
@@ -162,6 +217,18 @@ async function repairDoctorCredentials(root, auth, observed) {
|
|
|
162
217
|
observed.authority = "offline";
|
|
163
218
|
observed.attempted = true;
|
|
164
219
|
results = await remintDaemonCreds(root, auth.space);
|
|
220
|
+
// No broker answers, so no daemon runs on these files. One that holds no key to re-sign is minted
|
|
221
|
+
// again under a new identity, as `up` mints a missing one, once the store still reads it unparsable.
|
|
222
|
+
const store = workspaceSecretStore(root);
|
|
223
|
+
const still = new Set(await unparsableDaemonCreds(root, auth.space, store));
|
|
224
|
+
for (const [i, row] of results.entries()) {
|
|
225
|
+
const entry = REMINTABLE_DAEMON_CREDS.find((daemon) => daemon.kind === row.file);
|
|
226
|
+
if (row.ok || row.skipped !== undefined || !entry || !unparsable.has(row.file) || !still.has(row.file))
|
|
227
|
+
continue;
|
|
228
|
+
await store.put(entry.key(auth.space), await mintCreds(auth, newIdentity(), entry.profile));
|
|
229
|
+
results[i] = { file: row.file, ok: true };
|
|
230
|
+
reminted.add(row.file);
|
|
231
|
+
}
|
|
165
232
|
retain(results);
|
|
166
233
|
}
|
|
167
234
|
const adoption = prior.brokerAcceptance === "recorded-refusal" ? { ok: false, error: "re-signed locally by doctor auth --fix; the previous broker refusal remains unproven until the native renewal owner proves and adopts the generation" } : undefined;
|
|
@@ -185,17 +252,151 @@ function renewalObservation(root, space) {
|
|
|
185
252
|
return { ...absent, state: "unreadable", brokerAcceptance: "not-established", legacyRecordPresent: false };
|
|
186
253
|
}
|
|
187
254
|
}
|
|
255
|
+
/** The files `auth mint --out` wrote for this space from this root that are still there, with their
|
|
256
|
+
* expiry and, for one the broker refuses or soon will, the mint that replaces it. */
|
|
257
|
+
function exportedCredentials(root, auth) {
|
|
258
|
+
const cmd = displayCmd(), here = canonicalRoot(root), revocations = accountRevocations(auth.account.jwt);
|
|
259
|
+
const rows = [];
|
|
260
|
+
for (const { record: { value: entry } } of credentialExportStore(auth.space).list()) {
|
|
261
|
+
if (canonicalRoot(entry.root) !== here)
|
|
262
|
+
continue;
|
|
263
|
+
const row = { label: entry.label, profile: entry.profile, path: entry.path, state: "unreadable", issuedAt: null, expiresAt: null, revokedAt: null, repair: null };
|
|
264
|
+
let bytes;
|
|
265
|
+
try {
|
|
266
|
+
bytes = readLocalRecordSource(entry.path, 1024 * 1024, true);
|
|
267
|
+
}
|
|
268
|
+
catch {
|
|
269
|
+
try {
|
|
270
|
+
const stat = lstatSync(entry.path);
|
|
271
|
+
row.repair = stat.isFile() ? credentialFileExposure(entry.path, stat)?.remedy ?? null : null;
|
|
272
|
+
}
|
|
273
|
+
catch { /* reported unreadable */ }
|
|
274
|
+
rows.push(row);
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
// A file removed since is not listed.
|
|
278
|
+
if (!bytes)
|
|
279
|
+
continue;
|
|
280
|
+
let claims;
|
|
281
|
+
try {
|
|
282
|
+
claims = credsClaims(bytes.toString("utf8"));
|
|
283
|
+
}
|
|
284
|
+
catch {
|
|
285
|
+
rows.push(row);
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
const health = inspectCredHealth(bytes.toString("utf8"));
|
|
289
|
+
const profile = entry.profile === "agent" ? "" : ` --profile ${entry.profile}`;
|
|
290
|
+
// A new key holds only the grants its mint names, so the mint names the ones this file holds.
|
|
291
|
+
const grants = entry.profile === "agent" && claims.name === "agent" ? agentGrants(claims.nats ?? {}, auth.space) : undefined;
|
|
292
|
+
const fresh = `mint a new key${grants ? " with the grants this file holds" : ""}: \`${cmd} auth mint ${entry.label}${profile}${grants ? grantMintFlags(grants) : ""} --out <new file>\``;
|
|
293
|
+
const revokedAt = claims.sub === undefined ? undefined : revocations[claims.sub];
|
|
294
|
+
Object.assign(row, { state: health.state, issuedAt: claims.iat ?? null, expiresAt: claims.exp ?? null });
|
|
295
|
+
if ((claims.nats?.issuer_account ?? claims.iss) !== auth.account.pub)
|
|
296
|
+
Object.assign(row, { state: "other-account", repair: `the space's identity changed after it was written, so its broker refuses it; ${fresh}` });
|
|
297
|
+
else if (revokedAt !== undefined && (claims.iat === undefined || claims.iat <= revokedAt))
|
|
298
|
+
Object.assign(row, { state: "revoked", revokedAt, repair: `its key was revoked at ${at(revokedAt)}, and auth mint --identity refuses that key; ${fresh}` });
|
|
299
|
+
else if (health.state === "expired" || health.state === "near-expiry")
|
|
300
|
+
row.repair = `\`${cmd} auth mint ${entry.label}${profile} --identity ${entry.path} --out ${entry.path}\` signs the same key again${entry.profile === "agent" ? " with the same grants" : ""}`;
|
|
301
|
+
rows.push(row);
|
|
302
|
+
}
|
|
303
|
+
return rows.sort((x, y) => x.label.localeCompare(y.label) || x.path.localeCompare(y.path));
|
|
304
|
+
}
|
|
305
|
+
/** The heading of a run with no findings. It names what the run still asks of the operator, so it
|
|
306
|
+
* never reads as nothing to do while a warning or an exported file's repair is printed. */
|
|
307
|
+
function noFindingsTitle(items, exported) {
|
|
308
|
+
const attention = exported?.filter((row) => row.state !== "healthy" && row.state !== "unbounded").length ?? 0;
|
|
309
|
+
const unbounded = items.filter((row) => row.warning !== null).length;
|
|
310
|
+
const parts = [
|
|
311
|
+
...(attention ? [`${attention} exported credential ${attention === 1 ? "file needs" : "files need"} attention`] : []),
|
|
312
|
+
...(unbounded ? [`${unbounded} ${unbounded === 1 ? "credential has" : "credentials have"} no expiry by request`] : []),
|
|
313
|
+
...(exported === null ? ["the records of exported credential files could not be read"] : []),
|
|
314
|
+
];
|
|
315
|
+
return parts.length ? `No findings; ${parts.join("; ")}` : "No local credential findings";
|
|
316
|
+
}
|
|
188
317
|
function isRemintable(kind) {
|
|
189
318
|
return kind === "delivery" || kind === "membership-rw";
|
|
190
319
|
}
|
|
191
|
-
|
|
320
|
+
/** Why a `--fix` row is not a plain re-sign, or null for one that is. */
|
|
321
|
+
function repairReason(row, reminted, unparsable) {
|
|
322
|
+
if (reminted.has(row.file))
|
|
323
|
+
return "it held no key to re-sign";
|
|
324
|
+
if (row.skipped === "missing-file")
|
|
325
|
+
return `it is absent here, and \`${displayCmd()} up\` mints it`;
|
|
326
|
+
if (row.skipped === "no-auth")
|
|
327
|
+
return "no static trust here signs it";
|
|
328
|
+
if (row.ok)
|
|
329
|
+
return null;
|
|
330
|
+
if (unparsable.has(row.file))
|
|
331
|
+
return `it holds no key to re-sign, and its broker answers; stop the stack with \`${displayCmd()} down\`, then run \`${displayCmd()} doctor auth --fix\` again`;
|
|
332
|
+
return "it could not be re-signed, so the current file was kept";
|
|
333
|
+
}
|
|
334
|
+
/** The repair for a daemon file that holds no key: only a new identity replaces it. */
|
|
335
|
+
function daemonRemintRepair() {
|
|
336
|
+
const cmd = displayCmd();
|
|
337
|
+
return `it holds no key to re-sign, so the manager cannot renew it. While its broker does not answer, \`${cmd} doctor auth --fix\` mints it again under a new identity, as \`${cmd} up\` does for a missing one; stop a running stack with \`${cmd} down\` first`;
|
|
338
|
+
}
|
|
339
|
+
/** The repair for the $SYS pair, which nothing re-signs in place. A plain `down` + `up` does NOT
|
|
340
|
+
* touch these: `up` mints them only on the branch that CREATES the trust record, so re-upping an
|
|
341
|
+
* existing space reuses the same files and reports success. The rotation must be asked for. */
|
|
342
|
+
function systemRotationRepair() {
|
|
343
|
+
return `system-account rotation: \`${displayCmd()} down\` then \`${displayCmd()} up --rotate-sys\` re-mints the $SYS material (the space, its agents, its creds and its data are untouched)`;
|
|
344
|
+
}
|
|
345
|
+
/** A credential file that is absent. Only the $SYS pair is a finding then, once the space has its
|
|
346
|
+
* trust: `up` mints the other two when they are missing, and nothing but a rotation mints these. */
|
|
347
|
+
function missingReport(label, kind, path, sysPub) {
|
|
348
|
+
if (sysPub === undefined || (kind !== "membership-observer" && kind !== "connection-evictor"))
|
|
349
|
+
return { label, kind, path };
|
|
350
|
+
return { label, kind, path, problem: `missing - ${kind === "membership-observer" ? "the membership feed" : "live connection eviction"} cannot run without it`, repair: systemRotationRepair() };
|
|
351
|
+
}
|
|
352
|
+
function agentRepair(path, family, space, grants, profile) {
|
|
192
353
|
if (family?.role === "superseded")
|
|
193
354
|
return `an older local incarnation file exists at ${path}; inspect its exact lifecycle and owner before removing it. File ordering alone proves no live successor. Do not respawn an agent from this finding`;
|
|
355
|
+
const replace = standingReplace(path, space, grants, profile);
|
|
356
|
+
// An observer or admin credential is no agent a manager runs.
|
|
357
|
+
if (replace && mintedProfile(profile))
|
|
358
|
+
return `if \`${displayCmd()} auth mint\` wrote it, replace it with ${replace}`;
|
|
359
|
+
if (replace)
|
|
360
|
+
return `if a manager runs this agent, inspect this original lifecycle under it; supported managed renewal can re-sign the same nkey without a replacement. If \`${displayCmd()} auth mint\` wrote it, replace it with ${replace}. Do not spawn another agent only because a local file expired`;
|
|
194
361
|
return `inspect this original lifecycle under its manager; supported managed renewal can re-sign the same nkey without a replacement. Do not spawn another agent only because a local file expired`;
|
|
195
362
|
}
|
|
363
|
+
/** The `--profile` an `auth mint` needs to mint a credential of this profile again, where it is not
|
|
364
|
+
* the default agent one. */
|
|
365
|
+
function mintedProfile(profile) {
|
|
366
|
+
return profile === "observer" || profile === "admin" ? profile : undefined;
|
|
367
|
+
}
|
|
368
|
+
/** The `auth mint --replace` that replaces a standing `<label>.creds`, with the lifetime it gets. It
|
|
369
|
+
* mints a new key, which holds only the profile and grants its mint names, so it names the ones the
|
|
370
|
+
* file holds. An incarnation file, `<alias>.<lifecycleUid>.creds`, is no label's standing credential. */
|
|
371
|
+
function standingReplace(path, space, grants, profile) {
|
|
372
|
+
const label = basename(path);
|
|
373
|
+
if (space === undefined || !label.endsWith(".creds") || incarnationUidOf(label) !== undefined)
|
|
374
|
+
return undefined;
|
|
375
|
+
const flag = mintedProfile(profile);
|
|
376
|
+
return `\`${displayCmd()} auth mint ${aliasOf(label)} --replace --space ${space}${flag ? ` --profile ${flag}` : ""}${grants ? grantMintFlags(grants) : ""}\`, which lasts 24 hours unless --expires-in <seconds> or --expires-at <unix-seconds> sets another time`;
|
|
377
|
+
}
|
|
378
|
+
/** The repair for an agent file whose key was revoked. A revoked key is never signed again, so a
|
|
379
|
+
* label's standing file is replaced under a new key that holds the grants this one did, and any
|
|
380
|
+
* other agent file belongs to an agent to stop. */
|
|
381
|
+
function revokedAgentRepair(path, space, grants, profile) {
|
|
382
|
+
const replace = standingReplace(path, space, grants, profile);
|
|
383
|
+
if (!replace)
|
|
384
|
+
return "a revoked key is not signed again; stop or despawn the agent that uses this file";
|
|
385
|
+
return `a revoked key is not signed again, so replace it with a new key${grants ? " that holds the grants this file holds" : ""}: ${replace}`;
|
|
386
|
+
}
|
|
196
387
|
function agentUnrenewableRepair() {
|
|
197
388
|
return "native renewal skips unbounded or unreadable material; inspect the exact lifecycle and authority before choosing an explicit replacement. This diagnosis does not prove the agent is stopped or authorize a blind respawn";
|
|
198
389
|
}
|
|
390
|
+
/** The two ways out for an agent credential with no expiry: rotating the space identity retires it
|
|
391
|
+
* with everything the space issued, and a bounded replacement ends it. A label's standing file is
|
|
392
|
+
* replaced with `auth mint --replace`, which also drops its no-expiry record; any other file, and
|
|
393
|
+
* the record beside it, are removed first. */
|
|
394
|
+
function agentUnboundedRepair(path, space, record, grants, profile) {
|
|
395
|
+
const cmd = displayCmd();
|
|
396
|
+
const replace = standingReplace(path, space, grants, profile);
|
|
397
|
+
const bound = replace ? `stop what uses it, then replace it with ${replace}` : `stop what uses it, remove ${path}${record ? ` and ${record}` : ""} and mint a replacement without --no-expiry, which lasts 24 hours unless --expires-in <seconds> or --expires-at <unix-seconds> sets another time`;
|
|
398
|
+
return `native renewal skips unbounded material. Revoke it and keep the store: \`${cmd} down\`, \`${cmd} auth revoke-credential ${path} --yes\`, then \`${cmd} up\`. Or bound it: ${bound}; a copy made before stays valid until it is revoked. To retire every credential the space issued, rotate the space identity: \`${cmd} down\`, \`${cmd} reset space ${space}\`, then \`${cmd} up\`; the reset also removes the space's store, with its ${storeContentsText(STORE_CONTENTS)}. This diagnosis does not prove the agent is stopped or authorize a blind respawn`;
|
|
399
|
+
}
|
|
199
400
|
/** Classify every `agent` file by alias family, so a superseded incarnation is never reported as a
|
|
200
401
|
* broken fleet (#1576 ask 3).
|
|
201
402
|
*
|
|
@@ -264,7 +465,7 @@ function aliasOf(label) {
|
|
|
264
465
|
/** Inspect every managed credential file for this folder. Missing files are noted (with how they
|
|
265
466
|
* get provisioned) but only EXISTING-but-bad material is a problem — process presence is `cotal
|
|
266
467
|
* status`'s job; this surface owns credential health. */
|
|
267
|
-
function inventory(root, space, sysPub, readOnly = false, onMigrated) {
|
|
468
|
+
function inventory(root, space, sysPub, readOnly = false, onMigrated, revocations = {}) {
|
|
268
469
|
// Through the choke point, not a hand-composed `.cotal/<file>` (P7 §2 rule 1). The four kinds are
|
|
269
470
|
// per-space now, and a diagnosis that read the canonical location past an unmigrated copy would
|
|
270
471
|
// report every one of them "missing" on a root `up` has not re-provisioned — the worst possible
|
|
@@ -289,7 +490,7 @@ function inventory(root, space, sysPub, readOnly = false, onMigrated) {
|
|
|
289
490
|
const agentDir = agentCredsDir(root, space, { readOnly, onMigrated });
|
|
290
491
|
if (existsSync(agentDir)) {
|
|
291
492
|
for (const f of readdirSync(agentDir).filter((f) => f.endsWith(".creds") && !f.endsWith(".sentinel.creds")).sort()) {
|
|
292
|
-
reports.push(report(basename(f), "agent", join(agentDir, f)));
|
|
493
|
+
reports.push(report(basename(f), "agent", join(agentDir, f), undefined, undefined, undefined, space, revocations));
|
|
293
494
|
}
|
|
294
495
|
}
|
|
295
496
|
// SECOND PASS over the agent files (#1576). Supersession is a property of an alias's FAMILY, not of
|
|
@@ -297,21 +498,24 @@ function inventory(root, space, sysPub, readOnly = false, onMigrated) {
|
|
|
297
498
|
// exactly why the old single pass reported 15 leftovers as a broken fleet. Now each family is
|
|
298
499
|
// classified once every member is known, and the affected rows are re-derived with that role.
|
|
299
500
|
const roles = classifyAgentFamilies(reports);
|
|
300
|
-
return reports.map((r) => r.kind === "agent" && r.health ? report(r.label, r.kind, r.path, undefined, undefined, { role: roles.get(r.label) ?? "sole" }) : r);
|
|
501
|
+
return reports.map((r) => r.kind === "agent" && r.health ? report(r.label, r.kind, r.path, undefined, undefined, { role: roles.get(r.label) ?? "sole" }, space, revocations) : r);
|
|
301
502
|
}
|
|
302
|
-
function report(label, kind, path, sysPub, stale, live) {
|
|
503
|
+
function report(label, kind, path, sysPub, stale, live, space, revocations = {}) {
|
|
303
504
|
let health;
|
|
304
505
|
// A cause the operator can act on, reported in place of the generic parse finding. Its text is
|
|
305
506
|
// fixed and never quotes the file.
|
|
306
507
|
let named;
|
|
508
|
+
let bytes;
|
|
509
|
+
let unparsable = false;
|
|
307
510
|
try {
|
|
308
|
-
|
|
511
|
+
bytes = readLocalRecordSource(path, 1024 * 1024, true);
|
|
309
512
|
if (!bytes)
|
|
310
|
-
return
|
|
513
|
+
return missingReport(label, kind, path, sysPub);
|
|
311
514
|
const creds = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
312
515
|
// The NATS client's own parse, the check `--creds` makes, so a file whose claims are legible but
|
|
313
516
|
// that the client cannot present is not called healthy.
|
|
314
517
|
const unusable = credsProblem(creds);
|
|
518
|
+
unparsable = unusable !== undefined;
|
|
315
519
|
if (unusable)
|
|
316
520
|
named = { problem: `the NATS client cannot parse it: ${unusable.message}`, ...(unusable.code === "crlf" ? { repair: `save it with LF line endings, for example with \`dos2unix ${path}\`` } : {}) };
|
|
317
521
|
health = unusable ? { state: "unreadable", error: unusable.message } : inspectCredHealth(creds);
|
|
@@ -330,19 +534,22 @@ function report(label, kind, path, sysPub, stale, live) {
|
|
|
330
534
|
}
|
|
331
535
|
if (exposure)
|
|
332
536
|
named = { problem: `the credential file ${exposure.reason}`, repair: exposure.remedy };
|
|
537
|
+
// Bytes that were read and then failed to decode are unparsable; a refused read is not.
|
|
538
|
+
unparsable = bytes !== undefined && exposure === undefined;
|
|
333
539
|
health = { state: "unreadable", error: "protected credential could not be read or parsed" };
|
|
334
540
|
}
|
|
335
|
-
const r = { label, kind, path, health };
|
|
541
|
+
const r = { label, kind, path, health, unparsable };
|
|
542
|
+
// An agent file's own claims: its grants, which a replacement under a new key holds only if its
|
|
543
|
+
// mint names them, and its key, which a revocation names.
|
|
544
|
+
const claims = kind === "agent" && health.state !== "unreadable" && bytes ? credsClaims(bytes.toString("utf8")) : undefined;
|
|
545
|
+
const grants = claims?.name === "agent" && space !== undefined ? agentGrants(claims.nats ?? {}, space) : undefined;
|
|
336
546
|
const policy = credentialLifetime(kind);
|
|
337
547
|
const standing = policy.class === "standing-renewable" || policy.class === "rotation-renewed";
|
|
338
548
|
const repair = isRemintable(kind)
|
|
339
549
|
? `${displayCmd()} doctor auth --fix (or start the mesh's manager - it is the renewal owner and re-signs + reloads these every half-TTL)`
|
|
340
550
|
: kind === "agent"
|
|
341
|
-
? agentRepair(path, live)
|
|
342
|
-
|
|
343
|
-
// branch that CREATES the trust record, so re-upping an existing space reuses the same
|
|
344
|
-
// expired files and reports success. The rotation must be asked for.
|
|
345
|
-
: `system-account rotation: \`${displayCmd()} down\` then \`${displayCmd()} up --rotate-sys\` re-mints the $SYS material (the space, its agents, its creds and its data are untouched)`;
|
|
551
|
+
? agentRepair(path, live, space, grants, claims?.name)
|
|
552
|
+
: systemRotationRepair();
|
|
346
553
|
// A $SYS cred is only usable if the system account that SIGNED it is the one the broker loads,
|
|
347
554
|
// i.e. the one in this root's trust record. Expiry alone cannot see a RETIRED issuer: a rotation
|
|
348
555
|
// that committed the record and then died leaves a file that is structurally valid and years from
|
|
@@ -355,12 +562,23 @@ function report(label, kind, path, sysPub, stale, live) {
|
|
|
355
562
|
r.repair = repair;
|
|
356
563
|
return r;
|
|
357
564
|
}
|
|
565
|
+
// The broker refuses a key the space's account revoked, so a file signed for it before then is dead
|
|
566
|
+
// however far off its expiry is, and nothing signs that key again.
|
|
567
|
+
if (claims && live?.role !== "superseded") {
|
|
568
|
+
const revokedAt = claims.sub === undefined ? undefined : revocations[claims.sub];
|
|
569
|
+
if (revokedAt !== undefined && (claims.iat === undefined || claims.iat <= revokedAt)) {
|
|
570
|
+
r.revokedAt = revokedAt;
|
|
571
|
+
r.problem = `REVOKED - its key ${claims.sub} was revoked at ${at(revokedAt)} with auth revoke-credential, so the broker refuses this credential`;
|
|
572
|
+
r.repair = revokedAgentRepair(path, space, grants, claims.name);
|
|
573
|
+
return r;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
358
576
|
switch (health.state) {
|
|
359
577
|
case "unreadable":
|
|
360
578
|
r.problem = named?.problem ?? "credential parsing failed; raw diagnostic omitted";
|
|
361
579
|
// Unreadable material cannot be re-signed, so the honest agent remedy here is the respawn
|
|
362
580
|
// the old code gave to every case — this is the ONE case it fitted.
|
|
363
|
-
r.repair = named?.repair ?? (kind === "agent" && live?.role !== "superseded" ? agentUnrenewableRepair() : repair);
|
|
581
|
+
r.repair = named?.repair ?? (kind === "agent" && live?.role !== "superseded" ? agentUnrenewableRepair() : unparsable && isRemintable(kind) ? daemonRemintRepair() : repair);
|
|
364
582
|
break;
|
|
365
583
|
case "expired":
|
|
366
584
|
// #1576 ASK 3. A SUPERSEDED incarnation is expected to be expired — that is what supersession
|
|
@@ -383,14 +601,23 @@ function report(label, kind, path, sysPub, stale, live) {
|
|
|
383
601
|
r.repair = repair;
|
|
384
602
|
}
|
|
385
603
|
break;
|
|
386
|
-
case "unbounded":
|
|
604
|
+
case "unbounded": {
|
|
605
|
+
// An agent credential `auth mint --no-expiry` asked for, whose record beside it names these
|
|
606
|
+
// bytes, is reported with the same ways out, but someone chose it, so it is no finding.
|
|
607
|
+
const requestedAt = kind === "agent" && live?.role !== "superseded" && space !== undefined && bytes ? noExpiryRequestedAt(path, bytes) : undefined;
|
|
608
|
+
if (requestedAt !== undefined) {
|
|
609
|
+
r.warning = `unbounded by request (auth mint --no-expiry, recorded ${requestedAt}) - a copy stays valid until it is revoked or the space identity rotates`;
|
|
610
|
+
r.repair = agentUnboundedRepair(path, space, noExpiryRecordPath(path), grants, claims?.name);
|
|
611
|
+
break;
|
|
612
|
+
}
|
|
387
613
|
// A credential with no expiry claim stays valid until its signer rotates, whatever its kind,
|
|
388
614
|
// so it is a finding even where no renewal owner bounds it.
|
|
389
615
|
r.problem = standing
|
|
390
616
|
? "unbounded standing credential (minted before the renewal slice) - a copied cred never dies"
|
|
391
|
-
: "unbounded credential (no expiry claim) - a
|
|
392
|
-
r.repair = kind === "agent" && live?.role !== "superseded" ?
|
|
617
|
+
: "unbounded credential (no expiry claim) - a copy stays valid until it is revoked or the space identity rotates";
|
|
618
|
+
r.repair = kind === "agent" && live?.role !== "superseded" && space !== undefined ? agentUnboundedRepair(path, space, undefined, grants, claims?.name) : repair;
|
|
393
619
|
break;
|
|
620
|
+
}
|
|
394
621
|
}
|
|
395
622
|
return r;
|
|
396
623
|
}
|