@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,12 +1,24 @@
|
|
|
1
|
-
import { type CompactionProviderRejection, type MaterializationVerificationDiagnostic } from "@opengeni/runtime";
|
|
1
|
+
import { type CompactionProviderRejection, type MaterializationVerificationDiagnostic, type ProviderQuotaExhaustion, type ProviderQuotaScope, type AnthropicRequestSize } from "@opengeni/runtime";
|
|
2
2
|
import { type McpTransportRequestFailureDiagnostic } from "@opengeni/runtime/mcp-network";
|
|
3
3
|
import { ApplicationFailure } from "@temporalio/activity";
|
|
4
|
+
import type { ProviderErrorOutcome } from "@opengeni/subscriptions";
|
|
4
5
|
import type { CodexAccountStatus } from "@opengeni/db";
|
|
5
6
|
import type { EscapedMcpTimeoutRecoveryDetail } from "../types.js";
|
|
6
7
|
import { type MandatoryHistoryPersistenceStage } from "./quiescence.js";
|
|
8
|
+
import { type ProviderCondition } from "./provider-recovery-copy.js";
|
|
9
|
+
export { PROVIDER_OVERLOAD_RECOVERY_CODE, MAX_AUTOMATIC_PROVIDER_OVERLOAD_RECOVERIES, PROVIDER_OVERLOAD_RECOVERY_WINDOW_MS, } from "./provider-recovery-policy.js";
|
|
7
10
|
export declare const PROVIDER_BACKPRESSURE_DELAY_MS = 60000;
|
|
8
11
|
export declare const PROVIDER_CONNECTIVITY_BACKOFF_MS: readonly [2000, 5000, 15000, 30000, 60000];
|
|
9
12
|
export declare const MAX_AUTOMATIC_PROVIDER_RECOVERIES: 5;
|
|
13
|
+
export declare function providerRecoveryLimit(failureCode: unknown): number;
|
|
14
|
+
/**
|
|
15
|
+
* Minimum wait per rate-limited recovery. Providers such as Azure OpenAI often
|
|
16
|
+
* answer a per-minute token limit with a `retry-after` of about a second, which
|
|
17
|
+
* alone would spend every automatic recovery before the window resets.
|
|
18
|
+
*/
|
|
19
|
+
export declare const PROVIDER_RATE_LIMIT_BACKOFF_MS: readonly [10000, 20000, 40000, 60000, 120000];
|
|
20
|
+
/** Positive-only spread: never shorten the provider's minimum delay. */
|
|
21
|
+
export declare function providerRecoveryJitterMs(delayMs: number, sample: number): number;
|
|
10
22
|
export declare const POST_COMPACTION_CONTINUATION_EMPTY_CODE = "post_compaction_continuation_empty";
|
|
11
23
|
export declare class PostCompactionContinuationEmptyError extends Error {
|
|
12
24
|
readonly code = "post_compaction_continuation_empty";
|
|
@@ -15,16 +27,44 @@ export declare class PostCompactionContinuationEmptyError extends Error {
|
|
|
15
27
|
export type ProviderRecoveryResult = {
|
|
16
28
|
status: "recovering";
|
|
17
29
|
continueDelayMs: number;
|
|
30
|
+
maxProviderRecoveryCount?: number;
|
|
18
31
|
} | {
|
|
19
32
|
status: "exhausted";
|
|
20
33
|
providerRecoveryCount: number;
|
|
21
34
|
maxProviderRecoveryCount: number;
|
|
35
|
+
providerRecoveryExhaustedReason?: "deadline" | "retry_limit" | "invalid_clock";
|
|
22
36
|
};
|
|
23
37
|
export declare function providerRecoveryResult(input: {
|
|
24
38
|
failureCode: string | undefined;
|
|
25
39
|
attemptNumber: number;
|
|
26
40
|
retryAfterMs?: number | null;
|
|
41
|
+
jitterSample?: number;
|
|
42
|
+
/** Durable first-failure clock, never a new clock on each replacement attempt. */
|
|
43
|
+
recoveryStartedAt?: number | undefined;
|
|
44
|
+
now?: number;
|
|
27
45
|
}): ProviderRecoveryResult;
|
|
46
|
+
/** A timer/queue delay cannot authorize a provider call after the recovery window. */
|
|
47
|
+
export declare class ProviderOverloadRecoveryExpiredError extends Error {
|
|
48
|
+
readonly failure: {
|
|
49
|
+
error: string;
|
|
50
|
+
code: string;
|
|
51
|
+
providerCondition: "overloaded";
|
|
52
|
+
} & {
|
|
53
|
+
retryable: false;
|
|
54
|
+
recoveryExhausted: true;
|
|
55
|
+
providerRecoveryCount: number;
|
|
56
|
+
maxProviderRecoveryCount: number;
|
|
57
|
+
lastRetryableError: string;
|
|
58
|
+
providerRecoveryExhaustedReason?: "deadline" | "retry_limit" | "invalid_clock";
|
|
59
|
+
};
|
|
60
|
+
constructor(count: number, reason: "deadline" | "retry_limit" | "invalid_clock");
|
|
61
|
+
}
|
|
62
|
+
export declare function assertProviderOverloadRecoveryActive(input: {
|
|
63
|
+
failureCode: unknown;
|
|
64
|
+
providerRecoveryCount: number;
|
|
65
|
+
recoveryStartedAt?: number | undefined;
|
|
66
|
+
now?: number;
|
|
67
|
+
}): void;
|
|
28
68
|
export declare function providerRecoveryExhaustedFailure<T extends Record<string, unknown> & {
|
|
29
69
|
error: string;
|
|
30
70
|
}>(failure: T, recovery: Extract<ProviderRecoveryResult, {
|
|
@@ -35,6 +75,36 @@ export declare function providerRecoveryExhaustedFailure<T extends Record<string
|
|
|
35
75
|
providerRecoveryCount: number;
|
|
36
76
|
maxProviderRecoveryCount: number;
|
|
37
77
|
lastRetryableError: string;
|
|
78
|
+
providerRecoveryExhaustedReason?: "deadline" | "retry_limit" | "invalid_clock";
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* A retryable failure whose automatic same-turn recovery was not authorized
|
|
82
|
+
* (for example, request custody could not be checkpointed). The classifier's
|
|
83
|
+
* "will retry" sentence would be false on a terminal record, so name the
|
|
84
|
+
* condition and the person's options instead.
|
|
85
|
+
*/
|
|
86
|
+
export declare function automaticRecoveryUnavailableFailure<T extends Record<string, unknown> & {
|
|
87
|
+
error: string;
|
|
88
|
+
}>(failure: T): T & {
|
|
89
|
+
retryable: false;
|
|
90
|
+
automaticRecovery: "unavailable";
|
|
91
|
+
lastRetryableError: string;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Name the exact accepted model route on model-provider recovery evidence so a
|
|
95
|
+
* person learns which model is affected. Display labels only: the route's
|
|
96
|
+
* credentials, base URL and upstream ids never enter the event.
|
|
97
|
+
*/
|
|
98
|
+
export declare function withModelRoutePresentation<T extends {
|
|
99
|
+
code?: string | undefined;
|
|
100
|
+
}>(failure: T, route: {
|
|
101
|
+
model: string;
|
|
102
|
+
modelLabel: string;
|
|
103
|
+
providerLabel: string;
|
|
104
|
+
} | undefined): T & {
|
|
105
|
+
model?: string;
|
|
106
|
+
modelLabel?: string;
|
|
107
|
+
providerLabel?: string;
|
|
38
108
|
};
|
|
39
109
|
export declare function providerRecoveryCountFromMetadata(metadata: Record<string, unknown>): number;
|
|
40
110
|
export declare function providerRecoveryCountAfterModelRequestPhase(currentCount: number, phase: string): number;
|
|
@@ -74,18 +144,30 @@ export declare function escapedMcpTimeoutRecoveryFailure(input: {
|
|
|
74
144
|
*/
|
|
75
145
|
export declare function preClaimAdmissionFailure(error: unknown): ApplicationFailure;
|
|
76
146
|
/**
|
|
77
|
-
*
|
|
78
|
-
* recovery
|
|
79
|
-
*
|
|
147
|
+
* True when an error is a structured database failure that the exact-attempt
|
|
148
|
+
* database recovery path owns. Callers that translate other failures into
|
|
149
|
+
* user-visible states must rethrow these unchanged.
|
|
150
|
+
*/
|
|
151
|
+
export declare function isPostClaimDatabaseRecoveryCandidate(error: unknown): boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Carry one exact claimed attempt into the workflow's DB-only
|
|
154
|
+
* recovery lane. Permanent database/state failures remain terminal. The
|
|
155
|
+
* running-turn lane additionally requires a closed own-client outage class;
|
|
156
|
+
* existing pre-execution recovery classifications are unchanged.
|
|
80
157
|
*/
|
|
81
158
|
export declare function postClaimDatabaseRecoveryFailure(input: {
|
|
82
159
|
error: unknown;
|
|
83
160
|
turnId: string;
|
|
84
161
|
triggerEventId: string;
|
|
85
162
|
executionGeneration: number;
|
|
163
|
+
/** Require an actual own-client boundary and the closed running-turn allowlist. */
|
|
164
|
+
requireDatabaseProvenance?: boolean;
|
|
165
|
+
sandboxSetupOutcomeUnknown?: true;
|
|
166
|
+
sandboxSetupRecoveryExhausted?: true;
|
|
86
167
|
providerRecovery?: {
|
|
87
168
|
failureCode: string;
|
|
88
169
|
providerRecoveryCount: number;
|
|
170
|
+
continueDelayMs?: number;
|
|
89
171
|
};
|
|
90
172
|
}): ApplicationFailure | null;
|
|
91
173
|
/**
|
|
@@ -108,19 +190,16 @@ export type SandboxLifecycleTransitionDiagnostic = {
|
|
|
108
190
|
* cross-package error object is accepted.
|
|
109
191
|
*/
|
|
110
192
|
export declare function sandboxLifecycleTransitionDiagnostic(error: unknown): SandboxLifecycleTransitionDiagnostic | null;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
* message text, which could originate in model or tool content.
|
|
122
|
-
*/
|
|
123
|
-
export declare function sandboxRouteTransitionCode(error: unknown): "home_unavailable_this_turn" | "workspace_root_changed_this_turn" | null;
|
|
193
|
+
export declare function modelPreparationFailureEventPayload(error: unknown, durationMs: number): {
|
|
194
|
+
phase: string;
|
|
195
|
+
durationMs: number;
|
|
196
|
+
expectedTransition: boolean;
|
|
197
|
+
failureCategory?: string;
|
|
198
|
+
failureStage?: string;
|
|
199
|
+
failureCode?: "capture_in_progress" | "provider_recovery_in_progress" | "rotation_in_progress";
|
|
200
|
+
retryable?: boolean;
|
|
201
|
+
};
|
|
202
|
+
export declare function sandboxRouteTransitionCode(error: unknown): "home_unavailable_this_turn" | "workspace_root_changed_this_turn" | "native_capabilities_changed_this_attempt" | "home_backend_recovery_pending" | null;
|
|
124
203
|
export declare function isSandboxRouteTransitionError(error: unknown): boolean;
|
|
125
204
|
/** Backward-compatible name for callers/tests that only exercised the original
|
|
126
205
|
* machine-to-home transition. */
|
|
@@ -168,6 +247,7 @@ export declare function compactionFailureTurnEventPayload(error: unknown, overri
|
|
|
168
247
|
recovery: "user_message";
|
|
169
248
|
compacted: false;
|
|
170
249
|
providerRejection?: CompactionProviderRejection;
|
|
250
|
+
quotaScope?: ProviderQuotaScope;
|
|
171
251
|
};
|
|
172
252
|
export declare function isCompactionSummaryFailure(error: unknown): boolean;
|
|
173
253
|
export declare function shouldRecoverCompactionProviderFailure(error: unknown): boolean;
|
|
@@ -233,22 +313,53 @@ export declare function collectErrorStrings(value: unknown, seen?: WeakSet<objec
|
|
|
233
313
|
* same-execution retry.
|
|
234
314
|
*/
|
|
235
315
|
export declare const STATUSLESS_UPSTREAM_CONNECTIVITY_MESSAGE = "unable to connect. is the computer able to access the url?";
|
|
316
|
+
/** Bun's exact fetch text when an upstream drops an open connection. */
|
|
317
|
+
export declare const STATUSLESS_UPSTREAM_SOCKET_CLOSED_MESSAGE = "the socket connection was closed unexpectedly. for more information, pass `verbose: true` in the second argument to fetch()";
|
|
236
318
|
export declare function isExactStatuslessUpstreamConnectivityMessage(message: string): boolean;
|
|
319
|
+
/**
|
|
320
|
+
* A fetch-layer timeout: the runtime's DOMException `TimeoutError` (message
|
|
321
|
+
* "The operation timed out."), possibly wrapped by SDK/runner `cause` chains.
|
|
322
|
+
* Explicit cancellation (`AbortError`) is deliberately not matched.
|
|
323
|
+
*/
|
|
324
|
+
export declare function isTransportTimeoutError(error: unknown): boolean;
|
|
237
325
|
export declare function isTransientProviderError(error: unknown): boolean;
|
|
238
|
-
export type XaiCredentialFailure = {
|
|
239
|
-
kind: "auth" | "forbidden" | "rate_limit";
|
|
240
|
-
cooldownMs: number | null;
|
|
241
|
-
};
|
|
242
326
|
/**
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
327
|
+
* Recognize an exhausted API-key provider quota (a daily or monthly allowance,
|
|
328
|
+
* a free-tier day cap, or an account out of credits) as distinct from an
|
|
329
|
+
* ordinary per-minute rate limit. Retrying within the bounded same-turn budget
|
|
330
|
+
* cannot succeed, so the turn fails promptly instead. Subscription transports
|
|
331
|
+
* own their quota semantics through credential rotation and durable capacity
|
|
332
|
+
* waits, so a Codex, SuperGrok or Claude subscription transport error never
|
|
333
|
+
* classifies here.
|
|
247
334
|
*/
|
|
248
|
-
export declare function
|
|
335
|
+
export declare function classifyProviderQuotaExhaustionError(error: unknown): ProviderQuotaExhaustion | null;
|
|
336
|
+
/** A refusal raised by a Claude subscription (OAuth) transport, at any wrapper depth. */
|
|
337
|
+
export declare function isClaudeSubscriptionTransportError(error: unknown): boolean;
|
|
338
|
+
/**
|
|
339
|
+
* SuperGrok's classification of a failed model request as a shared provider
|
|
340
|
+
* outcome (the adapter's `classifyError`, SuperGrok track X1b): a refresh
|
|
341
|
+
* relogin or a marked 401 is `unauthorized`, a marked 403 `forbidden`, and a
|
|
342
|
+
* marked 429 or HTTP 200 SSE capacity terminal `rate_limited` with the
|
|
343
|
+
* provider's retry time (null when it gave none: the adapter's fallback
|
|
344
|
+
* applies). Anything else, a provider safety refusal included, is null: not
|
|
345
|
+
* a refusal of the account.
|
|
346
|
+
*/
|
|
347
|
+
export declare function classifyXaiProviderError(error: unknown): ProviderErrorOutcome | null;
|
|
249
348
|
export declare function agentRunFailurePayload(error: unknown, options?: {
|
|
250
349
|
isCodexTurn?: boolean;
|
|
251
350
|
}): ReturnType<typeof baseAgentRunFailurePayload>;
|
|
351
|
+
/** HTTP 529, Anthropic `overloaded_error`, or explicit provider "overloaded" wording. */
|
|
352
|
+
export declare function isProviderOverloadError(error: unknown, failure?: {
|
|
353
|
+
error?: string;
|
|
354
|
+
detail?: string;
|
|
355
|
+
}): boolean;
|
|
356
|
+
/** Retry authority must not depend on the looser presentation-only overload label. */
|
|
357
|
+
export declare function providerRecoveryCode(error: unknown, failure: {
|
|
358
|
+
code?: string;
|
|
359
|
+
retryable?: boolean;
|
|
360
|
+
}): string | undefined;
|
|
361
|
+
/** Keep Anthropic provider text on terminal failures, never recovery events. */
|
|
362
|
+
export declare function agentRunRecoveryFailurePayload(error: unknown, failure: ReturnType<typeof agentRunFailurePayload>): ReturnType<typeof agentRunFailurePayload>;
|
|
252
363
|
declare function baseAgentRunFailurePayload(error: unknown, options?: {
|
|
253
364
|
isCodexTurn?: boolean;
|
|
254
365
|
}): {
|
|
@@ -271,10 +382,31 @@ declare function baseAgentRunFailurePayload(error: unknown, options?: {
|
|
|
271
382
|
historyPersistenceStage?: MandatoryHistoryPersistenceStage;
|
|
272
383
|
mcpTransportDiagnostic?: McpTransportRequestFailureDiagnostic;
|
|
273
384
|
materializationDiagnostic?: MaterializationVerificationDiagnostic;
|
|
385
|
+
requestSize?: AnthropicRequestSize;
|
|
386
|
+
quotaScope?: ProviderQuotaScope;
|
|
387
|
+
/** Closed Codex plan key on `codex_plan_entitlement` / `codex_request_rejected`. */
|
|
388
|
+
planType?: string | null;
|
|
389
|
+
/** Product model id a `codex_plan_entitlement` or model-provider recovery failure refers to. */
|
|
390
|
+
model?: string | null;
|
|
391
|
+
/** Display label of the turn's model on model-provider recovery evidence. */
|
|
392
|
+
modelLabel?: string;
|
|
393
|
+
/** Display label of the serving provider on model-provider recovery evidence. */
|
|
394
|
+
providerLabel?: string;
|
|
395
|
+
/** Closed transient provider condition on `provider_unavailable` / `provider_rate_limited`. */
|
|
396
|
+
providerCondition?: ProviderCondition;
|
|
397
|
+
recoveryExhausted?: boolean;
|
|
398
|
+
providerRecoveryCount?: number;
|
|
399
|
+
maxProviderRecoveryCount?: number;
|
|
400
|
+
providerRecoveryExhaustedReason?: "deadline" | "retry_limit" | "invalid_clock";
|
|
274
401
|
};
|
|
275
402
|
export type CodexCredentialFailure = {
|
|
276
|
-
|
|
403
|
+
/**
|
|
404
|
+
* `plan_entitlement` is produced only after a plan re-check proves the
|
|
405
|
+
* serving account's current plan does not include the requested model.
|
|
406
|
+
*/
|
|
407
|
+
kind: "auth" | "forbidden" | "rate_limit" | "quota" | "plan_entitlement";
|
|
277
408
|
cooldownSeconds: number | null;
|
|
409
|
+
origin?: "included_usage_policy" | "usage_verification_policy";
|
|
278
410
|
};
|
|
279
411
|
export declare const CODEX_ALLOWANCE_FALLBACK_MS: number;
|
|
280
412
|
/**
|
|
@@ -310,4 +442,16 @@ export declare function codexUsageLimitFailurePayload(info: {
|
|
|
310
442
|
detail?: string;
|
|
311
443
|
};
|
|
312
444
|
export declare const CODEX_USAGE_LIMIT_MAX_RESUME_MS: number;
|
|
313
|
-
|
|
445
|
+
/**
|
|
446
|
+
* Claude's classification of a failed model request as a shared provider
|
|
447
|
+
* outcome (the adapter's `classifyError`, Claude track C1b), for a request
|
|
448
|
+
* of the Claude subscription transport only: a reconnect-required refresh or
|
|
449
|
+
* HTTP 401 is `unauthorized` (the transport already ran the turn's one
|
|
450
|
+
* forced refresh); 429 is `rate_limited` for the turn's model `modelId`, with
|
|
451
|
+
* the provider's retry time (null: the adapter's fallback applies); 529 or
|
|
452
|
+
* `overloaded_error` is `overloaded`, which never moves the turn to another
|
|
453
|
+
* account; 403 is `fatal`, which never rotates or quarantines the account.
|
|
454
|
+
* Anything else, a provider safety refusal included, is null: not a refusal
|
|
455
|
+
* of the account.
|
|
456
|
+
*/
|
|
457
|
+
export declare function classifyClaudeProviderError(error: unknown, modelId?: string): ProviderErrorOutcome | null;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Settings } from "@opengeni/config";
|
|
2
2
|
import type { TurnActivityServices as ActivityServices, RunAgentTurnInput, RunAgentTurnResult } from "../types.js";
|
|
3
3
|
import { createTurnCredentialLeases } from "./credential-leases.js";
|
|
4
4
|
import { createTurnHistorySink } from "./history-sink.js";
|
|
5
|
-
import
|
|
5
|
+
import { agentRunFailurePayload } from "./errors.js";
|
|
6
|
+
import type { AttemptIdentityState, BillingState, CodexSubscriptionCoreTurn, EventingState, ProviderTurnState, TurnControlState } from "./turn-context.js";
|
|
6
7
|
export type TurnFailureDeps = {
|
|
7
8
|
error: unknown;
|
|
8
9
|
input: RunAgentTurnInput;
|
|
@@ -11,6 +12,8 @@ export type TurnFailureDeps = {
|
|
|
11
12
|
bus: ActivityServices["bus"];
|
|
12
13
|
observability: ActivityServices["observability"];
|
|
13
14
|
wakeSessionWorkflow: ActivityServices["wakeSessionWorkflow"];
|
|
15
|
+
/** Typed capacity-wake signals of core waiters (a refusal's joined observations may wake them). */
|
|
16
|
+
signalCodexCapacityWorkflow?: ActivityServices["signalCodexCapacityWorkflow"];
|
|
14
17
|
cancellationSignal: AbortSignal | undefined;
|
|
15
18
|
sandboxRotationController: AbortController;
|
|
16
19
|
noteCancellationRequested: () => void;
|
|
@@ -30,46 +33,10 @@ export type TurnFailureDeps = {
|
|
|
30
33
|
acknowledgeRecoveryQuiescence: () => void;
|
|
31
34
|
};
|
|
32
35
|
export type CodexDefinitiveFailureDisposition = "failover" | "wait" | "terminal";
|
|
33
|
-
|
|
34
|
-
error: string;
|
|
35
|
-
code: string;
|
|
36
|
-
detail?: string;
|
|
37
|
-
retryable: false;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Pure policy for a definitive serving-credential refusal. A policy-constrained
|
|
41
|
-
* account and an all-unavailable pool wait for the same selected capacity to
|
|
42
|
-
* recover; only a truly empty/non-allocatable pool makes an auth/forbidden
|
|
43
|
-
* failure terminal. A different eligible account under rotation-on policy may
|
|
44
|
-
* recover the same durable turn immediately.
|
|
45
|
-
*/
|
|
46
|
-
export declare function codexDefinitiveFailureDisposition(input: {
|
|
47
|
-
failureKind: "auth" | "forbidden" | "rate_limit" | "quota";
|
|
48
|
-
rotationEnabled: boolean;
|
|
49
|
-
pinDisposition: "manual" | "sharded" | "clearStale" | "unpinned";
|
|
50
|
-
decisionKind: "active" | "allCapped" | "none";
|
|
51
|
-
decisionCredentialId: string | null;
|
|
52
|
-
servingCredentialId: string;
|
|
53
|
-
}): CodexDefinitiveFailureDisposition;
|
|
36
|
+
export declare function settleTurnFailure(deps: TurnFailureDeps): Promise<RunAgentTurnResult>;
|
|
54
37
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* requires a positive bound even though one-account paths never fail over.
|
|
38
|
+
* Classify a Codex failure whose only replay obstacle is this attempt's own
|
|
39
|
+
* interrupted request. Returns the retryable failure the bounded provider
|
|
40
|
+
* recovery should use, or null when the unknown outcome must stay terminal.
|
|
59
41
|
*/
|
|
60
|
-
export declare function
|
|
61
|
-
id: string;
|
|
62
|
-
allocatorEnabled: boolean;
|
|
63
|
-
}>, servingCredentialId: string): number;
|
|
64
|
-
/** Build the durable waiter payload without collapsing quota refusals into 403. */
|
|
65
|
-
export declare function codexCapacityWaitFailurePayload(input: {
|
|
66
|
-
failureKind: "auth" | "forbidden" | "rate_limit" | "quota";
|
|
67
|
-
usageLimit: {
|
|
68
|
-
resetsInSeconds: number | null;
|
|
69
|
-
} | null;
|
|
70
|
-
cooldownSeconds: number | null;
|
|
71
|
-
detail: string;
|
|
72
|
-
allAccounts: boolean;
|
|
73
|
-
}): CodexCapacityWaitFailurePayload;
|
|
74
|
-
export declare function settleTurnFailure(deps: TurnFailureDeps): Promise<RunAgentTurnResult>;
|
|
75
|
-
export {};
|
|
42
|
+
export declare function ownInterruptedCodexRequestRecovery(error: unknown, core: Pick<CodexSubscriptionCoreTurn, "requests">, isCodexTurn: boolean): ReturnType<typeof agentRunFailurePayload> | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** One durable, same-logical-turn handoff, not a retry of model/tool effects. */
|
|
2
|
+
export declare function finalReplyNudge(turnId: string): {
|
|
3
|
+
type: "message";
|
|
4
|
+
role: "developer";
|
|
5
|
+
content: {
|
|
6
|
+
type: "input_text";
|
|
7
|
+
text: string;
|
|
8
|
+
}[];
|
|
9
|
+
};
|
|
10
|
+
export declare function hasFinalReplyNudge(history: readonly unknown[], turnId: string): boolean;
|
|
11
|
+
export declare function needsFinalReply(input: {
|
|
12
|
+
output: unknown;
|
|
13
|
+
inputWaitYielded: boolean;
|
|
14
|
+
interrupted: boolean;
|
|
15
|
+
maintenance: boolean;
|
|
16
|
+
toolsExecuted: boolean;
|
|
17
|
+
completedGoal: boolean;
|
|
18
|
+
}): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Observability } from "@opengeni/observability";
|
|
2
2
|
import type { TurnHeartbeatDetails } from "../../op-journal.js";
|
|
3
3
|
export declare const TURN_FINALIZATION_STAGES: readonly ["tool_writers", "credential_renewals", "credential_cleanup", "quiescence_receipt", "event_flush", "provider_leases", "workspace_capture", "tool_close", "sandbox_provisioning", "sandbox_rotation", "workspace_snapshot", "sandbox_release"];
|
|
4
4
|
export type TurnFinalizationStage = (typeof TURN_FINALIZATION_STAGES)[number];
|
|
@@ -8,7 +8,12 @@ export declare function startTurnFinalizationMonitor(input: {
|
|
|
8
8
|
observability: Observability;
|
|
9
9
|
details: TurnHeartbeatDetails;
|
|
10
10
|
heartbeat: (details: TurnHeartbeatDetails) => void;
|
|
11
|
-
|
|
11
|
+
requestWorkerDrain: () => void;
|
|
12
|
+
execution?: {
|
|
13
|
+
workspaceId: string;
|
|
14
|
+
sessionId: string;
|
|
15
|
+
attemptId: string;
|
|
16
|
+
};
|
|
12
17
|
timeoutMs?: number;
|
|
13
18
|
slowAfterMs?: number;
|
|
14
19
|
}): {
|
|
@@ -16,6 +16,8 @@ export type TurnFinalizationDeps = {
|
|
|
16
16
|
wakeSessionWorkflow: ActivityServices["wakeSessionWorkflow"];
|
|
17
17
|
signalSessionAttemptQuiesced: ActivityServices["signalSessionAttemptQuiesced"];
|
|
18
18
|
signalCodexCapacityWorkflow: ActivityServices["signalCodexCapacityWorkflow"];
|
|
19
|
+
requestWorkerDrain: ActivityServices["requestWorkerDrain"];
|
|
20
|
+
turnFinalizationTimeoutMs: ActivityServices["turnFinalizationTimeoutMs"];
|
|
19
21
|
cancellationSignal: AbortSignal | undefined;
|
|
20
22
|
sandboxResumeController: AbortController;
|
|
21
23
|
activityContext: ReturnType<typeof currentActivityContext>;
|
|
@@ -76,6 +76,8 @@ export type ApplyTurnGitHubRepositoryBindingsInput = {
|
|
|
76
76
|
workspaceId: string;
|
|
77
77
|
sessionId: string;
|
|
78
78
|
activeSandboxBackend: Settings["sandboxBackend"] | undefined;
|
|
79
|
+
/** Product-owned credentials take precedence over inferred platform bindings. */
|
|
80
|
+
hasCredentialProvider?: boolean;
|
|
79
81
|
claimedTurnResources: readonly ResourceRef[];
|
|
80
82
|
claimedRuntimeResources: readonly ResourceRef[];
|
|
81
83
|
/** Publishes one attempt-fenced session event batch. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { materializeRigVersionForAttempt } from "@opengeni/db";
|
|
1
|
+
import { materializeRigVersionForAttempt, freezeAgentLearningPolicy } from "@opengeni/db";
|
|
2
2
|
import { renderWorkspaceGovernanceContext, type OpenGeniRuntime } from "@opengeni/runtime";
|
|
3
3
|
import { type Settings } from "@opengeni/config";
|
|
4
4
|
import { createModelHistoryAttachmentProjector } from "../run-input.js";
|
|
@@ -9,8 +9,10 @@ import { lazyToolTransportForTurn, openAiHostedImageProviderBindingForTurn, mode
|
|
|
9
9
|
import type { ClaimTurnOk } from "./claim.js";
|
|
10
10
|
import type { EventingState, WorkspaceRefState } from "./turn-context.js";
|
|
11
11
|
export type GovernanceModelDeps = {
|
|
12
|
+
learningPolicy: Awaited<ReturnType<typeof freezeAgentLearningPolicy>>;
|
|
12
13
|
input: RunAgentTurnInput;
|
|
13
14
|
db: ActivityServices["db"];
|
|
15
|
+
observability: ActivityServices["observability"];
|
|
14
16
|
runtime: ActivityServices["runtime"];
|
|
15
17
|
objectStorage: ActivityServices["objectStorage"];
|
|
16
18
|
eventing: EventingState;
|
|
@@ -37,9 +39,19 @@ export type GovernanceModelOk = {
|
|
|
37
39
|
rigVersion: NonNullable<Awaited<ReturnType<typeof materializeRigVersionForAttempt>>>["version"] | null;
|
|
38
40
|
rigName: string | null;
|
|
39
41
|
agentHumanInputEnabled: boolean;
|
|
42
|
+
/** Deployment and workspace allow the Jev-backed code_search tool. */
|
|
43
|
+
codeSearchEnabled: boolean;
|
|
40
44
|
workspaceAgentInstructions: string | null | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Modular composer identity tier: the explicit workspace default identity,
|
|
47
|
+
* else the frozen legacy persona without `{{core}}`. Never dropped by
|
|
48
|
+
* instruction policies (only read for sessions with an agent configuration).
|
|
49
|
+
*/
|
|
50
|
+
workspaceAgentIdentity: string | null;
|
|
41
51
|
workspaceGovernance: ReturnType<typeof renderWorkspaceGovernanceContext>;
|
|
42
52
|
structuredWorkspacePolicyActive: boolean;
|
|
53
|
+
/** False when the workspace turned Opengeni credits off (model policy). */
|
|
54
|
+
workspaceCreditModelsAllowed: boolean;
|
|
43
55
|
workspaceMemory: string | null | undefined;
|
|
44
56
|
buildCompanyBrainContributionReceiptFor: (skillCatalogText: string) => ReturnType<typeof buildCompanyBrainContributionReceipt>;
|
|
45
57
|
logicalSandboxSettings: Settings;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type OpenGeniRuntime } from "@opengeni/runtime";
|
|
2
|
-
import type
|
|
2
|
+
import { type Settings } from "@opengeni/config";
|
|
3
3
|
import type { SharedActivityServices } from "../types.js";
|
|
4
4
|
import type { turnInput } from "../run-input.js";
|
|
5
5
|
import type { TurnMediaArtifacts } from "./media-artifacts.js";
|
|
@@ -41,6 +41,7 @@ export type TurnHistorySinkDeps = {
|
|
|
41
41
|
export declare class TurnHistorySink {
|
|
42
42
|
private readonly deps;
|
|
43
43
|
private readonly prefix;
|
|
44
|
+
private checkpointTail;
|
|
44
45
|
seedHistory(input: string | readonly unknown[] | {
|
|
45
46
|
readonly history: unknown[];
|
|
46
47
|
}, count: number): void;
|
|
@@ -52,5 +53,6 @@ export declare class TurnHistorySink {
|
|
|
52
53
|
skipInputOnlyRows?: boolean;
|
|
53
54
|
requireDurable?: boolean;
|
|
54
55
|
}) => Promise<void>;
|
|
56
|
+
private reconcile;
|
|
55
57
|
}
|
|
56
58
|
export declare function createTurnHistorySink(deps: TurnHistorySinkDeps): TurnHistorySink;
|
|
@@ -49,6 +49,8 @@ export declare function pendingToolCallFromSdkEvent(event: unknown): {
|
|
|
49
49
|
} | null;
|
|
50
50
|
/** Tools whose intentional visual result must survive inline-media sanitization. */
|
|
51
51
|
export declare function toolCallProducesRetainableSessionImage(name: string | null): boolean;
|
|
52
|
+
/** Browser interactions can carry an image block, including opt-in observe frames. */
|
|
53
|
+
export declare function retainableBrowserScreenshotToolCall(name: string | null): boolean;
|
|
52
54
|
export declare function completedToolCallFromSdkEvent(event: unknown): {
|
|
53
55
|
callId: string;
|
|
54
56
|
resultItem: Record<string, unknown>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type Database } from "@opengeni/db";
|
|
2
|
+
import type { TurnInitiator, TurnInitiatorContext } from "@opengeni/contracts";
|
|
3
|
+
type ReplyTurn = {
|
|
4
|
+
source?: string | undefined;
|
|
5
|
+
initiator: TurnInitiator;
|
|
6
|
+
initiatorContext: TurnInitiatorContext;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Whether a turn answers a message a person sent, directly or through an API
|
|
10
|
+
* caller that relays one (an embedding host, a realtime delegation). The
|
|
11
|
+
* source alone is not enough: every session's first turn is `user`, including
|
|
12
|
+
* a child an agent spawned and a session a scheduled task created.
|
|
13
|
+
*/
|
|
14
|
+
export declare function turnAnswersMessage(turn: ReplyTurn): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The reply `turn.completed` records when a turn ends through `wait_for_input`
|
|
17
|
+
* (read back with `turnCompletedReply` in `@opengeni/contracts`).
|
|
18
|
+
*
|
|
19
|
+
* Such a turn settles with an empty `output`: the wait, not an answer, ended
|
|
20
|
+
* it. When the turn answers a person's message, its latest assistant message
|
|
21
|
+
* is still that message's answer, for example a status reply given before
|
|
22
|
+
* waiting again on work in flight. That message shares its model response with
|
|
23
|
+
* the wait call, so it streams as commentary, which is activity everywhere
|
|
24
|
+
* else. Recording it lets unread attention and Slack treat it as the answer
|
|
25
|
+
* without relabelling the provider's phase in stored history. Turns that
|
|
26
|
+
* machine input, an agent or a worker-owned producer started only narrate
|
|
27
|
+
* progress and record nothing.
|
|
28
|
+
*
|
|
29
|
+
* The message this activity completed last is the newest. An activity that
|
|
30
|
+
* resumed the turn (after an approval, a human-input answer or a recovery) and
|
|
31
|
+
* completed none reads the turn's latest durable message instead.
|
|
32
|
+
*/
|
|
33
|
+
export declare function inputWaitReply(input: {
|
|
34
|
+
inputWaitYielded: boolean;
|
|
35
|
+
turn: ReplyTurn;
|
|
36
|
+
latestAssistantMessageText: string | null;
|
|
37
|
+
readLatestDurableTurnMessage: () => Promise<string | null>;
|
|
38
|
+
}): Promise<string | null>;
|
|
39
|
+
/**
|
|
40
|
+
* Text of the newest current `agent.message.completed` this turn persisted,
|
|
41
|
+
* or null when the session's newest completion belongs to another turn.
|
|
42
|
+
*/
|
|
43
|
+
export declare function latestDurableTurnMessageText(db: Database, input: {
|
|
44
|
+
workspaceId: string;
|
|
45
|
+
sessionId: string;
|
|
46
|
+
turnId: string;
|
|
47
|
+
}): Promise<string | null>;
|
|
48
|
+
/**
|
|
49
|
+
* Tool error the model receives when it waits before answering a person.
|
|
50
|
+
*
|
|
51
|
+
* Models with extended thinking often draft the reply inside their thinking
|
|
52
|
+
* and believe it was sent, then retry the wait unchanged and conclude that a
|
|
53
|
+
* wait cannot be armed at all. The text therefore names thinking explicitly and
|
|
54
|
+
* says the reply may share the wait call's response.
|
|
55
|
+
*/
|
|
56
|
+
export declare const INPUT_WAIT_REPLY_REFUSAL = "wait_for_input was not registered: this turn answers a person's message and you have not written a visible reply yet. Your reasoning is not shown to them: text inside a thinking or reasoning block does not count, even when it is written as an answer. Write your answer to their message as a normal assistant text block (it may be in the same response, before the wait_for_input call), then call wait_for_input again. If an earlier wait is still armed, pass the time remaining on its deadline rather than a fresh timeout.";
|
|
57
|
+
/**
|
|
58
|
+
* Refusals per turn attempt (one worker activity); a resumed or retried
|
|
59
|
+
* attempt starts again. After that the wait proceeds rather than looping.
|
|
60
|
+
*/
|
|
61
|
+
export declare const MAX_INPUT_WAIT_REPLY_REFUSALS = 2;
|
|
62
|
+
/**
|
|
63
|
+
* Why `wait_for_input` must not end this turn yet, or null.
|
|
64
|
+
*
|
|
65
|
+
* A wait ends the turn at the tool boundary, so no message can follow it. When
|
|
66
|
+
* the turn answers a person's message and has no visible assistant text, the
|
|
67
|
+
* person would get no answer at all (the model may have drafted one only in its
|
|
68
|
+
* reasoning). Refusing the wait as a tool error gives the model one more step
|
|
69
|
+
* to write the reply; the wait is registered on its next call.
|
|
70
|
+
*/
|
|
71
|
+
export declare function inputWaitReplyRefusal(input: {
|
|
72
|
+
turn: ReplyTurn;
|
|
73
|
+
refusalsSoFar: number;
|
|
74
|
+
hasVisibleReply: () => Promise<boolean>;
|
|
75
|
+
}): Promise<string | null>;
|
|
76
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conservative progress evidence for a model response that reaches the worker
|
|
3
|
+
* as an SDK `response_done` event (providers without their own request
|
|
4
|
+
* events): completed assistant text or a complete function call. Reasoning,
|
|
5
|
+
* usage, an incomplete message and empty bookkeeping are not work. The shared
|
|
6
|
+
* false-resumption breaker of core waiters reads this through
|
|
7
|
+
* `agent.model.request` `meaningfulOutput`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function sdkResponseHasMeaningfulOutput(event: unknown): boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type CodemodeTokenWriterSession, type RetainableSessionImageOutputHook, type TurnToolCancellationFence } from "@opengeni/runtime";
|
|
2
2
|
import type { Settings } from "@opengeni/config";
|
|
3
|
+
import type { RetainedSessionScreenshotKind } from "@opengeni/contracts";
|
|
3
4
|
import type { ResumedTurnSandbox } from "../../sandbox-resume.js";
|
|
4
5
|
import type { SharedActivityServices } from "../types.js";
|
|
5
6
|
import { type GeneratedImageOutput, type GeneratedImageReceipt } from "../generated-images.js";
|
|
@@ -35,7 +36,7 @@ export declare class TurnMediaArtifacts {
|
|
|
35
36
|
readonly retainedScreenshotReceiptsByCallId: Map<string, {
|
|
36
37
|
available: true;
|
|
37
38
|
artifactId: string;
|
|
38
|
-
kind: "assistant_completion" | "computer_screenshot" | "event_media" | "file" | "generated_image" | "generated_video" | "internal_update" | "tool_result";
|
|
39
|
+
kind: "assistant_completion" | "browser_screenshot" | "computer_screenshot" | "event_media" | "file" | "generated_image" | "generated_video" | "internal_update" | "tool_result";
|
|
39
40
|
contentType: string;
|
|
40
41
|
originalBytes: number;
|
|
41
42
|
sha256: string;
|
|
@@ -68,7 +69,7 @@ export declare class TurnMediaArtifacts {
|
|
|
68
69
|
artifact: {
|
|
69
70
|
available: true;
|
|
70
71
|
artifactId: string;
|
|
71
|
-
kind: "assistant_completion" | "computer_screenshot" | "event_media" | "file" | "generated_image" | "generated_video" | "internal_update" | "tool_result";
|
|
72
|
+
kind: "assistant_completion" | "browser_screenshot" | "computer_screenshot" | "event_media" | "file" | "generated_image" | "generated_video" | "internal_update" | "tool_result";
|
|
72
73
|
contentType: string;
|
|
73
74
|
originalBytes: number;
|
|
74
75
|
sha256: string;
|
|
@@ -98,7 +99,7 @@ export declare class TurnMediaArtifacts {
|
|
|
98
99
|
artifact: {
|
|
99
100
|
available: true;
|
|
100
101
|
artifactId: string;
|
|
101
|
-
kind: "assistant_completion" | "computer_screenshot" | "event_media" | "file" | "generated_image" | "generated_video" | "internal_update" | "tool_result";
|
|
102
|
+
kind: "assistant_completion" | "browser_screenshot" | "computer_screenshot" | "event_media" | "file" | "generated_image" | "generated_video" | "internal_update" | "tool_result";
|
|
102
103
|
contentType: string;
|
|
103
104
|
originalBytes: number;
|
|
104
105
|
sha256: string;
|
|
@@ -128,6 +129,7 @@ export declare class TurnMediaArtifacts {
|
|
|
128
129
|
sandboxFileDownloadBackend: Settings["sandboxBackend"];
|
|
129
130
|
nativeImageGenerationRetention: NativeImageGenerationRetention | null;
|
|
130
131
|
readonly retainedSessionImageCallIds: Set<string>;
|
|
132
|
+
readonly retainedSessionImageKindsByCallId: Map<string, RetainedSessionScreenshotKind>;
|
|
131
133
|
constructor(deps: TurnMediaArtifactDeps);
|
|
132
134
|
rememberGeneratedImageCreatedThisTurn: (receipt: GeneratedImageReceipt) => void;
|
|
133
135
|
private prepareGeneratedImageDownload;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StreamEvent } from "@openai/agents";
|
|
2
|
+
/** SDK producer/consumer rendezvous. Usage stays on the sole consumer writer. */
|
|
3
|
+
export declare function createModelCallAdmission(input: {
|
|
4
|
+
signal: AbortSignal;
|
|
5
|
+
admit: () => Promise<void>;
|
|
6
|
+
}): {
|
|
7
|
+
beforeModelRequest: () => Promise<void>;
|
|
8
|
+
onModelResponse: (event: StreamEvent) => Promise<void>;
|
|
9
|
+
settle: (event: {
|
|
10
|
+
type: string;
|
|
11
|
+
data?: unknown;
|
|
12
|
+
}) => void;
|
|
13
|
+
fail: (error: unknown) => void;
|
|
14
|
+
close: () => void;
|
|
15
|
+
};
|