deepline 0.3.88 → 0.3.90
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 +652 -39
- package/dist/bundling-sources/sdk/src/config.ts +77 -0
- package/dist/bundling-sources/sdk/src/http.ts +76 -30
- package/dist/bundling-sources/sdk/src/index.ts +10 -0
- package/dist/bundling-sources/sdk/src/monitor-fleet-contract.ts +1 -1
- package/dist/bundling-sources/sdk/src/pagination.ts +25 -0
- package/dist/bundling-sources/sdk/src/play.ts +15 -1
- package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +3 -3
- package/dist/bundling-sources/sdk/src/release.ts +16 -9
- package/dist/bundling-sources/sdk/src/types.ts +106 -4
- package/dist/bundling-sources/shared_libs/integration-contracts/AGENTS.md +9 -0
- package/dist/bundling-sources/shared_libs/integration-contracts/README.md +3 -0
- package/dist/bundling-sources/shared_libs/integration-contracts/index.ts +2 -0
- package/dist/bundling-sources/shared_libs/monitors/analytics-install-guides.ts +77 -0
- package/dist/bundling-sources/shared_libs/monitors/analytics-public.ts +10 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/charges.ts +125 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/policy-builders.ts +686 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/pricing.ts +54 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/public-pricing.ts +72 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/session.ts +45 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/state.ts +454 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/tamradar.ts +260 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/types.ts +215 -0
- package/dist/bundling-sources/shared_libs/monitors/callback-security.ts +333 -0
- package/dist/bundling-sources/shared_libs/monitors/cursor-page.ts +42 -0
- package/dist/bundling-sources/shared_libs/monitors/deactivation-reasons.ts +16 -0
- package/dist/bundling-sources/shared_libs/monitors/framework-managed-payload-fields.ts +71 -0
- package/dist/bundling-sources/shared_libs/monitors/generated/provider-monitor-callback-admission-targets.ts +16 -0
- package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +270 -0
- package/dist/bundling-sources/shared_libs/monitors/inbound-publish-key.ts +39 -0
- package/dist/bundling-sources/shared_libs/monitors/inbound-queue.ts +82 -0
- package/dist/bundling-sources/shared_libs/monitors/inventory-reconciliation.ts +59 -0
- package/dist/bundling-sources/shared_libs/monitors/lifecycle-notifications.ts +471 -0
- package/dist/bundling-sources/shared_libs/monitors/org-monitor-limits.ts +1 -1
- package/dist/bundling-sources/shared_libs/monitors/package.json +36 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-callback-verification.ts +1125 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +305 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-capability.ts +964 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-consumer-health.ts +56 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-errors.ts +131 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts +535 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-legacy-aliases.ts +16 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-priority-execution.ts +56 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-public-aliases.ts +28 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-runtime-read-eligibility.ts +38 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-state.ts +122 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-status.ts +10 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +112 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-webhook-monitor-runtime.ts +300 -0
- package/dist/bundling-sources/shared_libs/monitors/quickstart-prompts.ts +22 -0
- 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 +93 -0
- package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +332 -0
- package/dist/bundling-sources/shared_libs/monitors/snitcher-radar.ts +221 -0
- package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +105 -0
- package/dist/bundling-sources/shared_libs/monitors/tracking-provider-guidance.ts +73 -0
- package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +81 -0
- package/dist/bundling-sources/shared_libs/monitors/tsconfig.json +10 -0
- 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 +654 -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/activity-observation.ts +6 -11
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +135 -12
- 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 +77 -0
- package/dist/bundling-sources/shared_libs/play-runtime/bounceban-batching.ts +137 -0
- package/dist/bundling-sources/shared_libs/play-runtime/checkpoint-boundaries.ts +70 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +1159 -166
- package/dist/bundling-sources/shared_libs/play-runtime/coordinator-headers.ts +1 -32
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +103 -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/default-batch-strategies.ts +20 -1
- 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 +29 -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 +7 -1
- 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/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 +189 -0
- 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/play-runtime-semantics.ts +28 -0
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +4 -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 +23 -2
- package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +168 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +90 -13
- 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-start-admission.ts +68 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +21 -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 -43
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +67 -213
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +201 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-capacity-policy.ts +20 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-contract.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-env.ts +12 -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 +38 -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 +37 -1
- 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/tool-http-errors.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +1 -1
- 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/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 +8 -3
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +454 -17
- package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +19 -4
- package/dist/bundling-sources/shared_libs/plays/contracts.ts +8 -14
- package/dist/bundling-sources/shared_libs/plays/core.ts +11 -6
- package/dist/bundling-sources/shared_libs/plays/deployment-status.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/docflow-binding-owner.ts +16 -11
- package/dist/bundling-sources/shared_libs/plays/docflow.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/email-status.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/play-grep-search.ts +39 -0
- package/dist/bundling-sources/shared_libs/plays/resolve-static-pipeline.ts +1 -1
- 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/slack-hitl-timeout-error.ts +37 -0
- package/dist/bundling-sources/shared_libs/plays/slug.ts +115 -0
- package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +50 -15
- package/dist/bundling-sources/shared_libs/plays/tool-category-descriptions.ts +2 -2
- package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +1 -1
- package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +877 -0
- package/dist/bundling-sources/shared_libs/product-notifications/configuration-draft.ts +456 -0
- package/dist/bundling-sources/shared_libs/product-notifications/configuration.ts +566 -0
- package/dist/bundling-sources/shared_libs/product-notifications/content.ts +28 -0
- package/dist/bundling-sources/shared_libs/product-notifications/default-policy.ts +60 -0
- package/dist/bundling-sources/shared_libs/product-notifications/email.ts +246 -0
- package/dist/bundling-sources/shared_libs/product-notifications/evaluation.ts +280 -0
- package/dist/bundling-sources/shared_libs/product-notifications/events.ts +433 -0
- package/dist/bundling-sources/shared_libs/product-notifications/legacy-slack.ts +80 -0
- 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/product-notifications/workspace.ts +38 -0
- package/dist/bundling-sources/shared_libs/runtime-env.ts +12 -0
- package/dist/bundling-sources/shared_libs/security/email-blacklist.ts +42 -0
- package/dist/bundling-sources/shared_libs/security/header-safe-env.ts +35 -0
- package/dist/bundling-sources/shared_libs/security/internal-actor.ts +50 -0
- package/dist/bundling-sources/shared_libs/security/secret-redaction.ts +267 -0
- 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 +1611 -453
- package/dist/cli/index.mjs +1596 -447
- package/dist/{compiler-manifest-Dbov16F7.d.mts → compiler-manifest-BaJfE-5H.d.mts} +136 -10
- package/dist/{compiler-manifest-Dbov16F7.d.ts → compiler-manifest-BaJfE-5H.d.ts} +136 -10
- package/dist/index.d.mts +910 -155
- package/dist/index.d.ts +910 -155
- package/dist/index.js +550 -64
- package/dist/index.mjs +550 -64
- package/dist/install-integrity.json +193 -4
- package/dist/monitor-fleet-contract.d.mts +138 -0
- package/dist/monitor-fleet-contract.d.ts +138 -0
- package/dist/monitor-fleet-contract.js +404 -0
- package/dist/monitor-fleet-contract.mjs +367 -0
- package/dist/plays/bundle-play-file.d.mts +8 -3
- package/dist/plays/bundle-play-file.d.ts +8 -3
- package/dist/plays/bundle-play-file.mjs +100 -20
- package/dist/release.d.mts +255 -0
- package/dist/release.d.ts +255 -0
- package/dist/release.js +215 -0
- package/dist/release.mjs +188 -0
- package/package.json +23 -4
- /package/dist/bundling-sources/shared_libs/{integrations/bettercontact-execution-policy.ts → integration-contracts/bettercontact/execution-policy.ts} +0 -0
- /package/dist/bundling-sources/shared_libs/{integrations/theirstack-execution-policy.ts → integration-contracts/theirstack/execution-policy.ts} +0 -0
|
@@ -0,0 +1,658 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package-owned helpers that distill a compiled static pipeline into a
|
|
3
|
+
* small, public-safe summary. No source, params, or secrets cross this layer.
|
|
4
|
+
*/
|
|
5
|
+
// This Module is bundled by Convex through its workspace dependency graph.
|
|
6
|
+
import {
|
|
7
|
+
deriveStaticPipelineEntryInputFields,
|
|
8
|
+
flattenStaticPipeline,
|
|
9
|
+
getTopLevelPipelineSubsteps,
|
|
10
|
+
type PlayStaticPipeline,
|
|
11
|
+
type PlayStaticSubstep,
|
|
12
|
+
} from '../static-pipeline';
|
|
13
|
+
import type {
|
|
14
|
+
PlayCostBasis,
|
|
15
|
+
PlaySharePreviewNode,
|
|
16
|
+
PlaySharePreviewStep,
|
|
17
|
+
PlayShareSchemaShape,
|
|
18
|
+
PlayShareStaticPipelineSummary,
|
|
19
|
+
} from './types';
|
|
20
|
+
|
|
21
|
+
const MAX_PREVIEW_NODES = 12;
|
|
22
|
+
const MAX_SCHEMA_FIELDS = 24;
|
|
23
|
+
const PROVIDER_DISPLAY_NAMES: Readonly<Record<string, string>> = {
|
|
24
|
+
harvestapi: 'HarvestAPI',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
function asPipeline(staticPipeline: unknown): PlayStaticPipeline | null {
|
|
28
|
+
if (!staticPipeline || typeof staticPipeline !== 'object') {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return staticPipeline as PlayStaticPipeline;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Derive a friendly provider name from a tool id like `apollo_people_search`.
|
|
36
|
+
* Provider NAMES are safe to expose; provider SPEND is not (and never touches
|
|
37
|
+
* this module).
|
|
38
|
+
*/
|
|
39
|
+
export function providerNameFromToolId(toolId: string): string | null {
|
|
40
|
+
const trimmed = toolId.trim();
|
|
41
|
+
if (!trimmed) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const head = trimmed.split(/[_/.]/)[0];
|
|
45
|
+
if (!head) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const canonicalName = PROVIDER_DISPLAY_NAMES[head.toLowerCase()];
|
|
49
|
+
if (canonicalName) {
|
|
50
|
+
return canonicalName;
|
|
51
|
+
}
|
|
52
|
+
return head
|
|
53
|
+
.split('-')
|
|
54
|
+
.filter(Boolean)
|
|
55
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
56
|
+
.join(' ');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function providerForSubstep(substep: PlayStaticSubstep): string | null {
|
|
60
|
+
if (substep.type === 'tool') {
|
|
61
|
+
return providerNameFromToolId(substep.toolId);
|
|
62
|
+
}
|
|
63
|
+
if (substep.type === 'waterfall') {
|
|
64
|
+
const fromSteps = (substep.steps ?? [])
|
|
65
|
+
.map((step) => (step.toolId ? providerNameFromToolId(step.toolId) : null))
|
|
66
|
+
.find((name): name is string => Boolean(name));
|
|
67
|
+
if (fromSteps) {
|
|
68
|
+
return fromSteps;
|
|
69
|
+
}
|
|
70
|
+
return substep.tool ? providerNameFromToolId(substep.tool) : null;
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Auto-generated transform names like `lines_390_390` carry no meaning publicly. */
|
|
76
|
+
function isAutoLineAlias(name: string | undefined): boolean {
|
|
77
|
+
return !name || /^lines?_\d+(?:_\d+)?$/i.test(name.trim());
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function isAutoLineDescription(description: string | undefined): boolean {
|
|
81
|
+
return /^Lines? \d+(?:-\d+)?$/i.test(description?.trim() ?? '');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function isAnonymousRunJavascript(substep: PlayStaticSubstep): boolean {
|
|
85
|
+
return (
|
|
86
|
+
substep.type === 'run_javascript' &&
|
|
87
|
+
isAutoLineAlias(substep.alias) &&
|
|
88
|
+
(!substep.description || isAutoLineDescription(substep.description))
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function publicSubstepKey(substep: PlayStaticSubstep): string {
|
|
93
|
+
switch (substep.type) {
|
|
94
|
+
case 'csv':
|
|
95
|
+
return `csv:${substep.field}:${substep.path ?? ''}`;
|
|
96
|
+
case 'dataset':
|
|
97
|
+
return `dataset:${substep.tableNamespace ?? substep.field}`;
|
|
98
|
+
case 'run_javascript':
|
|
99
|
+
return `run_javascript:${substep.alias}`;
|
|
100
|
+
case 'control_flow':
|
|
101
|
+
return `control_flow:${substep.kind}:${substep.field}`;
|
|
102
|
+
case 'tool':
|
|
103
|
+
return `tool:${substep.toolId}:${substep.field}`;
|
|
104
|
+
case 'waterfall':
|
|
105
|
+
return `waterfall:${substep.id ?? substep.tool ?? substep.field}`;
|
|
106
|
+
case 'step_suite':
|
|
107
|
+
return `step_suite:${substep.field}`;
|
|
108
|
+
case 'play_call':
|
|
109
|
+
return `play_call:${substep.playId}:${substep.field}`;
|
|
110
|
+
case 'play_launch':
|
|
111
|
+
return `play_launch:${substep.playId}:${substep.field}`;
|
|
112
|
+
case 'code':
|
|
113
|
+
return `code:${substep.field}`;
|
|
114
|
+
default:
|
|
115
|
+
return JSON.stringify(substep);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function dedupePublicSubsteps(
|
|
120
|
+
substeps: PlayStaticSubstep[],
|
|
121
|
+
): PlayStaticSubstep[] {
|
|
122
|
+
const seen = new Set<string>();
|
|
123
|
+
const out: PlayStaticSubstep[] = [];
|
|
124
|
+
for (const substep of substeps) {
|
|
125
|
+
const key = publicSubstepKey(substep);
|
|
126
|
+
if (seen.has(key)) continue;
|
|
127
|
+
seen.add(key);
|
|
128
|
+
out.push(substep);
|
|
129
|
+
}
|
|
130
|
+
return out;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function projectPublicTopLevelSubstep(
|
|
134
|
+
substep: PlayStaticSubstep,
|
|
135
|
+
): PlayStaticSubstep[] {
|
|
136
|
+
if (isAnonymousRunJavascript(substep)) {
|
|
137
|
+
return [];
|
|
138
|
+
}
|
|
139
|
+
if (substep.type !== 'control_flow') {
|
|
140
|
+
return [substep];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const projectedNested = dedupePublicSubsteps(
|
|
144
|
+
substep.steps.flatMap(projectPublicTopLevelSubstep),
|
|
145
|
+
);
|
|
146
|
+
const unwrapsToInputOnly =
|
|
147
|
+
substep.kind === 'conditional' &&
|
|
148
|
+
projectedNested.length > 0 &&
|
|
149
|
+
projectedNested.every((nested) => nested.type === 'csv');
|
|
150
|
+
|
|
151
|
+
return unwrapsToInputOnly ? projectedNested : [substep];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function getPublicTopLevelPipelineSubsteps(
|
|
155
|
+
pipeline: PlayStaticPipeline,
|
|
156
|
+
): PlayStaticSubstep[] {
|
|
157
|
+
const topLevel = dedupePublicSubsteps(
|
|
158
|
+
getTopLevelPipelineSubsteps(pipeline).flatMap(projectPublicTopLevelSubstep),
|
|
159
|
+
);
|
|
160
|
+
const hasStructuredPublicStep = topLevel.some(
|
|
161
|
+
(substep) => substep.type !== 'run_javascript',
|
|
162
|
+
);
|
|
163
|
+
return hasStructuredPublicStep
|
|
164
|
+
? topLevel.filter((substep) => substep.type !== 'run_javascript')
|
|
165
|
+
: topLevel;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** Tool ids reachable inside a step suite (recursing nested suites/waterfalls). */
|
|
169
|
+
function stepSuiteToolIds(
|
|
170
|
+
substep: Extract<PlayStaticSubstep, { type: 'step_suite' }>,
|
|
171
|
+
): string[] {
|
|
172
|
+
return substep.steps.flatMap((step) => {
|
|
173
|
+
if (step.type === 'tool') return [step.toolId];
|
|
174
|
+
if (step.type === 'step_suite') return stepSuiteToolIds(step);
|
|
175
|
+
if (step.type === 'control_flow') {
|
|
176
|
+
return step.steps.flatMap((nested) =>
|
|
177
|
+
nested.type === 'tool'
|
|
178
|
+
? [nested.toolId]
|
|
179
|
+
: nested.type === 'step_suite'
|
|
180
|
+
? stepSuiteToolIds(nested)
|
|
181
|
+
: [],
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
if (step.type === 'waterfall') {
|
|
185
|
+
return (step.steps ?? [])
|
|
186
|
+
.map((waterfallStep) => waterfallStep.toolId)
|
|
187
|
+
.filter((toolId): toolId is string => Boolean(toolId));
|
|
188
|
+
}
|
|
189
|
+
return [];
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Executable steps a substep represents. A step suite (e.g. an email waterfall
|
|
195
|
+
* built with `steps().step(...).step(...)`) expands to its inner steps so a
|
|
196
|
+
* 16-provider waterfall doesn't read as a single "step".
|
|
197
|
+
*/
|
|
198
|
+
function effectiveStepCount(substep: PlayStaticSubstep): number {
|
|
199
|
+
if (substep.type === 'dataset' && substep.steps?.length) {
|
|
200
|
+
const inner = substep.steps.reduce(
|
|
201
|
+
(total, step) => total + effectiveStepCount(step),
|
|
202
|
+
0,
|
|
203
|
+
);
|
|
204
|
+
return inner > 0 ? inner : 1;
|
|
205
|
+
}
|
|
206
|
+
if (substep.type === 'step_suite') {
|
|
207
|
+
const inner = substep.steps.reduce(
|
|
208
|
+
(total, step) => total + effectiveStepCount(step),
|
|
209
|
+
0,
|
|
210
|
+
);
|
|
211
|
+
return inner > 0 ? inner : 1;
|
|
212
|
+
}
|
|
213
|
+
if (substep.type === 'control_flow') {
|
|
214
|
+
const inner = substep.steps.reduce(
|
|
215
|
+
(total, step) => total + effectiveStepCount(step),
|
|
216
|
+
0,
|
|
217
|
+
);
|
|
218
|
+
return inner > 0 ? inner : 1;
|
|
219
|
+
}
|
|
220
|
+
return 1;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** Every distinct provider a substep touches, including all waterfall steps. */
|
|
224
|
+
function allProvidersForSubstep(substep: PlayStaticSubstep): string[] {
|
|
225
|
+
if (substep.type === 'tool') {
|
|
226
|
+
const name = providerNameFromToolId(substep.toolId);
|
|
227
|
+
return name ? [name] : [];
|
|
228
|
+
}
|
|
229
|
+
if (substep.type === 'waterfall') {
|
|
230
|
+
const names = (substep.steps ?? [])
|
|
231
|
+
.map((step) => (step.toolId ? providerNameFromToolId(step.toolId) : null))
|
|
232
|
+
.filter((name): name is string => Boolean(name));
|
|
233
|
+
if (names.length > 0) {
|
|
234
|
+
return names;
|
|
235
|
+
}
|
|
236
|
+
const fallback = substep.tool ? providerNameFromToolId(substep.tool) : null;
|
|
237
|
+
return fallback ? [fallback] : [];
|
|
238
|
+
}
|
|
239
|
+
if (substep.type === 'step_suite') {
|
|
240
|
+
return stepSuiteToolIds(substep)
|
|
241
|
+
.map((toolId) => providerNameFromToolId(toolId))
|
|
242
|
+
.filter((name): name is string => Boolean(name));
|
|
243
|
+
}
|
|
244
|
+
if (substep.type === 'control_flow') {
|
|
245
|
+
return substep.steps.flatMap(allProvidersForSubstep);
|
|
246
|
+
}
|
|
247
|
+
return [];
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function previewLabelFor(substep: PlayStaticSubstep): string {
|
|
251
|
+
switch (substep.type) {
|
|
252
|
+
case 'csv':
|
|
253
|
+
return 'Read input rows';
|
|
254
|
+
case 'dataset':
|
|
255
|
+
return 'Dataset rows';
|
|
256
|
+
case 'tool':
|
|
257
|
+
return providerNameFromToolId(substep.toolId) ?? 'Provider call';
|
|
258
|
+
case 'waterfall':
|
|
259
|
+
return providerForSubstep(substep)
|
|
260
|
+
? `${providerForSubstep(substep)} waterfall`
|
|
261
|
+
: 'Waterfall enrichment';
|
|
262
|
+
case 'step_suite':
|
|
263
|
+
return 'Enrichment waterfall';
|
|
264
|
+
case 'control_flow':
|
|
265
|
+
return substep.kind === 'loop' ? 'Looped code' : 'Conditional code';
|
|
266
|
+
case 'play_call':
|
|
267
|
+
return 'Nested play';
|
|
268
|
+
case 'play_launch':
|
|
269
|
+
return 'Async child play';
|
|
270
|
+
case 'run_javascript':
|
|
271
|
+
return 'Run JavaScript';
|
|
272
|
+
case 'code':
|
|
273
|
+
return 'Transformation';
|
|
274
|
+
default:
|
|
275
|
+
return 'Step';
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const MAX_PREVIEW_STEPS = 8;
|
|
280
|
+
|
|
281
|
+
/** Humanize the action part of a tool id, e.g. `apollo_people_search` -> `people search`. */
|
|
282
|
+
function humanizeToolAction(toolId: string): string {
|
|
283
|
+
const parts = toolId.trim().split(/[_/.]/).filter(Boolean);
|
|
284
|
+
const action = parts.slice(1).join(' ').trim();
|
|
285
|
+
return action || toolId.trim();
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function previewStepsFor(
|
|
289
|
+
substep: PlayStaticSubstep,
|
|
290
|
+
): PlaySharePreviewStep[] | undefined {
|
|
291
|
+
if (substep.type === 'step_suite') {
|
|
292
|
+
const steps = stepSuiteToolIds(substep)
|
|
293
|
+
.slice(0, MAX_PREVIEW_STEPS)
|
|
294
|
+
.map((toolId) => ({
|
|
295
|
+
label: humanizeToolAction(toolId),
|
|
296
|
+
provider: providerNameFromToolId(toolId),
|
|
297
|
+
}));
|
|
298
|
+
return steps.length > 0 ? steps : undefined;
|
|
299
|
+
}
|
|
300
|
+
if (substep.type === 'control_flow') {
|
|
301
|
+
const steps = substep.steps
|
|
302
|
+
.flatMap((step) => previewStepsFor(step) ?? [])
|
|
303
|
+
.slice(0, MAX_PREVIEW_STEPS);
|
|
304
|
+
return steps.length > 0 ? steps : undefined;
|
|
305
|
+
}
|
|
306
|
+
if (substep.type !== 'waterfall' || !substep.steps?.length) {
|
|
307
|
+
return undefined;
|
|
308
|
+
}
|
|
309
|
+
const steps = substep.steps.slice(0, MAX_PREVIEW_STEPS).map((step) => ({
|
|
310
|
+
label: step.toolId ? humanizeToolAction(step.toolId) : 'transform',
|
|
311
|
+
provider: step.toolId ? providerNameFromToolId(step.toolId) : null,
|
|
312
|
+
}));
|
|
313
|
+
return steps.length > 0 ? steps : undefined;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function previewDetailFor(substep: PlayStaticSubstep): string | null {
|
|
317
|
+
switch (substep.type) {
|
|
318
|
+
case 'dataset':
|
|
319
|
+
return substep.inputFields?.length
|
|
320
|
+
? `over ${substep.inputFields.slice(0, 4).join(', ')}`
|
|
321
|
+
: 'one row at a time';
|
|
322
|
+
case 'tool':
|
|
323
|
+
return humanizeToolAction(substep.toolId);
|
|
324
|
+
case 'csv':
|
|
325
|
+
return 'play entry';
|
|
326
|
+
case 'waterfall':
|
|
327
|
+
return substep.steps?.length
|
|
328
|
+
? `${substep.steps.length} fallbacks`
|
|
329
|
+
: 'first match wins';
|
|
330
|
+
case 'step_suite': {
|
|
331
|
+
const count = stepSuiteToolIds(substep).length;
|
|
332
|
+
return count > 0 ? `${count} providers, first match wins` : null;
|
|
333
|
+
}
|
|
334
|
+
case 'control_flow': {
|
|
335
|
+
const count = substep.steps.reduce(
|
|
336
|
+
(total, step) => total + effectiveStepCount(step),
|
|
337
|
+
0,
|
|
338
|
+
);
|
|
339
|
+
return count > 0 ? `${count} nested step${count === 1 ? '' : 's'}` : null;
|
|
340
|
+
}
|
|
341
|
+
case 'code':
|
|
342
|
+
return 'in-play transform';
|
|
343
|
+
case 'run_javascript':
|
|
344
|
+
return 'runs JavaScript';
|
|
345
|
+
default:
|
|
346
|
+
return null;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Compute the bounded static-pipeline summary for the public read model.
|
|
352
|
+
*/
|
|
353
|
+
export function buildStaticPipelineSummary(
|
|
354
|
+
staticPipeline: unknown,
|
|
355
|
+
): PlayShareStaticPipelineSummary {
|
|
356
|
+
const pipeline = asPipeline(staticPipeline);
|
|
357
|
+
if (!pipeline) {
|
|
358
|
+
return { stepCount: 0, providerCount: 0, hasMap: false, previewNodes: [] };
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const topLevel = getPublicTopLevelPipelineSubsteps(pipeline);
|
|
362
|
+
const flattened = flattenStaticPipeline(pipeline);
|
|
363
|
+
|
|
364
|
+
const providers = new Set<string>();
|
|
365
|
+
for (const substep of flattened) {
|
|
366
|
+
for (const provider of allProvidersForSubstep(substep)) {
|
|
367
|
+
providers.add(provider);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
const hasMap =
|
|
372
|
+
topLevel.some((substep) => substep.type === 'dataset') ||
|
|
373
|
+
flattened.some((substep) => substep.type === 'dataset') ||
|
|
374
|
+
Boolean(pipeline.tableNamespace?.trim());
|
|
375
|
+
|
|
376
|
+
const previewNodes: PlaySharePreviewNode[] = topLevel
|
|
377
|
+
.slice(0, MAX_PREVIEW_NODES)
|
|
378
|
+
.map((substep) => ({
|
|
379
|
+
type: substep.type,
|
|
380
|
+
label: previewLabelFor(substep),
|
|
381
|
+
provider: providerForSubstep(substep),
|
|
382
|
+
detail: previewDetailFor(substep),
|
|
383
|
+
steps: previewStepsFor(substep),
|
|
384
|
+
}));
|
|
385
|
+
|
|
386
|
+
return {
|
|
387
|
+
stepCount: topLevel.reduce(
|
|
388
|
+
(total, substep) => total + effectiveStepCount(substep),
|
|
389
|
+
0,
|
|
390
|
+
),
|
|
391
|
+
providerCount: providers.size,
|
|
392
|
+
hasMap,
|
|
393
|
+
previewNodes,
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// Internal-only fields stripped before exposing substeps publicly. The static
|
|
398
|
+
// pipeline is structural (no payloads/secrets), but source locations and raw
|
|
399
|
+
// param sources never need to cross the public boundary.
|
|
400
|
+
const SUBSTEP_STRIP_KEYS = new Set([
|
|
401
|
+
'sourceRange',
|
|
402
|
+
'sourcePath',
|
|
403
|
+
'callPath',
|
|
404
|
+
'callDepth',
|
|
405
|
+
'sourceText',
|
|
406
|
+
'paramsSource',
|
|
407
|
+
'returnSource',
|
|
408
|
+
]);
|
|
409
|
+
// Each conditional level adds the node, branches array, branch object, and
|
|
410
|
+
// steps array. One nested structural level keeps the complete public package
|
|
411
|
+
// below Convex's 16-level return limit. Flat leaf actions at that boundary are
|
|
412
|
+
// still safe to retain because they add no further recursive structure.
|
|
413
|
+
const MAX_PUBLIC_SUBSTEP_DEPTH = 1;
|
|
414
|
+
|
|
415
|
+
function isRecursivePublicSubstep(substep: PlayStaticSubstep): boolean {
|
|
416
|
+
return (
|
|
417
|
+
substep.type === 'dataset' ||
|
|
418
|
+
substep.type === 'step_suite' ||
|
|
419
|
+
substep.type === 'control_flow' ||
|
|
420
|
+
substep.type === 'play_call'
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
function publicSubstepBase(
|
|
425
|
+
substep: PlayStaticSubstep,
|
|
426
|
+
): Record<string, unknown> {
|
|
427
|
+
return Object.fromEntries(
|
|
428
|
+
Object.entries(substep).filter(
|
|
429
|
+
([key]) => !SUBSTEP_STRIP_KEYS.has(key) && key !== 'columns',
|
|
430
|
+
),
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
function projectPublicPipeline(
|
|
435
|
+
pipeline: PlayStaticPipeline,
|
|
436
|
+
depth: number,
|
|
437
|
+
): PlayStaticPipeline {
|
|
438
|
+
return {
|
|
439
|
+
...pipeline,
|
|
440
|
+
stages: (pipeline.stages ?? []).map((substep) =>
|
|
441
|
+
projectPublicSubstep(substep, depth),
|
|
442
|
+
),
|
|
443
|
+
substeps: pipeline.substeps.map((substep) =>
|
|
444
|
+
projectPublicSubstep(substep, depth),
|
|
445
|
+
),
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
function projectPublicSubstep(
|
|
450
|
+
substep: PlayStaticSubstep,
|
|
451
|
+
depth: number,
|
|
452
|
+
): PlayStaticSubstep {
|
|
453
|
+
const base = publicSubstepBase(substep);
|
|
454
|
+
const projectChildren = depth < MAX_PUBLIC_SUBSTEP_DEPTH;
|
|
455
|
+
const child = (value: PlayStaticSubstep) =>
|
|
456
|
+
projectPublicSubstep(value, depth + 1);
|
|
457
|
+
|
|
458
|
+
if (substep.type === 'dataset') {
|
|
459
|
+
return {
|
|
460
|
+
...base,
|
|
461
|
+
type: 'dataset',
|
|
462
|
+
field: substep.field,
|
|
463
|
+
columns: substep.columns?.map((column) => ({
|
|
464
|
+
id: column.id,
|
|
465
|
+
source: column.source,
|
|
466
|
+
...(column.sqlName ? { sqlName: column.sqlName } : {}),
|
|
467
|
+
producers: column.producers.map((producer) => ({
|
|
468
|
+
id: producer.id,
|
|
469
|
+
kind: producer.kind,
|
|
470
|
+
field: producer.field,
|
|
471
|
+
...(producer.toolId ? { toolId: producer.toolId } : {}),
|
|
472
|
+
...(producer.playId ? { playId: producer.playId } : {}),
|
|
473
|
+
...(producer.conditional !== undefined
|
|
474
|
+
? { conditional: producer.conditional }
|
|
475
|
+
: {}),
|
|
476
|
+
substep: projectPublicSubstep(
|
|
477
|
+
producer.substep,
|
|
478
|
+
MAX_PUBLIC_SUBSTEP_DEPTH,
|
|
479
|
+
),
|
|
480
|
+
})),
|
|
481
|
+
})),
|
|
482
|
+
steps: projectChildren ? (substep.steps ?? []).map(child) : [],
|
|
483
|
+
} as PlayStaticSubstep;
|
|
484
|
+
}
|
|
485
|
+
if (substep.type === 'step_suite') {
|
|
486
|
+
return {
|
|
487
|
+
...base,
|
|
488
|
+
type: 'step_suite',
|
|
489
|
+
field: substep.field,
|
|
490
|
+
steps: projectChildren ? substep.steps.map(child) : [],
|
|
491
|
+
} as PlayStaticSubstep;
|
|
492
|
+
}
|
|
493
|
+
if (substep.type === 'control_flow') {
|
|
494
|
+
const retainedSteps = projectChildren
|
|
495
|
+
? substep.steps
|
|
496
|
+
: substep.steps.filter((value) => !isRecursivePublicSubstep(value));
|
|
497
|
+
return {
|
|
498
|
+
...base,
|
|
499
|
+
type: 'control_flow',
|
|
500
|
+
kind: substep.kind,
|
|
501
|
+
field: substep.field,
|
|
502
|
+
steps: retainedSteps.map(child),
|
|
503
|
+
branches: projectChildren
|
|
504
|
+
? substep.branches?.map((branch) => ({
|
|
505
|
+
label: branch.label,
|
|
506
|
+
...(branch.condition ? { condition: branch.condition } : {}),
|
|
507
|
+
steps: branch.steps.map(child),
|
|
508
|
+
}))
|
|
509
|
+
: [],
|
|
510
|
+
} as PlayStaticSubstep;
|
|
511
|
+
}
|
|
512
|
+
if (substep.type === 'waterfall') {
|
|
513
|
+
return {
|
|
514
|
+
...base,
|
|
515
|
+
type: 'waterfall',
|
|
516
|
+
field: substep.field,
|
|
517
|
+
steps: substep.steps?.map((step) => ({
|
|
518
|
+
id: step.id,
|
|
519
|
+
...(step.kind ? { kind: step.kind } : {}),
|
|
520
|
+
...(step.toolId ? { toolId: step.toolId } : {}),
|
|
521
|
+
})),
|
|
522
|
+
} as PlayStaticSubstep;
|
|
523
|
+
}
|
|
524
|
+
if (substep.type === 'play_call') {
|
|
525
|
+
return {
|
|
526
|
+
...base,
|
|
527
|
+
type: 'play_call',
|
|
528
|
+
playId: substep.playId,
|
|
529
|
+
field: substep.field,
|
|
530
|
+
pipeline:
|
|
531
|
+
projectChildren && substep.pipeline
|
|
532
|
+
? projectPublicPipeline(substep.pipeline, depth + 1)
|
|
533
|
+
: null,
|
|
534
|
+
} as PlayStaticSubstep;
|
|
535
|
+
}
|
|
536
|
+
if (substep.type === 'play_launch') {
|
|
537
|
+
return {
|
|
538
|
+
...base,
|
|
539
|
+
type: 'play_launch',
|
|
540
|
+
playId: substep.playId,
|
|
541
|
+
field: substep.field,
|
|
542
|
+
} as PlayStaticSubstep;
|
|
543
|
+
}
|
|
544
|
+
return base as PlayStaticSubstep;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* The bounded, public-safe top-level substeps used to render the real v2 step
|
|
549
|
+
* graph on the share page. Strips source locations / raw param sources.
|
|
550
|
+
*/
|
|
551
|
+
export function buildPublicSubsteps(
|
|
552
|
+
staticPipeline: unknown,
|
|
553
|
+
): PlayStaticSubstep[] {
|
|
554
|
+
const pipeline = asPipeline(staticPipeline);
|
|
555
|
+
if (!pipeline) {
|
|
556
|
+
return [];
|
|
557
|
+
}
|
|
558
|
+
const topLevel = getPublicTopLevelPipelineSubsteps(pipeline);
|
|
559
|
+
return topLevel.map((substep) => projectPublicSubstep(substep, 0));
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/** Distinct provider names across the full (flattened) pipeline. */
|
|
563
|
+
export function extractProviderNames(staticPipeline: unknown): string[] {
|
|
564
|
+
const pipeline = asPipeline(staticPipeline);
|
|
565
|
+
if (!pipeline) {
|
|
566
|
+
return [];
|
|
567
|
+
}
|
|
568
|
+
const providers = new Set<string>();
|
|
569
|
+
for (const substep of flattenStaticPipeline(pipeline)) {
|
|
570
|
+
for (const provider of allProvidersForSubstep(substep)) {
|
|
571
|
+
providers.add(provider);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
return [...providers];
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
function dedupeFields(fields: Array<string | null | undefined>): string[] {
|
|
578
|
+
const seen = new Set<string>();
|
|
579
|
+
const out: string[] = [];
|
|
580
|
+
for (const field of fields) {
|
|
581
|
+
const trimmed = typeof field === 'string' ? field.trim() : '';
|
|
582
|
+
if (!trimmed || seen.has(trimmed)) {
|
|
583
|
+
continue;
|
|
584
|
+
}
|
|
585
|
+
seen.add(trimmed);
|
|
586
|
+
out.push(trimmed);
|
|
587
|
+
if (out.length >= MAX_SCHEMA_FIELDS) {
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
return out;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Decide the only cost denominator that stays comparable across runs of
|
|
596
|
+
* different input sizes, purely from the play's map structure:
|
|
597
|
+
*
|
|
598
|
+
* - 0 top-level datasets (a flat play) → `'run'`: the run is a fixed unit of
|
|
599
|
+
* work, so credits/run is meaningful.
|
|
600
|
+
* - exactly 1 top-level dataset and no nested datasets → `'row'`: cost scales
|
|
601
|
+
* with the number of input rows, so credits/row is the stable metric.
|
|
602
|
+
* - multiple top-level datasets or nested datasets → `'none'`: there is no single
|
|
603
|
+
* honest denominator (which collection's count?), so cost is suppressed
|
|
604
|
+
* rather than shown as a misleading per-run total over a variable input.
|
|
605
|
+
*/
|
|
606
|
+
export function classifyCostBasis(staticPipeline: unknown): PlayCostBasis {
|
|
607
|
+
const pipeline = asPipeline(staticPipeline);
|
|
608
|
+
if (!pipeline) {
|
|
609
|
+
return 'run';
|
|
610
|
+
}
|
|
611
|
+
const topLevelMaps = getTopLevelPipelineSubsteps(pipeline).filter(
|
|
612
|
+
(substep) => substep.type === 'dataset',
|
|
613
|
+
).length;
|
|
614
|
+
if (topLevelMaps === 0) {
|
|
615
|
+
return 'run';
|
|
616
|
+
}
|
|
617
|
+
const allMaps = flattenStaticPipeline(pipeline).filter(
|
|
618
|
+
(substep) => substep.type === 'dataset',
|
|
619
|
+
).length;
|
|
620
|
+
return topLevelMaps === 1 && allMaps === 1 ? 'row' : 'none';
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Derive a safe input-shape for the page's "Inputs" section.
|
|
625
|
+
*
|
|
626
|
+
* The play's real inputs are its declared FILE inputs (e.g. a CSV the caller
|
|
627
|
+
* supplies) — NOT the CSV's columns or the computed sheet columns, which are the
|
|
628
|
+
* row contract / outputs. So we surface the `csv` substep field name(s) and fall
|
|
629
|
+
* back to declared top-level `inputFields` only for plays that take no file
|
|
630
|
+
* input. We never dump `pipeline.fields` (the full column list) here.
|
|
631
|
+
*/
|
|
632
|
+
export function buildInputSchemaShape(
|
|
633
|
+
staticPipeline: unknown,
|
|
634
|
+
): PlayShareSchemaShape {
|
|
635
|
+
const pipeline = asPipeline(staticPipeline);
|
|
636
|
+
if (!pipeline) {
|
|
637
|
+
return null;
|
|
638
|
+
}
|
|
639
|
+
const fields = dedupeFields(deriveStaticPipelineEntryInputFields(pipeline));
|
|
640
|
+
return fields.length > 0 ? { fields } : null;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Derive a safe output-shape from the compiled sheet contract column names.
|
|
645
|
+
*/
|
|
646
|
+
export function buildOutputSchemaShape(
|
|
647
|
+
staticPipeline: unknown,
|
|
648
|
+
): PlayShareSchemaShape {
|
|
649
|
+
const pipeline = asPipeline(staticPipeline);
|
|
650
|
+
if (!pipeline) {
|
|
651
|
+
return null;
|
|
652
|
+
}
|
|
653
|
+
const columnNames = (pipeline.sheetContract?.columns ?? []).map(
|
|
654
|
+
(column) => column.id,
|
|
655
|
+
);
|
|
656
|
+
const fields = dedupeFields(columnNames);
|
|
657
|
+
return fields.length > 0 ? { fields } : null;
|
|
658
|
+
}
|