deepline 0.3.122 → 0.3.124

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.
package/dist/index.d.ts 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.
@@ -5398,6 +5464,7 @@ declare class DeeplineClient {
5398
5464
  reactivateMonitor(key: string, options?: {
5399
5465
  dryRun?: boolean;
5400
5466
  }): Promise<MonitorReactivateResult>;
5467
+ private static readonly MONITOR_JOB_IDEMPOTENCY_KEY_MAX_LENGTH;
5401
5468
  private monitorJobIdempotencyKey;
5402
5469
  private monitorJobHeaders;
5403
5470
  deployMonitorBatch(definitions: MonitorDefinition[], options?: MonitorJobDeployOptions): Promise<MonitorJobResult>;
@@ -6447,4 +6514,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
6447
6514
  */
6448
6515
  declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
6449
6516
 
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 };
6517
+ 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 };
package/dist/index.js CHANGED
@@ -87,6 +87,7 @@ __export(src_exports, {
87
87
  isPlayBootstrapTemplate: () => isPlayBootstrapTemplate,
88
88
  isProviderUnavailable: () => isProviderUnavailable,
89
89
  isProviderWaterfallUnavailableError: () => isProviderWaterfallUnavailableError,
90
+ isStopAllPlayRunsDryRunResult: () => isStopAllPlayRunsDryRunResult,
90
91
  lintMonitorBatchInput: () => lintMonitorBatchInput,
91
92
  lintMonitorFleetInput: () => lintMonitorFleetInput,
92
93
  lintMonitorSpecTemplate: () => lintMonitorSpecTemplate,
@@ -863,7 +864,7 @@ var SDK_RELEASE = {
863
864
  // getters keep their established compatibility behavior.
864
865
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
865
866
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
866
- version: "0.3.122",
867
+ version: "0.3.124",
867
868
  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.",
868
869
  packageCapabilities: {
869
870
  updatePreferences: 1
@@ -3894,6 +3895,11 @@ async function* observeRunEvents(options) {
3894
3895
  }
3895
3896
  }
3896
3897
 
3898
+ // src/types.ts
3899
+ function isStopAllPlayRunsDryRunResult(result) {
3900
+ return "dryRun" in result && result.dryRun === true;
3901
+ }
3902
+
3897
3903
  // ../integration-contracts/theirstack/execution-policy.ts
3898
3904
  var THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS = 135e3;
3899
3905
  var THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS = 6e4 + THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS + 15e3;
@@ -4587,7 +4593,7 @@ function playRunStatusFromState(state) {
4587
4593
  ..."result" in state ? { result: state.result } : {}
4588
4594
  };
4589
4595
  }
4590
- var DeeplineClient = class {
4596
+ var DeeplineClient = class _DeeplineClient {
4591
4597
  http;
4592
4598
  config;
4593
4599
  /** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
@@ -4619,10 +4625,10 @@ var DeeplineClient = class {
4619
4625
  tail: (runId, options2) => this.tailRun(runId, options2),
4620
4626
  logs: (runId, options2) => this.getRunLogs(runId, options2),
4621
4627
  input: (runId) => this.getRunInput(runId),
4622
- rerun: (runId) => this.rerun(runId),
4628
+ rerun: (runId, options2) => this.rerun(runId, options2),
4623
4629
  exportDatasetRows: (input) => this.getPlaySheetRows(input),
4624
4630
  stop: (runId, options2) => this.stopRun(runId, options2),
4625
- stopAll: (options2) => this.stopAllRuns(options2)
4631
+ stopAll: ((options2) => this.stopAllRuns(options2))
4626
4632
  };
4627
4633
  this.db = {
4628
4634
  query: (input) => this.queryDb(input)
@@ -6138,11 +6144,28 @@ var DeeplineClient = class {
6138
6144
  async getRunInput(runId) {
6139
6145
  return this.http.get(`/api/v2/runs/${encodeURIComponent(runId)}/input`);
6140
6146
  }
6141
- /** Start a fresh run from a prior run's retained input and pinned revision. */
6142
- async rerun(runId) {
6147
+ /**
6148
+ * Start a fresh run from a prior run's retained input and pinned revision.
6149
+ *
6150
+ * Every invocation sends an `Idempotency-Key`. When the caller does not
6151
+ * supply one, a fresh key is generated once per call so the transport's own
6152
+ * network retries converge on a single rerun. Pass the same explicit key
6153
+ * across separate invocations to repeat an ambiguous result safely; a
6154
+ * different key intentionally starts another rerun.
6155
+ */
6156
+ async rerun(runId, options) {
6157
+ const idempotencyKey = options?.idempotencyKey?.trim();
6158
+ if (options?.idempotencyKey !== void 0 && !idempotencyKey) {
6159
+ throw new DeeplineError(
6160
+ "runs.rerun idempotencyKey must not be empty.",
6161
+ void 0,
6162
+ "INVALID_IDEMPOTENCY_KEY"
6163
+ );
6164
+ }
6143
6165
  return this.http.post(
6144
6166
  `/api/v2/runs/${encodeURIComponent(runId)}/rerun`,
6145
- {}
6167
+ {},
6168
+ { "Idempotency-Key": idempotencyKey || globalThis.crypto.randomUUID() }
6146
6169
  );
6147
6170
  }
6148
6171
  /**
@@ -6287,11 +6310,13 @@ var DeeplineClient = class {
6287
6310
  );
6288
6311
  }
6289
6312
  /**
6290
- * Stop every active run visible to the current workspace.
6313
+ * Stop every active run visible to the current workspace, or with
6314
+ * `dryRun: true` enumerate the exact candidates without cancelling anything.
6291
6315
  *
6292
6316
  * This is the SDK equivalent of:
6293
6317
  *
6294
6318
  * ```bash
6319
+ * deepline runs stop-all --dry-run --json
6295
6320
  * deepline runs stop-all --reason "stale lock" --json
6296
6321
  * ```
6297
6322
  *
@@ -6299,10 +6324,22 @@ var DeeplineClient = class {
6299
6324
  * need to clear the workspace run-slot state without knowing each run id.
6300
6325
  */
6301
6326
  async stopAllRuns(options) {
6302
- return this.http.post(
6327
+ const dryRun = options?.dryRun === true;
6328
+ const result = await this.http.post(
6303
6329
  "/api/v2/runs/stop-all",
6304
- options?.reason ? { reason: options.reason } : {}
6330
+ {
6331
+ ...options?.reason ? { reason: options.reason } : {},
6332
+ ...dryRun ? { dryRun: true } : {}
6333
+ }
6305
6334
  );
6335
+ if (dryRun && !isStopAllPlayRunsDryRunResult(result)) {
6336
+ throw new DeeplineError(
6337
+ "This Deepline server does not support runs stop-all --dry-run and performed a real stop-all. Update the server before using --dry-run.",
6338
+ void 0,
6339
+ "STOP_ALL_DRY_RUN_UNSUPPORTED"
6340
+ );
6341
+ }
6342
+ return result;
6306
6343
  }
6307
6344
  /**
6308
6345
  * List one page of callable plays; grep retains exhaustive matching results.
@@ -7481,9 +7518,16 @@ var DeeplineClient = class {
7481
7518
  // ——————————————————————————————————————————————————————————
7482
7519
  // Monitor Jobs, Batches, and Fleets
7483
7520
  // ——————————————————————————————————————————————————————————
7521
+ static MONITOR_JOB_IDEMPOTENCY_KEY_MAX_LENGTH = 96;
7484
7522
  monitorJobIdempotencyKey(operation) {
7485
- const uuid = globalThis.crypto?.randomUUID?.();
7486
- return `monitor-job-${operation}-${uuid ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`}`;
7523
+ const uuid = globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`;
7524
+ const prefix = "monitor-job-";
7525
+ const safeOperation = operation.replace(/[^A-Za-z0-9._-]/g, "-");
7526
+ const maxOperationLength = Math.max(
7527
+ 0,
7528
+ _DeeplineClient.MONITOR_JOB_IDEMPOTENCY_KEY_MAX_LENGTH - prefix.length - uuid.length - 1
7529
+ );
7530
+ return `${prefix}${safeOperation.slice(0, maxOperationLength)}-${uuid}`;
7487
7531
  }
7488
7532
  monitorJobHeaders(operation, idempotencyKey) {
7489
7533
  return {
@@ -12617,6 +12661,7 @@ function extractSummaryFields(payload) {
12617
12661
  isPlayBootstrapTemplate,
12618
12662
  isProviderUnavailable,
12619
12663
  isProviderWaterfallUnavailableError,
12664
+ isStopAllPlayRunsDryRunResult,
12620
12665
  lintMonitorBatchInput,
12621
12666
  lintMonitorFleetInput,
12622
12667
  lintMonitorSpecTemplate,
package/dist/index.mjs CHANGED
@@ -768,7 +768,7 @@ var SDK_RELEASE = {
768
768
  // getters keep their established compatibility behavior.
769
769
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
770
770
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
771
- version: "0.3.122",
771
+ version: "0.3.124",
772
772
  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.",
773
773
  packageCapabilities: {
774
774
  updatePreferences: 1
@@ -3799,6 +3799,11 @@ async function* observeRunEvents(options) {
3799
3799
  }
3800
3800
  }
3801
3801
 
3802
+ // src/types.ts
3803
+ function isStopAllPlayRunsDryRunResult(result) {
3804
+ return "dryRun" in result && result.dryRun === true;
3805
+ }
3806
+
3802
3807
  // ../integration-contracts/theirstack/execution-policy.ts
3803
3808
  var THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS = 135e3;
3804
3809
  var THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS = 6e4 + THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS + 15e3;
@@ -4492,7 +4497,7 @@ function playRunStatusFromState(state) {
4492
4497
  ..."result" in state ? { result: state.result } : {}
4493
4498
  };
4494
4499
  }
4495
- var DeeplineClient = class {
4500
+ var DeeplineClient = class _DeeplineClient {
4496
4501
  http;
4497
4502
  config;
4498
4503
  /** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
@@ -4524,10 +4529,10 @@ var DeeplineClient = class {
4524
4529
  tail: (runId, options2) => this.tailRun(runId, options2),
4525
4530
  logs: (runId, options2) => this.getRunLogs(runId, options2),
4526
4531
  input: (runId) => this.getRunInput(runId),
4527
- rerun: (runId) => this.rerun(runId),
4532
+ rerun: (runId, options2) => this.rerun(runId, options2),
4528
4533
  exportDatasetRows: (input) => this.getPlaySheetRows(input),
4529
4534
  stop: (runId, options2) => this.stopRun(runId, options2),
4530
- stopAll: (options2) => this.stopAllRuns(options2)
4535
+ stopAll: ((options2) => this.stopAllRuns(options2))
4531
4536
  };
4532
4537
  this.db = {
4533
4538
  query: (input) => this.queryDb(input)
@@ -6043,11 +6048,28 @@ var DeeplineClient = class {
6043
6048
  async getRunInput(runId) {
6044
6049
  return this.http.get(`/api/v2/runs/${encodeURIComponent(runId)}/input`);
6045
6050
  }
6046
- /** Start a fresh run from a prior run's retained input and pinned revision. */
6047
- async rerun(runId) {
6051
+ /**
6052
+ * Start a fresh run from a prior run's retained input and pinned revision.
6053
+ *
6054
+ * Every invocation sends an `Idempotency-Key`. When the caller does not
6055
+ * supply one, a fresh key is generated once per call so the transport's own
6056
+ * network retries converge on a single rerun. Pass the same explicit key
6057
+ * across separate invocations to repeat an ambiguous result safely; a
6058
+ * different key intentionally starts another rerun.
6059
+ */
6060
+ async rerun(runId, options) {
6061
+ const idempotencyKey = options?.idempotencyKey?.trim();
6062
+ if (options?.idempotencyKey !== void 0 && !idempotencyKey) {
6063
+ throw new DeeplineError(
6064
+ "runs.rerun idempotencyKey must not be empty.",
6065
+ void 0,
6066
+ "INVALID_IDEMPOTENCY_KEY"
6067
+ );
6068
+ }
6048
6069
  return this.http.post(
6049
6070
  `/api/v2/runs/${encodeURIComponent(runId)}/rerun`,
6050
- {}
6071
+ {},
6072
+ { "Idempotency-Key": idempotencyKey || globalThis.crypto.randomUUID() }
6051
6073
  );
6052
6074
  }
6053
6075
  /**
@@ -6192,11 +6214,13 @@ var DeeplineClient = class {
6192
6214
  );
6193
6215
  }
6194
6216
  /**
6195
- * Stop every active run visible to the current workspace.
6217
+ * Stop every active run visible to the current workspace, or with
6218
+ * `dryRun: true` enumerate the exact candidates without cancelling anything.
6196
6219
  *
6197
6220
  * This is the SDK equivalent of:
6198
6221
  *
6199
6222
  * ```bash
6223
+ * deepline runs stop-all --dry-run --json
6200
6224
  * deepline runs stop-all --reason "stale lock" --json
6201
6225
  * ```
6202
6226
  *
@@ -6204,10 +6228,22 @@ var DeeplineClient = class {
6204
6228
  * need to clear the workspace run-slot state without knowing each run id.
6205
6229
  */
6206
6230
  async stopAllRuns(options) {
6207
- return this.http.post(
6231
+ const dryRun = options?.dryRun === true;
6232
+ const result = await this.http.post(
6208
6233
  "/api/v2/runs/stop-all",
6209
- options?.reason ? { reason: options.reason } : {}
6234
+ {
6235
+ ...options?.reason ? { reason: options.reason } : {},
6236
+ ...dryRun ? { dryRun: true } : {}
6237
+ }
6210
6238
  );
6239
+ if (dryRun && !isStopAllPlayRunsDryRunResult(result)) {
6240
+ throw new DeeplineError(
6241
+ "This Deepline server does not support runs stop-all --dry-run and performed a real stop-all. Update the server before using --dry-run.",
6242
+ void 0,
6243
+ "STOP_ALL_DRY_RUN_UNSUPPORTED"
6244
+ );
6245
+ }
6246
+ return result;
6211
6247
  }
6212
6248
  /**
6213
6249
  * List one page of callable plays; grep retains exhaustive matching results.
@@ -7386,9 +7422,16 @@ var DeeplineClient = class {
7386
7422
  // ——————————————————————————————————————————————————————————
7387
7423
  // Monitor Jobs, Batches, and Fleets
7388
7424
  // ——————————————————————————————————————————————————————————
7425
+ static MONITOR_JOB_IDEMPOTENCY_KEY_MAX_LENGTH = 96;
7389
7426
  monitorJobIdempotencyKey(operation) {
7390
- const uuid = globalThis.crypto?.randomUUID?.();
7391
- return `monitor-job-${operation}-${uuid ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`}`;
7427
+ const uuid = globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`;
7428
+ const prefix = "monitor-job-";
7429
+ const safeOperation = operation.replace(/[^A-Za-z0-9._-]/g, "-");
7430
+ const maxOperationLength = Math.max(
7431
+ 0,
7432
+ _DeeplineClient.MONITOR_JOB_IDEMPOTENCY_KEY_MAX_LENGTH - prefix.length - uuid.length - 1
7433
+ );
7434
+ return `${prefix}${safeOperation.slice(0, maxOperationLength)}-${uuid}`;
7392
7435
  }
7393
7436
  monitorJobHeaders(operation, idempotencyKey) {
7394
7437
  return {
@@ -12527,6 +12570,7 @@ export {
12527
12570
  isPlayBootstrapTemplate,
12528
12571
  isProviderUnavailable,
12529
12572
  isProviderWaterfallUnavailableError,
12573
+ isStopAllPlayRunsDryRunResult,
12530
12574
  lintMonitorBatchInput,
12531
12575
  lintMonitorFleetInput,
12532
12576
  lintMonitorSpecTemplate,
@@ -65,6 +65,7 @@
65
65
  "dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts",
66
66
  "dist/bundling-sources/shared_libs/monitors/provider-monitor-capability.ts",
67
67
  "dist/bundling-sources/shared_libs/monitors/provider-monitor-consumer-health.ts",
68
+ "dist/bundling-sources/shared_libs/monitors/provider-monitor-control-plane-capability.ts",
68
69
  "dist/bundling-sources/shared_libs/monitors/provider-monitor-errors.ts",
69
70
  "dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts",
70
71
  "dist/bundling-sources/shared_libs/monitors/provider-monitor-legacy-aliases.ts",
@@ -149,7 +149,7 @@ type SdkRelease = {
149
149
  supportPolicy: SdkSupportPolicy;
150
150
  };
151
151
  declare const SDK_RELEASE: {
152
- readonly version: "0.3.122";
152
+ readonly version: "0.3.124";
153
153
  readonly 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.";
154
154
  readonly packageCapabilities: {
155
155
  readonly updatePreferences: 1;
package/dist/release.d.ts CHANGED
@@ -149,7 +149,7 @@ type SdkRelease = {
149
149
  supportPolicy: SdkSupportPolicy;
150
150
  };
151
151
  declare const SDK_RELEASE: {
152
- readonly version: "0.3.122";
152
+ readonly version: "0.3.124";
153
153
  readonly 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.";
154
154
  readonly packageCapabilities: {
155
155
  readonly updatePreferences: 1;
package/dist/release.js CHANGED
@@ -74,7 +74,7 @@ var SDK_RELEASE = {
74
74
  // getters keep their established compatibility behavior.
75
75
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
76
76
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
77
- version: "0.3.122",
77
+ version: "0.3.124",
78
78
  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.",
79
79
  packageCapabilities: {
80
80
  updatePreferences: 1
package/dist/release.mjs CHANGED
@@ -48,7 +48,7 @@ var SDK_RELEASE = {
48
48
  // getters keep their established compatibility behavior.
49
49
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
50
50
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
51
- version: "0.3.122",
51
+ version: "0.3.124",
52
52
  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.",
53
53
  packageCapabilities: {
54
54
  updatePreferences: 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.3.122",
3
+ "version": "0.3.124",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",