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,140 @@
|
|
|
1
|
+
export type SlackPayload = {
|
|
2
|
+
text: string;
|
|
3
|
+
data?: string;
|
|
4
|
+
source: string;
|
|
5
|
+
requestedAt?: string;
|
|
6
|
+
blocks?: Array<Record<string, unknown>>;
|
|
7
|
+
unfurl_links?: boolean;
|
|
8
|
+
unfurl_media?: boolean;
|
|
9
|
+
bypassInternalActorBlock?: boolean;
|
|
10
|
+
} & Record<string, unknown>;
|
|
11
|
+
|
|
12
|
+
export type SlackField = {
|
|
13
|
+
label: string;
|
|
14
|
+
value: string | number | null | undefined;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type SlackActivityPayloadInput = {
|
|
18
|
+
source: string;
|
|
19
|
+
activityTitle: string;
|
|
20
|
+
activityPrimary: string;
|
|
21
|
+
fields: SlackField[];
|
|
22
|
+
fallbackText?: string;
|
|
23
|
+
footerText?: string;
|
|
24
|
+
requestedAt?: string;
|
|
25
|
+
extra?: Record<string, unknown>;
|
|
26
|
+
showHeader?: boolean;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export function buildSlackActivityPayload(
|
|
30
|
+
input: SlackActivityPayloadInput,
|
|
31
|
+
): SlackPayload {
|
|
32
|
+
const title =
|
|
33
|
+
normalizeText(input.activityTitle) || 'You have a new activity:';
|
|
34
|
+
const primary = normalizeText(input.activityPrimary) || 'Activity update';
|
|
35
|
+
const detailsTableBlock = buildSlackTableBlock(input.fields);
|
|
36
|
+
const text =
|
|
37
|
+
normalizeText(input.fallbackText) ||
|
|
38
|
+
[
|
|
39
|
+
title,
|
|
40
|
+
primary,
|
|
41
|
+
...input.fields.map((field) => {
|
|
42
|
+
const label = normalizeText(field.label);
|
|
43
|
+
const value = normalizeText(field.value);
|
|
44
|
+
return label && value ? `${label}: ${value}` : '';
|
|
45
|
+
}),
|
|
46
|
+
]
|
|
47
|
+
.filter(Boolean)
|
|
48
|
+
.join('\n');
|
|
49
|
+
const compactDetails = normalizeText(input.fallbackText);
|
|
50
|
+
const compactDetailsBlock =
|
|
51
|
+
!detailsTableBlock && compactDetails
|
|
52
|
+
? {
|
|
53
|
+
type: 'section',
|
|
54
|
+
text: {
|
|
55
|
+
type: 'mrkdwn',
|
|
56
|
+
text: compactDetails,
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
: null;
|
|
60
|
+
const showHeader = input.showHeader ?? true;
|
|
61
|
+
const footerText = normalizeText(input.footerText);
|
|
62
|
+
const headerBlock = {
|
|
63
|
+
type: 'section',
|
|
64
|
+
text: {
|
|
65
|
+
type: 'mrkdwn',
|
|
66
|
+
text: `${title}\n*${primary}*`,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
text,
|
|
72
|
+
data: text,
|
|
73
|
+
source: input.source,
|
|
74
|
+
requestedAt: input.requestedAt ?? new Date().toISOString(),
|
|
75
|
+
...(input.extra ?? {}),
|
|
76
|
+
blocks: [
|
|
77
|
+
{ type: 'divider' },
|
|
78
|
+
...(showHeader ? [headerBlock] : []),
|
|
79
|
+
...(compactDetailsBlock ? [compactDetailsBlock] : []),
|
|
80
|
+
...(detailsTableBlock ? [detailsTableBlock] : []),
|
|
81
|
+
...(footerText
|
|
82
|
+
? [
|
|
83
|
+
{
|
|
84
|
+
type: 'context',
|
|
85
|
+
elements: [
|
|
86
|
+
{
|
|
87
|
+
type: 'mrkdwn',
|
|
88
|
+
text: footerText,
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
]
|
|
93
|
+
: []),
|
|
94
|
+
],
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function buildSlackTableBlock(fields: SlackField[]) {
|
|
99
|
+
const rows = fields
|
|
100
|
+
.map((field) => ({
|
|
101
|
+
label: normalizeText(field.label),
|
|
102
|
+
value: normalizeText(field.value),
|
|
103
|
+
}))
|
|
104
|
+
.filter((field) => Boolean(field.label) && Boolean(field.value))
|
|
105
|
+
.slice(0, 20);
|
|
106
|
+
|
|
107
|
+
if (rows.length === 0) return null;
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
type: 'table',
|
|
111
|
+
rows: [
|
|
112
|
+
[buildSlackTableCell('Field', true), buildSlackTableCell('Value', true)],
|
|
113
|
+
...rows.map((row) => [
|
|
114
|
+
buildSlackTableCell(row.label, false),
|
|
115
|
+
buildSlackTableCell(row.value, false),
|
|
116
|
+
]),
|
|
117
|
+
],
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function buildSlackTableCell(text: string, bold: boolean) {
|
|
122
|
+
return {
|
|
123
|
+
type: 'rich_text',
|
|
124
|
+
elements: [
|
|
125
|
+
{
|
|
126
|
+
type: 'rich_text_section',
|
|
127
|
+
elements: [
|
|
128
|
+
bold
|
|
129
|
+
? { type: 'text', text, style: { bold: true } }
|
|
130
|
+
: { type: 'text', text },
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function normalizeText(value: unknown): string {
|
|
138
|
+
if (value === null || value === undefined) return '';
|
|
139
|
+
return String(value).trim();
|
|
140
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { removeHttpHeadersFromSlackPayload } from '../security/slack-sanitize';
|
|
2
|
+
|
|
3
|
+
type SlackChatResponse = {
|
|
4
|
+
ok: boolean;
|
|
5
|
+
error?: string;
|
|
6
|
+
channel?: string;
|
|
7
|
+
ts?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type SlackMessageOptions = {
|
|
11
|
+
threadTs?: string;
|
|
12
|
+
blocks?: Array<Record<string, unknown>>;
|
|
13
|
+
unfurlLinks?: boolean;
|
|
14
|
+
unfurlMedia?: boolean;
|
|
15
|
+
username?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
async function postSlackMessage(
|
|
19
|
+
token: string,
|
|
20
|
+
channelId: string,
|
|
21
|
+
text: string,
|
|
22
|
+
options?: SlackMessageOptions,
|
|
23
|
+
): Promise<SlackChatResponse> {
|
|
24
|
+
const sanitizedText = removeHttpHeadersFromSlackPayload(text);
|
|
25
|
+
const sanitizedBlocks = options?.blocks
|
|
26
|
+
? (removeHttpHeadersFromSlackPayload(options.blocks) as Array<
|
|
27
|
+
Record<string, unknown>
|
|
28
|
+
>)
|
|
29
|
+
: undefined;
|
|
30
|
+
const res = await fetch('https://slack.com/api/chat.postMessage', {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
headers: {
|
|
33
|
+
Authorization: `Bearer ${token}`,
|
|
34
|
+
'Content-Type': 'application/json',
|
|
35
|
+
},
|
|
36
|
+
body: JSON.stringify({
|
|
37
|
+
channel: channelId,
|
|
38
|
+
text: typeof sanitizedText === 'string' ? sanitizedText : text,
|
|
39
|
+
unfurl_links: options?.unfurlLinks ?? false,
|
|
40
|
+
unfurl_media: options?.unfurlMedia ?? false,
|
|
41
|
+
...(options?.threadTs ? { thread_ts: options.threadTs } : {}),
|
|
42
|
+
...(options?.username ? { username: options.username } : {}),
|
|
43
|
+
...(sanitizedBlocks ? { blocks: sanitizedBlocks } : {}),
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
const data = (await res.json()) as SlackChatResponse;
|
|
47
|
+
if (!data.ok) {
|
|
48
|
+
throw new Error(
|
|
49
|
+
`Slack chat.postMessage failed: ${data.error ?? 'unknown'}`,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
return data;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export async function postMessageToSlack(
|
|
56
|
+
token: string,
|
|
57
|
+
channelId: string,
|
|
58
|
+
text: string,
|
|
59
|
+
options?: SlackMessageOptions,
|
|
60
|
+
): Promise<void> {
|
|
61
|
+
await postSlackMessage(token, channelId, text, options);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export async function postMessageToSlackWithResult(
|
|
65
|
+
token: string,
|
|
66
|
+
channelId: string,
|
|
67
|
+
text: string,
|
|
68
|
+
options?: SlackMessageOptions,
|
|
69
|
+
): Promise<{ channelId: string; ts: string }> {
|
|
70
|
+
const data = await postSlackMessage(token, channelId, text, options);
|
|
71
|
+
if (!data.channel || !data.ts) {
|
|
72
|
+
throw new Error('Slack chat.postMessage returned no message timestamp.');
|
|
73
|
+
}
|
|
74
|
+
return { channelId: data.channel, ts: data.ts };
|
|
75
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export type NotificationWorkspace = {
|
|
2
|
+
workspaceId: string;
|
|
3
|
+
workspaceName?: string;
|
|
4
|
+
appUrl: string;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export function workspaceAppUrl(
|
|
8
|
+
baseUrl: string,
|
|
9
|
+
workspaceId: string,
|
|
10
|
+
path: string,
|
|
11
|
+
): string {
|
|
12
|
+
const target = new URL(path, baseUrl);
|
|
13
|
+
if (
|
|
14
|
+
target.origin !== new URL(baseUrl).origin ||
|
|
15
|
+
path.startsWith('//') ||
|
|
16
|
+
path.includes('\\')
|
|
17
|
+
) {
|
|
18
|
+
throw new Error('Notification target must be a safe internal path.');
|
|
19
|
+
}
|
|
20
|
+
const url = new URL('/notifications/open', baseUrl);
|
|
21
|
+
url.searchParams.set('workspace', workspaceId);
|
|
22
|
+
url.searchParams.set(
|
|
23
|
+
'next',
|
|
24
|
+
`${target.pathname}${target.search}${target.hash}`,
|
|
25
|
+
);
|
|
26
|
+
return url.toString();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function notificationSettingsUrl(
|
|
30
|
+
workspace: NotificationWorkspace,
|
|
31
|
+
groupKey: string,
|
|
32
|
+
): string {
|
|
33
|
+
return workspaceAppUrl(
|
|
34
|
+
workspace.appUrl,
|
|
35
|
+
workspace.workspaceId,
|
|
36
|
+
`/dashboard/settings/notifications?group=${encodeURIComponent(groupKey)}`,
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -53,3 +53,15 @@ export function getRuntimeEnvInfo() {
|
|
|
53
53
|
node_env: process.env.NODE_ENV ?? null,
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
+
|
|
57
|
+
/** Test seams must never be reachable from a Vercel production deployment. */
|
|
58
|
+
export function isTestOnlyRuntime(): boolean {
|
|
59
|
+
if (process.env.VERCEL_ENV === 'production') return false;
|
|
60
|
+
return process.env.VERCEL_ENV === 'preview' || getRuntimeEnv() !== 'prod';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function shouldEnableMarketingIntegrations(): boolean {
|
|
64
|
+
return getRuntimeEnv() === 'prod';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export { isBuildContext } from './observability/build-context';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const HARDCODED_BLACKLISTED_EMAILS = [] as const;
|
|
2
|
+
const EMAIL_BLACKLIST_ENV_VAR = 'DEEPLINE_EMAIL_BLACKLIST';
|
|
3
|
+
|
|
4
|
+
export function normalizeEmailAddress(email?: string | null): string | null {
|
|
5
|
+
const normalized = String(email ?? '')
|
|
6
|
+
.trim()
|
|
7
|
+
.toLowerCase();
|
|
8
|
+
return normalized.length > 0 ? normalized : null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function getBlacklistedEmails(): Set<string> {
|
|
12
|
+
const emails = new Set<string>();
|
|
13
|
+
|
|
14
|
+
for (const email of HARDCODED_BLACKLISTED_EMAILS) {
|
|
15
|
+
const normalized = normalizeEmailAddress(email);
|
|
16
|
+
if (normalized) {
|
|
17
|
+
emails.add(normalized);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const rawEnvValue = process.env[EMAIL_BLACKLIST_ENV_VAR];
|
|
22
|
+
if (!rawEnvValue) {
|
|
23
|
+
return emails;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
for (const part of rawEnvValue.split(/[,\n]/)) {
|
|
27
|
+
const normalized = normalizeEmailAddress(part);
|
|
28
|
+
if (normalized) {
|
|
29
|
+
emails.add(normalized);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return emails;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function isBlacklistedEmail(email?: string | null): boolean {
|
|
37
|
+
const normalized = normalizeEmailAddress(email);
|
|
38
|
+
if (!normalized) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
return getBlacklistedEmails().has(normalized);
|
|
42
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Guards for env-derived secrets that are sent as HTTP header values.
|
|
3
|
+
*
|
|
4
|
+
* fetch() validates header values and throws an error that can echo the raw
|
|
5
|
+
* value when it contains a forbidden byte. Validate at the env-read site so
|
|
6
|
+
* secrets never leak into error envelopes or logs.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// The set fetch() accepts for header values: HTAB, printable ASCII, and
|
|
10
|
+
// obs-text (0x80-0xFF). NUL/CR/LF and other C0 controls are rejected by the
|
|
11
|
+
// runtime, and characters above U+00FF fail ByteString conversion outright.
|
|
12
|
+
const HEADER_UNSAFE_CHAR_PATTERN = /[^\t\u0020-\u007e\u0080-\u00ff]/;
|
|
13
|
+
|
|
14
|
+
export function isHeaderSafeValue(value: string): boolean {
|
|
15
|
+
return !HEADER_UNSAFE_CHAR_PATTERN.test(value);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Returns `value` unchanged when it is safe to send as an HTTP header value.
|
|
20
|
+
* Otherwise throws an error that names `envVar` and never echoes the value.
|
|
21
|
+
*/
|
|
22
|
+
export function assertHeaderSafeEnvValue(input: {
|
|
23
|
+
envVar: string;
|
|
24
|
+
value: string;
|
|
25
|
+
}): string {
|
|
26
|
+
if (!isHeaderSafeValue(input.value)) {
|
|
27
|
+
throw new Error(
|
|
28
|
+
`Environment variable ${input.envVar} contains a character that is invalid in an HTTP header value ` +
|
|
29
|
+
`(typically an embedded newline from a multi-line paste). ` +
|
|
30
|
+
`Re-set ${input.envVar} as a single-line value. ` +
|
|
31
|
+
`The raw value is not echoed to avoid leaking a secret.`,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return input.value;
|
|
35
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export const INTERNAL_EMAIL_DOMAINS = ['getaero.io', 'deepline.com'] as const;
|
|
2
|
+
const LOCAL_DEVELOPMENT_PLATFORM_ADMIN_EMAIL = 'local-dev@deepline.local';
|
|
3
|
+
|
|
4
|
+
export function normalizeInternalEmail(email?: string | null): string | null {
|
|
5
|
+
const normalized = String(email ?? '')
|
|
6
|
+
.trim()
|
|
7
|
+
.toLowerCase();
|
|
8
|
+
return normalized || null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function isInternalEmail(email?: string | null): boolean {
|
|
12
|
+
const normalized = normalizeInternalEmail(email);
|
|
13
|
+
if (!normalized) return false;
|
|
14
|
+
if (
|
|
15
|
+
process.env.NODE_ENV === 'development' &&
|
|
16
|
+
normalized === LOCAL_DEVELOPMENT_PLATFORM_ADMIN_EMAIL
|
|
17
|
+
) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
const atIndex = normalized.lastIndexOf('@');
|
|
21
|
+
if (atIndex === -1) return false;
|
|
22
|
+
const domain = normalized.slice(atIndex + 1);
|
|
23
|
+
return INTERNAL_EMAIL_DOMAINS.includes(
|
|
24
|
+
domain as (typeof INTERNAL_EMAIL_DOMAINS)[number],
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Actors allowed to request provider fixtures against the production API. */
|
|
29
|
+
export function isAuthorizedProductionFixtureActor(
|
|
30
|
+
email?: string | null,
|
|
31
|
+
): boolean {
|
|
32
|
+
const normalized = normalizeInternalEmail(email);
|
|
33
|
+
return (
|
|
34
|
+
isInternalEmail(normalized) ||
|
|
35
|
+
/^bootstrap-[0-9a-f]{8}@deepline\.local$/i.test(normalized ?? '')
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Whether an email belongs to a Deepline staff account. */
|
|
40
|
+
export function isDeeplineUser(email?: string | null): boolean {
|
|
41
|
+
return isInternalEmail(email);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function isDeeplineInternalEmail(email?: string | null): boolean {
|
|
45
|
+
const normalized = normalizeInternalEmail(email);
|
|
46
|
+
if (!normalized) return false;
|
|
47
|
+
const atIndex = normalized.lastIndexOf('@');
|
|
48
|
+
if (atIndex === -1) return false;
|
|
49
|
+
return normalized.slice(atIndex + 1) === 'deepline.com';
|
|
50
|
+
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
const REDACTED_VALUE = '[REDACTED]';
|
|
2
|
+
|
|
3
|
+
type SecretRedactionOptions = {
|
|
4
|
+
redactHighEntropy?: boolean;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const SENSITIVE_KEY_PATTERNS = [
|
|
8
|
+
/^api[-_]?key$/i,
|
|
9
|
+
/^x[-_]?api[-_]?key$/i,
|
|
10
|
+
/secret/i,
|
|
11
|
+
/token/i,
|
|
12
|
+
/password/i,
|
|
13
|
+
/authorization/i,
|
|
14
|
+
/cookie/i,
|
|
15
|
+
/credential/i,
|
|
16
|
+
/private/i,
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const SAFE_IDENTIFIER_KEYS = new Set([
|
|
20
|
+
'artifactHash',
|
|
21
|
+
'artifactHashes',
|
|
22
|
+
'artifact_hash',
|
|
23
|
+
'artifact_hashes',
|
|
24
|
+
'graphHash',
|
|
25
|
+
'graph_hash',
|
|
26
|
+
'hash',
|
|
27
|
+
'idempotencyKey',
|
|
28
|
+
'idempotency_key',
|
|
29
|
+
'key',
|
|
30
|
+
'session',
|
|
31
|
+
'sessionId',
|
|
32
|
+
'session_id',
|
|
33
|
+
'sessionIds',
|
|
34
|
+
'session_ids',
|
|
35
|
+
'promptId',
|
|
36
|
+
'prompt_id',
|
|
37
|
+
'requestId',
|
|
38
|
+
'request_id',
|
|
39
|
+
'upload_id',
|
|
40
|
+
// Durable-call runtime identity fields. These are non-secret
|
|
41
|
+
// `ctx:<org>:call:tool:<tool>:<hash>` receipt/idempotency keys (and their
|
|
42
|
+
// `:force:<lease>` / `:ordered:<hash>` variants) surfaced on tool-result
|
|
43
|
+
// `_metadata.execution` and echoed provider idempotency metadata.
|
|
44
|
+
// Explicit-secret patterns below still redact real secrets that ever appear
|
|
45
|
+
// under these keys.
|
|
46
|
+
'receiptKey',
|
|
47
|
+
'receipt_key',
|
|
48
|
+
'attachedToReceiptKey',
|
|
49
|
+
'attached_to_receipt_key',
|
|
50
|
+
'durableCallReceiptKey',
|
|
51
|
+
'durable_call_receipt_key',
|
|
52
|
+
'providerIdempotencyKey',
|
|
53
|
+
'provider_idempotency_key',
|
|
54
|
+
'cacheKey',
|
|
55
|
+
'cache_key',
|
|
56
|
+
// Non-secret run-output identifiers.
|
|
57
|
+
'targetTable',
|
|
58
|
+
'target_table',
|
|
59
|
+
'tableNamespace',
|
|
60
|
+
'table_namespace',
|
|
61
|
+
'queryId',
|
|
62
|
+
'query_id',
|
|
63
|
+
'queryIds',
|
|
64
|
+
'query_ids',
|
|
65
|
+
'snowflakeQueryId',
|
|
66
|
+
'snowflake_query_id',
|
|
67
|
+
'snowflakeQueryIds',
|
|
68
|
+
'snowflake_query_ids',
|
|
69
|
+
]);
|
|
70
|
+
|
|
71
|
+
const EXPLICIT_SECRET_VALUE_PATTERNS = [
|
|
72
|
+
/\bnapi_[a-z0-9]{20,}\b/i,
|
|
73
|
+
/\bgh[opsu]_[A-Za-z0-9_]{20,}\b/,
|
|
74
|
+
/\bwhsec_[a-z0-9]+\b/i,
|
|
75
|
+
/\bsk-proj-[A-Za-z0-9_-]{20,}\b/,
|
|
76
|
+
/\bxox[baprs]-[A-Za-z0-9-]{20,}\b/i,
|
|
77
|
+
/\b(sk|rk)_(live|test)_[a-z0-9]+\b/i,
|
|
78
|
+
/\bpostgres(?:ql)?:\/\/[^\s'"]+/i,
|
|
79
|
+
/\bhttps?:\/\/[^/\s'"]+:[^@\s'"]+@[^/\s'"]+/i,
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
const HIGH_ENTROPY_VALUE_PATTERN = /\b[A-Za-z0-9+/=_-]{32,}\b/g;
|
|
83
|
+
// A public hostname can legitimately contain a generated label longer than the
|
|
84
|
+
// high-entropy threshold (for example, a per-run probe hostname). Preserve the
|
|
85
|
+
// complete hostname after known secret formats have already been checked.
|
|
86
|
+
const PUBLIC_DNS_NAME_PATTERN =
|
|
87
|
+
/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}\.?$/i;
|
|
88
|
+
const SENSITIVE_URL_PARAM_KEY_PATTERN =
|
|
89
|
+
/(?:api[-_]?key|x[-_]?api[-_]?key|token|access[-_]?token|refresh[-_]?token|secret|password|authorization|credential|signature|sig)/i;
|
|
90
|
+
const BEARER_SECRET_PATTERN = /\b(Bearer)\s+[A-Za-z0-9._~+/=-]{8,}/gi;
|
|
91
|
+
const ASSIGNMENT_SECRET_PATTERN =
|
|
92
|
+
/\b(access[-_]?token|refresh[-_]?token|token|x[-_\s]?api[-_\s]?key|api[-_\s]?key|apikey|password|secret|session)\b(\s*[:=]\s*)[^\s'",;)}\]]+/gi;
|
|
93
|
+
const AUTH_ASSIGNMENT_SECRET_PATTERN =
|
|
94
|
+
/\b(auth(?:orization)?)\b(\s*[:=]\s*)(?!Bearer\b)(?:[A-Za-z]+\s+)?[^\s'",;)}\]]+/gi;
|
|
95
|
+
const SENSITIVE_URL_PARAM_VALUE_PATTERN =
|
|
96
|
+
/([?&#](?:api[-_]?key|x[-_]?api[-_]?key|token|access[-_]?token|refresh[-_]?token|secret|password|authorization|credential|signature|sig)=)[^&#\s'"]+/gi;
|
|
97
|
+
|
|
98
|
+
function inspectStandalonePublicHttpUrl(
|
|
99
|
+
value: string,
|
|
100
|
+
): 'safe' | 'sensitive' | null {
|
|
101
|
+
const trimmed = value.trim();
|
|
102
|
+
if (!trimmed || /\s/.test(trimmed)) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
let url: URL;
|
|
107
|
+
try {
|
|
108
|
+
url = new URL(trimmed);
|
|
109
|
+
} catch {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (url.protocol !== 'http:' && url.protocol !== 'https:') {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
if (url.username || url.password) {
|
|
117
|
+
return 'sensitive';
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
for (const key of url.searchParams.keys()) {
|
|
121
|
+
if (SENSITIVE_URL_PARAM_KEY_PATTERN.test(key)) {
|
|
122
|
+
return 'sensitive';
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (url.hash && SENSITIVE_URL_PARAM_KEY_PATTERN.test(url.hash)) {
|
|
126
|
+
return 'sensitive';
|
|
127
|
+
}
|
|
128
|
+
return 'safe';
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function shouldRedactKey(key: string) {
|
|
132
|
+
if (SAFE_IDENTIFIER_KEYS.has(key)) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
return SENSITIVE_KEY_PATTERNS.some((pattern) => pattern.test(key));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function maybeRedactString(value: string, options: SecretRedactionOptions) {
|
|
139
|
+
if (EXPLICIT_SECRET_VALUE_PATTERNS.some((pattern) => pattern.test(value))) {
|
|
140
|
+
return REDACTED_VALUE;
|
|
141
|
+
}
|
|
142
|
+
const publicHttpUrl = inspectStandalonePublicHttpUrl(value);
|
|
143
|
+
if (publicHttpUrl === 'sensitive') {
|
|
144
|
+
return REDACTED_VALUE;
|
|
145
|
+
}
|
|
146
|
+
if (publicHttpUrl === 'safe') {
|
|
147
|
+
return value;
|
|
148
|
+
}
|
|
149
|
+
if (PUBLIC_DNS_NAME_PATTERN.test(value.trim())) {
|
|
150
|
+
return value;
|
|
151
|
+
}
|
|
152
|
+
const redacted = value
|
|
153
|
+
.replace(BEARER_SECRET_PATTERN, `$1 ${REDACTED_VALUE}`)
|
|
154
|
+
.replace(AUTH_ASSIGNMENT_SECRET_PATTERN, `$1$2${REDACTED_VALUE}`)
|
|
155
|
+
.replace(ASSIGNMENT_SECRET_PATTERN, `$1$2${REDACTED_VALUE}`)
|
|
156
|
+
.replace(SENSITIVE_URL_PARAM_VALUE_PATTERN, `$1${REDACTED_VALUE}`);
|
|
157
|
+
return options.redactHighEntropy === false
|
|
158
|
+
? redacted
|
|
159
|
+
: redacted.replace(HIGH_ENTROPY_VALUE_PATTERN, REDACTED_VALUE);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function redactSecretsInValue<T>(
|
|
163
|
+
value: T,
|
|
164
|
+
parentKey?: string,
|
|
165
|
+
options: SecretRedactionOptions = {},
|
|
166
|
+
): T {
|
|
167
|
+
if (typeof value === 'string') {
|
|
168
|
+
if (EXPLICIT_SECRET_VALUE_PATTERNS.some((pattern) => pattern.test(value))) {
|
|
169
|
+
return REDACTED_VALUE as T;
|
|
170
|
+
}
|
|
171
|
+
if (parentKey && SAFE_IDENTIFIER_KEYS.has(parentKey)) {
|
|
172
|
+
return value as T;
|
|
173
|
+
}
|
|
174
|
+
if (parentKey && shouldRedactKey(parentKey)) {
|
|
175
|
+
return REDACTED_VALUE as T;
|
|
176
|
+
}
|
|
177
|
+
return maybeRedactString(value, options) as T;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (!value || typeof value !== 'object') return value;
|
|
181
|
+
|
|
182
|
+
type Container = unknown[] | Record<string, unknown>;
|
|
183
|
+
const root: Container = Array.isArray(value) ? [] : {};
|
|
184
|
+
const pending: Array<{
|
|
185
|
+
source: Container;
|
|
186
|
+
target: Container;
|
|
187
|
+
parentKey?: string;
|
|
188
|
+
}> = [{ source: value as Container, target: root, parentKey }];
|
|
189
|
+
|
|
190
|
+
const redactNestedValue = (
|
|
191
|
+
item: unknown,
|
|
192
|
+
itemParentKey: string | undefined,
|
|
193
|
+
): unknown => {
|
|
194
|
+
if (typeof item !== 'string') return item;
|
|
195
|
+
if (EXPLICIT_SECRET_VALUE_PATTERNS.some((pattern) => pattern.test(item))) {
|
|
196
|
+
return REDACTED_VALUE;
|
|
197
|
+
}
|
|
198
|
+
if (itemParentKey && SAFE_IDENTIFIER_KEYS.has(itemParentKey)) return item;
|
|
199
|
+
if (itemParentKey && shouldRedactKey(itemParentKey)) return REDACTED_VALUE;
|
|
200
|
+
return maybeRedactString(item, options);
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
while (pending.length > 0) {
|
|
204
|
+
const current = pending.pop();
|
|
205
|
+
if (!current) break;
|
|
206
|
+
const sourceIsArray = Array.isArray(current.source);
|
|
207
|
+
for (const [key, item] of Object.entries(current.source)) {
|
|
208
|
+
const itemParentKey = sourceIsArray ? current.parentKey : key;
|
|
209
|
+
if (!sourceIsArray && shouldRedactKey(key)) {
|
|
210
|
+
(current.target as Record<string, unknown>)[key] = REDACTED_VALUE;
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
if (item && typeof item === 'object') {
|
|
214
|
+
const nestedTarget: Container = Array.isArray(item) ? [] : {};
|
|
215
|
+
(current.target as Record<string, unknown>)[key] = nestedTarget;
|
|
216
|
+
pending.push({
|
|
217
|
+
source: item as Container,
|
|
218
|
+
target: nestedTarget,
|
|
219
|
+
parentKey: itemParentKey,
|
|
220
|
+
});
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
(current.target as Record<string, unknown>)[key] = redactNestedValue(
|
|
224
|
+
item,
|
|
225
|
+
itemParentKey,
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return root as T;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Redaction for customer-authored inputs and outputs. Preserve arbitrary
|
|
235
|
+
* identifiers while still removing explicit credential formats, sensitive
|
|
236
|
+
* keys, authorization values, and credential-bearing URLs.
|
|
237
|
+
*/
|
|
238
|
+
export function redactSecretsInCustomerValue<T>(
|
|
239
|
+
value: T,
|
|
240
|
+
parentKey?: string,
|
|
241
|
+
): T {
|
|
242
|
+
return redactSecretsInValue(value, parentKey, { redactHighEntropy: false });
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export function redactSecretsInJsonText(
|
|
246
|
+
text: string,
|
|
247
|
+
options: SecretRedactionOptions = {},
|
|
248
|
+
) {
|
|
249
|
+
try {
|
|
250
|
+
const parsed = JSON.parse(text) as unknown;
|
|
251
|
+
return JSON.stringify(
|
|
252
|
+
redactSecretsInValue(parsed, undefined, options),
|
|
253
|
+
null,
|
|
254
|
+
2,
|
|
255
|
+
);
|
|
256
|
+
} catch {
|
|
257
|
+
let redacted = text;
|
|
258
|
+
for (const pattern of EXPLICIT_SECRET_VALUE_PATTERNS) {
|
|
259
|
+
redacted = redacted.replace(pattern, REDACTED_VALUE);
|
|
260
|
+
}
|
|
261
|
+
return maybeRedactString(redacted, options);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export function redactSecretsInCustomerJsonText(text: string) {
|
|
266
|
+
return redactSecretsInJsonText(text, { redactHighEntropy: false });
|
|
267
|
+
}
|