deepline 0.3.361 → 0.3.363

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 (97) hide show
  1. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  2. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +12 -1
  3. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +96 -79
  4. package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +1 -1
  5. package/dist/bundling-sources/shared_libs/product-notifications/events.ts +1 -0
  6. package/dist/cli/{auth-W3XF4IVK.mjs → auth-4X5IPPQY.mjs} +4 -4
  7. package/dist/cli/auth-IIY7PILQ.js +33 -0
  8. package/dist/cli/{billing-7YLHT6JZ.js → billing-A7CKW7AN.js} +73 -73
  9. package/dist/cli/{billing-OYXE7XZW.mjs → billing-PG5LC7A4.mjs} +4 -4
  10. package/dist/cli/{chunk-APL6QYTI.js → chunk-2VHSNTGJ.js} +15 -15
  11. package/dist/cli/{chunk-ISYEWJYS.mjs → chunk-3LL7F4VL.mjs} +5 -5
  12. package/dist/cli/{chunk-VR5AT72F.mjs → chunk-6453ELCN.mjs} +1 -1
  13. package/dist/cli/{chunk-UVMVPGLI.js → chunk-6TSA3G3I.js} +45 -45
  14. package/dist/cli/{chunk-TC6FXLSY.js → chunk-AG7AXHHA.js} +8 -8
  15. package/dist/cli/{chunk-77EFLOIZ.mjs → chunk-BCUUOP2S.mjs} +2 -2
  16. package/dist/cli/{chunk-AUDSNAI3.js → chunk-BTPEPEJR.js} +1 -1
  17. package/dist/cli/{chunk-BTUYN2YZ.mjs → chunk-CLXZXGJD.mjs} +2 -2
  18. package/dist/cli/{chunk-WBADQ5MO.mjs → chunk-DJDA57VF.mjs} +6 -6
  19. package/dist/cli/{chunk-BWPUOIHM.js → chunk-DZBDG6V7.js} +8 -8
  20. package/dist/cli/{chunk-CYN2W7ZU.js → chunk-FIZHV5SW.js} +60 -60
  21. package/dist/cli/{chunk-JUXZATZT.js → chunk-GC5J26KZ.js} +9 -9
  22. package/dist/cli/{chunk-4X7ABXAA.mjs → chunk-HK5L26A2.mjs} +1 -1
  23. package/dist/cli/{chunk-CNB7MDAS.mjs → chunk-IYRMVSNR.mjs} +3 -3
  24. package/dist/cli/{chunk-QWT3UDGV.mjs → chunk-JXIA7B4Q.mjs} +2 -2
  25. package/dist/cli/{chunk-N3G3OVL3.js → chunk-KNQ3PNZ7.js} +50 -50
  26. package/dist/cli/{chunk-FIV4J6SA.mjs → chunk-MC5IFDUJ.mjs} +1 -1
  27. package/dist/cli/{chunk-AIGVDBSZ.mjs → chunk-NVQLHOXI.mjs} +4 -4
  28. package/dist/cli/{chunk-TSMUWVJW.mjs → chunk-NWHXW4M4.mjs} +1 -1
  29. package/dist/cli/{chunk-HYSGORGL.mjs → chunk-OM3GDDKW.mjs} +2 -2
  30. package/dist/cli/{chunk-TJHUGJGZ.js → chunk-QQOQ7FCJ.js} +2 -2
  31. package/dist/cli/{chunk-6GWITFPG.js → chunk-SDCD7OH4.js} +224 -224
  32. package/dist/cli/{chunk-2UQLI6U7.mjs → chunk-TVMGRV4A.mjs} +1 -1
  33. package/dist/cli/{chunk-MOYOMVFW.js → chunk-VID352NP.js} +4 -4
  34. package/dist/cli/{chunk-U7KWVLJV.js → chunk-VTKCTJWG.js} +6 -6
  35. package/dist/cli/{chunk-V344OI5X.js → chunk-XB7NSDSX.js} +26 -26
  36. package/dist/cli/{client-ZQZVXFS2.mjs → client-FCVDAPRF.mjs} +3 -3
  37. package/dist/cli/client-FUDC2ULP.js +20 -0
  38. package/dist/cli/{csv-QVS44KXB.mjs → csv-5JHK77KT.mjs} +3 -3
  39. package/dist/cli/{csv-E42FNOUK.js → csv-6LOALPZU.js} +12 -12
  40. package/dist/cli/{db-P6HRY3JB.js → db-3MOAOVCW.js} +29 -29
  41. package/dist/cli/{db-XEUTHCF6.mjs → db-MRTQDSJB.mjs} +4 -4
  42. package/dist/cli/{describe-OOS6MEQD.js → describe-VOU44BDZ.js} +15 -15
  43. package/dist/cli/{describe-QWKKPM3X.mjs → describe-ZO2BH3V2.mjs} +8 -8
  44. package/dist/cli/{executions-A4WZCHH4.js → executions-H7GY5KI3.js} +6 -6
  45. package/dist/cli/{executions-ZS7VKRZD.mjs → executions-HOOTTSXV.mjs} +4 -4
  46. package/dist/cli/{feedback-757PQUXC.mjs → feedback-4U7FFIS5.mjs} +3 -3
  47. package/dist/cli/{feedback-U2PQLPKT.js → feedback-SH4V2B65.js} +7 -7
  48. package/dist/cli/git-IW6D5HOP.js +23 -0
  49. package/dist/cli/{git-L3XO7VI6.mjs → git-QKEH2SFT.mjs} +4 -4
  50. package/dist/cli/index.js +82 -82
  51. package/dist/cli/index.mjs +32 -32
  52. package/dist/cli/{legacy-noops-42NM5QWZ.mjs → legacy-noops-AWQ2T2C6.mjs} +4 -4
  53. package/dist/cli/{legacy-noops-OQ4ALQKK.js → legacy-noops-UWXUHHDX.js} +7 -7
  54. package/dist/cli/{monitors-JPBAFUVX.js → monitors-4MAKL2VN.js} +85 -85
  55. package/dist/cli/{monitors-7FDWSLBS.mjs → monitors-JEQ5YYLX.mjs} +4 -4
  56. package/dist/cli/{org-C2C2NALX.mjs → org-2C74R6WM.mjs} +4 -4
  57. package/dist/cli/{org-B4MYZVK4.js → org-C7N5OMSW.js} +60 -60
  58. package/dist/cli/play-J3W7VDAZ.js +153 -0
  59. package/dist/cli/{play-ZYSGVU24.mjs → play-LN7URHHN.mjs} +7 -7
  60. package/dist/cli/{providers-KKNRURH5.mjs → providers-2HOUYSJM.mjs} +4 -4
  61. package/dist/cli/{providers-MLIOET4Z.js → providers-LVG7PESP.js} +7 -7
  62. package/dist/cli/{quickstart-IY6MFHPJ.js → quickstart-56TVYIZW.js} +5 -5
  63. package/dist/cli/{quickstart-UHEO3K5Q.mjs → quickstart-DYU6XFQF.mjs} +3 -3
  64. package/dist/cli/{search-376E7O6G.mjs → search-HF7PKAGT.mjs} +5 -5
  65. package/dist/cli/search-YNNBIM73.js +26 -0
  66. package/dist/cli/{secrets-XSE4P5OQ.js → secrets-P5CWA6ZL.js} +13 -13
  67. package/dist/cli/{secrets-JW5JDLOC.mjs → secrets-SIILJU3C.mjs} +4 -4
  68. package/dist/cli/{sessions-ROTWO7MM.js → sessions-QHWGNJ5R.js} +5 -5
  69. package/dist/cli/{sessions-5AXLRZF5.mjs → sessions-TC3IN56Y.mjs} +4 -4
  70. package/dist/cli/{settings-FORRN32A.js → settings-F6HEQVKL.js} +74 -74
  71. package/dist/cli/{settings-GU32I3JW.mjs → settings-HUII4D54.mjs} +7 -7
  72. package/dist/cli/{setup-3F4IMDMT.js → setup-62IL6VFZ.js} +41 -41
  73. package/dist/cli/{setup-EXMSW4YQ.mjs → setup-EDQQAIZ3.mjs} +6 -6
  74. package/dist/cli/skills-3PA4O6CP.js +28 -0
  75. package/dist/cli/{skills-HMXGPD43.mjs → skills-KY4MRCQP.mjs} +4 -4
  76. package/dist/cli/{tools-6CMEX2JP.mjs → tools-7K3KPDVB.mjs} +6 -6
  77. package/dist/cli/tools-U6SM7MXM.js +40 -0
  78. package/dist/cli/update-7XMTB6YL.js +28 -0
  79. package/dist/cli/{update-XWJAPODY.mjs → update-T2BM6XEI.mjs} +6 -6
  80. package/dist/cli/{workflow-ORHETMDU.mjs → workflow-ONMVUYGO.mjs} +5 -5
  81. package/dist/cli/{workflow-B5DI4HZI.js → workflow-ZSAF2S66.js} +15 -15
  82. package/dist/index.js +6 -6
  83. package/dist/index.mjs +3 -3
  84. package/dist/install-integrity.json +74 -74
  85. package/dist/release.d.mts +1 -1
  86. package/dist/release.d.ts +1 -1
  87. package/dist/release.js +2 -2
  88. package/dist/release.mjs +1 -1
  89. package/package.json +1 -1
  90. package/dist/cli/auth-P5NP573V.js +0 -33
  91. package/dist/cli/client-7WALWJYV.js +0 -20
  92. package/dist/cli/git-IOVW32ES.js +0 -23
  93. package/dist/cli/play-E75ZXHHC.js +0 -153
  94. package/dist/cli/search-E4BC3JPV.js +0 -26
  95. package/dist/cli/skills-DNZKW3ZI.js +0 -28
  96. package/dist/cli/tools-U6SVTTKD.js +0 -40
  97. package/dist/cli/update-3IPQQEEQ.js +0 -28
@@ -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.361',
203
+ version: '0.3.363',
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: {
@@ -18788,6 +18788,8 @@ export async function readPostgresSchedulerOutboxNextDueAt(
18788
18788
  client: PostgresSchedulerQueryClient,
18789
18789
  options?: Pick<PostgresSchedulerOptions, 'schema'> & {
18790
18790
  lane?: 'lifecycle' | 'observability';
18791
+ /** Read one notified run's clock instead of enumerating every pending run. */
18792
+ runId?: string;
18791
18793
  },
18792
18794
  ): Promise<Date | null> {
18793
18795
  const lanes =
@@ -18796,10 +18798,18 @@ export async function readPostgresSchedulerOutboxNextDueAt(
18796
18798
  : options?.lane === 'observability'
18797
18799
  ? [true]
18798
18800
  : [false, true];
18801
+ const runId = options?.runId?.trim() || null;
18799
18802
  const result = await client.query<{ due_at: Date | string | null }>(
18800
18803
  `
18801
18804
  -- Seek distinct run identities without reading their pending fact tails.
18802
- WITH RECURSIVE ${runLedgerPendingRunsSql(options, options?.lane === undefined ? undefined : lanes[0])}, heads AS MATERIALIZED (
18805
+ WITH RECURSIVE ${
18806
+ runId
18807
+ ? 'pending_runs AS (SELECT $1::text AS run_id)'
18808
+ : runLedgerPendingRunsSql(
18809
+ options,
18810
+ options?.lane === undefined ? undefined : lanes[0],
18811
+ )
18812
+ }, heads AS MATERIALIZED (
18803
18813
  ${lanes
18804
18814
  .map(
18805
18815
  (
@@ -18836,6 +18846,7 @@ export async function readPostgresSchedulerOutboxNextDueAt(
18836
18846
  -- A failed head quarantines its lane; never wake on its successor.
18837
18847
  WHERE candidate.failed_at IS NULL
18838
18848
  `,
18849
+ runId ? [runId] : undefined,
18839
18850
  );
18840
18851
  const value = result.rows[0]?.due_at;
18841
18852
  if (value instanceof Date) return value;
@@ -99,8 +99,14 @@ export type RunLedgerOutboxRecoveryDeps = {
99
99
  runId?: string,
100
100
  ) => Promise<PostgresSchedulerOutboxProjectionResult>;
101
101
  observabilityParallelism?: number;
102
- /** Earliest pending retry time or active lease expiry in the durable outbox. */
103
- readNextDueAt: (lane?: 'lifecycle' | 'observability') => Promise<Date | null>;
102
+ /**
103
+ * Earliest pending retry time or active lease expiry in the durable outbox,
104
+ * or in one run's lane when `runId` names it.
105
+ */
106
+ readNextDueAt: (
107
+ lane?: 'lifecycle' | 'observability',
108
+ runId?: string,
109
+ ) => Promise<Date | null>;
104
110
  /** A direct LISTEN connection. It is a hint only; a null lease is safe. */
105
111
  acquireNotifyHub: () => PgNotifyHubLease | null;
106
112
  /** Bounded number of independent runs this replica may deliver at once. */
@@ -207,9 +213,10 @@ export function startRunLedgerOutboxRecovery(
207
213
  let dueClockRefreshRequested = false;
208
214
  let dueClockReadGeneration = 0;
209
215
  let dueClockKnownLane: 'both' | 'lifecycle' | 'observability' | null = null;
210
- let producerHintGeneration = 0;
211
- let dueClockReadHintGeneration = 0;
212
- let dueClockKnownHintGeneration = -1;
216
+ // Earliest run clock learned while a global read was in flight. That read's
217
+ // snapshot may predate the run's lease, so it must not arm a later wake.
218
+ let runDueDuringGlobalReadMs: number | null = null;
219
+ const runDueReads = new Set<Promise<void>>();
213
220
  let drainPromise: Promise<void> | null = null;
214
221
  let wakeActiveDrain: (() => void) | null = null;
215
222
  let cooldownUntilMs: number | null = null;
@@ -217,31 +224,26 @@ export function startRunLedgerOutboxRecovery(
217
224
  let unsubscribeNotify: (() => void) | undefined;
218
225
  let unsubscribeState: (() => void) | undefined;
219
226
  let requestDrain: (reason: string, runId?: string) => void = () => undefined;
220
- // A producer hint may reveal a lease that the claim cannot acquire. A
221
- // successful scoped claim's continuation does not force a metadata query
222
- // while other deliveries keep the drain busy. Zero marks that continuation.
223
- const lifecycleRunHints = new Map<string, number>();
224
- const observabilityRunHints = new Map<string, number>();
227
+ const lifecycleRunHints = new Set<string>();
228
+ const observabilityRunHints = new Set<string>();
225
229
  const hasRequests = () =>
226
230
  requested ||
227
231
  observabilityRequested ||
228
232
  lifecycleRunHints.size > 0 ||
229
233
  observabilityRunHints.size > 0;
230
- const addRunHint = (
231
- hints: Map<string, number>,
232
- runId: string,
233
- discoveryGeneration = producerHintGeneration,
234
- ) => {
235
- hints.set(runId, Math.max(discoveryGeneration, hints.get(runId) ?? 0));
234
+ const addRunHint = (hints: Set<string>, runId: string) => {
235
+ hints.add(runId);
236
236
  if (hints.size <= MAX_NOTIFICATION_RUN_HINTS) return true;
237
+ // The caller turns the dropped runs into a global request, whose empty
238
+ // claim must still rediscover their clocks.
237
239
  hints.clear();
240
+ dueClockKnownLane = null;
238
241
  return false;
239
242
  };
240
- const takeRunHint = (hints: Map<string, number>) => {
241
- const hint = hints.entries().next().value;
242
- if (!hint) return undefined;
243
- hints.delete(hint[0]);
244
- return { runId: hint[0], discoveryGeneration: hint[1] };
243
+ const takeRunHint = (hints: Set<string>) => {
244
+ const runId = hints.values().next().value;
245
+ if (runId !== undefined) hints.delete(runId);
246
+ return runId;
245
247
  };
246
248
  const inFlightStartedAt = new Map<number, number>();
247
249
  let nextDispatchId = 0;
@@ -326,11 +328,10 @@ export function startRunLedgerOutboxRecovery(
326
328
 
327
329
  requestDrain = (reason: string, runId?: string) => {
328
330
  if (closed) return;
329
- // Tag producer hints so a later missed claim can reject an older empty
330
- // snapshot. Productive hints need no metadata refresh while work is busy.
331
- producerHintGeneration += 1;
332
- dueClockKnownLane = null;
331
+ // A named run cannot change another run's clock. Its scoped claim reads
332
+ // that run's clock if it comes back empty.
333
333
  if (runId === undefined) {
334
+ dueClockKnownLane = null;
334
335
  requested = true;
335
336
  observabilityRequested = !!deps.dispatchObservabilityOnce;
336
337
  lifecycleRunHints.clear();
@@ -430,7 +431,6 @@ export function startRunLedgerOutboxRecovery(
430
431
  const readNextDueClock = async (
431
432
  generation: number,
432
433
  lane: Exclude<ReturnType<typeof dueClockLane>, null>,
433
- hintGeneration: number,
434
434
  ): Promise<void> => {
435
435
  let dueAt: Date | null;
436
436
  try {
@@ -467,8 +467,40 @@ export function startRunLedgerOutboxRecovery(
467
467
  }
468
468
  failureCount = 0;
469
469
  dueClockKnownLane = lane;
470
- dueClockKnownHintGeneration = hintGeneration;
471
- scheduleDueWake(dueAt);
470
+ const runDueMs = runDueDuringGlobalReadMs;
471
+ scheduleDueWake(
472
+ runDueMs !== null && (dueAt === null || runDueMs < dueAt.getTime())
473
+ ? new Date(runDueMs)
474
+ : dueAt,
475
+ );
476
+ };
477
+
478
+ const readRunDueClock = async (
479
+ lane: 'lifecycle' | 'observability',
480
+ runId: string,
481
+ ): Promise<void> => {
482
+ if (closed || cooldownUntilMs !== null) return;
483
+ let dueAt: Date | null;
484
+ try {
485
+ dueAt = await deps.readNextDueAt(lane, runId);
486
+ } catch (error) {
487
+ if (closed || cooldownUntilMs !== null) return;
488
+ // The global read covers this run; its own failure owns the cooldown.
489
+ logger.warn('[run-ledger-outbox.recovery_retry]', {
490
+ stage: 'run_due',
491
+ error: error instanceof Error ? error.message : String(error),
492
+ });
493
+ dueClockKnownLane = null;
494
+ if (!drainPromise) void scheduleNextDue();
495
+ return;
496
+ }
497
+ if (closed || cooldownUntilMs !== null || !dueAt) return;
498
+ if (dueClockRead)
499
+ runDueDuringGlobalReadMs = Math.min(
500
+ runDueDuringGlobalReadMs ?? Infinity,
501
+ dueAt.getTime(),
502
+ );
503
+ scheduleDueWake(dueAt, true);
472
504
  };
473
505
 
474
506
  const scheduleNextDue = (refresh = false): Promise<void> => {
@@ -484,18 +516,16 @@ export function startRunLedgerOutboxRecovery(
484
516
  if (lane === null || (dueClockKnownLane === lane && !refresh))
485
517
  return Promise.resolve();
486
518
  dueClockReadGeneration = dueClockGeneration;
487
- dueClockReadHintGeneration = producerHintGeneration;
488
- dueClockRead = readNextDueClock(
489
- dueClockReadGeneration,
490
- lane,
491
- dueClockReadHintGeneration,
492
- ).finally(() => {
493
- dueClockRead = null;
494
- if (dueClockRefreshRequested) {
495
- dueClockRefreshRequested = false;
496
- if (!closed && cooldownUntilMs === null) void scheduleNextDue(true);
497
- }
498
- });
519
+ runDueDuringGlobalReadMs = null;
520
+ dueClockRead = readNextDueClock(dueClockReadGeneration, lane).finally(
521
+ () => {
522
+ dueClockRead = null;
523
+ if (dueClockRefreshRequested) {
524
+ dueClockRefreshRequested = false;
525
+ if (!closed && cooldownUntilMs === null) void scheduleNextDue(true);
526
+ }
527
+ },
528
+ );
499
529
  return dueClockRead;
500
530
  };
501
531
 
@@ -504,7 +534,6 @@ export function startRunLedgerOutboxRecovery(
504
534
  id: symbol;
505
535
  observability: boolean;
506
536
  runId?: string;
507
- discoveryGeneration: number;
508
537
  result:
509
538
  | PromiseSettledResult<PostgresSchedulerOutboxProjectionResult>
510
539
  | { status: 'skipped' };
@@ -539,11 +568,7 @@ export function startRunLedgerOutboxRecovery(
539
568
  completed = attempted = projected = retrying = blocked = 0;
540
569
  };
541
570
 
542
- const launch = (
543
- observability = false,
544
- runId?: string,
545
- discoveryGeneration = producerHintGeneration,
546
- ) => {
571
+ const launch = (observability = false, runId?: string) => {
547
572
  const id = Symbol();
548
573
  pending.add(id);
549
574
  if (observability) pendingObservability.add(id);
@@ -552,13 +577,7 @@ export function startRunLedgerOutboxRecovery(
552
577
  dispatchFailed = true;
553
578
  scheduleFailureRetry('dispatch', result.reason);
554
579
  }
555
- deliveries.push({
556
- id,
557
- observability,
558
- runId,
559
- discoveryGeneration,
560
- result,
561
- });
580
+ deliveries.push({ id, observability, runId, result });
562
581
  wakeActiveDrain?.();
563
582
  };
564
583
  // Subscribe once per delivery. Repeated Promise.race calls would retain
@@ -600,16 +619,16 @@ export function startRunLedgerOutboxRecovery(
600
619
  // still delivering. Keep it pending when full so an empty result
601
620
  // cannot consume a notification that arrived after its query began.
602
621
  if (canProbeObservability()) {
603
- const hint = observabilityRequested
622
+ const runId = observabilityRequested
604
623
  ? undefined
605
624
  : takeRunHint(observabilityRunHints);
606
625
  observabilityRequested = false;
607
- launch(true, hint?.runId, hint?.discoveryGeneration);
626
+ launch(true, runId);
608
627
  }
609
628
  if (canProbeLifecycle()) {
610
- const hint = requested ? undefined : takeRunHint(lifecycleRunHints);
629
+ const runId = requested ? undefined : takeRunHint(lifecycleRunHints);
611
630
  requested = false;
612
- launch(false, hint?.runId, hint?.discoveryGeneration);
631
+ launch(false, runId);
613
632
  }
614
633
  // Productive completion permits immediate use of every free slot.
615
634
  // Empty results grant no refill, so idle work cannot spin on scans.
@@ -659,22 +678,22 @@ export function startRunLedgerOutboxRecovery(
659
678
  continue;
660
679
  }
661
680
  const result = delivery.result.value;
662
- const hintLane = delivery.observability ? 'observability' : 'lifecycle';
663
- const missedProducerHint =
664
- delivery.discoveryGeneration > 0 &&
665
- result.attempted === 0 &&
666
- (dueClockKnownHintGeneration < delivery.discoveryGeneration ||
667
- (dueClockKnownLane !== 'both' && dueClockKnownLane !== hintLane));
668
- if (result.attempted > 0 || missedProducerHint) dueClockKnownLane = null;
669
- // A claim returning empty may have lost to an inline owner. If its
670
- // notification followed the pending metadata snapshot, retain discovery
671
- // debt so that snapshot cannot cache an obsolete empty result.
681
+ // An empty scoped claim lost to another owner's lease, a delayed retry
682
+ // or a quarantined head of that run alone. Its clock is a run-scoped
683
+ // index read. The global read re-proves every pending run, so running
684
+ // it here once per outbox insert kept the database CPU-bound.
685
+ if (delivery.runId !== undefined && result.attempted === 0) {
686
+ const read = readRunDueClock(
687
+ delivery.observability ? 'observability' : 'lifecycle',
688
+ delivery.runId,
689
+ ).finally(() => runDueReads.delete(read));
690
+ runDueReads.add(read);
691
+ }
672
692
  if (
673
- missedProducerHint &&
674
- dueClockRead &&
675
- dueClockReadHintGeneration < delivery.discoveryGeneration
693
+ result.retrying > 0 ||
694
+ (delivery.runId === undefined && result.attempted > 0)
676
695
  )
677
- dueClockRefreshRequested = true;
696
+ dueClockKnownLane = null;
678
697
  if (result.retrying > 0) dueClockGeneration += 1;
679
698
  completed += 1;
680
699
  attempted += result.attempted;
@@ -684,16 +703,12 @@ export function startRunLedgerOutboxRecovery(
684
703
  if (completed >= parallelism) reportDeliveries();
685
704
  // Discovery cannot wait for every independent HTTP delivery to finish.
686
705
  // A retry commits a new clock; an empty global probe can expose that
687
- // clock while another slot remains busy. A missed producer hint may
688
- // expose an inline owner's lease; one later snapshot covers all earlier
689
- // hints. Scoped success keeps its cheap continuation, and the idle drain
690
- // still refreshes metadata after those continuations settle.
706
+ // clock while another slot remains busy.
691
707
  if (
692
708
  !closed &&
693
709
  !dispatchFailed &&
694
710
  pending.size > deliveries.length &&
695
711
  (result.retrying > 0 ||
696
- missedProducerHint ||
697
712
  ((timer === null || dueClockKnownLane !== dueClockLane()) &&
698
713
  delivery.runId === undefined &&
699
714
  result.attempted === 0))
@@ -708,12 +723,12 @@ export function startRunLedgerOutboxRecovery(
708
723
  if (delivery.observability) {
709
724
  if (
710
725
  !observabilityRequested &&
711
- !addRunHint(observabilityRunHints, delivery.runId, 0)
726
+ !addRunHint(observabilityRunHints, delivery.runId)
712
727
  )
713
728
  observabilityRequested = true;
714
729
  } else if (
715
730
  !requested &&
716
- !addRunHint(lifecycleRunHints, delivery.runId, 0)
731
+ !addRunHint(lifecycleRunHints, delivery.runId)
717
732
  )
718
733
  requested = true;
719
734
  }
@@ -756,6 +771,7 @@ export function startRunLedgerOutboxRecovery(
756
771
  unsubscribeState?.();
757
772
  await drainPromise;
758
773
  await dueClockRead;
774
+ await Promise.all(runDueReads);
759
775
  hubLease?.release();
760
776
  },
761
777
  };
@@ -1056,11 +1072,12 @@ export function startRunLedgerOutboxRecoveryController(input: {
1056
1072
  notifyUnavailableSafetyWakeMs: runLedgerOutboxNotifySafetyWakeMs(
1057
1073
  schedulerOptions.schema,
1058
1074
  ),
1059
- readNextDueAt: (lane) =>
1075
+ readNextDueAt: (lane, runId) =>
1060
1076
  withRuntimeSchedulerClient(input.poolOptions, (client) =>
1061
1077
  readPostgresSchedulerOutboxNextDueAt(client, {
1062
1078
  ...schedulerOptions,
1063
1079
  lane,
1080
+ runId,
1064
1081
  }),
1065
1082
  ),
1066
1083
  });
@@ -773,7 +773,7 @@ const PRODUCT_NOTIFICATION_TYPE_REGISTRY = [
773
773
  },
774
774
  }),
775
775
  present: ({ payload }) => ({
776
- title: `${payload.isFirstPurchase === true ? '🎉 First credit purchase' : 'Credit purchase'}: $${(Number(payload.amountPaidCents) / 100).toFixed(2)}`,
776
+ title: `${payload.isFirstPurchase === true ? '🎉 First credit purchase' : 'Credit purchase'}${payload.isAutoTopup === true ? ' (Auto top-up)' : ''}: $${(Number(payload.amountPaidCents) / 100).toFixed(2)}`,
777
777
  summary: [
778
778
  { workspace: true },
779
779
  ` purchased ${formatCredits(Number(payload.credits))} credits.`,
@@ -213,6 +213,7 @@ export const PRODUCT_NOTIFICATION_EVENT_DEFINITIONS: readonly ProductNotificatio
213
213
  amountPaidCents: 'number',
214
214
  currency: 'string',
215
215
  isFirstPurchase: 'boolean',
216
+ isAutoTopup: 'boolean',
216
217
  },
217
218
  orderingSubjectFact: 'accountId',
218
219
  allowedTriggers: ['threshold_crossing'],
@@ -10,12 +10,12 @@ import {
10
10
  registerAuthCommands,
11
11
  reportSetupCompleted,
12
12
  resolvePendingAuthClaimForResume
13
- } from "./chunk-BTUYN2YZ.mjs";
14
- import "./chunk-TSMUWVJW.mjs";
15
- import "./chunk-VR5AT72F.mjs";
13
+ } from "./chunk-CLXZXGJD.mjs";
14
+ import "./chunk-NWHXW4M4.mjs";
15
+ import "./chunk-6453ELCN.mjs";
16
16
  import "./chunk-DLIRSHV6.mjs";
17
17
  import "./chunk-NXGCO4JB.mjs";
18
- import "./chunk-2UQLI6U7.mjs";
18
+ import "./chunk-TVMGRV4A.mjs";
19
19
  import "./chunk-WZYKRD7T.mjs";
20
20
  import "./chunk-KRD6H754.mjs";
21
21
  export {
@@ -0,0 +1,33 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+ var _chunkKNQ3PNZ7js = require('./chunk-KNQ3PNZ7.js');
14
+ require('./chunk-VTKCTJWG.js');
15
+ require('./chunk-VID352NP.js');
16
+ require('./chunk-XNYIZMNQ.js');
17
+ require('./chunk-7P5AA3SN.js');
18
+ require('./chunk-BTPEPEJR.js');
19
+ require('./chunk-OG64RBAC.js');
20
+ require('./chunk-COGTRVWW.js');
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+ exports.EXIT_WORKSPACE_MISMATCH = _chunkKNQ3PNZ7js.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkKNQ3PNZ7js.authStatusLine; exports.clearPendingClaim = _chunkKNQ3PNZ7js.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkKNQ3PNZ7js.clearSatisfiedPendingClaim; exports.handleRegister = _chunkKNQ3PNZ7js.handleRegister; exports.handleStatus = _chunkKNQ3PNZ7js.handleStatus; exports.handleWait = _chunkKNQ3PNZ7js.handleWait; exports.readPendingAuthClaim = _chunkKNQ3PNZ7js.readPendingAuthClaim; exports.registerAuthCommands = _chunkKNQ3PNZ7js.registerAuthCommands; exports.reportSetupCompleted = _chunkKNQ3PNZ7js.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkKNQ3PNZ7js.resolvePendingAuthClaimForResume;