deepline 0.3.403 → 0.3.405

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 (92) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +4 -4
  2. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  3. package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +1 -1
  4. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-public-aliases.ts +4 -0
  5. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +114 -50
  6. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +6 -2
  7. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +379 -133
  8. package/dist/cli/{auth-AHF355KV.mjs → auth-D4GXO4IN.mjs} +4 -4
  9. package/dist/cli/auth-IJKAKAHG.js +40 -0
  10. package/dist/cli/{billing-LSZECOCV.mjs → billing-NVV5VSUJ.mjs} +4 -4
  11. package/dist/cli/{billing-5L5X2OAC.js → billing-TQ4UM4D4.js} +73 -73
  12. package/dist/cli/{chunk-VNO3VAJT.mjs → chunk-3DWMYKWU.mjs} +1 -1
  13. package/dist/cli/{chunk-CC3QT7Q5.mjs → chunk-3FF3SPSE.mjs} +2 -2
  14. package/dist/cli/{chunk-JZ7TJL7G.js → chunk-3MVBOBV4.js} +2 -2
  15. package/dist/cli/{chunk-RXVJYS76.mjs → chunk-4ONG2MWB.mjs} +1 -1
  16. package/dist/cli/{chunk-57GMG2DV.js → chunk-6HXTHMHZ.js} +26 -26
  17. package/dist/cli/{chunk-SGPGIC3M.js → chunk-AAIV3ACM.js} +50 -50
  18. package/dist/cli/{chunk-QN55SQYI.mjs → chunk-B6ME2XIO.mjs} +5 -5
  19. package/dist/cli/{chunk-FQL75GML.js → chunk-BZBV2GY2.js} +8 -8
  20. package/dist/cli/{chunk-V4PLPRWQ.js → chunk-CB6AJNHI.js} +4 -4
  21. package/dist/cli/{chunk-JHNYOTWR.mjs → chunk-EKWJXPIX.mjs} +1 -1
  22. package/dist/cli/{chunk-GJECLPJP.mjs → chunk-EVLCUV64.mjs} +4 -4
  23. package/dist/cli/{chunk-C27DGNII.mjs → chunk-HG5PMETP.mjs} +5 -5
  24. package/dist/cli/{chunk-DJSPH5T2.js → chunk-HYAA3F6U.js} +10 -10
  25. package/dist/cli/{chunk-4BWZA57I.js → chunk-JPNBAZBR.js} +6 -6
  26. package/dist/cli/{chunk-77FZLY5L.js → chunk-LM2JHRZM.js} +1 -1
  27. package/dist/cli/{chunk-KTBMDDEQ.mjs → chunk-MPXPTSGJ.mjs} +3 -3
  28. package/dist/cli/{chunk-J3OZIYU4.js → chunk-MZ4LBCV7.js} +15 -15
  29. package/dist/cli/{chunk-MJ4OWXFM.js → chunk-NAJEB3N4.js} +44 -44
  30. package/dist/cli/{chunk-5SGQF4QF.js → chunk-NLT6GCWZ.js} +8 -8
  31. package/dist/cli/{chunk-HPEIY4UR.mjs → chunk-TECEX3K5.mjs} +3 -3
  32. package/dist/cli/{chunk-BYBRENKM.mjs → chunk-TPYRDAU7.mjs} +1 -1
  33. package/dist/cli/{chunk-VYDYDELF.js → chunk-WGX7SIGL.js} +65 -65
  34. package/dist/cli/{chunk-B4Y2CZKS.mjs → chunk-YRZIKG47.mjs} +2 -2
  35. package/dist/cli/{chunk-MQWZYCQJ.mjs → chunk-YX7JSSJ2.mjs} +2 -2
  36. package/dist/cli/{csv-IO2BKRNX.js → csv-5AASYDRF.js} +12 -12
  37. package/dist/cli/{csv-J6ZPUWE4.mjs → csv-H7LD6IQK.mjs} +3 -3
  38. package/dist/cli/{db-QICV6JWY.mjs → db-CG3UQUA7.mjs} +4 -4
  39. package/dist/cli/{db-ZVRBVSPU.js → db-MJBZBDWZ.js} +25 -25
  40. package/dist/cli/{describe-WX6VWGH6.js → describe-2A7GARI2.js} +10 -10
  41. package/dist/cli/{describe-YA35XS55.mjs → describe-INFC5ACQ.mjs} +6 -6
  42. package/dist/cli/{executions-YQAUBJLS.js → executions-AUDQ5HOJ.js} +6 -6
  43. package/dist/cli/{executions-X3PDLFKO.mjs → executions-DO47P6MX.mjs} +4 -4
  44. package/dist/cli/{feedback-M2WMOY5B.js → feedback-MNWNDZVU.js} +7 -7
  45. package/dist/cli/{feedback-HSERSHDV.mjs → feedback-XGZSJM2N.mjs} +3 -3
  46. package/dist/cli/{git-3JMX455D.mjs → git-2ECFQKAA.mjs} +4 -4
  47. package/dist/cli/git-6S64UBWC.js +24 -0
  48. package/dist/cli/index.js +89 -89
  49. package/dist/cli/index.mjs +32 -32
  50. package/dist/cli/{legacy-noops-EMUCJ5KW.js → legacy-noops-3UZTD4DS.js} +7 -7
  51. package/dist/cli/{legacy-noops-OKC6VDD3.mjs → legacy-noops-534TKEMO.mjs} +4 -4
  52. package/dist/cli/{monitors-RH3FIA63.mjs → monitors-5ARELE2S.mjs} +4 -4
  53. package/dist/cli/{monitors-M6DU2JXC.js → monitors-G4S54JSX.js} +84 -84
  54. package/dist/cli/{org-KK3C5J6E.mjs → org-BAMOOXQW.mjs} +4 -4
  55. package/dist/cli/{org-BZDZO32O.js → org-RIWF2TLI.js} +64 -64
  56. package/dist/cli/{play-ZKYHO2KC.js → play-32XSQMFK.js} +231 -231
  57. package/dist/cli/{play-QXBNDI6C.mjs → play-WV4UNGPR.mjs} +7 -7
  58. package/dist/cli/{providers-JRN5FNXI.mjs → providers-SMSRO23R.mjs} +4 -4
  59. package/dist/cli/{providers-VCT7HFYW.js → providers-XKY2CNKH.js} +7 -7
  60. package/dist/cli/{quickstart-Y33XAQDY.mjs → quickstart-BFYYEVSS.mjs} +3 -3
  61. package/dist/cli/{quickstart-X2IC2U6U.js → quickstart-Q2TA72HD.js} +5 -5
  62. package/dist/cli/search-GK7P3AZY.js +30 -0
  63. package/dist/cli/{search-R443WBN7.mjs → search-I2TVB2P5.mjs} +5 -5
  64. package/dist/cli/{secrets-U6V4M7R3.js → secrets-B4NYTSL7.js} +13 -13
  65. package/dist/cli/{secrets-EUKR5NG2.mjs → secrets-BHKICIE3.mjs} +4 -4
  66. package/dist/cli/{sessions-RZVHJSVB.mjs → sessions-IOR2ZNNH.mjs} +4 -4
  67. package/dist/cli/{sessions-IPKYJT4M.js → sessions-XY2UREJ7.js} +5 -5
  68. package/dist/cli/{settings-W4YFY5JJ.js → settings-ASGROQDE.js} +74 -74
  69. package/dist/cli/{settings-FKU7KJ24.mjs → settings-W6S7B4NH.mjs} +7 -7
  70. package/dist/cli/{setup-6WIECL4V.mjs → setup-UUWGI3IN.mjs} +6 -6
  71. package/dist/cli/{setup-BEIN6536.js → setup-YIYQ73OV.js} +41 -41
  72. package/dist/cli/{skills-CV72BOP7.mjs → skills-CHA4QCGI.mjs} +4 -4
  73. package/dist/cli/skills-LKNKHB2I.js +29 -0
  74. package/dist/cli/{tools-2ADAYBNB.js → tools-43ZFJWAQ.js} +7 -7
  75. package/dist/cli/{tools-2SH4RIFD.mjs → tools-PMZDYKTT.mjs} +6 -6
  76. package/dist/cli/{update-YTR4JUPG.mjs → update-6VSEGTSG.mjs} +6 -6
  77. package/dist/cli/update-R7FODDIW.js +29 -0
  78. package/dist/cli/{workflow-446CNNRV.js → workflow-26EOXZ7M.js} +15 -15
  79. package/dist/cli/{workflow-BBSL2QKK.mjs → workflow-SVMVLQOF.mjs} +5 -5
  80. package/dist/index.js +6 -6
  81. package/dist/index.mjs +3 -3
  82. package/dist/install-integrity.json +70 -70
  83. package/dist/release.d.mts +1 -1
  84. package/dist/release.d.ts +1 -1
  85. package/dist/release.js +2 -2
  86. package/dist/release.mjs +1 -1
  87. package/package.json +1 -1
  88. package/dist/cli/auth-O7A7JS2M.js +0 -40
  89. package/dist/cli/git-IUDHAE5O.js +0 -24
  90. package/dist/cli/search-7257KVSQ.js +0 -30
  91. package/dist/cli/skills-A7ATFQEL.js +0 -29
  92. package/dist/cli/update-AUYYCJUT.js +0 -29
@@ -6815,10 +6815,10 @@ export class DeeplineClient {
6815
6815
  // post-deploy work creates/reuses the tracker and returns the artifact a
6816
6816
  // caller needs to install it; there is intentionally no separate setup
6817
6817
  // command in the public monitor lifecycle.
6818
- const setup = await this.setupMonitor(
6819
- definition.tool,
6820
- definition.payload ?? {},
6821
- );
6818
+ const setup = await this.setupMonitor(definition.tool, {
6819
+ ...definition.payload,
6820
+ monitor_key: definition.key,
6821
+ });
6822
6822
  return {
6823
6823
  ...deployed,
6824
6824
  monitor: {
@@ -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.403',
205
+ version: '0.3.405',
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: {
@@ -130,7 +130,7 @@ export function monitorErrorNextAction(payload: MonitorErrorPayload): string {
130
130
  return 'Run `deepline monitors available`, choose a returned tool id, then retry with that exact id.';
131
131
  }
132
132
  if (code === 'monitor_provider_not_offered') {
133
- return 'This provider monitor is retired for new deployments. Run `deepline monitors available` to choose a supported Deepline Native radar. Existing retired-provider monitors can still be inspected and deleted.';
133
+ return 'This provider monitor is retired for new deployments. Run `deepline monitors available` to choose a supported monitor. Existing retired-provider monitors can still be inspected and deleted.';
134
134
  }
135
135
  if (code === 'deployed_monitor_not_found' || code === 'monitor_not_found') {
136
136
  return 'Run `deepline monitors list --status all`, choose a returned public monitor key, then retry with that key.';
@@ -12,6 +12,10 @@ export function canonicalProviderMonitorKey(key: string) {
12
12
  return key === ANALYTICS_MONITOR_KEY ? ANALYTICS_INTERNAL_MONITOR_KEY : key;
13
13
  }
14
14
 
15
+ export function publicProviderMonitorKey(key: string) {
16
+ return key === ANALYTICS_INTERNAL_MONITOR_KEY ? ANALYTICS_MONITOR_KEY : key;
17
+ }
18
+
15
19
  /** Convert a customer-facing monitor tool id to its internal registry id. */
16
20
  export function canonicalProviderMonitorTool(tool: string) {
17
21
  return tool === ANALYTICS_PUBLIC_TOOL ? ANALYTICS_INTERNAL_TOOL : tool;
@@ -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