deepline 0.1.301 → 0.1.303

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 (40) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +8 -0
  2. package/dist/bundling-sources/sdk/src/errors.ts +96 -36
  3. package/dist/bundling-sources/sdk/src/http.ts +82 -5
  4. package/dist/bundling-sources/sdk/src/index.ts +12 -0
  5. package/dist/bundling-sources/sdk/src/play.ts +29 -1
  6. package/dist/bundling-sources/sdk/src/release.ts +5 -3
  7. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +120 -14
  8. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +10 -0
  9. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +59 -11
  10. package/dist/bundling-sources/shared_libs/play-runtime/execution-ledger-store.ts +3 -3
  11. package/dist/bundling-sources/shared_libs/play-runtime/execution-plan.ts +0 -15
  12. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +3 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +3 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +136 -36
  15. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +17 -12
  16. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +210 -5
  17. package/dist/bundling-sources/shared_libs/play-runtime/tool-result-paths.ts +15 -0
  18. package/dist/bundling-sources/shared_libs/play-runtime/tool-result-types.ts +4 -0
  19. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +33 -24
  20. package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +4 -0
  21. package/dist/bundling-sources/shared_libs/plays/artifact-contract-version.ts +6 -0
  22. package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +4 -0
  23. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +159 -12
  24. package/dist/bundling-sources/shared_libs/plays/contracts.ts +69 -1
  25. package/dist/bundling-sources/shared_libs/tool-execution-error.ts +557 -0
  26. package/dist/cli/index.js +556 -183
  27. package/dist/cli/index.mjs +556 -183
  28. package/dist/index.d.mts +69 -40
  29. package/dist/index.d.ts +69 -40
  30. package/dist/index.js +480 -80
  31. package/dist/index.mjs +477 -80
  32. package/dist/plays/bundle-play-file.d.mts +4 -2
  33. package/dist/plays/bundle-play-file.d.ts +4 -2
  34. package/dist/plays/bundle-play-file.mjs +116 -19
  35. package/dist/tool-execution-error-YDz7UMl-.d.mts +440 -0
  36. package/dist/tool-execution-error-YDz7UMl-.d.ts +440 -0
  37. package/package.json +1 -1
  38. package/dist/bundling-sources/shared_libs/play-runtime/completed-receipt-cache.ts +0 -166
  39. package/dist/compiler-manifest-BjopNIqx.d.mts +0 -240
  40. package/dist/compiler-manifest-BjopNIqx.d.ts +0 -240
package/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
- import { a as PlayCompilerManifest } from './compiler-manifest-BjopNIqx.mjs';
1
+ import { a as PlayCompilerManifest, D as DeeplineError, c as ToolExecutionError, d as ToolExecutionErrorOptions, T as ToolExecutionErrorSchemaVersion } from './tool-execution-error-YDz7UMl-.mjs';
2
+ export { e as ProviderTransientError, f as ProviderTransientErrorCategory, g as ToolExecutionErrorCategory, h as ToolExecutionErrorOrigin, i as ToolExecutionFailureV1, j as ToolExecutionNetworkKind, k as ToolExecutionNetworkScope } from './tool-execution-error-YDz7UMl-.mjs';
2
3
 
3
4
  type PlayRuntimeSelection = {
4
5
  environment: 'preview';
@@ -1587,6 +1588,7 @@ type EnrichStepCommand = {
1587
1588
  functionExpressionSource: string;
1588
1589
  sourceHash: string;
1589
1590
  typeImports: string[];
1591
+ runtimeImports?: string[];
1590
1592
  };
1591
1593
  };
1592
1594
  payload: Record<string, unknown>;
@@ -3166,43 +3168,6 @@ declare const SDK_VERSION: string;
3166
3168
  /** @deprecated Transitional wire id for pre-major-header SDKs only. */
3167
3169
  declare const SDK_API_CONTRACT: string;
3168
3170
 
3169
- /**
3170
- * Base error class for all Deepline SDK errors.
3171
- *
3172
- * Every error thrown by the SDK extends this class, so you can catch all
3173
- * Deepline-specific errors with a single `catch (e) { if (e instanceof DeeplineError) }`.
3174
- *
3175
- * @example
3176
- * ```typescript
3177
- * import { DeeplineClient, DeeplineError, AuthError } from 'deepline';
3178
- *
3179
- * const client = new DeeplineClient();
3180
- * try {
3181
- * await client.executeTool('dropleads_search_people', { query: 'cto' });
3182
- * } catch (err) {
3183
- * if (err instanceof AuthError) {
3184
- * console.error('Bad API key — run: deepline auth register');
3185
- * } else if (err instanceof DeeplineError) {
3186
- * console.error(`API error ${err.statusCode}: ${err.message}`);
3187
- * }
3188
- * }
3189
- * ```
3190
- */
3191
- declare class DeeplineError extends Error {
3192
- /** HTTP status code from the API response, if applicable. */
3193
- statusCode?: number | undefined;
3194
- /** Machine-readable error code (e.g. `'AUTH_ERROR'`, `'RATE_LIMIT'`, `'CONFIG_ERROR'`). */
3195
- code?: string | undefined;
3196
- /** Additional context from the API response body. */
3197
- details?: Record<string, unknown> | undefined;
3198
- constructor(message: string,
3199
- /** HTTP status code from the API response, if applicable. */
3200
- statusCode?: number | undefined,
3201
- /** Machine-readable error code (e.g. `'AUTH_ERROR'`, `'RATE_LIMIT'`, `'CONFIG_ERROR'`). */
3202
- code?: string | undefined,
3203
- /** Additional context from the API response body. */
3204
- details?: Record<string, unknown> | undefined);
3205
- }
3206
3171
  /**
3207
3172
  * Thrown when the API rejects the request due to an invalid or missing API key.
3208
3173
  *
@@ -3224,8 +3189,11 @@ declare class DeeplineError extends Error {
3224
3189
  * }
3225
3190
  * }
3226
3191
  * ```
3192
+ *
3193
+ * @sdkReference errors 090
3227
3194
  */
3228
3195
  declare class AuthError extends DeeplineError {
3196
+ /** Constructed by the SDK when Deepline rejects the caller's credentials. */
3229
3197
  constructor(message?: string);
3230
3198
  }
3231
3199
  /**
@@ -3250,12 +3218,53 @@ declare class AuthError extends DeeplineError {
3250
3218
  * }
3251
3219
  * }
3252
3220
  * ```
3221
+ *
3222
+ * @sdkReference errors 100
3253
3223
  */
3254
3224
  declare class RateLimitError extends DeeplineError {
3255
3225
  /** Milliseconds to wait before retrying, from the `Retry-After` response header. Defaults to 5000. */
3256
3226
  retryAfterMs: number;
3227
+ /** Constructed by the SDK after exhausting HTTP-level rate-limit retries. */
3257
3228
  constructor(retryAfterMs?: number, message?: string);
3258
3229
  }
3230
+ /**
3231
+ * Tool-specific 429 preserving both historical RateLimitError catches and the
3232
+ * structured ToolExecutionError ontology. JavaScript has one prototype chain,
3233
+ * so this class extends RateLimitError and carries ToolExecutionError's stable
3234
+ * cross-bundle brand.
3235
+ *
3236
+ * This class appears in external SDK calls after HTTP 429 retries are
3237
+ * exhausted. It also satisfies `instanceof ToolExecutionError` and, for a
3238
+ * provider-owned rate limit, `instanceof ProviderTransientError`. Authored
3239
+ * Plays should use `ProviderTransientError`; they do not need this
3240
+ * compatibility class.
3241
+ *
3242
+ * @sdkReference errors 110
3243
+ */
3244
+ declare class ToolRateLimitError extends RateLimitError {
3245
+ /** Public tool id passed to `tools.execute`. */
3246
+ readonly toolId: string;
3247
+ /** Provider responsible for the operation, or `null`. */
3248
+ readonly provider: string | null;
3249
+ /** Provider operation name, or `null`. */
3250
+ readonly operation: string | null;
3251
+ /** Stable machine-readable failure code when one exists. */
3252
+ readonly code: string | undefined;
3253
+ /** Boundary responsible for the failure. */
3254
+ readonly origin: ToolExecutionError['origin'];
3255
+ /** Stable reason family for policy and diagnostics. */
3256
+ readonly category: ToolExecutionError['category'];
3257
+ /** Whether repeating the same semantic call is delivery-safe. */
3258
+ readonly retryable: boolean;
3259
+ /** Provider or Deepline request id, or `null`. */
3260
+ readonly requestId: string | null;
3261
+ /** Network failure kind, or `null` for non-network failures. */
3262
+ readonly networkKind: ToolExecutionError['networkKind'];
3263
+ /** Network boundary that failed, or `null` for non-network failures. */
3264
+ readonly networkScope: ToolExecutionError['networkScope'];
3265
+ /** Constructed by the SDK after a structured tool HTTP 429. */
3266
+ constructor(message: string, options: ToolExecutionErrorOptions);
3267
+ }
3259
3268
  /**
3260
3269
  * Thrown when the SDK cannot resolve a valid configuration.
3261
3270
  *
@@ -3274,8 +3283,11 @@ declare class RateLimitError extends DeeplineError {
3274
3283
  * }
3275
3284
  * }
3276
3285
  * ```
3286
+ *
3287
+ * @sdkReference errors 120
3277
3288
  */
3278
3289
  declare class ConfigError extends DeeplineError {
3290
+ /** Construct a local SDK configuration failure. */
3279
3291
  constructor(message: string);
3280
3292
  }
3281
3293
 
@@ -3666,6 +3678,8 @@ type ToolExecuteResultBase<TResult = unknown, TMeta = Record<string, unknown>> =
3666
3678
  count: number | null;
3667
3679
  keys: Record<string, string>;
3668
3680
  }>;
3681
+ /** Original declarations preserve semantic accessor names across replay. */
3682
+ listExtractorPaths?: readonly string[];
3669
3683
  };
3670
3684
  };
3671
3685
  type ToolExecuteResultAccessors<TExtracted extends Record<string, unknown> = Partial<DeeplineGetterValueMap>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = {
@@ -3778,6 +3792,16 @@ type PlayBindings = {
3778
3792
  * older clients can continue to register revisions during the migration.
3779
3793
  */
3780
3794
  description?: string;
3795
+ /**
3796
+ * Public behavior that must remain pinned for this play artifact.
3797
+ *
3798
+ * New plays default to typed tool errors (`1`). Set `toolErrorSchemaVersion`
3799
+ * to `0` only while migrating code that depends on legacy error names,
3800
+ * messages, or classes.
3801
+ */
3802
+ compatibility?: {
3803
+ toolErrorSchemaVersion: ToolExecutionErrorSchemaVersion;
3804
+ };
3781
3805
  /** Allow compilers to bundle this named handler directly without a child run. */
3782
3806
  inline?: boolean;
3783
3807
  /** Optional per-run billing controls enforced by the runtime. */
@@ -4352,7 +4376,7 @@ interface DeeplinePlayRuntimeContext {
4352
4376
  *
4353
4377
  * @sdkReference runtime 140 ctx.runPlay(key, playRef, input, options)
4354
4378
  */
4355
- runPlay<TOutput = unknown>(key: string, playRef: string | PlayReferenceLike, input: Record<string, unknown>, options: PlayCallOptions): Promise<TOutput>;
4379
+ runPlay<TOutput = unknown>(key: string, playRef: string | PlayReferenceLike, input: Record<string, unknown>, options?: PlayCallOptions): Promise<TOutput>;
4356
4380
  /**
4357
4381
  * Emit a log line visible in `play tail` and the play's progress logs.
4358
4382
  *
@@ -4599,6 +4623,8 @@ type DefinePlayConfig<TInput, TOutput extends PlayReturnObject> = {
4599
4623
  bindings?: PlayBindings;
4600
4624
  /** Billing options. */
4601
4625
  billing?: PlayBindings['billing'];
4626
+ /** Runtime compatibility override. Omit for the current typed contract. */
4627
+ compatibility?: PlayBindings['compatibility'];
4602
4628
  };
4603
4629
  declare function steps<TInput>(): StepProgram<TInput, TInput, TInput>;
4604
4630
  declare function runIf<Row, Value>(predicate: (row: Row, index: number) => boolean | Promise<boolean>, resolver: StepResolver<Row, Value>): ConditionalStepResolver<Row, Value, null>;
@@ -4639,6 +4665,8 @@ declare function runIf<Row, Value>(predicate: (row: Row, index: number) => boole
4639
4665
  type DefinedPlay<TInput, TOutput extends PlayReturnObject> = ((ctx: DeeplinePlayRuntimeContext, input: TInput) => Promise<TOutput>) & DeeplineNamedPlay<TInput, TOutput> & {
4640
4666
  /** Optional trigger bindings (cron, webhook). */
4641
4667
  readonly bindings?: PlayBindings;
4668
+ /** Runtime compatibility explicitly selected by the author. */
4669
+ readonly compatibility?: PlayBindings['compatibility'];
4642
4670
  /** The play's name (same as `.name`). */
4643
4671
  readonly playName: string;
4644
4672
  };
@@ -4648,6 +4676,7 @@ type PlayMetadata = {
4648
4676
  bindings?: PlayBindings;
4649
4677
  inputSchema?: Record<string, unknown>;
4650
4678
  billing?: PlayBindings['billing'];
4679
+ compatibility?: PlayBindings['compatibility'];
4651
4680
  };
4652
4681
  /**
4653
4682
  * High-level SDK context with tool shortcuts and play handles.
@@ -5043,4 +5072,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
5043
5072
  */
5044
5073
  declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
5045
5074
 
5046
- export { 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 CsvInput, type CsvOptions, type CustomerDbQueryResult, DEEPLINE_EXTRACTOR_TARGETS, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, type DatasetColumnDefinition, type DatasetColumnRunInput, type DbNamespace, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, type DeeplineEmailStatusGetterValue, DeeplineError, type DeeplineExtractorTarget, type DeeplineGetterValue, type DeeplineGetterValueMap, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplinePlaysNamespace, type DeeplineToolCategory, type DeeplineToolsNamespace, type DefinePlayConfig, type DefinedPlay, type FileInput, type IngestionStorageRepairResult, JOB_CHANGE_STATUS_VALUES, type JobChangeStatus, type LiveEventEnvelope, type MonitorCheckResult, type MonitorControls, type MonitorDefinition, type MonitorDeleteResult, type MonitorDependents, type MonitorDeployResult, type MonitorDetail, type MonitorListEntry, type MonitorPayload, type MonitorReactivateResult, type MonitorUpdateResult, type MonitorsAccessStatus, type MonitorsAvailableOptions, type MonitorsAvailableResult, type MonitorsListOptions, type MonitorsListResult, type MonitorsNamespace, PHONE_STATUS_VALUES, 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 PhoneStatus, type PlayActivityObservation, type PlayActivityState, type PlayActivityTarget, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayCallExecution, type PlayCallOptions, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunActionPackage, type PlayRunActivityProjection, type PlayRunDatasetActions, type PlayRunPackage, type PlayRunResult, type PlayRunStart, type PlaySheetRow, type PlaySheetRowsResult, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PreviousCell, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, RunObserveTransportUnavailableError, type RunsListOptions, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, 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, type ToolExecuteResult, type ToolExecution, type ToolExecutionRequest, type ToolMetadata, type ToolSearchOptions, type ToolSearchResult, defineInput, defineMonitor, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
5075
+ export { 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 CsvInput, type CsvOptions, type CustomerDbQueryResult, DEEPLINE_EXTRACTOR_TARGETS, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, type DatasetColumnDefinition, type DatasetColumnRunInput, type DbNamespace, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, type DeeplineEmailStatusGetterValue, DeeplineError, type DeeplineExtractorTarget, type DeeplineGetterValue, type DeeplineGetterValueMap, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplinePlaysNamespace, type DeeplineToolCategory, type DeeplineToolsNamespace, type DefinePlayConfig, type DefinedPlay, type FileInput, type IngestionStorageRepairResult, JOB_CHANGE_STATUS_VALUES, type JobChangeStatus, type LiveEventEnvelope, type MonitorCheckResult, type MonitorControls, type MonitorDefinition, type MonitorDeleteResult, type MonitorDependents, type MonitorDeployResult, type MonitorDetail, type MonitorListEntry, type MonitorPayload, type MonitorReactivateResult, type MonitorUpdateResult, type MonitorsAccessStatus, type MonitorsAvailableOptions, type MonitorsAvailableResult, type MonitorsListOptions, type MonitorsListResult, type MonitorsNamespace, PHONE_STATUS_VALUES, 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 PhoneStatus, type PlayActivityObservation, type PlayActivityState, type PlayActivityTarget, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayCallExecution, type PlayCallOptions, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunActionPackage, type PlayRunActivityProjection, type PlayRunDatasetActions, type PlayRunPackage, type PlayRunResult, type PlayRunStart, type PlaySheetRow, type PlaySheetRowsResult, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PreviousCell, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, RunObserveTransportUnavailableError, type RunsListOptions, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, 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, type ToolExecuteResult, type ToolExecution, ToolExecutionError, ToolExecutionErrorOptions, type ToolExecutionRequest, type ToolMetadata, ToolRateLimitError, type ToolSearchOptions, type ToolSearchResult, defineInput, defineMonitor, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { a as PlayCompilerManifest } from './compiler-manifest-BjopNIqx.js';
1
+ import { a as PlayCompilerManifest, D as DeeplineError, c as ToolExecutionError, d as ToolExecutionErrorOptions, T as ToolExecutionErrorSchemaVersion } from './tool-execution-error-YDz7UMl-.js';
2
+ export { e as ProviderTransientError, f as ProviderTransientErrorCategory, g as ToolExecutionErrorCategory, h as ToolExecutionErrorOrigin, i as ToolExecutionFailureV1, j as ToolExecutionNetworkKind, k as ToolExecutionNetworkScope } from './tool-execution-error-YDz7UMl-.js';
2
3
 
3
4
  type PlayRuntimeSelection = {
4
5
  environment: 'preview';
@@ -1587,6 +1588,7 @@ type EnrichStepCommand = {
1587
1588
  functionExpressionSource: string;
1588
1589
  sourceHash: string;
1589
1590
  typeImports: string[];
1591
+ runtimeImports?: string[];
1590
1592
  };
1591
1593
  };
1592
1594
  payload: Record<string, unknown>;
@@ -3166,43 +3168,6 @@ declare const SDK_VERSION: string;
3166
3168
  /** @deprecated Transitional wire id for pre-major-header SDKs only. */
3167
3169
  declare const SDK_API_CONTRACT: string;
3168
3170
 
3169
- /**
3170
- * Base error class for all Deepline SDK errors.
3171
- *
3172
- * Every error thrown by the SDK extends this class, so you can catch all
3173
- * Deepline-specific errors with a single `catch (e) { if (e instanceof DeeplineError) }`.
3174
- *
3175
- * @example
3176
- * ```typescript
3177
- * import { DeeplineClient, DeeplineError, AuthError } from 'deepline';
3178
- *
3179
- * const client = new DeeplineClient();
3180
- * try {
3181
- * await client.executeTool('dropleads_search_people', { query: 'cto' });
3182
- * } catch (err) {
3183
- * if (err instanceof AuthError) {
3184
- * console.error('Bad API key — run: deepline auth register');
3185
- * } else if (err instanceof DeeplineError) {
3186
- * console.error(`API error ${err.statusCode}: ${err.message}`);
3187
- * }
3188
- * }
3189
- * ```
3190
- */
3191
- declare class DeeplineError extends Error {
3192
- /** HTTP status code from the API response, if applicable. */
3193
- statusCode?: number | undefined;
3194
- /** Machine-readable error code (e.g. `'AUTH_ERROR'`, `'RATE_LIMIT'`, `'CONFIG_ERROR'`). */
3195
- code?: string | undefined;
3196
- /** Additional context from the API response body. */
3197
- details?: Record<string, unknown> | undefined;
3198
- constructor(message: string,
3199
- /** HTTP status code from the API response, if applicable. */
3200
- statusCode?: number | undefined,
3201
- /** Machine-readable error code (e.g. `'AUTH_ERROR'`, `'RATE_LIMIT'`, `'CONFIG_ERROR'`). */
3202
- code?: string | undefined,
3203
- /** Additional context from the API response body. */
3204
- details?: Record<string, unknown> | undefined);
3205
- }
3206
3171
  /**
3207
3172
  * Thrown when the API rejects the request due to an invalid or missing API key.
3208
3173
  *
@@ -3224,8 +3189,11 @@ declare class DeeplineError extends Error {
3224
3189
  * }
3225
3190
  * }
3226
3191
  * ```
3192
+ *
3193
+ * @sdkReference errors 090
3227
3194
  */
3228
3195
  declare class AuthError extends DeeplineError {
3196
+ /** Constructed by the SDK when Deepline rejects the caller's credentials. */
3229
3197
  constructor(message?: string);
3230
3198
  }
3231
3199
  /**
@@ -3250,12 +3218,53 @@ declare class AuthError extends DeeplineError {
3250
3218
  * }
3251
3219
  * }
3252
3220
  * ```
3221
+ *
3222
+ * @sdkReference errors 100
3253
3223
  */
3254
3224
  declare class RateLimitError extends DeeplineError {
3255
3225
  /** Milliseconds to wait before retrying, from the `Retry-After` response header. Defaults to 5000. */
3256
3226
  retryAfterMs: number;
3227
+ /** Constructed by the SDK after exhausting HTTP-level rate-limit retries. */
3257
3228
  constructor(retryAfterMs?: number, message?: string);
3258
3229
  }
3230
+ /**
3231
+ * Tool-specific 429 preserving both historical RateLimitError catches and the
3232
+ * structured ToolExecutionError ontology. JavaScript has one prototype chain,
3233
+ * so this class extends RateLimitError and carries ToolExecutionError's stable
3234
+ * cross-bundle brand.
3235
+ *
3236
+ * This class appears in external SDK calls after HTTP 429 retries are
3237
+ * exhausted. It also satisfies `instanceof ToolExecutionError` and, for a
3238
+ * provider-owned rate limit, `instanceof ProviderTransientError`. Authored
3239
+ * Plays should use `ProviderTransientError`; they do not need this
3240
+ * compatibility class.
3241
+ *
3242
+ * @sdkReference errors 110
3243
+ */
3244
+ declare class ToolRateLimitError extends RateLimitError {
3245
+ /** Public tool id passed to `tools.execute`. */
3246
+ readonly toolId: string;
3247
+ /** Provider responsible for the operation, or `null`. */
3248
+ readonly provider: string | null;
3249
+ /** Provider operation name, or `null`. */
3250
+ readonly operation: string | null;
3251
+ /** Stable machine-readable failure code when one exists. */
3252
+ readonly code: string | undefined;
3253
+ /** Boundary responsible for the failure. */
3254
+ readonly origin: ToolExecutionError['origin'];
3255
+ /** Stable reason family for policy and diagnostics. */
3256
+ readonly category: ToolExecutionError['category'];
3257
+ /** Whether repeating the same semantic call is delivery-safe. */
3258
+ readonly retryable: boolean;
3259
+ /** Provider or Deepline request id, or `null`. */
3260
+ readonly requestId: string | null;
3261
+ /** Network failure kind, or `null` for non-network failures. */
3262
+ readonly networkKind: ToolExecutionError['networkKind'];
3263
+ /** Network boundary that failed, or `null` for non-network failures. */
3264
+ readonly networkScope: ToolExecutionError['networkScope'];
3265
+ /** Constructed by the SDK after a structured tool HTTP 429. */
3266
+ constructor(message: string, options: ToolExecutionErrorOptions);
3267
+ }
3259
3268
  /**
3260
3269
  * Thrown when the SDK cannot resolve a valid configuration.
3261
3270
  *
@@ -3274,8 +3283,11 @@ declare class RateLimitError extends DeeplineError {
3274
3283
  * }
3275
3284
  * }
3276
3285
  * ```
3286
+ *
3287
+ * @sdkReference errors 120
3277
3288
  */
3278
3289
  declare class ConfigError extends DeeplineError {
3290
+ /** Construct a local SDK configuration failure. */
3279
3291
  constructor(message: string);
3280
3292
  }
3281
3293
 
@@ -3666,6 +3678,8 @@ type ToolExecuteResultBase<TResult = unknown, TMeta = Record<string, unknown>> =
3666
3678
  count: number | null;
3667
3679
  keys: Record<string, string>;
3668
3680
  }>;
3681
+ /** Original declarations preserve semantic accessor names across replay. */
3682
+ listExtractorPaths?: readonly string[];
3669
3683
  };
3670
3684
  };
3671
3685
  type ToolExecuteResultAccessors<TExtracted extends Record<string, unknown> = Partial<DeeplineGetterValueMap>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = {
@@ -3778,6 +3792,16 @@ type PlayBindings = {
3778
3792
  * older clients can continue to register revisions during the migration.
3779
3793
  */
3780
3794
  description?: string;
3795
+ /**
3796
+ * Public behavior that must remain pinned for this play artifact.
3797
+ *
3798
+ * New plays default to typed tool errors (`1`). Set `toolErrorSchemaVersion`
3799
+ * to `0` only while migrating code that depends on legacy error names,
3800
+ * messages, or classes.
3801
+ */
3802
+ compatibility?: {
3803
+ toolErrorSchemaVersion: ToolExecutionErrorSchemaVersion;
3804
+ };
3781
3805
  /** Allow compilers to bundle this named handler directly without a child run. */
3782
3806
  inline?: boolean;
3783
3807
  /** Optional per-run billing controls enforced by the runtime. */
@@ -4352,7 +4376,7 @@ interface DeeplinePlayRuntimeContext {
4352
4376
  *
4353
4377
  * @sdkReference runtime 140 ctx.runPlay(key, playRef, input, options)
4354
4378
  */
4355
- runPlay<TOutput = unknown>(key: string, playRef: string | PlayReferenceLike, input: Record<string, unknown>, options: PlayCallOptions): Promise<TOutput>;
4379
+ runPlay<TOutput = unknown>(key: string, playRef: string | PlayReferenceLike, input: Record<string, unknown>, options?: PlayCallOptions): Promise<TOutput>;
4356
4380
  /**
4357
4381
  * Emit a log line visible in `play tail` and the play's progress logs.
4358
4382
  *
@@ -4599,6 +4623,8 @@ type DefinePlayConfig<TInput, TOutput extends PlayReturnObject> = {
4599
4623
  bindings?: PlayBindings;
4600
4624
  /** Billing options. */
4601
4625
  billing?: PlayBindings['billing'];
4626
+ /** Runtime compatibility override. Omit for the current typed contract. */
4627
+ compatibility?: PlayBindings['compatibility'];
4602
4628
  };
4603
4629
  declare function steps<TInput>(): StepProgram<TInput, TInput, TInput>;
4604
4630
  declare function runIf<Row, Value>(predicate: (row: Row, index: number) => boolean | Promise<boolean>, resolver: StepResolver<Row, Value>): ConditionalStepResolver<Row, Value, null>;
@@ -4639,6 +4665,8 @@ declare function runIf<Row, Value>(predicate: (row: Row, index: number) => boole
4639
4665
  type DefinedPlay<TInput, TOutput extends PlayReturnObject> = ((ctx: DeeplinePlayRuntimeContext, input: TInput) => Promise<TOutput>) & DeeplineNamedPlay<TInput, TOutput> & {
4640
4666
  /** Optional trigger bindings (cron, webhook). */
4641
4667
  readonly bindings?: PlayBindings;
4668
+ /** Runtime compatibility explicitly selected by the author. */
4669
+ readonly compatibility?: PlayBindings['compatibility'];
4642
4670
  /** The play's name (same as `.name`). */
4643
4671
  readonly playName: string;
4644
4672
  };
@@ -4648,6 +4676,7 @@ type PlayMetadata = {
4648
4676
  bindings?: PlayBindings;
4649
4677
  inputSchema?: Record<string, unknown>;
4650
4678
  billing?: PlayBindings['billing'];
4679
+ compatibility?: PlayBindings['compatibility'];
4651
4680
  };
4652
4681
  /**
4653
4682
  * High-level SDK context with tool shortcuts and play handles.
@@ -5043,4 +5072,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
5043
5072
  */
5044
5073
  declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
5045
5074
 
5046
- export { 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 CsvInput, type CsvOptions, type CustomerDbQueryResult, DEEPLINE_EXTRACTOR_TARGETS, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, type DatasetColumnDefinition, type DatasetColumnRunInput, type DbNamespace, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, type DeeplineEmailStatusGetterValue, DeeplineError, type DeeplineExtractorTarget, type DeeplineGetterValue, type DeeplineGetterValueMap, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplinePlaysNamespace, type DeeplineToolCategory, type DeeplineToolsNamespace, type DefinePlayConfig, type DefinedPlay, type FileInput, type IngestionStorageRepairResult, JOB_CHANGE_STATUS_VALUES, type JobChangeStatus, type LiveEventEnvelope, type MonitorCheckResult, type MonitorControls, type MonitorDefinition, type MonitorDeleteResult, type MonitorDependents, type MonitorDeployResult, type MonitorDetail, type MonitorListEntry, type MonitorPayload, type MonitorReactivateResult, type MonitorUpdateResult, type MonitorsAccessStatus, type MonitorsAvailableOptions, type MonitorsAvailableResult, type MonitorsListOptions, type MonitorsListResult, type MonitorsNamespace, PHONE_STATUS_VALUES, 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 PhoneStatus, type PlayActivityObservation, type PlayActivityState, type PlayActivityTarget, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayCallExecution, type PlayCallOptions, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunActionPackage, type PlayRunActivityProjection, type PlayRunDatasetActions, type PlayRunPackage, type PlayRunResult, type PlayRunStart, type PlaySheetRow, type PlaySheetRowsResult, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PreviousCell, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, RunObserveTransportUnavailableError, type RunsListOptions, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, 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, type ToolExecuteResult, type ToolExecution, type ToolExecutionRequest, type ToolMetadata, type ToolSearchOptions, type ToolSearchResult, defineInput, defineMonitor, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
5075
+ export { 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 CsvInput, type CsvOptions, type CustomerDbQueryResult, DEEPLINE_EXTRACTOR_TARGETS, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, type DatasetColumnDefinition, type DatasetColumnRunInput, type DbNamespace, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, type DeeplineEmailStatusGetterValue, DeeplineError, type DeeplineExtractorTarget, type DeeplineGetterValue, type DeeplineGetterValueMap, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplinePlaysNamespace, type DeeplineToolCategory, type DeeplineToolsNamespace, type DefinePlayConfig, type DefinedPlay, type FileInput, type IngestionStorageRepairResult, JOB_CHANGE_STATUS_VALUES, type JobChangeStatus, type LiveEventEnvelope, type MonitorCheckResult, type MonitorControls, type MonitorDefinition, type MonitorDeleteResult, type MonitorDependents, type MonitorDeployResult, type MonitorDetail, type MonitorListEntry, type MonitorPayload, type MonitorReactivateResult, type MonitorUpdateResult, type MonitorsAccessStatus, type MonitorsAvailableOptions, type MonitorsAvailableResult, type MonitorsListOptions, type MonitorsListResult, type MonitorsNamespace, PHONE_STATUS_VALUES, 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 PhoneStatus, type PlayActivityObservation, type PlayActivityState, type PlayActivityTarget, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayCallExecution, type PlayCallOptions, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunActionPackage, type PlayRunActivityProjection, type PlayRunDatasetActions, type PlayRunPackage, type PlayRunResult, type PlayRunStart, type PlaySheetRow, type PlaySheetRowsResult, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PreviousCell, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, RunObserveTransportUnavailableError, type RunsListOptions, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, 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, type ToolExecuteResult, type ToolExecution, ToolExecutionError, ToolExecutionErrorOptions, type ToolExecutionRequest, type ToolMetadata, ToolRateLimitError, type ToolSearchOptions, type ToolSearchResult, defineInput, defineMonitor, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };