@opengeni/worker-bundle 2.0.1 → 2.0.2-canary.38789554071001
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 +185 -26
- 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 +4 -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 +31 -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-5IIVRXLA.js} +1569 -2883
- package/dist/activities-control-5IIVRXLA.js.map +1 -0
- package/dist/activities-control.d.ts +64 -4
- package/dist/{activities-turn-YVVKCGAK.js → activities-turn-FLYJOM54.js} +9300 -4403
- package/dist/activities-turn-FLYJOM54.js.map +1 -0
- package/dist/activities.d.ts +64 -4
- package/dist/artifact-materializer-entry.js +107 -36
- 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-MVESOYFC.js +3746 -0
- package/dist/chunk-MVESOYFC.js.map +1 -0
- package/dist/{chunk-M3NVMF2V.js → chunk-N57B3PJ5.js} +2307 -3951
- package/dist/chunk-N57B3PJ5.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 +1152 -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 +42 -12
- 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 +114 -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 +634 -111
- 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 +182 -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 +124 -9
- package/src/activities/sandbox-lease.ts +1615 -73
- package/src/activities/scheduled-tasks.ts +780 -147
- 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 +85 -39
- 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,18 +1,31 @@
|
|
|
1
1
|
import type { AttemptToolDefinition } from "@opengeni/codemode";
|
|
2
|
-
import type
|
|
3
|
-
import {
|
|
2
|
+
import { type ModelCapabilitiesV1 } from "@opengeni/config";
|
|
3
|
+
import type { GeneratedSessionTitle, GenerateSessionTitleOptions, OpenGeniRuntime } from "@opengeni/runtime";
|
|
4
|
+
import { ReasoningEffort, type FirstPartyMcpToolName, type Permission, type ResolvedAgentConfig, type ToolRef } from "@opengeni/contracts";
|
|
4
5
|
export declare const SESSION_TITLE_MODEL_TOOL_NAME = "opengeni__set_session_title";
|
|
5
6
|
export declare function shouldRequestMissingSessionTitle(input: {
|
|
6
7
|
title: string | null;
|
|
7
8
|
titleSource: "user" | "agent" | null;
|
|
9
|
+
agentConfig?: ResolvedAgentConfig | null;
|
|
8
10
|
firstPartyMcpTools: readonly FirstPartyMcpToolName[];
|
|
9
11
|
firstPartyMcpPermissions: readonly Permission[] | null;
|
|
10
12
|
}): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the turn's route can afford a model request spent only on a title.
|
|
15
|
+
* The managed OpenRouter free route draws on one deployment-wide per-minute
|
|
16
|
+
* and per-day request quota that users' turns need, so an untitled session on
|
|
17
|
+
* it gets no title sidecar and no title tool (whose call would cost a
|
|
18
|
+
* follow-up request). Clients keep showing the prompt preview, and a later
|
|
19
|
+
* turn on another route titles the session.
|
|
20
|
+
*/
|
|
21
|
+
export declare function routeAllowsSessionTitleRequests(resolvedModel: ReturnType<OpenGeniRuntime["resolveTurnModel"]>): boolean;
|
|
11
22
|
export declare function sessionTitleToolPlan(input: {
|
|
12
23
|
tools: readonly ToolRef[];
|
|
24
|
+
agentConfig?: ResolvedAgentConfig | null;
|
|
13
25
|
selectedFirstPartyMcpTools: readonly FirstPartyMcpToolName[];
|
|
14
26
|
shouldRequestTitle: boolean;
|
|
15
27
|
parallelGenerationAvailable: boolean;
|
|
28
|
+
routeAllowsTitleRequests: boolean;
|
|
16
29
|
}): {
|
|
17
30
|
promoteTitleTool: boolean;
|
|
18
31
|
generateTitleInParallel: boolean;
|
|
@@ -20,6 +33,48 @@ export declare function sessionTitleToolPlan(input: {
|
|
|
20
33
|
preparationIndependentToolNames: string[];
|
|
21
34
|
};
|
|
22
35
|
export declare const PARALLEL_SESSION_TITLE_TIMEOUT_MS = 15000;
|
|
36
|
+
/** Codex subscription turns title on this fast model of the same account. */
|
|
37
|
+
export declare const CODEX_SESSION_TITLE_MODEL_ID = "codex/gpt-6-luna";
|
|
38
|
+
/** Claude subscription turns title on this fast model of the same account. */
|
|
39
|
+
export declare const CLAUDE_SESSION_TITLE_UPSTREAM_MODEL_ID = "claude-haiku-5-5";
|
|
40
|
+
export type SessionTitleRoute = {
|
|
41
|
+
resolvedModel: ReturnType<OpenGeniRuntime["resolveTurnModel"]>;
|
|
42
|
+
/** Upstream model name sent to the provider. */
|
|
43
|
+
modelName: string;
|
|
44
|
+
/** Product model id the title usage is recorded under, when it differs from the turn's. */
|
|
45
|
+
usageModelId: string | null;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The model for the auxiliary title request. A subscription turn titles on a
|
|
49
|
+
* fast model of the same subscription account and request context, so the
|
|
50
|
+
* title costs the subscription little and never another rail: Codex turns use
|
|
51
|
+
* Luna and Claude subscription turns use Haiku. Other turns, and a
|
|
52
|
+
* subscription whose catalog lacks the title model, title on the turn's model.
|
|
53
|
+
*/
|
|
54
|
+
export declare function sessionTitleRoute(input: {
|
|
55
|
+
resolvedModel: ReturnType<OpenGeniRuntime["resolveTurnModel"]>;
|
|
56
|
+
modelName: string;
|
|
57
|
+
resolveTurnModel: (modelId: string) => ReturnType<OpenGeniRuntime["resolveTurnModel"]>;
|
|
58
|
+
}): SessionTitleRoute;
|
|
59
|
+
/**
|
|
60
|
+
* The lowest reasoning effort the resolved model can run, for the auxiliary
|
|
61
|
+
* title request only. A title needs no deliberation, and a provider default
|
|
62
|
+
* effort can use most of the output budget before any visible text. Returns
|
|
63
|
+
* undefined when the model declares no runnable reasoning control, so the
|
|
64
|
+
* request carries no reasoning parameter.
|
|
65
|
+
*/
|
|
66
|
+
export declare function sessionTitleReasoningEffort(capabilities: Pick<ModelCapabilitiesV1, "reasoning"> | undefined): ReasoningEffort | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Options for the parallel title request. It uses the turn's resolved
|
|
69
|
+
* provider and credential authority, but its own lowest runnable reasoning
|
|
70
|
+
* effort rather than the turn's effort.
|
|
71
|
+
*/
|
|
72
|
+
export declare function sessionTitleGenerationOptions(input: {
|
|
73
|
+
resolvedModel: ReturnType<OpenGeniRuntime["resolveTurnModel"]>;
|
|
74
|
+
modelName: string;
|
|
75
|
+
serviceTier: GenerateSessionTitleOptions["serviceTier"] | null | undefined;
|
|
76
|
+
signal: AbortSignal;
|
|
77
|
+
}): GenerateSessionTitleOptions;
|
|
23
78
|
export type ParallelSessionTitleGeneration = {
|
|
24
79
|
finish: () => Promise<GeneratedSessionTitle | null>;
|
|
25
80
|
cancel: () => Promise<void>;
|
|
@@ -29,13 +84,15 @@ export type ParallelSessionTitleGeneration = {
|
|
|
29
84
|
* stream. finish() waits for the already-running bounded request, so a quick
|
|
30
85
|
* main response does not discard a valid title merely because it completed
|
|
31
86
|
* first. cancel() aborts and joins exceptional/cancelled exits so no provider
|
|
32
|
-
* work escapes the owning runAgentTurn activity.
|
|
87
|
+
* work escapes the owning runAgentTurn activity. Both exits settle an already
|
|
88
|
+
* completed result before returning, including its separate request custody.
|
|
33
89
|
*/
|
|
34
90
|
export declare function startParallelSessionTitleGeneration(input: {
|
|
35
91
|
generate: (signal: AbortSignal) => Promise<GeneratedSessionTitle>;
|
|
36
92
|
signal?: AbortSignal;
|
|
37
93
|
timeoutMs?: number;
|
|
38
94
|
onError?: (error: unknown) => void;
|
|
95
|
+
onFinish?: (result: GeneratedSessionTitle | null) => Promise<void>;
|
|
39
96
|
}): ParallelSessionTitleGeneration;
|
|
40
97
|
export declare function createSessionTitleAttemptToolDefinition(input: {
|
|
41
98
|
updateTitle: (title: string) => Promise<{
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { HeldSessionUsageReceipt } from "@opengeni/core";
|
|
2
|
+
import type { TurnActivityServices as ActivityServices } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Attempt-scoped custody for per-task usage receipts whose write failed after
|
|
5
|
+
* the provider response was received.
|
|
6
|
+
*
|
|
7
|
+
* The response is never lost or re-requested because of an accounting
|
|
8
|
+
* failure: settlement hands the content-free receipt here (original source
|
|
9
|
+
* identity, amount, pricing source) and the turn keeps the response. Before
|
|
10
|
+
* the next model request (every admission check) and before the turn
|
|
11
|
+
* completes, held receipts are written; if that still fails, the attempt
|
|
12
|
+
* stops for the workflow's DB-only recovery lane and carries the held
|
|
13
|
+
* receipts in its typed failure detail (durable in workflow history), which
|
|
14
|
+
* the lane writes before any replacement attempt. Writes are idempotent per
|
|
15
|
+
* source identity, so overlapping writers (the `agent.model.usage` event
|
|
16
|
+
* meter, a later flush and the recovery lane) record the call once.
|
|
17
|
+
*/
|
|
18
|
+
type Scope = {
|
|
19
|
+
accountId: string;
|
|
20
|
+
workspaceId: string;
|
|
21
|
+
};
|
|
22
|
+
/** Bound on receipts carried through one recovery failure detail. */
|
|
23
|
+
export declare const MAX_RECOVERY_SESSION_USAGE_RECEIPTS = 64;
|
|
24
|
+
/** Recovery reason and detail code for a task whose earlier single-call receipt is still owed. */
|
|
25
|
+
export declare const SESSION_USAGE_CUSTODY_PENDING = "session_usage_custody_pending";
|
|
26
|
+
/**
|
|
27
|
+
* How long a parked turn waits before its replacement attempt re-checks
|
|
28
|
+
* admission (database reads only). An owner fills its receipt within
|
|
29
|
+
* seconds; a dead owner's marker is disclosed by maintenance after 30
|
|
30
|
+
* minutes, so a task waits at most about 60 rechecks.
|
|
31
|
+
*/
|
|
32
|
+
export declare const SESSION_USAGE_CUSTODY_RECHECK_MS = 30000;
|
|
33
|
+
/** A fenced or overdue custody marker (not a database outage) refused the next model request. */
|
|
34
|
+
export declare function sessionUsageCustodyPending(error: unknown): boolean;
|
|
35
|
+
export declare function holdSessionUsageReceipt(scope: Scope, receipt: HeldSessionUsageReceipt): void;
|
|
36
|
+
/** Held receipts for one turn, bounded, for a post-claim recovery failure detail. */
|
|
37
|
+
export declare function heldSessionUsageReceiptsForTurn(turnId: string): HeldSessionUsageReceipt[];
|
|
38
|
+
export declare function heldSessionUsageReceiptCount(sessionId?: string): number;
|
|
39
|
+
/**
|
|
40
|
+
* The `agent.model.usage` event for a held receipt committed. Its appending
|
|
41
|
+
* transaction meters the same source identity through the database trigger
|
|
42
|
+
* (or, for a root still preparing, leaves the event for the bounded import),
|
|
43
|
+
* and a trigger failure would have rolled the event back. When the event
|
|
44
|
+
* carries exactly the held amount, the receipt is therefore durable and the
|
|
45
|
+
* hold is dropped, so completion does not stop for a write that is already
|
|
46
|
+
* done. A different or unknown event amount keeps the hold: only the direct
|
|
47
|
+
* write can record (or fill) that value.
|
|
48
|
+
*/
|
|
49
|
+
export declare function releaseHeldSessionUsageReceiptMeteredByEvent(input: {
|
|
50
|
+
sessionId: string;
|
|
51
|
+
sourceId: string;
|
|
52
|
+
amountMicros: number | null;
|
|
53
|
+
pricingSource: string | null;
|
|
54
|
+
}): boolean;
|
|
55
|
+
/** Write receipts with their original identities; throws the last database error. */
|
|
56
|
+
export declare function writeSessionUsageReceipts(db: ActivityServices["db"], scope: Scope, receipts: readonly HeldSessionUsageReceipt[]): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Write every receipt held for this session before another model request or
|
|
59
|
+
* turn completion. Retries briefly; a persistent failure rethrows the
|
|
60
|
+
* database error so the attempt enters post-claim DB recovery with the
|
|
61
|
+
* receipts still held for its failure detail.
|
|
62
|
+
*/
|
|
63
|
+
export declare function flushHeldSessionUsageReceipts(db: ActivityServices["db"], sessionId: string): Promise<void>;
|
|
64
|
+
/** Test-only reset of process custody. */
|
|
65
|
+
export declare function resetSessionUsageReceiptCustodyForTests(): void;
|
|
66
|
+
export {};
|
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
import type { AttemptToolDefinition } from "@opengeni/codemode";
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
2
|
+
import { type SkillTextFile } from "@opengeni/runtime/skill-library";
|
|
3
|
+
import { type SkillFileSystem } from "./skill-transfer.js";
|
|
4
4
|
import type { SkillSaveReceipt, SkillSaveRequest } from "./skill-save.js";
|
|
5
|
-
type
|
|
5
|
+
export type SkillCheckoutOutcome = "written" | "unchanged" | "refused" | "failed";
|
|
6
|
+
/**
|
|
7
|
+
* Content-free timing of one skill_checkout call. `resolve` covers authority
|
|
8
|
+
* and the Skill read, `sandbox` acquiring the turn's filesystem handle, and
|
|
9
|
+
* `write` the batched filesystem write. On a lazily provisioned turn whose
|
|
10
|
+
* first sandbox use is this checkout, acquiring the handle starts the box, so
|
|
11
|
+
* box start is inside `sandbox`. A phase that did not run is null.
|
|
12
|
+
*/
|
|
13
|
+
export type SkillCheckoutObservation = Readonly<{
|
|
14
|
+
outcome: SkillCheckoutOutcome;
|
|
15
|
+
selection: "all" | "paths";
|
|
16
|
+
files: number;
|
|
17
|
+
written: number;
|
|
18
|
+
unchanged: number;
|
|
19
|
+
resolveSeconds: number | null;
|
|
20
|
+
sandboxSeconds: number | null;
|
|
21
|
+
writeSeconds: number | null;
|
|
22
|
+
totalSeconds: number;
|
|
23
|
+
}>;
|
|
6
24
|
export declare function createSkillCheckoutAttemptToolDefinition(input: {
|
|
7
25
|
authorize: () => Promise<void>;
|
|
8
26
|
load: (skill: string) => Promise<{
|
|
@@ -11,11 +29,12 @@ export declare function createSkillCheckoutAttemptToolDefinition(input: {
|
|
|
11
29
|
scopeVersion: number | null;
|
|
12
30
|
files: readonly SkillTextFile[];
|
|
13
31
|
}>;
|
|
14
|
-
filesystem: () => Promise<SkillFileSystem
|
|
32
|
+
filesystem: () => Promise<Pick<SkillFileSystem, "fsWriteFiles">>;
|
|
33
|
+
/** Telemetry only; a failure here never changes the result. */
|
|
34
|
+
observe?: (observation: SkillCheckoutObservation) => void;
|
|
15
35
|
}): AttemptToolDefinition;
|
|
16
36
|
export declare function createSkillPublishAttemptToolDefinition(input: {
|
|
17
37
|
authorize: () => Promise<void>;
|
|
18
|
-
filesystem: () => Promise<SkillFileSystem
|
|
38
|
+
filesystem: () => Promise<Pick<SkillFileSystem, "fsList" | "fsRead">>;
|
|
19
39
|
save: (request: SkillSaveRequest) => Promise<SkillSaveReceipt>;
|
|
20
40
|
}): AttemptToolDefinition;
|
|
21
|
-
export {};
|
|
@@ -1,15 +1,83 @@
|
|
|
1
|
-
import type { AttemptToolDefinition } from "@opengeni/codemode";
|
|
1
|
+
import type { AttemptToolDefinition, AttemptToolExecutionContext } from "@opengeni/codemode";
|
|
2
|
+
import { type SkillReadKind, type SkillUseSource } from "@opengeni/contracts";
|
|
2
3
|
import { type SkillTextFile } from "@opengeni/runtime/skill-library";
|
|
3
4
|
export declare const SKILL_READ_TOOL_NAME = "skill_read";
|
|
5
|
+
/** Content-free provenance of a resolved Skill. The caller never receives it. */
|
|
6
|
+
export type SkillReadOrigin = Readonly<{
|
|
7
|
+
id: string;
|
|
8
|
+
source: SkillUseSource;
|
|
9
|
+
/** Platform display label of a built-in; never user-authored text. */
|
|
10
|
+
label?: string;
|
|
11
|
+
/** Whole-artifact digest, for an artifact without a ledger revision. */
|
|
12
|
+
contentSha256?: string;
|
|
13
|
+
}>;
|
|
4
14
|
export type SkillReadContent = Readonly<{
|
|
5
15
|
files: readonly SkillTextFile[];
|
|
6
16
|
skillId: string;
|
|
7
17
|
revisionId: string;
|
|
8
18
|
scopeVersion: number;
|
|
9
19
|
installationVersion?: number;
|
|
20
|
+
origin?: SkillReadOrigin;
|
|
21
|
+
}>;
|
|
22
|
+
/** A selected built-in or session artifact: no ledger identity, and none is synthesized. */
|
|
23
|
+
export type SelectedSkillReadContent = Readonly<{
|
|
24
|
+
files: readonly SkillTextFile[];
|
|
25
|
+
origin: SkillReadOrigin;
|
|
26
|
+
}>;
|
|
27
|
+
export type SkillReadObservation = Readonly<{
|
|
28
|
+
caller: AttemptToolExecutionContext["caller"]["kind"];
|
|
29
|
+
kind: SkillReadKind;
|
|
30
|
+
/** Null when the read was refused before a Skill resolved. */
|
|
31
|
+
source: SkillUseSource | null;
|
|
32
|
+
/** The resolved Skill id, or the requested identifier when none resolved. */
|
|
33
|
+
skill: string;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Content-free read telemetry. It never changes what the caller receives: a
|
|
37
|
+
* model result gains only MCP `_meta`, which the model never sees and which
|
|
38
|
+
* only the tool-output event projection keeps.
|
|
39
|
+
*/
|
|
40
|
+
export type SkillReadTelemetry = Readonly<{
|
|
41
|
+
/** Ids in the Skill index the model sees this turn; null until known. */
|
|
42
|
+
indexedSkillIds: () => ReadonlySet<string> | null;
|
|
43
|
+
/** Whether skill_search returned this id earlier in this turn attempt. */
|
|
44
|
+
searched: (id: string) => boolean;
|
|
45
|
+
observe: (observation: SkillReadObservation) => void;
|
|
46
|
+
}>;
|
|
47
|
+
export type SkillReadActiveHistory = Readonly<{
|
|
48
|
+
/** Earlier skill_read results still in this session's active model history. */
|
|
49
|
+
readResults: () => Promise<ReadonlyArray<Record<string, unknown>>>;
|
|
50
|
+
/**
|
|
51
|
+
* This turn's model tool-output bound. Rows are bounded when stored, but a
|
|
52
|
+
* later model with a lower bound receives a shorter copy than the row holds.
|
|
53
|
+
*/
|
|
54
|
+
toolOutputTruncationTokens: () => number;
|
|
55
|
+
/** The lookup only saves tokens, so a failure returns the full text. */
|
|
56
|
+
onLookupFailed?: (error: unknown) => void;
|
|
57
|
+
}>;
|
|
58
|
+
export declare const SKILL_UNAVAILABLE_MESSAGE = "Skill is not available in this session.";
|
|
59
|
+
/** Bounds on the Skill list an unresolved identifier returns. */
|
|
60
|
+
export declare const SKILL_UNAVAILABLE_LIST_MAX_ENTRIES = 25;
|
|
61
|
+
export declare const SKILL_UNAVAILABLE_LIST_MAX_BYTES: number;
|
|
62
|
+
export type AvailableSkill = Readonly<{
|
|
63
|
+
id: string;
|
|
64
|
+
name: string;
|
|
10
65
|
}>;
|
|
66
|
+
/**
|
|
67
|
+
* The error for an identifier that resolves to no Skill. It lists available
|
|
68
|
+
* Skills by id and name only, the descriptors the Skill index and skill_search
|
|
69
|
+
* already show the model, so the caller can retry instead of rediscovering
|
|
70
|
+
* the work from scratch. Entries resembling the requested identifier (shared
|
|
71
|
+
* prefix, suffix, or containment) come first, so a mistyped or spliced id
|
|
72
|
+
* keeps its likely targets inside the bound. The requested identifier is
|
|
73
|
+
* never echoed.
|
|
74
|
+
*/
|
|
75
|
+
export declare function unavailableSkillError(requested: string, available: readonly AvailableSkill[]): Error;
|
|
11
76
|
/** A first-party gateway definition, not a sandbox capability or second backend. */
|
|
12
77
|
export declare function createSkillReadAttemptToolDefinition(input: {
|
|
13
78
|
authorize: () => Promise<void>;
|
|
14
|
-
load: (skill: string) => Promise<readonly SkillTextFile[] | SkillReadContent>;
|
|
79
|
+
load: (skill: string) => Promise<readonly SkillTextFile[] | SkillReadContent | SelectedSkillReadContent>;
|
|
80
|
+
/** Without it every read returns full text. */
|
|
81
|
+
activeHistory?: SkillReadActiveHistory;
|
|
82
|
+
telemetry?: SkillReadTelemetry;
|
|
15
83
|
}): AttemptToolDefinition;
|
|
@@ -13,4 +13,6 @@ export declare function createSkillSearchAttemptToolDefinition(input: {
|
|
|
13
13
|
authorize: () => Promise<void>;
|
|
14
14
|
listWorkspace: () => Promise<readonly WorkspaceSkillSearchEntry[]>;
|
|
15
15
|
publicSearch: PublicSkillSearchClient;
|
|
16
|
+
/** Ids of the readable Skills a search returned, for read telemetry only. */
|
|
17
|
+
onWorkspaceHits?: (ids: readonly string[]) => void;
|
|
16
18
|
}): AttemptToolDefinition;
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import type { Settings } from "@opengeni/config";
|
|
2
2
|
import { type SkillActor } from "@opengeni/contracts";
|
|
3
|
-
import { type Database } from "@opengeni/db";
|
|
3
|
+
import { SkillLifecycleRefusedError, type Database } from "@opengeni/db";
|
|
4
4
|
import type { RuntimeSkillArtifact } from "@opengeni/runtime";
|
|
5
|
-
import type
|
|
5
|
+
import { type SkillReadObservation } from "./skill-read.js";
|
|
6
|
+
import { type SkillCheckoutObservation } from "./skill-checkout.js";
|
|
7
|
+
import type { SkillFileSystem } from "./skill-transfer.js";
|
|
8
|
+
import type { AttemptToolDefinition } from "@opengeni/codemode";
|
|
9
|
+
/** What a refused Skill change means for the agent, in words it can act on. */
|
|
10
|
+
export declare function skillRefusalMessage(error: SkillLifecycleRefusedError): string;
|
|
11
|
+
/**
|
|
12
|
+
* The check before a Skill write (save, install, publish, remove): the live
|
|
13
|
+
* attempt, and that no Site page started the agent. An agent started from a
|
|
14
|
+
* Site page reads Skills but never changes them: it does not learn. The
|
|
15
|
+
* refusal is definite (nothing was saved).
|
|
16
|
+
*/
|
|
17
|
+
export declare function skillWriteAuthorizer(authorize: () => Promise<void>, siteClamped: () => Promise<boolean>): () => Promise<void>;
|
|
6
18
|
export declare function createWorkspaceSkillTools(input: {
|
|
7
19
|
db: Database;
|
|
8
20
|
settings: Settings;
|
|
@@ -16,5 +28,30 @@ export declare function createWorkspaceSkillTools(input: {
|
|
|
16
28
|
id: string;
|
|
17
29
|
artifact: RuntimeSkillArtifact;
|
|
18
30
|
}[];
|
|
19
|
-
filesystem: () => Promise<
|
|
20
|
-
|
|
31
|
+
filesystem: () => Promise<SkillFileSystem>;
|
|
32
|
+
/** Content-free skill_checkout timing; it never changes a result. */
|
|
33
|
+
observeSkillCheckout?: (observation: SkillCheckoutObservation) => void;
|
|
34
|
+
/** The resolved model's bound, which `settings` does not carry. */
|
|
35
|
+
modelToolOutputTruncationTokens: () => number;
|
|
36
|
+
onSkillReadHistoryLookupFailed?: (error: unknown) => void;
|
|
37
|
+
/** Content-free skill_read telemetry; it never changes a result. */
|
|
38
|
+
skillReadTelemetry?: {
|
|
39
|
+
/** Ids in the Skill index the model sees this turn; null until known. */
|
|
40
|
+
indexedSkillIds: () => ReadonlySet<string> | null;
|
|
41
|
+
observe: (observation: SkillReadObservation) => void;
|
|
42
|
+
};
|
|
43
|
+
}): AttemptToolDefinition[];
|
|
44
|
+
/**
|
|
45
|
+
* Names of the Skills a session carries itself. The session's creator chose
|
|
46
|
+
* that copy for this conversation, so it shadows a workspace Skill of the same
|
|
47
|
+
* name in the Skill index, skill_search and by-name reads; offering both lets
|
|
48
|
+
* the model pick either one.
|
|
49
|
+
*/
|
|
50
|
+
export declare function sessionShadowedSkillNames(selected: readonly {
|
|
51
|
+
id: string;
|
|
52
|
+
artifact: Pick<RuntimeSkillArtifact, "name">;
|
|
53
|
+
}[]): ReadonlySet<string>;
|
|
54
|
+
/** Workspace Skill descriptors without the ones a session Skill shadows. */
|
|
55
|
+
export declare function withoutSessionShadowedSkills<T extends {
|
|
56
|
+
title: string;
|
|
57
|
+
}>(descriptors: readonly T[], shadowed: ReadonlySet<string>): T[];
|
|
@@ -1,26 +1,38 @@
|
|
|
1
1
|
import type { SandboxChannelAService } from "@opengeni/runtime/sandbox";
|
|
2
2
|
import { type SkillTextFile } from "@opengeni/runtime/skill-library";
|
|
3
|
-
type SkillFileSystem = Pick<SandboxChannelAService, "fsList" | "fsRead" | "
|
|
3
|
+
export type SkillFileSystem = Pick<SandboxChannelAService, "fsList" | "fsRead" | "fsWriteFiles">;
|
|
4
4
|
/** Reuse the host's cancellation and workspace-mutation authority for each filesystem operation. */
|
|
5
5
|
export declare function guardSkillFilesystem(fs: SkillFileSystem, authority: {
|
|
6
6
|
assertActive: () => void;
|
|
7
7
|
runMutation: <T>(operation: () => Promise<T>) => Promise<T>;
|
|
8
8
|
}): SkillFileSystem;
|
|
9
|
-
|
|
10
|
-
export declare function checkoutSkillDirectory(fs: SkillFileSystem, directory: string, files: readonly SkillTextFile[]): Promise<{
|
|
9
|
+
export type SkillCheckoutResult = {
|
|
11
10
|
directory: string;
|
|
12
11
|
fileCount: number;
|
|
13
|
-
|
|
12
|
+
written: number;
|
|
13
|
+
unchanged: number;
|
|
14
|
+
/** This call created the directory, so it holds nothing but these files. */
|
|
15
|
+
createdDirectory: boolean;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Caller supplies an authorized live filesystem and a workspace-relative
|
|
19
|
+
* target. All missing files are created in one filesystem batch (normally a
|
|
20
|
+
* single sandbox command). Nothing is overwritten: files already holding the
|
|
21
|
+
* same bytes are kept, and any other existing entry fails before writing.
|
|
22
|
+
* `paths` selects exactly those Skill files, for example one script to run.
|
|
23
|
+
*/
|
|
24
|
+
export declare function checkoutSkillDirectory(fs: Pick<SkillFileSystem, "fsWriteFiles">, directory: string, files: readonly SkillTextFile[], options?: {
|
|
25
|
+
paths?: readonly string[];
|
|
26
|
+
}): Promise<SkillCheckoutResult>;
|
|
14
27
|
/**
|
|
15
28
|
* Read a folder through existing structured filesystem services, never via model
|
|
16
29
|
* arguments. The caller owns workspace confinement and the final governed save.
|
|
17
30
|
* This operation does not execute scripts or activate the resulting artifact.
|
|
18
31
|
*/
|
|
19
|
-
export declare function readSkillDirectory(fs: SkillFileSystem, directory: string): Promise<Readonly<{
|
|
32
|
+
export declare function readSkillDirectory(fs: Pick<SkillFileSystem, "fsList" | "fsRead">, directory: string): Promise<Readonly<{
|
|
20
33
|
name: string;
|
|
21
34
|
description: string;
|
|
22
35
|
files: readonly import("@opengeni/runtime").SkillLibraryFile[];
|
|
23
36
|
contentSha256: string;
|
|
24
37
|
totalBytes: number;
|
|
25
38
|
}>>;
|
|
26
|
-
export {};
|
|
@@ -11,7 +11,7 @@ import { ToolResultSpill } from "./tool-result-spill.js";
|
|
|
11
11
|
import { createTurnCredentialLeases } from "./credential-leases.js";
|
|
12
12
|
import { createTurnMediaArtifacts } from "./media-artifacts.js";
|
|
13
13
|
import { createTurnHistorySink } from "./history-sink.js";
|
|
14
|
-
import { type SessionEvent } from "@opengeni/contracts";
|
|
14
|
+
import { type SessionEvent, type SessionTurn } from "@opengeni/contracts";
|
|
15
15
|
import { createModelCheckpointMemoryCollector } from "../../model-checkpoint-memory-collector.js";
|
|
16
16
|
import { TurnEventPublisher } from "./model-usage.js";
|
|
17
17
|
import type { CompactionSummarizer } from "../context-compaction.js";
|
|
@@ -44,11 +44,12 @@ export type TurnStreamAttemptDeps = {
|
|
|
44
44
|
providerTurn: ProviderTurnState;
|
|
45
45
|
leases: ReturnType<typeof createTurnCredentialLeases>;
|
|
46
46
|
historySink: ReturnType<typeof createTurnHistorySink>;
|
|
47
|
+
checkpointBeforeProviderDispatch: () => Promise<void>;
|
|
47
48
|
media: ReturnType<typeof createTurnMediaArtifacts>;
|
|
48
49
|
toolResultSpill: ToolResultSpill;
|
|
49
50
|
claimedResult: ClaimedResult;
|
|
50
51
|
flushRuntimeBatcher: () => Promise<void>;
|
|
51
|
-
finalizeTurnOpStreamOps: () => Promise<void>;
|
|
52
|
+
finalizeTurnOpStreamOps: (toolCallIds?: readonly string[]) => Promise<void>;
|
|
52
53
|
runWorkspaceMutationForSandbox: <T>(sandbox: ResumedTurnSandbox, operation: string, mutation: () => Promise<T>, observePhase?: (measurement: {
|
|
53
54
|
phase: "admission" | "provider" | "settlement" | "snapshot_wait";
|
|
54
55
|
outcome: "completed" | "failed";
|
|
@@ -79,7 +80,9 @@ export type TurnStreamAttemptDeps = {
|
|
|
79
80
|
activeSandboxBackend: Settings["sandboxBackend"] | undefined;
|
|
80
81
|
groupBoxBackend: Settings["sandboxBackend"];
|
|
81
82
|
turnExecutionPolicy: TurnExecutionPolicyV1;
|
|
82
|
-
turn: {
|
|
83
|
+
turn: Pick<SessionTurn, "initiator" | "initiatorContext"> & {
|
|
84
|
+
initiatingHumanSubjectId: string | null;
|
|
85
|
+
id: string;
|
|
83
86
|
executionGeneration: number;
|
|
84
87
|
model: string;
|
|
85
88
|
source?: string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type SubscriptionCapacityArmingFailurePayload = {
|
|
2
|
+
error: string;
|
|
3
|
+
code: string;
|
|
4
|
+
retryable: true;
|
|
5
|
+
recovery: "user_message";
|
|
6
|
+
};
|
|
7
|
+
declare const PROVIDER_NAMES: {
|
|
8
|
+
readonly codex: "Codex";
|
|
9
|
+
readonly claude: "Claude";
|
|
10
|
+
readonly xai: "SuperGrok";
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Translate a failure to arm a durable capacity wait into an explicit,
|
|
14
|
+
* user-visible turn failure instead of a generic activity failure.
|
|
15
|
+
*
|
|
16
|
+
* Returns null for structured database failures: those belong to the
|
|
17
|
+
* exact-attempt database recovery path and must be rethrown unchanged. The
|
|
18
|
+
* payload is secret-safe: it never includes the underlying error text, which
|
|
19
|
+
* can carry row identifiers or provider diagnostics.
|
|
20
|
+
*
|
|
21
|
+
* Every other failure, including a permanent database rejection such as an
|
|
22
|
+
* RLS/permission denial or a constraint violation, settles the turn as failed
|
|
23
|
+
* with the session idle. `retryable` means only that a new user message may
|
|
24
|
+
* try again; nothing retries automatically. Callers must report
|
|
25
|
+
* `subscriptionCapacityArmingDiagnostic` to operators so the underlying class
|
|
26
|
+
* and SQLSTATE are not lost behind the user-facing state.
|
|
27
|
+
*/
|
|
28
|
+
export declare function subscriptionCapacityArmingFailure(provider: keyof typeof PROVIDER_NAMES, error: unknown): SubscriptionCapacityArmingFailurePayload | null;
|
|
29
|
+
export type SubscriptionCapacityArmingDiagnostic = {
|
|
30
|
+
errorClass: string;
|
|
31
|
+
errorCode: string;
|
|
32
|
+
origin: "database" | "worker";
|
|
33
|
+
sqlState?: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Operator-only facts about a wait that could not be armed: the error class
|
|
37
|
+
* and, for database rejections, the SQLSTATE. Never message text, so it is
|
|
38
|
+
* safe for worker logs; it must not enter the user-visible turn payload.
|
|
39
|
+
*/
|
|
40
|
+
export declare function subscriptionCapacityArmingDiagnostic(provider: keyof typeof PROVIDER_NAMES, error: unknown): SubscriptionCapacityArmingDiagnostic;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { Database, SubscriptionCorePlacement, SubscriptionCorePlacementRequest, SubscriptionCoreTurnIdentity } from "@opengeni/db";
|
|
2
|
+
import type { CapacityPhaseDeps, CapacityPhaseOutcome } from "./codex-capacity.js";
|
|
3
|
+
import type { CoreSubscriptionTurnLease } from "./credential-leases.js";
|
|
4
|
+
import type { SubscriptionCoreTurn } from "./turn-context.js";
|
|
5
|
+
import { type CoreWaitBinding } from "../subscription-core-codex-waits.js";
|
|
6
|
+
type WaitPlacement = Extract<SubscriptionCorePlacement, {
|
|
7
|
+
kind: "wait";
|
|
8
|
+
}> & {
|
|
9
|
+
/** Fresh failover evaluation hints, never authority. */
|
|
10
|
+
candidateProviders?: readonly string[];
|
|
11
|
+
};
|
|
12
|
+
type RunPlacement = Extract<SubscriptionCorePlacement, {
|
|
13
|
+
kind: "run";
|
|
14
|
+
}>;
|
|
15
|
+
/** One provider's chat placement on the core, as the worker uses it. */
|
|
16
|
+
export type CoreTurnPlacementProvider = {
|
|
17
|
+
/** The provider id on the core. */
|
|
18
|
+
id: string;
|
|
19
|
+
/** The provider's name in failure copy. */
|
|
20
|
+
displayName: string;
|
|
21
|
+
/** The startup-phase metric's provider label. */
|
|
22
|
+
startupPhaseProvider: string;
|
|
23
|
+
leaseTtlMs: number;
|
|
24
|
+
/** The turn's lease for this provider. */
|
|
25
|
+
lease: (deps: CapacityPhaseDeps) => CoreSubscriptionTurnLease;
|
|
26
|
+
place: (db: Database, request: SubscriptionCorePlacementRequest) => Promise<SubscriptionCorePlacement>;
|
|
27
|
+
/** Quarantines that ran out return to service before placement reads the world. */
|
|
28
|
+
recoverHealth: (deps: CapacityPhaseDeps, identity: SubscriptionCoreTurnIdentity) => Promise<void>;
|
|
29
|
+
/** A provider-specific read before placement (Codex: plan entitlements). */
|
|
30
|
+
beforePlacement?: (deps: CapacityPhaseDeps, identity: SubscriptionCoreTurnIdentity) => Promise<void>;
|
|
31
|
+
/** Record the placement on the provider's turn fields. */
|
|
32
|
+
adopt: (deps: CapacityPhaseDeps, core: SubscriptionCoreTurn, placement: RunPlacement) => void;
|
|
33
|
+
/** The provider's selection receipt (events and metrics), if it records one. */
|
|
34
|
+
recordSelection?: (deps: CapacityPhaseDeps, placement: RunPlacement, turnId: string) => Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Park a chat turn on the durable core waiter. Without it a wait is a
|
|
37
|
+
* terminal capacity failure (fail closed; the session stays usable).
|
|
38
|
+
*/
|
|
39
|
+
park?: (deps: CapacityPhaseDeps, wait: WaitPlacement) => Promise<CapacityPhaseOutcome>;
|
|
40
|
+
isSourceDisconnected: (db: Database, identity: SubscriptionCoreTurnIdentity, connectionId: string) => Promise<boolean>;
|
|
41
|
+
sourceDisconnectedError: () => Error;
|
|
42
|
+
/** The attempt-fence refusal the selection receipt raises. */
|
|
43
|
+
isAttemptFenced: (error: unknown) => boolean;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Whether an error (or a cause up to eight deep) is a core source disconnect
|
|
47
|
+
* of any provider: every provider's `sourceDisconnectedError` carries the
|
|
48
|
+
* shared code `subscription_core_source_disconnected`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function isCoreSourceDisconnectedError(error: unknown): boolean;
|
|
51
|
+
/** Lifecycle disappearance is not an auth refusal or an ordinary account pause. */
|
|
52
|
+
export declare function assertCoreSourceConnected(db: Database, provider: Pick<CoreTurnPlacementProvider, "isSourceDisconnected" | "sourceDisconnectedError">, core: Pick<SubscriptionCoreTurn, "identity" | "connectionId">): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Wrap a core credential resolver for one attempt: every read and refresh
|
|
55
|
+
* rechecks the source and this attempt's live lease. A lost lease marks the
|
|
56
|
+
* local holder lost, so dispatch stops with the ordinary lease-loss error; a
|
|
57
|
+
* failure is reclassified as a disconnect only on proven lifecycle
|
|
58
|
+
* disconnect, never on an ordinary pause.
|
|
59
|
+
*/
|
|
60
|
+
export declare function guardCoreTokenResolver<Snapshot>(db: Database, provider: Pick<CoreTurnPlacementProvider, "isSourceDisconnected" | "sourceDisconnectedError">, core: SubscriptionCoreTurn, lease: CoreSubscriptionTurnLease, resolver: {
|
|
61
|
+
getToken: () => Promise<Snapshot>;
|
|
62
|
+
refresh: () => Promise<Snapshot>;
|
|
63
|
+
}, isLeaseLost: (error: unknown) => boolean): {
|
|
64
|
+
getToken: () => Promise<Snapshot>;
|
|
65
|
+
refresh: () => Promise<Snapshot>;
|
|
66
|
+
};
|
|
67
|
+
/** The lease reference a core turn's credential reads and requests carry. */
|
|
68
|
+
export declare function coreLeaseRef(lease: CoreSubscriptionTurnLease, core: Pick<SubscriptionCoreTurn, "connectionId">, displayName: string): {
|
|
69
|
+
connectionId: string;
|
|
70
|
+
holderId: string;
|
|
71
|
+
generation: number;
|
|
72
|
+
};
|
|
73
|
+
export declare function selectCoreSubscriptionTurnCapacity(deps: CapacityPhaseDeps, provider: CoreTurnPlacementProvider): Promise<CapacityPhaseOutcome>;
|
|
74
|
+
/** The session's active goal fence for a capacity waiter. */
|
|
75
|
+
export declare function activeGoalFence(deps: Pick<CapacityPhaseDeps, "db" | "input">): Promise<{
|
|
76
|
+
goalId: string | null;
|
|
77
|
+
goalVersion: number | null;
|
|
78
|
+
}>;
|
|
79
|
+
/**
|
|
80
|
+
* Arm the session's core waiter for this attempt's turn and re-evaluate it at
|
|
81
|
+
* once: a capacity change that committed before the waiter existed could not
|
|
82
|
+
* wake it, so the arm closes that edge itself (as the legacy Codex arm does).
|
|
83
|
+
* Any provider: `waits` supplies its waiter entry points.
|
|
84
|
+
*/
|
|
85
|
+
export declare function parkCoreSubscriptionTurn(deps: CapacityPhaseDeps, wait: WaitPlacement, waits: CoreWaitBinding, displayName: string): Promise<CapacityPhaseOutcome>;
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-turn re-placement after a definitive refusal on a chat turn placed by
|
|
3
|
+
* the shared subscription core, for any provider (generalized from the M3
|
|
4
|
+
* Codex failover, PR 2a; Codex binds it in `codex-core-failover.ts` under
|
|
5
|
+
* the names it shipped).
|
|
6
|
+
*
|
|
7
|
+
* The refusal was already recorded against the leased connection (failure
|
|
8
|
+
* receipt plus the state that keeps placement away from it). After a durable
|
|
9
|
+
* checkpoint the same accepted turn is recovered with a new attempt, whose
|
|
10
|
+
* placement chooses again under the core rules: another eligible account, or
|
|
11
|
+
* a durable wait when nothing can serve it. An explicit choice never fails
|
|
12
|
+
* over: its placement waits on the chosen account. The per-turn bound counts
|
|
13
|
+
* every refusal of the turn, by any account, so a turn cannot alternate
|
|
14
|
+
* between failing accounts forever; the refusal that reaches the bound fails
|
|
15
|
+
* the turn with typed copy and leaves the session usable.
|
|
16
|
+
*/
|
|
17
|
+
import { type Database, type SubscriptionCoreTurnIdentity } from "@opengeni/db";
|
|
18
|
+
import type { RunAgentTurnResult } from "../types.js";
|
|
19
|
+
import type { CoreSubscriptionTurnLease } from "./credential-leases.js";
|
|
20
|
+
import type { TurnFailureDeps } from "./failure-settlement.js";
|
|
21
|
+
import type { SubscriptionCoreTurn } from "./turn-context.js";
|
|
22
|
+
/** One provider's failover inputs. */
|
|
23
|
+
export type CoreFailoverBinding = {
|
|
24
|
+
displayName: string;
|
|
25
|
+
lease: (deps: TurnFailureDeps) => CoreSubscriptionTurnLease;
|
|
26
|
+
countRefusals: (db: Database, identity: SubscriptionCoreTurnIdentity) => Promise<number | null>;
|
|
27
|
+
/** Refusals one turn may take before it stops. */
|
|
28
|
+
refusalLimit: number;
|
|
29
|
+
/** The in-turn recovery's reason and its detail's provider label. */
|
|
30
|
+
recoveryReason: string;
|
|
31
|
+
recoveryProvider: string;
|
|
32
|
+
metrics: {
|
|
33
|
+
checkpoints: {
|
|
34
|
+
name: string;
|
|
35
|
+
help: string;
|
|
36
|
+
};
|
|
37
|
+
settlements: {
|
|
38
|
+
name: string;
|
|
39
|
+
help: string;
|
|
40
|
+
};
|
|
41
|
+
labels: (deps: TurnFailureDeps) => Record<string, string>;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
/** A recorded refusal (`unbounded`: it does not count toward the bound), or a graceful disconnect. */
|
|
45
|
+
export type CoreFailoverRefusal = {
|
|
46
|
+
kind: string;
|
|
47
|
+
unbounded: boolean;
|
|
48
|
+
} | "source_disconnected";
|
|
49
|
+
/**
|
|
50
|
+
* Refusals one turn may take before it stops: at most three in-turn switches
|
|
51
|
+
* (the contract and design require a bound but do not fix it; this is the
|
|
52
|
+
* small fixed bound chosen for M3, see design 5.1.1 "PR 2a").
|
|
53
|
+
*/
|
|
54
|
+
export declare const SUBSCRIPTION_CORE_TURN_REFUSAL_LIMIT = 4;
|
|
55
|
+
/**
|
|
56
|
+
* The shared failover metrics, labelled by provider (Codex keeps its M3
|
|
57
|
+
* `opengeni_codex_failover_*` metrics with `workspace_key`).
|
|
58
|
+
*/
|
|
59
|
+
export declare function subscriptionCoreFailoverMetrics(provider: string): CoreFailoverBinding["metrics"];
|
|
60
|
+
/** Pure bound: fail over while under the limit, stop at it. */
|
|
61
|
+
export declare function coreFailoverDisposition(refusals: number | null, limit: number): "failover" | "exhausted" | "unrecorded";
|
|
62
|
+
/**
|
|
63
|
+
* Re-place the same turn after graceful source disappearance, without a
|
|
64
|
+
* refusal budget, or settle a recorded refusal within its bound. Returns
|
|
65
|
+
* null when automatic replay is unsafe (the checkpoint did not become
|
|
66
|
+
* durable, or the bound could not be read): the caller then fails the turn
|
|
67
|
+
* with its typed copy instead.
|
|
68
|
+
*/
|
|
69
|
+
export declare function failOverCoreSubscriptionTurn(deps: TurnFailureDeps, core: SubscriptionCoreTurn, refusal: CoreFailoverRefusal, binding: CoreFailoverBinding): Promise<RunAgentTurnResult | null>;
|