deepline 0.1.238 → 0.1.239

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.mts CHANGED
@@ -85,12 +85,17 @@ interface CustomerDbColumn {
85
85
  data_type_id: number | null;
86
86
  }
87
87
  /**
88
- * Result returned by {@link DeeplineClient.queryCustomerDb}.
88
+ * Result returned by {@link DeeplineClient.db.query}.
89
89
  *
90
90
  * Rows are intentionally untyped because the schema depends on the caller's SQL
91
91
  * query and selected customer tables.
92
92
  */
93
93
  interface CustomerDbQueryResult {
94
+ /** This query reads the current mutable customer database, not one run snapshot. */
95
+ scope?: {
96
+ kind: 'database';
97
+ mutability: 'current';
98
+ };
94
99
  /** Database command executed by the query endpoint. */
95
100
  command: string;
96
101
  /** Total affected row count when reported by the database. */
@@ -410,6 +415,23 @@ interface PlayProgressStatus {
410
415
  type PlayRunActionPackage = {
411
416
  kind: 'deepline_run_inspect';
412
417
  runId: string;
418
+ command?: string;
419
+ api: {
420
+ method: 'GET';
421
+ path: string;
422
+ };
423
+ } | {
424
+ kind: 'deepline_run_full';
425
+ runId: string;
426
+ command?: string;
427
+ api: {
428
+ method: 'GET';
429
+ path: string;
430
+ };
431
+ } | {
432
+ kind: 'deepline_run_billing';
433
+ runId: string;
434
+ command?: string;
413
435
  api: {
414
436
  method: 'GET';
415
437
  path: string;
@@ -422,6 +444,20 @@ type PlayRunActionPackage = {
422
444
  sqlQualifiedTableName?: string;
423
445
  sql: string;
424
446
  maxRows: number;
447
+ command?: string;
448
+ scope?: {
449
+ kind: 'database';
450
+ mutability: 'current';
451
+ } | {
452
+ kind: 'run';
453
+ runId: string;
454
+ };
455
+ note?: string;
456
+ deprecated?: {
457
+ replacement: 'queryCurrentTable';
458
+ removeAfter: string;
459
+ reason: string;
460
+ };
425
461
  api: {
426
462
  method: 'POST';
427
463
  path: '/api/v2/db/query';
@@ -431,6 +467,17 @@ type PlayRunActionPackage = {
431
467
  runId: string;
432
468
  datasetPath: string;
433
469
  format: 'csv';
470
+ command?: string;
471
+ scope?: {
472
+ kind: 'run';
473
+ runId: string;
474
+ };
475
+ note?: string;
476
+ deprecated?: {
477
+ replacement: 'datasets[].actions.exportCsv';
478
+ removeAfter: string;
479
+ reason: string;
480
+ };
434
481
  } | {
435
482
  kind: 'deepline_run_logs';
436
483
  runId: string;
@@ -442,6 +489,33 @@ type PlayRunActionPackage = {
442
489
  path: string;
443
490
  };
444
491
  };
492
+ type PlayRunDbQueryAction = Extract<PlayRunActionPackage, {
493
+ kind: 'deepline_db_query';
494
+ }>;
495
+ type PlayRunExportAction = Extract<PlayRunActionPackage, {
496
+ kind: 'deepline_run_export';
497
+ }>;
498
+ type PlayRunDatasetActions = {
499
+ /** @deprecated Use queryCurrentTable or exportCsv. Removed after 2026-08-18. */
500
+ query?: PlayRunDbQueryAction & {
501
+ scope?: {
502
+ kind: 'run';
503
+ runId: string;
504
+ };
505
+ };
506
+ queryCurrentTable?: PlayRunDbQueryAction & {
507
+ scope?: {
508
+ kind: 'database';
509
+ mutability: 'current';
510
+ };
511
+ };
512
+ exportCsv?: PlayRunExportAction & {
513
+ scope?: {
514
+ kind: 'run';
515
+ runId: string;
516
+ };
517
+ };
518
+ };
445
519
  /**
446
520
  * Compact canonical package for an inspected play run.
447
521
  *
@@ -477,9 +551,15 @@ interface PlayRunPackage {
477
551
  path: string;
478
552
  tableNamespace?: string;
479
553
  rowCount?: number;
554
+ sqlTableName?: string;
555
+ sqlQualifiedTableName?: string;
480
556
  recovered?: true;
557
+ exportUnavailable?: {
558
+ reason: 'empty_dataset' | 'shared_table_namespace';
559
+ message: string;
560
+ };
481
561
  preview?: Record<string, unknown>;
482
- actions?: Record<string, PlayRunActionPackage>;
562
+ actions?: PlayRunDatasetActions;
483
563
  }>;
484
564
  /** Small retained tail of customer and runtime logs; fetch the full stream through `runs.logs`. */
485
565
  logs?: {
@@ -491,6 +571,8 @@ interface PlayRunPackage {
491
571
  /** Follow-up actions a caller can perform against the run. */
492
572
  next?: {
493
573
  inspect?: PlayRunActionPackage;
574
+ full?: PlayRunActionPackage;
575
+ billing?: PlayRunActionPackage;
494
576
  export?: PlayRunActionPackage;
495
577
  query?: PlayRunActionPackage;
496
578
  logs?: PlayRunActionPackage;
@@ -1363,6 +1445,12 @@ type PlaySheetRow = {
1363
1445
  /** Runtime-sheet rows and aggregate progress for one dataset/table namespace. */
1364
1446
  type PlaySheetRowsResult = {
1365
1447
  rows: PlaySheetRow[];
1448
+ scope?: {
1449
+ kind: 'database';
1450
+ } | {
1451
+ kind: 'run';
1452
+ runId: string;
1453
+ };
1366
1454
  summary?: {
1367
1455
  stats?: {
1368
1456
  total?: number;
@@ -1426,6 +1514,14 @@ type RunsNamespace = {
1426
1514
  reason?: string;
1427
1515
  }) => Promise<StopAllPlayRunsResult>;
1428
1516
  };
1517
+ /** Current mutable customer database namespace exposed as `client.db`. */
1518
+ type DbNamespace = {
1519
+ /** Run a bounded SQL query against the current customer data plane. */
1520
+ query: (input: {
1521
+ sql: string;
1522
+ maxRows?: number;
1523
+ }) => Promise<CustomerDbQueryResult>;
1524
+ };
1429
1525
  /** One credit grant pool reported by the billing subscription status endpoint. */
1430
1526
  type BillingCreditPool = {
1431
1527
  pool: string;
@@ -1640,6 +1736,8 @@ declare class DeeplineClient {
1640
1736
  private readonly config;
1641
1737
  /** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
1642
1738
  readonly runs: RunsNamespace;
1739
+ /** Current mutable customer database namespace backed by `/api/v2/db/query`. */
1740
+ readonly db: DbNamespace;
1643
1741
  /** Billing namespace: subscription status/cancel and invoice history. */
1644
1742
  readonly billing: BillingNamespace;
1645
1743
  /**
@@ -1746,11 +1844,14 @@ declare class DeeplineClient {
1746
1844
  * envelope remains the same.
1747
1845
  */
1748
1846
  executeToolRaw<TData = unknown, TMeta = Record<string, unknown>>(toolId: string, input: Record<string, unknown>, options?: ExecuteToolRawOptions): Promise<ToolExecution<TData, TMeta>>;
1847
+ private queryDb;
1749
1848
  /**
1750
- * Run a bounded SQL query against the customer data plane.
1849
+ * Run a bounded SQL query against the current mutable customer database.
1850
+ *
1851
+ * This query is not scoped to one play run. Use `client.runs` export actions
1852
+ * when the caller needs the rows produced by a specific run.
1751
1853
  *
1752
- * Use this from trusted backend or agent contexts only. The API enforces
1753
- * workspace scoping and row limits.
1854
+ * @deprecated Use {@link DeeplineClient.db} `.query(...)`.
1754
1855
  */
1755
1856
  queryCustomerDb(input: {
1756
1857
  sql: string;
@@ -4412,4 +4513,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
4412
4513
  */
4413
4514
  declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
4414
4515
 
4415
- 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, 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, JOB_CHANGE_STATUS_VALUES, type JobChangeStatus, type LiveEventEnvelope, 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 PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayCallExecution, type PlayCallOptions, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, 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, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
4516
+ 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, JOB_CHANGE_STATUS_VALUES, type JobChangeStatus, type LiveEventEnvelope, 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 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 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, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
package/dist/index.d.ts CHANGED
@@ -85,12 +85,17 @@ interface CustomerDbColumn {
85
85
  data_type_id: number | null;
86
86
  }
87
87
  /**
88
- * Result returned by {@link DeeplineClient.queryCustomerDb}.
88
+ * Result returned by {@link DeeplineClient.db.query}.
89
89
  *
90
90
  * Rows are intentionally untyped because the schema depends on the caller's SQL
91
91
  * query and selected customer tables.
92
92
  */
93
93
  interface CustomerDbQueryResult {
94
+ /** This query reads the current mutable customer database, not one run snapshot. */
95
+ scope?: {
96
+ kind: 'database';
97
+ mutability: 'current';
98
+ };
94
99
  /** Database command executed by the query endpoint. */
95
100
  command: string;
96
101
  /** Total affected row count when reported by the database. */
@@ -410,6 +415,23 @@ interface PlayProgressStatus {
410
415
  type PlayRunActionPackage = {
411
416
  kind: 'deepline_run_inspect';
412
417
  runId: string;
418
+ command?: string;
419
+ api: {
420
+ method: 'GET';
421
+ path: string;
422
+ };
423
+ } | {
424
+ kind: 'deepline_run_full';
425
+ runId: string;
426
+ command?: string;
427
+ api: {
428
+ method: 'GET';
429
+ path: string;
430
+ };
431
+ } | {
432
+ kind: 'deepline_run_billing';
433
+ runId: string;
434
+ command?: string;
413
435
  api: {
414
436
  method: 'GET';
415
437
  path: string;
@@ -422,6 +444,20 @@ type PlayRunActionPackage = {
422
444
  sqlQualifiedTableName?: string;
423
445
  sql: string;
424
446
  maxRows: number;
447
+ command?: string;
448
+ scope?: {
449
+ kind: 'database';
450
+ mutability: 'current';
451
+ } | {
452
+ kind: 'run';
453
+ runId: string;
454
+ };
455
+ note?: string;
456
+ deprecated?: {
457
+ replacement: 'queryCurrentTable';
458
+ removeAfter: string;
459
+ reason: string;
460
+ };
425
461
  api: {
426
462
  method: 'POST';
427
463
  path: '/api/v2/db/query';
@@ -431,6 +467,17 @@ type PlayRunActionPackage = {
431
467
  runId: string;
432
468
  datasetPath: string;
433
469
  format: 'csv';
470
+ command?: string;
471
+ scope?: {
472
+ kind: 'run';
473
+ runId: string;
474
+ };
475
+ note?: string;
476
+ deprecated?: {
477
+ replacement: 'datasets[].actions.exportCsv';
478
+ removeAfter: string;
479
+ reason: string;
480
+ };
434
481
  } | {
435
482
  kind: 'deepline_run_logs';
436
483
  runId: string;
@@ -442,6 +489,33 @@ type PlayRunActionPackage = {
442
489
  path: string;
443
490
  };
444
491
  };
492
+ type PlayRunDbQueryAction = Extract<PlayRunActionPackage, {
493
+ kind: 'deepline_db_query';
494
+ }>;
495
+ type PlayRunExportAction = Extract<PlayRunActionPackage, {
496
+ kind: 'deepline_run_export';
497
+ }>;
498
+ type PlayRunDatasetActions = {
499
+ /** @deprecated Use queryCurrentTable or exportCsv. Removed after 2026-08-18. */
500
+ query?: PlayRunDbQueryAction & {
501
+ scope?: {
502
+ kind: 'run';
503
+ runId: string;
504
+ };
505
+ };
506
+ queryCurrentTable?: PlayRunDbQueryAction & {
507
+ scope?: {
508
+ kind: 'database';
509
+ mutability: 'current';
510
+ };
511
+ };
512
+ exportCsv?: PlayRunExportAction & {
513
+ scope?: {
514
+ kind: 'run';
515
+ runId: string;
516
+ };
517
+ };
518
+ };
445
519
  /**
446
520
  * Compact canonical package for an inspected play run.
447
521
  *
@@ -477,9 +551,15 @@ interface PlayRunPackage {
477
551
  path: string;
478
552
  tableNamespace?: string;
479
553
  rowCount?: number;
554
+ sqlTableName?: string;
555
+ sqlQualifiedTableName?: string;
480
556
  recovered?: true;
557
+ exportUnavailable?: {
558
+ reason: 'empty_dataset' | 'shared_table_namespace';
559
+ message: string;
560
+ };
481
561
  preview?: Record<string, unknown>;
482
- actions?: Record<string, PlayRunActionPackage>;
562
+ actions?: PlayRunDatasetActions;
483
563
  }>;
484
564
  /** Small retained tail of customer and runtime logs; fetch the full stream through `runs.logs`. */
485
565
  logs?: {
@@ -491,6 +571,8 @@ interface PlayRunPackage {
491
571
  /** Follow-up actions a caller can perform against the run. */
492
572
  next?: {
493
573
  inspect?: PlayRunActionPackage;
574
+ full?: PlayRunActionPackage;
575
+ billing?: PlayRunActionPackage;
494
576
  export?: PlayRunActionPackage;
495
577
  query?: PlayRunActionPackage;
496
578
  logs?: PlayRunActionPackage;
@@ -1363,6 +1445,12 @@ type PlaySheetRow = {
1363
1445
  /** Runtime-sheet rows and aggregate progress for one dataset/table namespace. */
1364
1446
  type PlaySheetRowsResult = {
1365
1447
  rows: PlaySheetRow[];
1448
+ scope?: {
1449
+ kind: 'database';
1450
+ } | {
1451
+ kind: 'run';
1452
+ runId: string;
1453
+ };
1366
1454
  summary?: {
1367
1455
  stats?: {
1368
1456
  total?: number;
@@ -1426,6 +1514,14 @@ type RunsNamespace = {
1426
1514
  reason?: string;
1427
1515
  }) => Promise<StopAllPlayRunsResult>;
1428
1516
  };
1517
+ /** Current mutable customer database namespace exposed as `client.db`. */
1518
+ type DbNamespace = {
1519
+ /** Run a bounded SQL query against the current customer data plane. */
1520
+ query: (input: {
1521
+ sql: string;
1522
+ maxRows?: number;
1523
+ }) => Promise<CustomerDbQueryResult>;
1524
+ };
1429
1525
  /** One credit grant pool reported by the billing subscription status endpoint. */
1430
1526
  type BillingCreditPool = {
1431
1527
  pool: string;
@@ -1640,6 +1736,8 @@ declare class DeeplineClient {
1640
1736
  private readonly config;
1641
1737
  /** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
1642
1738
  readonly runs: RunsNamespace;
1739
+ /** Current mutable customer database namespace backed by `/api/v2/db/query`. */
1740
+ readonly db: DbNamespace;
1643
1741
  /** Billing namespace: subscription status/cancel and invoice history. */
1644
1742
  readonly billing: BillingNamespace;
1645
1743
  /**
@@ -1746,11 +1844,14 @@ declare class DeeplineClient {
1746
1844
  * envelope remains the same.
1747
1845
  */
1748
1846
  executeToolRaw<TData = unknown, TMeta = Record<string, unknown>>(toolId: string, input: Record<string, unknown>, options?: ExecuteToolRawOptions): Promise<ToolExecution<TData, TMeta>>;
1847
+ private queryDb;
1749
1848
  /**
1750
- * Run a bounded SQL query against the customer data plane.
1849
+ * Run a bounded SQL query against the current mutable customer database.
1850
+ *
1851
+ * This query is not scoped to one play run. Use `client.runs` export actions
1852
+ * when the caller needs the rows produced by a specific run.
1751
1853
  *
1752
- * Use this from trusted backend or agent contexts only. The API enforces
1753
- * workspace scoping and row limits.
1854
+ * @deprecated Use {@link DeeplineClient.db} `.query(...)`.
1754
1855
  */
1755
1856
  queryCustomerDb(input: {
1756
1857
  sql: string;
@@ -4412,4 +4513,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
4412
4513
  */
4413
4514
  declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
4414
4515
 
4415
- 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, 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, JOB_CHANGE_STATUS_VALUES, type JobChangeStatus, type LiveEventEnvelope, 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 PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayCallExecution, type PlayCallOptions, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, 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, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
4516
+ 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, JOB_CHANGE_STATUS_VALUES, type JobChangeStatus, type LiveEventEnvelope, 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 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 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, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
package/dist/index.js CHANGED
@@ -426,10 +426,10 @@ var SDK_RELEASE = {
426
426
  // silently materializing them as unmatched results.
427
427
  // 0.1.220 deprecates SDK CLI versions below 0.1.219 and updates them
428
428
  // automatically without blocking their current command.
429
- version: "0.1.238",
429
+ version: "0.1.239",
430
430
  apiContract: "2026-06-dataset-handle-results-hard-cutover",
431
431
  supportPolicy: {
432
- latest: "0.1.238",
432
+ latest: "0.1.239",
433
433
  minimumSupported: "0.1.53",
434
434
  deprecatedBelow: "0.1.219",
435
435
  commandMinimumSupported: [
@@ -691,6 +691,7 @@ var HttpClient = class {
691
691
  "X-Deepline-CLI-Version": SDK_VERSION,
692
692
  "X-Deepline-SDK-Version": SDK_VERSION,
693
693
  "X-Deepline-API-Contract": SDK_API_CONTRACT,
694
+ "X-Deepline-Run-Result-Shape": "canonical",
694
695
  ...extra
695
696
  };
696
697
  const skillsVersion = this.readSkillsVersionHeader();
@@ -2504,6 +2505,8 @@ var DeeplineClient = class {
2504
2505
  config;
2505
2506
  /** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
2506
2507
  runs;
2508
+ /** Current mutable customer database namespace backed by `/api/v2/db/query`. */
2509
+ db;
2507
2510
  /** Billing namespace: subscription status/cancel and invoice history. */
2508
2511
  billing;
2509
2512
  /**
@@ -2527,6 +2530,9 @@ var DeeplineClient = class {
2527
2530
  stop: (runId, options2) => this.stopRun(runId, options2),
2528
2531
  stopAll: (options2) => this.stopAllRuns(options2)
2529
2532
  };
2533
+ this.db = {
2534
+ query: (input) => this.queryDb(input)
2535
+ };
2530
2536
  this.billing = {
2531
2537
  topUp: (options2) => this.topUpBillingBalance(options2),
2532
2538
  plans: () => this.getBillingPlans(),
@@ -2793,17 +2799,29 @@ var DeeplineClient = class {
2793
2799
  async executeToolRaw(toolId, input, options) {
2794
2800
  return this.executeTool(toolId, input, options);
2795
2801
  }
2802
+ async queryDb(input) {
2803
+ const result = await this.http.post(
2804
+ "/api/v2/db/query",
2805
+ {
2806
+ sql: input.sql,
2807
+ ...input.maxRows ? { max_rows: input.maxRows } : {}
2808
+ }
2809
+ );
2810
+ return {
2811
+ ...result,
2812
+ scope: { kind: "database", mutability: "current" }
2813
+ };
2814
+ }
2796
2815
  /**
2797
- * Run a bounded SQL query against the customer data plane.
2816
+ * Run a bounded SQL query against the current mutable customer database.
2817
+ *
2818
+ * This query is not scoped to one play run. Use `client.runs` export actions
2819
+ * when the caller needs the rows produced by a specific run.
2798
2820
  *
2799
- * Use this from trusted backend or agent contexts only. The API enforces
2800
- * workspace scoping and row limits.
2821
+ * @deprecated Use {@link DeeplineClient.db} `.query(...)`.
2801
2822
  */
2802
2823
  async queryCustomerDb(input) {
2803
- return this.http.post("/api/v2/db/query", {
2804
- sql: input.sql,
2805
- ...input.maxRows ? { max_rows: input.maxRows } : {}
2806
- });
2824
+ return this.db.query(input);
2807
2825
  }
2808
2826
  /**
2809
2827
  * Re-establish this workspace's tenant storage contract: role/DB connect
@@ -3934,9 +3952,35 @@ var DeeplineClient = class {
3934
3952
  if (input.rowMode === "all") {
3935
3953
  params.set("rowMode", "all");
3936
3954
  }
3937
- return await this.http.get(
3955
+ const result = await this.http.get(
3938
3956
  `/api/v2/plays/${encodeURIComponent(input.playName)}/sheet?${params.toString()}`
3939
3957
  );
3958
+ const requestedRunId = input.runId?.trim() || "";
3959
+ if (requestedRunId) {
3960
+ const confirmedRunId = result.scope?.kind === "run" ? result.scope.runId.trim() : "";
3961
+ const foreignRowRunIds = [
3962
+ ...new Set(
3963
+ result.rows.map(
3964
+ (row) => typeof row.runId === "string" ? row.runId.trim() : ""
3965
+ ).filter((runId) => runId && runId !== requestedRunId)
3966
+ )
3967
+ ];
3968
+ if (result.scope?.kind !== "run" || confirmedRunId !== requestedRunId || foreignRowRunIds.length > 0) {
3969
+ throw new DeeplineError(
3970
+ `Run-scoped dataset export was not confirmed for ${requestedRunId}; no rows were returned to the caller. Update Deepline, then retry the same export command. Do not rerun the play.`,
3971
+ void 0,
3972
+ "RUN_EXPORT_SCOPE_MISMATCH",
3973
+ {
3974
+ requestedRunId,
3975
+ confirmedScope: result.scope ?? null,
3976
+ foreignRowRunIds,
3977
+ playName: input.playName,
3978
+ tableNamespace: input.tableNamespace
3979
+ }
3980
+ );
3981
+ }
3982
+ }
3983
+ return result;
3940
3984
  }
3941
3985
  /**
3942
3986
  * Stop a run by id using the public runs resource model.
package/dist/index.mjs CHANGED
@@ -356,10 +356,10 @@ var SDK_RELEASE = {
356
356
  // silently materializing them as unmatched results.
357
357
  // 0.1.220 deprecates SDK CLI versions below 0.1.219 and updates them
358
358
  // automatically without blocking their current command.
359
- version: "0.1.238",
359
+ version: "0.1.239",
360
360
  apiContract: "2026-06-dataset-handle-results-hard-cutover",
361
361
  supportPolicy: {
362
- latest: "0.1.238",
362
+ latest: "0.1.239",
363
363
  minimumSupported: "0.1.53",
364
364
  deprecatedBelow: "0.1.219",
365
365
  commandMinimumSupported: [
@@ -621,6 +621,7 @@ var HttpClient = class {
621
621
  "X-Deepline-CLI-Version": SDK_VERSION,
622
622
  "X-Deepline-SDK-Version": SDK_VERSION,
623
623
  "X-Deepline-API-Contract": SDK_API_CONTRACT,
624
+ "X-Deepline-Run-Result-Shape": "canonical",
624
625
  ...extra
625
626
  };
626
627
  const skillsVersion = this.readSkillsVersionHeader();
@@ -2434,6 +2435,8 @@ var DeeplineClient = class {
2434
2435
  config;
2435
2436
  /** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
2436
2437
  runs;
2438
+ /** Current mutable customer database namespace backed by `/api/v2/db/query`. */
2439
+ db;
2437
2440
  /** Billing namespace: subscription status/cancel and invoice history. */
2438
2441
  billing;
2439
2442
  /**
@@ -2457,6 +2460,9 @@ var DeeplineClient = class {
2457
2460
  stop: (runId, options2) => this.stopRun(runId, options2),
2458
2461
  stopAll: (options2) => this.stopAllRuns(options2)
2459
2462
  };
2463
+ this.db = {
2464
+ query: (input) => this.queryDb(input)
2465
+ };
2460
2466
  this.billing = {
2461
2467
  topUp: (options2) => this.topUpBillingBalance(options2),
2462
2468
  plans: () => this.getBillingPlans(),
@@ -2723,17 +2729,29 @@ var DeeplineClient = class {
2723
2729
  async executeToolRaw(toolId, input, options) {
2724
2730
  return this.executeTool(toolId, input, options);
2725
2731
  }
2732
+ async queryDb(input) {
2733
+ const result = await this.http.post(
2734
+ "/api/v2/db/query",
2735
+ {
2736
+ sql: input.sql,
2737
+ ...input.maxRows ? { max_rows: input.maxRows } : {}
2738
+ }
2739
+ );
2740
+ return {
2741
+ ...result,
2742
+ scope: { kind: "database", mutability: "current" }
2743
+ };
2744
+ }
2726
2745
  /**
2727
- * Run a bounded SQL query against the customer data plane.
2746
+ * Run a bounded SQL query against the current mutable customer database.
2747
+ *
2748
+ * This query is not scoped to one play run. Use `client.runs` export actions
2749
+ * when the caller needs the rows produced by a specific run.
2728
2750
  *
2729
- * Use this from trusted backend or agent contexts only. The API enforces
2730
- * workspace scoping and row limits.
2751
+ * @deprecated Use {@link DeeplineClient.db} `.query(...)`.
2731
2752
  */
2732
2753
  async queryCustomerDb(input) {
2733
- return this.http.post("/api/v2/db/query", {
2734
- sql: input.sql,
2735
- ...input.maxRows ? { max_rows: input.maxRows } : {}
2736
- });
2754
+ return this.db.query(input);
2737
2755
  }
2738
2756
  /**
2739
2757
  * Re-establish this workspace's tenant storage contract: role/DB connect
@@ -3864,9 +3882,35 @@ var DeeplineClient = class {
3864
3882
  if (input.rowMode === "all") {
3865
3883
  params.set("rowMode", "all");
3866
3884
  }
3867
- return await this.http.get(
3885
+ const result = await this.http.get(
3868
3886
  `/api/v2/plays/${encodeURIComponent(input.playName)}/sheet?${params.toString()}`
3869
3887
  );
3888
+ const requestedRunId = input.runId?.trim() || "";
3889
+ if (requestedRunId) {
3890
+ const confirmedRunId = result.scope?.kind === "run" ? result.scope.runId.trim() : "";
3891
+ const foreignRowRunIds = [
3892
+ ...new Set(
3893
+ result.rows.map(
3894
+ (row) => typeof row.runId === "string" ? row.runId.trim() : ""
3895
+ ).filter((runId) => runId && runId !== requestedRunId)
3896
+ )
3897
+ ];
3898
+ if (result.scope?.kind !== "run" || confirmedRunId !== requestedRunId || foreignRowRunIds.length > 0) {
3899
+ throw new DeeplineError(
3900
+ `Run-scoped dataset export was not confirmed for ${requestedRunId}; no rows were returned to the caller. Update Deepline, then retry the same export command. Do not rerun the play.`,
3901
+ void 0,
3902
+ "RUN_EXPORT_SCOPE_MISMATCH",
3903
+ {
3904
+ requestedRunId,
3905
+ confirmedScope: result.scope ?? null,
3906
+ foreignRowRunIds,
3907
+ playName: input.playName,
3908
+ tableNamespace: input.tableNamespace
3909
+ }
3910
+ );
3911
+ }
3912
+ }
3913
+ return result;
3870
3914
  }
3871
3915
  /**
3872
3916
  * Stop a run by id using the public runs resource model.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.1.238",
3
+ "version": "0.1.239",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {