@cotal-ai/cli 0.100.2 → 0.101.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/chat-view.d.ts.map +1 -1
- package/dist/chat/chat-view.js +5 -1
- package/dist/chat/chat-view.js.map +1 -1
- package/dist/chat/engine.d.ts +2 -1
- package/dist/chat/engine.d.ts.map +1 -1
- package/dist/chat/engine.js +2 -1
- package/dist/chat/engine.js.map +1 -1
- package/dist/chat/frontend.d.ts.map +1 -1
- package/dist/chat/frontend.js +13 -7
- package/dist/chat/frontend.js.map +1 -1
- package/dist/chat/native-session.d.ts +22 -3
- package/dist/chat/native-session.d.ts.map +1 -1
- package/dist/chat/native-session.js +91 -19
- package/dist/chat/native-session.js.map +1 -1
- package/dist/chat/open-session.d.ts +1 -0
- package/dist/chat/open-session.d.ts.map +1 -1
- package/dist/chat/open-session.js +1 -1
- package/dist/chat/open-session.js.map +1 -1
- package/dist/chat/picker.d.ts +5 -0
- package/dist/chat/picker.d.ts.map +1 -1
- package/dist/chat/picker.js +23 -10
- package/dist/chat/picker.js.map +1 -1
- package/dist/chat/plain.d.ts.map +1 -1
- package/dist/chat/plain.js +36 -10
- package/dist/chat/plain.js.map +1 -1
- package/dist/chat/session.d.ts +5 -0
- package/dist/chat/session.d.ts.map +1 -1
- package/dist/chat/static-session.d.ts +1 -0
- package/dist/chat/static-session.d.ts.map +1 -1
- package/dist/chat/static-session.js +24 -8
- package/dist/chat/static-session.js.map +1 -1
- package/dist/chat/stdio-io.d.ts +2 -0
- package/dist/chat/stdio-io.d.ts.map +1 -1
- package/dist/chat/stdio-io.js +6 -6
- package/dist/chat/stdio-io.js.map +1 -1
- package/dist/chat/stdio.d.ts +3 -2
- package/dist/chat/stdio.d.ts.map +1 -1
- package/dist/chat/stdio.js +26 -25
- package/dist/chat/stdio.js.map +1 -1
- package/dist/chat/user-session.d.ts +1 -0
- package/dist/chat/user-session.d.ts.map +1 -1
- package/dist/chat/user-session.js +1 -1
- package/dist/chat/user-session.js.map +1 -1
- package/dist/chat/view.d.ts +5 -4
- package/dist/chat/view.d.ts.map +1 -1
- package/dist/chat/view.js +10 -8
- package/dist/chat/view.js.map +1 -1
- package/dist/command.d.ts +5 -0
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +295 -82
- package/dist/command.js.map +1 -1
- package/dist/commands/agents.d.ts +29 -5
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +100 -35
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/backup-maintenance.d.ts.map +1 -1
- package/dist/commands/backup-maintenance.js +54 -21
- package/dist/commands/backup-maintenance.js.map +1 -1
- package/dist/commands/backup-read.d.ts.map +1 -1
- package/dist/commands/backup-read.js +12 -15
- package/dist/commands/backup-read.js.map +1 -1
- package/dist/commands/backup-restore.d.ts.map +1 -1
- package/dist/commands/backup-restore.js +20 -4
- package/dist/commands/backup-restore.js.map +1 -1
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +156 -28
- package/dist/commands/backup.js.map +1 -1
- package/dist/commands/channel-members.d.ts +1 -1
- package/dist/commands/channel-members.d.ts.map +1 -1
- package/dist/commands/channel-members.js +115 -29
- package/dist/commands/channel-members.js.map +1 -1
- package/dist/commands/channels.d.ts +11 -1
- package/dist/commands/channels.d.ts.map +1 -1
- package/dist/commands/channels.js +109 -20
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/chat.d.ts +11 -3
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +50 -22
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/clean.d.ts +10 -5
- package/dist/commands/clean.d.ts.map +1 -1
- package/dist/commands/clean.js +245 -42
- package/dist/commands/clean.js.map +1 -1
- package/dist/commands/completion.d.ts +15 -2
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +91 -26
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/config.d.ts +24 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +65 -13
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/console.d.ts.map +1 -1
- package/dist/commands/console.js +5 -4
- package/dist/commands/console.js.map +1 -1
- package/dist/commands/describe.d.ts +4 -2
- package/dist/commands/describe.d.ts.map +1 -1
- package/dist/commands/describe.js +4 -4
- package/dist/commands/describe.js.map +1 -1
- package/dist/commands/doctor.d.ts +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +261 -34
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/down-manifest.d.ts.map +1 -1
- package/dist/commands/down-manifest.js +9 -6
- package/dist/commands/down-manifest.js.map +1 -1
- package/dist/commands/down-services.d.ts +17 -16
- package/dist/commands/down-services.d.ts.map +1 -1
- package/dist/commands/down-services.js +29 -53
- package/dist/commands/down-services.js.map +1 -1
- package/dist/commands/down.d.ts +2 -2
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +96 -67
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/endpoint-deregister.d.ts.map +1 -1
- package/dist/commands/endpoint-deregister.js +2 -2
- package/dist/commands/endpoint-deregister.js.map +1 -1
- package/dist/commands/endpoint.d.ts +2 -1
- package/dist/commands/endpoint.d.ts.map +1 -1
- package/dist/commands/endpoint.js +2 -2
- package/dist/commands/endpoint.js.map +1 -1
- package/dist/commands/endpoints.d.ts +1 -0
- package/dist/commands/endpoints.d.ts.map +1 -1
- package/dist/commands/endpoints.js +20 -5
- package/dist/commands/endpoints.js.map +1 -1
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +40 -2
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/help.d.ts.map +1 -1
- package/dist/commands/help.js +2 -1
- package/dist/commands/help.js.map +1 -1
- package/dist/commands/history-clear.d.ts.map +1 -1
- package/dist/commands/history-clear.js +67 -51
- package/dist/commands/history-clear.js.map +1 -1
- package/dist/commands/history.d.ts +17 -2
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +221 -34
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/join.d.ts +2 -0
- package/dist/commands/join.d.ts.map +1 -1
- package/dist/commands/join.js +132 -80
- package/dist/commands/join.js.map +1 -1
- package/dist/commands/meshes-add.d.ts +19 -4
- package/dist/commands/meshes-add.d.ts.map +1 -1
- package/dist/commands/meshes-add.js +114 -15
- package/dist/commands/meshes-add.js.map +1 -1
- package/dist/commands/meshes-wizard.d.ts +1 -0
- package/dist/commands/meshes-wizard.d.ts.map +1 -1
- package/dist/commands/meshes-wizard.js +45 -13
- package/dist/commands/meshes-wizard.js.map +1 -1
- package/dist/commands/meshes.d.ts +1 -1
- package/dist/commands/meshes.d.ts.map +1 -1
- package/dist/commands/meshes.js +76 -47
- package/dist/commands/meshes.js.map +1 -1
- package/dist/commands/mint.d.ts.map +1 -1
- package/dist/commands/mint.js +212 -19
- package/dist/commands/mint.js.map +1 -1
- package/dist/commands/models.d.ts +5 -1
- package/dist/commands/models.d.ts.map +1 -1
- package/dist/commands/models.js +21 -13
- package/dist/commands/models.js.map +1 -1
- package/dist/commands/persona-remote.d.ts.map +1 -1
- package/dist/commands/persona-remote.js +24 -13
- package/dist/commands/persona-remote.js.map +1 -1
- package/dist/commands/persona.d.ts +1 -1
- package/dist/commands/persona.d.ts.map +1 -1
- package/dist/commands/persona.js +92 -23
- package/dist/commands/persona.js.map +1 -1
- package/dist/commands/personas.d.ts.map +1 -1
- package/dist/commands/personas.js +59 -40
- package/dist/commands/personas.js.map +1 -1
- package/dist/commands/reset-space-apply.d.ts.map +1 -1
- package/dist/commands/reset-space-apply.js +69 -17
- package/dist/commands/reset-space-apply.js.map +1 -1
- package/dist/commands/reset-store-apply.d.ts +16 -0
- package/dist/commands/reset-store-apply.d.ts.map +1 -1
- package/dist/commands/reset-store-apply.js +122 -23
- package/dist/commands/reset-store-apply.js.map +1 -1
- package/dist/commands/reset.d.ts.map +1 -1
- package/dist/commands/reset.js +8 -7
- package/dist/commands/reset.js.map +1 -1
- package/dist/commands/revoke-credential.d.ts +5 -0
- package/dist/commands/revoke-credential.d.ts.map +1 -0
- package/dist/commands/revoke-credential.js +128 -0
- package/dist/commands/revoke-credential.js.map +1 -0
- package/dist/commands/send.d.ts +11 -3
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +284 -47
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/service-actions.d.ts +2 -1
- package/dist/commands/service-actions.d.ts.map +1 -1
- package/dist/commands/service-actions.js +117 -21
- package/dist/commands/service-actions.js.map +1 -1
- package/dist/commands/service-log-follow.js +1 -1
- package/dist/commands/service-log-follow.js.map +1 -1
- package/dist/commands/service-registry.d.ts +1 -1
- package/dist/commands/service-registry.d.ts.map +1 -1
- package/dist/commands/service-registry.js +74 -30
- package/dist/commands/service-registry.js.map +1 -1
- package/dist/commands/service-set-stop.d.ts.map +1 -1
- package/dist/commands/service-set-stop.js +3 -2
- package/dist/commands/service-set-stop.js.map +1 -1
- package/dist/commands/setup-start.d.ts.map +1 -1
- package/dist/commands/setup-start.js +46 -5
- package/dist/commands/setup-start.js.map +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +28 -13
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/space-delete.d.ts.map +1 -1
- package/dist/commands/space-delete.js +130 -41
- package/dist/commands/space-delete.js.map +1 -1
- package/dist/commands/space-registration.d.ts +13 -6
- package/dist/commands/space-registration.d.ts.map +1 -1
- package/dist/commands/space-registration.js +167 -46
- package/dist/commands/space-registration.js.map +1 -1
- package/dist/commands/space.d.ts +15 -1
- package/dist/commands/space.d.ts.map +1 -1
- package/dist/commands/space.js +66 -24
- package/dist/commands/space.js.map +1 -1
- package/dist/commands/spawn-preview.d.ts.map +1 -1
- package/dist/commands/spawn-preview.js +48 -10
- package/dist/commands/spawn-preview.js.map +1 -1
- package/dist/commands/spawn.d.ts +36 -13
- package/dist/commands/spawn.d.ts.map +1 -1
- package/dist/commands/spawn.js +306 -130
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/stack-down.d.ts +9 -3
- package/dist/commands/stack-down.d.ts.map +1 -1
- package/dist/commands/stack-down.js +348 -64
- package/dist/commands/stack-down.js.map +1 -1
- package/dist/commands/stack-gone.d.ts +17 -0
- package/dist/commands/stack-gone.d.ts.map +1 -0
- package/dist/commands/stack-gone.js +218 -0
- package/dist/commands/stack-gone.js.map +1 -0
- package/dist/commands/stack-up.d.ts +64 -4
- package/dist/commands/stack-up.d.ts.map +1 -1
- package/dist/commands/stack-up.js +482 -55
- package/dist/commands/stack-up.js.map +1 -1
- package/dist/commands/status.d.ts +76 -2
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +550 -112
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/team-agent-apply.d.ts.map +1 -1
- package/dist/commands/team-agent-apply.js +4 -3
- package/dist/commands/team-agent-apply.js.map +1 -1
- package/dist/commands/team-agent-remove.d.ts.map +1 -1
- package/dist/commands/team-agent-remove.js +4 -4
- package/dist/commands/team-agent-remove.js.map +1 -1
- package/dist/commands/team-boot-controller.d.ts.map +1 -1
- package/dist/commands/team-boot-controller.js +8 -2
- package/dist/commands/team-boot-controller.js.map +1 -1
- package/dist/commands/team-channel-remove.d.ts.map +1 -1
- package/dist/commands/team-channel-remove.js +26 -10
- package/dist/commands/team-channel-remove.js.map +1 -1
- package/dist/commands/team-deploy-apply.d.ts.map +1 -1
- package/dist/commands/team-deploy-apply.js +4 -3
- package/dist/commands/team-deploy-apply.js.map +1 -1
- package/dist/commands/team-mixed-remove.js +5 -5
- package/dist/commands/team-mixed-remove.js.map +1 -1
- package/dist/commands/team.d.ts.map +1 -1
- package/dist/commands/team.js +94 -32
- package/dist/commands/team.js.map +1 -1
- package/dist/commands/telemetry.d.ts.map +1 -1
- package/dist/commands/telemetry.js +3 -1
- package/dist/commands/telemetry.js.map +1 -1
- package/dist/commands/topology.d.ts.map +1 -1
- package/dist/commands/topology.js +11 -7
- package/dist/commands/topology.js.map +1 -1
- package/dist/commands/up.d.ts +6 -6
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +963 -240
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +9 -3
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/use.d.ts +5 -1
- package/dist/commands/use.d.ts.map +1 -1
- package/dist/commands/use.js +55 -12
- package/dist/commands/use.js.map +1 -1
- package/dist/commands/watch.d.ts +4 -1
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +15 -3
- package/dist/commands/watch.js.map +1 -1
- package/dist/commands/who.d.ts +2 -0
- package/dist/commands/who.d.ts.map +1 -1
- package/dist/commands/who.js +18 -5
- package/dist/commands/who.js.map +1 -1
- package/dist/commands/whoami.d.ts +44 -5
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +168 -16
- package/dist/commands/whoami.js.map +1 -1
- package/dist/console/app.d.ts +1 -1
- package/dist/console/app.d.ts.map +1 -1
- package/dist/console/app.js +15 -9
- package/dist/console/app.js.map +1 -1
- package/dist/console/launch.d.ts +25 -0
- package/dist/console/launch.d.ts.map +1 -0
- package/dist/console/launch.js +56 -0
- package/dist/console/launch.js.map +1 -0
- package/dist/console/ui/CommandPalette.d.ts +5 -4
- package/dist/console/ui/CommandPalette.d.ts.map +1 -1
- package/dist/console/ui/CommandPalette.js +136 -45
- package/dist/console/ui/CommandPalette.js.map +1 -1
- package/dist/console/ui/Help.js +1 -1
- package/dist/console/ui/Help.js.map +1 -1
- package/dist/console/ui/Modal.d.ts +10 -0
- package/dist/console/ui/Modal.d.ts.map +1 -0
- package/dist/console/ui/Modal.js +8 -0
- package/dist/console/ui/Modal.js.map +1 -0
- package/dist/console/ui/NewAgent.d.ts +14 -0
- package/dist/console/ui/NewAgent.d.ts.map +1 -0
- package/dist/console/ui/NewAgent.js +114 -0
- package/dist/console/ui/NewAgent.js.map +1 -0
- package/dist/console/ui/StatusBar.d.ts +1 -2
- package/dist/console/ui/StatusBar.d.ts.map +1 -1
- package/dist/console/ui/StatusBar.js +6 -8
- package/dist/console/ui/StatusBar.js.map +1 -1
- package/dist/console/ui/topo/Map.d.ts.map +1 -1
- package/dist/console/ui/topo/Map.js +1 -2
- package/dist/console/ui/topo/Map.js.map +1 -1
- package/dist/console/ui/topo/Matrix.js +2 -2
- package/dist/console/ui/topo/Matrix.js.map +1 -1
- package/dist/console/ui/topo/Sequence.d.ts.map +1 -1
- package/dist/console/ui/topo/Sequence.js +5 -4
- package/dist/console/ui/topo/Sequence.js.map +1 -1
- package/dist/console/ui/topo/model.d.ts +2 -1
- package/dist/console/ui/topo/model.d.ts.map +1 -1
- package/dist/console/ui/topo/model.js +4 -3
- package/dist/console/ui/topo/model.js.map +1 -1
- package/dist/exec-endpoint/service-adapter.d.ts.map +1 -1
- package/dist/exec-endpoint/service-adapter.js +13 -3
- package/dist/exec-endpoint/service-adapter.js.map +1 -1
- package/dist/ext-loader.d.ts +4 -0
- package/dist/ext-loader.d.ts.map +1 -1
- package/dist/ext-loader.js +6 -0
- package/dist/ext-loader.js.map +1 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +44 -23
- package/dist/help.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +59 -54
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-skills.d.ts.map +1 -1
- package/dist/lib/agent-skills.js +2 -1
- package/dist/lib/agent-skills.js.map +1 -1
- package/dist/lib/attach-client.js +2 -2
- package/dist/lib/attach-client.js.map +1 -1
- package/dist/lib/backup-artifact.d.ts +29 -8
- package/dist/lib/backup-artifact.d.ts.map +1 -1
- package/dist/lib/backup-artifact.js +147 -26
- package/dist/lib/backup-artifact.js.map +1 -1
- package/dist/lib/broker-service.d.ts +27 -3
- package/dist/lib/broker-service.d.ts.map +1 -1
- package/dist/lib/broker-service.js +142 -29
- package/dist/lib/broker-service.js.map +1 -1
- package/dist/lib/broker-store-health.d.ts +89 -0
- package/dist/lib/broker-store-health.d.ts.map +1 -0
- package/dist/lib/broker-store-health.js +171 -0
- package/dist/lib/broker-store-health.js.map +1 -0
- package/dist/lib/cancel.d.ts +4 -4
- package/dist/lib/cancel.d.ts.map +1 -1
- package/dist/lib/cancel.js +5 -5
- package/dist/lib/cancel.js.map +1 -1
- package/dist/lib/completion-install.d.ts +11 -2
- package/dist/lib/completion-install.d.ts.map +1 -1
- package/dist/lib/completion-install.js +79 -21
- package/dist/lib/completion-install.js.map +1 -1
- package/dist/lib/completion-scripts.d.ts.map +1 -1
- package/dist/lib/completion-scripts.js +2 -2
- package/dist/lib/completion-scripts.js.map +1 -1
- package/dist/lib/completion.d.ts +5 -1
- package/dist/lib/completion.d.ts.map +1 -1
- package/dist/lib/completion.js +10 -0
- package/dist/lib/completion.js.map +1 -1
- package/dist/lib/concrete-channel.d.ts +6 -0
- package/dist/lib/concrete-channel.d.ts.map +1 -0
- package/dist/lib/concrete-channel.js +17 -0
- package/dist/lib/concrete-channel.js.map +1 -0
- package/dist/lib/confirmation-required.d.ts +3 -12
- package/dist/lib/confirmation-required.d.ts.map +1 -1
- package/dist/lib/confirmation-required.js +9 -8
- package/dist/lib/confirmation-required.js.map +1 -1
- package/dist/lib/connect.d.ts +9 -0
- package/dist/lib/connect.d.ts.map +1 -1
- package/dist/lib/connect.js +27 -0
- package/dist/lib/connect.js.map +1 -1
- package/dist/lib/control.d.ts +42 -12
- package/dist/lib/control.d.ts.map +1 -1
- package/dist/lib/control.js +148 -34
- package/dist/lib/control.js.map +1 -1
- package/dist/lib/controller-restore.d.ts.map +1 -1
- package/dist/lib/controller-restore.js +12 -7
- package/dist/lib/controller-restore.js.map +1 -1
- package/dist/lib/credential-authority.d.ts.map +1 -1
- package/dist/lib/credential-authority.js +3 -0
- package/dist/lib/credential-authority.js.map +1 -1
- package/dist/lib/credential-exports.d.ts +17 -0
- package/dist/lib/credential-exports.d.ts.map +1 -0
- package/dist/lib/credential-exports.js +21 -0
- package/dist/lib/credential-exports.js.map +1 -0
- package/dist/lib/debug-flag.d.ts +4 -0
- package/dist/lib/debug-flag.d.ts.map +1 -0
- package/dist/lib/debug-flag.js +7 -0
- package/dist/lib/debug-flag.js.map +1 -0
- package/dist/lib/default-persona.d.ts +2 -0
- package/dist/lib/default-persona.d.ts.map +1 -1
- package/dist/lib/default-persona.js +2 -0
- package/dist/lib/default-persona.js.map +1 -1
- package/dist/lib/delivery-proc.d.ts +1 -1
- package/dist/lib/delivery-proc.d.ts.map +1 -1
- package/dist/lib/delivery-proc.js +5 -4
- package/dist/lib/delivery-proc.js.map +1 -1
- package/dist/lib/delivery-responder.d.ts +7 -3
- package/dist/lib/delivery-responder.d.ts.map +1 -1
- package/dist/lib/delivery-responder.js +8 -4
- package/dist/lib/delivery-responder.js.map +1 -1
- package/dist/lib/denied-write.d.ts +8 -0
- package/dist/lib/denied-write.d.ts.map +1 -0
- package/dist/lib/denied-write.js +24 -0
- package/dist/lib/denied-write.js.map +1 -0
- package/dist/lib/endpoint-capability-gates.js +2 -2
- package/dist/lib/endpoint-capability-gates.js.map +1 -1
- package/dist/lib/flag-value-refusal.d.ts +8 -0
- package/dist/lib/flag-value-refusal.d.ts.map +1 -0
- package/dist/lib/flag-value-refusal.js +10 -0
- package/dist/lib/flag-value-refusal.js.map +1 -0
- package/dist/lib/install-umask.d.ts +5 -0
- package/dist/lib/install-umask.d.ts.map +1 -1
- package/dist/lib/install-umask.js +25 -0
- package/dist/lib/install-umask.js.map +1 -1
- package/dist/lib/interrupt-notice.d.ts +23 -1
- package/dist/lib/interrupt-notice.d.ts.map +1 -1
- package/dist/lib/interrupt-notice.js +27 -6
- package/dist/lib/interrupt-notice.js.map +1 -1
- package/dist/lib/interrupt-report.d.ts +7 -0
- package/dist/lib/interrupt-report.d.ts.map +1 -0
- package/dist/lib/interrupt-report.js +24 -0
- package/dist/lib/interrupt-report.js.map +1 -0
- package/dist/lib/isolated-broker.d.ts +1 -1
- package/dist/lib/isolated-broker.d.ts.map +1 -1
- package/dist/lib/isolated-broker.js +17 -8
- package/dist/lib/isolated-broker.js.map +1 -1
- package/dist/lib/legacy-start.d.ts +8 -6
- package/dist/lib/legacy-start.d.ts.map +1 -1
- package/dist/lib/legacy-start.js +36 -36
- package/dist/lib/legacy-start.js.map +1 -1
- package/dist/lib/manager-choice.d.ts +92 -4
- package/dist/lib/manager-choice.d.ts.map +1 -1
- package/dist/lib/manager-choice.js +338 -23
- package/dist/lib/manager-choice.js.map +1 -1
- package/dist/lib/manager-proc.d.ts.map +1 -1
- package/dist/lib/manager-proc.js +7 -6
- package/dist/lib/manager-proc.js.map +1 -1
- package/dist/lib/manifest/index.d.ts +5 -1
- package/dist/lib/manifest/index.d.ts.map +1 -1
- package/dist/lib/manifest/index.js +50 -5
- package/dist/lib/manifest/index.js.map +1 -1
- package/dist/lib/manifest/preflight.d.ts +4 -0
- package/dist/lib/manifest/preflight.d.ts.map +1 -1
- package/dist/lib/manifest/preflight.js +18 -1
- package/dist/lib/manifest/preflight.js.map +1 -1
- package/dist/lib/manifest/resolve.d.ts +8 -0
- package/dist/lib/manifest/resolve.d.ts.map +1 -1
- package/dist/lib/manifest/resolve.js +104 -11
- package/dist/lib/manifest/resolve.js.map +1 -1
- package/dist/lib/missing-flags.js +1 -1
- package/dist/lib/missing-flags.js.map +1 -1
- package/dist/lib/nats-bin.d.ts +28 -5
- package/dist/lib/nats-bin.d.ts.map +1 -1
- package/dist/lib/nats-bin.js +85 -7
- package/dist/lib/nats-bin.js.map +1 -1
- package/dist/lib/nearest-word.d.ts +14 -0
- package/dist/lib/nearest-word.d.ts.map +1 -0
- package/dist/lib/nearest-word.js +76 -0
- package/dist/lib/nearest-word.js.map +1 -0
- package/dist/lib/no-expiry-record.d.ts +8 -0
- package/dist/lib/no-expiry-record.d.ts.map +1 -0
- package/dist/lib/no-expiry-record.js +27 -0
- package/dist/lib/no-expiry-record.js.map +1 -0
- package/dist/lib/paths.d.ts +31 -0
- package/dist/lib/paths.d.ts.map +1 -1
- package/dist/lib/paths.js +92 -2
- package/dist/lib/paths.js.map +1 -1
- package/dist/lib/persona-files.d.ts +29 -6
- package/dist/lib/persona-files.d.ts.map +1 -1
- package/dist/lib/persona-files.js +179 -36
- package/dist/lib/persona-files.js.map +1 -1
- package/dist/lib/personas.d.ts +18 -1
- package/dist/lib/personas.d.ts.map +1 -1
- package/dist/lib/personas.js +65 -6
- package/dist/lib/personas.js.map +1 -1
- package/dist/lib/prompts.d.ts +7 -1
- package/dist/lib/prompts.d.ts.map +1 -1
- package/dist/lib/prompts.js +43 -3
- package/dist/lib/prompts.js.map +1 -1
- package/dist/lib/registry-errors.d.ts +2 -1
- package/dist/lib/registry-errors.d.ts.map +1 -1
- package/dist/lib/registry-errors.js +6 -2
- package/dist/lib/registry-errors.js.map +1 -1
- package/dist/lib/reset-space-plan.d.ts +2 -0
- package/dist/lib/reset-space-plan.d.ts.map +1 -1
- package/dist/lib/reset-space-plan.js +1 -1
- package/dist/lib/reset-space-plan.js.map +1 -1
- package/dist/lib/restore.d.ts +45 -3
- package/dist/lib/restore.d.ts.map +1 -1
- package/dist/lib/restore.js +233 -39
- package/dist/lib/restore.js.map +1 -1
- package/dist/lib/rolled-back-runs.d.ts +36 -0
- package/dist/lib/rolled-back-runs.d.ts.map +1 -0
- package/dist/lib/rolled-back-runs.js +96 -0
- package/dist/lib/rolled-back-runs.js.map +1 -0
- package/dist/lib/service-custody-win32.d.ts +25 -0
- package/dist/lib/service-custody-win32.d.ts.map +1 -0
- package/dist/lib/service-custody-win32.js +67 -0
- package/dist/lib/service-custody-win32.js.map +1 -0
- package/dist/lib/service-definitions.d.ts +16 -3
- package/dist/lib/service-definitions.d.ts.map +1 -1
- package/dist/lib/service-definitions.js +99 -27
- package/dist/lib/service-definitions.js.map +1 -1
- package/dist/lib/service-instances.d.ts +46 -5
- package/dist/lib/service-instances.d.ts.map +1 -1
- package/dist/lib/service-instances.js +112 -18
- package/dist/lib/service-instances.js.map +1 -1
- package/dist/lib/service-journal.js +1 -1
- package/dist/lib/service-journal.js.map +1 -1
- package/dist/lib/service-presets.d.ts.map +1 -1
- package/dist/lib/service-presets.js +16 -0
- package/dist/lib/service-presets.js.map +1 -1
- package/dist/lib/service-process.d.ts +53 -15
- package/dist/lib/service-process.d.ts.map +1 -1
- package/dist/lib/service-process.js +533 -86
- package/dist/lib/service-process.js.map +1 -1
- package/dist/lib/service-systemd-install.js +1 -1
- package/dist/lib/service-systemd-install.js.map +1 -1
- package/dist/lib/space-streams.d.ts +18 -0
- package/dist/lib/space-streams.d.ts.map +1 -0
- package/dist/lib/space-streams.js +35 -0
- package/dist/lib/space-streams.js.map +1 -0
- package/dist/lib/spawn-defaults.d.ts +25 -1
- package/dist/lib/spawn-defaults.d.ts.map +1 -1
- package/dist/lib/spawn-defaults.js +37 -1
- package/dist/lib/spawn-defaults.js.map +1 -1
- package/dist/lib/stack-journal.d.ts +157 -14
- package/dist/lib/stack-journal.d.ts.map +1 -1
- package/dist/lib/stack-journal.js +406 -49
- package/dist/lib/stack-journal.js.map +1 -1
- package/dist/lib/stack-listeners.d.ts +17 -0
- package/dist/lib/stack-listeners.d.ts.map +1 -0
- package/dist/lib/stack-listeners.js +54 -0
- package/dist/lib/stack-listeners.js.map +1 -0
- package/dist/lib/stack-members.d.ts +13 -0
- package/dist/lib/stack-members.d.ts.map +1 -0
- package/dist/lib/stack-members.js +24 -0
- package/dist/lib/stack-members.js.map +1 -0
- package/dist/lib/stack-resume.d.ts.map +1 -1
- package/dist/lib/stack-resume.js +5 -2
- package/dist/lib/stack-resume.js.map +1 -1
- package/dist/lib/stack-runs.d.ts +34 -0
- package/dist/lib/stack-runs.d.ts.map +1 -0
- package/dist/lib/stack-runs.js +75 -0
- package/dist/lib/stack-runs.js.map +1 -0
- package/dist/lib/status.d.ts +11 -0
- package/dist/lib/status.d.ts.map +1 -1
- package/dist/lib/status.js +4 -5
- package/dist/lib/status.js.map +1 -1
- package/dist/lib/stdout-owner.d.ts +12 -3
- package/dist/lib/stdout-owner.d.ts.map +1 -1
- package/dist/lib/stdout-owner.js +33 -5
- package/dist/lib/stdout-owner.js.map +1 -1
- package/dist/lib/store-dir.d.ts +68 -4
- package/dist/lib/store-dir.d.ts.map +1 -1
- package/dist/lib/store-dir.js +253 -17
- package/dist/lib/store-dir.js.map +1 -1
- package/dist/lib/team-additive-attempt.d.ts +1 -1
- package/dist/lib/team-channel-removal.d.ts.map +1 -1
- package/dist/lib/team-channel-removal.js +4 -0
- package/dist/lib/team-channel-removal.js.map +1 -1
- package/dist/lib/team-deploy-inspection.d.ts +13 -0
- package/dist/lib/team-deploy-inspection.d.ts.map +1 -1
- package/dist/lib/team-deploy-inspection.js +12 -0
- package/dist/lib/team-deploy-inspection.js.map +1 -1
- package/dist/lib/team-text.d.ts +6 -0
- package/dist/lib/team-text.d.ts.map +1 -0
- package/dist/lib/team-text.js +36 -0
- package/dist/lib/team-text.js.map +1 -0
- package/dist/lib/transient.d.ts +14 -8
- package/dist/lib/transient.d.ts.map +1 -1
- package/dist/lib/transient.js +72 -11
- package/dist/lib/transient.js.map +1 -1
- package/dist/lib/unusable-file.d.ts +13 -0
- package/dist/lib/unusable-file.d.ts.map +1 -0
- package/dist/lib/unusable-file.js +12 -0
- package/dist/lib/unusable-file.js.map +1 -0
- package/dist/lib/up-report.d.ts +6 -0
- package/dist/lib/up-report.d.ts.map +1 -1
- package/dist/lib/up-report.js +13 -0
- package/dist/lib/up-report.js.map +1 -1
- package/dist/lib/verdict.d.ts +14 -0
- package/dist/lib/verdict.d.ts.map +1 -0
- package/dist/lib/verdict.js +15 -0
- package/dist/lib/verdict.js.map +1 -0
- package/dist/managed-handoff.d.ts +11 -6
- package/dist/managed-handoff.d.ts.map +1 -1
- package/dist/managed-handoff.js +27 -18
- package/dist/managed-handoff.js.map +1 -1
- package/dist/render.d.ts +5 -2
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +44 -10
- package/dist/render.js.map +1 -1
- package/dist/telemetry.d.ts +4 -3
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +14 -6
- package/dist/telemetry.js.map +1 -1
- package/dist/ui.d.ts +3 -2
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +6 -4
- package/dist/ui.js.map +1 -1
- package/dist/view/mesh-view.d.ts.map +1 -1
- package/dist/view/mesh-view.js +4 -1
- package/dist/view/mesh-view.js.map +1 -1
- package/dist/watch-data.d.ts +9 -1
- package/dist/watch-data.d.ts.map +1 -1
- package/dist/watch-data.js +17 -3
- package/dist/watch-data.js.map +1 -1
- package/dist/watch-json.js +4 -3
- package/dist/watch-json.js.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The record's path: `<credential file>.no-expiry.json`. */
|
|
2
|
+
export declare const noExpiryRecordPath: (credsPath: string) => string;
|
|
3
|
+
/** The record's text for a credential with these bytes, requested now. */
|
|
4
|
+
export declare function noExpiryRecordText(creds: string): string;
|
|
5
|
+
/** When `auth mint --no-expiry` asked for the credential at `credsPath`, if the private record beside
|
|
6
|
+
* it names these bytes. A missing, unreadable, malformed or mismatched record is no request. */
|
|
7
|
+
export declare function noExpiryRequestedAt(credsPath: string, bytes: Uint8Array): string | undefined;
|
|
8
|
+
//# sourceMappingURL=no-expiry-record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-expiry-record.d.ts","sourceRoot":"","sources":["../../src/lib/no-expiry-record.ts"],"names":[],"mappings":"AAeA,6DAA6D;AAC7D,eAAO,MAAM,kBAAkB,GAAI,WAAW,MAAM,KAAG,MAAuC,CAAC;AAE/F,0EAA0E;AAC1E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGxD;AAED;iGACiG;AACjG,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAW5F"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readLocalRecordSource } from "@cotal-ai/workspace";
|
|
3
|
+
const sha256 = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
|
4
|
+
/** The record's path: `<credential file>.no-expiry.json`. */
|
|
5
|
+
export const noExpiryRecordPath = (credsPath) => `${credsPath}.no-expiry.json`;
|
|
6
|
+
/** The record's text for a credential with these bytes, requested now. */
|
|
7
|
+
export function noExpiryRecordText(creds) {
|
|
8
|
+
const record = { schemaVersion: 1, kind: "credential-no-expiry", requestedAt: new Date().toISOString(), credsSha256: sha256(creds) };
|
|
9
|
+
return `${JSON.stringify(record, null, 2)}\n`;
|
|
10
|
+
}
|
|
11
|
+
/** When `auth mint --no-expiry` asked for the credential at `credsPath`, if the private record beside
|
|
12
|
+
* it names these bytes. A missing, unreadable, malformed or mismatched record is no request. */
|
|
13
|
+
export function noExpiryRequestedAt(credsPath, bytes) {
|
|
14
|
+
let value;
|
|
15
|
+
try {
|
|
16
|
+
const raw = readLocalRecordSource(noExpiryRecordPath(credsPath), 64 * 1024, true);
|
|
17
|
+
if (!raw)
|
|
18
|
+
return undefined;
|
|
19
|
+
value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(raw));
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
const known = value && typeof value === "object" && value.schemaVersion === 1 && value.kind === "credential-no-expiry";
|
|
25
|
+
return known && typeof value.requestedAt === "string" && Number.isFinite(Date.parse(value.requestedAt)) && value.credsSha256 === sha256(bytes) ? value.requestedAt : undefined;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=no-expiry-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-expiry-record.js","sourceRoot":"","sources":["../../src/lib/no-expiry-record.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,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a,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,sBAAsB,CAAC;IACvH,OAAO,KAAK,IAAI,OAAO,KAAK,CAAC,WAAW,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,KAAK,CAAC,WAAW,KAAK,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;AACjL,CAAC"}
|
package/dist/lib/paths.d.ts
CHANGED
|
@@ -1,7 +1,38 @@
|
|
|
1
|
+
import { CommandFailure } from "@cotal-ai/workspace";
|
|
1
2
|
/** The project's `.cotal/` root, found by walking up from cwd (like git finds `.git`), so every
|
|
2
3
|
* command resolves the same `.cotal/` whether you're at the project root or a subdirectory. */
|
|
3
4
|
export declare function cotalRoot(): string;
|
|
5
|
+
/** Whether the machine home already holds a stack an earlier release started there: a registration,
|
|
6
|
+
* a maintenance attempt, or a space account. Such a stack still starts, resumes and stops in place. */
|
|
7
|
+
export declare function homeHoldsStack(root: string): boolean;
|
|
4
8
|
/** A path inside the project's `.cotal/` directory. Use instead of `resolve(".cotal/…")` so paths
|
|
5
9
|
* don't break when `cotal` runs from a subdirectory. */
|
|
6
10
|
export declare function cotalPath(...segments: string[]): string;
|
|
11
|
+
/** Whether the working folder was removed before this process read it. Node then fails every cwd
|
|
12
|
+
* read, and caches the first read that succeeds. */
|
|
13
|
+
export declare function workingFolderRemoved(): boolean;
|
|
14
|
+
/** A folder's `.cotal` that is a link: where it is, where it leads, and whether that exists. */
|
|
15
|
+
export interface CotalLink {
|
|
16
|
+
root: string;
|
|
17
|
+
path: string;
|
|
18
|
+
target: string;
|
|
19
|
+
dangling: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** A `.cotal` link that the walk {@link cotalRoot} takes from the working folder meets first: a link
|
|
22
|
+
* to another folder, or one that leads nowhere, which the walk passes over. `target` is where it
|
|
23
|
+
* leads. The machine's home `.cotal` is left to the commands that use it. Undefined when the first
|
|
24
|
+
* `.cotal` the walk meets is a real directory, or there is none. */
|
|
25
|
+
export declare function cotalLinkHere(): CotalLink | undefined;
|
|
26
|
+
/** {@link cotalLinkHere} for one folder, with no walk: its `.cotal` when that is a link. */
|
|
27
|
+
export declare function cotalLinkAt(root: string): CotalLink | undefined;
|
|
28
|
+
/** The next step in a folder whose `.cotal` links to `target`: moving the records back when they are
|
|
29
|
+
* this folder's own ({@link recordsMovedTo}), else the project whose `.cotal` it is, when it is one,
|
|
30
|
+
* or giving this folder records of its own. */
|
|
31
|
+
export declare function linkedCotalRemedy(root: string, target: string): string;
|
|
32
|
+
/** The refusal of a command in a folder whose `.cotal` is a link ({@link cotalLinkHere}, or for a
|
|
33
|
+
* reset {@link cotalLinkAt} the root it selected). A stack runs only from a folder whose `.cotal` is
|
|
34
|
+
* its own directory, and `clean` and `reset` read and remove nothing through a link, so none of
|
|
35
|
+
* them reads or writes through it. A link that leads nowhere is not passed over either: `clean`
|
|
36
|
+
* would otherwise remove the records of a folder above it. */
|
|
37
|
+
export declare function linkedCotalRefusal(command: "up" | "down" | "clean" | "reset store" | "reset space", link?: CotalLink | undefined): CommandFailure | undefined;
|
|
7
38
|
//# sourceMappingURL=paths.d.ts.map
|
package/dist/lib/paths.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/lib/paths.ts"],"names":[],"mappings":"AAGA;gGACgG;AAChG,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED;yDACyD;AACzD,wBAAgB,SAAS,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAEvD"}
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/lib/paths.ts"],"names":[],"mappings":"AAGA,OAAO,EAA0B,cAAc,EAAyH,MAAM,qBAAqB,CAAC;AAEpM;gGACgG;AAChG,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED;wGACwG;AACxG,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;yDACyD;AACzD,wBAAgB,SAAS,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAEvD;AAED;qDACqD;AACrD,wBAAgB,oBAAoB,IAAI,OAAO,CAQ9C;AAED,gGAAgG;AAChG,MAAM,WAAW,SAAS;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE;AAE5F;;;qEAGqE;AACrE,wBAAgB,aAAa,IAAI,SAAS,GAAG,SAAS,CASrD;AAED,4FAA4F;AAC5F,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAE/D;AAaD;;gDAEgD;AAChD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAItE;AAED;;;;+DAI+D;AAC/D,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,aAAa,EAAE,IAAI,GAAE,SAAS,GAAG,SAA2B,GAAG,cAAc,GAAG,SAAS,CAiB9K"}
|
package/dist/lib/paths.js
CHANGED
|
@@ -1,13 +1,103 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { existsSync, lstatSync, readlinkSync, realpathSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
4
|
+
import { authDir, canonicalRoot, CommandFailure, findCotalRoot, homeCotalDir, localMeshesForRoot, moveRecordsBack, readMaintenanceJournal, recordsMovedTo, soleSpaceOf } from "@cotal-ai/workspace";
|
|
3
5
|
/** The project's `.cotal/` root, found by walking up from cwd (like git finds `.git`), so every
|
|
4
6
|
* command resolves the same `.cotal/` whether you're at the project root or a subdirectory. */
|
|
5
7
|
export function cotalRoot() {
|
|
6
8
|
return findCotalRoot();
|
|
7
9
|
}
|
|
10
|
+
/** Whether the machine home already holds a stack an earlier release started there: a registration,
|
|
11
|
+
* a maintenance attempt, or a space account. Such a stack still starts, resumes and stops in place. */
|
|
12
|
+
export function homeHoldsStack(root) {
|
|
13
|
+
return localMeshesForRoot(root).length > 0 || readMaintenanceJournal(root) !== undefined || soleSpaceOf(authDir(root)) !== undefined;
|
|
14
|
+
}
|
|
8
15
|
/** A path inside the project's `.cotal/` directory. Use instead of `resolve(".cotal/…")` so paths
|
|
9
16
|
* don't break when `cotal` runs from a subdirectory. */
|
|
10
17
|
export function cotalPath(...segments) {
|
|
11
18
|
return join(cotalRoot(), ".cotal", ...segments);
|
|
12
19
|
}
|
|
20
|
+
/** Whether the working folder was removed before this process read it. Node then fails every cwd
|
|
21
|
+
* read, and caches the first read that succeeds. */
|
|
22
|
+
export function workingFolderRemoved() {
|
|
23
|
+
try {
|
|
24
|
+
process.cwd();
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
if (e.code !== "ENOENT")
|
|
29
|
+
throw e;
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** A `.cotal` link that the walk {@link cotalRoot} takes from the working folder meets first: a link
|
|
34
|
+
* to another folder, or one that leads nowhere, which the walk passes over. `target` is where it
|
|
35
|
+
* leads. The machine's home `.cotal` is left to the commands that use it. Undefined when the first
|
|
36
|
+
* `.cotal` the walk meets is a real directory, or there is none. */
|
|
37
|
+
export function cotalLinkHere() {
|
|
38
|
+
let dir = resolve(process.cwd());
|
|
39
|
+
for (;;) {
|
|
40
|
+
const link = linkAt(dir);
|
|
41
|
+
if (link !== null)
|
|
42
|
+
return link;
|
|
43
|
+
const parent = dirname(dir);
|
|
44
|
+
if (parent === dir)
|
|
45
|
+
return undefined;
|
|
46
|
+
dir = parent;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** {@link cotalLinkHere} for one folder, with no walk: its `.cotal` when that is a link. */
|
|
50
|
+
export function cotalLinkAt(root) {
|
|
51
|
+
return linkAt(resolve(root)) ?? undefined;
|
|
52
|
+
}
|
|
53
|
+
/** The `.cotal` link at `dir`, undefined when its `.cotal` is a directory or the home one, and null
|
|
54
|
+
* when it has no `.cotal` at all. */
|
|
55
|
+
function linkAt(dir) {
|
|
56
|
+
const path = join(dir, ".cotal");
|
|
57
|
+
let stat;
|
|
58
|
+
try {
|
|
59
|
+
stat = lstatSync(path);
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
if (!stat.isSymbolicLink() || canonicalRoot(dir) === canonicalRoot(homedir()) || resolve(homeCotalDir()) === path)
|
|
65
|
+
return undefined;
|
|
66
|
+
const dangling = !existsSync(path);
|
|
67
|
+
return { root: dir, path, target: dangling ? resolve(dir, readlinkSync(path)) : realpathSync(path), dangling };
|
|
68
|
+
}
|
|
69
|
+
/** The next step in a folder whose `.cotal` links to `target`: moving the records back when they are
|
|
70
|
+
* this folder's own ({@link recordsMovedTo}), else the project whose `.cotal` it is, when it is one,
|
|
71
|
+
* or giving this folder records of its own. */
|
|
72
|
+
export function linkedCotalRemedy(root, target) {
|
|
73
|
+
if (recordsMovedTo(root, dirname(target)))
|
|
74
|
+
return moveRecordsBack(root, dirname(target));
|
|
75
|
+
const prepare = `remove the link and prepare this folder with cotal space create <space> --root ${root}`;
|
|
76
|
+
return basename(target) === ".cotal" ? `run commands for that project from ${dirname(target)}, or ${prepare}` : prepare;
|
|
77
|
+
}
|
|
78
|
+
/** The refusal of a command in a folder whose `.cotal` is a link ({@link cotalLinkHere}, or for a
|
|
79
|
+
* reset {@link cotalLinkAt} the root it selected). A stack runs only from a folder whose `.cotal` is
|
|
80
|
+
* its own directory, and `clean` and `reset` read and remove nothing through a link, so none of
|
|
81
|
+
* them reads or writes through it. A link that leads nowhere is not passed over either: `clean`
|
|
82
|
+
* would otherwise remove the records of a folder above it. */
|
|
83
|
+
export function linkedCotalRefusal(command, link = cotalLinkHere()) {
|
|
84
|
+
if (link === undefined)
|
|
85
|
+
return undefined;
|
|
86
|
+
const { root, path, target } = link;
|
|
87
|
+
const removes = command !== "up" && command !== "down";
|
|
88
|
+
const effect = command === "up" ? "started" : command === "down" ? "stopped" : "removed";
|
|
89
|
+
const failureTarget = { root, path, link: target };
|
|
90
|
+
const here = command === "up" ? `remove the link and prepare this folder with cotal space create <space> --root ${root}`
|
|
91
|
+
: command === "down" ? "remove the link, then run cotal down again"
|
|
92
|
+
: "remove the link, then run it again where the records it should remove are";
|
|
93
|
+
const why = removes ? `${command} reads and removes nothing through a link` : "a stack runs only from a folder whose .cotal is its own directory";
|
|
94
|
+
if (link.dangling)
|
|
95
|
+
return new CommandFailure("refused", "TARGET_NOT_FOUND", `${path} links to ${target}, which does not exist${removes ? `, and ${why}` : ""}; nothing was ${effect}`, { target: failureTarget, remedy: here });
|
|
96
|
+
// A reset selects its root by the space's name, so running it from another folder changes nothing.
|
|
97
|
+
const elsewhere = basename(target) === ".cotal" && !command.startsWith("reset") ? `run cotal ${command} from ${dirname(target)}, whose .cotal this links to, or ${here}` : here;
|
|
98
|
+
return new CommandFailure("refused", "CONFLICT", `${path} is a link to ${target}, and ${why}; nothing was ${effect}`, {
|
|
99
|
+
target: failureTarget,
|
|
100
|
+
remedy: recordsMovedTo(root, dirname(target)) ? `${moveRecordsBack(root, dirname(target))}; then run ${removes ? "it" : `cotal ${command}`} again` : elsewhere,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
13
103
|
//# sourceMappingURL=paths.js.map
|
package/dist/lib/paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/lib/paths.ts"],"names":[],"mappings":"AAAA,OAAO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C,CAAC,mEAAmE,CAAC;IAClJ,IAAI,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,cAAc,CAAC,SAAS,EAAE,kBAAkB,EAAE,GAAG,IAAI,aAAa,MAAM,yBAAyB,OAAO,CAAC,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,iBAAiB,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAChO,mGAAmG;IACnG,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,OAAO,SAAS,OAAO,CAAC,MAAM,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAChL,OAAO,IAAI,cAAc,CAAC,SAAS,EAAE,UAAU,EAAE,GAAG,IAAI,iBAAiB,MAAM,SAAS,GAAG,iBAAiB,MAAM,EAAE,EAAE;QACpH,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,cAAc,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS;KAC/J,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -14,20 +14,43 @@ export declare function personaCatalog(values: {
|
|
|
14
14
|
space?: string;
|
|
15
15
|
server?: string;
|
|
16
16
|
}): PersonaCatalog;
|
|
17
|
+
/** Why a new persona cannot take `name`: the seeded default's agents already launch under it, so a
|
|
18
|
+
* second definition would launch under the same name. */
|
|
19
|
+
export declare function reservedPersonaName(name: string): string | undefined;
|
|
17
20
|
/** Why `name` cannot name a persona, or undefined when it can. */
|
|
18
21
|
export declare function personaNameProblem(name: string): string | undefined;
|
|
19
22
|
export declare function personaPath(root: string, name: string): string;
|
|
20
23
|
/** Only absence is absent. Unreadable and non-regular sources refuse rather than becoming empty. */
|
|
21
24
|
export declare function readPersonaSource(path: string): PersonaSource | undefined;
|
|
22
25
|
export declare function requirePersonaSource(path: string): PersonaSource;
|
|
23
|
-
/**
|
|
24
|
-
* `name` is required of a new definition only. A stored one may launch under another name: the
|
|
26
|
+
/** `name` is required of a new definition only. A stored one may launch under another name: the
|
|
25
27
|
* seeded `default` persona launches as `default_agent`. */
|
|
26
28
|
export declare function validatePersona(bytes: Buffer, path: string, name?: string): AgentDef;
|
|
27
|
-
/**
|
|
29
|
+
/** The largest persona definition the CLI saves, the bound a create on a manager applies to its input. */
|
|
30
|
+
export declare const PERSONA_LIMIT: number;
|
|
31
|
+
/** Shared by canonical and legacy CLI writes only. Manager and external writers do not take this lock.
|
|
32
|
+
* A new persona whose name differs from an existing one only in case is refused. */
|
|
28
33
|
export declare function commitPersona(path: string, expected: PersonaSource | undefined, bytes: Buffer | undefined): void;
|
|
34
|
+
/** Refuse a `--role` or `--model` that holds control characters by name, before any rule quotes it. */
|
|
35
|
+
export declare function assertLabels(values: {
|
|
36
|
+
role?: string;
|
|
37
|
+
model?: string;
|
|
38
|
+
}): void;
|
|
29
39
|
/** Use the existing serializer for flag-built definitions; file inputs keep their original bytes. */
|
|
30
|
-
export declare function serializePersona(def: AgentDef): Buffer
|
|
31
|
-
/**
|
|
32
|
-
|
|
40
|
+
export declare function serializePersona(def: AgentDef): Promise<Buffer>;
|
|
41
|
+
/** What an edit did. An editor that exits non-zero cancels it, as vim's `:cq` does; a draft it changed
|
|
42
|
+
* is kept. A draft left as it was saves nothing. */
|
|
43
|
+
export type PersonaEdit = {
|
|
44
|
+
action: "saved";
|
|
45
|
+
} | {
|
|
46
|
+
action: "unchanged";
|
|
47
|
+
} | {
|
|
48
|
+
action: "cancelled";
|
|
49
|
+
status: number;
|
|
50
|
+
draft?: string;
|
|
51
|
+
};
|
|
52
|
+
/** Never expose the catalog file to an editor. Validate successful draft bytes, then compare under lock.
|
|
53
|
+
* An interrupt that stops the edit saves nothing, removes an unchanged draft, names a changed one, and
|
|
54
|
+
* exits with the signal's code. */
|
|
55
|
+
export declare function editPersona(path: string, name: string, catalog: PersonaCatalog, json?: boolean): Promise<PersonaEdit>;
|
|
33
56
|
//# sourceMappingURL=persona-files.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persona-files.d.ts","sourceRoot":"","sources":["../../src/lib/persona-files.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,QAAQ,EACd,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"persona-files.d.ts","sourceRoot":"","sources":["../../src/lib/persona-files.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,QAAQ,EACd,MAAM,gBAAgB,CAAC;AAUxB,MAAM,WAAW,cAAc;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAC/D,MAAM,WAAW,aAAa;IAAG,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;AAE3F,gGAAgG;AAChG,wBAAgB,cAAc,CAAC,MAAM,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,cAAc,CAsB1F;AAaD;0DAC0D;AAC1D,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEpE;AAED,kEAAkE;AAClE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKnE;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE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{ accessSync, constants, existsSync, lstatSync, mkdtempSync, readFileSync, realpathSync, rmSync, statSync, unlinkSync } from "node:fs";
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { accessSync, constants, existsSync, lstatSync, mkdtempSync, readdirSync, readFileSync, realpathSync, rmSync, statSync, unlinkSync } from "node:fs";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
|
-
import { basename, dirname, join } from "node:path";
|
|
5
|
-
import { acquireLock, agentFilePath, assertValidName, hardenPrivate, MAX_NAME_LENGTH, mkSecretDir, parseAgentFileSource, saveAgentFile, writeSecretFile, writeSecretFileAtomic, } from "@cotal-ai/core";
|
|
6
|
-
import { cachedPreferences, CommandFailure, inputDisabledByFlag, isCommandFailure, isGenuineSpace, isWorkspaceTargetError, loadMeshes, resolveMeshTarget, resolvePreference, targetErrorCode, workspaceErrorParts, } from "@cotal-ai/workspace";
|
|
4
|
+
import { basename, dirname, join, sep } from "node:path";
|
|
5
|
+
import { acquireLock, agentFilePath, assertValidName, hardenPrivate, MAX_NAME_LENGTH, mkSecretDir, parseAgentFileSource, saveAgentFile, utf16Problem, writeSecretFile, writeSecretFileAtomic, } from "@cotal-ai/core";
|
|
6
|
+
import { cachedPreferences, CommandFailure, ConfirmationRequired, inputDisabledByFlag, isCommandFailure, isGenuineSpace, isWorkspaceTargetError, loadMeshes, movedProject, resolveMeshTarget, resolvePreference, targetErrorCode, workspaceErrorParts, } from "@cotal-ai/workspace";
|
|
7
|
+
import { DEFAULT_AGENT_NAME } from "./default-persona.js";
|
|
8
|
+
import { shellWord } from "./endpoint-errors.js";
|
|
9
|
+
import { exitInterrupted, INTERRUPT_SIGNALS } from "./interrupt-notice.js";
|
|
10
|
+
import { catalogFolderProblem, linkTarget } from "./personas.js";
|
|
7
11
|
/** Resolve once, without inventing a broker for a prepared space or falling back to the cwd. */
|
|
8
12
|
export function personaCatalog(values) {
|
|
9
13
|
try {
|
|
@@ -37,9 +41,17 @@ function catalogAt(root, space) {
|
|
|
37
41
|
return { root: realpathSync(root), space };
|
|
38
42
|
}
|
|
39
43
|
catch {
|
|
44
|
+
const moved = movedProject(space, root);
|
|
45
|
+
if (moved)
|
|
46
|
+
throw new CommandFailure("refused", "CONFLICT", moved.message, { target: moved.target, remedy: moved.remedy });
|
|
40
47
|
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the selected persona catalog root is unavailable");
|
|
41
48
|
}
|
|
42
49
|
}
|
|
50
|
+
/** Why a new persona cannot take `name`: the seeded default's agents already launch under it, so a
|
|
51
|
+
* second definition would launch under the same name. */
|
|
52
|
+
export function reservedPersonaName(name) {
|
|
53
|
+
return name === DEFAULT_AGENT_NAME ? `'${name}' is reserved: the seeded default persona launches its agents under that name` : undefined;
|
|
54
|
+
}
|
|
43
55
|
/** Why `name` cannot name a persona, or undefined when it can. */
|
|
44
56
|
export function personaNameProblem(name) {
|
|
45
57
|
if (!/^[A-Za-z0-9_-]+$/.test(name))
|
|
@@ -64,34 +76,55 @@ export function personaPath(root, name) {
|
|
|
64
76
|
export function readPersonaSource(path) {
|
|
65
77
|
try {
|
|
66
78
|
const stat = lstatSync(path);
|
|
67
|
-
if (!stat.isFile())
|
|
68
|
-
|
|
79
|
+
if (!stat.isFile()) {
|
|
80
|
+
const link = stat.isSymbolicLink() ? linkTarget(path) : undefined;
|
|
81
|
+
throw new CommandFailure("refused", "PERMISSION_DENIED", `persona is not a regular file: ${path}`, link === undefined ? {} : { remedy: `${path} is a link to ${link}; replace the link with a copy of that file` });
|
|
82
|
+
}
|
|
69
83
|
return { bytes: readFileSync(path), ino: stat.ino, dev: stat.dev, mtimeMs: stat.mtimeMs };
|
|
70
84
|
}
|
|
71
85
|
catch (error) {
|
|
72
|
-
|
|
86
|
+
const code = error.code;
|
|
87
|
+
if (code === "ENOENT")
|
|
73
88
|
return undefined;
|
|
74
89
|
if (error instanceof CommandFailure)
|
|
75
90
|
throw error;
|
|
91
|
+
const folder = code === "ENOTDIR" || code === "ELOOP" ? catalogFolderProblem(dirname(path)) : undefined;
|
|
92
|
+
if (folder)
|
|
93
|
+
throw folder;
|
|
76
94
|
throw new CommandFailure("refused", "PERMISSION_DENIED", `cannot read persona: ${path}`);
|
|
77
95
|
}
|
|
78
96
|
}
|
|
79
97
|
export function requirePersonaSource(path) {
|
|
80
98
|
const source = readPersonaSource(path);
|
|
81
99
|
if (!source)
|
|
82
|
-
throw new CommandFailure("refused", "TARGET_NOT_FOUND", `no persona at ${path}`);
|
|
100
|
+
throw new CommandFailure("refused", "TARGET_NOT_FOUND", `no persona at ${path}`, { remedy: "see the personas here with `cotal persona`" });
|
|
83
101
|
return source;
|
|
84
102
|
}
|
|
85
|
-
/**
|
|
86
|
-
*
|
|
103
|
+
/** Why the agent-file parser refused a definition. A YAML error keeps only its position: the
|
|
104
|
+
* parser's own text can quote the document's sensitive values. */
|
|
105
|
+
function definitionProblem(error, path) {
|
|
106
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
107
|
+
const prefix = `agent file ${path}: `;
|
|
108
|
+
const reason = message.startsWith(prefix) ? message.slice(prefix.length) : message;
|
|
109
|
+
if (!reason.startsWith("invalid YAML frontmatter"))
|
|
110
|
+
return reason;
|
|
111
|
+
// The parser counts lines from the first line after the opening `---`.
|
|
112
|
+
const at = /at line (\d+), column (\d+)/.exec(reason);
|
|
113
|
+
return `the frontmatter is not valid YAML${at ? ` at line ${Number(at[1]) + 1}, column ${at[2]}` : ""}`;
|
|
114
|
+
}
|
|
115
|
+
/** `name` is required of a new definition only. A stored one may launch under another name: the
|
|
87
116
|
* seeded `default` persona launches as `default_agent`. */
|
|
88
117
|
export function validatePersona(bytes, path, name) {
|
|
118
|
+
// Its encoding names no value from the file, so it is the one reason given.
|
|
119
|
+
const encoding = utf16Problem(bytes.toString("utf8"));
|
|
120
|
+
if (encoding)
|
|
121
|
+
throw new CommandFailure("refused", "SCHEMA_INVALID", `invalid persona definition: ${path}: ${encoding}`, { remedy: `save ${path} as UTF-8` });
|
|
89
122
|
let def;
|
|
90
123
|
try {
|
|
91
124
|
def = parseAgentFileSource(bytes.toString("utf8"), path);
|
|
92
125
|
}
|
|
93
|
-
catch {
|
|
94
|
-
throw new CommandFailure("refused", "SCHEMA_INVALID", `invalid persona definition: ${path}`, { remedy: "check the agent-file frontmatter and channel declarations" });
|
|
126
|
+
catch (error) {
|
|
127
|
+
throw new CommandFailure("refused", "SCHEMA_INVALID", `invalid persona definition ${path}: ${definitionProblem(error, path)}`, { remedy: "check the agent-file frontmatter and channel declarations" });
|
|
95
128
|
}
|
|
96
129
|
if (name !== undefined && def.name !== name)
|
|
97
130
|
throw new CommandFailure("refused", "SCHEMA_INVALID", `persona name must match the catalog name '${name}'`);
|
|
@@ -108,11 +141,28 @@ function assertCatalogWritable(dir) {
|
|
|
108
141
|
accessSync(dir, constants.W_OK);
|
|
109
142
|
}
|
|
110
143
|
catch {
|
|
111
|
-
throw new CommandFailure("refused", "PERMISSION_DENIED", `the persona catalog ${dir} is not writable; nothing was changed`, { remedy: `make it writable with \`chmod u+w ${dir}\` to change its personas` });
|
|
144
|
+
throw new CommandFailure("refused", "PERMISSION_DENIED", `the persona catalog ${dir} is not writable; nothing was changed`, { remedy: `make it writable with \`chmod u+w ${shellWord(dir)}\` to change its personas` });
|
|
112
145
|
}
|
|
113
146
|
}
|
|
114
|
-
/**
|
|
147
|
+
/** The largest persona definition the CLI saves, the bound a create on a manager applies to its input. */
|
|
148
|
+
export const PERSONA_LIMIT = 1024 * 1024;
|
|
149
|
+
/** The refusal of a definition over {@link PERSONA_LIMIT}, the same for create and edit. */
|
|
150
|
+
function tooLarge(bytes, remedy) {
|
|
151
|
+
return bytes.length > PERSONA_LIMIT ? new CommandFailure("refused", "SCHEMA_INVALID", `the persona definition is ${bytes.length} bytes, over the 1 MiB limit, so it was not saved`, { remedy }) : undefined;
|
|
152
|
+
}
|
|
153
|
+
/** The persona whose file name differs from `path`'s only in case. A case-insensitive file system
|
|
154
|
+
* holds the two as one file. */
|
|
155
|
+
function caseTwin(path) {
|
|
156
|
+
const file = basename(path);
|
|
157
|
+
const twin = readdirSync(dirname(path)).find(entry => entry !== file && entry.toLowerCase() === file.toLowerCase());
|
|
158
|
+
return twin === undefined ? undefined : basename(twin, ".md");
|
|
159
|
+
}
|
|
160
|
+
/** Shared by canonical and legacy CLI writes only. Manager and external writers do not take this lock.
|
|
161
|
+
* A new persona whose name differs from an existing one only in case is refused. */
|
|
115
162
|
export function commitPersona(path, expected, bytes) {
|
|
163
|
+
const oversized = bytes && tooLarge(bytes, "shorten its instructions to 1 MiB or less");
|
|
164
|
+
if (oversized)
|
|
165
|
+
throw oversized;
|
|
116
166
|
const dir = dirname(path);
|
|
117
167
|
assertCatalogWritable(dir);
|
|
118
168
|
mkSecretDir(dir);
|
|
@@ -122,6 +172,9 @@ export function commitPersona(path, expected, bytes) {
|
|
|
122
172
|
const current = readPersonaSource(path);
|
|
123
173
|
if (!sameSource(expected, current))
|
|
124
174
|
throw new CommandFailure("refused", "CONFLICT", `persona ${current === undefined ? "was removed" : "changed"} while the operation was open: ${path}`, { remedy: current === undefined ? "list the catalog with `cotal persona` and retry" : "read the current definition and retry" });
|
|
175
|
+
const twin = current === undefined && bytes !== undefined ? caseTwin(path) : undefined;
|
|
176
|
+
if (twin !== undefined)
|
|
177
|
+
throw new CommandFailure("refused", "CONFLICT", `persona '${basename(path, ".md")}' differs from the existing '${twin}' only in case; nothing was written`, { remedy: `choose another name, or change the existing one with cotal persona edit ${twin}` });
|
|
125
178
|
if (bytes === undefined)
|
|
126
179
|
unlinkSync(path);
|
|
127
180
|
else
|
|
@@ -148,16 +201,18 @@ function draftFolder() {
|
|
|
148
201
|
}
|
|
149
202
|
}
|
|
150
203
|
/** Own a private draft and remove only that draft. A cleanup failure is not a successful operation.
|
|
151
|
-
*
|
|
152
|
-
function withDraft(name, action, keep) {
|
|
204
|
+
* When `keep` says so, the draft stays in place, because it holds work that was not saved. */
|
|
205
|
+
async function withDraft(name, action, keep) {
|
|
153
206
|
const dir = draftFolder();
|
|
154
207
|
let kept = false;
|
|
155
208
|
try {
|
|
156
209
|
hardenPrivate(dir, "dir");
|
|
157
|
-
|
|
210
|
+
const value = await action(join(dir, `${name}.md`));
|
|
211
|
+
kept = keep?.() === true;
|
|
212
|
+
return value;
|
|
158
213
|
}
|
|
159
214
|
catch (error) {
|
|
160
|
-
kept = keep?.(
|
|
215
|
+
kept = keep?.() === true;
|
|
161
216
|
throw error;
|
|
162
217
|
}
|
|
163
218
|
finally {
|
|
@@ -171,48 +226,128 @@ function withDraft(name, action, keep) {
|
|
|
171
226
|
}
|
|
172
227
|
}
|
|
173
228
|
}
|
|
174
|
-
/**
|
|
175
|
-
export function
|
|
176
|
-
for (const [flag, value] of [["--role",
|
|
229
|
+
/** Refuse a `--role` or `--model` that holds control characters by name, before any rule quotes it. */
|
|
230
|
+
export function assertLabels(values) {
|
|
231
|
+
for (const [flag, value] of [["--role", values.role], ["--model", values.model]])
|
|
177
232
|
if (value !== undefined && /[\u0000-\u001f\u007f]/u.test(value))
|
|
178
233
|
throw new CommandFailure("refused", "USAGE_INVALID", `${flag} takes a label without control characters`);
|
|
234
|
+
}
|
|
235
|
+
/** Use the existing serializer for flag-built definitions; file inputs keep their original bytes. */
|
|
236
|
+
export function serializePersona(def) {
|
|
237
|
+
assertLabels(def);
|
|
238
|
+
if (def.model !== undefined && !def.model.trim())
|
|
239
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "--model is empty", { remedy: "name a model, or leave --model out for the application default" });
|
|
179
240
|
return withDraft(def.name, path => {
|
|
180
241
|
try {
|
|
181
242
|
writeSecretFile(path, "");
|
|
182
243
|
saveAgentFile(path, def);
|
|
183
244
|
}
|
|
184
|
-
catch {
|
|
185
|
-
throw new CommandFailure("refused", "SCHEMA_INVALID",
|
|
245
|
+
catch (error) {
|
|
246
|
+
throw new CommandFailure("refused", "SCHEMA_INVALID", `invalid persona fields: ${error.message.replace(/^saveAgentFile: /, "")}`);
|
|
186
247
|
}
|
|
187
248
|
const bytes = readFileSync(path);
|
|
188
249
|
validatePersona(bytes, path, def.name);
|
|
189
250
|
return bytes;
|
|
190
251
|
});
|
|
191
252
|
}
|
|
192
|
-
/**
|
|
193
|
-
|
|
253
|
+
/** The editor value as a program, when it names an existing file by path: it runs with no shell, so a
|
|
254
|
+
* path that holds spaces needs no quoting. Any other value runs as a shell command. */
|
|
255
|
+
function editorProgram(editor) {
|
|
256
|
+
if (!editor.includes("/") && !editor.includes(sep))
|
|
257
|
+
return undefined;
|
|
258
|
+
try {
|
|
259
|
+
return statSync(editor).isFile() ? editor : undefined;
|
|
260
|
+
}
|
|
261
|
+
catch {
|
|
262
|
+
return undefined;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
/** Run the editor on the draft and wait for it to exit. A SIGINT, SIGTERM or SIGHUP the CLI receives
|
|
266
|
+
* meanwhile is passed to the editor, so the editor does not outlive the CLI. */
|
|
267
|
+
function runEditor(editor, draft) {
|
|
268
|
+
const program = editorProgram(editor);
|
|
269
|
+
const quoted = process.platform === "win32" ? `"${draft.replaceAll('"', '""')}"` : `'${draft.replaceAll("'", "'\\''")}'`;
|
|
270
|
+
let received;
|
|
271
|
+
// The editor starts running as soon as it is spawned, so the CLI holds the signals first.
|
|
272
|
+
const pass = (signal) => { received ??= signal; child.kill(signal); };
|
|
273
|
+
for (const signal of INTERRUPT_SIGNALS)
|
|
274
|
+
process.on(signal, pass);
|
|
275
|
+
const child = program ? spawn(program, [draft], { stdio: "inherit" }) : spawn(`${editor} ${quoted}`, { shell: true, stdio: "inherit" });
|
|
276
|
+
return new Promise(resolve => {
|
|
277
|
+
const done = (exit) => {
|
|
278
|
+
for (const signal of INTERRUPT_SIGNALS)
|
|
279
|
+
process.off(signal, pass);
|
|
280
|
+
resolve({ ...exit, ...(received ? { received } : {}) });
|
|
281
|
+
};
|
|
282
|
+
// An error after a successful start is a failed kill; the exit still follows.
|
|
283
|
+
child.once("error", error => { if (child.pid === undefined)
|
|
284
|
+
done({ status: null, signal: null, error }); });
|
|
285
|
+
child.once("exit", (status, signal) => done({ status, signal }));
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
/** Never expose the catalog file to an editor. Validate successful draft bytes, then compare under lock.
|
|
289
|
+
* An interrupt that stops the edit saves nothing, removes an unchanged draft, names a changed one, and
|
|
290
|
+
* exits with the signal's code. */
|
|
291
|
+
export async function editPersona(path, name, catalog, json = false) {
|
|
194
292
|
if (json || inputDisabledByFlag())
|
|
195
|
-
throw new
|
|
293
|
+
throw new ConfirmationRequired("persona edit opens an editor, --no-input forbids one, as does --json", { remedy: "edit interactively without --json or --no-input" });
|
|
196
294
|
const source = requirePersonaSource(path);
|
|
197
295
|
validatePersona(source.bytes, path);
|
|
198
296
|
assertCatalogWritable(dirname(path));
|
|
199
297
|
const editor = resolvePreference("editor", { preferences: cachedPreferences(), space: catalog.space }).value;
|
|
200
298
|
if (!editor)
|
|
201
299
|
throw new CommandFailure("refused", "DEPENDENCY_UNAVAILABLE", "no editor is set", { remedy: "set VISUAL or EDITOR, or run `cotal config set editor vim`" });
|
|
202
|
-
|
|
300
|
+
// A draft the editor may have changed and that was not saved is kept, and the failure names it.
|
|
301
|
+
let keep = false;
|
|
302
|
+
const edit = await withDraft(name, async (draft) => {
|
|
203
303
|
writeSecretFile(draft, source.bytes);
|
|
204
|
-
const
|
|
205
|
-
|
|
304
|
+
const result = await runEditor(editor, draft);
|
|
305
|
+
// SIGTERM or SIGHUP stops the edit. Ctrl-C reaches the editor too, and stops the edit only when
|
|
306
|
+
// it ends the editor, since an editor such as vim takes Ctrl-C as a key.
|
|
307
|
+
if (result.received && (result.received !== "SIGINT" || result.signal)) {
|
|
308
|
+
keep = readPersonaSource(draft)?.bytes.equals(source.bytes) === false;
|
|
309
|
+
return { action: "interrupted", signal: result.received, ...(keep ? { draft } : {}) };
|
|
310
|
+
}
|
|
206
311
|
// A POSIX shell exits 127 when it finds no such command and 126 when it cannot run it: the editor
|
|
207
|
-
// is missing, as it is when none is set, and nothing was edited.
|
|
312
|
+
// is missing, as it is when none is set, and nothing was edited. A program that cannot be run is
|
|
313
|
+
// refused the same way.
|
|
314
|
+
if (result.error?.code === "EACCES")
|
|
315
|
+
throw new CommandFailure("refused", "DEPENDENCY_UNAVAILABLE", `the editor ${JSON.stringify(editor)} could not be run - not saved`, { remedy: `make ${editor} executable, or set VISUAL or EDITOR to an installed editor` });
|
|
208
316
|
if (process.platform !== "win32" && !result.error && (result.status === 127 || result.status === 126))
|
|
209
317
|
throw new CommandFailure("refused", "DEPENDENCY_UNAVAILABLE", `the editor ${JSON.stringify(editor)} ${result.status === 127 ? "was not found" : "could not be run"} - not saved`, {
|
|
210
|
-
remedy: "set VISUAL or EDITOR to an installed editor, or run `cotal config set editor vim`;
|
|
318
|
+
remedy: "set VISUAL or EDITOR to an installed editor, or run `cotal config set editor vim`; a value that is not the path of an existing file runs as a shell command, so quote a path that holds spaces",
|
|
319
|
+
});
|
|
320
|
+
if (result.error)
|
|
321
|
+
throw new CommandFailure("failed", "OPERATION_FAILED", "the editor could not be started - not saved");
|
|
322
|
+
if (result.signal) {
|
|
323
|
+
keep = true;
|
|
324
|
+
throw new CommandFailure("failed", "OPERATION_FAILED", `editor ended on ${result.signal} - not saved`, {
|
|
325
|
+
remedy: `your draft is kept in ${draft}; remove ${dirname(draft)} when you are done`,
|
|
211
326
|
});
|
|
212
|
-
|
|
213
|
-
|
|
327
|
+
}
|
|
328
|
+
if (result.status !== 0) {
|
|
329
|
+
keep = readPersonaSource(draft)?.bytes.equals(source.bytes) === false;
|
|
330
|
+
return { action: "cancelled", status: result.status ?? 1, ...(keep ? { draft } : {}) };
|
|
331
|
+
}
|
|
214
332
|
const edited = requirePersonaSource(draft).bytes;
|
|
215
|
-
|
|
333
|
+
if (edited.equals(source.bytes))
|
|
334
|
+
return { action: "unchanged" };
|
|
335
|
+
const oversized = tooLarge(edited, `your edit is kept in ${draft}; shorten it to 1 MiB or less, run cotal persona edit ${name} again and paste it in, then remove ${dirname(draft)}`);
|
|
336
|
+
if (oversized) {
|
|
337
|
+
keep = true;
|
|
338
|
+
throw oversized;
|
|
339
|
+
}
|
|
340
|
+
try {
|
|
341
|
+
validatePersona(edited, draft);
|
|
342
|
+
}
|
|
343
|
+
catch (error) {
|
|
344
|
+
if (!isCommandFailure(error))
|
|
345
|
+
throw error;
|
|
346
|
+
keep = true;
|
|
347
|
+
throw new CommandFailure("refused", "SCHEMA_INVALID", `${error.message} - not saved`, {
|
|
348
|
+
remedy: `your edit is kept in ${draft}; correct it, run cotal persona edit ${name} again and paste it in, then remove ${dirname(draft)}`,
|
|
349
|
+
});
|
|
350
|
+
}
|
|
216
351
|
try {
|
|
217
352
|
commitPersona(path, source, edited);
|
|
218
353
|
}
|
|
@@ -221,10 +356,18 @@ export function editPersona(path, name, catalog, json = false) {
|
|
|
221
356
|
throw error;
|
|
222
357
|
// The edit was not saved, so the draft stays and the refusal says where it is.
|
|
223
358
|
const removed = readPersonaSource(path) === undefined;
|
|
359
|
+
keep = true;
|
|
224
360
|
throw new CommandFailure("refused", "CONFLICT", error.message, {
|
|
225
361
|
remedy: `your edit is kept in ${draft}; ${removed ? `restore it with \`cotal persona create ${name} --file ${draft}\`` : `compare it with \`cotal persona show ${name}\`, then edit again`}, and remove ${dirname(draft)} when you are done`,
|
|
226
362
|
});
|
|
227
363
|
}
|
|
228
|
-
|
|
364
|
+
return { action: "saved" };
|
|
365
|
+
}, () => keep);
|
|
366
|
+
if (edit.action === "interrupted") {
|
|
367
|
+
exitInterrupted(edit.signal, edit.draft
|
|
368
|
+
? `Interrupted while the editor was open, so nothing was saved. Your draft is kept in ${edit.draft}; remove ${dirname(edit.draft)} when you are done.`
|
|
369
|
+
: `Interrupted while the editor was open, so nothing was saved and ${name} is unchanged.`);
|
|
370
|
+
}
|
|
371
|
+
return edit;
|
|
229
372
|
}
|
|
230
373
|
//# sourceMappingURL=persona-files.js.map
|