@opengeni/worker-bundle 2.0.1 → 2.0.2-canary.38789554071001
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activities/agent-run-admission.d.ts +1 -12
- package/dist/activities/agent-turn/admission.d.ts +88 -10
- package/dist/activities/agent-turn/agent-build.d.ts +14 -3
- package/dist/activities/agent-turn/claim.d.ts +4 -1
- package/dist/activities/agent-turn/claude-core.d.ts +195 -0
- package/dist/activities/agent-turn/code-search.d.ts +60 -0
- package/dist/activities/agent-turn/codex-capacity.d.ts +3 -0
- package/dist/activities/agent-turn/codex-core-capacity.d.ts +37 -0
- package/dist/activities/agent-turn/codex-core-claim.d.ts +40 -0
- package/dist/activities/agent-turn/codex-core-errors.d.ts +102 -0
- package/dist/activities/agent-turn/codex-core-failover.d.ts +15 -0
- package/dist/activities/agent-turn/codex-core-requests.d.ts +28 -0
- package/dist/activities/agent-turn/codex-core-settlement.d.ts +77 -0
- package/dist/activities/agent-turn/codex-credit-policy.d.ts +30 -0
- package/dist/activities/agent-turn/codex-plan-entitlement.d.ts +105 -0
- package/dist/activities/agent-turn/codex-usage-policy.d.ts +2 -0
- package/dist/activities/agent-turn/codex.d.ts +2 -19
- package/dist/activities/agent-turn/compaction-interruption.d.ts +32 -0
- package/dist/activities/agent-turn/compaction-prep.d.ts +30 -1
- package/dist/activities/agent-turn/credential-leases.d.ts +64 -37
- package/dist/activities/agent-turn/credential-restriction.d.ts +3 -0
- package/dist/activities/agent-turn/errors.d.ts +185 -26
- package/dist/activities/agent-turn/failure-settlement.d.ts +10 -43
- package/dist/activities/agent-turn/final-reply.d.ts +18 -0
- package/dist/activities/agent-turn/finalization-monitor.d.ts +7 -2
- package/dist/activities/agent-turn/finalization.d.ts +2 -0
- package/dist/activities/agent-turn/github-repository-bindings.d.ts +2 -0
- package/dist/activities/agent-turn/governance-model.d.ts +13 -1
- package/dist/activities/agent-turn/history-sink.d.ts +4 -1
- package/dist/activities/agent-turn/history.d.ts +2 -0
- package/dist/activities/agent-turn/input-wait-reply.d.ts +76 -0
- package/dist/activities/agent-turn/meaningful-output.d.ts +9 -0
- package/dist/activities/agent-turn/media-artifacts.d.ts +5 -3
- package/dist/activities/agent-turn/model-call-admission.d.ts +15 -0
- package/dist/activities/agent-turn/model-usage.d.ts +56 -14
- package/dist/activities/agent-turn/model-wire-dispatch.d.ts +15 -0
- package/dist/activities/agent-turn/optional-repositories.d.ts +59 -0
- package/dist/activities/agent-turn/prompt-tool-availability.d.ts +17 -0
- package/dist/activities/agent-turn/provider-dispatch-barrier.d.ts +12 -1
- package/dist/activities/agent-turn/provider-recovery-copy.d.ts +24 -0
- package/dist/activities/agent-turn/provider-recovery-metrics.d.ts +18 -0
- package/dist/activities/agent-turn/provider-recovery-policy.d.ts +6 -0
- package/dist/activities/agent-turn/quiescence.d.ts +6 -7
- package/dist/activities/agent-turn/recovery-warning.d.ts +6 -5
- package/dist/activities/agent-turn/refresh-credentials.d.ts +6 -0
- package/dist/activities/agent-turn/run-credentials.d.ts +9 -5
- package/dist/activities/agent-turn/run.d.ts +27 -2
- package/dist/activities/agent-turn/sandbox-establish.d.ts +1 -0
- package/dist/activities/agent-turn/sandbox-provision.d.ts +25 -1
- package/dist/activities/agent-turn/sandbox-route.d.ts +3 -0
- package/dist/activities/agent-turn/sandbox-runtime.d.ts +1 -1
- package/dist/activities/agent-turn/secret-resolver.d.ts +64 -0
- package/dist/activities/agent-turn/session-title.d.ts +60 -3
- package/dist/activities/agent-turn/session-usage-custody.d.ts +66 -0
- package/dist/activities/agent-turn/skill-checkout.d.ts +25 -6
- package/dist/activities/agent-turn/skill-read.d.ts +70 -2
- package/dist/activities/agent-turn/skill-search.d.ts +2 -0
- package/dist/activities/agent-turn/skill-tools.d.ts +41 -4
- package/dist/activities/agent-turn/skill-transfer.d.ts +18 -6
- package/dist/activities/agent-turn/stream-attempt.d.ts +6 -3
- package/dist/activities/agent-turn/subscription-capacity-arming.d.ts +41 -0
- package/dist/activities/agent-turn/subscription-core-capacity.d.ts +86 -0
- package/dist/activities/agent-turn/subscription-core-failover.d.ts +69 -0
- package/dist/activities/agent-turn/subscription-core-placed.d.ts +14 -0
- package/dist/activities/agent-turn/subscription-core-requests.d.ts +109 -0
- package/dist/activities/agent-turn/subscription-core-settlement.d.ts +112 -0
- package/dist/activities/agent-turn/subscription-lease.d.ts +44 -0
- package/dist/activities/agent-turn/subscription-serving-capacity.d.ts +6 -0
- package/dist/activities/agent-turn/subscription-serving-catalog.d.ts +13 -0
- package/dist/activities/agent-turn/subscription-serving-claim.d.ts +30 -0
- package/dist/activities/agent-turn/subscription-serving-providers.d.ts +2 -0
- package/dist/activities/agent-turn/tool-environment.d.ts +31 -6
- package/dist/activities/agent-turn/tool-policy.d.ts +55 -3
- package/dist/activities/agent-turn/turn-context.d.ts +104 -5
- package/dist/activities/agent-turn/web-search.d.ts +57 -0
- package/dist/activities/agent-turn/xai-core.d.ts +96 -0
- package/dist/activities/automations.d.ts +3 -1
- package/dist/activities/browser-deadline-checkpoint.d.ts +34 -0
- package/dist/activities/capabilities.d.ts +8 -20
- package/dist/activities/codemode-dispatcher.d.ts +20 -3
- package/dist/activities/codex-capacity.d.ts +1 -56
- package/dist/activities/codex-image-generation.d.ts +49 -3
- package/dist/activities/common.d.ts +3 -1
- package/dist/activities/context-compaction.d.ts +41 -2
- package/dist/activities/environment.d.ts +1 -19
- package/dist/activities/gmail-files.d.ts +50 -0
- package/dist/activities/goals.d.ts +1 -9
- package/dist/activities/incident-telemetry-authority.d.ts +5 -2
- package/dist/activities/incident-telemetry-preflight.d.ts +10 -3
- package/dist/activities/knowledge-indexing.d.ts +19 -0
- package/dist/activities/mcp-account-routes.d.ts +2 -21
- package/dist/activities/model-call-fact-reconciler.d.ts +34 -0
- package/dist/activities/open-suffix-resume.d.ts +15 -0
- package/dist/activities/parent-wake.d.ts +17 -12
- package/dist/activities/programmatic-approvals.d.ts +10 -0
- package/dist/activities/requester-unavailable-receipt.d.ts +8 -0
- package/dist/activities/retained-screenshots.d.ts +7 -2
- package/dist/activities/run-credential-renewal.d.ts +1 -0
- package/dist/activities/run-credentials.d.ts +16 -4
- package/dist/activities/run-input.d.ts +17 -0
- package/dist/activities/sandbox-lease.d.ts +132 -12
- package/dist/activities/scheduled-tasks.d.ts +4 -35
- package/dist/activities/session-archive.d.ts +58 -0
- package/dist/activities/session-state.d.ts +15 -3
- package/dist/activities/session-storage.d.ts +44 -0
- package/dist/activities/subscription-core-claude-waits.d.ts +2 -0
- package/dist/activities/subscription-core-codex-quota.d.ts +25 -0
- package/dist/activities/subscription-core-codex-waits.d.ts +153 -0
- package/dist/activities/subscription-core-image-operation.d.ts +29 -0
- package/dist/activities/subscription-core-usage-recheck.d.ts +49 -0
- package/dist/activities/subscription-core-wait-bindings.d.ts +3 -0
- package/dist/activities/subscription-core-xai-quota.d.ts +30 -0
- package/dist/activities/subscription-core-xai-waits.d.ts +2 -0
- package/dist/activities/types.d.ts +68 -5
- package/dist/activities/video-generation-admission.d.ts +2 -8
- package/dist/activities/video-generation-credential.d.ts +15 -12
- package/dist/activities/video-generation-subscription-core.d.ts +70 -0
- package/dist/activities/workspace-capture.d.ts +2 -0
- package/dist/activities/workspace-credential-provider.d.ts +47 -0
- package/dist/activities/xai-auth.d.ts +6 -18
- package/dist/activities/xai-image-generation.d.ts +22 -6
- package/dist/{activities-control-QA6OLRQY.js → activities-control-5IIVRXLA.js} +1569 -2883
- package/dist/activities-control-5IIVRXLA.js.map +1 -0
- package/dist/activities-control.d.ts +64 -4
- package/dist/{activities-turn-YVVKCGAK.js → activities-turn-FLYJOM54.js} +9300 -4403
- package/dist/activities-turn-FLYJOM54.js.map +1 -0
- package/dist/activities.d.ts +64 -4
- package/dist/artifact-materializer-entry.js +107 -36
- package/dist/artifact-materializer-entry.js.map +1 -1
- package/dist/artifact-outbox-entry.js +132 -61
- package/dist/artifact-outbox-entry.js.map +1 -1
- package/dist/browser-deadline-checkpoint-contract.d.ts +2 -0
- package/dist/{chunk-GDCLDKSH.js → chunk-24GP3BX5.js} +79 -72
- package/dist/chunk-24GP3BX5.js.map +1 -0
- package/dist/{chunk-RAMNYSAW.js → chunk-4ER3YXOT.js} +22 -4
- package/dist/chunk-4ER3YXOT.js.map +1 -0
- package/dist/{chunk-I7HKKMUJ.js → chunk-5NNS4327.js} +734 -58
- package/dist/chunk-5NNS4327.js.map +1 -0
- package/dist/chunk-MVESOYFC.js +3746 -0
- package/dist/chunk-MVESOYFC.js.map +1 -0
- package/dist/{chunk-M3NVMF2V.js → chunk-N57B3PJ5.js} +2307 -3951
- package/dist/chunk-N57B3PJ5.js.map +1 -0
- package/dist/chunk-NQDVJ6RI.js +2823 -0
- package/dist/chunk-NQDVJ6RI.js.map +1 -0
- package/dist/chunk-O7UPBWXK.js +79 -0
- package/dist/chunk-O7UPBWXK.js.map +1 -0
- package/dist/chunk-W2QSM5HR.js +414 -0
- package/dist/chunk-W2QSM5HR.js.map +1 -0
- package/dist/chunk-ZN3XJR33.js +227 -0
- package/dist/chunk-ZN3XJR33.js.map +1 -0
- package/dist/editable-artifact-outbox-dispatcher.d.ts +12 -1
- package/dist/editable-artifact-outbox-service.d.ts +3 -1
- package/dist/host-export-pump.d.ts +3 -1
- package/dist/host-export.d.ts +2 -2
- package/dist/host-export.js +1 -1
- package/dist/http.d.ts +1 -1
- package/dist/index.d.ts +49 -48
- package/dist/index.js +835 -256
- package/dist/index.js.map +1 -1
- package/dist/internal-maintenance.d.ts +63 -0
- package/dist/maintenance-cadence.d.ts +43 -0
- package/dist/observability-metrics.d.ts +293 -24
- package/dist/onepassword-vault-provider.d.ts +7 -0
- package/dist/parent-wake-PCLH7A3Y.js +24 -0
- package/dist/parent-wake-PCLH7A3Y.js.map +1 -0
- package/dist/personal-github-git-credentials.d.ts +1 -1
- package/dist/readiness-checks.d.ts +39 -0
- package/dist/retained-process-retry.d.ts +7 -0
- package/dist/sandbox-lease-BJYU72N3.js +84 -0
- package/dist/sandbox-lease-BJYU72N3.js.map +1 -0
- package/dist/sandbox-reaper-contract.d.ts +25 -0
- package/dist/sandbox-resume.d.ts +72 -4
- package/dist/sandbox-routing.d.ts +4 -2
- package/dist/session-event-fanout.d.ts +6 -0
- package/dist/site-auth-maintenance-WK3MR2PV.js +12 -0
- package/dist/site-auth-maintenance-WK3MR2PV.js.map +1 -0
- package/dist/telemetry-scheduler.d.ts +14 -0
- package/dist/temporal-runtime-logger.d.ts +22 -0
- package/dist/turn-task-queue-reader.d.ts +18 -0
- package/dist/turn-worker-activity-telemetry.d.ts +47 -0
- package/dist/worker-service-lifecycle.d.ts +12 -0
- package/dist/workflow-bundle.js +468 -71
- package/dist/workflows/activities.d.ts +1 -1
- package/dist/workflows/browser-deadline-checkpoint.d.ts +10 -0
- package/dist/workflows/sandbox-reaper.d.ts +10 -1
- package/dist/workflows/scheduled-tasks.d.ts +4 -0
- package/dist/workflows/session-storage.d.ts +2 -0
- package/dist/workflows/session.d.ts +36 -0
- package/dist/workflows/site-auth-maintenance.d.ts +2 -1
- package/dist/workflows/workflow-wake.d.ts +14 -3
- package/dist/workflows.d.ts +3 -1
- package/package.json +26 -20
- package/src/activities/agent-run-admission.ts +1 -82
- package/src/activities/agent-turn/admission.ts +175 -24
- package/src/activities/agent-turn/agent-build.ts +226 -145
- package/src/activities/agent-turn/claim.ts +363 -64
- package/src/activities/agent-turn/claude-core.ts +587 -0
- package/src/activities/agent-turn/code-search.ts +275 -0
- package/src/activities/agent-turn/codex-capacity.ts +30 -757
- package/src/activities/agent-turn/codex-core-capacity.ts +190 -0
- package/src/activities/agent-turn/codex-core-claim.ts +83 -0
- package/src/activities/agent-turn/codex-core-errors.ts +308 -0
- package/src/activities/agent-turn/codex-core-failover.ts +73 -0
- package/src/activities/agent-turn/codex-core-requests.ts +86 -0
- package/src/activities/agent-turn/codex-core-settlement.ts +263 -0
- package/src/activities/agent-turn/codex-credit-policy.ts +247 -0
- package/src/activities/agent-turn/codex-plan-entitlement.ts +254 -0
- package/src/activities/agent-turn/codex-usage-policy.ts +2 -0
- package/src/activities/agent-turn/codex.ts +8 -76
- package/src/activities/agent-turn/compaction-interruption.ts +56 -0
- package/src/activities/agent-turn/compaction-prep.ts +249 -36
- package/src/activities/agent-turn/credential-leases.ts +269 -214
- package/src/activities/agent-turn/credential-restriction.ts +14 -0
- package/src/activities/agent-turn/errors.ts +1152 -82
- package/src/activities/agent-turn/failure-settlement.ts +879 -886
- package/src/activities/agent-turn/final-reply.ts +46 -0
- package/src/activities/agent-turn/finalization-monitor.ts +17 -5
- package/src/activities/agent-turn/finalization.ts +107 -88
- package/src/activities/agent-turn/github-repository-bindings.ts +3 -1
- package/src/activities/agent-turn/governance-model.ts +90 -22
- package/src/activities/agent-turn/history-sink.ts +42 -12
- package/src/activities/agent-turn/history.ts +25 -5
- package/src/activities/agent-turn/input-wait-reply.ts +139 -0
- package/src/activities/agent-turn/knowledge-source-tools.ts +2 -0
- package/src/activities/agent-turn/meaningful-output.ts +44 -0
- package/src/activities/agent-turn/media-artifacts.ts +3 -1
- package/src/activities/agent-turn/model-call-admission.ts +114 -0
- package/src/activities/agent-turn/model-usage.ts +299 -233
- package/src/activities/agent-turn/model-wire-dispatch.ts +27 -0
- package/src/activities/agent-turn/optional-repositories.ts +224 -0
- package/src/activities/agent-turn/prompt-tool-availability.ts +27 -0
- package/src/activities/agent-turn/provider-dispatch-barrier.ts +22 -0
- package/src/activities/agent-turn/provider-recovery-copy.ts +76 -0
- package/src/activities/agent-turn/provider-recovery-metrics.ts +64 -0
- package/src/activities/agent-turn/provider-recovery-policy.ts +25 -0
- package/src/activities/agent-turn/quiescence.ts +7 -7
- package/src/activities/agent-turn/recovery-warning.ts +6 -8
- package/src/activities/agent-turn/refresh-credentials.ts +44 -0
- package/src/activities/agent-turn/run-credentials.ts +124 -76
- package/src/activities/agent-turn/run.ts +501 -112
- package/src/activities/agent-turn/sandbox-establish.ts +152 -75
- package/src/activities/agent-turn/sandbox-provision.ts +54 -1
- package/src/activities/agent-turn/sandbox-route.ts +4 -1
- package/src/activities/agent-turn/sandbox-runtime.ts +319 -11
- package/src/activities/agent-turn/secret-resolver.ts +155 -0
- package/src/activities/agent-turn/session-title.ts +177 -12
- package/src/activities/agent-turn/session-usage-custody.ts +170 -0
- package/src/activities/agent-turn/skill-checkout.ts +111 -24
- package/src/activities/agent-turn/skill-install.ts +1 -1
- package/src/activities/agent-turn/skill-read.ts +374 -28
- package/src/activities/agent-turn/skill-save.ts +35 -7
- package/src/activities/agent-turn/skill-search.ts +9 -0
- package/src/activities/agent-turn/skill-selection.ts +4 -0
- package/src/activities/agent-turn/skill-tools.ts +208 -21
- package/src/activities/agent-turn/skill-transfer.ts +68 -23
- package/src/activities/agent-turn/stream-attempt.ts +634 -111
- package/src/activities/agent-turn/subscription-capacity-arming.ts +81 -0
- package/src/activities/agent-turn/subscription-core-capacity.ts +439 -0
- package/src/activities/agent-turn/subscription-core-failover.ts +229 -0
- package/src/activities/agent-turn/subscription-core-placed.ts +37 -0
- package/src/activities/agent-turn/subscription-core-requests.ts +271 -0
- package/src/activities/agent-turn/subscription-core-settlement.ts +234 -0
- package/src/activities/agent-turn/subscription-lease.ts +140 -0
- package/src/activities/agent-turn/subscription-serving-capacity.ts +195 -0
- package/src/activities/agent-turn/subscription-serving-catalog.ts +71 -0
- package/src/activities/agent-turn/subscription-serving-claim.ts +178 -0
- package/src/activities/agent-turn/subscription-serving-providers.ts +15 -0
- package/src/activities/agent-turn/tool-environment.ts +384 -292
- package/src/activities/agent-turn/tool-policy.ts +104 -4
- package/src/activities/agent-turn/tool-result-spill.ts +1 -0
- package/src/activities/agent-turn/turn-context.ts +124 -8
- package/src/activities/agent-turn/web-search.ts +431 -0
- package/src/activities/agent-turn/xai-core.ts +301 -0
- package/src/activities/automations.ts +81 -6
- package/src/activities/browser-deadline-checkpoint.ts +297 -0
- package/src/activities/capabilities.ts +53 -213
- package/src/activities/codemode-dispatcher.ts +236 -14
- package/src/activities/codex-capacity.ts +27 -380
- package/src/activities/codex-image-generation.ts +252 -42
- package/src/activities/common.ts +12 -0
- package/src/activities/connector-attachments.ts +3 -1
- package/src/activities/context-compaction.ts +182 -21
- package/src/activities/environment.ts +18 -106
- package/src/activities/gmail-files.ts +108 -0
- package/src/activities/goals.ts +120 -204
- package/src/activities/image-generation-operation.ts +1 -1
- package/src/activities/incident-telemetry-authority.ts +80 -50
- package/src/activities/incident-telemetry-preflight.ts +27 -15
- package/src/activities/knowledge-indexing.ts +287 -17
- package/src/activities/knowledge-source-sync.ts +10 -0
- package/src/activities/mcp-account-routes.ts +2 -124
- package/src/activities/model-call-fact-reconciler.ts +112 -0
- package/src/activities/open-suffix-resume.ts +122 -88
- package/src/activities/parent-wake.ts +89 -21
- package/src/activities/programmatic-approvals.ts +26 -0
- package/src/activities/requester-unavailable-receipt.ts +14 -0
- package/src/activities/retained-screenshots.ts +135 -24
- package/src/activities/run-credential-renewal.ts +13 -1
- package/src/activities/run-credentials.ts +61 -19
- package/src/activities/run-input.ts +124 -9
- package/src/activities/sandbox-lease.ts +1615 -73
- package/src/activities/scheduled-tasks.ts +780 -147
- package/src/activities/session-archive.ts +382 -0
- package/src/activities/session-state.ts +219 -10
- package/src/activities/session-storage.ts +124 -0
- package/src/activities/site-auth-maintenance.ts +5 -2
- package/src/activities/subscription-core-claude-waits.ts +49 -0
- package/src/activities/subscription-core-codex-quota.ts +46 -0
- package/src/activities/subscription-core-codex-waits.ts +488 -0
- package/src/activities/subscription-core-image-operation.ts +126 -0
- package/src/activities/subscription-core-usage-recheck.ts +146 -0
- package/src/activities/subscription-core-wait-bindings.ts +12 -0
- package/src/activities/subscription-core-xai-quota.ts +85 -0
- package/src/activities/subscription-core-xai-waits.ts +48 -0
- package/src/activities/types.ts +85 -9
- package/src/activities/video-generation-admission.ts +1 -36
- package/src/activities/video-generation-credential.ts +38 -56
- package/src/activities/video-generation-reconciliation.ts +150 -131
- package/src/activities/video-generation-subscription-core.ts +180 -0
- package/src/activities/workspace-capture.ts +13 -2
- package/src/activities/workspace-credential-provider.ts +302 -0
- package/src/activities/xai-auth.ts +34 -112
- package/src/activities/xai-image-generation.ts +84 -36
- package/src/activities-control.ts +8 -0
- package/src/activities-turn.ts +5 -0
- package/src/activities.ts +17 -0
- package/src/activity-services.ts +29 -4
- package/src/browser-deadline-checkpoint-contract.ts +5 -0
- package/src/editable-artifact-hint-broker.ts +3 -0
- package/src/editable-artifact-materializer-service.ts +85 -39
- package/src/editable-artifact-materializer-subprocess.ts +47 -2
- package/src/editable-artifact-outbox-dispatcher.ts +107 -46
- package/src/editable-artifact-outbox-service.ts +55 -25
- package/src/github-rest-mcp.ts +1 -1
- package/src/host-export-pump.ts +26 -4
- package/src/host-export.ts +4 -1
- package/src/http.ts +4 -2
- package/src/index.ts +222 -282
- package/src/internal-maintenance.ts +347 -0
- package/src/maintenance-cadence.ts +156 -0
- package/src/observability-metrics.ts +1173 -73
- package/src/onepassword-vault-provider.ts +11 -0
- package/src/personal-github-git-credentials.ts +3 -1
- package/src/pr-review-credentials.ts +1 -1
- package/src/readiness-checks.ts +113 -0
- package/src/retained-process-retry.ts +36 -0
- package/src/sandbox-reaper-contract.ts +33 -0
- package/src/sandbox-resume.ts +444 -73
- package/src/sandbox-routing.ts +230 -75
- package/src/session-event-fanout.ts +23 -0
- package/src/telemetry-scheduler.ts +53 -0
- package/src/temporal-runtime-logger.ts +44 -0
- package/src/turn-task-queue-reader.ts +110 -0
- package/src/turn-worker-activity-telemetry.ts +209 -0
- package/src/worker-service-lifecycle.ts +54 -1
- package/src/workflows/activities.ts +16 -1
- package/src/workflows/browser-deadline-checkpoint.ts +55 -0
- package/src/workflows/file-upload-reaper.ts +2 -0
- package/src/workflows/sandbox-reaper.ts +88 -0
- package/src/workflows/scheduled-tasks.ts +26 -13
- package/src/workflows/session-storage.ts +19 -0
- package/src/workflows/session.ts +238 -33
- package/src/workflows/site-auth-maintenance.ts +2 -1
- package/src/workflows/workflow-wake.ts +26 -4
- package/src/workflows.ts +7 -0
- package/dist/activities/agent-turn/xai-capacity.d.ts +0 -2
- package/dist/activities/codex-fleet-shadow.d.ts +0 -74
- package/dist/activities/codex-rotation.d.ts +0 -200
- package/dist/activities/xai-quota.d.ts +0 -3
- package/dist/activities-control-QA6OLRQY.js.map +0 -1
- package/dist/activities-turn-YVVKCGAK.js.map +0 -1
- package/dist/chunk-GDCLDKSH.js.map +0 -1
- package/dist/chunk-I7HKKMUJ.js.map +0 -1
- package/dist/chunk-M3NVMF2V.js.map +0 -1
- package/dist/chunk-RAMNYSAW.js.map +0 -1
- package/src/activities/agent-turn/xai-capacity.ts +0 -257
- package/src/activities/codex-fleet-shadow.ts +0 -306
- package/src/activities/codex-rotation.ts +0 -685
- package/src/activities/xai-quota.ts +0 -35
|
@@ -2,6 +2,7 @@ import type { Agent } from "@openai/agents";
|
|
|
2
2
|
import {
|
|
3
3
|
OPEN_SUFFIX_RUN_STATE_BLOB,
|
|
4
4
|
approvalIdentifier,
|
|
5
|
+
withPublicApprovalFields,
|
|
5
6
|
type HumanInputResponse,
|
|
6
7
|
type SessionEvent,
|
|
7
8
|
} from "@opengeni/contracts";
|
|
@@ -164,7 +165,7 @@ function memberResult(input: {
|
|
|
164
165
|
};
|
|
165
166
|
}
|
|
166
167
|
|
|
167
|
-
async function resultItemForOpenSuffixMember(input: {
|
|
168
|
+
export async function resultItemForOpenSuffixMember(input: {
|
|
168
169
|
agent: Agent<any, any>;
|
|
169
170
|
row: OpenSuffixPendingToolCall;
|
|
170
171
|
trigger: Pick<SessionEvent, "type" | "payload">;
|
|
@@ -177,6 +178,18 @@ async function resultItemForOpenSuffixMember(input: {
|
|
|
177
178
|
const name = toolNameFromCallItem(input.row.callItem);
|
|
178
179
|
const rejected = (): { resultItem: Record<string, unknown>; eventOutput: unknown } => {
|
|
179
180
|
const payload = input.trigger.payload as { message?: unknown; decision?: unknown };
|
|
181
|
+
if (
|
|
182
|
+
input.row.interruptionKind === "approval" &&
|
|
183
|
+
payload.decision === "reject" &&
|
|
184
|
+
!(typeof payload.message === "string" && payload.message.trim().length > 0)
|
|
185
|
+
) {
|
|
186
|
+
// This approval was rejected before invocation, not interrupted during execution.
|
|
187
|
+
return memberResult({
|
|
188
|
+
callId: input.row.callId,
|
|
189
|
+
name,
|
|
190
|
+
output: "Tool approval was rejected. This proposed tool call was not executed.",
|
|
191
|
+
});
|
|
192
|
+
}
|
|
180
193
|
const message =
|
|
181
194
|
typeof payload.message === "string" && payload.message.trim().length > 0
|
|
182
195
|
? payload.message
|
|
@@ -235,6 +248,8 @@ async function resultItemForOpenSuffixMember(input: {
|
|
|
235
248
|
}
|
|
236
249
|
|
|
237
250
|
export async function settleOpenSuffixResumeIfNeeded(input: {
|
|
251
|
+
additionalApprovals?: unknown[];
|
|
252
|
+
programmaticApprovalAcknowledged?: boolean;
|
|
238
253
|
db: Database;
|
|
239
254
|
agent: Agent<any, any>;
|
|
240
255
|
accountId: string;
|
|
@@ -257,7 +272,8 @@ export async function settleOpenSuffixResumeIfNeeded(input: {
|
|
|
257
272
|
}): Promise<OpenSuffixResumeOutcome> {
|
|
258
273
|
if (
|
|
259
274
|
input.trigger.type !== "user.approvalDecision" &&
|
|
260
|
-
input.trigger.type !== "user.humanInputResponse"
|
|
275
|
+
input.trigger.type !== "user.humanInputResponse" &&
|
|
276
|
+
!input.additionalApprovals?.length
|
|
261
277
|
) {
|
|
262
278
|
return { action: "continue" };
|
|
263
279
|
}
|
|
@@ -267,7 +283,7 @@ export async function settleOpenSuffixResumeIfNeeded(input: {
|
|
|
267
283
|
input.sessionId,
|
|
268
284
|
input.turnId,
|
|
269
285
|
);
|
|
270
|
-
if (rows.length === 0) {
|
|
286
|
+
if (rows.length === 0 && !input.additionalApprovals?.length) {
|
|
271
287
|
return { action: "continue" };
|
|
272
288
|
}
|
|
273
289
|
const callId = matchingOpenSuffixCallId({
|
|
@@ -275,112 +291,130 @@ export async function settleOpenSuffixResumeIfNeeded(input: {
|
|
|
275
291
|
humanInputToolCallId: input.humanInputResume?.toolCallId,
|
|
276
292
|
});
|
|
277
293
|
const target = resolveOpenSuffixResumeTarget(rows, callId);
|
|
278
|
-
if (
|
|
294
|
+
if (
|
|
295
|
+
(!target || !callId) &&
|
|
296
|
+
!input.programmaticApprovalAcknowledged &&
|
|
297
|
+
(input.trigger.type === "user.approvalDecision" ||
|
|
298
|
+
input.trigger.type === "user.humanInputResponse" ||
|
|
299
|
+
!input.additionalApprovals?.length)
|
|
300
|
+
) {
|
|
279
301
|
throw new Error("Open suffix resume event does not match an interruption");
|
|
280
302
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
303
|
+
if (target && callId) {
|
|
304
|
+
const truncationTokens =
|
|
305
|
+
input.modelToolOutputTruncationTokens ?? target.modelToolOutputTruncationTokens ?? undefined;
|
|
306
|
+
let resultItem = target.resultItem;
|
|
307
|
+
let eventOutput: unknown = resultItem?.output;
|
|
308
|
+
if (!resultItem) {
|
|
309
|
+
const member = await resultItemForOpenSuffixMember({
|
|
310
|
+
agent: input.agent,
|
|
311
|
+
row: target,
|
|
312
|
+
trigger: input.trigger,
|
|
313
|
+
humanInputResume: input.humanInputResume,
|
|
314
|
+
});
|
|
315
|
+
resultItem = member.resultItem;
|
|
316
|
+
eventOutput = member.eventOutput;
|
|
317
|
+
const recorded = await recordPendingSessionToolCallResult(input.db, {
|
|
318
|
+
accountId: input.accountId,
|
|
319
|
+
workspaceId: input.workspaceId,
|
|
320
|
+
sessionId: input.sessionId,
|
|
321
|
+
turnId: input.turnId,
|
|
322
|
+
executionGeneration: input.executionGeneration,
|
|
323
|
+
attemptId: input.attemptId,
|
|
324
|
+
callId: target.callId,
|
|
325
|
+
...(truncationTokens !== undefined
|
|
326
|
+
? { modelToolOutputTruncationTokens: truncationTokens }
|
|
327
|
+
: {}),
|
|
328
|
+
resultItem,
|
|
329
|
+
eventOutput,
|
|
330
|
+
});
|
|
331
|
+
if (!recorded.accepted) {
|
|
332
|
+
return { action: "cancelled" };
|
|
333
|
+
}
|
|
334
|
+
if (!recorded.recorded) {
|
|
335
|
+
const latest = resolveOpenSuffixResumeTarget(
|
|
336
|
+
await listTurnOpenSuffixToolCalls(
|
|
337
|
+
input.db,
|
|
338
|
+
input.workspaceId,
|
|
339
|
+
input.sessionId,
|
|
340
|
+
input.turnId,
|
|
341
|
+
),
|
|
342
|
+
callId,
|
|
343
|
+
);
|
|
344
|
+
resultItem = latest?.resultItem ?? resultItem;
|
|
345
|
+
} else if (input.publish) {
|
|
346
|
+
await input.publish([
|
|
347
|
+
{
|
|
348
|
+
type: "agent.toolCall.output",
|
|
349
|
+
payload: { id: target.callId, output: eventOutput },
|
|
350
|
+
},
|
|
351
|
+
]);
|
|
352
|
+
}
|
|
329
353
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
throw new Error(`Open suffix resume for ${target.callId} has no result item`);
|
|
333
|
-
}
|
|
334
|
-
const history = await getActiveSessionHistoryItems(input.db, input.workspaceId, input.sessionId);
|
|
335
|
-
if (
|
|
336
|
-
!openSuffixPairPresentInHistory(
|
|
337
|
-
history.map((row) => row.item),
|
|
338
|
-
callId,
|
|
339
|
-
)
|
|
340
|
-
) {
|
|
341
|
-
const historyItems = openSuffixHistoryItems(target, resultItem);
|
|
342
|
-
if (historyItems.length === 0) {
|
|
343
|
-
throw new Error(`Open suffix resume for ${target.callId} produced no paired history`);
|
|
354
|
+
if (!resultItem) {
|
|
355
|
+
throw new Error(`Open suffix resume for ${target.callId} has no result item`);
|
|
344
356
|
}
|
|
345
|
-
const
|
|
357
|
+
const history = await getActiveSessionHistoryItems(
|
|
346
358
|
input.db,
|
|
347
359
|
input.workspaceId,
|
|
348
360
|
input.sessionId,
|
|
349
361
|
);
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
362
|
+
if (
|
|
363
|
+
!openSuffixPairPresentInHistory(
|
|
364
|
+
history.map((row) => row.item),
|
|
365
|
+
callId,
|
|
366
|
+
)
|
|
367
|
+
) {
|
|
368
|
+
const historyItems = openSuffixHistoryItems(target, resultItem);
|
|
369
|
+
if (historyItems.length === 0) {
|
|
370
|
+
throw new Error(`Open suffix resume for ${target.callId} produced no paired history`);
|
|
371
|
+
}
|
|
372
|
+
const nextPosition = await nextSessionHistoryPosition(
|
|
373
|
+
input.db,
|
|
374
|
+
input.workspaceId,
|
|
375
|
+
input.sessionId,
|
|
376
|
+
);
|
|
377
|
+
const appended = await appendSessionHistoryItems(input.db, {
|
|
378
|
+
accountId: input.accountId,
|
|
379
|
+
workspaceId: input.workspaceId,
|
|
380
|
+
sessionId: input.sessionId,
|
|
381
|
+
turnId: input.turnId,
|
|
382
|
+
expectedExecutionGeneration: input.executionGeneration,
|
|
383
|
+
expectedAttemptId: input.attemptId,
|
|
384
|
+
...(truncationTokens !== undefined
|
|
385
|
+
? { modelToolOutputTruncationTokens: truncationTokens }
|
|
386
|
+
: {}),
|
|
387
|
+
items: historyItems.map((item, offset) => ({
|
|
388
|
+
position: nextPosition + offset,
|
|
389
|
+
item,
|
|
390
|
+
})),
|
|
391
|
+
});
|
|
392
|
+
if (!appended) {
|
|
393
|
+
return { action: "cancelled" };
|
|
394
|
+
}
|
|
367
395
|
}
|
|
368
396
|
}
|
|
369
397
|
const remaining = (
|
|
370
398
|
await listTurnOpenSuffixToolCalls(input.db, input.workspaceId, input.sessionId, input.turnId)
|
|
371
399
|
).filter((row) => row.resultItem == null);
|
|
372
|
-
if (remaining.length === 0) {
|
|
400
|
+
if (remaining.length === 0 && !input.additionalApprovals?.length) {
|
|
373
401
|
return { action: "continue" };
|
|
374
402
|
}
|
|
375
|
-
const requiresActionApprovals =
|
|
376
|
-
|
|
403
|
+
const requiresActionApprovals = [
|
|
404
|
+
...remainingPendingApprovalsFromSuffix(remaining),
|
|
405
|
+
...(input.additionalApprovals ?? []),
|
|
406
|
+
];
|
|
407
|
+
const pendingApprovals = [
|
|
408
|
+
...remainingRunStatePendingApprovalsFromSuffix(remaining),
|
|
409
|
+
...(input.additionalApprovals ?? []),
|
|
410
|
+
];
|
|
377
411
|
const settled = await input.settle({
|
|
378
412
|
events: [
|
|
379
413
|
...(requiresActionApprovals.length > 0
|
|
380
414
|
? [
|
|
381
415
|
{
|
|
382
416
|
type: "session.requiresAction" as const,
|
|
383
|
-
payload: { approvals: requiresActionApprovals },
|
|
417
|
+
payload: { approvals: requiresActionApprovals.map(withPublicApprovalFields) },
|
|
384
418
|
},
|
|
385
419
|
]
|
|
386
420
|
: []),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getSessionParentClaudeProviderAccountAuthority } from "@opengeni/db";
|
|
1
2
|
import type { Settings } from "@opengeni/config";
|
|
2
3
|
import type { Session, SessionGoal, SessionSystemUpdatePayload } from "@opengeni/contracts";
|
|
3
4
|
import {
|
|
@@ -9,6 +10,10 @@ import {
|
|
|
9
10
|
addSessionSystemUpdateWithSourceMutation,
|
|
10
11
|
claimPendingSessionSystemUpdateOutbox,
|
|
11
12
|
claimPendingSessionWorkflowWakes,
|
|
13
|
+
repairPendingChildTerminalResultWakes,
|
|
14
|
+
type ChildTerminalWakeRepairCursor,
|
|
15
|
+
repairMissingQuiescenceReceiptWakes,
|
|
16
|
+
type QuiescenceReceiptWakeRepairCursor,
|
|
12
17
|
childRequiresActionDedupeKey,
|
|
13
18
|
getSessionSystemUpdateOutboxByDedupeKey,
|
|
14
19
|
getOrCreateSessionSystemUpdateOutbox,
|
|
@@ -39,8 +44,13 @@ export type ReconcileParentSystemUpdateOverrides = Partial<{
|
|
|
39
44
|
|
|
40
45
|
export type ReconcileSessionWorkflowWakeOverrides = Partial<{
|
|
41
46
|
claimPendingSessionWorkflowWakes: typeof claimPendingSessionWorkflowWakes;
|
|
47
|
+
repairPendingChildTerminalResultWakes: typeof repairPendingChildTerminalResultWakes;
|
|
48
|
+
repairMissingQuiescenceReceiptWakes: typeof repairMissingQuiescenceReceiptWakes;
|
|
42
49
|
}>;
|
|
43
50
|
|
|
51
|
+
const childTerminalRepairCursors = new WeakMap<Database, ChildTerminalWakeRepairCursor>();
|
|
52
|
+
const quiescenceRepairCursors = new WeakMap<Database, QuiescenceReceiptWakeRepairCursor>();
|
|
53
|
+
|
|
44
54
|
export type ReconcileAutomaticSessionTitleFanoutOverrides = Partial<{
|
|
45
55
|
claimAutomaticSessionTitleFanout: typeof claimAutomaticSessionTitleFanout;
|
|
46
56
|
markAutomaticSessionTitleFanoutDelivered: typeof markAutomaticSessionTitleFanoutDelivered;
|
|
@@ -64,12 +74,9 @@ export async function notifyParentOfChildIdle(
|
|
|
64
74
|
return;
|
|
65
75
|
}
|
|
66
76
|
const goal = await getSessionGoal(svc.db, workspaceId, childSessionId);
|
|
67
|
-
// Sacred user pause: if the MANAGER's own goal was paused by the user, the
|
|
68
|
-
// wake must not tell it to "resume it now" — that instruction is exactly
|
|
69
|
-
// what re-arms the loop the user just stopped. Suppress the resume nudge and
|
|
70
|
-
// tell the agent to stay paused. Paired with the goal_set reactivation
|
|
71
|
-
// guard so a nudge that slips through still cannot revive the goal.
|
|
72
77
|
const clientEventId = `child-completion:${childSessionId}:${episodeKey}`;
|
|
78
|
+
// The idle settlement committed this row with the child's frozen final
|
|
79
|
+
// answer. This adds the goal facts; the upsert keeps the frozen content.
|
|
73
80
|
const payload = childCompletionPayload(child, goal);
|
|
74
81
|
const personalConnectionDelegations = await getSessionParentPersonalConnectionDelegations(
|
|
75
82
|
svc.db,
|
|
@@ -86,6 +93,11 @@ export async function notifyParentOfChildIdle(
|
|
|
86
93
|
workspaceId,
|
|
87
94
|
childSessionId,
|
|
88
95
|
);
|
|
96
|
+
const claudeAuthority = await getSessionParentClaudeProviderAccountAuthority(
|
|
97
|
+
svc.db,
|
|
98
|
+
workspaceId,
|
|
99
|
+
childSessionId,
|
|
100
|
+
);
|
|
89
101
|
const outbox = await getOrCreateSessionSystemUpdateOutbox(svc.db, {
|
|
90
102
|
accountId: child.accountId,
|
|
91
103
|
workspaceId,
|
|
@@ -98,6 +110,9 @@ export async function notifyParentOfChildIdle(
|
|
|
98
110
|
summary: childCompletionSummary(child, goal, "idle"),
|
|
99
111
|
payload,
|
|
100
112
|
lineage: {
|
|
113
|
+
...(claudeAuthority.subjectId
|
|
114
|
+
? { claudeAuthoritySubjectId: claudeAuthority.subjectId }
|
|
115
|
+
: {}),
|
|
101
116
|
childSessionId: child.id,
|
|
102
117
|
parentSessionId: child.parentSessionId,
|
|
103
118
|
...(xaiAuthority.subjectId ? { xaiAuthoritySubjectId: xaiAuthority.subjectId } : {}),
|
|
@@ -105,6 +120,7 @@ export async function notifyParentOfChildIdle(
|
|
|
105
120
|
personalConnectionDelegations,
|
|
106
121
|
mcpAccountBindings,
|
|
107
122
|
xaiProviderAccountAuthoritySnapshot: xaiAuthority.snapshot,
|
|
123
|
+
claudeProviderAccountAuthoritySnapshot: claudeAuthority.snapshot,
|
|
108
124
|
});
|
|
109
125
|
if (outbox.status === "delivered") {
|
|
110
126
|
return;
|
|
@@ -223,6 +239,8 @@ async function deliverParentSystemUpdateOutbox(
|
|
|
223
239
|
personalConnectionDelegations: outbox.personalConnectionDelegations,
|
|
224
240
|
mcpAccountBindings: outbox.mcpAccountBindings,
|
|
225
241
|
xaiProviderAccountAuthoritySnapshot: outbox.xaiProviderAccountAuthoritySnapshot,
|
|
242
|
+
claudeProviderAccountAuthoritySnapshot: outbox.claudeProviderAccountAuthoritySnapshot,
|
|
243
|
+
subscriptionAuthority: outbox.subscriptionAuthority,
|
|
226
244
|
},
|
|
227
245
|
async (tx) => {
|
|
228
246
|
await markSessionSystemUpdateOutboxDeliveredInTransaction(tx, outbox);
|
|
@@ -360,6 +378,67 @@ export type WorkflowWakeReconciliationResult = {
|
|
|
360
378
|
>;
|
|
361
379
|
};
|
|
362
380
|
|
|
381
|
+
/**
|
|
382
|
+
* Register durable wakes that a producer committed work for but never woke:
|
|
383
|
+
* pending child results on an idle parent, and recovering sessions still
|
|
384
|
+
* owed a physical-quiescence receipt. Registration is idempotent and lock
|
|
385
|
+
* fenced, writes only when it finds a real repair, and never delivers. The
|
|
386
|
+
* dispatcher activity runs it before claiming, and the worker's maintenance
|
|
387
|
+
* cadence runs it before checking for due wakes, so an idle tick needs no
|
|
388
|
+
* workflow execution to keep this repair cadence.
|
|
389
|
+
*/
|
|
390
|
+
export async function repairMissedSessionWorkflowWakes(
|
|
391
|
+
svc: Pick<NotifyServices, "db" | "observability">,
|
|
392
|
+
limit = 100,
|
|
393
|
+
overrides: Pick<
|
|
394
|
+
ReconcileSessionWorkflowWakeOverrides,
|
|
395
|
+
"repairPendingChildTerminalResultWakes" | "repairMissingQuiescenceReceiptWakes"
|
|
396
|
+
> = {},
|
|
397
|
+
): Promise<void> {
|
|
398
|
+
const repairChildren =
|
|
399
|
+
overrides.repairPendingChildTerminalResultWakes ?? repairPendingChildTerminalResultWakes;
|
|
400
|
+
const inventory = await repairChildren(
|
|
401
|
+
svc.db,
|
|
402
|
+
limit,
|
|
403
|
+
childTerminalRepairCursors.get(svc.db) ?? null,
|
|
404
|
+
);
|
|
405
|
+
if (inventory.cursor) childTerminalRepairCursors.set(svc.db, inventory.cursor);
|
|
406
|
+
else childTerminalRepairCursors.delete(svc.db);
|
|
407
|
+
if (inventory.failed > 0) {
|
|
408
|
+
svc.observability.error("Pending child-result wake repair failed", {
|
|
409
|
+
examined: inventory.examined,
|
|
410
|
+
registered: inventory.registered,
|
|
411
|
+
failed: inventory.failed,
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
const repairQuiescence =
|
|
415
|
+
overrides.repairMissingQuiescenceReceiptWakes ?? repairMissingQuiescenceReceiptWakes;
|
|
416
|
+
// Repair discovery must never block delivery of already-pending wakes.
|
|
417
|
+
try {
|
|
418
|
+
const quiescenceInventory = await repairQuiescence(
|
|
419
|
+
svc.db,
|
|
420
|
+
limit,
|
|
421
|
+
quiescenceRepairCursors.get(svc.db) ?? null,
|
|
422
|
+
);
|
|
423
|
+
if (quiescenceInventory.cursor) {
|
|
424
|
+
quiescenceRepairCursors.set(svc.db, quiescenceInventory.cursor);
|
|
425
|
+
} else {
|
|
426
|
+
quiescenceRepairCursors.delete(svc.db);
|
|
427
|
+
}
|
|
428
|
+
if (quiescenceInventory.failed > 0) {
|
|
429
|
+
svc.observability.error("Missing quiescence-receipt wake repair failed", {
|
|
430
|
+
examined: quiescenceInventory.examined,
|
|
431
|
+
registered: quiescenceInventory.registered,
|
|
432
|
+
failed: quiescenceInventory.failed,
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
} catch (error) {
|
|
436
|
+
svc.observability.error("Missing quiescence-receipt wake repair failed", {
|
|
437
|
+
error: error instanceof Error ? error.message : String(error),
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
363
442
|
export async function reconcilePendingSessionWorkflowWakes(
|
|
364
443
|
svc: NotifyServices,
|
|
365
444
|
limit = 1_000,
|
|
@@ -378,6 +457,7 @@ export async function reconcilePendingSessionWorkflowWakes(
|
|
|
378
457
|
pendingAdmissionBlockers: {},
|
|
379
458
|
};
|
|
380
459
|
}
|
|
460
|
+
await repairMissedSessionWorkflowWakes(svc, Math.min(100, limit), overrides);
|
|
381
461
|
const repairs = await claimPendingSessionWorkflowWakesFn(svc.db, limit);
|
|
382
462
|
let signaled = 0;
|
|
383
463
|
let pendingAdmission = 0;
|
|
@@ -465,11 +545,10 @@ function childCompletionPayload(
|
|
|
465
545
|
}
|
|
466
546
|
|
|
467
547
|
/**
|
|
468
|
-
* The
|
|
469
|
-
* the
|
|
470
|
-
*
|
|
471
|
-
*
|
|
472
|
-
* shared trailing instruction instead of running N model calls.
|
|
548
|
+
* The short status line for one child (what happened + its goal). It is also
|
|
549
|
+
* the timeline preview, so it carries no instructions: the parent reads the
|
|
550
|
+
* child's answer from the typed payload, and the operational contract says how
|
|
551
|
+
* to use it. N completions coalesce into one internal-update inference.
|
|
473
552
|
*/
|
|
474
553
|
export function childCompletionSummary(
|
|
475
554
|
child: Session,
|
|
@@ -503,14 +582,3 @@ export function childCompletionSummary(
|
|
|
503
582
|
}
|
|
504
583
|
return lines.join("\n");
|
|
505
584
|
}
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* The single trailing instruction appended to a child-completion (or digest)
|
|
509
|
-
* inference. Suppresses the "resume it now" nudge when the manager's own goal
|
|
510
|
-
* was paused by the user (paired with the goal_set reactivation guard).
|
|
511
|
-
*/
|
|
512
|
-
export function childCompletionTrailing(parentGoalUserPaused: boolean): string {
|
|
513
|
-
return parentGoalUserPaused
|
|
514
|
-
? "Read each worker's session events/notebook output for its result. This session was paused by the user — do NOT resume or replace your goal; summarize the result for the user and remain paused."
|
|
515
|
-
: "Read each worker's session events/notebook output for its result, then continue. If your own goal was paused awaiting these workers, resume it now.";
|
|
516
|
-
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CodemodeOperation } from "@opengeni/contracts";
|
|
2
|
+
|
|
3
|
+
/** Programmatic receipts are not open SDK calls. Exact arguments stay in protected storage. */
|
|
4
|
+
export function programmaticApproval(operation: CodemodeOperation) {
|
|
5
|
+
return {
|
|
6
|
+
id: operation.operationId,
|
|
7
|
+
name: operation.identity.toolName,
|
|
8
|
+
source: "codemode" as const,
|
|
9
|
+
operationId: operation.operationId,
|
|
10
|
+
requestId: operation.approvalRequestId,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function programmaticContinuationNote(
|
|
15
|
+
operations: readonly CodemodeOperation[],
|
|
16
|
+
): string | undefined {
|
|
17
|
+
if (operations.length === 0) return undefined;
|
|
18
|
+
return [
|
|
19
|
+
"Stored programmatic operations (durable server receipts):",
|
|
20
|
+
...operations.map(
|
|
21
|
+
(operation) =>
|
|
22
|
+
`${operation.operationId}: ${operation.state}${operation.errorCode ? ` (${operation.errorCode})` : ""}`,
|
|
23
|
+
),
|
|
24
|
+
"Approval resumes the stored operation, not the earlier program's JavaScript stack. Read results with the current Codemode client's status/resume handle. Do not resubmit arguments for completed, running, waiting, or uncertain operations.",
|
|
25
|
+
].join("\n");
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Neutral model-facing text for history media the current requester's file
|
|
3
|
+
* authority excludes, for example another participant's private file in a
|
|
4
|
+
* shared session. Authority exclusion and real unavailability stay
|
|
5
|
+
* indistinguishable, and there is no fetch instruction that would fail and
|
|
6
|
+
* lead the model to report the file as deleted.
|
|
7
|
+
*/
|
|
8
|
+
export function requesterUnavailableReceiptText(subject: string, noun: "file" | "image"): string {
|
|
9
|
+
return (
|
|
10
|
+
`[${subject}. This ${noun} is not available to the current requester: ` +
|
|
11
|
+
`it may belong to another participant, or it may no longer be available. ` +
|
|
12
|
+
`Its contents are not included and it cannot be downloaded in this turn; do not guess which.]`
|
|
13
|
+
);
|
|
14
|
+
}
|