deepline 0.3.402 → 0.3.404

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 (120) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +14 -2
  2. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  3. package/dist/bundling-sources/shared_libs/integration-contracts/billing-entitlements.ts +7 -2
  4. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +114 -50
  5. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +6 -2
  6. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +379 -133
  7. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +2 -1
  8. package/dist/cli/{auth-GJGFHAUP.mjs → auth-DVJWHHC3.mjs} +4 -4
  9. package/dist/cli/auth-UIC53AE2.js +40 -0
  10. package/dist/cli/{billing-7YYI5OFD.mjs → billing-7UDFOLCT.mjs} +4 -4
  11. package/dist/cli/{billing-UBBNYU74.js → billing-MHS6WS77.js} +73 -73
  12. package/dist/cli/{chunk-3HWALOL2.mjs → chunk-6BJK4EJ3.mjs} +1 -1
  13. package/dist/cli/{chunk-5Z7SAD3Q.js → chunk-7CFSSEN3.js} +207 -207
  14. package/dist/cli/{chunk-TWZEHT5L.mjs → chunk-ANL3NJV5.mjs} +7 -7
  15. package/dist/cli/{chunk-65YHUBYZ.js → chunk-AYUR2RZ6.js} +8 -8
  16. package/dist/cli/{chunk-MSS6UHGK.js → chunk-B2BO6G7L.js} +26 -26
  17. package/dist/cli/{chunk-YHZUZO3U.mjs → chunk-BZAMOCPA.mjs} +1 -1
  18. package/dist/cli/{chunk-LQS5XUFL.js → chunk-CBMYUXAT.js} +6 -6
  19. package/dist/cli/{chunk-3HU47EGZ.mjs → chunk-CLJGSOVM.mjs} +2 -1
  20. package/dist/cli/{chunk-Q77JWGMZ.mjs → chunk-DSXMTZ64.mjs} +1 -1
  21. package/dist/cli/{chunk-RLL23M7M.mjs → chunk-EDSBH6W7.mjs} +2 -2
  22. package/dist/cli/{chunk-7DRPTGCK.js → chunk-FERRDNMO.js} +4 -4
  23. package/dist/cli/{chunk-Z7MNFHHE.mjs → chunk-FF2H4YLR.mjs} +4 -4
  24. package/dist/cli/{chunk-JHFX74T6.js → chunk-GPWTKORH.js} +4 -4
  25. package/dist/cli/{chunk-RFG3MRAC.js → chunk-ILHRA7AD.js} +5 -5
  26. package/dist/cli/{chunk-V4TFEZ47.mjs → chunk-JJZOGHEF.mjs} +1 -1
  27. package/dist/cli/{chunk-QPIAVCCS.mjs → chunk-KTWTQPYM.mjs} +2 -2
  28. package/dist/cli/{chunk-B2FAQ3AX.js → chunk-L3JGXPGB.js} +50 -50
  29. package/dist/cli/{chunk-TPPHH3FS.mjs → chunk-M55M5LDV.mjs} +3 -3
  30. package/dist/cli/{chunk-NMPFKSZN.mjs → chunk-NRI4TJVF.mjs} +1 -1
  31. package/dist/cli/{chunk-CIOMFOJJ.js → chunk-ODKHUBU3.js} +6 -6
  32. package/dist/cli/{chunk-JT7XZP4U.mjs → chunk-OHGXSFDQ.mjs} +1 -1
  33. package/dist/cli/{chunk-CBPK2TLC.js → chunk-OPGILU75.js} +65 -65
  34. package/dist/cli/{chunk-HFYQBC2D.mjs → chunk-PMVFAYL7.mjs} +1 -1
  35. package/dist/cli/{chunk-MH73HMPV.js → chunk-SEFMGO3Z.js} +3 -3
  36. package/dist/cli/{chunk-OPS5KQVF.mjs → chunk-TFIB4VNU.mjs} +2 -2
  37. package/dist/cli/{chunk-IK7J2DE5.js → chunk-URQAM7RR.js} +1 -1
  38. package/dist/cli/{chunk-L5UOVDJV.js → chunk-V5DPHNTE.js} +2 -2
  39. package/dist/cli/{chunk-OIUXHL7G.mjs → chunk-VPCIT5N6.mjs} +3 -3
  40. package/dist/cli/{chunk-ZOKF4F65.js → chunk-W3SACRLJ.js} +8 -8
  41. package/dist/cli/{chunk-4EWCKDFC.mjs → chunk-XKVJZ5JC.mjs} +1 -1
  42. package/dist/cli/{chunk-VHZOTHAD.js → chunk-Y5QWK7SS.js} +15 -15
  43. package/dist/cli/{chunk-KB4SDX5S.js → chunk-Z4VNJOF7.js} +2 -1
  44. package/dist/cli/{csv-V6JDZEWY.js → csv-7BXOAC3V.js} +12 -12
  45. package/dist/cli/{csv-USUSIYER.mjs → csv-TG7SSGXW.mjs} +3 -3
  46. package/dist/cli/{db-HRWKCFXF.js → db-BQCWAL3D.js} +25 -25
  47. package/dist/cli/{db-F5GMBQ65.mjs → db-GBVIPT7D.mjs} +4 -4
  48. package/dist/cli/{describe-R6KMEHL5.js → describe-3ROS6TC6.js} +15 -15
  49. package/dist/cli/{describe-S5O6FVT3.mjs → describe-6LP2CWEF.mjs} +9 -9
  50. package/dist/cli/describe-core.d.mts +2 -2
  51. package/dist/cli/describe-core.d.ts +2 -2
  52. package/dist/cli/describe-core.js +4 -4
  53. package/dist/cli/describe-core.mjs +3 -3
  54. package/dist/cli/{executions-YPZREEMY.mjs → executions-4TJOBZOQ.mjs} +4 -4
  55. package/dist/cli/{executions-PZIPKQBP.js → executions-KCKC2KKP.js} +6 -6
  56. package/dist/cli/{feedback-VDJR5X3J.js → feedback-7T77UCIV.js} +7 -7
  57. package/dist/cli/{feedback-BTETOM6H.mjs → feedback-CGJNFV3G.mjs} +3 -3
  58. package/dist/cli/{git-INUECEXT.mjs → git-5E3HETBN.mjs} +4 -4
  59. package/dist/cli/git-DRUSBG74.js +24 -0
  60. package/dist/cli/index.js +89 -89
  61. package/dist/cli/index.mjs +32 -32
  62. package/dist/cli/{legacy-noops-MDN77QAS.mjs → legacy-noops-4FGVQLLD.mjs} +4 -4
  63. package/dist/cli/{legacy-noops-45WQXPUD.js → legacy-noops-X5MCVE34.js} +7 -7
  64. package/dist/cli/{monitors-BMQEIYV6.js → monitors-OTAQWJH5.js} +84 -84
  65. package/dist/cli/{monitors-4BTZGTJW.mjs → monitors-QRZEIITA.mjs} +4 -4
  66. package/dist/cli/{org-6YNJ7VNJ.mjs → org-A6KANSFR.mjs} +4 -4
  67. package/dist/cli/{org-GTZDYRD3.js → org-B3JK2BND.js} +64 -64
  68. package/dist/cli/{play-GGQBJQG4.mjs → play-CN6DOFMT.mjs} +9 -9
  69. package/dist/cli/{play-BDIBVDSU.js → play-HLDZVD47.js} +249 -249
  70. package/dist/cli/{providers-6EYFXCHM.mjs → providers-EVPLX6BG.mjs} +4 -4
  71. package/dist/cli/{providers-AFQ6FQWQ.js → providers-XGCTTZ7T.js} +7 -7
  72. package/dist/cli/{quickstart-FIK5TO73.mjs → quickstart-HXORYMNO.mjs} +3 -3
  73. package/dist/cli/{quickstart-PUXYA3QD.js → quickstart-LTH2MZNQ.js} +5 -5
  74. package/dist/cli/search-MH6VAITK.js +30 -0
  75. package/dist/cli/{search-UTPRENV4.mjs → search-S4JOGJMH.mjs} +5 -5
  76. package/dist/cli/{secrets-FMM4RFK2.js → secrets-JV3TPKE6.js} +13 -13
  77. package/dist/cli/{secrets-R2RJ2J7Z.mjs → secrets-VNHUBHLN.mjs} +4 -4
  78. package/dist/cli/{sessions-HA2B7AYB.mjs → sessions-CDBTN53U.mjs} +4 -4
  79. package/dist/cli/{sessions-ZRXUQIVV.js → sessions-QYYFCXGY.js} +5 -5
  80. package/dist/cli/{settings-HPGNP7UU.mjs → settings-I6LQQCMK.mjs} +7 -7
  81. package/dist/cli/{settings-KKHOBBKF.js → settings-YYZ2IHFU.js} +74 -74
  82. package/dist/cli/{setup-FTSDFQOK.js → setup-IZQI5RZA.js} +41 -41
  83. package/dist/cli/{setup-WERVZIIX.mjs → setup-X24RP6O7.mjs} +6 -6
  84. package/dist/cli/skills-U4MIVNPW.js +29 -0
  85. package/dist/cli/{skills-D4BGGD5D.mjs → skills-UYIFSY2Y.mjs} +4 -4
  86. package/dist/cli/tools-BLP2VRAN.js +39 -0
  87. package/dist/cli/{tools-TKQW72OL.mjs → tools-IR5JEQF6.mjs} +8 -8
  88. package/dist/cli/update-EIYE45GT.js +29 -0
  89. package/dist/cli/{update-O77BPQAE.mjs → update-MXFLD3ZQ.mjs} +6 -6
  90. package/dist/cli/{workflow-GIDAYVSL.js → workflow-CZ6CXXOL.js} +15 -15
  91. package/dist/cli/{workflow-IJCMSPGJ.mjs → workflow-QGY342J5.mjs} +5 -5
  92. package/dist/{client-D0j-_aaa.d.mts → client-Buv1_ktG.d.mts} +4 -2
  93. package/dist/{client-DflfVyj6.d.ts → client-Db1jFLpF.d.ts} +4 -2
  94. package/dist/{compiler-manifest-DLxUY5kI.d.ts → compiler-manifest-N77W75Py.d.mts} +10 -6
  95. package/dist/{compiler-manifest-DLxUY5kI.d.mts → compiler-manifest-N77W75Py.d.ts} +10 -6
  96. package/dist/{index-SCb0NvDb.d.mts → index-3WOfyVhW.d.mts} +1 -1
  97. package/dist/{index-B_GM9E3q.d.ts → index-CtIJFTCl.d.ts} +1 -1
  98. package/dist/index.d.mts +5 -5
  99. package/dist/index.d.ts +5 -5
  100. package/dist/index.js +7 -7
  101. package/dist/index.mjs +4 -4
  102. package/dist/install-integrity.json +84 -84
  103. package/dist/plays/bundle-play-file.d.mts +3 -3
  104. package/dist/plays/bundle-play-file.d.ts +3 -3
  105. package/dist/plays/bundle-play-file.mjs +2 -2
  106. package/dist/plays/play-description.d.mts +2 -2
  107. package/dist/plays/play-description.d.ts +2 -2
  108. package/dist/plays/run-request.d.mts +2 -2
  109. package/dist/plays/run-request.d.ts +2 -2
  110. package/dist/release.d.mts +1 -1
  111. package/dist/release.d.ts +1 -1
  112. package/dist/release.js +2 -2
  113. package/dist/release.mjs +1 -1
  114. package/package.json +1 -1
  115. package/dist/cli/auth-CF34E66T.js +0 -40
  116. package/dist/cli/git-B5DP75FD.js +0 -24
  117. package/dist/cli/search-64GE26YS.js +0 -30
  118. package/dist/cli/skills-O7HGWWGF.js +0 -29
  119. package/dist/cli/tools-EKVHV35B.js +0 -39
  120. package/dist/cli/update-5CP72TRU.js +0 -29
@@ -1,4 +1,7 @@
1
- import type { BillingEntitlements } from '../../shared_libs/integration-contracts/billing-entitlements';
1
+ import type {
2
+ BillingEntitlements,
3
+ BillingBenefitValues,
4
+ } from '../../shared_libs/integration-contracts/billing-entitlements';
2
5
  export type { BillingEntitlements } from '../../shared_libs/integration-contracts/billing-entitlements';
3
6
  import type {
4
7
  PlaySettingsResult,
@@ -2168,11 +2171,20 @@ export type TargetBillingOperation = {
2168
2171
  };
2169
2172
 
2170
2173
  export type TargetBillingPlan = {
2171
- sku: 'payg-v1' | 'builder-v1' | 'growth-v1' | 'growth-canary-v1' | 'team-v1';
2174
+ sku:
2175
+ | 'payg-v1'
2176
+ | 'builder-v1'
2177
+ | 'growth-v1'
2178
+ | 'growth-canary-v1'
2179
+ | 'team-v1'
2180
+ | 'team-v2'
2181
+ | 'legacy-growth-v1';
2172
2182
  name: string;
2173
2183
  recurring_price_usd: number;
2174
2184
  interval: 'month' | 'year';
2175
2185
  included_credits: number;
2186
+ /** Offered benefit terms; omitted by older API deployments. */
2187
+ benefits?: Partial<BillingBenefitValues>;
2176
2188
  purchased_credit_price_usd: number;
2177
2189
  acquisition_enabled: boolean;
2178
2190
  };
@@ -202,7 +202,7 @@ export const SDK_RELEASE = {
202
202
  // getters keep their established compatibility behavior.
203
203
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
204
204
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
205
- version: '0.3.402',
205
+ version: '0.3.404',
206
206
  updateSummary:
207
207
  '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.',
208
208
  packageCapabilities: {
@@ -1,3 +1,8 @@
1
+ /** Finite customer-visible benefit values shared by offers and entitlement reads. */
2
+ export type BillingBenefitValues = {
3
+ quickenrichUnlimited: { enabled: boolean; requestsPerMinute: number };
4
+ };
5
+
1
6
  /** Customer-visible discovery data; execution always rechecks admission. */
2
7
  export type BillingEntitlements = {
3
8
  org_id: string;
@@ -13,11 +18,11 @@ export type BillingEntitlements = {
13
18
  benefits: {
14
19
  quickenrichUnlimited?: {
15
20
  status: 'active' | 'past_due';
16
- value: { enabled: boolean; requestsPerMinute: number };
21
+ value: BillingBenefitValues['quickenrichUnlimited'];
17
22
  expiresAt?: number;
18
23
  };
19
24
  };
20
- /** Configuration provenance is separate from the purchased promise. */
25
+ /** Rate provenance is separate from the inclusion flag. */
21
26
  effective_limits: {
22
27
  quickenrichUnlimited?: {
23
28
  baseline: number;
@@ -20574,9 +20574,7 @@ export function postgresSchedulerCancellationOutboxLease(runId: string): {
20574
20574
 
20575
20575
  export type RunLedgerOutboxDispatchInput = {
20576
20576
  /** Dedicated bounded checkout for indexing; claims/ACKs use withClient. */
20577
- withObservabilityClient?: <T>(
20578
- operation: (client: PostgresSchedulerQueryClient) => Promise<T>,
20579
- ) => Promise<T>;
20577
+ withObservabilityClient?: RunLedgerOutboxWithClient;
20580
20578
 
20581
20579
  /** Only the existing background projector claims the independent search prefix. */
20582
20580
  searchOnly?: boolean;
@@ -21435,6 +21433,29 @@ async function dispatchRunLedgerOutboxBatchWithScope(
21435
21433
  let appendResponse:
21436
21434
  | (RunLedgerDispatchResponseTrace & { roundTripMs: number | null })
21437
21435
  | null = null;
21436
+ // Checkout spans include retries and overlap query/commit spans. Acquisition
21437
+ // includes earlier callback attempts: it is neither CPU nor pure pool wait.
21438
+ // These observations must not be summed. Null means the stage was not reached.
21439
+ const searchPhaseTimingsMs = {
21440
+ renewal: null as number | null,
21441
+ materializeCheckout: null as number | null,
21442
+ materializeAcquireAndRetry: null as number | null,
21443
+ materializeQuery: null as number | null,
21444
+ materializeCommit: null as number | null,
21445
+ acknowledge: null as number | null,
21446
+ };
21447
+ const observeSearchPhase = async <T>(
21448
+ phase: keyof typeof searchPhaseTimingsMs,
21449
+ operation: () => Promise<T>,
21450
+ ): Promise<T> => {
21451
+ const startedAtMs = performance.now();
21452
+ try {
21453
+ return await operation();
21454
+ } finally {
21455
+ searchPhaseTimingsMs[phase] =
21456
+ (searchPhaseTimingsMs[phase] ?? 0) + performance.now() - startedAtMs;
21457
+ }
21458
+ };
21438
21459
  const callerOnResponseMeta = input.runtimeApi?.onResponseMeta;
21439
21460
  // The last append attempt sent, named even when it never gets a response
21440
21461
  // (an append aborted at the caller's deadline has no response to read).
@@ -21481,35 +21502,50 @@ async function dispatchRunLedgerOutboxBatchWithScope(
21481
21502
  ) === true,
21482
21503
  );
21483
21504
  const materialize = async (prefix: typeof deferredEvents) => {
21484
- await withClient((client) =>
21485
- renewPostgresRunLedgerDelivery(
21486
- client,
21505
+ await observeSearchPhase('renewal', () =>
21506
+ withClient(
21507
+ (client) =>
21508
+ renewPostgresRunLedgerDelivery(
21509
+ client,
21510
+ {
21511
+ eventIds: events.map((event) => event.eventId),
21512
+ leaseOwner,
21513
+ leaseSeconds: 120,
21514
+ },
21515
+ options,
21516
+ ),
21487
21517
  {
21488
- eventIds: events.map((event) => event.eventId),
21489
- leaseOwner,
21490
- leaseSeconds: 120,
21518
+ runId: events[0]!.runId,
21519
+ phase: 'run_ledger_outbox_search_renew',
21491
21520
  },
21492
- options,
21493
21521
  ),
21494
21522
  );
21495
- await (input.withObservabilityClient ?? withClient)(async (client) => {
21496
- await client.query('BEGIN');
21497
- try {
21498
- await client.query(
21499
- "SELECT set_config('statement_timeout', $1, true)",
21500
- [
21501
- `${Math.min(60_000, RUNTIME_RELIABILITY_POLICY.schedulerDatabase.queryTimeoutMs - 1_000)}ms`,
21502
- ],
21503
- );
21504
- // The recursive dependency evaluates this already-bounded causal
21505
- // prefix in order, in one database round trip. Its eight-fact
21506
- // contract is unchanged. The timeout bounds the entire statement
21507
- // below the lease; the installed function still fences every fact.
21508
- const result = await client.query<{
21509
- ordinal: number;
21510
- payload: unknown;
21511
- }>(
21512
- `WITH RECURSIVE projected(ordinal, payload) AS (
21523
+ const checkoutStartedAtMs = performance.now();
21524
+ let materializeEnteredAtMs: number | null = null;
21525
+ try {
21526
+ await (input.withObservabilityClient ?? withClient)(
21527
+ async (client) => {
21528
+ materializeEnteredAtMs = performance.now();
21529
+ await client.query('BEGIN');
21530
+ try {
21531
+ await client.query(
21532
+ "SELECT set_config('statement_timeout', $1, true)",
21533
+ [
21534
+ `${Math.min(60_000, RUNTIME_RELIABILITY_POLICY.schedulerDatabase.queryTimeoutMs - 1_000)}ms`,
21535
+ ],
21536
+ );
21537
+ // The recursive dependency evaluates this already-bounded causal
21538
+ // prefix in order, in one database round trip. Its eight-fact
21539
+ // contract is unchanged. The timeout bounds the entire statement
21540
+ // below the lease; the installed function still fences every fact.
21541
+ const result = await observeSearchPhase(
21542
+ 'materializeQuery',
21543
+ () =>
21544
+ client.query<{
21545
+ ordinal: number;
21546
+ payload: unknown;
21547
+ }>(
21548
+ `WITH RECURSIVE projected(ordinal, payload) AS (
21513
21549
  SELECT 1, ${quoteIdent(schemaName(options))}.materialize_runtime_outbox_event(($1::text[])[1], $2)
21514
21550
  UNION ALL
21515
21551
  SELECT prior.ordinal + 1,
@@ -21518,18 +21554,33 @@ async function dispatchRunLedgerOutboxBatchWithScope(
21518
21554
  WHERE prior.ordinal < cardinality($1::text[])
21519
21555
  )
21520
21556
  SELECT ordinal, payload FROM projected ORDER BY ordinal`,
21521
- [prefix.map((event) => event.eventId), leaseOwner],
21522
- );
21523
- await client.query('COMMIT');
21524
- for (const row of result.rows)
21525
- prefix[row.ordinal - 1]!.payload = row.payload;
21526
- } catch (error) {
21527
- // A query timeout may already have closed this connection. Keep
21528
- // the delivery failure for retry classification and diagnostics.
21529
- await client.query('ROLLBACK').catch(() => undefined);
21530
- throw error;
21531
- }
21532
- });
21557
+ [prefix.map((event) => event.eventId), leaseOwner],
21558
+ ),
21559
+ );
21560
+ await observeSearchPhase('materializeCommit', () =>
21561
+ client.query('COMMIT'),
21562
+ );
21563
+ for (const row of result.rows)
21564
+ prefix[row.ordinal - 1]!.payload = row.payload;
21565
+ } catch (error) {
21566
+ // A query timeout may already have closed this connection. Keep
21567
+ // the delivery failure for retry classification and diagnostics.
21568
+ await client.query('ROLLBACK').catch(() => undefined);
21569
+ throw error;
21570
+ }
21571
+ },
21572
+ { runId: events[0]!.runId, phase: 'run_ledger_outbox_materialize' },
21573
+ );
21574
+ } finally {
21575
+ searchPhaseTimingsMs.materializeCheckout =
21576
+ (searchPhaseTimingsMs.materializeCheckout ?? 0) +
21577
+ performance.now() -
21578
+ checkoutStartedAtMs;
21579
+ searchPhaseTimingsMs.materializeAcquireAndRetry =
21580
+ (searchPhaseTimingsMs.materializeAcquireAndRetry ?? 0) +
21581
+ (materializeEnteredAtMs ?? performance.now()) -
21582
+ checkoutStartedAtMs;
21583
+ }
21533
21584
  };
21534
21585
  try {
21535
21586
  await materialize(deferredEvents);
@@ -21591,11 +21642,18 @@ async function dispatchRunLedgerOutboxBatchWithScope(
21591
21642
  )
21592
21643
  )
21593
21644
  throw new Error('Search lease includes a lifecycle fact.');
21594
- const delivered = await withClient((client) =>
21595
- markPostgresSchedulerOutboxDeliveredRows(
21596
- client,
21597
- events.map((event) => event.eventId),
21598
- { ...options, leaseOwner },
21645
+ const delivered = await observeSearchPhase('acknowledge', () =>
21646
+ withClient(
21647
+ (client) =>
21648
+ markPostgresSchedulerOutboxDeliveredRows(
21649
+ client,
21650
+ events.map((event) => event.eventId),
21651
+ { ...options, leaseOwner },
21652
+ ),
21653
+ {
21654
+ runId: events[0]!.runId,
21655
+ phase: 'run_ledger_outbox_search_acknowledge',
21656
+ },
21599
21657
  ),
21600
21658
  );
21601
21659
  if (delivered.length !== events.length)
@@ -22084,11 +22142,14 @@ async function dispatchRunLedgerOutboxBatchWithScope(
22084
22142
  input.signal?.aborted ||
22085
22143
  claimed.transportOwnershipUnconfirmed ||
22086
22144
  (error instanceof RunLedgerProjectionLeaseLostError &&
22087
- error.reason === 'head_lease_owner_mismatch')
22145
+ (error.reason === 'head_lease_owner_mismatch' ||
22146
+ (input.searchOnly === true &&
22147
+ error.reason === 'delivery_lease_not_current')))
22088
22148
  ) {
22089
- // A skipped busy Run during prefix widening or a transferred head is a
22090
- // handoff, not a failed delivery. The owner fence also protects a newer
22091
- // cancellation lease. Caller deadline expiry uses the same handoff.
22149
+ // A skipped busy Run during prefix widening or a transferred/settled
22150
+ // lease is a handoff, not a failed delivery. The owner fence also
22151
+ // protects a newer cancellation lease. Caller deadline expiry uses the
22152
+ // same handoff.
22092
22153
  // Release the lease (fenced to this owner) without charging a
22093
22154
  // projection attempt or scheduling backoff, and wake the durable
22094
22155
  // projector. If the append already reached the ledger, the projector's
@@ -22135,7 +22196,9 @@ async function dispatchRunLedgerOutboxBatchWithScope(
22135
22196
  // even when this owner's fenced release cannot update that row.
22136
22197
  const handedOff =
22137
22198
  error instanceof RunLedgerProjectionLeaseLostError &&
22138
- error.reason === 'head_lease_owner_mismatch'
22199
+ (error.reason === 'head_lease_owner_mismatch' ||
22200
+ (input.searchOnly === true &&
22201
+ error.reason === 'delivery_lease_not_current'))
22139
22202
  ? eventIds
22140
22203
  : released;
22141
22204
  return withTransportDelivered({
@@ -22319,6 +22382,7 @@ async function dispatchRunLedgerOutboxBatchWithScope(
22319
22382
  continuationMs:
22320
22383
  acknowledgedAtMs === null ? null : settledAtMs - acknowledgedAtMs,
22321
22384
  durationMs: settledAtMs - dispatchStartedAtMs,
22385
+ ...(input.searchOnly ? { searchPhaseTimingsMs } : {}),
22322
22386
  // Which platform requests served the two app hops, so a slow
22323
22387
  // authority or append stage can be found in the app's request log.
22324
22388
  ...runLedgerSlowDeliveryResponseFields(
@@ -1042,8 +1042,12 @@ export function startRunLedgerOutboxRecoveryController(input: {
1042
1042
  materializeObservability: true,
1043
1043
  searchOnly,
1044
1044
  ...(runId === undefined ? {} : { runId }),
1045
- withObservabilityClient: (operation) =>
1046
- withRuntimeSchedulerClient(observabilityPoolOptions, operation),
1045
+ withObservabilityClient: (operation, trace) =>
1046
+ withRuntimeSchedulerClient(
1047
+ observabilityPoolOptions,
1048
+ operation,
1049
+ trace,
1050
+ ),
1047
1051
  limit: 8,
1048
1052
  headPriority,
1049
1053
  // The lease holder delivers a run's terminal committed during its