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.js
CHANGED
|
@@ -246,10 +246,10 @@ var import_node_path2 = require("path");
|
|
|
246
246
|
|
|
247
247
|
// src/release.ts
|
|
248
248
|
var SDK_RELEASE = {
|
|
249
|
-
version: "0.1.
|
|
249
|
+
version: "0.1.89",
|
|
250
250
|
apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
|
|
251
251
|
supportPolicy: {
|
|
252
|
-
latest: "0.1.
|
|
252
|
+
latest: "0.1.89",
|
|
253
253
|
minimumSupported: "0.1.53",
|
|
254
254
|
deprecatedBelow: "0.1.53"
|
|
255
255
|
}
|
|
@@ -263,6 +263,7 @@ var SDK_API_CONTRACT = SDK_RELEASE.apiContract;
|
|
|
263
263
|
var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
|
|
264
264
|
var COORDINATOR_URL_OVERRIDE_HEADER = "x-deepline-coordinator-url";
|
|
265
265
|
var WORKER_CALLBACK_URL_OVERRIDE_HEADER = "x-deepline-worker-callback-url";
|
|
266
|
+
var SYNTHETIC_RUN_HEADER = "x-deepline-synthetic-run";
|
|
266
267
|
|
|
267
268
|
// src/http.ts
|
|
268
269
|
var MAX_DIAGNOSTIC_HEADER_LENGTH = 120;
|
|
@@ -330,6 +331,10 @@ var HttpClient = class {
|
|
|
330
331
|
if (workerCallbackUrl?.trim()) {
|
|
331
332
|
headers[WORKER_CALLBACK_URL_OVERRIDE_HEADER] = workerCallbackUrl.trim();
|
|
332
333
|
}
|
|
334
|
+
const syntheticRun = typeof process !== "undefined" ? process.env?.DEEPLINE_SYNTHETIC_RUN : void 0;
|
|
335
|
+
if (syntheticRun && syntheticRun.trim() && syntheticRun.trim() !== "0") {
|
|
336
|
+
headers[SYNTHETIC_RUN_HEADER] = "1";
|
|
337
|
+
}
|
|
333
338
|
return headers;
|
|
334
339
|
}
|
|
335
340
|
/**
|
|
@@ -620,6 +625,21 @@ function isTransientCompileManifestError(error) {
|
|
|
620
625
|
function isRecord(value) {
|
|
621
626
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
622
627
|
}
|
|
628
|
+
function isPrebuiltPlayDescription(play) {
|
|
629
|
+
return play.origin === "prebuilt" || play.ownerType === "deepline";
|
|
630
|
+
}
|
|
631
|
+
function preferPrebuiltPlayDescriptions(plays) {
|
|
632
|
+
const prebuilt = [];
|
|
633
|
+
const owned = [];
|
|
634
|
+
for (const play of plays) {
|
|
635
|
+
if (isPrebuiltPlayDescription(play)) {
|
|
636
|
+
prebuilt.push(play);
|
|
637
|
+
} else {
|
|
638
|
+
owned.push(play);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
return [...prebuilt, ...owned];
|
|
642
|
+
}
|
|
623
643
|
function isPlayRunPackage(value) {
|
|
624
644
|
return Boolean(
|
|
625
645
|
value && typeof value === "object" && !Array.isArray(value) && value.kind === "play_run" && value.run && typeof value.run?.id === "string"
|
|
@@ -743,8 +763,14 @@ function playRunStatusFromState(state) {
|
|
|
743
763
|
var DeeplineClient = class {
|
|
744
764
|
http;
|
|
745
765
|
config;
|
|
766
|
+
/** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
|
|
746
767
|
runs;
|
|
747
768
|
/**
|
|
769
|
+
* Create a low-level SDK client.
|
|
770
|
+
*
|
|
771
|
+
* Most callers can omit options and let the SDK resolve auth/config from
|
|
772
|
+
* environment variables and CLI-managed credentials.
|
|
773
|
+
*
|
|
748
774
|
* @param options - Optional overrides for API key, base URL, timeout, and retries.
|
|
749
775
|
* @throws {@link ConfigError} if no API key can be resolved from any source.
|
|
750
776
|
*/
|
|
@@ -846,12 +872,19 @@ var DeeplineClient = class {
|
|
|
846
872
|
// ——————————————————————————————————————————————————————————
|
|
847
873
|
// Secrets
|
|
848
874
|
// ——————————————————————————————————————————————————————————
|
|
875
|
+
/** List secret metadata visible to the current workspace. */
|
|
849
876
|
async listSecrets() {
|
|
850
877
|
const response = await this.http.get(
|
|
851
878
|
"/api/v2/secrets"
|
|
852
879
|
);
|
|
853
880
|
return Array.isArray(response.secrets) ? response.secrets : [];
|
|
854
881
|
}
|
|
882
|
+
/**
|
|
883
|
+
* Check whether a named secret exists, is active, and has a stored value.
|
|
884
|
+
*
|
|
885
|
+
* @param name - Secret name. It is normalized to uppercase before lookup.
|
|
886
|
+
* @returns Matching active secret metadata, or `null`.
|
|
887
|
+
*/
|
|
855
888
|
async checkSecret(name) {
|
|
856
889
|
const normalized = name.trim().toUpperCase();
|
|
857
890
|
const secrets = await this.listSecrets();
|
|
@@ -964,9 +997,21 @@ var DeeplineClient = class {
|
|
|
964
997
|
headers
|
|
965
998
|
);
|
|
966
999
|
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Back-compatible alias for {@link executeTool}.
|
|
1002
|
+
*
|
|
1003
|
+
* Retained for callers that still use the older raw naming while the response
|
|
1004
|
+
* envelope remains the same.
|
|
1005
|
+
*/
|
|
967
1006
|
async executeToolRaw(toolId, input, options) {
|
|
968
1007
|
return this.executeTool(toolId, input, options);
|
|
969
1008
|
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Run a bounded SQL query against the customer data plane.
|
|
1011
|
+
*
|
|
1012
|
+
* Use this from trusted backend or agent contexts only. The API enforces
|
|
1013
|
+
* workspace scoping and row limits.
|
|
1014
|
+
*/
|
|
970
1015
|
async queryCustomerDb(input) {
|
|
971
1016
|
return this.http.post("/api/v2/db/query", {
|
|
972
1017
|
sql: input.sql,
|
|
@@ -1038,6 +1083,17 @@ var DeeplineClient = class {
|
|
|
1038
1083
|
);
|
|
1039
1084
|
return normalizePlayRunStart(response);
|
|
1040
1085
|
}
|
|
1086
|
+
/**
|
|
1087
|
+
* Start a play run and stream live runtime events from the same request.
|
|
1088
|
+
*
|
|
1089
|
+
* Use this when a caller wants low-level event handling instead of submitting
|
|
1090
|
+
* first and then connecting to `streamPlayRunEvents(runId)`.
|
|
1091
|
+
*
|
|
1092
|
+
* @param request - Play run configuration.
|
|
1093
|
+
* @param options - Optional streaming options.
|
|
1094
|
+
* @param options.signal - Optional abort signal for the streaming request.
|
|
1095
|
+
* @returns Async stream of play-scoped live events.
|
|
1096
|
+
*/
|
|
1041
1097
|
async *startPlayRunStream(request, options) {
|
|
1042
1098
|
const body = {
|
|
1043
1099
|
...request.name ? { name: request.name } : {},
|
|
@@ -1090,6 +1146,12 @@ var DeeplineClient = class {
|
|
|
1090
1146
|
compilerManifest
|
|
1091
1147
|
});
|
|
1092
1148
|
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Register multiple bundled play artifacts in one request.
|
|
1151
|
+
*
|
|
1152
|
+
* Used by packaging and prebuilt publication flows. Each artifact is compiled
|
|
1153
|
+
* first when a compiler manifest is not already supplied.
|
|
1154
|
+
*/
|
|
1093
1155
|
async registerPlayArtifacts(artifacts) {
|
|
1094
1156
|
const compiledArtifacts = await Promise.all(
|
|
1095
1157
|
artifacts.map(async (artifact) => ({
|
|
@@ -1106,6 +1168,13 @@ var DeeplineClient = class {
|
|
|
1106
1168
|
artifacts: compiledArtifacts
|
|
1107
1169
|
});
|
|
1108
1170
|
}
|
|
1171
|
+
/**
|
|
1172
|
+
* Compile a bundled play artifact into the server-side compiler manifest.
|
|
1173
|
+
*
|
|
1174
|
+
* The manifest records imports, trigger bindings, static pipeline shape, and
|
|
1175
|
+
* runtime metadata needed before a play artifact can be checked, registered,
|
|
1176
|
+
* or run.
|
|
1177
|
+
*/
|
|
1109
1178
|
async compilePlayManifest(input) {
|
|
1110
1179
|
const retryDelays = COMPILE_MANIFEST_RETRY_DELAYS_MS.slice(
|
|
1111
1180
|
0,
|
|
@@ -1134,9 +1203,21 @@ var DeeplineClient = class {
|
|
|
1134
1203
|
async checkPlayArtifact(input) {
|
|
1135
1204
|
return this.http.post("/api/v2/plays/check", input);
|
|
1136
1205
|
}
|
|
1206
|
+
/**
|
|
1207
|
+
* Compile legacy enrich command arguments into a runtime plan.
|
|
1208
|
+
*
|
|
1209
|
+
* This is primarily used by CLI compatibility paths that translate older
|
|
1210
|
+
* enrichment commands onto the play runtime.
|
|
1211
|
+
*/
|
|
1137
1212
|
async compileEnrichPlan(input) {
|
|
1138
1213
|
return this.http.post("/api/v2/enrich/compile", input);
|
|
1139
1214
|
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Register an already-bundled play artifact and start a run from it.
|
|
1217
|
+
*
|
|
1218
|
+
* This is the low-level file-backed run path used by SDK/CLI packaging
|
|
1219
|
+
* wrappers after local bundling has produced the runtime artifact.
|
|
1220
|
+
*/
|
|
1140
1221
|
async startPlayRunFromBundle(input) {
|
|
1141
1222
|
const compilerManifest = input.compilerManifest ?? await this.compilePlayManifest({
|
|
1142
1223
|
name: input.name,
|
|
@@ -1294,6 +1375,12 @@ var DeeplineClient = class {
|
|
|
1294
1375
|
const response = await this.http.postFormData("/api/v2/plays/files/stage", buildFormData);
|
|
1295
1376
|
return response.files;
|
|
1296
1377
|
}
|
|
1378
|
+
/**
|
|
1379
|
+
* Resolve staged play files by content hash without uploading bytes.
|
|
1380
|
+
*
|
|
1381
|
+
* Missing files are returned so callers can upload only the files the server
|
|
1382
|
+
* does not already have.
|
|
1383
|
+
*/
|
|
1297
1384
|
async resolveStagedPlayFiles(files) {
|
|
1298
1385
|
return this.http.post("/api/v2/plays/files/stage", { files });
|
|
1299
1386
|
}
|
|
@@ -1510,6 +1597,12 @@ var DeeplineClient = class {
|
|
|
1510
1597
|
entries
|
|
1511
1598
|
};
|
|
1512
1599
|
}
|
|
1600
|
+
/**
|
|
1601
|
+
* Export persisted runtime-sheet rows for a play dataset/table namespace.
|
|
1602
|
+
*
|
|
1603
|
+
* This is the SDK form of exporting `ctx.dataset(...).run()` output for a
|
|
1604
|
+
* specific play and optional run id.
|
|
1605
|
+
*/
|
|
1513
1606
|
async getPlaySheetRows(input) {
|
|
1514
1607
|
const params = new URLSearchParams({
|
|
1515
1608
|
tableNamespace: input.tableNamespace,
|
|
@@ -1538,6 +1631,12 @@ var DeeplineClient = class {
|
|
|
1538
1631
|
options?.reason ? { reason: options.reason } : {}
|
|
1539
1632
|
);
|
|
1540
1633
|
}
|
|
1634
|
+
/**
|
|
1635
|
+
* List callable plays visible to the workspace.
|
|
1636
|
+
*
|
|
1637
|
+
* Pass `origin: "prebuilt"` for Deepline-managed prebuilts or
|
|
1638
|
+
* `origin: "owned"` for org-owned plays.
|
|
1639
|
+
*/
|
|
1541
1640
|
async listPlays(options) {
|
|
1542
1641
|
const params = new URLSearchParams();
|
|
1543
1642
|
if (options?.origin) params.set("origin", options.origin);
|
|
@@ -1552,15 +1651,32 @@ var DeeplineClient = class {
|
|
|
1552
1651
|
);
|
|
1553
1652
|
return response.plays ?? [];
|
|
1554
1653
|
}
|
|
1654
|
+
/**
|
|
1655
|
+
* Search callable plays and return compact play descriptions.
|
|
1656
|
+
*
|
|
1657
|
+
* Prebuilt plays are preferred by default because they have maintained
|
|
1658
|
+
* contracts and stable run behavior.
|
|
1659
|
+
*/
|
|
1555
1660
|
async searchPlays(options) {
|
|
1556
1661
|
const params = new URLSearchParams();
|
|
1557
1662
|
params.set("search", options.query.trim());
|
|
1663
|
+
const scope = options.scope ?? "prebuilt";
|
|
1664
|
+
if (scope !== "all") {
|
|
1665
|
+
params.set("origin", scope);
|
|
1666
|
+
}
|
|
1558
1667
|
const response = await this.http.get(
|
|
1559
1668
|
`/api/v2/plays?${params.toString()}`
|
|
1560
1669
|
);
|
|
1561
|
-
|
|
1670
|
+
const plays = (response.plays ?? []).map(
|
|
1562
1671
|
(play) => this.summarizePlayListItem(play, options)
|
|
1563
1672
|
);
|
|
1673
|
+
if (scope === "prebuilt") {
|
|
1674
|
+
return plays.filter(isPrebuiltPlayDescription);
|
|
1675
|
+
}
|
|
1676
|
+
if (scope === "owned") {
|
|
1677
|
+
return plays.filter((play) => !isPrebuiltPlayDescription(play));
|
|
1678
|
+
}
|
|
1679
|
+
return preferPrebuiltPlayDescriptions(plays);
|
|
1564
1680
|
}
|
|
1565
1681
|
/**
|
|
1566
1682
|
* Get the full definition and state of a named play.
|
|
@@ -1583,6 +1699,12 @@ var DeeplineClient = class {
|
|
|
1583
1699
|
const encodedName = encodeURIComponent(name);
|
|
1584
1700
|
return this.http.get(`/api/v2/plays/${encodedName}`);
|
|
1585
1701
|
}
|
|
1702
|
+
/**
|
|
1703
|
+
* Get a normalized play description suitable for agents and CLIs.
|
|
1704
|
+
*
|
|
1705
|
+
* The description includes runnable examples, input/output summaries, clone
|
|
1706
|
+
* guidance, revision state, and latest run metadata when available.
|
|
1707
|
+
*/
|
|
1586
1708
|
async describePlay(name, options) {
|
|
1587
1709
|
const detail = await this.getPlay(name);
|
|
1588
1710
|
return this.summarizePlayDetail(detail, options);
|
|
@@ -2736,7 +2858,10 @@ var DeeplineStepProgram = class _DeeplineStepProgram {
|
|
|
2736
2858
|
...this.steps,
|
|
2737
2859
|
{
|
|
2738
2860
|
name,
|
|
2739
|
-
resolver: stepResolver
|
|
2861
|
+
resolver: stepResolver,
|
|
2862
|
+
...options?.staleAfterSeconds !== void 0 ? {
|
|
2863
|
+
staleAfterSeconds: options.staleAfterSeconds
|
|
2864
|
+
} : {}
|
|
2740
2865
|
}
|
|
2741
2866
|
],
|
|
2742
2867
|
this.returnResolver
|
|
@@ -2836,6 +2961,14 @@ function createNamedPlayHandle(clientFactory, name) {
|
|
|
2836
2961
|
}
|
|
2837
2962
|
var DeeplineContext = class {
|
|
2838
2963
|
client;
|
|
2964
|
+
/**
|
|
2965
|
+
* Create a high-level SDK context.
|
|
2966
|
+
*
|
|
2967
|
+
* Most callers should use {@link Deepline.connect}; direct construction is
|
|
2968
|
+
* equivalent when you already have explicit client options.
|
|
2969
|
+
*
|
|
2970
|
+
* @param options - Optional SDK client configuration.
|
|
2971
|
+
*/
|
|
2839
2972
|
constructor(options) {
|
|
2840
2973
|
this.client = new DeeplineClient(options);
|
|
2841
2974
|
}
|
|
@@ -2865,12 +2998,25 @@ var DeeplineContext = class {
|
|
|
2865
2998
|
}
|
|
2866
2999
|
};
|
|
2867
3000
|
}
|
|
3001
|
+
/**
|
|
3002
|
+
* Play discovery and named-play handles.
|
|
3003
|
+
*
|
|
3004
|
+
* Use `plays.list()` for discovery and `plays.get(name)` when you prefer a
|
|
3005
|
+
* namespace spelling over `ctx.play(name)`.
|
|
3006
|
+
*/
|
|
2868
3007
|
get plays() {
|
|
2869
3008
|
return {
|
|
2870
3009
|
list: () => this.client.listPlays(),
|
|
2871
3010
|
get: (name) => this.play(name)
|
|
2872
3011
|
};
|
|
2873
3012
|
}
|
|
3013
|
+
/**
|
|
3014
|
+
* Convenience references for Deepline-managed prebuilt plays.
|
|
3015
|
+
*
|
|
3016
|
+
* Known prebuilts are exposed by camel-cased aliases. Any other property is
|
|
3017
|
+
* converted into `prebuilt/<property>` so callers can pass the reference to
|
|
3018
|
+
* `ctx.runPlay(...)`.
|
|
3019
|
+
*/
|
|
2874
3020
|
get prebuilt() {
|
|
2875
3021
|
const explicit = {
|
|
2876
3022
|
companyToContact: {
|
|
@@ -2925,6 +3071,17 @@ var DeeplineContext = class {
|
|
|
2925
3071
|
play(name) {
|
|
2926
3072
|
return createNamedPlayHandle(() => this.client, name);
|
|
2927
3073
|
}
|
|
3074
|
+
/**
|
|
3075
|
+
* Run a named or prebuilt play and wait for its output.
|
|
3076
|
+
*
|
|
3077
|
+
* This is the high-level SDK equivalent of `ctx.play(name).runSync(input)`.
|
|
3078
|
+
* Inside a play runtime, prefer the in-play `ctx.runPlay(key, playRef, input,
|
|
3079
|
+
* options)` form so the child run is checkpointed under a stable key.
|
|
3080
|
+
*
|
|
3081
|
+
* @param playOrRef - Play name or prebuilt/reference object.
|
|
3082
|
+
* @param input - JSON input passed to the play.
|
|
3083
|
+
* @returns Completed play output.
|
|
3084
|
+
*/
|
|
2928
3085
|
async runPlay(playOrRef, input) {
|
|
2929
3086
|
const name = typeof playOrRef === "string" ? playOrRef : playOrRef.playName ?? playOrRef.name ?? "";
|
|
2930
3087
|
return await this.play(name).runSync(input);
|
package/dist/index.mjs
CHANGED
|
@@ -179,10 +179,10 @@ import { join as join2 } from "path";
|
|
|
179
179
|
|
|
180
180
|
// src/release.ts
|
|
181
181
|
var SDK_RELEASE = {
|
|
182
|
-
version: "0.1.
|
|
182
|
+
version: "0.1.89",
|
|
183
183
|
apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
|
|
184
184
|
supportPolicy: {
|
|
185
|
-
latest: "0.1.
|
|
185
|
+
latest: "0.1.89",
|
|
186
186
|
minimumSupported: "0.1.53",
|
|
187
187
|
deprecatedBelow: "0.1.53"
|
|
188
188
|
}
|
|
@@ -196,6 +196,7 @@ var SDK_API_CONTRACT = SDK_RELEASE.apiContract;
|
|
|
196
196
|
var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
|
|
197
197
|
var COORDINATOR_URL_OVERRIDE_HEADER = "x-deepline-coordinator-url";
|
|
198
198
|
var WORKER_CALLBACK_URL_OVERRIDE_HEADER = "x-deepline-worker-callback-url";
|
|
199
|
+
var SYNTHETIC_RUN_HEADER = "x-deepline-synthetic-run";
|
|
199
200
|
|
|
200
201
|
// src/http.ts
|
|
201
202
|
var MAX_DIAGNOSTIC_HEADER_LENGTH = 120;
|
|
@@ -263,6 +264,10 @@ var HttpClient = class {
|
|
|
263
264
|
if (workerCallbackUrl?.trim()) {
|
|
264
265
|
headers[WORKER_CALLBACK_URL_OVERRIDE_HEADER] = workerCallbackUrl.trim();
|
|
265
266
|
}
|
|
267
|
+
const syntheticRun = typeof process !== "undefined" ? process.env?.DEEPLINE_SYNTHETIC_RUN : void 0;
|
|
268
|
+
if (syntheticRun && syntheticRun.trim() && syntheticRun.trim() !== "0") {
|
|
269
|
+
headers[SYNTHETIC_RUN_HEADER] = "1";
|
|
270
|
+
}
|
|
266
271
|
return headers;
|
|
267
272
|
}
|
|
268
273
|
/**
|
|
@@ -553,6 +558,21 @@ function isTransientCompileManifestError(error) {
|
|
|
553
558
|
function isRecord(value) {
|
|
554
559
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
555
560
|
}
|
|
561
|
+
function isPrebuiltPlayDescription(play) {
|
|
562
|
+
return play.origin === "prebuilt" || play.ownerType === "deepline";
|
|
563
|
+
}
|
|
564
|
+
function preferPrebuiltPlayDescriptions(plays) {
|
|
565
|
+
const prebuilt = [];
|
|
566
|
+
const owned = [];
|
|
567
|
+
for (const play of plays) {
|
|
568
|
+
if (isPrebuiltPlayDescription(play)) {
|
|
569
|
+
prebuilt.push(play);
|
|
570
|
+
} else {
|
|
571
|
+
owned.push(play);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
return [...prebuilt, ...owned];
|
|
575
|
+
}
|
|
556
576
|
function isPlayRunPackage(value) {
|
|
557
577
|
return Boolean(
|
|
558
578
|
value && typeof value === "object" && !Array.isArray(value) && value.kind === "play_run" && value.run && typeof value.run?.id === "string"
|
|
@@ -676,8 +696,14 @@ function playRunStatusFromState(state) {
|
|
|
676
696
|
var DeeplineClient = class {
|
|
677
697
|
http;
|
|
678
698
|
config;
|
|
699
|
+
/** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
|
|
679
700
|
runs;
|
|
680
701
|
/**
|
|
702
|
+
* Create a low-level SDK client.
|
|
703
|
+
*
|
|
704
|
+
* Most callers can omit options and let the SDK resolve auth/config from
|
|
705
|
+
* environment variables and CLI-managed credentials.
|
|
706
|
+
*
|
|
681
707
|
* @param options - Optional overrides for API key, base URL, timeout, and retries.
|
|
682
708
|
* @throws {@link ConfigError} if no API key can be resolved from any source.
|
|
683
709
|
*/
|
|
@@ -779,12 +805,19 @@ var DeeplineClient = class {
|
|
|
779
805
|
// ——————————————————————————————————————————————————————————
|
|
780
806
|
// Secrets
|
|
781
807
|
// ——————————————————————————————————————————————————————————
|
|
808
|
+
/** List secret metadata visible to the current workspace. */
|
|
782
809
|
async listSecrets() {
|
|
783
810
|
const response = await this.http.get(
|
|
784
811
|
"/api/v2/secrets"
|
|
785
812
|
);
|
|
786
813
|
return Array.isArray(response.secrets) ? response.secrets : [];
|
|
787
814
|
}
|
|
815
|
+
/**
|
|
816
|
+
* Check whether a named secret exists, is active, and has a stored value.
|
|
817
|
+
*
|
|
818
|
+
* @param name - Secret name. It is normalized to uppercase before lookup.
|
|
819
|
+
* @returns Matching active secret metadata, or `null`.
|
|
820
|
+
*/
|
|
788
821
|
async checkSecret(name) {
|
|
789
822
|
const normalized = name.trim().toUpperCase();
|
|
790
823
|
const secrets = await this.listSecrets();
|
|
@@ -897,9 +930,21 @@ var DeeplineClient = class {
|
|
|
897
930
|
headers
|
|
898
931
|
);
|
|
899
932
|
}
|
|
933
|
+
/**
|
|
934
|
+
* Back-compatible alias for {@link executeTool}.
|
|
935
|
+
*
|
|
936
|
+
* Retained for callers that still use the older raw naming while the response
|
|
937
|
+
* envelope remains the same.
|
|
938
|
+
*/
|
|
900
939
|
async executeToolRaw(toolId, input, options) {
|
|
901
940
|
return this.executeTool(toolId, input, options);
|
|
902
941
|
}
|
|
942
|
+
/**
|
|
943
|
+
* Run a bounded SQL query against the customer data plane.
|
|
944
|
+
*
|
|
945
|
+
* Use this from trusted backend or agent contexts only. The API enforces
|
|
946
|
+
* workspace scoping and row limits.
|
|
947
|
+
*/
|
|
903
948
|
async queryCustomerDb(input) {
|
|
904
949
|
return this.http.post("/api/v2/db/query", {
|
|
905
950
|
sql: input.sql,
|
|
@@ -971,6 +1016,17 @@ var DeeplineClient = class {
|
|
|
971
1016
|
);
|
|
972
1017
|
return normalizePlayRunStart(response);
|
|
973
1018
|
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Start a play run and stream live runtime events from the same request.
|
|
1021
|
+
*
|
|
1022
|
+
* Use this when a caller wants low-level event handling instead of submitting
|
|
1023
|
+
* first and then connecting to `streamPlayRunEvents(runId)`.
|
|
1024
|
+
*
|
|
1025
|
+
* @param request - Play run configuration.
|
|
1026
|
+
* @param options - Optional streaming options.
|
|
1027
|
+
* @param options.signal - Optional abort signal for the streaming request.
|
|
1028
|
+
* @returns Async stream of play-scoped live events.
|
|
1029
|
+
*/
|
|
974
1030
|
async *startPlayRunStream(request, options) {
|
|
975
1031
|
const body = {
|
|
976
1032
|
...request.name ? { name: request.name } : {},
|
|
@@ -1023,6 +1079,12 @@ var DeeplineClient = class {
|
|
|
1023
1079
|
compilerManifest
|
|
1024
1080
|
});
|
|
1025
1081
|
}
|
|
1082
|
+
/**
|
|
1083
|
+
* Register multiple bundled play artifacts in one request.
|
|
1084
|
+
*
|
|
1085
|
+
* Used by packaging and prebuilt publication flows. Each artifact is compiled
|
|
1086
|
+
* first when a compiler manifest is not already supplied.
|
|
1087
|
+
*/
|
|
1026
1088
|
async registerPlayArtifacts(artifacts) {
|
|
1027
1089
|
const compiledArtifacts = await Promise.all(
|
|
1028
1090
|
artifacts.map(async (artifact) => ({
|
|
@@ -1039,6 +1101,13 @@ var DeeplineClient = class {
|
|
|
1039
1101
|
artifacts: compiledArtifacts
|
|
1040
1102
|
});
|
|
1041
1103
|
}
|
|
1104
|
+
/**
|
|
1105
|
+
* Compile a bundled play artifact into the server-side compiler manifest.
|
|
1106
|
+
*
|
|
1107
|
+
* The manifest records imports, trigger bindings, static pipeline shape, and
|
|
1108
|
+
* runtime metadata needed before a play artifact can be checked, registered,
|
|
1109
|
+
* or run.
|
|
1110
|
+
*/
|
|
1042
1111
|
async compilePlayManifest(input) {
|
|
1043
1112
|
const retryDelays = COMPILE_MANIFEST_RETRY_DELAYS_MS.slice(
|
|
1044
1113
|
0,
|
|
@@ -1067,9 +1136,21 @@ var DeeplineClient = class {
|
|
|
1067
1136
|
async checkPlayArtifact(input) {
|
|
1068
1137
|
return this.http.post("/api/v2/plays/check", input);
|
|
1069
1138
|
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Compile legacy enrich command arguments into a runtime plan.
|
|
1141
|
+
*
|
|
1142
|
+
* This is primarily used by CLI compatibility paths that translate older
|
|
1143
|
+
* enrichment commands onto the play runtime.
|
|
1144
|
+
*/
|
|
1070
1145
|
async compileEnrichPlan(input) {
|
|
1071
1146
|
return this.http.post("/api/v2/enrich/compile", input);
|
|
1072
1147
|
}
|
|
1148
|
+
/**
|
|
1149
|
+
* Register an already-bundled play artifact and start a run from it.
|
|
1150
|
+
*
|
|
1151
|
+
* This is the low-level file-backed run path used by SDK/CLI packaging
|
|
1152
|
+
* wrappers after local bundling has produced the runtime artifact.
|
|
1153
|
+
*/
|
|
1073
1154
|
async startPlayRunFromBundle(input) {
|
|
1074
1155
|
const compilerManifest = input.compilerManifest ?? await this.compilePlayManifest({
|
|
1075
1156
|
name: input.name,
|
|
@@ -1227,6 +1308,12 @@ var DeeplineClient = class {
|
|
|
1227
1308
|
const response = await this.http.postFormData("/api/v2/plays/files/stage", buildFormData);
|
|
1228
1309
|
return response.files;
|
|
1229
1310
|
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Resolve staged play files by content hash without uploading bytes.
|
|
1313
|
+
*
|
|
1314
|
+
* Missing files are returned so callers can upload only the files the server
|
|
1315
|
+
* does not already have.
|
|
1316
|
+
*/
|
|
1230
1317
|
async resolveStagedPlayFiles(files) {
|
|
1231
1318
|
return this.http.post("/api/v2/plays/files/stage", { files });
|
|
1232
1319
|
}
|
|
@@ -1443,6 +1530,12 @@ var DeeplineClient = class {
|
|
|
1443
1530
|
entries
|
|
1444
1531
|
};
|
|
1445
1532
|
}
|
|
1533
|
+
/**
|
|
1534
|
+
* Export persisted runtime-sheet rows for a play dataset/table namespace.
|
|
1535
|
+
*
|
|
1536
|
+
* This is the SDK form of exporting `ctx.dataset(...).run()` output for a
|
|
1537
|
+
* specific play and optional run id.
|
|
1538
|
+
*/
|
|
1446
1539
|
async getPlaySheetRows(input) {
|
|
1447
1540
|
const params = new URLSearchParams({
|
|
1448
1541
|
tableNamespace: input.tableNamespace,
|
|
@@ -1471,6 +1564,12 @@ var DeeplineClient = class {
|
|
|
1471
1564
|
options?.reason ? { reason: options.reason } : {}
|
|
1472
1565
|
);
|
|
1473
1566
|
}
|
|
1567
|
+
/**
|
|
1568
|
+
* List callable plays visible to the workspace.
|
|
1569
|
+
*
|
|
1570
|
+
* Pass `origin: "prebuilt"` for Deepline-managed prebuilts or
|
|
1571
|
+
* `origin: "owned"` for org-owned plays.
|
|
1572
|
+
*/
|
|
1474
1573
|
async listPlays(options) {
|
|
1475
1574
|
const params = new URLSearchParams();
|
|
1476
1575
|
if (options?.origin) params.set("origin", options.origin);
|
|
@@ -1485,15 +1584,32 @@ var DeeplineClient = class {
|
|
|
1485
1584
|
);
|
|
1486
1585
|
return response.plays ?? [];
|
|
1487
1586
|
}
|
|
1587
|
+
/**
|
|
1588
|
+
* Search callable plays and return compact play descriptions.
|
|
1589
|
+
*
|
|
1590
|
+
* Prebuilt plays are preferred by default because they have maintained
|
|
1591
|
+
* contracts and stable run behavior.
|
|
1592
|
+
*/
|
|
1488
1593
|
async searchPlays(options) {
|
|
1489
1594
|
const params = new URLSearchParams();
|
|
1490
1595
|
params.set("search", options.query.trim());
|
|
1596
|
+
const scope = options.scope ?? "prebuilt";
|
|
1597
|
+
if (scope !== "all") {
|
|
1598
|
+
params.set("origin", scope);
|
|
1599
|
+
}
|
|
1491
1600
|
const response = await this.http.get(
|
|
1492
1601
|
`/api/v2/plays?${params.toString()}`
|
|
1493
1602
|
);
|
|
1494
|
-
|
|
1603
|
+
const plays = (response.plays ?? []).map(
|
|
1495
1604
|
(play) => this.summarizePlayListItem(play, options)
|
|
1496
1605
|
);
|
|
1606
|
+
if (scope === "prebuilt") {
|
|
1607
|
+
return plays.filter(isPrebuiltPlayDescription);
|
|
1608
|
+
}
|
|
1609
|
+
if (scope === "owned") {
|
|
1610
|
+
return plays.filter((play) => !isPrebuiltPlayDescription(play));
|
|
1611
|
+
}
|
|
1612
|
+
return preferPrebuiltPlayDescriptions(plays);
|
|
1497
1613
|
}
|
|
1498
1614
|
/**
|
|
1499
1615
|
* Get the full definition and state of a named play.
|
|
@@ -1516,6 +1632,12 @@ var DeeplineClient = class {
|
|
|
1516
1632
|
const encodedName = encodeURIComponent(name);
|
|
1517
1633
|
return this.http.get(`/api/v2/plays/${encodedName}`);
|
|
1518
1634
|
}
|
|
1635
|
+
/**
|
|
1636
|
+
* Get a normalized play description suitable for agents and CLIs.
|
|
1637
|
+
*
|
|
1638
|
+
* The description includes runnable examples, input/output summaries, clone
|
|
1639
|
+
* guidance, revision state, and latest run metadata when available.
|
|
1640
|
+
*/
|
|
1519
1641
|
async describePlay(name, options) {
|
|
1520
1642
|
const detail = await this.getPlay(name);
|
|
1521
1643
|
return this.summarizePlayDetail(detail, options);
|
|
@@ -2669,7 +2791,10 @@ var DeeplineStepProgram = class _DeeplineStepProgram {
|
|
|
2669
2791
|
...this.steps,
|
|
2670
2792
|
{
|
|
2671
2793
|
name,
|
|
2672
|
-
resolver: stepResolver
|
|
2794
|
+
resolver: stepResolver,
|
|
2795
|
+
...options?.staleAfterSeconds !== void 0 ? {
|
|
2796
|
+
staleAfterSeconds: options.staleAfterSeconds
|
|
2797
|
+
} : {}
|
|
2673
2798
|
}
|
|
2674
2799
|
],
|
|
2675
2800
|
this.returnResolver
|
|
@@ -2769,6 +2894,14 @@ function createNamedPlayHandle(clientFactory, name) {
|
|
|
2769
2894
|
}
|
|
2770
2895
|
var DeeplineContext = class {
|
|
2771
2896
|
client;
|
|
2897
|
+
/**
|
|
2898
|
+
* Create a high-level SDK context.
|
|
2899
|
+
*
|
|
2900
|
+
* Most callers should use {@link Deepline.connect}; direct construction is
|
|
2901
|
+
* equivalent when you already have explicit client options.
|
|
2902
|
+
*
|
|
2903
|
+
* @param options - Optional SDK client configuration.
|
|
2904
|
+
*/
|
|
2772
2905
|
constructor(options) {
|
|
2773
2906
|
this.client = new DeeplineClient(options);
|
|
2774
2907
|
}
|
|
@@ -2798,12 +2931,25 @@ var DeeplineContext = class {
|
|
|
2798
2931
|
}
|
|
2799
2932
|
};
|
|
2800
2933
|
}
|
|
2934
|
+
/**
|
|
2935
|
+
* Play discovery and named-play handles.
|
|
2936
|
+
*
|
|
2937
|
+
* Use `plays.list()` for discovery and `plays.get(name)` when you prefer a
|
|
2938
|
+
* namespace spelling over `ctx.play(name)`.
|
|
2939
|
+
*/
|
|
2801
2940
|
get plays() {
|
|
2802
2941
|
return {
|
|
2803
2942
|
list: () => this.client.listPlays(),
|
|
2804
2943
|
get: (name) => this.play(name)
|
|
2805
2944
|
};
|
|
2806
2945
|
}
|
|
2946
|
+
/**
|
|
2947
|
+
* Convenience references for Deepline-managed prebuilt plays.
|
|
2948
|
+
*
|
|
2949
|
+
* Known prebuilts are exposed by camel-cased aliases. Any other property is
|
|
2950
|
+
* converted into `prebuilt/<property>` so callers can pass the reference to
|
|
2951
|
+
* `ctx.runPlay(...)`.
|
|
2952
|
+
*/
|
|
2807
2953
|
get prebuilt() {
|
|
2808
2954
|
const explicit = {
|
|
2809
2955
|
companyToContact: {
|
|
@@ -2858,6 +3004,17 @@ var DeeplineContext = class {
|
|
|
2858
3004
|
play(name) {
|
|
2859
3005
|
return createNamedPlayHandle(() => this.client, name);
|
|
2860
3006
|
}
|
|
3007
|
+
/**
|
|
3008
|
+
* Run a named or prebuilt play and wait for its output.
|
|
3009
|
+
*
|
|
3010
|
+
* This is the high-level SDK equivalent of `ctx.play(name).runSync(input)`.
|
|
3011
|
+
* Inside a play runtime, prefer the in-play `ctx.runPlay(key, playRef, input,
|
|
3012
|
+
* options)` form so the child run is checkpointed under a stable key.
|
|
3013
|
+
*
|
|
3014
|
+
* @param playOrRef - Play name or prebuilt/reference object.
|
|
3015
|
+
* @param input - JSON input passed to the play.
|
|
3016
|
+
* @returns Completed play output.
|
|
3017
|
+
*/
|
|
2861
3018
|
async runPlay(playOrRef, input) {
|
|
2862
3019
|
const name = typeof playOrRef === "string" ? playOrRef : playOrRef.playName ?? playOrRef.name ?? "";
|
|
2863
3020
|
return await this.play(name).runSync(input);
|
|
@@ -1302,6 +1302,7 @@ export class PlayDedup implements DurableObject {
|
|
|
1302
1302
|
? body.activeArtifactTableNamespace
|
|
1303
1303
|
: null,
|
|
1304
1304
|
updatedAt: typeof body.updatedAt === 'number' ? body.updatedAt : null,
|
|
1305
|
+
liveNodeProgress: body.liveNodeProgress,
|
|
1305
1306
|
};
|
|
1306
1307
|
} else if (
|
|
1307
1308
|
body.type === 'terminal' &&
|