deepline 0.3.297 → 0.3.299

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 (91) hide show
  1. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  2. package/dist/bundling-sources/shared_libs/monitors/quickstart-prompts.ts +15 -0
  3. package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +9 -98
  4. package/dist/bundling-sources/shared_libs/play-runtime/async-operation.ts +15 -2
  5. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-pool.ts +3 -1
  6. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +80 -33
  7. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +115 -59
  8. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +15 -3
  9. package/dist/cli/auth-4WFBFN3L.js +31 -0
  10. package/dist/cli/{auth-FOHTQKQV.mjs → auth-GWIEEZWL.mjs} +4 -4
  11. package/dist/cli/{billing-NRKIBTKJ.js → billing-K5EVUVEH.js} +70 -70
  12. package/dist/cli/{billing-ZY3KZNZD.mjs → billing-O5RAKWXK.mjs} +4 -4
  13. package/dist/cli/{chunk-VIOM5OEQ.js → chunk-2BISKKLW.js} +58 -58
  14. package/dist/cli/{chunk-YH2XATMF.js → chunk-3M3LQJUV.js} +26 -26
  15. package/dist/cli/{chunk-FSPE246W.js → chunk-4B7VWFHW.js} +15 -15
  16. package/dist/cli/{chunk-YCCDPYIV.mjs → chunk-5465KL4F.mjs} +4 -4
  17. package/dist/cli/{chunk-QPBTAYNK.mjs → chunk-6ECTEH6V.mjs} +2 -2
  18. package/dist/cli/{chunk-4NYMO67X.js → chunk-ACSNZYU3.js} +2 -2
  19. package/dist/cli/{chunk-ZXJWXNGA.mjs → chunk-BQ63LCEL.mjs} +3 -3
  20. package/dist/cli/{chunk-PYXPP7NX.mjs → chunk-CJBMCJW7.mjs} +1 -1
  21. package/dist/cli/{chunk-B52G7BYN.js → chunk-CL4YLYGW.js} +6 -6
  22. package/dist/cli/{chunk-FHO5PO6Q.js → chunk-D2P4AM5M.js} +6 -6
  23. package/dist/cli/{chunk-OSUS6K5I.js → chunk-DMTWRFPD.js} +4 -4
  24. package/dist/cli/{chunk-PLKA4WFH.mjs → chunk-FKKCGFQ2.mjs} +3 -3
  25. package/dist/cli/{chunk-DBZX2IWV.mjs → chunk-FT2TIKOX.mjs} +2 -2
  26. package/dist/cli/{chunk-R2COLUYE.mjs → chunk-QAEIUQPS.mjs} +1 -1
  27. package/dist/cli/{chunk-IJGJKU4L.js → chunk-REFGDIMC.js} +1 -1
  28. package/dist/cli/{chunk-YFPOHUWQ.mjs → chunk-S34ZVHGJ.mjs} +1 -1
  29. package/dist/cli/{chunk-QIJ32UEW.js → chunk-SJK2LSDQ.js} +6 -6
  30. package/dist/cli/{chunk-SZJM7D7W.mjs → chunk-TRSF2X3K.mjs} +1 -1
  31. package/dist/cli/{chunk-AC3SC3AC.mjs → chunk-W2N5FICT.mjs} +1 -1
  32. package/dist/cli/{chunk-34A5RSXF.js → chunk-WF7XMZAC.js} +6 -6
  33. package/dist/cli/{chunk-V24XJVLX.js → chunk-XUMCCIOY.js} +48 -48
  34. package/dist/cli/{chunk-R5BISWXF.mjs → chunk-ZWUOF7WR.mjs} +1 -1
  35. package/dist/cli/{client-65MCTEMR.mjs → client-OXUEAZD2.mjs} +3 -3
  36. package/dist/cli/client-ZBLK3VOY.js +20 -0
  37. package/dist/cli/{csv-SHCW3IJL.js → csv-J24BXLDP.js} +12 -12
  38. package/dist/cli/{csv-TJWBSMR2.mjs → csv-NV6QBRGT.mjs} +3 -3
  39. package/dist/cli/{db-DN6YHQTC.js → db-FL4N5LXG.js} +20 -20
  40. package/dist/cli/{db-K7QXXM5C.mjs → db-IY4LHKLR.mjs} +4 -4
  41. package/dist/cli/{executions-FRQO6SJF.mjs → executions-72PNXJWI.mjs} +4 -4
  42. package/dist/cli/{executions-2POJWTCH.js → executions-OYGLF6K2.js} +6 -6
  43. package/dist/cli/{feedback-A6232HB5.mjs → feedback-NGPJBTUS.mjs} +3 -3
  44. package/dist/cli/{feedback-EEYZOH3S.js → feedback-WHOLOKBU.js} +6 -6
  45. package/dist/cli/git-GD5I7YOP.js +23 -0
  46. package/dist/cli/{git-FRVNZNIA.mjs → git-HQKCORLT.mjs} +4 -4
  47. package/dist/cli/index.js +73 -73
  48. package/dist/cli/index.mjs +30 -30
  49. package/dist/cli/{legacy-noops-NREP3YMQ.js → legacy-noops-5RHXWONK.js} +7 -7
  50. package/dist/cli/{legacy-noops-WEN2VQKS.mjs → legacy-noops-MCAHTGPU.mjs} +4 -4
  51. package/dist/cli/{monitors-EHHO4IGT.js → monitors-MC4QEQ7N.js} +85 -85
  52. package/dist/cli/{monitors-2F7GLG24.mjs → monitors-X2KE6CL6.mjs} +4 -4
  53. package/dist/cli/{org-TTFZKSMD.js → org-75TWPW5D.js} +60 -60
  54. package/dist/cli/{org-JONFO5PV.mjs → org-YW6EKMHL.mjs} +4 -4
  55. package/dist/cli/{play-N3JMRLKG.js → play-CAMPEI5I.js} +200 -200
  56. package/dist/cli/{play-Y7U2XU2K.mjs → play-DEBY5SCV.mjs} +6 -6
  57. package/dist/cli/{providers-CWPT5L3U.mjs → providers-IA77P6YJ.mjs} +4 -4
  58. package/dist/cli/{providers-I4V4QCOM.js → providers-VNOHQ2AS.js} +7 -7
  59. package/dist/cli/{quickstart-UBONJ6EY.mjs → quickstart-K7HQS543.mjs} +3 -3
  60. package/dist/cli/{quickstart-2DDUIWC5.js → quickstart-LDTV2HGI.js} +5 -5
  61. package/dist/cli/{search-BHCCYLF2.mjs → search-536X3UCU.mjs} +5 -5
  62. package/dist/cli/{search-Z72FUFXL.js → search-SN5OPRXZ.js} +6 -6
  63. package/dist/cli/{secrets-AE22MX42.js → secrets-2EW56WXT.js} +13 -13
  64. package/dist/cli/{secrets-BGD4PNTG.mjs → secrets-B3AJVZEX.mjs} +4 -4
  65. package/dist/cli/{sessions-7SIBBFHF.js → sessions-3VDMBHNS.js} +5 -5
  66. package/dist/cli/{sessions-JYSG6SUN.mjs → sessions-WBJUUGWS.mjs} +4 -4
  67. package/dist/cli/{settings-LCA42CL3.js → settings-KABYSG3X.js} +74 -74
  68. package/dist/cli/{settings-4XWN4JFT.mjs → settings-RLDDNKLV.mjs} +7 -7
  69. package/dist/cli/{setup-NID2M4GQ.js → setup-CSOSGT4H.js} +41 -41
  70. package/dist/cli/{setup-WMOKDWHV.mjs → setup-LXS6GANX.mjs} +6 -6
  71. package/dist/cli/{skills-6IL3LQUJ.mjs → skills-63SF5XTZ.mjs} +4 -4
  72. package/dist/cli/skills-C7MLZJEK.js +28 -0
  73. package/dist/cli/{tools-BOIRKQA4.mjs → tools-HNP35FVR.mjs} +5 -5
  74. package/dist/cli/{tools-TZLX4WAL.js → tools-RHL5K6UA.js} +50 -50
  75. package/dist/cli/{update-VF3BB3R7.mjs → update-BIUXK2GK.mjs} +6 -6
  76. package/dist/cli/update-NFJGKKZ6.js +28 -0
  77. package/dist/cli/{workflow-RUTOLKOS.js → workflow-45YNQNPE.js} +15 -15
  78. package/dist/cli/{workflow-UZKD5KU2.mjs → workflow-EKLCRCUD.mjs} +5 -5
  79. package/dist/index.js +6 -6
  80. package/dist/index.mjs +3 -3
  81. package/dist/install-integrity.json +68 -68
  82. package/dist/release.d.mts +1 -1
  83. package/dist/release.d.ts +1 -1
  84. package/dist/release.js +2 -2
  85. package/dist/release.mjs +1 -1
  86. package/package.json +1 -1
  87. package/dist/cli/auth-DLGUNY3B.js +0 -31
  88. package/dist/cli/client-QLERARAF.js +0 -20
  89. package/dist/cli/git-SZHVHZWU.js +0 -23
  90. package/dist/cli/skills-AYCZ4UXS.js +0 -28
  91. package/dist/cli/update-EEFUC76J.js +0 -28
@@ -74,6 +74,7 @@ export const RUN_LEDGER_OUTBOX_RECOVERY_MAX_IN_FLIGHT = 32;
74
74
  // The higher exported ceiling remains available to isolated recovery callers,
75
75
  // but it is not the steady-state production setting.
76
76
  const RUN_LEDGER_OUTBOX_RECOVERY_PRODUCTION_IN_FLIGHT = 8;
77
+ const RUN_LEDGER_OUTBOX_RECOVERY_INDEX_IN_FLIGHT = 4;
77
78
  // Admissions retain three of four claim opportunities. The fourth selects
78
79
  // the oldest eligible causal head across all runs, preventing terminal work
79
80
  // from starving behind continuous new admissions. An empty class never costs
@@ -89,6 +90,9 @@ export type RunLedgerOutboxRecoveryDeps = {
89
90
  dispatchOnce: (
90
91
  headPriority: RunLedgerOutboxHeadPriority,
91
92
  ) => Promise<PostgresSchedulerOutboxProjectionResult>;
93
+ /** Independent index deliveries share this controller and notification source. */
94
+ dispatchObservabilityOnce?: () => Promise<PostgresSchedulerOutboxProjectionResult>;
95
+ observabilityParallelism?: number;
92
96
  /** Earliest pending retry time or active lease expiry in the durable outbox. */
93
97
  readNextDueAt: () => Promise<Date | null>;
94
98
  /** A direct LISTEN connection. It is a hint only; a null lease is safe. */
@@ -159,6 +163,22 @@ export function startRunLedgerOutboxRecovery(
159
163
  ),
160
164
  )
161
165
  : 1;
166
+ if (deps.dispatchObservabilityOnce && parallelism < 2) {
167
+ throw new Error(
168
+ 'Independent observability delivery requires at least two slots.',
169
+ );
170
+ }
171
+ const observabilityParallelism = deps.dispatchObservabilityOnce
172
+ ? Math.min(
173
+ Math.max(1, deps.observabilityParallelism ?? 1),
174
+ Math.max(1, parallelism - 1),
175
+ )
176
+ : 0;
177
+ const lifecycleParallelism = Math.max(
178
+ 1,
179
+ parallelism - observabilityParallelism,
180
+ );
181
+ let observabilityRequested = false;
162
182
  let closed = false;
163
183
  let requested = false;
164
184
  let failureCount = 0;
@@ -174,22 +194,24 @@ export function startRunLedgerOutboxRecovery(
174
194
  let nextDispatchId = 0;
175
195
  let lastDispatchSettledAt: number | null = null;
176
196
  let admissionTurns = 0;
177
- const dispatchOnce =
178
- async (): Promise<PostgresSchedulerOutboxProjectionResult> => {
179
- const oldestReady =
180
- admissionTurns === ADMISSION_TURNS_PER_OLDEST_READY_TURN;
181
- admissionTurns = oldestReady ? 0 : admissionTurns + 1;
182
- const id = nextDispatchId++;
183
- inFlightStartedAt.set(id, now());
184
- try {
185
- return await deps.dispatchOnce(
186
- oldestReady ? 'oldest_ready' : 'admission_first',
187
- );
188
- } finally {
189
- inFlightStartedAt.delete(id);
190
- lastDispatchSettledAt = now();
191
- }
192
- };
197
+ const dispatchOnce = async (
198
+ observability = false,
199
+ ): Promise<PostgresSchedulerOutboxProjectionResult> => {
200
+ const oldestReady =
201
+ admissionTurns === ADMISSION_TURNS_PER_OLDEST_READY_TURN;
202
+ if (!observability) admissionTurns = oldestReady ? 0 : admissionTurns + 1;
203
+ const id = nextDispatchId++;
204
+ inFlightStartedAt.set(id, now());
205
+ try {
206
+ if (observability) return await deps.dispatchObservabilityOnce!();
207
+ return await deps.dispatchOnce(
208
+ oldestReady ? 'oldest_ready' : 'admission_first',
209
+ );
210
+ } finally {
211
+ inFlightStartedAt.delete(id);
212
+ lastDispatchSettledAt = now();
213
+ }
214
+ };
193
215
 
194
216
  const clearWakeTimer = () => {
195
217
  if (!timer) return;
@@ -220,6 +242,7 @@ export function startRunLedgerOutboxRecovery(
220
242
  requestDrain = (reason: string) => {
221
243
  if (closed) return;
222
244
  requested = true;
245
+ observabilityRequested = !!deps.dispatchObservabilityOnce;
223
246
  if (cooldownUntilMs !== null && now() < cooldownUntilMs) return;
224
247
  clearWakeTimer();
225
248
  if (drainPromise) {
@@ -313,11 +336,13 @@ export function startRunLedgerOutboxRecovery(
313
336
  const drain = async (reason: string): Promise<void> => {
314
337
  type Delivery = {
315
338
  id: symbol;
339
+ observability: boolean;
316
340
  result:
317
341
  | PromiseSettledResult<PostgresSchedulerOutboxProjectionResult>
318
342
  | { status: 'skipped' };
319
343
  };
320
344
  const pending = new Set<symbol>();
345
+ const pendingObservability = new Set<symbol>();
321
346
  const deliveries: Delivery[] = [];
322
347
  let refill = false;
323
348
  let dispatchFailed = false;
@@ -345,15 +370,16 @@ export function startRunLedgerOutboxRecovery(
345
370
  completed = attempted = projected = retrying = blocked = 0;
346
371
  };
347
372
 
348
- const launch = () => {
373
+ const launch = (observability = false) => {
349
374
  const id = Symbol();
350
375
  pending.add(id);
376
+ if (observability) pendingObservability.add(id);
351
377
  const settle = (result: Delivery['result']) => {
352
378
  if (result.status === 'rejected' && !dispatchFailed) {
353
379
  dispatchFailed = true;
354
380
  scheduleFailureRetry('dispatch', result.reason);
355
381
  }
356
- deliveries.push({ id, result });
382
+ deliveries.push({ id, observability, result });
357
383
  wakeActiveDrain?.();
358
384
  };
359
385
  // Subscribe once per delivery. Repeated Promise.race calls would retain
@@ -364,26 +390,54 @@ export function startRunLedgerOutboxRecovery(
364
390
  return;
365
391
  }
366
392
  try {
367
- settle({ status: 'fulfilled', value: await dispatchOnce() });
393
+ settle({
394
+ status: 'fulfilled',
395
+ value: await dispatchOnce(observability),
396
+ });
368
397
  } catch (reason) {
369
398
  settle({ status: 'rejected', reason });
370
399
  }
371
400
  });
372
401
  };
373
402
 
403
+ const canProbeLifecycle = () =>
404
+ !closed &&
405
+ !dispatchFailed &&
406
+ requested &&
407
+ pending.size < parallelism &&
408
+ pending.size - pendingObservability.size < lifecycleParallelism;
409
+ const canProbeObservability = () =>
410
+ !closed &&
411
+ !dispatchFailed &&
412
+ observabilityRequested &&
413
+ pending.size < parallelism &&
414
+ pendingObservability.size < observabilityParallelism;
415
+
374
416
  for (;;) {
375
417
  if (!closed && !dispatchFailed) {
376
418
  // A wake grants one indexed probe, including when other slots are
377
419
  // still delivering. Keep it pending when full so an empty result
378
420
  // cannot consume a notification that arrived after its query began.
379
- if (requested && pending.size < parallelism) {
421
+ if (canProbeObservability()) {
422
+ observabilityRequested = false;
423
+ while (
424
+ pendingObservability.size < observabilityParallelism &&
425
+ pending.size < parallelism
426
+ )
427
+ launch(true);
428
+ }
429
+ if (canProbeLifecycle()) {
380
430
  requested = false;
381
431
  launch();
382
432
  }
383
433
  // Productive completion permits immediate use of every free slot.
384
434
  // Empty results grant no refill, so idle work cannot spin on scans.
385
435
  if (refill) {
386
- while (pending.size < parallelism) launch();
436
+ while (
437
+ pending.size < parallelism &&
438
+ pending.size - pendingObservability.size < lifecycleParallelism
439
+ )
440
+ launch();
387
441
  refill = false;
388
442
  }
389
443
  }
@@ -398,10 +452,8 @@ export function startRunLedgerOutboxRecovery(
398
452
  wakeActiveDrain = resolve;
399
453
  if (
400
454
  deliveries.length > 0 ||
401
- (requested &&
402
- !closed &&
403
- !dispatchFailed &&
404
- pending.size < parallelism)
455
+ canProbeLifecycle() ||
456
+ canProbeObservability()
405
457
  )
406
458
  resolve();
407
459
  });
@@ -409,6 +461,7 @@ export function startRunLedgerOutboxRecovery(
409
461
  const delivery = deliveries.shift();
410
462
  if (!delivery) continue;
411
463
  pending.delete(delivery.id);
464
+ pendingObservability.delete(delivery.id);
412
465
  if (delivery.result.status !== 'fulfilled') {
413
466
  // Stop new claims but settle every already-started delivery before
414
467
  // cooldown or close can hand ownership to another drain.
@@ -423,7 +476,9 @@ export function startRunLedgerOutboxRecovery(
423
476
  if (completed >= parallelism) reportDeliveries();
424
477
  // Retryable rows own durable retry clocks. The SQL claim keeps their
425
478
  // run ordered while successful slots keep unrelated runs moving.
426
- refill = result.attempted > 0;
479
+ if (delivery.observability) {
480
+ if (result.attempted > 0) observabilityRequested = true;
481
+ } else refill = result.attempted > 0;
427
482
  }
428
483
  };
429
484
 
@@ -598,12 +653,37 @@ export function startRunLedgerOutboxRecoveryController(input: {
598
653
  onDelivered?: (deliveries: readonly RunLedgerOutboxDeliveredRow[]) => void;
599
654
  }): RunLedgerOutboxRecoveryController {
600
655
  const schedulerOptions = input.schedulerOptions ?? {};
601
- let dispatchOrdinal = 0;
602
- let searchInFlight = 0;
603
- const maxSearchInFlight = Math.max(
604
- 1,
605
- Math.floor(RUN_LEDGER_OUTBOX_RECOVERY_PRODUCTION_IN_FLIGHT / 2),
606
- );
656
+ const observabilityPoolOptions: RuntimeSchedulerPoolOptions = {
657
+ ...input.poolOptions,
658
+ purpose: 'observability',
659
+ applicationName: 'deepline-runtime-observability',
660
+ maxClients: RUN_LEDGER_OUTBOX_RECOVERY_INDEX_IN_FLIGHT,
661
+ };
662
+ const dispatch = (
663
+ headPriority: RunLedgerOutboxHeadPriority,
664
+ searchOnly: boolean,
665
+ ) =>
666
+ dispatchRunLedgerOutboxToLedgerBatchOnceWithClientScope(
667
+ (operation) =>
668
+ withRuntimeSchedulerClient(
669
+ searchOnly ? observabilityPoolOptions : input.poolOptions,
670
+ operation,
671
+ ),
672
+ {
673
+ tokenAuthority: 'gateway',
674
+ materializeObservability: true,
675
+ searchOnly,
676
+ withObservabilityClient: (operation) =>
677
+ withRuntimeSchedulerClient(observabilityPoolOptions, operation),
678
+ limit: 8,
679
+ headPriority,
680
+ // The lease holder delivers a run's terminal committed during its
681
+ // append, instead of leaving it for the next wave.
682
+ continueThroughTerminal: true,
683
+ ...(input.onDelivered ? { onDelivered: input.onDelivered } : {}),
684
+ },
685
+ schedulerOptions,
686
+ );
607
687
  return startRunLedgerOutboxRecovery({
608
688
  acquireNotifyHub: () =>
609
689
  input.useDirectNotify === false
@@ -614,33 +694,9 @@ export function startRunLedgerOutboxRecoveryController(input: {
614
694
  schedulerOptions,
615
695
  }),
616
696
  ),
617
- dispatchOnce: async (headPriority) => {
618
- const searchOnly =
619
- dispatchOrdinal++ % 2 === 1 && searchInFlight < maxSearchInFlight;
620
- if (searchOnly) searchInFlight += 1;
621
- try {
622
- return await dispatchRunLedgerOutboxToLedgerBatchOnceWithClientScope(
623
- (operation) =>
624
- withRuntimeSchedulerClient(input.poolOptions, operation),
625
- {
626
- tokenAuthority: 'gateway',
627
- materializeObservability: true,
628
- // One durable controller, with half its capacity reserved for
629
- // lifecycle delivery even when every search operation is blocked.
630
- searchOnly,
631
- limit: 8,
632
- headPriority,
633
- // The lease holder delivers a run's terminal committed during its
634
- // append, instead of leaving it for the next wave.
635
- continueThroughTerminal: true,
636
- ...(input.onDelivered ? { onDelivered: input.onDelivered } : {}),
637
- },
638
- schedulerOptions,
639
- );
640
- } finally {
641
- if (searchOnly) searchInFlight -= 1;
642
- }
643
- },
697
+ dispatchOnce: (headPriority) => dispatch(headPriority, false),
698
+ dispatchObservabilityOnce: () => dispatch('oldest_ready', true),
699
+ observabilityParallelism: RUN_LEDGER_OUTBOX_RECOVERY_INDEX_IN_FLIGHT,
644
700
  // `dispatchRunLedgerOutboxToLedgerBatchOnceWithClientScope` releases each
645
701
  // short scheduler checkout before it calls the Vercel gateway. The two
646
702
  // replicas therefore drain up to sixteen independent runs concurrently
@@ -61,7 +61,7 @@ const RUNTIME_EVENT_LOG_POSITION_EXPRESSION = `jsonb_set(
61
61
  // Migration readiness tracks this projection body independently of scheduler
62
62
  // wire and schema versions. Bump when a changed trigger must be reinstalled.
63
63
  export const RUNTIME_EVENT_SEARCH_OUTBOX_PROJECTION_MARKER =
64
- 'runtime-event-search-origin-batches-log-metadata';
64
+ 'runtime-event-search-origin-batches-log-metadata-point-replay';
65
65
  /** Trusted trigger-authored state; absent on already-projected legacy rows. */
66
66
  export const RUNTIME_EVENT_DEFERRED_PROJECTION_FIELD =
67
67
  '_runtimeSearchProjectionPending';
@@ -1310,8 +1310,16 @@ export async function attachRuntimeEventSearchTriggers(
1310
1310
  -- Tombstones retain digest/identity: retry never restores an expired body.
1311
1311
  SELECT count(*) INTO mismatches
1312
1312
  FROM jsonb_array_elements(item->'lines') WITH ORDINALITY AS entries(body, ordinal)
1313
- LEFT JOIN runtime_observability.events event ON event.runtime_scope = ${quoteLiteral(scope)} AND event.org_id = run_org
1314
- AND event.event_id = 'log-origin:' || observation.run_id || ':' || (item->'lineIds'->>(ordinal-1)::int)
1313
+ -- Keep each replay proof on the journal primary key. An unrestricted
1314
+ -- join can hash the whole shared org history for a small JSON batch.
1315
+ LEFT JOIN LATERAL (
1316
+ SELECT event.run_id, event.kind, event.source_digest
1317
+ FROM runtime_observability.events event
1318
+ WHERE event.runtime_scope = ${quoteLiteral(scope)} AND event.org_id = run_org
1319
+ AND event.event_id = 'log-origin:' || observation.run_id || ':' || (item->'lineIds'->>(ordinal-1)::int)
1320
+ -- The primary key admits one row; retain a parameterized point lookup.
1321
+ LIMIT 1
1322
+ ) event ON true
1315
1323
  WHERE event.run_id IS DISTINCT FROM observation.run_id OR event.kind IS DISTINCT FROM ${RUN_EVENT_KIND_SQL_LITERAL.logAppended}
1316
1324
  OR event.source_digest IS DISTINCT FROM CASE WHEN NULLIF(item->'lineContexts'->(ordinal-1)::int, 'null'::jsonb) IS NULL
1317
1325
  THEN encode(sha256(convert_to(body #>> '{}','UTF8')),'hex')
@@ -1982,11 +1990,15 @@ export async function attachRuntimeEventSearchTriggers(
1982
1990
  DO UPDATE SET last_seq = runtime_observability.run_log_cursors.last_seq + EXCLUDED.last_seq,
1983
1991
  updated_at = clock_timestamp()
1984
1992
  RETURNING last_seq INTO assigned_seq;
1993
+ -- Bound sequence assignment before joining the variable-size ID list.
1994
+ -- Shared-journal history from other runs is never a candidate.
1985
1995
  UPDATE runtime_observability.events AS event
1986
1996
  SET log_seq = assigned_seq - line_count + fresh.ordinality
1987
1997
  FROM unnest(fresh_event_ids) WITH ORDINALITY AS fresh(event_id, ordinality)
1988
1998
  WHERE event.runtime_scope = ${quoteLiteral(scope)}
1989
1999
  AND event.org_id = run_org
2000
+ AND event.run_id = observation.run_id
2001
+ AND event.event_id = ANY(fresh_event_ids)
1990
2002
  AND event.event_id = fresh.event_id;
1991
2003
  END IF;
1992
2004
  RETURN;
@@ -0,0 +1,31 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+ var _chunkXUMCCIOYjs = require('./chunk-XUMCCIOY.js');
13
+ require('./chunk-WF7XMZAC.js');
14
+ require('./chunk-DMTWRFPD.js');
15
+ require('./chunk-XNYIZMNQ.js');
16
+ require('./chunk-REFGDIMC.js');
17
+ require('./chunk-7P5AA3SN.js');
18
+ require('./chunk-OG64RBAC.js');
19
+ require('./chunk-COGTRVWW.js');
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+ exports.EXIT_WORKSPACE_MISMATCH = _chunkXUMCCIOYjs.EXIT_WORKSPACE_MISMATCH; exports.clearPendingClaim = _chunkXUMCCIOYjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkXUMCCIOYjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkXUMCCIOYjs.handleRegister; exports.handleStatus = _chunkXUMCCIOYjs.handleStatus; exports.handleWait = _chunkXUMCCIOYjs.handleWait; exports.readPendingAuthClaim = _chunkXUMCCIOYjs.readPendingAuthClaim; exports.registerAuthCommands = _chunkXUMCCIOYjs.registerAuthCommands; exports.reportSetupCompleted = _chunkXUMCCIOYjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkXUMCCIOYjs.resolvePendingAuthClaimForResume;
@@ -9,11 +9,11 @@ import {
9
9
  registerAuthCommands,
10
10
  reportSetupCompleted,
11
11
  resolvePendingAuthClaimForResume
12
- } from "./chunk-DBZX2IWV.mjs";
13
- import "./chunk-SZJM7D7W.mjs";
14
- import "./chunk-YFPOHUWQ.mjs";
12
+ } from "./chunk-FT2TIKOX.mjs";
13
+ import "./chunk-TRSF2X3K.mjs";
14
+ import "./chunk-S34ZVHGJ.mjs";
15
15
  import "./chunk-DLIRSHV6.mjs";
16
- import "./chunk-R2COLUYE.mjs";
16
+ import "./chunk-QAEIUQPS.mjs";
17
17
  import "./chunk-NXGCO4JB.mjs";
18
18
  import "./chunk-WZYKRD7T.mjs";
19
19
  import "./chunk-KRD6H754.mjs";