deepline 0.1.25 → 0.1.26
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 +118 -85
- package/dist/cli/index.mjs +103 -69
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/repo/apps/play-runner-workers/src/coordinator-entry.ts +75 -62
- package/dist/repo/apps/play-runner-workers/src/dedup-do.ts +6 -1
- package/dist/repo/apps/play-runner-workers/src/entry.ts +1102 -711
- package/dist/repo/apps/play-runner-workers/src/runtime/dataset-handles.ts +418 -0
- package/dist/repo/sdk/src/client.ts +5 -1
- package/dist/repo/sdk/src/plays/bundle-play-file.ts +1 -1
- package/dist/repo/sdk/src/plays/harness-stub.ts +23 -35
- package/dist/repo/sdk/src/version.ts +1 -1
- package/dist/repo/shared_libs/play-runtime/execution-plan.ts +18 -8
- package/dist/repo/shared_libs/play-runtime/scheduler-backend.ts +5 -4
- package/dist/repo/shared_libs/play-runtime/step-lifecycle-tracker.ts +228 -0
- package/dist/repo/shared_libs/plays/bundling/index.ts +90 -51
- package/package.json +1 -1
- package/dist/repo/shared_libs/play-runtime/runtime-actions.ts +0 -208
package/dist/cli/index.js
CHANGED
|
@@ -266,7 +266,7 @@ function saveProjectDeeplineEnvValues(baseUrl, values, startDir = projectEnvStar
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
// src/version.ts
|
|
269
|
-
var SDK_VERSION = "0.1.
|
|
269
|
+
var SDK_VERSION = "0.1.26";
|
|
270
270
|
var SDK_API_CONTRACT = "2026-05-runs-v2";
|
|
271
271
|
|
|
272
272
|
// ../shared_libs/play-runtime/coordinator-headers.ts
|
|
@@ -611,7 +611,7 @@ function updatePlayLiveStatusState(state, event) {
|
|
|
611
611
|
const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : state.runId;
|
|
612
612
|
const status = normalizeLiveStatus(payload.status) ?? state.status;
|
|
613
613
|
const logs = readStringArray(payload.logs);
|
|
614
|
-
if (logs.length > 0 || event.type === "play.run.snapshot") {
|
|
614
|
+
if (logs.length > 0 || event.type === "play.run.snapshot" || event.type === "play.run.final_status") {
|
|
615
615
|
state.logs = logs;
|
|
616
616
|
}
|
|
617
617
|
if ("result" in payload) {
|
|
@@ -3513,17 +3513,18 @@ Examples:
|
|
|
3513
3513
|
|
|
3514
3514
|
// src/cli/commands/play.ts
|
|
3515
3515
|
var import_node_crypto3 = require("crypto");
|
|
3516
|
-
var
|
|
3516
|
+
var import_node_fs7 = require("fs");
|
|
3517
3517
|
var import_node_path9 = require("path");
|
|
3518
3518
|
|
|
3519
3519
|
// src/plays/bundle-play-file.ts
|
|
3520
3520
|
var import_node_os5 = require("os");
|
|
3521
3521
|
var import_node_path8 = require("path");
|
|
3522
3522
|
var import_node_url = require("url");
|
|
3523
|
-
var
|
|
3523
|
+
var import_node_fs6 = require("fs");
|
|
3524
3524
|
|
|
3525
3525
|
// ../shared_libs/plays/bundling/index.ts
|
|
3526
3526
|
var import_node_crypto = require("crypto");
|
|
3527
|
+
var import_node_fs5 = require("fs");
|
|
3527
3528
|
var import_promises3 = require("fs/promises");
|
|
3528
3529
|
var import_node_os4 = require("os");
|
|
3529
3530
|
var import_node_path6 = require("path");
|
|
@@ -3582,8 +3583,6 @@ function buildPlayContractCompatibility(input) {
|
|
|
3582
3583
|
}
|
|
3583
3584
|
|
|
3584
3585
|
// ../shared_libs/plays/bundling/index.ts
|
|
3585
|
-
var import_meta = {};
|
|
3586
|
-
var playArtifactRequire = (0, import_node_module.createRequire)(import_meta.url);
|
|
3587
3586
|
var PLAY_BUNDLE_CACHE_VERSION = 24;
|
|
3588
3587
|
var MAX_PLAY_BUNDLE_BYTES = 30 * 1024 * 1024;
|
|
3589
3588
|
var MAX_ESM_WORKERS_BUNDLE_BYTES = 115e4;
|
|
@@ -3750,7 +3749,7 @@ function findMatchingBrace(source, openIndex) {
|
|
|
3750
3749
|
}
|
|
3751
3750
|
return -1;
|
|
3752
3751
|
}
|
|
3753
|
-
function extractDefinedPlayName(sourceCode
|
|
3752
|
+
function extractDefinedPlayName(sourceCode) {
|
|
3754
3753
|
const source = stripCommentsToSpaces(sourceCode);
|
|
3755
3754
|
const callPattern = /(?:\b[A-Za-z_$][\w$]*\s*\.\s*)?\b(?:definePlay|defineWorkflow)\s*\(/g;
|
|
3756
3755
|
for (const match of source.matchAll(callPattern)) {
|
|
@@ -3777,17 +3776,61 @@ function extractDefinedPlayName(sourceCode, _filePath) {
|
|
|
3777
3776
|
}
|
|
3778
3777
|
return null;
|
|
3779
3778
|
}
|
|
3780
|
-
function
|
|
3781
|
-
|
|
3782
|
-
(0,
|
|
3783
|
-
(
|
|
3784
|
-
|
|
3779
|
+
function readPackageVersionFromPackageJson(packageJsonPath, packageName) {
|
|
3780
|
+
try {
|
|
3781
|
+
const packageJson = JSON.parse((0, import_node_fs5.readFileSync)(packageJsonPath, "utf-8"));
|
|
3782
|
+
if (packageJson.name === packageName && typeof packageJson.version === "string") {
|
|
3783
|
+
return packageJson.version;
|
|
3784
|
+
}
|
|
3785
|
+
} catch {
|
|
3786
|
+
return null;
|
|
3787
|
+
}
|
|
3788
|
+
return null;
|
|
3789
|
+
}
|
|
3790
|
+
function findPackageJsonPathFrom(startDir, packageName) {
|
|
3791
|
+
let current = (0, import_node_path6.resolve)(startDir);
|
|
3792
|
+
while (true) {
|
|
3793
|
+
const packageJsonPath = (0, import_node_path6.join)(
|
|
3794
|
+
current,
|
|
3795
|
+
"node_modules",
|
|
3796
|
+
packageName,
|
|
3797
|
+
"package.json"
|
|
3798
|
+
);
|
|
3799
|
+
if ((0, import_node_fs5.existsSync)(packageJsonPath)) {
|
|
3800
|
+
return packageJsonPath;
|
|
3801
|
+
}
|
|
3802
|
+
const parent = (0, import_node_path6.dirname)(current);
|
|
3803
|
+
if (parent === current) {
|
|
3804
|
+
return null;
|
|
3805
|
+
}
|
|
3806
|
+
current = parent;
|
|
3807
|
+
}
|
|
3808
|
+
}
|
|
3809
|
+
function findPackageJsonPath(packageName, fromFile, adapter) {
|
|
3810
|
+
const startDirs = [
|
|
3811
|
+
(0, import_node_path6.dirname)(fromFile),
|
|
3812
|
+
adapter.projectRoot,
|
|
3813
|
+
(0, import_node_path6.dirname)(adapter.sdkPackageJson),
|
|
3814
|
+
process.cwd()
|
|
3785
3815
|
];
|
|
3786
|
-
|
|
3816
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3817
|
+
for (const startDir of startDirs) {
|
|
3818
|
+
const normalized = (0, import_node_path6.resolve)(startDir);
|
|
3819
|
+
if (seen.has(normalized)) continue;
|
|
3820
|
+
seen.add(normalized);
|
|
3821
|
+
const packageJsonPath = findPackageJsonPathFrom(normalized, packageName);
|
|
3822
|
+
if (packageJsonPath) return packageJsonPath;
|
|
3823
|
+
}
|
|
3824
|
+
const adapterNodeModulesPackageJson = (0, import_node_path6.join)(
|
|
3825
|
+
adapter.nodeModulesDir,
|
|
3826
|
+
packageName,
|
|
3827
|
+
"package.json"
|
|
3828
|
+
);
|
|
3829
|
+
return (0, import_node_fs5.existsSync)(adapterNodeModulesPackageJson) ? adapterNodeModulesPackageJson : null;
|
|
3787
3830
|
}
|
|
3788
3831
|
function localSdkAliasPlugin(adapter, options) {
|
|
3789
3832
|
const entryFile = options?.workersRuntime ? adapter.sdkWorkersEntryFile : adapter.sdkEntryFile;
|
|
3790
|
-
if (!
|
|
3833
|
+
if (!(0, import_node_fs5.existsSync)(entryFile)) {
|
|
3791
3834
|
return null;
|
|
3792
3835
|
}
|
|
3793
3836
|
return {
|
|
@@ -4028,43 +4071,23 @@ async function resolveLocalImport(fromFile, specifier) {
|
|
|
4028
4071
|
}
|
|
4029
4072
|
function resolvePackageImport(specifier, fromFile, adapter) {
|
|
4030
4073
|
const packageName = getPackageName(specifier);
|
|
4031
|
-
if (packageName === "deepline" &&
|
|
4074
|
+
if (packageName === "deepline" && (0, import_node_fs5.existsSync)(adapter.sdkPackageJson)) {
|
|
4032
4075
|
const packageJson = JSON.parse(
|
|
4033
|
-
|
|
4076
|
+
(0, import_node_fs5.readFileSync)(adapter.sdkPackageJson, "utf-8")
|
|
4034
4077
|
);
|
|
4035
4078
|
return {
|
|
4036
4079
|
name: "deepline",
|
|
4037
4080
|
version: packageJson.version ?? null
|
|
4038
4081
|
};
|
|
4039
4082
|
}
|
|
4040
|
-
const
|
|
4041
|
-
|
|
4042
|
-
for (const candidateRequire of candidateRequires) {
|
|
4043
|
-
try {
|
|
4044
|
-
candidateRequire.resolve(specifier);
|
|
4045
|
-
resolved = true;
|
|
4046
|
-
break;
|
|
4047
|
-
} catch {
|
|
4048
|
-
continue;
|
|
4049
|
-
}
|
|
4050
|
-
}
|
|
4051
|
-
if (!resolved) {
|
|
4083
|
+
const packageJsonPath = findPackageJsonPath(packageName, fromFile, adapter);
|
|
4084
|
+
if (!packageJsonPath) {
|
|
4052
4085
|
throw new Error(`Could not resolve "${specifier}" from ${fromFile}`);
|
|
4053
4086
|
}
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
const packageJson = JSON.parse(
|
|
4059
|
-
playArtifactRequire("node:fs").readFileSync(packageJsonPath, "utf-8")
|
|
4060
|
-
);
|
|
4061
|
-
version = packageJson.version ?? null;
|
|
4062
|
-
break;
|
|
4063
|
-
} catch {
|
|
4064
|
-
continue;
|
|
4065
|
-
}
|
|
4066
|
-
}
|
|
4067
|
-
return { name: packageName, version };
|
|
4087
|
+
return {
|
|
4088
|
+
name: packageName,
|
|
4089
|
+
version: readPackageVersionFromPackageJson(packageJsonPath, packageName)
|
|
4090
|
+
};
|
|
4068
4091
|
}
|
|
4069
4092
|
async function analyzeSourceGraph(entryFile, adapter) {
|
|
4070
4093
|
const absoluteEntryFile = await normalizeLocalPath(entryFile);
|
|
@@ -4107,7 +4130,7 @@ async function analyzeSourceGraph(entryFile, adapter) {
|
|
|
4107
4130
|
});
|
|
4108
4131
|
if (resolved !== absoluteEntryFile && isPlaySourceFile(resolved)) {
|
|
4109
4132
|
const importedSource = await (0, import_promises3.readFile)(resolved, "utf-8");
|
|
4110
|
-
const importedPlayName = extractDefinedPlayName(importedSource
|
|
4133
|
+
const importedPlayName = extractDefinedPlayName(importedSource);
|
|
4111
4134
|
if (!importedPlayName) {
|
|
4112
4135
|
throw new Error(
|
|
4113
4136
|
`${absolutePath}:${line}:${column} Imported play file "${specifier}" must export definePlay(...) so it can be runtime-composed.`
|
|
@@ -4161,7 +4184,7 @@ async function analyzeSourceGraph(entryFile, adapter) {
|
|
|
4161
4184
|
})).sort((left, right) => left.filePath.localeCompare(right.filePath))
|
|
4162
4185
|
})
|
|
4163
4186
|
);
|
|
4164
|
-
const playName = extractDefinedPlayName(sourceCode
|
|
4187
|
+
const playName = extractDefinedPlayName(sourceCode);
|
|
4165
4188
|
return {
|
|
4166
4189
|
sourceCode,
|
|
4167
4190
|
sourceFiles: Object.fromEntries(
|
|
@@ -4844,16 +4867,16 @@ async function discoverPackagedLocalFiles(entryFile) {
|
|
|
4844
4867
|
}
|
|
4845
4868
|
|
|
4846
4869
|
// src/plays/bundle-play-file.ts
|
|
4847
|
-
var
|
|
4848
|
-
var PLAY_BUNDLE_CACHE_VERSION2 =
|
|
4849
|
-
var MODULE_DIR = (0, import_node_path8.dirname)((0, import_node_url.fileURLToPath)(
|
|
4870
|
+
var import_meta = {};
|
|
4871
|
+
var PLAY_BUNDLE_CACHE_VERSION2 = 30;
|
|
4872
|
+
var MODULE_DIR = (0, import_node_path8.dirname)((0, import_node_url.fileURLToPath)(import_meta.url));
|
|
4850
4873
|
var SDK_PACKAGE_ROOT = (0, import_node_path8.resolve)(MODULE_DIR, "..", "..");
|
|
4851
4874
|
var SOURCE_REPO_ROOT = (0, import_node_path8.resolve)(SDK_PACKAGE_ROOT, "..");
|
|
4852
|
-
var HAS_SOURCE_BUNDLING_SOURCES = (0,
|
|
4875
|
+
var HAS_SOURCE_BUNDLING_SOURCES = (0, import_node_fs6.existsSync)(
|
|
4853
4876
|
(0, import_node_path8.resolve)(SOURCE_REPO_ROOT, "apps", "play-runner-workers", "src", "entry.ts")
|
|
4854
4877
|
);
|
|
4855
4878
|
var PACKAGED_REPO_ROOT = (0, import_node_path8.resolve)(SDK_PACKAGE_ROOT, "dist", "repo");
|
|
4856
|
-
var HAS_PACKAGED_BUNDLING_SOURCES = (0,
|
|
4879
|
+
var HAS_PACKAGED_BUNDLING_SOURCES = (0, import_node_fs6.existsSync)(
|
|
4857
4880
|
(0, import_node_path8.resolve)(PACKAGED_REPO_ROOT, "apps", "play-runner-workers", "src", "entry.ts")
|
|
4858
4881
|
);
|
|
4859
4882
|
var PROJECT_ROOT = HAS_SOURCE_BUNDLING_SOURCES ? SOURCE_REPO_ROOT : HAS_PACKAGED_BUNDLING_SOURCES ? PACKAGED_REPO_ROOT : (0, import_node_path8.resolve)(SDK_PACKAGE_ROOT, "..");
|
|
@@ -4892,7 +4915,7 @@ function createSdkPlayBundlingAdapter() {
|
|
|
4892
4915
|
sdkSourceRoot: SDK_SOURCE_ROOT,
|
|
4893
4916
|
sdkPackageJson: SDK_PACKAGE_JSON,
|
|
4894
4917
|
sdkEntryFile: SDK_ENTRY_FILE,
|
|
4895
|
-
sdkTypesEntryFile: HAS_SOURCE_BUNDLING_SOURCES || !(0,
|
|
4918
|
+
sdkTypesEntryFile: HAS_SOURCE_BUNDLING_SOURCES || !(0, import_node_fs6.existsSync)(SDK_TYPES_ENTRY_FILE) ? SDK_ENTRY_FILE : SDK_TYPES_ENTRY_FILE,
|
|
4896
4919
|
sdkWorkersEntryFile: SDK_WORKERS_ENTRY_FILE,
|
|
4897
4920
|
workersHarnessEntryFile: WORKERS_HARNESS_ENTRY_FILE,
|
|
4898
4921
|
workersHarnessFilesDir: WORKERS_HARNESS_FILES_DIR,
|
|
@@ -5178,15 +5201,15 @@ function materializeRemotePlaySource(input) {
|
|
|
5178
5201
|
return null;
|
|
5179
5202
|
}
|
|
5180
5203
|
const outputPath = input.outPath ?? defaultMaterializedPlayPath(input.playName);
|
|
5181
|
-
if ((0,
|
|
5182
|
-
const existingSource = (0,
|
|
5204
|
+
if ((0, import_node_fs7.existsSync)(outputPath)) {
|
|
5205
|
+
const existingSource = (0, import_node_fs7.readFileSync)(outputPath, "utf-8");
|
|
5183
5206
|
if (existingSource === input.sourceCode) {
|
|
5184
5207
|
return { path: outputPath, status: "unchanged", created: false };
|
|
5185
5208
|
}
|
|
5186
|
-
(0,
|
|
5209
|
+
(0, import_node_fs7.writeFileSync)(outputPath, input.sourceCode, "utf-8");
|
|
5187
5210
|
return { path: outputPath, status: "updated", created: false };
|
|
5188
5211
|
}
|
|
5189
|
-
(0,
|
|
5212
|
+
(0, import_node_fs7.writeFileSync)(outputPath, input.sourceCode, "utf-8");
|
|
5190
5213
|
return { path: outputPath, status: "created", created: true };
|
|
5191
5214
|
}
|
|
5192
5215
|
function formatLoadedPlayMessage(materializedFile) {
|
|
@@ -5224,14 +5247,14 @@ function buildMissingDefinePlayError(filePath) {
|
|
|
5224
5247
|
);
|
|
5225
5248
|
}
|
|
5226
5249
|
function extractPlayName(code, filePath) {
|
|
5227
|
-
const definedPlayName = extractDefinedPlayName(code
|
|
5250
|
+
const definedPlayName = extractDefinedPlayName(code);
|
|
5228
5251
|
if (definedPlayName) {
|
|
5229
5252
|
return definedPlayName;
|
|
5230
5253
|
}
|
|
5231
5254
|
throw buildMissingDefinePlayError(filePath);
|
|
5232
5255
|
}
|
|
5233
5256
|
function isFileTarget(target) {
|
|
5234
|
-
return (0,
|
|
5257
|
+
return (0, import_node_fs7.existsSync)((0, import_node_path9.resolve)(target));
|
|
5235
5258
|
}
|
|
5236
5259
|
function looksLikeFilePath(target) {
|
|
5237
5260
|
if (target.trim().toLowerCase().startsWith("prebuilt/")) {
|
|
@@ -5250,7 +5273,7 @@ function parsePositiveInteger2(value, flagName) {
|
|
|
5250
5273
|
return parsed;
|
|
5251
5274
|
}
|
|
5252
5275
|
function parseJsonInput(raw) {
|
|
5253
|
-
const source = raw.startsWith("@") ? (0,
|
|
5276
|
+
const source = raw.startsWith("@") ? (0, import_node_fs7.readFileSync)((0, import_node_path9.resolve)(raw.slice(1)), "utf-8") : raw;
|
|
5254
5277
|
const parsed = JSON.parse(source);
|
|
5255
5278
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
5256
5279
|
throw new Error("--input must be a JSON object.");
|
|
@@ -5360,7 +5383,7 @@ function applyCsvShortcutInput(input) {
|
|
|
5360
5383
|
function isLocalFilePathValue(value) {
|
|
5361
5384
|
if (typeof value !== "string" || !value.trim()) return false;
|
|
5362
5385
|
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(value.trim())) return false;
|
|
5363
|
-
return (0,
|
|
5386
|
+
return (0, import_node_fs7.existsSync)((0, import_node_path9.resolve)(value));
|
|
5364
5387
|
}
|
|
5365
5388
|
function inputContainsLocalFilePath(value) {
|
|
5366
5389
|
if (isLocalFilePathValue(value)) {
|
|
@@ -5411,7 +5434,7 @@ async function stageFileInputArgs(input) {
|
|
|
5411
5434
|
};
|
|
5412
5435
|
}
|
|
5413
5436
|
function stageFile(logicalPath, absolutePath) {
|
|
5414
|
-
const buffer = (0,
|
|
5437
|
+
const buffer = (0, import_node_fs7.readFileSync)(absolutePath);
|
|
5415
5438
|
return {
|
|
5416
5439
|
logicalPath,
|
|
5417
5440
|
contentBase64: buffer.toString("base64"),
|
|
@@ -5422,7 +5445,7 @@ function stageFile(logicalPath, absolutePath) {
|
|
|
5422
5445
|
}
|
|
5423
5446
|
function normalizePlayPath(filePath) {
|
|
5424
5447
|
try {
|
|
5425
|
-
return
|
|
5448
|
+
return import_node_fs7.realpathSync.native((0, import_node_path9.resolve)(filePath));
|
|
5426
5449
|
} catch {
|
|
5427
5450
|
return (0, import_node_path9.resolve)(filePath);
|
|
5428
5451
|
}
|
|
@@ -5509,7 +5532,10 @@ async function compileBundledPlayGraphManifests(client, graph) {
|
|
|
5509
5532
|
`Missing compiler manifest for imported dependency ${dependency.filePath}.`
|
|
5510
5533
|
);
|
|
5511
5534
|
}
|
|
5512
|
-
return
|
|
5535
|
+
return {
|
|
5536
|
+
...child.compilerManifest,
|
|
5537
|
+
filePath: dependency.filePath
|
|
5538
|
+
};
|
|
5513
5539
|
}
|
|
5514
5540
|
)
|
|
5515
5541
|
});
|
|
@@ -5583,14 +5609,14 @@ function getEventPayload(event) {
|
|
|
5583
5609
|
return event.payload && typeof event.payload === "object" ? event.payload : {};
|
|
5584
5610
|
}
|
|
5585
5611
|
function getStatusFromLiveEvent(event) {
|
|
5586
|
-
if (event.type !== "play.run.status" && event.type !== "play.run.snapshot") {
|
|
5612
|
+
if (event.type !== "play.run.status" && event.type !== "play.run.snapshot" && event.type !== "play.run.final_status") {
|
|
5587
5613
|
return null;
|
|
5588
5614
|
}
|
|
5589
5615
|
const status = getEventPayload(event).status;
|
|
5590
5616
|
return status === "queued" || status === "running" || status === "waiting" || status === "completed" || status === "failed" || status === "cancelled" ? status : null;
|
|
5591
5617
|
}
|
|
5592
5618
|
function getFinalStatusFromLiveEvent(event) {
|
|
5593
|
-
if (event.type !== "play.run.final_status") {
|
|
5619
|
+
if (event.type !== "play.run.snapshot" && event.type !== "play.run.status" && event.type !== "play.run.final_status") {
|
|
5594
5620
|
return null;
|
|
5595
5621
|
}
|
|
5596
5622
|
const payload = getEventPayload(event);
|
|
@@ -6078,6 +6104,13 @@ function getStringField(value, key) {
|
|
|
6078
6104
|
const field = getRecordField(value, key);
|
|
6079
6105
|
return typeof field === "string" && field.trim() ? field : null;
|
|
6080
6106
|
}
|
|
6107
|
+
function getTimestampField(value, key) {
|
|
6108
|
+
const field = getRecordField(value, key);
|
|
6109
|
+
if (typeof field === "number" && Number.isFinite(field)) {
|
|
6110
|
+
return field;
|
|
6111
|
+
}
|
|
6112
|
+
return typeof field === "string" && field.trim() ? field : null;
|
|
6113
|
+
}
|
|
6081
6114
|
function normalizeRunStatusForEnvelope(status) {
|
|
6082
6115
|
const run = status.run ?? null;
|
|
6083
6116
|
return {
|
|
@@ -6085,9 +6118,9 @@ function normalizeRunStatusForEnvelope(status) {
|
|
|
6085
6118
|
playName: status.playName ?? status.name ?? getStringField(run, "playName") ?? null,
|
|
6086
6119
|
status: status.status,
|
|
6087
6120
|
runtime: getStringField(status, "runtime") ?? getStringField(status, "runtimeBackend") ?? getStringField(run, "runtime") ?? null,
|
|
6088
|
-
startedAt:
|
|
6089
|
-
updatedAt:
|
|
6090
|
-
finishedAt:
|
|
6121
|
+
startedAt: getTimestampField(status, "startedAt") ?? getTimestampField(run, "startTime") ?? getTimestampField(run, "startedAt") ?? null,
|
|
6122
|
+
updatedAt: getTimestampField(status, "updatedAt") ?? getTimestampField(run, "updatedAt") ?? null,
|
|
6123
|
+
finishedAt: getTimestampField(status, "finishedAt") ?? getTimestampField(run, "closeTime") ?? getTimestampField(run, "finishedAt") ?? null,
|
|
6091
6124
|
source: getRecordField(status, "source") ?? getRecordField(status, "artifact") ?? null
|
|
6092
6125
|
};
|
|
6093
6126
|
}
|
|
@@ -6589,7 +6622,7 @@ async function handlePlayCheck(args) {
|
|
|
6589
6622
|
return 1;
|
|
6590
6623
|
}
|
|
6591
6624
|
const absolutePlayPath = (0, import_node_path9.resolve)(options.target);
|
|
6592
|
-
const sourceCode = (0,
|
|
6625
|
+
const sourceCode = (0, import_node_fs7.readFileSync)(absolutePlayPath, "utf-8");
|
|
6593
6626
|
let graph;
|
|
6594
6627
|
try {
|
|
6595
6628
|
graph = await collectBundledPlayGraph(absolutePlayPath);
|
|
@@ -6657,7 +6690,7 @@ async function handleFileBackedRun(options) {
|
|
|
6657
6690
|
const sourceCode = traceCliSync(
|
|
6658
6691
|
"cli.play_file_read_source",
|
|
6659
6692
|
{ targetKind: "file" },
|
|
6660
|
-
() => (0,
|
|
6693
|
+
() => (0, import_node_fs7.readFileSync)(absolutePlayPath, "utf-8")
|
|
6661
6694
|
);
|
|
6662
6695
|
const runtimeInput = options.input ? { ...options.input } : {};
|
|
6663
6696
|
let graph;
|
|
@@ -6944,10 +6977,10 @@ async function handlePlayRun(args) {
|
|
|
6944
6977
|
const resolved = (0, import_node_path9.resolve)(options.target.path);
|
|
6945
6978
|
console.error(`File not found: ${resolved}`);
|
|
6946
6979
|
const dir = (0, import_node_path9.dirname)(resolved);
|
|
6947
|
-
if ((0,
|
|
6980
|
+
if ((0, import_node_fs7.existsSync)(dir)) {
|
|
6948
6981
|
const base = (0, import_node_path9.basename)(resolved);
|
|
6949
6982
|
try {
|
|
6950
|
-
const siblings = (0,
|
|
6983
|
+
const siblings = (0, import_node_fs7.readdirSync)(dir).filter(
|
|
6951
6984
|
(f) => f.includes(base.replace(/\.(play\.)?ts$/, "")) || f.endsWith(".play.ts")
|
|
6952
6985
|
);
|
|
6953
6986
|
if (siblings.length > 0) {
|
|
@@ -7106,7 +7139,7 @@ async function handleRunLogs(args) {
|
|
|
7106
7139
|
const status = await client.runs.get(runId);
|
|
7107
7140
|
const logs = status.progress?.logs ?? [];
|
|
7108
7141
|
if (outPath) {
|
|
7109
|
-
(0,
|
|
7142
|
+
(0, import_node_fs7.writeFileSync)(outPath, `${logs.join("\n")}${logs.length > 0 ? "\n" : ""}`);
|
|
7110
7143
|
if (argsWantJson(args)) {
|
|
7111
7144
|
process.stdout.write(
|
|
7112
7145
|
`${JSON.stringify({
|
|
@@ -7229,7 +7262,7 @@ async function handlePlayGet(args) {
|
|
|
7229
7262
|
outPath = (0, import_node_path9.resolve)(args[++index]);
|
|
7230
7263
|
}
|
|
7231
7264
|
}
|
|
7232
|
-
const playName = isFileTarget(target) ? extractPlayName((0,
|
|
7265
|
+
const playName = isFileTarget(target) ? extractPlayName((0, import_node_fs7.readFileSync)((0, import_node_path9.resolve)(target), "utf-8"), (0, import_node_path9.resolve)(target)) : parseReferencedPlayTarget(target).playName;
|
|
7233
7266
|
const detail = isFileTarget(target) ? await client.getPlay(playName) : await assertCanonicalNamedPlayReference(client, target);
|
|
7234
7267
|
const resolvedSource = detail.play.workingRevision?.sourceCode ?? detail.play.liveRevision?.sourceCode ?? detail.play.currentRevision?.sourceCode ?? detail.play.sourceCode ?? "";
|
|
7235
7268
|
const materializedFile = outPath ? materializeRemotePlaySource({
|
|
@@ -8015,12 +8048,12 @@ Examples:
|
|
|
8015
8048
|
}
|
|
8016
8049
|
|
|
8017
8050
|
// src/cli/commands/tools.ts
|
|
8018
|
-
var
|
|
8051
|
+
var import_node_fs9 = require("fs");
|
|
8019
8052
|
var import_node_os7 = require("os");
|
|
8020
8053
|
var import_node_path11 = require("path");
|
|
8021
8054
|
|
|
8022
8055
|
// src/tool-output.ts
|
|
8023
|
-
var
|
|
8056
|
+
var import_node_fs8 = require("fs");
|
|
8024
8057
|
var import_node_os6 = require("os");
|
|
8025
8058
|
var import_node_path10 = require("path");
|
|
8026
8059
|
function isPlainObject(value) {
|
|
@@ -8098,13 +8131,13 @@ function tryConvertToList(payload, options) {
|
|
|
8098
8131
|
}
|
|
8099
8132
|
function ensureOutputDir() {
|
|
8100
8133
|
const outputDir = (0, import_node_path10.join)((0, import_node_os6.homedir)(), ".local", "share", "deepline", "data");
|
|
8101
|
-
(0,
|
|
8134
|
+
(0, import_node_fs8.mkdirSync)(outputDir, { recursive: true });
|
|
8102
8135
|
return outputDir;
|
|
8103
8136
|
}
|
|
8104
8137
|
function writeJsonOutputFile(payload, stem) {
|
|
8105
8138
|
const outputDir = ensureOutputDir();
|
|
8106
8139
|
const outputPath = (0, import_node_path10.join)(outputDir, `${stem}_${Date.now()}.json`);
|
|
8107
|
-
(0,
|
|
8140
|
+
(0, import_node_fs8.writeFileSync)(outputPath, JSON.stringify(payload, null, 2), "utf-8");
|
|
8108
8141
|
return outputPath;
|
|
8109
8142
|
}
|
|
8110
8143
|
function writeCsvOutputFile(rows, stem) {
|
|
@@ -8132,7 +8165,7 @@ function writeCsvOutputFile(rows, stem) {
|
|
|
8132
8165
|
for (const row of rows) {
|
|
8133
8166
|
lines.push(columns.map((column) => escapeCell(row[column])).join(","));
|
|
8134
8167
|
}
|
|
8135
|
-
(0,
|
|
8168
|
+
(0, import_node_fs8.writeFileSync)(outputPath, `${lines.join("\n")}
|
|
8136
8169
|
`, "utf-8");
|
|
8137
8170
|
const previewRows = rows.slice(0, 5);
|
|
8138
8171
|
const previewColumns = columns.slice(0, 5);
|
|
@@ -8669,8 +8702,8 @@ function powerShellQuote(value) {
|
|
|
8669
8702
|
function seedToolListScript(input) {
|
|
8670
8703
|
const stem = safeFileStem(input.toolId);
|
|
8671
8704
|
const fileName = `${stem}-workflow-seed-${Date.now()}.play.ts`;
|
|
8672
|
-
const scriptDir = (0,
|
|
8673
|
-
(0,
|
|
8705
|
+
const scriptDir = (0, import_node_fs9.mkdtempSync)((0, import_node_path11.join)((0, import_node_os7.tmpdir)(), "deepline-workflow-seed-"));
|
|
8706
|
+
(0, import_node_fs9.chmodSync)(scriptDir, 448);
|
|
8674
8707
|
const scriptPath = (0, import_node_path11.join)(scriptDir, fileName);
|
|
8675
8708
|
const projectDir = `deepline/projects/${stem}-workflow`;
|
|
8676
8709
|
const playName = `${stem}-workflow`;
|
|
@@ -8704,7 +8737,7 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
|
|
|
8704
8737
|
};
|
|
8705
8738
|
});
|
|
8706
8739
|
`;
|
|
8707
|
-
(0,
|
|
8740
|
+
(0, import_node_fs9.writeFileSync)(scriptPath, script, { encoding: "utf-8", mode: 384 });
|
|
8708
8741
|
return {
|
|
8709
8742
|
path: scriptPath,
|
|
8710
8743
|
projectDir,
|
|
@@ -8812,7 +8845,7 @@ async function executeTool(args) {
|
|
|
8812
8845
|
|
|
8813
8846
|
// src/cli/skills-sync.ts
|
|
8814
8847
|
var import_node_child_process2 = require("child_process");
|
|
8815
|
-
var
|
|
8848
|
+
var import_node_fs10 = require("fs");
|
|
8816
8849
|
var import_node_os8 = require("os");
|
|
8817
8850
|
var import_node_path12 = require("path");
|
|
8818
8851
|
var CHECK_TIMEOUT_MS2 = 3e3;
|
|
@@ -8829,17 +8862,17 @@ function sdkSkillsVersionPath(baseUrl) {
|
|
|
8829
8862
|
}
|
|
8830
8863
|
function readLocalSkillsVersion(baseUrl) {
|
|
8831
8864
|
const path = sdkSkillsVersionPath(baseUrl);
|
|
8832
|
-
if (!(0,
|
|
8865
|
+
if (!(0, import_node_fs10.existsSync)(path)) return "";
|
|
8833
8866
|
try {
|
|
8834
|
-
return (0,
|
|
8867
|
+
return (0, import_node_fs10.readFileSync)(path, "utf-8").trim();
|
|
8835
8868
|
} catch {
|
|
8836
8869
|
return "";
|
|
8837
8870
|
}
|
|
8838
8871
|
}
|
|
8839
8872
|
function writeLocalSkillsVersion(baseUrl, version) {
|
|
8840
8873
|
const path = sdkSkillsVersionPath(baseUrl);
|
|
8841
|
-
(0,
|
|
8842
|
-
(0,
|
|
8874
|
+
(0, import_node_fs10.mkdirSync)((0, import_node_path12.dirname)(path), { recursive: true });
|
|
8875
|
+
(0, import_node_fs10.writeFileSync)(path, `${version}
|
|
8843
8876
|
`, "utf-8");
|
|
8844
8877
|
}
|
|
8845
8878
|
async function fetchSkillsUpdate(baseUrl, localVersion) {
|