@cotal-ai/cli 0.90.1 → 0.92.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 +20 -0
- package/dist/chat/controller.d.ts.map +1 -0
- package/dist/chat/controller.js +132 -0
- package/dist/chat/controller.js.map +1 -0
- package/dist/chat/engine.d.ts +110 -0
- package/dist/chat/engine.d.ts.map +1 -0
- package/dist/chat/engine.js +224 -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 +166 -0
- package/dist/chat/frontend.js.map +1 -0
- package/dist/chat/native-session.d.ts +93 -0
- package/dist/chat/native-session.d.ts.map +1 -0
- package/dist/chat/native-session.js +389 -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 +35 -0
- package/dist/chat/picker.d.ts.map +1 -0
- package/dist/chat/picker.js +99 -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 +249 -0
- package/dist/chat/plain.js.map +1 -0
- package/dist/chat/session.d.ts +222 -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 +35 -0
- package/dist/chat/stdio-io.d.ts.map +1 -0
- package/dist/chat/stdio-io.js +176 -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 +401 -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 +217 -0
- package/dist/chat/view.d.ts.map +1 -0
- package/dist/chat/view.js +433 -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 +395 -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 +506 -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 +93 -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 +30 -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 +78 -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 +123 -32
- 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 +270 -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 +384 -117
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/endpoint-authoring.d.ts +6 -0
- package/dist/commands/endpoint-authoring.d.ts.map +1 -0
- package/dist/commands/endpoint-authoring.js +130 -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 +74 -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 +437 -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 +127 -0
- package/dist/commands/reset-space-apply.js.map +1 -0
- package/dist/commands/reset-store-apply.d.ts +35 -0
- package/dist/commands/reset-store-apply.d.ts.map +1 -0
- package/dist/commands/reset-store-apply.js +216 -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 +155 -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 +413 -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 +107 -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 +164 -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 +386 -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 +394 -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 +81 -21
- package/dist/commands/spawn.d.ts.map +1 -1
- package/dist/commands/spawn.js +254 -107
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/stack-down.d.ts +20 -0
- package/dist/commands/stack-down.d.ts.map +1 -0
- package/dist/commands/stack-down.js +313 -0
- package/dist/commands/stack-down.js.map +1 -0
- package/dist/commands/stack-up.d.ts +154 -0
- package/dist/commands/stack-up.d.ts.map +1 -0
- package/dist/commands/stack-up.js +498 -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 +244 -5
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +1044 -407
- 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 +728 -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 +146 -6
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +1123 -131
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/update.d.ts +13 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +90 -22
- 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 +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +446 -119
- 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 +41 -1
- package/dist/lib/backup-artifact.d.ts.map +1 -1
- package/dist/lib/backup-artifact.js +96 -22
- package/dist/lib/backup-artifact.js.map +1 -1
- package/dist/lib/broker-service.d.ts +19 -0
- package/dist/lib/broker-service.d.ts.map +1 -0
- package/dist/lib/broker-service.js +369 -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/confirmation-required.d.ts +13 -0
- package/dist/lib/confirmation-required.d.ts.map +1 -0
- package/dist/lib/confirmation-required.js +10 -0
- package/dist/lib/confirmation-required.js.map +1 -0
- 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 +29 -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 +44 -23
- 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 +23 -0
- package/dist/lib/endpoint-client.d.ts.map +1 -0
- package/dist/lib/endpoint-client.js +46 -0
- package/dist/lib/endpoint-client.js.map +1 -0
- package/dist/lib/endpoint-errors.d.ts +20 -0
- package/dist/lib/endpoint-errors.d.ts.map +1 -0
- package/dist/lib/endpoint-errors.js +46 -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 +202 -0
- package/dist/lib/reset-space-plan.js.map +1 -0
- package/dist/lib/restore.d.ts +13 -1
- package/dist/lib/restore.d.ts.map +1 -1
- package/dist/lib/restore.js +73 -11
- 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 +139 -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 +146 -0
- package/dist/lib/service-process.d.ts.map +1 -0
- package/dist/lib/service-process.js +862 -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/shown-time.d.ts +5 -0
- package/dist/lib/shown-time.d.ts.map +1 -0
- package/dist/lib/shown-time.js +9 -0
- package/dist/lib/shown-time.js.map +1 -0
- 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 +166 -0
- package/dist/lib/stack-journal.d.ts.map +1 -0
- package/dist/lib/stack-journal.js +421 -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/stdout-owner.d.ts +17 -0
- package/dist/lib/stdout-owner.d.ts.map +1 -0
- package/dist/lib/stdout-owner.js +44 -0
- package/dist/lib/stdout-owner.js.map +1 -0
- 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 +3 -0
- package/dist/lib/up-report.d.ts.map +1 -1
- package/dist/lib/up-report.js +4 -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/managed-handoff.d.ts +3 -0
- package/dist/managed-handoff.d.ts.map +1 -1
- package/dist/managed-handoff.js +5 -0
- package/dist/managed-handoff.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 +10 -2
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +28 -6
- 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 +132 -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
|
@@ -0,0 +1,728 @@
|
|
|
1
|
+
import { basename, join, resolve } from "node:path";
|
|
2
|
+
import { CotalEndpoint, DEFAULT_SERVER, isReachable, realDirNoSymlink, subjectMatches } from "@cotal-ai/core";
|
|
3
|
+
import { assertSingleSpaceBroker, recordOperationSpace, authDir, CommandFailure, credentialRefusalMessage, brokerAddressForDisplay, canonicalRoot, connectOrThrow, findMesh, findPreparedSpace, jsonFlag, loadMeshes, localMeshesForRoot, plainFlag, presentationOf, readMaintenanceJournal, spaceFlag, userViewAuth, writeResult } from "@cotal-ai/workspace";
|
|
4
|
+
import { personaCatalog } from "../lib/persona-files.js";
|
|
5
|
+
import { loadManifest } from "../lib/manifest/index.js";
|
|
6
|
+
import { findLedgerByRun, listLedgerFiles } from "../lib/manifest/ledger.js";
|
|
7
|
+
import { findFreshTeamAttempt, findFreshTeamSummary, freshTeamAttemptSettled, listFreshTeamAttempts, listFreshTeamSummaries } from "../lib/team-fresh.js";
|
|
8
|
+
import { additiveTeamRecordedState, findAdditiveTeamAttempt, listAdditiveTeamAttempts, removedAdditiveDeploymentIds } from "../lib/team-additive-attempt.js";
|
|
9
|
+
import { completedFlagValue, completingFlagValue, positionalsForCompletion } from "../lib/completion.js";
|
|
10
|
+
import { inspectTeamDeployment, readOwnedChannelRevisions } from "../lib/team-deploy-inspection.js";
|
|
11
|
+
import { managerRecordState } from "../lib/manager-proc.js";
|
|
12
|
+
import { readLocalServiceCensus } from "../lib/service-census.js";
|
|
13
|
+
import { liveMeshProcesses } from "./clean.js";
|
|
14
|
+
import { preparedUpRoot, recordedBrokerTransport } from "./up.js";
|
|
15
|
+
import { controllerTeamBoot } from "./team-boot-controller.js";
|
|
16
|
+
import { applyChannelOnlyTeam } from "./team-deploy-apply.js";
|
|
17
|
+
export const teamFlags = [spaceFlag, jsonFlag, plainFlag,
|
|
18
|
+
{ name: "graph", type: "boolean", description: "check: show effective channel and capability access from merged manifest/persona policy" },
|
|
19
|
+
{ name: "dry-run", type: "boolean", description: "boot: preview declaration; deploy/remove: read native diagnostics without effects" },
|
|
20
|
+
{ name: "runtime", type: "string", value: "<name>", description: "deploy: require the selected manager's native runtime; channel-only apply refuses it" },
|
|
21
|
+
{ name: "allow-stale", type: "string", value: "<names>", description: "retained agents: keep named stale agents on their old policy without restarting; new/channel-only apply refuses it" },
|
|
22
|
+
{ name: "foreground", type: "boolean", description: "boot: hold the booted stack's lifetime in this terminal; Ctrl-C runs the guarded whole-stack stop" },
|
|
23
|
+
{ name: "yes", short: "y", type: "boolean", description: "remove: confirm recorded static agent retirement and unchanged channel-card removal, or record observed outcomes of an unsettled removal; not accepted with a preview" },
|
|
24
|
+
];
|
|
25
|
+
/** Completion reads the local space selection and its ledger directory, never the broker.
|
|
26
|
+
* An unreadable record cannot become a suggested target or trigger a provider. */
|
|
27
|
+
export function teamComplete(argv) {
|
|
28
|
+
const flag = completingFlagValue(argv, teamFlags);
|
|
29
|
+
if (flag?.name === "space")
|
|
30
|
+
return { items: loadMeshes().map((mesh) => ({ value: mesh.space })), directive: "nofiles" };
|
|
31
|
+
if (argv.at(-1)?.startsWith("-"))
|
|
32
|
+
return { items: teamFlags.map((item) => ({ value: `--${item.name}`, description: item.description })), directive: "nofiles" };
|
|
33
|
+
const positionals = positionalsForCompletion(argv, teamFlags);
|
|
34
|
+
if (positionals.length <= 1)
|
|
35
|
+
return { items: ["show", "check", "boot", "deploy", "remove"].map((value) => ({ value })), directive: "nofiles" };
|
|
36
|
+
if (positionals.length !== 2)
|
|
37
|
+
return { items: [], directive: "nofiles" };
|
|
38
|
+
if (positionals[0] === "check" || positionals[0] === "boot" || positionals[0] === "deploy")
|
|
39
|
+
return { items: [], directive: "default" };
|
|
40
|
+
if (positionals[0] !== "show" && positionals[0] !== "remove")
|
|
41
|
+
return { items: [], directive: "nofiles" };
|
|
42
|
+
try {
|
|
43
|
+
const { root, space } = personaCatalog({ space: completedFlagValue(argv, teamFlags, "space") });
|
|
44
|
+
const additive = listLedgerFiles(root).valid.filter(({ ledger }) => ledger.space === space).map(({ ledger }) => ({ value: ledger.runId, description: "recorded additive deployment" }));
|
|
45
|
+
const fresh = listFreshTeamSummaries(root).valid.filter((summary) => summary.space === space).map((summary) => ({ value: summary.deploymentId, description: "recorded fresh boot" }));
|
|
46
|
+
const freshIds = new Set(fresh.map((row) => row.value));
|
|
47
|
+
const intents = listFreshTeamAttempts(root).valid.filter((attempt) => attempt.space === space).map((attempt) => ({ value: attempt.deploymentId, description: "fresh boot attempt" }));
|
|
48
|
+
const additiveInventory = listAdditiveTeamAttempts(root);
|
|
49
|
+
const additiveIntents = additiveInventory.valid.filter((attempt) => attempt.space === space).map((attempt) => ({ value: attempt.deploymentId, description: additiveTeamRecordedState(attempt, additiveInventory).replaceAll("-", " ") }));
|
|
50
|
+
for (const intent of intents)
|
|
51
|
+
freshIds.add(intent.value);
|
|
52
|
+
const additiveAttemptIds = new Set(additiveIntents.map((row) => row.value));
|
|
53
|
+
if (positionals[0] === "remove") {
|
|
54
|
+
const removed = removedAdditiveDeploymentIds(additiveInventory);
|
|
55
|
+
const unsettledRemoval = (id) => additiveInventory.removal?.attempts.some((attempt) => attempt.deploymentId === id) && !additiveInventory.removal?.returned.some((row) => row.deploymentId === id)
|
|
56
|
+
|| additiveInventory.channelRemoval?.attempts.some((attempt) => attempt.deploymentId === id) && !additiveInventory.channelRemoval?.returned.some((row) => row.deploymentId === id);
|
|
57
|
+
return { items: [...additive.filter((row) => !freshIds.has(row.value) && !additiveAttemptIds.has(row.value)), ...additiveIntents.filter((row) => additiveInventory.returned.some((receipt) => receipt.deploymentId === row.value && (receipt.kind === "additive-channel-receipt" || receipt.authMode === "auth")) && !removed.has(row.value) && !freshIds.has(row.value) && !additive.some((legacy) => legacy.value === row.value)).map((row) => ({ ...row, description: unsettledRemoval(row.value) ? "unsettled removal; observation-only reconcile" : additiveInventory.returned.some((receipt) => receipt.deploymentId === row.value && receipt.kind === "additive-channel-receipt") ? "channel-only card removal; revision recheck required" : additiveInventory.returned.some((receipt) => receipt.deploymentId === row.value && receipt.kind === "additive-team-receipt") ? "static mixed removal; native and revision recheck required" : "static agent-only removal; native recheck required" }))], directive: "nofiles" };
|
|
58
|
+
}
|
|
59
|
+
const additiveIds = new Set(additive.map((row) => row.value));
|
|
60
|
+
return { items: [...fresh.filter((row) => !additiveIds.has(row.value) && !additiveAttemptIds.has(row.value)), ...intents.filter((row) => !additiveIds.has(row.value) && !additiveAttemptIds.has(row.value) && !fresh.some((summary) => summary.value === row.value)), ...additiveIntents.filter((row) => !freshIds.has(row.value) && !additiveIds.has(row.value)), ...additive.filter((row) => !freshIds.has(row.value) && !additiveAttemptIds.has(row.value))], directive: "nofiles" };
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return { items: [], directive: "nofiles" };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export function validateTeamArguments(args) {
|
|
67
|
+
presentationOf(args.values);
|
|
68
|
+
const [mode = "list", subject, ...extra] = args.positionals;
|
|
69
|
+
if (!["list", "show", "check", "boot", "deploy", "remove"].includes(mode) || extra.length || (mode === "list" ? subject !== undefined : !subject?.trim()))
|
|
70
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "use team, team show <deployment-id>, team check <file> [--graph], team boot <file> [--dry-run], team deploy <file> [--dry-run], or team remove <deployment-id> [--dry-run] [--yes]");
|
|
71
|
+
if (mode !== "check" && args.values.graph)
|
|
72
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "--graph belongs to team check");
|
|
73
|
+
if (!["boot", "deploy", "remove"].includes(mode) && args.values["dry-run"] !== undefined)
|
|
74
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "--dry-run belongs to team boot, deploy or remove in this source");
|
|
75
|
+
if (mode !== "deploy" && (args.values.runtime !== undefined || args.values["allow-stale"] !== undefined))
|
|
76
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "--runtime and --allow-stale belong to team deploy");
|
|
77
|
+
if (mode === "deploy" && args.values.runtime !== undefined && !String(args.values.runtime).trim())
|
|
78
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "--runtime needs a runtime name");
|
|
79
|
+
if (mode === "deploy" && args.values["dry-run"] === true && args.values["allow-stale"] !== undefined)
|
|
80
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "--allow-stale is apply-only and cannot be validated by a declaration-only preview");
|
|
81
|
+
if (mode !== "boot" && args.values.foreground !== undefined)
|
|
82
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "--foreground belongs to team boot");
|
|
83
|
+
if (mode === "boot" && args.values["dry-run"] !== true && args.values.foreground === true && (args.values.json === true || args.values.plain === true))
|
|
84
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "a foreground team boot keeps terminal custody and cannot produce a finite JSON or plain receipt");
|
|
85
|
+
if ((mode !== "remove" && args.values.yes !== undefined) || (mode === "remove" && args.values["dry-run"] === true && args.values.yes === true))
|
|
86
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "--yes belongs only to a real guarded team removal, not a read or dry-run");
|
|
87
|
+
if (mode === "remove" && !/^[a-f0-9]{16}$/.test(subject))
|
|
88
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "team remove requires the complete recorded 16-character deployment ID, not a manifest path or prefix");
|
|
89
|
+
if (mode === "show" && !/^[A-Za-z0-9_-]+$/.test(subject))
|
|
90
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "use the full recorded deployment ID, not a manifest path");
|
|
91
|
+
}
|
|
92
|
+
function recorded(root, ledger) {
|
|
93
|
+
return { deploymentId: ledger.runId, kind: "additive", space: ledger.space, root,
|
|
94
|
+
recordedState: "ownership-ledger-present", liveState: "not-checked", manifestPath: ledger.manifestPath,
|
|
95
|
+
channels: ledger.created.channels, agents: ledger.created.agents.map((agent) => ({ requested: agent.requested, name: agent.name, id: agent.id, lifecycleUid: agent.lifecycleUid ?? null })),
|
|
96
|
+
removalScope: "only ledger-owned resources after native ownership and live-incarnation checks",
|
|
97
|
+
nextAction: "review-scoped-native-teardown" };
|
|
98
|
+
}
|
|
99
|
+
/** One card removal step as `team show` names it. A reconciled observation never claims that the
|
|
100
|
+
* original delete executed. */
|
|
101
|
+
function cardStepText(phase) {
|
|
102
|
+
return phase === "deleted" ? "deleted at created revision" : phase === "absent" ? "already absent; remover unknown" : phase === "conflict" ? "card moved; not deleted"
|
|
103
|
+
: phase === "observed-removed" ? "removed after an unconfirmed delete; remover unknown" : phase === "observed-superseded" ? "replaced after an unconfirmed delete; not owned" : "delete submitted; outcome not implied";
|
|
104
|
+
}
|
|
105
|
+
function freshRecorded(summary) {
|
|
106
|
+
const responderMismatch = summary.deliveryResponderBound !== undefined && (summary.authMode === "open" ? summary.deliveryResponderBound !== null
|
|
107
|
+
: summary.authMode === "auth" || summary.authMode === "user" ? summary.deliveryResponderBound !== true : false);
|
|
108
|
+
return { deploymentId: summary.deploymentId, kind: "fresh", space: summary.space, root: summary.root,
|
|
109
|
+
recordedState: !summary.controlPlaneReturned || !summary.authServiceReturned || responderMismatch ? "broker-boot-degraded" : summary.authMode === undefined || summary.deliveryResponderBound === undefined ? "broker-boot-unverified" : "broker-boot-returned",
|
|
110
|
+
liveState: "not-checked", authMode: summary.authMode ?? null, brokerPid: summary.brokerPid ?? null, deliveryResponder: summary.deliveryResponderBound === undefined ? "not-recorded" : summary.deliveryResponderBound === null ? "not-required-open" : summary.deliveryResponderBound ? "bound-at-return" : "not-bound-at-return", manifestPath: summary.manifestPath, recordedAt: summary.recordedAt,
|
|
111
|
+
channels: summary.declaredChannels, agents: summary.requestedAgents.map((requested) => ({ requested, name: null, id: null, lifecycleUid: null })),
|
|
112
|
+
managerRequested: summary.managerRequested, controlPlaneReturned: summary.controlPlaneReturned, authServiceReturned: summary.authServiceReturned,
|
|
113
|
+
removalScope: "whole local stack only; this summary grants no stop authority, and bare down offers local-record inspection only",
|
|
114
|
+
nextAction: "inspect-selected-stack" };
|
|
115
|
+
}
|
|
116
|
+
export async function team(args) {
|
|
117
|
+
validateTeamArguments(args);
|
|
118
|
+
const values = args.values;
|
|
119
|
+
const [mode = "list", subject] = args.positionals;
|
|
120
|
+
if (mode === "check")
|
|
121
|
+
return checkTeam(subject, values);
|
|
122
|
+
if (mode === "boot")
|
|
123
|
+
return previewBoot(subject, values);
|
|
124
|
+
if (mode === "deploy")
|
|
125
|
+
return previewDeploy(subject, values);
|
|
126
|
+
if (mode === "remove")
|
|
127
|
+
return previewRemove(subject, values);
|
|
128
|
+
const catalog = personaCatalog(values);
|
|
129
|
+
recordOperationSpace(catalog.space);
|
|
130
|
+
if (mode === "show") {
|
|
131
|
+
let summary;
|
|
132
|
+
let additiveAttempt;
|
|
133
|
+
if (/^[a-f0-9]{16}$/.test(subject)) {
|
|
134
|
+
try {
|
|
135
|
+
summary = findFreshTeamSummary(catalog.root, subject);
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
throw new CommandFailure("refused", "SCHEMA_INVALID", "the fresh launch summary for this full ID is unreadable or does not match its recorded root; it was not treated as absent", { target: { space: catalog.space, deploymentId: subject } });
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
additiveAttempt = findAdditiveTeamAttempt(catalog.root, subject);
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
throw new CommandFailure("refused", "SCHEMA_INVALID", "the additive attempt for this full ID is unreadable or does not match its recorded root; its effects were not inferred", { target: { space: catalog.space, deploymentId: subject } });
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (summary && additiveAttempt)
|
|
148
|
+
throw new CommandFailure("refused", "CONFLICT", "a fresh summary and additive attempt share this deployment ID; neither establishes unique ownership authority");
|
|
149
|
+
if (summary) {
|
|
150
|
+
if (summary.space !== catalog.space)
|
|
151
|
+
throw new CommandFailure("refused", "CONFLICT", "this fresh launch summary belongs to another space; it was not rebound", { target: { recordedSpace: summary.space, selectedSpace: catalog.space, deploymentId: subject } });
|
|
152
|
+
let intent;
|
|
153
|
+
try {
|
|
154
|
+
intent = findFreshTeamAttempt(catalog.root, subject);
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
throw new CommandFailure("refused", "SCHEMA_INVALID", "the fresh boot intent for this summary is unreadable; its outcome was not inferred", { target: { space: catalog.space, deploymentId: subject } });
|
|
158
|
+
}
|
|
159
|
+
if (intent && (intent.space !== summary.space || intent.server !== summary.server || intent.authMode !== summary.authMode || intent.manifestPath !== summary.manifestPath))
|
|
160
|
+
throw new CommandFailure("refused", "CONFLICT", "the fresh boot intent and returned summary disagree on their target; no settled boot was inferred", { target: { space: catalog.space, deploymentId: subject } });
|
|
161
|
+
let ledgers;
|
|
162
|
+
try {
|
|
163
|
+
ledgers = listLedgerFiles(catalog.root);
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the additive ledger directory could not be safely read; the fresh run ID was not treated as unique");
|
|
167
|
+
}
|
|
168
|
+
if (ledgers.valid.some(({ ledger }) => ledger.runId === subject) || ledgers.refused.some(({ path }) => basename(path) === `${subject}.json`))
|
|
169
|
+
throw new CommandFailure("refused", "CONFLICT", "fresh and additive records claim the same deployment ID; neither was used as teardown authority");
|
|
170
|
+
const row = freshRecorded(summary);
|
|
171
|
+
writeResult(presentationOf(values), { command: "team", target: { space: row.space, root: row.root, deploymentId: row.deploymentId }, result: row,
|
|
172
|
+
...(row.recordedState !== "broker-boot-returned" ? { completeness: "partial", partial: { message: "The fresh boot summary did not verify every returned startup component, or predates delivery-responder observation; this record proves no current ownership." } } : {}) }, (data) => ({ sections: [
|
|
173
|
+
{ title: "Recorded fresh boot", blocks: [{ kind: "fields", rows: [["Deployment", data.deploymentId], ["Kind", data.kind], ["Space", data.space], ["Root", data.root], ["Initial broker PID", data.brokerPid === null ? "not recorded" : String(data.brokerPid)], ["Auth mode", data.authMode ?? "not recorded"], ["Recorded state", data.recordedState], ["Next action", data.nextAction], ["Manager requested", data.managerRequested ? "yes" : "no (broker-only)"], ["Control-plane ensure", data.controlPlaneReturned ? "returned" : "did not confirm return"], ["Auth-service command", data.authServiceReturned ? "returned or not required" : "did not confirm return"], ["Delivery responder", data.deliveryResponder.replaceAll("-", " ")], ["Requested agent readiness", "not checked"], ["Live state", "not checked"], ["Source context", data.manifestPath]] }] },
|
|
174
|
+
{ title: "Declared at boot", blocks: [
|
|
175
|
+
{ kind: "fields", rows: [["Requested agents", String(data.agents.length)], ["Declared channels", String(data.channels.length)]] },
|
|
176
|
+
{ kind: "lines", lines: data.agents.length ? data.agents.slice(0, 100).map((agent) => `requested agent ${agent.requested} (allocation not checked)`) : ["No agents requested in this fresh boot."] },
|
|
177
|
+
{ kind: "lines", lines: data.channels.length ? data.channels.slice(0, 100).map((channel) => `declared #${channel}`) : ["No channels declared in this fresh boot."] },
|
|
178
|
+
...((data.agents.length > 100 || data.channels.length > 100) ? [{ kind: "lines", lines: ["Additional declared names are not shown; JSON retains the full summary."] }] : []),
|
|
179
|
+
{ kind: "lines", lines: [{ text: "The requested agent names are not allocated identities. A returned boot command does not prove current broker health, agent joins or retained ownership.", tone: "hint" }] },
|
|
180
|
+
] },
|
|
181
|
+
{ title: "Next", blocks: [{ kind: "commands", items: [{ command: "cotal down --space <recorded-space> --dry-run", description: "From the recorded root, inspect local process records without a stop" }] }, { kind: "lines", lines: [`Whole-stack apply from ${data.root} remains unguarded in this source. The preview is incomplete and this summary authorizes no stop.`] }] },
|
|
182
|
+
] }));
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
let attempt;
|
|
186
|
+
if (/^[a-f0-9]{16}$/.test(subject)) {
|
|
187
|
+
try {
|
|
188
|
+
attempt = findFreshTeamAttempt(catalog.root, subject);
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
throw new CommandFailure("refused", "SCHEMA_INVALID", "the fresh boot attempt for this full ID is unreadable or does not match its recorded root; no completed boot was inferred", { target: { space: catalog.space, deploymentId: subject } });
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (attempt) {
|
|
195
|
+
if (additiveAttempt)
|
|
196
|
+
throw new CommandFailure("refused", "CONFLICT", "a fresh boot and additive attempt share this deployment ID; neither establishes unique ownership authority");
|
|
197
|
+
if (attempt.space !== catalog.space)
|
|
198
|
+
throw new CommandFailure("refused", "CONFLICT", "this fresh boot attempt belongs to another space; it was not rebound", { target: { recordedSpace: attempt.space, selectedSpace: catalog.space, deploymentId: subject } });
|
|
199
|
+
let ledgers;
|
|
200
|
+
try {
|
|
201
|
+
ledgers = listLedgerFiles(catalog.root, { requireReadable: true });
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the additive ledger directory could not be read; this attempt ID was not treated as unique");
|
|
205
|
+
}
|
|
206
|
+
if (ledgers.valid.some(({ ledger }) => ledger.runId === subject) || ledgers.refused.some(({ path }) => basename(path) === `${subject}.json`))
|
|
207
|
+
throw new CommandFailure("refused", "CONFLICT", "fresh attempt and additive record claim the same deployment ID; neither grants ownership authority");
|
|
208
|
+
writeResult(presentationOf(values), { command: "team", target: { space: attempt.space, root: attempt.root, deploymentId: attempt.deploymentId }, result: { ...attempt, kind: "fresh-team-attempt", server: brokerAddressForDisplay(attempt.server) ?? "not displayable", intentPath: join(catalog.root, ".cotal", `team-boot-attempt-${attempt.deploymentId}.json`), launchSpecCandidate: join(catalog.root, ".cotal", "run", `${attempt.deploymentId}.json`), recordedState: "no-matching-summary", nativeOutcome: "unknown", effectAttempted: "not-established" }, completeness: "partial", partial: { message: "A durable fresh boot intent has no matching summary. The launch spec, broker and control plane may have changed; this is not a retry or stop authorization." } }, (data) => ({ sections: [{ title: "Unsettled fresh boot attempt", blocks: [{ kind: "fields", rows: [["Deployment", data.deploymentId], ["Space", data.space], ["Root", data.root], ["Broker", data.server], ["Manifest", data.manifestPath], ["Intent file", data.intentPath], ["Launch spec candidate", data.launchSpecCandidate], ["Intent recorded", data.createdAt], ["Native outcome", "unknown"]] }, { kind: "lines", lines: ["The launch spec path is derived from the run ID, not read or verified. Inspect the original listener and local custody. A missing summary is not proof that the broker never started."] }] }] }));
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
if (additiveAttempt) {
|
|
212
|
+
if (additiveAttempt.space !== catalog.space)
|
|
213
|
+
throw new CommandFailure("refused", "CONFLICT", "this additive attempt belongs to another space; it was not rebound", { target: { recordedSpace: additiveAttempt.space, selectedSpace: catalog.space, deploymentId: subject } });
|
|
214
|
+
let ledgers;
|
|
215
|
+
try {
|
|
216
|
+
ledgers = listLedgerFiles(catalog.root, { requireReadable: true });
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the additive ledger directory could not be read; an attempt was not treated as settled");
|
|
220
|
+
}
|
|
221
|
+
if (ledgers.valid.some(({ ledger }) => ledger.runId === subject) || ledgers.refused.some(({ path }) => basename(path) === `${subject}.json`))
|
|
222
|
+
throw new CommandFailure("refused", "CONFLICT", "an additive intent and legacy ledger share this ID, but no revision-bound settlement links them; no ownership was inferred");
|
|
223
|
+
let inventory;
|
|
224
|
+
try {
|
|
225
|
+
inventory = listAdditiveTeamAttempts(catalog.root);
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the additive step inventory could not be read; no native outcome was inferred");
|
|
229
|
+
}
|
|
230
|
+
const steps = inventory.steps.filter((step) => step.deploymentId === subject);
|
|
231
|
+
const unreadableSteps = inventory.refused.filter(({ path }) => basename(path).startsWith(`team-deploy-step-${subject}-`) || basename(path) === `team-deploy-attempt-${subject}-returned.json`).map(({ path }) => path);
|
|
232
|
+
const receipt = inventory.returned.find((row) => row.deploymentId === subject);
|
|
233
|
+
if (additiveAttempt.requestedAgents.length) {
|
|
234
|
+
const agentSteps = inventory.agentSteps.filter((step) => step.deploymentId === subject);
|
|
235
|
+
const agentReceipt = receipt && receipt.kind !== "additive-channel-receipt" ? receipt : null;
|
|
236
|
+
const mixed = additiveAttempt.declaredChannels.length > 0;
|
|
237
|
+
const removalReceipt = inventory.removal?.returned.find((row) => row.deploymentId === subject) ?? null;
|
|
238
|
+
const removalAttempt = inventory.removal?.attempts.find((row) => row.deploymentId === subject) ?? null;
|
|
239
|
+
const removalSteps = inventory.removal?.steps.filter((row) => row.deploymentId === subject) ?? [];
|
|
240
|
+
const cardRemoval = mixed ? { receipt: inventory.channelRemoval?.returned.find((row) => row.deploymentId === subject) ?? null, attempt: inventory.channelRemoval?.attempts.find((row) => row.deploymentId === subject) ?? null, steps: inventory.channelRemoval?.steps.filter((row) => row.deploymentId === subject) ?? [] } : null;
|
|
241
|
+
const data = { ...additiveAttempt, server: brokerAddressForDisplay(additiveAttempt.server) ?? "not displayable", kind: mixed ? "additive-mixed-deployment" : "additive-agent-deployment", recordedState: additiveTeamRecordedState(additiveAttempt, inventory), agentSteps, steps, removalReceipt, removalAttempt, removalSteps, cardRemoval, remainingRemovalPhase: !removalAttempt ? null : !removalReceipt ? "agent-retirement" : mixed && !cardRemoval?.receipt ? "card-removal" : null, receipt: agentReceipt ? { ...agentReceipt, server: brokerAddressForDisplay(agentReceipt.server) ?? "not displayable" } : null, unreadableSteps: [...new Set([...unreadableSteps, ...inventory.refused.filter(({ path }) => basename(path).startsWith(`team-deploy-agent-step-${subject}-`) || basename(path).startsWith("team-remove-") && basename(path).includes(subject) || basename(path).startsWith("team-channel-remove-") && basename(path).includes(subject)).map(({ path }) => path)])], currentState: "not-rechecked" };
|
|
242
|
+
writeResult(presentationOf(values), { command: "team", target: { space: data.space, root: data.root, deploymentId: data.deploymentId }, result: data, completeness: "partial", partial: { message: removalReceipt ? "All original static agent incarnations have matched native retired slot/head and cleanup receipts. Current alias holders are not rechecked, and the receipt authorizes no further stop." : agentReceipt ? "Declared channel creates and native launch joins have matching historical receipts. Current health, readers and permission to remove an incarnation are not established." : "The original intent and steps do not settle every channel create and launch. A missing acceptance or terminal does not authorize another submission." } }, (row) => ({ sections: [
|
|
243
|
+
{ title: agentReceipt ? "Returned additive team" : "Unsettled additive team", blocks: [{ kind: "fields", rows: [["Deployment", row.deploymentId], ["Root", row.root], ["Manager", row.managerInstanceId ?? "not recorded"], ["Recorded state", row.recordedState], ["Requested agents", String(row.requestedAgents.length)], ["Joined receipts", row.receipt ? String(row.receipt.createdAgents.length) : "incomplete"], ["Declared channels", String(row.declaredChannels.length)], ["Channel create receipts", row.receipt ? String(row.receipt.createdChannels.length) : "incomplete"], ["Current state", row.currentState]] }] },
|
|
244
|
+
...(row.receipt ? [{ title: "Original joined identities", blocks: [{ kind: "table", columns: [{ key: "requested", label: "Declared" }, { key: "name", label: "Allocated" }, { key: "id", label: "Identity" }, { key: "goal", label: "Accepted goal" }], rows: row.receipt.createdAgents.slice(0, 100).map((agent) => ({ requested: agent.requested, name: agent.name, id: agent.id, goal: agent.request.goalId })) }, ...(row.receipt.createdAgents.length > 100 ? [{ kind: "lines", lines: ["Additional joined identities are in JSON."] }] : [])] }] : [{ title: "Native launch journal", blocks: [{ kind: "table", columns: [{ key: "name", label: "Declared" }, { key: "phase", label: "Phase" }, { key: "request", label: "Original request" }, { key: "goal", label: "Accepted goal" }], rows: row.agentSteps.slice(0, 100).map((step) => ({ name: step.name, phase: step.phase, request: step.requestId, goal: step.request?.goalId ?? "not returned" })) }, { kind: "lines", lines: [...(row.agentSteps.length > 100 ? ["Additional native steps are in JSON."] : []), "Do not retry an unknown launch or infer a fresh incarnation from a reused name."] }] }]),
|
|
245
|
+
...(row.declaredChannels.length ? [{ title: row.receipt ? "Created channel receipts" : "Native channel journal", blocks: [{ kind: "table", columns: [{ key: "name", label: "Channel" }, { key: "phase", label: "Phase" }, { key: "revision", label: "Returned revision" }], rows: row.receipt ? row.receipt.createdChannels.slice(0, 100).map((channel) => ({ name: `#${channel.name}`, phase: "accepted", revision: String(channel.revision) })) : row.steps.slice(0, 100).map((step) => ({ name: `#${step.name}`, phase: step.phase, revision: step.phase === "accepted" ? String(step.revision) : "not returned" })) }, { kind: "lines", lines: [...((row.receipt ? row.receipt.createdChannels.length : row.steps.length) > 100 ? ["Additional channel records are in JSON."] : []), "Returned revisions do not prove current cards or exclusive readers."] }] }] : []),
|
|
246
|
+
...(row.removalAttempt ? [{ title: row.removalReceipt ? "Recorded native retirements" : "Unsettled removal journal", blocks: [{ kind: "fields", rows: [["Full removal receipt", row.removalReceipt ? "recorded" : "not confirmed"], ["Original-receipt binding", row.removalAttempt.originalReceiptDigest]] }, { kind: "table", columns: [{ key: "name", label: "Original agent" }, { key: "phase", label: "Observation" }, { key: "request", label: "Stop request" }, { key: "revisions", label: "Slot / head revisions" }], rows: row.removalSteps.map((step) => ({ name: step.phase === "retired" ? step.observation.name : row.receipt?.createdAgents[step.ordinal]?.name ?? row.requestedAgents[step.ordinal] ?? "not recorded", phase: step.phase === "retired" ? "native retired and cleaned" : "stop submitted; outcome not implied", request: step.requestId ?? "already retired before stop", revisions: step.phase === "retired" ? `${step.observation.slotRevision} / ${step.observation.headRevision}` : "not confirmed" })) }, { kind: "lines", lines: ["Only a complete matched retirement receipt releases this deployment's known additive blocker. An incomplete intent is not retry authority; stop acceptance is not retirement."] }] }] : []),
|
|
247
|
+
...(row.cardRemoval?.attempt ? [{ title: row.cardRemoval.receipt ? "Recorded card removals" : "Unsettled card removal journal", blocks: [{ kind: "fields", rows: [["Full card receipt", row.cardRemoval.receipt ? "recorded" : "not confirmed"], ["Remaining removal phase", row.remainingRemovalPhase ?? "none"]] }, { kind: "table", columns: [{ key: "channel", label: "Channel" }, { key: "phase", label: "Step" }, { key: "marker", label: "Marker revision" }], rows: row.cardRemoval.steps.map((step) => ({ channel: `#${step.name}`, phase: cardStepText(step.phase), marker: "markerRevision" in step && step.markerRevision !== null ? String(step.markerRevision) : "currentRevision" in step ? String(step.currentRevision) : "none" })) }, { kind: "lines", lines: ["Only registry cards are in scope. Retained history, grants and readers were not changed. The mixed deployment is released only when both receipts exist."] }] }] : row.remainingRemovalPhase ? [{ title: "Remaining removal phase", blocks: [{ kind: "lines", lines: [`The ${row.remainingRemovalPhase.replace("-", " ")} phase has not settled. An unsettled intent is not retry authority.`] }] }] : []),
|
|
248
|
+
...(row.unreadableSteps.length ? [{ title: "Unreadable records", blocks: [{ kind: "lines", lines: [...row.unreadableSteps.slice(0, 100).map((path) => `Unreadable: ${path}`), ...(row.unreadableSteps.length > 100 ? ["Additional unreadable paths are in JSON."] : [])] }] }] : []),
|
|
249
|
+
] }));
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const channelRemoval = { receipt: inventory.channelRemoval?.returned.find((row) => row.deploymentId === subject) ?? null, attempt: inventory.channelRemoval?.attempts.find((row) => row.deploymentId === subject) ?? null, steps: inventory.channelRemoval?.steps.filter((row) => row.deploymentId === subject) ?? [] };
|
|
253
|
+
const result = { ...additiveAttempt, server: brokerAddressForDisplay(additiveAttempt.server) ?? "not displayable", intentPath: join(catalog.root, ".cotal", `team-deploy-attempt-${additiveAttempt.deploymentId}.json`), steps, unreadableSteps: [...unreadableSteps, ...inventory.refused.filter(({ path }) => basename(path).startsWith("team-channel-remove-") && basename(path).includes(subject)).map(({ path }) => path)], receipt: receipt ? { ...receipt, server: brokerAddressForDisplay(receipt.server) ?? "not displayable" } : null, channelRemoval, recordedState: channelRemoval.receipt ? "removal-returned" : receipt ? "channel-create-returned" : "unsettled-additive-attempt", nativeOutcome: receipt ? "returned" : "unknown" };
|
|
254
|
+
writeResult(presentationOf(values), { command: "team", target: { space: result.space, root: result.root, deploymentId: result.deploymentId }, result, completeness: "partial", partial: { message: receipt ? "All declared channel creates returned and their revisions were recorded. This is historical, not current broker state; guarded card removal rechecks each revision." : "Submitted and acknowledged channel steps do not settle the entire deployment. Missing or unreadable steps remain unknown; neither intent nor steps grant removal or retry authority." } }, (data) => ({ sections: [
|
|
255
|
+
{ title: data.receipt ? "Returned additive channels" : "Unsettled additive attempt", blocks: [{ kind: "fields", rows: [["Deployment", data.deploymentId], ["Space", data.space], ["Root", data.root], ["Broker", data.server], ["Auth mode", data.authMode], ["TLS", data.tlsRequired ? "required" : "not required"], ["Manifest", data.manifestPath], ["Intent recorded", data.createdAt], ["Recorded state", data.recordedState], ["Created channels", data.receipt ? String(data.receipt.createdChannels.length) : "unknown"]] }, { kind: "lines", lines: [data.receipt ? "The returned revisions are historical. Current cards and readers were not checked here; team remove deletes only cards still at these revisions." : "The intent and partial steps do not prove a complete deployment. Inspect the exact run before any retry or removal."] }] },
|
|
256
|
+
...(data.receipt ? [{ title: "Created channel receipts", blocks: [{ kind: "table", columns: [{ key: "channel", label: "Channel" }, { key: "revision", label: "Returned revision" }], rows: data.receipt.createdChannels.slice(0, 100).map((row) => ({ channel: `#${row.name}`, revision: String(row.revision) })) }, ...(data.receipt.createdChannels.length > 100 ? [{ kind: "lines", lines: ["Additional returned revisions are in JSON."] }] : [])] }] : data.steps.length || data.unreadableSteps.length ? [{ title: "Unsettled channel steps", blocks: [{ kind: "table", columns: [{ key: "channel", label: "Channel" }, { key: "phase", label: "Step" }, { key: "revision", label: "Returned revision" }], rows: data.steps.slice(0, 100).map((step) => ({ channel: `#${step.name}`, phase: step.phase, revision: step.phase === "accepted" ? String(step.revision) : "not returned" })) }, { kind: "lines", lines: [...data.unreadableSteps.slice(0, 100).map((path) => `Unreadable: ${path}`), ...(data.steps.length > 100 || data.unreadableSteps.length > 100 ? ["Additional steps are in JSON."] : [])] }] }] : []),
|
|
257
|
+
...(data.channelRemoval.attempt ? [{ title: data.channelRemoval.receipt ? "Recorded card removals" : "Unsettled card removal journal", blocks: [{ kind: "fields", rows: [["Full removal receipt", data.channelRemoval.receipt ? "recorded" : "not confirmed"], ["Original-receipt binding", data.channelRemoval.attempt.originalReceiptDigest]] }, { kind: "table", columns: [{ key: "channel", label: "Channel" }, { key: "phase", label: "Step" }, { key: "marker", label: "Marker revision" }], rows: data.channelRemoval.steps.map((step) => ({ channel: `#${step.name}`, phase: cardStepText(step.phase), marker: "markerRevision" in step && step.markerRevision !== null ? String(step.markerRevision) : "currentRevision" in step ? String(step.currentRevision) : "none" })) }, { kind: "lines", lines: ["Only registry cards are in scope. Retained history, grants and readers were not changed. An incomplete intent is not retry authority."] }] }] : []),
|
|
258
|
+
] }));
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
let found;
|
|
262
|
+
try {
|
|
263
|
+
found = findLedgerByRun(catalog.root, subject);
|
|
264
|
+
}
|
|
265
|
+
catch {
|
|
266
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the selected root has no readable additive ownership ledger for this full ID; no resources were touched", { target: { space: catalog.space, deploymentId: subject }, remedy: "inspect team in the checkout and space that created this deployment" });
|
|
267
|
+
}
|
|
268
|
+
if (found.ledger.space !== catalog.space)
|
|
269
|
+
throw new CommandFailure("refused", "CONFLICT", "this deployment's recorded space differs from the selected space; it was not rebound", { target: { recordedSpace: found.ledger.space, selectedSpace: catalog.space, deploymentId: subject } });
|
|
270
|
+
const result = recorded(catalog.root, found.ledger);
|
|
271
|
+
writeResult(presentationOf(values), { command: "team", target: { space: result.space, root: result.root, deploymentId: result.deploymentId }, result }, (row) => ({ sections: [
|
|
272
|
+
{ title: "Recorded team deployment", blocks: [{ kind: "fields", rows: [["Deployment", row.deploymentId], ["Kind", row.kind], ["Space", row.space], ["Root", row.root], ["Recorded state", row.recordedState], ["Next action", row.nextAction], ["Live state", "not checked"], ["Source context", row.manifestPath]] }] },
|
|
273
|
+
{ title: "Ledger-owned agents", blocks: [row.agents.length ? { kind: "table", columns: [{ key: "requested", label: "Declared" }, { key: "name", label: "Allocated name" }, { key: "id", label: "Identity" }, { key: "lifecycleUid", label: "Lifecycle" }], rows: row.agents.slice(0, 100).map((agent) => ({ ...agent, lifecycleUid: agent.lifecycleUid ?? "not recorded by this ledger" })) } : { kind: "lines", lines: ["No agent entries in this ledger."] }, ...(row.agents.length > 100 ? [{ kind: "lines", lines: ["Additional owned agent records are in JSON."] }] : [])] },
|
|
274
|
+
{ title: "Ledger-owned channels", blocks: [{ kind: "lines", lines: row.channels.length ? row.channels.slice(0, 100).map((name) => `#${name}`) : ["No channel entries in this ledger."] }, ...(row.channels.length > 100 ? [{ kind: "lines", lines: ["Additional owned channel records are in JSON."] }] : []), { kind: "lines", lines: [{ text: "An ownership record is not proof of running agents or permission to stop them. Removal must recheck native identities and retain unresolved entries.", tone: "hint" }] }] },
|
|
275
|
+
{ title: "Next", blocks: [{ kind: "commands", items: [{ command: `cotal down -f <file> --run ${row.deploymentId} --dry-run`, description: "From the recorded root, review only this additive run's native teardown plan" }] }, { kind: "lines", lines: [{ text: "The file is a required command argument, not the authority for --run. Do not apply from another root or infer that this ledger names current live members.", tone: "hint" }] }] },
|
|
276
|
+
] }));
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
let records;
|
|
280
|
+
try {
|
|
281
|
+
records = listLedgerFiles(catalog.root);
|
|
282
|
+
}
|
|
283
|
+
catch {
|
|
284
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the deployment record directory could not be read; an empty inventory was not inferred");
|
|
285
|
+
}
|
|
286
|
+
let fresh;
|
|
287
|
+
try {
|
|
288
|
+
fresh = listFreshTeamSummaries(catalog.root);
|
|
289
|
+
}
|
|
290
|
+
catch {
|
|
291
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the fresh launch summary directory could not be safely read; an empty inventory was not inferred");
|
|
292
|
+
}
|
|
293
|
+
let attempts;
|
|
294
|
+
try {
|
|
295
|
+
attempts = listFreshTeamAttempts(catalog.root);
|
|
296
|
+
}
|
|
297
|
+
catch {
|
|
298
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the fresh boot attempt records could not be read; an empty inventory was not inferred");
|
|
299
|
+
}
|
|
300
|
+
let additiveAttempts;
|
|
301
|
+
try {
|
|
302
|
+
additiveAttempts = listAdditiveTeamAttempts(catalog.root);
|
|
303
|
+
}
|
|
304
|
+
catch {
|
|
305
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the additive attempt records could not be read; an empty deployment inventory was not inferred");
|
|
306
|
+
}
|
|
307
|
+
const additive = records.valid.filter(({ ledger }) => ledger.space === catalog.space).map(({ ledger }) => recorded(catalog.root, ledger));
|
|
308
|
+
const freshItems = fresh.valid.filter((summary) => summary.space === catalog.space).map(freshRecorded);
|
|
309
|
+
const removedIds = removedAdditiveDeploymentIds(additiveAttempts);
|
|
310
|
+
const returnedItems = additiveAttempts.returned.filter((receipt) => receipt.space === catalog.space).map((receipt) => ({ deploymentId: receipt.deploymentId, kind: receipt.kind === "additive-team-receipt" ? "additive-mixed-team" : receipt.kind === "additive-agent-receipt" ? "additive-agent-only" : "additive-channel-only", space: receipt.space, root: receipt.root, manifestPath: receipt.manifestPath, recordedState: removedIds.has(receipt.deploymentId) ? "removal-returned" : receipt.kind === "additive-team-receipt" ? "channels-and-agents-returned" : receipt.kind === "additive-agent-receipt" ? "agent-joins-returned" : "channel-create-returned", liveState: "not-checked", nextAction: removedIds.has(receipt.deploymentId) ? "inspect-removal-history" : additiveAttempts.removal?.attempts.some((row) => row.deploymentId === receipt.deploymentId) && !additiveAttempts.removal?.returned.some((row) => row.deploymentId === receipt.deploymentId) || additiveAttempts.channelRemoval?.attempts.some((row) => row.deploymentId === receipt.deploymentId) && !additiveAttempts.channelRemoval?.returned.some((row) => row.deploymentId === receipt.deploymentId) ? "reconcile-unsettled-removal" : receipt.kind === "additive-channel-receipt" ? "inspect-card-revisions-before-removal" : "inspect-native-incarnation-before-removal", agents: receipt.kind !== "additive-channel-receipt" ? receipt.createdAgents : [], channels: receipt.createdChannels }));
|
|
311
|
+
const ids = new Set(additive.map((row) => row.deploymentId));
|
|
312
|
+
if ([...freshItems, ...returnedItems].some((row) => ids.has(row.deploymentId)) || returnedItems.some((row) => freshItems.some((freshRow) => freshRow.deploymentId === row.deploymentId)))
|
|
313
|
+
throw new CommandFailure("refused", "CONFLICT", "fresh, legacy additive and returned channel records share a deployment ID; none was treated as unique ownership");
|
|
314
|
+
const items = [...freshItems, ...additive, ...returnedItems];
|
|
315
|
+
const summariesById = new Map(fresh.valid.map((summary) => [summary.deploymentId, summary]));
|
|
316
|
+
const unsettledAttempts = attempts.valid.filter((attempt) => attempt.space === catalog.space && !freshTeamAttemptSettled(attempt, summariesById.get(attempt.deploymentId)))
|
|
317
|
+
.map((attempt) => ({ deploymentId: attempt.deploymentId, space: attempt.space, root: attempt.root, server: brokerAddressForDisplay(attempt.server) ?? "not displayable", createdAt: attempt.createdAt, recordedState: "unsettled-fresh-attempt" }));
|
|
318
|
+
if (unsettledAttempts.some((attempt) => ids.has(attempt.deploymentId)))
|
|
319
|
+
throw new CommandFailure("refused", "CONFLICT", "fresh attempt and additive ledger claim the same deployment ID; neither was treated as ownership authority");
|
|
320
|
+
const returnedIds = new Set(returnedItems.map((row) => row.deploymentId));
|
|
321
|
+
const allAdditiveAttempts = additiveAttempts.valid.filter((attempt) => attempt.space === catalog.space);
|
|
322
|
+
const occupied = new Set([...freshItems.map((row) => row.deploymentId), ...additive.map((row) => row.deploymentId), ...unsettledAttempts.map((row) => row.deploymentId)]);
|
|
323
|
+
if (allAdditiveAttempts.some((attempt) => occupied.has(attempt.deploymentId)))
|
|
324
|
+
throw new CommandFailure("refused", "CONFLICT", "additive and another deployment record claim the same ID; no settled ownership was inferred");
|
|
325
|
+
const unsettledAdditiveAttempts = allAdditiveAttempts.filter((attempt) => !returnedIds.has(attempt.deploymentId))
|
|
326
|
+
.map((attempt) => ({ deploymentId: attempt.deploymentId, space: attempt.space, root: attempt.root, server: brokerAddressForDisplay(attempt.server) ?? "not displayable", createdAt: attempt.createdAt, recordedState: "unsettled-additive-attempt" }));
|
|
327
|
+
const warnings = [...records.refused, ...fresh.refused, ...attempts.refused, ...additiveAttempts.refused].map(({ path }) => ({ code: "DEPLOYMENT_RECORD_UNREADABLE", message: "A local deployment record could not be read or validated; it was not reset.", target: { path } }));
|
|
328
|
+
writeResult(presentationOf(values), { command: "team", target: catalog, result: { kind: "team-deployments", scope: "selected-root fresh summaries/attempts and additive ledgers/attempts; historical completeness unknown", items, unsettledAttempts, unsettledAdditiveAttempts }, completeness: "partial", partial: { message: "The available local records do not establish a complete historical or live team inventory. An unsettled fresh or additive attempt is not proof that no native effect occurred." }, warnings }, (result) => ({ sections: [
|
|
329
|
+
{ title: "Recorded teams", blocks: [{ kind: "fields", rows: [["Space", catalog.space], ["Root", catalog.root], ["Scope", "fresh summaries, additive ledgers and returned agent/channel receipts; historical completeness unknown"]] }, result.items.length ? { kind: "table", columns: [{ key: "id", label: "Deployment" }, { key: "kind", label: "Kind" }, { key: "state", label: "Recorded state" }, { key: "next", label: "Next" }, { key: "agents", label: "Agent records" }, { key: "channels", label: "Channel records" }], rows: result.items.slice(0, 100).map((row) => ({ id: row.deploymentId, kind: row.kind, state: row.recordedState, next: row.nextAction, agents: String(row.agents.length), channels: String(row.channels.length) })) } : { kind: "lines", lines: ["No readable fresh summaries or additive ledgers for this selected space."] }, ...(result.items.length > 100 ? [{ kind: "lines", lines: ["Additional deployment records are in JSON."] }] : []), { kind: "lines", lines: [{ text: "Older fresh boots may have no summary. A record is not current live state or removal authority; native observations are still needed.", tone: "waiting" }] }] },
|
|
330
|
+
{ title: "Unsettled fresh boot attempts", blocks: [result.unsettledAttempts.length ? { kind: "table", columns: [{ key: "id", label: "Deployment" }, { key: "space", label: "Space" }, { key: "broker", label: "Recorded broker" }, { key: "time", label: "Intent recorded" }], rows: result.unsettledAttempts.slice(0, 100).map((row) => ({ id: row.deploymentId, space: row.space, broker: row.server, time: row.createdAt })) } : { kind: "lines", lines: ["No unsettled readable fresh boot attempts in the selected space."] }, { kind: "lines", lines: [...(result.unsettledAttempts.length > 100 ? ["Additional attempts are in JSON."] : []), "An intent without a matching returned summary may have started a broker. Inspect its exact run; do not retry or stop by inference."] }] },
|
|
331
|
+
{ title: "Unsettled additive attempts", blocks: [result.unsettledAdditiveAttempts.length ? { kind: "table", columns: [{ key: "id", label: "Deployment" }, { key: "space", label: "Space" }, { key: "broker", label: "Recorded broker" }, { key: "time", label: "Intent recorded" }], rows: result.unsettledAdditiveAttempts.slice(0, 100).map((row) => ({ id: row.deploymentId, space: row.space, broker: row.server, time: row.createdAt })) } : { kind: "lines", lines: ["No readable additive attempts in the selected space."] }, { kind: "lines", lines: [...(result.unsettledAdditiveAttempts.length > 100 ? ["Additional attempts are in JSON."] : []), "An intent names a request, not resources created. Its native outcome remains unknown until a guarded receipt reconciles it."] }] },
|
|
332
|
+
{ title: "Next", blocks: [{ kind: "commands", items: [{ command: "cotal t show <deployment-id>", description: "Inspect recorded ownership or an unsettled boot attempt without changing anything" }, { command: "cotal t check <file> --graph", description: "Read the resolved manifest and its access edges offline" }] }] },
|
|
333
|
+
] }));
|
|
334
|
+
}
|
|
335
|
+
async function previewDeploy(file, values) {
|
|
336
|
+
if (values["dry-run"] !== true) {
|
|
337
|
+
let resolved;
|
|
338
|
+
try {
|
|
339
|
+
resolved = loadManifest(resolve(file));
|
|
340
|
+
}
|
|
341
|
+
catch {
|
|
342
|
+
throw new CommandFailure("refused", "SCHEMA_INVALID", "the additive manifest could not be resolved; no native effect was submitted");
|
|
343
|
+
}
|
|
344
|
+
if (resolved.agents.length) {
|
|
345
|
+
const { applyAgentTeam } = await import("./team-agent-apply.js");
|
|
346
|
+
return applyAgentTeam(file, values);
|
|
347
|
+
}
|
|
348
|
+
return applyChannelOnlyTeam(file, values);
|
|
349
|
+
}
|
|
350
|
+
const { path, prepared } = readTeamFile(file, values);
|
|
351
|
+
const space = prepared.manifest.space;
|
|
352
|
+
let local, waiting;
|
|
353
|
+
try {
|
|
354
|
+
local = findMesh(space);
|
|
355
|
+
waiting = findPreparedSpace(space);
|
|
356
|
+
}
|
|
357
|
+
catch {
|
|
358
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the local registry or prepared-space records could not be read; no additive target was inferred", { target: { space } });
|
|
359
|
+
}
|
|
360
|
+
if (!local)
|
|
361
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", waiting ? "the selected space is only prepared; additive deploy requires an existing registered mesh" : "the selected space has no local registration; no broker or authorization target was inferred", { target: { space }, remedy: "register an existing authorized mesh before reviewing an additive deployment" });
|
|
362
|
+
if (waiting && canonicalRoot(waiting.root) !== canonicalRoot(local.root))
|
|
363
|
+
throw new CommandFailure("refused", "CONFLICT", "prepared and registered records disagree on this space's root; no additive target was chosen", { target: { space } });
|
|
364
|
+
const runtimeRequest = values.runtime ?? prepared.manifest.runtime ?? "pty";
|
|
365
|
+
const openDurable = local.mode === "open" && prepared.manifest.channels.some((channel) => channel.deliveryClass === "durable");
|
|
366
|
+
let attempts;
|
|
367
|
+
try {
|
|
368
|
+
attempts = listAdditiveTeamAttempts(canonicalRoot(local.root));
|
|
369
|
+
}
|
|
370
|
+
catch {
|
|
371
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the registered root's additive attempt records could not be read; no empty apply history was inferred", { target: { space, root: local.root } });
|
|
372
|
+
}
|
|
373
|
+
const native = await inspectTeamDeployment(canonicalRoot(local.root), path, prepared, runtimeRequest);
|
|
374
|
+
const result = { kind: "additive-team-deploy-preview", dryRun: true, path, space, root: local.root,
|
|
375
|
+
retainedAdditiveAttempts: attempts.valid.map((attempt) => ({ deploymentId: attempt.deploymentId, space: attempt.space, server: brokerAddressForDisplay(attempt.server) ?? "not displayable", createdAt: attempt.createdAt, recordedState: additiveTeamRecordedState(attempt, attempts) })), unreadableAdditiveAttempts: attempts.refused.map(({ path }) => path),
|
|
376
|
+
registrationOrigin: local.origin ?? "not recorded", recordedBroker: brokerAddressForDisplay(local.server) ?? null,
|
|
377
|
+
recordedMode: local.mode, recordedTlsRequired: local.tlsRequired === true,
|
|
378
|
+
runtimeRequest, native, openDurableUnsupported: openDurable,
|
|
379
|
+
agents: prepared.agents.map((agent) => ({ name: agent.name, application: agent.agentType, role: agent.role ?? null, requestedModel: agent.model ?? null })),
|
|
380
|
+
channels: prepared.manifest.channels.map((channel) => ({ name: channel.name, deliveryClass: channel.deliveryClass ?? null, replay: channel.replay ?? null, replayWindow: channel.replayWindow ?? null })),
|
|
381
|
+
targetReachability: "native-reads-established", brokerPolicy: "not-checked", authorization: "read-established-not-deploy-authority", ownershipClassification: "native-roster-and-registry-snapshot", connectorAvailability: "not-checked", effectAttempted: false, persisted: false };
|
|
382
|
+
writeResult(presentationOf(values), { command: "team deploy", target: { space, root: local.root, path }, result,
|
|
383
|
+
completeness: "partial", partial: { message: "Native roster and channel-registry classification is a non-atomic read, not an authorized deployment plan. Manager readiness, runtime and connector availability, write grants and apply effects remain unchecked." },
|
|
384
|
+
warnings: [...prepared.warnings.map((warning) => ({ code: "MANIFEST_WARNING", target: { agent: warning.agent }, message: warning.message })), ...(openDurable ? [{ code: "OPEN_DURABLE_UNSUPPORTED", target: { space }, message: "The selected running mesh is open and has no delivery daemon; this manifest's durable declaration cannot acquire a per-member backstop." }] : []), ...(!native.unmanaged.feedAvailable ? [{ code: "MEMBERSHIP_FEED_UNAVAILABLE", target: { space }, message: "Other readers are a lower bound because the derived membership feed has no observed heartbeat." }] : []), ...(attempts.valid.length || attempts.refused.length ? [{ code: "ADDITIVE_ATTEMPT_REMAINS", target: { root: local.root, space, deploymentIds: attempts.valid.map((attempt) => attempt.deploymentId), unreadable: attempts.refused.map(({ path }) => path) }, message: "An additive deployment intent is retained at this root; the preview does not settle or retry it." }] : [])] }, (data) => ({ sections: [
|
|
385
|
+
{ title: "Additive team inspection", blocks: [{ kind: "fields", rows: [["Space", data.space], ["Registered root", data.root], ["Registration", data.registrationOrigin], ["Recorded broker", data.recordedBroker ?? "not displayable"], ["Recorded mode", data.recordedMode], ["TLS requirement", data.recordedTlsRequired ? "recorded required" : "not recorded required"], ["Manifest", data.path], ["Runtime request", data.runtimeRequest], ["Prior additive run", data.native.priorDeploymentId ?? "none recorded"], ["Retained additive attempts", String(data.retainedAdditiveAttempts.length)], ["Unreadable additive attempts", String(data.unreadableAdditiveAttempts.length)], ["Native roster", data.native.roster], ["Channel registry", data.native.registry], ["Membership feed", data.native.unmanaged.feedAvailable ? "display-only lower bound" : "unavailable"], ["Durable delivery on open", data.openDurableUnsupported ? "unsupported" : "not a contradiction"]] }, { kind: "lines", lines: [{ text: "The observed registry and roster do not reserve names or authorize creation. Manager readiness, runtime/provider availability and write grants remain unchecked; nothing was added.", tone: "waiting" }] }] },
|
|
386
|
+
{ title: "Requested agents", blocks: [data.agents.length ? { kind: "table", columns: [{ key: "name", label: "Name" }, { key: "application", label: "Application" }, { key: "role", label: "Role" }, { key: "model", label: "Model request" }], rows: data.agents.slice(0, 100).map((agent) => ({ name: agent.name, application: agent.application, role: agent.role ?? "none", model: agent.requestedModel ?? "application default" })) } : { kind: "lines", lines: ["No agents requested."] }, ...(data.agents.length > 100 ? [{ kind: "lines", lines: ["Additional requested agents are in JSON."] }] : [])] },
|
|
387
|
+
{ title: "Declared channels", blocks: [data.channels.length ? { kind: "table", columns: [{ key: "name", label: "Channel" }, { key: "delivery", label: "Delivery class" }, { key: "replay", label: "Replay" }, { key: "window", label: "Replay window" }], rows: data.channels.slice(0, 100).map((channel) => ({ name: `#${channel.name}`, delivery: channel.deliveryClass ?? "not declared", replay: channel.replay === null ? "not declared" : channel.replay ? "on" : "off", window: channel.replayWindow ?? "not declared" })) } : { kind: "lines", lines: ["No channels declared."] }, { kind: "lines", lines: [...(data.channels.length > 100 ? ["Additional channels are in JSON."] : []), "Declared policy is not a live registry value or permission to overwrite existing metadata. Apply accepts all-new live channels and bounded static/open agent or mixed teams; existing cards and reapply refuse."] }] },
|
|
388
|
+
{ title: "Retained additive attempts", blocks: [data.retainedAdditiveAttempts.length ? { kind: "table", columns: [{ key: "id", label: "Deployment" }, { key: "space", label: "Space" }, { key: "state", label: "Recorded state" }], rows: data.retainedAdditiveAttempts.slice(0, 100).map((attempt) => ({ id: attempt.deploymentId, space: attempt.space, state: attempt.recordedState })) } : { kind: "lines", lines: ["No readable additive attempt under this root."] }, { kind: "lines", lines: [...data.unreadableAdditiveAttempts.slice(0, 100).map((path) => `Unreadable additive attempt: ${path}`), ...(data.retainedAdditiveAttempts.length > 100 || data.unreadableAdditiveAttempts.length > 100 ? ["Additional records are in JSON."] : []), "A returned receipt records historical channel creation or native agent joins; an unsettled intent remains unknown. Neither grants removal or retry authority."] }] },
|
|
389
|
+
{ title: "Existing unmanaged channel metadata", blocks: [data.native.channels.existsUnmanagedPolicy.length ? { kind: "table", columns: [{ key: "name", label: "Channel" }, { key: "difference", label: "Declared fields differing from live" }], rows: data.native.channels.existsUnmanagedPolicy.slice(0, 100).map((row) => ({ name: `#${row.name}`, difference: row.differingDeclaredFields.join(", ") || "none among declared fields" })) } : { kind: "lines", lines: ["No existing unmanaged declared channel cards in this snapshot."] }, { kind: "lines", lines: [...(data.native.channels.existsUnmanagedPolicy.length > 100 ? ["Additional comparisons are in JSON."] : []), "Only field names are shown, not live instructions or descriptions. Unmanaged cards are not patched or adopted; an omitted declaration is not a difference."] }] },
|
|
390
|
+
{ title: "Native additive classification", blocks: [{ kind: "fields", rows: [["New channel candidates", String(data.native.channels.create.length)], ["Prior-owned channel records", String(data.native.channels.owned.length)], ["Unmanaged existing channels", String(data.native.channels.existsUnmanaged.length)], ["Present unowned agents", String(data.native.unmanaged.presentUnowned.length)]] }, { kind: "table", columns: [{ key: "name", label: "Declared agent" }, { key: "state", label: "Disposition" }, { key: "running", label: "Prior name present" }], rows: data.native.agents.slice(0, 100).map((agent) => ({ name: agent.name, state: agent.disposition, running: agent.runningByName === null ? "not recorded" : agent.runningByName ? "yes" : "no" })) }, ...(data.native.agents.length > 100 ? [{ kind: "lines", lines: ["Additional classifications are in JSON."] }] : []), { kind: "lines", lines: ["Presence is not an ownership claim. The derived membership feed is display-only and may miss silent readers; this read is not a safe-to-apply plan."] }] },
|
|
391
|
+
] }));
|
|
392
|
+
}
|
|
393
|
+
/** A native read for display. Neither PS nor the derived membership feed grants stop authority. */
|
|
394
|
+
async function nativeRemovalImpact(root, ledger) {
|
|
395
|
+
const conn = await connectOrThrow({ space: ledger.space }, "deployer", { readOnly: true });
|
|
396
|
+
if (!conn.root || canonicalRoot(conn.root) !== canonicalRoot(root) || conn.server !== ledger.server)
|
|
397
|
+
throw new CommandFailure("refused", "CONFLICT", "the current registered broker/root differs from the additive ledger; no live removal target was inferred", { target: { space: ledger.space, deploymentId: ledger.runId } });
|
|
398
|
+
let user;
|
|
399
|
+
if (conn.mode === "user") {
|
|
400
|
+
try {
|
|
401
|
+
user = await userViewAuth(conn, "deployer");
|
|
402
|
+
}
|
|
403
|
+
catch (error) {
|
|
404
|
+
const remedy = credentialRefusalMessage(error);
|
|
405
|
+
throw new CommandFailure("refused", "PERMISSION_DENIED", "the selected user-auth deployer view was not issued; no other identity or root was substituted", { target: { space: ledger.space, deploymentId: ledger.runId }, ...(remedy ? { remedy } : {}) });
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
const ep = new CotalEndpoint({ space: ledger.space, servers: conn.server, tls: conn.tls,
|
|
409
|
+
...(user ? { bearer: user.source, sentinelCreds: user.sentinelCreds, lifecycleUid: user.lifecycleUid,
|
|
410
|
+
card: { owner: user.owner, actor: user.actor, name: "team-remove-preview", kind: "endpoint" } }
|
|
411
|
+
: { creds: conn.creds, lifecycleUid: conn.epCaller?.uid, card: { name: "team-remove-preview", kind: "endpoint" } }),
|
|
412
|
+
channels: [], consume: false, registerPresence: false, watchPresence: false });
|
|
413
|
+
ep.on("error", () => { });
|
|
414
|
+
try {
|
|
415
|
+
await ep.start();
|
|
416
|
+
const response = await ep.invokeService("manager", "ps", undefined, { deadlineMs: 8_000 });
|
|
417
|
+
const live = response.reply.data;
|
|
418
|
+
if (response.reply.ok !== true || !Array.isArray(live) || live.length > 10_000 || live.some((row) => !row || typeof row !== "object" || typeof row.name !== "string" || !row.name || typeof row.id !== "string" || !row.id || typeof row.lifecycleUid !== "string" || !row.lifecycleUid) || new Set(live.map((row) => row.id)).size !== live.length)
|
|
419
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the serving manager did not return a bounded, usable native agent inventory; no disappearance or stop eligibility was inferred", { target: { space: ledger.space, deploymentId: ledger.runId } });
|
|
420
|
+
const byId = new Map(live.map((row) => [row.id, row]));
|
|
421
|
+
const agents = ledger.created.agents.map((agent) => {
|
|
422
|
+
const current = byId.get(agent.id);
|
|
423
|
+
const other = live.find((row) => row.name === agent.name && row.id !== agent.id);
|
|
424
|
+
return { name: agent.name, recordedId: agent.id, recordedLifecycleUid: agent.lifecycleUid ?? null,
|
|
425
|
+
observedId: current?.id ?? other?.id ?? null, observedLifecycleUid: current?.lifecycleUid ?? other?.lifecycleUid ?? null,
|
|
426
|
+
state: current ? current.name !== agent.name ? "identity-name-mismatch" : !agent.lifecycleUid ? "recorded-lifecycle-unpinned" : current.lifecycleUid === agent.lifecycleUid ? "exact-incarnation-observed" : "successor-incarnation-observed"
|
|
427
|
+
: other ? "foreign-name-holder-observed" : "not-in-manager-ps" };
|
|
428
|
+
});
|
|
429
|
+
const readAuth = user ? { bearer: user.bearer, sentinelCreds: user.sentinelCreds } : { creds: conn.creds };
|
|
430
|
+
const revisions = await readOwnedChannelRevisions(conn.server, ledger.space, conn.tls, readAuth, ledger.created.channels);
|
|
431
|
+
let members;
|
|
432
|
+
let membershipWarning = null;
|
|
433
|
+
try {
|
|
434
|
+
members = await ep.readMembership();
|
|
435
|
+
}
|
|
436
|
+
catch {
|
|
437
|
+
membershipWarning = "The derived membership feed could not be read; channel observers and live readers are unknown.";
|
|
438
|
+
}
|
|
439
|
+
const ownedIds = new Set(ledger.created.agents.map((agent) => agent.id));
|
|
440
|
+
const channels = revisions.map(({ name, revision }) => ({ name, observedRevision: revision, otherMembersObserved: members ? members.members.filter((row) => !ownedIds.has(row.id) && (row.durable.includes(name) || row.live.some((pattern) => subjectMatches(pattern, name)))).map((row) => row.id) : null }));
|
|
441
|
+
return { managerPs: "answered", agents, channels, channelRegistry: ledger.created.channels.length ? "scoped-native-read" : "no-owned-channels", membershipFeed: members ? "display-only-observed" : "unavailable", membershipObservedAt: members?.asOf ?? null, membershipWarning };
|
|
442
|
+
}
|
|
443
|
+
catch (error) {
|
|
444
|
+
if (error instanceof CommandFailure)
|
|
445
|
+
throw error;
|
|
446
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the native manager or owned-channel registry read did not complete; no live absence or removal eligibility was inferred", { target: { space: ledger.space, deploymentId: ledger.runId } });
|
|
447
|
+
}
|
|
448
|
+
finally {
|
|
449
|
+
try {
|
|
450
|
+
await ep.stop();
|
|
451
|
+
}
|
|
452
|
+
catch {
|
|
453
|
+
throw new CommandFailure("failed", "OPERATION_FAILED", "the native preview reader did not confirm closure; no agent or channel was removed", { target: { space: ledger.space, deploymentId: ledger.runId } });
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
async function previewRemove(deploymentId, values) {
|
|
458
|
+
if (values["dry-run"] !== true) {
|
|
459
|
+
// The original intent picks the route; each route revalidates its own returned receipt.
|
|
460
|
+
let routed;
|
|
461
|
+
try {
|
|
462
|
+
routed = findAdditiveTeamAttempt(personaCatalog(values).root, deploymentId);
|
|
463
|
+
}
|
|
464
|
+
catch {
|
|
465
|
+
throw new CommandFailure("refused", "SCHEMA_INVALID", "the additive attempt for this ID is unreadable; no removal route was inferred", { target: { deploymentId } });
|
|
466
|
+
}
|
|
467
|
+
if (routed && !routed.requestedAgents.length && routed.declaredChannels.length) {
|
|
468
|
+
const { removeChannelTeam } = await import("./team-channel-remove.js");
|
|
469
|
+
return removeChannelTeam(deploymentId, values);
|
|
470
|
+
}
|
|
471
|
+
if (routed && routed.requestedAgents.length && routed.declaredChannels.length) {
|
|
472
|
+
const { removeMixedTeam } = await import("./team-mixed-remove.js");
|
|
473
|
+
return removeMixedTeam(deploymentId, values);
|
|
474
|
+
}
|
|
475
|
+
const { removeAgentTeam } = await import("./team-agent-remove.js");
|
|
476
|
+
return removeAgentTeam(deploymentId, values);
|
|
477
|
+
}
|
|
478
|
+
const catalog = personaCatalog(values);
|
|
479
|
+
recordOperationSpace(catalog.space);
|
|
480
|
+
let summary;
|
|
481
|
+
try {
|
|
482
|
+
summary = findFreshTeamSummary(catalog.root, deploymentId);
|
|
483
|
+
}
|
|
484
|
+
catch {
|
|
485
|
+
throw new CommandFailure("refused", "SCHEMA_INVALID", "the fresh launch summary for this ID is unreadable; it cannot be treated as absent or as an additive removal target", { target: { space: catalog.space, deploymentId } });
|
|
486
|
+
}
|
|
487
|
+
if (summary)
|
|
488
|
+
throw new CommandFailure("refused", "CONFLICT", "this ID belongs to a fresh boot summary, not an additive ownership ledger; team remove did not infer whole-stack stop authority", { target: { recordedSpace: summary.space, recordedRoot: summary.root, selectedSpace: catalog.space, deploymentId }, remedy: "from the recorded root, inspect cotal down --space <recorded-space> --dry-run; guarded bare down is not integrated in this source" });
|
|
489
|
+
let freshAttempt;
|
|
490
|
+
try {
|
|
491
|
+
freshAttempt = findFreshTeamAttempt(catalog.root, deploymentId);
|
|
492
|
+
}
|
|
493
|
+
catch {
|
|
494
|
+
throw new CommandFailure("refused", "SCHEMA_INVALID", "the fresh boot attempt for this ID is unreadable; it was not treated as an additive target", { target: { root: catalog.root, deploymentId } });
|
|
495
|
+
}
|
|
496
|
+
if (freshAttempt)
|
|
497
|
+
throw new CommandFailure("refused", "CONFLICT", "this ID belongs to a fresh boot attempt, not an additive removal target", { target: { root: catalog.root, deploymentId } });
|
|
498
|
+
let attempt;
|
|
499
|
+
try {
|
|
500
|
+
attempt = findAdditiveTeamAttempt(catalog.root, deploymentId);
|
|
501
|
+
}
|
|
502
|
+
catch {
|
|
503
|
+
throw new CommandFailure("refused", "SCHEMA_INVALID", "the additive attempt for this ID is unreadable; no safe removal target was inferred", { target: { root: catalog.root, deploymentId } });
|
|
504
|
+
}
|
|
505
|
+
if (attempt) {
|
|
506
|
+
let inventory;
|
|
507
|
+
try {
|
|
508
|
+
inventory = listAdditiveTeamAttempts(catalog.root);
|
|
509
|
+
}
|
|
510
|
+
catch {
|
|
511
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the additive attempt steps and receipts could not be read; no removal scope was inferred", { target: { root: catalog.root, deploymentId } });
|
|
512
|
+
}
|
|
513
|
+
const receipt = inventory.returned.find((row) => row.deploymentId === deploymentId);
|
|
514
|
+
if (receipt) {
|
|
515
|
+
if (attempt.space !== catalog.space)
|
|
516
|
+
throw new CommandFailure("refused", "CONFLICT", "this returned additive deployment belongs to another selected space; it was not rebound", { target: { recordedSpace: attempt.space, selectedSpace: catalog.space, deploymentId } });
|
|
517
|
+
if (receipt.kind === "additive-agent-receipt") {
|
|
518
|
+
const { removeAgentTeam } = await import("./team-agent-remove.js");
|
|
519
|
+
return removeAgentTeam(deploymentId, values);
|
|
520
|
+
}
|
|
521
|
+
if (receipt.kind === "additive-team-receipt") {
|
|
522
|
+
const { removeMixedTeam } = await import("./team-mixed-remove.js");
|
|
523
|
+
return removeMixedTeam(deploymentId, values);
|
|
524
|
+
}
|
|
525
|
+
if (receipt.kind !== "additive-channel-receipt")
|
|
526
|
+
throw new CommandFailure("refused", "UNSUPPORTED", "the returned agent identities and any channel revisions are historical receipts; guarded team removal requires native incarnation, reader and retained-custody review", { target: { space: catalog.space, deploymentId }, remedy: "inspect team show <deployment-id> and the recorded exact manager before requesting a stop" });
|
|
527
|
+
const { removeChannelTeam } = await import("./team-channel-remove.js");
|
|
528
|
+
return removeChannelTeam(deploymentId, values);
|
|
529
|
+
}
|
|
530
|
+
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", "this additive ID retains an unsettled attempt; team remove cannot infer which resources it created", { target: { root: catalog.root, deploymentId }, remedy: "inspect team show <deployment-id> and the original native target; no effect was retried or removed" });
|
|
531
|
+
}
|
|
532
|
+
let found;
|
|
533
|
+
try {
|
|
534
|
+
found = findLedgerByRun(catalog.root, deploymentId);
|
|
535
|
+
}
|
|
536
|
+
catch {
|
|
537
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "no readable additive ownership ledger matches this full ID in the selected root; no resources were touched", { target: { space: catalog.space, root: catalog.root, deploymentId }, remedy: "inspect the checkout and space that recorded the additive deployment" });
|
|
538
|
+
}
|
|
539
|
+
if (found.ledger.space !== catalog.space)
|
|
540
|
+
throw new CommandFailure("refused", "CONFLICT", "this additive ledger belongs to another space; it was not rebound", { target: { recordedSpace: found.ledger.space, selectedSpace: catalog.space, deploymentId } });
|
|
541
|
+
let otherAttempts;
|
|
542
|
+
try {
|
|
543
|
+
otherAttempts = listAdditiveTeamAttempts(catalog.root);
|
|
544
|
+
}
|
|
545
|
+
catch {
|
|
546
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the root's additive attempt inventory could not be read; no complete removal scope was inferred", { target: { root: catalog.root, deploymentId } });
|
|
547
|
+
}
|
|
548
|
+
const native = await nativeRemovalImpact(catalog.root, found.ledger);
|
|
549
|
+
const result = { ...recorded(catalog.root, found.ledger), kind: "additive-removal-preview",
|
|
550
|
+
dryRun: true, native, otherRetainedAttempts: otherAttempts.valid.map((row) => ({ deploymentId: row.deploymentId, space: row.space, server: brokerAddressForDisplay(row.server) ?? "not displayable" })), unreadableAttempts: otherAttempts.refused.map(({ path }) => path), authorization: "read-established-not-removal-authority", effectAttempted: false, persisted: false };
|
|
551
|
+
writeResult(presentationOf(values), { command: "team remove", target: { space: result.space, root: result.root, deploymentId }, result,
|
|
552
|
+
completeness: "partial", partial: { message: "Native manager PS, current channel revisions and a derived display-only membership read do not authorize stopping a lifecycle or removing a channel. The legacy ledger has no create revisions; exact ownership, authority and effect impact still need guarded apply checks." },
|
|
553
|
+
warnings: [...(native.membershipWarning ? [{ code: "MEMBERSHIP_FEED_UNAVAILABLE", target: { space: result.space, deploymentId }, message: native.membershipWarning }] : []), ...(otherAttempts.valid.length || otherAttempts.refused.length ? [{ code: "ADDITIVE_ATTEMPT_REMAINS", target: { root: catalog.root, deploymentIds: otherAttempts.valid.map((row) => row.deploymentId), unreadable: otherAttempts.refused.map(({ path }) => path) }, message: "Other additive attempts remain in this root; their native effects were not attributed to this ledger." }] : [])] }, (data) => ({ sections: [
|
|
554
|
+
{ title: "Additive removal impact", blocks: [{ kind: "fields", rows: [["Deployment", data.deploymentId], ["Space", data.space], ["Recorded root", data.root], ["Source context", data.manifestPath], ["Manager PS", data.native.managerPs], ["Channel registry", data.native.channelRegistry], ["Other additive attempts", String(data.otherRetainedAttempts.length)], ["Unreadable attempts", String(data.unreadableAttempts.length)], ["Membership feed", data.native.membershipFeed], ["Feed observed at", data.native.membershipObservedAt === null ? "not available" : String(data.native.membershipObservedAt)], ["Removal authority", "not established"]] }, { kind: "lines", lines: [{ text: "Native PS is a snapshot; the derived membership feed is display-only, never an ACL or stop authority. No stop, channel removal or ledger write occurred.", tone: "waiting" }] }] },
|
|
555
|
+
...(data.otherRetainedAttempts.length || data.unreadableAttempts.length ? [{ title: "Other retained additive attempts", blocks: [{ kind: "lines", lines: [...data.otherRetainedAttempts.slice(0, 100).map((row) => `${row.deploymentId} (${row.space})`), ...data.unreadableAttempts.slice(0, 100).map((path) => `Unreadable: ${path}`), ...(data.otherRetainedAttempts.length > 100 || data.unreadableAttempts.length > 100 ? ["Additional attempts are in JSON."] : []), "These attempts may have affected the same broker; they are not part of this ledger's owned scope."] }] }] : []),
|
|
556
|
+
{ title: "Ledger-owned agents against manager PS", blocks: [data.native.agents.length ? { kind: "table", columns: [{ key: "name", label: "Allocated" }, { key: "recorded", label: "Recorded identity" }, { key: "observed", label: "Observed identity" }, { key: "state", label: "Incarnation" }], rows: data.native.agents.slice(0, 100).map((agent) => ({ name: agent.name, recorded: agent.recordedId, observed: agent.observedId ?? "not seen", state: agent.state })) } : { kind: "lines", lines: ["No agent entries in this ledger."] }, ...(data.native.agents.length > 100 ? [{ kind: "lines", lines: ["Additional agent observations are in JSON."] }] : [])] },
|
|
557
|
+
{ title: "Ledger-owned channels", blocks: [{ kind: "table", columns: [{ key: "name", label: "Channel" }, { key: "revision", label: "Current revision" }, { key: "members", label: "Other members observed" }], rows: data.native.channels.slice(0, 100).map((channel) => ({ name: `#${channel.name}`, revision: channel.observedRevision === null ? "not live" : String(channel.observedRevision), members: channel.otherMembersObserved === null ? "unknown" : String(channel.otherMembersObserved.length) })) }, ...(data.native.channels.length > 100 ? [{ kind: "lines", lines: ["Additional channel observations are in JSON."] }] : []), { kind: "lines", lines: ["Current KV revisions are read-only snapshots. This ledger did not record create revisions, so matching a channel name does not authorize deleting its current card."] }] },
|
|
558
|
+
] }));
|
|
559
|
+
}
|
|
560
|
+
function accessGraph(prepared) {
|
|
561
|
+
const declared = new Set(prepared.manifest.channels.map((channel) => channel.name));
|
|
562
|
+
const names = new Set(declared);
|
|
563
|
+
for (const agent of prepared.agents) {
|
|
564
|
+
for (const channel of [...agent.policy.subscribe, ...agent.policy.allowSubscribe, ...agent.policy.allowPublish])
|
|
565
|
+
names.add(channel);
|
|
566
|
+
}
|
|
567
|
+
return [...names].sort().map((name) => ({
|
|
568
|
+
name,
|
|
569
|
+
source: declared.has(name) ? "manifest" : "persona-inherited",
|
|
570
|
+
subscribe: prepared.agents.filter((agent) => agent.policy.subscribe.includes(name)).map((agent) => agent.name),
|
|
571
|
+
allowSubscribe: prepared.agents.filter((agent) => agent.policy.allowSubscribe.includes(name)).map((agent) => agent.name),
|
|
572
|
+
allowPublish: prepared.agents.filter((agent) => agent.policy.allowPublish.includes(name)).map((agent) => agent.name),
|
|
573
|
+
}));
|
|
574
|
+
}
|
|
575
|
+
function readTeamFile(file, values) {
|
|
576
|
+
const path = resolve(file);
|
|
577
|
+
let prepared;
|
|
578
|
+
try {
|
|
579
|
+
prepared = loadManifest(path);
|
|
580
|
+
}
|
|
581
|
+
catch {
|
|
582
|
+
throw new CommandFailure("refused", "SCHEMA_INVALID", "the team manifest or referenced persona could not be read and resolved; no broker was contacted", { target: { path }, remedy: "check the manifest schema, persona paths and permission declarations" });
|
|
583
|
+
}
|
|
584
|
+
if (values.space !== undefined && values.space !== prepared.manifest.space)
|
|
585
|
+
throw new CommandFailure("refused", "CONFLICT", "--space must agree with the manifest's recorded target; the file was not rebound");
|
|
586
|
+
return { path, prepared };
|
|
587
|
+
}
|
|
588
|
+
async function bootTeam(file, values) {
|
|
589
|
+
const { path, prepared } = readTeamFile(file, values), space = prepared.manifest.space;
|
|
590
|
+
let local, waiting;
|
|
591
|
+
try {
|
|
592
|
+
local = findMesh(space);
|
|
593
|
+
waiting = findPreparedSpace(space);
|
|
594
|
+
}
|
|
595
|
+
catch {
|
|
596
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the selected local registration or prepared-space record could not be read; no boot root was chosen", { target: { space } });
|
|
597
|
+
}
|
|
598
|
+
if (local && local.origin !== "up")
|
|
599
|
+
throw new CommandFailure("refused", "CONFLICT", "a remote, discovered or hand-registered space cannot become an owned fresh local boot target", { target: { space } });
|
|
600
|
+
if (!local && !waiting)
|
|
601
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "prepare this space at an explicit local root before a fresh team boot; no current directory or machine home was guessed", { target: { space }, remedy: `cotal space create ${space} --root <project-directory>` });
|
|
602
|
+
if (local && waiting && canonicalRoot(local.root) !== canonicalRoot(waiting.root))
|
|
603
|
+
throw new CommandFailure("refused", "CONFLICT", "the registered and prepared records disagree on this space's root; no stack was started", { target: { space } });
|
|
604
|
+
const root = canonicalRoot(waiting?.root ?? local.root);
|
|
605
|
+
// The service controller owns the fresh boot: the same exact members, journal and stop route as
|
|
606
|
+
// `cotal up`, with the manifest's launch carried by the stack's own manager member.
|
|
607
|
+
const selected = preparedUpRoot(root), previous = process.cwd();
|
|
608
|
+
process.chdir(selected);
|
|
609
|
+
try {
|
|
610
|
+
await controllerTeamBoot({ file: path, space, transport: recordedBrokerTransport(selected), foreground: values.foreground === true, presentation: presentationOf(values) });
|
|
611
|
+
}
|
|
612
|
+
finally {
|
|
613
|
+
process.chdir(previous);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
async function previewBoot(file, values) {
|
|
617
|
+
if (values["dry-run"] !== true)
|
|
618
|
+
return bootTeam(file, values);
|
|
619
|
+
const { path, prepared } = readTeamFile(file, values);
|
|
620
|
+
const space = prepared.manifest.space;
|
|
621
|
+
let local, waiting;
|
|
622
|
+
try {
|
|
623
|
+
local = findMesh(space);
|
|
624
|
+
waiting = findPreparedSpace(space);
|
|
625
|
+
}
|
|
626
|
+
catch {
|
|
627
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the local space registry or prepared-space records could not be read; no boot target was inferred", { target: { space } });
|
|
628
|
+
}
|
|
629
|
+
if (local && local.origin !== "up")
|
|
630
|
+
throw new CommandFailure("refused", "CONFLICT", "a remote, discovered or hand-registered space cannot become an owned local boot target", { target: { space } });
|
|
631
|
+
if (local && waiting && canonicalRoot(local.root) !== canonicalRoot(waiting.root))
|
|
632
|
+
throw new CommandFailure("refused", "CONFLICT", "prepared and registered records disagree on this space's root; no boot target was chosen", { target: { space } });
|
|
633
|
+
const root = waiting?.root ?? local?.root ?? process.cwd();
|
|
634
|
+
let localState;
|
|
635
|
+
let serviceCensus;
|
|
636
|
+
let additiveRecords, additiveAttempts;
|
|
637
|
+
let bootAttempts;
|
|
638
|
+
let bootSummaries;
|
|
639
|
+
try {
|
|
640
|
+
const controlDir = realDirNoSymlink(root, ".cotal") ? "real" : "absent";
|
|
641
|
+
if (controlDir === "real")
|
|
642
|
+
assertSingleSpaceBroker(authDir(root), "team boot preview");
|
|
643
|
+
const manager = controlDir === "real" ? managerRecordState(undefined, undefined, space, root) : null;
|
|
644
|
+
localState = { controlDir, recordedSpaces: controlDir === "real" ? localMeshesForRoot(root).map((entry) => entry.space) : [],
|
|
645
|
+
maintenance: controlDir === "real" ? readMaintenanceJournal(root)?.state ?? "none-recorded" : "not-checked",
|
|
646
|
+
possibleProcesses: controlDir === "real" ? liveMeshProcesses(root, space) : [],
|
|
647
|
+
managerRecord: manager ? { state: manager.state, pid: manager.pid ?? null, path: manager.path } : null };
|
|
648
|
+
serviceCensus = readLocalServiceCensus(space);
|
|
649
|
+
additiveRecords = controlDir === "real" ? listLedgerFiles(root, { requireReadable: true }) : { valid: [], refused: [] };
|
|
650
|
+
additiveAttempts = controlDir === "real" ? listAdditiveTeamAttempts(root) : { valid: [], steps: [], agentSteps: [], returned: [], refused: [] };
|
|
651
|
+
bootAttempts = controlDir === "real" ? listFreshTeamAttempts(root) : { valid: [], refused: [] };
|
|
652
|
+
bootSummaries = controlDir === "real" ? listFreshTeamSummaries(root) : { valid: [], refused: [] };
|
|
653
|
+
}
|
|
654
|
+
catch (error) {
|
|
655
|
+
if (error instanceof CommandFailure)
|
|
656
|
+
throw error;
|
|
657
|
+
throw new CommandFailure("refused", "CONFLICT", "the boot root's control directory, tenant inventory, maintenance state, additive ledgers, process records or selected-space service records could not be read safely; no startup eligibility was inferred", { target: { space, root } });
|
|
658
|
+
}
|
|
659
|
+
const openDurable = prepared.manifest.broker?.auth === false && (prepared.manifest.defaults?.deliveryClass === "durable" || prepared.manifest.channels.some((channel) => channel.deliveryClass === "durable"));
|
|
660
|
+
const candidate = prepared.manifest.broker?.host && !prepared.manifest.broker?.servers ? null : prepared.manifest.broker?.servers ?? DEFAULT_SERVER;
|
|
661
|
+
let otherBrokerRegistrations = null;
|
|
662
|
+
if (candidate) {
|
|
663
|
+
try {
|
|
664
|
+
otherBrokerRegistrations = loadMeshes().filter((row) => row.space !== space && row.server === candidate).map((row) => ({ space: row.space, root: row.root, origin: row.origin ?? "not recorded" }));
|
|
665
|
+
}
|
|
666
|
+
catch {
|
|
667
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the local broker registration list could not be read; an exact-address sharing snapshot was not inferred", { target: { space, root } });
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
let brokerProbe = "not-checked";
|
|
671
|
+
if (candidate) {
|
|
672
|
+
try {
|
|
673
|
+
brokerProbe = await isReachable(candidate) ? "credless-broker-response" : "no-credless-response";
|
|
674
|
+
}
|
|
675
|
+
catch {
|
|
676
|
+
brokerProbe = "probe-failed";
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
const result = { kind: "fresh-team-boot-preview", dryRun: true, path, space, root,
|
|
680
|
+
rootSource: waiting ? "prepared-local-record" : local ? "local-up-registration" : "invoking-folder-unprepared",
|
|
681
|
+
localState, serviceCensus,
|
|
682
|
+
additiveLedgers: additiveRecords.valid.map(({ ledger }) => ({ deploymentId: ledger.runId, space: ledger.space, agents: ledger.created.agents.length, channels: ledger.created.channels.length })),
|
|
683
|
+
unreadableAdditiveLedgers: additiveRecords.refused.map(({ path }) => path),
|
|
684
|
+
additiveAttempts: additiveAttempts.valid.map((attempt) => ({ deploymentId: attempt.deploymentId, space: attempt.space, server: brokerAddressForDisplay(attempt.server) ?? "not displayable", createdAt: attempt.createdAt, recordedState: additiveTeamRecordedState(attempt, additiveAttempts) })),
|
|
685
|
+
unreadableAdditiveAttempts: additiveAttempts.refused.map(({ path }) => path),
|
|
686
|
+
bootAttempts: bootAttempts.valid.map((attempt) => ({ deploymentId: attempt.deploymentId, space: attempt.space, server: brokerAddressForDisplay(attempt.server) ?? "not displayable", createdAt: attempt.createdAt,
|
|
687
|
+
matchedSummary: bootSummaries.valid.some((summary) => freshTeamAttemptSettled(attempt, summary)) })),
|
|
688
|
+
unreadableBootRecords: [...bootAttempts.refused, ...bootSummaries.refused].map(({ path }) => path),
|
|
689
|
+
additiveInventory: localState.controlDir === "real" ? "selected-root-local-ledgers" : "not-checked-no-control-directory",
|
|
690
|
+
brokerCandidate: candidate ? brokerAddressForDisplay(candidate) ?? null : null, brokerProbe, otherBrokerRegistrations,
|
|
691
|
+
brokerAddressScope: candidate ? "exact local registration matches only; aliases and live tenants not checked" : "host-derived at apply; exact local matches not checked",
|
|
692
|
+
lifetimeRequest: values.foreground ? "terminal-bound" : "background",
|
|
693
|
+
runtime: prepared.manifest.runtime ?? "pty",
|
|
694
|
+
authMode: prepared.manifest.broker?.auth === false ? "open" : prepared.manifest.broker?.auth === "user" ? "user" : "static",
|
|
695
|
+
agents: prepared.agents.map((agent) => ({ name: agent.name, application: agent.agentType, role: agent.role ?? null, requestedModel: agent.model ?? null })),
|
|
696
|
+
channels: prepared.manifest.channels.map((channel) => ({ name: channel.name, deliveryClass: channel.deliveryClass ?? null, replay: channel.replay ?? null, replayWindow: channel.replayWindow ?? null })),
|
|
697
|
+
nativePreflight: "local-read-and-credless-probe-only", openDurableUnsupported: openDurable, effectAttempted: false, persisted: false };
|
|
698
|
+
writeResult(presentationOf(values), { command: "team boot", target: { space, root, path }, result, completeness: "partial", partial: { message: "Local process, additive ledger and selected-space service records, any exact-address registration matches and a credless broker probe were read, but broker exclusivity, service root ownership, native attempt settlement, bind authority, credentials, provider availability and startup readiness have not been checked.", remedy: waiting || local ? "inspect the selected local root and native startup guards before a future apply" : "prepare this folder explicitly with cotal space create <space> --root . before a future apply" }, warnings: [...prepared.warnings.map((warning) => ({ code: "MANIFEST_WARNING", target: { agent: warning.agent }, message: warning.message })), ...(openDurable ? [{ code: "OPEN_DURABLE_UNSUPPORTED", target: { space }, message: "The open manifest declares durable delivery, but its broker has no delivery daemon; fresh apply refuses before writing." }] : []), ...(otherBrokerRegistrations?.length ? [{ code: "BROKER_ADDRESS_SHARED", target: { space, root, otherSpaces: otherBrokerRegistrations.map((row) => row.space) }, message: "Other local registrations name this exact broker address; fresh apply refuses rather than binding over their recorded target." }] : []), ...(additiveRecords.valid.length || additiveRecords.refused.length ? [{ code: "ADDITIVE_OWNERSHIP_REMAINS", target: { space, root, deploymentIds: additiveRecords.valid.map(({ ledger }) => ledger.runId), unreadable: additiveRecords.refused.map(({ path }) => path) }, message: "Additive ledgers remain under this boot root. Fresh apply refuses until their lifecycle is resolved; unreadable ledgers are not absence." }] : []), ...(additiveAttempts.valid.length || additiveAttempts.refused.length ? [{ code: "ADDITIVE_ATTEMPT_REMAINS", target: { space, root, deploymentIds: additiveAttempts.valid.map((attempt) => attempt.deploymentId), unreadable: additiveAttempts.refused.map(({ path }) => path) }, message: "An additive intent is retained under this boot root. Fresh apply cannot infer its native outcome and refuses." }] : [])] }, (data) => ({ sections: [
|
|
699
|
+
{ title: "Fresh team local impact", blocks: [{ kind: "fields", rows: [["Space", data.space], ["Local root", data.root], ["Root source", data.rootSource], ["Control directory", data.localState.controlDir], ["Other locally recorded spaces", data.localState.recordedSpaces.join(", ") || "none"], ["Maintenance", data.localState.maintenance], ["Manager record", data.localState.managerRecord ? `${data.localState.managerRecord.state}${data.localState.managerRecord.pid === null ? "" : ` (pid ${data.localState.managerRecord.pid})`}` : "not checked"], ["Possibly live recorded processes", data.localState.possibleProcesses.join(", ") || "none found"], ["Broker candidate", data.brokerCandidate ?? "host-derived at apply; not probed"], ["Credless broker probe", data.brokerProbe], ["Other exact-address registrations", data.otherBrokerRegistrations === null ? "not checked" : String(data.otherBrokerRegistrations.length)], ["Manifest", data.path], ["Runtime request", data.runtime], ["Lifetime request", data.lifetimeRequest], ["Auth mode request", data.authMode], ["Durable delivery on open", data.openDurableUnsupported ? "unsupported at apply" : "not a contradiction"], ["Agents requested", String(data.agents.length)], ["Channels declared", String(data.channels.length)], ["Saved service definitions", String(data.serviceCensus.serviceDefinitions.length)], ["Saved service instances", String(data.serviceCensus.serviceRecords.length)], ["Supervisor receipts", String(data.serviceCensus.supervisors.length)], ["Retained native attempts", String(data.serviceCensus.nativeAttempts.length)], ["Additive ledgers", data.additiveInventory === "selected-root-local-ledgers" ? String(data.additiveLedgers.length) : "not checked"], ["Unreadable additive ledgers", data.additiveInventory === "selected-root-local-ledgers" ? String(data.unreadableAdditiveLedgers.length) : "not checked"], ["Additive attempts", data.additiveInventory === "selected-root-local-ledgers" ? String(data.additiveAttempts.length) : "not checked"], ["Unreadable additive attempts", data.additiveInventory === "selected-root-local-ledgers" ? String(data.unreadableAdditiveAttempts.length) : "not checked"], ["Fresh boot attempts", data.additiveInventory === "selected-root-local-ledgers" ? String(data.bootAttempts.length) : "not checked"], ["Unsettled fresh attempts", data.additiveInventory === "selected-root-local-ledgers" ? String(data.bootAttempts.filter((attempt) => !attempt.matchedSummary).length) : "not checked"], ["Unreadable fresh records", data.additiveInventory === "selected-root-local-ledgers" ? String(data.unreadableBootRecords.length) : "not checked"]] }, { kind: "lines", lines: [{ text: "A dead manager PID record remains visible here even when the possibly-live list omits it. Neither that record nor a credless probe proves safe reuse, broker absence on a TLS-first address, or authority to stop a leftover process. Bind authority, credentials, provider readiness and startup ownership remain unproved. No process or native resource was started.", tone: "waiting" }] }] },
|
|
700
|
+
{ title: "Recorded additive deployments", blocks: [data.additiveLedgers.length ? { kind: "table", columns: [{ key: "id", label: "Deployment" }, { key: "space", label: "Recorded space" }, { key: "agents", label: "Agent rows" }, { key: "channels", label: "Channel rows" }], rows: data.additiveLedgers.slice(0, 100).map((row) => ({ id: row.deploymentId, space: row.space, agents: String(row.agents), channels: String(row.channels) })) } : { kind: "lines", lines: [data.additiveInventory === "selected-root-local-ledgers" ? "No readable additive deployment ledgers in this root." : "The unprepared root has no control directory; additive ownership was not checked."] }, { kind: "lines", lines: [...(data.additiveLedgers.length > 100 ? ["Additional additive ledgers are in JSON."] : []), ...data.unreadableAdditiveLedgers.slice(0, 100).map((path) => `Unreadable ledger: ${path}`), ...(data.unreadableAdditiveLedgers.length > 100 ? ["Additional unreadable ledger paths are in JSON."] : []), "A recorded or unreadable additive ledger blocks fresh apply. The preview neither adopts nor tears down its resources."] }] },
|
|
701
|
+
{ title: "Retained additive deployments", blocks: [data.additiveAttempts.length ? { kind: "table", columns: [{ key: "id", label: "Deployment" }, { key: "space", label: "Space" }, { key: "state", label: "Recorded state" }], rows: data.additiveAttempts.slice(0, 100).map((attempt) => ({ id: attempt.deploymentId, space: attempt.space, state: attempt.recordedState })) } : { kind: "lines", lines: ["No readable additive attempts in this root."] }, { kind: "lines", lines: [...data.unreadableAdditiveAttempts.slice(0, 100).map((path) => `Unreadable additive attempt: ${path}`), ...(data.additiveAttempts.length > 100 || data.unreadableAdditiveAttempts.length > 100 ? ["Additional attempts or paths are in JSON."] : []), "An unsettled or unremoved additive deployment blocks a fresh boot. A complete matched removal receipt (static agent retirement or channel card deletion) releases only that known blocker; other service, broker and process custody is still checked."] }] },
|
|
702
|
+
{ title: "Fresh boot attempts", blocks: [data.bootAttempts.length ? { kind: "table", columns: [{ key: "id", label: "Deployment" }, { key: "space", label: "Space" }, { key: "summary", label: "Returned summary" }], rows: data.bootAttempts.slice(0, 100).map((attempt) => ({ id: attempt.deploymentId, space: attempt.space, summary: attempt.matchedSummary ? "matched" : "unsettled" })) } : { kind: "lines", lines: ["No readable fresh boot attempts under this root."] }, { kind: "lines", lines: [...(data.bootAttempts.length > 100 ? ["Additional attempts are in JSON."] : []), ...data.unreadableBootRecords.slice(0, 100).map((path) => `Unreadable fresh record: ${path}`), ...(data.unreadableBootRecords.length > 100 ? ["Additional unreadable paths are in JSON."] : []), "An unsettled attempt or unreadable fresh record blocks a new boot. Even a matched summary is not current broker or agent liveness."] }] },
|
|
703
|
+
{ title: "Recorded broker address matches", blocks: [data.otherBrokerRegistrations === null ? { kind: "lines", lines: ["Broker address is host-derived at apply; exact local registrations were not compared."] } : data.otherBrokerRegistrations.length ? { kind: "table", columns: [{ key: "space", label: "Other space" }, { key: "root", label: "Recorded root" }, { key: "origin", label: "Registration" }], rows: data.otherBrokerRegistrations.slice(0, 100) } : { kind: "lines", lines: ["No other registration uses this exact candidate address in the local workstation registry."] }, { kind: "lines", lines: [...((data.otherBrokerRegistrations?.length ?? 0) > 100 ? ["Additional exact-address matches are in JSON."] : []), "A match blocks fresh apply. No match does not prove an exclusive broker: address aliases, remote tenants and live attachments were not checked."] }] },
|
|
704
|
+
{ title: "Selected-space service records", blocks: [data.serviceCensus.serviceRecords.length ? { kind: "table", columns: [{ key: "definition", label: "Definition" }, { key: "instance", label: "Full instance" }, { key: "state", label: "Recorded state" }], rows: data.serviceCensus.serviceRecords.slice(0, 100).map((row) => ({ definition: row.definition, instance: row.instanceId, state: row.recordedState })) } : { kind: "lines", lines: ["No service instance records in this space's workstation store."] }, { kind: "lines", lines: [...(data.serviceCensus.serviceRecords.length > 100 ? ["Additional instance records are in JSON."] : []), "Definitions and supervisor receipts are also in JSON. These space-scoped records are not attributed to this boot root or established as live; a future apply must recheck them before writing."] }] },
|
|
705
|
+
{ title: "Retained native attempts", blocks: [data.serviceCensus.nativeAttempts.length ? { kind: "table", columns: [{ key: "kind", label: "Action" }, { key: "instance", label: "Full instance" }, { key: "step", label: "Step" }, { key: "position", label: "Position" }], rows: data.serviceCensus.nativeAttempts.slice(0, 100).map((row) => ({ kind: row.kind, instance: row.instanceId, step: row.step, position: row.position })) } : { kind: "lines", lines: ["No retained native attempts in this space's workstation store."] }, ...(data.serviceCensus.nativeAttempts.length > 100 ? [{ kind: "lines", lines: ["Additional attempts are in JSON."] }] : [])] },
|
|
706
|
+
{ title: "Requested agents", blocks: [data.agents.length ? { kind: "table", columns: [{ key: "name", label: "Name" }, { key: "application", label: "Application" }, { key: "role", label: "Role" }, { key: "model", label: "Model request" }], rows: data.agents.slice(0, 100).map((agent) => ({ name: agent.name, application: agent.application, role: agent.role ?? "none", model: agent.requestedModel ?? "application default" })) } : { kind: "lines", lines: ["No agents requested."] }, ...(data.agents.length > 100 ? [{ kind: "lines", lines: ["Additional requested agents are in JSON."] }] : [])] },
|
|
707
|
+
{ title: "Declared channels", blocks: [data.channels.length ? { kind: "table", columns: [{ key: "name", label: "Channel" }, { key: "delivery", label: "Delivery class" }, { key: "replay", label: "Replay" }, { key: "window", label: "Replay window" }], rows: data.channels.slice(0, 100).map((channel) => ({ name: `#${channel.name}`, delivery: channel.deliveryClass ?? "not declared", replay: channel.replay === null ? "not declared" : channel.replay ? "on" : "off", window: channel.replayWindow ?? "not declared" })) } : { kind: "lines", lines: ["No channels declared."] }, { kind: "lines", lines: [...(data.channels.length > 100 ? ["Additional channels are in JSON."] : []), "Only declared values are shown. The preview does not read saved channel metadata or infer final effective policy."] }] },
|
|
708
|
+
] }));
|
|
709
|
+
}
|
|
710
|
+
async function checkTeam(file, values) {
|
|
711
|
+
const { path, prepared } = readTeamFile(file, values);
|
|
712
|
+
const openDurable = prepared.manifest.broker?.auth === false && (prepared.manifest.defaults?.deliveryClass === "durable" || prepared.manifest.channels.some((channel) => channel.deliveryClass === "durable"));
|
|
713
|
+
const result = { kind: "team-check", file: path, space: prepared.manifest.space, runtime: prepared.manifest.runtime ?? "pty",
|
|
714
|
+
agents: prepared.agents.map((agent) => ({ name: agent.name, harness: agent.agentType, role: agent.role ?? null, model: agent.model ?? null, policy: agent.policy, inherited: agent.inherited, capabilities: agent.capabilities, capabilitySource: agent.capabilitySource })),
|
|
715
|
+
channels: prepared.manifest.channels.map((channel) => ({ name: channel.name, subscribe: channel.subscribe, allowSubscribe: channel.allowSubscribe, allowPublish: channel.allowPublish,
|
|
716
|
+
deliveryClass: channel.deliveryClass ?? null, replay: channel.replay ?? null, replayWindow: channel.replayWindow ?? null })),
|
|
717
|
+
graph: values.graph ? accessGraph(prepared) : null,
|
|
718
|
+
};
|
|
719
|
+
writeResult(presentationOf(values), { command: "team", target: { space: result.space, path }, result: { ...result, openDurableUnsupported: openDurable }, warnings: [...prepared.warnings.map((warning) => ({ code: "MANIFEST_WARNING", target: { agent: warning.agent }, message: warning.message })), ...(openDurable ? [{ code: "OPEN_DURABLE_UNSUPPORTED", target: { space: result.space }, message: "This open manifest explicitly declares durable delivery, but open mode has no delivery daemon; fresh apply refuses before effects." }] : [])] }, (data) => ({ sections: [
|
|
720
|
+
{ title: "Team manifest resolved", blocks: [{ kind: "fields", rows: [["File", data.file], ["Space", data.space], ["Runtime", data.runtime], ["Agents", String(data.agents.length)], ["Channels", String(data.channels.length)], ["Durable delivery on open", data.openDurableUnsupported ? "unsupported at fresh apply" : "not a contradiction"]] }, { kind: "table", columns: [{ key: "name", label: "Agent" }, { key: "harness", label: "Application" }, { key: "role", label: "Role" }, { key: "model", label: "Declared model" }], rows: data.agents.slice(0, 100).map((agent) => ({ name: agent.name, harness: agent.harness, role: agent.role ?? "none", model: agent.model ?? "application default" })) }, ...(data.agents.length > 100 ? [{ kind: "lines", lines: ["Additional resolved agents are in JSON."] }] : []), { kind: "lines", lines: [{ text: "File and persona resolution only. No broker, runtime availability, grants, reservations or launch readiness were checked. Persona bodies and kickoff prompts are not printed.", tone: "hint" }] }] },
|
|
721
|
+
{ title: "Declared channel policy", blocks: [data.channels.length ? { kind: "table", columns: [{ key: "name", label: "Channel" }, { key: "delivery", label: "Delivery class" }, { key: "replay", label: "Replay" }, { key: "window", label: "Replay window" }], rows: data.channels.slice(0, 100).map((channel) => ({ name: `#${channel.name}`, delivery: channel.deliveryClass ?? "not declared", replay: channel.replay === null ? "not declared" : channel.replay ? "on" : "off", window: channel.replayWindow ?? "not declared" })) } : { kind: "lines", lines: ["No channels declared."] }, { kind: "lines", lines: [...(data.channels.length > 100 ? ["Additional channel policies are in JSON."] : []), "Only manifest-declared values are shown. An absent field may inherit saved registry metadata at boot; this offline check does not read the broker."] }] },
|
|
722
|
+
...(values.graph ? [
|
|
723
|
+
{ title: "Effective channel access", blocks: [{ kind: "table", columns: [{ key: "channel", label: "Channel" }, { key: "source", label: "Source" }, { key: "listen", label: "Initially listening" }, { key: "read", label: "May read" }, { key: "post", label: "May post" }], rows: (data.graph ?? []).slice(0, 100).map((channel) => ({ channel: `#${channel.name}`, source: channel.source, listen: channel.subscribe.join(", ") || "none", read: channel.allowSubscribe.join(", ") || "none", post: channel.allowPublish.join(", ") || "none" })) }, { kind: "lines", lines: [...((data.graph?.length ?? 0) > 100 ? ["Additional access edges are in JSON."] : []), "Persona-inherited channels have no manifest card. These are resolved access intentions, not registered channels, observed membership or live grants."] }] },
|
|
724
|
+
{ title: "Agent capability intent", blocks: [data.agents.length ? { kind: "table", columns: [{ key: "agent", label: "Agent" }, { key: "role", label: "Role" }, { key: "capabilities", label: "Capabilities" }, { key: "source", label: "Source" }], rows: data.agents.slice(0, 100).map((agent) => ({ agent: agent.name, role: agent.role ?? "none", capabilities: agent.capabilities.join(", ") || "none", source: agent.capabilitySource })) } : { kind: "lines", lines: ["No agents declared."] }, { kind: "lines", lines: [...(data.agents.length > 100 ? ["Additional capability intentions are in JSON."] : []), "A role or capability in a resolved manifest is not an issued credential. No broker, provider or grant was contacted."] }] },
|
|
725
|
+
] : []),
|
|
726
|
+
] }));
|
|
727
|
+
}
|
|
728
|
+
//# sourceMappingURL=team.js.map
|