deepline 0.3.310 → 0.3.312

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 (114) hide show
  1. package/dist/bundling-sources/sdk/src/play.ts +7 -1
  2. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  3. package/dist/bundling-sources/shared_libs/play-runtime/ledger-safe-payload.ts +7 -3
  4. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +153 -32
  5. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +23 -1
  6. package/dist/bundling-sources/shared_libs/plays/core.ts +7 -1
  7. package/dist/bundling-sources/shared_libs/plays/settings-contract.ts +29 -3
  8. package/dist/cli/{auth-CS6NQ737.mjs → auth-ACDTPM3M.mjs} +4 -4
  9. package/dist/cli/auth-TFDGA24W.js +31 -0
  10. package/dist/cli/{billing-SDRP5BYV.mjs → billing-FVBBJ77L.mjs} +5 -5
  11. package/dist/cli/{billing-7SIQJUEI.js → billing-YTJFHEGU.js} +71 -71
  12. package/dist/cli/{chunk-D3HSRXCJ.js → chunk-6KKETQSI.js} +6 -6
  13. package/dist/cli/{chunk-RYO6353O.js → chunk-6LLJWMYH.js} +6 -6
  14. package/dist/cli/{chunk-LUJGLZCJ.mjs → chunk-6OGNRAS7.mjs} +2 -2
  15. package/dist/cli/chunk-76VKBPOC.mjs +406 -0
  16. package/dist/cli/{chunk-MWY35HT3.js → chunk-7SW43OAX.js} +60 -60
  17. package/dist/cli/{chunk-VN7Y4LVH.mjs → chunk-AA66YTS7.mjs} +1 -1
  18. package/dist/cli/{chunk-4YCPND5A.js → chunk-BRJOVSTH.js} +2 -2
  19. package/dist/cli/{chunk-7L27LIZO.mjs → chunk-EHVJ7XXD.mjs} +2 -2
  20. package/dist/cli/{chunk-T25I3M2J.mjs → chunk-ENSDO4SG.mjs} +4 -4
  21. package/dist/cli/{chunk-N2VXH4GK.js → chunk-FQVTHBEH.js} +15 -15
  22. package/dist/cli/{chunk-HYACJPRJ.mjs → chunk-GTEDCRKC.mjs} +1 -1
  23. package/dist/cli/{play-YO22ZNSN.mjs → chunk-I25C4KL7.mjs} +166 -90
  24. package/dist/cli/{chunk-W7INSYJS.js → chunk-IALPYID6.js} +3 -3
  25. package/dist/cli/{chunk-NXFFT73P.mjs → chunk-MK4K5MQU.mjs} +23 -3
  26. package/dist/cli/{chunk-WB6Z2Q44.mjs → chunk-N5V2SBB2.mjs} +19 -1
  27. package/dist/cli/{chunk-AV4CJWNP.mjs → chunk-NJNYWVEF.mjs} +2 -2
  28. package/dist/cli/{chunk-XOIOZ5JA.mjs → chunk-NMZPK7LM.mjs} +1 -1
  29. package/dist/cli/{chunk-NKRSVEP4.mjs → chunk-NWFE4PGX.mjs} +1 -1
  30. package/dist/cli/{chunk-ZDO3TO3M.js → chunk-OJ243ZA5.js} +19 -1
  31. package/dist/cli/{tools-M73P2E7K.mjs → chunk-OV6IFAXH.mjs} +180 -36
  32. package/dist/cli/{play-Q5SVL5MG.js → chunk-QFSLMI42.js} +342 -266
  33. package/dist/cli/{chunk-JVCD2CWD.js → chunk-T4IJQKRE.js} +26 -26
  34. package/dist/cli/{chunk-QARMMLYE.js → chunk-TID5XLTZ.js} +4 -4
  35. package/dist/cli/{chunk-PNNFR4L5.js → chunk-ULI6UVV6.js} +6 -6
  36. package/dist/cli/{chunk-4NIQA6S7.mjs → chunk-US4S3E4Y.mjs} +1 -1
  37. package/dist/cli/{tools-XSF6FCIM.js → chunk-V7N6BJQD.js} +231 -87
  38. package/dist/cli/{chunk-5VVRQY4Y.js → chunk-VJDKV5RU.js} +29 -9
  39. package/dist/cli/{chunk-M4KGWEN2.mjs → chunk-WPTUKXIF.mjs} +1 -1
  40. package/dist/cli/chunk-XNL3SEMC.js +406 -0
  41. package/dist/cli/{chunk-DCUYMHHV.js → chunk-YYU3PYVK.js} +48 -48
  42. package/dist/cli/{chunk-OJWZADOG.mjs → chunk-ZH7KTVAB.mjs} +1 -1
  43. package/dist/cli/{chunk-KKAAKV77.js → chunk-ZQJDRSR5.js} +1 -1
  44. package/dist/cli/{client-G7HWPY6S.mjs → client-ENGOMTTU.mjs} +3 -3
  45. package/dist/cli/client-T6YGH6TT.js +20 -0
  46. package/dist/cli/{csv-6GDEDRY6.js → csv-6WOJC6NZ.js} +12 -12
  47. package/dist/cli/{csv-4JIXNZ6J.mjs → csv-ENKTPYAJ.mjs} +3 -3
  48. package/dist/cli/{db-MXNCRZNY.js → db-BAEVP4QK.js} +20 -20
  49. package/dist/cli/{db-TGAQ7XWX.mjs → db-DSCJZYJU.mjs} +4 -4
  50. package/dist/cli/describe-PAUHJF7H.mjs +236 -0
  51. package/dist/cli/describe-X2AFAC4B.js +236 -0
  52. package/dist/cli/{executions-VEBKTUFZ.js → executions-LXS6NLCV.js} +6 -6
  53. package/dist/cli/{executions-XSGG4VCW.mjs → executions-R6JOR67D.mjs} +4 -4
  54. package/dist/cli/{feedback-PY4ZCKEV.mjs → feedback-CYRVNCGT.mjs} +3 -3
  55. package/dist/cli/{feedback-GI3Q4RGW.js → feedback-HXP2D7K6.js} +6 -6
  56. package/dist/cli/git-JOE2RM3Q.js +23 -0
  57. package/dist/cli/{git-7QAK7CKT.mjs → git-XBYBZB4R.mjs} +4 -4
  58. package/dist/cli/index.js +82 -78
  59. package/dist/cli/index.mjs +45 -41
  60. package/dist/cli/{legacy-noops-2VT7K2VQ.js → legacy-noops-AUNAFEZP.js} +7 -7
  61. package/dist/cli/{legacy-noops-KCG3YZCN.mjs → legacy-noops-OQP6VZKE.mjs} +4 -4
  62. package/dist/cli/{monitors-GTIHVO56.mjs → monitors-L2HAAPAL.mjs} +7 -7
  63. package/dist/cli/{monitors-7CLNZE7C.js → monitors-QSIZG3CJ.js} +88 -88
  64. package/dist/cli/{org-HTA6MXVO.js → org-JUHQGBQE.js} +60 -60
  65. package/dist/cli/{org-FCPAM7NW.mjs → org-UCSN5XRC.mjs} +4 -4
  66. package/dist/cli/play-2SNMTZGK.js +152 -0
  67. package/dist/cli/play-5AT2RB3M.mjs +152 -0
  68. package/dist/cli/{providers-YHWPMW4J.js → providers-CVG4L3VR.js} +7 -7
  69. package/dist/cli/{providers-25X5A5JC.mjs → providers-GVPAPZ4L.mjs} +4 -4
  70. package/dist/cli/{quickstart-SLE7UMAK.js → quickstart-7OIFIQG3.js} +5 -5
  71. package/dist/cli/{quickstart-Z4CXNAQ3.mjs → quickstart-Y6ZU27LE.mjs} +3 -3
  72. package/dist/cli/{search-RQO3ZVKK.mjs → search-4I2Y2NKK.mjs} +13 -5
  73. package/dist/cli/search-DS36UHOX.js +26 -0
  74. package/dist/cli/{secrets-MV6MRXW5.mjs → secrets-3Z4IUEBA.mjs} +4 -4
  75. package/dist/cli/{secrets-N37STTK4.js → secrets-O2UFLU52.js} +13 -13
  76. package/dist/cli/{sessions-4M2BUN2J.mjs → sessions-OMAXRY5I.mjs} +4 -4
  77. package/dist/cli/{sessions-KBWZYHNE.js → sessions-T6MWWQRH.js} +5 -5
  78. package/dist/cli/{settings-EYMOSUED.mjs → settings-C47WXZY5.mjs} +7 -7
  79. package/dist/cli/{settings-OCRYSYWC.js → settings-R4LO5NMY.js} +74 -74
  80. package/dist/cli/{setup-3UKEGBFB.js → setup-FIUTV4DD.js} +41 -41
  81. package/dist/cli/{setup-TUVPIGJV.mjs → setup-JPJVTIQ6.mjs} +6 -6
  82. package/dist/cli/{skills-56ADS5BA.mjs → skills-6WVTMKP5.mjs} +4 -4
  83. package/dist/cli/skills-GLPKPF7R.js +28 -0
  84. package/dist/cli/tools-L3YLQ7BR.js +38 -0
  85. package/dist/cli/tools-TKS77TNU.mjs +38 -0
  86. package/dist/cli/{update-Y6KMCBWD.mjs → update-GD754XMA.mjs} +6 -6
  87. package/dist/cli/update-HXI35NME.js +28 -0
  88. package/dist/cli/{workflow-DHQ3NCVT.js → workflow-OCUQCNXA.js} +16 -16
  89. package/dist/cli/{workflow-DWKZA4FR.mjs → workflow-YKQSPXQZ.mjs} +6 -6
  90. package/dist/{client-DpnkGBn-.d.mts → client-CtVdLZux.d.mts} +21 -4
  91. package/dist/{client-ypdBvf1o.d.ts → client-OBwghxPC.d.ts} +21 -4
  92. package/dist/{compiler-manifest-qtTNYvBl.d.ts → compiler-manifest-wOKNiXpa.d.mts} +21 -0
  93. package/dist/{compiler-manifest-qtTNYvBl.d.mts → compiler-manifest-wOKNiXpa.d.ts} +21 -0
  94. package/dist/index.d.mts +4 -4
  95. package/dist/index.d.ts +4 -4
  96. package/dist/index.js +13 -10
  97. package/dist/index.mjs +16 -13
  98. package/dist/install-integrity.json +84 -76
  99. package/dist/plays/bundle-play-file.d.mts +2 -2
  100. package/dist/plays/bundle-play-file.d.ts +2 -2
  101. package/dist/plays/bundle-play-file.mjs +2 -2
  102. package/dist/plays/run-request.d.mts +2 -2
  103. package/dist/plays/run-request.d.ts +2 -2
  104. package/dist/release.d.mts +1 -1
  105. package/dist/release.d.ts +1 -1
  106. package/dist/release.js +2 -2
  107. package/dist/release.mjs +1 -1
  108. package/package.json +1 -1
  109. package/dist/cli/auth-CP4YBO33.js +0 -31
  110. package/dist/cli/client-MIVDO6SP.js +0 -20
  111. package/dist/cli/git-5KB2XFJ6.js +0 -23
  112. package/dist/cli/search-UBWCREKT.js +0 -18
  113. package/dist/cli/skills-CUWFLZG4.js +0 -28
  114. package/dist/cli/update-QOQRJM2S.js +0 -28
@@ -1748,7 +1748,13 @@ export function definePlay<TInput, TOutput extends PlayReturnObject>(
1748
1748
  : {
1749
1749
  name: nameOrConfig.id,
1750
1750
  fn: nameOrConfig.run,
1751
- bindings: nameOrConfig.bindings,
1751
+ bindings:
1752
+ nameOrConfig.displayName !== undefined
1753
+ ? {
1754
+ ...nameOrConfig.bindings,
1755
+ displayName: nameOrConfig.displayName,
1756
+ }
1757
+ : nameOrConfig.bindings,
1752
1758
  description: nameOrConfig.description,
1753
1759
  inputSchema: nameOrConfig.input.schema,
1754
1760
  billing: nameOrConfig.billing,
@@ -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.310',
203
+ version: '0.3.312',
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: {
@@ -95,8 +95,12 @@ export function sanitizeLedgerLogLines(value: unknown): string[] {
95
95
  return value
96
96
  .filter((line): line is string => typeof line === 'string')
97
97
  .slice(0, MAX_LEDGER_LOG_LINES_PER_EVENT)
98
- .map((line) =>
99
- boundRunLogLine(ledgerIngressRedactor.redactString(line.trim())),
100
- )
98
+ .map((line) => sanitizeLedgerLogLine(line))
101
99
  .filter(Boolean);
102
100
  }
101
+
102
+ /** Runtime measurement records use the terminal transport's existing byte budget. */
103
+ export function sanitizeLedgerLogLine(line: string, bounded = true): string {
104
+ const redacted = ledgerIngressRedactor.redactString(line.trim());
105
+ return bounded ? boundRunLogLine(redacted) : redacted;
106
+ }
@@ -4,6 +4,7 @@ import {
4
4
  type RunLedgerDispatchLaunch,
5
5
  } from './run-ledger-dispatch-authority';
6
6
  import { normalizeRunLogIds } from '../run-log-buffer';
7
+ import { sanitizeLedgerLogLine } from '../ledger-safe-payload';
7
8
  import {
8
9
  retainedPlayPipelineFields,
9
10
  hydrateRetainedPlayPipelines,
@@ -10926,7 +10927,9 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
10926
10927
  stringifyPostgresJson(runtimeTiming ?? null),
10927
10928
  stringifyPostgresJson(ledgerTerminalResult ?? null),
10928
10929
  JSON.stringify(terminalLogLines),
10929
- JSON.stringify(input.terminalProgressEvents ?? []),
10930
+ JSON.stringify(
10931
+ sanitizeTerminalProgressEvents(input.terminalProgressEvents),
10932
+ ),
10930
10933
  postgresSchedulerNotifyChannel('terminal', options),
10931
10934
  JSON.stringify({ runId: input.runId, status: 'completed' }),
10932
10935
  input.leaseToken,
@@ -13305,7 +13308,7 @@ export async function completePostgresSchedulerAttempt(
13305
13308
  );
13306
13309
  const terminalLogEntries = (input.terminalLogLines ?? [])
13307
13310
  .map((line, index) => ({
13308
- line: line.trim(),
13311
+ line: sanitizeTerminalLogBody(line),
13309
13312
  context: input.terminalLogContexts?.[index] ?? null,
13310
13313
  metadata: input.terminalLogMetadata?.[index] ?? null,
13311
13314
  entryId: terminalLogIds?.[index] ?? null,
@@ -13529,7 +13532,9 @@ export async function completePostgresSchedulerAttempt(
13529
13532
  JSON.stringify(terminalLogContexts),
13530
13533
  stringifyPostgresJson(input.terminalWorkCounterSegment ?? null),
13531
13534
  JSON.stringify(terminalLogMetadata),
13532
- JSON.stringify(input.terminalProgressEvents ?? []),
13535
+ JSON.stringify(
13536
+ sanitizeTerminalProgressEvents(input.terminalProgressEvents),
13537
+ ),
13533
13538
  stringifyPostgresJson(
13534
13539
  terminalLogIds
13535
13540
  ? terminalLogEntries.map((entry) => entry.entryId)
@@ -13615,7 +13620,7 @@ export async function failPostgresSchedulerAttempt(
13615
13620
  );
13616
13621
  const terminalLogEntries = (input.terminalLogLines ?? [])
13617
13622
  .map((line, index) => ({
13618
- line: line.trim(),
13623
+ line: sanitizeTerminalLogBody(line),
13619
13624
  context: input.terminalLogContexts?.[index] ?? null,
13620
13625
  metadata: input.terminalLogMetadata?.[index] ?? null,
13621
13626
  entryId: terminalLogIds?.[index] ?? null,
@@ -13901,7 +13906,9 @@ export async function failPostgresSchedulerAttempt(
13901
13906
  stringifyPostgresJson(resultSummary),
13902
13907
  JSON.stringify(terminalLogContexts),
13903
13908
  stringifyPostgresJson(terminalWorkCounterSegment ?? null),
13904
- stringifyPostgresJson(input.terminalProgressEvents ?? []),
13909
+ stringifyPostgresJson(
13910
+ sanitizeTerminalProgressEvents(input.terminalProgressEvents),
13911
+ ),
13905
13912
  JSON.stringify(terminalLogMetadata),
13906
13913
  stringifyPostgresJson(
13907
13914
  terminalLogIds
@@ -14612,7 +14619,9 @@ function runnerTerminalLogPayload(input: {
14612
14619
  terminalLogContexts: projection.lineContexts,
14613
14620
  terminalLogMetadata: projection.lineMetadata,
14614
14621
  ...(projection.lineIds ? { terminalLogIds: projection.lineIds } : {}),
14615
- terminalProgressEvents: input.terminalProgressEvents ?? [],
14622
+ terminalProgressEvents: sanitizeTerminalProgressEvents(
14623
+ input.terminalProgressEvents,
14624
+ ),
14616
14625
  // Older runner envelopes conveyed these diagnostics only in tagged log
14617
14626
  // text. Preserve their small structured facts before removing that text.
14618
14627
  recoveredRuntimeDiagnostics:
@@ -14629,6 +14638,41 @@ function runnerTerminalLogPayload(input: {
14629
14638
  };
14630
14639
  }
14631
14640
 
14641
+ function sanitizeTerminalProgressEvents(
14642
+ events: readonly unknown[] = [],
14643
+ ): unknown[] {
14644
+ return events.map((event) => {
14645
+ if (!event || typeof event !== 'object' || Array.isArray(event))
14646
+ return event;
14647
+ const item = event as Record<string, unknown>;
14648
+ if (item.type !== 'log.appended' || !Array.isArray(item.lines))
14649
+ return event;
14650
+ return {
14651
+ ...item,
14652
+ // Keep every position and annotation aligned, including blank lines.
14653
+ // Invalid values still reach the existing SQL validation unchanged.
14654
+ lines: item.lines.map((line) =>
14655
+ typeof line === 'string'
14656
+ ? sanitizeTerminalLogBody(line) || '(blank log line)'
14657
+ : line,
14658
+ ),
14659
+ };
14660
+ });
14661
+ }
14662
+
14663
+ function sanitizeTerminalLogBody(line: string): string {
14664
+ const body = line.trim();
14665
+ const runtimeDiagnostic =
14666
+ body.startsWith('[runtime.failure_diagnostic] ') ||
14667
+ body.startsWith('[runtime.phase_summary] ') ||
14668
+ body.startsWith('[runtime.logs] ') ||
14669
+ body.startsWith('[runtime.log_transport] ');
14670
+ // These runtime records contain machine-readable JSON, already bounded by
14671
+ // the terminal transport. Keep it parseable while applying the same redaction.
14672
+ // Authored tagged lines retain the ordinary live-ingress line bound.
14673
+ return sanitizeLedgerLogLine(body, !runtimeDiagnostic);
14674
+ }
14675
+
14632
14676
  function terminalLogProjectionForOutbox(
14633
14677
  runnerResult: unknown,
14634
14678
  mode: PostgresSchedulerTerminalLogOutbox | undefined,
@@ -14689,7 +14733,9 @@ function terminalLogProjectionForOutbox(
14689
14733
  normalized.startsWith('[runtime.log_transport] ');
14690
14734
  if (!retained) return null;
14691
14735
  return {
14692
- line: line.trim(),
14736
+ // The live API applies this same canonicalization before indexing.
14737
+ // Replaying an origin ID must carry that exact redacted, bounded body.
14738
+ line: sanitizeTerminalLogBody(line),
14693
14739
  context: normalizePlayLogContext(logContexts?.[index]),
14694
14740
  metadata: normalizePlayLogMetadata(logMetadata?.[index]),
14695
14741
  entryId: logIds?.[index] ?? null,
@@ -18014,6 +18060,8 @@ export async function readPendingPostgresSchedulerOutboxEvents(
18014
18060
  extendOwnedHead?: string;
18015
18061
  /** The dispatcher owns a short, exclusive claim transaction. */
18016
18062
  inTransaction?: boolean;
18063
+ /** The owner rolls back and restarts the whole claim on the old-schema adapter. */
18064
+ restartTransactionOnMissingMarker?: boolean;
18017
18065
  } = {},
18018
18066
  options?: Pick<PostgresSchedulerOptions, 'schema'>,
18019
18067
  ): Promise<PostgresSchedulerOutboxEvent[]> {
@@ -18054,6 +18102,11 @@ async function claimPostgresSchedulerOutboxPrefix(
18054
18102
  `${alias}.delivered_at IS NULL${
18055
18103
  acknowledgement ? ` AND NOT (${alias}.event_id = ANY($5::text[]))` : ''
18056
18104
  }`;
18105
+ // The dispatcher already chose this run. Seek its oldest pending fact
18106
+ // before eligibility checks; comparing every candidate with every earlier
18107
+ // fact makes a single run's burst quadratic. Failed/delayed heads must
18108
+ // remain in this seek so they still block their causal successors.
18109
+ const seekRunHead = runId !== null && !input.extendOwnedHead;
18057
18110
  const claim = async (supportsTerminalBatchMarker: boolean) => {
18058
18111
  const urgentLifecyclePendingSql = (alias: string) =>
18059
18112
  input.searchOnly === true
@@ -18091,6 +18144,18 @@ async function claimPostgresSchedulerOutboxPrefix(
18091
18144
  : `waiting_runs AS MATERIALIZED (
18092
18145
  ${runLedgerWaitingRunsSql(options, '$2')}
18093
18146
  ), `
18147
+ }${
18148
+ seekRunHead
18149
+ ? `pending_head AS MATERIALIZED (
18150
+ SELECT pending.event_id
18151
+ FROM ${tableName('outbox', options)} AS pending
18152
+ WHERE pending.run_id = $2
18153
+ AND ${pending('pending')}
18154
+ AND ${searchLaneSql('pending')} = ${input.searchOnly === true ? 'true' : 'false'}
18155
+ ORDER BY ${runLedgerOrderSql('pending')}
18156
+ LIMIT 1
18157
+ ),`
18158
+ : ''
18094
18159
  }${
18095
18160
  input.extendOwnedHead
18096
18161
  ? `owned_run AS MATERIALIZED (
@@ -18106,6 +18171,7 @@ async function claimPostgresSchedulerOutboxPrefix(
18106
18171
  SELECT candidate.event_id, candidate.run_id, candidate.event_type,
18107
18172
  ${supportsTerminalBatchMarker ? 'candidate.delivery_batch_started_at' : 'NULL::timestamptz'} AS delivery_batch_started_at
18108
18173
  FROM ${tableName('outbox', options)} AS candidate
18174
+ ${seekRunHead ? 'JOIN pending_head ON pending_head.event_id = candidate.event_id' : ''}
18109
18175
  ${input.extendOwnedHead ? 'JOIN owned_run ON owned_run.run_id = candidate.run_id' : ''}
18110
18176
  WHERE ${pending('candidate')}
18111
18177
  AND ${searchLaneSql('candidate')} = ${input.searchOnly === true ? 'true' : 'false'}
@@ -18149,13 +18215,17 @@ async function claimPostgresSchedulerOutboxPrefix(
18149
18215
  -- Competing projectors acquire one run through its oldest event.
18150
18216
  -- Locking this head prevents another projector from splitting the
18151
18217
  -- run while still letting it skip to unrelated runs.
18152
- AND NOT EXISTS (
18218
+ ${
18219
+ seekRunHead
18220
+ ? ''
18221
+ : `AND NOT EXISTS (
18153
18222
  SELECT 1
18154
18223
  FROM ${tableName('outbox', options)} AS predecessor
18155
18224
  WHERE predecessor.run_id = candidate.run_id
18156
18225
  AND ${pending('predecessor')}
18157
18226
  AND ${runLedgerPrecedesSql('predecessor', 'candidate')}
18158
- )
18227
+ )`
18228
+ }
18159
18229
  -- A new durable admission has no causal dependency on unrelated
18160
18230
  -- terminal facts. Project it first so a lifecycle backlog cannot make
18161
18231
  -- an accepted run invisible; per-run predecessor checks above retain
@@ -18337,7 +18407,9 @@ async function claimPostgresSchedulerOutboxPrefix(
18337
18407
  );
18338
18408
  };
18339
18409
  let result;
18340
- if (input.inTransaction) await client.query('SAVEPOINT run_ledger_claim');
18410
+ const useSavepoint =
18411
+ input.inTransaction && !input.restartTransactionOnMissingMarker;
18412
+ if (useSavepoint) await client.query('SAVEPOINT run_ledger_claim');
18341
18413
  if (supportsOutboxDeliveryBatchMarker(options)) {
18342
18414
  try {
18343
18415
  result = await claim(true);
@@ -18347,16 +18419,16 @@ async function claimPostgresSchedulerOutboxPrefix(
18347
18419
  // The ACK caller owns the whole short transaction. Roll it back and
18348
18420
  // repeat only this missing-column adapter, avoiding two SAVEPOINT round
18349
18421
  // trips on every successful acknowledgement.
18350
- if (acknowledgement) throw error;
18351
- if (input.inTransaction)
18422
+ if (acknowledgement || input.restartTransactionOnMissingMarker)
18423
+ throw error;
18424
+ if (useSavepoint)
18352
18425
  await client.query('ROLLBACK TO SAVEPOINT run_ledger_claim');
18353
18426
  result = await claim(false);
18354
18427
  }
18355
18428
  } else {
18356
18429
  result = await claim(false);
18357
18430
  }
18358
- if (input.inTransaction)
18359
- await client.query('RELEASE SAVEPOINT run_ledger_claim');
18431
+ if (useSavepoint) await client.query('RELEASE SAVEPOINT run_ledger_claim');
18360
18432
  const events = result.rows
18361
18433
  .filter((row) => row.row_kind === 'claimed')
18362
18434
  .map((row) => {
@@ -19825,7 +19897,7 @@ export async function dispatchRunLedgerOutboxToLedgerBatchOnceWithClientScope(
19825
19897
  }
19826
19898
 
19827
19899
  async function dispatchRunLedgerOutboxBatchWithScope(
19828
- withClient: RunLedgerOutboxWithClient,
19900
+ acquireClient: RunLedgerOutboxWithClient,
19829
19901
  input: RunLedgerOutboxDispatchInput & { waitForRunLock?: boolean },
19830
19902
  options?: Pick<PostgresSchedulerOptions, 'schema'>,
19831
19903
  scope?: RunLedgerOutboxDrainScope,
@@ -19833,6 +19905,25 @@ async function dispatchRunLedgerOutboxBatchWithScope(
19833
19905
  remainingEvents: number | null = null,
19834
19906
  ): Promise<PostgresSchedulerOutboxProjectionResult> {
19835
19907
  const dispatchStartedAtMs = Date.now();
19908
+ // A committed terminal is running-work control traffic. Use the existing
19909
+ // alternating critical admission lane so its short lease operations do not
19910
+ // sit behind a full ordinary-work backlog; capacity is unchanged.
19911
+ const terminalRunId =
19912
+ scope && scope.targetEventId === `run-terminal:${scope.runId}`
19913
+ ? scope.runId
19914
+ : null;
19915
+ const withClient: RunLedgerOutboxWithClient = (operation, trace) =>
19916
+ acquireClient(
19917
+ operation,
19918
+ trace ??
19919
+ (terminalRunId
19920
+ ? {
19921
+ runId: terminalRunId,
19922
+ phase: 'run_ledger_outbox_terminal_delivery',
19923
+ priority: 'critical',
19924
+ }
19925
+ : undefined),
19926
+ );
19836
19927
  const tokenAuthority = input.tokenAuthority ?? 'local_mint';
19837
19928
  const leaseOwner =
19838
19929
  input.leaseOwner?.trim() || `run-ledger-outbox-dispatch:${randomUUID()}`;
@@ -19884,6 +19975,9 @@ async function dispatchRunLedgerOutboxBatchWithScope(
19884
19975
  await client.query('BEGIN');
19885
19976
  try {
19886
19977
  const targetRunId = input.runId?.trim() || null;
19978
+ let lockedRun: {
19979
+ rows: { run_id: string; dispatch_launch_json: unknown }[];
19980
+ } | null = null;
19887
19981
  if (input.waitForRunLock && targetRunId) {
19888
19982
  // A synchronous drain must not mistake a busy run for an empty
19889
19983
  // outbox. In particular, cancellation owns its pending prefix lease,
@@ -19899,8 +19993,14 @@ async function dispatchRunLedgerOutboxBatchWithScope(
19899
19993
  `${RUNTIME_SCHEDULER_CANCEL_STATEMENT_TIMEOUT_MS}ms`,
19900
19994
  ],
19901
19995
  );
19902
- await client.query(
19903
- `SELECT run_id FROM ${tableName('runs', options)} WHERE run_id = $1 FOR UPDATE`,
19996
+ lockedRun = await client.query<{
19997
+ run_id: string;
19998
+ dispatch_launch_json: unknown;
19999
+ }>(
20000
+ `SELECT runs.run_id,
20001
+ ${needsLaunch ? runLedgerDispatchLaunchSql('runs') : 'NULL::jsonb'} AS dispatch_launch_json
20002
+ FROM ${tableName('runs', options)} AS runs
20003
+ WHERE runs.run_id = $1 FOR UPDATE`,
19904
20004
  [targetRunId],
19905
20005
  );
19906
20006
  }
@@ -19909,12 +20009,14 @@ async function dispatchRunLedgerOutboxBatchWithScope(
19909
20009
  // nullable predicate made PostgreSQL materialize every pending run head
19910
20010
  // for each lifecycle transition. Only the two dedicated projectors may
19911
20011
  // perform the global distinct-head scan below.
19912
- const selected = targetRunId
19913
- ? await client.query<{
19914
- run_id: string;
19915
- dispatch_launch_json: unknown;
19916
- }>(
19917
- `
20012
+ const selected =
20013
+ (input.headEventId ? null : lockedRun) ??
20014
+ (targetRunId
20015
+ ? await client.query<{
20016
+ run_id: string;
20017
+ dispatch_launch_json: unknown;
20018
+ }>(
20019
+ `
19918
20020
  WITH head AS MATERIALIZED (
19919
20021
  SELECT pending.run_id,
19920
20022
  pending.event_id,
@@ -19947,12 +20049,12 @@ async function dispatchRunLedgerOutboxBatchWithScope(
19947
20049
  )
19948
20050
  FOR UPDATE OF runs SKIP LOCKED
19949
20051
  `,
19950
- [targetRunId, leaseOwner, input.headEventId?.trim() || null],
19951
- )
19952
- : await client.query<{
19953
- run_id: string;
19954
- dispatch_launch_json: unknown;
19955
- }>(`
20052
+ [targetRunId, leaseOwner, input.headEventId?.trim() || null],
20053
+ )
20054
+ : await client.query<{
20055
+ run_id: string;
20056
+ dispatch_launch_json: unknown;
20057
+ }>(`
19956
20058
  WITH ${
19957
20059
  input.searchOnly === true
19958
20060
  ? ''
@@ -20002,7 +20104,7 @@ async function dispatchRunLedgerOutboxBatchWithScope(
20002
20104
  }
20003
20105
  head.created_at, runs.run_id
20004
20106
  FOR UPDATE OF runs SKIP LOCKED LIMIT 1
20005
- `);
20107
+ `));
20006
20108
  const runId = selected.rows[0]?.run_id;
20007
20109
  const claimed = runId
20008
20110
  ? await readPendingPostgresSchedulerOutboxEvents(
@@ -20013,6 +20115,7 @@ async function dispatchRunLedgerOutboxBatchWithScope(
20013
20115
  leaseOwner,
20014
20116
  leaseSeconds: input.leaseSeconds ?? 120,
20015
20117
  inTransaction: true,
20118
+ restartTransactionOnMissingMarker: true,
20016
20119
  searchOnly: input.searchOnly,
20017
20120
  },
20018
20121
  options,
@@ -20037,7 +20140,16 @@ async function dispatchRunLedgerOutboxBatchWithScope(
20037
20140
  : null;
20038
20141
  const claimed = preclaimed
20039
20142
  ? { events: preclaimed, launchJson: null }
20040
- : await withClient(claimEvents);
20143
+ : await withClient(async (client) => {
20144
+ try {
20145
+ return await claimEvents(client);
20146
+ } catch (error) {
20147
+ if (!isMissingOutboxDeliveryBatchMarker(error)) throw error;
20148
+ // claimEvents rolled back. Reacquire the run fence and its fresh
20149
+ // snapshot using only the named missing-column compatibility path.
20150
+ return claimEvents(client);
20151
+ }
20152
+ });
20041
20153
  const { launchJson } = claimed;
20042
20154
  let events = claimed.events;
20043
20155
  if (events.length === 0) {
@@ -20345,7 +20457,7 @@ async function dispatchRunLedgerOutboxBatchWithScope(
20345
20457
  events.length === 1 &&
20346
20458
  first.eventType === RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runEvents
20347
20459
  ) {
20348
- const widened = await withClient(async (client) => {
20460
+ const widen = async (client: PostgresSchedulerQueryClient) => {
20349
20461
  await client.query('BEGIN');
20350
20462
  try {
20351
20463
  await client.query(
@@ -20376,6 +20488,7 @@ async function dispatchRunLedgerOutboxBatchWithScope(
20376
20488
  allowIngressPrefix: true,
20377
20489
  extendOwnedHead: first.eventId,
20378
20490
  inTransaction: true,
20491
+ restartTransactionOnMissingMarker: true,
20379
20492
  },
20380
20493
  options,
20381
20494
  );
@@ -20385,6 +20498,14 @@ async function dispatchRunLedgerOutboxBatchWithScope(
20385
20498
  await client.query('ROLLBACK');
20386
20499
  throw error;
20387
20500
  }
20501
+ };
20502
+ const widened = await withClient(async (client) => {
20503
+ try {
20504
+ return await widen(client);
20505
+ } catch (error) {
20506
+ if (!isMissingOutboxDeliveryBatchMarker(error)) throw error;
20507
+ return widen(client);
20508
+ }
20388
20509
  });
20389
20510
  if (widened[0]?.eventId !== first.eventId) {
20390
20511
  throw new RunLedgerProjectionLeaseLostError(
@@ -717,6 +717,7 @@ export type PlayAuthoringAstSqlListenerDeclaration = {
717
717
  operations: string[];
718
718
  };
719
719
  export type PlayAuthoringAstBindings = {
720
+ displayName?: string;
720
721
  webhook?: {
721
722
  hmac?: {
722
723
  algorithm?: 'sha256';
@@ -745,6 +746,7 @@ export type PlayAuthoringAstBindings = {
745
746
  */
746
747
  export const PLAY_AUTHORING_BINDING_FIELDS = {
747
748
  root: [
749
+ 'displayName',
748
750
  'billing',
749
751
  'compatibility',
750
752
  'cron',
@@ -792,6 +794,7 @@ export type PlayAuthoringCronInput<TInput> = TInput extends readonly unknown[]
792
794
 
793
795
  /** The one public type for options accepted by definePlay. */
794
796
  export type PlayAuthoringBindings<TInput = Record<string, unknown>> = {
797
+ displayName?: string;
795
798
  description?: string;
796
799
  compatibility?: {
797
800
  toolErrorSchemaVersion?: ToolExecutionErrorSchemaVersion;
@@ -929,6 +932,7 @@ export type PlayAuthoringDefineConfig<
929
932
  > = {
930
933
  id: string;
931
934
  description?: string;
935
+ displayName?: string;
932
936
  input: PlayAuthoringInputContract<TInput>;
933
937
  run: (ctx: TContext, input: TInput) => Promise<TOutput>;
934
938
  bindings?: PlayAuthoringBindings<TInput>;
@@ -1644,6 +1648,23 @@ const SqlListenerFilterScalarSchema = Type.Union([
1644
1648
  ]);
1645
1649
 
1646
1650
  export const PLAY_AUTHORING_FIELD_REGISTRY = {
1651
+ displayName: {
1652
+ schema: Type.String(),
1653
+ fixtures: {
1654
+ valid: 'Find verified emails',
1655
+ invalid: 42,
1656
+ absent: undefined,
1657
+ unresolved: { expression: 'displayName' },
1658
+ edition1: 'Legacy play',
1659
+ },
1660
+ referenceType: 'string',
1661
+ required: false,
1662
+ resolution: 'static-required',
1663
+ issueCode: 'play_authoring_binding_invalid',
1664
+ description:
1665
+ 'Optional human-readable Play name; empty uses the derived identifier.',
1666
+ errorMessage: 'displayName must be a static string.',
1667
+ },
1647
1668
  description: {
1648
1669
  schema: Type.String({ minLength: 1 }),
1649
1670
  fixtures: {
@@ -3198,6 +3219,7 @@ export const PLAY_AUTHORING_CLOUD_TYPE_DECLARATIONS = [
3198
3219
  '};',
3199
3220
  'export type PlayCronInput<TInput> = TInput extends readonly unknown[] ? never : TInput extends object ? TInput : never;',
3200
3221
  'export type PlayBindings<TInput = Record<string, unknown>> = {',
3222
+ ` displayName?: ${cloudReferenceType('displayName')};`,
3201
3223
  ` description?: ${cloudReferenceType('description')};`,
3202
3224
  ` compatibility?: { toolErrorSchemaVersion?: ${cloudReferenceType('compatibility.toolErrorSchemaVersion')}; toolResponseReceiptRevision?: ${cloudReferenceType('compatibility.toolResponseReceiptRevision')} };`,
3203
3225
  ` inline?: ${cloudReferenceType('inline')};`,
@@ -3276,7 +3298,7 @@ export const PLAY_AUTHORING_CLOUD_TYPE_DECLARATIONS = [
3276
3298
  " log(message: string, options?: { level?: 'debug' | 'info' | 'warn' | 'error'; context?: Readonly<Record<string, string | number | boolean>> }): void;",
3277
3299
  ` sleep(ms: ${cloudReferenceType('ctx.sleep.ms')}): Promise<void>;`,
3278
3300
  '}',
3279
- "export type DefinePlayConfig<TInput, TOutput extends PlayReturnObject> = { id: string; description?: string; input: PlayInputContract<TInput>; run: (ctx: DeeplinePlayRuntimeContext, input: TInput) => Promise<TOutput>; bindings?: PlayBindings<TInput>; billing?: PlayBindings<TInput>['billing']; runtime?: PlayBindings<TInput>['runtime']; compatibility?: PlayBindings<TInput>['compatibility'] };",
3301
+ "export type DefinePlayConfig<TInput, TOutput extends PlayReturnObject> = { id: string; displayName?: string; description?: string; input: PlayInputContract<TInput>; run: (ctx: DeeplinePlayRuntimeContext, input: TInput) => Promise<TOutput>; bindings?: PlayBindings<TInput>; billing?: PlayBindings<TInput>['billing']; runtime?: PlayBindings<TInput>['runtime']; compatibility?: PlayBindings<TInput>['compatibility'] };",
3280
3302
  "export type DefinedPlay<TInput, TOutput extends PlayReturnObject> = ((ctx: DeeplinePlayRuntimeContext, input: TInput) => Promise<TOutput>) & { readonly name: string; readonly __inputType?: TInput; readonly __outputType?: TOutput; readonly bindings?: PlayBindings<TInput>; readonly runtime?: PlayBindings<TInput>['runtime']; readonly compatibility?: PlayBindings<TInput>['compatibility'] };",
3281
3303
  'export type PlayHandlerInput<THandler> = THandler extends (context: DeeplinePlayRuntimeContext, input: infer TInput) => Promise<PlayReturnObject> ? TInput : never;',
3282
3304
  'export type PlayHandlerOutput<THandler> = THandler extends (context: DeeplinePlayRuntimeContext, input: unknown) => Promise<infer TOutput extends PlayReturnObject> ? TOutput : never;',
@@ -358,7 +358,13 @@ export function createDefinedPlay<
358
358
  : {
359
359
  name: nameOrConfig.id,
360
360
  fn: nameOrConfig.run,
361
- bindings: nameOrConfig.bindings,
361
+ bindings:
362
+ nameOrConfig.displayName !== undefined
363
+ ? {
364
+ ...nameOrConfig.bindings,
365
+ displayName: nameOrConfig.displayName,
366
+ }
367
+ : nameOrConfig.bindings,
362
368
  description: nameOrConfig.description,
363
369
  inputSchema: nameOrConfig.input.schema,
364
370
  billing: nameOrConfig.billing,
@@ -89,6 +89,12 @@ export function publishedPlayPath(path: PlayPath): PlayPath {
89
89
  return { root: 'team', folders: path?.folders ?? [] };
90
90
  }
91
91
 
92
+ export const playDisplayNameSchema = z
93
+ .string()
94
+ .trim()
95
+ .nullable()
96
+ .transform((value) => value || null);
97
+
92
98
  /** One registry drives validation, defaults, CLI keys/help and settings controls. */
93
99
  export const PLAY_SETTING_FIELDS = {
94
100
  path: {
@@ -114,10 +120,30 @@ export const PLAY_SETTING_FIELDS = {
114
120
  ],
115
121
  parse: (value: string) =>
116
122
  value === 'null' ? null : parsePlayPath(value),
117
- format: formatPlayPath,
123
+ format: (value: unknown) => formatPlayPath(playPathSchema.parse(value)),
118
124
  },
119
125
  ui: { control: 'play-location-picker' as const },
120
126
  },
127
+ displayName: {
128
+ schema: playDisplayNameSchema
129
+ .default(null)
130
+ .describe(
131
+ 'Optional human-readable Play name. Null uses the name derived from the identifier.',
132
+ ),
133
+ label: 'Display name',
134
+ description:
135
+ 'Optional name shown in the UI. Leave empty to use the name derived from the Play identifier.',
136
+ get defaultValue(): string | null {
137
+ return this.schema.parse(undefined);
138
+ },
139
+ cli: {
140
+ valueSyntax: 'text | null',
141
+ examples: ['Find verified emails', 'null'],
142
+ parse: (value: string) => (value === 'null' ? null : value),
143
+ format: (value: unknown) => playDisplayNameSchema.parse(value) ?? 'null',
144
+ },
145
+ ui: { control: 'text' as const },
146
+ },
121
147
  } as const;
122
148
  export const playSettingsSchema = z
123
149
  .object(
@@ -150,10 +176,10 @@ export const playSettingsPatchSchema = z
150
176
  'Supply at least one setting.',
151
177
  );
152
178
  export type PlaySettings = {
153
- [K in keyof typeof PLAY_SETTING_FIELDS]: z.output<
179
+ [K in Exclude<keyof typeof PLAY_SETTING_FIELDS, 'displayName'>]: z.output<
154
180
  (typeof PLAY_SETTING_FIELDS)[K]['schema']
155
181
  >;
156
- };
182
+ } & { displayName?: string | null };
157
183
  export type PlaySettingsPatch = z.output<typeof playSettingsPatchSchema>;
158
184
  /** Validate registered keys while preserving future keys in stored objects. */
159
185
  export function parsePlaySettings(value: unknown): PlaySettings {
@@ -9,11 +9,11 @@ import {
9
9
  registerAuthCommands,
10
10
  reportSetupCompleted,
11
11
  resolvePendingAuthClaimForResume
12
- } from "./chunk-LUJGLZCJ.mjs";
13
- import "./chunk-OJWZADOG.mjs";
14
- import "./chunk-M4KGWEN2.mjs";
12
+ } from "./chunk-6OGNRAS7.mjs";
13
+ import "./chunk-ZH7KTVAB.mjs";
14
+ import "./chunk-WPTUKXIF.mjs";
15
15
  import "./chunk-DLIRSHV6.mjs";
16
- import "./chunk-VN7Y4LVH.mjs";
16
+ import "./chunk-AA66YTS7.mjs";
17
17
  import "./chunk-NXGCO4JB.mjs";
18
18
  import "./chunk-WZYKRD7T.mjs";
19
19
  import "./chunk-KRD6H754.mjs";
@@ -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 _chunkYYU3PYVKjs = require('./chunk-YYU3PYVK.js');
13
+ require('./chunk-6LLJWMYH.js');
14
+ require('./chunk-TID5XLTZ.js');
15
+ require('./chunk-XNYIZMNQ.js');
16
+ require('./chunk-ZQJDRSR5.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 = _chunkYYU3PYVKjs.EXIT_WORKSPACE_MISMATCH; exports.clearPendingClaim = _chunkYYU3PYVKjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkYYU3PYVKjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkYYU3PYVKjs.handleRegister; exports.handleStatus = _chunkYYU3PYVKjs.handleStatus; exports.handleWait = _chunkYYU3PYVKjs.handleWait; exports.readPendingAuthClaim = _chunkYYU3PYVKjs.readPendingAuthClaim; exports.registerAuthCommands = _chunkYYU3PYVKjs.registerAuthCommands; exports.reportSetupCompleted = _chunkYYU3PYVKjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkYYU3PYVKjs.resolvePendingAuthClaimForResume;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DeeplineClient,
3
3
  iterateCursorPages
4
- } from "./chunk-NKRSVEP4.mjs";
4
+ } from "./chunk-NWFE4PGX.mjs";
5
5
  import "./chunk-CBVIJSHF.mjs";
6
6
  import {
7
7
  createTimestampedName,
@@ -9,13 +9,13 @@ import {
9
9
  openInBrowser,
10
10
  printCommandEnvelope,
11
11
  shouldEmitJson
12
- } from "./chunk-OJWZADOG.mjs";
12
+ } from "./chunk-ZH7KTVAB.mjs";
13
13
  import {
14
14
  AuthError,
15
15
  ConfigError
16
- } from "./chunk-M4KGWEN2.mjs";
16
+ } from "./chunk-WPTUKXIF.mjs";
17
17
  import "./chunk-DLIRSHV6.mjs";
18
- import "./chunk-VN7Y4LVH.mjs";
18
+ import "./chunk-AA66YTS7.mjs";
19
19
  import "./chunk-6IKARAYD.mjs";
20
20
  import {
21
21
  DeeplineError
@@ -1383,7 +1383,7 @@ Examples:
1383
1383
  deepline billing subscription status --json
1384
1384
 
1385
1385
  # Price a tool before execution; look up its exact charge afterward
1386
- deepline tools describe <tool-id> --pricing-only
1386
+ deepline describe <tool-id>
1387
1387
  deepline billing usage --request-id <job_id> --json
1388
1388
 
1389
1389
  # Buy credits or a plan