deepline 0.1.83 → 0.1.88

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
@@ -46,7 +46,7 @@ interface PlaySheetContractSnapshot {
46
46
  tableNamespace: string;
47
47
  columns: PlaySheetColumnContractSnapshot[];
48
48
  }
49
- type PlayStaticColumnProducerKindSnapshot = 'tool' | 'waterfall' | 'stepProgram' | 'playCall' | 'transform';
49
+ type PlayStaticColumnProducerKindSnapshot = 'tool' | 'waterfall' | 'stepProgram' | 'playCall' | 'controlFlow' | 'transform';
50
50
  interface PlayStaticColumnProducerSnapshot {
51
51
  id: string;
52
52
  kind: PlayStaticColumnProducerKindSnapshot;
@@ -148,6 +148,15 @@ type PlayStaticSubstepSnapshot = PlayStaticSubstepMetadataSnapshot & ({
148
148
  sourceRange?: PlayStaticSourceRangeSnapshot;
149
149
  callDepth?: number;
150
150
  callPath?: string[];
151
+ } | {
152
+ type: 'control_flow';
153
+ kind: 'conditional' | 'loop';
154
+ field: string;
155
+ steps: PlayStaticSubstepSnapshot[];
156
+ description?: string;
157
+ sourceRange?: PlayStaticSourceRangeSnapshot;
158
+ callDepth?: number;
159
+ callPath?: string[];
151
160
  } | {
152
161
  type: 'run_javascript';
153
162
  alias: string;
@@ -258,17 +267,33 @@ interface ResolvedConfig {
258
267
  /** Max retry count for transient failures. */
259
268
  maxRetries: number;
260
269
  }
270
+ /** Column metadata returned by a customer data query. */
261
271
  interface CustomerDbColumn {
272
+ /** Column name as returned by the database. */
262
273
  name: string;
274
+ /** Internal table identifier when available. */
263
275
  table_id: number | null;
276
+ /** Internal data-type identifier when available. */
264
277
  data_type_id: number | null;
265
278
  }
279
+ /**
280
+ * Result returned by {@link DeeplineClient.queryCustomerDb}.
281
+ *
282
+ * Rows are intentionally untyped because the schema depends on the caller's SQL
283
+ * query and selected customer tables.
284
+ */
266
285
  interface CustomerDbQueryResult {
286
+ /** Database command executed by the query endpoint. */
267
287
  command: string;
288
+ /** Total affected row count when reported by the database. */
268
289
  row_count: number | null;
290
+ /** Number of rows included in this response. */
269
291
  row_count_returned: number;
292
+ /** Whether server-side row limits truncated the result. */
270
293
  truncated: boolean;
294
+ /** Column metadata for the returned rows. */
271
295
  columns: CustomerDbColumn[];
296
+ /** Result rows. */
272
297
  rows: unknown[];
273
298
  }
274
299
  interface ToolPricingSummary {
@@ -288,6 +313,13 @@ interface ToolPricingSummary {
288
313
  details: string[];
289
314
  }
290
315
 
316
+ /**
317
+ * Summary definition of a callable provider-backed tool.
318
+ *
319
+ * Returned by {@link DeeplineClient.listTools} and ranked tool search. Use
320
+ * `getTool(toolId)` or the matching HTTP describe route for provider-specific
321
+ * schema, examples, pricing, and extraction guidance before executing.
322
+ */
291
323
  interface ToolDefinition {
292
324
  /** Unique tool identifier used in API calls (e.g. `"apollo_people_search"`). */
293
325
  toolId: string;
@@ -385,28 +417,53 @@ interface ToolDefinition {
385
417
  term?: string;
386
418
  }>;
387
419
  }
420
+ /**
421
+ * Query options for ranked tool/provider discovery.
422
+ */
388
423
  interface ToolSearchOptions {
424
+ /** Free-text search query. */
389
425
  query?: string;
426
+ /** Comma-separated category filter such as `company_search` or `email_finder`. */
390
427
  categories?: string;
428
+ /** Optional explicit search terms used by agent/CLI callers. */
391
429
  searchTerms?: string;
430
+ /** Search algorithm/version. Defaults to the current ranked mode. */
392
431
  searchMode?: 'v1' | 'v2';
432
+ /** Include backend debug metadata in the search response. */
393
433
  includeSearchDebug?: boolean;
394
434
  }
435
+ /**
436
+ * Ranked tool/provider discovery response.
437
+ *
438
+ * Includes matching tools plus render/action hints used by the CLI and agents.
439
+ */
395
440
  interface ToolSearchResult {
441
+ /** Ranked matching tools. */
396
442
  tools: ToolDefinition[];
443
+ /** Count included in this response when available. */
397
444
  count?: number;
445
+ /** Total available count when the backend reports it. */
398
446
  total?: number;
447
+ /** Whether results were truncated by server-side limits. */
399
448
  truncated?: boolean;
449
+ /** Echoed query. */
400
450
  query?: string;
451
+ /** Parsed category filters. */
401
452
  categories?: string[];
453
+ /** Parsed search terms. */
402
454
  search_terms?: string[];
455
+ /** Search mode used. */
403
456
  search_mode?: 'v1' | 'v2';
457
+ /** Whether search fell back to category matching. */
404
458
  search_fallback_to_category?: boolean;
459
+ /** Hint explaining omitted play results when searching tools only. */
405
460
  omitted_plays_hint?: string;
461
+ /** Copyable CLI command templates for follow-up discovery/execution. */
406
462
  commandTemplates?: {
407
463
  describe?: string;
408
464
  execute?: string;
409
465
  };
466
+ /** Pre-rendered sections and actions for CLI/agent display. */
410
467
  render?: {
411
468
  sections?: Array<{
412
469
  title: string;
@@ -525,9 +582,19 @@ type PlayRunActionPackage = {
525
582
  datasetPath: string;
526
583
  format: 'csv';
527
584
  };
585
+ /**
586
+ * Compact canonical package for an inspected play run.
587
+ *
588
+ * This object is designed for SDK/CLI/API consumers that need stable run
589
+ * metadata, output handles, and follow-up actions without reading dashboard
590
+ * internals.
591
+ */
528
592
  interface PlayRunPackage {
593
+ /** Package schema version. */
529
594
  schemaVersion: 1;
595
+ /** Package discriminator. */
530
596
  kind: 'play_run';
597
+ /** Run identity, status, timing, and dashboard metadata. */
531
598
  run: {
532
599
  id: string;
533
600
  playName: string;
@@ -539,8 +606,11 @@ interface PlayRunPackage {
539
606
  durationMs?: number | null;
540
607
  error?: string;
541
608
  };
609
+ /** Step-level summaries emitted by the runtime. */
542
610
  steps: Array<Record<string, unknown>>;
611
+ /** Named output summaries, including dataset handles and scalar outputs. */
543
612
  outputs: Record<string, Record<string, unknown>>;
613
+ /** Follow-up actions a caller can perform against the run. */
544
614
  next?: {
545
615
  inspect?: PlayRunActionPackage;
546
616
  export?: PlayRunActionPackage;
@@ -646,6 +716,10 @@ interface PlayRunListItem {
646
716
  closeTime: string | null;
647
717
  /** Duration string (e.g. `'2.5s'`). */
648
718
  executionTime: string | null;
719
+ /** Total Deepline credits charged for the run, when available. */
720
+ billingTotalCredits?: number;
721
+ /** Configured per-run Deepline credit cap, when available. */
722
+ billingMaxCreditsPerRun?: number | null;
649
723
  /** Metadata attached to the workflow. */
650
724
  memo: {
651
725
  /** Organization that owns this run. */
@@ -1123,6 +1197,13 @@ type EnrichCompiledConfig = {
1123
1197
  type ExecuteToolRawOptions = {
1124
1198
  includeToolMetadata?: boolean;
1125
1199
  };
1200
+ /**
1201
+ * Standard provider/tool execution envelope returned by low-level SDK calls.
1202
+ *
1203
+ * `toolResponse.raw` contains the provider result. `extractedValues` and
1204
+ * `extractedLists` contain Deepline-normalized getters when the tool exposes
1205
+ * them. Billing fields are Deepline-facing and must not expose provider spend.
1206
+ */
1126
1207
  type ToolExecution<TData = unknown, TMeta = Record<string, unknown>> = {
1127
1208
  status: string;
1128
1209
  job_id?: string;
@@ -1136,16 +1217,20 @@ type ToolExecution<TData = unknown, TMeta = Record<string, unknown>> = {
1136
1217
  billing?: Record<string, unknown>;
1137
1218
  [key: string]: unknown;
1138
1219
  };
1220
+ /** Filters for `client.runs.list(...)`. */
1139
1221
  type RunsListOptions = {
1140
1222
  play: string;
1141
1223
  status?: string;
1142
1224
  };
1225
+ /** Streaming options for `client.runs.tail(...)`. */
1143
1226
  type RunsTailOptions = {
1144
1227
  signal?: AbortSignal;
1145
1228
  };
1229
+ /** Log fetch options for `client.runs.logs(...)`. */
1146
1230
  type RunsLogsOptions = {
1147
1231
  limit?: number;
1148
1232
  };
1233
+ /** Persisted log response for one play run. */
1149
1234
  type RunsLogsResult = {
1150
1235
  runId: string;
1151
1236
  totalCount: number;
@@ -1156,12 +1241,14 @@ type RunsLogsResult = {
1156
1241
  hasMore: boolean;
1157
1242
  entries: string[];
1158
1243
  };
1244
+ /** One persisted runtime-sheet row returned by `client.runs.exportDatasetRows(...)`. */
1159
1245
  type PlaySheetRow = {
1160
1246
  key?: string;
1161
1247
  status?: string;
1162
1248
  data?: Record<string, unknown>;
1163
1249
  [key: string]: unknown;
1164
1250
  };
1251
+ /** Runtime-sheet rows and aggregate progress for one dataset/table namespace. */
1165
1252
  type PlaySheetRowsResult = {
1166
1253
  rows: PlaySheetRow[];
1167
1254
  summary?: {
@@ -1191,13 +1278,27 @@ type PlaySecretMetadata = {
1191
1278
  updatedAt: number;
1192
1279
  lastUsedAt?: number;
1193
1280
  };
1281
+ /**
1282
+ * Public runs namespace exposed as `client.runs`.
1283
+ *
1284
+ * This namespace mirrors the canonical `/api/v2/runs` resource family and is
1285
+ * the preferred low-level surface for polling, streaming, stopping, reading
1286
+ * logs, and exporting durable dataset rows.
1287
+ *
1288
+ * @sdkReference client 020 client.runs
1289
+ */
1194
1290
  type RunsNamespace = {
1291
+ /** Get current run status by public run id. */
1195
1292
  get: (runId: string, options?: {
1196
1293
  full?: boolean;
1197
1294
  }) => Promise<PlayStatus>;
1295
+ /** List runs for one play, optionally filtered by status. */
1198
1296
  list: (options: RunsListOptions) => Promise<PlayRunListItem[]>;
1297
+ /** Stream run events and return the latest/terminal run status. */
1199
1298
  tail: (runId: string, options?: RunsTailOptions) => Promise<PlayStatus>;
1299
+ /** Fetch persisted log lines for a run. */
1200
1300
  logs: (runId: string, options?: RunsLogsOptions) => Promise<RunsLogsResult>;
1301
+ /** Export persisted rows for a runtime-sheet dataset/table namespace. */
1201
1302
  exportDatasetRows: (input: {
1202
1303
  playName: string;
1203
1304
  tableNamespace: string;
@@ -1205,6 +1306,7 @@ type RunsNamespace = {
1205
1306
  limit?: number;
1206
1307
  offset?: number;
1207
1308
  }) => Promise<PlaySheetRowsResult>;
1309
+ /** Stop a running/waiting run. */
1208
1310
  stop: (runId: string, options?: {
1209
1311
  reason?: string;
1210
1312
  }) => Promise<StopPlayRunResult>;
@@ -1228,12 +1330,20 @@ type RunsNamespace = {
1228
1330
  * baseUrl: 'http://localhost:3000',
1229
1331
  * });
1230
1332
  * ```
1333
+ *
1334
+ * @sdkReference client 010
1231
1335
  */
1232
1336
  declare class DeeplineClient {
1233
1337
  private readonly http;
1234
1338
  private readonly config;
1339
+ /** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
1235
1340
  readonly runs: RunsNamespace;
1236
1341
  /**
1342
+ * Create a low-level SDK client.
1343
+ *
1344
+ * Most callers can omit options and let the SDK resolve auth/config from
1345
+ * environment variables and CLI-managed credentials.
1346
+ *
1237
1347
  * @param options - Optional overrides for API key, base URL, timeout, and retries.
1238
1348
  * @throws {@link ConfigError} if no API key can be resolved from any source.
1239
1349
  */
@@ -1247,7 +1357,14 @@ declare class DeeplineClient {
1247
1357
  private playCloneEditStarter;
1248
1358
  private summarizePlayListItem;
1249
1359
  private summarizePlayDetail;
1360
+ /** List secret metadata visible to the current workspace. */
1250
1361
  listSecrets(): Promise<PlaySecretMetadata[]>;
1362
+ /**
1363
+ * Check whether a named secret exists, is active, and has a stored value.
1364
+ *
1365
+ * @param name - Secret name. It is normalized to uppercase before lookup.
1366
+ * @returns Matching active secret metadata, or `null`.
1367
+ */
1251
1368
  checkSecret(name: string): Promise<PlaySecretMetadata | null>;
1252
1369
  /**
1253
1370
  * List all available tools.
@@ -1303,7 +1420,19 @@ declare class DeeplineClient {
1303
1420
  * Deepline execution envelope.
1304
1421
  */
1305
1422
  executeTool<TData = unknown, TMeta = Record<string, unknown>>(toolId: string, input: Record<string, unknown>, options?: ExecuteToolRawOptions): Promise<ToolExecution<TData, TMeta>>;
1423
+ /**
1424
+ * Back-compatible alias for {@link executeTool}.
1425
+ *
1426
+ * Retained for callers that still use the older raw naming while the response
1427
+ * envelope remains the same.
1428
+ */
1306
1429
  executeToolRaw<TData = unknown, TMeta = Record<string, unknown>>(toolId: string, input: Record<string, unknown>, options?: ExecuteToolRawOptions): Promise<ToolExecution<TData, TMeta>>;
1430
+ /**
1431
+ * Run a bounded SQL query against the customer data plane.
1432
+ *
1433
+ * Use this from trusted backend or agent contexts only. The API enforces
1434
+ * workspace scoping and row limits.
1435
+ */
1307
1436
  queryCustomerDb(input: {
1308
1437
  sql: string;
1309
1438
  maxRows?: number;
@@ -1342,6 +1471,17 @@ declare class DeeplineClient {
1342
1471
  * ```
1343
1472
  */
1344
1473
  startPlayRun(request: StartPlayRunRequest): Promise<PlayRunStart>;
1474
+ /**
1475
+ * Start a play run and stream live runtime events from the same request.
1476
+ *
1477
+ * Use this when a caller wants low-level event handling instead of submitting
1478
+ * first and then connecting to `streamPlayRunEvents(runId)`.
1479
+ *
1480
+ * @param request - Play run configuration.
1481
+ * @param options - Optional streaming options.
1482
+ * @param options.signal - Optional abort signal for the streaming request.
1483
+ * @returns Async stream of play-scoped live events.
1484
+ */
1345
1485
  startPlayRunStream(request: StartPlayRunRequest, options?: {
1346
1486
  signal?: AbortSignal;
1347
1487
  }): AsyncGenerator<PlayLiveEvent>;
@@ -1374,6 +1514,12 @@ declare class DeeplineClient {
1374
1514
  triggerMetadata?: unknown;
1375
1515
  triggerBindings?: unknown;
1376
1516
  }>;
1517
+ /**
1518
+ * Register multiple bundled play artifacts in one request.
1519
+ *
1520
+ * Used by packaging and prebuilt publication flows. Each artifact is compiled
1521
+ * first when a compiler manifest is not already supplied.
1522
+ */
1377
1523
  registerPlayArtifacts(artifacts: Array<{
1378
1524
  name: string;
1379
1525
  sourceCode: string;
@@ -1400,6 +1546,13 @@ declare class DeeplineClient {
1400
1546
  triggerBindings?: unknown;
1401
1547
  }>;
1402
1548
  }>;
1549
+ /**
1550
+ * Compile a bundled play artifact into the server-side compiler manifest.
1551
+ *
1552
+ * The manifest records imports, trigger bindings, static pipeline shape, and
1553
+ * runtime metadata needed before a play artifact can be checked, registered,
1554
+ * or run.
1555
+ */
1403
1556
  compilePlayManifest(input: {
1404
1557
  name: string;
1405
1558
  sourceCode: string;
@@ -1420,12 +1573,24 @@ declare class DeeplineClient {
1420
1573
  sourceFiles?: Record<string, string>;
1421
1574
  artifact: Record<string, unknown>;
1422
1575
  }): Promise<PlayCheckResult>;
1576
+ /**
1577
+ * Compile legacy enrich command arguments into a runtime plan.
1578
+ *
1579
+ * This is primarily used by CLI compatibility paths that translate older
1580
+ * enrichment commands onto the play runtime.
1581
+ */
1423
1582
  compileEnrichPlan(input: {
1424
1583
  plan_args?: string[];
1425
1584
  config?: unknown;
1426
1585
  }): Promise<{
1427
1586
  config: EnrichCompiledConfig;
1428
1587
  }>;
1588
+ /**
1589
+ * Register an already-bundled play artifact and start a run from it.
1590
+ *
1591
+ * This is the low-level file-backed run path used by SDK/CLI packaging
1592
+ * wrappers after local bundling has produced the runtime artifact.
1593
+ */
1429
1594
  startPlayRunFromBundle(input: {
1430
1595
  name: string;
1431
1596
  sourceCode: string;
@@ -1502,6 +1667,12 @@ declare class DeeplineClient {
1502
1667
  contentType: string;
1503
1668
  bytes: number;
1504
1669
  }>): Promise<PlayStagedFileRef[]>;
1670
+ /**
1671
+ * Resolve staged play files by content hash without uploading bytes.
1672
+ *
1673
+ * Missing files are returned so callers can upload only the files the server
1674
+ * does not already have.
1675
+ */
1505
1676
  resolveStagedPlayFiles(files: Array<{
1506
1677
  logicalPath: string;
1507
1678
  contentHash: string;
@@ -1619,6 +1790,12 @@ declare class DeeplineClient {
1619
1790
  * ```
1620
1791
  */
1621
1792
  getRunLogs(runId: string, options?: RunsLogsOptions): Promise<RunsLogsResult>;
1793
+ /**
1794
+ * Export persisted runtime-sheet rows for a play dataset/table namespace.
1795
+ *
1796
+ * This is the SDK form of exporting `ctx.dataset(...).run()` output for a
1797
+ * specific play and optional run id.
1798
+ */
1622
1799
  getPlaySheetRows(input: {
1623
1800
  playName: string;
1624
1801
  tableNamespace: string;
@@ -1638,14 +1815,27 @@ declare class DeeplineClient {
1638
1815
  stopRun(runId: string, options?: {
1639
1816
  reason?: string;
1640
1817
  }): Promise<StopPlayRunResult>;
1818
+ /**
1819
+ * List callable plays visible to the workspace.
1820
+ *
1821
+ * Pass `origin: "prebuilt"` for Deepline-managed prebuilts or
1822
+ * `origin: "owned"` for org-owned plays.
1823
+ */
1641
1824
  listPlays(options?: {
1642
1825
  origin?: 'prebuilt' | 'owned';
1643
1826
  grep?: string;
1644
1827
  grepMode?: 'all' | 'any' | 'phrase';
1645
1828
  }): Promise<PlayListItem[]>;
1829
+ /**
1830
+ * Search callable plays and return compact play descriptions.
1831
+ *
1832
+ * Prebuilt plays are preferred by default because they have maintained
1833
+ * contracts and stable run behavior.
1834
+ */
1646
1835
  searchPlays(options: {
1647
1836
  query: string;
1648
1837
  compact?: boolean;
1838
+ scope?: 'prebuilt' | 'owned' | 'all';
1649
1839
  }): Promise<PlayDescription[]>;
1650
1840
  /**
1651
1841
  * Get the full definition and state of a named play.
@@ -1665,6 +1855,12 @@ declare class DeeplineClient {
1665
1855
  * ```
1666
1856
  */
1667
1857
  getPlay(name: string): Promise<PlayDetail>;
1858
+ /**
1859
+ * Get a normalized play description suitable for agents and CLIs.
1860
+ *
1861
+ * The description includes runnable examples, input/output summaries, clone
1862
+ * guidance, revision state, and latest run metadata when available.
1863
+ */
1668
1864
  describePlay(name: string, options?: {
1669
1865
  compact?: boolean;
1670
1866
  }): Promise<PlayDescription>;
@@ -1991,6 +2187,8 @@ type PlayDatasetTransformOptions = {
1991
2187
  * small and bounded. `PlayDataset` intentionally does not expose `.rows`,
1992
2188
  * `.toArray()`, or other array aliases; those hide the runtime cost of loading
1993
2189
  * persisted rows into memory.
2190
+ *
2191
+ * @sdkReference runtime 190
1994
2192
  */
1995
2193
  interface PlayDataset<T> extends AsyncIterable<T> {
1996
2194
  readonly [PLAY_DATASET_BRAND]: true;
@@ -2036,6 +2234,35 @@ interface PlayDataset<T> extends AsyncIterable<T> {
2036
2234
 
2037
2235
  type EmailStatusVerdict = 'send' | 'send_with_caution' | 'verify_next' | 'hold' | 'drop';
2038
2236
  type EmailStatusValue = 'valid' | 'invalid' | 'catch_all' | 'valid_catch_all' | 'unknown' | 'do_not_mail' | 'spamtrap' | 'abuse' | 'disposable';
2237
+ type EmailDeliverability = 'high' | 'medium' | 'low' | 'unknown';
2238
+ type EmailMxClass = 'consumer_mailbox' | 'workspace_mailbox' | 'security_gateway' | 'on_prem' | 'unknown';
2239
+ type EmailStatus = {
2240
+ verdict: EmailStatusVerdict;
2241
+ status: EmailStatusValue;
2242
+ verified: boolean;
2243
+ confidence: number | null;
2244
+ reasons: string[];
2245
+ signals: {
2246
+ catch_all: boolean | null;
2247
+ deliverability: EmailDeliverability;
2248
+ mx_class: EmailMxClass;
2249
+ mx_provider: string | null;
2250
+ mx_record: string | null;
2251
+ fraud_score: number | null;
2252
+ disposable: boolean | null;
2253
+ role_based: boolean | null;
2254
+ free_email: boolean | null;
2255
+ abuse: boolean | null;
2256
+ spamtrap: boolean | null;
2257
+ suspect: boolean | null;
2258
+ valid: boolean | null;
2259
+ };
2260
+ provider: {
2261
+ name: string;
2262
+ raw_status: string | boolean | number | null;
2263
+ raw_score: number | null;
2264
+ };
2265
+ };
2039
2266
  type EmailStatusMapEntry = {
2040
2267
  status: EmailStatusValue;
2041
2268
  verdict?: EmailStatusVerdict;
@@ -2065,6 +2292,153 @@ type EmailStatusExtractorConfig = {
2065
2292
  rules?: EmailStatusRule[];
2066
2293
  };
2067
2294
 
2295
+ declare const JOB_CHANGE_STATUS_VALUES: readonly ["moved", "no_change", "left_company", "unknown", "profile_unavailable", "no_new_company"];
2296
+ type JobChangeStatus = (typeof JOB_CHANGE_STATUS_VALUES)[number];
2297
+ type JobChangeGetterValue = {
2298
+ status: JobChangeStatus;
2299
+ date: string | null;
2300
+ new_company: string | null;
2301
+ new_title: string | null;
2302
+ };
2303
+ declare const PHONE_STATUS_VALUES: readonly ["valid", "invalid", "unknown"];
2304
+ type PhoneStatus = (typeof PHONE_STATUS_VALUES)[number];
2305
+ declare const DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS: {
2306
+ readonly id: {
2307
+ readonly identity: true;
2308
+ readonly valueKind: "string";
2309
+ };
2310
+ readonly name: {
2311
+ readonly identity: true;
2312
+ readonly valueKind: "string";
2313
+ };
2314
+ readonly email: {
2315
+ readonly identity: true;
2316
+ readonly valueKind: "string";
2317
+ };
2318
+ readonly personal_email: {
2319
+ readonly identity: true;
2320
+ readonly valueKind: "string";
2321
+ };
2322
+ readonly phone: {
2323
+ readonly identity: true;
2324
+ readonly valueKind: "string";
2325
+ };
2326
+ readonly linkedin: {
2327
+ readonly identity: true;
2328
+ readonly valueKind: "string";
2329
+ };
2330
+ readonly linkedin_url: {
2331
+ readonly identity: true;
2332
+ readonly valueKind: "string";
2333
+ };
2334
+ readonly domain: {
2335
+ readonly identity: true;
2336
+ readonly valueKind: "string";
2337
+ };
2338
+ readonly website: {
2339
+ readonly identity: true;
2340
+ readonly valueKind: "string";
2341
+ };
2342
+ readonly first_name: {
2343
+ readonly identity: true;
2344
+ readonly valueKind: "string";
2345
+ };
2346
+ readonly last_name: {
2347
+ readonly identity: true;
2348
+ readonly valueKind: "string";
2349
+ };
2350
+ readonly full_name: {
2351
+ readonly identity: true;
2352
+ readonly valueKind: "string";
2353
+ };
2354
+ readonly company: {
2355
+ readonly identity: true;
2356
+ readonly valueKind: "string";
2357
+ };
2358
+ readonly company_name: {
2359
+ readonly identity: true;
2360
+ readonly valueKind: "string";
2361
+ };
2362
+ readonly organization_name: {
2363
+ readonly identity: true;
2364
+ readonly valueKind: "string";
2365
+ };
2366
+ readonly company_domain: {
2367
+ readonly identity: true;
2368
+ readonly valueKind: "string";
2369
+ };
2370
+ readonly company_website: {
2371
+ readonly identity: true;
2372
+ readonly valueKind: "string";
2373
+ };
2374
+ readonly company_linkedin_url: {
2375
+ readonly identity: true;
2376
+ readonly valueKind: "string";
2377
+ };
2378
+ readonly title: {
2379
+ readonly identity: false;
2380
+ readonly valueKind: "string";
2381
+ };
2382
+ readonly industry: {
2383
+ readonly identity: false;
2384
+ readonly valueKind: "string";
2385
+ };
2386
+ readonly status: {
2387
+ readonly identity: false;
2388
+ readonly valueKind: "string";
2389
+ };
2390
+ readonly job_change: {
2391
+ readonly identity: false;
2392
+ readonly valueKind: "job_change";
2393
+ };
2394
+ readonly job_change_status: {
2395
+ readonly identity: false;
2396
+ readonly valueKind: "job_change_status";
2397
+ readonly enum: readonly ["moved", "no_change", "left_company", "unknown", "profile_unavailable", "no_new_company"];
2398
+ };
2399
+ readonly email_status: {
2400
+ readonly identity: false;
2401
+ readonly valueKind: "email_status";
2402
+ };
2403
+ readonly phone_status: {
2404
+ readonly identity: false;
2405
+ readonly valueKind: "phone_status";
2406
+ readonly enum: readonly ["valid", "invalid", "unknown"];
2407
+ };
2408
+ };
2409
+ type DeeplineExtractorTarget = keyof typeof DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS;
2410
+ declare const DEEPLINE_EXTRACTOR_TARGETS: DeeplineExtractorTarget[];
2411
+ type DeeplineEmailStatusGetterValue = EmailStatus | EmailStatusValue;
2412
+ type DeeplineGetterValueMap = {
2413
+ id: string;
2414
+ name: string;
2415
+ email: string;
2416
+ personal_email: string;
2417
+ phone: string;
2418
+ linkedin: string;
2419
+ linkedin_url: string;
2420
+ domain: string;
2421
+ website: string;
2422
+ first_name: string;
2423
+ last_name: string;
2424
+ full_name: string;
2425
+ company: string;
2426
+ company_name: string;
2427
+ organization_name: string;
2428
+ company_domain: string;
2429
+ company_website: string;
2430
+ company_linkedin_url: string;
2431
+ title: string;
2432
+ industry: string;
2433
+ status: string;
2434
+ job_change: JobChangeGetterValue;
2435
+ job_change_status: JobChangeStatus;
2436
+ email_status: DeeplineEmailStatusGetterValue;
2437
+ phone_status: PhoneStatus;
2438
+ };
2439
+ type DeeplineGetterValue<TTarget extends DeeplineExtractorTarget = DeeplineExtractorTarget> = DeeplineGetterValueMap[TTarget];
2440
+ declare function isDeeplineExtractorTarget(value: string): value is DeeplineExtractorTarget;
2441
+
2068
2442
  type ToolResultExecutionMetadata = {
2069
2443
  idempotent: true;
2070
2444
  cached: boolean;
@@ -2128,7 +2502,7 @@ type ToolExecuteResultBase<TResult = unknown, TMeta = Record<string, unknown>> =
2128
2502
  }>;
2129
2503
  };
2130
2504
  };
2131
- type ToolExecuteResultAccessors<TExtracted extends Record<string, unknown> = Record<string, unknown>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = {
2505
+ type ToolExecuteResultAccessors<TExtracted extends Record<string, unknown> = Partial<DeeplineGetterValueMap>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = {
2132
2506
  extractedValues: {
2133
2507
  [K in keyof TExtracted]: ToolResultTargetAccessor<TExtracted[K]>;
2134
2508
  };
@@ -2148,8 +2522,30 @@ type ToolExecuteResultAccessors<TExtracted extends Record<string, unknown> = Rec
2148
2522
  * Use extractors first when a tool contract exposes them. Drop to
2149
2523
  * `toolResponse.raw` when you need provider-specific fields or when debugging
2150
2524
  * from persisted run rows.
2525
+ *
2526
+ * @sdkReference runtime 200
2527
+ */
2528
+ type ToolExecuteResult<TResult = unknown, TMeta = Record<string, unknown>, TExtracted extends Record<string, unknown> = Partial<DeeplineGetterValueMap>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = ToolExecuteResultBase<TResult, TMeta> & ToolExecuteResultAccessors<TExtracted, TLists>;
2529
+
2530
+ /**
2531
+ * Previous durable cell value passed to object-column resolvers.
2532
+ *
2533
+ * The runtime supplies this when a row+column is being recomputed after a
2534
+ * previous value existed. `value` has the same type that the column returns;
2535
+ * freshness metadata lives beside it.
2536
+ *
2537
+ * @sdkReference runtime 120
2151
2538
  */
2152
- type ToolExecuteResult<TResult = unknown, TMeta = Record<string, unknown>, TExtracted extends Record<string, unknown> = Record<string, unknown>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = ToolExecuteResultBase<TResult, TMeta> & ToolExecuteResultAccessors<TExtracted, TLists>;
2539
+ type PreviousCell<Value = unknown> = {
2540
+ /** Previous completed value for this row+column. */
2541
+ value: Value;
2542
+ /** Millisecond timestamp when the previous value completed. */
2543
+ completedAt?: number;
2544
+ /** Millisecond timestamp when the previous value becomes stale; `null` means no expiry. */
2545
+ staleAt?: number | null;
2546
+ /** Resolved numeric TTL in seconds for the previous value, when present. */
2547
+ staleAfterSeconds?: number;
2548
+ };
2153
2549
 
2154
2550
  /**
2155
2551
  * Optional trigger bindings for a play.
@@ -2177,6 +2573,8 @@ type ToolExecuteResult<TResult = unknown, TMeta = Record<string, unknown>, TExtr
2177
2573
  * cron: { schedule: '0 2 * * *', timezone: 'UTC' },
2178
2574
  * });
2179
2575
  * ```
2576
+ *
2577
+ * @sdkReference runtime 030
2180
2578
  */
2181
2579
  type PlayBindings = {
2182
2580
  /** Optional per-run billing controls enforced by the runtime. */
@@ -2235,6 +2633,8 @@ type LoosePlayObject = {
2235
2633
  *
2236
2634
  * The `tool` value comes from live tool discovery. The `id` is the stable
2237
2635
  * logical call name inside this play and participates in replay/idempotency.
2636
+ *
2637
+ * @sdkReference runtime 160
2238
2638
  */
2239
2639
  type ToolExecutionRequest = {
2240
2640
  /** Stable logical id for this tool call within the play. */
@@ -2245,9 +2645,61 @@ type ToolExecutionRequest = {
2245
2645
  input: Record<string, unknown>;
2246
2646
  /** Human-readable description for logs and run inspection. */
2247
2647
  description?: string;
2648
+ /** Numeric TTL in seconds for this tool checkpoint. */
2248
2649
  staleAfterSeconds?: number;
2249
2650
  };
2250
- type StepResolver<Row, Value> = (row: Row, ctx: DeeplinePlayRuntimeContext, index: number) => Value | Promise<Value>;
2651
+ /**
2652
+ * Freshness policy for dataset cells and step-program columns.
2653
+ *
2654
+ * Use a positive whole number of seconds for a fixed TTL. Use a function when
2655
+ * the next expiry depends on the value that was just produced. The function
2656
+ * receives the completed cell value; return a positive whole number of seconds
2657
+ * to set the next expiry, or `null` to keep that value indefinitely.
2658
+ *
2659
+ * Result-based policies are evaluated only for dataset/step-program cells. The
2660
+ * scalar `ctx.step`, `ctx.fetch`, `ctx.runPlay`, and `ctx.tools.execute` APIs
2661
+ * accept numeric TTLs.
2662
+ *
2663
+ * @sdkReference runtime 080
2664
+ */
2665
+ type StaleAfterSeconds<Value = unknown> = number | ((value: Value) => number | null);
2666
+ type StepResolver<Row, Value> = (row: Row, ctx: DeeplinePlayRuntimeContext, index: number, previousCell?: PreviousCell<Value>) => Value | Promise<Value>;
2667
+ /**
2668
+ * Input object passed to an object-column `run` resolver.
2669
+ *
2670
+ * @sdkReference runtime 090
2671
+ */
2672
+ type DatasetColumnRunInput<Row, Value> = {
2673
+ /** Current row, including previously computed columns. */
2674
+ row: Row;
2675
+ /** Runtime context for tool/play/fetch/log calls. */
2676
+ ctx: DeeplinePlayRuntimeContext;
2677
+ /** Zero-based row index for this dataset run. */
2678
+ index: number;
2679
+ /**
2680
+ * The prior stored value for this exact row+column when the runtime has
2681
+ * decided the cell is due to run again. `previousCell.value` is the same type
2682
+ * this column returns; metadata such as `completedAt` and `staleAt` lives
2683
+ * beside it and is not mixed into the value.
2684
+ */
2685
+ previousCell?: PreviousCell<Value>;
2686
+ };
2687
+ /**
2688
+ * Object-column form for `.withColumn(...)`.
2689
+ *
2690
+ * Use this when a column needs `runIf`, typed `previousCell`, or a
2691
+ * result-based `staleAfterSeconds(value)` policy.
2692
+ *
2693
+ * @sdkReference runtime 100
2694
+ */
2695
+ type DatasetColumnDefinition<Row, Value> = {
2696
+ /** Compute one cell value. Receives the previous stored value when rerunning. */
2697
+ run: (input: DatasetColumnRunInput<Row, Value>) => Value | Promise<Value>;
2698
+ /** Optional row-level gate. Skipped rows produce `null` for this column. */
2699
+ readonly runIf?: (row: Row, index: number) => boolean | Promise<boolean>;
2700
+ /** Fixed or value-dependent freshness policy for this cell. */
2701
+ readonly staleAfterSeconds?: StaleAfterSeconds<Value>;
2702
+ };
2251
2703
  type ConditionalStepResolver<Row, Value, Else = null> = {
2252
2704
  readonly kind: 'conditional';
2253
2705
  readonly when: (row: Row, index: number) => boolean | Promise<boolean>;
@@ -2255,9 +2707,16 @@ type ConditionalStepResolver<Row, Value, Else = null> = {
2255
2707
  readonly elseValue: Else;
2256
2708
  else<ValueElse>(value: ValueElse): ConditionalStepResolver<Row, Value, ValueElse>;
2257
2709
  };
2258
- type StepOptions<Row> = {
2710
+ /**
2711
+ * Options for row-level `.withColumn(...)` and `steps().step(...)` entries.
2712
+ *
2713
+ * @sdkReference runtime 110
2714
+ */
2715
+ type StepOptions<Row, Value = unknown> = {
2716
+ /** Optional row-level gate. Skipped rows produce `null` for this column. */
2259
2717
  readonly runIf?: (row: Row, index: number) => boolean | Promise<boolean>;
2260
- readonly staleAfterSeconds?: number;
2718
+ /** Fixed or value-dependent freshness policy for this cell. */
2719
+ readonly staleAfterSeconds?: StaleAfterSeconds<Value>;
2261
2720
  };
2262
2721
  type StepProgram<Input, Output, Return = Output> = {
2263
2722
  readonly kind: 'steps';
@@ -2265,7 +2724,7 @@ type StepProgram<Input, Output, Return = Output> = {
2265
2724
  readonly returnResolver?: StepResolver<Output, Return>;
2266
2725
  readonly __inputType?: (input: Input) => void;
2267
2726
  step<Name extends string, Value>(name: Name, resolver: StepResolver<Output, Value> | ConditionalStepResolver<Output, Value> | StepProgramResolver<Output, Value>): StepProgram<Input, Output & Record<Name, Value>, Return>;
2268
- step<Name extends string, Value>(name: Name, resolver: StepResolver<Output, Value> | StepProgramResolver<Output, Value>, options: StepOptions<Output>): StepProgram<Input, Output & Record<Name, Value | null>, Return>;
2727
+ step<Name extends string, Value>(name: Name, resolver: StepResolver<Output, Value> | StepProgramResolver<Output, Value>, options: StepOptions<Output, Value>): StepProgram<Input, Output & Record<Name, Value | null>, Return>;
2269
2728
  return<Value>(resolver: StepResolver<Output, Value>): StepProgram<Input, Output, Value>;
2270
2729
  };
2271
2730
  type StepProgramResolver<Input, Return> = {
@@ -2276,11 +2735,16 @@ type StepProgramResolver<Input, Return> = {
2276
2735
  };
2277
2736
  type PlayStepProgramStep = {
2278
2737
  readonly name: string;
2279
- readonly staleAfterSeconds?: number;
2738
+ readonly staleAfterSeconds?: StaleAfterSeconds;
2280
2739
  readonly resolver: StepResolver<Record<string, unknown>, unknown> | ConditionalStepResolver<Record<string, unknown>, unknown> | StepProgramResolver<Record<string, unknown>, unknown>;
2281
2740
  };
2282
2741
  type ColumnResolver<Row, Value> = StepResolver<Row, Value> | ConditionalStepResolver<Row, Value> | StepProgramResolver<Row, Value>;
2283
2742
  type StepProgramOutput<TProgram> = TProgram extends StepProgram<any, infer Output, any> ? Output : never;
2743
+ /**
2744
+ * Builder returned by `ctx.dataset(...)` for row-level durable columns.
2745
+ *
2746
+ * @sdkReference runtime 070 .dataset(...).withColumn(name, resolver).run(options)
2747
+ */
2284
2748
  type DatasetBuilder<InputRow extends object, OutputRow extends object> = {
2285
2749
  /**
2286
2750
  * Define one output column for every row in this dataset.
@@ -2296,7 +2760,36 @@ type DatasetBuilder<InputRow extends object, OutputRow extends object> = {
2296
2760
  * @returns The same dataset builder with the new column type.
2297
2761
  */
2298
2762
  withColumn<Name extends string, Value>(name: Name, resolver: ColumnResolver<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value>>;
2299
- withColumn<Name extends string, Value>(name: Name, resolver: StepResolver<OutputRow, Value> | StepProgramResolver<OutputRow, Value>, options: StepOptions<OutputRow>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value | null>>;
2763
+ /**
2764
+ * Define one output column with object-column authoring and a row gate.
2765
+ *
2766
+ * @param name - Output column name.
2767
+ * @param definition - Object-column definition with required `runIf`.
2768
+ * @returns The same dataset builder with a nullable column type for skipped rows.
2769
+ */
2770
+ withColumn<Name extends string, Value>(name: Name, definition: DatasetColumnDefinition<OutputRow, Value> & {
2771
+ readonly runIf: (row: OutputRow, index: number) => boolean | Promise<boolean>;
2772
+ }): DatasetBuilder<InputRow, OutputRow & Record<Name, Value | null>>;
2773
+ /**
2774
+ * Define one output column with object-column authoring.
2775
+ *
2776
+ * Use this form for typed `previousCell` access or result-based
2777
+ * `staleAfterSeconds(value)` policies.
2778
+ *
2779
+ * @param name - Output column name.
2780
+ * @param definition - Object-column definition.
2781
+ * @returns The same dataset builder with the new column type.
2782
+ */
2783
+ withColumn<Name extends string, Value>(name: Name, definition: DatasetColumnDefinition<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value>>;
2784
+ /**
2785
+ * Define one output column with a resolver plus row-level options.
2786
+ *
2787
+ * @param name - Output column name.
2788
+ * @param resolver - Computes the value for one row.
2789
+ * @param options - Row gate and freshness options.
2790
+ * @returns The same dataset builder with a nullable column type for skipped rows.
2791
+ */
2792
+ withColumn<Name extends string, Value>(name: Name, resolver: StepResolver<OutputRow, Value> | StepProgramResolver<OutputRow, Value>, options: StepOptions<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value | null>>;
2300
2793
  withColumns<Program extends StepProgram<OutputRow, object, unknown>>(program: Program): DatasetBuilder<InputRow, StepProgramOutput<Program>>;
2301
2794
  /** @deprecated Dataset `.step(...)` was replaced by `.withColumn(...)`. */
2302
2795
  step<Name extends string, Value>(name: Name, resolver: ColumnResolver<OutputRow, Value>): never;
@@ -2334,7 +2827,11 @@ type CsvInput<TRow extends object = Record<string, unknown>> = FileInput<{
2334
2827
  readonly row: TRow;
2335
2828
  }>;
2336
2829
  type ColumnMap<TRow extends object> = Partial<Record<Extract<keyof TRow, string>, string | readonly string[]>>;
2337
- /** Options for loading a staged CSV with `ctx.csv(...)`. */
2830
+ /**
2831
+ * Options for loading a staged CSV with `ctx.csv(...)`.
2832
+ *
2833
+ * @sdkReference runtime 050
2834
+ */
2338
2835
  type CsvOptions = {
2339
2836
  /** Human-readable description for runtime logs and inspection. */
2340
2837
  description?: string;
@@ -2408,6 +2905,8 @@ interface DeeplinePlayRuntimeContext {
2408
2905
  * @param options - CSV load options.
2409
2906
  *
2410
2907
  * @returns A {@link PlayDataset} whose rows should usually flow directly into `ctx.dataset(...)`.
2908
+ *
2909
+ * @sdkReference runtime 040 ctx.csv(path, options)
2411
2910
  */
2412
2911
  csv<T = Record<string, unknown>>(path: string, options?: CsvOptions): Promise<PlayDataset<T>>;
2413
2912
  /**
@@ -2464,6 +2963,8 @@ interface DeeplinePlayRuntimeContext {
2464
2963
  * row.company?.employeeCount > 100 ? 'enterprise' : 'smb')
2465
2964
  * .run({ description: 'Enrich leads.' });
2466
2965
  * ```
2966
+ *
2967
+ * @sdkReference runtime 060 ctx.dataset(key, items)
2467
2968
  */
2468
2969
  dataset<TItem extends object>(key: string, items: PlayDatasetInput<TItem>): DatasetBuilder<TItem, TItem>;
2469
2970
  /**
@@ -2477,6 +2978,8 @@ interface DeeplinePlayRuntimeContext {
2477
2978
  *
2478
2979
  * @param request - Tool call request.
2479
2980
  * @returns Tool execution result.
2981
+ *
2982
+ * @sdkReference runtime 150 ctx.tools.execute(request)
2480
2983
  */
2481
2984
  execute<TOutput = LoosePlayObject>(request: ToolExecutionRequest & {
2482
2985
  staleAfterSeconds?: number;
@@ -2503,6 +3006,8 @@ interface DeeplinePlayRuntimeContext {
2503
3006
  * @param input - Program input.
2504
3007
  * @param options - Run options.
2505
3008
  * @returns Program output.
3009
+ *
3010
+ * @sdkReference runtime 180 ctx.runSteps(program, input, options)
2506
3011
  */
2507
3012
  runSteps<TInput extends Record<string, unknown>, TOutput>(program: StepProgram<TInput, any, TOutput>, input: TInput, options?: {
2508
3013
  description?: string;
@@ -2523,6 +3028,8 @@ interface DeeplinePlayRuntimeContext {
2523
3028
  * @param run - Computes the value once.
2524
3029
  * @param options - Checkpoint options.
2525
3030
  * @returns Checkpoint value.
3031
+ *
3032
+ * @sdkReference runtime 130 ctx.step(id, fn)
2526
3033
  */
2527
3034
  step<T>(id: string, run: () => T | Promise<T>, options?: {
2528
3035
  staleAfterSeconds?: number;
@@ -2539,6 +3046,8 @@ interface DeeplinePlayRuntimeContext {
2539
3046
  * @param url - URL to fetch.
2540
3047
  * @param init - Fetch options.
2541
3048
  * @returns Recorded response.
3049
+ *
3050
+ * @sdkReference runtime 170 ctx.fetch(key, url, init)
2542
3051
  */
2543
3052
  fetch(key: string, url: string | URL, init?: SecretAwareRequestInit, options?: {
2544
3053
  staleAfterSeconds?: number;
@@ -2551,6 +3060,11 @@ interface DeeplinePlayRuntimeContext {
2551
3060
  bodyText: string;
2552
3061
  json: unknown | null;
2553
3062
  }>;
3063
+ secrets: {
3064
+ get(name: string): SecretHandle;
3065
+ bearer(secret: SecretHandle): SecretAuth;
3066
+ header(header: string, secret: SecretHandle): SecretAuth;
3067
+ };
2554
3068
  /**
2555
3069
  * Invoke another registered or file-backed play as a child workflow.
2556
3070
  *
@@ -2566,12 +3080,9 @@ interface DeeplinePlayRuntimeContext {
2566
3080
  * @param input - Input object passed to the child play.
2567
3081
  * @param options - Child play options.
2568
3082
  * @returns Child play output.
3083
+ *
3084
+ * @sdkReference runtime 140 ctx.runPlay(key, playRef, input, options)
2569
3085
  */
2570
- secrets: {
2571
- get(name: string): SecretHandle;
2572
- bearer(secret: SecretHandle): SecretAuth;
2573
- header(header: string, secret: SecretHandle): SecretAuth;
2574
- };
2575
3086
  runPlay<TOutput = unknown>(key: string, playRef: string | PlayReferenceLike, input: Record<string, unknown>, options: {
2576
3087
  description?: string;
2577
3088
  staleAfterSeconds?: number;
@@ -2626,6 +3137,8 @@ interface DeeplinePlayRuntimeContext {
2626
3137
  * // Cancel if needed
2627
3138
  * await job.cancel();
2628
3139
  * ```
3140
+ *
3141
+ * @sdkReference plays 030
2629
3142
  */
2630
3143
  interface PlayJob<TOutput = unknown> {
2631
3144
  /** Temporal workflow ID for this execution. */
@@ -2699,6 +3212,8 @@ interface PlayJob<TOutput = unknown> {
2699
3212
  * // Publish the current draft
2700
3213
  * await play.publish();
2701
3214
  * ```
3215
+ *
3216
+ * @sdkReference plays 020
2702
3217
  */
2703
3218
  interface DeeplineNamedPlay<TInput = Record<string, unknown>, TOutput = unknown> {
2704
3219
  /** The play's name. */
@@ -2740,6 +3255,39 @@ interface DeeplineNamedPlay<TInput = Record<string, unknown>, TOutput = unknown>
2740
3255
  revisionId?: string;
2741
3256
  }): Promise<TOutput>;
2742
3257
  }
3258
+ /**
3259
+ * Tool/provider operations available from a connected {@link DeeplineContext}.
3260
+ *
3261
+ * This namespace is for regular SDK callers outside a play runtime. Inside a
3262
+ * `definePlay(...)` body, use `ctx.tools.execute({ id, tool, input, ... })`
3263
+ * so provider calls become durable runtime checkpoints.
3264
+ *
3265
+ * @sdkReference tools 010 DeeplineContext.tools
3266
+ */
3267
+ type DeeplineToolsNamespace = {
3268
+ /** List all available provider-backed tools. */
3269
+ list(): Promise<ToolDefinition[]>;
3270
+ /** Get detailed metadata for one provider-backed tool. */
3271
+ get(toolId: string): Promise<ToolMetadata>;
3272
+ /**
3273
+ * Execute a provider-backed tool from a regular SDK process.
3274
+ *
3275
+ * For durable play code, prefer `ctx.tools.execute(...)` because the play
3276
+ * runtime records the call under a stable id.
3277
+ */
3278
+ execute(toolId: string, input: Record<string, unknown>): Promise<ToolExecuteResult>;
3279
+ };
3280
+ /**
3281
+ * Named-play discovery and handle operations from a connected {@link DeeplineContext}.
3282
+ *
3283
+ * @sdkReference plays 010 DeeplineContext.plays
3284
+ */
3285
+ type DeeplinePlaysNamespace = {
3286
+ /** List saved and callable plays visible to the current workspace. */
3287
+ list(): Promise<PlayListItem[]>;
3288
+ /** Return a typed handle for a named, saved, shared, or prebuilt play. */
3289
+ get<TInput = Record<string, unknown>, TOutput = unknown>(name: string): DeeplineNamedPlay<TInput, TOutput>;
3290
+ };
2743
3291
  type PrebuiltPlayRef = {
2744
3292
  readonly playName: string;
2745
3293
  readonly name: string;
@@ -2763,6 +3311,8 @@ type PlayInputContract<TInput> = {
2763
3311
  * through `defineInput<T>(schema)`, or when configuration reads clearer as one
2764
3312
  * object. The shorthand `definePlay(name, fn, bindings?)` is equivalent for
2765
3313
  * simple file-backed plays.
3314
+ *
3315
+ * @sdkReference runtime 020
2766
3316
  */
2767
3317
  type DefinePlayConfig<TInput, TOutput extends PlayReturnObject> = {
2768
3318
  /** Play id/name. */
@@ -2842,9 +3392,19 @@ type PlayMetadata = {
2842
3392
  * const job = await deepline.play('email-waterfall').run({ domain: 'stripe.com' });
2843
3393
  * const output = await job.get();
2844
3394
  * ```
3395
+ *
3396
+ * @sdkReference entrypoints 020
2845
3397
  */
2846
3398
  declare class DeeplineContext {
2847
3399
  private readonly client;
3400
+ /**
3401
+ * Create a high-level SDK context.
3402
+ *
3403
+ * Most callers should use {@link Deepline.connect}; direct construction is
3404
+ * equivalent when you already have explicit client options.
3405
+ *
3406
+ * @param options - Optional SDK client configuration.
3407
+ */
2848
3408
  constructor(options?: DeeplineClientOptions);
2849
3409
  /**
2850
3410
  * Tool operations namespace.
@@ -2857,18 +3417,21 @@ declare class DeeplineContext {
2857
3417
  * const company = companyLookup.toolResponse.raw;
2858
3418
  * ```
2859
3419
  */
2860
- get tools(): {
2861
- /** List all available tools. */
2862
- list: () => Promise<ToolDefinition[]>;
2863
- /** Get detailed metadata for a tool. */
2864
- get: (toolId: string) => Promise<ToolMetadata>;
2865
- /** Execute a tool and return the standard execution envelope. */
2866
- execute: (toolId: string, input: Record<string, unknown>) => Promise<ToolExecuteResult>;
2867
- };
2868
- get plays(): {
2869
- list: () => Promise<PlayListItem[]>;
2870
- get: <TInput = Record<string, unknown>, TOutput = unknown>(name: string) => DeeplineNamedPlay<TInput, TOutput>;
2871
- };
3420
+ get tools(): DeeplineToolsNamespace;
3421
+ /**
3422
+ * Play discovery and named-play handles.
3423
+ *
3424
+ * Use `plays.list()` for discovery and `plays.get(name)` when you prefer a
3425
+ * namespace spelling over `ctx.play(name)`.
3426
+ */
3427
+ get plays(): DeeplinePlaysNamespace;
3428
+ /**
3429
+ * Convenience references for Deepline-managed prebuilt plays.
3430
+ *
3431
+ * Known prebuilts are exposed by camel-cased aliases. Any other property is
3432
+ * converted into `prebuilt/<property>` so callers can pass the reference to
3433
+ * `ctx.runPlay(...)`.
3434
+ */
2872
3435
  get prebuilt(): Record<string, PrebuiltPlayRef>;
2873
3436
  /**
2874
3437
  * Get a named play handle for remote lifecycle operations.
@@ -2886,6 +3449,17 @@ declare class DeeplineContext {
2886
3449
  * ```
2887
3450
  */
2888
3451
  play<TInput = Record<string, unknown>, TOutput = unknown>(name: string): DeeplineNamedPlay<TInput, TOutput>;
3452
+ /**
3453
+ * Run a named or prebuilt play and wait for its output.
3454
+ *
3455
+ * This is the high-level SDK equivalent of `ctx.play(name).runSync(input)`.
3456
+ * Inside a play runtime, prefer the in-play `ctx.runPlay(key, playRef, input,
3457
+ * options)` form so the child run is checkpointed under a stable key.
3458
+ *
3459
+ * @param playOrRef - Play name or prebuilt/reference object.
3460
+ * @param input - JSON input passed to the play.
3461
+ * @returns Completed play output.
3462
+ */
2889
3463
  runPlay<TInput = Record<string, unknown>, TOutput = unknown>(playOrRef: string | PlayReferenceLike, input: TInput): Promise<TOutput>;
2890
3464
  }
2891
3465
  /**
@@ -2899,6 +3473,8 @@ declare class DeeplineContext {
2899
3473
  * const tools = await deepline.tools.list();
2900
3474
  * const result = await deepline.tools.execute('test_company_search', { domain: 'stripe.com' });
2901
3475
  * ```
3476
+ *
3477
+ * @sdkReference entrypoints 010
2902
3478
  */
2903
3479
  declare class Deepline {
2904
3480
  /**
@@ -3189,4 +3765,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
3189
3765
  */
3190
3766
  declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
3191
3767
 
3192
- export { AuthError, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CsvInput, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, DeeplineError, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplineToolCategory, type DefinePlayConfig, type DefinedPlay, type FileInput, type LiveEventEnvelope, 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 PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunResult, type PlayRunStart, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, SDK_API_CONTRACT, SDK_VERSION, type StartPlayRunRequest, type StepProgram, type StepProgramResolver, type StepResolver, type ToolDefinition, type ToolExecuteResult, type ToolExecution, type ToolMetadata, defineInput, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
3768
+ export { AuthError, 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 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, type RunsListOptions, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, SDK_API_CONTRACT, SDK_VERSION, type StaleAfterSeconds, 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 };