deepline 0.1.63 → 0.1.65
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 +933 -533
- package/dist/cli/index.mjs +837 -421
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +102 -49
- package/dist/index.mjs +98 -45
- package/dist/repo/apps/play-runner-workers/src/coordinator-entry.ts +9 -10
- package/dist/repo/apps/play-runner-workers/src/runtime/dataset-handles.ts +36 -27
- package/dist/repo/apps/play-runner-workers/src/runtime/tool-http-errors.ts +5 -2
- package/dist/repo/sdk/src/client.ts +71 -63
- package/dist/repo/sdk/src/errors.ts +5 -1
- package/dist/repo/sdk/src/http.ts +69 -17
- package/dist/repo/sdk/src/plays/local-file-discovery.ts +93 -24
- package/dist/repo/sdk/src/release.ts +2 -2
- package/dist/repo/sdk/src/tool-output.ts +40 -20
- package/dist/repo/shared_libs/play-runtime/batch-runtime.ts +10 -3
- package/dist/repo/shared_libs/play-runtime/batching-types.ts +15 -4
- package/dist/repo/shared_libs/play-runtime/coordinator-headers.ts +2 -1
- package/dist/repo/shared_libs/play-runtime/dedup-backend.ts +0 -0
- package/dist/repo/shared_libs/play-runtime/default-batch-strategies.ts +3 -4
- package/dist/repo/shared_libs/play-runtime/run-failure.ts +1 -3
- package/dist/repo/shared_libs/play-runtime/step-lifecycle-tracker.ts +4 -1
- package/dist/repo/shared_libs/play-runtime/tool-batch-executor.ts +4 -1
- package/dist/repo/shared_libs/plays/dataset.ts +10 -11
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1206,7 +1206,7 @@ declare class DeeplineClient {
|
|
|
1206
1206
|
* artifactStorageKey: 'plays/v1/orgs/acme/plays/my-play/artifacts/playgraph_abc123.json',
|
|
1207
1207
|
* });
|
|
1208
1208
|
* ```
|
|
1209
|
-
|
|
1209
|
+
*/
|
|
1210
1210
|
startPlayRun(request: StartPlayRunRequest): Promise<PlayRunStart>;
|
|
1211
1211
|
startPlayRunStream(request: StartPlayRunRequest, options?: {
|
|
1212
1212
|
signal?: AbortSignal;
|
package/dist/index.d.ts
CHANGED
|
@@ -1206,7 +1206,7 @@ declare class DeeplineClient {
|
|
|
1206
1206
|
* artifactStorageKey: 'plays/v1/orgs/acme/plays/my-play/artifacts/playgraph_abc123.json',
|
|
1207
1207
|
* });
|
|
1208
1208
|
* ```
|
|
1209
|
-
|
|
1209
|
+
*/
|
|
1210
1210
|
startPlayRun(request: StartPlayRunRequest): Promise<PlayRunStart>;
|
|
1211
1211
|
startPlayRunStream(request: StartPlayRunRequest, options?: {
|
|
1212
1212
|
signal?: AbortSignal;
|
package/dist/index.js
CHANGED
|
@@ -88,7 +88,11 @@ var RateLimitError = class extends DeeplineError {
|
|
|
88
88
|
/** Milliseconds to wait before retrying, from the `Retry-After` response header. Defaults to 5000. */
|
|
89
89
|
retryAfterMs;
|
|
90
90
|
constructor(retryAfterMs = 5e3, message) {
|
|
91
|
-
super(
|
|
91
|
+
super(
|
|
92
|
+
message ?? `Rate limited. Retry after ${retryAfterMs}ms.`,
|
|
93
|
+
429,
|
|
94
|
+
"RATE_LIMIT"
|
|
95
|
+
);
|
|
92
96
|
this.name = "RateLimitError";
|
|
93
97
|
this.retryAfterMs = retryAfterMs;
|
|
94
98
|
}
|
|
@@ -230,12 +234,17 @@ function resolveConfig(options) {
|
|
|
230
234
|
};
|
|
231
235
|
}
|
|
232
236
|
|
|
237
|
+
// src/http.ts
|
|
238
|
+
var import_node_fs2 = require("fs");
|
|
239
|
+
var import_node_os2 = require("os");
|
|
240
|
+
var import_node_path2 = require("path");
|
|
241
|
+
|
|
233
242
|
// src/release.ts
|
|
234
243
|
var SDK_RELEASE = {
|
|
235
|
-
version: "0.1.
|
|
244
|
+
version: "0.1.65",
|
|
236
245
|
apiContract: "2026-05-play-bootstrap-dataset-summary",
|
|
237
246
|
supportPolicy: {
|
|
238
|
-
latest: "0.1.
|
|
247
|
+
latest: "0.1.65",
|
|
239
248
|
minimumSupported: "0.1.53",
|
|
240
249
|
deprecatedBelow: "0.1.53"
|
|
241
250
|
}
|
|
@@ -251,19 +260,51 @@ var COORDINATOR_URL_OVERRIDE_HEADER = "x-deepline-coordinator-url";
|
|
|
251
260
|
var WORKER_CALLBACK_URL_OVERRIDE_HEADER = "x-deepline-worker-callback-url";
|
|
252
261
|
|
|
253
262
|
// src/http.ts
|
|
263
|
+
var MAX_DIAGNOSTIC_HEADER_LENGTH = 120;
|
|
254
264
|
var HttpClient = class {
|
|
255
265
|
constructor(config) {
|
|
256
266
|
this.config = config;
|
|
257
267
|
}
|
|
258
268
|
config;
|
|
269
|
+
cleanDiagnosticHeader(value) {
|
|
270
|
+
const normalized = String(value ?? "").replace(/[\u0000-\u001f\u007f]/g, " ").trim().slice(0, MAX_DIAGNOSTIC_HEADER_LENGTH);
|
|
271
|
+
return normalized || null;
|
|
272
|
+
}
|
|
273
|
+
readSkillsVersionHeader() {
|
|
274
|
+
const explicit = this.cleanDiagnosticHeader(
|
|
275
|
+
process.env.DEEPLINE_SKILLS_VERSION
|
|
276
|
+
);
|
|
277
|
+
if (explicit) return explicit;
|
|
278
|
+
try {
|
|
279
|
+
const versionPath = (0, import_node_path2.join)(
|
|
280
|
+
process.env.HOME?.trim() || (0, import_node_os2.homedir)(),
|
|
281
|
+
".local",
|
|
282
|
+
"deepline",
|
|
283
|
+
baseUrlSlug(this.config.baseUrl),
|
|
284
|
+
"sdk-skills",
|
|
285
|
+
".version"
|
|
286
|
+
);
|
|
287
|
+
if (!(0, import_node_fs2.existsSync)(versionPath)) return null;
|
|
288
|
+
return this.cleanDiagnosticHeader((0, import_node_fs2.readFileSync)(versionPath, "utf-8"));
|
|
289
|
+
} catch {
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
259
293
|
authHeaders(extra) {
|
|
260
294
|
const headers = {
|
|
261
|
-
|
|
295
|
+
Authorization: `Bearer ${this.config.apiKey}`,
|
|
262
296
|
"User-Agent": `deepline-ts-sdk/${SDK_VERSION}`,
|
|
297
|
+
"X-Deepline-Client-Family": "sdk",
|
|
298
|
+
"X-Deepline-CLI-Family": "sdk",
|
|
299
|
+
"X-Deepline-CLI-Version": SDK_VERSION,
|
|
263
300
|
"X-Deepline-SDK-Version": SDK_VERSION,
|
|
264
301
|
"X-Deepline-API-Contract": SDK_API_CONTRACT,
|
|
265
302
|
...extra
|
|
266
303
|
};
|
|
304
|
+
const skillsVersion = this.readSkillsVersionHeader();
|
|
305
|
+
if (skillsVersion) {
|
|
306
|
+
headers["X-Deepline-Skills-Version"] = skillsVersion;
|
|
307
|
+
}
|
|
267
308
|
const bypassToken = typeof process !== "undefined" ? process.env?.VERCEL_PROTECTION_BYPASS_TOKEN : void 0;
|
|
268
309
|
if (bypassToken) {
|
|
269
310
|
headers["x-vercel-protection-bypass"] = bypassToken;
|
|
@@ -941,31 +982,34 @@ var DeeplineClient = class {
|
|
|
941
982
|
* artifactStorageKey: 'plays/v1/orgs/acme/plays/my-play/artifacts/playgraph_abc123.json',
|
|
942
983
|
* });
|
|
943
984
|
* ```
|
|
944
|
-
|
|
985
|
+
*/
|
|
945
986
|
async startPlayRun(request) {
|
|
946
|
-
const response = await this.http.post(
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
987
|
+
const response = await this.http.post(
|
|
988
|
+
"/api/v2/plays/run",
|
|
989
|
+
{
|
|
990
|
+
...request.name ? { name: request.name } : {},
|
|
991
|
+
...request.revisionId ? { revisionId: request.revisionId } : {},
|
|
992
|
+
...request.artifactStorageKey ? { artifactStorageKey: request.artifactStorageKey } : {},
|
|
993
|
+
...request.sourceCode ? { sourceCode: request.sourceCode } : {},
|
|
994
|
+
...request.sourceFiles ? { sourceFiles: request.sourceFiles } : {},
|
|
995
|
+
..."staticPipeline" in request ? { staticPipeline: request.staticPipeline } : {},
|
|
996
|
+
...request.artifactHash ? { artifactHash: request.artifactHash } : {},
|
|
997
|
+
...request.graphHash ? { graphHash: request.graphHash } : {},
|
|
998
|
+
...request.runtimeArtifact ? { runtimeArtifact: request.runtimeArtifact } : {},
|
|
999
|
+
...request.compilerManifest ? { compilerManifest: request.compilerManifest } : {},
|
|
1000
|
+
...request.inputFileUpload ? { inputFileUpload: request.inputFileUpload } : {},
|
|
1001
|
+
...request.packagedFileUploads?.length ? { packagedFileUploads: request.packagedFileUploads } : {},
|
|
1002
|
+
...request.input ? { input: request.input } : {},
|
|
1003
|
+
...request.inputFile ? { inputFile: request.inputFile } : {},
|
|
1004
|
+
...request.packagedFiles?.length ? { packagedFiles: request.packagedFiles } : {},
|
|
1005
|
+
...request.force ? { force: true } : {},
|
|
1006
|
+
...typeof request.waitForCompletionMs === "number" ? { waitForCompletionMs: request.waitForCompletionMs } : {},
|
|
1007
|
+
// Profile selection is the API's job, not the CLI's. The server
|
|
1008
|
+
// hardcodes workers_edge as the default; tests that want a
|
|
1009
|
+
// different profile pass `request.profile` explicitly.
|
|
1010
|
+
...request.profile ? { profile: request.profile } : {}
|
|
1011
|
+
}
|
|
1012
|
+
);
|
|
969
1013
|
return normalizePlayRunStart(response);
|
|
970
1014
|
}
|
|
971
1015
|
async *startPlayRunStream(request, options) {
|
|
@@ -1217,10 +1261,7 @@ var DeeplineClient = class {
|
|
|
1217
1261
|
}
|
|
1218
1262
|
return formData;
|
|
1219
1263
|
};
|
|
1220
|
-
const response = await this.http.postFormData(
|
|
1221
|
-
"/api/v2/plays/files/stage",
|
|
1222
|
-
buildFormData
|
|
1223
|
-
);
|
|
1264
|
+
const response = await this.http.postFormData("/api/v2/plays/files/stage", buildFormData);
|
|
1224
1265
|
return response.files;
|
|
1225
1266
|
}
|
|
1226
1267
|
async resolveStagedPlayFiles(files) {
|
|
@@ -1667,7 +1708,9 @@ var DeeplineClient = class {
|
|
|
1667
1708
|
}
|
|
1668
1709
|
options?.onProgress?.(status);
|
|
1669
1710
|
if (TERMINAL_PLAY_STATUSES.has(status.status)) {
|
|
1670
|
-
const finalStatus = await this.getPlayStatus(
|
|
1711
|
+
const finalStatus = await this.getPlayStatus(
|
|
1712
|
+
status.runId || workflowId
|
|
1713
|
+
).catch(() => status);
|
|
1671
1714
|
return playRunResultFromStatus(finalStatus, start, workflowId);
|
|
1672
1715
|
}
|
|
1673
1716
|
}
|
|
@@ -2695,9 +2738,9 @@ function getDefinedPlayMetadata(value) {
|
|
|
2695
2738
|
}
|
|
2696
2739
|
|
|
2697
2740
|
// src/tool-output.ts
|
|
2698
|
-
var
|
|
2699
|
-
var
|
|
2700
|
-
var
|
|
2741
|
+
var import_node_fs3 = require("fs");
|
|
2742
|
+
var import_node_os3 = require("os");
|
|
2743
|
+
var import_node_path3 = require("path");
|
|
2701
2744
|
function isPlainObject(value) {
|
|
2702
2745
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
2703
2746
|
}
|
|
@@ -2719,7 +2762,9 @@ function normalizeRows2(value) {
|
|
|
2719
2762
|
});
|
|
2720
2763
|
}
|
|
2721
2764
|
function candidateRoots(payload) {
|
|
2722
|
-
const roots = [
|
|
2765
|
+
const roots = [
|
|
2766
|
+
{ path: null, value: payload }
|
|
2767
|
+
];
|
|
2723
2768
|
if (isPlainObject(payload) && isPlainObject(payload.toolResponse)) {
|
|
2724
2769
|
roots.push({ path: "toolResponse", value: payload.toolResponse });
|
|
2725
2770
|
if (Object.prototype.hasOwnProperty.call(payload.toolResponse, "raw")) {
|
|
@@ -2746,7 +2791,9 @@ function candidateRoots(payload) {
|
|
|
2746
2791
|
function findBestArrayCandidate(value, pathPrefix = "", depth = 0) {
|
|
2747
2792
|
if (depth > 5) return null;
|
|
2748
2793
|
const directRows = normalizeRows2(value);
|
|
2749
|
-
const hasObjectRow = directRows?.some(
|
|
2794
|
+
const hasObjectRow = directRows?.some(
|
|
2795
|
+
(row) => Object.keys(row).some((key) => key !== "value")
|
|
2796
|
+
) ?? false;
|
|
2750
2797
|
let best = directRows && directRows.length > 0 && hasObjectRow ? { path: pathPrefix, rows: directRows } : null;
|
|
2751
2798
|
if (!isPlainObject(value)) {
|
|
2752
2799
|
return best;
|
|
@@ -2762,7 +2809,9 @@ function findBestArrayCandidate(value, pathPrefix = "", depth = 0) {
|
|
|
2762
2809
|
return best;
|
|
2763
2810
|
}
|
|
2764
2811
|
function tryConvertToList(payload, options) {
|
|
2765
|
-
const listExtractorPaths = Array.isArray(options?.listExtractorPaths) ? options?.listExtractorPaths.filter(
|
|
2812
|
+
const listExtractorPaths = Array.isArray(options?.listExtractorPaths) ? options?.listExtractorPaths.filter(
|
|
2813
|
+
(entry) => typeof entry === "string" && entry.trim().length > 0
|
|
2814
|
+
) : [];
|
|
2766
2815
|
if (listExtractorPaths.length > 0) {
|
|
2767
2816
|
for (const root of candidateRoots(payload)) {
|
|
2768
2817
|
for (const extractorPath of listExtractorPaths) {
|
|
@@ -2787,19 +2836,19 @@ function tryConvertToList(payload, options) {
|
|
|
2787
2836
|
return null;
|
|
2788
2837
|
}
|
|
2789
2838
|
function ensureOutputDir() {
|
|
2790
|
-
const outputDir = (0,
|
|
2791
|
-
(0,
|
|
2839
|
+
const outputDir = (0, import_node_path3.join)((0, import_node_os3.homedir)(), ".local", "share", "deepline", "data");
|
|
2840
|
+
(0, import_node_fs3.mkdirSync)(outputDir, { recursive: true });
|
|
2792
2841
|
return outputDir;
|
|
2793
2842
|
}
|
|
2794
2843
|
function writeJsonOutputFile(payload, stem) {
|
|
2795
2844
|
const outputDir = ensureOutputDir();
|
|
2796
|
-
const outputPath = (0,
|
|
2797
|
-
(0,
|
|
2845
|
+
const outputPath = (0, import_node_path3.join)(outputDir, `${stem}_${Date.now()}.json`);
|
|
2846
|
+
(0, import_node_fs3.writeFileSync)(outputPath, JSON.stringify(payload, null, 2), "utf-8");
|
|
2798
2847
|
return outputPath;
|
|
2799
2848
|
}
|
|
2800
2849
|
function writeCsvOutputFile(rows, stem) {
|
|
2801
2850
|
const outputDir = ensureOutputDir();
|
|
2802
|
-
const outputPath = (0,
|
|
2851
|
+
const outputPath = (0, import_node_path3.join)(outputDir, `${stem}_${Date.now()}.csv`);
|
|
2803
2852
|
const seen = /* @__PURE__ */ new Set();
|
|
2804
2853
|
const columns = [];
|
|
2805
2854
|
for (const row of rows) {
|
|
@@ -2822,13 +2871,15 @@ function writeCsvOutputFile(rows, stem) {
|
|
|
2822
2871
|
for (const row of rows) {
|
|
2823
2872
|
lines.push(columns.map((column) => escapeCell(row[column])).join(","));
|
|
2824
2873
|
}
|
|
2825
|
-
(0,
|
|
2874
|
+
(0, import_node_fs3.writeFileSync)(outputPath, `${lines.join("\n")}
|
|
2826
2875
|
`, "utf-8");
|
|
2827
2876
|
const previewRows = rows.slice(0, 5);
|
|
2828
2877
|
const previewColumns = columns.slice(0, 5);
|
|
2829
2878
|
const preview = [
|
|
2830
2879
|
previewColumns.join(","),
|
|
2831
|
-
...previewRows.map(
|
|
2880
|
+
...previewRows.map(
|
|
2881
|
+
(row) => previewColumns.map((column) => escapeCell(row[column])).join(",")
|
|
2882
|
+
)
|
|
2832
2883
|
].join("\n");
|
|
2833
2884
|
return {
|
|
2834
2885
|
path: outputPath,
|
|
@@ -2841,9 +2892,11 @@ function extractSummaryFields(payload) {
|
|
|
2841
2892
|
const candidates = candidateRoots(payload);
|
|
2842
2893
|
for (const candidate of candidates) {
|
|
2843
2894
|
if (!isPlainObject(candidate.value)) continue;
|
|
2844
|
-
const summaryEntries = Object.entries(candidate.value).filter(
|
|
2845
|
-
|
|
2846
|
-
|
|
2895
|
+
const summaryEntries = Object.entries(candidate.value).filter(
|
|
2896
|
+
([, value]) => {
|
|
2897
|
+
return value == null || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
2898
|
+
}
|
|
2899
|
+
);
|
|
2847
2900
|
if (summaryEntries.length === 0) continue;
|
|
2848
2901
|
return Object.fromEntries(summaryEntries);
|
|
2849
2902
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -26,7 +26,11 @@ var RateLimitError = class extends DeeplineError {
|
|
|
26
26
|
/** Milliseconds to wait before retrying, from the `Retry-After` response header. Defaults to 5000. */
|
|
27
27
|
retryAfterMs;
|
|
28
28
|
constructor(retryAfterMs = 5e3, message) {
|
|
29
|
-
super(
|
|
29
|
+
super(
|
|
30
|
+
message ?? `Rate limited. Retry after ${retryAfterMs}ms.`,
|
|
31
|
+
429,
|
|
32
|
+
"RATE_LIMIT"
|
|
33
|
+
);
|
|
30
34
|
this.name = "RateLimitError";
|
|
31
35
|
this.retryAfterMs = retryAfterMs;
|
|
32
36
|
}
|
|
@@ -168,12 +172,17 @@ function resolveConfig(options) {
|
|
|
168
172
|
};
|
|
169
173
|
}
|
|
170
174
|
|
|
175
|
+
// src/http.ts
|
|
176
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
177
|
+
import { homedir as homedir2 } from "os";
|
|
178
|
+
import { join as join2 } from "path";
|
|
179
|
+
|
|
171
180
|
// src/release.ts
|
|
172
181
|
var SDK_RELEASE = {
|
|
173
|
-
version: "0.1.
|
|
182
|
+
version: "0.1.65",
|
|
174
183
|
apiContract: "2026-05-play-bootstrap-dataset-summary",
|
|
175
184
|
supportPolicy: {
|
|
176
|
-
latest: "0.1.
|
|
185
|
+
latest: "0.1.65",
|
|
177
186
|
minimumSupported: "0.1.53",
|
|
178
187
|
deprecatedBelow: "0.1.53"
|
|
179
188
|
}
|
|
@@ -189,19 +198,51 @@ var COORDINATOR_URL_OVERRIDE_HEADER = "x-deepline-coordinator-url";
|
|
|
189
198
|
var WORKER_CALLBACK_URL_OVERRIDE_HEADER = "x-deepline-worker-callback-url";
|
|
190
199
|
|
|
191
200
|
// src/http.ts
|
|
201
|
+
var MAX_DIAGNOSTIC_HEADER_LENGTH = 120;
|
|
192
202
|
var HttpClient = class {
|
|
193
203
|
constructor(config) {
|
|
194
204
|
this.config = config;
|
|
195
205
|
}
|
|
196
206
|
config;
|
|
207
|
+
cleanDiagnosticHeader(value) {
|
|
208
|
+
const normalized = String(value ?? "").replace(/[\u0000-\u001f\u007f]/g, " ").trim().slice(0, MAX_DIAGNOSTIC_HEADER_LENGTH);
|
|
209
|
+
return normalized || null;
|
|
210
|
+
}
|
|
211
|
+
readSkillsVersionHeader() {
|
|
212
|
+
const explicit = this.cleanDiagnosticHeader(
|
|
213
|
+
process.env.DEEPLINE_SKILLS_VERSION
|
|
214
|
+
);
|
|
215
|
+
if (explicit) return explicit;
|
|
216
|
+
try {
|
|
217
|
+
const versionPath = join2(
|
|
218
|
+
process.env.HOME?.trim() || homedir2(),
|
|
219
|
+
".local",
|
|
220
|
+
"deepline",
|
|
221
|
+
baseUrlSlug(this.config.baseUrl),
|
|
222
|
+
"sdk-skills",
|
|
223
|
+
".version"
|
|
224
|
+
);
|
|
225
|
+
if (!existsSync2(versionPath)) return null;
|
|
226
|
+
return this.cleanDiagnosticHeader(readFileSync2(versionPath, "utf-8"));
|
|
227
|
+
} catch {
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
197
231
|
authHeaders(extra) {
|
|
198
232
|
const headers = {
|
|
199
|
-
|
|
233
|
+
Authorization: `Bearer ${this.config.apiKey}`,
|
|
200
234
|
"User-Agent": `deepline-ts-sdk/${SDK_VERSION}`,
|
|
235
|
+
"X-Deepline-Client-Family": "sdk",
|
|
236
|
+
"X-Deepline-CLI-Family": "sdk",
|
|
237
|
+
"X-Deepline-CLI-Version": SDK_VERSION,
|
|
201
238
|
"X-Deepline-SDK-Version": SDK_VERSION,
|
|
202
239
|
"X-Deepline-API-Contract": SDK_API_CONTRACT,
|
|
203
240
|
...extra
|
|
204
241
|
};
|
|
242
|
+
const skillsVersion = this.readSkillsVersionHeader();
|
|
243
|
+
if (skillsVersion) {
|
|
244
|
+
headers["X-Deepline-Skills-Version"] = skillsVersion;
|
|
245
|
+
}
|
|
205
246
|
const bypassToken = typeof process !== "undefined" ? process.env?.VERCEL_PROTECTION_BYPASS_TOKEN : void 0;
|
|
206
247
|
if (bypassToken) {
|
|
207
248
|
headers["x-vercel-protection-bypass"] = bypassToken;
|
|
@@ -879,31 +920,34 @@ var DeeplineClient = class {
|
|
|
879
920
|
* artifactStorageKey: 'plays/v1/orgs/acme/plays/my-play/artifacts/playgraph_abc123.json',
|
|
880
921
|
* });
|
|
881
922
|
* ```
|
|
882
|
-
|
|
923
|
+
*/
|
|
883
924
|
async startPlayRun(request) {
|
|
884
|
-
const response = await this.http.post(
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
925
|
+
const response = await this.http.post(
|
|
926
|
+
"/api/v2/plays/run",
|
|
927
|
+
{
|
|
928
|
+
...request.name ? { name: request.name } : {},
|
|
929
|
+
...request.revisionId ? { revisionId: request.revisionId } : {},
|
|
930
|
+
...request.artifactStorageKey ? { artifactStorageKey: request.artifactStorageKey } : {},
|
|
931
|
+
...request.sourceCode ? { sourceCode: request.sourceCode } : {},
|
|
932
|
+
...request.sourceFiles ? { sourceFiles: request.sourceFiles } : {},
|
|
933
|
+
..."staticPipeline" in request ? { staticPipeline: request.staticPipeline } : {},
|
|
934
|
+
...request.artifactHash ? { artifactHash: request.artifactHash } : {},
|
|
935
|
+
...request.graphHash ? { graphHash: request.graphHash } : {},
|
|
936
|
+
...request.runtimeArtifact ? { runtimeArtifact: request.runtimeArtifact } : {},
|
|
937
|
+
...request.compilerManifest ? { compilerManifest: request.compilerManifest } : {},
|
|
938
|
+
...request.inputFileUpload ? { inputFileUpload: request.inputFileUpload } : {},
|
|
939
|
+
...request.packagedFileUploads?.length ? { packagedFileUploads: request.packagedFileUploads } : {},
|
|
940
|
+
...request.input ? { input: request.input } : {},
|
|
941
|
+
...request.inputFile ? { inputFile: request.inputFile } : {},
|
|
942
|
+
...request.packagedFiles?.length ? { packagedFiles: request.packagedFiles } : {},
|
|
943
|
+
...request.force ? { force: true } : {},
|
|
944
|
+
...typeof request.waitForCompletionMs === "number" ? { waitForCompletionMs: request.waitForCompletionMs } : {},
|
|
945
|
+
// Profile selection is the API's job, not the CLI's. The server
|
|
946
|
+
// hardcodes workers_edge as the default; tests that want a
|
|
947
|
+
// different profile pass `request.profile` explicitly.
|
|
948
|
+
...request.profile ? { profile: request.profile } : {}
|
|
949
|
+
}
|
|
950
|
+
);
|
|
907
951
|
return normalizePlayRunStart(response);
|
|
908
952
|
}
|
|
909
953
|
async *startPlayRunStream(request, options) {
|
|
@@ -1155,10 +1199,7 @@ var DeeplineClient = class {
|
|
|
1155
1199
|
}
|
|
1156
1200
|
return formData;
|
|
1157
1201
|
};
|
|
1158
|
-
const response = await this.http.postFormData(
|
|
1159
|
-
"/api/v2/plays/files/stage",
|
|
1160
|
-
buildFormData
|
|
1161
|
-
);
|
|
1202
|
+
const response = await this.http.postFormData("/api/v2/plays/files/stage", buildFormData);
|
|
1162
1203
|
return response.files;
|
|
1163
1204
|
}
|
|
1164
1205
|
async resolveStagedPlayFiles(files) {
|
|
@@ -1605,7 +1646,9 @@ var DeeplineClient = class {
|
|
|
1605
1646
|
}
|
|
1606
1647
|
options?.onProgress?.(status);
|
|
1607
1648
|
if (TERMINAL_PLAY_STATUSES.has(status.status)) {
|
|
1608
|
-
const finalStatus = await this.getPlayStatus(
|
|
1649
|
+
const finalStatus = await this.getPlayStatus(
|
|
1650
|
+
status.runId || workflowId
|
|
1651
|
+
).catch(() => status);
|
|
1609
1652
|
return playRunResultFromStatus(finalStatus, start, workflowId);
|
|
1610
1653
|
}
|
|
1611
1654
|
}
|
|
@@ -2634,8 +2677,8 @@ function getDefinedPlayMetadata(value) {
|
|
|
2634
2677
|
|
|
2635
2678
|
// src/tool-output.ts
|
|
2636
2679
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
2637
|
-
import { homedir as
|
|
2638
|
-
import { join as
|
|
2680
|
+
import { homedir as homedir3 } from "os";
|
|
2681
|
+
import { join as join3 } from "path";
|
|
2639
2682
|
function isPlainObject(value) {
|
|
2640
2683
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
2641
2684
|
}
|
|
@@ -2657,7 +2700,9 @@ function normalizeRows2(value) {
|
|
|
2657
2700
|
});
|
|
2658
2701
|
}
|
|
2659
2702
|
function candidateRoots(payload) {
|
|
2660
|
-
const roots = [
|
|
2703
|
+
const roots = [
|
|
2704
|
+
{ path: null, value: payload }
|
|
2705
|
+
];
|
|
2661
2706
|
if (isPlainObject(payload) && isPlainObject(payload.toolResponse)) {
|
|
2662
2707
|
roots.push({ path: "toolResponse", value: payload.toolResponse });
|
|
2663
2708
|
if (Object.prototype.hasOwnProperty.call(payload.toolResponse, "raw")) {
|
|
@@ -2684,7 +2729,9 @@ function candidateRoots(payload) {
|
|
|
2684
2729
|
function findBestArrayCandidate(value, pathPrefix = "", depth = 0) {
|
|
2685
2730
|
if (depth > 5) return null;
|
|
2686
2731
|
const directRows = normalizeRows2(value);
|
|
2687
|
-
const hasObjectRow = directRows?.some(
|
|
2732
|
+
const hasObjectRow = directRows?.some(
|
|
2733
|
+
(row) => Object.keys(row).some((key) => key !== "value")
|
|
2734
|
+
) ?? false;
|
|
2688
2735
|
let best = directRows && directRows.length > 0 && hasObjectRow ? { path: pathPrefix, rows: directRows } : null;
|
|
2689
2736
|
if (!isPlainObject(value)) {
|
|
2690
2737
|
return best;
|
|
@@ -2700,7 +2747,9 @@ function findBestArrayCandidate(value, pathPrefix = "", depth = 0) {
|
|
|
2700
2747
|
return best;
|
|
2701
2748
|
}
|
|
2702
2749
|
function tryConvertToList(payload, options) {
|
|
2703
|
-
const listExtractorPaths = Array.isArray(options?.listExtractorPaths) ? options?.listExtractorPaths.filter(
|
|
2750
|
+
const listExtractorPaths = Array.isArray(options?.listExtractorPaths) ? options?.listExtractorPaths.filter(
|
|
2751
|
+
(entry) => typeof entry === "string" && entry.trim().length > 0
|
|
2752
|
+
) : [];
|
|
2704
2753
|
if (listExtractorPaths.length > 0) {
|
|
2705
2754
|
for (const root of candidateRoots(payload)) {
|
|
2706
2755
|
for (const extractorPath of listExtractorPaths) {
|
|
@@ -2725,19 +2774,19 @@ function tryConvertToList(payload, options) {
|
|
|
2725
2774
|
return null;
|
|
2726
2775
|
}
|
|
2727
2776
|
function ensureOutputDir() {
|
|
2728
|
-
const outputDir =
|
|
2777
|
+
const outputDir = join3(homedir3(), ".local", "share", "deepline", "data");
|
|
2729
2778
|
mkdirSync2(outputDir, { recursive: true });
|
|
2730
2779
|
return outputDir;
|
|
2731
2780
|
}
|
|
2732
2781
|
function writeJsonOutputFile(payload, stem) {
|
|
2733
2782
|
const outputDir = ensureOutputDir();
|
|
2734
|
-
const outputPath =
|
|
2783
|
+
const outputPath = join3(outputDir, `${stem}_${Date.now()}.json`);
|
|
2735
2784
|
writeFileSync2(outputPath, JSON.stringify(payload, null, 2), "utf-8");
|
|
2736
2785
|
return outputPath;
|
|
2737
2786
|
}
|
|
2738
2787
|
function writeCsvOutputFile(rows, stem) {
|
|
2739
2788
|
const outputDir = ensureOutputDir();
|
|
2740
|
-
const outputPath =
|
|
2789
|
+
const outputPath = join3(outputDir, `${stem}_${Date.now()}.csv`);
|
|
2741
2790
|
const seen = /* @__PURE__ */ new Set();
|
|
2742
2791
|
const columns = [];
|
|
2743
2792
|
for (const row of rows) {
|
|
@@ -2766,7 +2815,9 @@ function writeCsvOutputFile(rows, stem) {
|
|
|
2766
2815
|
const previewColumns = columns.slice(0, 5);
|
|
2767
2816
|
const preview = [
|
|
2768
2817
|
previewColumns.join(","),
|
|
2769
|
-
...previewRows.map(
|
|
2818
|
+
...previewRows.map(
|
|
2819
|
+
(row) => previewColumns.map((column) => escapeCell(row[column])).join(",")
|
|
2820
|
+
)
|
|
2770
2821
|
].join("\n");
|
|
2771
2822
|
return {
|
|
2772
2823
|
path: outputPath,
|
|
@@ -2779,9 +2830,11 @@ function extractSummaryFields(payload) {
|
|
|
2779
2830
|
const candidates = candidateRoots(payload);
|
|
2780
2831
|
for (const candidate of candidates) {
|
|
2781
2832
|
if (!isPlainObject(candidate.value)) continue;
|
|
2782
|
-
const summaryEntries = Object.entries(candidate.value).filter(
|
|
2783
|
-
|
|
2784
|
-
|
|
2833
|
+
const summaryEntries = Object.entries(candidate.value).filter(
|
|
2834
|
+
([, value]) => {
|
|
2835
|
+
return value == null || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
2836
|
+
}
|
|
2837
|
+
);
|
|
2785
2838
|
if (summaryEntries.length === 0) continue;
|
|
2786
2839
|
return Object.fromEntries(summaryEntries);
|
|
2787
2840
|
}
|
|
@@ -991,12 +991,13 @@ async function persistWorkflowRetryState(input: {
|
|
|
991
991
|
childPlayManifests: stripRetryChildManifestCode(
|
|
992
992
|
input.params.childPlayManifests,
|
|
993
993
|
),
|
|
994
|
-
packagedFiles:
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
994
|
+
packagedFiles:
|
|
995
|
+
input.params.packagedFiles?.map((file) => ({
|
|
996
|
+
playPath: file.playPath,
|
|
997
|
+
storageKey: file.storageKey,
|
|
998
|
+
contentType: file.contentType,
|
|
999
|
+
bytes: file.bytes,
|
|
1000
|
+
})) ?? null,
|
|
1000
1001
|
};
|
|
1001
1002
|
await callWorkflowPool<{ ok?: unknown }>(input.env, '/run-retry-state-put', {
|
|
1002
1003
|
method: 'POST',
|
|
@@ -1115,9 +1116,7 @@ async function restartWorkflowAfterPlatformReset(input: {
|
|
|
1115
1116
|
instanceId: retryInstance.id,
|
|
1116
1117
|
started: true,
|
|
1117
1118
|
});
|
|
1118
|
-
input.ctx?.waitUntil(
|
|
1119
|
-
input.oldInstance.terminate().catch(() => undefined),
|
|
1120
|
-
);
|
|
1119
|
+
input.ctx?.waitUntil(input.oldInstance.terminate().catch(() => undefined));
|
|
1121
1120
|
recordCoordinatorPerfTraceBuffered(input.env, input.ctx, {
|
|
1122
1121
|
runId: input.runId,
|
|
1123
1122
|
phase: 'coordinator.platform_deploy_retry',
|
|
@@ -3177,7 +3176,7 @@ async function handleWorkflowRoute(input: {
|
|
|
3177
3176
|
error: error instanceof Error ? error.message : String(error),
|
|
3178
3177
|
},
|
|
3179
3178
|
});
|
|
3180
|
-
|
|
3179
|
+
});
|
|
3181
3180
|
input.ctx?.waitUntil(prewarmPromise);
|
|
3182
3181
|
}
|
|
3183
3182
|
await persistWorkflowRetryState({
|