@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
|
@@ -6,13 +6,18 @@ import {
|
|
|
6
6
|
COMPUTER_SCREENSHOT_WORKSPACE_QUOTA_BYTES,
|
|
7
7
|
RetainedArtifactMetadataSchema,
|
|
8
8
|
retainedScreenshotReferenceFromFile,
|
|
9
|
+
retainedSessionScreenshotKindFromObjectKey,
|
|
9
10
|
type RetainedArtifactMetadata,
|
|
10
11
|
type RetainedArtifactReference,
|
|
11
12
|
type RetainedOutputUnavailableReason,
|
|
13
|
+
type RetainedSessionScreenshotKind,
|
|
12
14
|
} from "@opengeni/contracts";
|
|
13
15
|
import {
|
|
14
16
|
RetainedScreenshotQuotaExceededError,
|
|
15
17
|
getRetainedScreenshotArtifact,
|
|
18
|
+
getRetainedScreenshotArtifactForToolCall,
|
|
19
|
+
getWithheldRetainedScreenshotArtifactIdForToolCall,
|
|
20
|
+
getWithheldRetainedScreenshotArtifactState,
|
|
16
21
|
isDatabasePersistenceFailure,
|
|
17
22
|
isSessionEventPersistenceError,
|
|
18
23
|
prepareRetainedScreenshotArtifact,
|
|
@@ -23,6 +28,7 @@ import {
|
|
|
23
28
|
} from "@opengeni/db";
|
|
24
29
|
import { retryWhileMissing, type ObjectStorage } from "@opengeni/storage";
|
|
25
30
|
import { createHash } from "node:crypto";
|
|
31
|
+
import { requesterUnavailableReceiptText } from "./requester-unavailable-receipt";
|
|
26
32
|
|
|
27
33
|
const PNG_SIGNATURE = Uint8Array.of(0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a);
|
|
28
34
|
const PNG_ALLOWED_CRITICAL_CHUNKS = new Set(["IHDR", "PLTE", "IDAT", "IEND"]);
|
|
@@ -209,14 +215,26 @@ export function toolOutputContainsInlineImage(output: unknown): boolean {
|
|
|
209
215
|
return (
|
|
210
216
|
(record.type === "input_image" &&
|
|
211
217
|
sdkImageSourceContainsInlineImage(record.image ?? record.image_url ?? record.imageUrl)) ||
|
|
212
|
-
(record.type === "image" &&
|
|
218
|
+
(record.type === "image" && isDeclaredInlineMcpImage(record))
|
|
213
219
|
);
|
|
214
220
|
});
|
|
215
221
|
}
|
|
216
222
|
if (!output || typeof output !== "object") return false;
|
|
217
223
|
const record = output as Record<string, unknown>;
|
|
218
224
|
if (Array.isArray(record.content)) return toolOutputContainsInlineImage(record.content);
|
|
219
|
-
return
|
|
225
|
+
return (
|
|
226
|
+
record.type === "image" &&
|
|
227
|
+
(sdkImageSourceContainsInlineImage(record.image) || isDeclaredInlineMcpImage(record))
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** Detect image-bearing MCP blocks even when decoding rejects oversized or malformed bytes. */
|
|
232
|
+
function isDeclaredInlineMcpImage(record: Record<string, unknown>): boolean {
|
|
233
|
+
return (
|
|
234
|
+
typeof record.data === "string" &&
|
|
235
|
+
typeof record.mimeType === "string" &&
|
|
236
|
+
record.mimeType.toLowerCase().startsWith("image/")
|
|
237
|
+
);
|
|
220
238
|
}
|
|
221
239
|
|
|
222
240
|
function decodeInlineMcpImage(
|
|
@@ -520,9 +538,14 @@ export function retainedScreenshotIdentity(input: {
|
|
|
520
538
|
attemptId: string;
|
|
521
539
|
toolCallId: string;
|
|
522
540
|
toolOutputId: string;
|
|
541
|
+
kind?: RetainedSessionScreenshotKind | undefined;
|
|
523
542
|
}): { artifactId: string; settlementKey: string } {
|
|
524
543
|
const settlementKey = createHash("sha256")
|
|
525
|
-
.update(
|
|
544
|
+
.update(
|
|
545
|
+
input.kind === "browser_screenshot"
|
|
546
|
+
? "opengeni:browser-screenshot:v1\0"
|
|
547
|
+
: "opengeni:computer-screenshot:v1\0",
|
|
548
|
+
)
|
|
526
549
|
.update(input.sessionId)
|
|
527
550
|
.update("\0")
|
|
528
551
|
.update(input.turnId)
|
|
@@ -551,12 +574,13 @@ export function unavailableRetainedSessionImage(input: {
|
|
|
551
574
|
toolCallId: string;
|
|
552
575
|
toolOutputId: string;
|
|
553
576
|
reason: RetainedOutputUnavailableReason;
|
|
577
|
+
kind?: RetainedSessionScreenshotKind | undefined;
|
|
554
578
|
}): RetainedArtifactMetadata {
|
|
555
579
|
const identity = retainedScreenshotIdentity(input);
|
|
556
580
|
return unavailable(identity.artifactId, input.reason);
|
|
557
581
|
}
|
|
558
582
|
|
|
559
|
-
export async function
|
|
583
|
+
export async function retainSessionScreenshot(input: {
|
|
560
584
|
db: Database;
|
|
561
585
|
objectStorage: ObjectStorage | null;
|
|
562
586
|
accountId: string;
|
|
@@ -565,6 +589,7 @@ export async function retainComputerScreenshot(input: {
|
|
|
565
589
|
turnId: string;
|
|
566
590
|
attemptId: string;
|
|
567
591
|
output: TypedScreenshotToolOutput;
|
|
592
|
+
kind?: RetainedSessionScreenshotKind | undefined;
|
|
568
593
|
now?: Date;
|
|
569
594
|
retentionMs?: number;
|
|
570
595
|
workspaceQuotaBytes?: number;
|
|
@@ -575,6 +600,7 @@ export async function retainComputerScreenshot(input: {
|
|
|
575
600
|
attemptId: input.attemptId,
|
|
576
601
|
toolCallId: input.output.callId,
|
|
577
602
|
toolOutputId: input.output.toolOutputId,
|
|
603
|
+
kind: input.kind,
|
|
578
604
|
});
|
|
579
605
|
let screenshot: ValidatedSessionImage;
|
|
580
606
|
try {
|
|
@@ -594,7 +620,8 @@ export async function retainComputerScreenshot(input: {
|
|
|
594
620
|
const retentionExpiresAt = new Date(
|
|
595
621
|
now.getTime() + (input.retentionMs ?? COMPUTER_SCREENSHOT_RETENTION_MS),
|
|
596
622
|
);
|
|
597
|
-
const
|
|
623
|
+
const objectName = input.kind === "browser_screenshot" ? "browser-screenshot" : "session-image";
|
|
624
|
+
const objectKey = `workspaces/${input.workspaceId}/files/${identity.artifactId}/retained/${objectName}.${screenshot.extension}`;
|
|
598
625
|
let prepared: RetainedScreenshotArtifact;
|
|
599
626
|
try {
|
|
600
627
|
prepared = (
|
|
@@ -697,6 +724,9 @@ export async function retainComputerScreenshot(input: {
|
|
|
697
724
|
}
|
|
698
725
|
}
|
|
699
726
|
|
|
727
|
+
/** Existing computer callers keep their stable entry point. */
|
|
728
|
+
export const retainComputerScreenshot = retainSessionScreenshot;
|
|
729
|
+
|
|
700
730
|
/** Replace only new screenshot bytes with a compact receipt before first persistence. */
|
|
701
731
|
export function compactRetainedScreenshotHistory(
|
|
702
732
|
history: Array<Record<string, unknown>>,
|
|
@@ -847,7 +877,7 @@ export async function materializeRetainedScreenshotRunState(input: {
|
|
|
847
877
|
}): Promise<string> {
|
|
848
878
|
const parsed = parseSerializedRunState(input.serialized);
|
|
849
879
|
if (!parsed) return input.serialized;
|
|
850
|
-
const cache = new Map<string, string>();
|
|
880
|
+
const cache = new Map<string, string | null>();
|
|
851
881
|
let changed = false;
|
|
852
882
|
await visitSerializedRunStateItemArraysAsync(parsed, async (items) => {
|
|
853
883
|
const materialized = await materializeRetainedScreenshotHistoryWithCache(
|
|
@@ -871,12 +901,57 @@ async function materializeRetainedScreenshotHistoryWithCache(
|
|
|
871
901
|
history: Array<Record<string, unknown>>;
|
|
872
902
|
now?: Date;
|
|
873
903
|
},
|
|
874
|
-
|
|
904
|
+
// A null entry records an image the current requester's file authority withholds.
|
|
905
|
+
cache: Map<string, string | null>,
|
|
875
906
|
): Promise<Array<Record<string, unknown>>> {
|
|
876
907
|
const now = input.now ?? new Date();
|
|
877
|
-
const
|
|
908
|
+
const receiptForMarker = async (
|
|
909
|
+
marker: unknown,
|
|
910
|
+
callId: string | null,
|
|
911
|
+
): Promise<RetainedArtifactMetadata | null> => {
|
|
912
|
+
if (!isRetainedImageMarker(marker)) return null;
|
|
913
|
+
const receipt = retainedReceipt(marker.artifact);
|
|
914
|
+
if (receipt) return receipt;
|
|
915
|
+
// Older canonical history could truncate the artifact UUID and reason as
|
|
916
|
+
// ordinary text. Recover only from this exact session and an unambiguous
|
|
917
|
+
// tool call; otherwise fail before constructing a malformed model image.
|
|
918
|
+
if (!callId) throw new Error("Retained screenshot receipt has no tool call identity");
|
|
919
|
+
const artifact = await getRetainedScreenshotArtifactForToolCall(
|
|
920
|
+
input.db,
|
|
921
|
+
input.workspaceId,
|
|
922
|
+
input.sessionId,
|
|
923
|
+
callId,
|
|
924
|
+
);
|
|
925
|
+
if (artifact) return reference(artifact);
|
|
926
|
+
// The exact screenshot may exist with its file withheld from this requester.
|
|
927
|
+
// Carry only its id; dataUrlForReceipt re-applies the withheld lifecycle checks.
|
|
928
|
+
const withheldId = await getWithheldRetainedScreenshotArtifactIdForToolCall(
|
|
929
|
+
input.db,
|
|
930
|
+
input.workspaceId,
|
|
931
|
+
input.sessionId,
|
|
932
|
+
callId,
|
|
933
|
+
);
|
|
934
|
+
if (!withheldId) throw new Error("Retained screenshot receipt cannot be recovered");
|
|
935
|
+
return unavailable(withheldId, "pending");
|
|
936
|
+
};
|
|
937
|
+
const assertRetainedState = (
|
|
938
|
+
artifactId: string,
|
|
939
|
+
state: { status: RetainedScreenshotArtifact["status"]; retentionExpiresAt: Date },
|
|
940
|
+
) => {
|
|
941
|
+
if (state.status !== "ready") {
|
|
942
|
+
throw new RetainedScreenshotUnavailableError(
|
|
943
|
+
artifactId,
|
|
944
|
+
unavailableReasonForStatus(state.status),
|
|
945
|
+
);
|
|
946
|
+
}
|
|
947
|
+
if (state.retentionExpiresAt.getTime() <= now.getTime()) {
|
|
948
|
+
throw new RetainedScreenshotUnavailableError(artifactId, "expired");
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
/** The image as a data URL, or null when file authority withholds it. */
|
|
952
|
+
const dataUrlForReceipt = async (receipt: RetainedArtifactMetadata): Promise<string | null> => {
|
|
878
953
|
let dataUrl = cache.get(receipt.artifactId);
|
|
879
|
-
if (
|
|
954
|
+
if (dataUrl === undefined) {
|
|
880
955
|
if (!input.objectStorage) {
|
|
881
956
|
throw new RetainedScreenshotUnavailableError(receipt.artifactId, "missing_storage");
|
|
882
957
|
}
|
|
@@ -886,16 +961,24 @@ async function materializeRetainedScreenshotHistoryWithCache(
|
|
|
886
961
|
input.sessionId,
|
|
887
962
|
receipt.artifactId,
|
|
888
963
|
);
|
|
889
|
-
if (!artifact)
|
|
890
|
-
|
|
891
|
-
|
|
964
|
+
if (!artifact) {
|
|
965
|
+
// In a shared session another participant's private image keeps its
|
|
966
|
+
// artifact row but hides its file from this requester. Lifecycle
|
|
967
|
+
// failures stay exactly as for a readable image; a live image becomes
|
|
968
|
+
// a neutral receipt instead of failing the whole turn. No bytes, no
|
|
969
|
+
// fetch hint, and no new access.
|
|
970
|
+
const withheld = await getWithheldRetainedScreenshotArtifactState(
|
|
971
|
+
input.db,
|
|
972
|
+
input.workspaceId,
|
|
973
|
+
input.sessionId,
|
|
892
974
|
receipt.artifactId,
|
|
893
|
-
unavailableReasonForStatus(artifact.status),
|
|
894
975
|
);
|
|
976
|
+
if (!withheld) throw new RetainedScreenshotUnavailableError(receipt.artifactId, "deleted");
|
|
977
|
+
assertRetainedState(receipt.artifactId, withheld);
|
|
978
|
+
cache.set(receipt.artifactId, null);
|
|
979
|
+
return null;
|
|
895
980
|
}
|
|
896
|
-
|
|
897
|
-
throw new RetainedScreenshotUnavailableError(receipt.artifactId, "expired");
|
|
898
|
-
}
|
|
981
|
+
assertRetainedState(receipt.artifactId, artifact);
|
|
899
982
|
const object = await retryWhileMissing(async () =>
|
|
900
983
|
input.objectStorage!.getObjectBytes(artifact.file.objectKey),
|
|
901
984
|
);
|
|
@@ -921,20 +1004,29 @@ async function materializeRetainedScreenshotHistoryWithCache(
|
|
|
921
1004
|
}
|
|
922
1005
|
return dataUrl;
|
|
923
1006
|
};
|
|
924
|
-
const
|
|
925
|
-
|
|
1007
|
+
const withheldReceiptText = (receipt: RetainedArtifactMetadata) =>
|
|
1008
|
+
requesterUnavailableReceiptText(`Image: retained artifactId=${receipt.artifactId}`, "image");
|
|
1009
|
+
const materializeEntry = async (entry: unknown, callId: string | null): Promise<unknown> => {
|
|
1010
|
+
const image =
|
|
1011
|
+
entry && typeof entry === "object" && !Array.isArray(entry)
|
|
1012
|
+
? (entry as Record<string, unknown>).image
|
|
1013
|
+
: null;
|
|
1014
|
+
const receipt = await receiptForMarker(image, callId);
|
|
926
1015
|
if (!receipt) return entry;
|
|
927
1016
|
const dataUrl = await dataUrlForReceipt(receipt);
|
|
928
|
-
return { ...(entry as Record<string, unknown>), image: dataUrl };
|
|
1017
|
+
if (dataUrl !== null) return { ...(entry as Record<string, unknown>), image: dataUrl };
|
|
1018
|
+
return { type: "input_text", text: withheldReceiptText(receipt) };
|
|
929
1019
|
};
|
|
930
1020
|
|
|
931
1021
|
const materialized: Array<Record<string, unknown>> = [];
|
|
932
1022
|
for (const item of input.history) {
|
|
933
|
-
const
|
|
1023
|
+
const callId = historyCallId(item);
|
|
1024
|
+
const directReceipt = await receiptForMarker(item.output, callId);
|
|
934
1025
|
if (directReceipt) {
|
|
1026
|
+
const dataUrl = await dataUrlForReceipt(directReceipt);
|
|
935
1027
|
materialized.push({
|
|
936
1028
|
...item,
|
|
937
|
-
output:
|
|
1029
|
+
output: dataUrl ?? withheldReceiptText(directReceipt),
|
|
938
1030
|
});
|
|
939
1031
|
continue;
|
|
940
1032
|
}
|
|
@@ -954,7 +1046,7 @@ async function materializeRetainedScreenshotHistoryWithCache(
|
|
|
954
1046
|
let changed = false;
|
|
955
1047
|
const output: unknown[] = [];
|
|
956
1048
|
for (const entry of outputEntries) {
|
|
957
|
-
const next = await materializeEntry(entry);
|
|
1049
|
+
const next = await materializeEntry(entry, callId);
|
|
958
1050
|
changed ||= next !== entry;
|
|
959
1051
|
output.push(next);
|
|
960
1052
|
}
|
|
@@ -1059,12 +1151,15 @@ function reference(artifact: RetainedScreenshotArtifact): RetainedArtifactRefere
|
|
|
1059
1151
|
if (!artifact.sessionId) {
|
|
1060
1152
|
throw new Error(`Ready retained screenshot is detached: ${artifact.artifactId}`);
|
|
1061
1153
|
}
|
|
1154
|
+
const kind = retainedSessionScreenshotKindFromObjectKey(artifact.file.objectKey);
|
|
1155
|
+
if (!kind) throw new Error(`Ready retained screenshot has unknown key: ${artifact.artifactId}`);
|
|
1062
1156
|
const value = retainedScreenshotReferenceFromFile({
|
|
1063
1157
|
...artifact.file,
|
|
1064
1158
|
sessionId: artifact.sessionId,
|
|
1065
1159
|
width: artifact.width,
|
|
1066
1160
|
height: artifact.height,
|
|
1067
1161
|
expiresAt: artifact.retentionExpiresAt.toISOString(),
|
|
1162
|
+
kind,
|
|
1068
1163
|
});
|
|
1069
1164
|
if (!value)
|
|
1070
1165
|
throw new Error(`Ready retained screenshot receipt is invalid: ${artifact.artifactId}`);
|
|
@@ -1110,6 +1205,18 @@ function retainedReceiptFromImageContent(entry: unknown): RetainedArtifactMetada
|
|
|
1110
1205
|
return retainedReceipt(marker.artifact);
|
|
1111
1206
|
}
|
|
1112
1207
|
|
|
1208
|
+
function isRetainedImageMarker(value: unknown): value is {
|
|
1209
|
+
type: "retained_artifact";
|
|
1210
|
+
artifact: unknown;
|
|
1211
|
+
} {
|
|
1212
|
+
return Boolean(
|
|
1213
|
+
value &&
|
|
1214
|
+
typeof value === "object" &&
|
|
1215
|
+
!Array.isArray(value) &&
|
|
1216
|
+
(value as Record<string, unknown>).type === RETAINED_IMAGE_MARKER,
|
|
1217
|
+
);
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1113
1220
|
function retainedReceiptFromDirectOutput(output: unknown): RetainedArtifactMetadata | null {
|
|
1114
1221
|
if (!output || typeof output !== "object" || Array.isArray(output)) return null;
|
|
1115
1222
|
const marker = output as Record<string, unknown>;
|
|
@@ -1120,7 +1227,11 @@ function retainedReceiptFromDirectOutput(output: unknown): RetainedArtifactMetad
|
|
|
1120
1227
|
function retainedReceipt(value: unknown): RetainedArtifactMetadata | null {
|
|
1121
1228
|
const parsed = RetainedArtifactMetadataSchema.safeParse(value);
|
|
1122
1229
|
if (!parsed.success) return null;
|
|
1123
|
-
return parsed.data.available &&
|
|
1230
|
+
return parsed.data.available &&
|
|
1231
|
+
parsed.data.kind !== "computer_screenshot" &&
|
|
1232
|
+
parsed.data.kind !== "browser_screenshot"
|
|
1233
|
+
? null
|
|
1234
|
+
: parsed.data;
|
|
1124
1235
|
}
|
|
1125
1236
|
|
|
1126
1237
|
function isInlineImageContent(entry: unknown): boolean {
|
|
@@ -1130,7 +1241,7 @@ function isInlineImageContent(entry: unknown): boolean {
|
|
|
1130
1241
|
(record.type === "input_image" &&
|
|
1131
1242
|
typeof record.image === "string" &&
|
|
1132
1243
|
record.image.startsWith("data:image/")) ||
|
|
1133
|
-
(record.type === "image" &&
|
|
1244
|
+
(record.type === "image" && isDeclaredInlineMcpImage(record))
|
|
1134
1245
|
);
|
|
1135
1246
|
}
|
|
1136
1247
|
|
|
@@ -28,6 +28,18 @@ export type RunCredentialRenewalOptions = {
|
|
|
28
28
|
}) => void;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
+
export function runCredentialRenewalExpiry(
|
|
32
|
+
material: NormalizedRunCredentialMaterial | null,
|
|
33
|
+
): Date | null {
|
|
34
|
+
const expiries = [
|
|
35
|
+
...(material?.expiresAt ? [material.expiresAt.getTime()] : []),
|
|
36
|
+
...(material?.mcp ?? []).flatMap((entry) =>
|
|
37
|
+
entry.expiresAt ? [Date.parse(entry.expiresAt)] : [],
|
|
38
|
+
),
|
|
39
|
+
];
|
|
40
|
+
return expiries.length ? new Date(Math.min(...expiries)) : null;
|
|
41
|
+
}
|
|
42
|
+
|
|
31
43
|
export function nextRunCredentialRenewalDelay(expiresAt: Date | null, nowMs = Date.now()): number {
|
|
32
44
|
return nextExpiringMaterialRenewalDelay(
|
|
33
45
|
expiresAt,
|
|
@@ -52,7 +64,7 @@ export function startRunCredentialRenewalLoop(
|
|
|
52
64
|
initialExpiresAt: options.initialExpiresAt,
|
|
53
65
|
resolve: options.resolve,
|
|
54
66
|
write: options.write,
|
|
55
|
-
expiresAt:
|
|
67
|
+
expiresAt: runCredentialRenewalExpiry,
|
|
56
68
|
publicErrorClass: "RunCredentialRenewalOperationError",
|
|
57
69
|
policy: {
|
|
58
70
|
defaultRefreshMs: RUN_CREDENTIAL_DEFAULT_REFRESH_MS,
|
|
@@ -5,12 +5,16 @@ import type {
|
|
|
5
5
|
RunCredentialsRequest,
|
|
6
6
|
Session,
|
|
7
7
|
SessionTurn,
|
|
8
|
+
ToolRef,
|
|
8
9
|
} from "@opengeni/contracts";
|
|
10
|
+
import type { Settings } from "@opengeni/config";
|
|
9
11
|
import { getSessionRootId, type Database } from "@opengeni/db";
|
|
10
12
|
import {
|
|
11
13
|
normalizeRunCredentialsResolution,
|
|
14
|
+
selectedSessionRemoteMcpTargets,
|
|
12
15
|
type NormalizedRunCredentialMaterial,
|
|
13
16
|
} from "@opengeni/runtime";
|
|
17
|
+
import { workspaceCredentialProviderResolver } from "./workspace-credential-provider";
|
|
14
18
|
|
|
15
19
|
export type RunCredentialResolutionContext = {
|
|
16
20
|
db: Database;
|
|
@@ -18,10 +22,17 @@ export type RunCredentialResolutionContext = {
|
|
|
18
22
|
accountId: string;
|
|
19
23
|
workspaceId: string;
|
|
20
24
|
session: Session;
|
|
21
|
-
turn: SessionTurn;
|
|
25
|
+
turn: SessionTurn & { initiatingHumanSubjectId?: string | null };
|
|
22
26
|
attemptId: string;
|
|
23
27
|
effectiveSandboxBackend: SandboxBackend;
|
|
24
28
|
variableSet: { id: string; name: string } | null;
|
|
29
|
+
/** Enables the workspace's configured HTTP credential provider. */
|
|
30
|
+
settings?: Settings;
|
|
31
|
+
initiatingHumanSubjectId?: string | null;
|
|
32
|
+
/** Installed in-process API routes must never enter a product callback. */
|
|
33
|
+
localMcpServerIds?: readonly string[];
|
|
34
|
+
/** Exact execution selection, resolved once at the turn policy boundary. */
|
|
35
|
+
effectiveTools: readonly ToolRef[];
|
|
25
36
|
};
|
|
26
37
|
|
|
27
38
|
export type BoundRunCredentialResolver = {
|
|
@@ -32,7 +43,10 @@ export type BoundRunCredentialResolver = {
|
|
|
32
43
|
};
|
|
33
44
|
|
|
34
45
|
export function buildRunCredentialsRequest(
|
|
35
|
-
input: Omit<
|
|
46
|
+
input: Omit<
|
|
47
|
+
RunCredentialResolutionContext,
|
|
48
|
+
"db" | "connectionCredentials" | "settings" | "initiatingHumanSubjectId" | "effectiveTools"
|
|
49
|
+
> & {
|
|
36
50
|
rootSessionId: string;
|
|
37
51
|
purpose: "provision" | "renewal";
|
|
38
52
|
forceRefresh: boolean;
|
|
@@ -78,7 +92,7 @@ export function runCredentialModelNote(
|
|
|
78
92
|
): string | undefined {
|
|
79
93
|
if (material.authNeeded.length === 0) return undefined;
|
|
80
94
|
return [
|
|
81
|
-
"[
|
|
95
|
+
"[Opengeni connected-service status]",
|
|
82
96
|
"One or more host-managed credentials need user attention. Continue with available capabilities, but do not claim the affected service is usable until it is reconnected.",
|
|
83
97
|
JSON.stringify({
|
|
84
98
|
credentials: material.authNeeded.map((notice) => ({
|
|
@@ -94,12 +108,37 @@ export function runCredentialModelNote(
|
|
|
94
108
|
/**
|
|
95
109
|
* Freeze the provider-neutral host credential request to this exact admitted
|
|
96
110
|
* turn. The host selects connections and material; the worker never infers a
|
|
97
|
-
* provider from repositories, environment names, or an
|
|
111
|
+
* provider from repositories, environment names, or an Opengeni variable set.
|
|
112
|
+
* A workspace that configured its own HTTP credential provider uses it in
|
|
113
|
+
* place of the deployment's injected port.
|
|
98
114
|
*/
|
|
99
115
|
export async function bindRunCredentialResolver(
|
|
100
116
|
input: RunCredentialResolutionContext,
|
|
101
117
|
): Promise<BoundRunCredentialResolver | null> {
|
|
102
|
-
|
|
118
|
+
// Connected Machines own their credentials. Even provider lookup/callback
|
|
119
|
+
// must not be performed for a turn executing on the user's machine.
|
|
120
|
+
if (input.effectiveSandboxBackend === "selfhosted") return null;
|
|
121
|
+
const workspaceResolver = input.settings
|
|
122
|
+
? await workspaceCredentialProviderResolver(
|
|
123
|
+
input.db,
|
|
124
|
+
input.settings,
|
|
125
|
+
{ accountId: input.accountId, workspaceId: input.workspaceId },
|
|
126
|
+
input.turn.initiatingHumanSubjectId ?? null,
|
|
127
|
+
{
|
|
128
|
+
mcpServers: selectedSessionRemoteMcpTargets(
|
|
129
|
+
input.settings,
|
|
130
|
+
input.session.mcpServers ?? [],
|
|
131
|
+
input.effectiveTools,
|
|
132
|
+
(input.localMcpServerIds ?? []).map((id) => ({ id })),
|
|
133
|
+
),
|
|
134
|
+
},
|
|
135
|
+
)
|
|
136
|
+
: null;
|
|
137
|
+
const resolver =
|
|
138
|
+
workspaceResolver ??
|
|
139
|
+
(input.effectiveSandboxBackend === "none"
|
|
140
|
+
? undefined
|
|
141
|
+
: input.connectionCredentials?.runCredentials);
|
|
103
142
|
if (!resolver) return null;
|
|
104
143
|
const rootSessionId = await getSessionRootId(input.db, input.workspaceId, input.session.id);
|
|
105
144
|
if (!rootSessionId) {
|
|
@@ -110,22 +149,25 @@ export async function bindRunCredentialResolver(
|
|
|
110
149
|
workspaceId: input.workspaceId,
|
|
111
150
|
sessionId: input.session.id,
|
|
112
151
|
};
|
|
152
|
+
// A renewable resolver belongs to one admitted turn, even if its caller
|
|
153
|
+
// subsequently replaces or mutates an in-memory session/turn projection.
|
|
154
|
+
const frozenRequest = structuredClone(
|
|
155
|
+
buildRunCredentialsRequest({
|
|
156
|
+
accountId: input.accountId,
|
|
157
|
+
workspaceId: input.workspaceId,
|
|
158
|
+
session: input.session,
|
|
159
|
+
turn: input.turn,
|
|
160
|
+
attemptId: input.attemptId,
|
|
161
|
+
effectiveSandboxBackend: input.effectiveSandboxBackend,
|
|
162
|
+
variableSet: input.variableSet,
|
|
163
|
+
rootSessionId,
|
|
164
|
+
purpose: "provision",
|
|
165
|
+
forceRefresh: false,
|
|
166
|
+
}),
|
|
167
|
+
);
|
|
113
168
|
return {
|
|
114
169
|
resolve: async ({ purpose, forceRefresh }) => {
|
|
115
|
-
const resolution = await resolver(
|
|
116
|
-
buildRunCredentialsRequest({
|
|
117
|
-
accountId: input.accountId,
|
|
118
|
-
workspaceId: input.workspaceId,
|
|
119
|
-
session: input.session,
|
|
120
|
-
turn: input.turn,
|
|
121
|
-
attemptId: input.attemptId,
|
|
122
|
-
effectiveSandboxBackend: input.effectiveSandboxBackend,
|
|
123
|
-
variableSet: input.variableSet,
|
|
124
|
-
rootSessionId,
|
|
125
|
-
purpose,
|
|
126
|
-
forceRefresh,
|
|
127
|
-
}),
|
|
128
|
-
);
|
|
170
|
+
const resolution = await resolver({ ...frozenRequest, purpose, forceRefresh });
|
|
129
171
|
return normalizeRunCredentialsResolution(resolution, scope);
|
|
130
172
|
},
|
|
131
173
|
};
|