deepline 0.3.88 → 0.3.89

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 (121) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +534 -4
  2. package/dist/bundling-sources/sdk/src/config.ts +77 -0
  3. package/dist/bundling-sources/sdk/src/http.ts +76 -30
  4. package/dist/bundling-sources/sdk/src/index.ts +6 -0
  5. package/dist/bundling-sources/sdk/src/monitor-fleet-contract.ts +1 -1
  6. package/dist/bundling-sources/sdk/src/play.ts +15 -1
  7. package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +2 -2
  8. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  9. package/dist/bundling-sources/sdk/src/types.ts +83 -4
  10. package/dist/bundling-sources/shared_libs/integration-contracts/AGENTS.md +9 -0
  11. package/dist/bundling-sources/shared_libs/integration-contracts/README.md +3 -0
  12. package/dist/bundling-sources/shared_libs/integration-contracts/index.ts +2 -0
  13. package/dist/bundling-sources/shared_libs/monitors/analytics-install-guides.ts +77 -0
  14. package/dist/bundling-sources/shared_libs/monitors/billing/charges.ts +125 -0
  15. package/dist/bundling-sources/shared_libs/monitors/billing/policy-builders.ts +686 -0
  16. package/dist/bundling-sources/shared_libs/monitors/billing/pricing.ts +54 -0
  17. package/dist/bundling-sources/shared_libs/monitors/billing/public-pricing.ts +72 -0
  18. package/dist/bundling-sources/shared_libs/monitors/billing/session.ts +45 -0
  19. package/dist/bundling-sources/shared_libs/monitors/billing/state.ts +454 -0
  20. package/dist/bundling-sources/shared_libs/monitors/billing/tamradar.ts +260 -0
  21. package/dist/bundling-sources/shared_libs/monitors/billing/types.ts +215 -0
  22. package/dist/bundling-sources/shared_libs/monitors/callback-security.ts +333 -0
  23. package/dist/bundling-sources/shared_libs/monitors/cursor-page.ts +42 -0
  24. package/dist/bundling-sources/shared_libs/monitors/deactivation-reasons.ts +16 -0
  25. package/dist/bundling-sources/shared_libs/monitors/framework-managed-payload-fields.ts +71 -0
  26. package/dist/bundling-sources/shared_libs/monitors/generated/provider-monitor-callback-admission-targets.ts +16 -0
  27. package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +267 -0
  28. package/dist/bundling-sources/shared_libs/monitors/inbound-publish-key.ts +39 -0
  29. package/dist/bundling-sources/shared_libs/monitors/inbound-queue.ts +82 -0
  30. package/dist/bundling-sources/shared_libs/monitors/lifecycle-notifications.ts +473 -0
  31. package/dist/bundling-sources/shared_libs/monitors/org-monitor-limits.ts +1 -1
  32. package/dist/bundling-sources/shared_libs/monitors/package.json +29 -0
  33. package/dist/bundling-sources/shared_libs/monitors/provider-callback-verification.ts +1125 -0
  34. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +263 -0
  35. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-capability.ts +964 -0
  36. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-consumer-health.ts +56 -0
  37. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-errors.ts +131 -0
  38. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts +535 -0
  39. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-legacy-aliases.ts +16 -0
  40. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-priority-execution.ts +56 -0
  41. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-public-aliases.ts +28 -0
  42. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-runtime-read-eligibility.ts +38 -0
  43. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-state.ts +122 -0
  44. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-status.ts +10 -0
  45. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +112 -0
  46. package/dist/bundling-sources/shared_libs/monitors/provider-webhook-monitor-runtime.ts +300 -0
  47. package/dist/bundling-sources/shared_libs/monitors/quickstart-prompts.ts +22 -0
  48. package/dist/bundling-sources/shared_libs/monitors/snitcher-install-validation.ts +93 -0
  49. package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +332 -0
  50. package/dist/bundling-sources/shared_libs/monitors/snitcher-radar.ts +221 -0
  51. package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +105 -0
  52. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-guidance.ts +73 -0
  53. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +81 -0
  54. package/dist/bundling-sources/shared_libs/monitors/tsconfig.json +10 -0
  55. package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +6 -11
  56. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +90 -12
  57. package/dist/bundling-sources/shared_libs/play-runtime/async-play-invocation.ts +78 -0
  58. package/dist/bundling-sources/shared_libs/play-runtime/checkpoint-boundaries.ts +70 -0
  59. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +407 -53
  60. package/dist/bundling-sources/shared_libs/play-runtime/coordinator-headers.ts +1 -32
  61. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +57 -0
  62. package/dist/bundling-sources/shared_libs/play-runtime/default-batch-strategies.ts +20 -1
  63. package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +6 -0
  64. package/dist/bundling-sources/shared_libs/play-runtime/execution-protocol.ts +7 -1
  65. package/dist/bundling-sources/shared_libs/play-runtime/lane-retirement-gate.ts +189 -0
  66. package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-semantics.ts +28 -0
  67. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +2 -0
  68. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +23 -0
  69. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +1 -1
  70. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +18 -4
  71. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-start-admission.ts +68 -0
  72. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +2 -0
  73. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +1 -0
  74. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +10 -8
  75. package/dist/bundling-sources/shared_libs/play-runtime/runtime-capacity-policy.ts +20 -0
  76. package/dist/bundling-sources/shared_libs/play-runtime/runtime-contract.ts +6 -0
  77. package/dist/bundling-sources/shared_libs/play-runtime/runtime-env.ts +6 -0
  78. package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +24 -0
  79. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +30 -1
  80. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +1 -1
  81. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +1 -1
  82. package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +6 -3
  83. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +454 -17
  84. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +19 -4
  85. package/dist/bundling-sources/shared_libs/plays/contracts.ts +6 -14
  86. package/dist/bundling-sources/shared_libs/plays/core.ts +11 -6
  87. package/dist/bundling-sources/shared_libs/plays/docflow-binding-owner.ts +16 -11
  88. package/dist/bundling-sources/shared_libs/plays/email-status.ts +1 -1
  89. package/dist/bundling-sources/shared_libs/plays/resolve-static-pipeline.ts +1 -1
  90. package/dist/bundling-sources/shared_libs/plays/slug.ts +115 -0
  91. package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +44 -14
  92. package/dist/bundling-sources/shared_libs/plays/tool-category-descriptions.ts +2 -2
  93. package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +877 -0
  94. package/dist/bundling-sources/shared_libs/product-notifications/configuration-draft.ts +456 -0
  95. package/dist/bundling-sources/shared_libs/product-notifications/configuration.ts +560 -0
  96. package/dist/bundling-sources/shared_libs/product-notifications/content.ts +28 -0
  97. package/dist/bundling-sources/shared_libs/product-notifications/default-policy.ts +59 -0
  98. package/dist/bundling-sources/shared_libs/product-notifications/email.ts +246 -0
  99. package/dist/bundling-sources/shared_libs/product-notifications/evaluation.ts +280 -0
  100. package/dist/bundling-sources/shared_libs/product-notifications/events.ts +433 -0
  101. package/dist/bundling-sources/shared_libs/product-notifications/legacy-slack.ts +80 -0
  102. package/dist/bundling-sources/shared_libs/product-notifications/workspace.ts +38 -0
  103. package/dist/bundling-sources/shared_libs/runtime-env.ts +6 -0
  104. package/dist/bundling-sources/shared_libs/security/header-safe-env.ts +28 -0
  105. package/dist/bundling-sources/shared_libs/security/internal-actor.ts +50 -0
  106. package/dist/bundling-sources/shared_libs/security/secret-redaction.ts +267 -0
  107. package/dist/cli/index.js +1070 -193
  108. package/dist/cli/index.mjs +1057 -180
  109. package/dist/{compiler-manifest-Dbov16F7.d.mts → compiler-manifest-DsLbQaew.d.mts} +132 -8
  110. package/dist/{compiler-manifest-Dbov16F7.d.ts → compiler-manifest-DsLbQaew.d.ts} +132 -8
  111. package/dist/index.d.mts +834 -12
  112. package/dist/index.d.ts +834 -12
  113. package/dist/index.js +469 -40
  114. package/dist/index.mjs +469 -40
  115. package/dist/install-integrity.json +65 -4
  116. package/dist/plays/bundle-play-file.d.mts +8 -3
  117. package/dist/plays/bundle-play-file.d.ts +8 -3
  118. package/dist/plays/bundle-play-file.mjs +100 -20
  119. package/package.json +3 -1
  120. /package/dist/bundling-sources/shared_libs/{integrations/bettercontact-execution-policy.ts → integration-contracts/bettercontact/execution-policy.ts} +0 -0
  121. /package/dist/bundling-sources/shared_libs/{integrations/theirstack-execution-policy.ts → integration-contracts/theirstack/execution-policy.ts} +0 -0
@@ -0,0 +1,68 @@
1
+ import { RUNTIME_CAPACITY_POLICY } from '../../runtime-capacity-policy';
2
+
3
+ export type DaytonaSandboxStartAdmission = {
4
+ run<T>(operation: () => Promise<T>): Promise<T>;
5
+ };
6
+
7
+ /**
8
+ * Daytona sandbox starts are control-plane transitions, not execution work.
9
+ * Keep their admission independent from Absurd worker slots so a run burst can
10
+ * still multiplex started sandboxes without stampeding the provider's create
11
+ * transition. A permit covers timeout reconciliation too: releasing it when
12
+ * `create` times out would admit another create while the first named sandbox
13
+ * is still transitioning, recreating the unsafe overlap this gate prevents.
14
+ */
15
+ export function createDaytonaSandboxStartAdmission(
16
+ concurrency =
17
+ RUNTIME_CAPACITY_POLICY.sandboxAcquisition
18
+ .daytonaConcurrentStartsPerProcess,
19
+ ): DaytonaSandboxStartAdmission {
20
+ if (!Number.isInteger(concurrency) || concurrency <= 0) {
21
+ throw new Error(
22
+ 'Daytona sandbox-start concurrency must be a positive integer.',
23
+ );
24
+ }
25
+
26
+ let active = 0;
27
+ const waiters: Array<(release: () => void) => void> = [];
28
+
29
+ const createRelease = (): (() => void) => {
30
+ let released = false;
31
+ return () => {
32
+ if (released) return;
33
+ released = true;
34
+ const next = waiters.shift();
35
+ if (next) {
36
+ // Transfer the occupied permit directly. Keeping `active` unchanged
37
+ // prevents a new eager caller from jumping ahead of the FIFO waiter.
38
+ next(createRelease());
39
+ return;
40
+ }
41
+ active -= 1;
42
+ };
43
+ };
44
+
45
+ return {
46
+ async run<T>(operation: () => Promise<T>): Promise<T> {
47
+ // Preserve eager prepare semantics when capacity is free: the provider
48
+ // create begins in this turn, just as it did before admission existed.
49
+ // Only contended callers cross an asynchronous queue boundary.
50
+ const release =
51
+ active < concurrency
52
+ ? (() => {
53
+ active += 1;
54
+ return createRelease();
55
+ })()
56
+ : await new Promise<() => void>((resolve) => waiters.push(resolve));
57
+ try {
58
+ return await operation();
59
+ } finally {
60
+ release();
61
+ }
62
+ },
63
+ };
64
+ }
65
+
66
+ /** One admission queue per worker process; all run slots share it. */
67
+ export const daytonaSandboxStartAdmission =
68
+ createDaytonaSandboxStartAdmission();
@@ -43,6 +43,7 @@ import {
43
43
  prepareDetachedDaytonaRunner,
44
44
  } from './daytona-session-execution';
45
45
  import { RUNTIME_RELIABILITY_POLICY } from '../../runtime-reliability-policy';
46
+ import { daytonaSandboxStartAdmission } from './daytona-start-admission';
46
47
 
47
48
  const DAYTONA_COMMAND_RECOVERY_TIMEOUT_MS =
48
49
  RUNTIME_RELIABILITY_POLICY.sandbox.daytonaCommandRecoveryTimeoutMs;
@@ -973,6 +974,7 @@ function prepareDaytonaExecution(
973
974
  callbacks.reserveSandboxCapacity!('daytona', providerAttempt)
974
975
  : undefined,
975
976
  releaseSandboxCapacity: callbacks?.releaseSandboxCapacity,
977
+ startAdmission: daytonaSandboxStartAdmission,
976
978
  });
977
979
  return {
978
980
  kind: 'daytona',
@@ -11,6 +11,7 @@ import type { DetachedRunnerSuspension } from '../suspension';
11
11
  export type RuntimeSandboxProviderId = 'daytona' | 'modal';
12
12
 
13
13
  export type RuntimeSandboxRef = {
14
+ /** Frozen at 1: persisted in suspension_json, so readers must keep taking 1. */
14
15
  schemaVersion: 1;
15
16
  provider: RuntimeSandboxProviderId;
16
17
  resourceId: string;
@@ -3361,8 +3361,8 @@ async function writeRuntimeRows(
3361
3361
  const insertedRowsCte =
3362
3362
  input.mode === 'upsert'
3363
3363
  ? `inserted_rows AS (
3364
- INSERT INTO ${sheetTable(session)} (_key, _status, _run_id, _input_index${physicalInsertColumnsSql})
3365
- SELECT _key, 'pending', $4::text, _input_index${physicalInsertValuesSql}
3364
+ INSERT INTO ${sheetTable(session)} (_key, _status, _run_id, _input_index, _created_at${physicalInsertColumnsSql})
3365
+ SELECT _key, 'pending', $4::text, _input_index, now()${physicalInsertValuesSql}
3366
3366
  FROM input_rows
3367
3367
  ON CONFLICT (_key) DO UPDATE SET
3368
3368
  _status = 'pending',
@@ -3374,8 +3374,8 @@ async function writeRuntimeRows(
3374
3374
  RETURNING _key
3375
3375
  ),`
3376
3376
  : `inserted_rows AS (
3377
- INSERT INTO ${sheetTable(session)} (_key, _status, _run_id, _input_index${physicalInsertColumnsSql})
3378
- SELECT _key, 'pending', $4::text, _input_index${physicalInsertValuesSql}
3377
+ INSERT INTO ${sheetTable(session)} (_key, _status, _run_id, _input_index, _created_at${physicalInsertColumnsSql})
3378
+ SELECT _key, 'pending', $4::text, _input_index, now()${physicalInsertValuesSql}
3379
3379
  FROM input_rows
3380
3380
  RETURNING _key
3381
3381
  ),`;
@@ -3660,8 +3660,8 @@ async function prepareRuntimeSheetDatasetRows(
3660
3660
  RETURNING target._key
3661
3661
  ),
3662
3662
  inserted_rows AS (
3663
- INSERT INTO ${sheetTable(session)} (_key, _status, _run_id, _input_index, _attempt_id, _attempt_owner_run_id, _attempt_expires_at, _attempt_seq, _write_version, _writer_run_id${input.physicalInsertColumnsSql})
3664
- SELECT _key, 'pending', $4::text, _input_index, $7::text, $8::text, $9::timestamptz, $10::integer, $12::bigint, $4::text${input.physicalInsertValuesSql}
3663
+ INSERT INTO ${sheetTable(session)} (_key, _status, _run_id, _input_index, _attempt_id, _attempt_owner_run_id, _attempt_expires_at, _attempt_seq, _write_version, _writer_run_id, _created_at${input.physicalInsertColumnsSql})
3664
+ SELECT _key, 'pending', $4::text, _input_index, $7::text, $8::text, $9::timestamptz, $10::integer, $12::bigint, $4::text, now()${input.physicalInsertValuesSql}
3665
3665
  FROM input_rows
3666
3666
  ON CONFLICT (_key) DO UPDATE SET
3667
3667
  _status = 'pending',
@@ -3991,9 +3991,9 @@ async function prepareNetNewRuntimeSheetDatasetRows(
3991
3991
  inserted_rows AS (
3992
3992
  INSERT INTO ${sheetTable(session)}
3993
3993
  (_key, _status, _run_id, _input_index, _attempt_id, _attempt_owner_run_id,
3994
- _attempt_expires_at, _attempt_seq, _write_version, _writer_run_id${input.physicalInsertColumnsSql})
3994
+ _attempt_expires_at, _attempt_seq, _write_version, _writer_run_id, _created_at${input.physicalInsertColumnsSql})
3995
3995
  SELECT _key, 'pending', $4::text, _input_index, $5::text, $6::text,
3996
- $7::timestamptz, $8::integer, $9::bigint, $4::text${input.physicalInsertValuesSql}
3996
+ $7::timestamptz, $8::integer, $9::bigint, $4::text, now()${input.physicalInsertValuesSql}
3997
3997
  FROM input_rows
3998
3998
  ON CONFLICT (_key) DO NOTHING
3999
3999
  RETURNING _key
@@ -7642,6 +7642,7 @@ async function insertMissingCompletedMapRowChunks(
7642
7642
  _attempt_owner_run_id,
7643
7643
  _attempt_expires_at,
7644
7644
  _attempt_seq,
7645
+ _created_at,
7645
7646
  _cell_meta${physicalInsertColumnsSql}
7646
7647
  )
7647
7648
  SELECT _key,
@@ -7652,6 +7653,7 @@ async function insertMissingCompletedMapRowChunks(
7652
7653
  $9::text,
7653
7654
  $10::timestamptz,
7654
7655
  $11::integer,
7656
+ now(),
7655
7657
  cell_meta_patch${physicalInsertValuesSql}
7656
7658
  FROM missing_rows
7657
7659
  ON CONFLICT (_key) DO NOTHING
@@ -26,6 +26,14 @@ export const RUNTIME_CAPACITY_POLICY = {
26
26
  claimOperationTimeoutMs: 20_000,
27
27
  requestTimeoutMs: 30_000,
28
28
  },
29
+ sandboxAcquisition: {
30
+ /**
31
+ * Starting a Daytona sandbox is a provider control-plane transition, not
32
+ * an Absurd execution slot. Serialize starts within each worker process;
33
+ * once started, all eight execution slots may run concurrently.
34
+ */
35
+ daytonaConcurrentStartsPerProcess: 1,
36
+ },
29
37
  } as const;
30
38
 
31
39
  export const ABSURD_GLOBAL_RUN_CONCURRENCY =
@@ -96,6 +104,18 @@ function nonNegativeNumber(value: number): number {
96
104
  }
97
105
 
98
106
  export function assertRuntimeCapacityPolicy(): void {
107
+ if (
108
+ !Number.isInteger(
109
+ RUNTIME_CAPACITY_POLICY.sandboxAcquisition
110
+ .daytonaConcurrentStartsPerProcess,
111
+ ) ||
112
+ RUNTIME_CAPACITY_POLICY.sandboxAcquisition
113
+ .daytonaConcurrentStartsPerProcess <= 0
114
+ ) {
115
+ throw new Error(
116
+ 'Daytona sandbox-start concurrency must be a positive integer.',
117
+ );
118
+ }
99
119
  if (
100
120
  RUNTIME_CAPACITY_POLICY.receiptGateway.requestTimeoutMs <=
101
121
  RUNTIME_CAPACITY_POLICY.receiptGateway.admissionTimeoutMs
@@ -3,11 +3,17 @@
3
3
  * receipt presentations. New operations must not use this as a version gate.
4
4
  */
5
5
  export const LEGACY_RUNTIME_RECEIPT_WIRE_HEADER = 'x-deepline-runtime-contract';
6
+ // Frozen: production lane main-9281ae259f still sends wire format 2. Delete
7
+ // this and `resolveLegacyRuntimeReceiptWireFormat` after that lane retires.
6
8
  export const LEGACY_RUNTIME_RECEIPT_WIRE_FORMAT = 3 as const;
7
9
  /**
8
10
  * Historical workers validate this readiness range before they claim work.
9
11
  * It is an output-only compatibility presentation; current callers use named
10
12
  * operation capabilities and do not treat it as a global admission contract.
13
+ *
14
+ * Frozen: a lane built before the global compatibility gate was removed calls
15
+ * /readyz at boot and throws when this range is absent. Delete after every such
16
+ * lane has retired.
11
17
  */
12
18
  export const LEGACY_RUNTIME_READINESS_MIN_SUPPORTED = 1 as const;
13
19
  export const LEGACY_RUNTIME_READINESS_CURRENT = 6 as const;
@@ -53,3 +53,9 @@ 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
+ }
@@ -12,6 +12,30 @@
12
12
  */
13
13
  export const PROD_DEFAULT_RUNTIME_SCHEDULER_SCHEMA = 'runtime_scheduler';
14
14
 
15
+ /** A wire-safe Postgres schema name that identifies one runtime topology. */
16
+ export const RUNTIME_SCHEDULER_SCHEMA_RE = /^[a-z_][a-z0-9_]{0,62}$/;
17
+
18
+ export function normalizeRuntimeSchedulerSchema(value: unknown): string | null {
19
+ if (typeof value !== 'string') return null;
20
+ const schema = value.trim();
21
+ return RUNTIME_SCHEDULER_SCHEMA_RE.test(schema) ? schema : null;
22
+ }
23
+
24
+ /**
25
+ * The one release-id shape. A release id is minted by the release controller
26
+ * and doubles as the lane's queue suffix (`runs_<releaseId>`) and the
27
+ * `DEEPLINE_RUNTIME_DEPLOY_VERSION` on every Machine in the lane, so it must be
28
+ * a stable lowercase engine-safe slug: no uppercase, no underscore, no repeated
29
+ * or trailing hyphen, 6 to 64 characters.
30
+ *
31
+ * It lives here, dependency-free, because the Fly lane operator, the release
32
+ * controller, the internal registry route, and the admin routes must all agree
33
+ * on it — a second copy is how one surface silently starts accepting an id the
34
+ * queue cannot name.
35
+ */
36
+ export const ABSURD_RELEASE_ID_RE =
37
+ /^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){5,63}$/;
38
+
15
39
  /**
16
40
  * True when the scheduler schema names an isolated (preview CI / worktree)
17
41
  * topology. Null/empty/prod-default => false (production topology). Callers
@@ -41,10 +41,36 @@ export type { PlayRunInputPayload };
41
41
 
42
42
  export type PlaySchedulerSubmitInput = {
43
43
  runId: string;
44
+ /** First-class async-child lineage. Absent for root launches. */
45
+ parentRunId?: string | null;
46
+ rootRunId?: string | null;
47
+ asyncLaunchKey?: string | null;
48
+ asyncInvocationKey?: string | null;
49
+ asyncRequestFingerprint?: string | null;
50
+ /** Full play ancestry for a scheduled child, including this play. */
51
+ asyncAncestryPlayIds?: string[] | null;
44
52
  playId: string;
45
53
  playName: string;
54
+ playReference?: string | null;
55
+ /**
56
+ * Immutable scheduler namespace for this admission. The durable
57
+ * `run.created` projector persists it onto the Play Run so replay/control
58
+ * paths stay on the original runtime lane instead of falling back to a host
59
+ * default.
60
+ */
61
+ schedulerSchema?: string | null;
62
+ definitionScope?: 'org' | 'system' | null;
63
+ revisionId?: string | null;
46
64
  workflowFamilyKey?: string | null;
47
65
  artifactStorageKey: string;
66
+ /**
67
+ * The runtime PostgreSQL admission path committed this launch before its
68
+ * Convex `run.created` projection exists. The worker must deliver that
69
+ * causal fact before it can claim an execution attempt.
70
+ *
71
+ * Omitted for legacy launches whose Play Run row was persisted synchronously.
72
+ */
73
+ requiresRunCreatedProjection?: boolean;
48
74
  /** Optional inline artifact for the Node scheduler. */
49
75
  runtimeArtifact?: unknown;
50
76
  artifactHash: string;
@@ -52,6 +78,9 @@ export type PlaySchedulerSubmitInput = {
52
78
  /** Immutable scheduler/worker/runner ABI snapshot (not a Git SHA). */
53
79
  runtimeProtocolVersion?: PlayRuntimeProtocolVersion | null;
54
80
  input: PlayRunInputPayload;
81
+ /** Bounded launch metadata used only by the asynchronous ledger projector. */
82
+ staticPipeline?: unknown;
83
+ inputSummary?: Record<string, unknown>;
55
84
  /** Convex metadata for the exact input saved before scheduler submission. */
56
85
  inputFileId?: string;
57
86
  inputBytes?: number;
@@ -127,7 +156,7 @@ export type PlaySchedulerSubmitInput = {
127
156
  userId?: string | null;
128
157
  source?: 'published' | 'ad_hoc' | 'draft';
129
158
  /** Invocation origin, distinct from the artifact source above. */
130
- triggerSource?: 'api' | 'webhook' | 'cron' | 'sql_listener';
159
+ triggerSource?: 'api' | 'webhook' | 'cron' | 'sql_listener' | 'async_child';
131
160
  /** Null lets a durable trigger wait for capacity; a number bounds queue delay. */
132
161
  queueMaxDelaySeconds?: number | null;
133
162
  /**
@@ -186,7 +186,7 @@ function isInsufficientCreditsBilling(
186
186
  * credit/cap denial: a funded org is temporarily blocked because our billing
187
187
  * store hiccuped, so it must be repairable on the next run rather than cached as
188
188
  * a terminal failure. See `billingUnavailableResponse` in
189
- * src/lib/integrations/execute-billing.ts. This class is the exact incident
189
+ * packages/integrations/execute-billing.ts. This class is the exact incident
190
190
  * poison closed by issues #2561/#2706: without this carve-out a billing-plane
191
191
  * outage classifies every affected tool call as `hard_billing_error` ->
192
192
  * `terminal` and the next run replays the cached failure instead of retrying.
@@ -206,7 +206,7 @@ function adaptV2ExecuteResponseToToolResult(data: Record<string, unknown>): {
206
206
  *
207
207
  * Boundary note: provider-specific redaction (wiza/apify/bettercontact billing
208
208
  * fields) happens server-side in
209
- * `src/lib/integrations/execute-result-normalization.ts` BEFORE the response
209
+ * `packages/integrations/execute-result-normalization.ts` BEFORE the response
210
210
  * leaves the API. This module only ever sees the already-redacted public
211
211
  * response — do not move redaction here, it would leak provider internals
212
212
  * into the shared runtime bundles.
@@ -20,10 +20,13 @@ export type PlayRuntimeFeature =
20
20
  | 'packaged_files';
21
21
 
22
22
  export type PlayArtifactCompatibility = {
23
- apiVersion: number;
23
+ /** Historical marker carried by stored artifacts. Nothing branches on it. */
24
+ apiVersion?: number;
24
25
  artifactVersion: number;
25
- minRunnerVersion: number;
26
- runtimeFeatures: PlayRuntimeFeature[];
26
+ /** Historical marker carried by stored artifacts. Every runner reads every artifact. */
27
+ minRunnerVersion?: number;
28
+ /** Historical marker carried by stored artifacts. Capabilities are named per operation. */
29
+ runtimeFeatures?: PlayRuntimeFeature[];
27
30
  runtimeBackend?: string | null;
28
31
  /** Missing preserves the legacy schema used before this field existed. */
29
32
  toolErrorSchemaVersion?: ToolExecutionErrorSchemaVersion;