@elie-laloum/outpost 2.0.0 → 4.0.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 +42 -0
- package/README.md +3 -1
- package/SECURITY.md +3 -1
- package/dist/adapters/agents/claude-diagnostics.d.ts +1 -0
- package/dist/adapters/agents/claude-diagnostics.js +7 -0
- package/dist/adapters/agents/claude-diagnostics.js.map +1 -0
- package/dist/adapters/agents/cli-diagnostics.constants.d.ts +12 -0
- package/dist/adapters/agents/cli-diagnostics.constants.js +24 -0
- package/dist/adapters/agents/cli-diagnostics.constants.js.map +1 -0
- package/dist/adapters/agents/cli-diagnostics.d.ts +4 -0
- package/dist/adapters/agents/cli-diagnostics.js +14 -0
- package/dist/adapters/agents/cli-diagnostics.js.map +1 -0
- package/dist/adapters/agents/cli-diagnostics.types.d.ts +13 -0
- package/dist/adapters/agents/cli-diagnostics.types.js +2 -0
- package/dist/adapters/agents/cli-diagnostics.types.js.map +1 -0
- package/dist/adapters/agents/codex-diagnostics.d.ts +1 -0
- package/dist/adapters/agents/codex-diagnostics.js +7 -0
- package/dist/adapters/agents/codex-diagnostics.js.map +1 -0
- 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 +21 -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 +2 -0
- package/dist/adapters/agents/protocol-fixtures.constants.js +105 -0
- package/dist/adapters/agents/protocol-fixtures.constants.js.map +1 -0
- package/dist/adapters/agents/protocol-fixtures.types.d.ts +6 -0
- package/dist/adapters/agents/protocol-fixtures.types.js +2 -0
- package/dist/adapters/agents/protocol-fixtures.types.js.map +1 -0
- 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/diagnostic-probe.d.ts +3 -0
- package/dist/application/diagnostic-probe.js +55 -0
- package/dist/application/diagnostic-probe.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 +11 -0
- package/dist/application/doctor-agent.constants.js +10 -0
- package/dist/application/doctor-agent.constants.js.map +1 -0
- package/dist/application/doctor-agent.d.ts +3 -0
- package/dist/application/doctor-agent.js +53 -0
- package/dist/application/doctor-agent.js.map +1 -0
- package/dist/application/doctor-image.d.ts +3 -0
- package/dist/application/doctor-image.js +133 -0
- package/dist/application/doctor-image.js.map +1 -0
- package/dist/application/doctor-protocol.d.ts +3 -0
- package/dist/application/doctor-protocol.js +30 -0
- package/dist/application/doctor-protocol.js.map +1 -0
- package/dist/application/doctor-protocol.types.d.ts +10 -0
- package/dist/application/doctor-protocol.types.js +2 -0
- package/dist/application/doctor-protocol.types.js.map +1 -0
- package/dist/application/doctor-sandbox.constants.d.ts +5 -0
- package/dist/application/doctor-sandbox.constants.js +6 -0
- package/dist/application/doctor-sandbox.constants.js.map +1 -0
- package/dist/application/doctor-sandbox.d.ts +4 -0
- package/dist/application/doctor-sandbox.js +133 -0
- package/dist/application/doctor-sandbox.js.map +1 -0
- package/dist/application/doctor-sandbox.types.d.ts +23 -0
- package/dist/application/doctor-sandbox.types.js +2 -0
- package/dist/application/doctor-sandbox.types.js.map +1 -0
- package/dist/application/doctor-transfers.constants.d.ts +6 -0
- package/dist/application/doctor-transfers.constants.js +7 -0
- package/dist/application/doctor-transfers.constants.js.map +1 -0
- package/dist/application/doctor-transfers.d.ts +4 -0
- package/dist/application/doctor-transfers.js +88 -0
- package/dist/application/doctor-transfers.js.map +1 -0
- package/dist/application/doctor.constants.d.ts +9 -0
- package/dist/application/doctor.constants.js +15 -0
- package/dist/application/doctor.constants.js.map +1 -0
- package/dist/application/doctor.d.ts +3 -0
- package/dist/application/doctor.js +106 -0
- package/dist/application/doctor.js.map +1 -0
- package/dist/application/doctor.types.d.ts +39 -0
- package/dist/application/doctor.types.js +2 -0
- package/dist/application/doctor.types.js.map +1 -0
- package/dist/application/execution.js +1 -0
- package/dist/application/execution.js.map +1 -1
- package/dist/application/outpost.types.d.ts +4 -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-checksum-capture.d.ts +2 -0
- package/dist/application/recovery-checksum-capture.js +32 -0
- package/dist/application/recovery-checksum-capture.js.map +1 -0
- package/dist/application/recovery-checksum-paths.d.ts +2 -0
- package/dist/application/recovery-checksum-paths.js +11 -0
- package/dist/application/recovery-checksum-paths.js.map +1 -0
- package/dist/application/recovery-checksums.constants.d.ts +5 -0
- package/dist/application/recovery-checksums.constants.js +6 -0
- package/dist/application/recovery-checksums.constants.js.map +1 -0
- package/dist/application/recovery-checksums.d.ts +3 -0
- package/dist/application/recovery-checksums.js +94 -0
- package/dist/application/recovery-checksums.js.map +1 -0
- package/dist/application/recovery-checksums.types.d.ts +17 -0
- package/dist/application/recovery-checksums.types.js +2 -0
- package/dist/application/recovery-checksums.types.js.map +1 -0
- package/dist/application/recovery-inspection.d.ts +2 -0
- package/dist/application/recovery-inspection.js +32 -0
- package/dist/application/recovery-inspection.js.map +1 -0
- package/dist/application/recovery-inspection.types.d.ts +18 -0
- package/dist/application/recovery-inspection.types.js +2 -0
- package/dist/application/recovery-inspection.types.js.map +1 -0
- package/dist/application/recovery-restorability.d.ts +2 -0
- package/dist/application/recovery-restorability.js +137 -0
- package/dist/application/recovery-restorability.js.map +1 -0
- 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-policy.d.ts +2 -0
- package/dist/application/recovery-retention-policy.js +21 -0
- package/dist/application/recovery-retention-policy.js.map +1 -0
- package/dist/application/recovery-retention.constants.d.ts +3 -0
- package/dist/application/recovery-retention.constants.js +2 -0
- package/dist/application/recovery-retention.constants.js.map +1 -0
- package/dist/application/recovery-retention.d.ts +4 -0
- package/dist/application/recovery-retention.js +207 -0
- package/dist/application/recovery-retention.js.map +1 -0
- package/dist/application/recovery-retention.types.d.ts +52 -0
- package/dist/application/recovery-retention.types.js +2 -0
- package/dist/application/recovery-retention.types.js.map +1 -0
- package/dist/application/recovery-verification.constants.d.ts +5 -0
- package/dist/application/recovery-verification.constants.js +10 -0
- package/dist/application/recovery-verification.constants.js.map +1 -0
- package/dist/application/recovery-verification.d.ts +3 -0
- package/dist/application/recovery-verification.js +107 -0
- package/dist/application/recovery-verification.js.map +1 -0
- package/dist/application/recovery-verification.types.d.ts +26 -0
- package/dist/application/recovery-verification.types.js +2 -0
- package/dist/application/recovery-verification.types.js.map +1 -0
- package/dist/application/remote-apply.js +30 -6
- package/dist/application/remote-apply.js.map +1 -1
- package/dist/application/remote-backup.js +6 -2
- package/dist/application/remote-backup.js.map +1 -1
- package/dist/application/remote-download.js +38 -6
- 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 +39 -28
- package/dist/application/remote-validation.js.map +1 -1
- package/dist/application/remote-workspace.constants.d.ts +3 -0
- package/dist/application/remote-workspace.constants.js +2 -0
- package/dist/application/remote-workspace.constants.js.map +1 -0
- package/dist/application/remote-workspace.js +10 -10
- package/dist/application/remote-workspace.js.map +1 -1
- package/dist/application/remote-workspace.types.d.ts +3 -1
- package/dist/application/remote-workspace.types.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 +33 -10
- 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 +4 -0
- package/dist/application/task-usage.js +41 -0
- package/dist/application/task-usage.js.map +1 -0
- package/dist/application/task-usage.types.d.ts +5 -0
- package/dist/application/task-usage.types.js +2 -0
- package/dist/application/task-usage.types.js.map +1 -0
- package/dist/application/tasks.js +23 -2
- 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 +4 -0
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/doctor-command.d.ts +3 -0
- package/dist/cli/doctor-command.js +38 -0
- package/dist/cli/doctor-command.js.map +1 -0
- package/dist/cli/main.constants.d.ts +38 -2
- package/dist/cli/main.constants.js +21 -2
- package/dist/cli/main.constants.js.map +1 -1
- package/dist/cli/recovery-command.d.ts +2 -0
- package/dist/cli/recovery-command.js +93 -0
- package/dist/cli/recovery-command.js.map +1 -0
- package/dist/cli/recovery-prune-command.d.ts +2 -0
- package/dist/cli/recovery-prune-command.js +34 -0
- package/dist/cli/recovery-prune-command.js.map +1 -0
- 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/recovery-verify-command.d.ts +2 -0
- package/dist/cli/recovery-verify-command.js +43 -0
- package/dist/cli/recovery-verify-command.js.map +1 -0
- package/dist/cli/scaffold-files.js +2 -2
- package/dist/cli/scaffold-files.js.map +1 -1
- package/dist/cli/scaffold-validation.js +1 -1
- package/dist/cli/scaffold-validation.js.map +1 -1
- package/dist/cli/scaffold.constants.d.ts +5 -0
- package/dist/cli/scaffold.constants.js +7 -2
- package/dist/cli/scaffold.constants.js.map +1 -1
- package/dist/cli/scaffold.types.d.ts +1 -1
- package/dist/cli/scaffold.types.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/ports.d.ts +1 -1
- package/dist/domain/ports.js.map +1 -1
- package/dist/domain/sandbox.types.d.ts +13 -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.constants.d.ts +1 -0
- package/dist/domain/workflow/budget.constants.js +7 -0
- package/dist/domain/workflow/budget.constants.js.map +1 -0
- package/dist/domain/workflow/budget.d.ts +9 -0
- package/dist/domain/workflow/budget.js +69 -0
- package/dist/domain/workflow/budget.js.map +1 -0
- package/dist/domain/workflow/budget.types.d.ts +15 -0
- package/dist/domain/workflow/budget.types.js +2 -0
- package/dist/domain/workflow/budget.types.js.map +1 -0
- 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 +22 -3
- 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 +68 -33
- 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 +107 -3
- package/dist/domain/workflow/workflow-state.js.map +1 -1
- package/dist/domain/workflow.d.ts +2 -0
- package/dist/domain/workflow.js +1 -0
- package/dist/domain/workflow.js.map +1 -1
- package/dist/domain/workflow.types.d.ts +23 -3
- package/dist/domain/workflow.types.js.map +1 -1
- package/dist/index.d.ts +44 -5
- package/dist/index.js +19 -2
- 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 +6 -0
- package/dist/infrastructure/file-manifest.js +92 -0
- package/dist/infrastructure/file-manifest.js.map +1 -0
- package/dist/infrastructure/git/lock-inspection.constants.d.ts +4 -0
- package/dist/infrastructure/git/lock-inspection.constants.js +5 -0
- package/dist/infrastructure/git/lock-inspection.constants.js.map +1 -0
- package/dist/infrastructure/git/lock-inspection.d.ts +3 -0
- package/dist/infrastructure/git/lock-inspection.js +64 -0
- package/dist/infrastructure/git/lock-inspection.js.map +1 -0
- package/dist/infrastructure/git/lock-inspection.types.d.ts +27 -0
- package/dist/infrastructure/git/lock-inspection.types.js +2 -0
- package/dist/infrastructure/git/lock-inspection.types.js.map +1 -0
- package/dist/infrastructure/git/lock.d.ts +1 -0
- package/dist/infrastructure/git/lock.js +70 -29
- package/dist/infrastructure/git/lock.js.map +1 -1
- package/dist/infrastructure/git/process-identity.d.ts +3 -0
- package/dist/infrastructure/git/process-identity.js +73 -0
- package/dist/infrastructure/git/process-identity.js.map +1 -0
- package/dist/infrastructure/git/process-identity.types.d.ts +10 -0
- package/dist/infrastructure/git/process-identity.types.js +2 -0
- package/dist/infrastructure/git/process-identity.types.js.map +1 -0
- package/dist/infrastructure/git/verification-command.d.ts +1 -0
- package/dist/infrastructure/git/verification-command.js +37 -0
- package/dist/infrastructure/git/verification-command.js.map +1 -0
- package/dist/infrastructure/git/workspace-lease.js +1 -0
- package/dist/infrastructure/git/workspace-lease.js.map +1 -1
- package/dist/infrastructure/git/workspace.js +5 -1
- package/dist/infrastructure/git/workspace.js.map +1 -1
- package/dist/infrastructure/git/worktree-inspection.constants.d.ts +5 -0
- package/dist/infrastructure/git/worktree-inspection.constants.js +16 -0
- package/dist/infrastructure/git/worktree-inspection.constants.js.map +1 -0
- package/dist/infrastructure/git/worktree-inspection.d.ts +3 -0
- package/dist/infrastructure/git/worktree-inspection.js +120 -0
- package/dist/infrastructure/git/worktree-inspection.js.map +1 -0
- package/dist/infrastructure/git/worktree-inspection.types.d.ts +19 -0
- package/dist/infrastructure/git/worktree-inspection.types.js +2 -0
- package/dist/infrastructure/git/worktree-inspection.types.js.map +1 -0
- package/dist/infrastructure/inspection-file.constants.d.ts +1 -0
- package/dist/infrastructure/inspection-file.constants.js +5 -0
- package/dist/infrastructure/inspection-file.constants.js.map +1 -0
- package/dist/infrastructure/inspection-file.d.ts +1 -0
- package/dist/infrastructure/inspection-file.js +43 -0
- package/dist/infrastructure/inspection-file.js.map +1 -0
- package/dist/infrastructure/inspection-hash.constants.d.ts +1 -0
- package/dist/infrastructure/inspection-hash.constants.js +2 -0
- package/dist/infrastructure/inspection-hash.constants.js.map +1 -0
- package/dist/infrastructure/inspection-hash.d.ts +2 -0
- package/dist/infrastructure/inspection-hash.js +62 -0
- package/dist/infrastructure/inspection-hash.js.map +1 -0
- package/dist/infrastructure/inspection-hash.types.d.ts +5 -0
- package/dist/infrastructure/inspection-hash.types.js +2 -0
- package/dist/infrastructure/inspection-hash.types.js.map +1 -0
- package/dist/infrastructure/journal-retention.constants.d.ts +4 -0
- package/dist/infrastructure/journal-retention.constants.js +5 -0
- package/dist/infrastructure/journal-retention.constants.js.map +1 -0
- package/dist/infrastructure/journal-retention.d.ts +2 -0
- package/dist/infrastructure/journal-retention.js +51 -0
- package/dist/infrastructure/journal-retention.js.map +1 -0
- package/dist/infrastructure/journal.js +37 -13
- package/dist/infrastructure/journal.js.map +1 -1
- package/dist/infrastructure/opentelemetry.constants.d.ts +10 -0
- package/dist/infrastructure/opentelemetry.constants.js +11 -0
- package/dist/infrastructure/opentelemetry.constants.js.map +1 -0
- package/dist/infrastructure/opentelemetry.d.ts +3 -0
- package/dist/infrastructure/opentelemetry.js +131 -0
- package/dist/infrastructure/opentelemetry.js.map +1 -0
- package/dist/infrastructure/opentelemetry.types.d.ts +21 -0
- package/dist/infrastructure/opentelemetry.types.js +2 -0
- package/dist/infrastructure/opentelemetry.types.js.map +1 -0
- 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-inventory.constants.d.ts +6 -0
- package/dist/infrastructure/storage-inventory.constants.js +11 -0
- package/dist/infrastructure/storage-inventory.constants.js.map +1 -0
- package/dist/infrastructure/storage-inventory.d.ts +2 -0
- package/dist/infrastructure/storage-inventory.js +123 -0
- package/dist/infrastructure/storage-inventory.js.map +1 -0
- package/dist/infrastructure/storage-inventory.types.d.ts +38 -0
- package/dist/infrastructure/storage-inventory.types.js +2 -0
- package/dist/infrastructure/storage-inventory.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 +17 -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 +2 -0
- package/dist/providers/agents.js +1 -0
- package/dist/providers/agents.js.map +1 -1
- package/dist/providers/cloud.constants.d.ts +1 -0
- package/dist/providers/cloud.constants.js +1 -0
- package/dist/providers/cloud.constants.js.map +1 -1
- package/dist/providers/container-cache.constants.d.ts +11 -0
- package/dist/providers/container-cache.constants.js +9 -0
- package/dist/providers/container-cache.constants.js.map +1 -0
- package/dist/providers/container-cache.d.ts +4 -0
- package/dist/providers/container-cache.js +48 -0
- package/dist/providers/container-cache.js.map +1 -0
- package/dist/providers/container-cache.types.d.ts +8 -0
- package/dist/providers/container-cache.types.js +2 -0
- package/dist/providers/container-cache.types.js.map +1 -0
- 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 +6 -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 +50 -3
- package/dist/providers/container.js.map +1 -1
- package/dist/providers/container.types.d.ts +5 -0
- package/dist/providers/container.types.js.map +1 -1
- package/dist/providers/daytona-command.js +10 -6
- package/dist/providers/daytona-command.js.map +1 -1
- package/dist/providers/daytona-terminal.d.ts +3 -0
- package/dist/providers/daytona-terminal.js +128 -0
- package/dist/providers/daytona-terminal.js.map +1 -0
- package/dist/providers/daytona.js +15 -4
- package/dist/providers/daytona.js.map +1 -1
- package/dist/providers/diagnostic-container.d.ts +4 -0
- package/dist/providers/diagnostic-container.js +15 -0
- package/dist/providers/diagnostic-container.js.map +1 -0
- package/dist/providers/docker.d.ts +2 -0
- package/dist/providers/docker.js.map +1 -1
- package/dist/providers/file-batches.constants.d.ts +10 -0
- package/dist/providers/file-batches.constants.js +57 -0
- package/dist/providers/file-batches.constants.js.map +1 -0
- package/dist/providers/file-batches.d.ts +2 -0
- package/dist/providers/file-batches.js +160 -0
- package/dist/providers/file-batches.js.map +1 -0
- 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 +2 -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-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 +8 -2
- 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 +16 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { artifactLabelMaxLength } from "./artifact.constants.js";
|
|
2
|
+
import { artifactDigest, artifactId, validateArtifactReference, } from "./artifact-reference.js";
|
|
3
|
+
import { checkpointValue } from "./workflow/checkpoint-value.js";
|
|
4
|
+
function identity(options) {
|
|
5
|
+
if (!options.name.trim() ||
|
|
6
|
+
!options.version.trim() ||
|
|
7
|
+
options.name.length > artifactLabelMaxLength ||
|
|
8
|
+
options.version.length > artifactLabelMaxLength)
|
|
9
|
+
throw new Error(`Artifact contract name and version must be nonempty and at most ${artifactLabelMaxLength} characters`);
|
|
10
|
+
return { name: options.name, version: options.version };
|
|
11
|
+
}
|
|
12
|
+
export const artifact = {
|
|
13
|
+
json(options) {
|
|
14
|
+
const schema = options.schema;
|
|
15
|
+
async function validate(value) {
|
|
16
|
+
if (typeof schema === "function")
|
|
17
|
+
return schema(value);
|
|
18
|
+
const result = await schema["~standard"].validate(value);
|
|
19
|
+
if (result.issues)
|
|
20
|
+
throw new Error(`Artifact schema validation failed: ${JSON.stringify(result.issues)}`);
|
|
21
|
+
return result.value;
|
|
22
|
+
}
|
|
23
|
+
return Object.freeze({
|
|
24
|
+
...identity(options),
|
|
25
|
+
encoding: "json",
|
|
26
|
+
async encode(value) {
|
|
27
|
+
const checked = checkpointValue(await validate(value));
|
|
28
|
+
if (checked.kind !== "json")
|
|
29
|
+
throw new Error("Artifact payload must be JSON");
|
|
30
|
+
return Buffer.from(JSON.stringify(checked.value));
|
|
31
|
+
},
|
|
32
|
+
async decode(bytes) {
|
|
33
|
+
return validate(JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes)));
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
binary(options) {
|
|
38
|
+
return Object.freeze({
|
|
39
|
+
...identity(options),
|
|
40
|
+
encoding: "binary",
|
|
41
|
+
async encode(value) {
|
|
42
|
+
if (!(value instanceof Uint8Array))
|
|
43
|
+
throw new Error("Artifact payload must be Uint8Array");
|
|
44
|
+
return Uint8Array.from(value);
|
|
45
|
+
},
|
|
46
|
+
async decode(bytes) {
|
|
47
|
+
return Uint8Array.from(bytes);
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
export async function publishArtifact(store, contract, value, options) {
|
|
53
|
+
options.signal?.throwIfAborted();
|
|
54
|
+
const producer = { ...options.producer };
|
|
55
|
+
const parents = (options.parents ?? []).map((parent) => validateArtifactReference(parent).id);
|
|
56
|
+
const bytes = Uint8Array.from(await contract.encode(value));
|
|
57
|
+
options.signal?.throwIfAborted();
|
|
58
|
+
const metadata = {
|
|
59
|
+
format: 1,
|
|
60
|
+
digest: artifactDigest(bytes),
|
|
61
|
+
size: bytes.length,
|
|
62
|
+
contract: {
|
|
63
|
+
name: contract.name,
|
|
64
|
+
version: contract.version,
|
|
65
|
+
encoding: contract.encoding,
|
|
66
|
+
},
|
|
67
|
+
producer,
|
|
68
|
+
parents,
|
|
69
|
+
};
|
|
70
|
+
const reference = validateArtifactReference({
|
|
71
|
+
...metadata,
|
|
72
|
+
id: artifactId(metadata),
|
|
73
|
+
});
|
|
74
|
+
await store.put(reference.id, bytes, options.signal);
|
|
75
|
+
options.signal?.throwIfAborted();
|
|
76
|
+
return reference;
|
|
77
|
+
}
|
|
78
|
+
export async function readStoredArtifact(store, contract, value, options = {}) {
|
|
79
|
+
options.signal?.throwIfAborted();
|
|
80
|
+
const reference = validateArtifactReference(value);
|
|
81
|
+
if (reference.contract.name !== contract.name ||
|
|
82
|
+
reference.contract.version !== contract.version ||
|
|
83
|
+
reference.contract.encoding !== contract.encoding)
|
|
84
|
+
throw new Error("Artifact contract mismatch");
|
|
85
|
+
const producer = options.producer;
|
|
86
|
+
if (producer &&
|
|
87
|
+
(reference.producer.executionId !== producer.executionId ||
|
|
88
|
+
reference.producer.taskKey !== producer.taskKey ||
|
|
89
|
+
reference.producer.attempt !== producer.attempt))
|
|
90
|
+
throw new Error("Artifact producer mismatch");
|
|
91
|
+
if (options.parents &&
|
|
92
|
+
JSON.stringify(reference.parents) !==
|
|
93
|
+
JSON.stringify(options.parents.map((parent) => validateArtifactReference(parent).id)))
|
|
94
|
+
throw new Error("Artifact lineage mismatch");
|
|
95
|
+
const bytes = await store.get(reference.id, options.signal);
|
|
96
|
+
options.signal?.throwIfAborted();
|
|
97
|
+
if (bytes.length !== reference.size ||
|
|
98
|
+
artifactDigest(bytes) !== reference.digest)
|
|
99
|
+
throw new Error("Artifact content integrity mismatch");
|
|
100
|
+
const result = await contract.decode(bytes);
|
|
101
|
+
options.signal?.throwIfAborted();
|
|
102
|
+
return result;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=artifact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact.js","sourceRoot":"","sources":["../../src/domain/artifact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EACL,cAAc,EACd,UAAU,EACV,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAWjE,SAAS,QAAQ,CAAC,OAAgC;IAChD,IACE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE;QACpB,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE;QACvB,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,sBAAsB;QAC5C,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,sBAAsB;QAE/C,MAAM,IAAI,KAAK,CACb,mEAAmE,sBAAsB,aAAa,CACvG,CAAC;IACJ,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;AAC1D,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,CAAI,OAA+B;QACrC,MAAM,MAAM,GAAG,OAAO,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,2BAA2B,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5D,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;IACjC,IACE,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,IAAI;QAC/B,cAAc,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,MAAM;QAE1C,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5C,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;IACjC,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { artifactLabelMaxLength } from \"./artifact.constants.ts\";\nimport {\n artifactDigest,\n artifactId,\n validateArtifactReference,\n} from \"./artifact-reference.ts\";\nimport { checkpointValue } from \"./workflow/checkpoint-value.ts\";\nimport type {\n ArtifactContract,\n ArtifactContractOptions,\n ArtifactReference,\n ArtifactStore,\n JsonArtifactOptions,\n PublishArtifactOptions,\n ReadArtifactOptions,\n} from \"./artifact.types.ts\";\n\nfunction identity(options: ArtifactContractOptions): ArtifactContractOptions {\n if (\n !options.name.trim() ||\n !options.version.trim() ||\n options.name.length > artifactLabelMaxLength ||\n options.version.length > artifactLabelMaxLength\n )\n throw new Error(\n `Artifact contract name and version must be nonempty and at most ${artifactLabelMaxLength} characters`,\n );\n return { name: options.name, version: options.version };\n}\n\nexport const artifact = {\n json<T>(options: JsonArtifactOptions<T>): ArtifactContract<T> {\n const schema = options.schema;\n async function validate(value: unknown): Promise<T> {\n if (typeof schema === \"function\") return schema(value);\n const result = await schema[\"~standard\"].validate(value);\n if (result.issues)\n throw new Error(\n `Artifact schema validation failed: ${JSON.stringify(result.issues)}`,\n );\n return result.value;\n }\n return Object.freeze({\n ...identity(options),\n encoding: \"json\",\n async encode(value: T) {\n const checked = checkpointValue(await validate(value));\n if (checked.kind !== \"json\")\n throw new Error(\"Artifact payload must be JSON\");\n return Buffer.from(JSON.stringify(checked.value));\n },\n async decode(bytes: Uint8Array) {\n return validate(\n JSON.parse(\n new TextDecoder(\"utf-8\", { fatal: true }).decode(bytes),\n ) as unknown,\n );\n },\n });\n },\n binary(options: ArtifactContractOptions): ArtifactContract<Uint8Array> {\n return Object.freeze({\n ...identity(options),\n encoding: \"binary\",\n async encode(value: Uint8Array) {\n if (!(value instanceof Uint8Array))\n throw new Error(\"Artifact payload must be Uint8Array\");\n return Uint8Array.from(value);\n },\n async decode(bytes: Uint8Array) {\n return Uint8Array.from(bytes);\n },\n });\n },\n};\n\nexport async function publishArtifact<T>(\n store: ArtifactStore,\n contract: ArtifactContract<T>,\n value: T,\n options: PublishArtifactOptions,\n): Promise<ArtifactReference> {\n options.signal?.throwIfAborted();\n const producer = { ...options.producer };\n const parents = (options.parents ?? []).map(\n (parent) => validateArtifactReference(parent).id,\n );\n const bytes = Uint8Array.from(await contract.encode(value));\n options.signal?.throwIfAborted();\n const metadata = {\n format: 1 as const,\n digest: artifactDigest(bytes),\n size: bytes.length,\n contract: {\n name: contract.name,\n version: contract.version,\n encoding: contract.encoding,\n },\n producer,\n parents,\n };\n const reference = validateArtifactReference({\n ...metadata,\n id: artifactId(metadata),\n });\n await store.put(reference.id, bytes, options.signal);\n options.signal?.throwIfAborted();\n return reference;\n}\n\nexport async function readStoredArtifact<T>(\n store: ArtifactStore,\n contract: ArtifactContract<T>,\n value: unknown,\n options: ReadArtifactOptions = {},\n): Promise<T> {\n options.signal?.throwIfAborted();\n const reference = validateArtifactReference(value);\n if (\n reference.contract.name !== contract.name ||\n reference.contract.version !== contract.version ||\n reference.contract.encoding !== contract.encoding\n )\n throw new Error(\"Artifact contract mismatch\");\n const producer = options.producer;\n if (\n producer &&\n (reference.producer.executionId !== producer.executionId ||\n reference.producer.taskKey !== producer.taskKey ||\n reference.producer.attempt !== producer.attempt)\n )\n throw new Error(\"Artifact producer mismatch\");\n if (\n options.parents &&\n JSON.stringify(reference.parents) !==\n JSON.stringify(\n options.parents.map((parent) => validateArtifactReference(parent).id),\n )\n )\n throw new Error(\"Artifact lineage mismatch\");\n const bytes = await store.get(reference.id, options.signal);\n options.signal?.throwIfAborted();\n if (\n bytes.length !== reference.size ||\n artifactDigest(bytes) !== reference.digest\n )\n throw new Error(\"Artifact content integrity mismatch\");\n const result = await contract.decode(bytes);\n options.signal?.throwIfAborted();\n return result;\n}\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { StandardValidator } from "./response.types.ts";
|
|
2
|
+
export interface ArtifactIdentity {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly version: string;
|
|
5
|
+
readonly encoding: "json" | "binary";
|
|
6
|
+
}
|
|
7
|
+
export interface ArtifactProducer {
|
|
8
|
+
readonly executionId: string;
|
|
9
|
+
readonly taskKey: string;
|
|
10
|
+
readonly attempt: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ArtifactReference {
|
|
13
|
+
readonly format: 1;
|
|
14
|
+
readonly id: string;
|
|
15
|
+
readonly digest: string;
|
|
16
|
+
readonly size: number;
|
|
17
|
+
readonly contract: ArtifactIdentity;
|
|
18
|
+
readonly producer: ArtifactProducer;
|
|
19
|
+
readonly parents: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
export interface ArtifactContract<T> extends ArtifactIdentity {
|
|
22
|
+
encode(value: T): Promise<Uint8Array>;
|
|
23
|
+
decode(bytes: Uint8Array): Promise<T>;
|
|
24
|
+
}
|
|
25
|
+
export type ArtifactContractOptions = Pick<ArtifactIdentity, "name" | "version">;
|
|
26
|
+
export type JsonArtifactOptions<T> = ArtifactContractOptions & {
|
|
27
|
+
readonly schema: StandardValidator<T> | ((input: unknown) => T | Promise<T>);
|
|
28
|
+
};
|
|
29
|
+
export interface ArtifactStore {
|
|
30
|
+
/** Publish atomically; reject conflicting bytes for an existing ID. */
|
|
31
|
+
put(id: string, bytes: Uint8Array, signal?: AbortSignal): Promise<void>;
|
|
32
|
+
/** Read bounded bytes or reject missing objects; callers verify integrity. */
|
|
33
|
+
get(id: string, signal?: AbortSignal): Promise<Uint8Array>;
|
|
34
|
+
}
|
|
35
|
+
export interface PublishArtifactOptions {
|
|
36
|
+
readonly producer: ArtifactProducer;
|
|
37
|
+
readonly parents?: readonly ArtifactReference[];
|
|
38
|
+
readonly signal?: AbortSignal;
|
|
39
|
+
}
|
|
40
|
+
export interface ReadArtifactOptions {
|
|
41
|
+
readonly producer?: ArtifactProducer;
|
|
42
|
+
readonly parents?: readonly ArtifactReference[];
|
|
43
|
+
readonly signal?: AbortSignal;
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact.types.js","sourceRoot":"","sources":["../../src/domain/artifact.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { StandardValidator } from \"./response.types.ts\";\n\nexport interface ArtifactIdentity {\n readonly name: string;\n readonly version: string;\n readonly encoding: \"json\" | \"binary\";\n}\n\nexport interface ArtifactProducer {\n readonly executionId: string;\n readonly taskKey: string;\n readonly attempt: number;\n}\n\nexport interface ArtifactReference {\n readonly format: 1;\n readonly id: string;\n readonly digest: string;\n readonly size: number;\n readonly contract: ArtifactIdentity;\n readonly producer: ArtifactProducer;\n readonly parents: readonly string[];\n}\n\nexport interface ArtifactContract<T> extends ArtifactIdentity {\n encode(value: T): Promise<Uint8Array>;\n decode(bytes: Uint8Array): Promise<T>;\n}\n\nexport type ArtifactContractOptions = Pick<\n ArtifactIdentity,\n \"name\" | \"version\"\n>;\nexport type JsonArtifactOptions<T> = ArtifactContractOptions & {\n readonly schema: StandardValidator<T> | ((input: unknown) => T | Promise<T>);\n};\n\nexport interface ArtifactStore {\n /** Publish atomically; reject conflicting bytes for an existing ID. */\n put(id: string, bytes: Uint8Array, signal?: AbortSignal): Promise<void>;\n /** Read bounded bytes or reject missing objects; callers verify integrity. */\n get(id: string, signal?: AbortSignal): Promise<Uint8Array>;\n}\n\nexport interface PublishArtifactOptions {\n readonly producer: ArtifactProducer;\n readonly parents?: readonly ArtifactReference[];\n readonly signal?: AbortSignal;\n}\n\nexport interface ReadArtifactOptions {\n readonly producer?: ArtifactProducer;\n readonly parents?: readonly ArtifactReference[];\n readonly signal?: AbortSignal;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const egressFields: readonly string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"egress.constants.js","sourceRoot":"","sources":["../../src/domain/egress.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAsB;IAC7C,MAAM;IACN,SAAS;IACT,YAAY;IACZ,WAAW;CACZ,CAAC","sourcesContent":["export const egressFields: readonly string[] = [\n \"mode\",\n \"domains\",\n \"allowCidrs\",\n \"denyCidrs\",\n];\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { isIP } from "node:net";
|
|
2
|
+
import { egressFields } from "./egress.constants.js";
|
|
3
|
+
import { invariant } from "./errors.js";
|
|
4
|
+
function entries(value, label, validate) {
|
|
5
|
+
if (value === undefined)
|
|
6
|
+
return [];
|
|
7
|
+
invariant(Array.isArray(value), `${label} must be an array`);
|
|
8
|
+
const items = Array.from(value);
|
|
9
|
+
invariant(items.every((entry) => typeof entry === "string" && validate(entry)), `Invalid ${label} entry`);
|
|
10
|
+
return [...new Set(items)];
|
|
11
|
+
}
|
|
12
|
+
function domain(value) {
|
|
13
|
+
const name = value.startsWith("*.") ? value.slice(2) : value;
|
|
14
|
+
return (name.length <= 253 &&
|
|
15
|
+
!isIP(name) &&
|
|
16
|
+
name.includes(".") &&
|
|
17
|
+
name
|
|
18
|
+
.split(".")
|
|
19
|
+
.every((label) => /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i.test(label)));
|
|
20
|
+
}
|
|
21
|
+
function cidr(value) {
|
|
22
|
+
const parts = value.split("/");
|
|
23
|
+
if (parts.length !== 2)
|
|
24
|
+
return false;
|
|
25
|
+
const version = isIP(parts[0]);
|
|
26
|
+
return (version !== 0 &&
|
|
27
|
+
/^(0|[1-9][0-9]*)$/.test(parts[1]) &&
|
|
28
|
+
Number(parts[1]) <= (version === 4 ? 32 : 128) &&
|
|
29
|
+
!parts[0].includes("%"));
|
|
30
|
+
}
|
|
31
|
+
export function validateEgress(value) {
|
|
32
|
+
if (value === undefined)
|
|
33
|
+
return undefined;
|
|
34
|
+
invariant(value !== null && typeof value === "object" && !Array.isArray(value), "egress must be a policy object");
|
|
35
|
+
invariant("mode" in value, "egress requires a mode");
|
|
36
|
+
if (value.mode === "deny-all") {
|
|
37
|
+
invariant(Object.keys(value).every((key) => key === "mode"), "deny-all does not accept allowlist fields");
|
|
38
|
+
return { mode: "deny-all" };
|
|
39
|
+
}
|
|
40
|
+
invariant(value.mode === "allowlist", "egress mode must be deny-all or allowlist");
|
|
41
|
+
invariant(Object.keys(value).every((key) => egressFields.includes(key)), "Unknown egress policy field");
|
|
42
|
+
const domains = entries("domains" in value ? value.domains : undefined, "egress domains", domain);
|
|
43
|
+
const allowCidrs = entries("allowCidrs" in value ? value.allowCidrs : undefined, "egress allowCidrs", cidr);
|
|
44
|
+
const denyCidrs = entries("denyCidrs" in value ? value.denyCidrs : undefined, "egress denyCidrs", cidr);
|
|
45
|
+
invariant(domains.length + allowCidrs.length > 0, "egress allowlist requires an allowed domain or CIDR; use deny-all to block everything");
|
|
46
|
+
return { mode: "allowlist", domains, allowCidrs, denyCidrs };
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=egress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"egress.js","sourceRoot":"","sources":["../../src/domain/egress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE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,CAAC,CAAC,SAAS,EAC9C,gBAAgB,EAChB,MAAM,CACP,CAAC;IACF,MAAM,UAAU,GAAG,OAAO,CACxB,YAAY,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EACpD,mBAAmB,EACnB,IAAI,CACL,CAAC;IACF,MAAM,SAAS,GAAG,OAAO,CACvB,WAAW,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAClD,kBAAkB,EAClB,IAAI,CACL,CAAC;IACF,SAAS,CACP,OAAO,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EACtC,uFAAuF,CACxF,CAAC;IACF,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AAC/D,CAAC","sourcesContent":["import { isIP } from \"node:net\";\nimport { egressFields } from \"./egress.constants.ts\";\nimport { invariant } from \"./errors.ts\";\nimport type { EgressPolicy } from \"./egress.types.ts\";\n\nfunction entries(\n value: unknown,\n label: string,\n validate: (entry: string) => boolean,\n): string[] {\n if (value === undefined) return [];\n invariant(Array.isArray(value), `${label} must be an array`);\n const items = Array.from(value);\n invariant(\n items.every((entry) => typeof entry === \"string\" && validate(entry)),\n `Invalid ${label} entry`,\n );\n return [...new Set<string>(items)];\n}\n\nfunction domain(value: string): boolean {\n const name = value.startsWith(\"*.\") ? value.slice(2) : value;\n return (\n name.length <= 253 &&\n !isIP(name) &&\n name.includes(\".\") &&\n name\n .split(\".\")\n .every((label) => /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i.test(label))\n );\n}\n\nfunction cidr(value: string): boolean {\n const parts = value.split(\"/\");\n if (parts.length !== 2) return false;\n const version = isIP(parts[0]!);\n return (\n version !== 0 &&\n /^(0|[1-9][0-9]*)$/.test(parts[1]!) &&\n Number(parts[1]) <= (version === 4 ? 32 : 128) &&\n !parts[0]!.includes(\"%\")\n );\n}\n\nexport function validateEgress(value: unknown): EgressPolicy | undefined {\n if (value === undefined) return undefined;\n invariant(\n value !== null && typeof value === \"object\" && !Array.isArray(value),\n \"egress must be a policy object\",\n );\n invariant(\"mode\" in value, \"egress requires a mode\");\n if (value.mode === \"deny-all\") {\n invariant(\n Object.keys(value).every((key) => key === \"mode\"),\n \"deny-all does not accept allowlist fields\",\n );\n return { mode: \"deny-all\" };\n }\n invariant(\n value.mode === \"allowlist\",\n \"egress mode must be deny-all or allowlist\",\n );\n invariant(\n Object.keys(value).every((key) => egressFields.includes(key)),\n \"Unknown egress policy field\",\n );\n const domains = entries(\n \"domains\" in value ? value.domains : undefined,\n \"egress domains\",\n domain,\n );\n const allowCidrs = entries(\n \"allowCidrs\" in value ? value.allowCidrs : undefined,\n \"egress allowCidrs\",\n cidr,\n );\n const denyCidrs = entries(\n \"denyCidrs\" in value ? value.denyCidrs : undefined,\n \"egress denyCidrs\",\n cidr,\n );\n invariant(\n domains.length + allowCidrs.length > 0,\n \"egress allowlist requires an allowed domain or CIDR; use deny-all to block everything\",\n );\n return { mode: \"allowlist\", domains, allowCidrs, denyCidrs };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"egress.types.js","sourceRoot":"","sources":["../../src/domain/egress.types.ts"],"names":[],"mappings":"","sourcesContent":["export type EgressPolicy =\n | { readonly mode: \"deny-all\" }\n | {\n readonly mode: \"allowlist\";\n readonly domains?: readonly string[];\n readonly allowCidrs?: readonly string[];\n readonly denyCidrs?: readonly string[];\n };\n"]}
|
package/dist/domain/ports.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { AgentAdapter, AgentEvent, AgentInput, AgentObservation, Usage, } from "./agent.types.ts";
|
|
2
2
|
export type { Channel, Command, CommandResult, Variables, } from "./command.types.ts";
|
|
3
3
|
export type { ConversationContext, ConversationRecord, ConversationStore, } from "./conversation.types.ts";
|
|
4
|
-
export type { SandboxContext, SandboxLease, SandboxProvider, TransferOptions, Volume, } from "./sandbox.types.ts";
|
|
4
|
+
export type { FileManifestEntry, FileTransfers, SandboxContext, SandboxLease, SandboxProvider, TransferOptions, Volume, } from "./sandbox.types.ts";
|
|
5
5
|
export type { BranchPolicy, Commit, Disposal, LifecycleHooks, StageLimits, WorkspaceRecord, } from "./workspace.types.ts";
|
package/dist/domain/ports.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ports.js","sourceRoot":"","sources":["../../src/domain/ports.ts"],"names":[],"mappings":"","sourcesContent":["export type {\n AgentAdapter,\n AgentEvent,\n AgentInput,\n AgentObservation,\n Usage,\n} from \"./agent.types.ts\";\nexport type {\n Channel,\n Command,\n CommandResult,\n Variables,\n} from \"./command.types.ts\";\nexport type {\n ConversationContext,\n ConversationRecord,\n ConversationStore,\n} from \"./conversation.types.ts\";\nexport type {\n SandboxContext,\n SandboxLease,\n SandboxProvider,\n TransferOptions,\n Volume,\n} from \"./sandbox.types.ts\";\nexport type {\n BranchPolicy,\n Commit,\n Disposal,\n LifecycleHooks,\n StageLimits,\n WorkspaceRecord,\n} from \"./workspace.types.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"ports.js","sourceRoot":"","sources":["../../src/domain/ports.ts"],"names":[],"mappings":"","sourcesContent":["export type {\n AgentAdapter,\n AgentEvent,\n AgentInput,\n AgentObservation,\n Usage,\n} from \"./agent.types.ts\";\nexport type {\n Channel,\n Command,\n CommandResult,\n Variables,\n} from \"./command.types.ts\";\nexport type {\n ConversationContext,\n ConversationRecord,\n ConversationStore,\n} from \"./conversation.types.ts\";\nexport type {\n FileManifestEntry,\n FileTransfers,\n SandboxContext,\n SandboxLease,\n SandboxProvider,\n TransferOptions,\n Volume,\n} from \"./sandbox.types.ts\";\nexport type {\n BranchPolicy,\n Commit,\n Disposal,\n LifecycleHooks,\n StageLimits,\n WorkspaceRecord,\n} from \"./workspace.types.ts\";\n"]}
|
|
@@ -15,7 +15,20 @@ export interface TransferOptions {
|
|
|
15
15
|
readonly signal?: AbortSignal;
|
|
16
16
|
readonly deadlineMs?: number;
|
|
17
17
|
}
|
|
18
|
+
export interface FileManifestEntry {
|
|
19
|
+
readonly path: string;
|
|
20
|
+
readonly kind: "file" | "link";
|
|
21
|
+
readonly mode: number;
|
|
22
|
+
readonly size: number;
|
|
23
|
+
readonly sha256: string;
|
|
24
|
+
}
|
|
25
|
+
export interface FileTransfers {
|
|
26
|
+
uploadBatch?(source: string, entries: readonly FileManifestEntry[], destination: string, options?: TransferOptions): Promise<void>;
|
|
27
|
+
manifest(source: string, paths: readonly string[], options?: TransferOptions): Promise<readonly FileManifestEntry[]>;
|
|
28
|
+
downloadBatch(source: string, entries: readonly FileManifestEntry[], destination: string, options?: TransferOptions): Promise<void>;
|
|
29
|
+
}
|
|
18
30
|
export interface SandboxLease {
|
|
31
|
+
readonly fileTransfers?: FileTransfers;
|
|
19
32
|
readonly root: string;
|
|
20
33
|
readonly home: string;
|
|
21
34
|
invoke(command: Command): Promise<CommandResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.types.js","sourceRoot":"","sources":["../../src/domain/sandbox.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Command, CommandResult, Variables } from \"./command.types.ts\";\n\nexport interface Volume {\n readonly source: string;\n readonly target: string;\n readonly readOnly?: boolean;\n}\n\nexport interface SandboxContext {\n readonly repository: string;\n readonly directory: string;\n readonly gitDirectories: readonly string[];\n readonly variables: Variables;\n readonly signal?: AbortSignal;\n}\n\nexport interface TransferOptions {\n readonly signal?: AbortSignal;\n readonly deadlineMs?: number;\n}\n\nexport interface SandboxLease {\n readonly root: string;\n readonly home: string;\n invoke(command: Command): Promise<CommandResult>;\n upload(\n source: string,\n destination: string,\n options?: TransferOptions,\n ): Promise<void>;\n download(\n source: string,\n destination: string,\n options?: TransferOptions,\n ): Promise<void>;\n release(): Promise<void>;\n}\n\nexport interface SandboxProvider {\n readonly name: string;\n readonly placement: \"mounted\" | \"remote\" | \"host\";\n readonly variables?: Variables;\n acquire(context: SandboxContext): Promise<SandboxLease>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sandbox.types.js","sourceRoot":"","sources":["../../src/domain/sandbox.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Command, CommandResult, Variables } from \"./command.types.ts\";\n\nexport interface Volume {\n readonly source: string;\n readonly target: string;\n readonly readOnly?: boolean;\n}\n\nexport interface SandboxContext {\n readonly repository: string;\n readonly directory: string;\n readonly gitDirectories: readonly string[];\n readonly variables: Variables;\n readonly signal?: AbortSignal;\n}\n\nexport interface TransferOptions {\n readonly signal?: AbortSignal;\n readonly deadlineMs?: number;\n}\n\nexport interface FileManifestEntry {\n readonly path: string;\n readonly kind: \"file\" | \"link\";\n readonly mode: number;\n readonly size: number;\n readonly sha256: string;\n}\n\nexport interface FileTransfers {\n uploadBatch?(\n source: string,\n entries: readonly FileManifestEntry[],\n destination: string,\n options?: TransferOptions,\n ): Promise<void>;\n manifest(\n source: string,\n paths: readonly string[],\n options?: TransferOptions,\n ): Promise<readonly FileManifestEntry[]>;\n downloadBatch(\n source: string,\n entries: readonly FileManifestEntry[],\n destination: string,\n options?: TransferOptions,\n ): Promise<void>;\n}\n\nexport interface SandboxLease {\n readonly fileTransfers?: FileTransfers;\n readonly root: string;\n readonly home: string;\n invoke(command: Command): Promise<CommandResult>;\n upload(\n source: string,\n destination: string,\n options?: TransferOptions,\n ): Promise<void>;\n download(\n source: string,\n destination: string,\n options?: TransferOptions,\n ): Promise<void>;\n release(): Promise<void>;\n}\n\nexport interface SandboxProvider {\n readonly name: string;\n readonly placement: \"mounted\" | \"remote\" | \"host\";\n readonly variables?: Variables;\n acquire(context: SandboxContext): Promise<SandboxLease>;\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const queueMaxBytes = 1048576;
|
|
2
|
+
export declare const queueMaxValueBytes = 262144;
|
|
3
|
+
export declare const queueDefaultLeaseMs = 30000;
|
|
4
|
+
export declare const queueDefaultPollMs = 250;
|
|
5
|
+
export declare const queueMaxLeaseMs = 300000;
|
|
6
|
+
export declare const queueMaxStringLength = 512;
|
|
7
|
+
export declare const queueMinLeaseMs = 30;
|
|
8
|
+
export declare const queueMaxHandlers = 100;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const queueMaxBytes = 1_048_576;
|
|
2
|
+
export const queueMaxValueBytes = 262_144;
|
|
3
|
+
export const queueDefaultLeaseMs = 30_000;
|
|
4
|
+
export const queueDefaultPollMs = 250;
|
|
5
|
+
export const queueMaxLeaseMs = 300_000;
|
|
6
|
+
export const queueMaxStringLength = 512;
|
|
7
|
+
export const queueMinLeaseMs = 30;
|
|
8
|
+
export const queueMaxHandlers = 100;
|
|
9
|
+
//# sourceMappingURL=task-queue.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-queue.constants.js","sourceRoot":"","sources":["../../src/domain/task-queue.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;AACvC,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAC1C,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAC1C,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AACtC,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC;AACvC,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACxC,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC","sourcesContent":["export const queueMaxBytes = 1_048_576;\nexport const queueMaxValueBytes = 262_144;\nexport const queueDefaultLeaseMs = 30_000;\nexport const queueDefaultPollMs = 250;\nexport const queueMaxLeaseMs = 300_000;\nexport const queueMaxStringLength = 512;\nexport const queueMinLeaseMs = 30;\nexport const queueMaxHandlers = 100;\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { QueueClaim, QueueJob, QueueLease, QueueRequest, QueueResult } from "./task-queue.types.ts";
|
|
2
|
+
export declare function queueObject(value: unknown): Record<string, unknown>;
|
|
3
|
+
export declare function queueString(value: unknown): string;
|
|
4
|
+
export declare function queueNumber(value: unknown): number;
|
|
5
|
+
export declare function queueLeaseMs(value: unknown): number;
|
|
6
|
+
export declare function queueJson(value: unknown): import("./workflow/checkpoint.types.ts").WorkflowJson;
|
|
7
|
+
export declare function queueRequest(value: unknown): QueueRequest;
|
|
8
|
+
export declare function queueClaim(value: unknown): QueueClaim;
|
|
9
|
+
export declare function queueLease(value: unknown): QueueLease;
|
|
10
|
+
export declare function queueResult(value: unknown): QueueResult;
|
|
11
|
+
export declare function queueJob(value: unknown): QueueJob;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { queueMaxValueBytes, queueMaxLeaseMs, queueMaxStringLength, queueMinLeaseMs, queueMaxHandlers, } from "./task-queue.constants.js";
|
|
2
|
+
import { checkpointValue } from "./workflow/checkpoint-value.js";
|
|
3
|
+
export function queueObject(value) {
|
|
4
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
5
|
+
throw new Error("Invalid queue object");
|
|
6
|
+
return Object.fromEntries(Object.entries(value));
|
|
7
|
+
}
|
|
8
|
+
export function queueString(value) {
|
|
9
|
+
if (typeof value !== "string" ||
|
|
10
|
+
!value.length ||
|
|
11
|
+
value.length > queueMaxStringLength)
|
|
12
|
+
throw new Error("Invalid queue identifier");
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
export function queueNumber(value) {
|
|
16
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0)
|
|
17
|
+
throw new Error("Invalid queue number");
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
export function queueLeaseMs(value) {
|
|
21
|
+
const ms = queueNumber(value);
|
|
22
|
+
if (ms < queueMinLeaseMs || ms > queueMaxLeaseMs)
|
|
23
|
+
throw new Error("Queue lease must be between 30 and 300000 milliseconds");
|
|
24
|
+
return ms;
|
|
25
|
+
}
|
|
26
|
+
export function queueJson(value) {
|
|
27
|
+
const checked = checkpointValue(value);
|
|
28
|
+
if (checked.kind !== "json")
|
|
29
|
+
throw new Error("Queue values must be JSON");
|
|
30
|
+
if (Buffer.byteLength(JSON.stringify(checked.value)) > queueMaxValueBytes)
|
|
31
|
+
throw new Error("Queue value exceeds size limit");
|
|
32
|
+
return checked.value;
|
|
33
|
+
}
|
|
34
|
+
export function queueRequest(value) {
|
|
35
|
+
const data = queueObject(value);
|
|
36
|
+
return {
|
|
37
|
+
id: queueString(data.id),
|
|
38
|
+
handler: queueString(data.handler),
|
|
39
|
+
input: queueJson(data.input),
|
|
40
|
+
...(data.deadline === undefined
|
|
41
|
+
? {}
|
|
42
|
+
: { deadline: queueNumber(data.deadline) }),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export function queueClaim(value) {
|
|
46
|
+
const data = queueObject(value);
|
|
47
|
+
if (!Array.isArray(data.handlers) ||
|
|
48
|
+
!data.handlers.length ||
|
|
49
|
+
data.handlers.length > queueMaxHandlers)
|
|
50
|
+
throw new Error("Invalid queue handlers");
|
|
51
|
+
return {
|
|
52
|
+
worker: queueString(data.worker),
|
|
53
|
+
handlers: data.handlers.map(queueString),
|
|
54
|
+
leaseMs: queueLeaseMs(data.leaseMs),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export function queueLease(value) {
|
|
58
|
+
const data = queueObject(value);
|
|
59
|
+
return {
|
|
60
|
+
id: queueString(data.id),
|
|
61
|
+
worker: queueString(data.worker),
|
|
62
|
+
fence: queueNumber(data.fence),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export function queueResult(value) {
|
|
66
|
+
const data = queueObject(value);
|
|
67
|
+
const usage = data.usage === undefined ? undefined : queueObject(data.usage);
|
|
68
|
+
return {
|
|
69
|
+
value: queueJson(data.value),
|
|
70
|
+
...(data.error === undefined ? {} : { error: queueString(data.error) }),
|
|
71
|
+
...(usage === undefined
|
|
72
|
+
? {}
|
|
73
|
+
: {
|
|
74
|
+
usage: {
|
|
75
|
+
input: queueNumber(usage.input),
|
|
76
|
+
output: queueNumber(usage.output),
|
|
77
|
+
cached: queueNumber(usage.cached),
|
|
78
|
+
...(usage.cacheCreated === undefined
|
|
79
|
+
? {}
|
|
80
|
+
: { cacheCreated: queueNumber(usage.cacheCreated) }),
|
|
81
|
+
},
|
|
82
|
+
}),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
export function queueJob(value) {
|
|
86
|
+
const data = queueObject(value);
|
|
87
|
+
const status = data.status;
|
|
88
|
+
if (status !== "pending" &&
|
|
89
|
+
status !== "active" &&
|
|
90
|
+
status !== "done" &&
|
|
91
|
+
status !== "failed" &&
|
|
92
|
+
status !== "cancelled")
|
|
93
|
+
throw new Error("Invalid queue status");
|
|
94
|
+
return {
|
|
95
|
+
...queueRequest(data),
|
|
96
|
+
status,
|
|
97
|
+
fence: queueNumber(data.fence),
|
|
98
|
+
...(data.worker === undefined ? {} : { worker: queueString(data.worker) }),
|
|
99
|
+
...(data.expires === undefined
|
|
100
|
+
? {}
|
|
101
|
+
: { expires: queueNumber(data.expires) }),
|
|
102
|
+
...(data.result === undefined ? {} : { result: queueResult(data.result) }),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=task-queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-queue.js","sourceRoot":"","sources":["../../src/domain/task-queue.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,CAAC,KAAK,IA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AAK,QAAQ;QACnB,MAAM,KAAK,WAAW;QAEtB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,OAAO;QACL,GAAG,YAAY,CAAC,IAAI,CAAC;QACrB,MAAM;QACN,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC;QAC9B,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1E,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS;YAC5B,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3C,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;KAC3E,CAAC;AACJ,CAAC","sourcesContent":["import type {\n QueueClaim,\n QueueJob,\n QueueLease,\n QueueRequest,\n QueueResult,\n} from \"./task-queue.types.ts\";\nimport {\n queueMaxValueBytes,\n queueMaxLeaseMs,\n queueMaxStringLength,\n queueMinLeaseMs,\n queueMaxHandlers,\n} from \"./task-queue.constants.ts\";\nimport { checkpointValue } from \"./workflow/checkpoint-value.ts\";\n\nexport function queueObject(value: unknown): Record<string, unknown> {\n if (!value || typeof value !== \"object\" || Array.isArray(value))\n throw new Error(\"Invalid queue object\");\n return Object.fromEntries(Object.entries(value));\n}\nexport function queueString(value: unknown): string {\n if (\n typeof value !== \"string\" ||\n !value.length ||\n value.length > queueMaxStringLength\n )\n throw new Error(\"Invalid queue identifier\");\n return value;\n}\nexport function queueNumber(value: unknown): number {\n if (typeof value !== \"number\" || !Number.isSafeInteger(value) || value < 0)\n throw new Error(\"Invalid queue number\");\n return value;\n}\nexport function queueLeaseMs(value: unknown): number {\n const ms = queueNumber(value);\n if (ms < queueMinLeaseMs || ms > queueMaxLeaseMs)\n throw new Error(\"Queue lease must be between 30 and 300000 milliseconds\");\n return ms;\n}\nexport function queueJson(value: unknown) {\n const checked = checkpointValue(value);\n if (checked.kind !== \"json\") throw new Error(\"Queue values must be JSON\");\n if (Buffer.byteLength(JSON.stringify(checked.value)) > queueMaxValueBytes)\n throw new Error(\"Queue value exceeds size limit\");\n return checked.value;\n}\nexport function queueRequest(value: unknown): QueueRequest {\n const data = queueObject(value);\n return {\n id: queueString(data.id),\n handler: queueString(data.handler),\n input: queueJson(data.input),\n ...(data.deadline === undefined\n ? {}\n : { deadline: queueNumber(data.deadline) }),\n };\n}\nexport function queueClaim(value: unknown): QueueClaim {\n const data = queueObject(value);\n if (\n !Array.isArray(data.handlers) ||\n !data.handlers.length ||\n data.handlers.length > queueMaxHandlers\n )\n throw new Error(\"Invalid queue handlers\");\n return {\n worker: queueString(data.worker),\n handlers: data.handlers.map(queueString),\n leaseMs: queueLeaseMs(data.leaseMs),\n };\n}\nexport function queueLease(value: unknown): QueueLease {\n const data = queueObject(value);\n return {\n id: queueString(data.id),\n worker: queueString(data.worker),\n fence: queueNumber(data.fence),\n };\n}\nexport function queueResult(value: unknown): QueueResult {\n const data = queueObject(value);\n const usage = data.usage === undefined ? undefined : queueObject(data.usage);\n return {\n value: queueJson(data.value),\n ...(data.error === undefined ? {} : { error: queueString(data.error) }),\n ...(usage === undefined\n ? {}\n : {\n usage: {\n input: queueNumber(usage.input),\n output: queueNumber(usage.output),\n cached: queueNumber(usage.cached),\n ...(usage.cacheCreated === undefined\n ? {}\n : { cacheCreated: queueNumber(usage.cacheCreated) }),\n },\n }),\n };\n}\nexport function queueJob(value: unknown): QueueJob {\n const data = queueObject(value);\n const status = data.status;\n if (\n status !== \"pending\" &&\n status !== \"active\" &&\n status !== \"done\" &&\n status !== \"failed\" &&\n status !== \"cancelled\"\n )\n throw new Error(\"Invalid queue status\");\n return {\n ...queueRequest(data),\n status,\n fence: queueNumber(data.fence),\n ...(data.worker === undefined ? {} : { worker: queueString(data.worker) }),\n ...(data.expires === undefined\n ? {}\n : { expires: queueNumber(data.expires) }),\n ...(data.result === undefined ? {} : { result: queueResult(data.result) }),\n };\n}\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Usage } from "./agent.types.ts";
|
|
2
|
+
import type { WorkflowJson } from "./workflow/checkpoint.types.ts";
|
|
3
|
+
export interface QueueRequest {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly handler: string;
|
|
6
|
+
readonly input: WorkflowJson;
|
|
7
|
+
readonly deadline?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface QueueResult {
|
|
10
|
+
readonly value: WorkflowJson;
|
|
11
|
+
readonly usage?: Usage;
|
|
12
|
+
readonly error?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface QueueJob extends QueueRequest {
|
|
15
|
+
readonly status: "pending" | "active" | "done" | "failed" | "cancelled";
|
|
16
|
+
readonly fence: number;
|
|
17
|
+
readonly worker?: string;
|
|
18
|
+
readonly expires?: number;
|
|
19
|
+
readonly result?: QueueResult;
|
|
20
|
+
}
|
|
21
|
+
export interface QueueClaim {
|
|
22
|
+
readonly worker: string;
|
|
23
|
+
readonly handlers: readonly string[];
|
|
24
|
+
readonly leaseMs: number;
|
|
25
|
+
}
|
|
26
|
+
export interface QueueLease {
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly worker: string;
|
|
29
|
+
readonly fence: number;
|
|
30
|
+
}
|
|
31
|
+
export interface TaskQueue {
|
|
32
|
+
enqueue(request: QueueRequest): Promise<QueueJob>;
|
|
33
|
+
get(id: string): Promise<QueueJob | undefined>;
|
|
34
|
+
claim(request: QueueClaim): Promise<QueueJob | undefined>;
|
|
35
|
+
renew(lease: QueueLease, leaseMs: number): Promise<QueueJob>;
|
|
36
|
+
complete(lease: QueueLease, result: QueueResult): Promise<QueueJob>;
|
|
37
|
+
cancel(id: string, fence: number): Promise<QueueJob>;
|
|
38
|
+
}
|
|
39
|
+
export interface DurableTaskQueue extends TaskQueue {
|
|
40
|
+
close(): void;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-queue.types.js","sourceRoot":"","sources":["../../src/domain/task-queue.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Usage } from \"./agent.types.ts\";\nimport type { WorkflowJson } from \"./workflow/checkpoint.types.ts\";\n\nexport interface QueueRequest {\n readonly id: string;\n readonly handler: string;\n readonly input: WorkflowJson;\n readonly deadline?: number;\n}\nexport interface QueueResult {\n readonly value: WorkflowJson;\n readonly usage?: Usage;\n readonly error?: string;\n}\nexport interface QueueJob extends QueueRequest {\n readonly status: \"pending\" | \"active\" | \"done\" | \"failed\" | \"cancelled\";\n readonly fence: number;\n readonly worker?: string;\n readonly expires?: number;\n readonly result?: QueueResult;\n}\nexport interface QueueClaim {\n readonly worker: string;\n readonly handlers: readonly string[];\n readonly leaseMs: number;\n}\nexport interface QueueLease {\n readonly id: string;\n readonly worker: string;\n readonly fence: number;\n}\nexport interface TaskQueue {\n enqueue(request: QueueRequest): Promise<QueueJob>;\n get(id: string): Promise<QueueJob | undefined>;\n claim(request: QueueClaim): Promise<QueueJob | undefined>;\n renew(lease: QueueLease, leaseMs: number): Promise<QueueJob>;\n complete(lease: QueueLease, result: QueueResult): Promise<QueueJob>;\n cancel(id: string, fence: number): Promise<QueueJob>;\n}\nexport interface DurableTaskQueue extends TaskQueue {\n close(): void;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const usageDimensions: readonly ["input", "cached", "cacheCreated", "output"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"budget.constants.js","sourceRoot":"","sources":["../../../src/domain/workflow/budget.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,OAAO;IACP,QAAQ;IACR,cAAc;IACd,QAAQ;CACA,CAAC","sourcesContent":["export const usageDimensions = [\n \"input\",\n \"cached\",\n \"cacheCreated\",\n \"output\",\n] as const;\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Usage } from "../agent.types.ts";
|
|
2
|
+
import type { WorkflowAccounting, WorkflowBudget, WorkflowUsage } from "./budget.types.ts";
|
|
3
|
+
export declare class WorkflowBudgetExceeded extends Error {
|
|
4
|
+
readonly dimension: "attempts" | keyof Usage;
|
|
5
|
+
readonly limit: number;
|
|
6
|
+
readonly observed: number;
|
|
7
|
+
constructor(dimension: "attempts" | keyof Usage, limit: number, observed: number);
|
|
8
|
+
}
|
|
9
|
+
export declare function workflowAccounting(budget: WorkflowBudget | undefined, exhaust: (error: WorkflowBudgetExceeded) => void, initial?: WorkflowUsage): WorkflowAccounting;
|