@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,19 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
-
selectXaiCredentialForUse,
|
|
3
|
-
materializeXaiCredentialForRun,
|
|
4
|
-
resolveXaiProviderAccountAuthoritySnapshotForAcceptance,
|
|
5
|
-
getXaiSessionAccountPin,
|
|
6
|
-
setXaiSessionAccountPin,
|
|
7
2
|
getWorkspaceVideoGenerationPolicy,
|
|
8
3
|
loadWorkspaceVercelAiGatewayCredentialLease,
|
|
9
4
|
getExternalLinkTurnAuthorization,
|
|
10
5
|
getSessionTurnForAttempt,
|
|
11
6
|
ensureSessionReasoningConfiguration,
|
|
12
7
|
ensureSessionSkillCatalog,
|
|
8
|
+
sessionHasToolRouterHistory,
|
|
9
|
+
readSubscriptionCoreProviderRouteForWorkspace,
|
|
10
|
+
SUBSCRIPTION_CORE_XAI,
|
|
11
|
+
SUBSCRIPTION_CORE_XAI_PROVIDER,
|
|
13
12
|
} from "@opengeni/db";
|
|
13
|
+
import { subscriptionCoreVideoGenerationCredentialLease } from "../video-generation-subscription-core";
|
|
14
14
|
import { recoveryAwareSessionInstructions } from "./recovery-warning";
|
|
15
15
|
import {
|
|
16
16
|
formatSkillCatalog,
|
|
17
|
+
skillCatalogEntryIds,
|
|
18
|
+
type AgentPromptToolAvailability,
|
|
17
19
|
type AttemptConnectorActionBinding,
|
|
18
20
|
type BuildAgentOptions,
|
|
19
21
|
type ConnectorActionPolicyHooks,
|
|
@@ -22,18 +24,16 @@ import {
|
|
|
22
24
|
} from "@opengeni/runtime";
|
|
23
25
|
import {
|
|
24
26
|
serviceTierForLatencyMode,
|
|
25
|
-
environmentsEncryptionKeyBytes,
|
|
26
27
|
WORKSPACE_GATEWAY_PROVIDER_ID,
|
|
27
28
|
resolveModelProvider,
|
|
28
29
|
type Settings,
|
|
29
30
|
} from "@opengeni/config";
|
|
30
31
|
import { type CodexRequestContext, supportsReasoningConfiguration } from "@opengeni/codex";
|
|
31
|
-
import {
|
|
32
|
+
import { executeCoreXaiImageGeneration } from "../xai-image-generation";
|
|
32
33
|
import { rigProviderImageContentHash, videoGenerationCapabilitiesForPolicy } from "@opengeni/core";
|
|
33
34
|
import {
|
|
34
35
|
admitVideoGenerationRequest,
|
|
35
36
|
managedVideoGenerationCredentialLease,
|
|
36
|
-
xaiVideoGenerationCredentialLease,
|
|
37
37
|
type VideoGenerationCredentialLease,
|
|
38
38
|
} from "../video-generation-admission";
|
|
39
39
|
import { VideoReferenceInputError } from "../video-reference-staging";
|
|
@@ -44,29 +44,30 @@ import { summarizeCompanyBrainContributions } from "../../model-context-contribu
|
|
|
44
44
|
import { createTurnCredentialLeases } from "./credential-leases";
|
|
45
45
|
import { createTurnMediaArtifacts } from "./media-artifacts";
|
|
46
46
|
import { executeGatewayImageGeneration } from "../gateway-image-generation";
|
|
47
|
-
import {
|
|
47
|
+
import {
|
|
48
|
+
executeCodexImageGeneration,
|
|
49
|
+
executeCoreCodexImageGeneration,
|
|
50
|
+
} from "../codex-image-generation";
|
|
48
51
|
import {
|
|
49
52
|
ImageGenerationReferenceError,
|
|
50
53
|
resolveImageGenerationReferencesForTool,
|
|
51
54
|
} from "../image-generation-references";
|
|
52
55
|
import { SandboxChannelAService } from "@opengeni/runtime/sandbox";
|
|
53
56
|
import { sandboxRunAs } from "@opengeni/runtime";
|
|
54
|
-
import { VideoGenerationRejectedResult } from "@opengeni/contracts";
|
|
57
|
+
import { VideoGenerationRejectedResult, resolveAgentToolFamilies } from "@opengeni/contracts";
|
|
55
58
|
|
|
56
59
|
import {
|
|
57
60
|
structuredToolTransportForTurn,
|
|
58
|
-
hostedWebSearchForTurn,
|
|
59
61
|
connectedSubscriptionImageGenerationAuthority,
|
|
62
|
+
textVerbosityForTurn,
|
|
63
|
+
reasoningSummaryForTurn,
|
|
60
64
|
} from "./tool-policy";
|
|
61
65
|
import type { ClaimTurnOk } from "./claim";
|
|
62
66
|
import type { GovernanceModelOk } from "./governance-model";
|
|
63
67
|
import type { CompactionPrepOk } from "./compaction-prep";
|
|
64
68
|
import type { runtimeResourcesForTurn } from "./file-resources";
|
|
65
69
|
import type { sandboxArtifactRuntimeAdmission } from "./sandbox-route";
|
|
66
|
-
import type {
|
|
67
|
-
loadWorkspaceEnvironmentForRunWithCredentials,
|
|
68
|
-
sandboxEnvironmentForRun,
|
|
69
|
-
} from "../environment";
|
|
70
|
+
import type { sandboxEnvironmentForRun } from "../environment";
|
|
70
71
|
import type {
|
|
71
72
|
AttemptIdentityState,
|
|
72
73
|
EventingState,
|
|
@@ -76,8 +77,17 @@ import type {
|
|
|
76
77
|
import { SESSION_TITLE_MODEL_TOOL_NAME } from "./session-title";
|
|
77
78
|
import { resolveTurnSandboxAccess } from "./turn-sandbox-access";
|
|
78
79
|
import { resolveVideoReferenceSandboxAccess } from "./video-reference-sandbox";
|
|
80
|
+
import { turnWebSearchPlan } from "./web-search";
|
|
81
|
+
import {
|
|
82
|
+
attemptQuestionVaultValidator,
|
|
83
|
+
createAttemptSecretResolver,
|
|
84
|
+
secretsCapabilityEnabled,
|
|
85
|
+
type AttemptVaultAccess,
|
|
86
|
+
} from "./secret-resolver";
|
|
79
87
|
|
|
80
88
|
export type BuildTurnAgentDeps = {
|
|
89
|
+
/** Connected-vault providers and the shared read budget for this attempt. */
|
|
90
|
+
vaultAccess: AttemptVaultAccess;
|
|
81
91
|
skillCatalog: NonNullable<BuildAgentOptions["skillCatalog"]>;
|
|
82
92
|
mcpServers: Settings["mcpServers"];
|
|
83
93
|
input: RunAgentTurnInput;
|
|
@@ -109,14 +119,15 @@ export type BuildTurnAgentDeps = {
|
|
|
109
119
|
supportsImageInput: GovernanceModelOk["supportsImageInput"];
|
|
110
120
|
agentHumanInputEnabled: GovernanceModelOk["agentHumanInputEnabled"];
|
|
111
121
|
workspaceAgentInstructions: GovernanceModelOk["workspaceAgentInstructions"];
|
|
122
|
+
workspaceAgentIdentity: GovernanceModelOk["workspaceAgentIdentity"];
|
|
112
123
|
workspaceGovernance: GovernanceModelOk["workspaceGovernance"];
|
|
113
124
|
structuredWorkspacePolicyActive: GovernanceModelOk["structuredWorkspacePolicyActive"];
|
|
125
|
+
workspaceCreditModelsAllowed: GovernanceModelOk["workspaceCreditModelsAllowed"];
|
|
114
126
|
workspaceMemory: GovernanceModelOk["workspaceMemory"];
|
|
115
127
|
rigVersion: GovernanceModelOk["rigVersion"];
|
|
116
128
|
rigName: GovernanceModelOk["rigName"];
|
|
117
129
|
buildCompanyBrainContributionReceiptFor: GovernanceModelOk["buildCompanyBrainContributionReceiptFor"];
|
|
118
130
|
promptCacheKey: CompactionPrepOk["promptCacheKey"];
|
|
119
|
-
workspaceVariableSet: Awaited<ReturnType<typeof loadWorkspaceEnvironmentForRunWithCredentials>>;
|
|
120
131
|
runtimeResources: ReturnType<typeof runtimeResourcesForTurn>;
|
|
121
132
|
sandboxEnvironment: Record<string, string>;
|
|
122
133
|
sandboxArtifactRuntime: ReturnType<typeof sandboxArtifactRuntimeAdmission>;
|
|
@@ -131,6 +142,13 @@ export type BuildTurnAgentDeps = {
|
|
|
131
142
|
connectorActionPolicy: ConnectorActionPolicyHooks;
|
|
132
143
|
trigger: ClaimTurnOk["trigger"];
|
|
133
144
|
preparationIndependentToolNames: readonly string[];
|
|
145
|
+
/** The attempt's tool catalog includes the Jev-backed code_search tool. */
|
|
146
|
+
codeSearchAvailable: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Frozen clause availability for the modular instructions; undefined for
|
|
149
|
+
* sessions without an agent configuration. Rendering input only.
|
|
150
|
+
*/
|
|
151
|
+
promptToolAvailability?: AgentPromptToolAvailability | undefined;
|
|
134
152
|
videoGenerationAcceptancesByCallId: Map<string, { operationId: string; requestDigest: string }>;
|
|
135
153
|
activeSandboxBackend: Settings["sandboxBackend"] | undefined;
|
|
136
154
|
groupBoxBackend: Settings["sandboxBackend"];
|
|
@@ -169,6 +187,7 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
169
187
|
supportsImageInput,
|
|
170
188
|
agentHumanInputEnabled,
|
|
171
189
|
workspaceAgentInstructions,
|
|
190
|
+
workspaceAgentIdentity,
|
|
172
191
|
workspaceGovernance,
|
|
173
192
|
structuredWorkspacePolicyActive,
|
|
174
193
|
workspaceMemory,
|
|
@@ -176,7 +195,6 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
176
195
|
rigName,
|
|
177
196
|
buildCompanyBrainContributionReceiptFor,
|
|
178
197
|
promptCacheKey,
|
|
179
|
-
workspaceVariableSet,
|
|
180
198
|
runtimeResources,
|
|
181
199
|
sandboxEnvironment,
|
|
182
200
|
sandboxArtifactRuntime,
|
|
@@ -189,6 +207,8 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
189
207
|
connectorActionPolicy,
|
|
190
208
|
trigger,
|
|
191
209
|
preparationIndependentToolNames,
|
|
210
|
+
codeSearchAvailable,
|
|
211
|
+
promptToolAvailability,
|
|
192
212
|
videoGenerationAcceptancesByCallId,
|
|
193
213
|
activeSandboxBackend,
|
|
194
214
|
groupBoxBackend,
|
|
@@ -198,11 +218,12 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
198
218
|
const preparedTools = eventing.preparedTools!;
|
|
199
219
|
// Durable recovery truth is read for every attempt, including reconstruction
|
|
200
220
|
// after compaction. It is never inferred from transcript tool successes.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
session,
|
|
205
|
-
|
|
221
|
+
// These scoped reads are independent. Keep the second live video-policy
|
|
222
|
+
// read here rather than reusing tool preparation's earlier policy snapshot.
|
|
223
|
+
const [sessionInstructions, videoGenerationPolicy] = await Promise.all([
|
|
224
|
+
recoveryAwareSessionInstructions(db, input.workspaceId, session),
|
|
225
|
+
getWorkspaceVideoGenerationPolicy(db, input.workspaceId),
|
|
226
|
+
]);
|
|
206
227
|
|
|
207
228
|
const missingSessionTitleHint = preparationIndependentToolNames.includes(
|
|
208
229
|
SESSION_TITLE_MODEL_TOOL_NAME,
|
|
@@ -219,24 +240,13 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
219
240
|
// resolved ONCE at turn start (above) via resolveActiveSandboxBackend (the
|
|
220
241
|
// tested gate) and is reused here — resolving once is correct because the
|
|
221
242
|
// clone hook runs at beforeAgentStart, so a mid-turn swap can't affect it.
|
|
222
|
-
//
|
|
223
|
-
//
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
const workspaceEnvironmentOption: Pick<BuildAgentOptions, "workspaceEnvironment"> =
|
|
230
|
-
workspaceVariableSet
|
|
231
|
-
? {
|
|
232
|
-
workspaceEnvironment: {
|
|
233
|
-
name: workspaceVariableSet.name,
|
|
234
|
-
description: workspaceVariableSet.description,
|
|
235
|
-
variableNames: Object.keys(workspaceVariableSet.values),
|
|
236
|
-
},
|
|
237
|
-
}
|
|
238
|
-
: {};
|
|
239
|
-
const hostedWebSearch = hostedWebSearchForTurn(resolvedModel, runSettings.webSearchEnabled);
|
|
243
|
+
// Fallback mode (the default) keeps hosted search exactly as resolved; the
|
|
244
|
+
// operator's `replace` mode withholds it in favour of provider tools.
|
|
245
|
+
const hostedWebSearch = turnWebSearchPlan(
|
|
246
|
+
resolvedModel,
|
|
247
|
+
runSettings,
|
|
248
|
+
deps.workspaceCreditModelsAllowed,
|
|
249
|
+
).hostedWebSearch;
|
|
240
250
|
const resolveImageReferences = async (
|
|
241
251
|
references: Parameters<typeof resolveImageGenerationReferencesForTool>[0]["references"],
|
|
242
252
|
) =>
|
|
@@ -279,7 +289,7 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
279
289
|
// Never expose a paid image operation unless its permanent artifact can
|
|
280
290
|
// be committed. Failing after provider execution would leave an
|
|
281
291
|
// unrecoverable outcome-unknown operation with no user-visible image.
|
|
282
|
-
if (!objectStorage) return {};
|
|
292
|
+
if (!objectStorage || !resolveAgentToolFamilies(session.agent).media) return {};
|
|
283
293
|
if (nativeImageProviderBinding) {
|
|
284
294
|
media.nativeImageGenerationRetention = {
|
|
285
295
|
...nativeImageProviderBinding,
|
|
@@ -291,6 +301,47 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
291
301
|
}
|
|
292
302
|
|
|
293
303
|
if (resolvedModel?.provider.kind === "codex-subscription") {
|
|
304
|
+
// A turn placed by the shared core funds its image operations through
|
|
305
|
+
// core operation leases on its own connection, never the legacy tables.
|
|
306
|
+
const core = providerTurn.codexSubscriptionCore;
|
|
307
|
+
if (core) {
|
|
308
|
+
const executionGeneration = leases.codex.generation;
|
|
309
|
+
if (!codexContext || executionGeneration === null) return {};
|
|
310
|
+
return {
|
|
311
|
+
imageGeneration: {
|
|
312
|
+
kind: "provider_adapter",
|
|
313
|
+
execute: async ({ prompt, references }, { toolCallId }) => {
|
|
314
|
+
const referenceResolution = await resolveImageReferences(references);
|
|
315
|
+
if (referenceResolution.status === "rejected") return referenceResolution.result;
|
|
316
|
+
const receipt = await executeCoreCodexImageGeneration({
|
|
317
|
+
db,
|
|
318
|
+
settings: capabilitySettings,
|
|
319
|
+
objectStorage,
|
|
320
|
+
core,
|
|
321
|
+
executionGeneration,
|
|
322
|
+
clientVersion: codexContext.clientVersion,
|
|
323
|
+
assertChatLease: () => leases.codex.assertCurrentForDispatch(),
|
|
324
|
+
assertCreditAdmission: async () => {
|
|
325
|
+
await codexContext.getToken();
|
|
326
|
+
await codexContext.beforeProviderDispatch?.();
|
|
327
|
+
},
|
|
328
|
+
accountId: input.accountId,
|
|
329
|
+
workspaceId: input.workspaceId,
|
|
330
|
+
sessionId: input.sessionId,
|
|
331
|
+
turnId: turn.id,
|
|
332
|
+
attemptId: input.attemptId,
|
|
333
|
+
toolCallId,
|
|
334
|
+
prompt,
|
|
335
|
+
references: referenceResolution.references,
|
|
336
|
+
...(runtimeCancellationSignal ? { abortSignal: runtimeCancellationSignal } : {}),
|
|
337
|
+
});
|
|
338
|
+
media.rememberGeneratedImageCreatedThisTurn(receipt);
|
|
339
|
+
await media.materializeGeneratedImage(receipt);
|
|
340
|
+
return receipt;
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
};
|
|
344
|
+
}
|
|
294
345
|
const imageAuthority = connectedSubscriptionImageGenerationAuthority(
|
|
295
346
|
codexContext,
|
|
296
347
|
providerTurn.effectiveCodexCredentialId,
|
|
@@ -326,38 +377,45 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
326
377
|
}
|
|
327
378
|
|
|
328
379
|
if (resolvedModel?.provider.kind === "xai-subscription") {
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
)
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
380
|
+
// A SuperGrok turn placed by the shared core generates images on its own
|
|
381
|
+
// placed connection under an `image` operation lease; the session
|
|
382
|
+
// binding is never touched. A turn without a core placement offers no
|
|
383
|
+
// image tool (SuperGrok has no legacy path after its cutover).
|
|
384
|
+
const core = providerTurn.xaiSubscriptionCore;
|
|
385
|
+
if (core) {
|
|
386
|
+
const executionGeneration = leases.xai.generation;
|
|
387
|
+
if (executionGeneration === null) return {};
|
|
388
|
+
return {
|
|
389
|
+
imageGeneration: {
|
|
390
|
+
kind: "provider_adapter",
|
|
391
|
+
execute: async ({ prompt, references }, { toolCallId }) => {
|
|
392
|
+
const referenceResolution = await resolveImageReferences(references);
|
|
393
|
+
if (referenceResolution.status === "rejected") return referenceResolution.result;
|
|
394
|
+
const receipt = await executeCoreXaiImageGeneration({
|
|
395
|
+
db,
|
|
396
|
+
settings: capabilitySettings,
|
|
397
|
+
objectStorage,
|
|
398
|
+
core,
|
|
399
|
+
executionGeneration,
|
|
400
|
+
assertChatLease: () => leases.xai.assertCurrentForDispatch(),
|
|
401
|
+
accountId: input.accountId,
|
|
402
|
+
workspaceId: input.workspaceId,
|
|
403
|
+
sessionId: input.sessionId,
|
|
404
|
+
turnId: turn.id,
|
|
405
|
+
attemptId: input.attemptId,
|
|
406
|
+
toolCallId,
|
|
407
|
+
prompt,
|
|
408
|
+
references: referenceResolution.references,
|
|
409
|
+
...(runtimeCancellationSignal ? { abortSignal: runtimeCancellationSignal } : {}),
|
|
410
|
+
});
|
|
411
|
+
media.rememberGeneratedImageCreatedThisTurn(receipt);
|
|
412
|
+
await media.materializeGeneratedImage(receipt);
|
|
413
|
+
return receipt;
|
|
414
|
+
},
|
|
358
415
|
},
|
|
359
|
-
}
|
|
360
|
-
}
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
return {};
|
|
361
419
|
}
|
|
362
420
|
|
|
363
421
|
const gatewayResolution = resolveModelProvider(
|
|
@@ -395,14 +453,18 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
395
453
|
},
|
|
396
454
|
};
|
|
397
455
|
})();
|
|
398
|
-
const videoGenerationPolicy = await getWorkspaceVideoGenerationPolicy(db, input.workspaceId);
|
|
399
456
|
const videoGenerationEnabled =
|
|
400
457
|
videoGenerationPolicy.defaultModelId !== null &&
|
|
401
458
|
videoGenerationPolicy.enabledModelIds.length > 0;
|
|
402
459
|
let videoGenerationCredential: VideoGenerationCredentialLease | null = null;
|
|
403
|
-
if (objectStorage && videoGenerationEnabled) {
|
|
460
|
+
if (objectStorage && videoGenerationEnabled && resolveAgentToolFamilies(session.agent).media) {
|
|
404
461
|
if (videoGenerationPolicy.fundingSource === "opengeni_credits") {
|
|
405
|
-
|
|
462
|
+
// Credit-funded video honors the workspace switch that turns Opengeni
|
|
463
|
+
// credits off: no credential, so the tool is never offered.
|
|
464
|
+
videoGenerationCredential =
|
|
465
|
+
deps.workspaceCreditModelsAllowed === false
|
|
466
|
+
? null
|
|
467
|
+
: managedVideoGenerationCredentialLease(eventing.modelRunSettings);
|
|
406
468
|
} else if (videoGenerationPolicy.fundingSource === "workspace_gateway") {
|
|
407
469
|
const workspaceCredential = await loadWorkspaceVercelAiGatewayCredentialLease(
|
|
408
470
|
db,
|
|
@@ -416,70 +478,26 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
416
478
|
};
|
|
417
479
|
}
|
|
418
480
|
} else if (videoGenerationPolicy.fundingSource === "supergrok_subscription") {
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
? {
|
|
436
|
-
credentialId: providerTurn.effectiveXaiCredentialId,
|
|
437
|
-
rotationEnabled: providerTurn.xaiRotationEnabled,
|
|
438
|
-
}
|
|
439
|
-
: await selectXaiCredentialForUse(db, {
|
|
440
|
-
accountId: input.accountId,
|
|
441
|
-
workspaceId: input.workspaceId,
|
|
442
|
-
subjectId,
|
|
443
|
-
authoritySnapshot,
|
|
444
|
-
shardKey: input.sessionId,
|
|
445
|
-
pinnedCredentialId: pin?.pinnedCredentialId ?? null,
|
|
446
|
-
pinSource:
|
|
447
|
-
pin?.pinSource === "manual" || pin?.pinSource === "policy" ? pin.pinSource : null,
|
|
448
|
-
});
|
|
449
|
-
if (selected.credentialId) {
|
|
450
|
-
if (
|
|
451
|
-
selected.rotationEnabled &&
|
|
452
|
-
pin?.pinSource !== "manual" &&
|
|
453
|
-
pin?.pinnedCredentialId !== selected.credentialId
|
|
454
|
-
) {
|
|
455
|
-
await setXaiSessionAccountPin(db, {
|
|
456
|
-
accountId: input.accountId,
|
|
457
|
-
workspaceId: input.workspaceId,
|
|
458
|
-
subjectId,
|
|
459
|
-
sessionId: input.sessionId,
|
|
460
|
-
authoritySnapshot,
|
|
461
|
-
credentialId: selected.credentialId,
|
|
462
|
-
pinSource: "policy",
|
|
463
|
-
expectedVersion: pin?.version ?? null,
|
|
464
|
-
}).catch((error: unknown) => {
|
|
465
|
-
if (error instanceof Error && error.message === "xAI session pin changed") return;
|
|
466
|
-
throw error;
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
const credential = await materializeXaiCredentialForRun(db, {
|
|
481
|
+
const route = await readSubscriptionCoreProviderRouteForWorkspace(db, {
|
|
482
|
+
accountId: input.accountId,
|
|
483
|
+
workspaceId: input.workspaceId,
|
|
484
|
+
provider: SUBSCRIPTION_CORE_XAI_PROVIDER,
|
|
485
|
+
});
|
|
486
|
+
if (route === "core" && eventing.modelRunSettings.supergrokSubscriptionEnabled) {
|
|
487
|
+
// After the receipt: a shared connection for the session's owner,
|
|
488
|
+
// referenced (never copied) by the operation (EP-T17/EP-N12), only
|
|
489
|
+
// while the deployment enables SuperGrok subscriptions.
|
|
490
|
+
videoGenerationCredential = await subscriptionCoreVideoGenerationCredentialLease(
|
|
491
|
+
db,
|
|
492
|
+
eventing.modelRunSettings,
|
|
493
|
+
SUBSCRIPTION_CORE_XAI,
|
|
494
|
+
videoGenerationPolicy.fundingSource,
|
|
495
|
+
{
|
|
496
|
+
accountId: input.accountId,
|
|
470
497
|
workspaceId: input.workspaceId,
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
encryptionKey,
|
|
475
|
-
});
|
|
476
|
-
videoGenerationCredential = xaiVideoGenerationCredentialLease({
|
|
477
|
-
settings: eventing.modelRunSettings,
|
|
478
|
-
credential,
|
|
479
|
-
subjectId,
|
|
480
|
-
authoritySnapshot,
|
|
481
|
-
});
|
|
482
|
-
}
|
|
498
|
+
sessionId: input.sessionId,
|
|
499
|
+
},
|
|
500
|
+
);
|
|
483
501
|
}
|
|
484
502
|
}
|
|
485
503
|
}
|
|
@@ -567,6 +585,8 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
567
585
|
turnExecutionPolicy.providerId,
|
|
568
586
|
turnExecutionPolicy.latencyMode,
|
|
569
587
|
);
|
|
588
|
+
const textVerbosity = textVerbosityForTurn(resolvedModel, turnExecutionPolicy.upstreamModelId);
|
|
589
|
+
const reasoningSummary = reasoningSummaryForTurn(resolvedModel);
|
|
570
590
|
const approvedToolCallId = approvedConnectorActionCallId(trigger);
|
|
571
591
|
const modelVisibleSkillCatalogText = await ensureSessionSkillCatalog(db, {
|
|
572
592
|
accountId: input.accountId,
|
|
@@ -577,6 +597,7 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
577
597
|
expectedAttemptId: input.attemptId,
|
|
578
598
|
catalog: formatSkillCatalog(deps.skillCatalog),
|
|
579
599
|
});
|
|
600
|
+
eventing.modelVisibleSkillIds = skillCatalogEntryIds(modelVisibleSkillCatalogText);
|
|
580
601
|
try {
|
|
581
602
|
eventing.companyBrainContextContributions = summarizeCompanyBrainContributions(
|
|
582
603
|
buildCompanyBrainContributionReceiptFor(modelVisibleSkillCatalogText),
|
|
@@ -605,10 +626,16 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
605
626
|
eventing.modelRunSettings.reasoningConfigurationUpdatesEnabled &&
|
|
606
627
|
resolvedModel?.provider.api === "responses" &&
|
|
607
628
|
(resolvedModel.provider.id === "codex" || resolvedModel.provider.id === "openai") &&
|
|
608
|
-
supportsReasoningConfiguration(
|
|
629
|
+
supportsReasoningConfiguration(
|
|
630
|
+
turnExecutionPolicy.upstreamModelId,
|
|
631
|
+
turnExecutionPolicy.reasoningEffort,
|
|
632
|
+
);
|
|
609
633
|
const requestReasoningEffort =
|
|
610
634
|
useReasoningUpdates &&
|
|
611
|
-
supportsReasoningConfiguration(
|
|
635
|
+
supportsReasoningConfiguration(
|
|
636
|
+
turnExecutionPolicy.upstreamModelId,
|
|
637
|
+
turnExecutionPolicy.reasoningEffort,
|
|
638
|
+
)
|
|
612
639
|
? await ensureSessionReasoningConfiguration(db, {
|
|
613
640
|
accountId: input.accountId,
|
|
614
641
|
workspaceId: input.workspaceId,
|
|
@@ -616,9 +643,16 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
616
643
|
turnId: turn.id,
|
|
617
644
|
expectedExecutionGeneration: turn.executionGeneration,
|
|
618
645
|
expectedAttemptId: input.attemptId,
|
|
619
|
-
effort:
|
|
646
|
+
effort: turnExecutionPolicy.reasoningEffort,
|
|
620
647
|
})
|
|
621
|
-
:
|
|
648
|
+
: turnExecutionPolicy.reasoningEffort;
|
|
649
|
+
const toolRouterInHistory = session.agent
|
|
650
|
+
? await sessionHasToolRouterHistory(db, {
|
|
651
|
+
accountId: input.accountId,
|
|
652
|
+
workspaceId: input.workspaceId,
|
|
653
|
+
sessionId: input.sessionId,
|
|
654
|
+
})
|
|
655
|
+
: false;
|
|
622
656
|
const agent = (() => {
|
|
623
657
|
const agentConstructionStartedAt = performance.now();
|
|
624
658
|
let agentConstructionOutcome: "completed" | "failed" = "completed";
|
|
@@ -645,11 +679,35 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
645
679
|
}
|
|
646
680
|
: {}),
|
|
647
681
|
...(preparedTools.inputWaitYield ? { inputWaitYield: preparedTools.inputWaitYield } : {}),
|
|
682
|
+
...(session.agent ? { agentConfig: session.agent, toolRouterInHistory } : {}),
|
|
683
|
+
...(session.agent && promptToolAvailability
|
|
684
|
+
? { agentPromptToolAvailability: promptToolAvailability }
|
|
685
|
+
: {}),
|
|
648
686
|
reasoningEffort: requestReasoningEffort,
|
|
687
|
+
...(reasoningSummary ? { reasoningSummary } : {}),
|
|
649
688
|
latencyMode: turnExecutionPolicy.latencyMode,
|
|
650
689
|
...(serviceTier ? { serviceTier } : {}),
|
|
690
|
+
...(textVerbosity ? { textVerbosity } : {}),
|
|
651
691
|
...(humanInputResume ? { humanInputResponse: humanInputResume } : {}),
|
|
652
692
|
humanInputEnabled: agentHumanInputEnabled,
|
|
693
|
+
secrets: {
|
|
694
|
+
referencesEnabled: secretsCapabilityEnabled(session.agent),
|
|
695
|
+
// Same rule as the vault context (0739) and session authorization:
|
|
696
|
+
// the initiating human, else a subject initiator.
|
|
697
|
+
hasActingHuman: Boolean(
|
|
698
|
+
turn.initiatingHumanSubjectId ??
|
|
699
|
+
(turn.initiator?.kind === "subject" ? turn.initiator.subjectId : null),
|
|
700
|
+
),
|
|
701
|
+
validateQuestionVault: attemptQuestionVaultValidator({
|
|
702
|
+
db,
|
|
703
|
+
accountId: input.accountId,
|
|
704
|
+
workspaceId: input.workspaceId,
|
|
705
|
+
sessionId: input.sessionId,
|
|
706
|
+
turnId: turn.id,
|
|
707
|
+
attemptId: input.attemptId,
|
|
708
|
+
executionGeneration: turn.executionGeneration,
|
|
709
|
+
}),
|
|
710
|
+
},
|
|
653
711
|
missingSessionTitleHint,
|
|
654
712
|
sandboxEnvironment,
|
|
655
713
|
...(preparedTools.attemptToolCatalog
|
|
@@ -657,6 +715,19 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
657
715
|
: {}),
|
|
658
716
|
...(sandboxArtifactRuntime.available ? { artifactRuntimeAvailable: true } : {}),
|
|
659
717
|
...(cancellationSignal ? { turnCancellationSignal: cancellationSignal } : {}),
|
|
718
|
+
// W1: `{{secret:…}}` references resolve at the exec boundary.
|
|
719
|
+
secretResolver: createAttemptSecretResolver({
|
|
720
|
+
db,
|
|
721
|
+
settings: eventing.modelRunSettings,
|
|
722
|
+
accountId: input.accountId,
|
|
723
|
+
workspaceId: input.workspaceId,
|
|
724
|
+
sessionId: input.sessionId,
|
|
725
|
+
turnId: turn.id,
|
|
726
|
+
attemptId: input.attemptId,
|
|
727
|
+
executionGeneration: turn.executionGeneration,
|
|
728
|
+
agent: session.agent,
|
|
729
|
+
vaultAccess: deps.vaultAccess,
|
|
730
|
+
}),
|
|
660
731
|
onToolCancellationFence: (fence) => {
|
|
661
732
|
eventing.toolCancellationFenceRef.current = fence;
|
|
662
733
|
},
|
|
@@ -676,6 +747,7 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
676
747
|
? { gitTokenSeed: sandboxGitToken }
|
|
677
748
|
: {}),
|
|
678
749
|
...(sandboxCodemodeToken ? { codemodeAvailable: true } : {}),
|
|
750
|
+
...(codeSearchAvailable ? { codeSearchAvailable: true } : {}),
|
|
679
751
|
// Managed boxes receive the bearer through their protected per-session
|
|
680
752
|
// token file. Connected Machines use transient per-exec delivery above,
|
|
681
753
|
// so they must not run the file-seeding lifecycle hook.
|
|
@@ -734,8 +806,8 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
734
806
|
// tool. Gateway Responses routes likewise expose ordinary function
|
|
735
807
|
// tools, not OpenAI-hosted sandbox tools. Tell buildAgent to use
|
|
736
808
|
// function apply_patch and wrap successful view_image results as
|
|
737
|
-
// typed input_image content. Chat
|
|
738
|
-
//
|
|
809
|
+
// typed input_image content. The Chat adapter projects tool images
|
|
810
|
+
// into a labelled image envelope after the paired tool results.
|
|
739
811
|
structuredToolTransport: structuredToolTransportForTurn(resolvedModel),
|
|
740
812
|
...(promptCacheKey ? { promptCacheKey } : {}),
|
|
741
813
|
}
|
|
@@ -748,6 +820,16 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
748
820
|
onRetainableSessionImageOutput: media.retainSessionImageAtToolBoundary,
|
|
749
821
|
skillCatalog: deps.skillCatalog,
|
|
750
822
|
skillCatalogInHistory: true,
|
|
823
|
+
// A session with an agent configuration composes the modular prompt
|
|
824
|
+
// (identity, base behavior, runtime mechanics, capability modules);
|
|
825
|
+
// its workspace identity survives instruction policies. Null keeps
|
|
826
|
+
// the legacy composition below byte-for-byte.
|
|
827
|
+
...(session.agent
|
|
828
|
+
? {
|
|
829
|
+
agentConfig: session.agent,
|
|
830
|
+
...(workspaceAgentIdentity ? { workspaceAgentIdentity } : {}),
|
|
831
|
+
}
|
|
832
|
+
: {}),
|
|
751
833
|
...(!structuredWorkspacePolicyActive && workspaceAgentInstructions
|
|
752
834
|
? { instructionsTemplate: workspaceAgentInstructions }
|
|
753
835
|
: {}),
|
|
@@ -757,7 +839,6 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
757
839
|
// Composed system-level AFTER the workspace persona so it refines it for
|
|
758
840
|
// this one session; absent ⇒ byte-identical to today's composition.
|
|
759
841
|
...(sessionInstructions ? { sessionInstructions } : {}),
|
|
760
|
-
...workspaceEnvironmentOption,
|
|
761
842
|
// RIG RUNTIME (M3): the doctrine block, the setup-script hook (only when
|
|
762
843
|
// the frozen version carries a non-empty script), and the rig credential
|
|
763
844
|
// hooks. All absent for a rig-less turn (byte-for-byte today).
|