deepline 0.3.214 → 0.3.215
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/bundling-sources/shared_libs/plays/deploy/api-client.ts +40 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/manifest.ts +51 -28
- package/dist/bundling-sources/shared_libs/plays/deploy/monitor-files.ts +52 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/run-deployment.ts +146 -19
- package/dist/cli/index.js +487 -325
- package/dist/cli/index.mjs +335 -173
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/install-integrity.json +1 -0
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +1 -1
- package/dist/release.mjs +1 -1
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -1951,7 +1951,7 @@ configureProxyFromEnv();
|
|
|
1951
1951
|
|
|
1952
1952
|
// src/cli/index.ts
|
|
1953
1953
|
import { mkdtemp as mkdtemp4, rm as rm4, writeFile as writeFile6 } from "fs/promises";
|
|
1954
|
-
import { join as
|
|
1954
|
+
import { join as join28 } from "path";
|
|
1955
1955
|
import { tmpdir as tmpdir7 } from "os";
|
|
1956
1956
|
import { Command as Command5 } from "commander";
|
|
1957
1957
|
|
|
@@ -3046,7 +3046,7 @@ var SDK_RELEASE = {
|
|
|
3046
3046
|
// getters keep their established compatibility behavior.
|
|
3047
3047
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
3048
3048
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
3049
|
-
version: "0.3.
|
|
3049
|
+
version: "0.3.215",
|
|
3050
3050
|
updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
|
|
3051
3051
|
packageCapabilities: {
|
|
3052
3052
|
updatePreferences: 1
|
|
@@ -15571,14 +15571,14 @@ function customerDbColumnNames(result) {
|
|
|
15571
15571
|
function errorMessage(value) {
|
|
15572
15572
|
return value instanceof Error ? value.message : String(value ?? "");
|
|
15573
15573
|
}
|
|
15574
|
-
function resolveDbQuerySql(rawSql,
|
|
15574
|
+
function resolveDbQuerySql(rawSql, readFile8 = (path) => readFileSync7(path, "utf8")) {
|
|
15575
15575
|
const value = rawSql.trim();
|
|
15576
15576
|
if (!value.startsWith("@")) return value;
|
|
15577
15577
|
const filePath = value.slice(1).trim();
|
|
15578
15578
|
if (!filePath) {
|
|
15579
15579
|
throw new Error("--sql @file requires a file path after `@`.");
|
|
15580
15580
|
}
|
|
15581
|
-
return
|
|
15581
|
+
return readFile8(resolve6(filePath)).trim();
|
|
15582
15582
|
}
|
|
15583
15583
|
function collectErrorText(value) {
|
|
15584
15584
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -15949,7 +15949,7 @@ import {
|
|
|
15949
15949
|
lstat as lstat2,
|
|
15950
15950
|
mkdir as mkdir5,
|
|
15951
15951
|
mkdtemp as mkdtemp3,
|
|
15952
|
-
readFile as
|
|
15952
|
+
readFile as readFile5,
|
|
15953
15953
|
realpath as realpath4,
|
|
15954
15954
|
rename as rename2,
|
|
15955
15955
|
rm as rm3,
|
|
@@ -15957,7 +15957,7 @@ import {
|
|
|
15957
15957
|
writeFile as writeFile4
|
|
15958
15958
|
} from "fs/promises";
|
|
15959
15959
|
import { homedir as homedir6, tmpdir as tmpdir5 } from "os";
|
|
15960
|
-
import { basename as basename4, dirname as dirname11, extname as extname3, join as
|
|
15960
|
+
import { basename as basename4, dirname as dirname11, extname as extname3, join as join15, resolve as resolve13 } from "path";
|
|
15961
15961
|
import { Option as Option2 } from "commander";
|
|
15962
15962
|
|
|
15963
15963
|
// ../plays/settings-contract.ts
|
|
@@ -16309,7 +16309,7 @@ import {
|
|
|
16309
16309
|
basename as basename3,
|
|
16310
16310
|
dirname as dirname10,
|
|
16311
16311
|
isAbsolute as isAbsolute5,
|
|
16312
|
-
join as
|
|
16312
|
+
join as join14,
|
|
16313
16313
|
relative as relative5,
|
|
16314
16314
|
resolve as resolve12
|
|
16315
16315
|
} from "path";
|
|
@@ -21631,10 +21631,10 @@ function normalizeFixtureScopeValue(value, maxLength) {
|
|
|
21631
21631
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
21632
21632
|
import { mkdtemp as mkdtemp2, realpath as realpath3, rm as rm2 } from "fs/promises";
|
|
21633
21633
|
import { tmpdir as tmpdir4 } from "os";
|
|
21634
|
-
import { join as
|
|
21634
|
+
import { join as join13, resolve as resolve11 } from "path";
|
|
21635
21635
|
|
|
21636
21636
|
// ../plays/deploy/run-deployment.ts
|
|
21637
|
-
import { join as
|
|
21637
|
+
import { join as join12 } from "path";
|
|
21638
21638
|
import { mkdir as mkdir4, mkdtemp, rm } from "fs/promises";
|
|
21639
21639
|
|
|
21640
21640
|
// ../plays/deployment-status.ts
|
|
@@ -21743,6 +21743,21 @@ var DeployApiClient = class {
|
|
|
21743
21743
|
body: { names }
|
|
21744
21744
|
});
|
|
21745
21745
|
}
|
|
21746
|
+
monitors(action, entries) {
|
|
21747
|
+
return this.request({
|
|
21748
|
+
method: "POST",
|
|
21749
|
+
path: this.deploymentPath("/monitors"),
|
|
21750
|
+
body: { action, entries }
|
|
21751
|
+
});
|
|
21752
|
+
}
|
|
21753
|
+
monitorJob(jobId, monitorKey) {
|
|
21754
|
+
return this.request({
|
|
21755
|
+
method: "GET",
|
|
21756
|
+
path: this.deploymentPath(
|
|
21757
|
+
`/monitors?jobId=${encodeURIComponent(jobId)}&monitorKey=${encodeURIComponent(monitorKey)}`
|
|
21758
|
+
)
|
|
21759
|
+
});
|
|
21760
|
+
}
|
|
21746
21761
|
compileManifest(input2) {
|
|
21747
21762
|
return this.request({
|
|
21748
21763
|
method: "POST",
|
|
@@ -21795,7 +21810,8 @@ var import_picomatch = __toESM(require_picomatch2(), 1);
|
|
|
21795
21810
|
import { readdir, readFile as readFile3, stat as stat3 } from "fs/promises";
|
|
21796
21811
|
import { join as join10, relative as relative4 } from "path";
|
|
21797
21812
|
var DEFAULT_PLAY_GLOBS = ["**/*.play.ts"];
|
|
21798
|
-
var
|
|
21813
|
+
var DEFAULT_MONITOR_GLOBS = ["**/*.monitor.json"];
|
|
21814
|
+
var MAX_DISCOVERED_FILES = 200;
|
|
21799
21815
|
var IGNORED_DIRECTORIES = /* @__PURE__ */ new Set([
|
|
21800
21816
|
"node_modules",
|
|
21801
21817
|
".git",
|
|
@@ -21809,9 +21825,26 @@ var DeeplineManifestError = class extends Error {
|
|
|
21809
21825
|
this.name = "DeeplineManifestError";
|
|
21810
21826
|
}
|
|
21811
21827
|
};
|
|
21828
|
+
function readGlobs(value, field) {
|
|
21829
|
+
if (!Array.isArray(value) || field === "plays" && value.length === 0 || !value.every((glob) => typeof glob === "string" && glob.trim().length > 0)) {
|
|
21830
|
+
throw new DeeplineManifestError(
|
|
21831
|
+
`deepline.json "${field}" must be ${field === "plays" ? "a non-empty" : "an"} array of glob strings.`
|
|
21832
|
+
);
|
|
21833
|
+
}
|
|
21834
|
+
const globs = value.map((glob) => glob.trim().replace(/^\.\//, ""));
|
|
21835
|
+
if (globs.some((glob) => glob.startsWith("/") || glob.includes(".."))) {
|
|
21836
|
+
throw new DeeplineManifestError(
|
|
21837
|
+
`deepline.json "${field}" globs must be relative and must not contain "..".`
|
|
21838
|
+
);
|
|
21839
|
+
}
|
|
21840
|
+
return globs;
|
|
21841
|
+
}
|
|
21812
21842
|
function parseDeeplineManifest(raw) {
|
|
21813
21843
|
if (raw === null) {
|
|
21814
|
-
return {
|
|
21844
|
+
return {
|
|
21845
|
+
plays: DEFAULT_PLAY_GLOBS,
|
|
21846
|
+
monitors: DEFAULT_MONITOR_GLOBS
|
|
21847
|
+
};
|
|
21815
21848
|
}
|
|
21816
21849
|
let parsed;
|
|
21817
21850
|
try {
|
|
@@ -21825,24 +21858,14 @@ function parseDeeplineManifest(raw) {
|
|
|
21825
21858
|
throw new DeeplineManifestError("deepline.json must be a JSON object.");
|
|
21826
21859
|
}
|
|
21827
21860
|
const record3 = parsed;
|
|
21828
|
-
|
|
21829
|
-
|
|
21830
|
-
if (!Array.isArray(record3.plays) || record3.plays.length === 0 || !record3.plays.every(
|
|
21831
|
-
(glob) => typeof glob === "string" && glob.trim().length > 0
|
|
21832
|
-
)) {
|
|
21833
|
-
throw new DeeplineManifestError(
|
|
21834
|
-
'deepline.json "plays" must be a non-empty array of glob strings, e.g. ["plays/**/*.play.ts"].'
|
|
21835
|
-
);
|
|
21836
|
-
}
|
|
21837
|
-
plays = record3.plays.map((glob) => glob.trim().replace(/^\.\//, ""));
|
|
21838
|
-
}
|
|
21839
|
-
if (plays.some((glob) => glob.startsWith("/") || glob.includes(".."))) {
|
|
21840
|
-
throw new DeeplineManifestError(
|
|
21841
|
-
'deepline.json "plays" globs must be relative and must not contain "..".'
|
|
21842
|
-
);
|
|
21843
|
-
}
|
|
21861
|
+
const plays = record3.plays === void 0 ? DEFAULT_PLAY_GLOBS : readGlobs(record3.plays, "plays");
|
|
21862
|
+
const monitors = record3.monitors === void 0 ? DEFAULT_MONITOR_GLOBS : readGlobs(record3.monitors, "monitors");
|
|
21844
21863
|
const org = typeof record3.org === "string" && record3.org.trim() ? record3.org.trim() : void 0;
|
|
21845
|
-
return {
|
|
21864
|
+
return {
|
|
21865
|
+
plays,
|
|
21866
|
+
monitors,
|
|
21867
|
+
...org ? { org } : {}
|
|
21868
|
+
};
|
|
21846
21869
|
}
|
|
21847
21870
|
var DEFAULT_MANIFEST_FILE = "deepline.json";
|
|
21848
21871
|
async function readDeeplineManifest(projectRoot, manifestFile = DEFAULT_MANIFEST_FILE) {
|
|
@@ -21872,7 +21895,7 @@ async function readDeeplineManifest(projectRoot, manifestFile = DEFAULT_MANIFEST
|
|
|
21872
21895
|
throw error;
|
|
21873
21896
|
}
|
|
21874
21897
|
}
|
|
21875
|
-
async function
|
|
21898
|
+
async function discoverDeploymentFiles(input2) {
|
|
21876
21899
|
const matchers = input2.globs.map((glob) => (0, import_picomatch.default)(glob));
|
|
21877
21900
|
const found = [];
|
|
21878
21901
|
async function walk(dir) {
|
|
@@ -21889,9 +21912,9 @@ async function discoverPlayFiles(input2) {
|
|
|
21889
21912
|
const relativePath = relative4(input2.projectRoot, absolute);
|
|
21890
21913
|
if (matchers.some((match) => match(relativePath))) {
|
|
21891
21914
|
found.push(relativePath);
|
|
21892
|
-
if (found.length >
|
|
21915
|
+
if (found.length > MAX_DISCOVERED_FILES) {
|
|
21893
21916
|
throw new DeeplineManifestError(
|
|
21894
|
-
`deepline.json globs matched more than ${
|
|
21917
|
+
`deepline.json globs matched more than ${MAX_DISCOVERED_FILES} files. Tighten the globs.`
|
|
21895
21918
|
);
|
|
21896
21919
|
}
|
|
21897
21920
|
}
|
|
@@ -21906,6 +21929,39 @@ async function discoverPlayFiles(input2) {
|
|
|
21906
21929
|
await walk(input2.projectRoot);
|
|
21907
21930
|
return found.sort();
|
|
21908
21931
|
}
|
|
21932
|
+
var discoverPlayFiles = discoverDeploymentFiles;
|
|
21933
|
+
|
|
21934
|
+
// ../plays/deploy/monitor-files.ts
|
|
21935
|
+
import { readFile as readFile4 } from "fs/promises";
|
|
21936
|
+
import { join as join11 } from "path";
|
|
21937
|
+
async function readMonitorFiles(input2) {
|
|
21938
|
+
const files = await discoverDeploymentFiles(input2);
|
|
21939
|
+
if (files.length > 100) {
|
|
21940
|
+
throw new DeeplineManifestError(
|
|
21941
|
+
"A deployment may contain at most 100 monitor definitions. Split the repository into multiple linked targets."
|
|
21942
|
+
);
|
|
21943
|
+
}
|
|
21944
|
+
return Promise.all(
|
|
21945
|
+
files.map(async (file) => {
|
|
21946
|
+
const sourcePath = input2.rootDirectory ? `${input2.rootDirectory}/${file}` : file;
|
|
21947
|
+
const raw = await readFile4(join11(input2.projectRoot, file), "utf8");
|
|
21948
|
+
try {
|
|
21949
|
+
return { file: sourcePath, definition: JSON.parse(raw) };
|
|
21950
|
+
} catch {
|
|
21951
|
+
throw new DeeplineManifestError(
|
|
21952
|
+
`${sourcePath} must contain a monitor definition as valid JSON.`
|
|
21953
|
+
);
|
|
21954
|
+
}
|
|
21955
|
+
})
|
|
21956
|
+
);
|
|
21957
|
+
}
|
|
21958
|
+
function monitorDeploymentSummary(outcomes) {
|
|
21959
|
+
return outcomes.map(
|
|
21960
|
+
(outcome) => `- Monitor \`${outcome.key}\` (\`${outcome.file}\`): ${outcome.status}${outcome.credits != null ? ` (${outcome.credits} Deepline credits)` : ""}${outcome.jobId ? ` \u2014 job \`${outcome.jobId}\`` : ""}${outcome.error ? `
|
|
21961
|
+
- ${outcome.error}` : ""}${outcome.warning ? `
|
|
21962
|
+
- :warning: ${outcome.warning}` : ""}`
|
|
21963
|
+
).join("\n");
|
|
21964
|
+
}
|
|
21909
21965
|
|
|
21910
21966
|
// ../plays/play-reference.ts
|
|
21911
21967
|
var PREBUILT_PLAY_NAMESPACE = "prebuilt";
|
|
@@ -22121,12 +22177,15 @@ async function runDeployment(params, hooks) {
|
|
|
22121
22177
|
}
|
|
22122
22178
|
}
|
|
22123
22179
|
const buildSeconds = () => Math.max(0, (Date.now() - startedAt) / 1e3);
|
|
22180
|
+
let monitorOutcomes = [];
|
|
22181
|
+
const monitorResults = () => monitorOutcomes.length > 0 ? { monitors: monitorOutcomes } : {};
|
|
22182
|
+
const monitorRunResult = () => monitorOutcomes.length > 0 ? { monitorOutcomes } : {};
|
|
22124
22183
|
const finishFailed = async (input2) => {
|
|
22125
22184
|
try {
|
|
22126
22185
|
await setStatus({
|
|
22127
22186
|
status: "failed",
|
|
22128
22187
|
error: input2.error.slice(0, 2e3),
|
|
22129
|
-
results: { plays: input2.outcomes },
|
|
22188
|
+
results: { plays: input2.outcomes, ...monitorResults() },
|
|
22130
22189
|
buildSeconds: buildSeconds(),
|
|
22131
22190
|
...input2.checkRunId ? { checkRunId: input2.checkRunId } : {}
|
|
22132
22191
|
});
|
|
@@ -22145,15 +22204,18 @@ async function runDeployment(params, hooks) {
|
|
|
22145
22204
|
return {
|
|
22146
22205
|
finalStatus: "failed",
|
|
22147
22206
|
outcomes: input2.outcomes,
|
|
22207
|
+
...monitorRunResult(),
|
|
22148
22208
|
checkRunId: input2.checkRunId
|
|
22149
22209
|
};
|
|
22150
22210
|
};
|
|
22151
22211
|
const finishSucceeded = async (outcomes, checkRun) => {
|
|
22152
|
-
const finalStatus = outcomes.some(
|
|
22212
|
+
const finalStatus = [...outcomes, ...monitorOutcomes].some(
|
|
22213
|
+
(outcome) => outcome.warning
|
|
22214
|
+
) ? "succeeded_with_warnings" : "succeeded";
|
|
22153
22215
|
try {
|
|
22154
22216
|
await setStatus({
|
|
22155
22217
|
status: finalStatus,
|
|
22156
|
-
results: { plays: outcomes },
|
|
22218
|
+
results: { plays: outcomes, ...monitorResults() },
|
|
22157
22219
|
buildSeconds: buildSeconds(),
|
|
22158
22220
|
...checkRun ? { checkRunId: checkRun.checkRunId } : {}
|
|
22159
22221
|
});
|
|
@@ -22170,11 +22232,12 @@ async function runDeployment(params, hooks) {
|
|
|
22170
22232
|
return {
|
|
22171
22233
|
finalStatus,
|
|
22172
22234
|
outcomes,
|
|
22235
|
+
...monitorRunResult(),
|
|
22173
22236
|
checkRunId: checkRun?.checkRunId
|
|
22174
22237
|
};
|
|
22175
22238
|
};
|
|
22176
22239
|
await mkdir4(hooks.workRoot, { recursive: true });
|
|
22177
|
-
const workDir = await mkdtemp(
|
|
22240
|
+
const workDir = await mkdtemp(join12(hooks.workRoot, "deploy-"));
|
|
22178
22241
|
const postCheck = async (postCheckOnce, input2) => {
|
|
22179
22242
|
let lastError;
|
|
22180
22243
|
for (let attempt = 0; ; attempt += 1) {
|
|
@@ -22250,7 +22313,7 @@ async function runDeployment(params, hooks) {
|
|
|
22250
22313
|
await writeCheck({
|
|
22251
22314
|
conclusion: "neutral",
|
|
22252
22315
|
title: `Deployment ${stopped}`,
|
|
22253
|
-
summary: "This deployment was stopped before it finished. Nothing from it went live."
|
|
22316
|
+
summary: monitorOutcomes.some((outcome) => outcome.jobId) ? "This deployment was stopped before it finished. Monitor jobs already submitted may have changed live resources; inspect the jobs in its receipt." : "This deployment was stopped before it finished. Nothing from it went live."
|
|
22254
22317
|
}).catch(() => void 0);
|
|
22255
22318
|
throw revocation;
|
|
22256
22319
|
});
|
|
@@ -22290,6 +22353,7 @@ async function runDeployment(params, hooks) {
|
|
|
22290
22353
|
status: "superseded",
|
|
22291
22354
|
error: `Branch ${deploymentBranch} is now at ${head?.slice(0, 12) ?? "<deleted>"}; this deployment's commit is no longer the head.`,
|
|
22292
22355
|
buildSeconds: buildSeconds(),
|
|
22356
|
+
...monitorOutcomes.length > 0 ? { results: monitorResults() } : {},
|
|
22293
22357
|
...head ? { observedHeadSha: head } : {}
|
|
22294
22358
|
});
|
|
22295
22359
|
return { finalStatus: "superseded", outcomes: [] };
|
|
@@ -22299,16 +22363,28 @@ async function runDeployment(params, hooks) {
|
|
|
22299
22363
|
if (superseded) return superseded;
|
|
22300
22364
|
}
|
|
22301
22365
|
const { repoRoot } = await source.open(workDir);
|
|
22302
|
-
const projectRoot = target.rootDirectory ?
|
|
22366
|
+
const projectRoot = target.rootDirectory ? join12(repoRoot, target.rootDirectory) : repoRoot;
|
|
22303
22367
|
const manifestFile = target.manifestPath || DEFAULT_MANIFEST_FILE;
|
|
22304
22368
|
let manifest;
|
|
22305
22369
|
let playFiles;
|
|
22370
|
+
let monitorEntries;
|
|
22306
22371
|
try {
|
|
22307
22372
|
manifest = await readDeeplineManifest(projectRoot, manifestFile);
|
|
22308
22373
|
playFiles = await discoverPlayFiles({
|
|
22309
22374
|
projectRoot,
|
|
22310
22375
|
globs: manifest.plays
|
|
22311
22376
|
});
|
|
22377
|
+
const discoveredMonitors = await readMonitorFiles({
|
|
22378
|
+
projectRoot,
|
|
22379
|
+
rootDirectory: target.rootDirectory,
|
|
22380
|
+
globs: manifest.monitors
|
|
22381
|
+
});
|
|
22382
|
+
if (!project && discoveredMonitors.length > 0) {
|
|
22383
|
+
throw new DeeplineManifestError(
|
|
22384
|
+
"Monitor Git deployment requires a linked repository. Deploy individual monitor files with deepline monitors deploy --file."
|
|
22385
|
+
);
|
|
22386
|
+
}
|
|
22387
|
+
monitorEntries = project && discoveredMonitors.length > 0 ? discoveredMonitors : void 0;
|
|
22312
22388
|
} catch (error) {
|
|
22313
22389
|
if (error instanceof DeeplineManifestError) {
|
|
22314
22390
|
return await failWithCheck({
|
|
@@ -22333,7 +22409,28 @@ async function runDeployment(params, hooks) {
|
|
|
22333
22409
|
});
|
|
22334
22410
|
}
|
|
22335
22411
|
}
|
|
22336
|
-
if (
|
|
22412
|
+
if (monitorEntries !== void 0) {
|
|
22413
|
+
const plan = await client2.monitors("plan", monitorEntries);
|
|
22414
|
+
monitorOutcomes = plan.monitors;
|
|
22415
|
+
const failed = monitorOutcomes.filter(
|
|
22416
|
+
(outcome) => outcome.status === "failed"
|
|
22417
|
+
);
|
|
22418
|
+
if (failed.length > 0) {
|
|
22419
|
+
return await failWithCheck({
|
|
22420
|
+
title: "Monitor validation failed",
|
|
22421
|
+
summary: monitorDeploymentSummary(monitorOutcomes),
|
|
22422
|
+
error: `${failed.length} monitor definition(s) failed validation.`,
|
|
22423
|
+
outcomes: [],
|
|
22424
|
+
annotations: failed.map(
|
|
22425
|
+
(outcome) => annotationForFailure({
|
|
22426
|
+
file: outcome.file,
|
|
22427
|
+
message: outcome.error ?? "Monitor validation failed."
|
|
22428
|
+
})
|
|
22429
|
+
)
|
|
22430
|
+
});
|
|
22431
|
+
}
|
|
22432
|
+
}
|
|
22433
|
+
if (playFiles.length === 0 && monitorOutcomes.length === 0) {
|
|
22337
22434
|
const checkRun2 = await postCheckOrNull({
|
|
22338
22435
|
conclusion: "neutral",
|
|
22339
22436
|
title: "No plays matched",
|
|
@@ -22360,7 +22457,7 @@ async function runDeployment(params, hooks) {
|
|
|
22360
22457
|
annotations.push(annotationForFailure({ file, message }));
|
|
22361
22458
|
};
|
|
22362
22459
|
for (const file of playFiles) {
|
|
22363
|
-
const entryFile =
|
|
22460
|
+
const entryFile = join12(projectRoot, file);
|
|
22364
22461
|
const result = await hooks.bundle(entryFile, {
|
|
22365
22462
|
sourceIdentityRoot: projectRoot
|
|
22366
22463
|
});
|
|
@@ -22466,7 +22563,7 @@ async function runDeployment(params, hooks) {
|
|
|
22466
22563
|
if (superseded) return superseded;
|
|
22467
22564
|
}
|
|
22468
22565
|
await setStatus({ status: "publishing" }).catch(() => void 0);
|
|
22469
|
-
const states = await client2.playsState(ordered.map((play) => play.name));
|
|
22566
|
+
const states = ordered.length > 0 ? await client2.playsState(ordered.map((play) => play.name)) : { plays: [] };
|
|
22470
22567
|
const stateByName = new Map(
|
|
22471
22568
|
states.plays.map((play) => [play.name, play])
|
|
22472
22569
|
);
|
|
@@ -22600,12 +22697,15 @@ async function runDeployment(params, hooks) {
|
|
|
22600
22697
|
).length;
|
|
22601
22698
|
const checkRun2 = await postCheckOrNull({
|
|
22602
22699
|
conclusion: "success",
|
|
22603
|
-
title: `${ordered.length} play${ordered.length === 1 ? "" : "s"} validated and registered (not deployed)`,
|
|
22700
|
+
title: monitorEntries !== void 0 ? `${ordered.length} play(s) validated and registered; ${monitorEntries.length} monitor(s) checked (not deployed)` : `${ordered.length} play${ordered.length === 1 ? "" : "s"} validated and registered (not deployed)`,
|
|
22604
22701
|
...annotations.length > 0 ? { annotations } : {},
|
|
22605
|
-
summary:
|
|
22606
|
-
|
|
22702
|
+
summary: [
|
|
22703
|
+
outcomes.map(
|
|
22704
|
+
(outcome) => `- \`${outcome.name}\`: ${outcome.status}${outcome.version !== void 0 ? ` (v${outcome.version})` : ""}${outcome.sdkUpdated ? " \u2014 SDK updated" : ""}${outcome.warning ? `
|
|
22607
22705
|
- :warning: ${outcome.warning}` : ""}`
|
|
22608
|
-
|
|
22706
|
+
).join("\n"),
|
|
22707
|
+
monitorDeploymentSummary(monitorOutcomes)
|
|
22708
|
+
].filter(Boolean).join("\n")
|
|
22609
22709
|
});
|
|
22610
22710
|
const result = await finishSucceeded(outcomes, checkRun2);
|
|
22611
22711
|
console.info("[deploy-worker] PR registration complete", {
|
|
@@ -22619,6 +22719,51 @@ async function runDeployment(params, hooks) {
|
|
|
22619
22719
|
const superseded = await supersedeIfHeadMoved();
|
|
22620
22720
|
if (superseded) return superseded;
|
|
22621
22721
|
}
|
|
22722
|
+
if (monitorEntries !== void 0) {
|
|
22723
|
+
monitorOutcomes = (await client2.monitors("apply", monitorEntries)).monitors;
|
|
22724
|
+
await setStatus({
|
|
22725
|
+
status: "publishing",
|
|
22726
|
+
results: { plays: outcomes, ...monitorResults() }
|
|
22727
|
+
});
|
|
22728
|
+
const deadline = Date.now() + 10 * 6e4;
|
|
22729
|
+
while (monitorOutcomes.some((outcome) => outcome.status === "applying")) {
|
|
22730
|
+
if (Date.now() >= deadline) {
|
|
22731
|
+
throw new RetryableDeploymentError(
|
|
22732
|
+
"Monitor jobs are still reconciling. Retrying this deployment will resume the same jobs."
|
|
22733
|
+
);
|
|
22734
|
+
}
|
|
22735
|
+
await new Promise((resolve22) => setTimeout(resolve22, 1e3));
|
|
22736
|
+
for (let index = 0; index < monitorOutcomes.length; index += 1) {
|
|
22737
|
+
const outcome = monitorOutcomes[index];
|
|
22738
|
+
if (outcome.status !== "applying") continue;
|
|
22739
|
+
if (!outcome.jobId) {
|
|
22740
|
+
throw new Error(
|
|
22741
|
+
`Monitor ${outcome.key} has no reconciliation job.`
|
|
22742
|
+
);
|
|
22743
|
+
}
|
|
22744
|
+
const result = await client2.monitorJob(outcome.jobId, outcome.key);
|
|
22745
|
+
const settled = result.monitors.find(
|
|
22746
|
+
(monitor) => monitor.key === outcome.key && monitor.jobId === outcome.jobId
|
|
22747
|
+
);
|
|
22748
|
+
if (!settled) {
|
|
22749
|
+
throw new Error(`Monitor job ${outcome.jobId} returned no result.`);
|
|
22750
|
+
}
|
|
22751
|
+
monitorOutcomes[index] = { ...outcome, ...settled };
|
|
22752
|
+
}
|
|
22753
|
+
}
|
|
22754
|
+
if (monitorOutcomes.some(
|
|
22755
|
+
(outcome) => outcome.status === "failed" || outcome.status === "planned"
|
|
22756
|
+
)) {
|
|
22757
|
+
return await failWithCheck({
|
|
22758
|
+
title: "Monitor deployment failed",
|
|
22759
|
+
summary: monitorDeploymentSummary(monitorOutcomes),
|
|
22760
|
+
error: "Some monitor changes failed. Applied changes remain live; inspect the reported jobs before retrying.",
|
|
22761
|
+
outcomes
|
|
22762
|
+
});
|
|
22763
|
+
}
|
|
22764
|
+
const superseded = await supersedeIfHeadMoved();
|
|
22765
|
+
if (superseded) return { ...superseded, ...monitorRunResult() };
|
|
22766
|
+
}
|
|
22622
22767
|
if (toPromote.length > 0) {
|
|
22623
22768
|
try {
|
|
22624
22769
|
const promotion = await client2.promote(toPromote);
|
|
@@ -22676,12 +22821,15 @@ async function runDeployment(params, hooks) {
|
|
|
22676
22821
|
}
|
|
22677
22822
|
const checkRun = await postCheckOrNull({
|
|
22678
22823
|
conclusion: "success",
|
|
22679
|
-
title: `Deployed ${outcomes.filter((o) => o.status === "promoted").length} play(s) (${outcomes.filter((o) => o.status === "unchanged").length} unchanged)`,
|
|
22824
|
+
title: `Deployed ${outcomes.filter((o) => o.status === "promoted").length} play(s) (${outcomes.filter((o) => o.status === "unchanged").length} unchanged)${monitorEntries !== void 0 ? `; ${monitorOutcomes.filter((outcome) => outcome.status === "applied").length} monitor(s) applied` : ""}`,
|
|
22680
22825
|
...annotations.length > 0 ? { annotations } : {},
|
|
22681
|
-
summary:
|
|
22682
|
-
(
|
|
22826
|
+
summary: [
|
|
22827
|
+
outcomes.map(
|
|
22828
|
+
(outcome) => `- \`${outcome.name}\`: ${outcome.status}${outcome.sdkUpdated ? " \u2014 SDK updated" : ""}${outcome.warning ? `
|
|
22683
22829
|
- :warning: ${outcome.warning}` : ""}`
|
|
22684
|
-
|
|
22830
|
+
).join("\n"),
|
|
22831
|
+
monitorDeploymentSummary(monitorOutcomes)
|
|
22832
|
+
].filter(Boolean).join("\n")
|
|
22685
22833
|
});
|
|
22686
22834
|
return await finishSucceeded(outcomes, checkRun);
|
|
22687
22835
|
} catch (error) {
|
|
@@ -22727,6 +22875,7 @@ async function runDeployment(params, hooks) {
|
|
|
22727
22875
|
await setStatus({
|
|
22728
22876
|
status: "failed",
|
|
22729
22877
|
error: message.slice(0, 2e3),
|
|
22878
|
+
...monitorOutcomes.length > 0 ? { results: monitorResults() } : {},
|
|
22730
22879
|
buildSeconds: buildSeconds(),
|
|
22731
22880
|
...checkRunId ? { checkRunId } : {}
|
|
22732
22881
|
}).catch(() => void 0);
|
|
@@ -22808,7 +22957,7 @@ async function handlePlaysDeploy(directory, options) {
|
|
|
22808
22957
|
...options.commit ? { commit: options.commit } : {}
|
|
22809
22958
|
});
|
|
22810
22959
|
const { bundleDeployPlayFile } = await loadPlayBundler();
|
|
22811
|
-
const workRoot = await mkdtemp2(
|
|
22960
|
+
const workRoot = await mkdtemp2(join13(tmpdir4(), "deepline-deploy-"));
|
|
22812
22961
|
const consoleInfo = console.info;
|
|
22813
22962
|
console.info = console.error;
|
|
22814
22963
|
try {
|
|
@@ -23210,10 +23359,22 @@ function renderDeploymentPlayLines(results) {
|
|
|
23210
23359
|
];
|
|
23211
23360
|
});
|
|
23212
23361
|
}
|
|
23362
|
+
function renderDeploymentMonitorLines(results) {
|
|
23363
|
+
const monitors = results?.monitors;
|
|
23364
|
+
if (!Array.isArray(monitors)) return [];
|
|
23365
|
+
return monitors.flatMap((monitor) => [
|
|
23366
|
+
`${monitor.key ?? "?"}${monitor.file ? ` (${monitor.file})` : ""} - ${monitor.status ?? "?"}`,
|
|
23367
|
+
...monitor.jobId ? [` job: ${monitor.jobId}`] : [],
|
|
23368
|
+
...monitor.credits != null ? [` Deepline credits: ${monitor.credits}`] : [],
|
|
23369
|
+
...monitor.error ? [` error: ${monitor.error}`] : [],
|
|
23370
|
+
...monitor.warning ? [` warning: ${monitor.warning}`] : []
|
|
23371
|
+
]);
|
|
23372
|
+
}
|
|
23213
23373
|
async function handleDeploymentGet(id, options) {
|
|
23214
23374
|
const { http } = getAuthedHttpClient();
|
|
23215
23375
|
const payload = await http.get(`/api/v2/deployments/${encodeURIComponent(id)}`);
|
|
23216
23376
|
const playLines = renderDeploymentPlayLines(payload.deployment.results);
|
|
23377
|
+
const monitorLines = renderDeploymentMonitorLines(payload.deployment.results);
|
|
23217
23378
|
const repository = payload.project?.repoFullName ?? payload.deployment.repoFullName;
|
|
23218
23379
|
printCommandEnvelope(
|
|
23219
23380
|
{
|
|
@@ -23225,7 +23386,8 @@ async function handleDeploymentGet(id, options) {
|
|
|
23225
23386
|
title: `deployment ${payload.deployment.id}${repository ? ` (${repository})` : ""}`,
|
|
23226
23387
|
lines: [renderDeployment(payload.deployment)]
|
|
23227
23388
|
},
|
|
23228
|
-
...playLines.length ? [{ title: "plays", lines: playLines }] : []
|
|
23389
|
+
...playLines.length ? [{ title: "plays", lines: playLines }] : [],
|
|
23390
|
+
...monitorLines.length ? [{ title: "monitors", lines: monitorLines }] : []
|
|
23229
23391
|
]
|
|
23230
23392
|
}
|
|
23231
23393
|
},
|
|
@@ -23431,7 +23593,7 @@ async function pathExistsIncludingSymlink(path) {
|
|
|
23431
23593
|
}
|
|
23432
23594
|
}
|
|
23433
23595
|
function runIdFileTempPath(destination) {
|
|
23434
|
-
return
|
|
23596
|
+
return join14(
|
|
23435
23597
|
dirname10(destination),
|
|
23436
23598
|
`.${basename3(destination)}.${process.pid}.${randomUUID4()}.tmp`
|
|
23437
23599
|
);
|
|
@@ -29327,7 +29489,7 @@ async function handlePlayRun(args, hooks) {
|
|
|
29327
29489
|
if (siblings.length > 0) {
|
|
29328
29490
|
console.error(`Did you mean one of these?`);
|
|
29329
29491
|
for (const s of siblings.slice(0, 5)) {
|
|
29330
|
-
console.error(` ${
|
|
29492
|
+
console.error(` ${join14(dir, s)}`);
|
|
29331
29493
|
}
|
|
29332
29494
|
}
|
|
29333
29495
|
} catch {
|
|
@@ -34044,7 +34206,7 @@ function expandAtFilePath(rawPath) {
|
|
|
34044
34206
|
return homedir6();
|
|
34045
34207
|
}
|
|
34046
34208
|
if (expanded.startsWith("~/") || expanded.startsWith("~\\")) {
|
|
34047
|
-
return
|
|
34209
|
+
return join15(homedir6(), expanded.slice(2));
|
|
34048
34210
|
}
|
|
34049
34211
|
return expanded;
|
|
34050
34212
|
}
|
|
@@ -34057,7 +34219,7 @@ async function readAtFileReference(value, argumentName, strip = true) {
|
|
|
34057
34219
|
throw new Error(`Invalid ${argumentName} value: empty @file path.`);
|
|
34058
34220
|
}
|
|
34059
34221
|
try {
|
|
34060
|
-
const text = await
|
|
34222
|
+
const text = await readFile5(filePath, "utf8");
|
|
34061
34223
|
const normalized = text.replace(/^\uFEFF/, "");
|
|
34062
34224
|
return strip ? normalized.trim() : normalized;
|
|
34063
34225
|
} catch (error) {
|
|
@@ -34408,7 +34570,7 @@ async function regularFileExists(path) {
|
|
|
34408
34570
|
}
|
|
34409
34571
|
}
|
|
34410
34572
|
async function readConfig(path) {
|
|
34411
|
-
const source = await
|
|
34573
|
+
const source = await readFile5(resolve13(path), "utf8");
|
|
34412
34574
|
let parsed;
|
|
34413
34575
|
try {
|
|
34414
34576
|
parsed = JSON.parse(source);
|
|
@@ -36426,7 +36588,7 @@ function sidecarEnrichRowsExportPath(outputPath) {
|
|
|
36426
36588
|
const resolved = resolve13(outputPath);
|
|
36427
36589
|
const ext = extname3(resolved) || ".csv";
|
|
36428
36590
|
const stem = basename4(resolved, ext);
|
|
36429
|
-
return
|
|
36591
|
+
return join15(dirname11(resolved), `${stem}.deepline-enrich-rows${ext}`);
|
|
36430
36592
|
}
|
|
36431
36593
|
function collectDatasetFollowUpCommands(value, state) {
|
|
36432
36594
|
if (state.depth > 12 || !value || typeof value !== "object" || state.commands.length >= 8) {
|
|
@@ -36507,10 +36669,10 @@ async function persistEnrichFailureReport(input2) {
|
|
|
36507
36669
|
if (input2.jobs.length === 0 && input2.issues.length === 0) {
|
|
36508
36670
|
return null;
|
|
36509
36671
|
}
|
|
36510
|
-
const stateDir =
|
|
36672
|
+
const stateDir = join15(homedir6(), ".local", "deepline", "runtime", "state");
|
|
36511
36673
|
const reportPrefix = input2.jobs.length > 0 ? "run-block-failures" : "enrich-issues";
|
|
36512
36674
|
await mkdir5(stateDir, { recursive: true });
|
|
36513
|
-
const reportPath =
|
|
36675
|
+
const reportPath = join15(
|
|
36514
36676
|
stateDir,
|
|
36515
36677
|
`${reportPrefix}-${Math.floor(Date.now() / 1e3)}-${process.pid}.json`
|
|
36516
36678
|
);
|
|
@@ -37439,9 +37601,9 @@ function registerEnrichCommand(program) {
|
|
|
37439
37601
|
sdkEnrichTelemetryCompleted = true;
|
|
37440
37602
|
await completeSdkEnrichTelemetry(sdkEnrichTelemetry, input2);
|
|
37441
37603
|
};
|
|
37442
|
-
const tempDir = await mkdtemp3(
|
|
37604
|
+
const tempDir = await mkdtemp3(join15(tmpdir5(), "deepline-enrich-play-"));
|
|
37443
37605
|
await emitSdkEnrichTelemetry(sdkEnrichTelemetry, "enrich_started");
|
|
37444
|
-
const tempPlay =
|
|
37606
|
+
const tempPlay = join15(tempDir, "deepline-enrich.play.ts");
|
|
37445
37607
|
let inPlaceTempDir = null;
|
|
37446
37608
|
let inPlaceTempOutputPath = null;
|
|
37447
37609
|
const inPlaceFinalOutputPath = options.inPlace ? resolve13(inputCsv) : null;
|
|
@@ -37469,12 +37631,12 @@ function registerEnrichCommand(program) {
|
|
|
37469
37631
|
await rm3(inPlaceTempDir, { recursive: true, force: true });
|
|
37470
37632
|
}
|
|
37471
37633
|
inPlaceTempDir = await mkdtemp3(
|
|
37472
|
-
|
|
37634
|
+
join15(
|
|
37473
37635
|
dirname11(inPlaceCommitOutputPath ?? resolve13(inputCsv)),
|
|
37474
37636
|
".deepline-enrich-in-place-"
|
|
37475
37637
|
)
|
|
37476
37638
|
);
|
|
37477
|
-
inPlaceTempOutputPath =
|
|
37639
|
+
inPlaceTempOutputPath = join15(inPlaceTempDir, "output.csv");
|
|
37478
37640
|
await copyFile(resolve13(inputCsv), inPlaceTempOutputPath);
|
|
37479
37641
|
outputPath = inPlaceTempOutputPath;
|
|
37480
37642
|
};
|
|
@@ -37741,7 +37903,7 @@ async function handleFeedback(text, options) {
|
|
|
37741
37903
|
{ json: options.json }
|
|
37742
37904
|
);
|
|
37743
37905
|
}
|
|
37744
|
-
function resolveFeedbackText(text, file,
|
|
37906
|
+
function resolveFeedbackText(text, file, readFile8 = (path) => readFileSync10(path, "utf8")) {
|
|
37745
37907
|
if (text !== void 0 && file !== void 0) {
|
|
37746
37908
|
throw new Error(
|
|
37747
37909
|
"Pass feedback text positionally or with --file, not both."
|
|
@@ -37750,7 +37912,7 @@ function resolveFeedbackText(text, file, readFile7 = (path) => readFileSync10(pa
|
|
|
37750
37912
|
let value;
|
|
37751
37913
|
if (file !== void 0) {
|
|
37752
37914
|
try {
|
|
37753
|
-
value =
|
|
37915
|
+
value = readFile8(file === "-" ? 0 : file);
|
|
37754
37916
|
} catch (error) {
|
|
37755
37917
|
throw new Error(
|
|
37756
37918
|
`Could not read feedback ${file === "-" ? "from stdin" : `file ${file}`}: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -37759,7 +37921,7 @@ function resolveFeedbackText(text, file, readFile7 = (path) => readFileSync10(pa
|
|
|
37759
37921
|
} else if (text !== void 0) {
|
|
37760
37922
|
value = text;
|
|
37761
37923
|
} else if (!process.stdin.isTTY) {
|
|
37762
|
-
value =
|
|
37924
|
+
value = readFile8(0);
|
|
37763
37925
|
} else {
|
|
37764
37926
|
throw new Error(
|
|
37765
37927
|
"Feedback text is required. Pass it positionally, use --file <path>, or pipe stdin."
|
|
@@ -37818,7 +37980,7 @@ import {
|
|
|
37818
37980
|
writeFileSync as writeFileSync11
|
|
37819
37981
|
} from "fs";
|
|
37820
37982
|
import { homedir as homedir7, platform } from "os";
|
|
37821
|
-
import { basename as basename5, dirname as dirname12, join as
|
|
37983
|
+
import { basename as basename5, dirname as dirname12, join as join16, resolve as resolve14 } from "path";
|
|
37822
37984
|
import { gzipSync } from "zlib";
|
|
37823
37985
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
37824
37986
|
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
@@ -37844,10 +38006,10 @@ function detectShellContext() {
|
|
|
37844
38006
|
};
|
|
37845
38007
|
}
|
|
37846
38008
|
function claudeProjectsRoot() {
|
|
37847
|
-
return
|
|
38009
|
+
return join16(homeDir(), ".claude", "projects");
|
|
37848
38010
|
}
|
|
37849
38011
|
function codexSessionsRoot() {
|
|
37850
|
-
return
|
|
38012
|
+
return join16(homeDir(), ".codex", "sessions");
|
|
37851
38013
|
}
|
|
37852
38014
|
function listClaudeSessionFiles() {
|
|
37853
38015
|
const root = claudeProjectsRoot();
|
|
@@ -37855,10 +38017,10 @@ function listClaudeSessionFiles() {
|
|
|
37855
38017
|
const projectDirs = readDirectoryNames(root);
|
|
37856
38018
|
const files = [];
|
|
37857
38019
|
for (const projectDir of projectDirs) {
|
|
37858
|
-
const fullProjectDir =
|
|
38020
|
+
const fullProjectDir = join16(root, projectDir);
|
|
37859
38021
|
for (const fileName of readDirectoryNames(fullProjectDir)) {
|
|
37860
38022
|
if (fileName.endsWith(".jsonl")) {
|
|
37861
|
-
const filePath =
|
|
38023
|
+
const filePath = join16(fullProjectDir, fileName);
|
|
37862
38024
|
const sessionId = sessionIdFromClaudeFilePath(filePath);
|
|
37863
38025
|
const stat5 = statIfReadable(filePath);
|
|
37864
38026
|
if (sessionId && stat5) {
|
|
@@ -37915,7 +38077,7 @@ function listJsonlFilesRecursive(root, maxDepth) {
|
|
|
37915
38077
|
return;
|
|
37916
38078
|
}
|
|
37917
38079
|
for (const entry of entries) {
|
|
37918
|
-
const fullPath =
|
|
38080
|
+
const fullPath = join16(dir, entry.name);
|
|
37919
38081
|
if (entry.isDirectory()) {
|
|
37920
38082
|
visit(fullPath, depth + 1);
|
|
37921
38083
|
} else if (entry.isFile() && entry.name.endsWith(".jsonl")) {
|
|
@@ -38354,8 +38516,8 @@ function loadViewerAssets() {
|
|
|
38354
38516
|
const cliEntry = process.argv[1]?.trim() ? realpathSync3(resolve14(process.argv[1])) : null;
|
|
38355
38517
|
const candidateRoots2 = [
|
|
38356
38518
|
...cliEntry ? [
|
|
38357
|
-
|
|
38358
|
-
|
|
38519
|
+
join16(dirname12(dirname12(cliEntry)), "viewer"),
|
|
38520
|
+
join16(
|
|
38359
38521
|
dirname12(dirname12(dirname12(cliEntry))),
|
|
38360
38522
|
"src",
|
|
38361
38523
|
"lib",
|
|
@@ -38363,12 +38525,12 @@ function loadViewerAssets() {
|
|
|
38363
38525
|
"viewer"
|
|
38364
38526
|
)
|
|
38365
38527
|
] : [],
|
|
38366
|
-
|
|
38528
|
+
join16(process.cwd(), "packages", "sdk", "assets", "viewer")
|
|
38367
38529
|
];
|
|
38368
38530
|
for (const root of candidateRoots2) {
|
|
38369
38531
|
try {
|
|
38370
|
-
const cssPath =
|
|
38371
|
-
const jsPath =
|
|
38532
|
+
const cssPath = join16(root, "viewer.css");
|
|
38533
|
+
const jsPath = join16(root, "viewer.js");
|
|
38372
38534
|
if (!existsSync10(cssPath) || !existsSync10(jsPath)) continue;
|
|
38373
38535
|
return {
|
|
38374
38536
|
css: readFileSync11(cssPath, "utf8"),
|
|
@@ -38400,9 +38562,9 @@ async function handleSessionsRender(options) {
|
|
|
38400
38562
|
});
|
|
38401
38563
|
let outputPath = options.output ? resolve14(options.output) : "";
|
|
38402
38564
|
if (!outputPath) {
|
|
38403
|
-
const outputDir =
|
|
38565
|
+
const outputDir = join16(process.cwd(), "deepline", "data");
|
|
38404
38566
|
mkdirSync8(outputDir, { recursive: true });
|
|
38405
|
-
outputPath =
|
|
38567
|
+
outputPath = join16(
|
|
38406
38568
|
outputDir,
|
|
38407
38569
|
targets.length > 1 ? "session-viewer.html" : `session-${targets[0]?.sessionId}.html`
|
|
38408
38570
|
);
|
|
@@ -39514,7 +39676,7 @@ function parseJsonObjectArg(raw, argLabel) {
|
|
|
39514
39676
|
return parsed;
|
|
39515
39677
|
}
|
|
39516
39678
|
function resolveMonitorJsonBody(input2) {
|
|
39517
|
-
const
|
|
39679
|
+
const readFile8 = input2.readFile ?? ((path) => readFileSync12(path, "utf-8"));
|
|
39518
39680
|
const readStdin = input2.readStdin ?? (() => readFileSync12(0, "utf-8"));
|
|
39519
39681
|
if (input2.positional !== void 0 && input2.file !== void 0) {
|
|
39520
39682
|
throw new MonitorsUsageError(
|
|
@@ -39530,7 +39692,7 @@ function resolveMonitorJsonBody(input2) {
|
|
|
39530
39692
|
}
|
|
39531
39693
|
let raw;
|
|
39532
39694
|
try {
|
|
39533
|
-
raw =
|
|
39695
|
+
raw = readFile8(input2.file);
|
|
39534
39696
|
} catch (error) {
|
|
39535
39697
|
throw new MonitorsUsageError(
|
|
39536
39698
|
`Could not read --file ${input2.file}: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -42600,10 +42762,10 @@ import {
|
|
|
42600
42762
|
unlinkSync,
|
|
42601
42763
|
writeFileSync as writeFileSync13
|
|
42602
42764
|
} from "fs";
|
|
42603
|
-
import { join as
|
|
42765
|
+
import { join as join17 } from "path";
|
|
42604
42766
|
function pendingOrgCreatePath(baseUrl, accountId, sourceOrgId, name) {
|
|
42605
42767
|
const intent = createHash5("sha256").update(accountId).update("\0").update(sourceOrgId).update("\0").update(name).digest("hex");
|
|
42606
|
-
return
|
|
42768
|
+
return join17(sdkCliStateDirPath(baseUrl), `pending-org-create-${intent}.json`);
|
|
42607
42769
|
}
|
|
42608
42770
|
function readPendingOrgCreate(path, accountId, sourceOrgId, name) {
|
|
42609
42771
|
let value;
|
|
@@ -43486,7 +43648,7 @@ Deprecated:
|
|
|
43486
43648
|
|
|
43487
43649
|
// src/cli/commands/secrets.ts
|
|
43488
43650
|
import { stdin as input, stdout as output } from "process";
|
|
43489
|
-
import { readFile as
|
|
43651
|
+
import { readFile as readFile6 } from "fs/promises";
|
|
43490
43652
|
var hiddenInputBuffer = "";
|
|
43491
43653
|
function normalizeSecretName(value) {
|
|
43492
43654
|
const normalized = value.trim().toUpperCase();
|
|
@@ -43659,7 +43821,7 @@ async function readSecretValueFromOptions(options) {
|
|
|
43659
43821
|
}
|
|
43660
43822
|
value = envValue;
|
|
43661
43823
|
} else {
|
|
43662
|
-
value = trimOneTerminalNewline(await
|
|
43824
|
+
value = trimOneTerminalNewline(await readFile6(options.fromFile, "utf8"));
|
|
43663
43825
|
}
|
|
43664
43826
|
if (!value) throw new Error("Secret value is required.");
|
|
43665
43827
|
return value;
|
|
@@ -43870,7 +44032,7 @@ import {
|
|
|
43870
44032
|
writeFileSync as writeFileSync16
|
|
43871
44033
|
} from "fs";
|
|
43872
44034
|
import { homedir as homedir10 } from "os";
|
|
43873
|
-
import { dirname as dirname16, join as
|
|
44035
|
+
import { dirname as dirname16, join as join21, resolve as resolve17 } from "path";
|
|
43874
44036
|
|
|
43875
44037
|
// src/cli/installation-lifecycle.ts
|
|
43876
44038
|
import {
|
|
@@ -43880,7 +44042,7 @@ import {
|
|
|
43880
44042
|
realpathSync as realpathSync4,
|
|
43881
44043
|
rmSync as rmSync4
|
|
43882
44044
|
} from "fs";
|
|
43883
|
-
import { basename as basename6, dirname as dirname13, join as
|
|
44045
|
+
import { basename as basename6, dirname as dirname13, join as join18, relative as relative6, resolve as resolve16 } from "path";
|
|
43884
44046
|
var nodeFileSystem = {
|
|
43885
44047
|
exists: existsSync12,
|
|
43886
44048
|
isSymbolicLink(path) {
|
|
@@ -43936,25 +44098,25 @@ var CliInstallation = class _CliInstallation {
|
|
|
43936
44098
|
});
|
|
43937
44099
|
}
|
|
43938
44100
|
static isNpmPackagePath(path) {
|
|
43939
|
-
return path?.includes(`${
|
|
44101
|
+
return path?.includes(`${join18("node_modules", "deepline")}`) ?? false;
|
|
43940
44102
|
}
|
|
43941
44103
|
launcher(path) {
|
|
43942
44104
|
return inspectLauncher(path, this.input.fileSystem);
|
|
43943
44105
|
}
|
|
43944
44106
|
retiredArtifacts() {
|
|
43945
|
-
const hostDir =
|
|
44107
|
+
const hostDir = join18(
|
|
43946
44108
|
this.input.home,
|
|
43947
44109
|
".local",
|
|
43948
44110
|
"deepline",
|
|
43949
44111
|
this.input.baseUrlSlug
|
|
43950
44112
|
);
|
|
43951
|
-
const legacyLauncherPath =
|
|
44113
|
+
const legacyLauncherPath = join18(
|
|
43952
44114
|
this.input.home,
|
|
43953
44115
|
".local",
|
|
43954
44116
|
"bin",
|
|
43955
44117
|
"deepline"
|
|
43956
44118
|
);
|
|
43957
|
-
const installerCommandPath = this.input.fileSystem.read(
|
|
44119
|
+
const installerCommandPath = this.input.fileSystem.read(join18(hostDir, "sdk", ".command-path")).trim();
|
|
43958
44120
|
const ownedInstallerCommand = isOwnedInstallerCommandPath({
|
|
43959
44121
|
hostDir,
|
|
43960
44122
|
commandPath: installerCommandPath
|
|
@@ -43962,16 +44124,16 @@ var CliInstallation = class _CliInstallation {
|
|
|
43962
44124
|
const legacyLauncher = this.launcher(legacyLauncherPath);
|
|
43963
44125
|
const candidates = [
|
|
43964
44126
|
...legacyLauncher.ownership === "installer_legacy" ? [legacyLauncherPath] : [],
|
|
43965
|
-
|
|
43966
|
-
|
|
43967
|
-
|
|
43968
|
-
|
|
43969
|
-
|
|
43970
|
-
|
|
43971
|
-
|
|
44127
|
+
join18(this.input.home, ".local", "bin", "deepline-real"),
|
|
44128
|
+
join18(hostDir, "bin", "deepline"),
|
|
44129
|
+
join18(hostDir, "bin", "deepline-real"),
|
|
44130
|
+
join18(hostDir, "cli", ".install-method"),
|
|
44131
|
+
join18(hostDir, "cli", ".version"),
|
|
44132
|
+
join18(hostDir, "sdk", ".install-method"),
|
|
44133
|
+
join18(hostDir, "sdk", ".command-path"),
|
|
43972
44134
|
...ownedInstallerCommand ? [
|
|
43973
44135
|
installerCommandPath,
|
|
43974
|
-
|
|
44136
|
+
join18(dirname13(installerCommandPath), "deepline-sdk")
|
|
43975
44137
|
] : []
|
|
43976
44138
|
];
|
|
43977
44139
|
return {
|
|
@@ -44004,7 +44166,7 @@ function isOwnedInstallerCommandPath(input2) {
|
|
|
44004
44166
|
import { spawn as spawn3 } from "child_process";
|
|
44005
44167
|
import { existsSync as existsSync14, mkdirSync as mkdirSync11, readFileSync as readFileSync16, writeFileSync as writeFileSync15 } from "fs";
|
|
44006
44168
|
import { homedir as homedir9 } from "os";
|
|
44007
|
-
import { dirname as dirname15, join as
|
|
44169
|
+
import { dirname as dirname15, join as join20 } from "path";
|
|
44008
44170
|
|
|
44009
44171
|
// contracts/install-commands.json
|
|
44010
44172
|
var install_commands_default = {
|
|
@@ -44131,7 +44293,7 @@ import {
|
|
|
44131
44293
|
unlinkSync as unlinkSync2,
|
|
44132
44294
|
writeFileSync as writeFileSync14
|
|
44133
44295
|
} from "fs";
|
|
44134
|
-
import { dirname as dirname14, join as
|
|
44296
|
+
import { dirname as dirname14, join as join19 } from "path";
|
|
44135
44297
|
|
|
44136
44298
|
// src/cli/windows-arg-escape.ts
|
|
44137
44299
|
var CMD_META_CHARS = /([()\][%!^"`<>&|;, *?])/g;
|
|
@@ -44496,7 +44658,7 @@ function shouldSkipSkillsSync() {
|
|
|
44496
44658
|
return value === "1" || value === "true" || value === "yes" || value === "on";
|
|
44497
44659
|
}
|
|
44498
44660
|
function unavailableSkillsNoticePath(baseUrl) {
|
|
44499
|
-
return
|
|
44661
|
+
return join19(sdkCliStateDirPath(baseUrl), "skills-sync-unavailable-version");
|
|
44500
44662
|
}
|
|
44501
44663
|
var SKILLS_SYNC_IN_PROGRESS_TTL_MS = 10 * 60 * 1e3;
|
|
44502
44664
|
var SKILLS_SYNC_IN_PROGRESS_PID_CAP_MS = 6 * 60 * 60 * 1e3;
|
|
@@ -44506,21 +44668,21 @@ function sortedLeaseAgents(agents) {
|
|
|
44506
44668
|
return [...new Set(expanded)].sort((a, b) => a.localeCompare(b));
|
|
44507
44669
|
}
|
|
44508
44670
|
function inProgressSkillsSyncPath(baseUrl, agent) {
|
|
44509
|
-
return
|
|
44671
|
+
return join19(
|
|
44510
44672
|
sdkCliStateDirPath(baseUrl),
|
|
44511
44673
|
`skills-sync-in-progress-${agentLeaseSegment(agent)}`
|
|
44512
44674
|
);
|
|
44513
44675
|
}
|
|
44514
44676
|
function readInProgressSkillsSyncLeaseFromDir(dir) {
|
|
44515
|
-
const claim = readMarkedSkillsSyncVersion(
|
|
44677
|
+
const claim = readMarkedSkillsSyncVersion(join19(dir, "claim"));
|
|
44516
44678
|
const [version = "", startedAt = ""] = claim.split(" ");
|
|
44517
|
-
const pidRaw = readMarkedSkillsSyncVersion(
|
|
44679
|
+
const pidRaw = readMarkedSkillsSyncVersion(join19(dir, "pid"));
|
|
44518
44680
|
return {
|
|
44519
44681
|
claimToken: version && startedAt ? `${version} ${startedAt}` : "",
|
|
44520
44682
|
version,
|
|
44521
44683
|
startedAt: Number(startedAt),
|
|
44522
44684
|
pid: /^\d+$/.test(pidRaw) ? Number(pidRaw) : null,
|
|
44523
|
-
owner: readMarkedSkillsSyncVersion(
|
|
44685
|
+
owner: readMarkedSkillsSyncVersion(join19(dir, "owner"))
|
|
44524
44686
|
};
|
|
44525
44687
|
}
|
|
44526
44688
|
function readInProgressSkillsSyncLease(baseUrl, agent) {
|
|
@@ -44578,9 +44740,9 @@ function claimOneInProgressSkillsSync(baseUrl, remoteVersion, agent, owner) {
|
|
|
44578
44740
|
const claimToken = `${remoteVersion} ${Date.now()}`;
|
|
44579
44741
|
const staging = `${dir}.staging-${process.pid}-${Date.now()}`;
|
|
44580
44742
|
mkdirSync10(staging);
|
|
44581
|
-
writeFileSync14(
|
|
44743
|
+
writeFileSync14(join19(staging, "claim"), `${claimToken}
|
|
44582
44744
|
`, "utf-8");
|
|
44583
|
-
writeFileSync14(
|
|
44745
|
+
writeFileSync14(join19(staging, "owner"), `${owner}
|
|
44584
44746
|
`, "utf-8");
|
|
44585
44747
|
try {
|
|
44586
44748
|
renameSync(staging, dir);
|
|
@@ -44654,7 +44816,7 @@ function recordOwnPidOnInProgressSkillsSync(baseUrl, leases) {
|
|
|
44654
44816
|
if (!lease.claimToken) continue;
|
|
44655
44817
|
try {
|
|
44656
44818
|
writeFileSync14(
|
|
44657
|
-
|
|
44819
|
+
join19(inProgressSkillsSyncPath(baseUrl, agent), "pid"),
|
|
44658
44820
|
`${process.pid}
|
|
44659
44821
|
`,
|
|
44660
44822
|
"utf-8"
|
|
@@ -44723,7 +44885,7 @@ function skillsInstallLeasePath(baseUrl, agents) {
|
|
|
44723
44885
|
return sortedLeaseAgents(agents).map((agent) => inProgressSkillsSyncPath(baseUrl, agent)).join(", ");
|
|
44724
44886
|
}
|
|
44725
44887
|
function deferredSkillsNoticePath(baseUrl, agents) {
|
|
44726
|
-
return
|
|
44888
|
+
return join19(
|
|
44727
44889
|
sdkCliStateDirPath(baseUrl),
|
|
44728
44890
|
`skills-sync-notice-${sortedLeaseAgents(agents).map(agentLeaseSegment).join("-")}`
|
|
44729
44891
|
);
|
|
@@ -44774,7 +44936,7 @@ function spawnDetachedSkillsSyncChild(argv, onSpawnError) {
|
|
|
44774
44936
|
child.unref();
|
|
44775
44937
|
}
|
|
44776
44938
|
function failedSkillsSyncPath(baseUrl, agents) {
|
|
44777
|
-
return
|
|
44939
|
+
return join19(
|
|
44778
44940
|
sdkCliStateDirPath(baseUrl),
|
|
44779
44941
|
`skills-sync-failed-${sortedLeaseAgents(agents).map(agentLeaseSegment).join("-")}-version`
|
|
44780
44942
|
);
|
|
@@ -44901,7 +45063,7 @@ function safeSkillFilePath(value) {
|
|
|
44901
45063
|
}
|
|
44902
45064
|
function installedSkillFiles(root, prefix = "") {
|
|
44903
45065
|
const files = [];
|
|
44904
|
-
for (const entry of readdirSync4(
|
|
45066
|
+
for (const entry of readdirSync4(join19(root, prefix), {
|
|
44905
45067
|
withFileTypes: true
|
|
44906
45068
|
})) {
|
|
44907
45069
|
const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
@@ -45021,11 +45183,11 @@ async function verifyDefaultAgentSkillsInstall(baseUrl, remoteVersion, skillName
|
|
|
45021
45183
|
controller.abort();
|
|
45022
45184
|
}
|
|
45023
45185
|
const home = homedir8();
|
|
45024
|
-
const claudeConfigDir = process.env.CLAUDE_CONFIG_DIR?.trim() ||
|
|
45186
|
+
const claudeConfigDir = process.env.CLAUDE_CONFIG_DIR?.trim() || join19(home, ".claude");
|
|
45025
45187
|
for (const [name, { files }] of published) {
|
|
45026
45188
|
for (const root of [
|
|
45027
|
-
|
|
45028
|
-
|
|
45189
|
+
join19(home, ".agents", "skills", name),
|
|
45190
|
+
join19(claudeConfigDir, "skills", name)
|
|
45029
45191
|
]) {
|
|
45030
45192
|
const installed = installedSkillFiles(root);
|
|
45031
45193
|
if (installed.length !== files.length || installed.some((file, index2) => file !== files[index2])) {
|
|
@@ -45033,7 +45195,7 @@ async function verifyDefaultAgentSkillsInstall(baseUrl, remoteVersion, skillName
|
|
|
45033
45195
|
}
|
|
45034
45196
|
for (const file of files) {
|
|
45035
45197
|
const publishedContent = expected.get(`${name}/${file}`);
|
|
45036
|
-
if (!publishedContent || !readFileSync15(
|
|
45198
|
+
if (!publishedContent || !readFileSync15(join19(root, file)).equals(publishedContent)) {
|
|
45037
45199
|
throw new Error(`installed content differs for ${name}/${file}`);
|
|
45038
45200
|
}
|
|
45039
45201
|
}
|
|
@@ -45087,7 +45249,7 @@ function probeInstallers(timeoutMs) {
|
|
|
45087
45249
|
};
|
|
45088
45250
|
}
|
|
45089
45251
|
function noInstallerProbePath(baseUrl) {
|
|
45090
|
-
return
|
|
45252
|
+
return join19(
|
|
45091
45253
|
sdkCliStateDirPath(baseUrl),
|
|
45092
45254
|
"skills-sync-no-installer-unknown.json"
|
|
45093
45255
|
);
|
|
@@ -45556,13 +45718,13 @@ function detectSkillsAgents(input2) {
|
|
|
45556
45718
|
];
|
|
45557
45719
|
const detected = AGENT_MARKERS.filter(
|
|
45558
45720
|
(marker) => roots.some(
|
|
45559
|
-
(root) => marker.paths.some((path) => existsSync14(
|
|
45721
|
+
(root) => marker.paths.some((path) => existsSync14(join20(root, path)))
|
|
45560
45722
|
)
|
|
45561
45723
|
).map((marker) => marker.agent);
|
|
45562
45724
|
return detected.length > 0 ? detected : ["*"];
|
|
45563
45725
|
}
|
|
45564
45726
|
function skillsStatePathForScope(baseUrl, scope, root) {
|
|
45565
|
-
return scope === "local" && root ?
|
|
45727
|
+
return scope === "local" && root ? join20(root, ".deepline", "setup", "skills.json") : join20(sdkCliStateDirPath(baseUrl), "skills-install.json");
|
|
45566
45728
|
}
|
|
45567
45729
|
function buildSkillsPlan(input2) {
|
|
45568
45730
|
const scopeArgs = input2.scope === "global" ? ["--global"] : [];
|
|
@@ -46112,7 +46274,7 @@ function buildPendingAuthorizationOutput(input2) {
|
|
|
46112
46274
|
};
|
|
46113
46275
|
}
|
|
46114
46276
|
function setupStatePath(baseUrl, scope, root) {
|
|
46115
|
-
return scope === "local" && root ?
|
|
46277
|
+
return scope === "local" && root ? join21(root, ".deepline", "setup", "state.json") : join21(sdkCliStateDirPath(baseUrl), "setup.json");
|
|
46116
46278
|
}
|
|
46117
46279
|
async function captureStdout2(run) {
|
|
46118
46280
|
let stdout = "";
|
|
@@ -46193,7 +46355,7 @@ function resolvePersistentGlobalCommand(dependencies = {}) {
|
|
|
46193
46355
|
if (prefix.status !== 0) return null;
|
|
46194
46356
|
const root = String(prefix.stdout ?? "").trim();
|
|
46195
46357
|
if (!root) return null;
|
|
46196
|
-
const candidates = platform3 === "win32" ? [
|
|
46358
|
+
const candidates = platform3 === "win32" ? [join21(root, "deepline.cmd"), join21(root, "deepline")] : [join21(root, "bin", "deepline")];
|
|
46197
46359
|
return candidates.find((candidate) => pathExists(candidate)) ?? null;
|
|
46198
46360
|
}
|
|
46199
46361
|
function inspectGlobalCliAvailability(input2) {
|
|
@@ -46219,7 +46381,7 @@ function isKnownDeeplineCommand(path) {
|
|
|
46219
46381
|
} catch {
|
|
46220
46382
|
}
|
|
46221
46383
|
if (entrypoint && resolvedPath === entrypoint) return true;
|
|
46222
|
-
if (resolvedPath.includes(`${
|
|
46384
|
+
if (resolvedPath.includes(`${join21("node_modules", "deepline")}`)) return true;
|
|
46223
46385
|
const content = safeRead(path);
|
|
46224
46386
|
return content.includes("node_modules/deepline") || content.includes("node_modules\\deepline") || content.includes("DEEPLINE_CONFIG_SCOPE") || content.includes("deepline-real");
|
|
46225
46387
|
}
|
|
@@ -46229,7 +46391,7 @@ function inspectPathConflict() {
|
|
|
46229
46391
|
try {
|
|
46230
46392
|
if (lstatSync2(commandPath).isSymbolicLink()) {
|
|
46231
46393
|
const target = realpathSync5(commandPath);
|
|
46232
|
-
if (target.includes(`${
|
|
46394
|
+
if (target.includes(`${join21("node_modules", "deepline")}`)) return null;
|
|
46233
46395
|
}
|
|
46234
46396
|
} catch {
|
|
46235
46397
|
}
|
|
@@ -46278,7 +46440,7 @@ function failSetupPhase(phases, phase, code) {
|
|
|
46278
46440
|
phases[phase] = { status: "failed", code };
|
|
46279
46441
|
}
|
|
46280
46442
|
function rollbackCommand(scope, root) {
|
|
46281
|
-
const prefix = scope === "local" && root ? ` --prefix ${JSON.stringify(
|
|
46443
|
+
const prefix = scope === "local" && root ? ` --prefix ${JSON.stringify(join21(root, ".deepline", "runtime"))}` : "";
|
|
46282
46444
|
const allowScriptsFlag = npmSupportsAllowScripts(readNpmVersion(process.env)) ? " --allow-scripts=esbuild" : "";
|
|
46283
46445
|
return `npm install -g${prefix} --no-audit --no-fund --include=optional${allowScriptsFlag} deepline@${SDK_VERSION}`;
|
|
46284
46446
|
}
|
|
@@ -46373,7 +46535,7 @@ function buildDoctorAssessment(input2) {
|
|
|
46373
46535
|
const pathGlobalCli = globalCli?.path ?? null;
|
|
46374
46536
|
const cliPath = input2.scope === "global" ? pathGlobalCli : runningCliPath;
|
|
46375
46537
|
const cliScopeOk = input2.scope === "global" ? Boolean(pathGlobalCli) : Boolean(
|
|
46376
|
-
input2.root && runningCliPath?.includes(
|
|
46538
|
+
input2.root && runningCliPath?.includes(join21(input2.root, ".deepline", "runtime"))
|
|
46377
46539
|
);
|
|
46378
46540
|
const checks = {
|
|
46379
46541
|
cli: {
|
|
@@ -47000,7 +47162,7 @@ import {
|
|
|
47000
47162
|
writeFileSync as writeFileSync17
|
|
47001
47163
|
} from "fs";
|
|
47002
47164
|
import { homedir as homedir11 } from "os";
|
|
47003
|
-
import { dirname as dirname17, join as
|
|
47165
|
+
import { dirname as dirname17, join as join22 } from "path";
|
|
47004
47166
|
var UPDATE_PREFERENCES_SCHEMA_VERSION = 1;
|
|
47005
47167
|
var CLI_UPDATE_MESSAGES = [
|
|
47006
47168
|
{
|
|
@@ -47029,7 +47191,7 @@ function unreadablePreferences(path, error) {
|
|
|
47029
47191
|
};
|
|
47030
47192
|
}
|
|
47031
47193
|
function cliUpdatePreferencesPath(homeDir2 = homedir11()) {
|
|
47032
|
-
return
|
|
47194
|
+
return join22(
|
|
47033
47195
|
homeDir2,
|
|
47034
47196
|
".local",
|
|
47035
47197
|
"deepline",
|
|
@@ -47131,7 +47293,7 @@ import {
|
|
|
47131
47293
|
basename as basename7,
|
|
47132
47294
|
dirname as dirname18,
|
|
47133
47295
|
isAbsolute as isAbsolute7,
|
|
47134
|
-
join as
|
|
47296
|
+
join as join24,
|
|
47135
47297
|
relative as relative8,
|
|
47136
47298
|
resolve as resolve19
|
|
47137
47299
|
} from "path";
|
|
@@ -47139,7 +47301,7 @@ import {
|
|
|
47139
47301
|
// src/cli/install-integrity.ts
|
|
47140
47302
|
import { createRequire } from "module";
|
|
47141
47303
|
import { existsSync as existsSync17, readFileSync as readFileSync19, statSync as statSync5 } from "fs";
|
|
47142
|
-
import { isAbsolute as isAbsolute6, join as
|
|
47304
|
+
import { isAbsolute as isAbsolute6, join as join23, relative as relative7, resolve as resolve18 } from "path";
|
|
47143
47305
|
var SDK_SIDECAR_CRITICAL_PACKAGE_FILES = [
|
|
47144
47306
|
"dist/cli/index.mjs",
|
|
47145
47307
|
"dist/index.mjs",
|
|
@@ -47184,7 +47346,7 @@ function isFile(path) {
|
|
|
47184
47346
|
}
|
|
47185
47347
|
}
|
|
47186
47348
|
function readManifest(packageRoot) {
|
|
47187
|
-
const packageJsonPath =
|
|
47349
|
+
const packageJsonPath = join23(packageRoot, "package.json");
|
|
47188
47350
|
let packageJson;
|
|
47189
47351
|
try {
|
|
47190
47352
|
packageJson = parseJson(packageJsonPath);
|
|
@@ -47258,8 +47420,8 @@ function readManifest(packageRoot) {
|
|
|
47258
47420
|
return { mode: "manifest", manifest };
|
|
47259
47421
|
}
|
|
47260
47422
|
function inspectSdkSidecarInstall(versionDir) {
|
|
47261
|
-
const nodeModulesRoot =
|
|
47262
|
-
const packageRoot =
|
|
47423
|
+
const nodeModulesRoot = join23(versionDir, "node_modules");
|
|
47424
|
+
const packageRoot = join23(nodeModulesRoot, "deepline");
|
|
47263
47425
|
const manifestResult = readManifest(packageRoot);
|
|
47264
47426
|
if ("invalidReason" in manifestResult) {
|
|
47265
47427
|
return {
|
|
@@ -47270,8 +47432,8 @@ function inspectSdkSidecarInstall(versionDir) {
|
|
|
47270
47432
|
};
|
|
47271
47433
|
}
|
|
47272
47434
|
const missing = [
|
|
47273
|
-
...manifestResult.manifest.packageFiles.filter((path) => !isFile(
|
|
47274
|
-
...manifestResult.manifest.dependencyFiles.filter((path) => !isFile(
|
|
47435
|
+
...manifestResult.manifest.packageFiles.filter((path) => !isFile(join23(packageRoot, path))).map((path) => `deepline/${path}`),
|
|
47436
|
+
...manifestResult.manifest.dependencyFiles.filter((path) => !isFile(join23(nodeModulesRoot, path))).map((path) => `node_modules/${path}`)
|
|
47275
47437
|
];
|
|
47276
47438
|
return {
|
|
47277
47439
|
ok: missing.length === 0,
|
|
@@ -47282,7 +47444,7 @@ function inspectSdkSidecarInstall(versionDir) {
|
|
|
47282
47444
|
}
|
|
47283
47445
|
function probeSdkSidecarEsbuild(versionDir) {
|
|
47284
47446
|
try {
|
|
47285
|
-
const requireFromInstall = createRequire(
|
|
47447
|
+
const requireFromInstall = createRequire(join23(versionDir, "package.json"));
|
|
47286
47448
|
const esbuild = requireFromInstall("esbuild");
|
|
47287
47449
|
if (typeof esbuild.transformSync !== "function") {
|
|
47288
47450
|
return "esbuild does not export transformSync";
|
|
@@ -47351,7 +47513,7 @@ function sidecarStateDir(input2) {
|
|
|
47351
47513
|
if (!scope || scope.includes("/") || scope.includes("\\")) {
|
|
47352
47514
|
return null;
|
|
47353
47515
|
}
|
|
47354
|
-
return
|
|
47516
|
+
return join24(input2.homeDir, ".local", "deepline", scope, "sdk-cli");
|
|
47355
47517
|
}
|
|
47356
47518
|
function sidecarRegistryUrl(hostUrl) {
|
|
47357
47519
|
let url;
|
|
@@ -47393,12 +47555,12 @@ function resolvePythonSidecarUpdatePlan(options) {
|
|
|
47393
47555
|
if (!relativeEntrypoint || relativeEntrypoint.startsWith("..") || isAbsolute7(relativeEntrypoint)) {
|
|
47394
47556
|
return null;
|
|
47395
47557
|
}
|
|
47396
|
-
const installMethod = readOptionalText(
|
|
47558
|
+
const installMethod = readOptionalText(join24(stateDir, ".install-method"));
|
|
47397
47559
|
if (installMethod !== "python-sidecar") return null;
|
|
47398
47560
|
const scope = options.env.DEEPLINE_CONFIG_SCOPE?.trim() || "";
|
|
47399
47561
|
const hostUrl = options.env.DEEPLINE_HOST_URL?.trim() || "";
|
|
47400
|
-
const nodeBin = readOptionalText(
|
|
47401
|
-
const sidecarPath = readOptionalText(
|
|
47562
|
+
const nodeBin = readOptionalText(join24(stateDir, ".node-bin")) || process.execPath;
|
|
47563
|
+
const sidecarPath = readOptionalText(join24(stateDir, ".command-path")) || join24(
|
|
47402
47564
|
stateDir,
|
|
47403
47565
|
"bin",
|
|
47404
47566
|
process.platform === "win32" ? "deepline-sdk.cmd" : "deepline-sdk"
|
|
@@ -47406,7 +47568,7 @@ function resolvePythonSidecarUpdatePlan(options) {
|
|
|
47406
47568
|
const packageSpec = options.packageSpec || "deepline@latest";
|
|
47407
47569
|
const npmCommand = "npm";
|
|
47408
47570
|
const registryUrl = sidecarRegistryUrl(hostUrl);
|
|
47409
|
-
const versionDir =
|
|
47571
|
+
const versionDir = join24(stateDir, "versions", "<version>");
|
|
47410
47572
|
const manualCommand = `${buildSidecarProjectConfigCommand(versionDir, nodeBin)} && ${npmCommand} install --prefix ${shellQuote5(versionDir)} --registry ${shellQuote5(registryUrl)} ${NPM_SDK_INSTALL_COMMON_FLAGS.map(shellQuote5).join(" ")} ${shellQuote5(packageSpec)}`;
|
|
47411
47573
|
return {
|
|
47412
47574
|
kind: "python-sidecar",
|
|
@@ -47424,11 +47586,11 @@ function resolvePythonSidecarUpdatePlan(options) {
|
|
|
47424
47586
|
function findRepoBackedSdkRoot(startPath) {
|
|
47425
47587
|
let current = resolve19(startPath);
|
|
47426
47588
|
while (true) {
|
|
47427
|
-
if (existsSync18(
|
|
47589
|
+
if (existsSync18(join24(current, "package.json")) && existsSync18(join24(current, "bin", "deepline-dev.ts"))) {
|
|
47428
47590
|
const parent2 = dirname18(current);
|
|
47429
47591
|
return basename7(parent2) === "packages" && basename7(current) === "sdk" ? dirname18(parent2) : parent2;
|
|
47430
47592
|
}
|
|
47431
|
-
if (existsSync18(
|
|
47593
|
+
if (existsSync18(join24(current, "sdk", "package.json")) && existsSync18(join24(current, "sdk", "bin", "deepline-dev.ts"))) {
|
|
47432
47594
|
return current;
|
|
47433
47595
|
}
|
|
47434
47596
|
const parent = dirname18(current);
|
|
@@ -47456,7 +47618,7 @@ function inferNpmGlobalPrefixFromEntrypoint(entrypoint, env) {
|
|
|
47456
47618
|
const directPrefix = prefixParts.join("/").toLowerCase();
|
|
47457
47619
|
const knownWindowsPrefixes = [
|
|
47458
47620
|
env.npm_config_prefix,
|
|
47459
|
-
env.APPDATA ?
|
|
47621
|
+
env.APPDATA ? join24(env.APPDATA, "npm") : void 0
|
|
47460
47622
|
].filter((value) => Boolean(value)).map((value) => resolve19(value).replace(/\\/g, "/").toLowerCase());
|
|
47461
47623
|
if (!knownWindowsPrefixes.includes(
|
|
47462
47624
|
resolve19(directPrefix).replace(/\\/g, "/").toLowerCase()
|
|
@@ -47563,9 +47725,9 @@ var AUTO_UPDATE_FAILURE_FILE = ".auto-update-failure.json";
|
|
|
47563
47725
|
function autoUpdateFailurePath(plan) {
|
|
47564
47726
|
if (plan.kind === "source" || plan.kind === "homebrew") return null;
|
|
47565
47727
|
if (plan.kind === "python-sidecar") {
|
|
47566
|
-
return
|
|
47728
|
+
return join24(plan.stateDir, AUTO_UPDATE_FAILURE_FILE);
|
|
47567
47729
|
}
|
|
47568
|
-
return
|
|
47730
|
+
return join24(
|
|
47569
47731
|
homedir12(),
|
|
47570
47732
|
".local",
|
|
47571
47733
|
"deepline",
|
|
@@ -47652,7 +47814,7 @@ function safeVersionSegment(value) {
|
|
|
47652
47814
|
return /^[0-9A-Za-z._-]+$/.test(normalized) ? normalized : "";
|
|
47653
47815
|
}
|
|
47654
47816
|
function entryPathInVersionDir(versionDir) {
|
|
47655
|
-
return
|
|
47817
|
+
return join24(
|
|
47656
47818
|
versionDir,
|
|
47657
47819
|
"node_modules",
|
|
47658
47820
|
"deepline",
|
|
@@ -47662,7 +47824,7 @@ function entryPathInVersionDir(versionDir) {
|
|
|
47662
47824
|
);
|
|
47663
47825
|
}
|
|
47664
47826
|
function installedPackageVersion(versionDir) {
|
|
47665
|
-
const packageJsonPath =
|
|
47827
|
+
const packageJsonPath = join24(
|
|
47666
47828
|
versionDir,
|
|
47667
47829
|
"node_modules",
|
|
47668
47830
|
"deepline",
|
|
@@ -47790,10 +47952,10 @@ function writeSidecarLauncher(input2) {
|
|
|
47790
47952
|
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);";
|
|
47791
47953
|
const criticalPaths = [
|
|
47792
47954
|
...SDK_SIDECAR_CRITICAL_PACKAGE_FILES.map(
|
|
47793
|
-
(path) =>
|
|
47955
|
+
(path) => join24(packageRoot, path)
|
|
47794
47956
|
),
|
|
47795
47957
|
...SDK_SIDECAR_CRITICAL_DEPENDENCY_FILES.map(
|
|
47796
|
-
(path) =>
|
|
47958
|
+
(path) => join24(versionDir, "node_modules", path)
|
|
47797
47959
|
)
|
|
47798
47960
|
];
|
|
47799
47961
|
if (process.platform === "win32") {
|
|
@@ -47847,14 +48009,14 @@ function writeSidecarLauncher(input2) {
|
|
|
47847
48009
|
);
|
|
47848
48010
|
}
|
|
47849
48011
|
async function runPythonSidecarUpdatePlan(plan) {
|
|
47850
|
-
const versionsDir =
|
|
47851
|
-
const tempDir =
|
|
48012
|
+
const versionsDir = join24(plan.stateDir, "versions");
|
|
48013
|
+
const tempDir = join24(
|
|
47852
48014
|
versionsDir,
|
|
47853
48015
|
`.tmp-sdk-update-${process.pid}-${Date.now()}`
|
|
47854
48016
|
);
|
|
47855
48017
|
rmSync7(tempDir, { recursive: true, force: true });
|
|
47856
48018
|
mkdirSync14(tempDir, { recursive: true });
|
|
47857
|
-
writeFileSync18(
|
|
48019
|
+
writeFileSync18(join24(tempDir, "package.json"), NPM_SDK_SIDECAR_PACKAGE_JSON);
|
|
47858
48020
|
const env = {
|
|
47859
48021
|
...process.env,
|
|
47860
48022
|
PATH: `${dirname18(plan.nodeBin)}${process.platform === "win32" ? ";" : ":"}${process.env.PATH ?? ""}`
|
|
@@ -47894,7 +48056,7 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
47894
48056
|
rmSync7(tempDir, { recursive: true, force: true });
|
|
47895
48057
|
return 1;
|
|
47896
48058
|
}
|
|
47897
|
-
const finalDir =
|
|
48059
|
+
const finalDir = join24(versionsDir, installedVersion);
|
|
47898
48060
|
const finalEntryPath = entryPathInVersionDir(finalDir);
|
|
47899
48061
|
const finalFailure = sidecarInstallFailure(finalDir);
|
|
47900
48062
|
let backupDir = null;
|
|
@@ -47903,7 +48065,7 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
47903
48065
|
} else {
|
|
47904
48066
|
let shouldPublishTemp = true;
|
|
47905
48067
|
if (existsSync18(finalDir)) {
|
|
47906
|
-
backupDir =
|
|
48068
|
+
backupDir = join24(
|
|
47907
48069
|
versionsDir,
|
|
47908
48070
|
`.backup-${installedVersion}-${process.pid}-${Date.now()}`
|
|
47909
48071
|
);
|
|
@@ -47978,27 +48140,27 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
47978
48140
|
entryPath: finalEntryPath
|
|
47979
48141
|
});
|
|
47980
48142
|
writeFileSync18(
|
|
47981
|
-
|
|
48143
|
+
join24(plan.stateDir, ".version"),
|
|
47982
48144
|
`${installedVersion}
|
|
47983
48145
|
`,
|
|
47984
48146
|
"utf8"
|
|
47985
48147
|
);
|
|
47986
48148
|
writeFileSync18(
|
|
47987
|
-
|
|
48149
|
+
join24(plan.stateDir, ".install-method"),
|
|
47988
48150
|
"python-sidecar\n",
|
|
47989
48151
|
"utf8"
|
|
47990
48152
|
);
|
|
47991
48153
|
writeFileSync18(
|
|
47992
|
-
|
|
48154
|
+
join24(plan.stateDir, ".command-path"),
|
|
47993
48155
|
`${plan.sidecarPath}
|
|
47994
48156
|
`,
|
|
47995
48157
|
"utf8"
|
|
47996
48158
|
);
|
|
47997
|
-
writeFileSync18(
|
|
47998
|
-
writeFileSync18(
|
|
48159
|
+
writeFileSync18(join24(plan.stateDir, ".runner"), "node\n", "utf8");
|
|
48160
|
+
writeFileSync18(join24(plan.stateDir, ".node-bin"), `${plan.nodeBin}
|
|
47999
48161
|
`, "utf8");
|
|
48000
48162
|
writeFileSync18(
|
|
48001
|
-
|
|
48163
|
+
join24(plan.stateDir, ".entry-path"),
|
|
48002
48164
|
`${finalEntryPath}
|
|
48003
48165
|
`,
|
|
48004
48166
|
"utf8"
|
|
@@ -49078,7 +49240,7 @@ import {
|
|
|
49078
49240
|
writeFileSync as writeFileSync20
|
|
49079
49241
|
} from "fs";
|
|
49080
49242
|
import { tmpdir as tmpdir6 } from "os";
|
|
49081
|
-
import { dirname as dirname20, join as
|
|
49243
|
+
import { dirname as dirname20, join as join26, resolve as resolve20 } from "path";
|
|
49082
49244
|
|
|
49083
49245
|
// src/tool-output.ts
|
|
49084
49246
|
import {
|
|
@@ -49089,7 +49251,7 @@ import {
|
|
|
49089
49251
|
writeSync
|
|
49090
49252
|
} from "fs";
|
|
49091
49253
|
import { homedir as homedir13 } from "os";
|
|
49092
|
-
import { dirname as dirname19, join as
|
|
49254
|
+
import { dirname as dirname19, join as join25 } from "path";
|
|
49093
49255
|
function isPlainObject(value) {
|
|
49094
49256
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
49095
49257
|
}
|
|
@@ -49216,18 +49378,18 @@ function projectRowOutput(conversion) {
|
|
|
49216
49378
|
};
|
|
49217
49379
|
}
|
|
49218
49380
|
function ensureOutputDir() {
|
|
49219
|
-
const outputDir =
|
|
49381
|
+
const outputDir = join25(homedir13(), ".local", "share", "deepline", "data");
|
|
49220
49382
|
mkdirSync15(outputDir, { recursive: true });
|
|
49221
49383
|
return outputDir;
|
|
49222
49384
|
}
|
|
49223
49385
|
function writeJsonOutputFile(payload, stem) {
|
|
49224
49386
|
const outputDir = ensureOutputDir();
|
|
49225
|
-
const outputPath =
|
|
49387
|
+
const outputPath = join25(outputDir, `${stem}_${Date.now()}.json`);
|
|
49226
49388
|
writeFileSync19(outputPath, JSON.stringify(payload, null, 2), "utf-8");
|
|
49227
49389
|
return outputPath;
|
|
49228
49390
|
}
|
|
49229
49391
|
function writeCsvOutputFile(rows, stem, options) {
|
|
49230
|
-
const outputPath = options?.outPath ? options.outPath :
|
|
49392
|
+
const outputPath = options?.outPath ? options.outPath : join25(ensureOutputDir(), `${stem}_${Date.now()}.csv`);
|
|
49231
49393
|
mkdirSync15(dirname19(outputPath), { recursive: true });
|
|
49232
49394
|
const columns = columnsForRows(rows);
|
|
49233
49395
|
const escapeCell = (value) => {
|
|
@@ -51582,7 +51744,7 @@ function parseToolExecuteTimeout(raw) {
|
|
|
51582
51744
|
function pendingToolExecutionPath(input2) {
|
|
51583
51745
|
const config = resolveConfig();
|
|
51584
51746
|
const fingerprint = createHash7("sha256").update(config.baseUrl).update("\0").update(createHash7("sha256").update(config.apiKey).digest("hex")).update("\0").update(input2.toolId).update("\0").update(stableStringify(input2.params)).update("\0").update(input2.responseIntent).digest("hex");
|
|
51585
|
-
return
|
|
51747
|
+
return join26(
|
|
51586
51748
|
sdkCliStateDirPath(resolveConfig().baseUrl),
|
|
51587
51749
|
`pending-tool-execution-${fingerprint}.json`
|
|
51588
51750
|
);
|
|
@@ -51666,9 +51828,9 @@ function starterScriptJson(script) {
|
|
|
51666
51828
|
function seedToolListScript(input2) {
|
|
51667
51829
|
const stem = safeFileStem(input2.toolId);
|
|
51668
51830
|
const fileName = `${stem}-workflow-seed-${Date.now()}.play.ts`;
|
|
51669
|
-
const scriptDir = mkdtempSync(
|
|
51831
|
+
const scriptDir = mkdtempSync(join26(tmpdir6(), "deepline-workflow-seed-"));
|
|
51670
51832
|
chmodSync(scriptDir, 448);
|
|
51671
|
-
const scriptPath =
|
|
51833
|
+
const scriptPath = join26(scriptDir, fileName);
|
|
51672
51834
|
const projectDir = `deepline/projects/${stem}-workflow`;
|
|
51673
51835
|
const playName = `${stem}-workflow`;
|
|
51674
51836
|
const sampleRows = input2.rows.length > 0 ? `${JSON.stringify(input2.rows.slice(0, 2)).replace(/\]$/, "")}, ...]` : "[]";
|
|
@@ -52173,8 +52335,8 @@ Examples:
|
|
|
52173
52335
|
}
|
|
52174
52336
|
|
|
52175
52337
|
// src/cli/commands/workflow.ts
|
|
52176
|
-
import { mkdir as mkdir6, readFile as
|
|
52177
|
-
import { dirname as dirname21, join as
|
|
52338
|
+
import { mkdir as mkdir6, readFile as readFile7, writeFile as writeFile5 } from "fs/promises";
|
|
52339
|
+
import { dirname as dirname21, join as join27, resolve as resolve21 } from "path";
|
|
52178
52340
|
|
|
52179
52341
|
// src/cli/workflow-to-play.ts
|
|
52180
52342
|
import { createHash as createHash8 } from "crypto";
|
|
@@ -52391,7 +52553,7 @@ function readStatus(payload) {
|
|
|
52391
52553
|
}
|
|
52392
52554
|
async function readJsonOption(payload, file) {
|
|
52393
52555
|
if (file) {
|
|
52394
|
-
const raw = await
|
|
52556
|
+
const raw = await readFile7(resolve21(file), "utf8");
|
|
52395
52557
|
return JSON.parse(raw);
|
|
52396
52558
|
}
|
|
52397
52559
|
if (payload) {
|
|
@@ -52425,7 +52587,7 @@ async function transformOne(api, workflowId, outDir, publish) {
|
|
|
52425
52587
|
revision.config,
|
|
52426
52588
|
{ workflowName: workflow.name, version: revision.version }
|
|
52427
52589
|
);
|
|
52428
|
-
const file =
|
|
52590
|
+
const file = join27(resolve21(outDir), `${compiled.playName}.play.ts`);
|
|
52429
52591
|
await mkdir6(dirname21(file), { recursive: true });
|
|
52430
52592
|
await writeFile5(file, compiled.sourceCode, "utf8");
|
|
52431
52593
|
let published = false;
|
|
@@ -52972,8 +53134,8 @@ function topLevelCommandKnown(program, commandName) {
|
|
|
52972
53134
|
);
|
|
52973
53135
|
}
|
|
52974
53136
|
async function runPlayRunnerHealthCheck() {
|
|
52975
|
-
const dir = await mkdtemp4(
|
|
52976
|
-
const file =
|
|
53137
|
+
const dir = await mkdtemp4(join28(tmpdir7(), "deepline-health-play-"));
|
|
53138
|
+
const file = join28(dir, "health-check.play.ts");
|
|
52977
53139
|
try {
|
|
52978
53140
|
await writeFile6(
|
|
52979
53141
|
file,
|