deepline 0.3.144 → 0.3.146

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 (32) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +53 -1
  2. package/dist/bundling-sources/sdk/src/index.ts +1 -0
  3. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  4. package/dist/bundling-sources/shared_libs/play-runtime/async-operation.ts +40 -4
  5. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +259 -7
  6. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +10 -0
  7. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +10 -0
  8. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +58 -19
  9. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +17 -11
  10. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +57 -2
  11. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +73 -16
  12. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +57 -3
  13. package/dist/bundling-sources/shared_libs/play-runtime/step-progress.ts +7 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +35 -3
  15. package/dist/bundling-sources/shared_libs/play-runtime/worker-api-types.ts +1 -0
  16. package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +11 -1
  17. package/dist/cli/index.js +85 -17
  18. package/dist/cli/index.mjs +85 -17
  19. package/dist/{compiler-manifest-BIqRyj5m.d.mts → compiler-manifest-BJBNPTWt.d.mts} +2 -1
  20. package/dist/{compiler-manifest-BIqRyj5m.d.ts → compiler-manifest-BJBNPTWt.d.ts} +2 -1
  21. package/dist/index.d.mts +26 -4
  22. package/dist/index.d.ts +26 -4
  23. package/dist/index.js +78 -10
  24. package/dist/index.mjs +78 -10
  25. package/dist/install-integrity.json +2 -2
  26. package/dist/plays/bundle-play-file.d.mts +2 -2
  27. package/dist/plays/bundle-play-file.d.ts +2 -2
  28. package/dist/release.d.mts +1 -1
  29. package/dist/release.d.ts +1 -1
  30. package/dist/release.js +1 -1
  31. package/dist/release.mjs +1 -1
  32. package/package.json +1 -1
@@ -9099,6 +9099,9 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
9099
9099
  input.result,
9100
9100
  { logMetadata: input.completionLogMetadata ?? 'attach' },
9101
9101
  );
9102
+ const resultSummary = terminalRowOutcomesSummary(
9103
+ (input.result as { rowOutcomes?: unknown }).rowOutcomes,
9104
+ );
9102
9105
  const terminalResult = assertTerminalRunResultWithinLimit(terminalOutput);
9103
9106
  const ledgerTerminalResult = terminalRunResultForLedger(terminalResult, {
9104
9107
  content: 'full',
@@ -9352,7 +9355,8 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
9352
9355
  jsonb_build_object(
9353
9356
  'output', $6::jsonb,
9354
9357
  'terminalLogLines', $7::jsonb,
9355
- 'terminalProgressEvents', $8::jsonb
9358
+ 'terminalProgressEvents', $8::jsonb,
9359
+ 'resultSummary', $16::jsonb
9356
9360
  ),
9357
9361
  ${causalOutboxCreatedAt('run_terminal.run_id', options)}
9358
9362
  FROM run_terminal
@@ -9386,6 +9390,7 @@ export async function directCompletePostgresSchedulerRunnerTerminal(
9386
9390
  input.engineWake.eventName,
9387
9391
  input.engineWake.wakeChannel,
9388
9392
  input.allowCappedCompletion === true,
9393
+ stringifyPostgresJson(resultSummary),
9389
9394
  ],
9390
9395
  );
9391
9396
  if (completed.rows.length > 0) return 'completed';
@@ -11271,6 +11276,7 @@ export async function completePostgresSchedulerAttempt(
11271
11276
  attempt: number;
11272
11277
  leaseToken: string;
11273
11278
  output: unknown;
11279
+ rowOutcomes?: unknown;
11274
11280
  runtimeTiming?: PlayRunnerRuntimeTiming | null;
11275
11281
  terminalLogLines?: readonly string[] | null;
11276
11282
  },
@@ -11280,6 +11286,7 @@ export async function completePostgresSchedulerAttempt(
11280
11286
  const ledgerTerminalResult = terminalRunResultForLedger(terminalResult, {
11281
11287
  content: 'full',
11282
11288
  });
11289
+ const resultSummary = terminalRowOutcomesSummary(input.rowOutcomes);
11283
11290
  const terminalLogLines = (input.terminalLogLines ?? [])
11284
11291
  .map((line) => line.trim())
11285
11292
  .filter(Boolean)
@@ -11458,7 +11465,8 @@ export async function completePostgresSchedulerAttempt(
11458
11465
  'run.completed',
11459
11466
  jsonb_build_object(
11460
11467
  'output', $9::jsonb,
11461
- 'terminalLogLines', $8::jsonb
11468
+ 'terminalLogLines', $8::jsonb,
11469
+ 'resultSummary', $10::jsonb
11462
11470
  ),
11463
11471
  ${causalOutboxCreatedAt('run_terminal.run_id', options)}
11464
11472
  FROM run_terminal
@@ -11479,6 +11487,7 @@ export async function completePostgresSchedulerAttempt(
11479
11487
  JSON.stringify({ runId: input.runId, status: 'completed' }),
11480
11488
  JSON.stringify(terminalLogLines),
11481
11489
  stringifyPostgresJson(ledgerTerminalResult ?? null),
11490
+ stringifyPostgresJson(resultSummary),
11482
11491
  ],
11483
11492
  );
11484
11493
  if (completed.rows.length === 0) {
@@ -11522,6 +11531,9 @@ export async function failPostgresSchedulerAttempt(
11522
11531
  terminalResult === undefined ? (input.result ?? null) : terminalResult,
11523
11532
  terminalResult === undefined ? {} : { content: 'full' },
11524
11533
  );
11534
+ const resultSummary = terminalRowOutcomesSummary(
11535
+ (input.result as { rowOutcomes?: unknown } | null)?.rowOutcomes,
11536
+ );
11525
11537
  // Keep the recovery tail separate from result: large failures are represented
11526
11538
  // by a result reference, but their customer guidance must still be logged.
11527
11539
  const terminalLogLines = (input.terminalLogLines ?? [])
@@ -11762,7 +11774,8 @@ export async function failPostgresSchedulerAttempt(
11762
11774
  jsonb_build_object(
11763
11775
  'error', $4::jsonb ->> 'message',
11764
11776
  'result', $8::jsonb,
11765
- 'terminalLogLines', $12::jsonb
11777
+ 'terminalLogLines', $12::jsonb,
11778
+ 'resultSummary', $13::jsonb
11766
11779
  ),
11767
11780
  ${causalOutboxCreatedAt('run_terminal.run_id', options)}
11768
11781
  FROM run_terminal
@@ -11786,6 +11799,7 @@ export async function failPostgresSchedulerAttempt(
11786
11799
  stringifyPostgresJson(input.sandboxCrashDiagnostic ?? null),
11787
11800
  input.preserveRunnerTerminal === true,
11788
11801
  JSON.stringify(terminalLogLines),
11802
+ stringifyPostgresJson(resultSummary),
11789
11803
  ],
11790
11804
  );
11791
11805
  return failed.rows.length > 0;
@@ -12265,6 +12279,23 @@ function finiteRunnerNumber(value: unknown): number | null {
12265
12279
  : null;
12266
12280
  }
12267
12281
 
12282
+ function terminalRowOutcomesSummary(value: unknown): {
12283
+ rowOutcomes: Record<string, number>;
12284
+ } | null {
12285
+ if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
12286
+ const record = value as Record<string, unknown>;
12287
+ const completedRows = finiteRunnerNumber(record.completedRows);
12288
+ const failedRows = finiteRunnerNumber(record.failedRows);
12289
+ const totalRows = finiteRunnerNumber(record.totalRows);
12290
+ const supersededRows = finiteRunnerNumber(record.supersededRows);
12291
+ const rowOutcomes: Record<string, number> = {};
12292
+ if (completedRows !== null) rowOutcomes.completedRows = completedRows;
12293
+ if (failedRows !== null) rowOutcomes.failedRows = failedRows;
12294
+ if (totalRows !== null) rowOutcomes.totalRows = totalRows;
12295
+ if (supersededRows !== null) rowOutcomes.supersededRows = supersededRows;
12296
+ return Object.keys(rowOutcomes).length > 0 ? { rowOutcomes } : null;
12297
+ }
12298
+
12268
12299
  function readPlayRunnerRuntimeTiming(
12269
12300
  value: unknown,
12270
12301
  ): PlayRunnerRuntimeTiming | null {
@@ -12425,6 +12456,18 @@ function attachRunnerWorkProgressMetadata(
12425
12456
  const skipped = finiteRunnerNumber(
12426
12457
  (runnerResult as { skipped?: unknown }).skipped,
12427
12458
  );
12459
+ const runnerRowOutcomes = terminalRowOutcomesSummary(
12460
+ (runnerResult as { rowOutcomes?: unknown }).rowOutcomes,
12461
+ )?.rowOutcomes;
12462
+ const existingRowOutcomes =
12463
+ metadata?.rowOutcomes &&
12464
+ typeof metadata.rowOutcomes === 'object' &&
12465
+ !Array.isArray(metadata.rowOutcomes)
12466
+ ? (metadata.rowOutcomes as Record<string, unknown>)
12467
+ : null;
12468
+ const rowOutcomes = runnerRowOutcomes
12469
+ ? { ...(existingRowOutcomes ?? {}), ...runnerRowOutcomes }
12470
+ : null;
12428
12471
  const logs = Array.isArray((runnerResult as { logs?: unknown }).logs)
12429
12472
  ? (runnerResult as { logs: unknown[] }).logs.filter(
12430
12473
  (line): line is string =>
@@ -12480,6 +12523,7 @@ function attachRunnerWorkProgressMetadata(
12480
12523
  (total === null || skipped === null || metadata?.workProgress) &&
12481
12524
  !runLogTail &&
12482
12525
  !runtimeResources &&
12526
+ !rowOutcomes &&
12483
12527
  mergedOutputWarnings.length === 0
12484
12528
  ) {
12485
12529
  return output;
@@ -12511,6 +12555,7 @@ function attachRunnerWorkProgressMetadata(
12511
12555
  _metadata: {
12512
12556
  ...(metadata ?? {}),
12513
12557
  ...(workProgress ? { workProgress } : {}),
12558
+ ...(rowOutcomes ? { rowOutcomes } : {}),
12514
12559
  ...(runLogTail ? { runLogTail } : {}),
12515
12560
  ...(runtimeResources ? { runtimeResources } : {}),
12516
12561
  ...(mergedOutputWarnings.length > 0
@@ -12608,6 +12653,7 @@ export async function executePostgresSchedulerClaim(
12608
12653
  attempt: claim.attempt,
12609
12654
  leaseToken: claim.leaseToken,
12610
12655
  output: terminalOutput,
12656
+ rowOutcomes: (output as { rowOutcomes?: unknown } | null)?.rowOutcomes,
12611
12657
  runtimeTiming: extractRunnerRuntimeTiming(output),
12612
12658
  terminalLogLines: terminalLogLinesForOutbox(
12613
12659
  output,
@@ -15736,6 +15782,7 @@ export function buildRunLedgerEventsFromPostgresSchedulerOutbox(
15736
15782
  event.runId,
15737
15783
  );
15738
15784
  const lines = stringArrayPayloadField(event.payload, 'terminalLogLines');
15785
+ const resultSummary = payloadField(event.payload, 'resultSummary');
15739
15786
  return [
15740
15787
  ...progressEvents,
15741
15788
  ...(lines.length === 0
@@ -15757,6 +15804,9 @@ export function buildRunLedgerEventsFromPostgresSchedulerOutbox(
15757
15804
  result: terminalRunResultForLedger(
15758
15805
  payloadField(event.payload, 'output'),
15759
15806
  ),
15807
+ ...(resultSummary === undefined || resultSummary === null
15808
+ ? {}
15809
+ : { resultSummary }),
15760
15810
  },
15761
15811
  ];
15762
15812
  }
@@ -15770,6 +15820,7 @@ export function buildRunLedgerEventsFromPostgresSchedulerOutbox(
15770
15820
  const result = terminalRunResultForLedger(
15771
15821
  payloadField(event.payload, 'result'),
15772
15822
  );
15823
+ const resultSummary = payloadField(event.payload, 'resultSummary');
15773
15824
  return [
15774
15825
  ...progressEvents,
15775
15826
  ...(lines.length === 0
@@ -15790,6 +15841,9 @@ export function buildRunLedgerEventsFromPostgresSchedulerOutbox(
15790
15841
  source: 'system',
15791
15842
  error: stringPayloadField(event.payload, 'error'),
15792
15843
  ...(result === null || result === undefined ? {} : { result }),
15844
+ ...(resultSummary === undefined || resultSummary === null
15845
+ ? {}
15846
+ : { resultSummary }),
15793
15847
  },
15794
15848
  ];
15795
15849
  }
@@ -25,6 +25,7 @@ export type PlayVisualNodeProgress = {
25
25
  activeRows?: number;
26
26
  waitingRows?: number;
27
27
  completedRows?: number;
28
+ supersededRows?: number;
28
29
  message?: string;
29
30
  updatedAt?: number | null;
30
31
  startedAt?: number | null;
@@ -129,6 +130,11 @@ export function normalizePlayVisualNodeProgressMap(
129
130
  Number.isFinite(rawProgress.completedRows)
130
131
  ? rawProgress.completedRows
131
132
  : undefined;
133
+ const supersededRows =
134
+ typeof rawProgress.supersededRows === 'number' &&
135
+ Number.isFinite(rawProgress.supersededRows)
136
+ ? rawProgress.supersededRows
137
+ : undefined;
132
138
  const updatedAt =
133
139
  typeof rawProgress.updatedAt === 'number' &&
134
140
  Number.isFinite(rawProgress.updatedAt)
@@ -165,6 +171,7 @@ export function normalizePlayVisualNodeProgressMap(
165
171
  ...(activeRows !== undefined ? { activeRows } : {}),
166
172
  ...(waitingRows !== undefined ? { waitingRows } : {}),
167
173
  ...(completedRows !== undefined ? { completedRows } : {}),
174
+ ...(supersededRows !== undefined ? { supersededRows } : {}),
168
175
  ...(updatedAt !== undefined ? { updatedAt } : {}),
169
176
  ...(startedAt !== undefined ? { startedAt } : {}),
170
177
  ...(completedAt !== undefined ? { completedAt } : {}),
@@ -664,6 +664,21 @@ function findFirstTargetByPath(
664
664
  return null;
665
665
  }
666
666
 
667
+ function findFirstExplicitNullTargetByPath(
668
+ result: unknown,
669
+ paths: readonly string[] | undefined,
670
+ ): ToolResultTargetMetadata | null {
671
+ for (const path of paths ?? []) {
672
+ for (const candidate of candidateResultPaths(path)) {
673
+ const explicitNull = valuesAtSegments(result, parsePath(candidate)).find(
674
+ (entry) => entry.value === null,
675
+ );
676
+ if (explicitNull) return { value: null, path: explicitNull.path };
677
+ }
678
+ }
679
+ return null;
680
+ }
681
+
667
682
  function firstValueForPaths(
668
683
  result: unknown,
669
684
  paths: readonly string[] | undefined,
@@ -1015,7 +1030,15 @@ function buildTargets(
1015
1030
  continue;
1016
1031
  }
1017
1032
  const fromExtractor = findFirstTargetByPath(result, descriptor.paths);
1018
- if (!fromExtractor) continue;
1033
+ if (!fromExtractor) {
1034
+ // A declared null is an explicit provider answer, not permission to
1035
+ // guess from a similarly named sibling such as `emailDomain`.
1036
+ const explicitNull = isSemanticStatus
1037
+ ? null
1038
+ : findFirstExplicitNullTargetByPath(result, descriptor.paths);
1039
+ if (explicitNull) targets[target] = explicitNull;
1040
+ continue;
1041
+ }
1019
1042
  const transformed = coerceToEnum(
1020
1043
  applyExtractorTransforms(fromExtractor.value, descriptor),
1021
1044
  descriptor,
@@ -1038,6 +1061,14 @@ function buildTargets(
1038
1061
  targets[target] = fromMetadata;
1039
1062
  continue;
1040
1063
  }
1064
+ const explicitNull = findFirstExplicitNullTargetByPath(
1065
+ result,
1066
+ targetGetters?.[target],
1067
+ );
1068
+ if (explicitNull) {
1069
+ targets[target] = explicitNull;
1070
+ continue;
1071
+ }
1041
1072
  // Declared paths are routinely incomplete against the shape a provider
1042
1073
  // actually returns (zerobounce declares `result.data.email` and answers
1043
1074
  // with `address`), so the key scan stays as the rescue. It is bounded by
@@ -1053,6 +1084,7 @@ function buildTargets(
1053
1084
  }
1054
1085
  if (metadataTargets.size === 0) {
1055
1086
  for (const target of ['email', 'phone', 'linkedin', 'domain', 'status']) {
1087
+ if (targets[target]) continue;
1056
1088
  const found = findFirstTargetByKey(result, target);
1057
1089
  if (found) targets[target] = found;
1058
1090
  }
@@ -1333,8 +1365,8 @@ export function readValue(
1333
1365
  selector: readonly string[] | string,
1334
1366
  ): unknown {
1335
1367
  if (typeof selector === 'string') {
1336
- const declared = result.extractedValues[selector]?.get();
1337
- if (declared != null) return declared;
1368
+ const declared = result.extractedValues[selector];
1369
+ if (declared) return declared.get();
1338
1370
  }
1339
1371
  const root = resultRootOf(result);
1340
1372
  const paths = Array.isArray(selector) ? selector : [selector];
@@ -18,6 +18,7 @@ export type PlayVisualNodeProgress = {
18
18
  activeRows?: number;
19
19
  waitingRows?: number;
20
20
  completedRows?: number;
21
+ supersededRows?: number;
21
22
  message?: string;
22
23
  updatedAt?: number;
23
24
  startedAt?: number;
@@ -13,7 +13,17 @@ export type ToolResultBilling = {
13
13
  cost_usd?: number;
14
14
  /** Missing on historical responses. Pending pricing has no final amount. */
15
15
  pricing_status?: 'final' | 'pending';
16
- settlement_status?: 'pending' | 'queued' | 'settled' | 'requires_recovery';
16
+ settlement_status?:
17
+ | 'pending'
18
+ | 'queued'
19
+ | 'settled'
20
+ | 'released'
21
+ | 'requires_recovery';
22
+ billing_outcome_reason?:
23
+ | 'free_operation'
24
+ | 'provider_no_billable_result'
25
+ | 'provider_reported_zero_usage'
26
+ | 'zero_price';
17
27
  estimated_credits?: number;
18
28
  estimated_cost_usd?: number;
19
29
  /** Preserve additive public pricing details across runtime/deployment skew. */
package/dist/cli/index.js CHANGED
@@ -3068,7 +3068,7 @@ var SDK_RELEASE = {
3068
3068
  // getters keep their established compatibility behavior.
3069
3069
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3070
3070
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3071
- version: "0.3.144",
3071
+ version: "0.3.146",
3072
3072
  updateSummary: "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.",
3073
3073
  packageCapabilities: {
3074
3074
  updatePreferences: 1
@@ -5313,19 +5313,32 @@ function summarizeRunRowOutcomes(snapshot) {
5313
5313
  let completedRows = 0;
5314
5314
  let failedRows = 0;
5315
5315
  let totalRows = 0;
5316
+ let supersededRows = 0;
5316
5317
  for (const step of Object.values(snapshot.stepsById)) {
5317
5318
  const progress = step.progress;
5318
5319
  if (!progress) continue;
5319
5320
  completedRows += Math.max(0, finiteNumber(progress.completed) ?? 0);
5320
5321
  failedRows += Math.max(0, finiteNumber(progress.failed) ?? 0);
5322
+ supersededRows += Math.max(0, finiteNumber(progress.supersededRows) ?? 0);
5321
5323
  const stepTotal = finiteNumber(progress.total);
5322
- totalRows += stepTotal !== null && stepTotal >= 0 ? stepTotal : Math.max(0, finiteNumber(progress.completed) ?? 0) + Math.max(0, finiteNumber(progress.failed) ?? 0);
5323
- }
5324
+ totalRows += stepTotal !== null && stepTotal >= 0 ? stepTotal : Math.max(0, finiteNumber(progress.completed) ?? 0) + Math.max(0, finiteNumber(progress.failed) ?? 0) + Math.max(0, finiteNumber(progress.supersededRows) ?? 0);
5325
+ }
5326
+ const resultSummary = isRecord5(snapshot.resultSummary) ? snapshot.resultSummary : null;
5327
+ const resultRowOutcomes = isRecord5(resultSummary?.rowOutcomes) ? resultSummary.rowOutcomes : null;
5328
+ const terminalCompletedRows = finiteNumber(resultRowOutcomes?.completedRows);
5329
+ const terminalFailedRows = finiteNumber(resultRowOutcomes?.failedRows);
5330
+ const terminalTotalRows = finiteNumber(resultRowOutcomes?.totalRows);
5331
+ const terminalSupersededRows = finiteNumber(
5332
+ resultRowOutcomes?.supersededRows
5333
+ );
5334
+ const settledCompletedRows = terminalCompletedRows ?? completedRows;
5335
+ const settledFailedRows = terminalFailedRows ?? failedRows;
5324
5336
  return {
5325
- completedRows,
5326
- failedRows,
5327
- totalRows,
5328
- hasRowFailures: failedRows > 0
5337
+ completedRows: settledCompletedRows,
5338
+ failedRows: settledFailedRows,
5339
+ totalRows: terminalTotalRows ?? totalRows,
5340
+ hasRowFailures: settledFailedRows > 0,
5341
+ ...(terminalSupersededRows ?? supersededRows) > 0 ? { supersededRows: terminalSupersededRows ?? supersededRows } : {}
5329
5342
  };
5330
5343
  }
5331
5344
  function createEmptyPlayRunLedgerSnapshot(input2) {
@@ -5483,6 +5496,7 @@ function normalizeStepProgress(value) {
5483
5496
  ...optionalFiniteNumber(value.activeRows) !== void 0 ? { activeRows: optionalFiniteNumber(value.activeRows) } : {},
5484
5497
  ...optionalFiniteNumber(value.waitingRows) !== void 0 ? { waitingRows: optionalFiniteNumber(value.waitingRows) } : {},
5485
5498
  ...optionalFiniteNumber(value.completedRows) !== void 0 ? { completedRows: optionalFiniteNumber(value.completedRows) } : {},
5499
+ ...optionalFiniteNumber(value.supersededRows) !== void 0 ? { supersededRows: optionalFiniteNumber(value.supersededRows) } : {},
5486
5500
  ...optionalString(value.message) ? { message: optionalString(value.message) } : {},
5487
5501
  ...optionalNullableString(value.artifactTableNamespace) !== void 0 ? {
5488
5502
  artifactTableNamespace: optionalNullableString(
@@ -5734,6 +5748,7 @@ function buildSnapshotFromLedger(snapshot) {
5734
5748
  activeRows: step.progress.activeRows,
5735
5749
  waitingRows: step.progress.waitingRows,
5736
5750
  completedRows: step.progress.completedRows,
5751
+ supersededRows: step.progress.supersededRows,
5737
5752
  message: step.progress.message,
5738
5753
  artifactTableNamespace: step.progress.artifactTableNamespace ?? step.artifactTableNamespace ?? null,
5739
5754
  startedAt: step.startedAt ?? null,
@@ -5747,7 +5762,8 @@ function buildSnapshotFromLedger(snapshot) {
5747
5762
  ...step.progress?.nodeIo ? { nodeIo: step.progress.nodeIo } : {}
5748
5763
  }));
5749
5764
  const liveStatus = normalizePlayRunLiveStatus(snapshot.status);
5750
- const rowOutcomes = isTerminalPlayRunLiveStatus(liveStatus) && Object.keys(snapshot.stepsById).length > 0 ? summarizeRunRowOutcomes(snapshot) : null;
5765
+ const terminalRowOutcomes = isTerminalPlayRunLiveStatus(liveStatus) ? summarizeRunRowOutcomes(snapshot) : null;
5766
+ const rowOutcomes = terminalRowOutcomes && (Object.keys(snapshot.stepsById).length > 0 || terminalRowOutcomes.totalRows > 0 || (terminalRowOutcomes.supersededRows ?? 0) > 0) ? terminalRowOutcomes : null;
5751
5767
  return {
5752
5768
  runId: snapshot.runId,
5753
5769
  status: liveStatus,
@@ -7100,6 +7116,7 @@ var DeeplineClient = class _DeeplineClient {
7100
7116
  invoices: {
7101
7117
  list: (options2) => this.listBillingInvoices(options2)
7102
7118
  },
7119
+ usageEvent: (requestId) => this.getBillingUsageEvent(requestId),
7103
7120
  targetPlans: () => this.getTargetBillingPlans(),
7104
7121
  targetStatus: () => this.getTargetBillingStatus(),
7105
7122
  autoRecharge: {
@@ -7434,7 +7451,7 @@ var DeeplineClient = class _DeeplineClient {
7434
7451
  * guaranteed support for every model. Runtime AI SDK/Gateway errors remain
7435
7452
  * authoritative for model-gated values.
7436
7453
  *
7437
- * @param model - Gateway model id such as `"openai/gpt-5.5"`
7454
+ * @param model - Exact-case Gateway model id such as `"openai/gpt-5.6-luna"`
7438
7455
  * @returns Model metadata, provider option shapes, and runnable examples
7439
7456
  */
7440
7457
  async describeModel(model) {
@@ -9471,6 +9488,33 @@ var DeeplineClient = class _DeeplineClient {
9471
9488
  async getBillingPlans() {
9472
9489
  return this.http.get("/api/v2/billing/catalog/current");
9473
9490
  }
9491
+ /**
9492
+ * Read the authenticated usage record for one execution request. The
9493
+ * request id comes from the original `executeTool` result and is not a
9494
+ * retry or idempotency token.
9495
+ */
9496
+ async getBillingUsageEvent(requestId) {
9497
+ const normalizedRequestId = requestId.trim();
9498
+ if (normalizedRequestId.length === 0 || normalizedRequestId.length > 200 || normalizedRequestId !== requestId) {
9499
+ throw new DeeplineError(
9500
+ "Usage request_id must contain 1\u2013200 characters with no leading or trailing whitespace.",
9501
+ void 0,
9502
+ "INVALID_USAGE_REQUEST_ID"
9503
+ );
9504
+ }
9505
+ const response = await this.http.get(
9506
+ `/api/v2/usage/events?request_id=${encodeURIComponent(normalizedRequestId)}`
9507
+ );
9508
+ const event = response.entries?.[0];
9509
+ if (!event) {
9510
+ throw new DeeplineError(
9511
+ "No usage event was found for this request_id.",
9512
+ void 0,
9513
+ "USAGE_EVENT_NOT_FOUND"
9514
+ );
9515
+ }
9516
+ return event;
9517
+ }
9474
9518
  /**
9475
9519
  * Charge the saved payment method and add Deepline credits to the active
9476
9520
  * workspace. Prefer `client.billing.topUp(...)`.
@@ -23628,14 +23672,18 @@ function getProgressLinesFromLiveEvent(event) {
23628
23672
  const rowOutcomes = readRowOutcomeSummary({
23629
23673
  rowOutcomes: payload.rowOutcomes
23630
23674
  });
23631
- if (rowOutcomes?.hasRowFailures) {
23675
+ if (rowOutcomes && (rowOutcomes.hasRowFailures || (rowOutcomes.supersededRows ?? 0) > 0)) {
23632
23676
  const counts = formatProgressCounts({
23633
23677
  completed: rowOutcomes.completedRows,
23634
23678
  total: rowOutcomes.totalRows,
23635
23679
  failed: rowOutcomes.failedRows
23636
23680
  });
23637
- if (counts) {
23638
- lines.push(`progress run outcomes: ${counts}`);
23681
+ const outcomeParts = [
23682
+ counts,
23683
+ ...rowOutcomes && (rowOutcomes.supersededRows ?? 0) > 0 ? [formatSupersededRowsNotice(rowOutcomes.supersededRows)] : []
23684
+ ].filter((part) => Boolean(part));
23685
+ if (outcomeParts.length > 0) {
23686
+ lines.push(`progress run outcomes: ${outcomeParts.join(", ")}`);
23639
23687
  }
23640
23688
  }
23641
23689
  return lines;
@@ -24514,9 +24562,13 @@ function buildRunWarnings(status, rowsInfo) {
24514
24562
  const rowOutcomeWarnings = rowOutcomes?.hasRowFailures ? [
24515
24563
  `${status.status === "completed" ? "Run completed" : "Run ended"} with ${formatInteger(rowOutcomes.failedRows)} failed row(s); inspect the persisted failed rows before treating the output as complete.`
24516
24564
  ] : [];
24565
+ const supersededRowNotices = (rowOutcomes?.supersededRows ?? 0) > 0 ? [
24566
+ `Latest-write-wins: ${formatSupersededRowsNotice(rowOutcomes.supersededRows ?? 0)}; the newer write still owns that Runtime Sheet row.`
24567
+ ] : [];
24517
24568
  if (status.status === "completed" && rowsInfo?.totalRows === 0) {
24518
24569
  return [
24519
24570
  ...rowOutcomeWarnings,
24571
+ ...supersededRowNotices,
24520
24572
  "Run completed with 0 output rows.",
24521
24573
  ...outputWarnings
24522
24574
  ];
@@ -24524,11 +24576,12 @@ function buildRunWarnings(status, rowsInfo) {
24524
24576
  if (rowsInfo && !rowsInfo.complete) {
24525
24577
  return [
24526
24578
  ...rowOutcomeWarnings,
24579
+ ...supersededRowNotices,
24527
24580
  `Run output is partial: showing ${rowsInfo.rows.length} preview row(s) of ${rowsInfo.totalRows}.`,
24528
24581
  ...outputWarnings
24529
24582
  ];
24530
24583
  }
24531
- return [...rowOutcomeWarnings, ...outputWarnings];
24584
+ return [...rowOutcomeWarnings, ...supersededRowNotices, ...outputWarnings];
24532
24585
  }
24533
24586
  function buildRunNextCommands(status) {
24534
24587
  const runId = status.runId?.trim();
@@ -24564,6 +24617,9 @@ function getNumericField(value, key) {
24564
24617
  const field = getRecordField(value, key);
24565
24618
  return typeof field === "number" && Number.isFinite(field) ? field : null;
24566
24619
  }
24620
+ function formatSupersededRowsNotice(count) {
24621
+ return `${formatInteger(count)} row${count === 1 ? "" : "s"} skipped because a newer Runtime Sheet write took precedence`;
24622
+ }
24567
24623
  function readRowOutcomeSummary(value) {
24568
24624
  const record3 = getRecordField(value, "rowOutcomes");
24569
24625
  if (!record3) return null;
@@ -24574,11 +24630,13 @@ function readRowOutcomeSummary(value) {
24574
24630
  return null;
24575
24631
  }
24576
24632
  const explicitHasFailures = getRecordField(record3, "hasRowFailures");
24633
+ const supersededRows = getNumericField(record3, "supersededRows");
24577
24634
  return {
24578
24635
  completedRows,
24579
24636
  failedRows,
24580
24637
  totalRows,
24581
- hasRowFailures: typeof explicitHasFailures === "boolean" ? explicitHasFailures : failedRows > 0
24638
+ hasRowFailures: typeof explicitHasFailures === "boolean" ? explicitHasFailures : failedRows > 0,
24639
+ ...supersededRows !== null ? { supersededRows: Math.max(0, supersededRows) } : {}
24582
24640
  };
24583
24641
  }
24584
24642
  function getStringField(value, key) {
@@ -24821,12 +24879,16 @@ function normalizeProgressForEnvelope(status, rowsInfo) {
24821
24879
  const total = rowOutcomes?.totalRows ?? getNumericField(progress, "totalRows") ?? getNumericField(progress, "total") ?? rowsInfo?.totalRows ?? null;
24822
24880
  const failed = rowOutcomes?.failedRows ?? getNumericField(progress, "failed") ?? getNumericField(progress, "failedRows") ?? null;
24823
24881
  const completed = rowOutcomes?.completedRows ?? getNumericField(progress, "completed") ?? getNumericField(progress, "completedRows") ?? (status.status === "completed" ? total : null);
24824
- const pending = getNumericField(progress, "pending") ?? (typeof total === "number" && typeof completed === "number" && typeof failed === "number" ? Math.max(0, total - completed - failed) : null);
24882
+ const supersededRows = rowOutcomes?.supersededRows ?? getNumericField(progress, "supersededRows");
24883
+ const supersededOffset = supersededRows ?? 0;
24884
+ const progressPending = getNumericField(progress, "pending");
24885
+ const pending = (progressPending !== null ? Math.max(0, progressPending - supersededOffset) : null) ?? (typeof total === "number" && typeof completed === "number" && typeof failed === "number" ? Math.max(0, total - completed - failed - supersededOffset) : null);
24825
24886
  return {
24826
24887
  total,
24827
24888
  totalRows: total,
24828
24889
  completed,
24829
24890
  completedRows: completed,
24891
+ ...supersededRows !== null ? { supersededRows: Math.max(0, supersededRows) } : {},
24830
24892
  pending,
24831
24893
  failed,
24832
24894
  executed: getNumericField(progress, "executed"),
@@ -24957,6 +25019,9 @@ function compactPlayStatus(status) {
24957
25019
  ) : [],
24958
25020
  ...rowOutcomes2.hasRowFailures ? [
24959
25021
  `${status.status === "completed" ? "Run completed" : "Run ended"} with ${formatInteger(rowOutcomes2.failedRows)} failed row(s); inspect the persisted failed rows before treating the output as complete.`
25022
+ ] : [],
25023
+ ...(rowOutcomes2.supersededRows ?? 0) > 0 ? [
25024
+ `Latest-write-wins: ${formatSupersededRowsNotice(rowOutcomes2.supersededRows ?? 0)}; the newer write still owns that Runtime Sheet row.`
24960
25025
  ] : []
24961
25026
  ]
24962
25027
  } : packaged;
@@ -47911,7 +47976,7 @@ Examples:
47911
47976
  deepline tools describe hunter_email_verifier --schema-only
47912
47977
  deepline tools describe hunter_email_verifier --examples-only
47913
47978
  deepline tools describe hunter_email_verifier --json
47914
- deepline tools describe deeplineagent --model openai/gpt-5.5 --json
47979
+ deepline tools describe deeplineagent --model openai/gpt-5.6-luna --json
47915
47980
  deepline tools describe ai_inference --estimate-payload @payload.json --json
47916
47981
  deepline tools describe ai_evaluate --estimate-payload @payload.json --json
47917
47982
  deepline tools execute hunter_email_verifier --input '{"email":"a@b.com"}'
@@ -47957,9 +48022,11 @@ Notes:
47957
48022
  waterfalls, row maps, checkpoints, and retries.
47958
48023
  Calling a provider-backed tool can spend Deepline credits. Use --json for the
47959
48024
  stable result payload plus output preview and debugging helpers.
48025
+ --timeout sets this CLI request's HTTP deadline; it does not cancel provider work.
47960
48026
 
47961
48027
  Examples:
47962
48028
  deepline tools execute hunter_email_verifier --input '{"email":"a@b.com"}'
48029
+ deepline tools execute bounceban_verify_bulk --input @batch.json --timeout 10m --json
47963
48030
  deepline tools execute hunter_email_verifier -p email=a@b.com
47964
48031
  deepline tools execute test_rate_limit --input '{"key":"smoke"}' --timeout 90s --json
47965
48032
  deepline tools execute test_rate_limit --input '{"key":"smoke"}' --json | jq '.status'
@@ -47984,7 +48051,7 @@ Examples:
47984
48051
  "Merge a JSON object or @file path into the tool params"
47985
48052
  ).option(
47986
48053
  "--timeout <duration>",
47987
- "Execution HTTP deadline (for example 90s, 5m, or 1h; bare numbers are seconds)"
48054
+ "Client-side HTTP deadline (for example 90s, 5m, or 1h; bare numbers are seconds); it does not cancel provider work"
47988
48055
  ).option(
47989
48056
  "--output-format <format>",
47990
48057
  "Output format: auto, csv, csv_file, json, or json_file"
@@ -49609,6 +49676,7 @@ async function executeTool(args) {
49609
49676
  return 2;
49610
49677
  }
49611
49678
  const rawResponse = await client2.executeTool(parsed.toolId, parsed.params, {
49679
+ ...parsed.timeoutMs !== void 0 ? { timeout: parsed.timeoutMs } : {},
49612
49680
  responseIntent: parsed.outPath || parsed.outputFormat === "csv" || parsed.outputFormat === "csv_file" ? "row_artifact" : "raw",
49613
49681
  ...parsed.timeoutMs !== void 0 ? { timeout: parsed.timeoutMs } : {}
49614
49682
  });