deepline 0.3.89 → 0.3.91
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/contracts/install-commands.json +29 -0
- package/dist/bundling-sources/sdk/src/client.ts +221 -43
- package/dist/bundling-sources/sdk/src/index.ts +4 -0
- package/dist/bundling-sources/sdk/src/monitor-fleet-contract.ts +2 -556
- package/dist/bundling-sources/sdk/src/monitor-fleets.ts +2 -2
- package/dist/bundling-sources/sdk/src/pagination.ts +25 -0
- package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +1 -1
- package/dist/bundling-sources/sdk/src/release.ts +11 -9
- package/dist/bundling-sources/sdk/src/types.ts +29 -1
- package/dist/bundling-sources/shared_libs/integration-contracts/monitor-fleet-contract.ts +549 -0
- package/dist/bundling-sources/shared_libs/monitors/analytics-public.ts +10 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/errors.ts +96 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +8 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/plan.ts +320 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/verdict.ts +106 -0
- package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +8 -1
- package/dist/bundling-sources/shared_libs/monitors/inbound-queue.ts +4 -4
- package/dist/bundling-sources/shared_libs/monitors/inventory-reconciliation.ts +59 -0
- package/dist/bundling-sources/shared_libs/monitors/lifecycle-notifications.ts +7 -9
- package/dist/bundling-sources/shared_libs/monitors/monitor-fleet-limits.ts +2 -12
- package/dist/bundling-sources/shared_libs/monitors/package.json +113 -4
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +56 -9
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-consumer-health.ts +2 -2
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts +2 -2
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-public-aliases.ts +1 -1
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +245 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-message.ts +38 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue-ack-probe.ts +94 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue-delivery.ts +60 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-queue.ts +60 -0
- package/dist/bundling-sources/shared_libs/monitors/snitcher-install-validation.ts +1 -1
- package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +2 -2
- package/dist/bundling-sources/shared_libs/monitors/snitcher-radar.ts +1 -1
- package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +1 -1
- package/dist/bundling-sources/shared_libs/observability/build-context.ts +13 -0
- package/dist/bundling-sources/shared_libs/observability/log-metadata.ts +160 -0
- package/dist/bundling-sources/shared_libs/observability/request-context.ts +68 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +690 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +35 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-work.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/neon-constants.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +272 -0
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +46 -1
- package/dist/bundling-sources/shared_libs/play-runtime/async-operation.ts +66 -1
- package/dist/bundling-sources/shared_libs/play-runtime/async-play-invocation.ts +0 -1
- package/dist/bundling-sources/shared_libs/play-runtime/bounceban-batching.ts +137 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +779 -140
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +46 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-payload-contract.ts +68 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-janitor.ts +103 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-reaper.ts +725 -0
- package/dist/bundling-sources/shared_libs/play-runtime/db-session-lease-store.ts +578 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/roll-execution-relay.ts +521 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/roll-receipt-gateway.ts +1378 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/runtime-topology.ts +1024 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-gateway-route-probe.ts +193 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machine-lifecycle.ts +104 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +1844 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-registry.ts +21 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/process-tree.ts +40 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-gateway-drain.ts +262 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-surface.ts +98 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-topology.ts +303 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-tuple-publication-guardian.ts +70 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-tuple-recovery.ts +519 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-fly-rollback-alignment.ts +280 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-production-gate.ts +159 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +29 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +23 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execution-gateway-invocation-fence.ts +442 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execution-protocol.ts +3 -3
- package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +18 -0
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/contracts.ts +66 -0
- package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/job.ts +145 -0
- package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/memory-store.ts +114 -0
- package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/ports.ts +21 -0
- package/dist/bundling-sources/shared_libs/play-runtime/integration-operation-reader-fence/postgres-store.ts +170 -0
- package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +1322 -0
- package/dist/bundling-sources/shared_libs/play-runtime/internal-step-ids.ts +2 -2
- package/dist/bundling-sources/shared_libs/play-runtime/lane-retirement-gate.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/launch-source-policy.ts +112 -0
- package/dist/bundling-sources/shared_libs/play-runtime/map-execution-frame.ts +8 -0
- package/dist/bundling-sources/shared_libs/play-runtime/perf-trace.ts +127 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-artifact-runtime-contract.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-run-recovery-policy.ts +24 -1
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/contracts.ts +56 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/index.ts +13 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/job.ts +41 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/ports.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/postgres-adapter.ts +54 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/contracts.ts +114 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/engine-suspension.ts +108 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/index.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/job.ts +97 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/ports.ts +104 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/postgres-fence-adapter.ts +263 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/worker-terminal-projection.ts +64 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/contracts.ts +29 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/gateway-adapter.ts +56 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/index.ts +15 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/job.ts +65 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/ports.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/contracts.ts +42 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/index.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +142 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/ports.ts +42 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/postgres-adapter.ts +102 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/contracts.ts +60 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/index.ts +16 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/job.ts +78 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/ports.ts +54 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/postgres-adapter.ts +71 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-batching-registry.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/receipt-status.ts +5 -8
- package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +3 -5
- package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +168 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +44 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/child-play-resolver.ts +26 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +3662 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/progress-sidecar.ts +47 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-deadline.ts +84 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-gateway-transport.ts +91 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-heartbeat.ts +424 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-progress-push.ts +321 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-sheet-persistence-retry.ts +110 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +625 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +72 -9
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +6 -12
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +19 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/bundle.ts +0 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +14 -44
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +103 -208
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +201 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-env.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +67 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-release-environment.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sandbox-contract.ts +68 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +14 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-telemetry.ts +108 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +7 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-deadline-reconciliation.ts +88 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-play-deploy-task.ts +124 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-play-run-task.ts +68 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +193 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-queue-lifecycle.ts +269 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-queue-suffix.ts +73 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +6642 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +897 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-metrics.ts +120 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-required-env.ts +76 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +476 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/gateway-heavy-request-admission.ts +47 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/gateway-progress-registry.ts +147 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/index.ts +27 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/lazy.ts +50 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +98 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-budget-state.ts +260 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-pool.ts +1416 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +1255 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +942 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +14636 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +888 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +355 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-terminal-transition.ts +46 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runner-push.ts +60 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts +33 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-receipt-gateway-health.ts +64 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +835 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-ledger-reconciliation.ts +1218 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-operation.ts +207 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-scheduler-schema.ts +10 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/scheduler-capacity.ts +123 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/scheduler-launch-read-observability.ts +78 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/submit-admission.ts +169 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/terminal-contract.ts +20 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/worker-queue-metrics.ts +34 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/worker-resource-metrics.ts +249 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sheet-attempt-sql.ts +7 -0
- package/dist/bundling-sources/shared_libs/play-runtime/step-progress.ts +296 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/native-batch.ts +3 -3
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/runtime-step-receipts-adapter.ts +20 -1
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +60 -15
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execution-outcome.ts +20 -0
- package/dist/bundling-sources/shared_libs/play-runtime/transient-service-error.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/vercel-protection.ts +14 -1
- package/dist/bundling-sources/shared_libs/play-runtime/webhook-receipt-retry.ts +50 -0
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +165 -0
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +15 -23
- package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +169 -0
- package/dist/bundling-sources/shared_libs/play-runtime/zerobounce-batching.ts +122 -0
- package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +2 -0
- package/dist/bundling-sources/shared_libs/plays/bundling/repository-adapter.ts +24 -0
- package/dist/bundling-sources/shared_libs/plays/child-run-projection.ts +174 -0
- package/dist/bundling-sources/shared_libs/plays/contracts.ts +2 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/api-client.ts +267 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/control-plane-types.ts +73 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/manifest.ts +162 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/project-serializer.ts +87 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/source-file-path.ts +26 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/target-paths.ts +36 -0
- package/dist/bundling-sources/shared_libs/plays/deployment-status.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/docflow.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/launch/input-contract.ts +400 -0
- package/dist/bundling-sources/shared_libs/plays/launch/prepare.ts +96 -0
- package/dist/bundling-sources/shared_libs/plays/local-file-discovery.ts +385 -0
- package/dist/bundling-sources/shared_libs/plays/play-grep-search.ts +112 -0
- package/dist/bundling-sources/shared_libs/plays/play-reference.ts +117 -0
- package/dist/bundling-sources/shared_libs/plays/run-input-summary.ts +260 -0
- package/dist/bundling-sources/shared_libs/plays/run-summary-types.ts +49 -0
- package/dist/bundling-sources/shared_libs/plays/secrets/errors.ts +19 -0
- package/dist/bundling-sources/shared_libs/plays/share/copy.ts +271 -0
- package/dist/bundling-sources/shared_libs/plays/share/metrics.ts +140 -0
- package/dist/bundling-sources/shared_libs/plays/share/public-read-model.ts +86 -0
- package/dist/bundling-sources/shared_libs/plays/share/seo-quality.ts +181 -0
- package/dist/bundling-sources/shared_libs/plays/share/static-pipeline-summary.ts +658 -0
- package/dist/bundling-sources/shared_libs/plays/share/types.ts +197 -0
- package/dist/bundling-sources/shared_libs/plays/sheet-filter.ts +347 -0
- package/dist/bundling-sources/shared_libs/plays/slack-hitl-timeout-error.ts +37 -0
- package/dist/bundling-sources/shared_libs/plays/standard-webhooks.ts +117 -0
- package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +6 -1
- package/dist/bundling-sources/shared_libs/plays/status-result.ts +388 -0
- package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/transform-factor-structure.ts +377 -0
- package/dist/bundling-sources/shared_libs/plays/webhook-payload.ts +113 -0
- package/dist/bundling-sources/shared_libs/product-notifications/configuration.ts +7 -1
- package/dist/bundling-sources/shared_libs/product-notifications/default-policy.ts +3 -2
- package/dist/bundling-sources/shared_libs/product-notifications/overflow.ts +18 -0
- package/dist/bundling-sources/shared_libs/product-notifications/rolling-limit.ts +24 -0
- package/dist/bundling-sources/shared_libs/product-notifications/slack-delivery.ts +624 -0
- package/dist/bundling-sources/shared_libs/product-notifications/slack-payload.ts +140 -0
- package/dist/bundling-sources/shared_libs/product-notifications/slack-transport.ts +75 -0
- package/dist/bundling-sources/shared_libs/runtime-env.ts +6 -0
- package/dist/bundling-sources/shared_libs/security/email-blacklist.ts +42 -0
- package/dist/bundling-sources/shared_libs/security/header-safe-env.ts +10 -3
- package/dist/bundling-sources/shared_libs/security/slack-sanitize.ts +133 -0
- package/dist/cli/getting-started.d.mts +52 -0
- package/dist/cli/getting-started.d.ts +52 -0
- package/dist/cli/getting-started.js +65 -0
- package/dist/cli/getting-started.mjs +36 -0
- package/dist/cli/index.d.mts +9 -0
- package/dist/cli/index.d.ts +9 -0
- package/dist/cli/index.js +895 -407
- package/dist/cli/index.mjs +893 -414
- package/dist/{compiler-manifest-DsLbQaew.d.mts → compiler-manifest-x14KL83E.d.mts} +4 -2
- package/dist/{compiler-manifest-DsLbQaew.d.ts → compiler-manifest-x14KL83E.d.ts} +4 -2
- package/dist/index.d.mts +124 -154
- package/dist/index.d.ts +124 -154
- package/dist/index.js +132 -28
- package/dist/index.mjs +132 -28
- package/dist/install-integrity.json +182 -2
- package/dist/monitor-fleet-contract.d.mts +131 -0
- package/dist/monitor-fleet-contract.d.ts +131 -0
- package/dist/monitor-fleet-contract.js +406 -0
- package/dist/monitor-fleet-contract.mjs +367 -0
- package/dist/plays/bundle-play-file.d.mts +2 -2
- package/dist/plays/bundle-play-file.d.ts +2 -2
- package/dist/release.d.mts +255 -0
- package/dist/release.d.ts +255 -0
- package/dist/release.js +210 -0
- package/dist/release.mjs +183 -0
- package/package.json +21 -4
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/worker-resource-metrics.ts
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { statfsSync } from 'node:fs';
|
|
2
|
+
import { cpus } from 'node:os';
|
|
3
|
+
|
|
4
|
+
type ReadFile = (path: string, encoding: 'utf8') => string;
|
|
5
|
+
|
|
6
|
+
export type WorkerResourceMetrics = {
|
|
7
|
+
cpuUtilizationRatio: number;
|
|
8
|
+
cpuLimitCores: number;
|
|
9
|
+
memoryUsageBytes: number;
|
|
10
|
+
memoryLimitBytes: number;
|
|
11
|
+
memoryUtilizationRatio: number;
|
|
12
|
+
filesystemUsageBytes: number;
|
|
13
|
+
filesystemAvailableBytes: number;
|
|
14
|
+
filesystemTotalBytes: number;
|
|
15
|
+
filesystemUtilizationRatio: number;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** A zero-sized filesystem report means the probe itself is unavailable; a
|
|
19
|
+
* nonzero filesystem with zero free bytes is the most urgent pressure state. */
|
|
20
|
+
export function hasFilesystemPressure(
|
|
21
|
+
metrics: Pick<
|
|
22
|
+
WorkerResourceMetrics,
|
|
23
|
+
'filesystemAvailableBytes' | 'filesystemTotalBytes'
|
|
24
|
+
>,
|
|
25
|
+
reserveBytes: number,
|
|
26
|
+
): boolean {
|
|
27
|
+
return (
|
|
28
|
+
metrics.filesystemTotalBytes > 0 &&
|
|
29
|
+
metrics.filesystemAvailableBytes < reserveBytes
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
type FileSystemStats = {
|
|
34
|
+
bsize: number;
|
|
35
|
+
blocks: number;
|
|
36
|
+
bfree: number;
|
|
37
|
+
bavail: number;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** Renders the small common CPU/RAM surface used by runtime processes. */
|
|
41
|
+
export function renderRuntimeProcessResourceMetrics(input: {
|
|
42
|
+
service: 'scheduler' | 'receipt_gateway' | 'execution_gateway' | 'scaler';
|
|
43
|
+
machine: string;
|
|
44
|
+
metrics: WorkerResourceMetrics;
|
|
45
|
+
}): string {
|
|
46
|
+
const labels = `service="${input.service}",machine="${input.machine}"`;
|
|
47
|
+
return [
|
|
48
|
+
'# HELP deepline_runtime_process_cpu_utilization_percent Container CPU utilization normalized to its CPU limit.',
|
|
49
|
+
'# TYPE deepline_runtime_process_cpu_utilization_percent gauge',
|
|
50
|
+
`deepline_runtime_process_cpu_utilization_percent{${labels}} ${input.metrics.cpuUtilizationRatio * 100}`,
|
|
51
|
+
'# HELP deepline_runtime_process_cpu_limit_cores Container CPU limit in cores.',
|
|
52
|
+
'# TYPE deepline_runtime_process_cpu_limit_cores gauge',
|
|
53
|
+
`deepline_runtime_process_cpu_limit_cores{${labels}} ${input.metrics.cpuLimitCores}`,
|
|
54
|
+
'# HELP deepline_runtime_process_memory_usage_bytes Container memory currently used.',
|
|
55
|
+
'# TYPE deepline_runtime_process_memory_usage_bytes gauge',
|
|
56
|
+
`deepline_runtime_process_memory_usage_bytes{${labels}} ${input.metrics.memoryUsageBytes}`,
|
|
57
|
+
'# HELP deepline_runtime_process_memory_limit_bytes Container memory limit.',
|
|
58
|
+
'# TYPE deepline_runtime_process_memory_limit_bytes gauge',
|
|
59
|
+
`deepline_runtime_process_memory_limit_bytes{${labels}} ${input.metrics.memoryLimitBytes}`,
|
|
60
|
+
'# HELP deepline_runtime_process_memory_utilization_percent Container memory utilization normalized to its memory limit.',
|
|
61
|
+
'# TYPE deepline_runtime_process_memory_utilization_percent gauge',
|
|
62
|
+
`deepline_runtime_process_memory_utilization_percent{${labels}} ${input.metrics.memoryUtilizationRatio * 100}`,
|
|
63
|
+
'# HELP deepline_runtime_process_filesystem_usage_bytes Local /tmp filesystem space used.',
|
|
64
|
+
'# TYPE deepline_runtime_process_filesystem_usage_bytes gauge',
|
|
65
|
+
`deepline_runtime_process_filesystem_usage_bytes{${labels}} ${input.metrics.filesystemUsageBytes}`,
|
|
66
|
+
'# HELP deepline_runtime_process_filesystem_available_bytes Local /tmp filesystem space available.',
|
|
67
|
+
'# TYPE deepline_runtime_process_filesystem_available_bytes gauge',
|
|
68
|
+
`deepline_runtime_process_filesystem_available_bytes{${labels}} ${input.metrics.filesystemAvailableBytes}`,
|
|
69
|
+
'# HELP deepline_runtime_process_filesystem_total_bytes Local /tmp filesystem total capacity.',
|
|
70
|
+
'# TYPE deepline_runtime_process_filesystem_total_bytes gauge',
|
|
71
|
+
`deepline_runtime_process_filesystem_total_bytes{${labels}} ${input.metrics.filesystemTotalBytes}`,
|
|
72
|
+
'# HELP deepline_runtime_process_filesystem_utilization_percent Local /tmp filesystem utilization normalized to its capacity.',
|
|
73
|
+
'# TYPE deepline_runtime_process_filesystem_utilization_percent gauge',
|
|
74
|
+
`deepline_runtime_process_filesystem_utilization_percent{${labels}} ${input.metrics.filesystemUtilizationRatio * 100}`,
|
|
75
|
+
].join('\n');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
type CpuSample = {
|
|
79
|
+
usageMicroseconds: number;
|
|
80
|
+
sampledAtMs: number;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
function finiteNonNegative(value: number, fallback: number): number {
|
|
84
|
+
return Number.isFinite(value) && value >= 0 ? value : fallback;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function parseCgroupCpuLimit(raw: string, fallback: number): number {
|
|
88
|
+
const [quota, period] = raw.trim().split(/\s+/, 2);
|
|
89
|
+
if (!quota || quota === 'max' || !period) return fallback;
|
|
90
|
+
const parsedQuota = Number(quota);
|
|
91
|
+
const parsedPeriod = Number(period);
|
|
92
|
+
if (
|
|
93
|
+
!Number.isFinite(parsedQuota) ||
|
|
94
|
+
!Number.isFinite(parsedPeriod) ||
|
|
95
|
+
parsedQuota <= 0 ||
|
|
96
|
+
parsedPeriod <= 0
|
|
97
|
+
) {
|
|
98
|
+
return fallback;
|
|
99
|
+
}
|
|
100
|
+
return Math.max(parsedQuota / parsedPeriod, 0.01);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** cgroup v1 reports aggregate CPU time in nanoseconds. */
|
|
104
|
+
export function parseCgroupV1CpuUsageMicroseconds(raw: string): number | null {
|
|
105
|
+
const nanoseconds = Number(raw.trim());
|
|
106
|
+
return Number.isFinite(nanoseconds) && nanoseconds >= 0
|
|
107
|
+
? nanoseconds / 1_000
|
|
108
|
+
: null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function parseCgroupCpuUsageMicroseconds(raw: string): number | null {
|
|
112
|
+
const match = raw.match(/^usage_usec\s+(\d+)$/m);
|
|
113
|
+
if (!match) return null;
|
|
114
|
+
const usage = Number(match[1]);
|
|
115
|
+
return Number.isFinite(usage) && usage >= 0 ? usage : null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function parseCgroupLimit(raw: string, fallback: number): number {
|
|
119
|
+
const value = raw.trim();
|
|
120
|
+
if (!value || value === 'max') return fallback;
|
|
121
|
+
return finiteNonNegative(Number(value), fallback);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function parseFileSystemStats(stats: FileSystemStats | null): {
|
|
125
|
+
usageBytes: number;
|
|
126
|
+
availableBytes: number;
|
|
127
|
+
totalBytes: number;
|
|
128
|
+
} {
|
|
129
|
+
if (!stats) {
|
|
130
|
+
return { usageBytes: 0, availableBytes: 0, totalBytes: 0 };
|
|
131
|
+
}
|
|
132
|
+
const blockSize = finiteNonNegative(stats.bsize, 0);
|
|
133
|
+
const blocks = finiteNonNegative(stats.blocks, 0);
|
|
134
|
+
const freeBlocks = Math.min(blocks, finiteNonNegative(stats.bfree, 0));
|
|
135
|
+
const availableBlocks = Math.min(blocks, finiteNonNegative(stats.bavail, 0));
|
|
136
|
+
const totalBytes = blocks * blockSize;
|
|
137
|
+
const availableBytes = availableBlocks * blockSize;
|
|
138
|
+
return {
|
|
139
|
+
// `bavail` excludes filesystem-reserved blocks. It is right for admission
|
|
140
|
+
// (what user work can still allocate), but treating the reservation as
|
|
141
|
+
// used makes a fresh Fly worker appear 5–6% full. `bfree` is the actual
|
|
142
|
+
// used-space denominator reported by df.
|
|
143
|
+
usageBytes: Math.max(0, (blocks - freeBlocks) * blockSize),
|
|
144
|
+
availableBytes,
|
|
145
|
+
totalBytes,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Produces container-scoped CPU and memory gauges for one Fly worker process.
|
|
151
|
+
* Fly's guest exposes cgroup v1 memory files and may expose cgroup v2 CPU
|
|
152
|
+
* files. Local development falls back to process RSS and host core count,
|
|
153
|
+
* preserving a useful metric endpoint without pretending local values are
|
|
154
|
+
* container quotas.
|
|
155
|
+
*/
|
|
156
|
+
export function createWorkerResourceMetricsReader(input: {
|
|
157
|
+
readFile: ReadFile;
|
|
158
|
+
now?: () => number;
|
|
159
|
+
cpuCount?: () => number;
|
|
160
|
+
memoryUsage?: () => NodeJS.MemoryUsage;
|
|
161
|
+
statfs?: (path: string) => FileSystemStats;
|
|
162
|
+
}) {
|
|
163
|
+
const now = input.now ?? Date.now;
|
|
164
|
+
const cpuCount = input.cpuCount ?? (() => cpus().length || 1);
|
|
165
|
+
const memoryUsage = input.memoryUsage ?? process.memoryUsage;
|
|
166
|
+
const statfs = input.statfs ?? statfsSync;
|
|
167
|
+
let previousCpu: CpuSample | null = null;
|
|
168
|
+
|
|
169
|
+
const read = (path: string): string | null => {
|
|
170
|
+
try {
|
|
171
|
+
return input.readFile(path, 'utf8');
|
|
172
|
+
} catch {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
return (): WorkerResourceMetrics => {
|
|
178
|
+
const fallbackCpuLimit = Math.max(cpuCount(), 1);
|
|
179
|
+
const cpuQuota = read('/sys/fs/cgroup/cpu/cpu.cfs_quota_us');
|
|
180
|
+
const cpuPeriod = read('/sys/fs/cgroup/cpu/cpu.cfs_period_us');
|
|
181
|
+
const cpuLimitCores = parseCgroupCpuLimit(
|
|
182
|
+
read('/sys/fs/cgroup/cpu.max') ??
|
|
183
|
+
(cpuQuota !== null && cpuPeriod !== null
|
|
184
|
+
? `${cpuQuota} ${cpuPeriod}`
|
|
185
|
+
: 'max'),
|
|
186
|
+
fallbackCpuLimit,
|
|
187
|
+
);
|
|
188
|
+
const sampledAtMs = now();
|
|
189
|
+
const cpuUsageMicroseconds =
|
|
190
|
+
parseCgroupCpuUsageMicroseconds(read('/sys/fs/cgroup/cpu.stat') ?? '') ??
|
|
191
|
+
parseCgroupV1CpuUsageMicroseconds(
|
|
192
|
+
read('/sys/fs/cgroup/cpuacct/cpuacct.usage') ?? '',
|
|
193
|
+
);
|
|
194
|
+
const cpuUtilizationRatio =
|
|
195
|
+
cpuUsageMicroseconds === null || previousCpu === null
|
|
196
|
+
? 0
|
|
197
|
+
: Math.max(
|
|
198
|
+
0,
|
|
199
|
+
Math.min(
|
|
200
|
+
1,
|
|
201
|
+
(cpuUsageMicroseconds - previousCpu.usageMicroseconds) /
|
|
202
|
+
((sampledAtMs - previousCpu.sampledAtMs) *
|
|
203
|
+
1_000 *
|
|
204
|
+
cpuLimitCores),
|
|
205
|
+
),
|
|
206
|
+
);
|
|
207
|
+
if (cpuUsageMicroseconds !== null) {
|
|
208
|
+
previousCpu = { usageMicroseconds: cpuUsageMicroseconds, sampledAtMs };
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const fallbackMemory = memoryUsage().rss;
|
|
212
|
+
const filesystem = (() => {
|
|
213
|
+
try {
|
|
214
|
+
return parseFileSystemStats(statfs('/tmp'));
|
|
215
|
+
} catch {
|
|
216
|
+
return parseFileSystemStats(null);
|
|
217
|
+
}
|
|
218
|
+
})();
|
|
219
|
+
const memoryUsageBytes = parseCgroupLimit(
|
|
220
|
+
read('/sys/fs/cgroup/memory.current') ??
|
|
221
|
+
read('/sys/fs/cgroup/memory/memory.usage_in_bytes') ??
|
|
222
|
+
'',
|
|
223
|
+
fallbackMemory,
|
|
224
|
+
);
|
|
225
|
+
const memoryLimitBytes = parseCgroupLimit(
|
|
226
|
+
read('/sys/fs/cgroup/memory.max') ??
|
|
227
|
+
read('/sys/fs/cgroup/memory/memory.limit_in_bytes') ??
|
|
228
|
+
'',
|
|
229
|
+
fallbackMemory,
|
|
230
|
+
);
|
|
231
|
+
return {
|
|
232
|
+
cpuUtilizationRatio,
|
|
233
|
+
cpuLimitCores,
|
|
234
|
+
memoryUsageBytes,
|
|
235
|
+
memoryLimitBytes,
|
|
236
|
+
memoryUtilizationRatio:
|
|
237
|
+
memoryLimitBytes > 0
|
|
238
|
+
? Math.min(1, memoryUsageBytes / memoryLimitBytes)
|
|
239
|
+
: 0,
|
|
240
|
+
filesystemUsageBytes: filesystem.usageBytes,
|
|
241
|
+
filesystemAvailableBytes: filesystem.availableBytes,
|
|
242
|
+
filesystemTotalBytes: filesystem.totalBytes,
|
|
243
|
+
filesystemUtilizationRatio:
|
|
244
|
+
filesystem.totalBytes > 0
|
|
245
|
+
? Math.min(1, filesystem.usageBytes / filesystem.totalBytes)
|
|
246
|
+
: 0,
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
}
|
|
@@ -40,6 +40,13 @@ export function releasableRuntimeSheetAttemptFenceSql(
|
|
|
40
40
|
)`;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Predicate for durable replay idempotency: matches rows that are already
|
|
45
|
+
* terminal (enriched or failed) from the same attempt owner + epoch. Used to
|
|
46
|
+
* suppress same-version conflicts when a worker restarts and re-runs map rows
|
|
47
|
+
* that it already completed. First terminal state wins; payload/error drift on
|
|
48
|
+
* replay is accepted as a no-op rather than rejected as a conflict.
|
|
49
|
+
*/
|
|
43
50
|
export function sameOwnerTerminalAttemptEpochSql(
|
|
44
51
|
tableAlias: string,
|
|
45
52
|
attemptOwnerRunIdExpression: string,
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import type { PlayStaticSubstep } from '../plays/static-pipeline';
|
|
2
|
+
import {
|
|
3
|
+
normalizePlayDocflowNodeIoState,
|
|
4
|
+
type PlayDocflowNodeIoState,
|
|
5
|
+
} from './/docflow-node-io';
|
|
6
|
+
import type { PlayVisualNodeUsageSnapshot } from './/live-state-contract';
|
|
7
|
+
|
|
8
|
+
export type PlayStepMetricLike = {
|
|
9
|
+
pulse?: boolean;
|
|
10
|
+
tone?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type PlayVisualNodeStatus =
|
|
14
|
+
| 'idle'
|
|
15
|
+
| 'running'
|
|
16
|
+
| 'completed'
|
|
17
|
+
| 'failed'
|
|
18
|
+
| 'skipped';
|
|
19
|
+
|
|
20
|
+
export type PlayVisualNodeProgress = {
|
|
21
|
+
completed?: number;
|
|
22
|
+
total?: number;
|
|
23
|
+
failed?: number;
|
|
24
|
+
startedRows?: number;
|
|
25
|
+
activeRows?: number;
|
|
26
|
+
waitingRows?: number;
|
|
27
|
+
completedRows?: number;
|
|
28
|
+
message?: string;
|
|
29
|
+
updatedAt?: number | null;
|
|
30
|
+
startedAt?: number | null;
|
|
31
|
+
completedAt?: number | null;
|
|
32
|
+
artifactTableNamespace?: string | null;
|
|
33
|
+
nodeIo?: PlayDocflowNodeIoState;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type PlayVisualNodeState = {
|
|
37
|
+
nodeId: string;
|
|
38
|
+
status: PlayVisualNodeStatus;
|
|
39
|
+
artifactTableNamespace?: string | null;
|
|
40
|
+
progress?: PlayVisualNodeProgress | null;
|
|
41
|
+
startedAt?: number | null;
|
|
42
|
+
completedAt?: number | null;
|
|
43
|
+
updatedAt?: number | null;
|
|
44
|
+
nodeIo?: PlayDocflowNodeIoState;
|
|
45
|
+
/** Observed provider usage for this node (ADR 0018). */
|
|
46
|
+
usage?: PlayVisualNodeUsageSnapshot;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type PlayVisualNodeProgressMap = Record<string, PlayVisualNodeProgress>;
|
|
50
|
+
|
|
51
|
+
export function getStaticSubstepNodeId(
|
|
52
|
+
substep: PlayStaticSubstep,
|
|
53
|
+
index: number,
|
|
54
|
+
): string {
|
|
55
|
+
switch (substep.type) {
|
|
56
|
+
case 'csv':
|
|
57
|
+
return `csv:${substep.field || index}`;
|
|
58
|
+
case 'dataset':
|
|
59
|
+
return `map:${substep.tableNamespace ?? substep.field}`;
|
|
60
|
+
case 'tool':
|
|
61
|
+
return `tool:${substep.field}:${substep.toolId}`;
|
|
62
|
+
case 'waterfall':
|
|
63
|
+
return `waterfall:${substep.id ?? substep.field}`;
|
|
64
|
+
case 'step_suite':
|
|
65
|
+
return `step_suite:${substep.field}`;
|
|
66
|
+
case 'control_flow':
|
|
67
|
+
return `control_flow:${substep.kind}:${substep.field}`;
|
|
68
|
+
case 'play_call':
|
|
69
|
+
return `play_call:${substep.field}:${substep.playId}`;
|
|
70
|
+
case 'play_launch':
|
|
71
|
+
return `play_launch:${substep.field}:${substep.playId}`;
|
|
72
|
+
case 'run_javascript':
|
|
73
|
+
return `run_javascript:${substep.alias}`;
|
|
74
|
+
case 'code':
|
|
75
|
+
return `code:${substep.field || index}`;
|
|
76
|
+
default:
|
|
77
|
+
return `node:${index}`;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
82
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function normalizePlayVisualNodeProgressMap(
|
|
86
|
+
value: unknown,
|
|
87
|
+
): PlayVisualNodeProgressMap {
|
|
88
|
+
if (!isRecord(value)) {
|
|
89
|
+
return {};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const normalized: PlayVisualNodeProgressMap = {};
|
|
93
|
+
for (const [nodeId, rawProgress] of Object.entries(value)) {
|
|
94
|
+
if (!nodeId.trim() || !isRecord(rawProgress)) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const completed =
|
|
98
|
+
typeof rawProgress.completed === 'number' &&
|
|
99
|
+
Number.isFinite(rawProgress.completed)
|
|
100
|
+
? rawProgress.completed
|
|
101
|
+
: undefined;
|
|
102
|
+
const total =
|
|
103
|
+
typeof rawProgress.total === 'number' &&
|
|
104
|
+
Number.isFinite(rawProgress.total)
|
|
105
|
+
? rawProgress.total
|
|
106
|
+
: undefined;
|
|
107
|
+
const failed =
|
|
108
|
+
typeof rawProgress.failed === 'number' &&
|
|
109
|
+
Number.isFinite(rawProgress.failed)
|
|
110
|
+
? rawProgress.failed
|
|
111
|
+
: undefined;
|
|
112
|
+
const startedRows =
|
|
113
|
+
typeof rawProgress.startedRows === 'number' &&
|
|
114
|
+
Number.isFinite(rawProgress.startedRows)
|
|
115
|
+
? rawProgress.startedRows
|
|
116
|
+
: undefined;
|
|
117
|
+
const activeRows =
|
|
118
|
+
typeof rawProgress.activeRows === 'number' &&
|
|
119
|
+
Number.isFinite(rawProgress.activeRows)
|
|
120
|
+
? rawProgress.activeRows
|
|
121
|
+
: undefined;
|
|
122
|
+
const waitingRows =
|
|
123
|
+
typeof rawProgress.waitingRows === 'number' &&
|
|
124
|
+
Number.isFinite(rawProgress.waitingRows)
|
|
125
|
+
? rawProgress.waitingRows
|
|
126
|
+
: undefined;
|
|
127
|
+
const completedRows =
|
|
128
|
+
typeof rawProgress.completedRows === 'number' &&
|
|
129
|
+
Number.isFinite(rawProgress.completedRows)
|
|
130
|
+
? rawProgress.completedRows
|
|
131
|
+
: undefined;
|
|
132
|
+
const updatedAt =
|
|
133
|
+
typeof rawProgress.updatedAt === 'number' &&
|
|
134
|
+
Number.isFinite(rawProgress.updatedAt)
|
|
135
|
+
? rawProgress.updatedAt
|
|
136
|
+
: undefined;
|
|
137
|
+
const startedAt =
|
|
138
|
+
typeof rawProgress.startedAt === 'number' &&
|
|
139
|
+
Number.isFinite(rawProgress.startedAt)
|
|
140
|
+
? rawProgress.startedAt
|
|
141
|
+
: undefined;
|
|
142
|
+
const completedAt =
|
|
143
|
+
typeof rawProgress.completedAt === 'number' &&
|
|
144
|
+
Number.isFinite(rawProgress.completedAt)
|
|
145
|
+
? rawProgress.completedAt
|
|
146
|
+
: undefined;
|
|
147
|
+
const message =
|
|
148
|
+
typeof rawProgress.message === 'string' && rawProgress.message.trim()
|
|
149
|
+
? rawProgress.message.trim()
|
|
150
|
+
: undefined;
|
|
151
|
+
const artifactTableNamespace =
|
|
152
|
+
typeof rawProgress.artifactTableNamespace === 'string' &&
|
|
153
|
+
rawProgress.artifactTableNamespace.trim()
|
|
154
|
+
? rawProgress.artifactTableNamespace.trim()
|
|
155
|
+
: rawProgress.artifactTableNamespace === null
|
|
156
|
+
? null
|
|
157
|
+
: undefined;
|
|
158
|
+
const nodeIo = normalizePlayDocflowNodeIoState(rawProgress.nodeIo);
|
|
159
|
+
|
|
160
|
+
normalized[nodeId] = {
|
|
161
|
+
...(completed !== undefined ? { completed } : {}),
|
|
162
|
+
...(total !== undefined ? { total } : {}),
|
|
163
|
+
...(failed !== undefined ? { failed } : {}),
|
|
164
|
+
...(startedRows !== undefined ? { startedRows } : {}),
|
|
165
|
+
...(activeRows !== undefined ? { activeRows } : {}),
|
|
166
|
+
...(waitingRows !== undefined ? { waitingRows } : {}),
|
|
167
|
+
...(completedRows !== undefined ? { completedRows } : {}),
|
|
168
|
+
...(updatedAt !== undefined ? { updatedAt } : {}),
|
|
169
|
+
...(startedAt !== undefined ? { startedAt } : {}),
|
|
170
|
+
...(completedAt !== undefined ? { completedAt } : {}),
|
|
171
|
+
...(message !== undefined ? { message } : {}),
|
|
172
|
+
...(artifactTableNamespace !== undefined
|
|
173
|
+
? { artifactTableNamespace }
|
|
174
|
+
: {}),
|
|
175
|
+
...(nodeIo ? { nodeIo } : {}),
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
return normalized;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export function applyVisualNodeProgress(input: {
|
|
182
|
+
nodeStates: readonly PlayVisualNodeState[];
|
|
183
|
+
progressByNode: PlayVisualNodeProgressMap;
|
|
184
|
+
}): PlayVisualNodeState[] {
|
|
185
|
+
const activeProgressIndex = input.nodeStates.findIndex((nodeState) => {
|
|
186
|
+
const progress = input.progressByNode[nodeState.nodeId];
|
|
187
|
+
if (!progress) {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
const completed = Number(progress.completed ?? 0);
|
|
191
|
+
const total = Number(progress.total ?? 0);
|
|
192
|
+
return (
|
|
193
|
+
Number.isFinite(total) &&
|
|
194
|
+
total > 0 &&
|
|
195
|
+
Number.isFinite(completed) &&
|
|
196
|
+
completed < total
|
|
197
|
+
);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
return input.nodeStates.map((nodeState, index) => {
|
|
201
|
+
const progress = input.progressByNode[nodeState.nodeId] ?? null;
|
|
202
|
+
if (
|
|
203
|
+
!progress &&
|
|
204
|
+
activeProgressIndex >= 0 &&
|
|
205
|
+
index > activeProgressIndex &&
|
|
206
|
+
nodeState.status === 'running'
|
|
207
|
+
) {
|
|
208
|
+
return {
|
|
209
|
+
...nodeState,
|
|
210
|
+
status: 'idle',
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
if (!progress) {
|
|
214
|
+
return nodeState;
|
|
215
|
+
}
|
|
216
|
+
const completed = Number(progress.completed ?? 0);
|
|
217
|
+
const total = Number(progress.total ?? 0);
|
|
218
|
+
const progressStatus =
|
|
219
|
+
nodeState.status === 'failed'
|
|
220
|
+
? 'failed'
|
|
221
|
+
: Number.isFinite(total) && total > 0
|
|
222
|
+
? Number.isFinite(completed) && completed >= total
|
|
223
|
+
? 'completed'
|
|
224
|
+
: 'running'
|
|
225
|
+
: progress.completedAt
|
|
226
|
+
? 'completed'
|
|
227
|
+
: nodeState.status;
|
|
228
|
+
return {
|
|
229
|
+
...nodeState,
|
|
230
|
+
status: progressStatus,
|
|
231
|
+
artifactTableNamespace:
|
|
232
|
+
nodeState.artifactTableNamespace ??
|
|
233
|
+
progress.artifactTableNamespace ??
|
|
234
|
+
null,
|
|
235
|
+
startedAt: nodeState.startedAt ?? progress.startedAt ?? null,
|
|
236
|
+
completedAt: nodeState.completedAt ?? progress.completedAt ?? null,
|
|
237
|
+
progress,
|
|
238
|
+
};
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export function findActiveStepMetricIndex(
|
|
243
|
+
metrics: readonly (PlayStepMetricLike | null | undefined)[],
|
|
244
|
+
): number | null {
|
|
245
|
+
const runningIndex = metrics.findIndex(
|
|
246
|
+
(metric) => metric?.pulse || metric?.tone === 'running',
|
|
247
|
+
);
|
|
248
|
+
if (runningIndex >= 0) {
|
|
249
|
+
return runningIndex;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const waitingIndex = metrics.findIndex(
|
|
253
|
+
(metric) => metric?.tone === 'waiting',
|
|
254
|
+
);
|
|
255
|
+
return waitingIndex >= 0 ? waitingIndex : null;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export function resolveSubstepSequenceStatus(input: {
|
|
259
|
+
substeps: readonly PlayStaticSubstep[];
|
|
260
|
+
substep: PlayStaticSubstep;
|
|
261
|
+
nodeStates?: readonly PlayVisualNodeState[];
|
|
262
|
+
liveStatus?: string;
|
|
263
|
+
}): string | undefined {
|
|
264
|
+
const nodeId = getStaticSubstepNodeId(
|
|
265
|
+
input.substep,
|
|
266
|
+
input.substeps.indexOf(input.substep),
|
|
267
|
+
);
|
|
268
|
+
const derivedStatus = input.nodeStates?.find(
|
|
269
|
+
(candidate) => candidate.nodeId === nodeId,
|
|
270
|
+
)?.status;
|
|
271
|
+
if (derivedStatus) {
|
|
272
|
+
if (derivedStatus === 'idle') {
|
|
273
|
+
return undefined;
|
|
274
|
+
}
|
|
275
|
+
return derivedStatus;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const normalizedLiveStatus = input.liveStatus?.toLowerCase();
|
|
279
|
+
if (!normalizedLiveStatus) {
|
|
280
|
+
return undefined;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
if (
|
|
284
|
+
normalizedLiveStatus === 'completed' ||
|
|
285
|
+
normalizedLiveStatus === 'failed' ||
|
|
286
|
+
normalizedLiveStatus === 'cancelled' ||
|
|
287
|
+
normalizedLiveStatus === 'terminated'
|
|
288
|
+
) {
|
|
289
|
+
return normalizedLiveStatus;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (normalizedLiveStatus !== 'running') {
|
|
293
|
+
return normalizedLiveStatus;
|
|
294
|
+
}
|
|
295
|
+
return 'running';
|
|
296
|
+
}
|
|
@@ -35,7 +35,7 @@ export type NativeBatchToolCallInput = {
|
|
|
35
35
|
*/
|
|
36
36
|
buildPhysicalCall(input: {
|
|
37
37
|
members: NativeBatchOwnedToolCallMember[];
|
|
38
|
-
}): ToolCallInput
|
|
38
|
+
}): ToolCallInput | Promise<ToolCallInput>;
|
|
39
39
|
/**
|
|
40
40
|
* Decodes one aggregate provider result into exactly one result for every
|
|
41
41
|
* owned receipt. The Module validates the correspondence before publishing
|
|
@@ -88,9 +88,9 @@ export function createNativeBatchToolCallJob(dependencies: {
|
|
|
88
88
|
const executeOwned = async (): Promise<void> => {
|
|
89
89
|
const owned = ownedMembers(cohort, input.members);
|
|
90
90
|
if (owned.length === 0) return;
|
|
91
|
-
const physical = input.buildPhysicalCall({ members: owned });
|
|
92
|
-
validatePhysicalCall(physical, input.owner);
|
|
93
91
|
try {
|
|
92
|
+
const physical = await input.buildPhysicalCall({ members: owned });
|
|
93
|
+
validatePhysicalCall(physical, input.owner);
|
|
94
94
|
const aggregate = await dependencies.physicalToolCall.call(physical);
|
|
95
95
|
const split = await input.splitResult({
|
|
96
96
|
result: aggregate,
|
package/dist/bundling-sources/shared_libs/play-runtime/tool-call/runtime-step-receipts-adapter.ts
CHANGED
|
@@ -81,6 +81,15 @@ export type RuntimeStepToolResultReceiptsInput = {
|
|
|
81
81
|
resultReceiptKey: string;
|
|
82
82
|
source: ToolCallReceiptRecoverySource | 'owner';
|
|
83
83
|
}) => ToolExecuteResult;
|
|
84
|
+
/**
|
|
85
|
+
* Best-effort observer after a canonical completed result converges. The
|
|
86
|
+
* adapter keeps receipt semantics; callers can use this to record a compact
|
|
87
|
+
* source-run replay pointer without another provider operation.
|
|
88
|
+
*/
|
|
89
|
+
onStored?: (input: {
|
|
90
|
+
result: ToolExecuteResult;
|
|
91
|
+
resultReceiptKey: string;
|
|
92
|
+
}) => void | Promise<void>;
|
|
84
93
|
/** Injectable only for deterministic adapter conformance tests. */
|
|
85
94
|
sleep?: (milliseconds: number) => Promise<void>;
|
|
86
95
|
};
|
|
@@ -433,6 +442,10 @@ export function createRuntimeStepToolResultReceipts(
|
|
|
433
442
|
? null
|
|
434
443
|
: completedResult(persisted, record.resultReceiptKey);
|
|
435
444
|
if (result) {
|
|
445
|
+
await input.onStored?.({
|
|
446
|
+
result,
|
|
447
|
+
resultReceiptKey: record.resultReceiptKey,
|
|
448
|
+
});
|
|
436
449
|
return {
|
|
437
450
|
// The legacy storage operation returns the converged completed row
|
|
438
451
|
// for both an insert and a concurrent winner. The exact distinction
|
|
@@ -443,7 +456,13 @@ export function createRuntimeStepToolResultReceipts(
|
|
|
443
456
|
};
|
|
444
457
|
}
|
|
445
458
|
const converged = await readCompleted(record.resultReceiptKey, 'owner');
|
|
446
|
-
if (converged)
|
|
459
|
+
if (converged) {
|
|
460
|
+
await input.onStored?.({
|
|
461
|
+
result: converged,
|
|
462
|
+
resultReceiptKey: record.resultReceiptKey,
|
|
463
|
+
});
|
|
464
|
+
return { kind: 'existing', result: converged };
|
|
465
|
+
}
|
|
447
466
|
throw new Error(
|
|
448
467
|
`Tool Result Receipt ${record.resultReceiptKey} could not publish a completed result.`,
|
|
449
468
|
);
|