deepline 0.3.121 → 0.3.123

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.
@@ -3063,7 +3063,7 @@ var SDK_RELEASE = {
3063
3063
  // getters keep their established compatibility behavior.
3064
3064
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3065
3065
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3066
- version: "0.3.121",
3066
+ version: "0.3.123",
3067
3067
  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.",
3068
3068
  packageCapabilities: {
3069
3069
  updatePreferences: 1
@@ -6237,6 +6237,11 @@ async function* observeRunEvents(options) {
6237
6237
  }
6238
6238
  }
6239
6239
 
6240
+ // src/types.ts
6241
+ function isStopAllPlayRunsDryRunResult(result) {
6242
+ return "dryRun" in result && result.dryRun === true;
6243
+ }
6244
+
6240
6245
  // ../integration-contracts/theirstack/execution-policy.ts
6241
6246
  var THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS = 135e3;
6242
6247
  var THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS = 6e4 + THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS + 15e3;
@@ -6941,10 +6946,10 @@ var DeeplineClient = class {
6941
6946
  tail: (runId, options2) => this.tailRun(runId, options2),
6942
6947
  logs: (runId, options2) => this.getRunLogs(runId, options2),
6943
6948
  input: (runId) => this.getRunInput(runId),
6944
- rerun: (runId) => this.rerun(runId),
6949
+ rerun: (runId, options2) => this.rerun(runId, options2),
6945
6950
  exportDatasetRows: (input2) => this.getPlaySheetRows(input2),
6946
6951
  stop: (runId, options2) => this.stopRun(runId, options2),
6947
- stopAll: (options2) => this.stopAllRuns(options2)
6952
+ stopAll: ((options2) => this.stopAllRuns(options2))
6948
6953
  };
6949
6954
  this.db = {
6950
6955
  query: (input2) => this.queryDb(input2)
@@ -8460,11 +8465,28 @@ var DeeplineClient = class {
8460
8465
  async getRunInput(runId) {
8461
8466
  return this.http.get(`/api/v2/runs/${encodeURIComponent(runId)}/input`);
8462
8467
  }
8463
- /** Start a fresh run from a prior run's retained input and pinned revision. */
8464
- async rerun(runId) {
8468
+ /**
8469
+ * Start a fresh run from a prior run's retained input and pinned revision.
8470
+ *
8471
+ * Every invocation sends an `Idempotency-Key`. When the caller does not
8472
+ * supply one, a fresh key is generated once per call so the transport's own
8473
+ * network retries converge on a single rerun. Pass the same explicit key
8474
+ * across separate invocations to repeat an ambiguous result safely; a
8475
+ * different key intentionally starts another rerun.
8476
+ */
8477
+ async rerun(runId, options) {
8478
+ const idempotencyKey = options?.idempotencyKey?.trim();
8479
+ if (options?.idempotencyKey !== void 0 && !idempotencyKey) {
8480
+ throw new DeeplineError(
8481
+ "runs.rerun idempotencyKey must not be empty.",
8482
+ void 0,
8483
+ "INVALID_IDEMPOTENCY_KEY"
8484
+ );
8485
+ }
8465
8486
  return this.http.post(
8466
8487
  `/api/v2/runs/${encodeURIComponent(runId)}/rerun`,
8467
- {}
8488
+ {},
8489
+ { "Idempotency-Key": idempotencyKey || globalThis.crypto.randomUUID() }
8468
8490
  );
8469
8491
  }
8470
8492
  /**
@@ -8609,11 +8631,13 @@ var DeeplineClient = class {
8609
8631
  );
8610
8632
  }
8611
8633
  /**
8612
- * Stop every active run visible to the current workspace.
8634
+ * Stop every active run visible to the current workspace, or with
8635
+ * `dryRun: true` enumerate the exact candidates without cancelling anything.
8613
8636
  *
8614
8637
  * This is the SDK equivalent of:
8615
8638
  *
8616
8639
  * ```bash
8640
+ * deepline runs stop-all --dry-run --json
8617
8641
  * deepline runs stop-all --reason "stale lock" --json
8618
8642
  * ```
8619
8643
  *
@@ -8621,10 +8645,22 @@ var DeeplineClient = class {
8621
8645
  * need to clear the workspace run-slot state without knowing each run id.
8622
8646
  */
8623
8647
  async stopAllRuns(options) {
8624
- return this.http.post(
8648
+ const dryRun = options?.dryRun === true;
8649
+ const result = await this.http.post(
8625
8650
  "/api/v2/runs/stop-all",
8626
- options?.reason ? { reason: options.reason } : {}
8651
+ {
8652
+ ...options?.reason ? { reason: options.reason } : {},
8653
+ ...dryRun ? { dryRun: true } : {}
8654
+ }
8627
8655
  );
8656
+ if (dryRun && !isStopAllPlayRunsDryRunResult(result)) {
8657
+ throw new DeeplineError(
8658
+ "This Deepline server does not support runs stop-all --dry-run and performed a real stop-all. Update the server before using --dry-run.",
8659
+ void 0,
8660
+ "STOP_ALL_DRY_RUN_UNSUPPORTED"
8661
+ );
8662
+ }
8663
+ return result;
8628
8664
  }
8629
8665
  /**
8630
8666
  * List one page of callable plays; grep retains exhaustive matching results.
@@ -24513,6 +24549,77 @@ function authoredPackageStackFrames(packaged) {
24513
24549
  (line) => !line.includes("/virtual/deepline-plays/") && !line.includes("/apps/play-runner/") && !line.includes("/shared_libs/play-runtime/") && !line.includes("node:internal")
24514
24550
  ).slice(0, 5);
24515
24551
  }
24552
+ function activityTargetLabel(target) {
24553
+ const kind = typeof target.kind === "string" ? target.kind : "target";
24554
+ const label = typeof target.label === "string" ? target.label.trim() : "";
24555
+ if (label) return `${kind} ${label}`;
24556
+ switch (kind) {
24557
+ case "provider":
24558
+ return `provider ${String(target.provider ?? "?")} ${String(target.operation ?? "?")}`;
24559
+ case "dataset":
24560
+ return `dataset ${String(target.tableNamespace ?? "?")} (${String(target.operation ?? "?")})`;
24561
+ case "lease":
24562
+ return `${String(target.resourceKind ?? "resource")} lease ${String(target.resourceLabel ?? "?")}`;
24563
+ case "runner":
24564
+ return `runner ${String(target.backend ?? "?")}`;
24565
+ case "step":
24566
+ return `step ${String(target.stepId ?? "?")}`;
24567
+ case "capacity":
24568
+ return `${String(target.pool ?? "?")} capacity`;
24569
+ default:
24570
+ return kind;
24571
+ }
24572
+ }
24573
+ function activityIsoTimestamp(value) {
24574
+ return typeof value === "number" || typeof value === "string" ? isoTimestamp(value) : null;
24575
+ }
24576
+ function buildRunActivityTextLines(run) {
24577
+ const activity = readRecord(run.activity);
24578
+ const observation = readRecord(activity?.observation);
24579
+ const state = readRecord(observation?.state);
24580
+ const target = readRecord(observation?.target);
24581
+ if (!activity || !observation || !state) return [];
24582
+ const kind = typeof state.kind === "string" ? state.kind : "unknown";
24583
+ if (kind === "completed") return [];
24584
+ const summary = typeof activity.summary === "string" && activity.summary.trim() ? activity.summary.trim() : null;
24585
+ const unclassified = activity.classified === false;
24586
+ const lines = [];
24587
+ lines.push(
24588
+ ` activity: ${kind}${summary ? ` \u2014 ${summary}` : ""}${unclassified ? " (unclassified evidence; may be stale)" : ""}`
24589
+ );
24590
+ if (target) lines.push(` target: ${activityTargetLabel(target)}`);
24591
+ if (typeof observation.stepId === "string" && observation.stepId.trim()) {
24592
+ lines.push(` step: ${observation.stepId.trim()}`);
24593
+ }
24594
+ const reason = readRecord(state.reason);
24595
+ if (kind === "retrying") {
24596
+ const attempt = typeof state.attempt === "number" ? ` (attempt ${state.attempt})` : "";
24597
+ const why = typeof state.reason === "string" ? ` after ${state.reason}` : "";
24598
+ lines.push(
24599
+ ` next retry: ${activityIsoTimestamp(state.retryAt) ?? "unknown"}${why}${attempt}`
24600
+ );
24601
+ } else if (kind === "scheduled") {
24602
+ lines.push(
24603
+ ` resumes: ${activityIsoTimestamp(state.resumeAt) ?? "unknown"}`
24604
+ );
24605
+ } else if (kind === "waiting" && reason) {
24606
+ if (reason.kind === "external_event") {
24607
+ const deadline = activityIsoTimestamp(reason.deadlineAt);
24608
+ if (deadline) lines.push(` deadline: ${deadline}`);
24609
+ if (typeof reason.eventKey === "string" && reason.eventKey.trim()) {
24610
+ lines.push(` event key: ${reason.eventKey.trim()}`);
24611
+ }
24612
+ } else if (reason.kind === "lease") {
24613
+ const expires = activityIsoTimestamp(reason.expiresAt);
24614
+ if (expires) lines.push(` lease expires: ${expires}`);
24615
+ } else if (reason.kind === "unknown") {
24616
+ lines.push(" wait reason: unknown (legacy producer)");
24617
+ }
24618
+ }
24619
+ const observedAt = activityIsoTimestamp(observation.observedAt);
24620
+ if (observedAt) lines.push(` observed: ${observedAt}`);
24621
+ return lines;
24622
+ }
24516
24623
  function buildRunPackageTextLines(packaged) {
24517
24624
  const run = readRunPackageRun(packaged);
24518
24625
  const runId = typeof run.id === "string" ? run.id : "unknown";
@@ -24563,6 +24670,7 @@ function buildRunPackageTextLines(packaged) {
24563
24670
  if (playName) {
24564
24671
  lines.push(` play: ${playName}`);
24565
24672
  }
24673
+ lines.push(...buildRunActivityTextLines(run));
24566
24674
  lines.push(...formatPackageValueOutputLines(packaged));
24567
24675
  lines.push(...formatPackageDatasetActionLines(packaged));
24568
24676
  const next = packaged.next && typeof packaged.next === "object" && !Array.isArray(packaged.next) ? packaged.next : {};
@@ -24706,6 +24814,11 @@ function writePlayResult(status, jsonOutput, options) {
24706
24814
  const displayError = formatPlayErrorForDisplay(status, progressError) ?? progressError;
24707
24815
  lines.push(` error: ${truncateErrorForDisplay(displayError, runId)}`);
24708
24816
  }
24817
+ lines.push(
24818
+ ...buildRunActivityTextLines(
24819
+ readRecord(status.run) ?? {}
24820
+ )
24821
+ );
24709
24822
  if (status.status === "failed") {
24710
24823
  const failedLogEntries = status.failedLogs?.entries ?? [];
24711
24824
  if (failedLogEntries.length > 0) {
@@ -26876,7 +26989,7 @@ function parseRunIdPositional(args, usage) {
26876
26989
  continue;
26877
26990
  }
26878
26991
  if (arg.startsWith("--log-level=")) continue;
26879
- if ((arg === "--out" || arg === "--reason" || arg === "--dataset") && args[index + 1]) {
26992
+ if ((arg === "--out" || arg === "--reason" || arg === "--dataset" || arg === "--idempotency-key") && args[index + 1]) {
26880
26993
  index += 1;
26881
26994
  continue;
26882
26995
  }
@@ -26911,7 +27024,7 @@ async function handleRunGet(args) {
26911
27024
  return 0;
26912
27025
  }
26913
27026
  async function handleRunsRerun(args) {
26914
- const usage = "Usage: deepline runs rerun <run-id> [--json]";
27027
+ const usage = "Usage: deepline runs rerun <run-id> [--idempotency-key <key>] [--json]";
26915
27028
  let runId;
26916
27029
  try {
26917
27030
  runId = parseRunIdPositional(args, usage);
@@ -26919,16 +27032,33 @@ async function handleRunsRerun(args) {
26919
27032
  console.error(error instanceof Error ? error.message : usage);
26920
27033
  return 1;
26921
27034
  }
26922
- const result = await new DeeplineClient().runs.rerun(runId);
27035
+ let idempotencyKey;
27036
+ for (let index = 0; index < args.length; index += 1) {
27037
+ if (args[index] === "--idempotency-key") {
27038
+ const value = args[index + 1];
27039
+ if (!value || value.startsWith("--") || !value.trim()) {
27040
+ console.error("--idempotency-key requires a non-empty value.");
27041
+ return 1;
27042
+ }
27043
+ idempotencyKey = value.trim();
27044
+ index += 1;
27045
+ }
27046
+ }
27047
+ const result = await new DeeplineClient().runs.rerun(runId, {
27048
+ ...idempotencyKey ? { idempotencyKey } : {}
27049
+ });
26923
27050
  if (argsWantJson(args)) {
26924
27051
  printCommandEnvelope(result, { json: true });
26925
27052
  } else {
26926
- console.log(`
26927
- Rerun started from ${runId}.`);
27053
+ console.log(
27054
+ result.deduplicated === true ? `
27055
+ Rerun already exists for ${runId} (matched by idempotency key): ${result.runId}` : `
27056
+ Rerun started from ${runId}.`
27057
+ );
26928
27058
  console.log(` inspect: deepline runs get ${result.runId} --json`);
26929
27059
  console.log(` original input: deepline runs get ${result.runId} --input`);
26930
27060
  console.log(
26931
- " This is a fresh run using the original input and pinned revision. Normal tool receipt reuse still applies."
27061
+ result.deduplicated === true ? " No new run was started. Use a different --idempotency-key to start another rerun." : " This is a fresh run using the original input and pinned revision. Normal tool receipt reuse still applies."
26932
27062
  );
26933
27063
  }
26934
27064
  return 0;
@@ -27406,8 +27536,46 @@ async function handleRunStop(args) {
27406
27536
  );
27407
27537
  return 0;
27408
27538
  }
27539
+ function padColumn(value, width) {
27540
+ return value.length >= width ? value : value + " ".repeat(width - value.length);
27541
+ }
27542
+ function buildStopAllDryRunTextLines(result) {
27543
+ const count = result.candidateCount;
27544
+ const lines = [
27545
+ `Dry run: ${count} active run${count === 1 ? "" : "s"} would be stopped`,
27546
+ `Scope: ${result.scope}`,
27547
+ `Includes child runs: ${result.includesChildren ? "yes" : "no"}`
27548
+ ];
27549
+ if (result.runs.length > 0) {
27550
+ const rows = result.runs.map((run) => [
27551
+ run.runId,
27552
+ run.playName ?? "\u2014",
27553
+ run.status ?? "\u2014"
27554
+ ]);
27555
+ const header = ["RUN_ID", "PLAY", "STATUS"];
27556
+ const widths = header.map(
27557
+ (label, column) => Math.max(label.length, ...rows.map((row) => row[column].length))
27558
+ );
27559
+ lines.push("");
27560
+ for (const row of [header, ...rows]) {
27561
+ lines.push(
27562
+ row.map(
27563
+ (cell, column) => column === row.length - 1 ? cell : padColumn(cell, widths[column])
27564
+ ).join(" ")
27565
+ );
27566
+ }
27567
+ }
27568
+ if (result.truncated) {
27569
+ lines.push("");
27570
+ lines.push(
27571
+ `Showing the first ${result.runs.length} matching runs. Results are truncated; no runs were stopped.`
27572
+ );
27573
+ }
27574
+ return lines;
27575
+ }
27409
27576
  async function handleRunStopAll(args) {
27410
27577
  let reason;
27578
+ const dryRun = args.includes("--dry-run");
27411
27579
  for (let index = 0; index < args.length; index += 1) {
27412
27580
  const arg = args[index];
27413
27581
  if (arg === "--reason" && args[index + 1]) {
@@ -27415,6 +27583,21 @@ async function handleRunStopAll(args) {
27415
27583
  }
27416
27584
  }
27417
27585
  const client2 = new DeeplineClient();
27586
+ if (dryRun) {
27587
+ const result2 = await client2.runs.stopAll({ dryRun: true, reason });
27588
+ const lines2 = buildStopAllDryRunTextLines(result2);
27589
+ printCommandEnvelope(
27590
+ {
27591
+ ...result2,
27592
+ render: {
27593
+ sections: [{ title: "workspace stop-all (dry run)", lines: lines2 }]
27594
+ }
27595
+ },
27596
+ { json: argsWantJson(args), text: `${lines2.join("\n")}
27597
+ ` }
27598
+ );
27599
+ return 0;
27600
+ }
27418
27601
  const result = await client2.runs.stopAll({ reason });
27419
27602
  const lines = [
27420
27603
  `Stopped ${result.stopped} active run${result.stopped === 1 ? "" : "s"}`,
@@ -29183,13 +29366,23 @@ Notes:
29183
29366
  The rerun uses the original input and exact saved revision. Normal completed
29184
29367
  tool receipts may be reused; inspect the new run before forcing any external
29185
29368
  side effect.
29369
+ Every call sends an Idempotency-Key. Pass --idempotency-key to reuse the
29370
+ same key across separate invocations (for example after an ambiguous or
29371
+ lost response): the same source run and key always resolve to the same
29372
+ rerun, and the JSON result reports deduplicated: true when nothing new was
29373
+ started. A different key intentionally starts another rerun.
29186
29374
 
29187
29375
  Examples:
29188
29376
  deepline runs rerun play/my-play/webhook/abc --json
29377
+ deepline runs rerun play/my-play/webhook/abc --idempotency-key incident-42 --json
29189
29378
  `
29379
+ ).option(
29380
+ "--idempotency-key <key>",
29381
+ "Reuse this key so repeated calls resolve to one rerun"
29190
29382
  ).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (runId, options) => {
29191
29383
  process.exitCode = await handleRunsRerun([
29192
29384
  runId,
29385
+ ...options.idempotencyKey ? ["--idempotency-key", options.idempotencyKey] : [],
29193
29386
  ...options.json ? ["--json"] : []
29194
29387
  ]);
29195
29388
  });
@@ -29220,14 +29413,24 @@ Examples:
29220
29413
  `
29221
29414
  Notes:
29222
29415
  Stops all active runs visible to this workspace, including child runs created by ctx.runPlay.
29416
+ --dry-run lists the exact candidates (same scope, statuses, and order) and
29417
+ never cancels or mutates anything. A real stop-all exits nonzero when any
29418
+ cancellation failed or the candidate list was truncated; failed runs stay
29419
+ active and are reported truthfully.
29223
29420
 
29224
29421
  Examples:
29422
+ deepline runs stop-all --dry-run
29423
+ deepline runs stop-all --dry-run --json
29225
29424
  deepline runs stop-all --reason "unjam workspace"
29226
29425
  deepline runs stop-all --json
29227
29426
  `
29228
- ).option("--reason <text>", "Reason to include with each stop request").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (options) => {
29427
+ ).option("--reason <text>", "Reason to include with each stop request").option(
29428
+ "--dry-run",
29429
+ "List the runs that would be stopped without cancelling anything"
29430
+ ).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (options) => {
29229
29431
  process.exitCode = await handleRunStopAll([
29230
29432
  ...options.reason ? ["--reason", options.reason] : [],
29433
+ ...options.dryRun ? ["--dry-run"] : [],
29231
29434
  ...options.json ? ["--json"] : []
29232
29435
  ]);
29233
29436
  });
package/dist/index.d.mts CHANGED
@@ -1899,15 +1899,80 @@ interface StopPlayRunResult {
1899
1899
  /** Server-side error detail when the stop was not confirmed. */
1900
1900
  error?: string;
1901
1901
  }
1902
- interface StopAllPlayRunsResult {
1902
+ /**
1903
+ * Result of an actual workspace stop-all. `stopped` counts only runs whose
1904
+ * scheduler cancellation was confirmed; a run whose cancel failed stays active
1905
+ * and is counted in `failed`.
1906
+ */
1907
+ interface StopAllPlayRunsStopResult {
1903
1908
  stopped: number;
1904
1909
  failed: number;
1905
1910
  skipped: number;
1911
+ /** True when the bounded candidate query may have left active runs behind. */
1906
1912
  partial?: boolean;
1907
1913
  runs: Array<StopPlayRunResult & {
1908
1914
  status?: string | null;
1909
1915
  }>;
1910
1916
  }
1917
+ /** Options for {@link DeeplineClient.rerun} / `runs.rerun`. */
1918
+ interface RerunOptions {
1919
+ /**
1920
+ * Caller-chosen key sent as `Idempotency-Key`. The same source run and key
1921
+ * always resolve to the same rerun; omit it to let the SDK generate one key
1922
+ * per invocation.
1923
+ */
1924
+ idempotencyKey?: string;
1925
+ }
1926
+ /** Result of {@link DeeplineClient.rerun} / `runs.rerun`. */
1927
+ interface RerunPlayRunResult {
1928
+ /** The rerun's public play-run id. */
1929
+ runId: string;
1930
+ /** The source run whose retained input and revision were replayed. */
1931
+ replayedFromRunId: string;
1932
+ revisionId: string | null;
1933
+ status: string;
1934
+ /**
1935
+ * True when the server returned an already-admitted rerun for this source
1936
+ * run and idempotency key instead of starting another. Absent on older
1937
+ * servers.
1938
+ */
1939
+ deduplicated?: boolean;
1940
+ next: {
1941
+ inspect: string;
1942
+ input: string;
1943
+ };
1944
+ }
1945
+ /** One active run that a workspace stop-all would target. */
1946
+ interface StopAllCandidate {
1947
+ /** Public play-run id. */
1948
+ runId: string;
1949
+ /** Saved play name for the run, when known. */
1950
+ playName: string | null;
1951
+ /** Current durable status (`running`, `queued`, or `waiting`). */
1952
+ status: string | null;
1953
+ /** Parent play-run id when this is a child run; null for root runs. */
1954
+ parentRunId: string | null;
1955
+ }
1956
+ /**
1957
+ * Result of `runs.stopAll({ dryRun: true })`. Nothing was cancelled or
1958
+ * mutated; the list is the exact candidate set the real stop-all would target,
1959
+ * in the same parent-before-child order.
1960
+ */
1961
+ interface StopAllPlayRunsDryRunResult {
1962
+ dryRun: true;
1963
+ scope: 'workspace';
1964
+ includesChildren: true;
1965
+ candidateCount: number;
1966
+ /** True when the bounded query hit its limit and more active runs may exist. */
1967
+ truncated: boolean;
1968
+ runs: StopAllCandidate[];
1969
+ }
1970
+ /**
1971
+ * Discriminated result of {@link DeeplineClient.stopAllRuns}: narrow on
1972
+ * `'dryRun' in result` to distinguish an enumeration from an actual stop.
1973
+ */
1974
+ type StopAllPlayRunsResult = StopAllPlayRunsStopResult | StopAllPlayRunsDryRunResult;
1975
+ declare function isStopAllPlayRunsDryRunResult(result: StopAllPlayRunsResult): result is StopAllPlayRunsDryRunResult;
1911
1976
  /**
1912
1977
  * Summary of a single play run, returned by {@link DeeplineClient.listPlayRuns}.
1913
1978
  */
@@ -3191,16 +3256,7 @@ type RunsNamespace = {
3191
3256
  replayedFromRunId: string | null;
3192
3257
  }>;
3193
3258
  /** Start a fresh run from a prior run's retained input and pinned revision. */
3194
- rerun: (runId: string) => Promise<{
3195
- runId: string;
3196
- replayedFromRunId: string;
3197
- revisionId: string | null;
3198
- status: string;
3199
- next: {
3200
- inspect: string;
3201
- input: string;
3202
- };
3203
- }>;
3259
+ rerun: (runId: string, options?: RerunOptions) => Promise<RerunPlayRunResult>;
3204
3260
  /** List runs for one play, optionally filtered by status. */
3205
3261
  list: (options: RunsListOptions) => Promise<PlayRunListItem[]>;
3206
3262
  /** Read one run page with total, offset, limit and completeness metadata. */
@@ -3222,10 +3278,26 @@ type RunsNamespace = {
3222
3278
  stop: (runId: string, options?: {
3223
3279
  reason?: string;
3224
3280
  }) => Promise<StopPlayRunResult>;
3225
- /** Stop active runs across the current workspace. */
3226
- stopAll: (options?: {
3227
- reason?: string;
3228
- }) => Promise<StopAllPlayRunsResult>;
3281
+ /**
3282
+ * Stop active runs across the current workspace, or with `dryRun: true`
3283
+ * enumerate the exact candidates without cancelling anything.
3284
+ */
3285
+ stopAll: {
3286
+ (options: StopAllRunsOptions & {
3287
+ dryRun: true;
3288
+ }): Promise<StopAllPlayRunsDryRunResult>;
3289
+ (options?: StopAllRunsOptions & {
3290
+ dryRun?: false;
3291
+ }): Promise<StopAllPlayRunsStopResult>;
3292
+ (options?: StopAllRunsOptions): Promise<StopAllPlayRunsResult>;
3293
+ };
3294
+ };
3295
+ /** Options for {@link RunsNamespace.stopAll} / {@link DeeplineClient.stopAllRuns}. */
3296
+ type StopAllRunsOptions = {
3297
+ /** Enumerate the candidate runs without cancelling or mutating anything. */
3298
+ dryRun?: boolean;
3299
+ /** Reason recorded with each stop request. Ignored by a dry run. */
3300
+ reason?: string;
3229
3301
  };
3230
3302
  /** Current mutable customer database namespace exposed as `client.db`. */
3231
3303
  type DbNamespace = {
@@ -4875,17 +4947,16 @@ declare class DeeplineClient {
4875
4947
  sha256: string | null;
4876
4948
  replayedFromRunId: string | null;
4877
4949
  }>;
4878
- /** Start a fresh run from a prior run's retained input and pinned revision. */
4879
- rerun(runId: string): Promise<{
4880
- runId: string;
4881
- replayedFromRunId: string;
4882
- revisionId: string | null;
4883
- status: string;
4884
- next: {
4885
- inspect: string;
4886
- input: string;
4887
- };
4888
- }>;
4950
+ /**
4951
+ * Start a fresh run from a prior run's retained input and pinned revision.
4952
+ *
4953
+ * Every invocation sends an `Idempotency-Key`. When the caller does not
4954
+ * supply one, a fresh key is generated once per call so the transport's own
4955
+ * network retries converge on a single rerun. Pass the same explicit key
4956
+ * across separate invocations to repeat an ambiguous result safely; a
4957
+ * different key intentionally starts another rerun.
4958
+ */
4959
+ rerun(runId: string, options?: RerunOptions): Promise<RerunPlayRunResult>;
4889
4960
  /**
4890
4961
  * Fetch persisted logs for a run using the public runs resource model.
4891
4962
  *
@@ -4922,21 +4993,16 @@ declare class DeeplineClient {
4922
4993
  stopRun(runId: string, options?: {
4923
4994
  reason?: string;
4924
4995
  }): Promise<StopPlayRunResult>;
4925
- /**
4926
- * Stop every active run visible to the current workspace.
4927
- *
4928
- * This is the SDK equivalent of:
4929
- *
4930
- * ```bash
4931
- * deepline runs stop-all --reason "stale lock" --json
4932
- * ```
4933
- *
4934
- * Use this when a failed parent run left child or waiting runs active and you
4935
- * need to clear the workspace run-slot state without knowing each run id.
4936
- */
4937
- stopAllRuns(options?: {
4938
- reason?: string;
4939
- }): Promise<StopAllPlayRunsResult>;
4996
+ /** Enumerate the runs a stop-all would target without cancelling any. */
4997
+ stopAllRuns(options: StopAllRunsOptions & {
4998
+ dryRun: true;
4999
+ }): Promise<StopAllPlayRunsDryRunResult>;
5000
+ /** Stop every active run visible to the current workspace. */
5001
+ stopAllRuns(options?: StopAllRunsOptions & {
5002
+ dryRun?: false;
5003
+ }): Promise<StopAllPlayRunsStopResult>;
5004
+ /** Stop, or with `dryRun: true` only enumerate, active workspace runs. */
5005
+ stopAllRuns(options?: StopAllRunsOptions): Promise<StopAllPlayRunsResult>;
4940
5006
  /**
4941
5007
  * List one page of callable plays; grep retains exhaustive matching results.
4942
5008
  * Use listPlaysPage to retain pagination metadata.
@@ -6447,4 +6513,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
6447
6513
  */
6448
6514
  declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
6449
6515
 
6450
- export { type AsyncPlayRunRef, AuthError, type BillingCreditPool, type BillingInvoiceEntry, type BillingInvoicesResult, type BillingNamespace, type BillingPaymentMethodSummary, type BillingSubscriptionCancelResult, type BillingSubscriptionStatus, type BillingTopUpResult, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CreateNotificationGroupInput, type CreateNotificationGroupResult, type CsvInput, type CsvOptions, type CustomerDbQueryResult, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, type DatasetColumnDefinition, type DatasetColumnRunInput, type DbNamespace, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, DeeplineError, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplinePlaysNamespace, type DeeplineToolCategory, type DeeplineToolsNamespace, type DefinePlayConfig, type DefinedPlay, type FetchOptions, type FileInput, type IngestionStorageRepairResult, type LegacyMonitorStatusFilter, type LiveEventEnvelope, MONITOR_JOB_PHASES, MONITOR_JOB_RECONCILIATION_STATES, MONITOR_JOB_STATES, type MonitorBatchNamespace, type MonitorCheckResult, type MonitorDefinition, type MonitorDeleteResult, type MonitorDependents, type MonitorDeployResult, type MonitorDetail, type MonitorFleetDeactivateOptions, MonitorFleetDefinition, type MonitorFleetGetOptions, type MonitorFleetReactivateOptions, type MonitorFleetResult, type MonitorFleetStatus, type MonitorFleetSyncOptions, type MonitorFleetWaitOptions, type MonitorFleetsNamespace, type MonitorJobDeployOptions, type MonitorJobLogsOptions, type MonitorJobPhase, type MonitorJobReconciliationState, type MonitorJobResult, type MonitorJobState, type MonitorJobWaitOptions, type MonitorJobsNamespace, type MonitorListEntry, type MonitorPayload, type MonitorReactivateResult, type MonitorSpec, type MonitorState, type MonitorStateFilter, type MonitorUpdateChangeSummary, type MonitorUpdateResult, type MonitorsAccessStatus, type MonitorsAvailableOptions, type MonitorsAvailableResult, type MonitorsListOptions, type MonitorsListResult, type MonitorsNamespace, PLAY_BOOTSTRAP_COMPANY_FIELDS, PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_CONTACT_FIELDS, PLAY_BOOTSTRAP_FINDER_KINDS, PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER, PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER, PLAY_BOOTSTRAP_SOURCE_KINDS, PLAY_BOOTSTRAP_STAGE_KINDS, PLAY_BOOTSTRAP_TEMPLATES, PROD_URL, type PlayActivityObservation, type PlayActivityState, type PlayActivityTarget, type PlayAsyncCallOptions, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayCallExecution, type PlayCallOptions, type PlayCostEstimate, type PlayFetchResponse, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayReferenceLike, type PlayRevisionSummary, type PlayRunActionPackage, type PlayRunActivityProjection, type PlayRunDatasetActions, type PlayRunId, type PlayRunPackage, type PlayRunResult, type PlayRunStart, type PlaySheetRow, type PlaySheetRowsResult, type PlayStatus, type PlayStepProgramStep, type PlaysListOptions, type PlaysListPage, type PrebuiltPlayRef, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, RunObserveTransportUnavailableError, type RunsListOptions, type RunsListPage, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, type RuntimeStepOptions, SDK_API_CONTRACT, SDK_VERSION, type SqlListenerDeclaration, type SqlListenerEvent, type SqlListenerOperation, type SqlQuery, type StartPlayRunRequest, type StepOptions, type StepProgram, type StepProgramResolver, type StepResolver, type StopPlayRunResult, type ToolDefinition, ToolExecuteResult, type ToolExecution, ToolExecutionError, ToolExecutionErrorOptions, type ToolExecutionRequest, type ToolMetadata, ToolRateLimitError, ToolResultBilling, type ToolSearchOptions, type ToolSearchResult, type WorkspaceCreateResult, type WorkspacesNamespace, defineInput, defineMonitor, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
6516
+ export { type AsyncPlayRunRef, AuthError, type BillingCreditPool, type BillingInvoiceEntry, type BillingInvoicesResult, type BillingNamespace, type BillingPaymentMethodSummary, type BillingSubscriptionCancelResult, type BillingSubscriptionStatus, type BillingTopUpResult, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CreateNotificationGroupInput, type CreateNotificationGroupResult, type CsvInput, type CsvOptions, type CustomerDbQueryResult, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, type DatasetColumnDefinition, type DatasetColumnRunInput, type DbNamespace, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, DeeplineError, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplinePlaysNamespace, type DeeplineToolCategory, type DeeplineToolsNamespace, type DefinePlayConfig, type DefinedPlay, type FetchOptions, type FileInput, type IngestionStorageRepairResult, type LegacyMonitorStatusFilter, type LiveEventEnvelope, MONITOR_JOB_PHASES, MONITOR_JOB_RECONCILIATION_STATES, MONITOR_JOB_STATES, type MonitorBatchNamespace, type MonitorCheckResult, type MonitorDefinition, type MonitorDeleteResult, type MonitorDependents, type MonitorDeployResult, type MonitorDetail, type MonitorFleetDeactivateOptions, MonitorFleetDefinition, type MonitorFleetGetOptions, type MonitorFleetReactivateOptions, type MonitorFleetResult, type MonitorFleetStatus, type MonitorFleetSyncOptions, type MonitorFleetWaitOptions, type MonitorFleetsNamespace, type MonitorJobDeployOptions, type MonitorJobLogsOptions, type MonitorJobPhase, type MonitorJobReconciliationState, type MonitorJobResult, type MonitorJobState, type MonitorJobWaitOptions, type MonitorJobsNamespace, type MonitorListEntry, type MonitorPayload, type MonitorReactivateResult, type MonitorSpec, type MonitorState, type MonitorStateFilter, type MonitorUpdateChangeSummary, type MonitorUpdateResult, type MonitorsAccessStatus, type MonitorsAvailableOptions, type MonitorsAvailableResult, type MonitorsListOptions, type MonitorsListResult, type MonitorsNamespace, PLAY_BOOTSTRAP_COMPANY_FIELDS, PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_CONTACT_FIELDS, PLAY_BOOTSTRAP_FINDER_KINDS, PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER, PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER, PLAY_BOOTSTRAP_SOURCE_KINDS, PLAY_BOOTSTRAP_STAGE_KINDS, PLAY_BOOTSTRAP_TEMPLATES, PROD_URL, type PlayActivityObservation, type PlayActivityState, type PlayActivityTarget, type PlayAsyncCallOptions, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayCallExecution, type PlayCallOptions, type PlayCostEstimate, type PlayFetchResponse, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayReferenceLike, type PlayRevisionSummary, type PlayRunActionPackage, type PlayRunActivityProjection, type PlayRunDatasetActions, type PlayRunId, type PlayRunPackage, type PlayRunResult, type PlayRunStart, type PlaySheetRow, type PlaySheetRowsResult, type PlayStatus, type PlayStepProgramStep, type PlaysListOptions, type PlaysListPage, type PrebuiltPlayRef, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type RerunOptions, type RerunPlayRunResult, type ResolvedConfig, RunObserveTransportUnavailableError, type RunsListOptions, type RunsListPage, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, type RuntimeStepOptions, SDK_API_CONTRACT, SDK_VERSION, type SqlListenerDeclaration, type SqlListenerEvent, type SqlListenerOperation, type SqlQuery, type StartPlayRunRequest, type StepOptions, type StepProgram, type StepProgramResolver, type StepResolver, type StopAllCandidate, type StopAllPlayRunsDryRunResult, type StopAllPlayRunsResult, type StopAllPlayRunsStopResult, type StopAllRunsOptions, type StopPlayRunResult, type ToolDefinition, ToolExecuteResult, type ToolExecution, ToolExecutionError, ToolExecutionErrorOptions, type ToolExecutionRequest, type ToolMetadata, ToolRateLimitError, ToolResultBilling, type ToolSearchOptions, type ToolSearchResult, type WorkspaceCreateResult, type WorkspacesNamespace, defineInput, defineMonitor, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, isStopAllPlayRunsDryRunResult, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };