deepline 0.3.240 → 0.3.241

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.
@@ -200,7 +200,7 @@ export const SDK_RELEASE = {
200
200
  // getters keep their established compatibility behavior.
201
201
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
202
202
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
203
- version: '0.3.240',
203
+ version: '0.3.241',
204
204
  updateSummary:
205
205
  'Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.',
206
206
  packageCapabilities: {
@@ -187,8 +187,16 @@ export const RUNTIME_TOPOLOGY = {
187
187
  dockerfile: 'deploy/fly/runtime-worker/Dockerfile.absurd-scaler',
188
188
  },
189
189
  processGroups: {
190
- app: { desiredStarted: 1, healthCheck: 'scaler_ready' },
191
- projector: { desiredStarted: 2, healthCheck: 'projector_ready' },
190
+ app: {
191
+ desiredStarted: 1,
192
+ healthCheck: 'scaler_ready',
193
+ guest: { cpu_kind: 'shared', cpus: 1, memory_mb: 256 },
194
+ },
195
+ projector: {
196
+ desiredStarted: 2,
197
+ healthCheck: 'projector_ready',
198
+ guest: { cpu_kind: 'shared', cpus: 1, memory_mb: 1024 },
199
+ },
192
200
  },
193
201
  },
194
202
  workerLogShipper: {
@@ -4686,10 +4686,10 @@ async function submitPostgresSchedulerRunTransaction(
4686
4686
  const taskSpawnCtes = absurdTask
4687
4687
  ? `task_request AS (
4688
4688
  SELECT
4689
- $21::text AS queue_name,
4690
- $22::text AS task_name,
4691
- $23::jsonb AS params,
4692
- $24::jsonb AS options
4689
+ $20::text AS queue_name,
4690
+ $21::text AS task_name,
4691
+ $22::jsonb AS params,
4692
+ $23::jsonb AS options
4693
4693
  FROM admission
4694
4694
  WHERE (
4695
4695
  NOT admission.existing_run
@@ -4753,10 +4753,15 @@ async function submitPostgresSchedulerRunTransaction(
4753
4753
  SELECT pg_advisory_xact_lock_shared(
4754
4754
  ${POSTGRES_SCHEDULER_RELEASE_ADMISSION_LOCK_NAMESPACE},
4755
4755
  ${quoteIdent(schemaName(options))}.runtime_release_admission_lock_id(
4756
- coalesce($13::text, 'non-absurd')
4756
+ coalesce($12::text, 'non-absurd')
4757
4757
  )
4758
4758
  )
4759
4759
  FROM run_lock
4760
+ ), launch_payload AS MATERIALIZED (
4761
+ -- Keep the bound document behind one materialization boundary. A
4762
+ -- custom plan otherwise copies its JSON constant into every field
4763
+ -- extraction and can consume hundreds of MiB during admission.
4764
+ SELECT $8::jsonb AS launch_json
4760
4765
  ), parent_run AS MATERIALIZED (
4761
4766
  SELECT runs.run_id,
4762
4767
  runs.status,
@@ -4774,8 +4779,8 @@ async function submitPostgresSchedulerRunTransaction(
4774
4779
  ) AS root_run_id
4775
4780
  FROM admission_lock
4776
4781
  JOIN ${tableName('runs', options)} AS runs
4777
- ON runs.run_id = $16::text
4778
- WHERE $16::text IS NOT NULL
4782
+ ON runs.run_id = $15::text
4783
+ WHERE $15::text IS NOT NULL
4779
4784
  FOR UPDATE
4780
4785
  ), existing_run AS (
4781
4786
  SELECT
@@ -4783,13 +4788,14 @@ async function submitPostgresSchedulerRunTransaction(
4783
4788
  ${existingLaunchIntentMatchesSql}
4784
4789
  OR ${quoteIdent(schemaName(options))}.runtime_launch_admission_matches(
4785
4790
  coalesce(runs.admission_json, runs.launch_json),
4786
- $8::jsonb
4791
+ launch_payload.launch_json
4787
4792
  )
4788
4793
  ) AS matches_launch,
4789
4794
  coalesce(runs.admission_json, runs.launch_json) AS launch_json,
4790
4795
  runs.absurd_task_id,
4791
4796
  runs.status
4792
4797
  FROM admission_lock
4798
+ CROSS JOIN launch_payload
4793
4799
  JOIN ${tableName('runs', options)} AS runs
4794
4800
  ON runs.run_id = $1
4795
4801
  ), parent_attempt AS MATERIALIZED (
@@ -4797,8 +4803,8 @@ async function submitPostgresSchedulerRunTransaction(
4797
4803
  FROM parent_run
4798
4804
  JOIN ${tableName('attempts', options)} AS attempts
4799
4805
  ON attempts.run_id = parent_run.run_id
4800
- WHERE attempts.attempt = $18::integer
4801
- AND attempts.lease_token = $19::text
4806
+ WHERE attempts.attempt = $17::integer
4807
+ AND attempts.lease_token = $18::text
4802
4808
  AND attempts.status IN ('claimed', 'running', 'waiting')
4803
4809
  AND NOT EXISTS (
4804
4810
  SELECT 1
@@ -4809,7 +4815,7 @@ async function submitPostgresSchedulerRunTransaction(
4809
4815
  ), admission AS (
4810
4816
  SELECT EXISTS (SELECT 1 FROM existing_run) AS existing_run,
4811
4817
  CASE
4812
- WHEN $16::text IS NULL THEN true
4818
+ WHEN $15::text IS NULL THEN true
4813
4819
  ELSE EXISTS (
4814
4820
  SELECT 1
4815
4821
  FROM parent_run
@@ -4819,21 +4825,21 @@ async function submitPostgresSchedulerRunTransaction(
4819
4825
  )
4820
4826
  AND (
4821
4827
  parent_run.release_id IS NULL
4822
- OR $12::text IS NULL
4823
- OR parent_run.release_id = $15::text
4828
+ OR $11::text IS NULL
4829
+ OR parent_run.release_id = $14::text
4824
4830
  )
4825
- AND parent_run.root_run_id = $17::text
4831
+ AND parent_run.root_run_id = $16::text
4826
4832
  AND (
4827
- ($20::boolean = false AND $18::integer IS NULL AND $19::text IS NULL)
4833
+ ($19::boolean = false AND $17::integer IS NULL AND $18::text IS NULL)
4828
4834
  OR EXISTS (SELECT 1 FROM parent_attempt)
4829
4835
  )
4830
4836
  )
4831
4837
  END AS parent_accepting,
4832
4838
  CASE
4833
- WHEN $16::text IS NULL THEN true
4834
- WHEN $20::boolean = false
4835
- AND $18::integer IS NULL
4836
- AND $19::text IS NULL THEN true
4839
+ WHEN $15::text IS NULL THEN true
4840
+ WHEN $19::boolean = false
4841
+ AND $17::integer IS NULL
4842
+ AND $18::text IS NULL THEN true
4837
4843
  ELSE EXISTS (SELECT 1 FROM parent_attempt)
4838
4844
  END AS parent_attempt_current,
4839
4845
  EXISTS (
@@ -4844,13 +4850,13 @@ async function submitPostgresSchedulerRunTransaction(
4844
4850
  CASE
4845
4851
  -- A live descendant stays on its parent's pinned release even after
4846
4852
  -- that lane stops accepting unrelated new roots.
4847
- WHEN $16::text IS NOT NULL THEN true
4848
- WHEN $12::text IS NULL THEN true
4853
+ WHEN $15::text IS NOT NULL THEN true
4854
+ WHEN $11::text IS NULL THEN true
4849
4855
  ELSE coalesce((
4850
4856
  SELECT accepting
4851
4857
  FROM ${tableName('runtime_release_admission', options)}
4852
- WHERE release_id = $12
4853
- OR ($14::boolean AND release_id = $15)
4858
+ WHERE release_id = $11
4859
+ OR ($13::boolean AND release_id = $14)
4854
4860
  ORDER BY admission_epoch DESC, accepting ASC
4855
4861
  LIMIT 1
4856
4862
  ), true)
@@ -4873,9 +4879,9 @@ async function submitPostgresSchedulerRunTransaction(
4873
4879
  absurd_task_id,
4874
4880
  admission_json
4875
4881
  )
4876
- SELECT $1, $2, $3, $4, $5, $6, $7, $8::jsonb, $9::jsonb, 'queued',
4882
+ SELECT $1, $2, $3, $4, $5, $6, $7, launch_payload.launch_json, coalesce(nullif(launch_payload.launch_json -> 'input', 'null'::jsonb), '{}'::jsonb), 'queued',
4877
4883
  (SELECT task_id FROM task_spawn),
4878
- $8::jsonb - ARRAY[
4884
+ launch_payload.launch_json - ARRAY[
4879
4885
  'executorToken',
4880
4886
  'preloadedDbSessionUnwrapKey',
4881
4887
  'preloadedDbSessions',
@@ -4885,6 +4891,7 @@ async function submitPostgresSchedulerRunTransaction(
4885
4891
  'vercelProtectionBypassToken'
4886
4892
  ]::text[]
4887
4893
  FROM admission
4894
+ CROSS JOIN launch_payload
4888
4895
  WHERE NOT existing_run
4889
4896
  AND accepting_new
4890
4897
  AND parent_accepting
@@ -4921,48 +4928,49 @@ async function submitPostgresSchedulerRunTransaction(
4921
4928
  'playName', $4::text,
4922
4929
  -- Optional lineage makes a projected async child discoverable
4923
4930
  -- from its terminal parent. Older envelopes omit these keys.
4924
- 'parentRunId', $8::jsonb ->> 'parentRunId',
4925
- 'rootRunId', $8::jsonb ->> 'rootRunId',
4926
- 'asyncLaunchKey', $8::jsonb ->> 'asyncLaunchKey',
4927
- 'asyncInvocationKey', $8::jsonb ->> 'asyncInvocationKey',
4928
- 'asyncRequestFingerprint', $8::jsonb ->> 'asyncRequestFingerprint',
4929
- 'asyncAncestryPlayIds', $8::jsonb -> 'asyncAncestryPlayIds',
4930
- 'definitionName', $8::jsonb ->> 'definitionName',
4931
- 'playReference', $8::jsonb ->> 'playReference',
4932
- 'definitionScope', $8::jsonb ->> 'definitionScope',
4933
- 'revisionId', $8::jsonb ->> 'revisionId',
4934
- 'workflowFamilyKey', $8::jsonb ->> 'workflowFamilyKey',
4931
+ 'parentRunId', launch_payload.launch_json ->> 'parentRunId',
4932
+ 'rootRunId', launch_payload.launch_json ->> 'rootRunId',
4933
+ 'asyncLaunchKey', launch_payload.launch_json ->> 'asyncLaunchKey',
4934
+ 'asyncInvocationKey', launch_payload.launch_json ->> 'asyncInvocationKey',
4935
+ 'asyncRequestFingerprint', launch_payload.launch_json ->> 'asyncRequestFingerprint',
4936
+ 'asyncAncestryPlayIds', launch_payload.launch_json -> 'asyncAncestryPlayIds',
4937
+ 'definitionName', launch_payload.launch_json ->> 'definitionName',
4938
+ 'playReference', launch_payload.launch_json ->> 'playReference',
4939
+ 'definitionScope', launch_payload.launch_json ->> 'definitionScope',
4940
+ 'revisionId', launch_payload.launch_json ->> 'revisionId',
4941
+ 'workflowFamilyKey', launch_payload.launch_json ->> 'workflowFamilyKey',
4935
4942
  'artifactStorageKey', $7::text,
4936
- 'artifactHash', $8::jsonb ->> 'artifactHash',
4943
+ 'artifactHash', launch_payload.launch_json ->> 'artifactHash',
4937
4944
  'graphHash', $5::text,
4938
4945
  'runtimeBackend', $6::text,
4939
- 'schedulerBackend', $8::jsonb ->> 'schedulerBackend',
4940
- 'schedulerSchema', $8::jsonb ->> 'schedulerSchema',
4941
- 'executionProfile', $8::jsonb ->> 'executionProfile',
4942
- 'runtimeReleaseId', $8::jsonb ->> 'runtimeReleaseId',
4943
- 'runtimeDeployVersion', $8::jsonb ->> 'runtimeDeployVersion',
4944
- 'runtimeCallbackBaseUrl', $8::jsonb ->> 'runtimeCallbackBaseUrl',
4945
- 'coordinatorUrl', $8::jsonb ->> 'coordinatorUrl',
4946
- 'coordinatorWorkerName', $8::jsonb ->> 'coordinatorWorkerName',
4947
- 'runtimeWorkflowName', $8::jsonb ->> 'runtimeWorkflowName',
4948
- 'runtimeHarnessWorkerName', $8::jsonb ->> 'runtimeHarnessWorkerName',
4949
- 'maxCreditsPerRun', $8::jsonb -> 'maxCreditsPerRun',
4950
- 'staticPipeline', $8::jsonb -> 'staticPipeline',
4951
- 'source', $8::jsonb ->> 'source',
4952
- 'triggerSource', $8::jsonb ->> 'triggerSource',
4953
- 'inputFileId', $8::jsonb ->> 'inputFileId',
4954
- 'inputBytes', $8::jsonb -> 'inputBytes',
4955
- 'inputSha256', $8::jsonb ->> 'inputSha256',
4956
- 'replayedFromRunId', $8::jsonb ->> 'replayedFromRunId',
4957
- 'secretRefs', $8::jsonb -> 'secretRefs',
4958
- 'inputSummary', $8::jsonb -> 'inputSummary'
4946
+ 'schedulerBackend', launch_payload.launch_json ->> 'schedulerBackend',
4947
+ 'schedulerSchema', launch_payload.launch_json ->> 'schedulerSchema',
4948
+ 'executionProfile', launch_payload.launch_json ->> 'executionProfile',
4949
+ 'runtimeReleaseId', launch_payload.launch_json ->> 'runtimeReleaseId',
4950
+ 'runtimeDeployVersion', launch_payload.launch_json ->> 'runtimeDeployVersion',
4951
+ 'runtimeCallbackBaseUrl', launch_payload.launch_json ->> 'runtimeCallbackBaseUrl',
4952
+ 'coordinatorUrl', launch_payload.launch_json ->> 'coordinatorUrl',
4953
+ 'coordinatorWorkerName', launch_payload.launch_json ->> 'coordinatorWorkerName',
4954
+ 'runtimeWorkflowName', launch_payload.launch_json ->> 'runtimeWorkflowName',
4955
+ 'runtimeHarnessWorkerName', launch_payload.launch_json ->> 'runtimeHarnessWorkerName',
4956
+ 'maxCreditsPerRun', launch_payload.launch_json -> 'maxCreditsPerRun',
4957
+ 'staticPipeline', launch_payload.launch_json -> 'staticPipeline',
4958
+ 'source', launch_payload.launch_json ->> 'source',
4959
+ 'triggerSource', launch_payload.launch_json ->> 'triggerSource',
4960
+ 'inputFileId', launch_payload.launch_json ->> 'inputFileId',
4961
+ 'inputBytes', launch_payload.launch_json -> 'inputBytes',
4962
+ 'inputSha256', launch_payload.launch_json ->> 'inputSha256',
4963
+ 'replayedFromRunId', launch_payload.launch_json ->> 'replayedFromRunId',
4964
+ 'secretRefs', launch_payload.launch_json -> 'secretRefs',
4965
+ 'inputSummary', launch_payload.launch_json -> 'inputSummary'
4959
4966
  )),
4960
4967
  ${causalOutboxCreatedAt('run_insert.run_id', options)}
4961
4968
  FROM run_insert
4969
+ CROSS JOIN launch_payload
4962
4970
  -- Old Vercel launchers do not carry the immutable admission envelope.
4963
4971
  -- During a Convex-first rollout they retain their established start
4964
4972
  -- projection; only the new launcher opts into queued projection.
4965
- WHERE $8::jsonb ? 'playReference'
4973
+ WHERE launch_payload.launch_json ? 'playReference'
4966
4974
  ON CONFLICT (event_id) DO NOTHING
4967
4975
  RETURNING run_id
4968
4976
  )
@@ -4996,7 +5004,7 @@ async function submitPostgresSchedulerRunTransaction(
4996
5004
  (SELECT launch_json FROM existing_run) AS existing_launch_json,
4997
5005
  CASE WHEN EXISTS (SELECT 1 FROM run_insert)
4998
5006
  OR EXISTS (SELECT 1 FROM run_recovery)
4999
- THEN pg_notify($10, $11)
5007
+ THEN pg_notify($9, $10)
5000
5008
  END
5001
5009
  FROM admission
5002
5010
  `,
@@ -5009,7 +5017,6 @@ async function submitPostgresSchedulerRunTransaction(
5009
5017
  input.runtimeBackend,
5010
5018
  input.artifactStorageKey,
5011
5019
  stringifyPostgresJson(input),
5012
- stringifyPostgresJson(input.input ?? {}),
5013
5020
  postgresSchedulerNotifyChannel('queue', options),
5014
5021
  JSON.stringify({ runId: input.runId, playName: input.playName }),
5015
5022
  releaseAdmissionKey,
@@ -5879,6 +5886,10 @@ export async function firePostgresSchedulerCronSchedule(
5879
5886
  'cron-schedule:' || $1::text
5880
5887
  )
5881
5888
  )
5889
+ ), launch_payload AS MATERIALIZED (
5890
+ -- The same payload boundary as ordinary admission: no large JSON
5891
+ -- constants repeated through the occurrence and outbox query plan.
5892
+ SELECT $6::jsonb AS launch_json
5882
5893
  ), matching_schedule AS MATERIALIZED (
5883
5894
  SELECT schedule.schedule_id
5884
5895
  FROM schedule_lock
@@ -5897,9 +5908,10 @@ export async function firePostgresSchedulerCronSchedule(
5897
5908
  coalesce(runs.admission_json, runs.launch_json) AS launch_json,
5898
5909
  ${quoteIdent(schemaName(options))}.runtime_launch_admission_matches(
5899
5910
  coalesce(runs.admission_json, runs.launch_json),
5900
- $6::jsonb
5911
+ launch_payload.launch_json
5901
5912
  ) AS matches_launch
5902
5913
  FROM matching_schedule
5914
+ CROSS JOIN launch_payload
5903
5915
  JOIN ${tableName('runs', options)} AS runs ON runs.run_id = $5::text
5904
5916
  ), occurrence AS MATERIALIZED (
5905
5917
  SELECT EXISTS (SELECT 1 FROM matching_schedule) AS schedule_current,
@@ -5932,17 +5944,17 @@ export async function firePostgresSchedulerCronSchedule(
5932
5944
  absurd_task_id, admission_json
5933
5945
  )
5934
5946
  SELECT $5::text,
5935
- $6::jsonb ->> 'orgId',
5936
- NULLIF($6::jsonb ->> 'playId', ''),
5937
- $6::jsonb ->> 'playName',
5938
- $6::jsonb ->> 'graphHash',
5939
- $6::jsonb ->> 'runtimeBackend',
5940
- $6::jsonb ->> 'artifactStorageKey',
5941
- $6::jsonb,
5942
- coalesce($6::jsonb -> 'input', '{}'::jsonb),
5947
+ launch_payload.launch_json ->> 'orgId',
5948
+ NULLIF(launch_payload.launch_json ->> 'playId', ''),
5949
+ launch_payload.launch_json ->> 'playName',
5950
+ launch_payload.launch_json ->> 'graphHash',
5951
+ launch_payload.launch_json ->> 'runtimeBackend',
5952
+ launch_payload.launch_json ->> 'artifactStorageKey',
5953
+ launch_payload.launch_json,
5954
+ coalesce(launch_payload.launch_json -> 'input', '{}'::jsonb),
5943
5955
  'queued',
5944
5956
  (SELECT task_id FROM play_task_spawn),
5945
- $6::jsonb - ARRAY[
5957
+ launch_payload.launch_json - ARRAY[
5946
5958
  'executorToken',
5947
5959
  'preloadedDbSessionUnwrapKey',
5948
5960
  'preloadedDbSessions',
@@ -5952,6 +5964,7 @@ export async function firePostgresSchedulerCronSchedule(
5952
5964
  'vercelProtectionBypassToken'
5953
5965
  ]::text[]
5954
5966
  FROM occurrence
5967
+ CROSS JOIN launch_payload
5955
5968
  WHERE occurrence.schedule_current
5956
5969
  AND NOT occurrence.existing_run
5957
5970
  RETURNING run_id
@@ -5987,47 +6000,48 @@ export async function firePostgresSchedulerCronSchedule(
5987
6000
  run_insert.run_id,
5988
6001
  'run.created',
5989
6002
  jsonb_strip_nulls(jsonb_build_object(
5990
- 'orgId', $6::jsonb ->> 'orgId',
5991
- 'playId', $6::jsonb ->> 'playId',
5992
- 'playName', $6::jsonb ->> 'playName',
5993
- 'definitionName', $6::jsonb ->> 'definitionName',
5994
- 'playReference', $6::jsonb ->> 'playReference',
5995
- 'definitionScope', $6::jsonb ->> 'definitionScope',
5996
- 'revisionId', $6::jsonb ->> 'revisionId',
5997
- 'workflowFamilyKey', $6::jsonb ->> 'workflowFamilyKey',
5998
- 'artifactStorageKey', $6::jsonb ->> 'artifactStorageKey',
5999
- 'artifactHash', $6::jsonb ->> 'artifactHash',
6000
- 'graphHash', $6::jsonb ->> 'graphHash',
6001
- 'runtimeBackend', $6::jsonb ->> 'runtimeBackend',
6002
- 'schedulerBackend', $6::jsonb ->> 'schedulerBackend',
6003
- 'schedulerSchema', $6::jsonb ->> 'schedulerSchema',
6004
- 'executionProfile', $6::jsonb ->> 'executionProfile',
6005
- 'runtimeReleaseId', $6::jsonb ->> 'runtimeReleaseId',
6006
- 'runtimeDeployVersion', $6::jsonb ->> 'runtimeDeployVersion',
6007
- 'runtimeCallbackBaseUrl', $6::jsonb ->> 'runtimeCallbackBaseUrl',
6008
- 'coordinatorUrl', $6::jsonb ->> 'coordinatorUrl',
6009
- 'coordinatorWorkerName', $6::jsonb ->> 'coordinatorWorkerName',
6010
- 'runtimeWorkflowName', $6::jsonb ->> 'runtimeWorkflowName',
6011
- 'runtimeHarnessWorkerName', $6::jsonb ->> 'runtimeHarnessWorkerName',
6012
- 'maxCreditsPerRun', $6::jsonb -> 'maxCreditsPerRun',
6013
- 'triggerSource', $6::jsonb ->> 'triggerSource',
6014
- 'source', $6::jsonb ->> 'source',
6015
- 'staticPipeline', $6::jsonb -> 'staticPipeline',
6016
- 'inputFileId', $6::jsonb ->> 'inputFileId',
6017
- 'inputBytes', $6::jsonb -> 'inputBytes',
6018
- 'inputSha256', $6::jsonb ->> 'inputSha256',
6019
- 'replayedFromRunId', $6::jsonb ->> 'replayedFromRunId',
6020
- 'parentRunId', $6::jsonb ->> 'parentRunId',
6021
- 'rootRunId', $6::jsonb ->> 'rootRunId',
6022
- 'asyncLaunchKey', $6::jsonb ->> 'asyncLaunchKey',
6023
- 'asyncInvocationKey', $6::jsonb ->> 'asyncInvocationKey',
6024
- 'asyncRequestFingerprint', $6::jsonb ->> 'asyncRequestFingerprint',
6025
- 'asyncAncestryPlayIds', $6::jsonb -> 'asyncAncestryPlayIds',
6026
- 'secretRefs', $6::jsonb -> 'secretRefs',
6027
- 'inputSummary', $6::jsonb -> 'inputSummary'
6003
+ 'orgId', launch_payload.launch_json ->> 'orgId',
6004
+ 'playId', launch_payload.launch_json ->> 'playId',
6005
+ 'playName', launch_payload.launch_json ->> 'playName',
6006
+ 'definitionName', launch_payload.launch_json ->> 'definitionName',
6007
+ 'playReference', launch_payload.launch_json ->> 'playReference',
6008
+ 'definitionScope', launch_payload.launch_json ->> 'definitionScope',
6009
+ 'revisionId', launch_payload.launch_json ->> 'revisionId',
6010
+ 'workflowFamilyKey', launch_payload.launch_json ->> 'workflowFamilyKey',
6011
+ 'artifactStorageKey', launch_payload.launch_json ->> 'artifactStorageKey',
6012
+ 'artifactHash', launch_payload.launch_json ->> 'artifactHash',
6013
+ 'graphHash', launch_payload.launch_json ->> 'graphHash',
6014
+ 'runtimeBackend', launch_payload.launch_json ->> 'runtimeBackend',
6015
+ 'schedulerBackend', launch_payload.launch_json ->> 'schedulerBackend',
6016
+ 'schedulerSchema', launch_payload.launch_json ->> 'schedulerSchema',
6017
+ 'executionProfile', launch_payload.launch_json ->> 'executionProfile',
6018
+ 'runtimeReleaseId', launch_payload.launch_json ->> 'runtimeReleaseId',
6019
+ 'runtimeDeployVersion', launch_payload.launch_json ->> 'runtimeDeployVersion',
6020
+ 'runtimeCallbackBaseUrl', launch_payload.launch_json ->> 'runtimeCallbackBaseUrl',
6021
+ 'coordinatorUrl', launch_payload.launch_json ->> 'coordinatorUrl',
6022
+ 'coordinatorWorkerName', launch_payload.launch_json ->> 'coordinatorWorkerName',
6023
+ 'runtimeWorkflowName', launch_payload.launch_json ->> 'runtimeWorkflowName',
6024
+ 'runtimeHarnessWorkerName', launch_payload.launch_json ->> 'runtimeHarnessWorkerName',
6025
+ 'maxCreditsPerRun', launch_payload.launch_json -> 'maxCreditsPerRun',
6026
+ 'triggerSource', launch_payload.launch_json ->> 'triggerSource',
6027
+ 'source', launch_payload.launch_json ->> 'source',
6028
+ 'staticPipeline', launch_payload.launch_json -> 'staticPipeline',
6029
+ 'inputFileId', launch_payload.launch_json ->> 'inputFileId',
6030
+ 'inputBytes', launch_payload.launch_json -> 'inputBytes',
6031
+ 'inputSha256', launch_payload.launch_json ->> 'inputSha256',
6032
+ 'replayedFromRunId', launch_payload.launch_json ->> 'replayedFromRunId',
6033
+ 'parentRunId', launch_payload.launch_json ->> 'parentRunId',
6034
+ 'rootRunId', launch_payload.launch_json ->> 'rootRunId',
6035
+ 'asyncLaunchKey', launch_payload.launch_json ->> 'asyncLaunchKey',
6036
+ 'asyncInvocationKey', launch_payload.launch_json ->> 'asyncInvocationKey',
6037
+ 'asyncRequestFingerprint', launch_payload.launch_json ->> 'asyncRequestFingerprint',
6038
+ 'asyncAncestryPlayIds', launch_payload.launch_json -> 'asyncAncestryPlayIds',
6039
+ 'secretRefs', launch_payload.launch_json -> 'secretRefs',
6040
+ 'inputSummary', launch_payload.launch_json -> 'inputSummary'
6028
6041
  )),
6029
6042
  ${causalOutboxCreatedAt('run_insert.run_id', options)}
6030
6043
  FROM run_insert
6044
+ CROSS JOIN launch_payload
6031
6045
  ON CONFLICT (event_id) DO NOTHING
6032
6046
  ), schedule_advance AS (
6033
6047
  UPDATE ${tableName(POSTGRES_SCHEDULER_CRON_SCHEDULES_TABLE, options)} AS schedule
@@ -8192,6 +8206,99 @@ export async function handoffPostgresSchedulerAttemptContinuation(
8192
8206
  return row ? { runId: row.run_id, eventId: row.event_id } : null;
8193
8207
  }
8194
8208
 
8209
+ /** Fixed-shape authority and callback data used by the execution relay. */
8210
+ const POSTGRES_SCHEDULER_LAUNCH_ROUTING_FIELDS = [
8211
+ 'runId',
8212
+ 'orgId',
8213
+ 'playName',
8214
+ 'userId',
8215
+ 'userEmail',
8216
+ 'baseUrl',
8217
+ 'runtimeApiBaseUrl',
8218
+ 'vercelProtectionBypassToken',
8219
+ 'absurdReleaseId',
8220
+ ] as const;
8221
+
8222
+ export type PostgresSchedulerLaunchRouting = Pick<
8223
+ PlaySchedulerSubmitInput,
8224
+ (typeof POSTGRES_SCHEDULER_LAUNCH_ROUTING_FIELDS)[number]
8225
+ >;
8226
+
8227
+ /**
8228
+ * The relay needs identity and routing, never customer input or the execution
8229
+ * graph. Decode each stored document once and merge only the named scalars.
8230
+ * Presence is separate from value: an admitted null must still override a
8231
+ * repaired launch field, exactly as the complete JSONB merge does.
8232
+ */
8233
+ export async function readPostgresSchedulerLaunchRouting(
8234
+ client: PostgresSchedulerQueryClient,
8235
+ runId: string,
8236
+ options?: Pick<PostgresSchedulerOptions, 'schema'>,
8237
+ ): Promise<PostgresSchedulerLaunchRouting | null> {
8238
+ const fields = POSTGRES_SCHEDULER_LAUNCH_ROUTING_FIELDS;
8239
+ const columns = fields.map((field) => `${quoteIdent(field)} text`).join(', ');
8240
+ const startedAt = performance.now();
8241
+ try {
8242
+ const result = await client.query<PostgresSchedulerLaunchRouting>(
8243
+ `
8244
+ WITH routing AS MATERIALIZED (
8245
+ SELECT ${fields
8246
+ .flatMap((field) => [
8247
+ `launch.${quoteIdent(field)} AS ${quoteIdent(`launch_${field}`)}`,
8248
+ `admitted.${quoteIdent(field)} AS ${quoteIdent(`admitted_${field}`)}`,
8249
+ ])
8250
+ .join(', ')},
8251
+ ARRAY(SELECT jsonb_object_keys(coalesce(runs.admission_json, '{}'::jsonb)))
8252
+ AS admitted_fields
8253
+ FROM ${tableName('runs', options)} AS runs
8254
+ CROSS JOIN LATERAL jsonb_to_record(runs.launch_json) AS launch(${columns})
8255
+ CROSS JOIN LATERAL jsonb_to_record(coalesce(runs.admission_json, '{}'::jsonb))
8256
+ AS admitted(${columns})
8257
+ WHERE runs.run_id = $1
8258
+ )
8259
+ SELECT ${fields
8260
+ .map(
8261
+ (field) =>
8262
+ `CASE WHEN '${field}' = ANY(admitted_fields)
8263
+ THEN ${quoteIdent(`admitted_${field}`)}
8264
+ ELSE ${quoteIdent(`launch_${field}`)}
8265
+ END AS ${quoteIdent(field)}`,
8266
+ )
8267
+ .join(', ')}
8268
+ FROM routing
8269
+ `,
8270
+ [runId],
8271
+ );
8272
+ const routing = result.rows[0] ?? null;
8273
+ if (
8274
+ routing &&
8275
+ (!routing.runId ||
8276
+ !routing.orgId ||
8277
+ !routing.playName ||
8278
+ !routing.baseUrl)
8279
+ ) {
8280
+ throw new Error(
8281
+ 'Postgres scheduler launch routing is missing required fields.',
8282
+ );
8283
+ }
8284
+ recordSchedulerLaunchRead({
8285
+ caller: 'execution_gateway_routing',
8286
+ releaseId: routing?.absurdReleaseId ?? null,
8287
+ durationMs: performance.now() - startedAt,
8288
+ outcome: routing ? 'found' : 'missing',
8289
+ });
8290
+ return routing;
8291
+ } catch (error) {
8292
+ recordSchedulerLaunchRead({
8293
+ caller: 'execution_gateway_routing',
8294
+ releaseId: null,
8295
+ durationMs: performance.now() - startedAt,
8296
+ outcome: 'error',
8297
+ });
8298
+ throw error;
8299
+ }
8300
+ }
8301
+
8195
8302
  export async function readPostgresSchedulerLaunch(
8196
8303
  client: PostgresSchedulerQueryClient,
8197
8304
  runId: string,
@@ -17807,32 +17914,28 @@ export async function dispatchRunLedgerOutboxToLedgerBatchOnceWithClientScope(
17807
17914
  const tokenAuthority = input.tokenAuthority ?? 'local_mint';
17808
17915
  const gatewayRuntimeApi =
17809
17916
  tokenAuthority === 'gateway'
17810
- ? await withClient((client) =>
17811
- loadPostgresSchedulerRuntimeApiForRun(
17812
- client,
17813
- first.runId,
17814
- first.leaseOwner
17815
- ? { eventId: first.eventId, leaseOwner: first.leaseOwner }
17816
- : null,
17817
- tokenAuthority,
17818
- options,
17819
- input.runtimeApi?.signal,
17820
- ),
17917
+ ? await loadPostgresSchedulerRuntimeApiForRun(
17918
+ withClient,
17919
+ first.runId,
17920
+ first.leaseOwner
17921
+ ? { eventId: first.eventId, leaseOwner: first.leaseOwner }
17922
+ : null,
17923
+ tokenAuthority,
17924
+ options,
17925
+ input.runtimeApi?.signal,
17821
17926
  )
17822
17927
  : null;
17823
17928
  const resolvedRuntimeApi =
17824
17929
  gatewayRuntimeApi ??
17825
17930
  input.runtimeApi ??
17826
- (await withClient((client) =>
17827
- loadPostgresSchedulerRuntimeApiForRun(
17828
- client,
17829
- first.runId,
17830
- first.leaseOwner
17831
- ? { eventId: first.eventId, leaseOwner: first.leaseOwner }
17832
- : null,
17833
- tokenAuthority,
17834
- options,
17835
- ),
17931
+ (await loadPostgresSchedulerRuntimeApiForRun(
17932
+ withClient,
17933
+ first.runId,
17934
+ first.leaseOwner
17935
+ ? { eventId: first.eventId, leaseOwner: first.leaseOwner }
17936
+ : null,
17937
+ tokenAuthority,
17938
+ options,
17836
17939
  ));
17837
17940
  const runtimeApi = {
17838
17941
  ...resolvedRuntimeApi,
@@ -18111,24 +18214,64 @@ async function projectPostgresSchedulerStartEvent(
18111
18214
  });
18112
18215
  }
18113
18216
 
18217
+ export type RunLedgerDispatchLaunch = Pick<
18218
+ PlaySchedulerSubmitInput,
18219
+ | 'runId'
18220
+ | 'playId'
18221
+ | 'playName'
18222
+ | 'executorToken'
18223
+ | 'baseUrl'
18224
+ | 'runtimeApiBaseUrl'
18225
+ | 'runtimeTokenOrigin'
18226
+ | 'orgId'
18227
+ | 'runtimeAuthority'
18228
+ | 'vercelProtectionBypassToken'
18229
+ >;
18230
+
18231
+ /** Authority reads never transfer customer input, artifacts or execution graphs. */
18232
+ function runLedgerDispatchLaunchSql(alias: string): string {
18233
+ const fields: (keyof RunLedgerDispatchLaunch)[] = [
18234
+ 'runId',
18235
+ 'playId',
18236
+ 'playName',
18237
+ 'executorToken',
18238
+ 'baseUrl',
18239
+ 'runtimeApiBaseUrl',
18240
+ 'runtimeTokenOrigin',
18241
+ 'orgId',
18242
+ 'runtimeAuthority',
18243
+ 'vercelProtectionBypassToken',
18244
+ ];
18245
+ return `jsonb_build_object(${fields
18246
+ .map((field) => `'${field}', ${alias}.launch_json->'${field}'`)
18247
+ .join(', ')})`;
18248
+ }
18249
+
18114
18250
  async function loadPostgresSchedulerRuntimeApiForRun(
18115
- client: PostgresSchedulerQueryClient,
18251
+ withClient: <T>(
18252
+ operation: (client: PostgresSchedulerQueryClient) => Promise<T>,
18253
+ ) => Promise<T>,
18116
18254
  runId: string,
18117
18255
  dispatchLease: { eventId: string; leaseOwner: string } | null,
18118
18256
  tokenAuthority: RunLedgerOutboxTokenAuthority,
18119
18257
  options?: Pick<PostgresSchedulerOptions, 'schema'>,
18120
18258
  signal?: AbortSignal,
18121
18259
  ): Promise<WorkerRuntimeApiContext> {
18122
- const result = await client.query<{ launch_json: unknown }>(
18123
- `
18124
- SELECT launch_json
18125
- FROM ${tableName('runs', options)}
18126
- WHERE run_id = $1
18127
- LIMIT 1
18128
- `,
18129
- [runId],
18260
+ // Release the scarce scheduler checkout before the token authority hop.
18261
+ // A slow gateway must not retain either projector pool client, and its
18262
+ // launch context must not hydrate customer execution graphs.
18263
+ const result = await withClient((client) =>
18264
+ client.query<{ launch_json: unknown }>(
18265
+ `SELECT ${runLedgerDispatchLaunchSql('runs')} AS launch_json
18266
+ FROM ${tableName('runs', options)} AS runs
18267
+ WHERE run_id = $1
18268
+ LIMIT 1`,
18269
+ [runId],
18270
+ ),
18271
+ );
18272
+ const launch: RunLedgerDispatchLaunch = parseLaunchJson(
18273
+ result.rows[0]?.launch_json,
18130
18274
  );
18131
- const launch = parseLaunchJson(result.rows[0]?.launch_json);
18132
18275
  if (!launch?.baseUrl) {
18133
18276
  throw new Error(
18134
18277
  `Run-ledger outbox dispatcher cannot resolve runtime API context for ${runId}.`,
@@ -18169,7 +18312,7 @@ async function loadPostgresSchedulerRuntimeApiForRun(
18169
18312
  }
18170
18313
 
18171
18314
  async function requestRunLedgerDispatchToken(input: {
18172
- launch: PlaySchedulerSubmitInput;
18315
+ launch: RunLedgerDispatchLaunch;
18173
18316
  eventId: string;
18174
18317
  leaseOwner: string;
18175
18318
  schedulerSchema: string | null;
@@ -18324,6 +18467,28 @@ export async function requestComputeBillingDispatchToken(input: {
18324
18467
  return body.executorToken;
18325
18468
  }
18326
18469
 
18470
+ /** Read only the immutable authority/routing fields under the same lease fence. */
18471
+ export async function readRunLedgerDispatchAuthorityForLease(
18472
+ client: PostgresSchedulerQueryClient,
18473
+ input: { runId: string; eventId: string; leaseOwner: string },
18474
+ options?: Pick<PostgresSchedulerOptions, 'schema'>,
18475
+ ): Promise<RunLedgerDispatchLaunch | null> {
18476
+ const result = await client.query<{ launch_json: unknown }>(
18477
+ `SELECT ${runLedgerDispatchLaunchSql('runs')} AS launch_json
18478
+ FROM ${tableName('outbox', options)} outbox
18479
+ JOIN ${tableName('runs', options)} runs ON runs.run_id = outbox.run_id
18480
+ WHERE outbox.event_id = $1
18481
+ AND outbox.run_id = $2
18482
+ AND outbox.lease_owner = $3
18483
+ AND outbox.lease_expires_at > now()
18484
+ AND outbox.delivered_at IS NULL
18485
+ AND outbox.failed_at IS NULL
18486
+ LIMIT 1`,
18487
+ [input.eventId, input.runId, input.leaseOwner],
18488
+ );
18489
+ return result.rows[0] ? parseLaunchJson(result.rows[0].launch_json) : null;
18490
+ }
18491
+
18327
18492
  export async function readRunLedgerDispatchLaunchForLease(
18328
18493
  client: PostgresSchedulerQueryClient,
18329
18494
  input: { runId: string; eventId: string; leaseOwner: string },
@@ -12,6 +12,7 @@ export type SchedulerLaunchReadCaller =
12
12
  | 'runtime_worker_outbox_projection'
13
13
  | 'receipt_gateway_auth'
14
14
  | 'receipt_gateway_lazy'
15
+ | 'execution_gateway_routing'
15
16
  | 'test';
16
17
 
17
18
  export type SchedulerLaunchReadOutcome = 'found' | 'missing' | 'error';
package/dist/cli/index.js CHANGED
@@ -3463,7 +3463,7 @@ var SDK_RELEASE = {
3463
3463
  // getters keep their established compatibility behavior.
3464
3464
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3465
3465
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3466
- version: "0.3.240",
3466
+ version: "0.3.241",
3467
3467
  updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
3468
3468
  packageCapabilities: {
3469
3469
  updatePreferences: 1
@@ -3458,7 +3458,7 @@ var SDK_RELEASE = {
3458
3458
  // getters keep their established compatibility behavior.
3459
3459
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3460
3460
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3461
- version: "0.3.240",
3461
+ version: "0.3.241",
3462
3462
  updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
3463
3463
  packageCapabilities: {
3464
3464
  updatePreferences: 1
package/dist/index.js CHANGED
@@ -1276,7 +1276,7 @@ var SDK_RELEASE = {
1276
1276
  // getters keep their established compatibility behavior.
1277
1277
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
1278
1278
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
1279
- version: "0.3.240",
1279
+ version: "0.3.241",
1280
1280
  updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
1281
1281
  packageCapabilities: {
1282
1282
  updatePreferences: 1
package/dist/index.mjs CHANGED
@@ -1180,7 +1180,7 @@ var SDK_RELEASE = {
1180
1180
  // getters keep their established compatibility behavior.
1181
1181
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
1182
1182
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
1183
- version: "0.3.240",
1183
+ version: "0.3.241",
1184
1184
  updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
1185
1185
  packageCapabilities: {
1186
1186
  updatePreferences: 1
@@ -149,7 +149,7 @@ type SdkRelease = {
149
149
  supportPolicy: SdkSupportPolicy;
150
150
  };
151
151
  declare const SDK_RELEASE: {
152
- readonly version: "0.3.240";
152
+ readonly version: "0.3.241";
153
153
  readonly updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.";
154
154
  readonly packageCapabilities: {
155
155
  readonly updatePreferences: 1;
package/dist/release.d.ts CHANGED
@@ -149,7 +149,7 @@ type SdkRelease = {
149
149
  supportPolicy: SdkSupportPolicy;
150
150
  };
151
151
  declare const SDK_RELEASE: {
152
- readonly version: "0.3.240";
152
+ readonly version: "0.3.241";
153
153
  readonly updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.";
154
154
  readonly packageCapabilities: {
155
155
  readonly updatePreferences: 1;
package/dist/release.js CHANGED
@@ -74,7 +74,7 @@ var SDK_RELEASE = {
74
74
  // getters keep their established compatibility behavior.
75
75
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
76
76
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
77
- version: "0.3.240",
77
+ version: "0.3.241",
78
78
  updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
79
79
  packageCapabilities: {
80
80
  updatePreferences: 1
package/dist/release.mjs CHANGED
@@ -48,7 +48,7 @@ var SDK_RELEASE = {
48
48
  // getters keep their established compatibility behavior.
49
49
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
50
50
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
51
- version: "0.3.240",
51
+ version: "0.3.241",
52
52
  updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
53
53
  packageCapabilities: {
54
54
  updatePreferences: 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.3.240",
3
+ "version": "0.3.241",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",