deepline 0.3.49 → 0.3.51

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.
Files changed (31) hide show
  1. package/dist/bundling-sources/sdk/src/index.ts +1 -0
  2. package/dist/bundling-sources/sdk/src/play.ts +1 -0
  3. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  4. package/dist/bundling-sources/sdk/src/types.ts +2 -0
  5. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +1 -0
  6. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +106 -89
  7. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +0 -2
  8. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +52 -21
  9. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +45 -5
  10. package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +11 -3
  11. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +0 -2
  12. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +11 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/secret-capability.ts +5 -1
  14. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +1 -14
  15. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/contract.ts +17 -7
  16. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/index.ts +0 -1
  17. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +112 -5
  18. package/dist/bundling-sources/shared_libs/security/safe-fetch.ts +6 -1
  19. package/dist/cli/index.js +837 -3147
  20. package/dist/cli/index.mjs +704 -3010
  21. package/dist/{compiler-manifest-CbzdZrJj.d.mts → compiler-manifest-B47AA7As.d.mts} +46 -4
  22. package/dist/{compiler-manifest-CbzdZrJj.d.ts → compiler-manifest-B47AA7As.d.ts} +46 -4
  23. package/dist/index.d.mts +151 -149
  24. package/dist/index.d.ts +151 -149
  25. package/dist/index.js +1515 -117
  26. package/dist/index.mjs +1514 -117
  27. package/dist/install-integrity.json +2 -2
  28. package/dist/plays/bundle-play-file.d.mts +2 -2
  29. package/dist/plays/bundle-play-file.d.ts +2 -2
  30. package/dist/plays/bundle-play-file.mjs +5 -2614
  31. package/package.json +2 -1
package/dist/index.mjs CHANGED
@@ -738,7 +738,7 @@ var SDK_RELEASE = {
738
738
  // available at toolResponse.rawV2 while toolResponse.raw and all declared
739
739
  // getters keep their established compatibility behavior.
740
740
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
741
- version: "0.3.49",
741
+ version: "0.3.51",
742
742
  updateSummary: "Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.",
743
743
  packageCapabilities: {
744
744
  updatePreferences: 1
@@ -6729,122 +6729,6 @@ var DeeplineClient = class {
6729
6729
  }
6730
6730
  };
6731
6731
 
6732
- // src/monitors.ts
6733
- function defineMonitor(definition) {
6734
- if (!definition || typeof definition !== "object") {
6735
- throw new Error("defineMonitor(definition) requires a definition object.");
6736
- }
6737
- const key = typeof definition.key === "string" ? definition.key.trim() : "";
6738
- if (!key) {
6739
- throw new Error('defineMonitor(definition) requires a non-empty "key".');
6740
- }
6741
- const tool = typeof definition.tool === "string" ? definition.tool.trim() : "";
6742
- if (!tool) {
6743
- throw new Error(
6744
- 'defineMonitor(definition) requires a non-empty monitor tool id in "tool" (e.g. "deepline_native.company_radar").'
6745
- );
6746
- }
6747
- if (!definition.payload || typeof definition.payload !== "object" || Array.isArray(definition.payload)) {
6748
- throw new Error(
6749
- 'defineMonitor(definition) requires "payload" to be a JSON object.'
6750
- );
6751
- }
6752
- if (definition.name !== void 0 && typeof definition.name !== "string") {
6753
- throw new Error('defineMonitor(definition) "name" must be a string.');
6754
- }
6755
- if (definition.controls !== void 0 && (typeof definition.controls !== "object" || Array.isArray(definition.controls))) {
6756
- throw new Error(
6757
- 'defineMonitor(definition) "controls" must be a JSON object.'
6758
- );
6759
- }
6760
- return definition;
6761
- }
6762
-
6763
- // ../plays/bootstrap-routes.ts
6764
- var DEEPLINE_TOOL_CATEGORIES = [
6765
- "company_search",
6766
- "people_search",
6767
- "people_enrich",
6768
- "email_finder",
6769
- "email_verify",
6770
- "phone_finder",
6771
- "phone_verify",
6772
- "identity_resolution",
6773
- "reverse_lookup",
6774
- "enrichment",
6775
- "batch",
6776
- "premium",
6777
- "free"
6778
- ];
6779
- var PLAY_BOOTSTRAP_TEMPLATES = [
6780
- "people-list",
6781
- "company-list",
6782
- "people-email",
6783
- "people-phone",
6784
- "company-people",
6785
- "company-people-email",
6786
- "company-people-phone"
6787
- ];
6788
- var PLAY_BOOTSTRAP_SOURCE_KINDS = [
6789
- "csv",
6790
- "play",
6791
- "provider",
6792
- "providers"
6793
- ];
6794
- var PLAY_BOOTSTRAP_STAGE_KINDS = [
6795
- "play",
6796
- "provider",
6797
- "providers"
6798
- ];
6799
- var PLAY_BOOTSTRAP_FINDER_KINDS = [
6800
- "email_finder",
6801
- "phone_finder"
6802
- ];
6803
- var PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY = "company_search";
6804
- var PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY = "people_search";
6805
- var PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER = {
6806
- email_finder: "email_finder",
6807
- phone_finder: "phone_finder"
6808
- };
6809
- var PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER = {
6810
- email_finder: "email",
6811
- phone_finder: "phone"
6812
- };
6813
- var PLAY_BOOTSTRAP_CONTACT_FIELDS = [
6814
- "first_name",
6815
- "last_name",
6816
- "domain",
6817
- "company_name",
6818
- "linkedin_url",
6819
- "title",
6820
- "email",
6821
- "phone"
6822
- ];
6823
- var PLAY_BOOTSTRAP_COMPANY_FIELDS = [
6824
- "domain",
6825
- "company_domain",
6826
- "company_name",
6827
- "linkedin_url",
6828
- "website"
6829
- ];
6830
- function isPlayBootstrapFinderKind(value) {
6831
- return PLAY_BOOTSTRAP_FINDER_KINDS.includes(value);
6832
- }
6833
- function isPlayBootstrapTemplate(value) {
6834
- return PLAY_BOOTSTRAP_TEMPLATES.includes(value);
6835
- }
6836
- function formatPlayBootstrapFinderKinds() {
6837
- return PLAY_BOOTSTRAP_FINDER_KINDS.join("|");
6838
- }
6839
- function formatPlayBootstrapTemplates() {
6840
- return PLAY_BOOTSTRAP_TEMPLATES.join("|");
6841
- }
6842
- function formatPlayBootstrapFinderKindsForSentence() {
6843
- const allButLast = PLAY_BOOTSTRAP_FINDER_KINDS.slice(0, -1);
6844
- const last = PLAY_BOOTSTRAP_FINDER_KINDS.at(-1);
6845
- return `${allButLast.join(", ")} or ${last}`;
6846
- }
6847
-
6848
6732
  // ../plays/email-status.ts
6849
6733
  function normalizeKey(value) {
6850
6734
  if (value == null) return null;
@@ -8301,6 +8185,1402 @@ function replaceAtPath(root, path, replacement) {
8301
8185
  return replace(root, 0);
8302
8186
  }
8303
8187
 
8188
+ // ../plays/authoring-contract.ts
8189
+ import { Type } from "@sinclair/typebox";
8190
+ import { Value } from "@sinclair/typebox/value";
8191
+ var PLAY_SQL_LISTENER_WHERE_OPERATORS = [
8192
+ "eq",
8193
+ "neq",
8194
+ "in",
8195
+ "notIn",
8196
+ "isNull",
8197
+ "isNotNull",
8198
+ "ilike"
8199
+ ];
8200
+ var PLAY_SQL_LISTENER_ID_PATTERN = /^[a-zA-Z][a-zA-Z0-9_-]*$/;
8201
+ var PLAY_SQL_LISTENER_TOOL_PATTERN = /^[a-zA-Z][a-zA-Z0-9_-]*\.[a-zA-Z][a-zA-Z0-9_-]*$/;
8202
+ var PLAY_SQL_LISTENER_WHERE_OPERATOR_SET = new Set(
8203
+ PLAY_SQL_LISTENER_WHERE_OPERATORS
8204
+ );
8205
+ var CtxFetchHttpError = class extends Error {
8206
+ /** Build the error from the durable response record. */
8207
+ constructor(response) {
8208
+ const body = response.bodyText || "empty response body";
8209
+ super(
8210
+ `ctx.fetch(${response.url}) returned HTTP ${response.status}${response.statusText ? ` ${response.statusText}` : ""}: ${body}`
8211
+ );
8212
+ this.response = response;
8213
+ this.name = "CtxFetchHttpError";
8214
+ this.status = response.status;
8215
+ this.statusText = response.statusText;
8216
+ this.url = response.url;
8217
+ this.headers = response.headers;
8218
+ this.bodyText = response.bodyText;
8219
+ this.json = response.json;
8220
+ }
8221
+ /**
8222
+ * Play source and the runtime are separately bundled. Recognize the stable
8223
+ * public error code so `instanceof` works across that boundary as well.
8224
+ */
8225
+ static [Symbol.hasInstance](value) {
8226
+ return value !== null && typeof value === "object" && value.code === "CTX_FETCH_HTTP_ERROR";
8227
+ }
8228
+ /** Stable machine-readable HTTP-failure code. */
8229
+ code = "CTX_FETCH_HTTP_ERROR";
8230
+ /** Upstream HTTP status. */
8231
+ status;
8232
+ /** Upstream HTTP status text. */
8233
+ statusText;
8234
+ /** Final response URL after redirects. */
8235
+ url;
8236
+ /** Secret-redacted response headers. */
8237
+ headers;
8238
+ /** Complete secret-redacted response body. */
8239
+ bodyText;
8240
+ /** Eagerly parsed secret-redacted JSON, or null. */
8241
+ json;
8242
+ };
8243
+ var PLAY_AUTHORING_DOCUMENTATION = {
8244
+ fetchBatching: {
8245
+ warning: "A static ctx.fetch key inside a loop is a warning because every iteration must still have distinct method, URL, body, or safe headers. One durable receipt must never stand in for every request.",
8246
+ guidance: "Keep the static fetch label. For a mutating batch, make the body distinct and use a replay-stable external Idempotency-Key such as `${ctx.run.id}:signals:${batchIndex}`."
8247
+ },
8248
+ runId: {
8249
+ semantics: "ctx.run.id is stable while Deepline retries or resumes one durable run. A separately submitted run receives a new id.",
8250
+ use: "Use it when deriving an external idempotency key for a sequence of batches."
8251
+ },
8252
+ staticCallKeys: {
8253
+ constraint: "Durable call keys \u2014 the ctx.fetch key, the ctx.dataset key, the ctx.step id \u2014 must be static string literals. The key names a durable receipt, so check, publish, and replay have to agree on it before the body runs. A key computed at runtime cannot be resolved at check time and is rejected.",
8254
+ consequence: "This is an architectural constraint, not a style rule. A play cannot loop over a computed key, so it cannot page a large table with a helper like page(pageNumber). Unrolling one literal key per page is not a design at any real page count.",
8255
+ workaround: "Push the aggregation server-side and call it once: a SQL function, a view, or a provider endpoint that returns the whole result. Keep unrolled literal keys only for a handful of genuinely distinct calls. To fan out over rows, use ctx.dataset with a static key \u2014 the per-row receipt identity comes from the row, not from the key."
8256
+ }
8257
+ };
8258
+ var PLAY_AUTHORING_STATIC_FETCH_KEY_HINT = `${PLAY_AUTHORING_DOCUMENTATION.staticCallKeys.workaround} Do not compute the key.`;
8259
+ var SecretEnvironmentNameSchema = Type.String({
8260
+ pattern: "^[A-Z][A-Z0-9_]{1,63}$",
8261
+ description: "An uppercase environment variable name beginning with a letter."
8262
+ });
8263
+ var SqlListenerFilterScalarSchema = Type.Union([
8264
+ Type.String(),
8265
+ Type.Number(),
8266
+ Type.Boolean(),
8267
+ Type.Null()
8268
+ ]);
8269
+ var PLAY_AUTHORING_FIELD_REGISTRY = {
8270
+ description: {
8271
+ schema: Type.String({ minLength: 1 }),
8272
+ fixtures: {
8273
+ valid: "Enrich a company.",
8274
+ invalid: "",
8275
+ absent: void 0,
8276
+ unresolved: { expression: "description" },
8277
+ edition1: "Legacy play."
8278
+ },
8279
+ referenceType: "string",
8280
+ required: false,
8281
+ resolution: "static-required",
8282
+ issueCode: "play_authoring_binding_invalid",
8283
+ description: "Optional non-empty human-readable summary of the Play.",
8284
+ errorMessage: "description must be a non-empty static string."
8285
+ },
8286
+ "compatibility.toolErrorSchemaVersion": {
8287
+ schema: Type.Union([Type.Literal(0), Type.Literal(1)]),
8288
+ fixtures: {
8289
+ valid: 1,
8290
+ invalid: 2,
8291
+ absent: void 0,
8292
+ unresolved: { expression: "version" },
8293
+ edition1: 0
8294
+ },
8295
+ referenceType: "0 | 1",
8296
+ required: false,
8297
+ resolution: "static-required",
8298
+ issueCode: "play_authoring_binding_invalid",
8299
+ description: "Artifact-pinned tool error behavior, either 0 or 1.",
8300
+ errorMessage: "compatibility.toolErrorSchemaVersion must be the static literal 0 or 1."
8301
+ },
8302
+ "compatibility.toolResponseReceiptRevision": {
8303
+ schema: Type.String({
8304
+ minLength: 1,
8305
+ maxLength: 64,
8306
+ pattern: "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$"
8307
+ }),
8308
+ fixtures: {
8309
+ valid: "raw-v2-receipt-v1",
8310
+ invalid: "has spaces",
8311
+ absent: void 0,
8312
+ unresolved: { expression: "revision" },
8313
+ edition1: void 0
8314
+ },
8315
+ referenceType: "string",
8316
+ required: false,
8317
+ resolution: "static-required",
8318
+ issueCode: "play_authoring_binding_invalid",
8319
+ description: "Explicit durable-receipt revision for a response transformation; bump only when serialized tool output changes.",
8320
+ errorMessage: "compatibility.toolResponseReceiptRevision must be a non-empty static identifier using letters, numbers, dots, underscores, or hyphens."
8321
+ },
8322
+ inline: {
8323
+ schema: Type.Boolean(),
8324
+ fixtures: {
8325
+ valid: true,
8326
+ invalid: "true",
8327
+ absent: void 0,
8328
+ unresolved: { expression: "inline" },
8329
+ edition1: false
8330
+ },
8331
+ referenceType: "boolean",
8332
+ required: false,
8333
+ resolution: "static-required",
8334
+ issueCode: "play_authoring_binding_invalid",
8335
+ description: "Compiler hint for an inline named Play handler.",
8336
+ errorMessage: "inline must be a static boolean."
8337
+ },
8338
+ "billing.maxCreditsPerRun": {
8339
+ schema: Type.Number({ exclusiveMinimum: 0 }),
8340
+ fixtures: {
8341
+ valid: 1,
8342
+ invalid: 0,
8343
+ absent: void 0,
8344
+ unresolved: { expression: "cap" },
8345
+ edition1: 1
8346
+ },
8347
+ referenceType: "number",
8348
+ required: false,
8349
+ resolution: "static-required",
8350
+ issueCode: "play_authoring_billing_limit_invalid",
8351
+ description: "Maximum Deepline credits permitted for one Play Run.",
8352
+ errorMessage: "billing.maxCreditsPerRun must be a static number greater than 0. Remove it for no run cap."
8353
+ },
8354
+ "bindings.webhook.hmac.secretEnv": {
8355
+ schema: SecretEnvironmentNameSchema,
8356
+ fixtures: {
8357
+ valid: "WEBHOOK_SECRET",
8358
+ invalid: "webhook_secret",
8359
+ absent: void 0,
8360
+ unresolved: { expression: "secretEnv" },
8361
+ edition1: "WEBHOOK_SECRET"
8362
+ },
8363
+ referenceType: "string",
8364
+ required: true,
8365
+ resolution: "static-required",
8366
+ issueCode: "play_authoring_webhook_hmac_invalid",
8367
+ description: "Environment variable containing the webhook HMAC secret.",
8368
+ errorMessage: "bindings.webhook.hmac.secretEnv must be an uppercase environment variable name beginning with a letter."
8369
+ },
8370
+ "bindings.webhook.hmac.algorithm": {
8371
+ schema: Type.Literal("sha256"),
8372
+ fixtures: {
8373
+ valid: "sha256",
8374
+ invalid: "sha1",
8375
+ absent: void 0,
8376
+ unresolved: { expression: "algorithm" },
8377
+ edition1: "sha256"
8378
+ },
8379
+ referenceType: "'sha256'",
8380
+ required: false,
8381
+ resolution: "static-required",
8382
+ issueCode: "play_authoring_webhook_hmac_invalid",
8383
+ description: "Webhook signature hash algorithm. Only sha256 is supported.",
8384
+ errorMessage: 'bindings.webhook.hmac.algorithm must be the static literal "sha256".'
8385
+ },
8386
+ "bindings.webhook.hmac.header": {
8387
+ schema: Type.String({ minLength: 1 }),
8388
+ fixtures: {
8389
+ valid: "x-signature",
8390
+ invalid: "",
8391
+ absent: void 0,
8392
+ unresolved: { expression: "header" },
8393
+ edition1: "x-signature"
8394
+ },
8395
+ referenceType: "string",
8396
+ required: false,
8397
+ resolution: "static-required",
8398
+ issueCode: "play_authoring_webhook_hmac_invalid",
8399
+ description: "HTTP header containing the webhook signature.",
8400
+ errorMessage: "bindings.webhook.hmac.header must be a non-empty static string."
8401
+ },
8402
+ "bindings.webhook.auth.type": {
8403
+ schema: Type.Literal("standard-webhooks"),
8404
+ fixtures: {
8405
+ valid: "standard-webhooks",
8406
+ invalid: "svix",
8407
+ absent: void 0,
8408
+ unresolved: { expression: "type" },
8409
+ edition1: void 0
8410
+ },
8411
+ referenceType: "'standard-webhooks'",
8412
+ // auth itself is optional; once present, the AST adapter requires this
8413
+ // field together with headerFamily and signingSecrets.
8414
+ required: false,
8415
+ resolution: "static-required",
8416
+ issueCode: "play_authoring_standard_webhooks_invalid",
8417
+ description: "Uses the Standard Webhooks v1 symmetric signing scheme.",
8418
+ errorMessage: 'bindings.webhook.auth.type must be the static literal "standard-webhooks".'
8419
+ },
8420
+ "bindings.webhook.auth.headerFamily": {
8421
+ schema: Type.Union([Type.Literal("standard"), Type.Literal("svix")]),
8422
+ fixtures: {
8423
+ valid: "svix",
8424
+ invalid: "webhook",
8425
+ absent: void 0,
8426
+ unresolved: { expression: "headerFamily" },
8427
+ edition1: void 0
8428
+ },
8429
+ referenceType: "'standard' | 'svix'",
8430
+ // auth itself is optional; once present, the AST adapter requires this
8431
+ // field together with type and signingSecrets.
8432
+ required: false,
8433
+ resolution: "static-required",
8434
+ issueCode: "play_authoring_standard_webhooks_invalid",
8435
+ description: "Header namespace expected from the webhook provider.",
8436
+ errorMessage: 'bindings.webhook.auth.headerFamily must be the static literal "standard" or "svix".'
8437
+ },
8438
+ "bindings.webhook.auth.signingSecrets[]": {
8439
+ schema: SecretEnvironmentNameSchema,
8440
+ fixtures: {
8441
+ valid: "VECTOR_WEBHOOK_SECRET",
8442
+ invalid: "vector_webhook_secret",
8443
+ absent: void 0,
8444
+ unresolved: { expression: "secret" },
8445
+ edition1: void 0
8446
+ },
8447
+ referenceType: "string",
8448
+ // auth itself is optional; once present, the AST adapter requires this
8449
+ // field together with type and headerFamily.
8450
+ required: false,
8451
+ resolution: "static-required",
8452
+ issueCode: "play_authoring_standard_webhooks_invalid",
8453
+ description: "Deepline Secret name used to verify Standard Webhooks.",
8454
+ errorMessage: "bindings.webhook.auth.signingSecrets entries must be uppercase Deepline Secret names beginning with a letter."
8455
+ },
8456
+ "bindings.webhook.auth.toleranceSeconds": {
8457
+ schema: Type.Integer({ minimum: 1, maximum: 3600 }),
8458
+ fixtures: {
8459
+ valid: 300,
8460
+ invalid: 0,
8461
+ absent: void 0,
8462
+ unresolved: { expression: "toleranceSeconds" },
8463
+ edition1: void 0
8464
+ },
8465
+ referenceType: "number",
8466
+ required: false,
8467
+ resolution: "static-required",
8468
+ issueCode: "play_authoring_standard_webhooks_invalid",
8469
+ description: "Accepted delivery timestamp skew in seconds, from 1 through 3600.",
8470
+ errorMessage: "bindings.webhook.auth.toleranceSeconds must be a static whole number from 1 through 3600."
8471
+ },
8472
+ "bindings.cron.schedule": {
8473
+ schema: Type.String({ minLength: 1 }),
8474
+ fixtures: {
8475
+ valid: "0 9 * * *",
8476
+ invalid: "",
8477
+ absent: void 0,
8478
+ unresolved: { expression: "schedule" },
8479
+ edition1: "0 9 * * *"
8480
+ },
8481
+ referenceType: "string",
8482
+ required: true,
8483
+ resolution: "static-required",
8484
+ issueCode: "play_authoring_binding_invalid",
8485
+ description: "Five-field cron expression.",
8486
+ errorMessage: "bindings.cron.schedule must be a non-empty static string."
8487
+ },
8488
+ "bindings.cron.timezone": {
8489
+ schema: Type.String({ minLength: 1 }),
8490
+ fixtures: {
8491
+ valid: "UTC",
8492
+ invalid: "",
8493
+ absent: void 0,
8494
+ unresolved: { expression: "timezone" },
8495
+ edition1: "UTC"
8496
+ },
8497
+ referenceType: "string",
8498
+ required: false,
8499
+ resolution: "static-required",
8500
+ issueCode: "play_authoring_cron_timezone_invalid",
8501
+ description: "IANA timezone. Omitted means UTC.",
8502
+ errorMessage: "bindings.cron.timezone must be a valid non-empty IANA timezone string."
8503
+ },
8504
+ "bindings.sqlListeners": {
8505
+ schema: Type.Array(Type.Object({}, { additionalProperties: true })),
8506
+ fixtures: {
8507
+ valid: [],
8508
+ invalid: "listeners",
8509
+ absent: void 0,
8510
+ unresolved: { expression: "listeners" },
8511
+ edition1: []
8512
+ },
8513
+ referenceType: "SqlListener[]",
8514
+ required: false,
8515
+ resolution: "static-required",
8516
+ issueCode: "play_authoring_binding_invalid",
8517
+ description: "Static provider-monitor listener declarations.",
8518
+ errorMessage: "bindings.sqlListeners must be a static array of objects."
8519
+ },
8520
+ "bindings.sqlListeners[].id": {
8521
+ schema: Type.String({ pattern: PLAY_SQL_LISTENER_ID_PATTERN.source }),
8522
+ fixtures: {
8523
+ valid: "job-openings",
8524
+ invalid: "1-job-openings",
8525
+ absent: void 0,
8526
+ unresolved: { expression: "listenerId" },
8527
+ edition1: "job-openings"
8528
+ },
8529
+ referenceType: "string",
8530
+ required: true,
8531
+ resolution: "static-required",
8532
+ issueCode: "sql_listener_binding_shape",
8533
+ description: "Unique static listener identifier within one Play.",
8534
+ errorMessage: "bindings.sqlListeners[].id must begin with a letter and contain only letters, numbers, underscores, or hyphens."
8535
+ },
8536
+ "bindings.sqlListeners[].tool": {
8537
+ schema: Type.String({ pattern: PLAY_SQL_LISTENER_TOOL_PATTERN.source }),
8538
+ fixtures: {
8539
+ valid: "deepline_native.company_radar",
8540
+ invalid: "company_radar",
8541
+ absent: void 0,
8542
+ unresolved: { expression: "toolId" },
8543
+ edition1: "deepline_native.company_radar"
8544
+ },
8545
+ referenceType: "string",
8546
+ required: true,
8547
+ resolution: "static-required",
8548
+ issueCode: "sql_listener_binding_shape",
8549
+ description: "Modeled provider monitor tool id in provider.tool form.",
8550
+ errorMessage: "bindings.sqlListeners[].tool must use static provider.tool syntax."
8551
+ },
8552
+ "bindings.sqlListeners[].stream": {
8553
+ schema: Type.String({ pattern: PLAY_SQL_LISTENER_ID_PATTERN.source }),
8554
+ fixtures: {
8555
+ valid: "company_job_openings",
8556
+ invalid: "1-company-job-openings",
8557
+ absent: void 0,
8558
+ unresolved: { expression: "stream" },
8559
+ edition1: "company_job_openings"
8560
+ },
8561
+ referenceType: "string",
8562
+ required: true,
8563
+ resolution: "static-required",
8564
+ issueCode: "sql_listener_binding_shape",
8565
+ description: "Static output stream key exposed by the monitor tool.",
8566
+ errorMessage: "bindings.sqlListeners[].stream must be a static stream identifier."
8567
+ },
8568
+ "bindings.sqlListeners[].operations[]": {
8569
+ schema: Type.Union([
8570
+ Type.Literal("INSERT"),
8571
+ Type.Literal("UPDATE"),
8572
+ Type.Literal("DELETE")
8573
+ ]),
8574
+ fixtures: {
8575
+ valid: "INSERT",
8576
+ invalid: "UPSERT",
8577
+ absent: void 0,
8578
+ unresolved: { expression: "operation" },
8579
+ edition1: "UPDATE"
8580
+ },
8581
+ referenceType: "'INSERT' | 'UPDATE' | 'DELETE'",
8582
+ required: false,
8583
+ resolution: "static-required",
8584
+ issueCode: "sql_listener_binding_shape",
8585
+ description: "Database operation that wakes the listener.",
8586
+ errorMessage: "bindings.sqlListeners[].operations entries must be INSERT, UPDATE, or DELETE."
8587
+ },
8588
+ "bindings.sqlListeners[].where.before": {
8589
+ schema: Type.Record(Type.String(), Type.Unknown()),
8590
+ fixtures: {
8591
+ valid: { status: { eq: "open" } },
8592
+ invalid: "status=open",
8593
+ absent: void 0,
8594
+ unresolved: "beforeFilter",
8595
+ edition1: { status: { eq: "open" } }
8596
+ },
8597
+ referenceType: "Record<string, SqlListenerFilterOperator>",
8598
+ required: false,
8599
+ resolution: "static-required",
8600
+ issueCode: "sql_listener_binding_shape",
8601
+ description: "Column filters evaluated against the row before mutation.",
8602
+ errorMessage: "bindings.sqlListeners[].where.before must be a static object keyed by column."
8603
+ },
8604
+ "bindings.sqlListeners[].where.after": {
8605
+ schema: Type.Record(Type.String(), Type.Unknown()),
8606
+ fixtures: {
8607
+ valid: { status: { eq: "open" } },
8608
+ invalid: "status=open",
8609
+ absent: void 0,
8610
+ unresolved: "afterFilter",
8611
+ edition1: { status: { eq: "open" } }
8612
+ },
8613
+ referenceType: "Record<string, SqlListenerFilterOperator>",
8614
+ required: false,
8615
+ resolution: "static-required",
8616
+ issueCode: "sql_listener_binding_shape",
8617
+ description: "Column filters evaluated against the row after mutation.",
8618
+ errorMessage: "bindings.sqlListeners[].where.after must be a static object keyed by column."
8619
+ },
8620
+ "bindings.sqlListeners[].where.*.*.eq": {
8621
+ schema: SqlListenerFilterScalarSchema,
8622
+ fixtures: {
8623
+ valid: "open",
8624
+ invalid: { nested: true },
8625
+ absent: void 0,
8626
+ unresolved: { expression: "equalsValue" },
8627
+ edition1: "open"
8628
+ },
8629
+ referenceType: "SqlListenerFilterScalar",
8630
+ required: false,
8631
+ resolution: "static-required",
8632
+ issueCode: "sql_listener_binding_shape",
8633
+ description: "Scalar equality condition.",
8634
+ errorMessage: "SQL listener eq must compare a scalar value."
8635
+ },
8636
+ "bindings.sqlListeners[].where.*.*.neq": {
8637
+ schema: SqlListenerFilterScalarSchema,
8638
+ fixtures: {
8639
+ valid: "closed",
8640
+ invalid: { nested: true },
8641
+ absent: void 0,
8642
+ unresolved: { expression: "notEqualsValue" },
8643
+ edition1: "closed"
8644
+ },
8645
+ referenceType: "SqlListenerFilterScalar",
8646
+ required: false,
8647
+ resolution: "static-required",
8648
+ issueCode: "sql_listener_binding_shape",
8649
+ description: "Scalar inequality condition.",
8650
+ errorMessage: "SQL listener neq must compare a scalar value."
8651
+ },
8652
+ "bindings.sqlListeners[].where.*.*.in": {
8653
+ schema: Type.Array(SqlListenerFilterScalarSchema, { minItems: 1 }),
8654
+ fixtures: {
8655
+ valid: ["open", "pending"],
8656
+ invalid: [],
8657
+ absent: void 0,
8658
+ unresolved: { expression: "acceptedValues" },
8659
+ edition1: ["open"]
8660
+ },
8661
+ referenceType: "readonly SqlListenerFilterScalar[]",
8662
+ required: false,
8663
+ resolution: "static-required",
8664
+ issueCode: "sql_listener_binding_shape",
8665
+ description: "Non-empty scalar membership condition.",
8666
+ errorMessage: "SQL listener in must contain at least one scalar value."
8667
+ },
8668
+ "bindings.sqlListeners[].where.*.*.notIn": {
8669
+ schema: Type.Array(SqlListenerFilterScalarSchema, { minItems: 1 }),
8670
+ fixtures: {
8671
+ valid: ["closed"],
8672
+ invalid: [],
8673
+ absent: void 0,
8674
+ unresolved: { expression: "rejectedValues" },
8675
+ edition1: ["closed"]
8676
+ },
8677
+ referenceType: "readonly SqlListenerFilterScalar[]",
8678
+ required: false,
8679
+ resolution: "static-required",
8680
+ issueCode: "sql_listener_binding_shape",
8681
+ description: "Non-empty scalar exclusion condition.",
8682
+ errorMessage: "SQL listener notIn must contain at least one scalar value."
8683
+ },
8684
+ "bindings.sqlListeners[].where.*.*.isNull": {
8685
+ schema: Type.Literal(true),
8686
+ fixtures: {
8687
+ valid: true,
8688
+ invalid: false,
8689
+ absent: void 0,
8690
+ unresolved: { expression: "isNull" },
8691
+ edition1: true
8692
+ },
8693
+ referenceType: "true",
8694
+ required: false,
8695
+ resolution: "static-required",
8696
+ issueCode: "sql_listener_binding_shape",
8697
+ description: "Matches null values when set to true.",
8698
+ errorMessage: "SQL listener isNull must be the static literal true."
8699
+ },
8700
+ "bindings.sqlListeners[].where.*.*.isNotNull": {
8701
+ schema: Type.Literal(true),
8702
+ fixtures: {
8703
+ valid: true,
8704
+ invalid: false,
8705
+ absent: void 0,
8706
+ unresolved: { expression: "isNotNull" },
8707
+ edition1: true
8708
+ },
8709
+ referenceType: "true",
8710
+ required: false,
8711
+ resolution: "static-required",
8712
+ issueCode: "sql_listener_binding_shape",
8713
+ description: "Matches non-null values when set to true.",
8714
+ errorMessage: "SQL listener isNotNull must be the static literal true."
8715
+ },
8716
+ "bindings.sqlListeners[].where.*.*.ilike": {
8717
+ schema: Type.String(),
8718
+ fixtures: {
8719
+ valid: "%software%",
8720
+ invalid: 1,
8721
+ absent: void 0,
8722
+ unresolved: { expression: "pattern" },
8723
+ edition1: "%software%"
8724
+ },
8725
+ referenceType: "string",
8726
+ required: false,
8727
+ resolution: "static-required",
8728
+ issueCode: "sql_listener_binding_shape",
8729
+ description: "Case-insensitive SQL pattern condition.",
8730
+ errorMessage: "SQL listener ilike must be a string pattern."
8731
+ },
8732
+ "bindings.secrets[]": {
8733
+ schema: SecretEnvironmentNameSchema,
8734
+ fixtures: {
8735
+ valid: "API_TOKEN",
8736
+ invalid: "api_token",
8737
+ absent: void 0,
8738
+ unresolved: { expression: "secret" },
8739
+ edition1: "API_TOKEN"
8740
+ },
8741
+ referenceType: "string",
8742
+ required: false,
8743
+ resolution: "static-required",
8744
+ issueCode: "play_authoring_secret_invalid",
8745
+ description: "Environment variable made available to the Play.",
8746
+ errorMessage: "bindings.secrets entries must be uppercase environment variable names beginning with a letter."
8747
+ },
8748
+ "ctx.tools.execute.staleAfterSeconds": {
8749
+ schema: Type.Union([Type.Null(), Type.Integer({ minimum: 0 })]),
8750
+ fixtures: {
8751
+ valid: 0,
8752
+ invalid: -1,
8753
+ absent: void 0,
8754
+ unresolved: { expression: "ttl" },
8755
+ edition1: null
8756
+ },
8757
+ referenceType: "number | null",
8758
+ required: false,
8759
+ resolution: "runtime-allowed",
8760
+ issueCode: "play_authoring_durable_policy_invalid",
8761
+ description: "`0` always executes; `null`/omitted never expires; a positive integer is a TTL in seconds.",
8762
+ errorMessage: "staleAfterSeconds must be null, 0 (always execute), or a positive whole number of seconds."
8763
+ },
8764
+ "ctx.tools.execute.id": {
8765
+ schema: Type.String({ pattern: "\\S" }),
8766
+ fixtures: {
8767
+ valid: "company-enrichment",
8768
+ invalid: "",
8769
+ absent: void 0,
8770
+ unresolved: { expression: "receiptId" },
8771
+ edition1: "company-enrichment"
8772
+ },
8773
+ referenceType: "string",
8774
+ required: true,
8775
+ resolution: "runtime-allowed",
8776
+ issueCode: "play_authoring_tool_request_invalid",
8777
+ description: "Stable durable receipt identity within one execution scope.",
8778
+ errorMessage: "ctx.tools.execute id must be a non-empty string."
8779
+ },
8780
+ "ctx.tools.execute.tool": {
8781
+ schema: Type.String({ pattern: "\\S" }),
8782
+ fixtures: {
8783
+ valid: "openmart_enrich_company",
8784
+ invalid: "",
8785
+ absent: void 0,
8786
+ unresolved: { expression: "toolId" },
8787
+ edition1: "openmart_enrich_company"
8788
+ },
8789
+ referenceType: "K",
8790
+ required: true,
8791
+ resolution: "runtime-allowed",
8792
+ issueCode: "play_authoring_tool_request_invalid",
8793
+ description: "Integration tool id resolved against the generated ToolMap.",
8794
+ errorMessage: "ctx.tools.execute tool must be a non-empty tool id."
8795
+ },
8796
+ "ctx.tools.execute.input": {
8797
+ schema: Type.Record(Type.String(), Type.Unknown()),
8798
+ fixtures: {
8799
+ valid: { domain: "example.com" },
8800
+ invalid: "example.com",
8801
+ absent: void 0,
8802
+ unresolved: "toolInput",
8803
+ edition1: {}
8804
+ },
8805
+ referenceType: "K extends keyof ToolMap ? ToolMap[K]['input'] : Record<string, unknown>",
8806
+ required: true,
8807
+ resolution: "runtime-allowed",
8808
+ issueCode: "play_authoring_tool_request_invalid",
8809
+ description: "Tool-specific input object.",
8810
+ errorMessage: "ctx.tools.execute input must be an object."
8811
+ },
8812
+ "ctx.tools.execute.description": {
8813
+ schema: Type.String(),
8814
+ fixtures: {
8815
+ valid: "Enrich the company.",
8816
+ invalid: 1,
8817
+ absent: void 0,
8818
+ unresolved: { expression: "description" },
8819
+ edition1: "Enrich the company."
8820
+ },
8821
+ referenceType: "string",
8822
+ required: false,
8823
+ resolution: "runtime-allowed",
8824
+ issueCode: "play_authoring_tool_request_invalid",
8825
+ description: "Human-readable purpose of the durable tool call.",
8826
+ errorMessage: "ctx.tools.execute description must be a string."
8827
+ },
8828
+ "ctx.tools.execute.force": {
8829
+ schema: Type.Boolean(),
8830
+ fixtures: {
8831
+ valid: true,
8832
+ invalid: "true",
8833
+ absent: void 0,
8834
+ unresolved: { expression: "force" },
8835
+ edition1: false
8836
+ },
8837
+ referenceType: "boolean",
8838
+ required: false,
8839
+ resolution: "runtime-allowed",
8840
+ issueCode: "play_authoring_tool_request_invalid",
8841
+ description: "Explicitly bypasses a completed durable tool receipt.",
8842
+ errorMessage: "ctx.tools.execute force must be a boolean."
8843
+ },
8844
+ "ctx.tools.execute.timeoutMs": {
8845
+ schema: Type.Integer({ minimum: 1 }),
8846
+ fixtures: {
8847
+ valid: 1,
8848
+ invalid: 0,
8849
+ absent: void 0,
8850
+ unresolved: { expression: "timeout" },
8851
+ edition1: 1
8852
+ },
8853
+ referenceType: "number",
8854
+ required: false,
8855
+ resolution: "runtime-allowed",
8856
+ issueCode: "play_authoring_durable_policy_invalid",
8857
+ description: "Positive whole-number runtime transport timeout in milliseconds.",
8858
+ errorMessage: "timeoutMs must be a positive whole number of milliseconds."
8859
+ },
8860
+ "ctx.tools.execute.receiptWaitMs": {
8861
+ schema: Type.Integer({ minimum: 1 }),
8862
+ fixtures: {
8863
+ valid: 1,
8864
+ invalid: 0,
8865
+ absent: void 0,
8866
+ unresolved: { expression: "receiptWait" },
8867
+ edition1: 1
8868
+ },
8869
+ referenceType: "number",
8870
+ required: false,
8871
+ resolution: "runtime-allowed",
8872
+ issueCode: "play_authoring_durable_policy_invalid",
8873
+ description: "Positive whole-number durable receipt wait budget in milliseconds.",
8874
+ errorMessage: "receiptWaitMs must be a positive whole number of milliseconds."
8875
+ },
8876
+ "ctx.csv.options.description": {
8877
+ schema: Type.String({ minLength: 1 }),
8878
+ fixtures: {
8879
+ valid: "Load account rows.",
8880
+ invalid: "",
8881
+ absent: void 0,
8882
+ unresolved: { expression: "description" },
8883
+ edition1: "Load rows."
8884
+ },
8885
+ referenceType: "string",
8886
+ required: false,
8887
+ resolution: "static-when-present",
8888
+ issueCode: "play_authoring_csv_option_invalid",
8889
+ description: "Non-empty description for a staged CSV load.",
8890
+ errorMessage: "ctx.csv options.description must be non-empty."
8891
+ },
8892
+ "ctx.csv.options.columns": {
8893
+ schema: Type.Record(
8894
+ Type.String(),
8895
+ Type.Union([
8896
+ Type.String({ minLength: 1 }),
8897
+ Type.Array(Type.String({ minLength: 1 }), { minItems: 1 })
8898
+ ])
8899
+ ),
8900
+ fixtures: {
8901
+ valid: { domain: ["domain", "Company Domain"] },
8902
+ invalid: { domain: [] },
8903
+ absent: void 0,
8904
+ unresolved: { expression: { dynamic: true } },
8905
+ edition1: { domain: "domain" }
8906
+ },
8907
+ referenceType: "CsvRenameMap",
8908
+ required: false,
8909
+ resolution: "runtime-allowed",
8910
+ issueCode: "play_authoring_csv_option_invalid",
8911
+ description: "Canonical field-to-header aliases for a staged CSV.",
8912
+ errorMessage: "ctx.csv options.columns values must be a non-empty header or alias list."
8913
+ },
8914
+ "ctx.csv.options.rename": {
8915
+ schema: Type.Record(
8916
+ Type.String(),
8917
+ Type.Union([
8918
+ Type.String({ minLength: 1 }),
8919
+ Type.Array(Type.String({ minLength: 1 }), { minItems: 1 })
8920
+ ])
8921
+ ),
8922
+ fixtures: {
8923
+ valid: { domain: "Company Domain" },
8924
+ invalid: { domain: "" },
8925
+ absent: void 0,
8926
+ unresolved: { expression: { dynamic: true } },
8927
+ edition1: { domain: "domain" }
8928
+ },
8929
+ referenceType: "CsvRenameMap",
8930
+ required: false,
8931
+ resolution: "static-when-present",
8932
+ issueCode: "play_authoring_csv_option_invalid",
8933
+ description: "Legacy header rename aliases for a staged CSV.",
8934
+ errorMessage: "ctx.csv options.rename values must be a non-empty header or alias list."
8935
+ },
8936
+ "ctx.csv.options.required": {
8937
+ schema: Type.Array(Type.String({ minLength: 1 })),
8938
+ fixtures: {
8939
+ valid: ["domain"],
8940
+ invalid: [""],
8941
+ absent: void 0,
8942
+ unresolved: { expression: "requiredColumns" },
8943
+ edition1: []
8944
+ },
8945
+ referenceType: "readonly string[]",
8946
+ required: false,
8947
+ resolution: "static-when-present",
8948
+ issueCode: "play_authoring_csv_option_invalid",
8949
+ description: "Canonical columns required after CSV normalization.",
8950
+ errorMessage: "ctx.csv options.required entries must be non-empty column names."
8951
+ },
8952
+ "ctx.dataset.key": {
8953
+ schema: Type.String({ minLength: 1 }),
8954
+ fixtures: {
8955
+ valid: "accounts",
8956
+ invalid: "",
8957
+ absent: void 0,
8958
+ unresolved: { expression: "datasetKey" },
8959
+ edition1: "rows"
8960
+ },
8961
+ referenceType: "string",
8962
+ required: true,
8963
+ resolution: "static-required",
8964
+ issueCode: "play_authoring_dataset_option_invalid",
8965
+ description: "Stable durable identity for one dataset.",
8966
+ errorMessage: "ctx.dataset key must be a non-empty static string."
8967
+ },
8968
+ "ctx.dataset.run.description": {
8969
+ schema: Type.String({ minLength: 1 }),
8970
+ fixtures: {
8971
+ valid: "Enrich account rows.",
8972
+ invalid: "",
8973
+ absent: void 0,
8974
+ unresolved: { expression: "description" },
8975
+ edition1: "Process rows."
8976
+ },
8977
+ referenceType: "string",
8978
+ required: false,
8979
+ resolution: "static-when-present",
8980
+ issueCode: "play_authoring_dataset_option_invalid",
8981
+ description: "Non-empty description for one dataset execution.",
8982
+ errorMessage: "ctx.dataset run description must be non-empty."
8983
+ },
8984
+ "ctx.dataset.run.key": {
8985
+ schema: Type.Union([
8986
+ Type.String({ minLength: 1 }),
8987
+ Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),
8988
+ Type.Function(
8989
+ [Type.Record(Type.String(), Type.Unknown()), Type.Integer()],
8990
+ Type.Union([
8991
+ Type.String(),
8992
+ Type.Number(),
8993
+ Type.Readonly(Type.Array(Type.Unknown()))
8994
+ ])
8995
+ )
8996
+ ]),
8997
+ fixtures: {
8998
+ valid: (row) => String(row.domain),
8999
+ invalid: [],
9000
+ absent: void 0,
9001
+ unresolved: { expression: "rowKey" },
9002
+ edition1: ["domain"]
9003
+ },
9004
+ referenceType: "DatasetRowKey<InputRow>",
9005
+ required: false,
9006
+ resolution: "runtime-dynamic",
9007
+ issueCode: "play_authoring_dataset_option_invalid",
9008
+ description: "Stable field or fields used for durable row identity.",
9009
+ errorMessage: "ctx.dataset run key must be a non-empty field, field list, or key function."
9010
+ },
9011
+ "ctx.dataset.run.onRowError": {
9012
+ schema: Type.Union([Type.Literal("isolate"), Type.Literal("fail")]),
9013
+ fixtures: {
9014
+ valid: "isolate",
9015
+ invalid: "continue",
9016
+ absent: void 0,
9017
+ unresolved: { expression: "rowErrorPolicy" },
9018
+ edition1: "fail"
9019
+ },
9020
+ referenceType: "'isolate' | 'fail'",
9021
+ required: false,
9022
+ resolution: "static-when-present",
9023
+ issueCode: "play_authoring_dataset_option_invalid",
9024
+ description: "Whether row failures isolate or fail the whole dataset.",
9025
+ errorMessage: 'ctx.dataset run onRowError must be "isolate" or "fail".'
9026
+ },
9027
+ "ctx.dataset.run.mode": {
9028
+ schema: Type.Union([Type.Literal("upsert"), Type.Literal("net_new")]),
9029
+ fixtures: {
9030
+ valid: "upsert",
9031
+ invalid: "append",
9032
+ absent: void 0,
9033
+ unresolved: { expression: "datasetMode" },
9034
+ edition1: "upsert"
9035
+ },
9036
+ referenceType: "'upsert' | 'net_new'",
9037
+ required: false,
9038
+ resolution: "static-when-present",
9039
+ issueCode: "play_authoring_dataset_option_invalid",
9040
+ description: "Whether the dataset returns all rows or only newly admitted rows.",
9041
+ errorMessage: 'ctx.dataset run mode must be "upsert" or "net_new".'
9042
+ },
9043
+ "ctx.dataset.run.undrawnColumns": {
9044
+ schema: Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),
9045
+ fixtures: {
9046
+ valid: ["miss_reason"],
9047
+ invalid: [],
9048
+ absent: void 0,
9049
+ unresolved: { expression: "undrawnColumns" },
9050
+ edition1: ["miss_reason"]
9051
+ },
9052
+ referenceType: "readonly string[]",
9053
+ required: false,
9054
+ resolution: "static-when-present",
9055
+ issueCode: "play_authoring_dataset_option_invalid",
9056
+ description: "Computed columns deliberately left out of the authored @mermaid diagram.",
9057
+ errorMessage: "ctx.dataset run undrawnColumns must be a non-empty array of static column-name strings."
9058
+ },
9059
+ "ctx.step.id": {
9060
+ schema: Type.String({ minLength: 1 }),
9061
+ fixtures: {
9062
+ valid: "load-settings",
9063
+ invalid: "",
9064
+ absent: void 0,
9065
+ unresolved: { expression: "stepId" },
9066
+ edition1: "step"
9067
+ },
9068
+ referenceType: "string",
9069
+ required: true,
9070
+ resolution: "static-required",
9071
+ issueCode: "play_authoring_step_option_invalid",
9072
+ description: "Stable durable identity for one scalar checkpoint.",
9073
+ errorMessage: "ctx.step id must be a non-empty static string."
9074
+ },
9075
+ "ctx.step.semanticKey": {
9076
+ schema: Type.String({ minLength: 1 }),
9077
+ fixtures: {
9078
+ valid: "account:stripe.com",
9079
+ invalid: "",
9080
+ absent: void 0,
9081
+ unresolved: { expression: "semanticKey" },
9082
+ edition1: "account"
9083
+ },
9084
+ referenceType: "string",
9085
+ required: false,
9086
+ resolution: "runtime-dynamic",
9087
+ issueCode: "play_authoring_step_option_invalid",
9088
+ description: "Optional semantic receipt identity for a scalar checkpoint.",
9089
+ errorMessage: "ctx.step semanticKey must be a non-empty string."
9090
+ },
9091
+ "ctx.step.staleAfterSeconds": {
9092
+ schema: Type.Union([Type.Null(), Type.Integer({ minimum: 0 })]),
9093
+ fixtures: {
9094
+ valid: 0,
9095
+ invalid: -1,
9096
+ absent: void 0,
9097
+ unresolved: { expression: "ttl" },
9098
+ edition1: null
9099
+ },
9100
+ referenceType: "number | null",
9101
+ required: false,
9102
+ resolution: "runtime-dynamic",
9103
+ issueCode: "play_authoring_durable_policy_invalid",
9104
+ description: "Checkpoint freshness: null/omitted never expires, 0 always executes.",
9105
+ errorMessage: "staleAfterSeconds must be null, 0 (always execute), or a positive whole number of seconds."
9106
+ },
9107
+ "ctx.fetch.key": {
9108
+ schema: Type.String({ minLength: 1 }),
9109
+ fixtures: {
9110
+ valid: "notify-crm",
9111
+ invalid: "",
9112
+ absent: void 0,
9113
+ unresolved: { expression: "fetchKey" },
9114
+ edition1: "fetch"
9115
+ },
9116
+ referenceType: "string",
9117
+ required: true,
9118
+ resolution: "static-required",
9119
+ issueCode: "play_authoring_durable_policy_invalid",
9120
+ description: "Stable durable identity for one external HTTP request.",
9121
+ errorMessage: "ctx.fetch key must be a non-empty static string.",
9122
+ unresolvedHint: PLAY_AUTHORING_STATIC_FETCH_KEY_HINT
9123
+ },
9124
+ "ctx.fetch.staleAfterSeconds": {
9125
+ schema: Type.Union([Type.Null(), Type.Integer({ minimum: 0 })]),
9126
+ fixtures: {
9127
+ valid: null,
9128
+ invalid: 1.5,
9129
+ absent: void 0,
9130
+ unresolved: { expression: "ttl" },
9131
+ edition1: 0
9132
+ },
9133
+ referenceType: "number | null",
9134
+ required: false,
9135
+ resolution: "runtime-dynamic",
9136
+ issueCode: "play_authoring_durable_policy_invalid",
9137
+ description: "Fetch freshness: null/omitted never expires, 0 always executes.",
9138
+ errorMessage: "staleAfterSeconds must be null, 0 (always execute), or a positive whole number of seconds."
9139
+ },
9140
+ "ctx.runPlay.key": {
9141
+ schema: Type.String({ minLength: 1 }),
9142
+ fixtures: {
9143
+ valid: "enrich-company",
9144
+ invalid: "",
9145
+ absent: void 0,
9146
+ unresolved: { expression: "callKey" },
9147
+ edition1: "child"
9148
+ },
9149
+ referenceType: "string",
9150
+ required: true,
9151
+ resolution: "runtime-dynamic",
9152
+ issueCode: "play_authoring_run_play_option_invalid",
9153
+ description: "Stable identity for one inline child Play call.",
9154
+ errorMessage: "ctx.runPlay key must be a non-empty string."
9155
+ },
9156
+ "ctx.runPlay.playRef": {
9157
+ schema: Type.Union([
9158
+ Type.String({ minLength: 1 }),
9159
+ Type.Union([
9160
+ Type.Object(
9161
+ { playName: Type.String({ minLength: 1 }) },
9162
+ { additionalProperties: true }
9163
+ ),
9164
+ Type.Object(
9165
+ { name: Type.String({ minLength: 1 }) },
9166
+ { additionalProperties: true }
9167
+ )
9168
+ ])
9169
+ ]),
9170
+ fixtures: {
9171
+ valid: "prebuilt/company-lookup",
9172
+ invalid: {},
9173
+ absent: void 0,
9174
+ unresolved: { expression: "playRef" },
9175
+ edition1: { name: "company-lookup" }
9176
+ },
9177
+ referenceType: "string | PlayReferenceLike",
9178
+ required: true,
9179
+ resolution: "runtime-dynamic",
9180
+ issueCode: "play_authoring_run_play_option_invalid",
9181
+ description: "Child Play name or typed Play definition handle.",
9182
+ errorMessage: "ctx.runPlay playRef must be a non-empty Play name or definition handle."
9183
+ },
9184
+ "ctx.runPlay.input": {
9185
+ schema: Type.Record(Type.String(), Type.Unknown()),
9186
+ fixtures: {
9187
+ valid: { domain: "example.com" },
9188
+ invalid: "example.com",
9189
+ absent: void 0,
9190
+ unresolved: "childInput",
9191
+ edition1: {}
9192
+ },
9193
+ referenceType: "Record<string, unknown>",
9194
+ required: true,
9195
+ resolution: "runtime-dynamic",
9196
+ issueCode: "play_authoring_run_play_option_invalid",
9197
+ description: "Scalar input object submitted to the child Play.",
9198
+ errorMessage: "ctx.runPlay input must be an object."
9199
+ },
9200
+ "ctx.runPlay.options.description": {
9201
+ schema: Type.String({ minLength: 1 }),
9202
+ fixtures: {
9203
+ valid: "Enrich the company.",
9204
+ invalid: "",
9205
+ absent: void 0,
9206
+ unresolved: { expression: "description" },
9207
+ edition1: "Run child."
9208
+ },
9209
+ referenceType: "string",
9210
+ required: true,
9211
+ resolution: "runtime-dynamic",
9212
+ issueCode: "play_authoring_run_play_option_invalid",
9213
+ description: "Non-empty purpose for one inline child Play call.",
9214
+ errorMessage: "ctx.runPlay options.description must be non-empty."
9215
+ },
9216
+ "ctx.runPlay.options.execution": {
9217
+ schema: Type.Literal("inline"),
9218
+ fixtures: {
9219
+ valid: "inline",
9220
+ invalid: "child-workflow",
9221
+ absent: void 0,
9222
+ unresolved: { expression: "execution" },
9223
+ edition1: "inline"
9224
+ },
9225
+ referenceType: "'inline'",
9226
+ required: false,
9227
+ resolution: "static-required",
9228
+ issueCode: "play_authoring_run_play_option_invalid",
9229
+ description: "Child composition strategy. Only inline is supported.",
9230
+ errorMessage: 'ctx.runPlay execution must be "inline".'
9231
+ },
9232
+ "ctx.runPlay.options.timeoutMs": {
9233
+ schema: Type.Undefined(),
9234
+ fixtures: {
9235
+ valid: void 0,
9236
+ invalid: 1e3,
9237
+ absent: void 0,
9238
+ unresolved: { expression: "timeoutMs" },
9239
+ edition1: void 0
9240
+ },
9241
+ referenceType: "never",
9242
+ required: false,
9243
+ resolution: "unsupported",
9244
+ issueCode: "play_authoring_run_play_option_invalid",
9245
+ description: "Unsupported legacy child-workflow timeout.",
9246
+ errorMessage: "ctx.runPlay timeoutMs is unsupported because child Plays execute inline."
9247
+ },
9248
+ "runtime.timeout": {
9249
+ schema: Type.String({ pattern: "^\\d+\\s*[mh]$" }),
9250
+ fixtures: {
9251
+ valid: "90m",
9252
+ invalid: "90s",
9253
+ absent: void 0,
9254
+ unresolved: { expression: "timeout" },
9255
+ edition1: "90m"
9256
+ },
9257
+ referenceType: "string",
9258
+ required: false,
9259
+ resolution: "static-required",
9260
+ issueCode: "play_authoring_binding_invalid",
9261
+ description: "Play-level sandbox deadline. The default is 30m; use a static duration such as 90m or 2h, up to 4h.",
9262
+ errorMessage: 'runtime.timeout must be a static duration such as "90m" or "2h".'
9263
+ },
9264
+ "runtime.size": {
9265
+ schema: Type.Literal("standard"),
9266
+ fixtures: {
9267
+ valid: "standard",
9268
+ invalid: "large",
9269
+ absent: void 0,
9270
+ unresolved: { expression: "size" },
9271
+ edition1: "standard"
9272
+ },
9273
+ referenceType: "'standard'",
9274
+ required: false,
9275
+ resolution: "static-required",
9276
+ issueCode: "play_authoring_binding_invalid",
9277
+ description: "Deepline-managed sandbox size. Only standard is supported.",
9278
+ errorMessage: 'runtime.size must be the static literal "standard".'
9279
+ },
9280
+ "ctx.customerDb.query.statement": {
9281
+ schema: Type.Union([
9282
+ Type.String({ minLength: 1 }),
9283
+ Type.Object(
9284
+ {
9285
+ kind: Type.Optional(Type.Literal("sql.query")),
9286
+ text: Type.String({ minLength: 1 }),
9287
+ values: Type.Optional(Type.Array(Type.Unknown(), { maxItems: 0 }))
9288
+ },
9289
+ { additionalProperties: false }
9290
+ )
9291
+ ]),
9292
+ fixtures: {
9293
+ valid: { kind: "sql.query", text: "select 1", values: [] },
9294
+ invalid: { kind: "sql.query", text: "select $1", values: [1] },
9295
+ absent: void 0,
9296
+ unresolved: { expression: "statement" },
9297
+ edition1: "select 1"
9298
+ },
9299
+ referenceType: "SqlQuery",
9300
+ required: true,
9301
+ resolution: "runtime-dynamic",
9302
+ issueCode: "play_authoring_tool_request_invalid",
9303
+ description: "One non-empty Customer DB SQL string; the deprecated SqlQuery object is accepted only without parameter values.",
9304
+ errorMessage: "ctx.customerDb.query statement must be a non-empty SQL string. Deprecated SqlQuery objects cannot contain parameter values."
9305
+ },
9306
+ "ctx.customerDb.query.options.maxRows": {
9307
+ schema: Type.Integer({ minimum: 1 }),
9308
+ fixtures: {
9309
+ valid: 100,
9310
+ invalid: 0,
9311
+ absent: void 0,
9312
+ unresolved: { expression: "maxRows" },
9313
+ edition1: 100
9314
+ },
9315
+ referenceType: "number",
9316
+ required: false,
9317
+ resolution: "runtime-dynamic",
9318
+ issueCode: "play_authoring_tool_request_invalid",
9319
+ description: "Positive whole-number Customer DB response row limit.",
9320
+ errorMessage: "ctx.customerDb.query options.maxRows must be a positive whole number."
9321
+ },
9322
+ "ctx.customerDb.query.options.timeoutMs": {
9323
+ schema: Type.Integer({ minimum: 1 }),
9324
+ fixtures: {
9325
+ valid: 1e3,
9326
+ invalid: 0,
9327
+ absent: void 0,
9328
+ unresolved: { expression: "timeoutMs" },
9329
+ edition1: 1e3
9330
+ },
9331
+ referenceType: "number",
9332
+ required: false,
9333
+ resolution: "runtime-dynamic",
9334
+ issueCode: "play_authoring_durable_policy_invalid",
9335
+ description: "Positive whole-number Customer DB timeout in milliseconds.",
9336
+ errorMessage: "ctx.customerDb.query options.timeoutMs must be a positive whole number of milliseconds."
9337
+ },
9338
+ "ctx.tool.key": {
9339
+ schema: Type.String({ minLength: 1 }),
9340
+ fixtures: {
9341
+ valid: "company",
9342
+ invalid: "",
9343
+ absent: void 0,
9344
+ unresolved: { expression: "key" },
9345
+ edition1: "tool"
9346
+ },
9347
+ referenceType: "string",
9348
+ required: true,
9349
+ resolution: "runtime-dynamic",
9350
+ issueCode: "play_authoring_tool_request_invalid",
9351
+ description: "Stable receipt identity for the tool shorthand.",
9352
+ errorMessage: "ctx.tool key must be a non-empty string."
9353
+ },
9354
+ "ctx.tool.tool": {
9355
+ schema: Type.String({ minLength: 1 }),
9356
+ fixtures: {
9357
+ valid: "openmart_enrich_company",
9358
+ invalid: "",
9359
+ absent: void 0,
9360
+ unresolved: { expression: "tool" },
9361
+ edition1: "openmart_enrich_company"
9362
+ },
9363
+ referenceType: "string",
9364
+ required: true,
9365
+ resolution: "runtime-dynamic",
9366
+ issueCode: "play_authoring_tool_request_invalid",
9367
+ description: "Integration tool id for the tool shorthand.",
9368
+ errorMessage: "ctx.tool tool must be a non-empty tool id."
9369
+ },
9370
+ "ctx.tool.input": {
9371
+ schema: Type.Record(Type.String(), Type.Unknown()),
9372
+ fixtures: {
9373
+ valid: { domain: "example.com" },
9374
+ invalid: "example.com",
9375
+ absent: void 0,
9376
+ unresolved: "toolInput",
9377
+ edition1: {}
9378
+ },
9379
+ referenceType: "Record<string, unknown>",
9380
+ required: true,
9381
+ resolution: "runtime-dynamic",
9382
+ issueCode: "play_authoring_tool_request_invalid",
9383
+ description: "Tool-specific input object for the shorthand.",
9384
+ errorMessage: "ctx.tool input must be an object."
9385
+ },
9386
+ "ctx.tool.options.description": {
9387
+ schema: Type.String({ minLength: 1 }),
9388
+ fixtures: {
9389
+ valid: "Enrich the company.",
9390
+ invalid: "",
9391
+ absent: void 0,
9392
+ unresolved: { expression: "description" },
9393
+ edition1: "Run tool."
9394
+ },
9395
+ referenceType: "string",
9396
+ required: false,
9397
+ resolution: "runtime-dynamic",
9398
+ issueCode: "play_authoring_tool_request_invalid",
9399
+ description: "Non-empty purpose for the tool shorthand.",
9400
+ errorMessage: "ctx.tool options.description must be non-empty."
9401
+ },
9402
+ "ctx.runSteps.options.description": {
9403
+ schema: Type.String({ minLength: 1 }),
9404
+ fixtures: {
9405
+ valid: "Score the account.",
9406
+ invalid: "",
9407
+ absent: void 0,
9408
+ unresolved: { expression: "description" },
9409
+ edition1: "Run steps."
9410
+ },
9411
+ referenceType: "string",
9412
+ required: false,
9413
+ resolution: "runtime-dynamic",
9414
+ issueCode: "play_authoring_step_option_invalid",
9415
+ description: "Non-empty purpose for a reusable step program.",
9416
+ errorMessage: "ctx.runSteps options.description must be non-empty."
9417
+ },
9418
+ "ctx.sleep.ms": {
9419
+ schema: Type.Integer({ minimum: 0 }),
9420
+ fixtures: {
9421
+ valid: 0,
9422
+ invalid: -1,
9423
+ absent: void 0,
9424
+ unresolved: { expression: "delayMs" },
9425
+ edition1: 1e3
9426
+ },
9427
+ referenceType: "number",
9428
+ required: true,
9429
+ resolution: "runtime-dynamic",
9430
+ issueCode: "play_authoring_step_option_invalid",
9431
+ description: "Non-negative whole-number sleep duration in milliseconds.",
9432
+ errorMessage: "ctx.sleep ms must be a non-negative whole number."
9433
+ },
9434
+ "ctx.fetch.url": {
9435
+ schema: Type.String({ minLength: 1 }),
9436
+ fixtures: {
9437
+ valid: "https://example.com",
9438
+ invalid: "",
9439
+ absent: void 0,
9440
+ unresolved: { expression: "url" },
9441
+ edition1: "https://example.com"
9442
+ },
9443
+ referenceType: "string",
9444
+ required: true,
9445
+ resolution: "runtime-allowed",
9446
+ issueCode: "play_authoring_fetch_secret_requires_tls",
9447
+ description: "HTTP request URL. Secret authentication requires HTTPS.",
9448
+ errorMessage: "ctx.fetch URL must be a non-empty URL string."
9449
+ },
9450
+ "ctx.fetch.init.method": {
9451
+ schema: Type.String({ minLength: 1 }),
9452
+ fixtures: {
9453
+ valid: "GET",
9454
+ invalid: "",
9455
+ absent: void 0,
9456
+ unresolved: { expression: "method" },
9457
+ edition1: "GET"
9458
+ },
9459
+ referenceType: "string",
9460
+ required: false,
9461
+ resolution: "runtime-allowed",
9462
+ issueCode: "play_authoring_fetch_idempotency_required",
9463
+ description: "HTTP method. Mutating methods require an Idempotency-Key.",
9464
+ errorMessage: "ctx.fetch method must be a non-empty string."
9465
+ },
9466
+ "ctx.fetch.init.headers.Idempotency-Key": {
9467
+ schema: Type.String({ minLength: 1 }),
9468
+ fixtures: {
9469
+ valid: "contact-123-update",
9470
+ invalid: "",
9471
+ absent: void 0,
9472
+ unresolved: { expression: "idempotencyKey" },
9473
+ edition1: "contact-123-update"
9474
+ },
9475
+ referenceType: "string",
9476
+ required: false,
9477
+ resolution: "runtime-allowed",
9478
+ issueCode: "play_authoring_fetch_idempotency_required",
9479
+ description: "Required for mutating HTTP methods to make replay safe.",
9480
+ errorMessage: "Idempotency-Key must be a non-empty string when provided."
9481
+ }
9482
+ };
9483
+ function cloudReferenceType(path) {
9484
+ return PLAY_AUTHORING_FIELD_REGISTRY[path].referenceType;
9485
+ }
9486
+ var PLAY_AUTHORING_CLOUD_TYPE_DECLARATIONS = [
9487
+ `export type DurableCallStaleAfterSeconds = ${cloudReferenceType("ctx.tools.execute.staleAfterSeconds")};`,
9488
+ `export type PlayRuntimeTimeoutMs = ${cloudReferenceType("ctx.tools.execute.timeoutMs")};`,
9489
+ `export type PlayReceiptWaitMs = ${cloudReferenceType("ctx.tools.execute.receiptWaitMs")};`,
9490
+ `export type SqlListenerOperation = ${cloudReferenceType("bindings.sqlListeners[].operations[]")};`,
9491
+ "export type SqlListenerFilterScalar = string | number | boolean | null;",
9492
+ `export type SqlListenerFilterOperator = { eq?: ${cloudReferenceType("bindings.sqlListeners[].where.*.*.eq")}; neq?: ${cloudReferenceType("bindings.sqlListeners[].where.*.*.neq")}; in?: ${cloudReferenceType("bindings.sqlListeners[].where.*.*.in")}; notIn?: ${cloudReferenceType("bindings.sqlListeners[].where.*.*.notIn")}; isNull?: ${cloudReferenceType("bindings.sqlListeners[].where.*.*.isNull")}; isNotNull?: ${cloudReferenceType("bindings.sqlListeners[].where.*.*.isNotNull")}; ilike?: ${cloudReferenceType("bindings.sqlListeners[].where.*.*.ilike")} };`,
9493
+ `export type SqlListenerWhere = { before?: ${cloudReferenceType("bindings.sqlListeners[].where.before")}; after?: ${cloudReferenceType("bindings.sqlListeners[].where.after")} };`,
9494
+ `export type SqlListenerDeclaration = { id: ${cloudReferenceType("bindings.sqlListeners[].id")}; tool: ${cloudReferenceType("bindings.sqlListeners[].tool")}; stream: ${cloudReferenceType("bindings.sqlListeners[].stream")}; operations?: readonly SqlListenerOperation[]; where?: SqlListenerWhere };`,
9495
+ "export type SqlListenerEvent<T extends object = Record<string, unknown>> = { tool: string; stream: string; operation: SqlListenerOperation; before: T | null; after: T | null; changedAt: string; metadata: { outboxId: string; listenerId: string; table: string } };",
9496
+ "export type SqlQuery = string | { kind?: 'sql.query'; text: string; values?: readonly unknown[] };",
9497
+ "export type ToolExecutionRequest<K extends string> = {",
9498
+ ` readonly id: ${cloudReferenceType("ctx.tools.execute.id")};`,
9499
+ ` readonly tool: ${cloudReferenceType("ctx.tools.execute.tool")};`,
9500
+ ` readonly input: ${cloudReferenceType("ctx.tools.execute.input")};`,
9501
+ ` readonly description?: ${cloudReferenceType("ctx.tools.execute.description")};`,
9502
+ ` readonly force?: ${cloudReferenceType("ctx.tools.execute.force")};`,
9503
+ " readonly staleAfterSeconds?: DurableCallStaleAfterSeconds;",
9504
+ " readonly timeoutMs?: PlayRuntimeTimeoutMs;",
9505
+ " readonly receiptWaitMs?: PlayReceiptWaitMs;",
9506
+ "};",
9507
+ "export type PlayBindings = {",
9508
+ ` description?: ${cloudReferenceType("description")};`,
9509
+ ` compatibility?: { toolErrorSchemaVersion?: ${cloudReferenceType("compatibility.toolErrorSchemaVersion")}; toolResponseReceiptRevision?: ${cloudReferenceType("compatibility.toolResponseReceiptRevision")} };`,
9510
+ ` inline?: ${cloudReferenceType("inline")};`,
9511
+ ` billing?: { maxCreditsPerRun?: ${cloudReferenceType("billing.maxCreditsPerRun")} };`,
9512
+ ` runtime?: { timeout?: ${cloudReferenceType("runtime.timeout")}; size?: ${cloudReferenceType("runtime.size")} };`,
9513
+ ` webhook?: { hmac?: { algorithm?: ${cloudReferenceType("bindings.webhook.hmac.algorithm")}; header?: ${cloudReferenceType("bindings.webhook.hmac.header")}; secretEnv: ${cloudReferenceType("bindings.webhook.hmac.secretEnv")} }; auth?: { type: ${cloudReferenceType("bindings.webhook.auth.type")}; headerFamily: ${cloudReferenceType("bindings.webhook.auth.headerFamily")}; signingSecrets: readonly ${cloudReferenceType("bindings.webhook.auth.signingSecrets[]")}[]; toleranceSeconds?: ${cloudReferenceType("bindings.webhook.auth.toleranceSeconds")} } };`,
9514
+ ` cron?: { schedule: ${cloudReferenceType("bindings.cron.schedule")}; timezone?: ${cloudReferenceType("bindings.cron.timezone")} };`,
9515
+ " sqlListeners?: readonly SqlListenerDeclaration[];",
9516
+ ` secrets?: readonly ${cloudReferenceType("bindings.secrets[]")}[];`,
9517
+ "};",
9518
+ "declare const SECRET_HANDLE_BRAND: unique symbol;",
9519
+ "declare const SECRET_PROMISE_BRAND: unique symbol;",
9520
+ "export type SecretHandle = { readonly [SECRET_HANDLE_BRAND]: never; readonly name: string; toString(): string; toJSON(): never };",
9521
+ "export type SecretPromise = Promise<string> & { readonly [SECRET_PROMISE_BRAND]: never };",
9522
+ "export type SecretValue = SecretHandle;",
9523
+ "export type SecretAuth = { readonly kind: 'bearer' | 'header'; readonly secret: string | SecretPromise | SecretHandle; readonly header?: string };",
9524
+ "export type SecretAuthInput = SecretAuth | readonly SecretAuth[];",
9525
+ "export type PlayInputContract<TInput> = { readonly schema: Record<string, unknown>; readonly __inputType?: TInput };",
9526
+ "export type PlayReturnObject = Record<string, unknown> & { readonly _metadata?: never };",
9527
+ "export type CsvRenameMap = Record<string, string | readonly string[]>;",
9528
+ "export type FileInput<TMetadata = unknown> = string & { readonly __deeplineFileInputMetadata?: TMetadata };",
9529
+ "export type CsvInput<TRow extends object = Record<string, unknown>> = FileInput<{ readonly kind: 'csv'; readonly row: TRow }>;",
9530
+ "export type ColumnMap<TRow extends object> = { [K in keyof TRow & string]?: string | readonly string[] };",
9531
+ `export type CsvOptions = { description?: ${cloudReferenceType("ctx.csv.options.description")}; columns?: ${cloudReferenceType("ctx.csv.options.columns")}; rename?: ${cloudReferenceType("ctx.csv.options.rename")}; required?: ${cloudReferenceType("ctx.csv.options.required")} };`,
9532
+ "export type PlayCallExecution = 'inline';",
9533
+ `export type PlayCallOptions = { description: ${cloudReferenceType("ctx.runPlay.options.description")}; execution?: ${cloudReferenceType("ctx.runPlay.options.execution")}; timeoutMs?: ${cloudReferenceType("ctx.runPlay.options.timeoutMs")} };`,
9534
+ `export type RuntimeStepOptions = { semanticKey?: ${cloudReferenceType("ctx.step.semanticKey")}; staleAfterSeconds?: ${cloudReferenceType("ctx.step.staleAfterSeconds")} };`,
9535
+ `export type FetchOptions = { staleAfterSeconds?: ${cloudReferenceType("ctx.fetch.staleAfterSeconds")}; transient?: boolean };`,
9536
+ "export type PlayFetchResponse = { ok: boolean; status: number; statusText: string; url: string; headers: Record<string, string>; bodyText: string; json: unknown | null };",
9537
+ "export declare class CtxFetchHttpError extends Error { readonly code: 'CTX_FETCH_HTTP_ERROR'; readonly response: PlayFetchResponse; readonly status: number; readonly statusText: string; readonly url: string; readonly headers: Record<string, string>; readonly bodyText: string; readonly json: unknown | null; }",
9538
+ "export type StepResolver<Row, Value> = (row: Row, ctx: DeeplinePlayRuntimeContext, index: number, previousCell?: PreviousCell<Value>) => Value | Promise<Value>;",
9539
+ "export type DatasetColumnRunInput<Row, Value> = { readonly row: Row; readonly ctx: DeeplinePlayRuntimeContext; readonly index: number; readonly previousCell?: PreviousCell<Value> };",
9540
+ "export type DatasetColumnDefinition<Row, Value> = { readonly run: (input: DatasetColumnRunInput<Row, Value>) => Value | Promise<Value>; readonly runIf?: (row: Row, index: number) => boolean | Promise<boolean> };",
9541
+ "export type ConditionalStepResolver<Row, Value, Else = null> = { readonly kind: 'conditional'; readonly when: (row: Row, index: number) => boolean | Promise<boolean>; readonly run: StepResolver<Row, Value>; readonly elseValue: Else; else<ValueElse>(value: ValueElse): ConditionalStepResolver<Row, Value, ValueElse>; };",
9542
+ "export type StepOptions<Row, Value = unknown> = { readonly runIf?: (row: Row, index: number) => boolean | Promise<boolean>; readonly recompute?: boolean; readonly recomputeOnError?: boolean; readonly staleAfterSeconds?: number };",
9543
+ "export type StepProgramOptions = { readonly continueOnProviderUnavailable?: boolean };",
9544
+ "export type StepProgram<Input, Output, Return = Output> = { readonly kind: 'steps'; readonly steps: readonly PlayStepProgramStep[]; readonly returnResolver?: StepResolver<Output, Return>; readonly continueOnProviderUnavailable?: boolean; readonly __inputType?: (input: Input) => void; step<Name extends string, Value>(name: Name, resolver: StepResolver<Output, Value> | ConditionalStepResolver<Output, Value> | StepProgramResolver<Output, Value>): StepProgram<Input, Output & Record<Name, Value>, Return>; step<Name extends string, Value>(name: Name, resolver: StepResolver<Output, Value> | StepProgramResolver<Output, Value>, options: StepOptions<Output, Value>): StepProgram<Input, Output & Record<Name, Value | null>, Return>; return<Value>(resolver: StepResolver<Output, Value>): StepProgram<Input, Output, Value>; };",
9545
+ "export type StepProgramResolver<Input, Return> = { readonly kind: 'steps'; readonly steps: readonly PlayStepProgramStep[]; readonly returnResolver?: StepResolver<never, Return>; readonly __inputType?: (input: Input) => void };",
9546
+ "export type RunnableStepProgram<Input, Return> = Pick<StepProgram<Input, never, Return>, 'kind' | 'steps' | 'returnResolver' | '__inputType'>;",
9547
+ "export type RunnableColumnStepProgram<Return> = Pick<StepProgramResolver<unknown, Return>, 'kind' | 'steps' | 'returnResolver'>;",
9548
+ "export type PlayStepProgramStep = { readonly name: string; readonly recompute?: boolean; readonly recomputeOnError?: boolean; readonly staleAfterSeconds?: number; readonly resolver: StepResolver<Record<string, unknown>, unknown> | ConditionalStepResolver<Record<string, unknown>, unknown> | StepProgramResolver<Record<string, unknown>, unknown> };",
9549
+ "export type ColumnResolver<Row, Value> = StepResolver<Row, Value> | ConditionalStepResolver<Row, Value> | RunnableColumnStepProgram<Value>;",
9550
+ "export type StepProgramOutput<TProgram> = TProgram extends StepProgram<unknown, infer Output, unknown> ? Output : never;",
9551
+ "export type DatasetRowKey<InputRow extends object> = (keyof InputRow & string) | readonly (keyof InputRow & string)[] | ((row: InputRow, index: number) => string | number | readonly unknown[]);",
9552
+ "export type DatasetDefinitionOptions<InputRow extends object> = { key?: DatasetRowKey<InputRow> };",
9553
+ `export type DatasetRunOptions<InputRow extends object> = { description?: ${cloudReferenceType("ctx.dataset.run.description")}; key?: DatasetRowKey<InputRow>; onRowError?: ${cloudReferenceType("ctx.dataset.run.onRowError")}; mode?: ${cloudReferenceType("ctx.dataset.run.mode")}; undrawnColumns?: ${cloudReferenceType("ctx.dataset.run.undrawnColumns")} };`,
9554
+ "export type DatasetBuilder<InputRow extends object, OutputRow extends object> = {",
9555
+ " withColumn<Name extends string, Value>(name: Name, resolver: ColumnResolver<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value>>;",
9556
+ " withColumn<Name extends string, Value>(name: Name, definition: DatasetColumnDefinition<OutputRow, Value> & { readonly runIf: (row: OutputRow, index: number) => boolean | Promise<boolean> }): DatasetBuilder<InputRow, OutputRow & Record<Name, Value | null>>;",
9557
+ " withColumn<Name extends string, Value>(name: Name, definition: DatasetColumnDefinition<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value>>;",
9558
+ " withColumn<Name extends string, Value>(name: Name, resolver: StepResolver<OutputRow, Value> | RunnableColumnStepProgram<Value>, options: StepOptions<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value | null>>;",
9559
+ " withColumns<Program extends StepProgram<OutputRow, object, unknown>>(program: Program): DatasetBuilder<InputRow, StepProgramOutput<Program>>;",
9560
+ " step<Name extends string, Value>(name: Name, resolver: ColumnResolver<OutputRow, Value>): never;",
9561
+ " run(options?: DatasetRunOptions<InputRow>): Promise<PlayDataset<OutputRow>>;",
9562
+ "};",
9563
+ "export type PlayReferenceLike = { readonly playName: string; readonly name?: string } | { readonly name: string; readonly playName?: string };",
9564
+ "export interface DeeplinePlayRuntimeContext {",
9565
+ " csv<T = Record<string, unknown>>(path: string | CsvInput<T & object>, options?: CsvOptions): Promise<PlayDataset<T>>;",
9566
+ " dataset<TSource extends PlayDatasetInput<object>>(key: string, items: TSource): DatasetBuilder<PlayDatasetRow<TSource> & object, PlayDatasetRow<TSource> & object>;",
9567
+ " map<TSource extends PlayDatasetInput<object>>(key: string, items: TSource, options?: DatasetDefinitionOptions<PlayDatasetRow<TSource> & object>): never;",
9568
+ " readonly run: { readonly id: string };",
9569
+ ` runSteps<TInput extends Record<string, unknown>, TOutput>(program: RunnableStepProgram<TInput, TOutput>, input: TInput, options?: { description?: ${cloudReferenceType("ctx.runSteps.options.description")} }): Promise<TOutput>;`,
9570
+ " tools: { execute<K extends string>(request: ToolExecutionRequest<K>): Promise<ToolExecutionOutput<K>> };",
9571
+ ` customerDb: { query<TRow extends Record<string, unknown> = Record<string, unknown>>(statement: SqlQuery, options?: { maxRows?: ${cloudReferenceType("ctx.customerDb.query.options.maxRows")}; timeoutMs?: ${cloudReferenceType("ctx.customerDb.query.options.timeoutMs")} }): Promise<TRow[]> };`,
9572
+ ` tool<K extends string>(key: ${cloudReferenceType("ctx.tool.key")}, toolId: K, input: ${cloudReferenceType("ctx.tool.input")}, options?: { description?: ${cloudReferenceType("ctx.tool.options.description")} }): Promise<ToolExecutionOutput<K>>;`,
9573
+ " step<T>(id: string, run: () => T | Promise<T>, options?: RuntimeStepOptions): Promise<T>;",
9574
+ " fetch(key: string, url: string | URL, init?: RequestInit & { headers?: HeadersInit & { 'Idempotency-Key'?: string; 'X-Idempotency-Key'?: string }; auth?: SecretAuthInput }, options?: FetchOptions): Promise<PlayFetchResponse>;",
9575
+ " secrets: { get(name: string): SecretPromise; bearer(secret: string | SecretPromise | SecretHandle): SecretAuth; header(header: string, secret: string | SecretPromise | SecretHandle): SecretAuth };",
9576
+ ` runPlay<TOutput = unknown>(key: string, playRef: ${cloudReferenceType("ctx.runPlay.playRef")}, input: ${cloudReferenceType("ctx.runPlay.input")}, options: PlayCallOptions): Promise<TOutput>;`,
9577
+ " log(message: string): void;",
9578
+ ` sleep(ms: ${cloudReferenceType("ctx.sleep.ms")}): Promise<void>;`,
9579
+ "}",
9580
+ "export type DefinePlayConfig<TInput, TOutput extends PlayReturnObject> = { id: string; description?: string; input: PlayInputContract<TInput>; run: (ctx: DeeplinePlayRuntimeContext, input: TInput) => Promise<TOutput>; bindings?: PlayBindings; billing?: PlayBindings['billing']; runtime?: PlayBindings['runtime']; compatibility?: PlayBindings['compatibility'] };",
9581
+ "export type DefinedPlay<TInput, TOutput extends PlayReturnObject> = ((ctx: DeeplinePlayRuntimeContext, input: TInput) => Promise<TOutput>) & { readonly name: string; readonly __inputType?: TInput; readonly __outputType?: TOutput; readonly runtime?: PlayBindings['runtime']; readonly compatibility?: PlayBindings['compatibility'] };"
9582
+ ];
9583
+
8304
9584
  // ../play-runtime/query-result-dataset.ts
8305
9585
  var QUERY_RESULT_DATASET_PAGE_SIZE = 1e3;
8306
9586
  function isCustomerDbDatasetTool(toolId) {
@@ -8995,6 +10275,122 @@ function getDefinedPlayMetadata(value) {
8995
10275
  return candidate;
8996
10276
  }
8997
10277
 
10278
+ // src/monitors.ts
10279
+ function defineMonitor(definition) {
10280
+ if (!definition || typeof definition !== "object") {
10281
+ throw new Error("defineMonitor(definition) requires a definition object.");
10282
+ }
10283
+ const key = typeof definition.key === "string" ? definition.key.trim() : "";
10284
+ if (!key) {
10285
+ throw new Error('defineMonitor(definition) requires a non-empty "key".');
10286
+ }
10287
+ const tool = typeof definition.tool === "string" ? definition.tool.trim() : "";
10288
+ if (!tool) {
10289
+ throw new Error(
10290
+ 'defineMonitor(definition) requires a non-empty monitor tool id in "tool" (e.g. "deepline_native.company_radar").'
10291
+ );
10292
+ }
10293
+ if (!definition.payload || typeof definition.payload !== "object" || Array.isArray(definition.payload)) {
10294
+ throw new Error(
10295
+ 'defineMonitor(definition) requires "payload" to be a JSON object.'
10296
+ );
10297
+ }
10298
+ if (definition.name !== void 0 && typeof definition.name !== "string") {
10299
+ throw new Error('defineMonitor(definition) "name" must be a string.');
10300
+ }
10301
+ if (definition.controls !== void 0 && (typeof definition.controls !== "object" || Array.isArray(definition.controls))) {
10302
+ throw new Error(
10303
+ 'defineMonitor(definition) "controls" must be a JSON object.'
10304
+ );
10305
+ }
10306
+ return definition;
10307
+ }
10308
+
10309
+ // ../plays/bootstrap-routes.ts
10310
+ var DEEPLINE_TOOL_CATEGORIES = [
10311
+ "company_search",
10312
+ "people_search",
10313
+ "people_enrich",
10314
+ "email_finder",
10315
+ "email_verify",
10316
+ "phone_finder",
10317
+ "phone_verify",
10318
+ "identity_resolution",
10319
+ "reverse_lookup",
10320
+ "enrichment",
10321
+ "batch",
10322
+ "premium",
10323
+ "free"
10324
+ ];
10325
+ var PLAY_BOOTSTRAP_TEMPLATES = [
10326
+ "people-list",
10327
+ "company-list",
10328
+ "people-email",
10329
+ "people-phone",
10330
+ "company-people",
10331
+ "company-people-email",
10332
+ "company-people-phone"
10333
+ ];
10334
+ var PLAY_BOOTSTRAP_SOURCE_KINDS = [
10335
+ "csv",
10336
+ "play",
10337
+ "provider",
10338
+ "providers"
10339
+ ];
10340
+ var PLAY_BOOTSTRAP_STAGE_KINDS = [
10341
+ "play",
10342
+ "provider",
10343
+ "providers"
10344
+ ];
10345
+ var PLAY_BOOTSTRAP_FINDER_KINDS = [
10346
+ "email_finder",
10347
+ "phone_finder"
10348
+ ];
10349
+ var PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY = "company_search";
10350
+ var PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY = "people_search";
10351
+ var PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER = {
10352
+ email_finder: "email_finder",
10353
+ phone_finder: "phone_finder"
10354
+ };
10355
+ var PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER = {
10356
+ email_finder: "email",
10357
+ phone_finder: "phone"
10358
+ };
10359
+ var PLAY_BOOTSTRAP_CONTACT_FIELDS = [
10360
+ "first_name",
10361
+ "last_name",
10362
+ "domain",
10363
+ "company_name",
10364
+ "linkedin_url",
10365
+ "title",
10366
+ "email",
10367
+ "phone"
10368
+ ];
10369
+ var PLAY_BOOTSTRAP_COMPANY_FIELDS = [
10370
+ "domain",
10371
+ "company_domain",
10372
+ "company_name",
10373
+ "linkedin_url",
10374
+ "website"
10375
+ ];
10376
+ function isPlayBootstrapFinderKind(value) {
10377
+ return PLAY_BOOTSTRAP_FINDER_KINDS.includes(value);
10378
+ }
10379
+ function isPlayBootstrapTemplate(value) {
10380
+ return PLAY_BOOTSTRAP_TEMPLATES.includes(value);
10381
+ }
10382
+ function formatPlayBootstrapFinderKinds() {
10383
+ return PLAY_BOOTSTRAP_FINDER_KINDS.join("|");
10384
+ }
10385
+ function formatPlayBootstrapTemplates() {
10386
+ return PLAY_BOOTSTRAP_TEMPLATES.join("|");
10387
+ }
10388
+ function formatPlayBootstrapFinderKindsForSentence() {
10389
+ const allButLast = PLAY_BOOTSTRAP_FINDER_KINDS.slice(0, -1);
10390
+ const last = PLAY_BOOTSTRAP_FINDER_KINDS.at(-1);
10391
+ return `${allButLast.join(", ")} or ${last}`;
10392
+ }
10393
+
8998
10394
  // src/tool-output.ts
8999
10395
  import {
9000
10396
  closeSync,
@@ -9188,6 +10584,7 @@ function extractSummaryFields(payload) {
9188
10584
  export {
9189
10585
  AuthError,
9190
10586
  ConfigError,
10587
+ CtxFetchHttpError,
9191
10588
  DEEPLINE_EXTRACTOR_TARGETS,
9192
10589
  DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS,
9193
10590
  DEEPLINE_TOOL_CATEGORIES,