deepline 0.1.20 → 0.1.21
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 +338 -118
- package/dist/cli/index.mjs +338 -118
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +51 -6
- package/dist/index.mjs +51 -6
- package/dist/repo/apps/play-runner-workers/src/coordinator-entry.ts +888 -227
- package/dist/repo/apps/play-runner-workers/src/dedup-do.ts +540 -36
- package/dist/repo/apps/play-runner-workers/src/entry.ts +330 -374
- package/dist/repo/sdk/src/client.ts +46 -4
- package/dist/repo/sdk/src/http.ts +19 -1
- package/dist/repo/sdk/src/plays/harness-stub.ts +12 -0
- package/dist/repo/sdk/src/version.ts +1 -1
- package/dist/repo/shared_libs/play-runtime/scheduler-backend.ts +3 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -241,7 +241,7 @@ function resolveConfig(options) {
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
// src/version.ts
|
|
244
|
-
var SDK_VERSION = "0.1.
|
|
244
|
+
var SDK_VERSION = "0.1.21";
|
|
245
245
|
var SDK_API_CONTRACT = "2026-05-runs-v2";
|
|
246
246
|
|
|
247
247
|
// ../shared_libs/play-runtime/coordinator-headers.ts
|
|
@@ -324,7 +324,7 @@ var HttpClient = class {
|
|
|
324
324
|
const response = await fetch(candidateUrl, {
|
|
325
325
|
method,
|
|
326
326
|
headers,
|
|
327
|
-
body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0,
|
|
327
|
+
body: options?.formData !== void 0 ? options.formData : options?.body !== void 0 ? JSON.stringify(options.body) : void 0,
|
|
328
328
|
signal: controller.signal
|
|
329
329
|
});
|
|
330
330
|
clearTimeout(timeoutId);
|
|
@@ -443,6 +443,13 @@ var HttpClient = class {
|
|
|
443
443
|
headers
|
|
444
444
|
});
|
|
445
445
|
}
|
|
446
|
+
async postFormData(path, formData, headers) {
|
|
447
|
+
return this.request(path, {
|
|
448
|
+
method: "POST",
|
|
449
|
+
formData,
|
|
450
|
+
headers
|
|
451
|
+
});
|
|
452
|
+
}
|
|
446
453
|
/**
|
|
447
454
|
* Send a DELETE request.
|
|
448
455
|
*
|
|
@@ -551,6 +558,14 @@ function mapLegacyTemporalStatus(status) {
|
|
|
551
558
|
return "running";
|
|
552
559
|
}
|
|
553
560
|
}
|
|
561
|
+
function decodeBase64Bytes(value) {
|
|
562
|
+
const binary = atob(value);
|
|
563
|
+
const bytes = new Uint8Array(binary.length);
|
|
564
|
+
for (let index = 0; index < binary.length; index += 1) {
|
|
565
|
+
bytes[index] = binary.charCodeAt(index);
|
|
566
|
+
}
|
|
567
|
+
return bytes;
|
|
568
|
+
}
|
|
554
569
|
var DeeplineClient = class {
|
|
555
570
|
http;
|
|
556
571
|
config;
|
|
@@ -1002,9 +1017,34 @@ var DeeplineClient = class {
|
|
|
1002
1017
|
* ```
|
|
1003
1018
|
*/
|
|
1004
1019
|
async stagePlayFiles(files) {
|
|
1005
|
-
const
|
|
1020
|
+
const formData = new FormData();
|
|
1021
|
+
formData.set(
|
|
1022
|
+
"metadata",
|
|
1023
|
+
JSON.stringify({
|
|
1024
|
+
files: files.map((file, index) => ({
|
|
1025
|
+
index,
|
|
1026
|
+
logicalPath: file.logicalPath,
|
|
1027
|
+
contentHash: file.contentHash,
|
|
1028
|
+
contentType: file.contentType,
|
|
1029
|
+
bytes: file.bytes
|
|
1030
|
+
}))
|
|
1031
|
+
})
|
|
1032
|
+
);
|
|
1033
|
+
for (const [index, file] of files.entries()) {
|
|
1034
|
+
const bytes = decodeBase64Bytes(file.contentBase64);
|
|
1035
|
+
const body = bytes.buffer.slice(
|
|
1036
|
+
bytes.byteOffset,
|
|
1037
|
+
bytes.byteOffset + bytes.byteLength
|
|
1038
|
+
);
|
|
1039
|
+
formData.set(
|
|
1040
|
+
`file:${index}`,
|
|
1041
|
+
new Blob([body], { type: file.contentType }),
|
|
1042
|
+
file.logicalPath
|
|
1043
|
+
);
|
|
1044
|
+
}
|
|
1045
|
+
const response = await this.http.postFormData(
|
|
1006
1046
|
"/api/v2/plays/files/stage",
|
|
1007
|
-
|
|
1047
|
+
formData
|
|
1008
1048
|
);
|
|
1009
1049
|
return response.files;
|
|
1010
1050
|
}
|
|
@@ -1033,9 +1073,14 @@ var DeeplineClient = class {
|
|
|
1033
1073
|
* console.log(`Logs: ${status.progress?.logs.length ?? 0} lines`);
|
|
1034
1074
|
* ```
|
|
1035
1075
|
*/
|
|
1036
|
-
async getPlayStatus(workflowId) {
|
|
1076
|
+
async getPlayStatus(workflowId, options) {
|
|
1077
|
+
const params = new URLSearchParams();
|
|
1078
|
+
if (options?.billing === false) {
|
|
1079
|
+
params.set("billing", "false");
|
|
1080
|
+
}
|
|
1081
|
+
const query = params.size > 0 ? `?${params.toString()}` : "";
|
|
1037
1082
|
const response = await this.http.get(
|
|
1038
|
-
`/api/v2/plays/run/${encodeURIComponent(workflowId)}`
|
|
1083
|
+
`/api/v2/plays/run/${encodeURIComponent(workflowId)}${query}`
|
|
1039
1084
|
);
|
|
1040
1085
|
return normalizePlayStatus(response);
|
|
1041
1086
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -195,7 +195,7 @@ function resolveConfig(options) {
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
// src/version.ts
|
|
198
|
-
var SDK_VERSION = "0.1.
|
|
198
|
+
var SDK_VERSION = "0.1.21";
|
|
199
199
|
var SDK_API_CONTRACT = "2026-05-runs-v2";
|
|
200
200
|
|
|
201
201
|
// ../shared_libs/play-runtime/coordinator-headers.ts
|
|
@@ -278,7 +278,7 @@ var HttpClient = class {
|
|
|
278
278
|
const response = await fetch(candidateUrl, {
|
|
279
279
|
method,
|
|
280
280
|
headers,
|
|
281
|
-
body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0,
|
|
281
|
+
body: options?.formData !== void 0 ? options.formData : options?.body !== void 0 ? JSON.stringify(options.body) : void 0,
|
|
282
282
|
signal: controller.signal
|
|
283
283
|
});
|
|
284
284
|
clearTimeout(timeoutId);
|
|
@@ -397,6 +397,13 @@ var HttpClient = class {
|
|
|
397
397
|
headers
|
|
398
398
|
});
|
|
399
399
|
}
|
|
400
|
+
async postFormData(path, formData, headers) {
|
|
401
|
+
return this.request(path, {
|
|
402
|
+
method: "POST",
|
|
403
|
+
formData,
|
|
404
|
+
headers
|
|
405
|
+
});
|
|
406
|
+
}
|
|
400
407
|
/**
|
|
401
408
|
* Send a DELETE request.
|
|
402
409
|
*
|
|
@@ -505,6 +512,14 @@ function mapLegacyTemporalStatus(status) {
|
|
|
505
512
|
return "running";
|
|
506
513
|
}
|
|
507
514
|
}
|
|
515
|
+
function decodeBase64Bytes(value) {
|
|
516
|
+
const binary = atob(value);
|
|
517
|
+
const bytes = new Uint8Array(binary.length);
|
|
518
|
+
for (let index = 0; index < binary.length; index += 1) {
|
|
519
|
+
bytes[index] = binary.charCodeAt(index);
|
|
520
|
+
}
|
|
521
|
+
return bytes;
|
|
522
|
+
}
|
|
508
523
|
var DeeplineClient = class {
|
|
509
524
|
http;
|
|
510
525
|
config;
|
|
@@ -956,9 +971,34 @@ var DeeplineClient = class {
|
|
|
956
971
|
* ```
|
|
957
972
|
*/
|
|
958
973
|
async stagePlayFiles(files) {
|
|
959
|
-
const
|
|
974
|
+
const formData = new FormData();
|
|
975
|
+
formData.set(
|
|
976
|
+
"metadata",
|
|
977
|
+
JSON.stringify({
|
|
978
|
+
files: files.map((file, index) => ({
|
|
979
|
+
index,
|
|
980
|
+
logicalPath: file.logicalPath,
|
|
981
|
+
contentHash: file.contentHash,
|
|
982
|
+
contentType: file.contentType,
|
|
983
|
+
bytes: file.bytes
|
|
984
|
+
}))
|
|
985
|
+
})
|
|
986
|
+
);
|
|
987
|
+
for (const [index, file] of files.entries()) {
|
|
988
|
+
const bytes = decodeBase64Bytes(file.contentBase64);
|
|
989
|
+
const body = bytes.buffer.slice(
|
|
990
|
+
bytes.byteOffset,
|
|
991
|
+
bytes.byteOffset + bytes.byteLength
|
|
992
|
+
);
|
|
993
|
+
formData.set(
|
|
994
|
+
`file:${index}`,
|
|
995
|
+
new Blob([body], { type: file.contentType }),
|
|
996
|
+
file.logicalPath
|
|
997
|
+
);
|
|
998
|
+
}
|
|
999
|
+
const response = await this.http.postFormData(
|
|
960
1000
|
"/api/v2/plays/files/stage",
|
|
961
|
-
|
|
1001
|
+
formData
|
|
962
1002
|
);
|
|
963
1003
|
return response.files;
|
|
964
1004
|
}
|
|
@@ -987,9 +1027,14 @@ var DeeplineClient = class {
|
|
|
987
1027
|
* console.log(`Logs: ${status.progress?.logs.length ?? 0} lines`);
|
|
988
1028
|
* ```
|
|
989
1029
|
*/
|
|
990
|
-
async getPlayStatus(workflowId) {
|
|
1030
|
+
async getPlayStatus(workflowId, options) {
|
|
1031
|
+
const params = new URLSearchParams();
|
|
1032
|
+
if (options?.billing === false) {
|
|
1033
|
+
params.set("billing", "false");
|
|
1034
|
+
}
|
|
1035
|
+
const query = params.size > 0 ? `?${params.toString()}` : "";
|
|
991
1036
|
const response = await this.http.get(
|
|
992
|
-
`/api/v2/plays/run/${encodeURIComponent(workflowId)}`
|
|
1037
|
+
`/api/v2/plays/run/${encodeURIComponent(workflowId)}${query}`
|
|
993
1038
|
);
|
|
994
1039
|
return normalizePlayStatus(response);
|
|
995
1040
|
}
|