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
|
@@ -13,6 +13,9 @@ import type {
|
|
|
13
13
|
PlayAuthoringDefinedPlay,
|
|
14
14
|
PlayAuthoringInputContract,
|
|
15
15
|
PlayAuthoringReferenceLike,
|
|
16
|
+
AsyncPlayRunRef as PlayAuthoringAsyncPlayRunRef,
|
|
17
|
+
PlayAuthoringAsyncCallOptions,
|
|
18
|
+
PlayRunId as PlayAuthoringRunId,
|
|
16
19
|
PlayAuthoringRuntimeContext,
|
|
17
20
|
PlayAuthoringStepOptions,
|
|
18
21
|
PlayAuthoringStepProgram,
|
|
@@ -125,7 +128,12 @@ export type DatasetBuilder<
|
|
|
125
128
|
DeeplinePlayRuntimeContext
|
|
126
129
|
>;
|
|
127
130
|
|
|
128
|
-
export type PlayReferenceLike
|
|
131
|
+
export type PlayReferenceLike<
|
|
132
|
+
TInput extends Record<string, unknown> = Record<string, unknown>,
|
|
133
|
+
> = PlayAuthoringReferenceLike<TInput>;
|
|
134
|
+
export type AsyncPlayRunRef = PlayAuthoringAsyncPlayRunRef;
|
|
135
|
+
export type PlayAsyncCallOptions = PlayAuthoringAsyncCallOptions;
|
|
136
|
+
export type PlayRunId = PlayAuthoringRunId;
|
|
129
137
|
|
|
130
138
|
export type DeeplinePlayRuntimeContext = PlayAuthoringRuntimeContext;
|
|
131
139
|
|
|
@@ -444,10 +452,7 @@ export function definePlay<TInput, TOutput extends PlayReturnObject>(
|
|
|
444
452
|
/** @internal Contextually type unannotated monitor-event handlers as unknown. */
|
|
445
453
|
export function definePlay<TOutput extends PlayReturnObject>(
|
|
446
454
|
name: string,
|
|
447
|
-
fn: (
|
|
448
|
-
context: DeeplinePlayRuntimeContext,
|
|
449
|
-
input: unknown,
|
|
450
|
-
) => Promise<TOutput>,
|
|
455
|
+
fn: (context: DeeplinePlayRuntimeContext, input: unknown) => Promise<TOutput>,
|
|
451
456
|
bindings: PlayBindings<never> & {
|
|
452
457
|
readonly sqlListeners: readonly SqlListenerDeclaration[];
|
|
453
458
|
},
|
|
@@ -455,7 +460,7 @@ export function definePlay<TOutput extends PlayReturnObject>(
|
|
|
455
460
|
/* eslint-disable @typescript-eslint/no-explicit-any -- This constraint must infer a concrete contravariant handler input. */
|
|
456
461
|
export function definePlay<
|
|
457
462
|
THandler extends (
|
|
458
|
-
|
|
463
|
+
context: DeeplinePlayRuntimeContext,
|
|
459
464
|
input: any,
|
|
460
465
|
) => Promise<PlayReturnObject>,
|
|
461
466
|
>(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The play deployment status machine, shared by the Convex control plane
|
|
3
|
-
* (convex/playDeployments.ts), worker auth (src/lib/auth/play-deploy-auth.ts),
|
|
3
|
+
* (convex/playDeployments.ts), worker auth (apps/deepline-api/src/lib/auth/play-deploy-auth.ts),
|
|
4
4
|
* and the deploy-worker API surface. One spelling of the union, the terminal
|
|
5
5
|
* set, and the allowed transitions.
|
|
6
6
|
*/
|
|
@@ -61,10 +61,12 @@ export type DocflowOwnerSubstep = Extract<
|
|
|
61
61
|
{ type: 'dataset' | 'csv' }
|
|
62
62
|
>;
|
|
63
63
|
export type DocflowToolSubstep = Extract<PlayStaticSubstep, { type: 'tool' }>;
|
|
64
|
-
export type
|
|
64
|
+
export type DocflowChildPlaySubstep = Extract<
|
|
65
65
|
PlayStaticSubstep,
|
|
66
|
-
{ type: 'play_call' }
|
|
66
|
+
{ type: 'play_call' | 'play_launch' }
|
|
67
67
|
>;
|
|
68
|
+
/** @deprecated Use `DocflowChildPlaySubstep`; retained for compatibility. */
|
|
69
|
+
export type DocflowPlayCallSubstep = DocflowChildPlaySubstep;
|
|
68
70
|
export type DocflowStepSuiteSubstep = Extract<
|
|
69
71
|
PlayStaticSubstep,
|
|
70
72
|
{ type: 'step_suite' }
|
|
@@ -332,19 +334,19 @@ export function resolveDocflowBoundTool(
|
|
|
332
334
|
}
|
|
333
335
|
|
|
334
336
|
/**
|
|
335
|
-
* The `ctx.runPlay` call a `type:"play"` docflow node
|
|
336
|
-
* other binding — symbol first, extent as the fallback
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
337
|
+
* The `ctx.runPlay` or `ctx.runPlayAsync` call a `type:"play"` docflow node
|
|
338
|
+
* names. Same join as every other binding — symbol first, extent as the fallback
|
|
339
|
+
* — over the FLATTENED substep tree. Its `field` is the column, variable, or
|
|
340
|
+
* launch key the child run lands in, which is exactly what the node's `out:`
|
|
341
|
+
* names.
|
|
340
342
|
*/
|
|
341
|
-
export function
|
|
343
|
+
export function resolveDocflowBoundChildPlay(
|
|
342
344
|
binding: PlayDocflowBinding,
|
|
343
345
|
substeps: readonly PlayStaticSubstep[],
|
|
344
|
-
): DocflowBindingJoin<
|
|
346
|
+
): DocflowBindingJoin<DocflowChildPlaySubstep> {
|
|
345
347
|
const playCalls = flattenSubsteps(substeps).filter(
|
|
346
|
-
(substep): substep is
|
|
347
|
-
substep.type === 'play_call',
|
|
348
|
+
(substep): substep is DocflowChildPlaySubstep =>
|
|
349
|
+
substep.type === 'play_call' || substep.type === 'play_launch',
|
|
348
350
|
);
|
|
349
351
|
return joinBySymbolThenExtent(
|
|
350
352
|
binding,
|
|
@@ -353,6 +355,9 @@ export function resolveDocflowBoundPlayCall(
|
|
|
353
355
|
);
|
|
354
356
|
}
|
|
355
357
|
|
|
358
|
+
/** @deprecated Use `resolveDocflowBoundChildPlay`; retained for compatibility. */
|
|
359
|
+
export const resolveDocflowBoundPlayCall = resolveDocflowBoundChildPlay;
|
|
360
|
+
|
|
356
361
|
// ── waterfalls: the step suite and its legs ─────────────────────────────────
|
|
357
362
|
//
|
|
358
363
|
// `steps().step('hunter_email', …).step('leadmagic_email', …).return(…)` compiles
|
|
@@ -78,7 +78,7 @@ export type PlayDocflowEdge = {
|
|
|
78
78
|
*
|
|
79
79
|
* ABSENT — never `null` — when unrecorded, and that is load-bearing rather
|
|
80
80
|
* than stylistic. `docflow` is whole-object serialized into
|
|
81
|
-
* `playStaticPipelineContractHash` (`src/lib/plays/artifact-storage.ts`),
|
|
81
|
+
* `playStaticPipelineContractHash` (`apps/deepline-api/src/lib/plays/artifact-storage.ts`),
|
|
82
82
|
* which is part of the immutable artifact storage key, and the canonicalizer
|
|
83
83
|
* there drops `undefined` but HASHES `null`. Emitting `arm: null` on an
|
|
84
84
|
* unannotated edge would change the contract hash of every diagrammed play
|
|
@@ -91,7 +91,7 @@ export type EmailStatusBuildInput = {
|
|
|
91
91
|
|
|
92
92
|
// There is intentionally NO shared default status map. Each provider must
|
|
93
93
|
// declare its own `statusMap` / `rules` for the raw status strings it emits
|
|
94
|
-
// (see the provider registries under
|
|
94
|
+
// (see the provider registries under packages/integrations/**). A coarse global
|
|
95
95
|
// map silently coerced provider-specific strings ("deliverable", "accept_all",
|
|
96
96
|
// etc.) into canonical verdicts and let validators depend on guesses instead of
|
|
97
97
|
// documented behavior. With it gone, an unmapped raw status falls through to
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Convex limits its final prefix-search term to 32 UTF-8 bytes, so the public
|
|
2
|
+
// query must stay below that boundary. The corpus was already backfilled in
|
|
3
|
+
// Convex's lowercase representation, so do not rewrite terms here: changing
|
|
4
|
+
// its token boundaries would make historical rows require another data
|
|
5
|
+
// migration. Reject an unsupported query at the API boundary rather than
|
|
6
|
+
// silently returning an incomplete result or adding a second reader.
|
|
7
|
+
export const CONVEX_PLAY_GREP_SEARCH_TERM_MAX_BYTES = 31;
|
|
8
|
+
export const CONVEX_PLAY_GREP_SEARCH_MAX_TERMS = 16;
|
|
9
|
+
|
|
10
|
+
const CONVEX_PLAY_GREP_SEARCH_TERM_PATTERN = /[\p{L}\p{N}]+/gu;
|
|
11
|
+
|
|
12
|
+
/** Return searchable raw terms for the public response filter. */
|
|
13
|
+
export function extractPlayGrepSearchTerms(value: string): string[] {
|
|
14
|
+
return value.match(CONVEX_PLAY_GREP_SEARCH_TERM_PATTERN) ?? [];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Match the immutable representation of the completed grep-corpus backfill.
|
|
19
|
+
*/
|
|
20
|
+
export function normalizePlayGrepSearchQuery(value: string): string {
|
|
21
|
+
return value.toLowerCase();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Count the terms the API will send to Convex. Request validation keeps an
|
|
26
|
+
* accepted query within Convex's 16-term full-text-search limit.
|
|
27
|
+
*/
|
|
28
|
+
export function countNormalizedPlayGrepSearchTerms(value: string): number {
|
|
29
|
+
return extractPlayGrepSearchTerms(normalizePlayGrepSearchQuery(value)).length;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** True when a query term exceeds Convex's usable full-text-search limit. */
|
|
33
|
+
export function hasOverlongPlayGrepSearchTerm(value: string): boolean {
|
|
34
|
+
const encoder = new TextEncoder();
|
|
35
|
+
return extractPlayGrepSearchTerms(normalizePlayGrepSearchQuery(value)).some(
|
|
36
|
+
(term) =>
|
|
37
|
+
encoder.encode(term).byteLength > CONVEX_PLAY_GREP_SEARCH_TERM_MAX_BYTES,
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -136,7 +136,7 @@ async function resolvePipelineSubsteps(input: {
|
|
|
136
136
|
return nested satisfies PlayStaticSubstep;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
if (annotated.type !== 'play_call') {
|
|
139
|
+
if (annotated.type !== 'play_call' && annotated.type !== 'play_launch') {
|
|
140
140
|
return annotated;
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package-owned helpers for share-page copy: the generation input shape, a deterministic
|
|
3
|
+
* (no-LLM) fallback builder, override merging, and validation of model output.
|
|
4
|
+
*
|
|
5
|
+
* Nothing here performs network I/O — see generate-card.ts for the LLM call.
|
|
6
|
+
*/
|
|
7
|
+
import type {
|
|
8
|
+
PlayShareCopyOverrides,
|
|
9
|
+
PlayShareGeneratedCopy,
|
|
10
|
+
PlayShareSchemaShape,
|
|
11
|
+
PlayShareStaticPipelineSummary,
|
|
12
|
+
} from './types';
|
|
13
|
+
|
|
14
|
+
/** A single safe, bounded sample of a successful run. */
|
|
15
|
+
export type ShareRunSummarySample = {
|
|
16
|
+
rowCount: number | null;
|
|
17
|
+
outputLeadCount: number | null;
|
|
18
|
+
columns: string[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Everything the copy generators are allowed to see about a revision. This is
|
|
23
|
+
* assembled server-side and contains no provider spend, secrets, or source.
|
|
24
|
+
*/
|
|
25
|
+
export type ShareCardGenerationInput = {
|
|
26
|
+
playName: string;
|
|
27
|
+
displayName?: string | null;
|
|
28
|
+
ownerDisplayName: string | null;
|
|
29
|
+
version: number;
|
|
30
|
+
graphHash: string | null;
|
|
31
|
+
sourceHash: string;
|
|
32
|
+
summary: PlayShareStaticPipelineSummary;
|
|
33
|
+
inputSchema: PlayShareSchemaShape;
|
|
34
|
+
outputSchema: PlayShareSchemaShape;
|
|
35
|
+
providerNames: string[];
|
|
36
|
+
existingDescription: string | null;
|
|
37
|
+
sampleRunSummaries: ShareRunSummarySample[];
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const COPY_FIELDS: Array<keyof PlayShareGeneratedCopy> = [
|
|
41
|
+
'title',
|
|
42
|
+
'shortDescription',
|
|
43
|
+
'jtbd',
|
|
44
|
+
'whenToUse',
|
|
45
|
+
'inputs',
|
|
46
|
+
'outputs',
|
|
47
|
+
'agentPrompt',
|
|
48
|
+
'llmSummary',
|
|
49
|
+
'seoTitle',
|
|
50
|
+
'seoDescription',
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
function humanizePlayName(name: string): string {
|
|
54
|
+
const cleaned = name
|
|
55
|
+
.split('/')
|
|
56
|
+
.pop()!
|
|
57
|
+
.replace(/[._-]+/g, ' ')
|
|
58
|
+
.trim();
|
|
59
|
+
if (!cleaned) {
|
|
60
|
+
return 'Play';
|
|
61
|
+
}
|
|
62
|
+
return cleaned
|
|
63
|
+
.split(/\s+/)
|
|
64
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
65
|
+
.join(' ');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function firstSentence(text: string): string {
|
|
69
|
+
const trimmed = text.trim();
|
|
70
|
+
const match = trimmed.match(/^.*?[.!?](\s|$)/);
|
|
71
|
+
return (match ? match[0] : trimmed).trim();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function joinList(items: string[], fallback: string): string {
|
|
75
|
+
const cleaned = items.filter(Boolean);
|
|
76
|
+
if (cleaned.length === 0) {
|
|
77
|
+
return fallback;
|
|
78
|
+
}
|
|
79
|
+
if (cleaned.length === 1) {
|
|
80
|
+
return cleaned[0];
|
|
81
|
+
}
|
|
82
|
+
return `${cleaned.slice(0, -1).join(', ')} and ${cleaned[cleaned.length - 1]}`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Build a conservative card from structured facts, no model required. Used as a
|
|
87
|
+
* deterministic fallback and as the seed for the LLM prompt. Uncertain parts are
|
|
88
|
+
* intentionally generic rather than invented.
|
|
89
|
+
*/
|
|
90
|
+
export function buildDeterministicShareCard(
|
|
91
|
+
input: ShareCardGenerationInput,
|
|
92
|
+
): PlayShareGeneratedCopy {
|
|
93
|
+
const human = input.displayName?.trim() || humanizePlayName(input.playName);
|
|
94
|
+
const providers = input.providerNames.filter(Boolean);
|
|
95
|
+
const providerPhrase =
|
|
96
|
+
providers.length > 0
|
|
97
|
+
? ` using ${joinList(providers, 'GTM providers')}`
|
|
98
|
+
: '';
|
|
99
|
+
const inputFields = input.inputSchema?.fields ?? [];
|
|
100
|
+
const outputFields = input.outputSchema?.fields ?? [];
|
|
101
|
+
|
|
102
|
+
const existing = input.existingDescription?.trim() || '';
|
|
103
|
+
const shortDescription = existing
|
|
104
|
+
? firstSentence(existing)
|
|
105
|
+
: `${human} is a Deepline play that automates a ${input.summary.stepCount}-step GTM pipeline${providerPhrase}.`;
|
|
106
|
+
|
|
107
|
+
const jtbd = existing
|
|
108
|
+
? existing
|
|
109
|
+
: `Run a repeatable, multi-step GTM workflow${providerPhrase} without wiring providers together by hand.`;
|
|
110
|
+
|
|
111
|
+
const whenToUse =
|
|
112
|
+
providers.length > 0
|
|
113
|
+
? [
|
|
114
|
+
`You need data from ${joinList(providers, 'multiple providers')} in one pass.`,
|
|
115
|
+
'You want a repeatable pipeline instead of one-off lookups.',
|
|
116
|
+
'You want an agent or teammate to run the same workflow on demand.',
|
|
117
|
+
]
|
|
118
|
+
: [
|
|
119
|
+
'You need a repeatable, multi-step GTM workflow.',
|
|
120
|
+
'You want an agent or teammate to run it on demand.',
|
|
121
|
+
'You want consistent output columns every run.',
|
|
122
|
+
];
|
|
123
|
+
|
|
124
|
+
const inputs =
|
|
125
|
+
inputFields.length > 0
|
|
126
|
+
? inputFields
|
|
127
|
+
: input.summary.hasMap
|
|
128
|
+
? ['A list of rows to process (CSV or table).']
|
|
129
|
+
: ['Run parameters for the workflow.'];
|
|
130
|
+
|
|
131
|
+
const outputs =
|
|
132
|
+
outputFields.length > 0
|
|
133
|
+
? outputFields
|
|
134
|
+
: ['An enriched output table with one row per processed record.'];
|
|
135
|
+
|
|
136
|
+
const agentPrompt = `Use the Deepline "${input.playName}" play to ${jtbd
|
|
137
|
+
.charAt(0)
|
|
138
|
+
.toLowerCase()}${jtbd.slice(1)}`;
|
|
139
|
+
|
|
140
|
+
const llmSummary = [
|
|
141
|
+
`${human} (Deepline play "${input.playName}", version ${input.version}).`,
|
|
142
|
+
shortDescription,
|
|
143
|
+
`Pipeline: ${input.summary.stepCount} steps, ${input.summary.providerCount} provider${input.summary.providerCount === 1 ? '' : 's'}${input.summary.hasMap ? ', processes input rows as a dataset' : ''}.`,
|
|
144
|
+
inputFields.length > 0 ? `Inputs: ${inputFields.join(', ')}.` : null,
|
|
145
|
+
outputFields.length > 0 ? `Outputs: ${outputFields.join(', ')}.` : null,
|
|
146
|
+
]
|
|
147
|
+
.filter(Boolean)
|
|
148
|
+
.join(' ');
|
|
149
|
+
|
|
150
|
+
const primaryInput = inputs[0]?.replace(/\.$/, '') ?? 'GTM inputs';
|
|
151
|
+
const primaryOutput = outputs[0]?.replace(/\.$/, '') ?? 'workflow output';
|
|
152
|
+
const providerCount = input.summary.providerCount;
|
|
153
|
+
const seoTitle = `${human}: Inputs, Outputs & CLI Setup`;
|
|
154
|
+
const seoDescription = [
|
|
155
|
+
`Run or fork this Deepline play from ${primaryInput} to ${primaryOutput}.`,
|
|
156
|
+
`See steps, ${providerCount} provider${providerCount === 1 ? '' : 's'}, setup, and CLI commands.`,
|
|
157
|
+
].join(' ');
|
|
158
|
+
|
|
159
|
+
return {
|
|
160
|
+
title: human,
|
|
161
|
+
shortDescription,
|
|
162
|
+
jtbd,
|
|
163
|
+
whenToUse,
|
|
164
|
+
inputs,
|
|
165
|
+
outputs,
|
|
166
|
+
agentPrompt,
|
|
167
|
+
llmSummary,
|
|
168
|
+
seoTitle,
|
|
169
|
+
seoDescription,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function nonEmptyString(value: unknown): value is string {
|
|
174
|
+
return typeof value === 'string' && value.trim().length > 0;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function nonEmptyStringArray(value: unknown): value is string[] {
|
|
178
|
+
return (
|
|
179
|
+
Array.isArray(value) &&
|
|
180
|
+
value.length > 0 &&
|
|
181
|
+
value.every((item) => nonEmptyString(item))
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Validate an arbitrary object as `PlayShareGeneratedCopy`. Returns the typed
|
|
187
|
+
* copy or throws (loud failure) so model output can never silently degrade.
|
|
188
|
+
*/
|
|
189
|
+
export function parseGeneratedCopy(value: unknown): PlayShareGeneratedCopy {
|
|
190
|
+
if (!value || typeof value !== 'object') {
|
|
191
|
+
throw new Error('Generated copy must be an object.');
|
|
192
|
+
}
|
|
193
|
+
const record = value as Record<string, unknown>;
|
|
194
|
+
const stringFields: Array<keyof PlayShareGeneratedCopy> = [
|
|
195
|
+
'title',
|
|
196
|
+
'shortDescription',
|
|
197
|
+
'jtbd',
|
|
198
|
+
'agentPrompt',
|
|
199
|
+
'llmSummary',
|
|
200
|
+
'seoTitle',
|
|
201
|
+
'seoDescription',
|
|
202
|
+
];
|
|
203
|
+
for (const field of stringFields) {
|
|
204
|
+
if (!nonEmptyString(record[field])) {
|
|
205
|
+
throw new Error(
|
|
206
|
+
`Generated copy field "${field}" must be a non-empty string.`,
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const arrayFields: Array<keyof PlayShareGeneratedCopy> = [
|
|
211
|
+
'whenToUse',
|
|
212
|
+
'inputs',
|
|
213
|
+
'outputs',
|
|
214
|
+
];
|
|
215
|
+
for (const field of arrayFields) {
|
|
216
|
+
if (!nonEmptyStringArray(record[field])) {
|
|
217
|
+
throw new Error(
|
|
218
|
+
`Generated copy field "${field}" must be a non-empty array of strings.`,
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return {
|
|
224
|
+
title: (record.title as string).trim(),
|
|
225
|
+
shortDescription: (record.shortDescription as string).trim(),
|
|
226
|
+
jtbd: (record.jtbd as string).trim(),
|
|
227
|
+
whenToUse: (record.whenToUse as string[]).map((item) => item.trim()),
|
|
228
|
+
inputs: (record.inputs as string[]).map((item) => item.trim()),
|
|
229
|
+
outputs: (record.outputs as string[]).map((item) => item.trim()),
|
|
230
|
+
agentPrompt: (record.agentPrompt as string).trim(),
|
|
231
|
+
llmSummary: (record.llmSummary as string).trim(),
|
|
232
|
+
seoTitle: (record.seoTitle as string).trim(),
|
|
233
|
+
seoDescription: (record.seoDescription as string).trim(),
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function isMeaningfulOverride(value: unknown): boolean {
|
|
238
|
+
if (nonEmptyString(value)) {
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
if (Array.isArray(value)) {
|
|
242
|
+
return value.some((item) => nonEmptyString(item));
|
|
243
|
+
}
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Merge owner overrides over generated copy at read time. Only non-empty
|
|
249
|
+
* overrides win; everything else falls through to the generated value.
|
|
250
|
+
*/
|
|
251
|
+
export function mergeShareCopy(
|
|
252
|
+
generated: PlayShareGeneratedCopy,
|
|
253
|
+
overrides: PlayShareCopyOverrides | null | undefined,
|
|
254
|
+
): PlayShareGeneratedCopy {
|
|
255
|
+
if (!overrides) {
|
|
256
|
+
return generated;
|
|
257
|
+
}
|
|
258
|
+
const merged: PlayShareGeneratedCopy = { ...generated };
|
|
259
|
+
for (const field of COPY_FIELDS) {
|
|
260
|
+
const override = overrides[field];
|
|
261
|
+
if (isMeaningfulOverride(override)) {
|
|
262
|
+
// Field types are homogeneous per key; cast is safe after the check.
|
|
263
|
+
(merged[field] as unknown) = Array.isArray(override)
|
|
264
|
+
? override
|
|
265
|
+
.filter((item) => nonEmptyString(item))
|
|
266
|
+
.map((item) => item.trim())
|
|
267
|
+
: (override as string).trim();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return merged;
|
|
271
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package-owned metric aggregation for the public read model.
|
|
3
|
+
*
|
|
4
|
+
* Hard rules (see docs/shareable-play-pages-plan.md + AGENTS.md):
|
|
5
|
+
* - Only Deepline credits are aggregated here. Provider spend (USD) is never
|
|
6
|
+
* passed into this module.
|
|
7
|
+
* - Cost is exposed only when the owner opted in.
|
|
8
|
+
* - Latency is exposed only when the owner opted in AND the revision has no map.
|
|
9
|
+
* - Denominator-specific metrics return null when row/contact counts are
|
|
10
|
+
* missing or ambiguous.
|
|
11
|
+
*/
|
|
12
|
+
import type { PlayCostBasis, PublishedPlayPageMetrics } from './types';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* One completed run, reduced to the only facts the public metrics need.
|
|
16
|
+
* `providerCostUsd` deliberately does not exist on this type.
|
|
17
|
+
*/
|
|
18
|
+
export type ShareRunMetricSample = {
|
|
19
|
+
/** Total Deepline credits for the run (sum of usageEvents.credits). */
|
|
20
|
+
credits: number;
|
|
21
|
+
/** Number of input rows processed, when reliably known. */
|
|
22
|
+
inputRowCount: number | null;
|
|
23
|
+
/** Number of output leads/contacts produced, when reliably known. */
|
|
24
|
+
outputLeadCount: number | null;
|
|
25
|
+
/** Wall-clock run latency in ms, when valid timing exists. */
|
|
26
|
+
latencyMs: number | null;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type ComputePublicMetricsOptions = {
|
|
30
|
+
showAverageDeeplineCost: boolean;
|
|
31
|
+
showAverageLatency: boolean;
|
|
32
|
+
/** Latency is meaningless for mapped (fan-out) revisions. */
|
|
33
|
+
hasMap: boolean;
|
|
34
|
+
/** Which credit denominator the page may render; see `classifyCostBasis`. */
|
|
35
|
+
costBasis: PlayCostBasis;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
function mean(values: number[]): number | null {
|
|
39
|
+
if (values.length === 0) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
const total = values.reduce((sum, value) => sum + value, 0);
|
|
43
|
+
return total / values.length;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function roundTo(value: number, decimals: number): number {
|
|
47
|
+
const factor = 10 ** decimals;
|
|
48
|
+
return Math.round(value * factor) / factor;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Aggregate a bounded sample of completed runs into public, credit-only metrics.
|
|
53
|
+
*/
|
|
54
|
+
export function computePublicMetrics(
|
|
55
|
+
samples: ShareRunMetricSample[],
|
|
56
|
+
options: ComputePublicMetricsOptions,
|
|
57
|
+
): PublishedPlayPageMetrics {
|
|
58
|
+
const sampleRunCount = samples.length;
|
|
59
|
+
|
|
60
|
+
const empty: PublishedPlayPageMetrics = {
|
|
61
|
+
averageDeeplineCostCredits: null,
|
|
62
|
+
averageCostPerInputRowCredits: null,
|
|
63
|
+
averageCostPerOutputLeadCredits: null,
|
|
64
|
+
averageLatencyMs: null,
|
|
65
|
+
sampleRunCount,
|
|
66
|
+
costBasis: options.costBasis,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
if (sampleRunCount === 0) {
|
|
70
|
+
return empty;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const metrics: PublishedPlayPageMetrics = { ...empty };
|
|
74
|
+
|
|
75
|
+
if (options.showAverageDeeplineCost) {
|
|
76
|
+
const creditValues = samples
|
|
77
|
+
.map((sample) => sample.credits)
|
|
78
|
+
.filter((value) => Number.isFinite(value) && value >= 0);
|
|
79
|
+
const avgCredits = mean(creditValues);
|
|
80
|
+
metrics.averageDeeplineCostCredits =
|
|
81
|
+
avgCredits === null ? null : roundTo(avgCredits, 2);
|
|
82
|
+
|
|
83
|
+
metrics.averageCostPerInputRowCredits = ratioOverDenominator(
|
|
84
|
+
samples,
|
|
85
|
+
(sample) => sample.inputRowCount,
|
|
86
|
+
);
|
|
87
|
+
metrics.averageCostPerOutputLeadCredits = ratioOverDenominator(
|
|
88
|
+
samples,
|
|
89
|
+
(sample) => sample.outputLeadCount,
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (options.showAverageLatency && !options.hasMap) {
|
|
94
|
+
const latencyValues = samples
|
|
95
|
+
.map((sample) => sample.latencyMs)
|
|
96
|
+
.filter(
|
|
97
|
+
(value): value is number =>
|
|
98
|
+
value !== null && Number.isFinite(value) && value >= 0,
|
|
99
|
+
);
|
|
100
|
+
const avgLatency = mean(latencyValues);
|
|
101
|
+
metrics.averageLatencyMs =
|
|
102
|
+
avgLatency === null ? null : Math.round(avgLatency);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return metrics;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* total credits / total denominator, considering only runs where the
|
|
110
|
+
* denominator is a reliable positive number. Returns null if no such run.
|
|
111
|
+
*/
|
|
112
|
+
function ratioOverDenominator(
|
|
113
|
+
samples: ShareRunMetricSample[],
|
|
114
|
+
pick: (sample: ShareRunMetricSample) => number | null,
|
|
115
|
+
): number | null {
|
|
116
|
+
let creditSum = 0;
|
|
117
|
+
let denominatorSum = 0;
|
|
118
|
+
let usableRuns = 0;
|
|
119
|
+
|
|
120
|
+
for (const sample of samples) {
|
|
121
|
+
const denominator = pick(sample);
|
|
122
|
+
if (
|
|
123
|
+
denominator === null ||
|
|
124
|
+
!Number.isFinite(denominator) ||
|
|
125
|
+
denominator <= 0 ||
|
|
126
|
+
!Number.isFinite(sample.credits) ||
|
|
127
|
+
sample.credits < 0
|
|
128
|
+
) {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
creditSum += sample.credits;
|
|
132
|
+
denominatorSum += denominator;
|
|
133
|
+
usableRuns += 1;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (usableRuns === 0 || denominatorSum <= 0) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
return roundTo(creditSum / denominatorSum, 4);
|
|
140
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package-owned assembler for the bounded `PublishedPlayPagePackage`.
|
|
3
|
+
*
|
|
4
|
+
* This is the ONLY object the public page and public API expose. It is built
|
|
5
|
+
* from already-gathered, already-sanitized inputs — this function performs no
|
|
6
|
+
* I/O and makes no access decisions.
|
|
7
|
+
*/
|
|
8
|
+
import {
|
|
9
|
+
buildInputSchemaShape,
|
|
10
|
+
buildOutputSchemaShape,
|
|
11
|
+
buildPublicSubsteps,
|
|
12
|
+
buildStaticPipelineSummary,
|
|
13
|
+
} from './static-pipeline-summary';
|
|
14
|
+
// This Module is bundled by Convex through its workspace dependency graph.
|
|
15
|
+
import { buildShareCanonicalPath } from '../slug';
|
|
16
|
+
import type {
|
|
17
|
+
PlayShareGeneratedCopy,
|
|
18
|
+
PlayShareSeoIndexing,
|
|
19
|
+
PublishedPlayPageMetrics,
|
|
20
|
+
PublishedPlayPagePackage,
|
|
21
|
+
} from './types';
|
|
22
|
+
|
|
23
|
+
export type BuildPublishedPlayPagePackageInput = {
|
|
24
|
+
shareSlug: string;
|
|
25
|
+
/** Org URL handle; the public page is namespaced `/p/:orgSlug/:playName`. */
|
|
26
|
+
orgSlug: string;
|
|
27
|
+
/** Page-level SEO posture; applied only to the published version. */
|
|
28
|
+
pageSeoIndexing: PlayShareSeoIndexing;
|
|
29
|
+
publishedVersion: number;
|
|
30
|
+
publishedAt: number;
|
|
31
|
+
definitionName: string;
|
|
32
|
+
ownerDisplayName: string | null;
|
|
33
|
+
revision: {
|
|
34
|
+
id: string;
|
|
35
|
+
version: number;
|
|
36
|
+
graphHash: string | null;
|
|
37
|
+
staticPipeline: unknown;
|
|
38
|
+
};
|
|
39
|
+
copy: PlayShareGeneratedCopy;
|
|
40
|
+
metrics: PublishedPlayPageMetrics;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export function buildPublishedPlayPagePackage(
|
|
44
|
+
input: BuildPublishedPlayPagePackageInput,
|
|
45
|
+
): PublishedPlayPagePackage {
|
|
46
|
+
const isPublishedVersion = input.revision.version === input.publishedVersion;
|
|
47
|
+
|
|
48
|
+
// Non-published (historical) versions default to noindex regardless of the
|
|
49
|
+
// page setting, so old copies never compete with the canonical version.
|
|
50
|
+
const seoIndexing: PlayShareSeoIndexing = isPublishedVersion
|
|
51
|
+
? input.pageSeoIndexing
|
|
52
|
+
: 'noindex';
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
page: {
|
|
56
|
+
shareSlug: input.shareSlug,
|
|
57
|
+
orgSlug: input.orgSlug,
|
|
58
|
+
visibility: 'unlisted',
|
|
59
|
+
seoIndexing,
|
|
60
|
+
canonicalPath: buildShareCanonicalPath(
|
|
61
|
+
input.orgSlug,
|
|
62
|
+
input.definitionName,
|
|
63
|
+
input.publishedVersion,
|
|
64
|
+
),
|
|
65
|
+
isPublishedVersion,
|
|
66
|
+
publishedAt: input.publishedAt,
|
|
67
|
+
},
|
|
68
|
+
definition: {
|
|
69
|
+
name: input.definitionName,
|
|
70
|
+
ownerDisplayName: input.ownerDisplayName,
|
|
71
|
+
},
|
|
72
|
+
revision: {
|
|
73
|
+
id: input.revision.id,
|
|
74
|
+
version: input.revision.version,
|
|
75
|
+
graphHash: input.revision.graphHash,
|
|
76
|
+
staticPipelineSummary: buildStaticPipelineSummary(
|
|
77
|
+
input.revision.staticPipeline,
|
|
78
|
+
),
|
|
79
|
+
substeps: buildPublicSubsteps(input.revision.staticPipeline),
|
|
80
|
+
inputSchema: buildInputSchemaShape(input.revision.staticPipeline),
|
|
81
|
+
outputSchema: buildOutputSchemaShape(input.revision.staticPipeline),
|
|
82
|
+
},
|
|
83
|
+
copy: input.copy,
|
|
84
|
+
publicMetrics: input.metrics,
|
|
85
|
+
};
|
|
86
|
+
}
|