deepline 0.1.129 → 0.1.130
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/bundling-sources/sdk/src/compat.ts +75 -14
- package/dist/bundling-sources/sdk/src/config.ts +13 -0
- package/dist/bundling-sources/sdk/src/http.ts +10 -3
- package/dist/bundling-sources/sdk/src/release.ts +2 -2
- package/dist/cli/index.js +228 -95
- package/dist/cli/index.mjs +224 -91
- package/dist/index.js +18 -4
- package/dist/index.mjs +18 -4
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -183,7 +183,7 @@ configureProxyFromEnv();
|
|
|
183
183
|
// src/cli/index.ts
|
|
184
184
|
var import_promises5 = require("fs/promises");
|
|
185
185
|
var import_node_path19 = require("path");
|
|
186
|
-
var
|
|
186
|
+
var import_node_os14 = require("os");
|
|
187
187
|
var import_commander3 = require("commander");
|
|
188
188
|
|
|
189
189
|
// src/config.ts
|
|
@@ -310,6 +310,15 @@ function sdkCliConfigDir(baseUrl) {
|
|
|
310
310
|
const home = process.env.HOME?.trim() || (0, import_node_os.homedir)();
|
|
311
311
|
return (0, import_node_path.join)(home, ".local", "deepline", baseUrlSlug(baseUrl || PROD_URL));
|
|
312
312
|
}
|
|
313
|
+
function sdkCliStateDirPath(baseUrl, homeDir2 = process.env.HOME?.trim() || (0, import_node_os.homedir)()) {
|
|
314
|
+
return (0, import_node_path.join)(
|
|
315
|
+
homeDir2,
|
|
316
|
+
".local",
|
|
317
|
+
"deepline",
|
|
318
|
+
baseUrlSlug(baseUrl || PROD_URL),
|
|
319
|
+
"sdk-cli"
|
|
320
|
+
);
|
|
321
|
+
}
|
|
313
322
|
function sdkCliEnvFilePath(baseUrl) {
|
|
314
323
|
return (0, import_node_path.join)(sdkCliConfigDir(baseUrl), ".env");
|
|
315
324
|
}
|
|
@@ -404,10 +413,10 @@ var SDK_RELEASE = {
|
|
|
404
413
|
// 0.1.108 ships explicit dataset column/tool recompute policy and removes
|
|
405
414
|
// the SDK enrich generator's one-second stale policy.
|
|
406
415
|
// 0.1.110 ships authored V2 prebuilts and required top-level play descriptions.
|
|
407
|
-
version: "0.1.
|
|
416
|
+
version: "0.1.130",
|
|
408
417
|
apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
|
|
409
418
|
supportPolicy: {
|
|
410
|
-
latest: "0.1.
|
|
419
|
+
latest: "0.1.130",
|
|
411
420
|
minimumSupported: "0.1.53",
|
|
412
421
|
deprecatedBelow: "0.1.53",
|
|
413
422
|
commandMinimumSupported: [
|
|
@@ -557,6 +566,10 @@ var HttpClient = class {
|
|
|
557
566
|
if (explicit) return explicit;
|
|
558
567
|
try {
|
|
559
568
|
const versionPath = (0, import_node_path2.join)(
|
|
569
|
+
sdkCliStateDirPath(this.config.baseUrl),
|
|
570
|
+
"skills-version"
|
|
571
|
+
);
|
|
572
|
+
const legacyVersionPath = (0, import_node_path2.join)(
|
|
560
573
|
process.env.HOME?.trim() || (0, import_node_os3.homedir)(),
|
|
561
574
|
".local",
|
|
562
575
|
"deepline",
|
|
@@ -564,8 +577,9 @@ var HttpClient = class {
|
|
|
564
577
|
"sdk-skills",
|
|
565
578
|
".version"
|
|
566
579
|
);
|
|
567
|
-
|
|
568
|
-
|
|
580
|
+
const resolvedPath = (0, import_node_fs2.existsSync)(versionPath) ? versionPath : legacyVersionPath;
|
|
581
|
+
if (!(0, import_node_fs2.existsSync)(resolvedPath)) return null;
|
|
582
|
+
return this.cleanDiagnosticHeader((0, import_node_fs2.readFileSync)(resolvedPath, "utf-8"));
|
|
569
583
|
} catch {
|
|
570
584
|
return null;
|
|
571
585
|
}
|
|
@@ -3666,15 +3680,27 @@ var import_node_fs3 = require("fs");
|
|
|
3666
3680
|
var import_node_os4 = require("os");
|
|
3667
3681
|
var import_node_path3 = require("path");
|
|
3668
3682
|
var CHECK_TIMEOUT_MS = 2e3;
|
|
3669
|
-
var
|
|
3683
|
+
var SDK_COMPATIBILITY_CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
3670
3684
|
function shouldSkipCompatibilityCheck() {
|
|
3671
3685
|
const value = process.env.DEEPLINE_SKIP_SDK_COMPAT_CHECK?.trim().toLowerCase();
|
|
3672
3686
|
return value === "1" || value === "true" || value === "yes";
|
|
3673
3687
|
}
|
|
3674
|
-
function
|
|
3675
|
-
return (0, import_node_path3.join)((
|
|
3688
|
+
function sdkCompatibilityCachePath(baseUrl, homeDir2 = (0, import_node_os4.homedir)()) {
|
|
3689
|
+
return (0, import_node_path3.join)(sdkCliStateDirPath(baseUrl, homeDir2), "compat-cache.json");
|
|
3690
|
+
}
|
|
3691
|
+
function legacySdkCompatibilityCachePath(homeDir2 = (0, import_node_os4.homedir)()) {
|
|
3692
|
+
return (0, import_node_path3.join)(homeDir2, ".cache", "deepline", "sdk-compat-cache.json");
|
|
3693
|
+
}
|
|
3694
|
+
function compatibilityCacheKey(baseUrl, command, skillsVersion) {
|
|
3695
|
+
return JSON.stringify({
|
|
3696
|
+
baseUrl: baseUrl.replace(/\/$/, ""),
|
|
3697
|
+
version: SDK_VERSION,
|
|
3698
|
+
apiContract: SDK_API_CONTRACT,
|
|
3699
|
+
command: command?.trim() || null,
|
|
3700
|
+
skillsVersion: skillsVersion ?? null
|
|
3701
|
+
});
|
|
3676
3702
|
}
|
|
3677
|
-
function
|
|
3703
|
+
function legacyCompatibilityCacheKey(baseUrl, command) {
|
|
3678
3704
|
return JSON.stringify({
|
|
3679
3705
|
baseUrl: baseUrl.replace(/\/$/, ""),
|
|
3680
3706
|
version: SDK_VERSION,
|
|
@@ -3682,15 +3708,20 @@ function compatibilityCacheKey(baseUrl, command) {
|
|
|
3682
3708
|
command: command?.trim() || null
|
|
3683
3709
|
});
|
|
3684
3710
|
}
|
|
3685
|
-
function readCachedCompatibility(baseUrl, command) {
|
|
3711
|
+
function readCachedCompatibility(baseUrl, command, skillsVersion) {
|
|
3686
3712
|
try {
|
|
3687
|
-
const path =
|
|
3688
|
-
|
|
3713
|
+
const path = sdkCompatibilityCachePath(baseUrl);
|
|
3714
|
+
const legacyPath = legacySdkCompatibilityCachePath();
|
|
3715
|
+
const useLegacyCache = !(0, import_node_fs3.existsSync)(path) && (0, import_node_fs3.existsSync)(legacyPath);
|
|
3716
|
+
const cachePath = useLegacyCache ? legacyPath : path;
|
|
3717
|
+
if (!(0, import_node_fs3.existsSync)(cachePath)) {
|
|
3689
3718
|
return null;
|
|
3690
3719
|
}
|
|
3691
|
-
const parsed = JSON.parse(
|
|
3692
|
-
|
|
3693
|
-
|
|
3720
|
+
const parsed = JSON.parse(
|
|
3721
|
+
(0, import_node_fs3.readFileSync)(cachePath, "utf8")
|
|
3722
|
+
);
|
|
3723
|
+
const entry = parsed.entries?.[compatibilityCacheKey(baseUrl, command, skillsVersion)] ?? (useLegacyCache ? parsed.entries?.[legacyCompatibilityCacheKey(baseUrl, command)] : void 0);
|
|
3724
|
+
if (!entry || Date.now() - entry.savedAt > SDK_COMPATIBILITY_CACHE_TTL_MS) {
|
|
3694
3725
|
return null;
|
|
3695
3726
|
}
|
|
3696
3727
|
return entry.response;
|
|
@@ -3698,12 +3729,12 @@ function readCachedCompatibility(baseUrl, command) {
|
|
|
3698
3729
|
return null;
|
|
3699
3730
|
}
|
|
3700
3731
|
}
|
|
3701
|
-
function writeCachedCompatibility(baseUrl, command, response) {
|
|
3732
|
+
function writeCachedCompatibility(baseUrl, command, skillsVersion, response) {
|
|
3702
3733
|
try {
|
|
3703
|
-
const path =
|
|
3734
|
+
const path = sdkCompatibilityCachePath(baseUrl);
|
|
3704
3735
|
const existing = (0, import_node_fs3.existsSync)(path) ? JSON.parse((0, import_node_fs3.readFileSync)(path, "utf8")) : {};
|
|
3705
3736
|
const entries = existing.entries ?? {};
|
|
3706
|
-
entries[compatibilityCacheKey(baseUrl, command)] = {
|
|
3737
|
+
entries[compatibilityCacheKey(baseUrl, command, skillsVersion)] = {
|
|
3707
3738
|
savedAt: Date.now(),
|
|
3708
3739
|
response
|
|
3709
3740
|
};
|
|
@@ -3725,6 +3756,9 @@ async function checkSdkCompatibility(baseUrl, options = {}) {
|
|
|
3725
3756
|
if (options.command?.trim()) {
|
|
3726
3757
|
url.searchParams.set("command", options.command.trim());
|
|
3727
3758
|
}
|
|
3759
|
+
if (options.skillsVersion !== void 0) {
|
|
3760
|
+
url.searchParams.set("skills_version", options.skillsVersion ?? "");
|
|
3761
|
+
}
|
|
3728
3762
|
const response = await fetch(url, {
|
|
3729
3763
|
method: "GET",
|
|
3730
3764
|
headers: {
|
|
@@ -3736,12 +3770,21 @@ async function checkSdkCompatibility(baseUrl, options = {}) {
|
|
|
3736
3770
|
});
|
|
3737
3771
|
const data = await response.json().catch(() => null);
|
|
3738
3772
|
if (data) {
|
|
3739
|
-
writeCachedCompatibility(
|
|
3773
|
+
writeCachedCompatibility(
|
|
3774
|
+
baseUrl,
|
|
3775
|
+
options.command,
|
|
3776
|
+
options.skillsVersion,
|
|
3777
|
+
data
|
|
3778
|
+
);
|
|
3740
3779
|
}
|
|
3741
3780
|
return { response: data, error: null };
|
|
3742
3781
|
} catch (error) {
|
|
3743
|
-
const cached = readCachedCompatibility(
|
|
3744
|
-
|
|
3782
|
+
const cached = readCachedCompatibility(
|
|
3783
|
+
baseUrl,
|
|
3784
|
+
options.command,
|
|
3785
|
+
options.skillsVersion
|
|
3786
|
+
);
|
|
3787
|
+
if (cached) {
|
|
3745
3788
|
return { response: cached, error: null };
|
|
3746
3789
|
}
|
|
3747
3790
|
return {
|
|
@@ -3771,6 +3814,7 @@ var import_node_os6 = require("os");
|
|
|
3771
3814
|
var import_node_path5 = require("path");
|
|
3772
3815
|
|
|
3773
3816
|
// src/cli/utils.ts
|
|
3817
|
+
var import_node_crypto = require("crypto");
|
|
3774
3818
|
var import_node_fs4 = require("fs");
|
|
3775
3819
|
var import_promises = require("fs/promises");
|
|
3776
3820
|
var import_node_os5 = require("os");
|
|
@@ -3779,6 +3823,7 @@ var childProcess = __toESM(require("child_process"));
|
|
|
3779
3823
|
var import_sync = require("csv-parse/sync");
|
|
3780
3824
|
var import_sync2 = require("csv-stringify/sync");
|
|
3781
3825
|
var BROWSER_OPEN_COOLDOWN_MS = 3e4;
|
|
3826
|
+
var SAME_URL_BROWSER_OPEN_COOLDOWN_MS = 5 * 6e4;
|
|
3782
3827
|
var defaultBrowserCommandRunner = childProcess;
|
|
3783
3828
|
function getAuthedHttpClient() {
|
|
3784
3829
|
const config = resolveConfig();
|
|
@@ -3791,25 +3836,37 @@ async function writeOutputFile(filename, content) {
|
|
|
3791
3836
|
await (0, import_promises.writeFile)(fullPath, content, "utf-8");
|
|
3792
3837
|
return fullPath;
|
|
3793
3838
|
}
|
|
3794
|
-
function
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3839
|
+
function stableOsUserId() {
|
|
3840
|
+
try {
|
|
3841
|
+
const info = (0, import_node_os5.userInfo)();
|
|
3842
|
+
if (typeof info.uid === "number") return `uid-${info.uid}`;
|
|
3843
|
+
if (info.username) return `user-${info.username}`;
|
|
3844
|
+
} catch {
|
|
3845
|
+
}
|
|
3846
|
+
return "unknown-user";
|
|
3847
|
+
}
|
|
3848
|
+
function defaultBrowserOpenStateDir() {
|
|
3849
|
+
return (0, import_node_path4.join)((0, import_node_os5.tmpdir)(), `deepline-${stableOsUserId()}`, "runtime", "state");
|
|
3804
3850
|
}
|
|
3805
|
-
function
|
|
3806
|
-
|
|
3851
|
+
function browserOpenStateFile(stateDir = defaultBrowserOpenStateDir()) {
|
|
3852
|
+
return (0, import_node_path4.join)(stateDir, "browser-open.json");
|
|
3853
|
+
}
|
|
3854
|
+
function normalizeBrowserOpenTarget(raw) {
|
|
3855
|
+
return String(raw || "").trim();
|
|
3856
|
+
}
|
|
3857
|
+
function browserOpenTargetKey(raw) {
|
|
3858
|
+
const normalized = normalizeBrowserOpenTarget(raw);
|
|
3859
|
+
return normalized ? (0, import_node_crypto.createHash)("sha256").update(normalized).digest("hex") : "";
|
|
3860
|
+
}
|
|
3861
|
+
function claimBrowserOpen(now = Date.now(), stateDir, targetUrl) {
|
|
3862
|
+
const statePath = browserOpenStateFile(stateDir);
|
|
3807
3863
|
const lockPath = `${statePath}.lock`;
|
|
3864
|
+
const targetKey = browserOpenTargetKey(targetUrl);
|
|
3808
3865
|
let locked = false;
|
|
3809
3866
|
try {
|
|
3810
|
-
(0, import_node_fs4.mkdirSync)((0, import_node_path4.dirname)(statePath), { recursive: true });
|
|
3867
|
+
(0, import_node_fs4.mkdirSync)((0, import_node_path4.dirname)(statePath), { recursive: true, mode: 448 });
|
|
3811
3868
|
try {
|
|
3812
|
-
(0, import_node_fs4.mkdirSync)(lockPath);
|
|
3869
|
+
(0, import_node_fs4.mkdirSync)(lockPath, { mode: 448 });
|
|
3813
3870
|
locked = true;
|
|
3814
3871
|
} catch {
|
|
3815
3872
|
return false;
|
|
@@ -3821,14 +3878,24 @@ function claimBrowserOpen(now = Date.now()) {
|
|
|
3821
3878
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
3822
3879
|
lastOpenedAt = value;
|
|
3823
3880
|
}
|
|
3881
|
+
const targetValue = payload.targetKey ?? payload.target_key ?? payload.targetHash ?? payload.target_hash;
|
|
3882
|
+
const lastTargetKey = typeof targetValue === "string" ? targetValue.trim() : "";
|
|
3883
|
+
const cooldownMs = targetKey && targetKey === lastTargetKey ? SAME_URL_BROWSER_OPEN_COOLDOWN_MS : BROWSER_OPEN_COOLDOWN_MS;
|
|
3884
|
+
if (lastOpenedAt > now) {
|
|
3885
|
+
lastOpenedAt = 0;
|
|
3886
|
+
}
|
|
3887
|
+
if (now - lastOpenedAt < cooldownMs) {
|
|
3888
|
+
return false;
|
|
3889
|
+
}
|
|
3824
3890
|
}
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3891
|
+
(0, import_node_fs4.writeFileSync)(
|
|
3892
|
+
statePath,
|
|
3893
|
+
JSON.stringify({
|
|
3894
|
+
lastOpenedAt: now,
|
|
3895
|
+
...targetKey ? { targetKey } : {}
|
|
3896
|
+
}),
|
|
3897
|
+
{ encoding: "utf-8", mode: 384 }
|
|
3898
|
+
);
|
|
3832
3899
|
return true;
|
|
3833
3900
|
} catch {
|
|
3834
3901
|
return true;
|
|
@@ -3860,6 +3927,30 @@ function browserAppNameFromBundleId(bundleId) {
|
|
|
3860
3927
|
};
|
|
3861
3928
|
return names[bundleId.toLowerCase()] ?? "";
|
|
3862
3929
|
}
|
|
3930
|
+
function currentOsUsername() {
|
|
3931
|
+
try {
|
|
3932
|
+
return (0, import_node_os5.userInfo)().username || "";
|
|
3933
|
+
} catch {
|
|
3934
|
+
return "";
|
|
3935
|
+
}
|
|
3936
|
+
}
|
|
3937
|
+
function readMacosUserHome(runner = defaultBrowserCommandRunner) {
|
|
3938
|
+
const username = currentOsUsername();
|
|
3939
|
+
if (process.platform === "darwin" && username) {
|
|
3940
|
+
try {
|
|
3941
|
+
const output2 = runner.execFileSync(
|
|
3942
|
+
"dscl",
|
|
3943
|
+
[".", "-read", `/Users/${username}`, "NFSHomeDirectory"],
|
|
3944
|
+
{ encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }
|
|
3945
|
+
);
|
|
3946
|
+
const match = String(output2).match(/NFSHomeDirectory:\s*(.+)\s*$/m);
|
|
3947
|
+
const home = match?.[1]?.trim();
|
|
3948
|
+
if (home) return home;
|
|
3949
|
+
} catch {
|
|
3950
|
+
}
|
|
3951
|
+
}
|
|
3952
|
+
return (0, import_node_os5.homedir)();
|
|
3953
|
+
}
|
|
3863
3954
|
function readDefaultMacBrowserBundleId(runner = defaultBrowserCommandRunner) {
|
|
3864
3955
|
try {
|
|
3865
3956
|
const output2 = runner.execFileSync(
|
|
@@ -3869,7 +3960,7 @@ function readDefaultMacBrowserBundleId(runner = defaultBrowserCommandRunner) {
|
|
|
3869
3960
|
"json",
|
|
3870
3961
|
"-o",
|
|
3871
3962
|
"-",
|
|
3872
|
-
`${(
|
|
3963
|
+
`${readMacosUserHome(runner)}/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist`
|
|
3873
3964
|
],
|
|
3874
3965
|
{ encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }
|
|
3875
3966
|
);
|
|
@@ -4016,7 +4107,7 @@ function openInBrowser(url) {
|
|
|
4016
4107
|
if (browserOpeningDisabled()) return;
|
|
4017
4108
|
const targetUrl = String(url || "").trim();
|
|
4018
4109
|
if (!targetUrl) return;
|
|
4019
|
-
if (!claimBrowserOpen()) return;
|
|
4110
|
+
if (!claimBrowserOpen(Date.now(), void 0, targetUrl)) return;
|
|
4020
4111
|
const allowFocus = true;
|
|
4021
4112
|
if (process.platform === "darwin") {
|
|
4022
4113
|
openUrlMacos(targetUrl, allowFocus);
|
|
@@ -6861,7 +6952,7 @@ var import_node_os7 = require("os");
|
|
|
6861
6952
|
var import_node_path11 = require("path");
|
|
6862
6953
|
|
|
6863
6954
|
// src/cli/commands/play.ts
|
|
6864
|
-
var
|
|
6955
|
+
var import_node_crypto2 = require("crypto");
|
|
6865
6956
|
var import_node_fs9 = require("fs");
|
|
6866
6957
|
var import_node_path10 = require("path");
|
|
6867
6958
|
var import_sync5 = require("csv-parse/sync");
|
|
@@ -9479,7 +9570,7 @@ function stageFile(logicalPath, absolutePath) {
|
|
|
9479
9570
|
return {
|
|
9480
9571
|
logicalPath,
|
|
9481
9572
|
contentBase64: buffer.toString("base64"),
|
|
9482
|
-
contentHash: (0,
|
|
9573
|
+
contentHash: (0, import_node_crypto2.createHash)("sha256").update(buffer).digest("hex"),
|
|
9483
9574
|
contentType: absolutePath.toLowerCase().endsWith(".csv") ? "text/csv" : absolutePath.toLowerCase().endsWith(".json") ? "application/json" : "application/octet-stream",
|
|
9484
9575
|
bytes: buffer.byteLength
|
|
9485
9576
|
};
|
|
@@ -14834,9 +14925,7 @@ function renderExecuteStep(command, options = {
|
|
|
14834
14925
|
const extractJs = command.extract_js ? `({ row, result, data, raw, pick, extract, extractList, target, get }) => { const input = row; const context = row;
|
|
14835
14926
|
${indent(renderJavascriptBody(command.extract_js), 6)}
|
|
14836
14927
|
}` : "null";
|
|
14837
|
-
const runIfJs =
|
|
14838
|
-
${indent(renderJavascriptBody(command.run_if_js), 6)}
|
|
14839
|
-
}` : "null";
|
|
14928
|
+
const runIfJs = options.nativeRunIf ? "null" : renderRunIfFunction(command) ?? "null";
|
|
14840
14929
|
const description = command.description ? `,
|
|
14841
14930
|
description: ${stringLiteral(command.description)}` : "";
|
|
14842
14931
|
const force = options.force ? `,
|
|
@@ -14861,13 +14950,35 @@ ${indent(renderJavascriptBody(command.run_if_js), 6)}
|
|
|
14861
14950
|
`}`
|
|
14862
14951
|
].join("\n");
|
|
14863
14952
|
}
|
|
14953
|
+
function renderRunIfFunction(command) {
|
|
14954
|
+
return command.run_if_js ? `(row) => { const input = row; const context = row;
|
|
14955
|
+
${indent(renderJavascriptBody(command.run_if_js), 6)}
|
|
14956
|
+
}` : null;
|
|
14957
|
+
}
|
|
14958
|
+
function renderColumnRunIfFunction(command) {
|
|
14959
|
+
if (!command.run_if_js) {
|
|
14960
|
+
return null;
|
|
14961
|
+
}
|
|
14962
|
+
if (command.play) {
|
|
14963
|
+
return `(__dlRawRow) => { const row = __dlPrepareEnrichRow(__dlRawRow, [${stringLiteral(command.alias)}]); const input = row; const context = row;
|
|
14964
|
+
${indent(renderJavascriptBody(command.run_if_js), 6)}
|
|
14965
|
+
}`;
|
|
14966
|
+
}
|
|
14967
|
+
return renderRunIfFunction(command);
|
|
14968
|
+
}
|
|
14969
|
+
function renderCombinedRunIfFunction(precheck, runIfSource) {
|
|
14970
|
+
if (!runIfSource) {
|
|
14971
|
+
return null;
|
|
14972
|
+
}
|
|
14973
|
+
return precheck ? `(row) => { if (${precheck}) return false; return (${runIfSource})(row); }` : runIfSource;
|
|
14974
|
+
}
|
|
14864
14975
|
function renderIdiomaticExecuteStep(command, options) {
|
|
14865
14976
|
const callId = stringLiteral(commandCallId(command));
|
|
14866
14977
|
const tool = stringLiteral(command.tool);
|
|
14867
14978
|
const input2 = renderToolPayloadExpression(command.payload ?? {});
|
|
14868
14979
|
const getter = getterFromLegacyExtractJs(command.extract_js, command.alias);
|
|
14869
14980
|
const extraction = getter ? `${renderExtractedValueGetterExpression("result", getter)} ?? null` : "result";
|
|
14870
|
-
const runIfLines = command.run_if_js ? [
|
|
14981
|
+
const runIfLines = command.run_if_js && !options.nativeRunIf ? [
|
|
14871
14982
|
` if (`,
|
|
14872
14983
|
` !((row: Record<string, any>) => {`,
|
|
14873
14984
|
` const input = row;`,
|
|
@@ -14901,10 +15012,8 @@ function renderPlayStep(command, options) {
|
|
|
14901
15012
|
const callId = stringLiteral(commandCallId(command));
|
|
14902
15013
|
const playRef = stringLiteral(command.play?.ref ?? command.tool);
|
|
14903
15014
|
const payload = stableJson(command.payload ?? {});
|
|
14904
|
-
const runIfJs = command
|
|
14905
|
-
|
|
14906
|
-
}` : "null";
|
|
14907
|
-
const runIfLines = command.run_if_js ? [
|
|
15015
|
+
const runIfJs = renderRunIfFunction(command) ?? "null";
|
|
15016
|
+
const runIfLines = command.run_if_js && !options.nativeRunIf ? [
|
|
14908
15017
|
` const __dlRunIf = ${runIfJs};`,
|
|
14909
15018
|
` if (!__dlRunIf(templateRow)) return null;`
|
|
14910
15019
|
] : [];
|
|
@@ -14928,7 +15037,7 @@ ${indent(renderJavascriptBody(command.run_if_js), 6)}
|
|
|
14928
15037
|
}
|
|
14929
15038
|
function renderInlineJavascriptStep(command, options) {
|
|
14930
15039
|
const code = typeof command.payload?.code === "string" ? command.payload.code : "return null;";
|
|
14931
|
-
const runIfLines = command.run_if_js ? [
|
|
15040
|
+
const runIfLines = command.run_if_js && !options.nativeRunIf ? [
|
|
14932
15041
|
` if (!((row: Record<string, any>) => { const input = row; const context = row;`,
|
|
14933
15042
|
indent(renderJavascriptBody(command.run_if_js), 4),
|
|
14934
15043
|
` })(row as Record<string, any>)) return null;`
|
|
@@ -14958,7 +15067,8 @@ function renderColumnStep(alias, resolverSource, options = {}) {
|
|
|
14958
15067
|
const resolver = indent(resolverSource, 8);
|
|
14959
15068
|
const optionFields = [
|
|
14960
15069
|
...options.recompute === true ? ["recompute: true"] : [],
|
|
14961
|
-
...options.recomputeOnError === true ? ["recomputeOnError: true"] : []
|
|
15070
|
+
...options.recomputeOnError === true ? ["recomputeOnError: true"] : [],
|
|
15071
|
+
...options.runIfSource ? [`runIf: ${options.runIfSource}`] : []
|
|
14962
15072
|
];
|
|
14963
15073
|
const optionSource = optionFields.length > 0 ? `{ ${optionFields.join(", ")} }` : null;
|
|
14964
15074
|
return [
|
|
@@ -15062,17 +15172,27 @@ function renderWaterfallColumns(command, forceAliases, inlineRunJavascript, idio
|
|
|
15062
15172
|
}
|
|
15063
15173
|
const priorAliases = activeChildren.slice(0, stepIndex).map((prior) => prior.alias);
|
|
15064
15174
|
const force = forceAliases.has(normalizeAlias(nested.alias));
|
|
15175
|
+
const precheck = priorAliases.length > 0 ? `__dlWaterfallSatisfied(row, ${stableJson(priorAliases)}, ${minResults})` : void 0;
|
|
15176
|
+
const runIfSource = renderCombinedRunIfFunction(
|
|
15177
|
+
precheck,
|
|
15178
|
+
renderColumnRunIfFunction(nested)
|
|
15179
|
+
);
|
|
15065
15180
|
return renderColumnStep(
|
|
15066
15181
|
nested.alias,
|
|
15067
15182
|
renderExecuteStep(nested, {
|
|
15068
15183
|
force,
|
|
15069
|
-
precheck
|
|
15184
|
+
precheck,
|
|
15070
15185
|
legacyEnvelope: Boolean(nested.extract_js),
|
|
15071
15186
|
inlineRunJavascript,
|
|
15072
15187
|
idiomaticGetters,
|
|
15073
|
-
waterfallSoftFail: true
|
|
15188
|
+
waterfallSoftFail: true,
|
|
15189
|
+
nativeRunIf: Boolean(runIfSource)
|
|
15074
15190
|
}),
|
|
15075
|
-
{
|
|
15191
|
+
{
|
|
15192
|
+
recompute: force,
|
|
15193
|
+
recomputeOnError: true,
|
|
15194
|
+
runIfSource
|
|
15195
|
+
}
|
|
15076
15196
|
);
|
|
15077
15197
|
}).filter((line) => line !== null);
|
|
15078
15198
|
const aliases = activeChildren.map((nested) => nested.alias);
|
|
@@ -15123,15 +15243,21 @@ function compileEnrichConfigToPlaySource(config, options = {}) {
|
|
|
15123
15243
|
return;
|
|
15124
15244
|
}
|
|
15125
15245
|
const force = forceAliases.has(normalizeAlias(command.alias));
|
|
15246
|
+
const runIfSource = renderColumnRunIfFunction(command);
|
|
15126
15247
|
columnSteps.push(
|
|
15127
15248
|
renderColumnStep(
|
|
15128
15249
|
command.alias,
|
|
15129
15250
|
renderExecuteStep(command, {
|
|
15130
15251
|
force,
|
|
15131
15252
|
inlineRunJavascript,
|
|
15132
|
-
idiomaticGetters
|
|
15253
|
+
idiomaticGetters,
|
|
15254
|
+
nativeRunIf: Boolean(runIfSource)
|
|
15133
15255
|
}),
|
|
15134
|
-
{
|
|
15256
|
+
{
|
|
15257
|
+
recompute: force,
|
|
15258
|
+
recomputeOnError: true,
|
|
15259
|
+
runIfSource
|
|
15260
|
+
}
|
|
15135
15261
|
)
|
|
15136
15262
|
);
|
|
15137
15263
|
});
|
|
@@ -17490,7 +17616,7 @@ var import_node_fs10 = require("fs");
|
|
|
17490
17616
|
var import_node_os8 = require("os");
|
|
17491
17617
|
var import_node_path12 = require("path");
|
|
17492
17618
|
var import_node_zlib = require("zlib");
|
|
17493
|
-
var
|
|
17619
|
+
var import_node_crypto3 = require("crypto");
|
|
17494
17620
|
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
17495
17621
|
var UUID_IN_TEXT_RE = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i;
|
|
17496
17622
|
var MAX_SESSION_UPLOAD_BYTES = 35e5;
|
|
@@ -17852,7 +17978,7 @@ async function uploadPayload(path, payload) {
|
|
|
17852
17978
|
return await http.post(path, payload);
|
|
17853
17979
|
}
|
|
17854
17980
|
async function uploadChunkedSessions(sessions, options) {
|
|
17855
|
-
const uploadId = (0,
|
|
17981
|
+
const uploadId = (0, import_node_crypto3.randomUUID)();
|
|
17856
17982
|
for (const session of sessions) {
|
|
17857
17983
|
const bytes = Buffer.from(session.encodedContent, "base64");
|
|
17858
17984
|
const chunks = [];
|
|
@@ -18497,7 +18623,7 @@ Examples:
|
|
|
18497
18623
|
|
|
18498
18624
|
// src/cli/commands/quickstart.ts
|
|
18499
18625
|
var import_node_child_process = require("child_process");
|
|
18500
|
-
var
|
|
18626
|
+
var import_node_crypto4 = require("crypto");
|
|
18501
18627
|
var import_node_http = require("http");
|
|
18502
18628
|
var EXIT_OK2 = 0;
|
|
18503
18629
|
var EXIT_AUTH2 = 1;
|
|
@@ -18626,7 +18752,7 @@ async function handleQuickstart(options) {
|
|
|
18626
18752
|
return EXIT_AUTH2;
|
|
18627
18753
|
}
|
|
18628
18754
|
}
|
|
18629
|
-
const state = (0,
|
|
18755
|
+
const state = (0, import_node_crypto4.randomBytes)(32).toString("hex");
|
|
18630
18756
|
let resolveSelection;
|
|
18631
18757
|
const selectionPromise = new Promise((resolve13) => {
|
|
18632
18758
|
resolveSelection = resolve13;
|
|
@@ -20726,7 +20852,7 @@ var import_promises4 = require("fs/promises");
|
|
|
20726
20852
|
var import_node_path16 = require("path");
|
|
20727
20853
|
|
|
20728
20854
|
// src/cli/workflow-to-play.ts
|
|
20729
|
-
var
|
|
20855
|
+
var import_node_crypto5 = require("crypto");
|
|
20730
20856
|
|
|
20731
20857
|
// ../shared_libs/plays/secret-guardrails.ts
|
|
20732
20858
|
var SECRET_ENV_PATTERN = /\bprocess(?:\.env|\[['"]env['"]\])(?:\.|\[['"])([A-Z0-9_]*(?:API[_-]?KEY|TOKEN|SECRET|PASSWORD|PRIVATE[_-]?KEY|ACCESS[_-]?KEY)[A-Z0-9_]*)(?:['"]\])?/g;
|
|
@@ -20869,7 +20995,7 @@ function sanitizePlayNameSegment(value) {
|
|
|
20869
20995
|
}
|
|
20870
20996
|
function deriveWorkflowPlayName(workflowName) {
|
|
20871
20997
|
const base = sanitizePlayNameSegment(workflowName) || "workflow";
|
|
20872
|
-
const suffix = (0,
|
|
20998
|
+
const suffix = (0, import_node_crypto5.createHash)("sha256").update(workflowName).digest("hex").slice(0, 8);
|
|
20873
20999
|
const reserved = suffix.length + 1;
|
|
20874
21000
|
const allowedBase = Math.max(1, MAX_PLAY_NAME_LENGTH - reserved);
|
|
20875
21001
|
let name = `${base.slice(0, allowedBase)}_${suffix}`;
|
|
@@ -21250,13 +21376,12 @@ Notes:
|
|
|
21250
21376
|
// src/cli/commands/update.ts
|
|
21251
21377
|
var import_node_child_process3 = require("child_process");
|
|
21252
21378
|
var import_node_fs15 = require("fs");
|
|
21253
|
-
var
|
|
21379
|
+
var import_node_os12 = require("os");
|
|
21254
21380
|
var import_node_path18 = require("path");
|
|
21255
21381
|
|
|
21256
21382
|
// src/cli/skills-sync.ts
|
|
21257
21383
|
var import_node_child_process2 = require("child_process");
|
|
21258
21384
|
var import_node_fs14 = require("fs");
|
|
21259
|
-
var import_node_os12 = require("os");
|
|
21260
21385
|
var import_node_path17 = require("path");
|
|
21261
21386
|
|
|
21262
21387
|
// ../shared_libs/cli/install-commands.json
|
|
@@ -21388,20 +21513,15 @@ function readPluginSkillsVersion() {
|
|
|
21388
21513
|
}
|
|
21389
21514
|
}
|
|
21390
21515
|
function sdkSkillsVersionPath(baseUrl) {
|
|
21391
|
-
|
|
21392
|
-
|
|
21393
|
-
|
|
21394
|
-
|
|
21395
|
-
"deepline",
|
|
21396
|
-
baseUrlSlug(baseUrl),
|
|
21397
|
-
"sdk-skills",
|
|
21398
|
-
".version"
|
|
21399
|
-
);
|
|
21516
|
+
return (0, import_node_path17.join)(sdkCliStateDirPath(baseUrl), "skills-version");
|
|
21517
|
+
}
|
|
21518
|
+
function legacySdkSkillsVersionPath(baseUrl) {
|
|
21519
|
+
return (0, import_node_path17.join)((0, import_node_path17.dirname)(sdkCliStateDirPath(baseUrl)), "sdk-skills", ".version");
|
|
21400
21520
|
}
|
|
21401
|
-
function
|
|
21521
|
+
function readSdkSkillsLocalVersion(baseUrl) {
|
|
21402
21522
|
const pluginVersion = readPluginSkillsVersion();
|
|
21403
21523
|
if (pluginVersion) return pluginVersion;
|
|
21404
|
-
const path = sdkSkillsVersionPath(baseUrl);
|
|
21524
|
+
const path = (0, import_node_fs14.existsSync)(sdkSkillsVersionPath(baseUrl)) ? sdkSkillsVersionPath(baseUrl) : legacySdkSkillsVersionPath(baseUrl);
|
|
21405
21525
|
if (!(0, import_node_fs14.existsSync)(path)) return "";
|
|
21406
21526
|
try {
|
|
21407
21527
|
return (0, import_node_fs14.readFileSync)(path, "utf-8").trim();
|
|
@@ -21611,15 +21731,18 @@ function writeSdkSkillsStatusLine(line) {
|
|
|
21611
21731
|
process.stderr.write(`${line}
|
|
21612
21732
|
`);
|
|
21613
21733
|
}
|
|
21614
|
-
async function syncSdkSkillsIfNeeded(baseUrl) {
|
|
21734
|
+
async function syncSdkSkillsIfNeeded(baseUrl, options = {}) {
|
|
21615
21735
|
if (attemptedSync || shouldSkipSkillsSync()) return;
|
|
21616
21736
|
attemptedSync = true;
|
|
21617
21737
|
const usingPluginSkills = Boolean(activePluginSkillsDir());
|
|
21618
|
-
const localVersion = readLocalSkillsVersion(baseUrl);
|
|
21619
|
-
const update = await fetchSkillsUpdate(baseUrl, localVersion);
|
|
21620
21738
|
if (usingPluginSkills) {
|
|
21621
21739
|
return;
|
|
21622
21740
|
}
|
|
21741
|
+
const localVersion = readSdkSkillsLocalVersion(baseUrl);
|
|
21742
|
+
const update = options.update === void 0 ? await fetchSkillsUpdate(baseUrl, localVersion) : options.update ? {
|
|
21743
|
+
needsUpdate: options.update.needs_update,
|
|
21744
|
+
remoteVersion: options.update.remote.version
|
|
21745
|
+
} : null;
|
|
21623
21746
|
if (!update?.needsUpdate || !update.remoteVersion) {
|
|
21624
21747
|
return;
|
|
21625
21748
|
}
|
|
@@ -21737,7 +21860,7 @@ function inferNpmGlobalPrefixFromEntrypoint(entrypoint) {
|
|
|
21737
21860
|
}
|
|
21738
21861
|
function resolveUpdatePlan(options = {}) {
|
|
21739
21862
|
const env = options.env ?? process.env;
|
|
21740
|
-
const homeDir2 = options.homeDir ?? (0,
|
|
21863
|
+
const homeDir2 = options.homeDir ?? (0, import_node_os12.homedir)();
|
|
21741
21864
|
const entrypoint = options.entrypoint ?? (process.argv[1] ? (0, import_node_path18.resolve)(process.argv[1]) : "");
|
|
21742
21865
|
const sourceRoot = entrypoint ? findRepoBackedSdkRoot((0, import_node_path18.dirname)(entrypoint)) : null;
|
|
21743
21866
|
if (sourceRoot) {
|
|
@@ -21773,7 +21896,7 @@ function autoUpdateFailurePath(plan) {
|
|
|
21773
21896
|
return (0, import_node_path18.join)(plan.stateDir, AUTO_UPDATE_FAILURE_FILE);
|
|
21774
21897
|
}
|
|
21775
21898
|
return (0, import_node_path18.join)(
|
|
21776
|
-
(0,
|
|
21899
|
+
(0, import_node_os12.homedir)(),
|
|
21777
21900
|
".local",
|
|
21778
21901
|
"deepline",
|
|
21779
21902
|
"sdk-cli",
|
|
@@ -22273,7 +22396,7 @@ async function maybeAutoUpdateAndRelaunch(response) {
|
|
|
22273
22396
|
}
|
|
22274
22397
|
|
|
22275
22398
|
// src/cli/failure-reporting.ts
|
|
22276
|
-
var
|
|
22399
|
+
var import_node_os13 = require("os");
|
|
22277
22400
|
var FAILURE_REPORT_DISABLE_ENV = "DEEPLINE_DISABLE_FAILURE_REPORTING";
|
|
22278
22401
|
var REPORT_FAILURE_TIMEOUT_MS = 1e4;
|
|
22279
22402
|
var MAX_FAILURE_TEXT_CHARS = 4e3;
|
|
@@ -22375,12 +22498,12 @@ function isNetworkFailure(error) {
|
|
|
22375
22498
|
}
|
|
22376
22499
|
function buildEnvironmentContext() {
|
|
22377
22500
|
const context = {
|
|
22378
|
-
os: (0,
|
|
22379
|
-
os_release: (0,
|
|
22380
|
-
platform: `${(0,
|
|
22501
|
+
os: (0, import_node_os13.platform)(),
|
|
22502
|
+
os_release: (0, import_node_os13.release)(),
|
|
22503
|
+
platform: `${(0, import_node_os13.platform)()}-${(0, import_node_os13.release)()}-${process.arch}`,
|
|
22381
22504
|
node_version: process.version,
|
|
22382
22505
|
runtime: "Node.js",
|
|
22383
|
-
hostname: (0,
|
|
22506
|
+
hostname: (0, import_node_os13.hostname)(),
|
|
22384
22507
|
agent_runtime: detectAgentRuntime()
|
|
22385
22508
|
};
|
|
22386
22509
|
for (const key of ["CLAUDE_CODE_REMOTE", "DEEPLINE_PLUGIN_MODE"]) {
|
|
@@ -22570,7 +22693,7 @@ function topLevelCommandKnown(program, commandName) {
|
|
|
22570
22693
|
);
|
|
22571
22694
|
}
|
|
22572
22695
|
async function runPlayRunnerHealthCheck() {
|
|
22573
|
-
const dir = await (0, import_promises5.mkdtemp)((0, import_node_path19.join)((0,
|
|
22696
|
+
const dir = await (0, import_promises5.mkdtemp)((0, import_node_path19.join)((0, import_node_os14.tmpdir)(), "deepline-health-play-"));
|
|
22574
22697
|
const file = (0, import_node_path19.join)(dir, "health-check.play.ts");
|
|
22575
22698
|
try {
|
|
22576
22699
|
await (0, import_promises5.writeFile)(
|
|
@@ -22798,11 +22921,18 @@ Exit codes:
|
|
|
22798
22921
|
}
|
|
22799
22922
|
const baseUrl = autoDetectBaseUrl().replace(/\/$/, "");
|
|
22800
22923
|
const compatibilityCommand = compatibilityCommandPath(actionCommand) || actionCommand.name();
|
|
22924
|
+
const shouldDeferSkillsSync = shouldDeferSkillsSyncForCommand();
|
|
22925
|
+
const skillsVersion = shouldDeferSkillsSync ? void 0 : readSdkSkillsLocalVersion(baseUrl);
|
|
22801
22926
|
const compatibility = await traceCliSpan(
|
|
22802
22927
|
"cli.sdk_compatibility",
|
|
22803
|
-
{
|
|
22928
|
+
{
|
|
22929
|
+
baseUrl,
|
|
22930
|
+
command: compatibilityCommand,
|
|
22931
|
+
skillsVersion: skillsVersion ?? null
|
|
22932
|
+
},
|
|
22804
22933
|
() => checkSdkCompatibility(baseUrl, {
|
|
22805
|
-
command: compatibilityCommand
|
|
22934
|
+
command: compatibilityCommand,
|
|
22935
|
+
skillsVersion
|
|
22806
22936
|
})
|
|
22807
22937
|
);
|
|
22808
22938
|
if (compatibility.error) {
|
|
@@ -22828,11 +22958,14 @@ Exit codes:
|
|
|
22828
22958
|
if (printStartupPhase) {
|
|
22829
22959
|
progress?.phase("checking sdk skills");
|
|
22830
22960
|
}
|
|
22831
|
-
if (!
|
|
22961
|
+
if (!shouldDeferSkillsSync) {
|
|
22962
|
+
const skillsUpdate = compatibility.response && Object.prototype.hasOwnProperty.call(compatibility.response, "skills") ? compatibility.response.skills ?? null : void 0;
|
|
22832
22963
|
await traceCliSpan(
|
|
22833
22964
|
"cli.sdk_skills_sync",
|
|
22834
22965
|
{ baseUrl },
|
|
22835
|
-
() => syncSdkSkillsIfNeeded(baseUrl
|
|
22966
|
+
() => syncSdkSkillsIfNeeded(baseUrl, {
|
|
22967
|
+
update: skillsUpdate
|
|
22968
|
+
})
|
|
22836
22969
|
);
|
|
22837
22970
|
}
|
|
22838
22971
|
});
|