deepline 0.1.85 → 0.1.89
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/cli/index.js +419 -70
- package/dist/cli/index.mjs +438 -83
- package/dist/index.d.mts +442 -60
- package/dist/index.d.ts +442 -60
- package/dist/index.js +161 -4
- package/dist/index.mjs +161 -4
- package/dist/repo/apps/play-runner-workers/src/dedup-do.ts +1 -0
- package/dist/repo/apps/play-runner-workers/src/entry.ts +276 -192
- package/dist/repo/sdk/src/client.ts +155 -1
- package/dist/repo/sdk/src/http.ts +11 -0
- package/dist/repo/sdk/src/index.ts +24 -1
- package/dist/repo/sdk/src/play.ts +198 -15
- package/dist/repo/sdk/src/release.ts +2 -2
- package/dist/repo/sdk/src/types.ts +61 -0
- package/dist/repo/sdk/src/worker-play-entry.ts +6 -3
- package/dist/repo/shared_libs/play-runtime/cell-staleness.ts +23 -0
- package/dist/repo/shared_libs/play-runtime/coordinator-headers.ts +10 -0
- package/dist/repo/shared_libs/play-runtime/scheduler-backend.ts +10 -1
- package/dist/repo/shared_libs/play-runtime/tool-result.ts +202 -12
- package/dist/repo/shared_libs/plays/bundling/index.ts +23 -16
- package/dist/repo/shared_libs/plays/dataset.ts +2 -0
- package/dist/repo/shared_libs/plays/row-identity.ts +14 -8
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -13,7 +13,17 @@ declare const PLAY_ARTIFACT_KINDS: {
|
|
|
13
13
|
};
|
|
14
14
|
type PlayArtifactKind = (typeof PLAY_ARTIFACT_KINDS)[keyof typeof PLAY_ARTIFACT_KINDS];
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* A top-level key the play's function literally `return`s. Derived from the
|
|
18
|
+
* `return { ... }` object literal — NOT from dataset `.withColumn(...)` names —
|
|
19
|
+
* so the "Returns" graph node mirrors the function's real output shape.
|
|
20
|
+
* `isDataset` is true when the key's value is a `PlayDataset` handle (a table).
|
|
21
|
+
*/
|
|
22
|
+
interface PlayStaticReturnField {
|
|
23
|
+
name: string;
|
|
24
|
+
isDataset: boolean;
|
|
25
|
+
}
|
|
26
|
+
interface PlayStaticPipeline {
|
|
17
27
|
tableNamespace?: string;
|
|
18
28
|
inputFields?: string[];
|
|
19
29
|
rowKeyFields?: string[];
|
|
@@ -22,16 +32,22 @@ interface PlayStaticPipelineSnapshot {
|
|
|
22
32
|
csvDescription?: string;
|
|
23
33
|
datasetDescription?: string;
|
|
24
34
|
fields: string[];
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Top-level keys of the play's `return { ... }` object literal, in source
|
|
37
|
+
* order. Undefined when the terminal return isn't a statically-known object
|
|
38
|
+
* literal (bare value, dataset handle, conditional returns, etc.).
|
|
39
|
+
*/
|
|
40
|
+
returnFields?: PlayStaticReturnField[];
|
|
41
|
+
stages?: PlayStaticSubstep[];
|
|
42
|
+
substeps: PlayStaticSubstep[];
|
|
43
|
+
sheetContract?: PlaySheetContract | null;
|
|
28
44
|
sheetContractErrors?: string[];
|
|
29
45
|
}
|
|
30
|
-
type
|
|
31
|
-
interface
|
|
46
|
+
type PlaySheetColumnSource = 'input' | 'datasetColumn' | 'waterfallStep' | 'childPlayColumn';
|
|
47
|
+
interface PlaySheetColumnContract {
|
|
32
48
|
id: string;
|
|
33
49
|
sqlName: string;
|
|
34
|
-
source:
|
|
50
|
+
source: PlaySheetColumnSource;
|
|
35
51
|
field?: string;
|
|
36
52
|
parentField?: string;
|
|
37
53
|
playId?: string;
|
|
@@ -42,44 +58,49 @@ interface PlaySheetColumnContractSnapshot {
|
|
|
42
58
|
toolId?: string;
|
|
43
59
|
isRowKey?: boolean;
|
|
44
60
|
}
|
|
45
|
-
interface
|
|
61
|
+
interface PlaySheetContract {
|
|
46
62
|
tableNamespace: string;
|
|
47
|
-
columns:
|
|
63
|
+
columns: PlaySheetColumnContract[];
|
|
48
64
|
}
|
|
49
|
-
type
|
|
50
|
-
interface
|
|
65
|
+
type PlayStaticColumnProducerKind = 'tool' | 'waterfall' | 'stepProgram' | 'playCall' | 'controlFlow' | 'transform';
|
|
66
|
+
interface PlayStaticColumnProducer {
|
|
51
67
|
id: string;
|
|
52
|
-
kind:
|
|
68
|
+
kind: PlayStaticColumnProducerKind;
|
|
53
69
|
field: string;
|
|
54
70
|
toolId?: string;
|
|
55
71
|
playId?: string;
|
|
72
|
+
dependsOnFields?: string[];
|
|
73
|
+
staleAfterSeconds?: number;
|
|
56
74
|
conditional?: boolean;
|
|
57
|
-
sourceRange?:
|
|
58
|
-
steps?:
|
|
59
|
-
substep:
|
|
75
|
+
sourceRange?: PlayStaticSourceRange;
|
|
76
|
+
steps?: PlayStaticColumnProducer[];
|
|
77
|
+
substep: PlayStaticSubstep;
|
|
60
78
|
}
|
|
61
|
-
interface
|
|
79
|
+
interface PlayStaticDatasetColumn {
|
|
62
80
|
id: string;
|
|
63
|
-
source:
|
|
81
|
+
source: PlaySheetColumnSource;
|
|
64
82
|
sqlName?: string;
|
|
65
|
-
|
|
83
|
+
staleAfterSeconds?: number;
|
|
84
|
+
producers: PlayStaticColumnProducer[];
|
|
66
85
|
}
|
|
67
|
-
interface
|
|
86
|
+
interface PlayStaticSourceRange {
|
|
68
87
|
sourcePath?: string;
|
|
69
88
|
startLine: number;
|
|
70
89
|
endLine: number;
|
|
71
90
|
startColumn: number;
|
|
72
91
|
endColumn: number;
|
|
73
92
|
}
|
|
74
|
-
type
|
|
93
|
+
type PlayStaticSubstepMetadata = {
|
|
75
94
|
conditional?: boolean;
|
|
95
|
+
dependsOnFields?: string[];
|
|
96
|
+
staleAfterSeconds?: number;
|
|
76
97
|
};
|
|
77
|
-
type
|
|
98
|
+
type PlayStaticSubstep = PlayStaticSubstepMetadata & ({
|
|
78
99
|
type: 'csv';
|
|
79
100
|
field: string;
|
|
80
101
|
path?: string;
|
|
81
102
|
description?: string;
|
|
82
|
-
sourceRange?:
|
|
103
|
+
sourceRange?: PlayStaticSourceRange;
|
|
83
104
|
callDepth?: number;
|
|
84
105
|
callPath?: string[];
|
|
85
106
|
} | {
|
|
@@ -90,22 +111,24 @@ type PlayStaticSubstepSnapshot = PlayStaticSubstepMetadataSnapshot & ({
|
|
|
90
111
|
inputFields?: string[];
|
|
91
112
|
rowKeyFields?: string[];
|
|
92
113
|
outputFields?: string[];
|
|
93
|
-
columns?:
|
|
114
|
+
columns?: PlayStaticDatasetColumn[];
|
|
94
115
|
waterfallIds?: string[];
|
|
95
|
-
steps?:
|
|
96
|
-
sheetContract?:
|
|
116
|
+
steps?: PlayStaticSubstep[];
|
|
117
|
+
sheetContract?: PlaySheetContract | null;
|
|
97
118
|
description?: string;
|
|
98
|
-
sourceRange?:
|
|
119
|
+
sourceRange?: PlayStaticSourceRange;
|
|
99
120
|
callDepth?: number;
|
|
100
121
|
callPath?: string[];
|
|
101
122
|
} | {
|
|
102
123
|
type: 'tool';
|
|
103
124
|
toolId: string;
|
|
104
125
|
field: string;
|
|
126
|
+
paramsSource?: string;
|
|
127
|
+
sourceText?: string;
|
|
105
128
|
description?: string;
|
|
106
129
|
inLoop?: boolean;
|
|
107
130
|
isEventWait?: boolean;
|
|
108
|
-
sourceRange?:
|
|
131
|
+
sourceRange?: PlayStaticSourceRange;
|
|
109
132
|
callDepth?: number;
|
|
110
133
|
callPath?: string[];
|
|
111
134
|
} | {
|
|
@@ -124,16 +147,16 @@ type PlayStaticSubstepSnapshot = PlayStaticSubstepMetadataSnapshot & ({
|
|
|
124
147
|
paramsSource?: string;
|
|
125
148
|
}>;
|
|
126
149
|
description?: string;
|
|
127
|
-
sourceRange?:
|
|
150
|
+
sourceRange?: PlayStaticSourceRange;
|
|
128
151
|
callDepth?: number;
|
|
129
152
|
callPath?: string[];
|
|
130
153
|
} | {
|
|
131
154
|
type: 'step_suite';
|
|
132
155
|
field: string;
|
|
133
|
-
steps:
|
|
156
|
+
steps: PlayStaticSubstep[];
|
|
134
157
|
returnSource?: string;
|
|
135
158
|
description?: string;
|
|
136
|
-
sourceRange?:
|
|
159
|
+
sourceRange?: PlayStaticSourceRange;
|
|
137
160
|
callDepth?: number;
|
|
138
161
|
callPath?: string[];
|
|
139
162
|
} | {
|
|
@@ -141,37 +164,40 @@ type PlayStaticSubstepSnapshot = PlayStaticSubstepMetadataSnapshot & ({
|
|
|
141
164
|
playId: string;
|
|
142
165
|
field: string;
|
|
143
166
|
inLoop?: boolean;
|
|
144
|
-
pipeline?:
|
|
167
|
+
pipeline?: PlayStaticPipeline | null;
|
|
145
168
|
cycleDetected?: boolean;
|
|
146
169
|
resolutionError?: string;
|
|
147
170
|
description?: string;
|
|
148
|
-
sourceRange?:
|
|
171
|
+
sourceRange?: PlayStaticSourceRange;
|
|
149
172
|
callDepth?: number;
|
|
150
173
|
callPath?: string[];
|
|
151
174
|
} | {
|
|
152
175
|
type: 'control_flow';
|
|
153
176
|
kind: 'conditional' | 'loop';
|
|
154
177
|
field: string;
|
|
155
|
-
steps:
|
|
178
|
+
steps: PlayStaticSubstep[];
|
|
156
179
|
description?: string;
|
|
157
|
-
sourceRange?:
|
|
180
|
+
sourceRange?: PlayStaticSourceRange;
|
|
158
181
|
callDepth?: number;
|
|
159
182
|
callPath?: string[];
|
|
160
183
|
} | {
|
|
161
184
|
type: 'run_javascript';
|
|
162
185
|
alias: string;
|
|
186
|
+
sourceText?: string;
|
|
163
187
|
description?: string;
|
|
164
|
-
sourceRange?:
|
|
188
|
+
sourceRange?: PlayStaticSourceRange;
|
|
165
189
|
callDepth?: number;
|
|
166
190
|
callPath?: string[];
|
|
167
191
|
} | {
|
|
168
192
|
type: 'code';
|
|
169
193
|
field: string;
|
|
194
|
+
sourceText?: string;
|
|
170
195
|
description?: string;
|
|
171
|
-
sourceRange?:
|
|
196
|
+
sourceRange?: PlayStaticSourceRange;
|
|
172
197
|
callDepth?: number;
|
|
173
198
|
callPath?: string[];
|
|
174
199
|
});
|
|
200
|
+
|
|
175
201
|
type PlayCompilerDependencyManifest = {
|
|
176
202
|
playName: string;
|
|
177
203
|
/** Original source path for direct imported definePlay dependencies. */
|
|
@@ -179,7 +205,7 @@ type PlayCompilerDependencyManifest = {
|
|
|
179
205
|
sourceHash: string;
|
|
180
206
|
graphHash: string;
|
|
181
207
|
artifactHash: string;
|
|
182
|
-
staticPipeline:
|
|
208
|
+
staticPipeline: PlayStaticPipeline;
|
|
183
209
|
};
|
|
184
210
|
type PlayCompilerManifest = {
|
|
185
211
|
compilerVersion: number;
|
|
@@ -188,7 +214,7 @@ type PlayCompilerManifest = {
|
|
|
188
214
|
graphHash: string;
|
|
189
215
|
artifactHash: string;
|
|
190
216
|
artifactKind?: PlayArtifactKind;
|
|
191
|
-
staticPipeline:
|
|
217
|
+
staticPipeline: PlayStaticPipeline;
|
|
192
218
|
importedPlayDependencies: PlayCompilerDependencyManifest[];
|
|
193
219
|
};
|
|
194
220
|
|
|
@@ -267,17 +293,33 @@ interface ResolvedConfig {
|
|
|
267
293
|
/** Max retry count for transient failures. */
|
|
268
294
|
maxRetries: number;
|
|
269
295
|
}
|
|
296
|
+
/** Column metadata returned by a customer data query. */
|
|
270
297
|
interface CustomerDbColumn {
|
|
298
|
+
/** Column name as returned by the database. */
|
|
271
299
|
name: string;
|
|
300
|
+
/** Internal table identifier when available. */
|
|
272
301
|
table_id: number | null;
|
|
302
|
+
/** Internal data-type identifier when available. */
|
|
273
303
|
data_type_id: number | null;
|
|
274
304
|
}
|
|
305
|
+
/**
|
|
306
|
+
* Result returned by {@link DeeplineClient.queryCustomerDb}.
|
|
307
|
+
*
|
|
308
|
+
* Rows are intentionally untyped because the schema depends on the caller's SQL
|
|
309
|
+
* query and selected customer tables.
|
|
310
|
+
*/
|
|
275
311
|
interface CustomerDbQueryResult {
|
|
312
|
+
/** Database command executed by the query endpoint. */
|
|
276
313
|
command: string;
|
|
314
|
+
/** Total affected row count when reported by the database. */
|
|
277
315
|
row_count: number | null;
|
|
316
|
+
/** Number of rows included in this response. */
|
|
278
317
|
row_count_returned: number;
|
|
318
|
+
/** Whether server-side row limits truncated the result. */
|
|
279
319
|
truncated: boolean;
|
|
320
|
+
/** Column metadata for the returned rows. */
|
|
280
321
|
columns: CustomerDbColumn[];
|
|
322
|
+
/** Result rows. */
|
|
281
323
|
rows: unknown[];
|
|
282
324
|
}
|
|
283
325
|
interface ToolPricingSummary {
|
|
@@ -297,6 +339,13 @@ interface ToolPricingSummary {
|
|
|
297
339
|
details: string[];
|
|
298
340
|
}
|
|
299
341
|
|
|
342
|
+
/**
|
|
343
|
+
* Summary definition of a callable provider-backed tool.
|
|
344
|
+
*
|
|
345
|
+
* Returned by {@link DeeplineClient.listTools} and ranked tool search. Use
|
|
346
|
+
* `getTool(toolId)` or the matching HTTP describe route for provider-specific
|
|
347
|
+
* schema, examples, pricing, and extraction guidance before executing.
|
|
348
|
+
*/
|
|
300
349
|
interface ToolDefinition {
|
|
301
350
|
/** Unique tool identifier used in API calls (e.g. `"apollo_people_search"`). */
|
|
302
351
|
toolId: string;
|
|
@@ -394,28 +443,53 @@ interface ToolDefinition {
|
|
|
394
443
|
term?: string;
|
|
395
444
|
}>;
|
|
396
445
|
}
|
|
446
|
+
/**
|
|
447
|
+
* Query options for ranked tool/provider discovery.
|
|
448
|
+
*/
|
|
397
449
|
interface ToolSearchOptions {
|
|
450
|
+
/** Free-text search query. */
|
|
398
451
|
query?: string;
|
|
452
|
+
/** Comma-separated category filter such as `company_search` or `email_finder`. */
|
|
399
453
|
categories?: string;
|
|
454
|
+
/** Optional explicit search terms used by agent/CLI callers. */
|
|
400
455
|
searchTerms?: string;
|
|
456
|
+
/** Search algorithm/version. Defaults to the current ranked mode. */
|
|
401
457
|
searchMode?: 'v1' | 'v2';
|
|
458
|
+
/** Include backend debug metadata in the search response. */
|
|
402
459
|
includeSearchDebug?: boolean;
|
|
403
460
|
}
|
|
461
|
+
/**
|
|
462
|
+
* Ranked tool/provider discovery response.
|
|
463
|
+
*
|
|
464
|
+
* Includes matching tools plus render/action hints used by the CLI and agents.
|
|
465
|
+
*/
|
|
404
466
|
interface ToolSearchResult {
|
|
467
|
+
/** Ranked matching tools. */
|
|
405
468
|
tools: ToolDefinition[];
|
|
469
|
+
/** Count included in this response when available. */
|
|
406
470
|
count?: number;
|
|
471
|
+
/** Total available count when the backend reports it. */
|
|
407
472
|
total?: number;
|
|
473
|
+
/** Whether results were truncated by server-side limits. */
|
|
408
474
|
truncated?: boolean;
|
|
475
|
+
/** Echoed query. */
|
|
409
476
|
query?: string;
|
|
477
|
+
/** Parsed category filters. */
|
|
410
478
|
categories?: string[];
|
|
479
|
+
/** Parsed search terms. */
|
|
411
480
|
search_terms?: string[];
|
|
481
|
+
/** Search mode used. */
|
|
412
482
|
search_mode?: 'v1' | 'v2';
|
|
483
|
+
/** Whether search fell back to category matching. */
|
|
413
484
|
search_fallback_to_category?: boolean;
|
|
485
|
+
/** Hint explaining omitted play results when searching tools only. */
|
|
414
486
|
omitted_plays_hint?: string;
|
|
487
|
+
/** Copyable CLI command templates for follow-up discovery/execution. */
|
|
415
488
|
commandTemplates?: {
|
|
416
489
|
describe?: string;
|
|
417
490
|
execute?: string;
|
|
418
491
|
};
|
|
492
|
+
/** Pre-rendered sections and actions for CLI/agent display. */
|
|
419
493
|
render?: {
|
|
420
494
|
sections?: Array<{
|
|
421
495
|
title: string;
|
|
@@ -534,9 +608,19 @@ type PlayRunActionPackage = {
|
|
|
534
608
|
datasetPath: string;
|
|
535
609
|
format: 'csv';
|
|
536
610
|
};
|
|
611
|
+
/**
|
|
612
|
+
* Compact canonical package for an inspected play run.
|
|
613
|
+
*
|
|
614
|
+
* This object is designed for SDK/CLI/API consumers that need stable run
|
|
615
|
+
* metadata, output handles, and follow-up actions without reading dashboard
|
|
616
|
+
* internals.
|
|
617
|
+
*/
|
|
537
618
|
interface PlayRunPackage {
|
|
619
|
+
/** Package schema version. */
|
|
538
620
|
schemaVersion: 1;
|
|
621
|
+
/** Package discriminator. */
|
|
539
622
|
kind: 'play_run';
|
|
623
|
+
/** Run identity, status, timing, and dashboard metadata. */
|
|
540
624
|
run: {
|
|
541
625
|
id: string;
|
|
542
626
|
playName: string;
|
|
@@ -548,8 +632,11 @@ interface PlayRunPackage {
|
|
|
548
632
|
durationMs?: number | null;
|
|
549
633
|
error?: string;
|
|
550
634
|
};
|
|
635
|
+
/** Step-level summaries emitted by the runtime. */
|
|
551
636
|
steps: Array<Record<string, unknown>>;
|
|
637
|
+
/** Named output summaries, including dataset handles and scalar outputs. */
|
|
552
638
|
outputs: Record<string, Record<string, unknown>>;
|
|
639
|
+
/** Follow-up actions a caller can perform against the run. */
|
|
553
640
|
next?: {
|
|
554
641
|
inspect?: PlayRunActionPackage;
|
|
555
642
|
export?: PlayRunActionPackage;
|
|
@@ -1136,6 +1223,13 @@ type EnrichCompiledConfig = {
|
|
|
1136
1223
|
type ExecuteToolRawOptions = {
|
|
1137
1224
|
includeToolMetadata?: boolean;
|
|
1138
1225
|
};
|
|
1226
|
+
/**
|
|
1227
|
+
* Standard provider/tool execution envelope returned by low-level SDK calls.
|
|
1228
|
+
*
|
|
1229
|
+
* `toolResponse.raw` contains the provider result. `extractedValues` and
|
|
1230
|
+
* `extractedLists` contain Deepline-normalized getters when the tool exposes
|
|
1231
|
+
* them. Billing fields are Deepline-facing and must not expose provider spend.
|
|
1232
|
+
*/
|
|
1139
1233
|
type ToolExecution<TData = unknown, TMeta = Record<string, unknown>> = {
|
|
1140
1234
|
status: string;
|
|
1141
1235
|
job_id?: string;
|
|
@@ -1149,16 +1243,20 @@ type ToolExecution<TData = unknown, TMeta = Record<string, unknown>> = {
|
|
|
1149
1243
|
billing?: Record<string, unknown>;
|
|
1150
1244
|
[key: string]: unknown;
|
|
1151
1245
|
};
|
|
1246
|
+
/** Filters for `client.runs.list(...)`. */
|
|
1152
1247
|
type RunsListOptions = {
|
|
1153
1248
|
play: string;
|
|
1154
1249
|
status?: string;
|
|
1155
1250
|
};
|
|
1251
|
+
/** Streaming options for `client.runs.tail(...)`. */
|
|
1156
1252
|
type RunsTailOptions = {
|
|
1157
1253
|
signal?: AbortSignal;
|
|
1158
1254
|
};
|
|
1255
|
+
/** Log fetch options for `client.runs.logs(...)`. */
|
|
1159
1256
|
type RunsLogsOptions = {
|
|
1160
1257
|
limit?: number;
|
|
1161
1258
|
};
|
|
1259
|
+
/** Persisted log response for one play run. */
|
|
1162
1260
|
type RunsLogsResult = {
|
|
1163
1261
|
runId: string;
|
|
1164
1262
|
totalCount: number;
|
|
@@ -1169,12 +1267,14 @@ type RunsLogsResult = {
|
|
|
1169
1267
|
hasMore: boolean;
|
|
1170
1268
|
entries: string[];
|
|
1171
1269
|
};
|
|
1270
|
+
/** One persisted runtime-sheet row returned by `client.runs.exportDatasetRows(...)`. */
|
|
1172
1271
|
type PlaySheetRow = {
|
|
1173
1272
|
key?: string;
|
|
1174
1273
|
status?: string;
|
|
1175
1274
|
data?: Record<string, unknown>;
|
|
1176
1275
|
[key: string]: unknown;
|
|
1177
1276
|
};
|
|
1277
|
+
/** Runtime-sheet rows and aggregate progress for one dataset/table namespace. */
|
|
1178
1278
|
type PlaySheetRowsResult = {
|
|
1179
1279
|
rows: PlaySheetRow[];
|
|
1180
1280
|
summary?: {
|
|
@@ -1204,13 +1304,27 @@ type PlaySecretMetadata = {
|
|
|
1204
1304
|
updatedAt: number;
|
|
1205
1305
|
lastUsedAt?: number;
|
|
1206
1306
|
};
|
|
1307
|
+
/**
|
|
1308
|
+
* Public runs namespace exposed as `client.runs`.
|
|
1309
|
+
*
|
|
1310
|
+
* This namespace mirrors the canonical `/api/v2/runs` resource family and is
|
|
1311
|
+
* the preferred low-level surface for polling, streaming, stopping, reading
|
|
1312
|
+
* logs, and exporting durable dataset rows.
|
|
1313
|
+
*
|
|
1314
|
+
* @sdkReference client 020 client.runs
|
|
1315
|
+
*/
|
|
1207
1316
|
type RunsNamespace = {
|
|
1317
|
+
/** Get current run status by public run id. */
|
|
1208
1318
|
get: (runId: string, options?: {
|
|
1209
1319
|
full?: boolean;
|
|
1210
1320
|
}) => Promise<PlayStatus>;
|
|
1321
|
+
/** List runs for one play, optionally filtered by status. */
|
|
1211
1322
|
list: (options: RunsListOptions) => Promise<PlayRunListItem[]>;
|
|
1323
|
+
/** Stream run events and return the latest/terminal run status. */
|
|
1212
1324
|
tail: (runId: string, options?: RunsTailOptions) => Promise<PlayStatus>;
|
|
1325
|
+
/** Fetch persisted log lines for a run. */
|
|
1213
1326
|
logs: (runId: string, options?: RunsLogsOptions) => Promise<RunsLogsResult>;
|
|
1327
|
+
/** Export persisted rows for a runtime-sheet dataset/table namespace. */
|
|
1214
1328
|
exportDatasetRows: (input: {
|
|
1215
1329
|
playName: string;
|
|
1216
1330
|
tableNamespace: string;
|
|
@@ -1218,6 +1332,7 @@ type RunsNamespace = {
|
|
|
1218
1332
|
limit?: number;
|
|
1219
1333
|
offset?: number;
|
|
1220
1334
|
}) => Promise<PlaySheetRowsResult>;
|
|
1335
|
+
/** Stop a running/waiting run. */
|
|
1221
1336
|
stop: (runId: string, options?: {
|
|
1222
1337
|
reason?: string;
|
|
1223
1338
|
}) => Promise<StopPlayRunResult>;
|
|
@@ -1241,12 +1356,20 @@ type RunsNamespace = {
|
|
|
1241
1356
|
* baseUrl: 'http://localhost:3000',
|
|
1242
1357
|
* });
|
|
1243
1358
|
* ```
|
|
1359
|
+
*
|
|
1360
|
+
* @sdkReference client 010
|
|
1244
1361
|
*/
|
|
1245
1362
|
declare class DeeplineClient {
|
|
1246
1363
|
private readonly http;
|
|
1247
1364
|
private readonly config;
|
|
1365
|
+
/** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
|
|
1248
1366
|
readonly runs: RunsNamespace;
|
|
1249
1367
|
/**
|
|
1368
|
+
* Create a low-level SDK client.
|
|
1369
|
+
*
|
|
1370
|
+
* Most callers can omit options and let the SDK resolve auth/config from
|
|
1371
|
+
* environment variables and CLI-managed credentials.
|
|
1372
|
+
*
|
|
1250
1373
|
* @param options - Optional overrides for API key, base URL, timeout, and retries.
|
|
1251
1374
|
* @throws {@link ConfigError} if no API key can be resolved from any source.
|
|
1252
1375
|
*/
|
|
@@ -1260,7 +1383,14 @@ declare class DeeplineClient {
|
|
|
1260
1383
|
private playCloneEditStarter;
|
|
1261
1384
|
private summarizePlayListItem;
|
|
1262
1385
|
private summarizePlayDetail;
|
|
1386
|
+
/** List secret metadata visible to the current workspace. */
|
|
1263
1387
|
listSecrets(): Promise<PlaySecretMetadata[]>;
|
|
1388
|
+
/**
|
|
1389
|
+
* Check whether a named secret exists, is active, and has a stored value.
|
|
1390
|
+
*
|
|
1391
|
+
* @param name - Secret name. It is normalized to uppercase before lookup.
|
|
1392
|
+
* @returns Matching active secret metadata, or `null`.
|
|
1393
|
+
*/
|
|
1264
1394
|
checkSecret(name: string): Promise<PlaySecretMetadata | null>;
|
|
1265
1395
|
/**
|
|
1266
1396
|
* List all available tools.
|
|
@@ -1316,7 +1446,19 @@ declare class DeeplineClient {
|
|
|
1316
1446
|
* Deepline execution envelope.
|
|
1317
1447
|
*/
|
|
1318
1448
|
executeTool<TData = unknown, TMeta = Record<string, unknown>>(toolId: string, input: Record<string, unknown>, options?: ExecuteToolRawOptions): Promise<ToolExecution<TData, TMeta>>;
|
|
1449
|
+
/**
|
|
1450
|
+
* Back-compatible alias for {@link executeTool}.
|
|
1451
|
+
*
|
|
1452
|
+
* Retained for callers that still use the older raw naming while the response
|
|
1453
|
+
* envelope remains the same.
|
|
1454
|
+
*/
|
|
1319
1455
|
executeToolRaw<TData = unknown, TMeta = Record<string, unknown>>(toolId: string, input: Record<string, unknown>, options?: ExecuteToolRawOptions): Promise<ToolExecution<TData, TMeta>>;
|
|
1456
|
+
/**
|
|
1457
|
+
* Run a bounded SQL query against the customer data plane.
|
|
1458
|
+
*
|
|
1459
|
+
* Use this from trusted backend or agent contexts only. The API enforces
|
|
1460
|
+
* workspace scoping and row limits.
|
|
1461
|
+
*/
|
|
1320
1462
|
queryCustomerDb(input: {
|
|
1321
1463
|
sql: string;
|
|
1322
1464
|
maxRows?: number;
|
|
@@ -1355,6 +1497,17 @@ declare class DeeplineClient {
|
|
|
1355
1497
|
* ```
|
|
1356
1498
|
*/
|
|
1357
1499
|
startPlayRun(request: StartPlayRunRequest): Promise<PlayRunStart>;
|
|
1500
|
+
/**
|
|
1501
|
+
* Start a play run and stream live runtime events from the same request.
|
|
1502
|
+
*
|
|
1503
|
+
* Use this when a caller wants low-level event handling instead of submitting
|
|
1504
|
+
* first and then connecting to `streamPlayRunEvents(runId)`.
|
|
1505
|
+
*
|
|
1506
|
+
* @param request - Play run configuration.
|
|
1507
|
+
* @param options - Optional streaming options.
|
|
1508
|
+
* @param options.signal - Optional abort signal for the streaming request.
|
|
1509
|
+
* @returns Async stream of play-scoped live events.
|
|
1510
|
+
*/
|
|
1358
1511
|
startPlayRunStream(request: StartPlayRunRequest, options?: {
|
|
1359
1512
|
signal?: AbortSignal;
|
|
1360
1513
|
}): AsyncGenerator<PlayLiveEvent>;
|
|
@@ -1387,6 +1540,12 @@ declare class DeeplineClient {
|
|
|
1387
1540
|
triggerMetadata?: unknown;
|
|
1388
1541
|
triggerBindings?: unknown;
|
|
1389
1542
|
}>;
|
|
1543
|
+
/**
|
|
1544
|
+
* Register multiple bundled play artifacts in one request.
|
|
1545
|
+
*
|
|
1546
|
+
* Used by packaging and prebuilt publication flows. Each artifact is compiled
|
|
1547
|
+
* first when a compiler manifest is not already supplied.
|
|
1548
|
+
*/
|
|
1390
1549
|
registerPlayArtifacts(artifacts: Array<{
|
|
1391
1550
|
name: string;
|
|
1392
1551
|
sourceCode: string;
|
|
@@ -1413,6 +1572,13 @@ declare class DeeplineClient {
|
|
|
1413
1572
|
triggerBindings?: unknown;
|
|
1414
1573
|
}>;
|
|
1415
1574
|
}>;
|
|
1575
|
+
/**
|
|
1576
|
+
* Compile a bundled play artifact into the server-side compiler manifest.
|
|
1577
|
+
*
|
|
1578
|
+
* The manifest records imports, trigger bindings, static pipeline shape, and
|
|
1579
|
+
* runtime metadata needed before a play artifact can be checked, registered,
|
|
1580
|
+
* or run.
|
|
1581
|
+
*/
|
|
1416
1582
|
compilePlayManifest(input: {
|
|
1417
1583
|
name: string;
|
|
1418
1584
|
sourceCode: string;
|
|
@@ -1433,12 +1599,24 @@ declare class DeeplineClient {
|
|
|
1433
1599
|
sourceFiles?: Record<string, string>;
|
|
1434
1600
|
artifact: Record<string, unknown>;
|
|
1435
1601
|
}): Promise<PlayCheckResult>;
|
|
1602
|
+
/**
|
|
1603
|
+
* Compile legacy enrich command arguments into a runtime plan.
|
|
1604
|
+
*
|
|
1605
|
+
* This is primarily used by CLI compatibility paths that translate older
|
|
1606
|
+
* enrichment commands onto the play runtime.
|
|
1607
|
+
*/
|
|
1436
1608
|
compileEnrichPlan(input: {
|
|
1437
1609
|
plan_args?: string[];
|
|
1438
1610
|
config?: unknown;
|
|
1439
1611
|
}): Promise<{
|
|
1440
1612
|
config: EnrichCompiledConfig;
|
|
1441
1613
|
}>;
|
|
1614
|
+
/**
|
|
1615
|
+
* Register an already-bundled play artifact and start a run from it.
|
|
1616
|
+
*
|
|
1617
|
+
* This is the low-level file-backed run path used by SDK/CLI packaging
|
|
1618
|
+
* wrappers after local bundling has produced the runtime artifact.
|
|
1619
|
+
*/
|
|
1442
1620
|
startPlayRunFromBundle(input: {
|
|
1443
1621
|
name: string;
|
|
1444
1622
|
sourceCode: string;
|
|
@@ -1515,6 +1693,12 @@ declare class DeeplineClient {
|
|
|
1515
1693
|
contentType: string;
|
|
1516
1694
|
bytes: number;
|
|
1517
1695
|
}>): Promise<PlayStagedFileRef[]>;
|
|
1696
|
+
/**
|
|
1697
|
+
* Resolve staged play files by content hash without uploading bytes.
|
|
1698
|
+
*
|
|
1699
|
+
* Missing files are returned so callers can upload only the files the server
|
|
1700
|
+
* does not already have.
|
|
1701
|
+
*/
|
|
1518
1702
|
resolveStagedPlayFiles(files: Array<{
|
|
1519
1703
|
logicalPath: string;
|
|
1520
1704
|
contentHash: string;
|
|
@@ -1632,6 +1816,12 @@ declare class DeeplineClient {
|
|
|
1632
1816
|
* ```
|
|
1633
1817
|
*/
|
|
1634
1818
|
getRunLogs(runId: string, options?: RunsLogsOptions): Promise<RunsLogsResult>;
|
|
1819
|
+
/**
|
|
1820
|
+
* Export persisted runtime-sheet rows for a play dataset/table namespace.
|
|
1821
|
+
*
|
|
1822
|
+
* This is the SDK form of exporting `ctx.dataset(...).run()` output for a
|
|
1823
|
+
* specific play and optional run id.
|
|
1824
|
+
*/
|
|
1635
1825
|
getPlaySheetRows(input: {
|
|
1636
1826
|
playName: string;
|
|
1637
1827
|
tableNamespace: string;
|
|
@@ -1651,14 +1841,27 @@ declare class DeeplineClient {
|
|
|
1651
1841
|
stopRun(runId: string, options?: {
|
|
1652
1842
|
reason?: string;
|
|
1653
1843
|
}): Promise<StopPlayRunResult>;
|
|
1844
|
+
/**
|
|
1845
|
+
* List callable plays visible to the workspace.
|
|
1846
|
+
*
|
|
1847
|
+
* Pass `origin: "prebuilt"` for Deepline-managed prebuilts or
|
|
1848
|
+
* `origin: "owned"` for org-owned plays.
|
|
1849
|
+
*/
|
|
1654
1850
|
listPlays(options?: {
|
|
1655
1851
|
origin?: 'prebuilt' | 'owned';
|
|
1656
1852
|
grep?: string;
|
|
1657
1853
|
grepMode?: 'all' | 'any' | 'phrase';
|
|
1658
1854
|
}): Promise<PlayListItem[]>;
|
|
1855
|
+
/**
|
|
1856
|
+
* Search callable plays and return compact play descriptions.
|
|
1857
|
+
*
|
|
1858
|
+
* Prebuilt plays are preferred by default because they have maintained
|
|
1859
|
+
* contracts and stable run behavior.
|
|
1860
|
+
*/
|
|
1659
1861
|
searchPlays(options: {
|
|
1660
1862
|
query: string;
|
|
1661
1863
|
compact?: boolean;
|
|
1864
|
+
scope?: 'prebuilt' | 'owned' | 'all';
|
|
1662
1865
|
}): Promise<PlayDescription[]>;
|
|
1663
1866
|
/**
|
|
1664
1867
|
* Get the full definition and state of a named play.
|
|
@@ -1678,6 +1881,12 @@ declare class DeeplineClient {
|
|
|
1678
1881
|
* ```
|
|
1679
1882
|
*/
|
|
1680
1883
|
getPlay(name: string): Promise<PlayDetail>;
|
|
1884
|
+
/**
|
|
1885
|
+
* Get a normalized play description suitable for agents and CLIs.
|
|
1886
|
+
*
|
|
1887
|
+
* The description includes runnable examples, input/output summaries, clone
|
|
1888
|
+
* guidance, revision state, and latest run metadata when available.
|
|
1889
|
+
*/
|
|
1681
1890
|
describePlay(name: string, options?: {
|
|
1682
1891
|
compact?: boolean;
|
|
1683
1892
|
}): Promise<PlayDescription>;
|
|
@@ -2004,6 +2213,8 @@ type PlayDatasetTransformOptions = {
|
|
|
2004
2213
|
* small and bounded. `PlayDataset` intentionally does not expose `.rows`,
|
|
2005
2214
|
* `.toArray()`, or other array aliases; those hide the runtime cost of loading
|
|
2006
2215
|
* persisted rows into memory.
|
|
2216
|
+
*
|
|
2217
|
+
* @sdkReference runtime 190
|
|
2007
2218
|
*/
|
|
2008
2219
|
interface PlayDataset<T> extends AsyncIterable<T> {
|
|
2009
2220
|
readonly [PLAY_DATASET_BRAND]: true;
|
|
@@ -2337,15 +2548,28 @@ type ToolExecuteResultAccessors<TExtracted extends Record<string, unknown> = Par
|
|
|
2337
2548
|
* Use extractors first when a tool contract exposes them. Drop to
|
|
2338
2549
|
* `toolResponse.raw` when you need provider-specific fields or when debugging
|
|
2339
2550
|
* from persisted run rows.
|
|
2551
|
+
*
|
|
2552
|
+
* @sdkReference runtime 200
|
|
2340
2553
|
*/
|
|
2341
2554
|
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>;
|
|
2342
2555
|
|
|
2343
|
-
|
|
2344
|
-
|
|
2556
|
+
/**
|
|
2557
|
+
* Previous durable cell value passed to object-column resolvers.
|
|
2558
|
+
*
|
|
2559
|
+
* The runtime supplies this when a row+column is being recomputed after a
|
|
2560
|
+
* previous value existed. `value` has the same type that the column returns;
|
|
2561
|
+
* freshness metadata lives beside it.
|
|
2562
|
+
*
|
|
2563
|
+
* @sdkReference runtime 120
|
|
2564
|
+
*/
|
|
2345
2565
|
type PreviousCell<Value = unknown> = {
|
|
2566
|
+
/** Previous completed value for this row+column. */
|
|
2346
2567
|
value: Value;
|
|
2568
|
+
/** Millisecond timestamp when the previous value completed. */
|
|
2347
2569
|
completedAt?: number;
|
|
2570
|
+
/** Millisecond timestamp when the previous value becomes stale; `null` means no expiry. */
|
|
2348
2571
|
staleAt?: number | null;
|
|
2572
|
+
/** Resolved numeric TTL in seconds for the previous value, when present. */
|
|
2349
2573
|
staleAfterSeconds?: number;
|
|
2350
2574
|
};
|
|
2351
2575
|
|
|
@@ -2375,6 +2599,8 @@ type PreviousCell<Value = unknown> = {
|
|
|
2375
2599
|
* cron: { schedule: '0 2 * * *', timezone: 'UTC' },
|
|
2376
2600
|
* });
|
|
2377
2601
|
* ```
|
|
2602
|
+
*
|
|
2603
|
+
* @sdkReference runtime 030
|
|
2378
2604
|
*/
|
|
2379
2605
|
type PlayBindings = {
|
|
2380
2606
|
/** Optional per-run billing controls enforced by the runtime. */
|
|
@@ -2433,6 +2659,8 @@ type LoosePlayObject = {
|
|
|
2433
2659
|
*
|
|
2434
2660
|
* The `tool` value comes from live tool discovery. The `id` is the stable
|
|
2435
2661
|
* logical call name inside this play and participates in replay/idempotency.
|
|
2662
|
+
*
|
|
2663
|
+
* @sdkReference runtime 160
|
|
2436
2664
|
*/
|
|
2437
2665
|
type ToolExecutionRequest = {
|
|
2438
2666
|
/** Stable logical id for this tool call within the play. */
|
|
@@ -2443,13 +2671,36 @@ type ToolExecutionRequest = {
|
|
|
2443
2671
|
input: Record<string, unknown>;
|
|
2444
2672
|
/** Human-readable description for logs and run inspection. */
|
|
2445
2673
|
description?: string;
|
|
2674
|
+
/** Numeric TTL in seconds for this tool checkpoint. */
|
|
2446
2675
|
staleAfterSeconds?: number;
|
|
2447
2676
|
};
|
|
2448
|
-
|
|
2677
|
+
/**
|
|
2678
|
+
* Freshness policy for dataset cells and step-program columns.
|
|
2679
|
+
*
|
|
2680
|
+
* Use a positive whole number of seconds for a fixed TTL. Use a function when
|
|
2681
|
+
* the next expiry depends on the value that was just produced. The function
|
|
2682
|
+
* receives the completed cell value; return a positive whole number of seconds
|
|
2683
|
+
* to set the next expiry, or `null` to keep that value indefinitely.
|
|
2684
|
+
*
|
|
2685
|
+
* Result-based policies are evaluated only for dataset/step-program cells. The
|
|
2686
|
+
* scalar `ctx.step`, `ctx.fetch`, `ctx.runPlay`, and `ctx.tools.execute` APIs
|
|
2687
|
+
* accept numeric TTLs.
|
|
2688
|
+
*
|
|
2689
|
+
* @sdkReference runtime 080
|
|
2690
|
+
*/
|
|
2691
|
+
type StaleAfterSeconds<Value = unknown> = number | ((value: Value) => number | null);
|
|
2449
2692
|
type StepResolver<Row, Value> = (row: Row, ctx: DeeplinePlayRuntimeContext, index: number, previousCell?: PreviousCell<Value>) => Value | Promise<Value>;
|
|
2693
|
+
/**
|
|
2694
|
+
* Input object passed to an object-column `run` resolver.
|
|
2695
|
+
*
|
|
2696
|
+
* @sdkReference runtime 090
|
|
2697
|
+
*/
|
|
2450
2698
|
type DatasetColumnRunInput<Row, Value> = {
|
|
2699
|
+
/** Current row, including previously computed columns. */
|
|
2451
2700
|
row: Row;
|
|
2701
|
+
/** Runtime context for tool/play/fetch/log calls. */
|
|
2452
2702
|
ctx: DeeplinePlayRuntimeContext;
|
|
2703
|
+
/** Zero-based row index for this dataset run. */
|
|
2453
2704
|
index: number;
|
|
2454
2705
|
/**
|
|
2455
2706
|
* The prior stored value for this exact row+column when the runtime has
|
|
@@ -2459,9 +2710,20 @@ type DatasetColumnRunInput<Row, Value> = {
|
|
|
2459
2710
|
*/
|
|
2460
2711
|
previousCell?: PreviousCell<Value>;
|
|
2461
2712
|
};
|
|
2713
|
+
/**
|
|
2714
|
+
* Object-column form for `.withColumn(...)`.
|
|
2715
|
+
*
|
|
2716
|
+
* Use this when a column needs `runIf`, typed `previousCell`, or a
|
|
2717
|
+
* result-based `staleAfterSeconds(value)` policy.
|
|
2718
|
+
*
|
|
2719
|
+
* @sdkReference runtime 100
|
|
2720
|
+
*/
|
|
2462
2721
|
type DatasetColumnDefinition<Row, Value> = {
|
|
2722
|
+
/** Compute one cell value. Receives the previous stored value when rerunning. */
|
|
2463
2723
|
run: (input: DatasetColumnRunInput<Row, Value>) => Value | Promise<Value>;
|
|
2724
|
+
/** Optional row-level gate. Skipped rows produce `null` for this column. */
|
|
2464
2725
|
readonly runIf?: (row: Row, index: number) => boolean | Promise<boolean>;
|
|
2726
|
+
/** Fixed or value-dependent freshness policy for this cell. */
|
|
2465
2727
|
readonly staleAfterSeconds?: StaleAfterSeconds<Value>;
|
|
2466
2728
|
};
|
|
2467
2729
|
type ConditionalStepResolver<Row, Value, Else = null> = {
|
|
@@ -2471,8 +2733,15 @@ type ConditionalStepResolver<Row, Value, Else = null> = {
|
|
|
2471
2733
|
readonly elseValue: Else;
|
|
2472
2734
|
else<ValueElse>(value: ValueElse): ConditionalStepResolver<Row, Value, ValueElse>;
|
|
2473
2735
|
};
|
|
2736
|
+
/**
|
|
2737
|
+
* Options for row-level `.withColumn(...)` and `steps().step(...)` entries.
|
|
2738
|
+
*
|
|
2739
|
+
* @sdkReference runtime 110
|
|
2740
|
+
*/
|
|
2474
2741
|
type StepOptions<Row, Value = unknown> = {
|
|
2742
|
+
/** Optional row-level gate. Skipped rows produce `null` for this column. */
|
|
2475
2743
|
readonly runIf?: (row: Row, index: number) => boolean | Promise<boolean>;
|
|
2744
|
+
/** Fixed or value-dependent freshness policy for this cell. */
|
|
2476
2745
|
readonly staleAfterSeconds?: StaleAfterSeconds<Value>;
|
|
2477
2746
|
};
|
|
2478
2747
|
type StepProgram<Input, Output, Return = Output> = {
|
|
@@ -2497,6 +2766,11 @@ type PlayStepProgramStep = {
|
|
|
2497
2766
|
};
|
|
2498
2767
|
type ColumnResolver<Row, Value> = StepResolver<Row, Value> | ConditionalStepResolver<Row, Value> | StepProgramResolver<Row, Value>;
|
|
2499
2768
|
type StepProgramOutput<TProgram> = TProgram extends StepProgram<any, infer Output, any> ? Output : never;
|
|
2769
|
+
/**
|
|
2770
|
+
* Builder returned by `ctx.dataset(...)` for row-level durable columns.
|
|
2771
|
+
*
|
|
2772
|
+
* @sdkReference runtime 070 .dataset(...).withColumn(name, resolver).run(options)
|
|
2773
|
+
*/
|
|
2500
2774
|
type DatasetBuilder<InputRow extends object, OutputRow extends object> = {
|
|
2501
2775
|
/**
|
|
2502
2776
|
* Define one output column for every row in this dataset.
|
|
@@ -2512,10 +2786,35 @@ type DatasetBuilder<InputRow extends object, OutputRow extends object> = {
|
|
|
2512
2786
|
* @returns The same dataset builder with the new column type.
|
|
2513
2787
|
*/
|
|
2514
2788
|
withColumn<Name extends string, Value>(name: Name, resolver: ColumnResolver<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value>>;
|
|
2789
|
+
/**
|
|
2790
|
+
* Define one output column with object-column authoring and a row gate.
|
|
2791
|
+
*
|
|
2792
|
+
* @param name - Output column name.
|
|
2793
|
+
* @param definition - Object-column definition with required `runIf`.
|
|
2794
|
+
* @returns The same dataset builder with a nullable column type for skipped rows.
|
|
2795
|
+
*/
|
|
2515
2796
|
withColumn<Name extends string, Value>(name: Name, definition: DatasetColumnDefinition<OutputRow, Value> & {
|
|
2516
2797
|
readonly runIf: (row: OutputRow, index: number) => boolean | Promise<boolean>;
|
|
2517
2798
|
}): DatasetBuilder<InputRow, OutputRow & Record<Name, Value | null>>;
|
|
2799
|
+
/**
|
|
2800
|
+
* Define one output column with object-column authoring.
|
|
2801
|
+
*
|
|
2802
|
+
* Use this form for typed `previousCell` access or result-based
|
|
2803
|
+
* `staleAfterSeconds(value)` policies.
|
|
2804
|
+
*
|
|
2805
|
+
* @param name - Output column name.
|
|
2806
|
+
* @param definition - Object-column definition.
|
|
2807
|
+
* @returns The same dataset builder with the new column type.
|
|
2808
|
+
*/
|
|
2518
2809
|
withColumn<Name extends string, Value>(name: Name, definition: DatasetColumnDefinition<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value>>;
|
|
2810
|
+
/**
|
|
2811
|
+
* Define one output column with a resolver plus row-level options.
|
|
2812
|
+
*
|
|
2813
|
+
* @param name - Output column name.
|
|
2814
|
+
* @param resolver - Computes the value for one row.
|
|
2815
|
+
* @param options - Row gate and freshness options.
|
|
2816
|
+
* @returns The same dataset builder with a nullable column type for skipped rows.
|
|
2817
|
+
*/
|
|
2519
2818
|
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>>;
|
|
2520
2819
|
withColumns<Program extends StepProgram<OutputRow, object, unknown>>(program: Program): DatasetBuilder<InputRow, StepProgramOutput<Program>>;
|
|
2521
2820
|
/** @deprecated Dataset `.step(...)` was replaced by `.withColumn(...)`. */
|
|
@@ -2554,7 +2853,11 @@ type CsvInput<TRow extends object = Record<string, unknown>> = FileInput<{
|
|
|
2554
2853
|
readonly row: TRow;
|
|
2555
2854
|
}>;
|
|
2556
2855
|
type ColumnMap<TRow extends object> = Partial<Record<Extract<keyof TRow, string>, string | readonly string[]>>;
|
|
2557
|
-
/**
|
|
2856
|
+
/**
|
|
2857
|
+
* Options for loading a staged CSV with `ctx.csv(...)`.
|
|
2858
|
+
*
|
|
2859
|
+
* @sdkReference runtime 050
|
|
2860
|
+
*/
|
|
2558
2861
|
type CsvOptions = {
|
|
2559
2862
|
/** Human-readable description for runtime logs and inspection. */
|
|
2560
2863
|
description?: string;
|
|
@@ -2628,6 +2931,8 @@ interface DeeplinePlayRuntimeContext {
|
|
|
2628
2931
|
* @param options - CSV load options.
|
|
2629
2932
|
*
|
|
2630
2933
|
* @returns A {@link PlayDataset} whose rows should usually flow directly into `ctx.dataset(...)`.
|
|
2934
|
+
*
|
|
2935
|
+
* @sdkReference runtime 040 ctx.csv(path, options)
|
|
2631
2936
|
*/
|
|
2632
2937
|
csv<T = Record<string, unknown>>(path: string, options?: CsvOptions): Promise<PlayDataset<T>>;
|
|
2633
2938
|
/**
|
|
@@ -2684,6 +2989,8 @@ interface DeeplinePlayRuntimeContext {
|
|
|
2684
2989
|
* row.company?.employeeCount > 100 ? 'enterprise' : 'smb')
|
|
2685
2990
|
* .run({ description: 'Enrich leads.' });
|
|
2686
2991
|
* ```
|
|
2992
|
+
*
|
|
2993
|
+
* @sdkReference runtime 060 ctx.dataset(key, items)
|
|
2687
2994
|
*/
|
|
2688
2995
|
dataset<TItem extends object>(key: string, items: PlayDatasetInput<TItem>): DatasetBuilder<TItem, TItem>;
|
|
2689
2996
|
/**
|
|
@@ -2697,6 +3004,8 @@ interface DeeplinePlayRuntimeContext {
|
|
|
2697
3004
|
*
|
|
2698
3005
|
* @param request - Tool call request.
|
|
2699
3006
|
* @returns Tool execution result.
|
|
3007
|
+
*
|
|
3008
|
+
* @sdkReference runtime 150 ctx.tools.execute(request)
|
|
2700
3009
|
*/
|
|
2701
3010
|
execute<TOutput = LoosePlayObject>(request: ToolExecutionRequest & {
|
|
2702
3011
|
staleAfterSeconds?: number;
|
|
@@ -2723,6 +3032,8 @@ interface DeeplinePlayRuntimeContext {
|
|
|
2723
3032
|
* @param input - Program input.
|
|
2724
3033
|
* @param options - Run options.
|
|
2725
3034
|
* @returns Program output.
|
|
3035
|
+
*
|
|
3036
|
+
* @sdkReference runtime 180 ctx.runSteps(program, input, options)
|
|
2726
3037
|
*/
|
|
2727
3038
|
runSteps<TInput extends Record<string, unknown>, TOutput>(program: StepProgram<TInput, any, TOutput>, input: TInput, options?: {
|
|
2728
3039
|
description?: string;
|
|
@@ -2743,6 +3054,8 @@ interface DeeplinePlayRuntimeContext {
|
|
|
2743
3054
|
* @param run - Computes the value once.
|
|
2744
3055
|
* @param options - Checkpoint options.
|
|
2745
3056
|
* @returns Checkpoint value.
|
|
3057
|
+
*
|
|
3058
|
+
* @sdkReference runtime 130 ctx.step(id, fn)
|
|
2746
3059
|
*/
|
|
2747
3060
|
step<T>(id: string, run: () => T | Promise<T>, options?: {
|
|
2748
3061
|
staleAfterSeconds?: number;
|
|
@@ -2759,6 +3072,8 @@ interface DeeplinePlayRuntimeContext {
|
|
|
2759
3072
|
* @param url - URL to fetch.
|
|
2760
3073
|
* @param init - Fetch options.
|
|
2761
3074
|
* @returns Recorded response.
|
|
3075
|
+
*
|
|
3076
|
+
* @sdkReference runtime 170 ctx.fetch(key, url, init)
|
|
2762
3077
|
*/
|
|
2763
3078
|
fetch(key: string, url: string | URL, init?: SecretAwareRequestInit, options?: {
|
|
2764
3079
|
staleAfterSeconds?: number;
|
|
@@ -2771,6 +3086,11 @@ interface DeeplinePlayRuntimeContext {
|
|
|
2771
3086
|
bodyText: string;
|
|
2772
3087
|
json: unknown | null;
|
|
2773
3088
|
}>;
|
|
3089
|
+
secrets: {
|
|
3090
|
+
get(name: string): SecretHandle;
|
|
3091
|
+
bearer(secret: SecretHandle): SecretAuth;
|
|
3092
|
+
header(header: string, secret: SecretHandle): SecretAuth;
|
|
3093
|
+
};
|
|
2774
3094
|
/**
|
|
2775
3095
|
* Invoke another registered or file-backed play as a child workflow.
|
|
2776
3096
|
*
|
|
@@ -2786,12 +3106,9 @@ interface DeeplinePlayRuntimeContext {
|
|
|
2786
3106
|
* @param input - Input object passed to the child play.
|
|
2787
3107
|
* @param options - Child play options.
|
|
2788
3108
|
* @returns Child play output.
|
|
3109
|
+
*
|
|
3110
|
+
* @sdkReference runtime 140 ctx.runPlay(key, playRef, input, options)
|
|
2789
3111
|
*/
|
|
2790
|
-
secrets: {
|
|
2791
|
-
get(name: string): SecretHandle;
|
|
2792
|
-
bearer(secret: SecretHandle): SecretAuth;
|
|
2793
|
-
header(header: string, secret: SecretHandle): SecretAuth;
|
|
2794
|
-
};
|
|
2795
3112
|
runPlay<TOutput = unknown>(key: string, playRef: string | PlayReferenceLike, input: Record<string, unknown>, options: {
|
|
2796
3113
|
description?: string;
|
|
2797
3114
|
staleAfterSeconds?: number;
|
|
@@ -2846,6 +3163,8 @@ interface DeeplinePlayRuntimeContext {
|
|
|
2846
3163
|
* // Cancel if needed
|
|
2847
3164
|
* await job.cancel();
|
|
2848
3165
|
* ```
|
|
3166
|
+
*
|
|
3167
|
+
* @sdkReference plays 030
|
|
2849
3168
|
*/
|
|
2850
3169
|
interface PlayJob<TOutput = unknown> {
|
|
2851
3170
|
/** Temporal workflow ID for this execution. */
|
|
@@ -2919,6 +3238,8 @@ interface PlayJob<TOutput = unknown> {
|
|
|
2919
3238
|
* // Publish the current draft
|
|
2920
3239
|
* await play.publish();
|
|
2921
3240
|
* ```
|
|
3241
|
+
*
|
|
3242
|
+
* @sdkReference plays 020
|
|
2922
3243
|
*/
|
|
2923
3244
|
interface DeeplineNamedPlay<TInput = Record<string, unknown>, TOutput = unknown> {
|
|
2924
3245
|
/** The play's name. */
|
|
@@ -2960,6 +3281,39 @@ interface DeeplineNamedPlay<TInput = Record<string, unknown>, TOutput = unknown>
|
|
|
2960
3281
|
revisionId?: string;
|
|
2961
3282
|
}): Promise<TOutput>;
|
|
2962
3283
|
}
|
|
3284
|
+
/**
|
|
3285
|
+
* Tool/provider operations available from a connected {@link DeeplineContext}.
|
|
3286
|
+
*
|
|
3287
|
+
* This namespace is for regular SDK callers outside a play runtime. Inside a
|
|
3288
|
+
* `definePlay(...)` body, use `ctx.tools.execute({ id, tool, input, ... })`
|
|
3289
|
+
* so provider calls become durable runtime checkpoints.
|
|
3290
|
+
*
|
|
3291
|
+
* @sdkReference tools 010 DeeplineContext.tools
|
|
3292
|
+
*/
|
|
3293
|
+
type DeeplineToolsNamespace = {
|
|
3294
|
+
/** List all available provider-backed tools. */
|
|
3295
|
+
list(): Promise<ToolDefinition[]>;
|
|
3296
|
+
/** Get detailed metadata for one provider-backed tool. */
|
|
3297
|
+
get(toolId: string): Promise<ToolMetadata>;
|
|
3298
|
+
/**
|
|
3299
|
+
* Execute a provider-backed tool from a regular SDK process.
|
|
3300
|
+
*
|
|
3301
|
+
* For durable play code, prefer `ctx.tools.execute(...)` because the play
|
|
3302
|
+
* runtime records the call under a stable id.
|
|
3303
|
+
*/
|
|
3304
|
+
execute(toolId: string, input: Record<string, unknown>): Promise<ToolExecuteResult>;
|
|
3305
|
+
};
|
|
3306
|
+
/**
|
|
3307
|
+
* Named-play discovery and handle operations from a connected {@link DeeplineContext}.
|
|
3308
|
+
*
|
|
3309
|
+
* @sdkReference plays 010 DeeplineContext.plays
|
|
3310
|
+
*/
|
|
3311
|
+
type DeeplinePlaysNamespace = {
|
|
3312
|
+
/** List saved and callable plays visible to the current workspace. */
|
|
3313
|
+
list(): Promise<PlayListItem[]>;
|
|
3314
|
+
/** Return a typed handle for a named, saved, shared, or prebuilt play. */
|
|
3315
|
+
get<TInput = Record<string, unknown>, TOutput = unknown>(name: string): DeeplineNamedPlay<TInput, TOutput>;
|
|
3316
|
+
};
|
|
2963
3317
|
type PrebuiltPlayRef = {
|
|
2964
3318
|
readonly playName: string;
|
|
2965
3319
|
readonly name: string;
|
|
@@ -2983,6 +3337,8 @@ type PlayInputContract<TInput> = {
|
|
|
2983
3337
|
* through `defineInput<T>(schema)`, or when configuration reads clearer as one
|
|
2984
3338
|
* object. The shorthand `definePlay(name, fn, bindings?)` is equivalent for
|
|
2985
3339
|
* simple file-backed plays.
|
|
3340
|
+
*
|
|
3341
|
+
* @sdkReference runtime 020
|
|
2986
3342
|
*/
|
|
2987
3343
|
type DefinePlayConfig<TInput, TOutput extends PlayReturnObject> = {
|
|
2988
3344
|
/** Play id/name. */
|
|
@@ -3062,9 +3418,19 @@ type PlayMetadata = {
|
|
|
3062
3418
|
* const job = await deepline.play('email-waterfall').run({ domain: 'stripe.com' });
|
|
3063
3419
|
* const output = await job.get();
|
|
3064
3420
|
* ```
|
|
3421
|
+
*
|
|
3422
|
+
* @sdkReference entrypoints 020
|
|
3065
3423
|
*/
|
|
3066
3424
|
declare class DeeplineContext {
|
|
3067
3425
|
private readonly client;
|
|
3426
|
+
/**
|
|
3427
|
+
* Create a high-level SDK context.
|
|
3428
|
+
*
|
|
3429
|
+
* Most callers should use {@link Deepline.connect}; direct construction is
|
|
3430
|
+
* equivalent when you already have explicit client options.
|
|
3431
|
+
*
|
|
3432
|
+
* @param options - Optional SDK client configuration.
|
|
3433
|
+
*/
|
|
3068
3434
|
constructor(options?: DeeplineClientOptions);
|
|
3069
3435
|
/**
|
|
3070
3436
|
* Tool operations namespace.
|
|
@@ -3077,18 +3443,21 @@ declare class DeeplineContext {
|
|
|
3077
3443
|
* const company = companyLookup.toolResponse.raw;
|
|
3078
3444
|
* ```
|
|
3079
3445
|
*/
|
|
3080
|
-
get tools():
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3446
|
+
get tools(): DeeplineToolsNamespace;
|
|
3447
|
+
/**
|
|
3448
|
+
* Play discovery and named-play handles.
|
|
3449
|
+
*
|
|
3450
|
+
* Use `plays.list()` for discovery and `plays.get(name)` when you prefer a
|
|
3451
|
+
* namespace spelling over `ctx.play(name)`.
|
|
3452
|
+
*/
|
|
3453
|
+
get plays(): DeeplinePlaysNamespace;
|
|
3454
|
+
/**
|
|
3455
|
+
* Convenience references for Deepline-managed prebuilt plays.
|
|
3456
|
+
*
|
|
3457
|
+
* Known prebuilts are exposed by camel-cased aliases. Any other property is
|
|
3458
|
+
* converted into `prebuilt/<property>` so callers can pass the reference to
|
|
3459
|
+
* `ctx.runPlay(...)`.
|
|
3460
|
+
*/
|
|
3092
3461
|
get prebuilt(): Record<string, PrebuiltPlayRef>;
|
|
3093
3462
|
/**
|
|
3094
3463
|
* Get a named play handle for remote lifecycle operations.
|
|
@@ -3106,6 +3475,17 @@ declare class DeeplineContext {
|
|
|
3106
3475
|
* ```
|
|
3107
3476
|
*/
|
|
3108
3477
|
play<TInput = Record<string, unknown>, TOutput = unknown>(name: string): DeeplineNamedPlay<TInput, TOutput>;
|
|
3478
|
+
/**
|
|
3479
|
+
* Run a named or prebuilt play and wait for its output.
|
|
3480
|
+
*
|
|
3481
|
+
* This is the high-level SDK equivalent of `ctx.play(name).runSync(input)`.
|
|
3482
|
+
* Inside a play runtime, prefer the in-play `ctx.runPlay(key, playRef, input,
|
|
3483
|
+
* options)` form so the child run is checkpointed under a stable key.
|
|
3484
|
+
*
|
|
3485
|
+
* @param playOrRef - Play name or prebuilt/reference object.
|
|
3486
|
+
* @param input - JSON input passed to the play.
|
|
3487
|
+
* @returns Completed play output.
|
|
3488
|
+
*/
|
|
3109
3489
|
runPlay<TInput = Record<string, unknown>, TOutput = unknown>(playOrRef: string | PlayReferenceLike, input: TInput): Promise<TOutput>;
|
|
3110
3490
|
}
|
|
3111
3491
|
/**
|
|
@@ -3119,6 +3499,8 @@ declare class DeeplineContext {
|
|
|
3119
3499
|
* const tools = await deepline.tools.list();
|
|
3120
3500
|
* const result = await deepline.tools.execute('test_company_search', { domain: 'stripe.com' });
|
|
3121
3501
|
* ```
|
|
3502
|
+
*
|
|
3503
|
+
* @sdkReference entrypoints 010
|
|
3122
3504
|
*/
|
|
3123
3505
|
declare class Deepline {
|
|
3124
3506
|
/**
|
|
@@ -3409,4 +3791,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
|
|
|
3409
3791
|
*/
|
|
3410
3792
|
declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
|
|
3411
3793
|
|
|
3412
|
-
export { AuthError, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CsvInput, DEEPLINE_EXTRACTOR_TARGETS, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, type DeeplineEmailStatusGetterValue, DeeplineError, type DeeplineExtractorTarget, type DeeplineGetterValue, type DeeplineGetterValueMap, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplineToolCategory, 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 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, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
|
|
3794
|
+
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 };
|