@elie-laloum/outpost 3.0.0 → 4.1.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/CHANGELOG.md +32 -0
- package/README.md +5 -3
- package/SECURITY.md +3 -1
- package/dist/adapters/agents/codex-adapter.js +2 -0
- package/dist/adapters/agents/codex-adapter.js.map +1 -1
- package/dist/adapters/agents/codex-provider.d.ts +2 -0
- package/dist/adapters/agents/codex-provider.js +32 -0
- package/dist/adapters/agents/codex-provider.js.map +1 -0
- package/dist/adapters/agents/codex-request.js +2 -1
- package/dist/adapters/agents/codex-request.js.map +1 -1
- package/dist/adapters/agents/gemini-adapter.d.ts +3 -0
- package/dist/adapters/agents/gemini-adapter.js +15 -0
- package/dist/adapters/agents/gemini-adapter.js.map +1 -0
- package/dist/adapters/agents/gemini-diagnostics.d.ts +2 -0
- package/dist/adapters/agents/gemini-diagnostics.js +15 -0
- package/dist/adapters/agents/gemini-diagnostics.js.map +1 -0
- package/dist/adapters/agents/gemini-events.d.ts +2 -0
- package/dist/adapters/agents/gemini-events.js +50 -0
- package/dist/adapters/agents/gemini-events.js.map +1 -0
- package/dist/adapters/agents/gemini-request.d.ts +4 -0
- package/dist/adapters/agents/gemini-request.js +23 -0
- package/dist/adapters/agents/gemini-request.js.map +1 -0
- package/dist/adapters/agents/gemini.types.d.ts +6 -0
- package/dist/adapters/agents/gemini.types.js +2 -0
- package/dist/adapters/agents/gemini.types.js.map +1 -0
- package/dist/adapters/agents/protocol-fixtures.constants.d.ts +1 -1
- package/dist/adapters/agents/protocol-fixtures.constants.js +37 -0
- package/dist/adapters/agents/protocol-fixtures.constants.js.map +1 -1
- package/dist/adapters/agents/settings.types.d.ts +5 -0
- package/dist/adapters/agents/settings.types.js.map +1 -1
- package/dist/application/agent-bootstrap.constants.d.ts +1 -0
- package/dist/application/agent-bootstrap.constants.js +1 -0
- package/dist/application/agent-bootstrap.constants.js.map +1 -1
- package/dist/application/agent-bootstrap.js +6 -2
- package/dist/application/agent-bootstrap.js.map +1 -1
- package/dist/application/agent-output.js +9 -2
- package/dist/application/agent-output.js.map +1 -1
- package/dist/application/artifact-tasks.d.ts +5 -0
- package/dist/application/artifact-tasks.js +31 -0
- package/dist/application/artifact-tasks.js.map +1 -0
- package/dist/application/artifact-tasks.types.d.ts +8 -0
- package/dist/application/artifact-tasks.types.js +2 -0
- package/dist/application/artifact-tasks.types.js.map +1 -0
- package/dist/application/dispatch-validation.js +2 -0
- package/dist/application/dispatch-validation.js.map +1 -1
- package/dist/application/doctor-agent.constants.d.ts +2 -0
- package/dist/application/doctor-agent.constants.js +2 -0
- package/dist/application/doctor-agent.constants.js.map +1 -1
- package/dist/application/doctor-agent.js +1 -1
- package/dist/application/doctor-agent.js.map +1 -1
- package/dist/application/doctor-protocol.js +2 -1
- package/dist/application/doctor-protocol.js.map +1 -1
- package/dist/application/doctor.constants.js +1 -1
- package/dist/application/doctor.constants.js.map +1 -1
- package/dist/application/doctor.types.d.ts +1 -1
- package/dist/application/doctor.types.js.map +1 -1
- package/dist/application/outpost.types.d.ts +2 -0
- package/dist/application/outpost.types.js.map +1 -1
- package/dist/application/queue-worker.d.ts +2 -0
- package/dist/application/queue-worker.js +75 -0
- package/dist/application/queue-worker.js.map +1 -0
- package/dist/application/queue-worker.types.d.ts +15 -0
- package/dist/application/queue-worker.types.js +2 -0
- package/dist/application/queue-worker.types.js.map +1 -0
- package/dist/application/queued-task.d.ts +3 -0
- package/dist/application/queued-task.js +56 -0
- package/dist/application/queued-task.js.map +1 -0
- package/dist/application/queued-task.types.d.ts +11 -0
- package/dist/application/queued-task.types.js +2 -0
- package/dist/application/queued-task.types.js.map +1 -0
- package/dist/application/recovery-inspection.js +5 -0
- package/dist/application/recovery-inspection.js.map +1 -1
- package/dist/application/recovery-inspection.types.d.ts +3 -0
- package/dist/application/recovery-inspection.types.js.map +1 -1
- package/dist/application/recovery-restore-snapshot.d.ts +2 -0
- package/dist/application/recovery-restore-snapshot.js +57 -0
- package/dist/application/recovery-restore-snapshot.js.map +1 -0
- package/dist/application/recovery-restore.d.ts +3 -0
- package/dist/application/recovery-restore.js +161 -0
- package/dist/application/recovery-restore.js.map +1 -0
- package/dist/application/recovery-restore.types.d.ts +28 -0
- package/dist/application/recovery-restore.types.js +2 -0
- package/dist/application/recovery-restore.types.js.map +1 -0
- package/dist/application/recovery-retention.js +5 -0
- package/dist/application/recovery-retention.js.map +1 -1
- package/dist/application/recovery-verification.d.ts +2 -1
- package/dist/application/recovery-verification.js +1 -1
- package/dist/application/recovery-verification.js.map +1 -1
- package/dist/application/remote-apply.js +6 -0
- package/dist/application/remote-apply.js.map +1 -1
- package/dist/application/remote-download.js +2 -2
- package/dist/application/remote-download.js.map +1 -1
- package/dist/application/remote-history.d.ts +6 -0
- package/dist/application/remote-history.js +114 -0
- package/dist/application/remote-history.js.map +1 -0
- package/dist/application/remote-upload.d.ts +2 -0
- package/dist/application/remote-upload.js +17 -0
- package/dist/application/remote-upload.js.map +1 -0
- package/dist/application/remote-validation.js +20 -28
- package/dist/application/remote-validation.js.map +1 -1
- package/dist/application/remote-workspace.js +4 -10
- package/dist/application/remote-workspace.js.map +1 -1
- package/dist/application/sandbox-activity.d.ts +3 -0
- package/dist/application/sandbox-activity.js +25 -0
- package/dist/application/sandbox-activity.js.map +1 -0
- package/dist/application/sandbox-provision.js +55 -10
- package/dist/application/sandbox-provision.js.map +1 -1
- package/dist/application/sandbox-session.types.d.ts +2 -0
- package/dist/application/sandbox-session.types.js.map +1 -1
- package/dist/application/sandbox.js +23 -11
- package/dist/application/sandbox.js.map +1 -1
- package/dist/application/speculation-host.d.ts +2 -0
- package/dist/application/speculation-host.js +30 -0
- package/dist/application/speculation-host.js.map +1 -0
- package/dist/application/speculation.constants.d.ts +4 -0
- package/dist/application/speculation.constants.js +2 -0
- package/dist/application/speculation.constants.js.map +1 -0
- package/dist/application/speculation.d.ts +2 -0
- package/dist/application/speculation.js +166 -0
- package/dist/application/speculation.js.map +1 -0
- package/dist/application/speculation.types.d.ts +56 -0
- package/dist/application/speculation.types.js +2 -0
- package/dist/application/speculation.types.js.map +1 -0
- package/dist/application/storage-reservation.d.ts +3 -0
- package/dist/application/storage-reservation.js +10 -0
- package/dist/application/storage-reservation.js.map +1 -0
- package/dist/application/storage-reservation.types.d.ts +4 -0
- package/dist/application/storage-reservation.types.js +2 -0
- package/dist/application/storage-reservation.types.js.map +1 -0
- package/dist/application/task-usage.d.ts +1 -1
- package/dist/application/task-usage.js.map +1 -1
- package/dist/application/tasks.js +1 -1
- package/dist/application/tasks.js.map +1 -1
- package/dist/application/tasks.types.d.ts +4 -3
- package/dist/application/tasks.types.js.map +1 -1
- package/dist/application/workspace-allocation.d.ts +3 -0
- package/dist/application/workspace-allocation.js +34 -0
- package/dist/application/workspace-allocation.js.map +1 -0
- package/dist/application/workspace.js +2 -2
- package/dist/application/workspace.js.map +1 -1
- package/dist/cli/commands.js +55 -18
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/doctor-command.js +1 -1
- package/dist/cli/doctor-command.js.map +1 -1
- package/dist/cli/init-authentication.constants.d.ts +13 -0
- package/dist/cli/init-authentication.constants.js +10 -0
- package/dist/cli/init-authentication.constants.js.map +1 -0
- package/dist/cli/init-authentication.d.ts +4 -0
- package/dist/cli/init-authentication.js +43 -0
- package/dist/cli/init-authentication.js.map +1 -0
- package/dist/cli/init-command.js +74 -15
- package/dist/cli/init-command.js.map +1 -1
- package/dist/cli/main.constants.d.ts +111 -2
- package/dist/cli/main.constants.js +148 -42
- package/dist/cli/main.constants.js.map +1 -1
- package/dist/cli/recovery-command.js +28 -4
- package/dist/cli/recovery-command.js.map +1 -1
- package/dist/cli/recovery-restore-command.d.ts +2 -0
- package/dist/cli/recovery-restore-command.js +34 -0
- package/dist/cli/recovery-restore-command.js.map +1 -0
- package/dist/cli/scaffold-files.js +3 -2
- package/dist/cli/scaffold-files.js.map +1 -1
- package/dist/cli/scaffold-validation.js +20 -1
- package/dist/cli/scaffold-validation.js.map +1 -1
- package/dist/cli/scaffold.constants.js +2 -2
- package/dist/cli/scaffold.constants.js.map +1 -1
- package/dist/cli/scaffold.js +13 -0
- package/dist/cli/scaffold.js.map +1 -1
- package/dist/cli/scaffold.types.d.ts +4 -1
- package/dist/cli/scaffold.types.js.map +1 -1
- package/dist/cli/starters.js +9 -2
- package/dist/cli/starters.js.map +1 -1
- package/dist/domain/agent.types.d.ts +2 -0
- package/dist/domain/agent.types.js.map +1 -1
- package/dist/domain/artifact-reference.d.ts +4 -0
- package/dist/domain/artifact-reference.js +90 -0
- package/dist/domain/artifact-reference.js.map +1 -0
- package/dist/domain/artifact.constants.d.ts +2 -0
- package/dist/domain/artifact.constants.js +3 -0
- package/dist/domain/artifact.constants.js.map +1 -0
- package/dist/domain/artifact.d.ts +7 -0
- package/dist/domain/artifact.js +104 -0
- package/dist/domain/artifact.js.map +1 -0
- package/dist/domain/artifact.types.d.ts +44 -0
- package/dist/domain/artifact.types.js +2 -0
- package/dist/domain/artifact.types.js.map +1 -0
- package/dist/domain/egress.constants.d.ts +1 -0
- package/dist/domain/egress.constants.js +7 -0
- package/dist/domain/egress.constants.js.map +1 -0
- package/dist/domain/egress.d.ts +2 -0
- package/dist/domain/egress.js +48 -0
- package/dist/domain/egress.js.map +1 -0
- package/dist/domain/egress.types.d.ts +8 -0
- package/dist/domain/egress.types.js +2 -0
- package/dist/domain/egress.types.js.map +1 -0
- package/dist/domain/sandbox.types.d.ts +1 -0
- package/dist/domain/sandbox.types.js.map +1 -1
- package/dist/domain/task-queue.constants.d.ts +8 -0
- package/dist/domain/task-queue.constants.js +9 -0
- package/dist/domain/task-queue.constants.js.map +1 -0
- package/dist/domain/task-queue.d.ts +11 -0
- package/dist/domain/task-queue.js +105 -0
- package/dist/domain/task-queue.js.map +1 -0
- package/dist/domain/task-queue.types.d.ts +41 -0
- package/dist/domain/task-queue.types.js +2 -0
- package/dist/domain/task-queue.types.js.map +1 -0
- package/dist/domain/workflow/budget.d.ts +2 -2
- package/dist/domain/workflow/budget.js +5 -3
- package/dist/domain/workflow/budget.js.map +1 -1
- package/dist/domain/workflow/checkpoint-validation.d.ts +3 -0
- package/dist/domain/workflow/checkpoint-validation.js +81 -0
- package/dist/domain/workflow/checkpoint-validation.js.map +1 -0
- package/dist/domain/workflow/checkpoint-value.d.ts +2 -0
- package/dist/domain/workflow/checkpoint-value.js +49 -0
- package/dist/domain/workflow/checkpoint-value.js.map +1 -0
- package/dist/domain/workflow/checkpoint.d.ts +3 -0
- package/dist/domain/workflow/checkpoint.js +70 -0
- package/dist/domain/workflow/checkpoint.js.map +1 -0
- package/dist/domain/workflow/checkpoint.types.d.ts +40 -0
- package/dist/domain/workflow/checkpoint.types.js +2 -0
- package/dist/domain/workflow/checkpoint.types.js.map +1 -0
- package/dist/domain/workflow/gate-validation.d.ts +4 -0
- package/dist/domain/workflow/gate-validation.js +71 -0
- package/dist/domain/workflow/gate-validation.js.map +1 -0
- package/dist/domain/workflow/gates.constants.d.ts +4 -0
- package/dist/domain/workflow/gates.constants.js +5 -0
- package/dist/domain/workflow/gates.constants.js.map +1 -0
- package/dist/domain/workflow/gates.d.ts +7 -0
- package/dist/domain/workflow/gates.js +85 -0
- package/dist/domain/workflow/gates.js.map +1 -0
- package/dist/domain/workflow/gates.types.d.ts +27 -0
- package/dist/domain/workflow/gates.types.js +2 -0
- package/dist/domain/workflow/gates.types.js.map +1 -0
- package/dist/domain/workflow/task-runner.js +14 -2
- package/dist/domain/workflow/task-runner.js.map +1 -1
- package/dist/domain/workflow/usage-receipt.constants.d.ts +2 -0
- package/dist/domain/workflow/usage-receipt.constants.js +3 -0
- package/dist/domain/workflow/usage-receipt.constants.js.map +1 -0
- package/dist/domain/workflow/usage-receipt.d.ts +2 -0
- package/dist/domain/workflow/usage-receipt.js +18 -0
- package/dist/domain/workflow/usage-receipt.js.map +1 -0
- package/dist/domain/workflow/validation.js +6 -0
- package/dist/domain/workflow/validation.js.map +1 -1
- package/dist/domain/workflow/workflow-scheduler.js +65 -32
- package/dist/domain/workflow/workflow-scheduler.js.map +1 -1
- package/dist/domain/workflow/workflow-state.d.ts +2 -1
- package/dist/domain/workflow/workflow-state.js +91 -16
- package/dist/domain/workflow/workflow-state.js.map +1 -1
- package/dist/domain/workflow.types.d.ts +13 -2
- package/dist/domain/workflow.types.js.map +1 -1
- package/dist/index.d.ts +32 -2
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/artifact-store.constants.d.ts +1 -0
- package/dist/infrastructure/artifact-store.constants.js +2 -0
- package/dist/infrastructure/artifact-store.constants.js.map +1 -0
- package/dist/infrastructure/artifact-store.d.ts +3 -0
- package/dist/infrastructure/artifact-store.js +100 -0
- package/dist/infrastructure/artifact-store.js.map +1 -0
- package/dist/infrastructure/artifact-store.types.d.ts +4 -0
- package/dist/infrastructure/artifact-store.types.js +2 -0
- package/dist/infrastructure/artifact-store.types.js.map +1 -0
- package/dist/infrastructure/file-manifest.d.ts +1 -1
- package/dist/infrastructure/file-manifest.js +3 -2
- package/dist/infrastructure/file-manifest.js.map +1 -1
- package/dist/infrastructure/git/verification-command.d.ts +1 -1
- package/dist/infrastructure/git/verification-command.js +3 -2
- package/dist/infrastructure/git/verification-command.js.map +1 -1
- package/dist/infrastructure/opentelemetry.js +1 -1
- package/dist/infrastructure/opentelemetry.js.map +1 -1
- package/dist/infrastructure/resource-activity-inspection.d.ts +2 -0
- package/dist/infrastructure/resource-activity-inspection.js +152 -0
- package/dist/infrastructure/resource-activity-inspection.js.map +1 -0
- package/dist/infrastructure/resource-activity.constants.d.ts +8 -0
- package/dist/infrastructure/resource-activity.constants.js +26 -0
- package/dist/infrastructure/resource-activity.constants.js.map +1 -0
- package/dist/infrastructure/resource-activity.d.ts +2 -0
- package/dist/infrastructure/resource-activity.js +166 -0
- package/dist/infrastructure/resource-activity.js.map +1 -0
- package/dist/infrastructure/resource-activity.types.d.ts +53 -0
- package/dist/infrastructure/resource-activity.types.js +2 -0
- package/dist/infrastructure/resource-activity.types.js.map +1 -0
- package/dist/infrastructure/storage-mutation-lock.constants.d.ts +5 -0
- package/dist/infrastructure/storage-mutation-lock.constants.js +6 -0
- package/dist/infrastructure/storage-mutation-lock.constants.js.map +1 -0
- package/dist/infrastructure/storage-mutation-lock.d.ts +1 -0
- package/dist/infrastructure/storage-mutation-lock.js +21 -0
- package/dist/infrastructure/storage-mutation-lock.js.map +1 -0
- package/dist/infrastructure/storage-reservations.constants.d.ts +4 -0
- package/dist/infrastructure/storage-reservations.constants.js +5 -0
- package/dist/infrastructure/storage-reservations.constants.js.map +1 -0
- package/dist/infrastructure/storage-reservations.d.ts +2 -0
- package/dist/infrastructure/storage-reservations.js +150 -0
- package/dist/infrastructure/storage-reservations.js.map +1 -0
- package/dist/infrastructure/storage-reservations.types.d.ts +21 -0
- package/dist/infrastructure/storage-reservations.types.js +2 -0
- package/dist/infrastructure/storage-reservations.types.js.map +1 -0
- package/dist/infrastructure/task-queue-http.constants.d.ts +2 -0
- package/dist/infrastructure/task-queue-http.constants.js +3 -0
- package/dist/infrastructure/task-queue-http.constants.js.map +1 -0
- package/dist/infrastructure/task-queue-http.d.ts +4 -0
- package/dist/infrastructure/task-queue-http.js +158 -0
- package/dist/infrastructure/task-queue-http.js.map +1 -0
- package/dist/infrastructure/task-queue-http.types.d.ts +16 -0
- package/dist/infrastructure/task-queue-http.types.js +2 -0
- package/dist/infrastructure/task-queue-http.types.js.map +1 -0
- package/dist/infrastructure/task-queue.d.ts +2 -0
- package/dist/infrastructure/task-queue.js +134 -0
- package/dist/infrastructure/task-queue.js.map +1 -0
- package/dist/infrastructure/transfer.js +5 -0
- package/dist/infrastructure/transfer.js.map +1 -1
- package/dist/infrastructure/workflow-checkpoint.constants.d.ts +1 -0
- package/dist/infrastructure/workflow-checkpoint.constants.js +2 -0
- package/dist/infrastructure/workflow-checkpoint.constants.js.map +1 -0
- package/dist/infrastructure/workflow-checkpoint.d.ts +3 -0
- package/dist/infrastructure/workflow-checkpoint.js +77 -0
- package/dist/infrastructure/workflow-checkpoint.js.map +1 -0
- package/dist/infrastructure/workflow-checkpoint.types.d.ts +4 -0
- package/dist/infrastructure/workflow-checkpoint.types.js +2 -0
- package/dist/infrastructure/workflow-checkpoint.types.js.map +1 -0
- package/dist/providers/agents.d.ts +3 -1
- package/dist/providers/agents.js +1 -0
- package/dist/providers/agents.js.map +1 -1
- package/dist/providers/container-isolation.d.ts +2 -0
- package/dist/providers/container-isolation.js +29 -0
- package/dist/providers/container-isolation.js.map +1 -0
- package/dist/providers/container-mounts.js +7 -2
- package/dist/providers/container-mounts.js.map +1 -1
- package/dist/providers/container-network.d.ts +2 -0
- package/dist/providers/container-network.js +14 -0
- package/dist/providers/container-network.js.map +1 -0
- package/dist/providers/container-plan.js +4 -2
- package/dist/providers/container-plan.js.map +1 -1
- package/dist/providers/container.constants.d.ts +1 -0
- package/dist/providers/container.constants.js +1 -0
- package/dist/providers/container.constants.js.map +1 -1
- package/dist/providers/container.js +19 -2
- package/dist/providers/container.js.map +1 -1
- package/dist/providers/container.types.d.ts +3 -0
- package/dist/providers/container.types.js.map +1 -1
- package/dist/providers/daytona-command.constants.d.ts +2 -0
- package/dist/providers/daytona-command.constants.js +13 -0
- package/dist/providers/daytona-command.constants.js.map +1 -0
- package/dist/providers/daytona-command.js +12 -5
- package/dist/providers/daytona-command.js.map +1 -1
- package/dist/providers/daytona-output.d.ts +4 -0
- package/dist/providers/daytona-output.js +37 -0
- package/dist/providers/daytona-output.js.map +1 -0
- package/dist/providers/daytona-terminal.d.ts +3 -0
- package/dist/providers/daytona-terminal.js +130 -0
- package/dist/providers/daytona-terminal.js.map +1 -0
- package/dist/providers/daytona.js +2 -0
- package/dist/providers/daytona.js.map +1 -1
- package/dist/providers/docker.d.ts +1 -0
- package/dist/providers/docker.js.map +1 -1
- package/dist/providers/file-batches.d.ts +1 -1
- package/dist/providers/file-batches.js +9 -0
- package/dist/providers/file-batches.js.map +1 -1
- package/dist/providers/file-upload.constants.d.ts +1 -0
- package/dist/providers/file-upload.constants.js +68 -0
- package/dist/providers/file-upload.constants.js.map +1 -0
- package/dist/providers/file-upload.d.ts +2 -0
- package/dist/providers/file-upload.js +146 -0
- package/dist/providers/file-upload.js.map +1 -0
- package/dist/providers/firecracker-command.d.ts +5 -0
- package/dist/providers/firecracker-command.js +114 -0
- package/dist/providers/firecracker-command.js.map +1 -0
- package/dist/providers/firecracker-files.constants.d.ts +1 -0
- package/dist/providers/firecracker-files.constants.js +21 -0
- package/dist/providers/firecracker-files.constants.js.map +1 -0
- package/dist/providers/firecracker-files.d.ts +3 -0
- package/dist/providers/firecracker-files.js +110 -0
- package/dist/providers/firecracker-files.js.map +1 -0
- package/dist/providers/firecracker-machine.d.ts +3 -0
- package/dist/providers/firecracker-machine.js +155 -0
- package/dist/providers/firecracker-machine.js.map +1 -0
- package/dist/providers/firecracker.constants.d.ts +10 -0
- package/dist/providers/firecracker.constants.js +11 -0
- package/dist/providers/firecracker.constants.js.map +1 -0
- package/dist/providers/firecracker.d.ts +4 -0
- package/dist/providers/firecracker.js +103 -0
- package/dist/providers/firecracker.js.map +1 -0
- package/dist/providers/firecracker.types.d.ts +36 -0
- package/dist/providers/firecracker.types.js +2 -0
- package/dist/providers/firecracker.types.js.map +1 -0
- package/dist/providers/local.js +2 -1
- package/dist/providers/local.js.map +1 -1
- package/dist/providers/podman.d.ts +1 -0
- package/dist/providers/podman.js.map +1 -1
- package/dist/providers/terminal-bridge.d.ts +14 -0
- package/dist/providers/terminal-bridge.js +100 -0
- package/dist/providers/terminal-bridge.js.map +1 -0
- package/dist/providers/vercel-command.js +2 -2
- package/dist/providers/vercel-command.js.map +1 -1
- package/dist/providers/vercel-directory.d.ts +2 -0
- package/dist/providers/vercel-directory.js +7 -0
- package/dist/providers/vercel-directory.js.map +1 -0
- package/dist/providers/vercel-files.js +3 -2
- package/dist/providers/vercel-files.js.map +1 -1
- package/dist/providers/vercel-network.d.ts +2 -0
- package/dist/providers/vercel-network.js +18 -0
- package/dist/providers/vercel-network.js.map +1 -0
- package/dist/providers/vercel.d.ts +1 -0
- package/dist/providers/vercel.js +5 -1
- package/dist/providers/vercel.js.map +1 -1
- package/dist/providers/vercel.types.d.ts +2 -0
- package/dist/providers/vercel.types.js.map +1 -1
- package/dist/providers/versions.constants.d.ts +1 -0
- package/dist/providers/versions.constants.js +1 -0
- package/dist/providers/versions.constants.js.map +1 -1
- package/package.json +10 -2
|
@@ -1,54 +1,87 @@
|
|
|
1
|
+
import { applyDecisions, pauseGate, prepareDecisions } from "./gates.js";
|
|
2
|
+
import { openCheckpoint } from "./checkpoint.js";
|
|
1
3
|
import { WorkflowFailure } from "./failure.js";
|
|
2
4
|
import { runTask } from "./task-runner.js";
|
|
3
5
|
import { positive } from "./validation.js";
|
|
4
6
|
import { workflowState } from "./workflow-state.js";
|
|
5
7
|
export async function schedule(name, tasks, options) {
|
|
8
|
+
if (!options.checkpoint &&
|
|
9
|
+
(tasks.some((item) => item.gate) || options.decisions?.length))
|
|
10
|
+
throw new Error("Workflow gates and decisions require a checkpoint");
|
|
11
|
+
if (options.decisions && !options.decisions.length)
|
|
12
|
+
throw new Error("Workflow decisions cannot be empty");
|
|
13
|
+
const checkpoint = options.checkpoint
|
|
14
|
+
? await openCheckpoint(name, tasks, options.checkpoint)
|
|
15
|
+
: undefined;
|
|
16
|
+
try {
|
|
17
|
+
return await scheduleRun(name, tasks, options, checkpoint);
|
|
18
|
+
}
|
|
19
|
+
finally {
|
|
20
|
+
await checkpoint?.release();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async function scheduleRun(name, tasks, options, checkpoint) {
|
|
6
24
|
const concurrency = options.concurrency ?? 1;
|
|
7
25
|
positive(concurrency, "concurrency");
|
|
8
|
-
const state = workflowState(name, tasks, options);
|
|
26
|
+
const state = workflowState(name, tasks, options, checkpoint);
|
|
9
27
|
const { executionId, signal, values, records, errors, observerErrors, record, emit, finish, } = state;
|
|
10
28
|
const active = new Map();
|
|
11
29
|
const started = Date.now();
|
|
30
|
+
const decisions = prepareDecisions(state);
|
|
12
31
|
emit({ type: "start" });
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
32
|
+
applyDecisions(state, decisions);
|
|
33
|
+
await state.persist();
|
|
34
|
+
try {
|
|
35
|
+
while (true) {
|
|
36
|
+
let changed = false;
|
|
37
|
+
for (const item of tasks) {
|
|
38
|
+
if (record(item).status !== "waiting")
|
|
39
|
+
continue;
|
|
40
|
+
if (signal.aborted || state.accounting.exhausted) {
|
|
41
|
+
finish(item, "cancelled");
|
|
42
|
+
changed = true;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const dependencies = item.after.map((dependency) => record(dependency).status);
|
|
46
|
+
if (dependencies.some((status) => ["failed", "skipped", "cancelled", "rejected"].includes(status))) {
|
|
47
|
+
finish(item, "skipped");
|
|
48
|
+
changed = true;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (active.size >= concurrency ||
|
|
52
|
+
item.after.some((dependency) => active.has(dependency)) ||
|
|
53
|
+
!dependencies.every((status) => status === "done"))
|
|
54
|
+
continue;
|
|
55
|
+
const running = (item.gate ? pauseGate(item, state) : runTask(item, state)).finally(() => {
|
|
56
|
+
active.delete(item);
|
|
57
|
+
});
|
|
58
|
+
active.set(item, running);
|
|
20
59
|
changed = true;
|
|
21
|
-
continue;
|
|
22
60
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
finish(item, "skipped");
|
|
26
|
-
changed = true;
|
|
61
|
+
if (active.size) {
|
|
62
|
+
await Promise.race(active.values());
|
|
27
63
|
continue;
|
|
28
64
|
}
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
-
continue;
|
|
32
|
-
const running = runTask(item, state).finally(() => {
|
|
33
|
-
active.delete(item);
|
|
34
|
-
});
|
|
35
|
-
active.set(item, running);
|
|
36
|
-
changed = true;
|
|
37
|
-
}
|
|
38
|
-
if (active.size) {
|
|
39
|
-
await Promise.race(active.values());
|
|
40
|
-
continue;
|
|
65
|
+
if (!changed)
|
|
66
|
+
break;
|
|
41
67
|
}
|
|
42
|
-
if (!changed)
|
|
43
|
-
break;
|
|
44
68
|
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
state.stop.abort(error);
|
|
71
|
+
await Promise.allSettled(active.values());
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
await state.persist();
|
|
45
75
|
if (options.signal?.aborted)
|
|
46
76
|
errors.push(options.signal.reason);
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
77
|
+
const paused = [...records.values()].some((entry) => entry.status === "paused");
|
|
78
|
+
let status = "done";
|
|
79
|
+
if (paused)
|
|
80
|
+
status = "paused";
|
|
81
|
+
if (errors.length)
|
|
82
|
+
status = "failed";
|
|
83
|
+
if (options.signal?.aborted)
|
|
84
|
+
status = "cancelled";
|
|
52
85
|
emit({ type: "finish", status, durationMs: Date.now() - started });
|
|
53
86
|
const result = Object.freeze({
|
|
54
87
|
executionId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-scheduler.js","sourceRoot":"","sources":["../../../src/domain/workflow/workflow-scheduler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workflow-scheduler.js","sourceRoot":"","sources":["../../../src/domain/workflow/workflow-scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAOjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,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GAAG,QAAQ,CAAC;IAC9B,IAAI,MAAM,CAAC,MAAM;QAAE,MAAM,GAAG,QAAQ,CAAC;IACrC,IAAI,OAAO,CAAC,MAAM,EAAE,OAAO;QAAE,MAAM,GAAG,WAAW,CAAC;IAClD,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,MAAM,MAAM,GAAmB,MAAM,CAAC,MAAM,CAAC;QAC3C,WAAW;QACX,IAAI;QACJ,MAAM;QACN,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE;QAClC,KAAK,EAAE,MAAM,CAAC,MAAM,CAClB,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAClE;QACD,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QAC7B,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC;QAC7C,KAAK,CAAI,IAAa;YACpB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;gBACnB,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,CAAC,GAAG,4CAA4C,CACxD,CAAC;YACJ,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,CAAM,CAAC;QAC/B,CAAC;QACD,MAAM;YACJ,IAAI,MAAM,KAAK,MAAM;gBAAE,MAAM,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;QAC3D,CAAC;KACF,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { applyDecisions, pauseGate, prepareDecisions } from \"./gates.ts\";\nimport { openCheckpoint } from \"./checkpoint.ts\";\nimport type { WorkflowCheckpointSession } from \"./checkpoint.types.ts\";\nimport type {\n Task,\n WorkflowOptions,\n WorkflowResult,\n} from \"../workflow.types.ts\";\nimport { WorkflowFailure } from \"./failure.ts\";\nimport { runTask } from \"./task-runner.ts\";\nimport { positive } from \"./validation.ts\";\nimport { workflowState } from \"./workflow-state.ts\";\n\nexport async function schedule(\n name: string,\n tasks: readonly Task[],\n options: WorkflowOptions,\n): Promise<WorkflowResult> {\n if (\n !options.checkpoint &&\n (tasks.some((item) => item.gate) || options.decisions?.length)\n )\n throw new Error(\"Workflow gates and decisions require a checkpoint\");\n if (options.decisions && !options.decisions.length)\n throw new Error(\"Workflow decisions cannot be empty\");\n const checkpoint = options.checkpoint\n ? await openCheckpoint(name, tasks, options.checkpoint)\n : undefined;\n try {\n return await scheduleRun(name, tasks, options, checkpoint);\n } finally {\n await checkpoint?.release();\n }\n}\n\nasync function scheduleRun(\n name: string,\n tasks: readonly Task[],\n options: WorkflowOptions,\n checkpoint?: WorkflowCheckpointSession,\n): Promise<WorkflowResult> {\n const concurrency = options.concurrency ?? 1;\n positive(concurrency, \"concurrency\");\n const state = workflowState(name, tasks, options, checkpoint);\n const {\n executionId,\n signal,\n values,\n records,\n errors,\n observerErrors,\n record,\n emit,\n finish,\n } = state;\n const active = new Map<Task, Promise<void>>();\n const started = Date.now();\n const decisions = prepareDecisions(state);\n emit({ type: \"start\" });\n applyDecisions(state, decisions);\n await state.persist();\n try {\n while (true) {\n let changed = false;\n for (const item of tasks) {\n if (record(item).status !== \"waiting\") continue;\n if (signal.aborted || state.accounting.exhausted) {\n finish(item, \"cancelled\");\n changed = true;\n continue;\n }\n const dependencies = item.after.map(\n (dependency) => record(dependency).status,\n );\n if (\n dependencies.some((status) =>\n [\"failed\", \"skipped\", \"cancelled\", \"rejected\"].includes(status),\n )\n ) {\n finish(item, \"skipped\");\n changed = true;\n continue;\n }\n if (\n active.size >= concurrency ||\n item.after.some((dependency) => active.has(dependency)) ||\n !dependencies.every((status) => status === \"done\")\n )\n continue;\n const running = (\n item.gate ? pauseGate(item, state) : runTask(item, state)\n ).finally(() => {\n active.delete(item);\n });\n active.set(item, running);\n changed = true;\n }\n if (active.size) {\n await Promise.race(active.values());\n continue;\n }\n if (!changed) break;\n }\n } catch (error) {\n state.stop.abort(error);\n await Promise.allSettled(active.values());\n throw error;\n }\n await state.persist();\n if (options.signal?.aborted) errors.push(options.signal.reason);\n const paused = [...records.values()].some(\n (entry) => entry.status === \"paused\",\n );\n let status: WorkflowResult[\"status\"] = \"done\";\n if (paused) status = \"paused\";\n if (errors.length) status = \"failed\";\n if (options.signal?.aborted) status = \"cancelled\";\n emit({ type: \"finish\", status, durationMs: Date.now() - started });\n const result: WorkflowResult = Object.freeze({\n executionId,\n name,\n status,\n usage: state.accounting.snapshot(),\n tasks: Object.freeze(\n [...records.values()].map((value) => Object.freeze({ ...value })),\n ),\n errors: Object.freeze(errors),\n observerErrors: Object.freeze(observerErrors),\n value<T>(item: Task<T>): T {\n if (!values.has(item))\n throw new Error(\n `${item.key} has no successful value in this execution`,\n );\n return values.get(item) as T;\n },\n unwrap() {\n if (status !== \"done\") throw new WorkflowFailure(result);\n },\n });\n return result;\n}\n"]}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import type { WorkflowCheckpointSession } from "./checkpoint.types.ts";
|
|
1
2
|
import type { Task, WorkflowExecutionState, WorkflowOptions } from "../workflow.types.ts";
|
|
2
|
-
export declare function workflowState(name: string, tasks: readonly Task[], options: WorkflowOptions): WorkflowExecutionState;
|
|
3
|
+
export declare function workflowState(name: string, tasks: readonly Task[], options: WorkflowOptions, checkpoint?: WorkflowCheckpointSession): WorkflowExecutionState;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { maxUsageReceiptsPerTask } from "./usage-receipt.constants.js";
|
|
2
|
+
import { validateUsageReceipt } from "./usage-receipt.js";
|
|
1
3
|
import { workflowAccounting } from "./budget.js";
|
|
2
4
|
import { randomUUID } from "node:crypto";
|
|
3
|
-
export function workflowState(name, tasks, options) {
|
|
4
|
-
const executionId = randomUUID();
|
|
5
|
+
export function workflowState(name, tasks, options, checkpoint) {
|
|
6
|
+
const executionId = checkpoint?.initial?.executionId ?? randomUUID();
|
|
5
7
|
const stop = new AbortController();
|
|
6
8
|
const signal = options.signal
|
|
7
9
|
? AbortSignal.any([options.signal, stop.signal])
|
|
@@ -12,12 +14,51 @@ export function workflowState(name, tasks, options) {
|
|
|
12
14
|
item,
|
|
13
15
|
{ key: item.key, status: "waiting", attempts: 0 },
|
|
14
16
|
]));
|
|
17
|
+
const saved = checkpoint?.initial;
|
|
18
|
+
if (saved) {
|
|
19
|
+
const complete = saved.records.every((entry) => ["done", "skipped"].includes(entry.status));
|
|
20
|
+
const settledPause = saved.records.some((entry) => ["paused", "rejected"].includes(entry.status)) &&
|
|
21
|
+
saved.records.every((entry) => ["done", "skipped", "paused", "rejected"].includes(entry.status) ||
|
|
22
|
+
(entry.status === "waiting" && entry.attempts === 0));
|
|
23
|
+
for (const item of tasks) {
|
|
24
|
+
const entry = saved.records.find((entry) => entry.key === item.key);
|
|
25
|
+
records.set(item, {
|
|
26
|
+
...entry,
|
|
27
|
+
...(entry.usageReceipts
|
|
28
|
+
? { usageReceipts: Object.freeze([...entry.usageReceipts]) }
|
|
29
|
+
: {}),
|
|
30
|
+
...(entry.pause
|
|
31
|
+
? {
|
|
32
|
+
pause: Object.freeze({
|
|
33
|
+
...entry.pause,
|
|
34
|
+
actors: Object.freeze([...entry.pause.actors]),
|
|
35
|
+
}),
|
|
36
|
+
}
|
|
37
|
+
: {}),
|
|
38
|
+
...(entry.decision
|
|
39
|
+
? { decision: Object.freeze({ ...entry.decision }) }
|
|
40
|
+
: {}),
|
|
41
|
+
status: ["done", "paused", "rejected"].includes(entry.status) ||
|
|
42
|
+
complete ||
|
|
43
|
+
(settledPause && entry.status === "skipped")
|
|
44
|
+
? entry.status
|
|
45
|
+
: "waiting",
|
|
46
|
+
});
|
|
47
|
+
if (entry.status === "done") {
|
|
48
|
+
const output = saved.values[item.key];
|
|
49
|
+
values.set(item, output.kind === "json" ? output.value : undefined);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
15
53
|
const errors = [], observerErrors = [];
|
|
54
|
+
for (const entry of records.values())
|
|
55
|
+
if (entry.status === "rejected")
|
|
56
|
+
errors.push(new Error(entry.error));
|
|
16
57
|
const accounting = workflowAccounting(options.budget, (error) => {
|
|
17
58
|
errors.push(error);
|
|
18
59
|
if (error.dimension !== "attempts")
|
|
19
60
|
stop.abort(error);
|
|
20
|
-
});
|
|
61
|
+
}, saved?.usage);
|
|
21
62
|
const record = (item) => records.get(item);
|
|
22
63
|
function emit(event) {
|
|
23
64
|
try {
|
|
@@ -50,22 +91,52 @@ export function workflowState(name, tasks, options) {
|
|
|
50
91
|
function context(item, attempt, taskSignal) {
|
|
51
92
|
if (attempt > 0)
|
|
52
93
|
activeAttempts.set(item, attempt);
|
|
94
|
+
function report(usage, receipt) {
|
|
95
|
+
const current = record(item);
|
|
96
|
+
if (attempt === 0 ||
|
|
97
|
+
current.status !== "active" ||
|
|
98
|
+
activeAttempts.get(item) !== attempt)
|
|
99
|
+
throw new Error("Usage must be reported during its active task attempt");
|
|
100
|
+
if (receipt !== undefined) {
|
|
101
|
+
validateUsageReceipt(receipt);
|
|
102
|
+
if (current.usageReceipts?.includes(receipt))
|
|
103
|
+
return;
|
|
104
|
+
if ((current.usageReceipts?.length ?? 0) >= maxUsageReceiptsPerTask)
|
|
105
|
+
throw new Error("Workflow usage receipt limit exceeded");
|
|
106
|
+
}
|
|
107
|
+
const previousReceipts = current.usageReceipts;
|
|
108
|
+
if (receipt !== undefined)
|
|
109
|
+
current.usageReceipts = Object.freeze([
|
|
110
|
+
...(previousReceipts ?? []),
|
|
111
|
+
receipt,
|
|
112
|
+
]);
|
|
113
|
+
try {
|
|
114
|
+
accounting.report(usage);
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
if (previousReceipts)
|
|
118
|
+
current.usageReceipts = previousReceipts;
|
|
119
|
+
else
|
|
120
|
+
delete current.usageReceipts;
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
void runtime.persist().catch((error) => stop.abort(error));
|
|
124
|
+
emit({
|
|
125
|
+
type: "usage",
|
|
126
|
+
key: item.key,
|
|
127
|
+
attempt,
|
|
128
|
+
usage: Object.freeze({ ...usage }),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
53
131
|
return {
|
|
54
132
|
signal: taskSignal,
|
|
55
133
|
attempt,
|
|
56
134
|
executionId,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
accounting.report(usage);
|
|
63
|
-
emit({
|
|
64
|
-
type: "usage",
|
|
65
|
-
key: item.key,
|
|
66
|
-
attempt,
|
|
67
|
-
usage: Object.freeze({ ...usage }),
|
|
68
|
-
});
|
|
135
|
+
checkpoint: () => runtime.persist(),
|
|
136
|
+
reportUsage: (usage) => report(usage),
|
|
137
|
+
reportUsageOnce: (receipt, usage) => {
|
|
138
|
+
validateUsageReceipt(receipt);
|
|
139
|
+
report(usage, receipt);
|
|
69
140
|
},
|
|
70
141
|
value(dependency) {
|
|
71
142
|
if (!item.after.includes(dependency))
|
|
@@ -76,7 +147,10 @@ export function workflowState(name, tasks, options) {
|
|
|
76
147
|
},
|
|
77
148
|
};
|
|
78
149
|
}
|
|
79
|
-
|
|
150
|
+
const runtime = {
|
|
151
|
+
async persist() {
|
|
152
|
+
await checkpoint?.save(runtime);
|
|
153
|
+
},
|
|
80
154
|
executionId,
|
|
81
155
|
accounting,
|
|
82
156
|
closeAttempt(item) {
|
|
@@ -94,5 +168,6 @@ export function workflowState(name, tasks, options) {
|
|
|
94
168
|
context,
|
|
95
169
|
options,
|
|
96
170
|
};
|
|
171
|
+
return runtime;
|
|
97
172
|
}
|
|
98
173
|
//# sourceMappingURL=workflow-state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-state.js","sourceRoot":"","sources":["../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,CAAC,KAAK,OAAO;oBAEpC,MAAM,IAAI,KAAK,CACb,uDAAuD,CACxD,CAAC;gBACJ,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACzB,IAAI,CAAC;oBACH,IAAI,EAAE,OAAO;oBACb,GAAG,EAAE,IAAI,CAAC,GAAG;oBACb,OAAO;oBACP,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC;iBACnC,CAAC,CAAC;YACL,CAAC;YACD,KAAK,CAAI,UAAmB;gBAC1B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC;oBAClC,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,CAAC,GAAG,2BAA2B,UAAU,CAAC,GAAG,EAAE,CACvD,CAAC;gBACJ,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC;oBACzB,MAAM,IAAI,KAAK,CAAC,GAAG,UAAU,CAAC,GAAG,0BAA0B,CAAC,CAAC;gBAC/D,OAAO,MAAM,CAAC,GAAG,CAAC,UAAU,CAAM,CAAC;YACrC,CAAC;SACF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,WAAW;QACX,UAAU;QACV,YAAY,CAAC,IAAI;YACf,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC;QACD,IAAI;QACJ,MAAM;QACN,MAAM;QACN,OAAO;QACP,MAAM;QACN,cAAc;QACd,MAAM;QACN,IAAI;QACJ,MAAM;QACN,OAAO;QACP,OAAO;KACR,CAAC;AACJ,CAAC","sourcesContent":["import { workflowAccounting } from \"./budget.ts\";\nimport { randomUUID } from \"node:crypto\";\nimport type {\n Task,\n TaskContext,\n TaskRecord,\n TaskStatus,\n WorkflowEvent,\n WorkflowExecutionState,\n WorkflowOptions,\n} from \"../workflow.types.ts\";\n\nexport function workflowState(\n name: string,\n tasks: readonly Task[],\n options: WorkflowOptions,\n): WorkflowExecutionState {\n const executionId = randomUUID();\n const stop = new AbortController();\n const signal = options.signal\n ? AbortSignal.any([options.signal, stop.signal])\n : stop.signal;\n const values = new Map<Task, unknown>();\n const activeAttempts = new Map<Task, number>();\n const records = new Map<Task, TaskRecord>(\n tasks.map((item) => [\n item,\n { key: item.key, status: \"waiting\", attempts: 0 },\n ]),\n );\n const errors: unknown[] = [],\n observerErrors: unknown[] = [];\n const accounting = workflowAccounting(options.budget, (error) => {\n errors.push(error);\n if (error.dimension !== \"attempts\") stop.abort(error);\n });\n const record = (item: Task) => records.get(item)!;\n function emit(\n event: Omit<WorkflowEvent, \"executionId\" | \"workflow\" | \"timestamp\">,\n ): void {\n try {\n options.observe?.({\n ...event,\n executionId,\n workflow: name,\n timestamp: new Date().toISOString(),\n });\n } catch (error) {\n observerErrors.push(error);\n }\n }\n function finish(item: Task, status: TaskStatus): void {\n Object.assign(record(item), {\n status,\n finishedAt: new Date().toISOString(),\n });\n emit({\n type: \"task\",\n key: item.key,\n status,\n attempt: record(item).attempts,\n ...(record(item).startedAt\n ? { durationMs: Date.now() - Date.parse(record(item).startedAt!) }\n : {}),\n });\n }\n function context(\n item: Task,\n attempt: number,\n taskSignal: AbortSignal,\n ): TaskContext {\n if (attempt > 0) activeAttempts.set(item, attempt);\n return {\n signal: taskSignal,\n attempt,\n executionId,\n reportUsage(usage) {\n if (\n attempt === 0 ||\n record(item).status !== \"active\" ||\n activeAttempts.get(item) !== attempt\n )\n throw new Error(\n \"Usage must be reported during its active task attempt\",\n );\n accounting.report(usage);\n emit({\n type: \"usage\",\n key: item.key,\n attempt,\n usage: Object.freeze({ ...usage }),\n });\n },\n value<T>(dependency: Task<T>): T {\n if (!item.after.includes(dependency))\n throw new Error(\n `${item.key}: undeclared dependency ${dependency.key}`,\n );\n if (!values.has(dependency))\n throw new Error(`${dependency.key} has no successful value`);\n return values.get(dependency) as T;\n },\n };\n }\n\n return {\n executionId,\n accounting,\n closeAttempt(item) {\n activeAttempts.delete(item);\n },\n stop,\n signal,\n values,\n records,\n errors,\n observerErrors,\n record,\n emit,\n finish,\n context,\n options,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"workflow-state.js","sourceRoot":"","sources":["../../../src/domain/workflow/workflow-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAWzC,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,KAAsB,EACtB,OAAwB,EACxB,UAAsC;IAEtC,MAAM,WAAW,GAAG,UAAU,EAAE,OAAO,EAAE,WAAW,IAAI,UAAU,EAAE,CAAC;IACrE,MAAM,IAAI,GAAG,IAAI,eAAe,EAAE,CAAC;IACnC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM;QAC3B,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAChD,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IAChB,MAAM,MAAM,GAAG,IAAI,GAAG,EAAiB,CAAC;IACxC,MAAM,cAAc,GAAG,IAAI,GAAG,EAAgB,CAAC;IAC/C,MAAM,OAAO,GAAG,IAAI,GAAG,CACrB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QAClB,IAAI;QACJ,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,EAAE;KAClD,CAAC,CACH,CAAC;IACF,MAAM,KAAK,GAAG,UAAU,EAAE,OAAO,CAAC;IAClC,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,EAA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CAAC","sourcesContent":["import { maxUsageReceiptsPerTask } from \"./usage-receipt.constants.ts\";\nimport { validateUsageReceipt } from \"./usage-receipt.ts\";\nimport type { Usage } from \"../agent.types.ts\";\nimport type { WorkflowCheckpointSession } from \"./checkpoint.types.ts\";\nimport { workflowAccounting } from \"./budget.ts\";\nimport { randomUUID } from \"node:crypto\";\nimport type {\n Task,\n TaskContext,\n TaskRecord,\n TaskStatus,\n WorkflowEvent,\n WorkflowExecutionState,\n WorkflowOptions,\n} from \"../workflow.types.ts\";\n\nexport function workflowState(\n name: string,\n tasks: readonly Task[],\n options: WorkflowOptions,\n checkpoint?: WorkflowCheckpointSession,\n): WorkflowExecutionState {\n const executionId = checkpoint?.initial?.executionId ?? randomUUID();\n const stop = new AbortController();\n const signal = options.signal\n ? AbortSignal.any([options.signal, stop.signal])\n : stop.signal;\n const values = new Map<Task, unknown>();\n const activeAttempts = new Map<Task, number>();\n const records = new Map<Task, TaskRecord>(\n tasks.map((item) => [\n item,\n { key: item.key, status: \"waiting\", attempts: 0 },\n ]),\n );\n const saved = checkpoint?.initial;\n if (saved) {\n const complete = saved.records.every((entry) =>\n [\"done\", \"skipped\"].includes(entry.status),\n );\n const settledPause =\n saved.records.some((entry) =>\n [\"paused\", \"rejected\"].includes(entry.status),\n ) &&\n saved.records.every(\n (entry) =>\n [\"done\", \"skipped\", \"paused\", \"rejected\"].includes(entry.status) ||\n (entry.status === \"waiting\" && entry.attempts === 0),\n );\n for (const item of tasks) {\n const entry = saved.records.find((entry) => entry.key === item.key)!;\n records.set(item, {\n ...entry,\n ...(entry.usageReceipts\n ? { usageReceipts: Object.freeze([...entry.usageReceipts]) }\n : {}),\n ...(entry.pause\n ? {\n pause: Object.freeze({\n ...entry.pause,\n actors: Object.freeze([...entry.pause.actors]),\n }),\n }\n : {}),\n ...(entry.decision\n ? { decision: Object.freeze({ ...entry.decision }) }\n : {}),\n status:\n [\"done\", \"paused\", \"rejected\"].includes(entry.status) ||\n complete ||\n (settledPause && entry.status === \"skipped\")\n ? entry.status\n : \"waiting\",\n });\n if (entry.status === \"done\") {\n const output = saved.values[item.key]!;\n values.set(item, output.kind === \"json\" ? output.value : undefined);\n }\n }\n }\n const errors: unknown[] = [],\n observerErrors: unknown[] = [];\n for (const entry of records.values())\n if (entry.status === \"rejected\") errors.push(new Error(entry.error));\n const accounting = workflowAccounting(\n options.budget,\n (error) => {\n errors.push(error);\n if (error.dimension !== \"attempts\") stop.abort(error);\n },\n saved?.usage,\n );\n const record = (item: Task) => records.get(item)!;\n function emit(\n event: Omit<WorkflowEvent, \"executionId\" | \"workflow\" | \"timestamp\">,\n ): void {\n try {\n options.observe?.({\n ...event,\n executionId,\n workflow: name,\n timestamp: new Date().toISOString(),\n });\n } catch (error) {\n observerErrors.push(error);\n }\n }\n function finish(item: Task, status: TaskStatus): void {\n Object.assign(record(item), {\n status,\n finishedAt: new Date().toISOString(),\n });\n emit({\n type: \"task\",\n key: item.key,\n status,\n attempt: record(item).attempts,\n ...(record(item).startedAt\n ? { durationMs: Date.now() - Date.parse(record(item).startedAt!) }\n : {}),\n });\n }\n function context(\n item: Task,\n attempt: number,\n taskSignal: AbortSignal,\n ): TaskContext {\n if (attempt > 0) activeAttempts.set(item, attempt);\n function report(usage: Usage, receipt?: string): void {\n const current = record(item);\n if (\n attempt === 0 ||\n current.status !== \"active\" ||\n activeAttempts.get(item) !== attempt\n )\n throw new Error(\n \"Usage must be reported during its active task attempt\",\n );\n if (receipt !== undefined) {\n validateUsageReceipt(receipt);\n if (current.usageReceipts?.includes(receipt)) return;\n if ((current.usageReceipts?.length ?? 0) >= maxUsageReceiptsPerTask)\n throw new Error(\"Workflow usage receipt limit exceeded\");\n }\n const previousReceipts = current.usageReceipts;\n if (receipt !== undefined)\n current.usageReceipts = Object.freeze([\n ...(previousReceipts ?? []),\n receipt,\n ]);\n try {\n accounting.report(usage);\n } catch (error) {\n if (previousReceipts) current.usageReceipts = previousReceipts;\n else delete current.usageReceipts;\n throw error;\n }\n void runtime.persist().catch((error: unknown) => stop.abort(error));\n emit({\n type: \"usage\",\n key: item.key,\n attempt,\n usage: Object.freeze({ ...usage }),\n });\n }\n\n return {\n signal: taskSignal,\n attempt,\n executionId,\n checkpoint: () => runtime.persist(),\n reportUsage: (usage) => report(usage),\n reportUsageOnce: (receipt, usage) => {\n validateUsageReceipt(receipt);\n report(usage, receipt);\n },\n value<T>(dependency: Task<T>): T {\n if (!item.after.includes(dependency))\n throw new Error(\n `${item.key}: undeclared dependency ${dependency.key}`,\n );\n if (!values.has(dependency))\n throw new Error(`${dependency.key} has no successful value`);\n return values.get(dependency) as T;\n },\n };\n }\n\n const runtime: WorkflowExecutionState = {\n async persist() {\n await checkpoint?.save(runtime);\n },\n executionId,\n accounting,\n closeAttempt(item) {\n activeAttempts.delete(item);\n },\n stop,\n signal,\n values,\n records,\n errors,\n observerErrors,\n record,\n emit,\n finish,\n context,\n options,\n };\n return runtime;\n}\n"]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { WorkflowDecision, WorkflowDecisionRecord, WorkflowGate, WorkflowPauseRequest } from "./workflow/gates.types.ts";
|
|
2
|
+
import type { WorkflowCheckpointOptions } from "./workflow/checkpoint.types.ts";
|
|
1
3
|
import type { Usage } from "./agent.types.ts";
|
|
2
4
|
import type { WorkflowAccounting, WorkflowBudget, WorkflowUsage } from "./workflow/budget.types.ts";
|
|
3
5
|
export interface TaskContext {
|
|
@@ -5,6 +7,8 @@ export interface TaskContext {
|
|
|
5
7
|
readonly attempt: number;
|
|
6
8
|
readonly executionId: string;
|
|
7
9
|
reportUsage(usage: Usage): void;
|
|
10
|
+
reportUsageOnce?(receipt: string, usage: Usage): void;
|
|
11
|
+
checkpoint?(): Promise<void>;
|
|
8
12
|
value<T>(dependency: Task<T>): T;
|
|
9
13
|
}
|
|
10
14
|
export interface Retry {
|
|
@@ -14,6 +18,7 @@ export interface Retry {
|
|
|
14
18
|
}
|
|
15
19
|
export interface Task<T = unknown> {
|
|
16
20
|
readonly key: string;
|
|
21
|
+
readonly gate?: WorkflowGate;
|
|
17
22
|
readonly after: readonly Task[];
|
|
18
23
|
readonly perform: (context: TaskContext) => T | Promise<T>;
|
|
19
24
|
readonly condition?: (context: TaskContext) => boolean | Promise<boolean>;
|
|
@@ -23,8 +28,11 @@ export interface Task<T = unknown> {
|
|
|
23
28
|
export type TaskOptions<T> = Omit<Task<T>, "after"> & {
|
|
24
29
|
readonly after?: readonly Task[];
|
|
25
30
|
};
|
|
26
|
-
export type TaskStatus = "waiting" | "active" | "done" | "failed" | "skipped" | "cancelled";
|
|
31
|
+
export type TaskStatus = "waiting" | "active" | "done" | "failed" | "skipped" | "cancelled" | "paused" | "rejected";
|
|
27
32
|
export interface TaskRecord {
|
|
33
|
+
usageReceipts?: readonly string[];
|
|
34
|
+
pause?: WorkflowPauseRequest;
|
|
35
|
+
decision?: WorkflowDecisionRecord;
|
|
28
36
|
readonly key: string;
|
|
29
37
|
status: TaskStatus;
|
|
30
38
|
attempts: number;
|
|
@@ -44,6 +52,8 @@ export interface WorkflowEvent {
|
|
|
44
52
|
readonly durationMs?: number;
|
|
45
53
|
}
|
|
46
54
|
export interface WorkflowOptions {
|
|
55
|
+
readonly decisions?: readonly WorkflowDecision[];
|
|
56
|
+
readonly checkpoint?: WorkflowCheckpointOptions;
|
|
47
57
|
readonly signal?: AbortSignal;
|
|
48
58
|
readonly concurrency?: number;
|
|
49
59
|
readonly budget?: WorkflowBudget;
|
|
@@ -53,7 +63,7 @@ export interface WorkflowOptions {
|
|
|
53
63
|
export interface WorkflowResult {
|
|
54
64
|
readonly executionId: string;
|
|
55
65
|
readonly name: string;
|
|
56
|
-
readonly status: "done" | "failed" | "cancelled";
|
|
66
|
+
readonly status: "done" | "failed" | "cancelled" | "paused";
|
|
57
67
|
readonly tasks: readonly Readonly<TaskRecord>[];
|
|
58
68
|
readonly errors: readonly unknown[];
|
|
59
69
|
readonly observerErrors: readonly unknown[];
|
|
@@ -78,6 +88,7 @@ export interface WorkflowExecutionState {
|
|
|
78
88
|
readonly observerErrors: unknown[];
|
|
79
89
|
readonly options: WorkflowOptions;
|
|
80
90
|
readonly accounting: WorkflowAccounting;
|
|
91
|
+
persist(): Promise<void>;
|
|
81
92
|
closeAttempt(task: Task): void;
|
|
82
93
|
record(task: Task): TaskRecord;
|
|
83
94
|
emit(event: WorkflowNotification): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.types.js","sourceRoot":"","sources":["../../src/domain/workflow.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Usage } from \"./agent.types.ts\";\nimport type {\n WorkflowAccounting,\n WorkflowBudget,\n WorkflowUsage,\n} from \"./workflow/budget.types.ts\";\n\nexport interface TaskContext {\n readonly signal: AbortSignal;\n readonly attempt: number;\n readonly executionId: string;\n reportUsage(usage: Usage): void;\n value<T>(dependency: Task<T>): T;\n}\n\nexport interface Retry {\n readonly attempts: number;\n readonly delayMs?: number;\n readonly accepts?: (error: unknown, attempt: number) => boolean;\n}\n\nexport interface Task<T = unknown> {\n readonly key: string;\n readonly after: readonly Task[];\n readonly perform: (context: TaskContext) => T | Promise<T>;\n readonly condition?: (context: TaskContext) => boolean | Promise<boolean>;\n readonly retry?: Retry;\n readonly timeoutMs?: number;\n}\n\nexport type TaskOptions<T> = Omit<Task<T>, \"after\"> & {\n readonly after?: readonly Task[];\n};\n\nexport type TaskStatus =\n \"waiting\"
|
|
1
|
+
{"version":3,"file":"workflow.types.js","sourceRoot":"","sources":["../../src/domain/workflow.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n WorkflowDecision,\n WorkflowDecisionRecord,\n WorkflowGate,\n WorkflowPauseRequest,\n} from \"./workflow/gates.types.ts\";\nimport type { WorkflowCheckpointOptions } from \"./workflow/checkpoint.types.ts\";\nimport type { Usage } from \"./agent.types.ts\";\nimport type {\n WorkflowAccounting,\n WorkflowBudget,\n WorkflowUsage,\n} from \"./workflow/budget.types.ts\";\n\nexport interface TaskContext {\n readonly signal: AbortSignal;\n readonly attempt: number;\n readonly executionId: string;\n reportUsage(usage: Usage): void;\n reportUsageOnce?(receipt: string, usage: Usage): void;\n checkpoint?(): Promise<void>;\n value<T>(dependency: Task<T>): T;\n}\n\nexport interface Retry {\n readonly attempts: number;\n readonly delayMs?: number;\n readonly accepts?: (error: unknown, attempt: number) => boolean;\n}\n\nexport interface Task<T = unknown> {\n readonly key: string;\n readonly gate?: WorkflowGate;\n readonly after: readonly Task[];\n readonly perform: (context: TaskContext) => T | Promise<T>;\n readonly condition?: (context: TaskContext) => boolean | Promise<boolean>;\n readonly retry?: Retry;\n readonly timeoutMs?: number;\n}\n\nexport type TaskOptions<T> = Omit<Task<T>, \"after\"> & {\n readonly after?: readonly Task[];\n};\n\nexport type TaskStatus =\n | \"waiting\"\n | \"active\"\n | \"done\"\n | \"failed\"\n | \"skipped\"\n | \"cancelled\"\n | \"paused\"\n | \"rejected\";\n\nexport interface TaskRecord {\n usageReceipts?: readonly string[];\n pause?: WorkflowPauseRequest;\n decision?: WorkflowDecisionRecord;\n readonly key: string;\n status: TaskStatus;\n attempts: number;\n startedAt?: string;\n finishedAt?: string;\n error?: string;\n}\n\nexport interface WorkflowEvent {\n readonly executionId: string;\n readonly workflow: string;\n readonly timestamp: string;\n readonly type: \"start\" | \"task\" | \"attempt\" | \"retry\" | \"usage\" | \"finish\";\n readonly key?: string;\n readonly status?: TaskStatus;\n readonly attempt?: number;\n readonly usage?: Usage;\n readonly durationMs?: number;\n}\n\nexport interface WorkflowOptions {\n readonly decisions?: readonly WorkflowDecision[];\n readonly checkpoint?: WorkflowCheckpointOptions;\n readonly signal?: AbortSignal;\n readonly concurrency?: number;\n readonly budget?: WorkflowBudget;\n readonly stopOnError?: boolean;\n readonly observe?: (event: WorkflowEvent) => void;\n}\n\nexport interface WorkflowResult {\n readonly executionId: string;\n readonly name: string;\n readonly status: \"done\" | \"failed\" | \"cancelled\" | \"paused\";\n readonly tasks: readonly Readonly<TaskRecord>[];\n readonly errors: readonly unknown[];\n readonly observerErrors: readonly unknown[];\n readonly usage: WorkflowUsage;\n value<T>(task: Task<T>): T;\n unwrap(): void;\n}\n\nexport interface Workflow {\n readonly name: string;\n readonly tasks: readonly Task[];\n start(options?: WorkflowOptions): Promise<WorkflowResult>;\n diagram(): string;\n}\n\nexport type WorkflowNotification = Omit<\n WorkflowEvent,\n \"executionId\" | \"workflow\" | \"timestamp\"\n>;\nexport interface WorkflowExecutionState {\n readonly executionId: string;\n readonly stop: AbortController;\n readonly signal: AbortSignal;\n readonly values: Map<Task, unknown>;\n readonly records: Map<Task, TaskRecord>;\n readonly errors: unknown[];\n readonly observerErrors: unknown[];\n readonly options: WorkflowOptions;\n readonly accounting: WorkflowAccounting;\n persist(): Promise<void>;\n closeAttempt(task: Task): void;\n record(task: Task): TaskRecord;\n emit(event: WorkflowNotification): void;\n finish(task: Task, status: TaskStatus): void;\n context(task: Task, attempt: number, signal: AbortSignal): TaskContext;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ export type { DispatchOptions, Execution, Turn, } from "./application/execution.
|
|
|
4
4
|
export { WorkflowFailure, WorkflowBudgetExceeded, task, workflow, } from "./domain/workflow.ts";
|
|
5
5
|
export type { Retry, Task, TaskContext, TaskOptions, TaskRecord, TaskStatus, Workflow, WorkflowEvent, WorkflowOptions, WorkflowBudget, WorkflowUsage, WorkflowResult, } from "./domain/workflow.ts";
|
|
6
6
|
export { agentTask, commandTask, isolatedTask } from "./application/tasks.ts";
|
|
7
|
-
export { claude, codex } from "./providers/agents.ts";
|
|
7
|
+
export { claude, codex, gemini } from "./providers/agents.ts";
|
|
8
8
|
export { agentVersions } from "./providers/versions.ts";
|
|
9
9
|
export { conversations } from "./infrastructure/conversations.ts";
|
|
10
10
|
export type { ConversationFormat, ConversationLocation, } from "./infrastructure/conversations.ts";
|
|
11
|
-
export type { ClaudeSettings, CodexSettings } from "./providers/agents.ts";
|
|
11
|
+
export type { ClaudeSettings, CodexSettings, CodexModelProvider, GeminiSettings, } from "./providers/agents.ts";
|
|
12
12
|
export { mountedProvider, remoteProvider } from "./providers/factories.ts";
|
|
13
13
|
export { ResponseError, response } from "./domain/response.ts";
|
|
14
14
|
export type { ResponseSpec, StandardValidator } from "./domain/response.ts";
|
|
@@ -29,3 +29,33 @@ export type { SandboxDiagnosticOptions, SandboxDiagnosticReport, DiagnosticCapab
|
|
|
29
29
|
export type { DiagnosticCheck, DiagnosticStatus, DoctorAgent, } from "./application/doctor.types.ts";
|
|
30
30
|
export { diagnoseAgentProtocol } from "./application/doctor-protocol.ts";
|
|
31
31
|
export type { AgentProtocolReport } from "./application/doctor-protocol.types.ts";
|
|
32
|
+
export { reserveRecoveryStorage } from "./application/storage-reservation.ts";
|
|
33
|
+
export type { RecoveryStorageReservationOptions } from "./application/storage-reservation.types.ts";
|
|
34
|
+
export type { StorageReservation, StorageReservationOptions, } from "./infrastructure/storage-reservations.types.ts";
|
|
35
|
+
export { planRecoveryRestore, restoreRecoveryTransfer, } from "./application/recovery-restore.ts";
|
|
36
|
+
export type { RecoveryRestoreOptions, RecoveryRestorePlan, RecoveryRestoreResult, } from "./application/recovery-restore.types.ts";
|
|
37
|
+
export { fileWorkflowCheckpointStore } from "./infrastructure/workflow-checkpoint.ts";
|
|
38
|
+
export type { FileWorkflowCheckpointOptions } from "./infrastructure/workflow-checkpoint.types.ts";
|
|
39
|
+
export type { WorkflowCheckpoint, WorkflowCheckpointOptions, WorkflowCheckpointStore, WorkflowCheckpointLease, WorkflowCheckpointValue, WorkflowJson, } from "./domain/workflow/checkpoint.types.ts";
|
|
40
|
+
export { approvalTask, pauseTask } from "./domain/workflow/gates.ts";
|
|
41
|
+
export type { WorkflowGate, WorkflowGateOptions, WorkflowPauseRequest, WorkflowDecision, WorkflowDecisionRecord, } from "./domain/workflow/gates.types.ts";
|
|
42
|
+
export { inspectRecovery } from "./application/recovery-inspection.ts";
|
|
43
|
+
export type { RecoveryInspection, RecoveryInspectionOptions, } from "./application/recovery-inspection.types.ts";
|
|
44
|
+
export type { ResourceActivityRecord, ResourceInspection, ResourceInspectionEntry, ResourceOperation, ResourceOperationKind, ResourceOperationResult, ResourcePhase, } from "./infrastructure/resource-activity.types.ts";
|
|
45
|
+
export { artifact, publishArtifact, readStoredArtifact, } from "./domain/artifact.ts";
|
|
46
|
+
export { artifactTask, readArtifact } from "./application/artifact-tasks.ts";
|
|
47
|
+
export { fileArtifactStore } from "./infrastructure/artifact-store.ts";
|
|
48
|
+
export type { ArtifactContract, ArtifactContractOptions, ArtifactIdentity, ArtifactProducer, ArtifactReference, ArtifactStore, JsonArtifactOptions, PublishArtifactOptions, ReadArtifactOptions, } from "./domain/artifact.types.ts";
|
|
49
|
+
export type { ArtifactTaskOptions } from "./application/artifact-tasks.types.ts";
|
|
50
|
+
export type { FileArtifactStoreOptions } from "./infrastructure/artifact-store.types.ts";
|
|
51
|
+
export { sqliteTaskQueue } from "./infrastructure/task-queue.ts";
|
|
52
|
+
export { serveTaskQueue, httpTaskQueue, } from "./infrastructure/task-queue-http.ts";
|
|
53
|
+
export { runQueueWorker } from "./application/queue-worker.ts";
|
|
54
|
+
export { queuedTask } from "./application/queued-task.ts";
|
|
55
|
+
export type { QueueRequest, QueueResult, QueueJob, QueueClaim, QueueLease, TaskQueue, DurableTaskQueue, } from "./domain/task-queue.types.ts";
|
|
56
|
+
export type { QueueServerOptions, QueueServer, QueueClientOptions, } from "./infrastructure/task-queue-http.types.ts";
|
|
57
|
+
export type { QueueHandlerContext, QueueHandler, QueueWorkerOptions, } from "./application/queue-worker.types.ts";
|
|
58
|
+
export type { QueuedTaskOptions } from "./application/queued-task.types.ts";
|
|
59
|
+
export type { EgressPolicy } from "./domain/egress.types.ts";
|
|
60
|
+
export { speculate } from "./application/speculation.ts";
|
|
61
|
+
export type { SpeculationOptions, SpeculationResult, SpeculativeCandidate, SpeculativeCandidateResult, SpeculativeOutput, SpeculativeHostSnapshot, SpeculativeValidation, } from "./application/speculation.types.ts";
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { attach, createSandbox, dispatch, openWorkspace, } from "./application/outpost.js";
|
|
2
2
|
export { WorkflowFailure, WorkflowBudgetExceeded, task, workflow, } from "./domain/workflow.js";
|
|
3
3
|
export { agentTask, commandTask, isolatedTask } from "./application/tasks.js";
|
|
4
|
-
export { claude, codex } from "./providers/agents.js";
|
|
4
|
+
export { claude, codex, gemini } from "./providers/agents.js";
|
|
5
5
|
export { agentVersions } from "./providers/versions.js";
|
|
6
6
|
export { conversations } from "./infrastructure/conversations.js";
|
|
7
7
|
export { mountedProvider, remoteProvider } from "./providers/factories.js";
|
|
@@ -12,4 +12,17 @@ export { planRecoveryRetention, pruneRecoveryRetention, assertRecoveryQuota, } f
|
|
|
12
12
|
export { verifyRecoveryTransfer } from "./application/recovery-verification.js";
|
|
13
13
|
export { diagnoseSandbox } from "./application/doctor-sandbox.js";
|
|
14
14
|
export { diagnoseAgentProtocol } from "./application/doctor-protocol.js";
|
|
15
|
+
export { reserveRecoveryStorage } from "./application/storage-reservation.js";
|
|
16
|
+
export { planRecoveryRestore, restoreRecoveryTransfer, } from "./application/recovery-restore.js";
|
|
17
|
+
export { fileWorkflowCheckpointStore } from "./infrastructure/workflow-checkpoint.js";
|
|
18
|
+
export { approvalTask, pauseTask } from "./domain/workflow/gates.js";
|
|
19
|
+
export { inspectRecovery } from "./application/recovery-inspection.js";
|
|
20
|
+
export { artifact, publishArtifact, readStoredArtifact, } from "./domain/artifact.js";
|
|
21
|
+
export { artifactTask, readArtifact } from "./application/artifact-tasks.js";
|
|
22
|
+
export { fileArtifactStore } from "./infrastructure/artifact-store.js";
|
|
23
|
+
export { sqliteTaskQueue } from "./infrastructure/task-queue.js";
|
|
24
|
+
export { serveTaskQueue, httpTaskQueue, } from "./infrastructure/task-queue-http.js";
|
|
25
|
+
export { runQueueWorker } from "./application/queue-worker.js";
|
|
26
|
+
export { queuedTask } from "./application/queued-task.js";
|
|
27
|
+
export { speculate } from "./application/speculation.js";
|
|
15
28
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,aAAa,EACb,QAAQ,EACR,aAAa,GACd,MAAM,0BAA0B,CAAC;AAoBlC,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,IAAI,EACJ,QAAQ,GACT,MAAM,sBAAsB,CAAC;AAiB9B,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE9E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,aAAa,EACb,QAAQ,EACR,aAAa,GACd,MAAM,0BAA0B,CAAC;AAoBlC,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,IAAI,EACJ,QAAQ,GACT,MAAM,sBAAsB,CAAC;AAiB9B,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE9E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAclE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAI/D,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAoCnE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAMxD,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,qCAAqC,CAAC;AAS7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAMhF,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAWlE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAGzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAO9E,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,mCAAmC,CAAC;AAO3C,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAWtF,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AASrE,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAevE,OAAO,EACL,QAAQ,EACR,eAAe,EACf,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAevE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EACL,cAAc,EACd,aAAa,GACd,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAwB1D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["export {\n attach,\n createSandbox,\n dispatch,\n openWorkspace,\n} from \"./application/outpost.ts\";\n\nexport type {\n AttachOptions,\n AttachResult,\n ContinuationOptions,\n DispatchResult,\n Sandbox,\n SandboxOptions,\n WarmDispatchResult,\n Workspace,\n WorkspaceOptions,\n} from \"./application/outpost.ts\";\n\nexport type {\n DispatchOptions,\n Execution,\n Turn,\n} from \"./application/execution.ts\";\n\nexport {\n WorkflowFailure,\n WorkflowBudgetExceeded,\n task,\n workflow,\n} from \"./domain/workflow.ts\";\n\nexport type {\n Retry,\n Task,\n TaskContext,\n TaskOptions,\n TaskRecord,\n TaskStatus,\n Workflow,\n WorkflowEvent,\n WorkflowOptions,\n WorkflowBudget,\n WorkflowUsage,\n WorkflowResult,\n} from \"./domain/workflow.ts\";\n\nexport { agentTask, commandTask, isolatedTask } from \"./application/tasks.ts\";\n\nexport { claude, codex, gemini } from \"./providers/agents.ts\";\n\nexport { agentVersions } from \"./providers/versions.ts\";\n\nexport { conversations } from \"./infrastructure/conversations.ts\";\n\nexport type {\n ConversationFormat,\n ConversationLocation,\n} from \"./infrastructure/conversations.ts\";\n\nexport type {\n ClaudeSettings,\n CodexSettings,\n CodexModelProvider,\n GeminiSettings,\n} from \"./providers/agents.ts\";\n\nexport { mountedProvider, remoteProvider } from \"./providers/factories.ts\";\n\nexport { ResponseError, response } from \"./domain/response.ts\";\n\nexport type { ResponseSpec, StandardValidator } from \"./domain/response.ts\";\n\nexport { OutpostError, recoveryDetails } from \"./domain/errors.ts\";\n\nexport type { FaultCode } from \"./domain/errors.ts\";\n\nexport type {\n AgentAdapter,\n AgentEvent,\n AgentInput,\n AgentObservation,\n BranchPolicy,\n Channel,\n Command,\n CommandResult,\n Commit,\n ConversationContext,\n ConversationRecord,\n ConversationStore,\n Disposal,\n LifecycleHooks,\n FileManifestEntry,\n FileTransfers,\n SandboxContext,\n SandboxLease,\n SandboxProvider,\n StageLimits,\n TransferOptions,\n Usage,\n Variables,\n Volume,\n WorkspaceRecord,\n} from \"./domain/ports.ts\";\n\nexport type { Brief, PromptVariables } from \"./domain/prompts.ts\";\n\nexport type { Logging } from \"./infrastructure/journal.ts\";\n\nexport { reporter } from \"./infrastructure/reporter.ts\";\n\nexport type { ReporterOptions } from \"./infrastructure/reporter.ts\";\n\nexport type { VariableQuestion } from \"./application/interactive-brief.ts\";\n\nexport {\n planRecoveryRetention,\n pruneRecoveryRetention,\n assertRecoveryQuota,\n} from \"./application/recovery-retention.ts\";\nexport type {\n RecoveryRetentionPolicy,\n RecoveryRetentionOptions,\n RecoveryRetentionPlan,\n RecoveryRetentionEntry,\n RecoveryPruneResult,\n RecoveryQuotaOptions,\n} from \"./application/recovery-retention.types.ts\";\nexport { verifyRecoveryTransfer } from \"./application/recovery-verification.ts\";\nexport type {\n RecoveryVerification,\n RecoveryVerificationOptions,\n} from \"./application/recovery-verification.types.ts\";\n\nexport { diagnoseSandbox } from \"./application/doctor-sandbox.ts\";\nexport type {\n SandboxDiagnosticOptions,\n SandboxDiagnosticReport,\n DiagnosticCapability,\n} from \"./application/doctor-sandbox.types.ts\";\nexport type {\n DiagnosticCheck,\n DiagnosticStatus,\n DoctorAgent,\n} from \"./application/doctor.types.ts\";\nexport { diagnoseAgentProtocol } from \"./application/doctor-protocol.ts\";\nexport type { AgentProtocolReport } from \"./application/doctor-protocol.types.ts\";\n\nexport { reserveRecoveryStorage } from \"./application/storage-reservation.ts\";\nexport type { RecoveryStorageReservationOptions } from \"./application/storage-reservation.types.ts\";\nexport type {\n StorageReservation,\n StorageReservationOptions,\n} from \"./infrastructure/storage-reservations.types.ts\";\n\nexport {\n planRecoveryRestore,\n restoreRecoveryTransfer,\n} from \"./application/recovery-restore.ts\";\nexport type {\n RecoveryRestoreOptions,\n RecoveryRestorePlan,\n RecoveryRestoreResult,\n} from \"./application/recovery-restore.types.ts\";\n\nexport { fileWorkflowCheckpointStore } from \"./infrastructure/workflow-checkpoint.ts\";\nexport type { FileWorkflowCheckpointOptions } from \"./infrastructure/workflow-checkpoint.types.ts\";\nexport type {\n WorkflowCheckpoint,\n WorkflowCheckpointOptions,\n WorkflowCheckpointStore,\n WorkflowCheckpointLease,\n WorkflowCheckpointValue,\n WorkflowJson,\n} from \"./domain/workflow/checkpoint.types.ts\";\n\nexport { approvalTask, pauseTask } from \"./domain/workflow/gates.ts\";\nexport type {\n WorkflowGate,\n WorkflowGateOptions,\n WorkflowPauseRequest,\n WorkflowDecision,\n WorkflowDecisionRecord,\n} from \"./domain/workflow/gates.types.ts\";\n\nexport { inspectRecovery } from \"./application/recovery-inspection.ts\";\nexport type {\n RecoveryInspection,\n RecoveryInspectionOptions,\n} from \"./application/recovery-inspection.types.ts\";\nexport type {\n ResourceActivityRecord,\n ResourceInspection,\n ResourceInspectionEntry,\n ResourceOperation,\n ResourceOperationKind,\n ResourceOperationResult,\n ResourcePhase,\n} from \"./infrastructure/resource-activity.types.ts\";\n\nexport {\n artifact,\n publishArtifact,\n readStoredArtifact,\n} from \"./domain/artifact.ts\";\nexport { artifactTask, readArtifact } from \"./application/artifact-tasks.ts\";\nexport { fileArtifactStore } from \"./infrastructure/artifact-store.ts\";\nexport type {\n ArtifactContract,\n ArtifactContractOptions,\n ArtifactIdentity,\n ArtifactProducer,\n ArtifactReference,\n ArtifactStore,\n JsonArtifactOptions,\n PublishArtifactOptions,\n ReadArtifactOptions,\n} from \"./domain/artifact.types.ts\";\nexport type { ArtifactTaskOptions } from \"./application/artifact-tasks.types.ts\";\nexport type { FileArtifactStoreOptions } from \"./infrastructure/artifact-store.types.ts\";\n\nexport { sqliteTaskQueue } from \"./infrastructure/task-queue.ts\";\nexport {\n serveTaskQueue,\n httpTaskQueue,\n} from \"./infrastructure/task-queue-http.ts\";\nexport { runQueueWorker } from \"./application/queue-worker.ts\";\nexport { queuedTask } from \"./application/queued-task.ts\";\nexport type {\n QueueRequest,\n QueueResult,\n QueueJob,\n QueueClaim,\n QueueLease,\n TaskQueue,\n DurableTaskQueue,\n} from \"./domain/task-queue.types.ts\";\nexport type {\n QueueServerOptions,\n QueueServer,\n QueueClientOptions,\n} from \"./infrastructure/task-queue-http.types.ts\";\nexport type {\n QueueHandlerContext,\n QueueHandler,\n QueueWorkerOptions,\n} from \"./application/queue-worker.types.ts\";\nexport type { QueuedTaskOptions } from \"./application/queued-task.types.ts\";\n\nexport type { EgressPolicy } from \"./domain/egress.types.ts\";\n\nexport { speculate } from \"./application/speculation.ts\";\nexport type {\n SpeculationOptions,\n SpeculationResult,\n SpeculativeCandidate,\n SpeculativeCandidateResult,\n SpeculativeOutput,\n SpeculativeHostSnapshot,\n SpeculativeValidation,\n} from \"./application/speculation.types.ts\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const artifactMaxBytes: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-store.constants.js","sourceRoot":"","sources":["../../src/infrastructure/artifact-store.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC","sourcesContent":["export const artifactMaxBytes = 16 * 1024 * 1024;\n"]}
|