@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
package/src/activities/goals.ts
CHANGED
|
@@ -1,33 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
configuredStaticUsageLimits,
|
|
4
|
-
policyProviderIdForModel,
|
|
5
|
-
resolveModelProvider,
|
|
2
|
+
resolveSessionFirstPartyMcpTools,
|
|
6
3
|
resolveTurnExecutionPolicyV1,
|
|
7
|
-
withCodexCatalogProvider,
|
|
8
|
-
withXaiSubscriptionCatalogProvider,
|
|
9
|
-
WORKSPACE_GATEWAY_MODEL_ID_PREFIX,
|
|
10
|
-
WORKSPACE_OPENROUTER_MODEL_ID_PREFIX,
|
|
11
4
|
type Settings,
|
|
12
5
|
} from "@opengeni/config";
|
|
13
6
|
import {
|
|
14
|
-
evaluateWorkspaceModelPolicy,
|
|
15
7
|
mergeToolRefs,
|
|
8
|
+
readTurnExecutionPolicyV1,
|
|
16
9
|
type SessionGoal,
|
|
17
10
|
type ToolRef,
|
|
18
11
|
} from "@opengeni/contracts";
|
|
19
|
-
import { isCodexBilledModel } from "@opengeni/codex";
|
|
20
12
|
import {
|
|
21
13
|
enqueueSessionWorkflowWakeIfRunnable,
|
|
22
|
-
getBillingBalance,
|
|
23
|
-
getLatestStartedSessionTurn,
|
|
24
|
-
getWorkspaceModelPolicy,
|
|
25
14
|
getSessionGoal,
|
|
26
|
-
|
|
15
|
+
getSessionTurn,
|
|
27
16
|
materializeGoalContinuation,
|
|
28
17
|
requireSession,
|
|
29
|
-
|
|
30
|
-
type Database,
|
|
18
|
+
requireWorkspace,
|
|
31
19
|
} from "@opengeni/db";
|
|
32
20
|
import type {
|
|
33
21
|
ControlActivityServices,
|
|
@@ -36,9 +24,13 @@ import type {
|
|
|
36
24
|
} from "./types";
|
|
37
25
|
import {
|
|
38
26
|
modelFundingForAdmission,
|
|
39
|
-
|
|
40
|
-
|
|
27
|
+
goalRunBudgetBlocked,
|
|
28
|
+
goalSessionUsageLimitBlocked,
|
|
29
|
+
recordSessionUsageLimitEvent,
|
|
30
|
+
resolveGoalModelAdmission,
|
|
41
31
|
} from "@opengeni/core";
|
|
32
|
+
export { goalContinuationModelDecision, goalRunBudgetBlocked } from "@opengeni/core";
|
|
33
|
+
import { turnCredentialRestriction } from "./agent-turn/credential-restriction";
|
|
42
34
|
|
|
43
35
|
export function createGoalActivities(services: () => Promise<ControlActivityServices>) {
|
|
44
36
|
async function enqueueGoalRetryWake(input: MaybeContinueGoalInput): Promise<void> {
|
|
@@ -66,89 +58,54 @@ export function createGoalActivities(services: () => Promise<ControlActivityServ
|
|
|
66
58
|
if (!existingGoal || existingGoal.status !== "active") {
|
|
67
59
|
return { action: "none" };
|
|
68
60
|
}
|
|
69
|
-
let settings = (await resolveCatalogSettings(db, catalogSourceSettings)).settings;
|
|
70
61
|
// Loaded before the budget check so the codex-billed predicate and the
|
|
71
62
|
// synthesized turn use the SAME effective policy. An explicit per-turn
|
|
72
63
|
// model can differ from the persisted session default; follow-up goal work
|
|
73
|
-
//
|
|
74
|
-
// Admission-rejected turns
|
|
64
|
+
// follows effective defaults: a started turn or a newer explicit settings
|
|
65
|
+
// boundary. Admission-rejected turns cannot poison that projection.
|
|
75
66
|
// Kept below the goal-less fast path so a non-goal session still skips the
|
|
76
67
|
// reads entirely.
|
|
77
68
|
const session = await requireSession(db, input.workspaceId, input.sessionId);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const inheritedContinuationModel = latestStartedTurn?.model ?? session.model;
|
|
84
|
-
let continuationModel = inheritedContinuationModel;
|
|
85
|
-
const continuationReasoningEffort =
|
|
86
|
-
latestStartedTurn?.reasoningEffort ?? session.reasoningEffort;
|
|
87
|
-
const continuationLatencyMode = latestStartedTurn?.latencyMode ?? session.latencyMode;
|
|
88
|
-
const workspaceModelPolicy = await getWorkspaceModelPolicy(db, input.workspaceId);
|
|
89
|
-
if (
|
|
90
|
-
inheritedContinuationModel.startsWith(WORKSPACE_GATEWAY_MODEL_ID_PREFIX) ||
|
|
91
|
-
inheritedContinuationModel.startsWith(WORKSPACE_OPENROUTER_MODEL_ID_PREFIX) ||
|
|
92
|
-
session.model.startsWith(WORKSPACE_GATEWAY_MODEL_ID_PREFIX) ||
|
|
93
|
-
session.model.startsWith(WORKSPACE_OPENROUTER_MODEL_ID_PREFIX)
|
|
94
|
-
) {
|
|
95
|
-
settings = (
|
|
96
|
-
await resolveWorkspaceCatalogSettings(db, catalogSourceSettings, {
|
|
97
|
-
accountId: input.accountId,
|
|
98
|
-
workspaceId: input.workspaceId,
|
|
99
|
-
retainedProductModelIds: [inheritedContinuationModel, session.model],
|
|
100
|
-
})
|
|
101
|
-
).settings;
|
|
102
|
-
}
|
|
103
|
-
const modelDecision = goalContinuationModelDecision({
|
|
104
|
-
settings,
|
|
105
|
-
workspaceModelPolicy,
|
|
106
|
-
inheritedModel: inheritedContinuationModel,
|
|
107
|
-
});
|
|
108
|
-
continuationModel = modelDecision.model;
|
|
109
|
-
let modelPolicyBlocked = modelDecision.blocked;
|
|
110
|
-
// remote_v2 sessions may only continue on Codex models — refuse synthesis
|
|
111
|
-
// that would leave the portable/non-Codex path (and mixed history shapes).
|
|
112
|
-
if (
|
|
113
|
-
!modelPolicyBlocked &&
|
|
114
|
-
session.codexCompactionMode === "remote_v2" &&
|
|
115
|
-
!isCodexBilledModel(continuationModel)
|
|
116
|
-
) {
|
|
117
|
-
modelPolicyBlocked = `session is locked to Codex remote compaction v2; model "${continuationModel}" is not a Codex subscription model`;
|
|
69
|
+
// Terminal sessions retain their goal for human recovery, but cannot
|
|
70
|
+
// continue. Do not validate an obsolete model before the locked guard gets
|
|
71
|
+
// the chance to reject that work; otherwise a deterministic error retries.
|
|
72
|
+
if (session.status === "failed" || session.status === "cancelled") {
|
|
73
|
+
return { action: "none" };
|
|
118
74
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const isCodexRun = await isCodexBilledTurn({
|
|
123
|
-
db,
|
|
124
|
-
settings,
|
|
75
|
+
const workspace = await requireWorkspace(db, input.workspaceId);
|
|
76
|
+
const modelDecision = await resolveGoalModelAdmission(db, catalogSourceSettings, {
|
|
77
|
+
accountId: input.accountId,
|
|
125
78
|
workspaceId: input.workspaceId,
|
|
126
|
-
model:
|
|
79
|
+
model: session.model,
|
|
80
|
+
codexCompactionMode: session.codexCompactionMode,
|
|
81
|
+
latencyMode: session.latencyMode,
|
|
127
82
|
});
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
83
|
+
const settings = modelDecision.settings;
|
|
84
|
+
const continuationModel = modelDecision.model;
|
|
85
|
+
const continuationReasoningEffort = session.reasoningEffort;
|
|
86
|
+
const continuationLatencyMode = session.latencyMode;
|
|
87
|
+
const modelPolicyBlocked = modelDecision.blocked;
|
|
88
|
+
const turnExecutionPolicy = modelPolicyBlocked
|
|
89
|
+
? undefined
|
|
90
|
+
: resolveTurnExecutionPolicyV1(settings, {
|
|
91
|
+
modelId: continuationModel,
|
|
92
|
+
requestedModelId: null,
|
|
93
|
+
modelSource: "continuation",
|
|
94
|
+
reasoningEffort: continuationReasoningEffort,
|
|
95
|
+
reasoningSource: "continuation",
|
|
96
|
+
latencyMode: continuationLatencyMode,
|
|
97
|
+
latencyModeSource: "continuation",
|
|
98
|
+
});
|
|
99
|
+
const continuationPolicy: NonNullable<
|
|
100
|
+
Parameters<typeof materializeGoalContinuation>[1]["policy"]
|
|
101
|
+
> = {
|
|
102
|
+
model: continuationModel,
|
|
147
103
|
reasoningEffort: continuationReasoningEffort,
|
|
148
|
-
reasoningSource: "continuation",
|
|
149
104
|
latencyMode: continuationLatencyMode,
|
|
150
|
-
|
|
151
|
-
|
|
105
|
+
...(turnExecutionPolicy ? { turnExecutionPolicy } : {}),
|
|
106
|
+
tools: withFirstPartyTools(settings, session.tools),
|
|
107
|
+
sandboxBackend: session.sandboxBackend,
|
|
108
|
+
};
|
|
152
109
|
const decision = await materializeGoalContinuation(db, {
|
|
153
110
|
accountId: input.accountId,
|
|
154
111
|
workspaceId: input.workspaceId,
|
|
@@ -164,23 +121,68 @@ export function createGoalActivities(services: () => Promise<ControlActivityServ
|
|
|
164
121
|
// A model-policy block takes precedence: it is deterministic (a budget
|
|
165
122
|
// pause can clear on its own; a policy pause needs a model/policy change)
|
|
166
123
|
// and rides the same visible-pause channel.
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
124
|
+
admission: async (tx, causalTurn) => {
|
|
125
|
+
// The materializer selects this exact causal row under its session/goal
|
|
126
|
+
// locks and freezes policy only after admission returns. Never infer
|
|
127
|
+
// credential authority from the generated continuation's payload.
|
|
128
|
+
const sourceTurn = causalTurn
|
|
129
|
+
? await getSessionTurn(tx, input.workspaceId, causalTurn.id)
|
|
130
|
+
: null;
|
|
131
|
+
if (causalTurn && (!sourceTurn || sourceTurn.sessionId !== input.sessionId)) {
|
|
132
|
+
throw new Error("Goal continuation source turn is unavailable");
|
|
133
|
+
}
|
|
134
|
+
const sourcePolicy = readTurnExecutionPolicyV1(sourceTurn?.metadata);
|
|
135
|
+
if (turnExecutionPolicy) {
|
|
136
|
+
const credentialRestriction = turnCredentialRestriction(
|
|
137
|
+
sourcePolicy.kind === "valid" ? sourcePolicy.policy : turnExecutionPolicy,
|
|
138
|
+
session.metadata,
|
|
139
|
+
);
|
|
140
|
+
continuationPolicy.turnExecutionPolicy = credentialRestriction
|
|
141
|
+
? { ...turnExecutionPolicy, credentialRestriction }
|
|
142
|
+
: turnExecutionPolicy;
|
|
143
|
+
}
|
|
144
|
+
// a reached task usage limit pauses the goal with its own
|
|
145
|
+
// reason before any funding gate; a read failure aborts materialization.
|
|
146
|
+
const usageLimitBlocked = modelPolicyBlocked
|
|
147
|
+
? null
|
|
148
|
+
: await goalSessionUsageLimitBlocked(tx, {
|
|
149
|
+
accountId: input.accountId,
|
|
150
|
+
workspaceId: input.workspaceId,
|
|
151
|
+
sessionId: input.sessionId,
|
|
152
|
+
});
|
|
153
|
+
if (usageLimitBlocked) {
|
|
154
|
+
recordSessionUsageLimitEvent(service.observability, "goal", "reached");
|
|
155
|
+
}
|
|
156
|
+
const budgetBlocked = modelPolicyBlocked
|
|
157
|
+
? null
|
|
158
|
+
: (usageLimitBlocked ??
|
|
159
|
+
(await goalRunBudgetBlocked(
|
|
160
|
+
{ ...service, settings, db: tx },
|
|
161
|
+
{
|
|
162
|
+
accountId: input.accountId,
|
|
163
|
+
workspaceId: input.workspaceId,
|
|
164
|
+
model: continuationModel,
|
|
165
|
+
initiatingHumanSubjectId: causalTurn?.initiatingHumanSubjectId ?? null,
|
|
166
|
+
},
|
|
167
|
+
)));
|
|
168
|
+
const pausedReason = modelPolicyBlocked
|
|
169
|
+
? modelDecision.pausedReason
|
|
170
|
+
: budgetBlocked?.pausedReason;
|
|
171
|
+
return {
|
|
172
|
+
budgetBlocked: modelPolicyBlocked ?? budgetBlocked?.message ?? null,
|
|
173
|
+
...(pausedReason ? { budgetPausedReason: pausedReason } : {}),
|
|
174
|
+
};
|
|
175
175
|
},
|
|
176
|
+
policy: continuationPolicy,
|
|
176
177
|
// Long-wait guidance is only given when `wait_for_input` is actually in this
|
|
177
178
|
// session's effective first-party selection (the same source the worker
|
|
178
179
|
// signs into the delegated token and the API uses to register tools), so
|
|
179
180
|
// a pre-existing narrowed selection is never told to call a missing tool.
|
|
180
181
|
prompt: (goal, autoContinuation, cap) => {
|
|
181
|
-
const effectiveFirstPartyTools =
|
|
182
|
+
const effectiveFirstPartyTools = resolveSessionFirstPartyMcpTools(
|
|
182
183
|
settings,
|
|
183
|
-
session
|
|
184
|
+
session,
|
|
185
|
+
workspace.settings,
|
|
184
186
|
);
|
|
185
187
|
return goalContinuationPrompt(goal, autoContinuation, cap, {
|
|
186
188
|
inputWaitAvailable: effectiveFirstPartyTools.includes("wait_for_input"),
|
|
@@ -202,44 +204,6 @@ export function createGoalActivities(services: () => Promise<ControlActivityServ
|
|
|
202
204
|
};
|
|
203
205
|
}
|
|
204
206
|
|
|
205
|
-
export function goalContinuationModelDecision(input: {
|
|
206
|
-
settings: Settings;
|
|
207
|
-
workspaceModelPolicy: Awaited<ReturnType<typeof getWorkspaceModelPolicy>>;
|
|
208
|
-
inheritedModel: string;
|
|
209
|
-
}): { model: string; blocked: string | null } {
|
|
210
|
-
const catalogSettings = input.settings.supergrokSubscriptionEnabled
|
|
211
|
-
? withXaiSubscriptionCatalogProvider(
|
|
212
|
-
input.settings.codexSubscriptionEnabled
|
|
213
|
-
? withCodexCatalogProvider(input.settings)
|
|
214
|
-
: input.settings,
|
|
215
|
-
)
|
|
216
|
-
: input.settings.codexSubscriptionEnabled
|
|
217
|
-
? withCodexCatalogProvider(input.settings)
|
|
218
|
-
: input.settings;
|
|
219
|
-
const policyBlocks = (modelId: string): boolean =>
|
|
220
|
-
input.workspaceModelPolicy !== null &&
|
|
221
|
-
!evaluateWorkspaceModelPolicy(input.workspaceModelPolicy, {
|
|
222
|
-
providerId: policyProviderIdForModel(catalogSettings, modelId),
|
|
223
|
-
modelId,
|
|
224
|
-
}).allowed;
|
|
225
|
-
if (
|
|
226
|
-
resolveModelProvider(catalogSettings, input.inheritedModel) &&
|
|
227
|
-
!policyBlocks(input.inheritedModel)
|
|
228
|
-
) {
|
|
229
|
-
return { model: input.inheritedModel, blocked: null };
|
|
230
|
-
}
|
|
231
|
-
if (!resolveModelProvider(catalogSettings, input.inheritedModel)) {
|
|
232
|
-
return {
|
|
233
|
-
model: input.inheritedModel,
|
|
234
|
-
blocked: `model "${input.inheritedModel}" is no longer in the deployment or workspace catalog; choose an available model before resuming the goal`,
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
return {
|
|
238
|
-
model: input.inheritedModel,
|
|
239
|
-
blocked: `workspace model policy blocks model "${input.inheritedModel}"; pick an allowed model or change the workspace model policy`,
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
|
|
243
207
|
export function goalContinuationFundedWithoutCredits(
|
|
244
208
|
settings: Settings,
|
|
245
209
|
model: string,
|
|
@@ -258,8 +222,9 @@ export function goalContinuationPrompt(
|
|
|
258
222
|
? [
|
|
259
223
|
"Waiting on child sessions, background commands, or external events:",
|
|
260
224
|
"- When further progress depends on work already in flight, do not sleep, loop, or poll session or command state repeatedly.",
|
|
261
|
-
"-
|
|
262
|
-
"-
|
|
225
|
+
"- If progress depends on work already in flight and the wait is long or uncertain, call opengeni__wait_for_input with a concrete reason and timeoutSeconds, then end your turn immediately. A preliminary status check is not required. Relevant session input or the safety deadline will start a new turn, and this goal stays active.",
|
|
226
|
+
"- No short execution wait is required first. Choose the safety deadline for the dependency or a meaningful monitoring cadence; an out-of-turn wait may span hours or days within the tool's limits. Do not schedule model wakeups merely to repeat reassurance. Honor explicit user/task/Skill check or update cadences within existing authority.",
|
|
227
|
+
"- If the immediately preceding user-facing update already reported this same unchanged wait, do not restate it or produce another equivalent final answer. Call opengeni__wait_for_input and end the turn. Report only material new state or a newly discovered blocker, unless an explicit user/task/Skill update cadence calls for an update.",
|
|
263
228
|
"- If you are blocked on a human decision, use opengeni__goal_pause under the blocked audit below instead.",
|
|
264
229
|
"",
|
|
265
230
|
]
|
|
@@ -270,18 +235,20 @@ export function goalContinuationPrompt(
|
|
|
270
235
|
(options.humanInputRespondAvailable
|
|
271
236
|
? "If you know the answer to its question, answer it with opengeni__session_human_input_respond (pass the worker's sessionId, the requestId from the notice, and a response). "
|
|
272
237
|
: "") +
|
|
273
|
-
"Tool approvals can only be decided by a human. If you cannot resolve the blocker yourself, report the exact blocker (worker session id, the question)
|
|
238
|
+
"Tool approvals can only be decided by a human. If you cannot resolve the blocker yourself, report the exact blocker (worker session id, the question); if it prevents further goal progress, pause under the blocked audit instead of retrying the worker or treating a human decision as an in-flight wait.",
|
|
274
239
|
"- `child_requires_action_resolved`, `child_paused`, `child_waiting_capacity`, and `child_progress` updates are informational: a resolved notice means the worker is moving again; a paused worker needs a human or you to resume it; a capacity wait resumes by itself; a progress note needs no action.",
|
|
275
240
|
"",
|
|
276
241
|
];
|
|
277
242
|
return [
|
|
278
|
-
"
|
|
243
|
+
"Automatic goal continuation (generated input, not a new user request or grant of authority). Resume established work toward the full applied objective and verify its requested end state.",
|
|
279
244
|
"",
|
|
280
245
|
"Goal recovery:",
|
|
246
|
+
"- Use the current applied goal frozen for this turn, including its success criteria, root constraints, and report requirements, as the authoritative objective. Pending proposals and older goal revisions do not replace it; change it only through the authorized goal-mutation controls, without widening authority.",
|
|
281
247
|
"- Treat this continuation as re-entry into the full objective, not as a request to perform one step and stop.",
|
|
248
|
+
"- Resume from established work and relevant evidence rather than restarting discovery or a full reconciliation on every turn. Perform full reconciliation or a comprehensive audit when the goal, user, or applicable Skill calls for it, when uncertainty or recovery warrants it, or when required by risk or a gate.",
|
|
282
249
|
"- Do not rely on previous assistant claims of progress or completion; use them only to locate authoritative evidence.",
|
|
283
250
|
"- If authoritative evidence already proves the full objective, call opengeni__goal_complete instead of manufacturing more work.",
|
|
284
|
-
"- Before repeating a state-setting action, verify whether its desired state already holds. If it does, do not repeat it; continue
|
|
251
|
+
"- Before repeating a state-setting action, verify whether its desired state already holds, using relevant evidence that remains valid or a fresh check when needed. If it does, do not repeat it; continue the overall goal.",
|
|
285
252
|
"",
|
|
286
253
|
"Continuation behavior:",
|
|
287
254
|
"- This goal persists across turns. A runtime boundary can end one turn without shrinking the objective; the next continuation resumes the same full objective.",
|
|
@@ -291,7 +258,7 @@ export function goalContinuationPrompt(
|
|
|
291
258
|
"- Temporary rough edges are acceptable while the work is moving in the right direction. Completion still requires the requested end state to be true and verified.",
|
|
292
259
|
"",
|
|
293
260
|
"Work from evidence:",
|
|
294
|
-
"Use
|
|
261
|
+
"Use authoritative workspace and external evidence, including prior tool results that remain relevant and valid. Reuse evidence only for the requirement, scope, version, and state it actually establishes; recheck changed, stale, uncertain, or insufficient evidence. Conversation summaries and assistant claims are pointers, not proof. Do not infer progress or evidence validity merely from this continuation. Improve, replace, or remove existing work as needed within authority to satisfy the actual objective.",
|
|
295
262
|
"",
|
|
296
263
|
"Progress visibility:",
|
|
297
264
|
"If a planning tool is available and the next work is meaningfully multi-step, use it to show a concise plan tied to the real objective. Keep the plan current as steps complete or the next best action changes. Skip planning overhead for trivial one-step progress, and do not treat a plan update as a substitute for doing the work.",
|
|
@@ -302,23 +269,26 @@ export function goalContinuationPrompt(
|
|
|
302
269
|
"- Treat alignment as movement toward the requested end state. An edit is aligned only if it makes the requested final state more true; useful-looking behavior that preserves a different end state is misaligned.",
|
|
303
270
|
"",
|
|
304
271
|
"Completion audit:",
|
|
305
|
-
"Before deciding that the goal is achieved, treat completion as unproven and verify it against the actual current state:",
|
|
272
|
+
"Before deciding that the goal is achieved, treat completion as unproven and verify it against the actual current state. This full completion audit is required even when ordinary continuation did not need full reconciliation; reuse still-valid authoritative evidence, but refresh it when the requirement or gate requires a fresh check:",
|
|
306
273
|
"- Derive concrete requirements from the objective and any referenced files, plans, specifications, issues, or user instructions.",
|
|
307
|
-
"- Preserve the
|
|
274
|
+
"- Preserve the applied objective's scope; do not redefine success around the work that already exists.",
|
|
308
275
|
"- For every explicit requirement, named artifact, command, test, gate, invariant, and deliverable, identify and inspect the authoritative evidence that would prove it.",
|
|
309
276
|
"- Match verification scope to requirement scope. Treat uncertain, indirect, incomplete, or missing evidence as not achieved and continue working.",
|
|
310
277
|
"- The audit must prove completion, not merely fail to find obvious remaining work.",
|
|
311
|
-
"- For
|
|
278
|
+
"- For document report deliverables (a document the user asked for, or a large report meant to be kept or shared), follow the Documents Skill: create the durable native document first, inspect its relevant final head after the last edit, and provide the returned artifact reference. Declare report requirements through the available goal tools before authoring and satisfy every persisted report requirement with verified artifact delivery evidence before completion. Sandbox paths and raw file IDs do not prove report delivery. If artifact tooling or access is unavailable, keep that deliverable incomplete and state the blocker; never invent proof or silently substitute a local report. Ordinary chat answers, short progress updates, source-code links, and explicitly requested local-file work remain outside this report contract.",
|
|
312
279
|
"",
|
|
313
280
|
"Do not rely on intent, partial progress, memory of earlier work, or a plausible final answer as proof of completion. Call opengeni__goal_complete with concrete evidence only when the full objective is actually achieved and no required work remains.",
|
|
281
|
+
"Goal evidence is a short proof for the ledger, not the deliverable. After goal_complete succeeds, finish this same turn with the requested user-facing answer, or a concise summary and retained artifact link. Goal completion stops future automatic continuations; it does not send the answer or end this turn. Never compress a report into evidence or omit the final reply.",
|
|
282
|
+
"Goal progress notes are short human-readable milestone statuses, not raw transcripts or continuation instructions. Keep normal spaces and summarize detail instead of squeezing words into a ledger field. The text and successCriteria fields each allow 8192 UTF-8 bytes, progressNote allows 8192 UTF-8 bytes, rationale allows 2048 UTF-8 bytes, and evidence allows 8192 characters.",
|
|
314
283
|
"",
|
|
315
284
|
...waitingGuidance,
|
|
316
285
|
...childNoticeGuidance,
|
|
317
286
|
"Blocked audit:",
|
|
318
|
-
"-
|
|
319
|
-
"-
|
|
287
|
+
"- Base persistence on evidence, not a fixed number of turns or retries. Investigate recoverable failures and try plausible safe alternatives within current authority when they could materially advance the goal; do not exhaust every imaginable alternative or repeat an unchanged failure without a reason to expect progress.",
|
|
288
|
+
"- A definitive missing permission, required human decision, or external prerequisite with no actionable authorized path can justify pausing immediately. State the concrete blocker, relevant evidence or attempted alternatives, and what must change to resume. Tool approvals remain human-only.",
|
|
289
|
+
"- If progress depends on work already in flight or a meaningful timed recheck, use the available waiting mechanism rather than pausing the goal; continue any independent authorized work first.",
|
|
320
290
|
"- Do not pause merely because the work is hard, slow, uncertain, incomplete, or would benefit from clarification.",
|
|
321
|
-
"-
|
|
291
|
+
"- When no meaningful authorized progress remains and the blocker requires human input or an external change that cannot be handled by an available wait or monitoring mechanism, call opengeni__goal_pause with the concrete blocker instead of repeatedly reporting it while leaving the goal active.",
|
|
322
292
|
"",
|
|
323
293
|
"Do not call opengeni__goal_complete or opengeni__goal_pause unless the corresponding audit above is satisfied.",
|
|
324
294
|
].join("\n");
|
|
@@ -337,57 +307,3 @@ export function withFirstPartyTools(settings: Settings, tools: ToolRef[]): ToolR
|
|
|
337
307
|
}
|
|
338
308
|
return mergeToolRefs(tools, [{ kind: "mcp", id: "opengeni" }]);
|
|
339
309
|
}
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* Non-throwing variant of the scheduled-run admission check: returns a human
|
|
343
|
-
* readable reason when balance or monthly caps block another agent run.
|
|
344
|
-
*/
|
|
345
|
-
async function goalRunBudgetBlocked(
|
|
346
|
-
settings: Settings,
|
|
347
|
-
db: Database,
|
|
348
|
-
accountId: string,
|
|
349
|
-
workspaceId: string,
|
|
350
|
-
fundedWithoutCredits: boolean,
|
|
351
|
-
): Promise<string | null> {
|
|
352
|
-
// Free, subscription, and workspace-funded continuations skip OpenGeni's
|
|
353
|
-
// credit-balance gate and monthly model-cost cap. The agent-run COUNT cap
|
|
354
|
-
// below is a volume quota (not a credit/cost gate) and remains enforced.
|
|
355
|
-
if (
|
|
356
|
-
!fundedWithoutCredits &&
|
|
357
|
-
(settings.billingMode === "stripe" || settings.usageLimitsMode === "managed")
|
|
358
|
-
) {
|
|
359
|
-
const balance = await getBillingBalance(db, accountId);
|
|
360
|
-
if (balance.balanceMicros <= 0) {
|
|
361
|
-
return "insufficient OpenGeni credits";
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
if (settings.usageLimitsMode === "static" || settings.usageLimitsMode === "managed") {
|
|
365
|
-
const limits = configuredStaticUsageLimits(settings);
|
|
366
|
-
if (!fundedWithoutCredits && limits.maxMonthlyCostMicrosPerAccount) {
|
|
367
|
-
const used = await sumUsageQuantity(db, {
|
|
368
|
-
accountId,
|
|
369
|
-
eventType: "model.cost",
|
|
370
|
-
since: startOfUtcMonth(),
|
|
371
|
-
});
|
|
372
|
-
if (used >= limits.maxMonthlyCostMicrosPerAccount) {
|
|
373
|
-
return `monthly model cost limit reached (${limits.maxMonthlyCostMicrosPerAccount} micros)`;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
if (limits.maxMonthlyAgentRunsPerWorkspace) {
|
|
377
|
-
const used = await sumUsageQuantity(db, {
|
|
378
|
-
workspaceId,
|
|
379
|
-
eventType: "agent_run.created",
|
|
380
|
-
since: startOfUtcMonth(),
|
|
381
|
-
});
|
|
382
|
-
if (used + 1 > limits.maxMonthlyAgentRunsPerWorkspace) {
|
|
383
|
-
return `monthly agent run limit reached (${limits.maxMonthlyAgentRunsPerWorkspace})`;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
return null;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
function startOfUtcMonth(): Date {
|
|
391
|
-
const now = new Date();
|
|
392
|
-
return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1));
|
|
393
|
-
}
|
|
@@ -36,7 +36,7 @@ export class ImageGenerationRetentionFailedError extends Error {
|
|
|
36
36
|
cause?: unknown,
|
|
37
37
|
) {
|
|
38
38
|
super(
|
|
39
|
-
"The image was generated, but
|
|
39
|
+
"The image was generated, but Opengeni could not save it. The paid provider request was not repeated.",
|
|
40
40
|
cause === undefined ? undefined : { cause },
|
|
41
41
|
);
|
|
42
42
|
this.name = "ImageGenerationRetentionFailedError";
|