deepline 0.2.20 → 0.2.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/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/cli/index.js +414 -140
- package/dist/cli/index.mjs +384 -110
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/install-integrity.json +234 -0
- package/package.json +9 -5
package/dist/cli/index.mjs
CHANGED
|
@@ -164,7 +164,7 @@ configureProxyFromEnv();
|
|
|
164
164
|
|
|
165
165
|
// src/cli/index.ts
|
|
166
166
|
import { mkdtemp as mkdtemp2, rm as rm2, writeFile as writeFile6 } from "fs/promises";
|
|
167
|
-
import { join as
|
|
167
|
+
import { join as join22 } from "path";
|
|
168
168
|
import { tmpdir as tmpdir6 } from "os";
|
|
169
169
|
import { Command as Command4 } from "commander";
|
|
170
170
|
|
|
@@ -1030,7 +1030,7 @@ var SDK_RELEASE = {
|
|
|
1030
1030
|
// 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
|
|
1031
1031
|
// exposed storage-dependent synchronous access. This deliberate minor
|
|
1032
1032
|
// release keeps lazy paging semantics independent of row residency.
|
|
1033
|
-
version: "0.2.
|
|
1033
|
+
version: "0.2.21",
|
|
1034
1034
|
contracts: {
|
|
1035
1035
|
api: {
|
|
1036
1036
|
name: "sdk-http-api",
|
|
@@ -1798,7 +1798,7 @@ function decodeSseFrame(frame) {
|
|
|
1798
1798
|
return parsed;
|
|
1799
1799
|
}
|
|
1800
1800
|
function sleep(ms) {
|
|
1801
|
-
return new Promise((
|
|
1801
|
+
return new Promise((resolve19) => setTimeout(resolve19, ms));
|
|
1802
1802
|
}
|
|
1803
1803
|
function withCoworkNetworkHint(message) {
|
|
1804
1804
|
if (!isCoworkLikeSandbox2() || message.includes(COWORK_NETWORK_HINT)) {
|
|
@@ -3100,14 +3100,14 @@ async function* observeRunEvents(options) {
|
|
|
3100
3100
|
try {
|
|
3101
3101
|
for (; ; ) {
|
|
3102
3102
|
if (queue.length === 0) {
|
|
3103
|
-
const waitForItem = new Promise((
|
|
3104
|
-
wake =
|
|
3103
|
+
const waitForItem = new Promise((resolve19) => {
|
|
3104
|
+
wake = resolve19;
|
|
3105
3105
|
});
|
|
3106
3106
|
if (!sawFirstSnapshot) {
|
|
3107
3107
|
const timedOut = await Promise.race([
|
|
3108
3108
|
waitForItem.then(() => false),
|
|
3109
3109
|
new Promise(
|
|
3110
|
-
(
|
|
3110
|
+
(resolve19) => setTimeout(() => resolve19(true), OBSERVE_BOOTSTRAP_TIMEOUT_MS)
|
|
3111
3111
|
)
|
|
3112
3112
|
]);
|
|
3113
3113
|
if (timedOut && queue.length === 0) {
|
|
@@ -3417,7 +3417,7 @@ function parseEnvTestPolicyOverrides() {
|
|
|
3417
3417
|
return normalizeTestPolicyOverrides(parsed, "DEEPLINE_TEST_POLICY_OVERRIDES");
|
|
3418
3418
|
}
|
|
3419
3419
|
function sleep2(ms) {
|
|
3420
|
-
return new Promise((
|
|
3420
|
+
return new Promise((resolve19) => setTimeout(resolve19, ms));
|
|
3421
3421
|
}
|
|
3422
3422
|
function isTransientCompileManifestError(error) {
|
|
3423
3423
|
if (error instanceof DeeplineError && typeof error.statusCode === "number") {
|
|
@@ -6963,7 +6963,7 @@ function buildCandidateUrls2(url) {
|
|
|
6963
6963
|
}
|
|
6964
6964
|
}
|
|
6965
6965
|
function sleep4(ms) {
|
|
6966
|
-
return new Promise((
|
|
6966
|
+
return new Promise((resolve19) => setTimeout(resolve19, ms));
|
|
6967
6967
|
}
|
|
6968
6968
|
function printDeeplineLogo() {
|
|
6969
6969
|
if (process.stdout.isTTY && (process.stdout.columns ?? 80) >= 70) {
|
|
@@ -17102,7 +17102,7 @@ function traceCliSync(phase, fields, run) {
|
|
|
17102
17102
|
}
|
|
17103
17103
|
}
|
|
17104
17104
|
function sleep5(ms) {
|
|
17105
|
-
return new Promise((
|
|
17105
|
+
return new Promise((resolve19) => setTimeout(resolve19, ms));
|
|
17106
17106
|
}
|
|
17107
17107
|
function parseReferencedPlayTarget2(target) {
|
|
17108
17108
|
const trimmed = target.trim();
|
|
@@ -25565,7 +25565,7 @@ function emitEnrichDebug(message) {
|
|
|
25565
25565
|
);
|
|
25566
25566
|
}
|
|
25567
25567
|
function sleep6(ms) {
|
|
25568
|
-
return new Promise((
|
|
25568
|
+
return new Promise((resolve19) => setTimeout(resolve19, ms));
|
|
25569
25569
|
}
|
|
25570
25570
|
function enrichExportBackingRowsWaitMs() {
|
|
25571
25571
|
const raw = process.env.DEEPLINE_ENRICH_EXPORT_BACKING_ROWS_WAIT_MS?.trim();
|
|
@@ -31737,7 +31737,7 @@ async function readHiddenLine(prompt, streams = {}) {
|
|
|
31737
31737
|
}
|
|
31738
31738
|
let value = "";
|
|
31739
31739
|
inputStream.resume();
|
|
31740
|
-
return await new Promise((
|
|
31740
|
+
return await new Promise((resolve19, reject) => {
|
|
31741
31741
|
let settled = false;
|
|
31742
31742
|
const cleanup = () => {
|
|
31743
31743
|
inputStream.off("data", onData);
|
|
@@ -31755,7 +31755,7 @@ async function readHiddenLine(prompt, streams = {}) {
|
|
|
31755
31755
|
settled = true;
|
|
31756
31756
|
outputStream.write("\n");
|
|
31757
31757
|
cleanup();
|
|
31758
|
-
|
|
31758
|
+
resolve19(line);
|
|
31759
31759
|
};
|
|
31760
31760
|
const fail = (error) => {
|
|
31761
31761
|
if (settled) return;
|
|
@@ -35216,17 +35216,17 @@ Notes:
|
|
|
35216
35216
|
// src/cli/commands/update.ts
|
|
35217
35217
|
import { spawn as spawn3 } from "child_process";
|
|
35218
35218
|
import {
|
|
35219
|
-
existsSync as
|
|
35219
|
+
existsSync as existsSync15,
|
|
35220
35220
|
mkdirSync as mkdirSync10,
|
|
35221
35221
|
realpathSync as realpathSync3,
|
|
35222
|
-
readFileSync as
|
|
35222
|
+
readFileSync as readFileSync15,
|
|
35223
35223
|
renameSync,
|
|
35224
35224
|
rmSync as rmSync4,
|
|
35225
35225
|
unlinkSync,
|
|
35226
35226
|
writeFileSync as writeFileSync15
|
|
35227
35227
|
} from "fs";
|
|
35228
35228
|
import { homedir as homedir12 } from "os";
|
|
35229
|
-
import { dirname as dirname16, isAbsolute as
|
|
35229
|
+
import { dirname as dirname16, isAbsolute as isAbsolute6, join as join19, relative as relative5, resolve as resolve17 } from "path";
|
|
35230
35230
|
|
|
35231
35231
|
// src/cli/commands/skills.ts
|
|
35232
35232
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -35530,7 +35530,7 @@ function readSkillsInstallState(path) {
|
|
|
35530
35530
|
}
|
|
35531
35531
|
}
|
|
35532
35532
|
function runProcess(command, args, cwd) {
|
|
35533
|
-
return new Promise((
|
|
35533
|
+
return new Promise((resolve19, reject) => {
|
|
35534
35534
|
const plan = resolveShellSpawn(command, args);
|
|
35535
35535
|
const child = spawn2(plan.command, plan.args, {
|
|
35536
35536
|
cwd,
|
|
@@ -35549,7 +35549,7 @@ function runProcess(command, args, cwd) {
|
|
|
35549
35549
|
process.stderr.write(`skills@latest exited ${code}.
|
|
35550
35550
|
`);
|
|
35551
35551
|
}
|
|
35552
|
-
|
|
35552
|
+
resolve19(code ?? 1);
|
|
35553
35553
|
});
|
|
35554
35554
|
});
|
|
35555
35555
|
}
|
|
@@ -35743,6 +35743,166 @@ Examples:
|
|
|
35743
35743
|
});
|
|
35744
35744
|
}
|
|
35745
35745
|
|
|
35746
|
+
// src/cli/install-integrity.ts
|
|
35747
|
+
import { createRequire } from "module";
|
|
35748
|
+
import { existsSync as existsSync14, readFileSync as readFileSync14, statSync as statSync5 } from "fs";
|
|
35749
|
+
import { isAbsolute as isAbsolute5, join as join18, relative as relative4, resolve as resolve16 } from "path";
|
|
35750
|
+
var SDK_SIDECAR_CRITICAL_PACKAGE_FILES = [
|
|
35751
|
+
"dist/cli/index.mjs",
|
|
35752
|
+
"dist/index.mjs",
|
|
35753
|
+
"dist/index.d.ts",
|
|
35754
|
+
"dist/plays/bundle-play-file.mjs",
|
|
35755
|
+
"dist/bundling-sources/shared_libs/observability/telemetry.ts",
|
|
35756
|
+
"dist/bundling-sources/shared_libs/play-runtime/backend.ts",
|
|
35757
|
+
"dist/bundling-sources/shared_libs/plays/bundling/index.ts",
|
|
35758
|
+
"dist/bundling-sources/shared_libs/tool-execution-error.ts"
|
|
35759
|
+
];
|
|
35760
|
+
var SDK_SIDECAR_CRITICAL_DEPENDENCY_FILES = [
|
|
35761
|
+
"esbuild/package.json",
|
|
35762
|
+
"esbuild/lib/main.js"
|
|
35763
|
+
];
|
|
35764
|
+
function safeRelativePath(value) {
|
|
35765
|
+
if (typeof value !== "string" || !value || isAbsolute5(value)) return false;
|
|
35766
|
+
const segments = value.split(/[\\/]+/);
|
|
35767
|
+
return segments.every(
|
|
35768
|
+
(segment) => Boolean(segment) && segment !== "." && segment !== ".."
|
|
35769
|
+
);
|
|
35770
|
+
}
|
|
35771
|
+
function resolveContainedPath(root, value) {
|
|
35772
|
+
if (!safeRelativePath(value)) return null;
|
|
35773
|
+
const target = resolve16(root, value);
|
|
35774
|
+
const relativeTarget = relative4(resolve16(root), target);
|
|
35775
|
+
if (!relativeTarget || relativeTarget.startsWith("..") || isAbsolute5(relativeTarget)) {
|
|
35776
|
+
return null;
|
|
35777
|
+
}
|
|
35778
|
+
return target;
|
|
35779
|
+
}
|
|
35780
|
+
function parseJson(path) {
|
|
35781
|
+
return JSON.parse(readFileSync14(path, "utf8"));
|
|
35782
|
+
}
|
|
35783
|
+
function isFile(path) {
|
|
35784
|
+
try {
|
|
35785
|
+
return statSync5(path).isFile();
|
|
35786
|
+
} catch {
|
|
35787
|
+
return false;
|
|
35788
|
+
}
|
|
35789
|
+
}
|
|
35790
|
+
function readManifest(packageRoot) {
|
|
35791
|
+
const packageJsonPath = join18(packageRoot, "package.json");
|
|
35792
|
+
let packageJson;
|
|
35793
|
+
try {
|
|
35794
|
+
packageJson = parseJson(packageJsonPath);
|
|
35795
|
+
} catch (error) {
|
|
35796
|
+
return {
|
|
35797
|
+
mode: "manifest",
|
|
35798
|
+
invalidReason: `invalid Deepline package metadata: ${error.message}`,
|
|
35799
|
+
missing: existsSync14(packageJsonPath) ? [] : ["deepline/package.json"]
|
|
35800
|
+
};
|
|
35801
|
+
}
|
|
35802
|
+
if (!packageJson || typeof packageJson !== "object" || Array.isArray(packageJson)) {
|
|
35803
|
+
return {
|
|
35804
|
+
mode: "manifest",
|
|
35805
|
+
invalidReason: "invalid Deepline package metadata: expected an object"
|
|
35806
|
+
};
|
|
35807
|
+
}
|
|
35808
|
+
const metadata = packageJson;
|
|
35809
|
+
if (metadata.deepline !== void 0 && (!metadata.deepline || typeof metadata.deepline !== "object" || Array.isArray(metadata.deepline))) {
|
|
35810
|
+
return {
|
|
35811
|
+
mode: "manifest",
|
|
35812
|
+
invalidReason: "invalid Deepline package metadata: deepline must be an object"
|
|
35813
|
+
};
|
|
35814
|
+
}
|
|
35815
|
+
const declaration = metadata.deepline?.installIntegrity;
|
|
35816
|
+
if (!declaration) {
|
|
35817
|
+
return {
|
|
35818
|
+
mode: "legacy",
|
|
35819
|
+
manifest: {
|
|
35820
|
+
schemaVersion: 1,
|
|
35821
|
+
packageFiles: [...SDK_SIDECAR_CRITICAL_PACKAGE_FILES],
|
|
35822
|
+
dependencyFiles: [...SDK_SIDECAR_CRITICAL_DEPENDENCY_FILES]
|
|
35823
|
+
}
|
|
35824
|
+
};
|
|
35825
|
+
}
|
|
35826
|
+
if (declaration.schemaVersion !== 1 || !safeRelativePath(declaration.manifest)) {
|
|
35827
|
+
return {
|
|
35828
|
+
mode: "manifest",
|
|
35829
|
+
invalidReason: "invalid Deepline install-integrity declaration"
|
|
35830
|
+
};
|
|
35831
|
+
}
|
|
35832
|
+
const manifestPath = resolveContainedPath(packageRoot, declaration.manifest);
|
|
35833
|
+
if (!manifestPath || !isFile(manifestPath)) {
|
|
35834
|
+
return {
|
|
35835
|
+
mode: "manifest",
|
|
35836
|
+
invalidReason: "declared Deepline install-integrity manifest is missing",
|
|
35837
|
+
missing: [String(declaration.manifest)]
|
|
35838
|
+
};
|
|
35839
|
+
}
|
|
35840
|
+
let raw;
|
|
35841
|
+
try {
|
|
35842
|
+
raw = parseJson(manifestPath);
|
|
35843
|
+
} catch (error) {
|
|
35844
|
+
return {
|
|
35845
|
+
mode: "manifest",
|
|
35846
|
+
invalidReason: `invalid Deepline install-integrity manifest: ${error.message}`
|
|
35847
|
+
};
|
|
35848
|
+
}
|
|
35849
|
+
if (!raw || typeof raw !== "object" || raw.schemaVersion !== 1 || !Array.isArray(raw.packageFiles) || !Array.isArray(raw.dependencyFiles)) {
|
|
35850
|
+
return {
|
|
35851
|
+
mode: "manifest",
|
|
35852
|
+
invalidReason: "invalid Deepline install-integrity manifest schema"
|
|
35853
|
+
};
|
|
35854
|
+
}
|
|
35855
|
+
const manifest = raw;
|
|
35856
|
+
if (manifest.packageFiles.length === 0 || manifest.dependencyFiles.length === 0 || !manifest.packageFiles.every(safeRelativePath) || !manifest.dependencyFiles.every(safeRelativePath)) {
|
|
35857
|
+
return {
|
|
35858
|
+
mode: "manifest",
|
|
35859
|
+
invalidReason: "unsafe path in Deepline install-integrity manifest"
|
|
35860
|
+
};
|
|
35861
|
+
}
|
|
35862
|
+
return { mode: "manifest", manifest };
|
|
35863
|
+
}
|
|
35864
|
+
function inspectSdkSidecarInstall(versionDir) {
|
|
35865
|
+
const nodeModulesRoot = join18(versionDir, "node_modules");
|
|
35866
|
+
const packageRoot = join18(nodeModulesRoot, "deepline");
|
|
35867
|
+
const manifestResult = readManifest(packageRoot);
|
|
35868
|
+
if ("invalidReason" in manifestResult) {
|
|
35869
|
+
return {
|
|
35870
|
+
ok: false,
|
|
35871
|
+
missing: manifestResult.missing ?? [],
|
|
35872
|
+
invalidReason: manifestResult.invalidReason,
|
|
35873
|
+
mode: manifestResult.mode
|
|
35874
|
+
};
|
|
35875
|
+
}
|
|
35876
|
+
const missing = [
|
|
35877
|
+
...manifestResult.manifest.packageFiles.filter((path) => !isFile(join18(packageRoot, path))).map((path) => `deepline/${path}`),
|
|
35878
|
+
...manifestResult.manifest.dependencyFiles.filter((path) => !isFile(join18(nodeModulesRoot, path))).map((path) => `node_modules/${path}`)
|
|
35879
|
+
];
|
|
35880
|
+
return {
|
|
35881
|
+
ok: missing.length === 0,
|
|
35882
|
+
missing,
|
|
35883
|
+
invalidReason: null,
|
|
35884
|
+
mode: manifestResult.mode
|
|
35885
|
+
};
|
|
35886
|
+
}
|
|
35887
|
+
function probeSdkSidecarEsbuild(versionDir) {
|
|
35888
|
+
try {
|
|
35889
|
+
const requireFromInstall = createRequire(join18(versionDir, "package.json"));
|
|
35890
|
+
const esbuild = requireFromInstall("esbuild");
|
|
35891
|
+
if (typeof esbuild.transformSync !== "function") {
|
|
35892
|
+
return "esbuild does not export transformSync";
|
|
35893
|
+
}
|
|
35894
|
+
const result = esbuild.transformSync("const value: number = 1;", {
|
|
35895
|
+
loader: "ts"
|
|
35896
|
+
});
|
|
35897
|
+
if (typeof result?.code !== "string") {
|
|
35898
|
+
return "esbuild transform probe returned no code";
|
|
35899
|
+
}
|
|
35900
|
+
return null;
|
|
35901
|
+
} catch (error) {
|
|
35902
|
+
return error instanceof Error ? error.message : String(error);
|
|
35903
|
+
}
|
|
35904
|
+
}
|
|
35905
|
+
|
|
35746
35906
|
// src/cli/commands/update.ts
|
|
35747
35907
|
var NPM_SDK_INSTALL_COMMON_FLAGS = [
|
|
35748
35908
|
"--no-audit",
|
|
@@ -35798,7 +35958,7 @@ function sidecarStateDir(input2) {
|
|
|
35798
35958
|
if (!scope || scope.includes("/") || scope.includes("\\")) {
|
|
35799
35959
|
return null;
|
|
35800
35960
|
}
|
|
35801
|
-
return
|
|
35961
|
+
return join19(input2.homeDir, ".local", "deepline", scope, "sdk-cli");
|
|
35802
35962
|
}
|
|
35803
35963
|
function sidecarRegistryUrl(hostUrl) {
|
|
35804
35964
|
let url;
|
|
@@ -35825,7 +35985,7 @@ function publicNpmFallbackRegistryUrl(hostUrl) {
|
|
|
35825
35985
|
}
|
|
35826
35986
|
function readOptionalText(path) {
|
|
35827
35987
|
try {
|
|
35828
|
-
return
|
|
35988
|
+
return readFileSync15(path, "utf8").trim();
|
|
35829
35989
|
} catch {
|
|
35830
35990
|
return "";
|
|
35831
35991
|
}
|
|
@@ -35833,19 +35993,19 @@ function readOptionalText(path) {
|
|
|
35833
35993
|
function resolvePythonSidecarUpdatePlan(options) {
|
|
35834
35994
|
const stateDir = sidecarStateDir(options);
|
|
35835
35995
|
if (!stateDir) return null;
|
|
35836
|
-
const relativeEntrypoint =
|
|
35837
|
-
|
|
35838
|
-
|
|
35996
|
+
const relativeEntrypoint = relative5(
|
|
35997
|
+
resolve17(stateDir),
|
|
35998
|
+
resolve17(options.entrypoint)
|
|
35839
35999
|
);
|
|
35840
|
-
if (!relativeEntrypoint || relativeEntrypoint.startsWith("..") ||
|
|
36000
|
+
if (!relativeEntrypoint || relativeEntrypoint.startsWith("..") || isAbsolute6(relativeEntrypoint)) {
|
|
35841
36001
|
return null;
|
|
35842
36002
|
}
|
|
35843
|
-
const installMethod = readOptionalText(
|
|
36003
|
+
const installMethod = readOptionalText(join19(stateDir, ".install-method"));
|
|
35844
36004
|
if (installMethod !== "python-sidecar") return null;
|
|
35845
36005
|
const scope = options.env.DEEPLINE_CONFIG_SCOPE?.trim() || "";
|
|
35846
36006
|
const hostUrl = options.env.DEEPLINE_HOST_URL?.trim() || "";
|
|
35847
|
-
const nodeBin = readOptionalText(
|
|
35848
|
-
const sidecarPath = readOptionalText(
|
|
36007
|
+
const nodeBin = readOptionalText(join19(stateDir, ".node-bin")) || process.execPath;
|
|
36008
|
+
const sidecarPath = readOptionalText(join19(stateDir, ".command-path")) || join19(
|
|
35849
36009
|
stateDir,
|
|
35850
36010
|
"bin",
|
|
35851
36011
|
process.platform === "win32" ? "deepline-sdk.cmd" : "deepline-sdk"
|
|
@@ -35853,7 +36013,7 @@ function resolvePythonSidecarUpdatePlan(options) {
|
|
|
35853
36013
|
const packageSpec = options.packageSpec || "deepline@latest";
|
|
35854
36014
|
const npmCommand = "npm";
|
|
35855
36015
|
const registryUrl = sidecarRegistryUrl(hostUrl);
|
|
35856
|
-
const versionDir =
|
|
36016
|
+
const versionDir = join19(stateDir, "versions", "<version>");
|
|
35857
36017
|
const manualCommand = `${buildSidecarProjectConfigCommand(versionDir, nodeBin)} && ${npmCommand} install --prefix ${shellQuote4(versionDir)} --registry ${shellQuote4(registryUrl)} ${NPM_SDK_INSTALL_COMMON_FLAGS.map(shellQuote4).join(" ")} ${shellQuote4(packageSpec)}`;
|
|
35858
36018
|
return {
|
|
35859
36019
|
kind: "python-sidecar",
|
|
@@ -35869,9 +36029,9 @@ function resolvePythonSidecarUpdatePlan(options) {
|
|
|
35869
36029
|
};
|
|
35870
36030
|
}
|
|
35871
36031
|
function findRepoBackedSdkRoot(startPath) {
|
|
35872
|
-
let current =
|
|
36032
|
+
let current = resolve17(startPath);
|
|
35873
36033
|
while (true) {
|
|
35874
|
-
if (
|
|
36034
|
+
if (existsSync15(join19(current, "sdk", "package.json")) && existsSync15(join19(current, "sdk", "bin", "deepline-dev.ts"))) {
|
|
35875
36035
|
return current;
|
|
35876
36036
|
}
|
|
35877
36037
|
const parent = dirname16(current);
|
|
@@ -35884,7 +36044,7 @@ function inferNpmGlobalPrefixFromEntrypoint(entrypoint) {
|
|
|
35884
36044
|
try {
|
|
35885
36045
|
return realpathSync3(entrypoint);
|
|
35886
36046
|
} catch {
|
|
35887
|
-
return
|
|
36047
|
+
return resolve17(entrypoint);
|
|
35888
36048
|
}
|
|
35889
36049
|
})();
|
|
35890
36050
|
const parts = normalized.split(/[\\/]+/);
|
|
@@ -35905,7 +36065,7 @@ function isHomebrewFormulaEntrypoint(entrypoint) {
|
|
|
35905
36065
|
try {
|
|
35906
36066
|
return realpathSync3(entrypoint);
|
|
35907
36067
|
} catch {
|
|
35908
|
-
return
|
|
36068
|
+
return resolve17(entrypoint);
|
|
35909
36069
|
}
|
|
35910
36070
|
})();
|
|
35911
36071
|
const parts = normalized.split(/[\\/]+/);
|
|
@@ -35915,7 +36075,7 @@ function isHomebrewFormulaEntrypoint(entrypoint) {
|
|
|
35915
36075
|
function resolveUpdatePlan(options = {}) {
|
|
35916
36076
|
const env = options.env ?? process.env;
|
|
35917
36077
|
const homeDir2 = options.homeDir ?? homedir12();
|
|
35918
|
-
const entrypoint = options.entrypoint ?? (process.argv[1] ?
|
|
36078
|
+
const entrypoint = options.entrypoint ?? (process.argv[1] ? resolve17(process.argv[1]) : "");
|
|
35919
36079
|
const sourceRoot = entrypoint ? findRepoBackedSdkRoot(dirname16(entrypoint)) : null;
|
|
35920
36080
|
if (sourceRoot) {
|
|
35921
36081
|
return {
|
|
@@ -35963,9 +36123,9 @@ var AUTO_UPDATE_FAILURE_FILE = ".auto-update-failure.json";
|
|
|
35963
36123
|
function autoUpdateFailurePath(plan) {
|
|
35964
36124
|
if (plan.kind === "source" || plan.kind === "homebrew") return null;
|
|
35965
36125
|
if (plan.kind === "python-sidecar") {
|
|
35966
|
-
return
|
|
36126
|
+
return join19(plan.stateDir, AUTO_UPDATE_FAILURE_FILE);
|
|
35967
36127
|
}
|
|
35968
|
-
return
|
|
36128
|
+
return join19(
|
|
35969
36129
|
homedir12(),
|
|
35970
36130
|
".local",
|
|
35971
36131
|
"deepline",
|
|
@@ -35983,7 +36143,7 @@ function readAutoUpdateFailure(plan) {
|
|
|
35983
36143
|
if (!path) return null;
|
|
35984
36144
|
try {
|
|
35985
36145
|
const parsed = JSON.parse(
|
|
35986
|
-
|
|
36146
|
+
readFileSync15(path, "utf8")
|
|
35987
36147
|
);
|
|
35988
36148
|
if ((parsed.kind === "npm-global" || parsed.kind === "python-sidecar") && typeof parsed.packageSpec === "string" && typeof parsed.failedAt === "string" && typeof parsed.exitCode === "number" && typeof parsed.manualCommand === "string") {
|
|
35989
36149
|
return parsed;
|
|
@@ -36052,7 +36212,7 @@ function safeVersionSegment(value) {
|
|
|
36052
36212
|
return /^[0-9A-Za-z._-]+$/.test(normalized) ? normalized : "";
|
|
36053
36213
|
}
|
|
36054
36214
|
function entryPathInVersionDir(versionDir) {
|
|
36055
|
-
return
|
|
36215
|
+
return join19(
|
|
36056
36216
|
versionDir,
|
|
36057
36217
|
"node_modules",
|
|
36058
36218
|
"deepline",
|
|
@@ -36062,19 +36222,36 @@ function entryPathInVersionDir(versionDir) {
|
|
|
36062
36222
|
);
|
|
36063
36223
|
}
|
|
36064
36224
|
function installedPackageVersion(versionDir) {
|
|
36065
|
-
const packageJsonPath =
|
|
36225
|
+
const packageJsonPath = join19(
|
|
36066
36226
|
versionDir,
|
|
36067
36227
|
"node_modules",
|
|
36068
36228
|
"deepline",
|
|
36069
36229
|
"package.json"
|
|
36070
36230
|
);
|
|
36071
36231
|
try {
|
|
36072
|
-
const parsed = JSON.parse(
|
|
36232
|
+
const parsed = JSON.parse(readFileSync15(packageJsonPath, "utf8"));
|
|
36073
36233
|
return typeof parsed.version === "string" ? safeVersionSegment(parsed.version) : "";
|
|
36074
36234
|
} catch {
|
|
36075
36235
|
return "";
|
|
36076
36236
|
}
|
|
36077
36237
|
}
|
|
36238
|
+
function sidecarStructureFailure(versionDir) {
|
|
36239
|
+
const health = inspectSdkSidecarInstall(versionDir);
|
|
36240
|
+
if (!health.ok) {
|
|
36241
|
+
const details = [
|
|
36242
|
+
...health.invalidReason ? [health.invalidReason] : [],
|
|
36243
|
+
...health.missing.length > 0 ? [`missing ${health.missing.join(", ")}`] : []
|
|
36244
|
+
].join("; ");
|
|
36245
|
+
return details || "required SDK CLI files are missing";
|
|
36246
|
+
}
|
|
36247
|
+
return null;
|
|
36248
|
+
}
|
|
36249
|
+
function sidecarInstallFailure(versionDir) {
|
|
36250
|
+
const structureFailure = sidecarStructureFailure(versionDir);
|
|
36251
|
+
if (structureFailure) return structureFailure;
|
|
36252
|
+
const esbuildFailure = probeSdkSidecarEsbuild(versionDir);
|
|
36253
|
+
return esbuildFailure ? `esbuild probe failed: ${esbuildFailure}` : null;
|
|
36254
|
+
}
|
|
36078
36255
|
function runCommand(command, args, env = process.env) {
|
|
36079
36256
|
return new Promise((resolveResult) => {
|
|
36080
36257
|
let output2 = "";
|
|
@@ -36147,13 +36324,35 @@ async function runNpmInstallWithRegistryFallback(input2) {
|
|
|
36147
36324
|
}
|
|
36148
36325
|
function writeSidecarLauncher(input2) {
|
|
36149
36326
|
mkdirSync10(dirname16(input2.path), { recursive: true });
|
|
36327
|
+
const packageRoot = dirname16(dirname16(dirname16(input2.entryPath)));
|
|
36328
|
+
const versionDir = dirname16(dirname16(packageRoot));
|
|
36329
|
+
const esbuildProbe = "const {createRequire}=require('node:module');const path=require('node:path');const req=createRequire(path.join(process.argv[1],'package.json'));const result=req('esbuild').transformSync('const value: number = 1;',{loader:'ts'});if(!result||typeof result.code!=='string')process.exit(3);";
|
|
36330
|
+
const criticalPaths = [
|
|
36331
|
+
...SDK_SIDECAR_CRITICAL_PACKAGE_FILES.map(
|
|
36332
|
+
(path) => join19(packageRoot, path)
|
|
36333
|
+
),
|
|
36334
|
+
...SDK_SIDECAR_CRITICAL_DEPENDENCY_FILES.map(
|
|
36335
|
+
(path) => join19(versionDir, "node_modules", path)
|
|
36336
|
+
)
|
|
36337
|
+
];
|
|
36150
36338
|
if (process.platform === "win32") {
|
|
36151
36339
|
writeFileSync15(
|
|
36152
36340
|
input2.path,
|
|
36153
36341
|
[
|
|
36154
36342
|
`@set DEEPLINE_HOST_URL=${input2.hostUrl.replace(/\r?\n/g, "")}`,
|
|
36155
36343
|
`@set DEEPLINE_CONFIG_SCOPE=${input2.scope.replace(/\r?\n/g, "")}`,
|
|
36344
|
+
...criticalPaths.map(
|
|
36345
|
+
(path) => `@if not exist "${path}" goto repair_sdk`
|
|
36346
|
+
),
|
|
36347
|
+
`@"${input2.nodeBin}" -e "${esbuildProbe}" "${versionDir}" >NUL 2>&1`,
|
|
36348
|
+
"@if errorlevel 1 goto repair_sdk",
|
|
36156
36349
|
`@"${input2.nodeBin}" "${input2.entryPath}" %*`,
|
|
36350
|
+
"@exit /b %ERRORLEVEL%",
|
|
36351
|
+
":repair_sdk",
|
|
36352
|
+
'@if defined DEEPLINE_REAL_BINARY "%DEEPLINE_REAL_BINARY%" --version=v2 %*',
|
|
36353
|
+
"@if defined DEEPLINE_REAL_BINARY exit /b %ERRORLEVEL%",
|
|
36354
|
+
"@echo Deepline SDK CLI install is incomplete. Run `deepline update` to repair it. 1>&2",
|
|
36355
|
+
"@exit /b 1",
|
|
36157
36356
|
""
|
|
36158
36357
|
].join("\r\n"),
|
|
36159
36358
|
"utf8"
|
|
@@ -36166,6 +36365,20 @@ function writeSidecarLauncher(input2) {
|
|
|
36166
36365
|
"#!/usr/bin/env sh",
|
|
36167
36366
|
`export DEEPLINE_HOST_URL=${shellQuote4(input2.hostUrl)}`,
|
|
36168
36367
|
`export DEEPLINE_CONFIG_SCOPE=${shellQuote4(input2.scope)}`,
|
|
36368
|
+
`if ${criticalPaths.map((path) => `[ ! -f ${shellQuote4(path)} ]`).join(" || ")}; then`,
|
|
36369
|
+
' if [ -n "${DEEPLINE_REAL_BINARY:-}" ] && [ -x "$DEEPLINE_REAL_BINARY" ]; then',
|
|
36370
|
+
' exec "$DEEPLINE_REAL_BINARY" --version=v2 "$@"',
|
|
36371
|
+
" fi",
|
|
36372
|
+
' printf "%s\\n" "Deepline SDK CLI install is incomplete. Run \\`deepline update\\` to repair it." >&2',
|
|
36373
|
+
" exit 1",
|
|
36374
|
+
"fi",
|
|
36375
|
+
`if ! ${shellQuote4(input2.nodeBin)} -e ${shellQuote4(esbuildProbe)} ${shellQuote4(versionDir)} >/dev/null 2>&1; then`,
|
|
36376
|
+
' if [ -n "${DEEPLINE_REAL_BINARY:-}" ] && [ -x "$DEEPLINE_REAL_BINARY" ]; then',
|
|
36377
|
+
' exec "$DEEPLINE_REAL_BINARY" --version=v2 "$@"',
|
|
36378
|
+
" fi",
|
|
36379
|
+
' printf "%s\\n" "Deepline SDK CLI install is incomplete. Run \\`deepline update\\` to repair it." >&2',
|
|
36380
|
+
" exit 1",
|
|
36381
|
+
"fi",
|
|
36169
36382
|
`exec ${shellQuote4(input2.nodeBin)} ${shellQuote4(input2.entryPath)} "$@"`,
|
|
36170
36383
|
""
|
|
36171
36384
|
].join("\n"),
|
|
@@ -36173,14 +36386,14 @@ function writeSidecarLauncher(input2) {
|
|
|
36173
36386
|
);
|
|
36174
36387
|
}
|
|
36175
36388
|
async function runPythonSidecarUpdatePlan(plan) {
|
|
36176
|
-
const versionsDir =
|
|
36177
|
-
const tempDir =
|
|
36389
|
+
const versionsDir = join19(plan.stateDir, "versions");
|
|
36390
|
+
const tempDir = join19(
|
|
36178
36391
|
versionsDir,
|
|
36179
36392
|
`.tmp-sdk-update-${process.pid}-${Date.now()}`
|
|
36180
36393
|
);
|
|
36181
36394
|
rmSync4(tempDir, { recursive: true, force: true });
|
|
36182
36395
|
mkdirSync10(tempDir, { recursive: true });
|
|
36183
|
-
writeFileSync15(
|
|
36396
|
+
writeFileSync15(join19(tempDir, "package.json"), NPM_SDK_SIDECAR_PACKAGE_JSON);
|
|
36184
36397
|
const env = {
|
|
36185
36398
|
...process.env,
|
|
36186
36399
|
PATH: `${dirname16(plan.nodeBin)}${process.platform === "win32" ? ";" : ":"}${process.env.PATH ?? ""}`
|
|
@@ -36211,30 +36424,91 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
36211
36424
|
rmSync4(tempDir, { recursive: true, force: true });
|
|
36212
36425
|
return 1;
|
|
36213
36426
|
}
|
|
36214
|
-
const
|
|
36427
|
+
const stagedFailure = sidecarInstallFailure(tempDir);
|
|
36428
|
+
if (stagedFailure) {
|
|
36429
|
+
process.stderr.write(
|
|
36430
|
+
`Updated Deepline SDK package is incomplete: ${stagedFailure}.
|
|
36431
|
+
`
|
|
36432
|
+
);
|
|
36433
|
+
rmSync4(tempDir, { recursive: true, force: true });
|
|
36434
|
+
return 1;
|
|
36435
|
+
}
|
|
36436
|
+
const finalDir = join19(versionsDir, installedVersion);
|
|
36215
36437
|
const finalEntryPath = entryPathInVersionDir(finalDir);
|
|
36216
|
-
|
|
36438
|
+
const finalFailure = sidecarInstallFailure(finalDir);
|
|
36439
|
+
let backupDir = null;
|
|
36440
|
+
if (!finalFailure) {
|
|
36217
36441
|
rmSync4(tempDir, { recursive: true, force: true });
|
|
36218
36442
|
} else {
|
|
36219
|
-
|
|
36220
|
-
|
|
36221
|
-
|
|
36222
|
-
|
|
36223
|
-
|
|
36224
|
-
process.stderr.write(
|
|
36225
|
-
`Failed to publish Deepline SDK sidecar update: ${error.message}
|
|
36226
|
-
`
|
|
36443
|
+
let shouldPublishTemp = true;
|
|
36444
|
+
if (existsSync15(finalDir)) {
|
|
36445
|
+
backupDir = join19(
|
|
36446
|
+
versionsDir,
|
|
36447
|
+
`.backup-${installedVersion}-${process.pid}-${Date.now()}`
|
|
36227
36448
|
);
|
|
36228
|
-
|
|
36449
|
+
try {
|
|
36450
|
+
renameSync(finalDir, backupDir);
|
|
36451
|
+
} catch (error) {
|
|
36452
|
+
const concurrentlyPublishedFailure = sidecarInstallFailure(finalDir);
|
|
36453
|
+
if (!concurrentlyPublishedFailure) {
|
|
36454
|
+
rmSync4(tempDir, { recursive: true, force: true });
|
|
36455
|
+
backupDir = null;
|
|
36456
|
+
shouldPublishTemp = false;
|
|
36457
|
+
} else {
|
|
36458
|
+
rmSync4(tempDir, { recursive: true, force: true });
|
|
36459
|
+
process.stderr.write(
|
|
36460
|
+
`Failed to preserve the incomplete Deepline SDK sidecar before repair: ${error.message}.
|
|
36461
|
+
`
|
|
36462
|
+
);
|
|
36463
|
+
return 1;
|
|
36464
|
+
}
|
|
36465
|
+
}
|
|
36466
|
+
}
|
|
36467
|
+
if (shouldPublishTemp) {
|
|
36468
|
+
try {
|
|
36469
|
+
renameSync(tempDir, finalDir);
|
|
36470
|
+
} catch (error) {
|
|
36471
|
+
rmSync4(tempDir, { recursive: true, force: true });
|
|
36472
|
+
const concurrentlyPublishedFailure = sidecarInstallFailure(finalDir);
|
|
36473
|
+
if (!concurrentlyPublishedFailure) {
|
|
36474
|
+
if (backupDir) rmSync4(backupDir, { recursive: true, force: true });
|
|
36475
|
+
backupDir = null;
|
|
36476
|
+
} else {
|
|
36477
|
+
let restoreFailure = "";
|
|
36478
|
+
if (backupDir && existsSync15(backupDir) && !existsSync15(finalDir)) {
|
|
36479
|
+
try {
|
|
36480
|
+
renameSync(backupDir, finalDir);
|
|
36481
|
+
backupDir = null;
|
|
36482
|
+
} catch (restoreError) {
|
|
36483
|
+
restoreFailure = `; failed to restore previous install: ${restoreError.message}`;
|
|
36484
|
+
}
|
|
36485
|
+
}
|
|
36486
|
+
process.stderr.write(
|
|
36487
|
+
`Failed to publish Deepline SDK sidecar update: ${error.message}; current install remains incomplete: ${concurrentlyPublishedFailure}${restoreFailure}.
|
|
36488
|
+
`
|
|
36489
|
+
);
|
|
36490
|
+
return 1;
|
|
36491
|
+
}
|
|
36492
|
+
}
|
|
36229
36493
|
}
|
|
36230
36494
|
}
|
|
36231
|
-
|
|
36495
|
+
const publishedFailure = sidecarStructureFailure(finalDir);
|
|
36496
|
+
if (publishedFailure) {
|
|
36497
|
+
if (backupDir && existsSync15(backupDir)) {
|
|
36498
|
+
rmSync4(finalDir, { recursive: true, force: true });
|
|
36499
|
+
try {
|
|
36500
|
+
renameSync(backupDir, finalDir);
|
|
36501
|
+
backupDir = null;
|
|
36502
|
+
} catch {
|
|
36503
|
+
}
|
|
36504
|
+
}
|
|
36232
36505
|
process.stderr.write(
|
|
36233
|
-
`Updated Deepline SDK CLI
|
|
36506
|
+
`Updated Deepline SDK CLI install is incomplete: ${publishedFailure}.
|
|
36234
36507
|
`
|
|
36235
36508
|
);
|
|
36236
36509
|
return 1;
|
|
36237
36510
|
}
|
|
36511
|
+
if (backupDir) rmSync4(backupDir, { recursive: true, force: true });
|
|
36238
36512
|
writeSidecarLauncher({
|
|
36239
36513
|
path: plan.sidecarPath,
|
|
36240
36514
|
hostUrl: plan.hostUrl,
|
|
@@ -36243,27 +36517,27 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
36243
36517
|
entryPath: finalEntryPath
|
|
36244
36518
|
});
|
|
36245
36519
|
writeFileSync15(
|
|
36246
|
-
|
|
36520
|
+
join19(plan.stateDir, ".version"),
|
|
36247
36521
|
`${installedVersion}
|
|
36248
36522
|
`,
|
|
36249
36523
|
"utf8"
|
|
36250
36524
|
);
|
|
36251
36525
|
writeFileSync15(
|
|
36252
|
-
|
|
36526
|
+
join19(plan.stateDir, ".install-method"),
|
|
36253
36527
|
"python-sidecar\n",
|
|
36254
36528
|
"utf8"
|
|
36255
36529
|
);
|
|
36256
36530
|
writeFileSync15(
|
|
36257
|
-
|
|
36531
|
+
join19(plan.stateDir, ".command-path"),
|
|
36258
36532
|
`${plan.sidecarPath}
|
|
36259
36533
|
`,
|
|
36260
36534
|
"utf8"
|
|
36261
36535
|
);
|
|
36262
|
-
writeFileSync15(
|
|
36263
|
-
writeFileSync15(
|
|
36536
|
+
writeFileSync15(join19(plan.stateDir, ".runner"), "node\n", "utf8");
|
|
36537
|
+
writeFileSync15(join19(plan.stateDir, ".node-bin"), `${plan.nodeBin}
|
|
36264
36538
|
`, "utf8");
|
|
36265
36539
|
writeFileSync15(
|
|
36266
|
-
|
|
36540
|
+
join19(plan.stateDir, ".entry-path"),
|
|
36267
36541
|
`${finalEntryPath}
|
|
36268
36542
|
`,
|
|
36269
36543
|
"utf8"
|
|
@@ -36387,16 +36661,16 @@ Examples:
|
|
|
36387
36661
|
// src/cli/commands/setup.ts
|
|
36388
36662
|
import { spawnSync } from "child_process";
|
|
36389
36663
|
import {
|
|
36390
|
-
existsSync as
|
|
36664
|
+
existsSync as existsSync16,
|
|
36391
36665
|
lstatSync,
|
|
36392
36666
|
mkdirSync as mkdirSync11,
|
|
36393
|
-
readFileSync as
|
|
36667
|
+
readFileSync as readFileSync16,
|
|
36394
36668
|
realpathSync as realpathSync4,
|
|
36395
36669
|
rmSync as rmSync5,
|
|
36396
36670
|
writeFileSync as writeFileSync16
|
|
36397
36671
|
} from "fs";
|
|
36398
36672
|
import { homedir as homedir13 } from "os";
|
|
36399
|
-
import { dirname as dirname17, join as
|
|
36673
|
+
import { dirname as dirname17, join as join20, resolve as resolve18 } from "path";
|
|
36400
36674
|
var SETUP_PHASE_NAMES = [
|
|
36401
36675
|
"cli",
|
|
36402
36676
|
"cleanup",
|
|
@@ -36453,7 +36727,7 @@ function phasesFromLegacyStatus(status) {
|
|
|
36453
36727
|
function readSetupState(input2) {
|
|
36454
36728
|
try {
|
|
36455
36729
|
const parsed = JSON.parse(
|
|
36456
|
-
|
|
36730
|
+
readFileSync16(
|
|
36457
36731
|
setupStatePath(input2.baseUrl, input2.scope, input2.root),
|
|
36458
36732
|
"utf8"
|
|
36459
36733
|
)
|
|
@@ -36529,7 +36803,7 @@ function buildPendingAuthorizationOutput(input2) {
|
|
|
36529
36803
|
};
|
|
36530
36804
|
}
|
|
36531
36805
|
function setupStatePath(baseUrl, scope, root) {
|
|
36532
|
-
return scope === "local" && root ?
|
|
36806
|
+
return scope === "local" && root ? join20(root, ".deepline", "setup", "state.json") : join20(sdkCliStateDirPath(baseUrl), "setup.json");
|
|
36533
36807
|
}
|
|
36534
36808
|
async function captureStdout2(run) {
|
|
36535
36809
|
let stdout = "";
|
|
@@ -36558,14 +36832,14 @@ function asRecord3(value) {
|
|
|
36558
36832
|
}
|
|
36559
36833
|
function safeRead(path) {
|
|
36560
36834
|
try {
|
|
36561
|
-
return
|
|
36835
|
+
return readFileSync16(path, "utf8");
|
|
36562
36836
|
} catch {
|
|
36563
36837
|
return "";
|
|
36564
36838
|
}
|
|
36565
36839
|
}
|
|
36566
36840
|
function isNpmManagedDeeplinePath(path) {
|
|
36567
36841
|
try {
|
|
36568
|
-
return realpathSync4(path).includes(`${
|
|
36842
|
+
return realpathSync4(path).includes(`${join20("node_modules", "deepline")}`);
|
|
36569
36843
|
} catch {
|
|
36570
36844
|
return false;
|
|
36571
36845
|
}
|
|
@@ -36576,28 +36850,28 @@ function isInstallerManagedLegacyLauncher(path) {
|
|
|
36576
36850
|
}
|
|
36577
36851
|
function removeKnownLegacyPaths(baseUrl) {
|
|
36578
36852
|
const home = homedir13();
|
|
36579
|
-
const hostDir =
|
|
36580
|
-
const legacyLauncherPath =
|
|
36853
|
+
const hostDir = join20(home, ".local", "deepline", baseUrlSlug(baseUrl));
|
|
36854
|
+
const legacyLauncherPath = join20(home, ".local", "bin", "deepline");
|
|
36581
36855
|
const installerCommandPath = safeRead(
|
|
36582
|
-
|
|
36856
|
+
join20(hostDir, "sdk", ".command-path")
|
|
36583
36857
|
).trim();
|
|
36584
36858
|
const candidates = [
|
|
36585
36859
|
...isInstallerManagedLegacyLauncher(legacyLauncherPath) ? [legacyLauncherPath] : [],
|
|
36586
|
-
|
|
36587
|
-
|
|
36588
|
-
|
|
36589
|
-
|
|
36590
|
-
|
|
36591
|
-
|
|
36592
|
-
|
|
36860
|
+
join20(home, ".local", "bin", "deepline-real"),
|
|
36861
|
+
join20(hostDir, "bin", "deepline"),
|
|
36862
|
+
join20(hostDir, "bin", "deepline-real"),
|
|
36863
|
+
join20(hostDir, "cli", ".install-method"),
|
|
36864
|
+
join20(hostDir, "cli", ".version"),
|
|
36865
|
+
join20(hostDir, "sdk", ".install-method"),
|
|
36866
|
+
join20(hostDir, "sdk", ".command-path"),
|
|
36593
36867
|
...installerCommandPath ? [
|
|
36594
36868
|
installerCommandPath,
|
|
36595
|
-
|
|
36869
|
+
join20(dirname17(installerCommandPath), "deepline-sdk")
|
|
36596
36870
|
] : []
|
|
36597
36871
|
];
|
|
36598
36872
|
const removed = [];
|
|
36599
36873
|
for (const path of candidates) {
|
|
36600
|
-
if (!
|
|
36874
|
+
if (!existsSync16(path)) continue;
|
|
36601
36875
|
if (path === installerCommandPath && isNpmManagedDeeplinePath(path)) {
|
|
36602
36876
|
continue;
|
|
36603
36877
|
}
|
|
@@ -36614,7 +36888,7 @@ function resolvePathCommands(command) {
|
|
|
36614
36888
|
);
|
|
36615
36889
|
return [
|
|
36616
36890
|
...new Set(
|
|
36617
|
-
String(lookup.stdout ?? "").split(/\r?\n/).map((line) => line.trim()).filter(Boolean).map((path) =>
|
|
36891
|
+
String(lookup.stdout ?? "").split(/\r?\n/).map((line) => line.trim()).filter(Boolean).map((path) => resolve18(path))
|
|
36618
36892
|
)
|
|
36619
36893
|
];
|
|
36620
36894
|
}
|
|
@@ -36635,7 +36909,7 @@ function isHomebrewFormulaCommand(path) {
|
|
|
36635
36909
|
function resolvePersistentGlobalCommand(dependencies = {}) {
|
|
36636
36910
|
const platform3 = dependencies.platform ?? process.platform;
|
|
36637
36911
|
const run = dependencies.spawn ?? spawnSync;
|
|
36638
|
-
const pathExists = dependencies.exists ??
|
|
36912
|
+
const pathExists = dependencies.exists ?? existsSync16;
|
|
36639
36913
|
const pathClis = dependencies.pathClis ?? resolvePathCommands("deepline");
|
|
36640
36914
|
const homebrewCommand = pathClis.find(isHomebrewFormulaCommand);
|
|
36641
36915
|
if (homebrewCommand) return homebrewCommand;
|
|
@@ -36647,7 +36921,7 @@ function resolvePersistentGlobalCommand(dependencies = {}) {
|
|
|
36647
36921
|
if (prefix.status !== 0) return null;
|
|
36648
36922
|
const root = String(prefix.stdout ?? "").trim();
|
|
36649
36923
|
if (!root) return null;
|
|
36650
|
-
const candidates = platform3 === "win32" ? [
|
|
36924
|
+
const candidates = platform3 === "win32" ? [join20(root, "deepline.cmd"), join20(root, "deepline")] : [join20(root, "bin", "deepline")];
|
|
36651
36925
|
return candidates.find((candidate) => pathExists(candidate)) ?? null;
|
|
36652
36926
|
}
|
|
36653
36927
|
function inspectGlobalCliAvailability(input2) {
|
|
@@ -36662,18 +36936,18 @@ function pathsResolveToSameFile(left, right) {
|
|
|
36662
36936
|
try {
|
|
36663
36937
|
return realpathSync4(left) === realpathSync4(right);
|
|
36664
36938
|
} catch {
|
|
36665
|
-
return
|
|
36939
|
+
return resolve18(left) === resolve18(right);
|
|
36666
36940
|
}
|
|
36667
36941
|
}
|
|
36668
36942
|
function isKnownDeeplineCommand(path) {
|
|
36669
|
-
const entrypoint = process.argv[1] ?
|
|
36943
|
+
const entrypoint = process.argv[1] ? resolve18(process.argv[1]) : "";
|
|
36670
36944
|
let resolvedPath = path;
|
|
36671
36945
|
try {
|
|
36672
36946
|
resolvedPath = realpathSync4(path);
|
|
36673
36947
|
} catch {
|
|
36674
36948
|
}
|
|
36675
36949
|
if (entrypoint && resolvedPath === entrypoint) return true;
|
|
36676
|
-
if (resolvedPath.includes(`${
|
|
36950
|
+
if (resolvedPath.includes(`${join20("node_modules", "deepline")}`)) return true;
|
|
36677
36951
|
const content = safeRead(path);
|
|
36678
36952
|
return content.includes("node_modules/deepline") || content.includes("node_modules\\deepline") || content.includes("DEEPLINE_CONFIG_SCOPE") || content.includes("deepline-real");
|
|
36679
36953
|
}
|
|
@@ -36683,7 +36957,7 @@ function inspectPathConflict() {
|
|
|
36683
36957
|
try {
|
|
36684
36958
|
if (lstatSync(commandPath).isSymbolicLink()) {
|
|
36685
36959
|
const target = realpathSync4(commandPath);
|
|
36686
|
-
if (target.includes(`${
|
|
36960
|
+
if (target.includes(`${join20("node_modules", "deepline")}`)) return null;
|
|
36687
36961
|
}
|
|
36688
36962
|
} catch {
|
|
36689
36963
|
}
|
|
@@ -36732,7 +37006,7 @@ function failSetupPhase(phases, phase, code) {
|
|
|
36732
37006
|
phases[phase] = { status: "failed", code };
|
|
36733
37007
|
}
|
|
36734
37008
|
function rollbackCommand(scope, root) {
|
|
36735
|
-
const prefix = scope === "local" && root ? ` --prefix ${JSON.stringify(
|
|
37009
|
+
const prefix = scope === "local" && root ? ` --prefix ${JSON.stringify(join20(root, ".deepline", "runtime"))}` : "";
|
|
36736
37010
|
return `npm install -g${prefix} --no-audit --no-fund --include=optional --allow-scripts=esbuild deepline@${SDK_VERSION}`;
|
|
36737
37011
|
}
|
|
36738
37012
|
function setupResumeCommand(baseUrl, scope) {
|
|
@@ -36819,12 +37093,12 @@ function buildDoctorAssessment(input2) {
|
|
|
36819
37093
|
const connected = input2.authStatus.payload?.connected === true;
|
|
36820
37094
|
const authScopeOk = input2.scope === "local" ? Boolean(projectAuth) : Boolean(apiKey && !projectAuth);
|
|
36821
37095
|
const skillsOk = skillsState?.scope === input2.scope && typeof skillsState.skillsVersion === "string" && Array.isArray(skillsState.agents) && skillsState.agents.length > 0;
|
|
36822
|
-
const runningCliPath = process.argv[1] ?
|
|
37096
|
+
const runningCliPath = process.argv[1] ? resolve18(process.argv[1]) : null;
|
|
36823
37097
|
const globalCli = input2.scope === "global" ? inspectGlobalCliAvailability() : null;
|
|
36824
37098
|
const pathGlobalCli = globalCli?.path ?? null;
|
|
36825
37099
|
const cliPath = input2.scope === "global" ? pathGlobalCli : runningCliPath;
|
|
36826
37100
|
const cliScopeOk = input2.scope === "global" ? Boolean(pathGlobalCli) : Boolean(
|
|
36827
|
-
input2.root && runningCliPath?.includes(
|
|
37101
|
+
input2.root && runningCliPath?.includes(join20(input2.root, ".deepline", "runtime"))
|
|
36828
37102
|
);
|
|
36829
37103
|
const checks = {
|
|
36830
37104
|
cli: {
|
|
@@ -37470,7 +37744,7 @@ function isDowngradeAutoUpdateResponse(response) {
|
|
|
37470
37744
|
return compareSemver(target, current) < 0;
|
|
37471
37745
|
}
|
|
37472
37746
|
function relaunchCurrentCommand(plan) {
|
|
37473
|
-
return new Promise((
|
|
37747
|
+
return new Promise((resolve19) => {
|
|
37474
37748
|
const command = plan.kind === "python-sidecar" ? plan.sidecarPath : process.execPath;
|
|
37475
37749
|
const args = plan.kind === "python-sidecar" ? process.argv.slice(2) : process.argv.slice(1);
|
|
37476
37750
|
const child = spawn4(command, args, {
|
|
@@ -37486,9 +37760,9 @@ function relaunchCurrentCommand(plan) {
|
|
|
37486
37760
|
`Deepline SDK/CLI updated, but relaunch failed: ${error.message}
|
|
37487
37761
|
`
|
|
37488
37762
|
);
|
|
37489
|
-
|
|
37763
|
+
resolve19(1);
|
|
37490
37764
|
});
|
|
37491
|
-
child.on("close", (code) =>
|
|
37765
|
+
child.on("close", (code) => resolve19(code ?? 1));
|
|
37492
37766
|
});
|
|
37493
37767
|
}
|
|
37494
37768
|
async function maybeAutoUpdateAndRelaunch(response) {
|
|
@@ -37540,13 +37814,13 @@ async function maybeAutoUpdateAndRelaunch(response) {
|
|
|
37540
37814
|
// src/cli/skills-sync.ts
|
|
37541
37815
|
import { spawn as spawn5, spawnSync as spawnSync2 } from "child_process";
|
|
37542
37816
|
import {
|
|
37543
|
-
existsSync as
|
|
37817
|
+
existsSync as existsSync17,
|
|
37544
37818
|
mkdirSync as mkdirSync12,
|
|
37545
|
-
readFileSync as
|
|
37819
|
+
readFileSync as readFileSync17,
|
|
37546
37820
|
unlinkSync as unlinkSync2,
|
|
37547
37821
|
writeFileSync as writeFileSync17
|
|
37548
37822
|
} from "fs";
|
|
37549
|
-
import { dirname as dirname18, join as
|
|
37823
|
+
import { dirname as dirname18, join as join21 } from "path";
|
|
37550
37824
|
var CHECK_TIMEOUT_MS2 = 3e3;
|
|
37551
37825
|
var attemptedSync = false;
|
|
37552
37826
|
function shouldSkipSkillsSync() {
|
|
@@ -37562,33 +37836,33 @@ function activePluginSkillsDir() {
|
|
|
37562
37836
|
return "";
|
|
37563
37837
|
}
|
|
37564
37838
|
const dir = process.env.DEEPLINE_PLUGIN_SKILLS_DIR?.trim() ?? "";
|
|
37565
|
-
return dir &&
|
|
37839
|
+
return dir && existsSync17(dir) ? dir : "";
|
|
37566
37840
|
}
|
|
37567
37841
|
function readPluginSkillsVersion() {
|
|
37568
37842
|
const dir = activePluginSkillsDir();
|
|
37569
37843
|
if (!dir) return "";
|
|
37570
37844
|
try {
|
|
37571
|
-
return
|
|
37845
|
+
return readFileSync17(join21(dir, ".version"), "utf-8").trim();
|
|
37572
37846
|
} catch {
|
|
37573
37847
|
return "";
|
|
37574
37848
|
}
|
|
37575
37849
|
}
|
|
37576
37850
|
function sdkSkillsVersionPath(baseUrl) {
|
|
37577
|
-
return
|
|
37851
|
+
return join21(sdkCliStateDirPath(baseUrl), "skills-version");
|
|
37578
37852
|
}
|
|
37579
37853
|
function legacySdkSkillsVersionPath(baseUrl) {
|
|
37580
|
-
return
|
|
37854
|
+
return join21(dirname18(sdkCliStateDirPath(baseUrl)), "sdk-skills", ".version");
|
|
37581
37855
|
}
|
|
37582
37856
|
function unavailableSkillsNoticePath(baseUrl) {
|
|
37583
|
-
return
|
|
37857
|
+
return join21(sdkCliStateDirPath(baseUrl), "skills-sync-unavailable-version");
|
|
37584
37858
|
}
|
|
37585
37859
|
function readSdkSkillsLocalVersion(baseUrl) {
|
|
37586
37860
|
const pluginVersion = readPluginSkillsVersion();
|
|
37587
37861
|
if (pluginVersion) return pluginVersion;
|
|
37588
|
-
const path =
|
|
37589
|
-
if (!
|
|
37862
|
+
const path = existsSync17(sdkSkillsVersionPath(baseUrl)) ? sdkSkillsVersionPath(baseUrl) : legacySdkSkillsVersionPath(baseUrl);
|
|
37863
|
+
if (!existsSync17(path)) return "";
|
|
37590
37864
|
try {
|
|
37591
|
-
return
|
|
37865
|
+
return readFileSync17(path, "utf-8").trim();
|
|
37592
37866
|
} catch {
|
|
37593
37867
|
return "";
|
|
37594
37868
|
}
|
|
@@ -37602,7 +37876,7 @@ function writeLocalSkillsVersion(baseUrl, version) {
|
|
|
37602
37876
|
function writeUnavailableSkillsNotice(baseUrl, remoteVersion, skillNames) {
|
|
37603
37877
|
const path = unavailableSkillsNoticePath(baseUrl);
|
|
37604
37878
|
try {
|
|
37605
|
-
if (
|
|
37879
|
+
if (existsSync17(path) && readFileSync17(path, "utf-8").trim() === remoteVersion) {
|
|
37606
37880
|
return;
|
|
37607
37881
|
}
|
|
37608
37882
|
mkdirSync12(dirname18(path), { recursive: true });
|
|
@@ -37740,7 +38014,7 @@ function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NA
|
|
|
37740
38014
|
return commands;
|
|
37741
38015
|
}
|
|
37742
38016
|
function runOneSkillsInstall(install) {
|
|
37743
|
-
return new Promise((
|
|
38017
|
+
return new Promise((resolve19) => {
|
|
37744
38018
|
const plan = resolveSkillsInstallSpawn(install);
|
|
37745
38019
|
const child = spawn5(plan.command, plan.args, {
|
|
37746
38020
|
stdio: ["ignore", "ignore", "pipe"],
|
|
@@ -37752,7 +38026,7 @@ function runOneSkillsInstall(install) {
|
|
|
37752
38026
|
stderr += chunk.toString("utf-8");
|
|
37753
38027
|
});
|
|
37754
38028
|
child.on("error", (error) => {
|
|
37755
|
-
|
|
38029
|
+
resolve19({
|
|
37756
38030
|
ok: false,
|
|
37757
38031
|
detail: `failed to start ${install.command}: ${error.message}`,
|
|
37758
38032
|
manualCommand: install.manualCommand
|
|
@@ -37760,11 +38034,11 @@ function runOneSkillsInstall(install) {
|
|
|
37760
38034
|
});
|
|
37761
38035
|
child.on("close", (code) => {
|
|
37762
38036
|
if (code === 0) {
|
|
37763
|
-
|
|
38037
|
+
resolve19({ ok: true, detail: "", manualCommand: install.manualCommand });
|
|
37764
38038
|
return;
|
|
37765
38039
|
}
|
|
37766
38040
|
const detail = stderr.trim();
|
|
37767
|
-
|
|
38041
|
+
resolve19({
|
|
37768
38042
|
ok: false,
|
|
37769
38043
|
detail: detail ? `${install.command}: ${detail}` : `${install.command} exited ${code}`,
|
|
37770
38044
|
manualCommand: install.manualCommand
|
|
@@ -38192,8 +38466,8 @@ function topLevelCommandKnown(program, commandName) {
|
|
|
38192
38466
|
);
|
|
38193
38467
|
}
|
|
38194
38468
|
async function runPlayRunnerHealthCheck() {
|
|
38195
|
-
const dir = await mkdtemp2(
|
|
38196
|
-
const file =
|
|
38469
|
+
const dir = await mkdtemp2(join22(tmpdir6(), "deepline-health-play-"));
|
|
38470
|
+
const file = join22(dir, "health-check.play.ts");
|
|
38197
38471
|
try {
|
|
38198
38472
|
await writeFile6(
|
|
38199
38473
|
file,
|