deepline 0.3.468 → 0.3.470

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 (124) hide show
  1. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  2. package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +0 -5
  3. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-errors.ts +0 -9
  4. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts +2 -31
  5. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-priority-execution.ts +0 -39
  6. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/admission/postgres-adapter.ts +3 -0
  7. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +3 -0
  8. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +42 -10
  9. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +17 -8
  10. package/dist/cli/auth-4DBOZZDX.js +41 -0
  11. package/dist/cli/{auth-CXQRTOBC.mjs → auth-7J52UEWO.mjs} +5 -5
  12. package/dist/cli/{billing-JSIPTXM6.js → billing-ASNWVDQG.js} +79 -79
  13. package/dist/cli/{billing-HDKO5VQI.mjs → billing-ORB3UZ73.mjs} +6 -6
  14. package/dist/cli/{chunk-NZQPALPW.mjs → chunk-262PYO4I.mjs} +2 -2
  15. package/dist/cli/{chunk-ERQJLYIS.mjs → chunk-3P4WOCRB.mjs} +5 -5
  16. package/dist/cli/{chunk-UNLLMHY7.mjs → chunk-3XLJPLXZ.mjs} +1 -1
  17. package/dist/cli/{chunk-U37BWQZH.js → chunk-44UR3BU2.js} +9 -9
  18. package/dist/cli/{chunk-RSMFUWCP.js → chunk-4BQQ3Q3J.js} +8 -8
  19. package/dist/cli/{chunk-YD2KV7RT.js → chunk-57F5VKHV.js} +7 -7
  20. package/dist/cli/{chunk-TNOTKGZC.mjs → chunk-5ADROBCY.mjs} +2 -2
  21. package/dist/cli/{chunk-UU4GMU7A.mjs → chunk-6B7XLHIE.mjs} +4 -4
  22. package/dist/cli/{chunk-ECY6QP3M.js → chunk-6R5UKWRW.js} +16 -16
  23. package/dist/cli/{chunk-SFWU7IJJ.mjs → chunk-7WILY2XM.mjs} +2 -2
  24. package/dist/cli/{chunk-OAF5U6SN.js → chunk-A7THVTRN.js} +51 -51
  25. package/dist/cli/{chunk-LQ2KVMOD.js → chunk-AGIEKE3L.js} +4 -4
  26. package/dist/cli/{chunk-X4U763KU.mjs → chunk-BWLXHUKH.mjs} +3 -3
  27. package/dist/cli/{chunk-54SVGPMK.js → chunk-C7EA2VNR.js} +5 -5
  28. package/dist/cli/{chunk-YI6TIURR.js → chunk-CNQBCLQP.js} +3 -3
  29. package/dist/cli/{chunk-GCHTTVC7.mjs → chunk-CTDWQYBW.mjs} +2 -2
  30. package/dist/cli/{chunk-CXYMJSRQ.mjs → chunk-DSOTGAXS.mjs} +1 -1
  31. package/dist/cli/{chunk-747ZYPXB.js → chunk-EM2E7YIS.js} +53 -53
  32. package/dist/cli/{chunk-FLH4D33O.js → chunk-ETTUFFBS.js} +36 -36
  33. package/dist/cli/{chunk-QI2LOENC.js → chunk-F2XK4UN6.js} +3 -3
  34. package/dist/cli/{chunk-FPFBYOR6.mjs → chunk-F4L7WMLK.mjs} +2 -2
  35. package/dist/cli/{chunk-AXTZID4V.js → chunk-F6OB5L74.js} +6 -6
  36. package/dist/cli/{chunk-ZA6UUGOZ.js → chunk-GDFO3ERN.js} +2 -2
  37. package/dist/cli/{chunk-EOWMLNCV.mjs → chunk-GLSFZYZB.mjs} +1 -1
  38. package/dist/cli/{chunk-F52TY2QC.js → chunk-KBNAI5BY.js} +21 -21
  39. package/dist/cli/{chunk-QWJ3V3GI.js → chunk-MXAB4W6E.js} +8 -8
  40. package/dist/cli/{chunk-VPCS5KOF.js → chunk-N72VIY7R.js} +2 -2
  41. package/dist/cli/{chunk-37Z2W7OS.js → chunk-NNCDHMCT.js} +26 -26
  42. package/dist/cli/{chunk-EXXXRDCC.js → chunk-NSAKJQLX.js} +1 -1
  43. package/dist/cli/{chunk-2NE3LCEA.js → chunk-ORO2GFH4.js} +5 -5
  44. package/dist/cli/{chunk-WNS5YEZN.mjs → chunk-PJX7BA7T.mjs} +2 -2
  45. package/dist/cli/{chunk-54CKAYKK.js → chunk-PWXHZPHK.js} +10 -10
  46. package/dist/cli/{chunk-NOQRM7LV.mjs → chunk-QG7UPPOK.mjs} +2 -2
  47. package/dist/cli/{chunk-7PBIHKB4.mjs → chunk-QW6HNDS7.mjs} +1 -1
  48. package/dist/cli/{chunk-QKGHYF7A.mjs → chunk-RVQ333NB.mjs} +1 -1
  49. package/dist/cli/{chunk-CHD7NMZD.mjs → chunk-SETIOXN4.mjs} +1 -1
  50. package/dist/cli/{chunk-F3YSH2CY.mjs → chunk-SHB7BUNQ.mjs} +3 -3
  51. package/dist/cli/{chunk-UA42Q7R3.mjs → chunk-SOME764Z.mjs} +4 -4
  52. package/dist/cli/{chunk-PZZNEIE3.mjs → chunk-SV3B6KW4.mjs} +5 -5
  53. package/dist/cli/{chunk-6PN2RUXL.mjs → chunk-SXQZYTUW.mjs} +1 -1
  54. package/dist/cli/{chunk-DQHMXKDT.js → chunk-VBKN6ISP.js} +93 -93
  55. package/dist/cli/{chunk-TVDBGEVP.mjs → chunk-VL7OL7YR.mjs} +1 -1
  56. package/dist/cli/{chunk-ZJRHPVJU.js → chunk-Y4OE46HH.js} +6 -6
  57. package/dist/cli/{chunk-DDUCF63F.mjs → chunk-YBDQUVDE.mjs} +10 -10
  58. package/dist/cli/{chunk-Q7NNU6KB.mjs → chunk-YFKOA4HW.mjs} +4 -4
  59. package/dist/cli/{chunk-5RXVB6UK.js → chunk-YTFCKCII.js} +3 -3
  60. package/dist/cli/{csv-H2656YID.mjs → csv-D3JPZVUN.mjs} +4 -4
  61. package/dist/cli/{csv-EIXI4D7F.js → csv-FSXDIWBP.js} +13 -13
  62. package/dist/cli/{db-CABNKWAS.mjs → db-3UWDQXLF.mjs} +6 -6
  63. package/dist/cli/{db-7AQJE7CP.js → db-DZQUPWI3.js} +27 -27
  64. package/dist/cli/describe-2ENX4O3U.js +48 -0
  65. package/dist/cli/{describe-5RUFO5ZR.mjs → describe-APG2GVFG.mjs} +17 -17
  66. package/dist/cli/{executions-OHOBXCPD.js → executions-BFAPMPG2.js} +8 -8
  67. package/dist/cli/{executions-4GUJEBEC.mjs → executions-TDUX3575.mjs} +6 -6
  68. package/dist/cli/{feedback-JIJWTK2H.js → feedback-2KNPCYTH.js} +8 -8
  69. package/dist/cli/{feedback-N3CSL3OV.mjs → feedback-BMV7PUDL.mjs} +4 -4
  70. package/dist/cli/{git-Z5DTMOAQ.mjs → git-KBVONNE5.mjs} +5 -5
  71. package/dist/cli/git-LUW3GBSD.js +25 -0
  72. package/dist/cli/index.js +135 -135
  73. package/dist/cli/index.mjs +40 -40
  74. package/dist/cli/{legacy-noops-XTLI64KX.mjs → legacy-noops-GZDRRUFE.mjs} +5 -5
  75. package/dist/cli/{legacy-noops-ZEJRXMTS.js → legacy-noops-LE6LJO7F.js} +8 -8
  76. package/dist/cli/{monitors-3MDJEWZB.mjs → monitors-CW22L3VL.mjs} +7 -7
  77. package/dist/cli/{monitors-E3TTJB3S.js → monitors-PGBHMKOU.js} +91 -91
  78. package/dist/cli/{org-722NMZ4T.js → org-3V2VAH5D.js} +72 -72
  79. package/dist/cli/{org-AJUXWQ6P.mjs → org-K5C23LAV.mjs} +6 -6
  80. package/dist/cli/{pages-CPCWTTPD.js → pages-2F73VVWC.js} +17 -17
  81. package/dist/cli/{pages-Y6AC7PBJ.mjs → pages-7V2C7GWU.mjs} +6 -6
  82. package/dist/cli/{play-ACQ54HNN.js → play-62KSZGJQ.js} +304 -304
  83. package/dist/cli/{play-TYHP7UNL.mjs → play-VT7TPJUH.mjs} +17 -17
  84. package/dist/cli/{providers-UDG7V7WU.js → providers-3SI3QBT3.js} +9 -9
  85. package/dist/cli/{providers-BSXILLKJ.mjs → providers-LX562YG7.mjs} +6 -6
  86. package/dist/cli/{quickstart-ZW7VOPFN.js → quickstart-5HA5IFTB.js} +6 -6
  87. package/dist/cli/{quickstart-66MNFG2G.mjs → quickstart-ADE7FV26.mjs} +4 -4
  88. package/dist/cli/{run-KPS3O2VA.js → run-4ZV4UDKP.js} +36 -36
  89. package/dist/cli/{run-JSAI5PRF.mjs → run-OITZJ6QZ.mjs} +22 -22
  90. package/dist/cli/{search-GQGB3JIE.mjs → search-BI5VZQMD.mjs} +7 -7
  91. package/dist/cli/search-PXFM3MGW.js +32 -0
  92. package/dist/cli/{secrets-LGGKGT3A.mjs → secrets-A2R36AZ6.mjs} +6 -6
  93. package/dist/cli/{secrets-UVQKUCBM.js → secrets-UAKNTMYB.js} +15 -15
  94. package/dist/cli/{sessions-MPZ42HUS.js → sessions-3JM3OXME.js} +6 -6
  95. package/dist/cli/{sessions-JYPDKPVA.mjs → sessions-PPOFUFBW.mjs} +5 -5
  96. package/dist/cli/{settings-E7VTIIRT.js → settings-C4M5HOD4.js} +78 -78
  97. package/dist/cli/{settings-5UVSGJ72.mjs → settings-PZA6TBOL.mjs} +11 -11
  98. package/dist/cli/{setup-FM6VKRER.mjs → setup-245XVTBR.mjs} +9 -9
  99. package/dist/cli/{setup-NQ5BQ3ZY.js → setup-TY2OSI6D.js} +44 -44
  100. package/dist/cli/skills-UYNRYDDI.js +31 -0
  101. package/dist/cli/{skills-WOCXEASX.mjs → skills-ZAN23KLR.mjs} +7 -7
  102. package/dist/cli/{tools-QZRDZS45.mjs → tools-GG4KDQBM.mjs} +16 -16
  103. package/dist/cli/tools-OBESOBG7.js +55 -0
  104. package/dist/cli/update-2VMXTKBN.js +33 -0
  105. package/dist/cli/{update-OW2FEGGG.mjs → update-XKXIL6DU.mjs} +9 -9
  106. package/dist/cli/{workflow-QRGUHBKL.mjs → workflow-LVQVTFUJ.mjs} +7 -7
  107. package/dist/cli/{workflow-QJM2ELOS.js → workflow-VN7M3D2U.js} +17 -17
  108. package/dist/index.js +9 -9
  109. package/dist/index.mjs +6 -6
  110. package/dist/install-integrity.json +96 -96
  111. package/dist/release.d.mts +1 -1
  112. package/dist/release.d.ts +1 -1
  113. package/dist/release.js +2 -2
  114. package/dist/release.mjs +1 -1
  115. package/dist/server.js +5 -5
  116. package/dist/server.mjs +3 -3
  117. package/package.json +1 -1
  118. package/dist/cli/auth-MDWIVGZQ.js +0 -41
  119. package/dist/cli/describe-ODBO2AMO.js +0 -48
  120. package/dist/cli/git-TWNEROIX.js +0 -25
  121. package/dist/cli/search-JUXEQ5HQ.js +0 -32
  122. package/dist/cli/skills-OLIMNV35.js +0 -31
  123. package/dist/cli/tools-IZNJT6RU.js +0 -55
  124. package/dist/cli/update-4JVVAYI4.js +0 -33
@@ -205,7 +205,7 @@ export const SDK_RELEASE = {
205
205
  // getters keep their established compatibility behavior.
206
206
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
207
207
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
208
- version: '0.3.468',
208
+ version: '0.3.470',
209
209
  updateSummary: {
210
210
  introducedIn: '0.3.90',
211
211
  summary:
@@ -1,7 +1,5 @@
1
1
  import { NextResponse } from 'next/server';
2
2
 
3
- import { MAX_PRIORITY_MONITORS_PER_ORG } from '@deepline/monitors/provider-monitor-priority-execution';
4
-
5
3
  export const MONITOR_ERROR_FALLBACK_NEXT_ACTION =
6
4
  "Do not retry blindly. Read the deepline-monitors skill's 'Recover from errors by code' section, inspect the returned message and relevant state, then diagnose this failure.";
7
5
 
@@ -191,9 +189,6 @@ export function monitorErrorNextAction(payload: MonitorErrorPayload): string {
191
189
  if (code === 'monitor_entitlement_limit_exceeded') {
192
190
  return 'Run `deepline monitors list --status all`; reuse or disable an existing monitor, or ask the user to change entitlement before retrying.';
193
191
  }
194
- if (code === 'priority_monitor_limit_exceeded') {
195
- return `This workspace already has ${MAX_PRIORITY_MONITORS_PER_ORG} priority radars. Delete or update an existing priority radar only after confirming it is no longer needed, then retry the urgent preview.`;
196
- }
197
192
  if (code === 'monitor_already_exists') {
198
193
  const existingMonitor = asRecord(nestedError(payload)?.existing_monitor);
199
194
  const existing = existingMonitor?.key;
@@ -130,12 +130,3 @@ export class ProviderMonitorStoppedAfterSubmitError extends Error {
130
130
  this.name = 'ProviderMonitorStoppedAfterSubmitError';
131
131
  }
132
132
  }
133
-
134
- export class PriorityMonitorExecutionLimitError extends Error {
135
- constructor(readonly max: number) {
136
- super(
137
- `This workspace already has ${max} priority radars. Remove priority from a radar that is no longer urgent before creating another one.`,
138
- );
139
- this.name = 'PriorityMonitorExecutionLimitError';
140
- }
141
- }
@@ -1,6 +1,5 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import {
3
- PriorityMonitorExecutionLimitError,
4
3
  ProviderMonitorCapacityBackfillInProgressError,
5
4
  ProviderMonitorCapacityCleanupRequiredError,
6
5
  ProviderMonitorIdentityBackfillInProgressError,
@@ -8,7 +7,6 @@ import {
8
7
  ProviderMonitorOrgLimitExceededError,
9
8
  type ProviderMonitorCapacitySnapshot,
10
9
  } from '@deepline/monitors/provider-monitor-errors';
11
- import { MAX_PRIORITY_MONITORS_PER_ORG } from '@deepline/monitors/provider-monitor-priority-execution';
12
10
  import { internal } from '@deepline/convex-client/function-references';
13
11
  import { getRequiredInternalConvexClient } from '@deepline/convex-client/internal-client';
14
12
  import { providerMonitorConflictIdentity } from '@deepline/monitors/provider-monitor-conflicts';
@@ -235,20 +233,6 @@ export function providerMonitorIdentityProvisioningForMonitor(input: {
235
233
  );
236
234
  }
237
235
 
238
- export function priorityMonitorExecutionLimitFromLifecycleError(
239
- error: unknown,
240
- ) {
241
- if (
242
- error instanceof Error &&
243
- error.message.includes('PRIORITY_MONITOR_LIMIT_EXCEEDED')
244
- ) {
245
- return new PriorityMonitorExecutionLimitError(
246
- MAX_PRIORITY_MONITORS_PER_ORG,
247
- );
248
- }
249
- return null;
250
- }
251
-
252
236
  // Convex retries mutations itself. This is the bounded outer retry for the
253
237
  // rare case in which that budget is exhausted while the short capacity-fold
254
238
  // mutation is updating the same organization fence. Lifecycle admission is
@@ -335,23 +319,10 @@ export async function beginProviderMonitorLifecycleReservation(input: {
335
319
  ? { requiredMonitorStatus: input.requiredMonitorStatus }
336
320
  : {}),
337
321
  });
338
- // A priority-slot refusal arrives as a thrown lifecycle error, while the
339
- // capacity outcomes below arrive as a returned kind. Both paths have to work
340
- // on the same call, and the backfill retry has to re-run the same request.
341
- const attempt = async () => {
342
- try {
343
- return await request();
344
- } catch (error) {
345
- const priorityLimit =
346
- priorityMonitorExecutionLimitFromLifecycleError(error);
347
- if (priorityLimit) throw priorityLimit;
348
- throw error;
349
- }
350
- };
351
- let result = await retryProviderMonitorLifecycleAdmission(attempt);
322
+ let result = await retryProviderMonitorLifecycleAdmission(request);
352
323
  if (result.kind === 'backfill_required') {
353
324
  await ensureProviderMonitorCapacityBackfill({ auth: input.auth });
354
- result = await retryProviderMonitorLifecycleAdmission(attempt);
325
+ result = await retryProviderMonitorLifecycleAdmission(request);
355
326
  }
356
327
  if (result.kind === 'limit_exceeded') {
357
328
  throw new ProviderMonitorOrgLimitExceededError(result.capacity);
@@ -1,26 +1,6 @@
1
1
  import type { ProviderMonitorCapabilityDefinition } from '@deepline/monitors/provider-monitor-capability';
2
- import type { ProviderMonitorStatus } from './provider-monitor-status';
3
2
 
4
3
  export const PRIORITY_MONITOR_EXECUTION_TYPE = 'priority' as const;
5
- export const MAX_PRIORITY_MONITORS_PER_ORG = 10;
6
-
7
- export const PRIORITY_MONITOR_SLOT_STATUSES = [
8
- 'active',
9
- // A billing suspension writes disabled before upstream deprovisioning. Keep
10
- // the slot occupied until that delete confirms success and clears the
11
- // projection; a failed cleanup can leave the priority radar live.
12
- 'disabled',
13
- 'deleting',
14
- 'error',
15
- 'deleted',
16
- // A fleet monitor holds its priority reservation from the commit that
17
- // records the desired state, not from the provider create that follows it.
18
- 'pending_create',
19
- ] as const satisfies readonly ProviderMonitorStatus[];
20
-
21
- const PRIORITY_MONITOR_SLOT_STATUS_SET = new Set<ProviderMonitorStatus>(
22
- PRIORITY_MONITOR_SLOT_STATUSES,
23
- );
24
4
 
25
5
  export function requestedPriorityMonitorExecution(definition: {
26
6
  controls?: Record<string, unknown>;
@@ -35,22 +15,3 @@ export function priorityMonitorExecutionIsSupported(
35
15
  ) {
36
16
  return capability.provider === 'deepline_native';
37
17
  }
38
-
39
- export function priorityMonitorConsumesSlot(input: {
40
- priorityExecution: boolean;
41
- status: ProviderMonitorStatus;
42
- }) {
43
- return (
44
- input.priorityExecution &&
45
- PRIORITY_MONITOR_SLOT_STATUS_SET.has(input.status)
46
- );
47
- }
48
-
49
- export function priorityMonitorReservedSlotCount(input: {
50
- priorityExecution: boolean;
51
- status: ProviderMonitorStatus;
52
- priorityExecutionSlots?: number;
53
- }) {
54
- if (!priorityMonitorConsumesSlot(input)) return 0;
55
- return input.priorityExecutionSlots === 2 ? 2 : 1;
56
- }
@@ -21,6 +21,8 @@ import { emitPlayRunLaunchConflictTelemetry } from '../../runtime-telemetry';
21
21
  export function createPostgresPlayRunAdmissionPorts(input: {
22
22
  client: PostgresSchedulerQueryClient;
23
23
  schema?: string;
24
+ /** The admitting app will immediately attempt its leased local projection. */
25
+ reserveCreatedProjection?: boolean;
24
26
  }): PlayRunAdmissionPorts {
25
27
  const options = input.schema ? { schema: input.schema } : undefined;
26
28
  return {
@@ -35,6 +37,7 @@ export function createPostgresPlayRunAdmissionPorts(input: {
35
37
  options,
36
38
  admission.queueName,
37
39
  admission.recoverExistingTask === true,
40
+ { reserveCreatedProjection: input.reserveCreatedProjection },
38
41
  );
39
42
  } catch (error) {
40
43
  if (isLaunchConflict(error)) {
@@ -453,6 +453,9 @@ export function createAbsurdSchedulerBackend(
453
453
  createPostgresPlayRunAdmissionPorts({
454
454
  client,
455
455
  schema: normalizedSchedulerOptions.schema,
456
+ reserveCreatedProjection: Boolean(
457
+ process.env.VERCEL?.trim(),
458
+ ),
456
459
  }),
457
460
  ).admit({
458
461
  launch: input,
@@ -5007,6 +5007,7 @@ export async function submitPostgresAbsurdPlayRun(
5007
5007
  options: Pick<PostgresSchedulerOptions, 'schema'> | undefined,
5008
5008
  queueName: string,
5009
5009
  recoverExistingTask = false,
5010
+ projection?: { reserveCreatedProjection?: boolean },
5010
5011
  ): Promise<{
5011
5012
  taskId: string | null;
5012
5013
  runCreated: boolean;
@@ -5030,6 +5031,7 @@ export async function submitPostgresAbsurdPlayRun(
5030
5031
  queueName,
5031
5032
  ...task,
5032
5033
  recoverExistingTask,
5034
+ reserveCreatedProjection: projection?.reserveCreatedProjection === true,
5033
5035
  },
5034
5036
  );
5035
5037
  const taskId = submitted.absurdTaskId;
@@ -5125,6 +5127,7 @@ async function submitPostgresSchedulerRunTransaction(
5125
5127
  params: unknown;
5126
5128
  options: unknown;
5127
5129
  recoverExistingTask?: boolean;
5130
+ reserveCreatedProjection?: boolean;
5128
5131
  },
5129
5132
  /**
5130
5133
  * Set only on the single re-admission after the current build proved the
@@ -5138,6 +5141,11 @@ async function submitPostgresSchedulerRunTransaction(
5138
5141
  taskRecoveryRequired: boolean;
5139
5142
  }> {
5140
5143
  const requestedInput = input;
5144
+ const createdProjectionLease =
5145
+ absurdTask?.reserveCreatedProjection === true &&
5146
+ input.requiresRunCreatedProjection === true
5147
+ ? postgresSchedulerInlineCreatedProjectionLease(input.runId)
5148
+ : null;
5141
5149
  // Persist the ABI with every new launch. Null is reserved for genuinely
5142
5150
  // historic rows already in storage, where readers interpret it as legacy.
5143
5151
  input = {
@@ -5445,7 +5453,8 @@ async function submitPostgresSchedulerRunTransaction(
5445
5453
  -- durable run, its task, and the launch envelope together. Persist the
5446
5454
  -- causal run.created fact here; projection is deliberately async.
5447
5455
  INSERT INTO ${tableName('outbox', options)} (
5448
- event_id, run_id, event_type, payload_json, created_at
5456
+ event_id, run_id, event_type, payload_json, created_at,
5457
+ lease_owner, lease_expires_at
5449
5458
  )
5450
5459
  SELECT
5451
5460
  'run-created:' || run_insert.run_id,
@@ -5498,7 +5507,9 @@ async function submitPostgresSchedulerRunTransaction(
5498
5507
  )) || CASE WHEN launch_payload.launch_json ? 'retainedPipelineGraph'
5499
5508
  THEN jsonb_build_object('retainedPipelineGraph', launch_payload.launch_json -> 'retainedPipelineGraph')
5500
5509
  ELSE '{}'::jsonb END,
5501
- ${causalOutboxCreatedAt('run_insert.run_id', options)}
5510
+ ${causalOutboxCreatedAt('run_insert.run_id', options)},
5511
+ ${createdProjectionLease ? escapeLiteral(createdProjectionLease.leaseOwner) : 'NULL::text'},
5512
+ ${createdProjectionLease ? `now() + interval '${createdProjectionLease.leaseSeconds} seconds'` : 'NULL::timestamptz'}
5502
5513
  FROM run_insert
5503
5514
  CROSS JOIN launch_payload
5504
5515
  -- Old Vercel launchers do not carry the immutable admission envelope.
@@ -22182,6 +22193,29 @@ export function postgresSchedulerCancellationOutboxLease(runId: string): {
22182
22193
  };
22183
22194
  }
22184
22195
 
22196
+ /**
22197
+ * The admitting app can project its own run.created without an HTTP round trip.
22198
+ * Reserve that first delivery in the admission commit, before NOTIFY lets the
22199
+ * remote projector race it. An app lost before delivery leaves at most this
22200
+ * short lease; ordinary inline claims retain their existing deadline/release.
22201
+ * This is delivery ownership only, never execution admission or authority.
22202
+ */
22203
+ export function postgresSchedulerInlineCreatedProjectionLease(runId: string): {
22204
+ leaseOwner: string;
22205
+ leaseSeconds: number;
22206
+ } {
22207
+ const normalizedRunId = runId.trim();
22208
+ if (!normalizedRunId) {
22209
+ throw new Error('Inline created projection requires a run id.');
22210
+ }
22211
+ return {
22212
+ leaseOwner: `run-created-inline:${createHash('sha256')
22213
+ .update(normalizedRunId)
22214
+ .digest('hex')}`,
22215
+ leaseSeconds: 2,
22216
+ };
22217
+ }
22218
+
22185
22219
  export type RunLedgerOutboxDispatchInput = {
22186
22220
  /** App-owned transport; launch authority and routing still come from the lease. */
22187
22221
  appRuntimeFetch?: typeof fetch;
@@ -22842,14 +22876,12 @@ async function dispatchRunLedgerOutboxBatchWithScope(
22842
22876
  // The caller's deadline elapsed while this checkout was queued. Its
22843
22877
  // attempt is already abandoned, so taking a lease now could only keep
22844
22878
  // the durable projector off the row until that lease expires. Claim
22845
- // nothing: the row stays pending and unleased for its next owner.
22846
- if (claimInvocations > 1 && abandonedHeadEventId) {
22847
- // An earlier invocation's COMMIT may have reached the server before
22848
- // its connection failed, so this owner can already hold the named
22849
- // head. Hand it back here, fenced to this owner; returning empty
22850
- // would leave that lease with nobody to release it. After a rolled
22851
- // back invocation it matches no row. A failure propagates, so the
22852
- // attempt is never reported as settled.
22879
+ // nothing, and hand back any initial reservation of the named head.
22880
+ if (abandonedHeadEventId) {
22881
+ // Admission may already have reserved this head, even on the first
22882
+ // checkout. A retried checkout can also follow an ambiguous COMMIT.
22883
+ // Release only this owner's lease; an absent or replaced owner is a
22884
+ // no-op. Failure propagates so the attempt cannot report settlement.
22853
22885
  await releasePostgresSchedulerOutboxLease(
22854
22886
  client,
22855
22887
  [abandonedHeadEventId],
@@ -14,6 +14,7 @@ import {
14
14
  postgresSchedulerNotifyChannel,
15
15
  readPostgresSchedulerOutboxAdmissionHints,
16
16
  readPostgresSchedulerOutboxNextDueAt,
17
+ postgresSchedulerInlineCreatedProjectionLease,
17
18
  type PostgresSchedulerOptions,
18
19
  type PostgresSchedulerOutboxProjectionResult,
19
20
  type RunLedgerOutboxDeliveredRow,
@@ -76,6 +77,12 @@ export const RUN_LEDGER_OUTBOX_RECOVERY_MAX_IN_FLIGHT = 32;
76
77
  // The higher exported ceiling remains available to isolated recovery callers,
77
78
  // but it is not the steady-state production setting.
78
79
  const RUN_LEDGER_OUTBOX_RECOVERY_PRODUCTION_IN_FLIGHT = 8;
80
+ // This is a total budget shared by lifecycle and indexing lanes. Preview's
81
+ // former 32 slots left 24 for lifecycle delivery and queued 25 short SQL
82
+ // operations behind a two-connection pool. Sixteen total slots retain eight
83
+ // lifecycle and eight indexing deliveries, matching both Production replicas
84
+ // combined. Isolated callers retain the larger hard ceiling above.
85
+ const RUN_LEDGER_OUTBOX_RECOVERY_PREVIEW_IN_FLIGHT = 16;
79
86
  // Production runs two projector replicas, so four index deliveries per
80
87
  // replica provide eight shared slots. Preview has one projector replica; give
81
88
  // it the same total bounded search-index capacity.
@@ -131,17 +138,17 @@ export type RunLedgerOutboxRecoveryDeps = {
131
138
  };
132
139
 
133
140
  /**
134
- * Production runs two projector replicas at eight deliveries each. An
135
- * isolated Preview estate has one replica, so use the existing bounded
136
- * 32-delivery ceiling there to keep fixture admission and its catalog
137
- * projection inside the same latency budget. This does not change Production
138
- * capacity or the controller's hard maximum.
141
+ * Production runs two projector replicas at eight total deliveries each:
142
+ * four lifecycle and four indexing slots. One Preview replica uses sixteen
143
+ * total slots, retaining eight per lane. Extra in-flight network deliveries
144
+ * also fan out claim, renewal and acknowledgement checkouts. Production
145
+ * capacity and the controller's hard maximum remain unchanged.
139
146
  */
140
147
  export function runLedgerOutboxRecoveryParallelism(
141
148
  environment: 'preview' | 'production',
142
149
  ): number {
143
150
  return environment === 'preview'
144
- ? RUN_LEDGER_OUTBOX_RECOVERY_MAX_IN_FLIGHT
151
+ ? RUN_LEDGER_OUTBOX_RECOVERY_PREVIEW_IN_FLIGHT
145
152
  : RUN_LEDGER_OUTBOX_RECOVERY_PRODUCTION_IN_FLIGHT;
146
153
  }
147
154
 
@@ -1054,6 +1061,8 @@ export async function deliverRunCreatedOutboxEventInline(input: {
1054
1061
  {
1055
1062
  runId,
1056
1063
  headEventId: `run-created:${runId}`,
1064
+ leaseOwner:
1065
+ postgresSchedulerInlineCreatedProjectionLease(runId).leaseOwner,
1057
1066
  limit: 1,
1058
1067
  leaseSeconds: RUN_CREATED_INLINE_DELIVERY_LEASE_SECONDS,
1059
1068
  tokenAuthority: input.tokenAuthority,
@@ -1233,8 +1242,8 @@ export function startRunLedgerOutboxRecoveryController(input: {
1233
1242
  observabilityParallelism,
1234
1243
  // `dispatchRunLedgerOutboxToLedgerBatchOnceWithClientScope` releases each
1235
1244
  // short scheduler checkout before it calls the Vercel gateway. Production
1236
- // retains two replicas at eight lifecycle and four search slots each; one
1237
- // Preview replica uses 32 lifecycle and eight search slots.
1245
+ // retains two replicas at four lifecycle and four search slots each; one
1246
+ // Preview replica uses eight lifecycle and eight search slots.
1238
1247
  parallelism: runLedgerOutboxRecoveryParallelism(environment),
1239
1248
  notifyUnavailableSafetyWakeMs: runLedgerOutboxNotifySafetyWakeMs(
1240
1249
  schedulerOptions.schema,
@@ -0,0 +1,41 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+ var _chunkA7THVTRNjs = require('./chunk-A7THVTRN.js');
17
+ require('./chunk-57F5VKHV.js');
18
+ require('./chunk-CNQBCLQP.js');
19
+ require('./chunk-AGIEKE3L.js');
20
+ require('./chunk-ALJJRZNJ.js');
21
+ require('./chunk-XNYIZMNQ.js');
22
+ require('./chunk-DIAWYWT5.js');
23
+ require('./chunk-NSAKJQLX.js');
24
+ require('./chunk-OG64RBAC.js');
25
+ require('./chunk-COGTRVWW.js');
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+ exports.EXIT_WORKSPACE_MISMATCH = _chunkA7THVTRNjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkA7THVTRNjs.authStatusLine; exports.clearPendingClaim = _chunkA7THVTRNjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkA7THVTRNjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkA7THVTRNjs.handleRegister; exports.handleStatus = _chunkA7THVTRNjs.handleStatus; exports.handleWait = _chunkA7THVTRNjs.handleWait; exports.httpJson = _chunkA7THVTRNjs.httpJson; exports.readPendingAuthClaim = _chunkA7THVTRNjs.readPendingAuthClaim; exports.readStatusBanner = _chunkA7THVTRNjs.readStatusBanner; exports.registerAuthCommands = _chunkA7THVTRNjs.registerAuthCommands; exports.reportSetupCompleted = _chunkA7THVTRNjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkA7THVTRNjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkA7THVTRNjs.statusBannerLine;
@@ -13,14 +13,14 @@ import {
13
13
  reportSetupCompleted,
14
14
  resolvePendingAuthClaimForResume,
15
15
  statusBannerLine
16
- } from "./chunk-X4U763KU.mjs";
17
- import "./chunk-NOQRM7LV.mjs";
18
- import "./chunk-TVDBGEVP.mjs";
19
- import "./chunk-CHD7NMZD.mjs";
16
+ } from "./chunk-BWLXHUKH.mjs";
17
+ import "./chunk-QG7UPPOK.mjs";
18
+ import "./chunk-VL7OL7YR.mjs";
19
+ import "./chunk-SETIOXN4.mjs";
20
20
  import "./chunk-4QF2K7TM.mjs";
21
21
  import "./chunk-DLIRSHV6.mjs";
22
22
  import "./chunk-HBL4PM5Q.mjs";
23
- import "./chunk-CXYMJSRQ.mjs";
23
+ import "./chunk-DSOTGAXS.mjs";
24
24
  import "./chunk-WZYKRD7T.mjs";
25
25
  import "./chunk-KRD6H754.mjs";
26
26
  export {