@opengeni/worker-bundle 2.0.1 → 2.0.2-canary.38686408778001
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activities/agent-run-admission.d.ts +1 -12
- package/dist/activities/agent-turn/admission.d.ts +88 -10
- package/dist/activities/agent-turn/agent-build.d.ts +14 -3
- package/dist/activities/agent-turn/claim.d.ts +4 -1
- package/dist/activities/agent-turn/claude-core.d.ts +195 -0
- package/dist/activities/agent-turn/code-search.d.ts +60 -0
- package/dist/activities/agent-turn/codex-capacity.d.ts +3 -0
- package/dist/activities/agent-turn/codex-core-capacity.d.ts +37 -0
- package/dist/activities/agent-turn/codex-core-claim.d.ts +40 -0
- package/dist/activities/agent-turn/codex-core-errors.d.ts +102 -0
- package/dist/activities/agent-turn/codex-core-failover.d.ts +15 -0
- package/dist/activities/agent-turn/codex-core-requests.d.ts +28 -0
- package/dist/activities/agent-turn/codex-core-settlement.d.ts +77 -0
- package/dist/activities/agent-turn/codex-credit-policy.d.ts +30 -0
- package/dist/activities/agent-turn/codex-plan-entitlement.d.ts +105 -0
- package/dist/activities/agent-turn/codex-usage-policy.d.ts +2 -0
- package/dist/activities/agent-turn/codex.d.ts +2 -19
- package/dist/activities/agent-turn/compaction-interruption.d.ts +32 -0
- package/dist/activities/agent-turn/compaction-prep.d.ts +30 -1
- package/dist/activities/agent-turn/credential-leases.d.ts +64 -37
- package/dist/activities/agent-turn/credential-restriction.d.ts +3 -0
- package/dist/activities/agent-turn/errors.d.ts +172 -28
- package/dist/activities/agent-turn/failure-settlement.d.ts +10 -43
- package/dist/activities/agent-turn/final-reply.d.ts +18 -0
- package/dist/activities/agent-turn/finalization-monitor.d.ts +7 -2
- package/dist/activities/agent-turn/finalization.d.ts +2 -0
- package/dist/activities/agent-turn/github-repository-bindings.d.ts +2 -0
- package/dist/activities/agent-turn/governance-model.d.ts +13 -1
- package/dist/activities/agent-turn/history-sink.d.ts +3 -1
- package/dist/activities/agent-turn/history.d.ts +2 -0
- package/dist/activities/agent-turn/input-wait-reply.d.ts +76 -0
- package/dist/activities/agent-turn/meaningful-output.d.ts +9 -0
- package/dist/activities/agent-turn/media-artifacts.d.ts +5 -3
- package/dist/activities/agent-turn/model-call-admission.d.ts +15 -0
- package/dist/activities/agent-turn/model-usage.d.ts +56 -14
- package/dist/activities/agent-turn/model-wire-dispatch.d.ts +15 -0
- package/dist/activities/agent-turn/optional-repositories.d.ts +59 -0
- package/dist/activities/agent-turn/prompt-tool-availability.d.ts +17 -0
- package/dist/activities/agent-turn/provider-dispatch-barrier.d.ts +12 -1
- package/dist/activities/agent-turn/provider-recovery-copy.d.ts +24 -0
- package/dist/activities/agent-turn/provider-recovery-metrics.d.ts +18 -0
- package/dist/activities/agent-turn/provider-recovery-policy.d.ts +6 -0
- package/dist/activities/agent-turn/quiescence.d.ts +6 -7
- package/dist/activities/agent-turn/recovery-warning.d.ts +6 -5
- package/dist/activities/agent-turn/refresh-credentials.d.ts +6 -0
- package/dist/activities/agent-turn/run-credentials.d.ts +9 -5
- package/dist/activities/agent-turn/run.d.ts +27 -2
- package/dist/activities/agent-turn/sandbox-establish.d.ts +1 -0
- package/dist/activities/agent-turn/sandbox-provision.d.ts +25 -1
- package/dist/activities/agent-turn/sandbox-route.d.ts +3 -0
- package/dist/activities/agent-turn/sandbox-runtime.d.ts +1 -1
- package/dist/activities/agent-turn/secret-resolver.d.ts +64 -0
- package/dist/activities/agent-turn/session-title.d.ts +60 -3
- package/dist/activities/agent-turn/session-usage-custody.d.ts +66 -0
- package/dist/activities/agent-turn/skill-checkout.d.ts +25 -6
- package/dist/activities/agent-turn/skill-read.d.ts +70 -2
- package/dist/activities/agent-turn/skill-search.d.ts +2 -0
- package/dist/activities/agent-turn/skill-tools.d.ts +41 -4
- package/dist/activities/agent-turn/skill-transfer.d.ts +18 -6
- package/dist/activities/agent-turn/stream-attempt.d.ts +6 -3
- package/dist/activities/agent-turn/subscription-capacity-arming.d.ts +41 -0
- package/dist/activities/agent-turn/subscription-core-capacity.d.ts +86 -0
- package/dist/activities/agent-turn/subscription-core-failover.d.ts +69 -0
- package/dist/activities/agent-turn/subscription-core-placed.d.ts +14 -0
- package/dist/activities/agent-turn/subscription-core-requests.d.ts +109 -0
- package/dist/activities/agent-turn/subscription-core-settlement.d.ts +112 -0
- package/dist/activities/agent-turn/subscription-lease.d.ts +44 -0
- package/dist/activities/agent-turn/subscription-serving-capacity.d.ts +6 -0
- package/dist/activities/agent-turn/subscription-serving-catalog.d.ts +13 -0
- package/dist/activities/agent-turn/subscription-serving-claim.d.ts +30 -0
- package/dist/activities/agent-turn/subscription-serving-providers.d.ts +2 -0
- package/dist/activities/agent-turn/tool-environment.d.ts +30 -6
- package/dist/activities/agent-turn/tool-policy.d.ts +55 -3
- package/dist/activities/agent-turn/turn-context.d.ts +104 -5
- package/dist/activities/agent-turn/web-search.d.ts +57 -0
- package/dist/activities/agent-turn/xai-core.d.ts +96 -0
- package/dist/activities/automations.d.ts +3 -1
- package/dist/activities/browser-deadline-checkpoint.d.ts +34 -0
- package/dist/activities/capabilities.d.ts +8 -20
- package/dist/activities/codemode-dispatcher.d.ts +20 -3
- package/dist/activities/codex-capacity.d.ts +1 -56
- package/dist/activities/codex-image-generation.d.ts +49 -3
- package/dist/activities/common.d.ts +3 -1
- package/dist/activities/context-compaction.d.ts +41 -2
- package/dist/activities/environment.d.ts +1 -19
- package/dist/activities/gmail-files.d.ts +50 -0
- package/dist/activities/goals.d.ts +1 -9
- package/dist/activities/incident-telemetry-authority.d.ts +5 -2
- package/dist/activities/incident-telemetry-preflight.d.ts +10 -3
- package/dist/activities/knowledge-indexing.d.ts +19 -0
- package/dist/activities/mcp-account-routes.d.ts +2 -21
- package/dist/activities/model-call-fact-reconciler.d.ts +34 -0
- package/dist/activities/open-suffix-resume.d.ts +15 -0
- package/dist/activities/parent-wake.d.ts +17 -12
- package/dist/activities/programmatic-approvals.d.ts +10 -0
- package/dist/activities/requester-unavailable-receipt.d.ts +8 -0
- package/dist/activities/retained-screenshots.d.ts +7 -2
- package/dist/activities/run-credential-renewal.d.ts +1 -0
- package/dist/activities/run-credentials.d.ts +16 -4
- package/dist/activities/run-input.d.ts +17 -0
- package/dist/activities/sandbox-lease.d.ts +132 -12
- package/dist/activities/scheduled-tasks.d.ts +4 -35
- package/dist/activities/session-archive.d.ts +58 -0
- package/dist/activities/session-state.d.ts +15 -3
- package/dist/activities/session-storage.d.ts +44 -0
- package/dist/activities/subscription-core-claude-waits.d.ts +2 -0
- package/dist/activities/subscription-core-codex-quota.d.ts +25 -0
- package/dist/activities/subscription-core-codex-waits.d.ts +153 -0
- package/dist/activities/subscription-core-image-operation.d.ts +29 -0
- package/dist/activities/subscription-core-usage-recheck.d.ts +49 -0
- package/dist/activities/subscription-core-wait-bindings.d.ts +3 -0
- package/dist/activities/subscription-core-xai-quota.d.ts +30 -0
- package/dist/activities/subscription-core-xai-waits.d.ts +2 -0
- package/dist/activities/types.d.ts +68 -5
- package/dist/activities/video-generation-admission.d.ts +2 -8
- package/dist/activities/video-generation-credential.d.ts +15 -12
- package/dist/activities/video-generation-subscription-core.d.ts +70 -0
- package/dist/activities/workspace-capture.d.ts +2 -0
- package/dist/activities/workspace-credential-provider.d.ts +47 -0
- package/dist/activities/xai-auth.d.ts +6 -18
- package/dist/activities/xai-image-generation.d.ts +22 -6
- package/dist/{activities-control-QA6OLRQY.js → activities-control-NTXZHYET.js} +1552 -2876
- package/dist/activities-control-NTXZHYET.js.map +1 -0
- package/dist/activities-control.d.ts +64 -4
- package/dist/{activities-turn-YVVKCGAK.js → activities-turn-RKRI5GY4.js} +9238 -4392
- package/dist/activities-turn-RKRI5GY4.js.map +1 -0
- package/dist/activities.d.ts +64 -4
- package/dist/artifact-materializer-entry.js +104 -35
- package/dist/artifact-materializer-entry.js.map +1 -1
- package/dist/artifact-outbox-entry.js +132 -61
- package/dist/artifact-outbox-entry.js.map +1 -1
- package/dist/browser-deadline-checkpoint-contract.d.ts +2 -0
- package/dist/{chunk-GDCLDKSH.js → chunk-24GP3BX5.js} +79 -72
- package/dist/chunk-24GP3BX5.js.map +1 -0
- package/dist/{chunk-RAMNYSAW.js → chunk-4ER3YXOT.js} +22 -4
- package/dist/chunk-4ER3YXOT.js.map +1 -0
- package/dist/{chunk-I7HKKMUJ.js → chunk-5NNS4327.js} +734 -58
- package/dist/chunk-5NNS4327.js.map +1 -0
- package/dist/{chunk-M3NVMF2V.js → chunk-7BIHFUGB.js} +2293 -3956
- package/dist/chunk-7BIHFUGB.js.map +1 -0
- package/dist/chunk-MVESOYFC.js +3746 -0
- package/dist/chunk-MVESOYFC.js.map +1 -0
- package/dist/chunk-NQDVJ6RI.js +2823 -0
- package/dist/chunk-NQDVJ6RI.js.map +1 -0
- package/dist/chunk-O7UPBWXK.js +79 -0
- package/dist/chunk-O7UPBWXK.js.map +1 -0
- package/dist/chunk-W2QSM5HR.js +414 -0
- package/dist/chunk-W2QSM5HR.js.map +1 -0
- package/dist/chunk-ZN3XJR33.js +227 -0
- package/dist/chunk-ZN3XJR33.js.map +1 -0
- package/dist/editable-artifact-outbox-dispatcher.d.ts +12 -1
- package/dist/editable-artifact-outbox-service.d.ts +3 -1
- package/dist/host-export-pump.d.ts +3 -1
- package/dist/host-export.d.ts +2 -2
- package/dist/host-export.js +1 -1
- package/dist/http.d.ts +1 -1
- package/dist/index.d.ts +49 -48
- package/dist/index.js +835 -256
- package/dist/index.js.map +1 -1
- package/dist/internal-maintenance.d.ts +63 -0
- package/dist/maintenance-cadence.d.ts +43 -0
- package/dist/observability-metrics.d.ts +293 -24
- package/dist/onepassword-vault-provider.d.ts +7 -0
- package/dist/parent-wake-PCLH7A3Y.js +24 -0
- package/dist/parent-wake-PCLH7A3Y.js.map +1 -0
- package/dist/personal-github-git-credentials.d.ts +1 -1
- package/dist/readiness-checks.d.ts +39 -0
- package/dist/retained-process-retry.d.ts +7 -0
- package/dist/sandbox-lease-BJYU72N3.js +84 -0
- package/dist/sandbox-lease-BJYU72N3.js.map +1 -0
- package/dist/sandbox-reaper-contract.d.ts +25 -0
- package/dist/sandbox-resume.d.ts +72 -4
- package/dist/sandbox-routing.d.ts +4 -2
- package/dist/session-event-fanout.d.ts +6 -0
- package/dist/site-auth-maintenance-WK3MR2PV.js +12 -0
- package/dist/site-auth-maintenance-WK3MR2PV.js.map +1 -0
- package/dist/telemetry-scheduler.d.ts +14 -0
- package/dist/temporal-runtime-logger.d.ts +22 -0
- package/dist/turn-task-queue-reader.d.ts +18 -0
- package/dist/turn-worker-activity-telemetry.d.ts +47 -0
- package/dist/worker-service-lifecycle.d.ts +12 -0
- package/dist/workflow-bundle.js +468 -71
- package/dist/workflows/activities.d.ts +1 -1
- package/dist/workflows/browser-deadline-checkpoint.d.ts +10 -0
- package/dist/workflows/sandbox-reaper.d.ts +10 -1
- package/dist/workflows/scheduled-tasks.d.ts +4 -0
- package/dist/workflows/session-storage.d.ts +2 -0
- package/dist/workflows/session.d.ts +36 -0
- package/dist/workflows/site-auth-maintenance.d.ts +2 -1
- package/dist/workflows/workflow-wake.d.ts +14 -3
- package/dist/workflows.d.ts +3 -1
- package/package.json +26 -20
- package/src/activities/agent-run-admission.ts +1 -82
- package/src/activities/agent-turn/admission.ts +175 -24
- package/src/activities/agent-turn/agent-build.ts +226 -145
- package/src/activities/agent-turn/claim.ts +363 -64
- package/src/activities/agent-turn/claude-core.ts +587 -0
- package/src/activities/agent-turn/code-search.ts +275 -0
- package/src/activities/agent-turn/codex-capacity.ts +30 -757
- package/src/activities/agent-turn/codex-core-capacity.ts +190 -0
- package/src/activities/agent-turn/codex-core-claim.ts +83 -0
- package/src/activities/agent-turn/codex-core-errors.ts +308 -0
- package/src/activities/agent-turn/codex-core-failover.ts +73 -0
- package/src/activities/agent-turn/codex-core-requests.ts +86 -0
- package/src/activities/agent-turn/codex-core-settlement.ts +263 -0
- package/src/activities/agent-turn/codex-credit-policy.ts +247 -0
- package/src/activities/agent-turn/codex-plan-entitlement.ts +254 -0
- package/src/activities/agent-turn/codex-usage-policy.ts +2 -0
- package/src/activities/agent-turn/codex.ts +8 -76
- package/src/activities/agent-turn/compaction-interruption.ts +56 -0
- package/src/activities/agent-turn/compaction-prep.ts +249 -36
- package/src/activities/agent-turn/credential-leases.ts +269 -214
- package/src/activities/agent-turn/credential-restriction.ts +14 -0
- package/src/activities/agent-turn/errors.ts +1134 -82
- package/src/activities/agent-turn/failure-settlement.ts +879 -886
- package/src/activities/agent-turn/final-reply.ts +46 -0
- package/src/activities/agent-turn/finalization-monitor.ts +17 -5
- package/src/activities/agent-turn/finalization.ts +107 -88
- package/src/activities/agent-turn/github-repository-bindings.ts +3 -1
- package/src/activities/agent-turn/governance-model.ts +90 -22
- package/src/activities/agent-turn/history-sink.ts +26 -4
- package/src/activities/agent-turn/history.ts +25 -5
- package/src/activities/agent-turn/input-wait-reply.ts +139 -0
- package/src/activities/agent-turn/knowledge-source-tools.ts +2 -0
- package/src/activities/agent-turn/meaningful-output.ts +44 -0
- package/src/activities/agent-turn/media-artifacts.ts +3 -1
- package/src/activities/agent-turn/model-call-admission.ts +94 -0
- package/src/activities/agent-turn/model-usage.ts +299 -233
- package/src/activities/agent-turn/model-wire-dispatch.ts +27 -0
- package/src/activities/agent-turn/optional-repositories.ts +224 -0
- package/src/activities/agent-turn/prompt-tool-availability.ts +27 -0
- package/src/activities/agent-turn/provider-dispatch-barrier.ts +22 -0
- package/src/activities/agent-turn/provider-recovery-copy.ts +76 -0
- package/src/activities/agent-turn/provider-recovery-metrics.ts +64 -0
- package/src/activities/agent-turn/provider-recovery-policy.ts +25 -0
- package/src/activities/agent-turn/quiescence.ts +7 -7
- package/src/activities/agent-turn/recovery-warning.ts +6 -8
- package/src/activities/agent-turn/refresh-credentials.ts +44 -0
- package/src/activities/agent-turn/run-credentials.ts +124 -76
- package/src/activities/agent-turn/run.ts +501 -112
- package/src/activities/agent-turn/sandbox-establish.ts +152 -75
- package/src/activities/agent-turn/sandbox-provision.ts +54 -1
- package/src/activities/agent-turn/sandbox-route.ts +4 -1
- package/src/activities/agent-turn/sandbox-runtime.ts +319 -11
- package/src/activities/agent-turn/secret-resolver.ts +155 -0
- package/src/activities/agent-turn/session-title.ts +177 -12
- package/src/activities/agent-turn/session-usage-custody.ts +170 -0
- package/src/activities/agent-turn/skill-checkout.ts +111 -24
- package/src/activities/agent-turn/skill-install.ts +1 -1
- package/src/activities/agent-turn/skill-read.ts +374 -28
- package/src/activities/agent-turn/skill-save.ts +35 -7
- package/src/activities/agent-turn/skill-search.ts +9 -0
- package/src/activities/agent-turn/skill-selection.ts +4 -0
- package/src/activities/agent-turn/skill-tools.ts +208 -21
- package/src/activities/agent-turn/skill-transfer.ts +68 -23
- package/src/activities/agent-turn/stream-attempt.ts +599 -110
- package/src/activities/agent-turn/subscription-capacity-arming.ts +81 -0
- package/src/activities/agent-turn/subscription-core-capacity.ts +439 -0
- package/src/activities/agent-turn/subscription-core-failover.ts +229 -0
- package/src/activities/agent-turn/subscription-core-placed.ts +37 -0
- package/src/activities/agent-turn/subscription-core-requests.ts +271 -0
- package/src/activities/agent-turn/subscription-core-settlement.ts +234 -0
- package/src/activities/agent-turn/subscription-lease.ts +140 -0
- package/src/activities/agent-turn/subscription-serving-capacity.ts +195 -0
- package/src/activities/agent-turn/subscription-serving-catalog.ts +71 -0
- package/src/activities/agent-turn/subscription-serving-claim.ts +178 -0
- package/src/activities/agent-turn/subscription-serving-providers.ts +15 -0
- package/src/activities/agent-turn/tool-environment.ts +384 -292
- package/src/activities/agent-turn/tool-policy.ts +104 -4
- package/src/activities/agent-turn/tool-result-spill.ts +1 -0
- package/src/activities/agent-turn/turn-context.ts +124 -8
- package/src/activities/agent-turn/web-search.ts +431 -0
- package/src/activities/agent-turn/xai-core.ts +301 -0
- package/src/activities/automations.ts +81 -6
- package/src/activities/browser-deadline-checkpoint.ts +297 -0
- package/src/activities/capabilities.ts +53 -213
- package/src/activities/codemode-dispatcher.ts +236 -14
- package/src/activities/codex-capacity.ts +27 -380
- package/src/activities/codex-image-generation.ts +252 -42
- package/src/activities/common.ts +12 -0
- package/src/activities/connector-attachments.ts +3 -1
- package/src/activities/context-compaction.ts +162 -21
- package/src/activities/environment.ts +18 -106
- package/src/activities/gmail-files.ts +108 -0
- package/src/activities/goals.ts +120 -204
- package/src/activities/image-generation-operation.ts +1 -1
- package/src/activities/incident-telemetry-authority.ts +80 -50
- package/src/activities/incident-telemetry-preflight.ts +27 -15
- package/src/activities/knowledge-indexing.ts +287 -17
- package/src/activities/knowledge-source-sync.ts +10 -0
- package/src/activities/mcp-account-routes.ts +2 -124
- package/src/activities/model-call-fact-reconciler.ts +112 -0
- package/src/activities/open-suffix-resume.ts +122 -88
- package/src/activities/parent-wake.ts +89 -21
- package/src/activities/programmatic-approvals.ts +26 -0
- package/src/activities/requester-unavailable-receipt.ts +14 -0
- package/src/activities/retained-screenshots.ts +135 -24
- package/src/activities/run-credential-renewal.ts +13 -1
- package/src/activities/run-credentials.ts +61 -19
- package/src/activities/run-input.ts +116 -9
- package/src/activities/sandbox-lease.ts +1615 -73
- package/src/activities/scheduled-tasks.ts +758 -141
- package/src/activities/session-archive.ts +382 -0
- package/src/activities/session-state.ts +219 -10
- package/src/activities/session-storage.ts +124 -0
- package/src/activities/site-auth-maintenance.ts +5 -2
- package/src/activities/subscription-core-claude-waits.ts +49 -0
- package/src/activities/subscription-core-codex-quota.ts +46 -0
- package/src/activities/subscription-core-codex-waits.ts +488 -0
- package/src/activities/subscription-core-image-operation.ts +126 -0
- package/src/activities/subscription-core-usage-recheck.ts +146 -0
- package/src/activities/subscription-core-wait-bindings.ts +12 -0
- package/src/activities/subscription-core-xai-quota.ts +85 -0
- package/src/activities/subscription-core-xai-waits.ts +48 -0
- package/src/activities/types.ts +85 -9
- package/src/activities/video-generation-admission.ts +1 -36
- package/src/activities/video-generation-credential.ts +38 -56
- package/src/activities/video-generation-reconciliation.ts +150 -131
- package/src/activities/video-generation-subscription-core.ts +180 -0
- package/src/activities/workspace-capture.ts +13 -2
- package/src/activities/workspace-credential-provider.ts +302 -0
- package/src/activities/xai-auth.ts +34 -112
- package/src/activities/xai-image-generation.ts +84 -36
- package/src/activities-control.ts +8 -0
- package/src/activities-turn.ts +5 -0
- package/src/activities.ts +17 -0
- package/src/activity-services.ts +29 -4
- package/src/browser-deadline-checkpoint-contract.ts +5 -0
- package/src/editable-artifact-hint-broker.ts +3 -0
- package/src/editable-artifact-materializer-service.ts +79 -38
- package/src/editable-artifact-materializer-subprocess.ts +47 -2
- package/src/editable-artifact-outbox-dispatcher.ts +107 -46
- package/src/editable-artifact-outbox-service.ts +55 -25
- package/src/github-rest-mcp.ts +1 -1
- package/src/host-export-pump.ts +26 -4
- package/src/host-export.ts +4 -1
- package/src/http.ts +4 -2
- package/src/index.ts +222 -282
- package/src/internal-maintenance.ts +347 -0
- package/src/maintenance-cadence.ts +156 -0
- package/src/observability-metrics.ts +1173 -73
- package/src/onepassword-vault-provider.ts +11 -0
- package/src/personal-github-git-credentials.ts +3 -1
- package/src/pr-review-credentials.ts +1 -1
- package/src/readiness-checks.ts +113 -0
- package/src/retained-process-retry.ts +36 -0
- package/src/sandbox-reaper-contract.ts +33 -0
- package/src/sandbox-resume.ts +444 -73
- package/src/sandbox-routing.ts +230 -75
- package/src/session-event-fanout.ts +23 -0
- package/src/telemetry-scheduler.ts +53 -0
- package/src/temporal-runtime-logger.ts +44 -0
- package/src/turn-task-queue-reader.ts +110 -0
- package/src/turn-worker-activity-telemetry.ts +209 -0
- package/src/worker-service-lifecycle.ts +54 -1
- package/src/workflows/activities.ts +16 -1
- package/src/workflows/browser-deadline-checkpoint.ts +55 -0
- package/src/workflows/file-upload-reaper.ts +2 -0
- package/src/workflows/sandbox-reaper.ts +88 -0
- package/src/workflows/scheduled-tasks.ts +26 -13
- package/src/workflows/session-storage.ts +19 -0
- package/src/workflows/session.ts +238 -33
- package/src/workflows/site-auth-maintenance.ts +2 -1
- package/src/workflows/workflow-wake.ts +26 -4
- package/src/workflows.ts +7 -0
- package/dist/activities/agent-turn/xai-capacity.d.ts +0 -2
- package/dist/activities/codex-fleet-shadow.d.ts +0 -74
- package/dist/activities/codex-rotation.d.ts +0 -200
- package/dist/activities/xai-quota.d.ts +0 -3
- package/dist/activities-control-QA6OLRQY.js.map +0 -1
- package/dist/activities-turn-YVVKCGAK.js.map +0 -1
- package/dist/chunk-GDCLDKSH.js.map +0 -1
- package/dist/chunk-I7HKKMUJ.js.map +0 -1
- package/dist/chunk-M3NVMF2V.js.map +0 -1
- package/dist/chunk-RAMNYSAW.js.map +0 -1
- package/src/activities/agent-turn/xai-capacity.ts +0 -257
- package/src/activities/codex-fleet-shadow.ts +0 -306
- package/src/activities/codex-rotation.ts +0 -685
- package/src/activities/xai-quota.ts +0 -35
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ProviderCommandPersistence } from "@opengeni/runtime";
|
|
1
|
+
import type { ProviderCommandPersistence, ProviderCommandSession } from "@opengeni/runtime";
|
|
2
2
|
import { type OpStatus } from "@opengeni/agent-proto";
|
|
3
|
-
import { listLiveModalSandboxLeaseAttributions, readLease, type ReapDrainable, type RetainedProcessProviderProof, type SandboxRetainedProcess, type LeaseSnapshot } from "@opengeni/db";
|
|
3
|
+
import { listLiveModalSandboxLeaseAttributions, readLease, readWorkspaceArchiveCapturePreflight, type ReapDrainable, type RetainedProcessProviderProof, type SandboxRetainedProcess, type LeaseSnapshot } from "@opengeni/db";
|
|
4
4
|
import { type ConnectedMachineBackgroundCommandClaim, type ConnectedMachineBackgroundCommandProof } from "@opengeni/db/session-background-commands";
|
|
5
|
-
import { type VerifiedHostWorkspaceArchive, createSandboxClientForBackend, inspectModalSandboxLifecycle, OpStreamExecClient, resolveModalCheckpointProviderBindingForSession, terminateModalSandboxById, type ModalOrphanSweepTermination, type ModalCheckpointProviderBinding, type ProviderWorkspaceCapturePolicy, type WorkspaceArchiveDescriptor, type ControlRpc } from "@opengeni/runtime/sandbox";
|
|
6
|
-
import { type SandboxDrainActivityInput, type SandboxLeaseSweepMaintenanceInput } from "../sandbox-reaper-contract.js";
|
|
5
|
+
import { type VerifiedHostWorkspaceArchive, createSandboxClientForBackend, inspectModalSandboxLifecycle, OpStreamExecClient, findModalProviderCreateReceipt, resolveModalCheckpointProviderBindingForSession, terminateModalSandboxById, type ModalOrphanSweepTermination, type ModalCheckpointProviderBinding, type ProviderWorkspaceCapturePolicy, type WorkspaceArchiveDescriptor, type ControlRpc } from "@opengeni/runtime/sandbox";
|
|
6
|
+
import { type SandboxDrainActivityInput, type SandboxLeaseSweepMaintenanceInput, type SandboxIdleCheckpointActivityInput, type SandboxIdleCheckpointPlan } from "../sandbox-reaper-contract.js";
|
|
7
7
|
import type { ControlActivityServices as ActivityServices } from "./types.js";
|
|
8
8
|
import { type RetainedProcessReconciliationOutcome } from "../observability-metrics.js";
|
|
9
9
|
import { type OpenSandboxKubernetesInventory } from "../opensandbox-kubernetes-inventory.js";
|
|
@@ -20,8 +20,7 @@ export type ReapSandboxLeasesResult = {
|
|
|
20
20
|
skipped: number;
|
|
21
21
|
/** Warm viewer-only leases that accrued warm-seconds this tick (P2.1). */
|
|
22
22
|
metered: number;
|
|
23
|
-
/**
|
|
24
|
-
* (0 balance / over the warm cap) — turn-held boxes are never drained (P2.1). */
|
|
23
|
+
/** Holderless boxes accelerated to draining by the optional warm cap. */
|
|
25
24
|
forceDrained: number;
|
|
26
25
|
/** Provider-side Modal orphan sandboxes terminated by the defensive sweep. */
|
|
27
26
|
modalOrphansTerminated: number;
|
|
@@ -60,7 +59,9 @@ export type DrainCaptureDisposition = "capture_required" | "archive_published";
|
|
|
60
59
|
* Test seams may return the legacy boolean shorthand. Production returns the
|
|
61
60
|
* typed outcome so the cold commit can distinguish a clean stop from definitive
|
|
62
61
|
* provider disappearance before capture. */
|
|
63
|
-
export type TerminateBoxFn = (settings: ActivityServices["settings"], lease: NonNullable<Awaited<ReturnType<typeof readLease>>>, observability: ActivityServices["observability"], persistArchive: PersistArchiveFn, providerCaptureRequestId?: string, captureDisposition?: DrainCaptureDisposition, capturePolicy?: ProviderWorkspaceCapturePolicy | null, diskBackedArchives?: boolean, releaseFailedCapture?: () => Promise<void>, workspaceId?: string) => Promise<
|
|
62
|
+
export type TerminateBoxFn = (settings: ActivityServices["settings"], lease: NonNullable<Awaited<ReturnType<typeof readLease>>>, observability: ActivityServices["observability"], persistArchive: PersistArchiveFn, providerCaptureRequestId?: string, captureDisposition?: DrainCaptureDisposition, capturePolicy?: ProviderWorkspaceCapturePolicy | null, diskBackedArchives?: boolean, releaseFailedCapture?: () => Promise<void>, workspaceId?: string, beforeProviderStop?: () => Promise<void>, beforeWorkspaceCapture?: () => Promise<{
|
|
63
|
+
archivePublished: boolean;
|
|
64
|
+
}>) => Promise<boolean | ProviderTerminationOutcome>;
|
|
64
65
|
export type SweepModalOrphansFn = (settings: ActivityServices["settings"], db: ActivityServices["db"], observability: ActivityServices["observability"]) => Promise<number>;
|
|
65
66
|
export type InspectOpenSandboxKubernetesInventoryFn = (input: {
|
|
66
67
|
namespace: string;
|
|
@@ -72,6 +73,8 @@ export type SandboxLeaseActivityOptions = {
|
|
|
72
73
|
/** Override the provider-side Modal orphan sweep (tests spy this; defaults to
|
|
73
74
|
* Modal list+tag comparison when Modal is configured). */
|
|
74
75
|
sweepModalOrphans?: SweepModalOrphansFn;
|
|
76
|
+
/** Only provider discovery is injected; durable recovery remains real. */
|
|
77
|
+
findModalProviderCreateReceipt?: typeof findModalProviderCreateReceipt;
|
|
75
78
|
/** Override the read-only bounded OpenSandbox Kubernetes projection. */
|
|
76
79
|
inspectOpenSandboxKubernetesInventory?: InspectOpenSandboxKubernetesInventoryFn;
|
|
77
80
|
/** Override only the read-only provider process probe. The canonical DB
|
|
@@ -83,7 +86,15 @@ export type SandboxLeaseActivityOptions = {
|
|
|
83
86
|
/** Override the read-only exact-instance readiness probe used before the
|
|
84
87
|
* reaper settles blockers for a provider that has definitively vanished. */
|
|
85
88
|
probeDrainableProvider?: DrainableProviderProbeFn;
|
|
89
|
+
/** Override only the resume-by-id of the box an idle checkpoint captures.
|
|
90
|
+
* Returns the live session, or null when the provider no longer has it. The
|
|
91
|
+
* capture claim, publication and release remain real. */
|
|
92
|
+
resumeIdleCheckpointSession?: ResumeIdleCheckpointSessionFn;
|
|
93
|
+
/** Override only the provider client factory of the default drain. The
|
|
94
|
+
* claim, capture, publication and teardown ordering remain real. */
|
|
95
|
+
createClientForBackend?: CreateSandboxClientForBackendFn;
|
|
86
96
|
};
|
|
97
|
+
export type ResumeIdleCheckpointSessionFn = (settings: ActivityServices["settings"], lease: LeaseSnapshot) => Promise<unknown | null>;
|
|
87
98
|
export type RetainedProcessProbeResult = {
|
|
88
99
|
status: "proved";
|
|
89
100
|
proof: RetainedProcessProviderProof;
|
|
@@ -94,13 +105,29 @@ export type RetainedProcessProbeResult = {
|
|
|
94
105
|
} | {
|
|
95
106
|
status: "deferred";
|
|
96
107
|
reason: "identity_mismatch" | "resume_state_missing" | "backend_unsupported" | "provider_running" | "provider_unknown" | "provider_timeout" | "provider_error" | "provider_binding_missing" | "provider_binding_mismatch" | "process_observation_unavailable";
|
|
108
|
+
/** A running command whose last read still returned a large backlog. */
|
|
109
|
+
outputBacklog?: boolean;
|
|
110
|
+
};
|
|
111
|
+
export type RetainedProcessProbeFn = (settings: ActivityServices["settings"], lease: LeaseSnapshot, process: SandboxRetainedProcess, mode?: "observe" | "cancel", captureOutput?: (result: unknown, chunkId: string, stream?: "stdout" | "stderr", streamFidelity?: "separate" | "merged") => Promise<void>, providerPersistence?: ProviderCommandPersistence, drainBudget?: RetainedProcessDrainBudget) => Promise<RetainedProcessProbeResult>;
|
|
112
|
+
/** Shared wall-clock bound on output draining within one reconciliation sweep. */
|
|
113
|
+
export type RetainedProcessDrainBudget = {
|
|
114
|
+
until: number;
|
|
97
115
|
};
|
|
98
|
-
export type RetainedProcessProbeFn = (settings: ActivityServices["settings"], lease: LeaseSnapshot, process: SandboxRetainedProcess, mode?: "observe" | "cancel", captureOutput?: (result: unknown, chunkId: string, stream?: "stdout" | "stderr", streamFidelity?: "separate" | "merged") => Promise<void>, providerPersistence?: ProviderCommandPersistence) => Promise<RetainedProcessProbeResult>;
|
|
99
116
|
export type HistoricalModalSandboxLifecycleProbeFn = typeof inspectModalSandboxLifecycle;
|
|
100
117
|
export type DrainableProviderProbeFn = (settings: ActivityServices["settings"], lease: LeaseSnapshot) => Promise<"ready" | "missing">;
|
|
101
118
|
export declare const RETAINED_PROCESS_RECONCILIATION_LIMIT = 20;
|
|
102
119
|
export declare const RETAINED_PROCESS_RECONCILIATION_CLAIM_TTL_MS: number;
|
|
103
120
|
export declare const RETAINED_PROCESS_PROVIDER_PROBE_TIMEOUT_MS = 5000;
|
|
121
|
+
/** Bounds on reading a command's output backlog: per claim, and across one
|
|
122
|
+
* reconciliation sweep so the reaper activity stays well inside its timeout.
|
|
123
|
+
* Each read returns up to one provider page per stream. */
|
|
124
|
+
export declare const RETAINED_PROCESS_OUTPUT_DRAIN_MAX_READS = 8;
|
|
125
|
+
export declare const RETAINED_PROCESS_OUTPUT_DRAIN_BUDGET_MS = 10000;
|
|
126
|
+
export declare const RETAINED_PROCESS_OUTPUT_DRAIN_SWEEP_BUDGET_MS = 60000;
|
|
127
|
+
/** A live process whose read returned at least this much output left a backlog
|
|
128
|
+
* behind it. A server or watcher that only trickles output stays on ordinary
|
|
129
|
+
* backoff; a process the provider reports exited is always read to EOF. */
|
|
130
|
+
export declare const RETAINED_PROCESS_OUTPUT_BACKLOG_BYTES: number;
|
|
104
131
|
export declare const RETAINED_PROCESS_BINDING_QUARANTINE_AFTER_ATTEMPTS = 5;
|
|
105
132
|
export declare const RETAINED_PROCESS_BINDING_QUARANTINE_RETRY_MS: number;
|
|
106
133
|
export declare const CONNECTED_COMMAND_RECONCILIATION_LIMIT = 20;
|
|
@@ -121,6 +148,9 @@ export declare function awaitProviderCaptureWithLatePublication<T>(input: {
|
|
|
121
148
|
publishLate: (value: T) => Promise<void>;
|
|
122
149
|
observeLateFailure: (error: unknown) => void;
|
|
123
150
|
observeLatePublicationFailure: (error: unknown) => void;
|
|
151
|
+
/** Called once the detached late path has fully settled (after publication
|
|
152
|
+
* or failure handling), never on the in-budget path. */
|
|
153
|
+
onLateSettled?: () => void;
|
|
124
154
|
}): Promise<T>;
|
|
125
155
|
export type SandboxLeaseSweepPlan = {
|
|
126
156
|
drainable: ReapDrainable[];
|
|
@@ -131,6 +161,10 @@ export type SandboxLeaseSweepPlan = {
|
|
|
131
161
|
* boxes enter the same sweep instead of paying another schedule period. */
|
|
132
162
|
rotationsRequested: number;
|
|
133
163
|
};
|
|
164
|
+
export type SandboxIdleCheckpointActivityResult = {
|
|
165
|
+
status: "checkpointed" | "skipped";
|
|
166
|
+
reason?: string;
|
|
167
|
+
};
|
|
134
168
|
export type SandboxLeaseSweepMaintenanceResult = {
|
|
135
169
|
metered: number;
|
|
136
170
|
forceDrained: number;
|
|
@@ -147,31 +181,96 @@ export declare function sandboxDrainCaptureId(operationId: string, attempt: numb
|
|
|
147
181
|
export declare function createSandboxLeaseActivities(services: () => Promise<ActivityServices>, options?: SandboxLeaseActivityOptions): {
|
|
148
182
|
prepareSandboxLeaseSweep: () => Promise<SandboxLeaseSweepPlan>;
|
|
149
183
|
drainSandboxLease: (input: SandboxDrainActivityInput) => Promise<SandboxDrainActivityResult>;
|
|
184
|
+
listIdleSandboxCheckpoints: () => Promise<SandboxIdleCheckpointPlan>;
|
|
185
|
+
checkpointIdleSandboxLease: (input: SandboxIdleCheckpointActivityInput) => Promise<SandboxIdleCheckpointActivityResult>;
|
|
150
186
|
maintainSandboxLeaseSweep: (input: SandboxLeaseSweepMaintenanceInput) => Promise<SandboxLeaseSweepMaintenanceResult>;
|
|
151
187
|
reapSandboxLeases: () => Promise<ReapSandboxLeasesResult>;
|
|
152
188
|
};
|
|
189
|
+
/** Resume the exact warm box by id for an idle checkpoint, with no cold
|
|
190
|
+
* restore and no replacement. Returns null when the provider no longer has
|
|
191
|
+
* it; the ordinary loss paths own that box. The session is not closed: the
|
|
192
|
+
* box keeps running its commands. */
|
|
193
|
+
export declare function resumeIdleCheckpointSessionAtProvider(settings: ActivityServices["settings"], lease: LeaseSnapshot): Promise<unknown | null>;
|
|
194
|
+
/** The checkpoint artifact GC claim TTL, which the reaper's work check previews. */
|
|
195
|
+
export declare const SANDBOX_CHECKPOINT_GC_CLAIM_TTL_MS: number;
|
|
153
196
|
/** Reconcile commands only against the immutable physical locator copied at
|
|
154
197
|
* adoption. A successor enrollment connection is intentionally irrelevant: no
|
|
155
198
|
* query or cancellation is ever rebound to it. */
|
|
156
199
|
export declare function reconcileConnectedMachineBackgroundCommands(db: ActivityServices["db"], settings: ActivityServices["settings"], observability: ActivityServices["observability"], bus: ActivityServices["bus"], controlRpcOverride?: ControlRpc): Promise<void>;
|
|
157
|
-
export declare function replayConnectedCommandOutput(client: Pick<OpStreamExecClient, "readExisting">, opId: string, terminalKnown: boolean, capture: Parameters<OpStreamExecClient["readExisting"]>[2]): Promise<
|
|
200
|
+
export declare function replayConnectedCommandOutput(client: Pick<OpStreamExecClient, "readExisting">, opId: string, terminalKnown: boolean, capture: Parameters<OpStreamExecClient["readExisting"]>[2]): Promise<Awaited<ReturnType<OpStreamExecClient["readExisting"]>>>;
|
|
201
|
+
/** Drain the durable terminal-output obligation independently of the launching
|
|
202
|
+
* attempt or model completion notice. Existing terminal rows receive no inferred
|
|
203
|
+
* receipt: they must replay and capture all retained bytes before any final ACK. */
|
|
204
|
+
export declare function reconcileConnectedCommandOutputReleases(db: ActivityServices["db"], settings: ActivityServices["settings"], observability: ActivityServices["observability"], bus: ActivityServices["bus"], controlRpcOverride?: ControlRpc): Promise<void>;
|
|
158
205
|
export declare function probeConnectedMachineBackgroundCommand(claim: ConnectedMachineBackgroundCommandClaim, controlRpc: ControlRpc, controlTimeoutMs: number, observedAt?: Date): Promise<ConnectedMachineBackgroundCommandProof | null>;
|
|
159
206
|
export declare function connectedCommandProofFromStatus(status: OpStatus, observedAt: Date): ConnectedMachineBackgroundCommandProof | null;
|
|
207
|
+
/** Per worker process: when each historical box may be probed again. */
|
|
208
|
+
export type EndedEpochProbeBackoff = Map<string, {
|
|
209
|
+
failures: number;
|
|
210
|
+
nextProbeAtMs: number;
|
|
211
|
+
}>;
|
|
160
212
|
type RetainedProcessDeferralOutcome = Extract<RetainedProcessProbeResult, {
|
|
161
213
|
status: "deferred";
|
|
162
214
|
}>["reason"] | "settlement_failed";
|
|
163
|
-
export declare function retainedProcessReconciliationDeferral(settings: Pick<ActivityServices["settings"], "sandboxLeaseReaperPeriodMs">, process: Pick<SandboxRetainedProcess, "reconcileAttempts">, outcome: RetainedProcessDeferralOutcome): {
|
|
215
|
+
export declare function retainedProcessReconciliationDeferral(settings: Pick<ActivityServices["settings"], "sandboxLeaseReaperPeriodMs">, process: Pick<SandboxRetainedProcess, "reconcileAttempts">, outcome: RetainedProcessDeferralOutcome, outputBacklog?: boolean): {
|
|
164
216
|
durableOutcome: string;
|
|
165
217
|
metricOutcome: RetainedProcessReconciliationOutcome;
|
|
166
218
|
retryAfterMs: number;
|
|
167
219
|
quarantined: boolean;
|
|
168
220
|
};
|
|
221
|
+
type RetainedProcessProbeSession = ProviderCommandSession & {
|
|
222
|
+
acknowledgeCommandOutput?: (result: string) => Promise<void>;
|
|
223
|
+
writeStdin?: (args: {
|
|
224
|
+
sessionId: number;
|
|
225
|
+
chars: string;
|
|
226
|
+
yieldTimeMs: number;
|
|
227
|
+
maxOutputTokens: number;
|
|
228
|
+
}) => Promise<unknown>;
|
|
229
|
+
};
|
|
230
|
+
/** A command's exit is reported only after both output streams reach EOF, so a
|
|
231
|
+
* finished command with a large backlog looks running until it is read. While a
|
|
232
|
+
* backlog remains, keep reading within the per-claim and per-sweep budgets, so
|
|
233
|
+
* it settles in this claim instead of one page per backoff step. Every page,
|
|
234
|
+
* including `first`, is captured here. */
|
|
235
|
+
export declare function drainRetainedCommandBacklog(session: RetainedProcessProbeSession, providerSessionId: number, first: unknown, capturePage: (value: unknown) => Promise<void>, budget?: RetainedProcessDrainBudget): Promise<RetainedProcessProbeResult>;
|
|
169
236
|
export declare function captureRetainedProbeOutput(processId: string, result: unknown, capture: (result: unknown, chunkId: string) => Promise<void>): Promise<void>;
|
|
170
|
-
export declare function probeRetainedProcessAtProvider(settings: ActivityServices["settings"], lease: LeaseSnapshot, process: SandboxRetainedProcess, mode?: "observe" | "cancel", captureOutput?: (result: unknown, chunkId: string, stream?: "stdout" | "stderr", streamFidelity?: "separate" | "merged") => Promise<void>, providerPersistence?: ProviderCommandPersistence): Promise<RetainedProcessProbeResult>;
|
|
237
|
+
export declare function probeRetainedProcessAtProvider(settings: ActivityServices["settings"], lease: LeaseSnapshot, process: SandboxRetainedProcess, mode?: "observe" | "cancel", captureOutput?: (result: unknown, chunkId: string, stream?: "stdout" | "stderr", streamFidelity?: "separate" | "merged") => Promise<void>, providerPersistence?: ProviderCommandPersistence, drainBudget?: RetainedProcessDrainBudget): Promise<RetainedProcessProbeResult>;
|
|
171
238
|
/** Classify only exact SDK control banners. Arbitrary output, malformed text,
|
|
172
239
|
* and a running marker are observations to retry; none is physical exit proof. */
|
|
173
240
|
export declare function classifyRetainedProcessPollResult(result: unknown, providerSessionId: number, source?: object): RetainedProcessProbeResult;
|
|
241
|
+
/**
|
|
242
|
+
* The reaper maintenance pass's read-only projections, for a reaper tick that
|
|
243
|
+
* started no workflow because there was no work. Same gauges, same process:
|
|
244
|
+
* the control worker both runs the cadence and polls the lifecycle queue.
|
|
245
|
+
*/
|
|
246
|
+
export declare function refreshIdleSandboxReaperProjections(input: {
|
|
247
|
+
db: ActivityServices["db"];
|
|
248
|
+
settings: ActivityServices["settings"];
|
|
249
|
+
observability: ActivityServices["observability"];
|
|
250
|
+
inspectOpenSandboxInventory?: InspectOpenSandboxKubernetesInventoryFn;
|
|
251
|
+
}): Promise<void>;
|
|
252
|
+
/**
|
|
253
|
+
* Whether the Modal orphan sweep could act: the deployment uses Modal and its
|
|
254
|
+
* app has an unfinished sandbox. Called only once the database checks found no
|
|
255
|
+
* warm lease, so an empty listing is the sweep's complete, empty inventory and
|
|
256
|
+
* is projected exactly as the sweep would project it.
|
|
257
|
+
*/
|
|
258
|
+
export declare function modalOrphanSweepMayHaveWork(input: {
|
|
259
|
+
settings: ActivityServices["settings"];
|
|
260
|
+
observability: ActivityServices["observability"];
|
|
261
|
+
hasRunningSandboxes?: (settings: ActivityServices["settings"]) => Promise<boolean>;
|
|
262
|
+
}): Promise<boolean>;
|
|
263
|
+
export declare function reconcileModalProviderCreates(db: ActivityServices["db"], settings: ActivityServices["settings"], observability: ActivityServices["observability"], discover?: typeof findModalProviderCreateReceipt): Promise<void>;
|
|
174
264
|
export declare function modalOrphanTerminationStillEligible(latest: Awaited<ReturnType<typeof listLiveModalSandboxLeaseAttributions>>, candidate: ModalOrphanSweepTermination): boolean;
|
|
265
|
+
/** Live leases still WARM on an instance the complete listing did not show.
|
|
266
|
+
* A draining lease legitimately loses its box mid-drain (capture, terminate,
|
|
267
|
+
* then cold), and warming has not published a box yet, so only a warm lease
|
|
268
|
+
* whose exact box is gone is a zombie. */
|
|
269
|
+
export declare function countWarmModalLeasesMissingInstance(latest: Awaited<ReturnType<typeof listLiveModalSandboxLeaseAttributions>>, missingInstanceIds: string[]): number;
|
|
270
|
+
/** Whether no live lease owns the candidate box by exact instance or by its
|
|
271
|
+
* attribution tags. Unlike termination eligibility this ignores the pending
|
|
272
|
+
* create postponement: a postponed orphan is still running without a lease. */
|
|
273
|
+
export declare function modalOrphanCandidateStillUnowned(latest: Awaited<ReturnType<typeof listLiveModalSandboxLeaseAttributions>>, candidate: ModalOrphanSweepTermination): boolean;
|
|
175
274
|
export type SandboxDrainReason = "idle" | "provider_deadline" | "operator" | "teardown_claim" | "rotation_requested";
|
|
176
275
|
/** The bounded drain reason carried on `sandbox.box.terminated`: the lease's
|
|
177
276
|
* rotation reason when a rotation was requested, otherwise the ordinary idle
|
|
@@ -208,4 +307,25 @@ export declare function sandboxDrainReason(lease: Pick<LeaseSnapshot, "rotationR
|
|
|
208
307
|
* draining until its adapter can prove termination. A truly instance-less or
|
|
209
308
|
* `none`-backed row is a no-op.
|
|
210
309
|
*/
|
|
211
|
-
|
|
310
|
+
/** Internal server pre-read fence; not a grant to arbitrary callers. The
|
|
311
|
+
* owning drain already derived account/workspace/group authority and claimed
|
|
312
|
+
* capture through the canonical DB lifecycle. No claim is fabricated here. */
|
|
313
|
+
export declare function verifyDockerDrainCaptureFence(db: ActivityServices["db"], input: {
|
|
314
|
+
accountId: string;
|
|
315
|
+
workspaceId: string;
|
|
316
|
+
sandboxGroupId: string;
|
|
317
|
+
leaseId: string;
|
|
318
|
+
leaseEpoch: number;
|
|
319
|
+
instanceId: string;
|
|
320
|
+
workspaceGeneration: number;
|
|
321
|
+
captureId: string;
|
|
322
|
+
providerRequestId: string;
|
|
323
|
+
}, readers?: {
|
|
324
|
+
readLease: typeof readLease;
|
|
325
|
+
readWorkspaceArchiveCapturePreflight: typeof readWorkspaceArchiveCapturePreflight;
|
|
326
|
+
}): Promise<{
|
|
327
|
+
archivePublished: boolean;
|
|
328
|
+
}>;
|
|
329
|
+
export declare function terminateProviderBox(settings: ActivityServices["settings"], lease: NonNullable<Awaited<ReturnType<typeof readLease>>>, observability: ActivityServices["observability"], persistArchive: PersistArchiveFn, createClientForBackend?: CreateSandboxClientForBackendFn, terminateModalById?: typeof terminateModalSandboxById, providerCaptureRequestId?: string, captureDisposition?: DrainCaptureDisposition, claimedCapturePolicy?: ProviderWorkspaceCapturePolicy | null, diskBackedArchives?: boolean, releaseFailedCapture?: () => Promise<void>, workspaceId?: string, beforeProviderStop?: () => Promise<void>, beforeWorkspaceCapture?: () => Promise<{
|
|
330
|
+
archivePublished: boolean;
|
|
331
|
+
}>): Promise<ProviderTerminationOutcome>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TurnExecutionPolicyV1 } from "@opengeni/contracts";
|
|
1
2
|
import { updateSessionTitleWithEvent } from "@opengeni/db";
|
|
2
3
|
import type { ControlActivityServices, DispatchScheduledTaskRunInput, DispatchScheduledTaskRunResult } from "./types.js";
|
|
3
4
|
import type { Database } from "@opengeni/db";
|
|
@@ -9,43 +10,11 @@ type ScheduledTemporalActivityIdentity = {
|
|
|
9
10
|
};
|
|
10
11
|
activityId: string;
|
|
11
12
|
};
|
|
13
|
+
export declare function scheduledTaskRunExecutionPolicy(policy: TurnExecutionPolicyV1, input: DispatchScheduledTaskRunInput, creatorRestriction?: "developer_setup"): TurnExecutionPolicyV1;
|
|
14
|
+
/** Only a creator ceiling is standing; a manual caller ceiling is per-run. */
|
|
15
|
+
export declare function scheduledSessionExecutionPolicyMetadata(policy: unknown, creatorRestriction?: "developer_setup"): Record<string, unknown>;
|
|
12
16
|
export declare function scheduledTaskRunProducerKey(input: DispatchScheduledTaskRunInput, suppliedActivityIdentity?: ScheduledTemporalActivityIdentity): string;
|
|
13
17
|
export declare function scheduledTaskGeneratedSessionCreateIdempotencyKey(producerKey: string): string;
|
|
14
|
-
/**
|
|
15
|
-
* Display title for a session the scheduler generates for a task.
|
|
16
|
-
*
|
|
17
|
-
* A scheduled session's `initialMessage` is the task prompt, byte-identical for
|
|
18
|
-
* every run. The task name is the short human-chosen label that actually
|
|
19
|
-
* identifies it, so that is the title.
|
|
20
|
-
*
|
|
21
|
-
* The title is the task name and NOTHING else. It deliberately does not name the
|
|
22
|
-
* run's fire instant, for two independent reasons:
|
|
23
|
-
*
|
|
24
|
-
* - No run mode guarantees one run per session. `reusable_session` generates
|
|
25
|
-
* its session on the first fire and then reuses it forever, and even under
|
|
26
|
-
* `new_session_per_run` alert-occurrence redelivery converges several runs
|
|
27
|
-
* onto one canonical responder session. `existing_session` never generates a
|
|
28
|
-
* session at all, so the scheduler never titles one. A run-specific fact
|
|
29
|
-
* frozen into the title is therefore right for the generating run and a lie
|
|
30
|
-
* for every run that lands in the same session afterwards.
|
|
31
|
-
* - A title is one stored string shown to every viewer, while every surface
|
|
32
|
-
* that renders a run's fire instant renders it viewer-local: the rail row
|
|
33
|
-
* prints the title beside `relativeTimeLabel(session.updatedAt)`, and the
|
|
34
|
-
* Schedules run list prints `formatTimestamp(run.firedAt)`, which is
|
|
35
|
-
* `toLocaleString()`. A wall clock stored in the title therefore disagrees
|
|
36
|
-
* with the time printed next to it for every viewer outside whichever zone
|
|
37
|
-
* it was rendered in. The task's own `timeZone` is no escape: it labels the
|
|
38
|
-
* schedule rule ("Mon Wed 09:00 Europe/Oslo"), not the rendering of a run,
|
|
39
|
-
* which stays viewer-local. No stored clock can agree with a viewer-local
|
|
40
|
-
* one, so the title carries none and the instant stays on the surfaces that
|
|
41
|
-
* already render it correctly.
|
|
42
|
-
*
|
|
43
|
-
* Dropping the clock settles the determinism constraint outright rather than
|
|
44
|
-
* working around it: the same run titled by the normal dispatch or by a later
|
|
45
|
-
* recovery in a different worker process derives one string from `task.name`
|
|
46
|
-
* alone, with no Intl call and so no host ICU or tzdata build to make the two
|
|
47
|
-
* texts differ.
|
|
48
|
-
*/
|
|
49
18
|
export declare function scheduledTaskSessionTitle(taskName: string): string;
|
|
50
19
|
/**
|
|
51
20
|
* Title a session the scheduler generated, and emit the same `session.title_set`
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type SessionArchiveScope } from "@opengeni/db";
|
|
2
|
+
import { type ObjectStorage } from "@opengeni/storage";
|
|
3
|
+
import type { ControlActivityServices } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Content-free public classification of a failed session archive. Telemetry
|
|
6
|
+
* only exports reviewed error classes and codes, so a raw error name or
|
|
7
|
+
* storage code would be reduced to a generic "OperationError".
|
|
8
|
+
*/
|
|
9
|
+
export declare function sessionArchiveFailureCode(error: unknown): string;
|
|
10
|
+
export declare const SESSION_ARCHIVE_CANDIDATES_PER_PASS = 25;
|
|
11
|
+
/**
|
|
12
|
+
* Soft budget for one archive pass. It shares a workflow (and the Schedule's
|
|
13
|
+
* skip-overlap cadence) with content compaction and delta folding, so a long
|
|
14
|
+
* archive pass would starve them while a backlog drains. Matching the storage
|
|
15
|
+
* pass budget gives both an equal share; unfinished work resumes next pass.
|
|
16
|
+
*/
|
|
17
|
+
export declare const SESSION_ARCHIVE_TIME_BUDGET_MS: number;
|
|
18
|
+
export declare const SESSION_ARCHIVE_STALE_SECONDS: number;
|
|
19
|
+
export declare const SESSION_ARCHIVE_EXPORT_PAGE_ROWS = 200;
|
|
20
|
+
export declare const SESSION_ARCHIVE_PURGE_BATCH_ROWS = 2000;
|
|
21
|
+
type Spool = {
|
|
22
|
+
path: string;
|
|
23
|
+
byteSize: number;
|
|
24
|
+
sha256: string;
|
|
25
|
+
open: () => AsyncIterable<Uint8Array>;
|
|
26
|
+
dispose: () => Promise<void>;
|
|
27
|
+
};
|
|
28
|
+
/** Stream JSON lines through zstd into a private file, metering the compressed bytes. */
|
|
29
|
+
export declare function writeCompressedJsonLines(path: string, produce: (write: (line: string) => Promise<void>) => Promise<void>): Promise<Spool>;
|
|
30
|
+
export declare function sessionArchiveObjectKeys(scope: SessionArchiveScope, archiveId: string): {
|
|
31
|
+
bundle: string;
|
|
32
|
+
transcript: string;
|
|
33
|
+
};
|
|
34
|
+
export type ArchiveSessionOutcome = "archived" | "skipped" | "failed";
|
|
35
|
+
export type SessionArchiveActivityOptions = {
|
|
36
|
+
candidatesPerPass?: number;
|
|
37
|
+
timeBudgetMs?: number;
|
|
38
|
+
now?: () => number;
|
|
39
|
+
upload?: (storage: ObjectStorage, key: string, spool: Spool) => Promise<void>;
|
|
40
|
+
};
|
|
41
|
+
export type ArchiveIdleSessionsResult = {
|
|
42
|
+
enabled: boolean;
|
|
43
|
+
archived: number;
|
|
44
|
+
skipped: number;
|
|
45
|
+
failed: number;
|
|
46
|
+
abandoned: number;
|
|
47
|
+
purgedRows: number;
|
|
48
|
+
objectsDeleted: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* The idle-session archiver. Off unless the deployment enables it; recovery of
|
|
52
|
+
* unfinished archives and deletion of removed sessions' objects always run so
|
|
53
|
+
* that disabling the feature never strands work.
|
|
54
|
+
*/
|
|
55
|
+
export declare function createSessionArchiveActivities(services: () => Promise<ControlActivityServices>, options?: SessionArchiveActivityOptions): {
|
|
56
|
+
archiveIdleSessions: () => Promise<ArchiveIdleSessionsResult>;
|
|
57
|
+
};
|
|
58
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { settleSessionAttemptInterruptions, applySessionTurnSettlement, enqueueSessionWorkflowWake, failSessionWorkBeforeAttemptClaim, blockSessionWorkBeforeAttemptClaim, requestSessionTurnRecovery, recoverSessionDispatch, reconcileSessionAttemptQuiescence, peekSessionWork as peekSessionWorkDb, settleSessionInputWait as settleSessionInputWaitDb, countQueuedTurns, getSessionAttemptActivityRef, getSessionEvent, getSessionTurnForAttempt, expireSessionInteractionIntervention as expireSessionInteractionInterventionDb, expireSessionHumanInputRequest, markSessionAttemptQuiesced, requireSession, settleSessionIdleWithParentOutbox } from "@opengeni/db";
|
|
1
|
+
import { settleSessionAttemptInterruptions, applySessionTurnSettlement, enqueueSessionWorkflowWake, failSessionWorkBeforeAttemptClaim, blockSessionWorkBeforeAttemptClaim, requestSessionTurnRecovery, recoverSessionDispatch, reconcileSettledSessionAttempt, reconcileSessionAttemptQuiescence, reconcileCompletedSandboxSetup, peekSessionWork as peekSessionWorkDb, settleSessionInputWait as settleSessionInputWaitDb, countQueuedTurns, getSessionAttemptActivityRef, getSessionEvent, getSessionTurnForAttempt, getWorkspace, expireSessionInteractionIntervention as expireSessionInteractionInterventionDb, expireScheduledRunHumanWait as expireScheduledRunHumanWaitDb, expireSessionHumanInputRequest, markSessionAttemptQuiesced, requireSession, settleSessionIdleWithParentOutbox } from "@opengeni/db";
|
|
2
2
|
import { publishDurableSessionEvents } from "@opengeni/events";
|
|
3
3
|
import { deliverFailedChildTurnToParent, notifyParentOfChildIdle } from "./parent-wake.js";
|
|
4
4
|
import { recordTurnsQueuedGauge, recordWorkerDeathRecoveryMetrics } from "../observability-metrics.js";
|
|
5
|
-
import type { ControlActivityServices, ExpireSessionHumanInputInput, ExpireSessionHumanInputResult, ExpireSessionInteractionInterventionInput, ExpireSessionInteractionInterventionResult, PeekSessionWorkInput, FailSessionAttemptInput, FailSessionAttemptResult, SettleSessionInterruptionsInput, MarkSessionIdleInput, PersistSessionAttemptQuiescenceInput, ReconcileSessionAttemptQuiescenceInput, ReconcileSessionAttemptQuiescenceResult, RecoverDispatchInput, RecoverDispatchResult, RecoverEscapedMcpTimeoutInput, RecoverEscapedMcpTimeoutResult, SettleSessionInputWaitInput, SettleSessionInputWaitResult } from "./types.js";
|
|
5
|
+
import type { ControlActivityServices, ExpireSessionHumanInputInput, ExpireSessionHumanInputResult, ExpireSessionInteractionInterventionInput, ExpireScheduledRunHumanWaitInput, ExpireScheduledRunHumanWaitResult, ExpireSessionInteractionInterventionResult, PeekSessionWorkInput, FailSessionAttemptInput, FailSessionAttemptResult, SettleSessionInterruptionsInput, MarkSessionIdleInput, PersistSessionAttemptQuiescenceInput, ReconcileSessionAttemptQuiescenceInput, ReconcileSessionAttemptQuiescenceResult, ReconcileSettledSessionAttemptInput, ReconcileSettledSessionAttemptResult, RecoverDispatchInput, RecoverDispatchResult, RecoverEscapedMcpTimeoutInput, RecoverEscapedMcpTimeoutResult, SettleSessionInputWaitInput, SettleSessionInputWaitResult } from "./types.js";
|
|
6
6
|
export type SessionStateActivityOverrides = Partial<{
|
|
7
7
|
settleSessionAttemptInterruptions: typeof settleSessionAttemptInterruptions;
|
|
8
8
|
applySessionTurnSettlement: typeof applySessionTurnSettlement;
|
|
@@ -11,15 +11,19 @@ export type SessionStateActivityOverrides = Partial<{
|
|
|
11
11
|
blockSessionWorkBeforeAttemptClaim: typeof blockSessionWorkBeforeAttemptClaim;
|
|
12
12
|
requestSessionTurnRecovery: typeof requestSessionTurnRecovery;
|
|
13
13
|
recoverSessionDispatch: typeof recoverSessionDispatch;
|
|
14
|
+
reconcileSettledSessionAttempt: typeof reconcileSettledSessionAttempt;
|
|
14
15
|
reconcileSessionAttemptQuiescence: typeof reconcileSessionAttemptQuiescence;
|
|
16
|
+
reconcileCompletedSandboxSetup: typeof reconcileCompletedSandboxSetup;
|
|
15
17
|
peekSessionWork: typeof peekSessionWorkDb;
|
|
16
18
|
settleSessionInputWait: typeof settleSessionInputWaitDb;
|
|
17
19
|
countQueuedTurns: typeof countQueuedTurns;
|
|
18
20
|
getSessionAttemptActivityRef: typeof getSessionAttemptActivityRef;
|
|
19
21
|
getSessionEvent: typeof getSessionEvent;
|
|
20
22
|
getSessionTurnForAttempt: typeof getSessionTurnForAttempt;
|
|
23
|
+
getWorkspace: typeof getWorkspace;
|
|
21
24
|
expireSessionHumanInputRequest: typeof expireSessionHumanInputRequest;
|
|
22
25
|
expireSessionInteractionIntervention: typeof expireSessionInteractionInterventionDb;
|
|
26
|
+
expireScheduledRunHumanWait: typeof expireScheduledRunHumanWaitDb;
|
|
23
27
|
requireSession: typeof requireSession;
|
|
24
28
|
settleSessionIdleWithParentOutbox: typeof settleSessionIdleWithParentOutbox;
|
|
25
29
|
markSessionAttemptQuiesced: typeof markSessionAttemptQuiesced;
|
|
@@ -37,6 +41,7 @@ export declare function createSessionStateActivities(services: () => Promise<Con
|
|
|
37
41
|
}>;
|
|
38
42
|
persistSessionAttemptQuiescence: (input: PersistSessionAttemptQuiescenceInput) => Promise<void>;
|
|
39
43
|
reconcileSessionAttemptQuiescence: (input: ReconcileSessionAttemptQuiescenceInput) => Promise<ReconcileSessionAttemptQuiescenceResult>;
|
|
44
|
+
reconcileSettledSessionAttempt: (input: ReconcileSettledSessionAttemptInput) => Promise<ReconcileSettledSessionAttemptResult>;
|
|
40
45
|
recoverDispatch: (input: RecoverDispatchInput) => Promise<RecoverDispatchResult>;
|
|
41
46
|
recoverEscapedMcpTimeout: (input: RecoverEscapedMcpTimeoutInput) => Promise<RecoverEscapedMcpTimeoutResult>;
|
|
42
47
|
peekSessionWork: (input: PeekSessionWorkInput) => Promise<{
|
|
@@ -52,6 +57,8 @@ export declare function createSessionStateActivities(services: () => Promise<Con
|
|
|
52
57
|
admissionFence?: import("@opengeni/db").SessionAdmissionFence;
|
|
53
58
|
} | {
|
|
54
59
|
kind: "admission-blocked";
|
|
60
|
+
reason?: "sandbox_setup_outcome_unknown" | "sandbox_setup_recovery_exhausted";
|
|
61
|
+
ref?: import("@opengeni/db").SandboxSetupOutcomeUnknown | import("@opengeni/db").SandboxSetupRecoveryExhausted;
|
|
55
62
|
} | {
|
|
56
63
|
kind: "sandbox-lifecycle-wait";
|
|
57
64
|
ref: import("@opengeni/db").SandboxLifecycleWait;
|
|
@@ -63,11 +70,15 @@ export declare function createSessionStateActivities(services: () => Promise<Con
|
|
|
63
70
|
kind: "approval-wait";
|
|
64
71
|
humanInputRequestId?: string;
|
|
65
72
|
interactionInterventionId?: string;
|
|
73
|
+
scheduledRunTimeout?: {
|
|
74
|
+
runId: string;
|
|
75
|
+
turnId: string;
|
|
76
|
+
};
|
|
66
77
|
expiresAt?: string;
|
|
67
78
|
} | {
|
|
68
79
|
kind: "capacity-wait";
|
|
69
80
|
ref: {
|
|
70
|
-
provider?: "codex" | "xai";
|
|
81
|
+
provider?: "codex" | "xai" | "claude";
|
|
71
82
|
waiterId: string;
|
|
72
83
|
generation: number;
|
|
73
84
|
nextCheckAt: string;
|
|
@@ -97,5 +108,6 @@ export declare function createSessionStateActivities(services: () => Promise<Con
|
|
|
97
108
|
settleSessionInputWait: (input: SettleSessionInputWaitInput) => Promise<SettleSessionInputWaitResult>;
|
|
98
109
|
expireSessionHumanInput: (input: ExpireSessionHumanInputInput) => Promise<ExpireSessionHumanInputResult>;
|
|
99
110
|
expireSessionInteractionIntervention: (input: ExpireSessionInteractionInterventionInput) => Promise<ExpireSessionInteractionInterventionResult>;
|
|
111
|
+
expireScheduledRunHumanWait: (input: ExpireScheduledRunHumanWaitInput) => Promise<ExpireScheduledRunHumanWaitResult>;
|
|
100
112
|
markSessionIdle: (input: MarkSessionIdleInput) => Promise<void>;
|
|
101
113
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { compactLegacySessionContent, foldSessionTurnDeltas, listSessionDeltaFoldCandidates } from "@opengeni/db";
|
|
2
|
+
import type { ControlActivityServices } from "./types.js";
|
|
3
|
+
/** Rows per content kind rewritten by one compaction batch. */
|
|
4
|
+
export declare const SESSION_CONTENT_COMPACTION_ROWS_PER_PASS = 200;
|
|
5
|
+
/** A turn's deltas fold once it has been settled this long. */
|
|
6
|
+
export declare const SESSION_DELTA_FOLD_SETTLE_SECONDS: number;
|
|
7
|
+
export declare const SESSION_DELTA_FOLD_TURNS_PER_BATCH = 50;
|
|
8
|
+
/** Soft budget for one pass; the workflow's activity timeout is 15 minutes. */
|
|
9
|
+
export declare const SESSION_STORAGE_PASS_BUDGET_MS: number;
|
|
10
|
+
export type MaintainSessionStorageResult = {
|
|
11
|
+
contentCompaction: {
|
|
12
|
+
scanned: number;
|
|
13
|
+
compacted: number;
|
|
14
|
+
skipped: number;
|
|
15
|
+
failed: number;
|
|
16
|
+
};
|
|
17
|
+
deltaFolding: {
|
|
18
|
+
turns: number;
|
|
19
|
+
runs: number;
|
|
20
|
+
removedRows: number;
|
|
21
|
+
refused: number;
|
|
22
|
+
failed: number;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type SessionStorageActivityOptions = {
|
|
26
|
+
compactionRowsPerPass?: number;
|
|
27
|
+
compactLegacyContent?: typeof compactLegacySessionContent;
|
|
28
|
+
listFoldCandidates?: typeof listSessionDeltaFoldCandidates;
|
|
29
|
+
foldTurn?: typeof foldSessionTurnDeltas;
|
|
30
|
+
foldTurnsPerBatch?: number;
|
|
31
|
+
foldSettleSeconds?: number;
|
|
32
|
+
timeBudgetMs?: number;
|
|
33
|
+
now?: () => number;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Deployment-wide session storage maintenance. Both steps are lossless and
|
|
37
|
+
* therefore always on: legacy content compaction (the database proves every
|
|
38
|
+
* rewrite) and folding the streamed deltas of settled turns (each folded row
|
|
39
|
+
* records every original fragment). Each keeps working through its backlog
|
|
40
|
+
* while it makes progress and the pass has budget left.
|
|
41
|
+
*/
|
|
42
|
+
export declare function createSessionStorageActivities(services: () => Promise<ControlActivityServices>, options?: SessionStorageActivityOptions): {
|
|
43
|
+
maintainSessionStorage: () => Promise<MaintainSessionStorageResult>;
|
|
44
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Database, type SubscriptionCoreTurnIdentity } from "@opengeni/db";
|
|
2
|
+
import type { Settings } from "@opengeni/config";
|
|
3
|
+
/** Codex's per-connection re-read interval (the provider-neutral one). */
|
|
4
|
+
export declare const CODEX_CORE_USAGE_RECHECK_MIN_INTERVAL_MS: number;
|
|
5
|
+
/** Codex's per-scope probe attempt interval (the provider-neutral one). */
|
|
6
|
+
export declare const CODEX_CORE_USAGE_PROBE_ATTEMPT_INTERVAL_MS: number;
|
|
7
|
+
/** Test seam: forget every recorded probe attempt. */
|
|
8
|
+
export declare function resetCodexCoreUsageProbeAttempts(): void;
|
|
9
|
+
/**
|
|
10
|
+
* Before a parked Codex turn's reconcile: one `/wham/usage` read per
|
|
11
|
+
* exhausted connection the work can use whose stored quota was not observed
|
|
12
|
+
* within `CODEX_CORE_USAGE_RECHECK_MIN_INTERVAL_MS`, through the same core
|
|
13
|
+
* probe the usage refresh route uses (`refreshBlockedCoreQuotaBeforeReconcile`
|
|
14
|
+
* bound to Codex: shared connections as the core's service subject, and only
|
|
15
|
+
* the personal connections the exact accepted turn admits).
|
|
16
|
+
*/
|
|
17
|
+
export declare function refreshExhaustedCodexCoreQuota(input: {
|
|
18
|
+
db: Database;
|
|
19
|
+
settings: Settings;
|
|
20
|
+
accountId: string;
|
|
21
|
+
workspaceId: string;
|
|
22
|
+
personalTurn?: SubscriptionCoreTurnIdentity | null;
|
|
23
|
+
fetch?: typeof fetch;
|
|
24
|
+
now?: number;
|
|
25
|
+
}): Promise<void>;
|