deepline 0.3.65 → 0.3.67
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/client.ts +2 -0
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +89 -2
- package/dist/bundling-sources/shared_libs/play-runtime/log-provenance.ts +80 -3
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +3 -0
- package/dist/cli/index.js +278 -155
- package/dist/cli/index.mjs +190 -67
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1214,7 +1214,7 @@ var SDK_RELEASE = {
|
|
|
1214
1214
|
// available at toolResponse.rawV2 while toolResponse.raw and all declared
|
|
1215
1215
|
// getters keep their established compatibility behavior.
|
|
1216
1216
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
1217
|
-
version: "0.3.
|
|
1217
|
+
version: "0.3.67",
|
|
1218
1218
|
updateSummary: "Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.",
|
|
1219
1219
|
packageCapabilities: {
|
|
1220
1220
|
updatePreferences: 1
|
|
@@ -16758,9 +16758,7 @@ function readProvenanceTag(line) {
|
|
|
16758
16758
|
return { provenance: null, line };
|
|
16759
16759
|
}
|
|
16760
16760
|
const candidate = line.slice(PROVENANCE_PREFIX.length, end);
|
|
16761
|
-
const provenance = LOG_PROVENANCE_CLASSES.includes(
|
|
16762
|
-
candidate
|
|
16763
|
-
) ? candidate : null;
|
|
16761
|
+
const provenance = LOG_PROVENANCE_CLASSES.includes(candidate) ? candidate : null;
|
|
16764
16762
|
return { provenance, line: line.slice(end + 1) };
|
|
16765
16763
|
}
|
|
16766
16764
|
function classifyLegacyLogLine(line) {
|
|
@@ -17094,12 +17092,16 @@ var PLAY_RUN_RESERVED_BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
|
17094
17092
|
"--watch",
|
|
17095
17093
|
"--no-wait",
|
|
17096
17094
|
"--logs",
|
|
17095
|
+
"--debug",
|
|
17097
17096
|
"--full",
|
|
17098
17097
|
"--force",
|
|
17099
17098
|
"--force-tool-refresh",
|
|
17100
17099
|
"--open",
|
|
17101
17100
|
"--debug-map-latency"
|
|
17102
17101
|
]);
|
|
17102
|
+
function isBarePlayRunDebugFlag(args, index) {
|
|
17103
|
+
return args[index] === "--debug" && (args[index + 1] === void 0 || args[index + 1].startsWith("--"));
|
|
17104
|
+
}
|
|
17103
17105
|
async function pathExistsIncludingSymlink(path) {
|
|
17104
17106
|
try {
|
|
17105
17107
|
await (0, import_promises6.lstat)(path);
|
|
@@ -18152,12 +18154,20 @@ async function publishImportedPlayDependencies(client2, graph) {
|
|
|
18152
18154
|
};
|
|
18153
18155
|
await publishNode(graph.root.filePath, true);
|
|
18154
18156
|
}
|
|
18157
|
+
function timestampDate(value) {
|
|
18158
|
+
if (value === null || value === void 0 || value === "") return null;
|
|
18159
|
+
const normalized = typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value) : value;
|
|
18160
|
+
const date = new Date(normalized);
|
|
18161
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
18162
|
+
}
|
|
18155
18163
|
function formatTimestamp(value) {
|
|
18156
|
-
|
|
18157
|
-
|
|
18158
|
-
if (Number.isNaN(date.getTime())) return "\u2014";
|
|
18164
|
+
const date = timestampDate(value);
|
|
18165
|
+
if (!date) return "\u2014";
|
|
18159
18166
|
return date.toISOString();
|
|
18160
18167
|
}
|
|
18168
|
+
function isoTimestamp(value) {
|
|
18169
|
+
return timestampDate(value)?.toISOString() ?? null;
|
|
18170
|
+
}
|
|
18161
18171
|
function formatRunLine(run) {
|
|
18162
18172
|
const credits = typeof run.billingTotalCredits === "number" && Number.isFinite(run.billingTotalCredits) ? `${formatCreditAmount(run.billingTotalCredits)} credits` : "\u2014";
|
|
18163
18173
|
return `${run.workflowId} ${run.status} ${formatTimestamp(run.startTime)} ${credits}`;
|
|
@@ -21057,12 +21067,13 @@ function parsePlayRunOptions(args) {
|
|
|
21057
21067
|
const watch = !args.includes("--no-wait");
|
|
21058
21068
|
let jsonOutput = watch ? args.includes("--json") : argsWantJson(args);
|
|
21059
21069
|
const fullJson = args.includes("--full");
|
|
21060
|
-
const
|
|
21070
|
+
const explicitDebugLogs = args.includes("--logs") || args.some((_, index) => isBarePlayRunDebugFlag(args, index));
|
|
21071
|
+
const emitLogs = !jsonOutput || explicitDebugLogs;
|
|
21061
21072
|
const force = args.includes("--force");
|
|
21062
21073
|
const forceToolRefresh = args.includes("--force-tool-refresh");
|
|
21063
21074
|
const open2 = args.includes("--open");
|
|
21064
21075
|
const debugMapLatency = args.includes("--debug-map-latency");
|
|
21065
|
-
const verboseLogs =
|
|
21076
|
+
const verboseLogs = explicitDebugLogs || debugMapLatency;
|
|
21066
21077
|
let waitTimeoutMs = null;
|
|
21067
21078
|
let maxConcurrentExternalCalls = null;
|
|
21068
21079
|
let maxConcurrentRows = null;
|
|
@@ -21193,6 +21204,20 @@ function parsePlayRunOptions(args) {
|
|
|
21193
21204
|
waitTimeoutMs = parsePositiveInteger3(args[++index], arg);
|
|
21194
21205
|
continue;
|
|
21195
21206
|
}
|
|
21207
|
+
if (arg === "--debug" && args[index + 1] && !args[index + 1].startsWith("--")) {
|
|
21208
|
+
input2 ??= {};
|
|
21209
|
+
setDottedInputValue(input2, "debug", parseInputFlagValue(args[++index]));
|
|
21210
|
+
continue;
|
|
21211
|
+
}
|
|
21212
|
+
if (arg.startsWith("--debug=")) {
|
|
21213
|
+
input2 ??= {};
|
|
21214
|
+
setDottedInputValue(
|
|
21215
|
+
input2,
|
|
21216
|
+
"debug",
|
|
21217
|
+
parseInputFlagValue(arg.slice("--debug=".length))
|
|
21218
|
+
);
|
|
21219
|
+
continue;
|
|
21220
|
+
}
|
|
21196
21221
|
if (PLAY_RUN_RESERVED_BOOLEAN_FLAGS.has(arg)) {
|
|
21197
21222
|
if (arg === "--watch") {
|
|
21198
21223
|
continue;
|
|
@@ -22451,7 +22476,7 @@ async function handlePlayRun(args, hooks) {
|
|
|
22451
22476
|
function parseRunIdPositional(args, usage) {
|
|
22452
22477
|
for (let index = 0; index < args.length; index += 1) {
|
|
22453
22478
|
const arg = args[index];
|
|
22454
|
-
if (arg === "--json" || arg === "--full" || arg === "--input" || arg === "--logs" || arg === "--compact" || arg === "--log-failed" || arg === "--failed" || arg === "--limit") {
|
|
22479
|
+
if (arg === "--json" || arg === "--full" || arg === "--input" || arg === "--logs" || arg === "--debug" || arg === "--compact" || arg === "--log-failed" || arg === "--failed" || arg === "--limit") {
|
|
22455
22480
|
if (arg === "--limit" && args[index + 1]) {
|
|
22456
22481
|
index += 1;
|
|
22457
22482
|
}
|
|
@@ -22568,13 +22593,22 @@ async function handleRunsList(args) {
|
|
|
22568
22593
|
...offset !== void 0 ? { offset } : {}
|
|
22569
22594
|
})).map((run) => ({
|
|
22570
22595
|
runId: run.workflowId,
|
|
22596
|
+
// `workflowId` is the legacy SDK name for the same public Deepline run
|
|
22597
|
+
// identity. Keep it during the compatibility window, but never label the
|
|
22598
|
+
// duplicate as a Temporal/runtime id.
|
|
22571
22599
|
workflowId: run.workflowId,
|
|
22572
|
-
|
|
22600
|
+
// Retain the runtime identifier for existing JSON consumers. It is not a
|
|
22601
|
+
// stable Deepline run id; `runId` above is the canonical public id.
|
|
22602
|
+
temporalRunId: run.runId ?? null,
|
|
22573
22603
|
parentRunId: run.parentRunId ?? null,
|
|
22574
22604
|
rootRunId: run.rootRunId ?? null,
|
|
22575
22605
|
status: String(run.status ?? "").toLowerCase(),
|
|
22606
|
+
createdAt: run.createdAt ?? null,
|
|
22607
|
+
createdAtIso: isoTimestamp(run.createdAt),
|
|
22576
22608
|
startedAt: run.startTime ?? run.startedAt ?? null,
|
|
22609
|
+
startedAtIso: isoTimestamp(run.startTime ?? run.startedAt ?? null),
|
|
22577
22610
|
finishedAt: run.closeTime ?? run.finishedAt ?? null,
|
|
22611
|
+
finishedAtIso: isoTimestamp(run.closeTime ?? run.finishedAt ?? null),
|
|
22578
22612
|
executionTime: run.executionTime,
|
|
22579
22613
|
billingTotalCredits: run.billingTotalCredits,
|
|
22580
22614
|
billingMaxCreditsPerRun: run.billingMaxCreditsPerRun,
|
|
@@ -22582,9 +22616,19 @@ async function handleRunsList(args) {
|
|
|
22582
22616
|
}));
|
|
22583
22617
|
const lines = runs.length === 0 ? [
|
|
22584
22618
|
playName ? `No runs found for ${playName}.` : `No runs found for status ${statusFilter}.`
|
|
22585
|
-
] : runs.map(
|
|
22586
|
-
|
|
22587
|
-
|
|
22619
|
+
] : runs.map((run) => {
|
|
22620
|
+
const lines2 = [
|
|
22621
|
+
`${run.runId} ${run.status}`,
|
|
22622
|
+
` created: ${formatTimestamp(run.createdAt)}`,
|
|
22623
|
+
` started: ${formatTimestamp(run.startedAt)}`,
|
|
22624
|
+
` finished: ${formatTimestamp(run.finishedAt)}`,
|
|
22625
|
+
` credits: ${typeof run.billingTotalCredits === "number" && Number.isFinite(run.billingTotalCredits) ? formatCreditAmount(run.billingTotalCredits) : "\u2014"}`,
|
|
22626
|
+
` inspect: deepline runs get ${run.runId} --json`
|
|
22627
|
+
];
|
|
22628
|
+
if (run.parentRunId) lines2.push(` parent: ${run.parentRunId}`);
|
|
22629
|
+
if (run.rootRunId) lines2.push(` root: ${run.rootRunId}`);
|
|
22630
|
+
return lines2.join("\n");
|
|
22631
|
+
});
|
|
22588
22632
|
printCommandEnvelope(
|
|
22589
22633
|
{
|
|
22590
22634
|
runs,
|
|
@@ -22599,7 +22643,7 @@ async function handleRunsList(args) {
|
|
|
22599
22643
|
return 0;
|
|
22600
22644
|
}
|
|
22601
22645
|
async function handleRunTail(args) {
|
|
22602
|
-
const usage = "Usage: deepline runs tail <run-id> [--json | --jsonl] [--compact]";
|
|
22646
|
+
const usage = "Usage: deepline runs tail <run-id> [--json | --jsonl] [--compact] [--debug]";
|
|
22603
22647
|
let runId;
|
|
22604
22648
|
try {
|
|
22605
22649
|
runId = parseRunIdPositional(args, usage);
|
|
@@ -22615,7 +22659,7 @@ async function handleRunTail(args) {
|
|
|
22615
22659
|
);
|
|
22616
22660
|
return 1;
|
|
22617
22661
|
}
|
|
22618
|
-
if (arg.startsWith("--") && arg !== "--json" && arg !== "--jsonl" && arg !== "--compact") {
|
|
22662
|
+
if (arg.startsWith("--") && arg !== "--json" && arg !== "--jsonl" && arg !== "--compact" && arg !== "--logs" && arg !== "--debug") {
|
|
22619
22663
|
console.error(`${arg} is not supported by deepline runs tail.`);
|
|
22620
22664
|
return 1;
|
|
22621
22665
|
}
|
|
@@ -22624,6 +22668,13 @@ async function handleRunTail(args) {
|
|
|
22624
22668
|
console.error("--json and --jsonl cannot be used together.");
|
|
22625
22669
|
return 1;
|
|
22626
22670
|
}
|
|
22671
|
+
const debug = args.includes("--logs") || args.includes("--debug");
|
|
22672
|
+
if (args.includes("--jsonl") && debug) {
|
|
22673
|
+
console.error(
|
|
22674
|
+
"--debug is redundant with --jsonl: JSON Lines already includes every canonical live event."
|
|
22675
|
+
);
|
|
22676
|
+
return 1;
|
|
22677
|
+
}
|
|
22627
22678
|
const client2 = new DeeplineClient();
|
|
22628
22679
|
const jsonLines = args.includes("--jsonl");
|
|
22629
22680
|
const jsonOutput = !jsonLines && argsWantJson(args);
|
|
@@ -22633,7 +22684,8 @@ async function handleRunTail(args) {
|
|
|
22633
22684
|
emittedRunnerStarted: false,
|
|
22634
22685
|
lastProgressSignature: null,
|
|
22635
22686
|
lastProgressHeartbeatAt: 0,
|
|
22636
|
-
lastStatusHeartbeatAt: 0
|
|
22687
|
+
lastStatusHeartbeatAt: 0,
|
|
22688
|
+
verbose: debug
|
|
22637
22689
|
};
|
|
22638
22690
|
const status = await client2.runs.tail(runId, {
|
|
22639
22691
|
onEvent: jsonLines ? (event) => {
|
|
@@ -22645,7 +22697,20 @@ async function handleRunTail(args) {
|
|
|
22645
22697
|
})}
|
|
22646
22698
|
`
|
|
22647
22699
|
);
|
|
22648
|
-
} : compact
|
|
22700
|
+
} : compact || debug ? (event) => {
|
|
22701
|
+
if (debug) {
|
|
22702
|
+
for (const line of getLogLinesFromLiveEvent(event)) {
|
|
22703
|
+
const formatted = formatPlayLogLine(
|
|
22704
|
+
line,
|
|
22705
|
+
void 0,
|
|
22706
|
+
compactState
|
|
22707
|
+
);
|
|
22708
|
+
if (formatted) process.stderr.write(`${formatted}
|
|
22709
|
+
`);
|
|
22710
|
+
compactState.lastLogIndex += 1;
|
|
22711
|
+
}
|
|
22712
|
+
}
|
|
22713
|
+
if (!compact || jsonOutput) return;
|
|
22649
22714
|
const transition = getStepTransitionLineFromLiveEvent(
|
|
22650
22715
|
event,
|
|
22651
22716
|
compactState
|
|
@@ -22668,7 +22733,7 @@ async function handleRunTail(args) {
|
|
|
22668
22733
|
}
|
|
22669
22734
|
} : void 0,
|
|
22670
22735
|
// Human mode only: in --json mode emit nothing non-protocol.
|
|
22671
|
-
onReconnect: jsonOutput ? void 0 : ({ reason }) => {
|
|
22736
|
+
onReconnect: jsonOutput && !debug ? void 0 : ({ reason }) => {
|
|
22672
22737
|
process.stderr.write(
|
|
22673
22738
|
`[runs tail] stream ended without a terminal status; reconnecting to run ${runId} (${reason})
|
|
22674
22739
|
`
|
|
@@ -22684,7 +22749,7 @@ async function handleRunTail(args) {
|
|
|
22684
22749
|
return status.status === "failed" ? 1 : 0;
|
|
22685
22750
|
}
|
|
22686
22751
|
async function handleRunLogs(args) {
|
|
22687
|
-
const usage = "Usage: deepline runs logs <run-id> [--limit 200] [--failed] [--out run.log] [--json]";
|
|
22752
|
+
const usage = "Usage: deepline runs logs <run-id> [--limit 200] [--failed] [--out run.log] [--json] [--debug]";
|
|
22688
22753
|
let runId;
|
|
22689
22754
|
try {
|
|
22690
22755
|
runId = parseRunIdPositional(args, usage);
|
|
@@ -22697,12 +22762,20 @@ async function handleRunLogs(args) {
|
|
|
22697
22762
|
const failed = args.includes("--failed");
|
|
22698
22763
|
for (let index = 0; index < args.length; index += 1) {
|
|
22699
22764
|
const arg = args[index];
|
|
22765
|
+
if (arg === "--debug" || arg === "--logs" || arg === "--json" || arg === "--failed") {
|
|
22766
|
+
continue;
|
|
22767
|
+
}
|
|
22700
22768
|
if (arg === "--limit" && args[index + 1]) {
|
|
22701
22769
|
limit = parsePositiveInteger3(args[++index], "--limit");
|
|
22702
22770
|
continue;
|
|
22703
22771
|
}
|
|
22704
22772
|
if (arg === "--out" && args[index + 1]) {
|
|
22705
22773
|
outPath = (0, import_node_path14.resolve)(args[++index]);
|
|
22774
|
+
continue;
|
|
22775
|
+
}
|
|
22776
|
+
if (arg.startsWith("--")) {
|
|
22777
|
+
console.error(`${arg} is not supported by deepline runs logs.`);
|
|
22778
|
+
return 1;
|
|
22706
22779
|
}
|
|
22707
22780
|
}
|
|
22708
22781
|
if (failed && outPath) {
|
|
@@ -24175,9 +24248,9 @@ Examples:
|
|
|
24175
24248
|
).option("--watch", "Compatibility alias; run waits by default").option("--wait", "Compatibility alias; run waits by default").option("--no-wait", "Start the run and return immediately").option(
|
|
24176
24249
|
"--run-id-file <path>",
|
|
24177
24250
|
"Atomically write the accepted run id to a new JSON file"
|
|
24178
|
-
).option(
|
|
24179
|
-
"--
|
|
24180
|
-
"
|
|
24251
|
+
).option("--logs", "Compatibility alias for --debug").option(
|
|
24252
|
+
"--debug [value]",
|
|
24253
|
+
"Stream complete customer-safe runtime logs when passed without a value; otherwise pass input.debug"
|
|
24181
24254
|
).option("--tail-timeout-ms <ms>", "Timeout while watching the run stream").option("--force", "Start a fresh run graph").option(
|
|
24182
24255
|
"--force-tool-refresh",
|
|
24183
24256
|
"Refresh completed tool receipts; may repeat billed provider calls"
|
|
@@ -24226,6 +24299,7 @@ Pass-through input flags:
|
|
|
24226
24299
|
...options.runIdFile ? ["--run-id-file", options.runIdFile] : [],
|
|
24227
24300
|
...options.watch || options.wait ? ["--watch"] : [],
|
|
24228
24301
|
...options.logs ? ["--logs"] : [],
|
|
24302
|
+
...options.debug === true ? ["--debug"] : typeof options.debug === "string" ? ["--debug", options.debug] : [],
|
|
24229
24303
|
...options.tailTimeoutMs ? ["--tail-timeout-ms", options.tailTimeoutMs] : [],
|
|
24230
24304
|
...options.force ? ["--force"] : [],
|
|
24231
24305
|
...options.forceToolRefresh ? ["--force-tool-refresh"] : [],
|
|
@@ -24643,11 +24717,13 @@ Notes:
|
|
|
24643
24717
|
logs for persisted log history. In human output, --compact prints deduplicated
|
|
24644
24718
|
step transitions and progress instead of the full event stream. --json emits
|
|
24645
24719
|
one terminal package. --jsonl emits canonical live events as JSON Lines and
|
|
24646
|
-
ends with the same compact package shape as runs get --json.
|
|
24720
|
+
ends with the same compact package shape as runs get --json. Use --debug
|
|
24721
|
+
(or legacy --logs) to also print customer-safe runtime log lines to stderr.
|
|
24647
24722
|
|
|
24648
24723
|
Examples:
|
|
24649
24724
|
deepline runs tail play/my-play/run/20260501t000000-000
|
|
24650
24725
|
deepline runs tail play/my-play/run/20260501t000000-000 --compact
|
|
24726
|
+
deepline runs tail play/my-play/run/20260501t000000-000 --debug
|
|
24651
24727
|
deepline runs tail play/my-play/run/20260501t000000-000 --jsonl
|
|
24652
24728
|
`
|
|
24653
24729
|
).option("--json", "Emit one terminal JSON package after the run completes").option(
|
|
@@ -24656,12 +24732,17 @@ Examples:
|
|
|
24656
24732
|
).option(
|
|
24657
24733
|
"--compact",
|
|
24658
24734
|
"Show deduplicated human step transitions and progress"
|
|
24735
|
+
).option("--logs", "Compatibility alias for --debug").option(
|
|
24736
|
+
"--debug",
|
|
24737
|
+
"Print customer-safe runtime log lines to stderr while tailing"
|
|
24659
24738
|
).action(async (runId, options) => {
|
|
24660
24739
|
process.exitCode = await handleRunTail([
|
|
24661
24740
|
runId,
|
|
24662
24741
|
...options.json ? ["--json"] : [],
|
|
24663
24742
|
...options.jsonl ? ["--jsonl"] : [],
|
|
24664
|
-
...options.compact ? ["--compact"] : []
|
|
24743
|
+
...options.compact ? ["--compact"] : [],
|
|
24744
|
+
...options.logs ? ["--logs"] : [],
|
|
24745
|
+
...options.debug ? ["--debug"] : []
|
|
24665
24746
|
]);
|
|
24666
24747
|
});
|
|
24667
24748
|
runs.command("logs <runId>").description("Fetch persisted logs for a play run.").addHelpText(
|
|
@@ -24669,24 +24750,31 @@ Examples:
|
|
|
24669
24750
|
`
|
|
24670
24751
|
Notes:
|
|
24671
24752
|
Prints a bounded recent log preview by default. Use --out to write the full
|
|
24672
|
-
persisted log stream to a local file.
|
|
24753
|
+
persisted log stream to a local file. --debug (or legacy --logs) is accepted
|
|
24754
|
+
for script parity; this command already returns the unfiltered durable stream.
|
|
24673
24755
|
|
|
24674
24756
|
Examples:
|
|
24675
24757
|
deepline runs logs play/my-play/run/20260501t000000-000
|
|
24676
24758
|
deepline runs logs play/my-play/run/20260501t000000-000 --limit 500
|
|
24677
24759
|
deepline runs logs play/my-play/run/20260501t000000-000 --failed --json
|
|
24760
|
+
deepline runs logs play/my-play/run/20260501t000000-000 --debug
|
|
24678
24761
|
deepline runs logs play/my-play/run/20260501t000000-000 --out run.log --json
|
|
24679
24762
|
`
|
|
24680
24763
|
).option(
|
|
24681
24764
|
"--limit <count>",
|
|
24682
24765
|
"Maximum recent log lines to print without --out",
|
|
24683
24766
|
"200"
|
|
24684
|
-
).option("--out <path>", "Write the full persisted log stream to a file").option("--failed", "Show the bounded terminal-failure log window").option("--
|
|
24767
|
+
).option("--out <path>", "Write the full persisted log stream to a file").option("--failed", "Show the bounded terminal-failure log window").option("--logs", "Compatibility alias for --debug").option(
|
|
24768
|
+
"--debug",
|
|
24769
|
+
"Explicitly request the same persisted log view (no provenance filtering)"
|
|
24770
|
+
).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (runId, options) => {
|
|
24685
24771
|
process.exitCode = await handleRunLogs([
|
|
24686
24772
|
runId,
|
|
24687
24773
|
...options.limit ? ["--limit", options.limit] : [],
|
|
24688
24774
|
...options.out ? ["--out", options.out] : [],
|
|
24689
24775
|
...options.failed ? ["--failed"] : [],
|
|
24776
|
+
...options.logs ? ["--logs"] : [],
|
|
24777
|
+
...options.debug ? ["--debug"] : [],
|
|
24690
24778
|
...options.json ? ["--json"] : []
|
|
24691
24779
|
]);
|
|
24692
24780
|
});
|
|
@@ -30346,10 +30434,12 @@ function registerEnrichCommand(program) {
|
|
|
30346
30434
|
}
|
|
30347
30435
|
|
|
30348
30436
|
// src/cli/commands/feedback.ts
|
|
30437
|
+
var import_node_fs13 = require("fs");
|
|
30349
30438
|
async function handleFeedback(text, options) {
|
|
30439
|
+
const message = resolveFeedbackText(text, options.file);
|
|
30350
30440
|
const { http } = getAuthedHttpClient();
|
|
30351
30441
|
const response = await http.post("/api/v2/cli/feedback", {
|
|
30352
|
-
text,
|
|
30442
|
+
text: message,
|
|
30353
30443
|
requested: options.requested === true,
|
|
30354
30444
|
environment: collectLocalEnvInfo(),
|
|
30355
30445
|
...options.command ? { command: options.command } : {},
|
|
@@ -30367,6 +30457,35 @@ async function handleFeedback(text, options) {
|
|
|
30367
30457
|
{ json: options.json }
|
|
30368
30458
|
);
|
|
30369
30459
|
}
|
|
30460
|
+
function resolveFeedbackText(text, file, readFile6 = (path) => (0, import_node_fs13.readFileSync)(path, "utf8")) {
|
|
30461
|
+
if (text !== void 0 && file !== void 0) {
|
|
30462
|
+
throw new Error(
|
|
30463
|
+
"Pass feedback text positionally or with --file, not both."
|
|
30464
|
+
);
|
|
30465
|
+
}
|
|
30466
|
+
let value;
|
|
30467
|
+
if (file !== void 0) {
|
|
30468
|
+
try {
|
|
30469
|
+
value = readFile6(file === "-" ? 0 : file);
|
|
30470
|
+
} catch (error) {
|
|
30471
|
+
throw new Error(
|
|
30472
|
+
`Could not read feedback ${file === "-" ? "from stdin" : `file ${file}`}: ${error instanceof Error ? error.message : String(error)}`
|
|
30473
|
+
);
|
|
30474
|
+
}
|
|
30475
|
+
} else if (text !== void 0) {
|
|
30476
|
+
value = text;
|
|
30477
|
+
} else if (!process.stdin.isTTY) {
|
|
30478
|
+
value = readFile6(0);
|
|
30479
|
+
} else {
|
|
30480
|
+
throw new Error(
|
|
30481
|
+
"Feedback text is required. Pass it positionally, use --file <path>, or pipe stdin."
|
|
30482
|
+
);
|
|
30483
|
+
}
|
|
30484
|
+
if (!value.trim()) {
|
|
30485
|
+
throw new Error("Feedback text must not be empty.");
|
|
30486
|
+
}
|
|
30487
|
+
return value;
|
|
30488
|
+
}
|
|
30370
30489
|
function registerFeedbackCommands(program) {
|
|
30371
30490
|
const feedback = program.command("feedback").description("Submit CLI feedback to Deepline.").addHelpText(
|
|
30372
30491
|
"after",
|
|
@@ -30386,17 +30505,19 @@ Examples:
|
|
|
30386
30505
|
`
|
|
30387
30506
|
Examples:
|
|
30388
30507
|
deepline feedback send "tools search returned stale results" --json
|
|
30508
|
+
deepline feedback send --file incident.md --requested --json
|
|
30509
|
+
cat incident.md | deepline feedback send --requested --json
|
|
30389
30510
|
deepline feedback send "tools search returned stale results" --requested --json
|
|
30390
30511
|
deepline feedback send "plays run failed after upload" --command "deepline plays run my.play.ts --watch"
|
|
30391
30512
|
`
|
|
30392
|
-
).argument("
|
|
30513
|
+
).argument("[text]", "Feedback text").option("--file <path>", "Read feedback text from a file, or - for stdin").option("--command <command>", "Command that reproduced the issue").option("--payload <payload>", "JSON or plain-text payload for the repro").option(
|
|
30393
30514
|
"--requested",
|
|
30394
30515
|
"Mark the report as explicitly requested by the user"
|
|
30395
30516
|
).option("--json", "Emit JSON output").action(handleFeedback);
|
|
30396
30517
|
}
|
|
30397
30518
|
|
|
30398
30519
|
// src/cli/commands/sessions.ts
|
|
30399
|
-
var
|
|
30520
|
+
var import_node_fs14 = require("fs");
|
|
30400
30521
|
var import_node_os10 = require("os");
|
|
30401
30522
|
var import_node_path16 = require("path");
|
|
30402
30523
|
var import_node_zlib = require("zlib");
|
|
@@ -30431,7 +30552,7 @@ function codexSessionsRoot() {
|
|
|
30431
30552
|
}
|
|
30432
30553
|
function listClaudeSessionFiles() {
|
|
30433
30554
|
const root = claudeProjectsRoot();
|
|
30434
|
-
if (!(0,
|
|
30555
|
+
if (!(0, import_node_fs14.existsSync)(root)) return [];
|
|
30435
30556
|
const projectDirs = readDirectoryNames(root);
|
|
30436
30557
|
const files = [];
|
|
30437
30558
|
for (const projectDir of projectDirs) {
|
|
@@ -30456,7 +30577,7 @@ function listClaudeSessionFiles() {
|
|
|
30456
30577
|
}
|
|
30457
30578
|
function listCodexSessionFiles() {
|
|
30458
30579
|
const root = codexSessionsRoot();
|
|
30459
|
-
if (!(0,
|
|
30580
|
+
if (!(0, import_node_fs14.existsSync)(root)) return [];
|
|
30460
30581
|
const files = [];
|
|
30461
30582
|
for (const filePath of listJsonlFilesRecursive(root, 5)) {
|
|
30462
30583
|
const stat4 = statIfReadable(filePath);
|
|
@@ -30479,7 +30600,7 @@ function listSessionFiles(agent) {
|
|
|
30479
30600
|
}
|
|
30480
30601
|
function readDirectoryNames(dir) {
|
|
30481
30602
|
try {
|
|
30482
|
-
return (0,
|
|
30603
|
+
return (0, import_node_fs14.readdirSync)(dir);
|
|
30483
30604
|
} catch {
|
|
30484
30605
|
return [];
|
|
30485
30606
|
}
|
|
@@ -30490,7 +30611,7 @@ function listJsonlFilesRecursive(root, maxDepth) {
|
|
|
30490
30611
|
if (depth > maxDepth) return;
|
|
30491
30612
|
let entries;
|
|
30492
30613
|
try {
|
|
30493
|
-
entries = (0,
|
|
30614
|
+
entries = (0, import_node_fs14.readdirSync)(dir, { withFileTypes: true });
|
|
30494
30615
|
} catch {
|
|
30495
30616
|
return;
|
|
30496
30617
|
}
|
|
@@ -30508,7 +30629,7 @@ function listJsonlFilesRecursive(root, maxDepth) {
|
|
|
30508
30629
|
}
|
|
30509
30630
|
function statIfReadable(filePath) {
|
|
30510
30631
|
try {
|
|
30511
|
-
return (0,
|
|
30632
|
+
return (0, import_node_fs14.statSync)(filePath);
|
|
30512
30633
|
} catch {
|
|
30513
30634
|
return null;
|
|
30514
30635
|
}
|
|
@@ -30531,7 +30652,7 @@ function sessionIdFromCodexFilePath(filePath) {
|
|
|
30531
30652
|
}
|
|
30532
30653
|
function readCodexSessionId(filePath) {
|
|
30533
30654
|
try {
|
|
30534
|
-
for (const line of normalizedJsonLines((0,
|
|
30655
|
+
for (const line of normalizedJsonLines((0, import_node_fs14.readFileSync)(filePath)).slice(
|
|
30535
30656
|
0,
|
|
30536
30657
|
20
|
|
30537
30658
|
)) {
|
|
@@ -30846,11 +30967,11 @@ async function uploadChunkedSessions(sessions, options) {
|
|
|
30846
30967
|
async function handleSessionsSend(options) {
|
|
30847
30968
|
if (options.file) {
|
|
30848
30969
|
const filePath = (0, import_node_path16.resolve)(options.file);
|
|
30849
|
-
if (!(0,
|
|
30970
|
+
if (!(0, import_node_fs14.existsSync)(filePath)) {
|
|
30850
30971
|
throw new Error(`File not found: ${options.file}`);
|
|
30851
30972
|
}
|
|
30852
30973
|
const response2 = await uploadPayload("/api/v2/cli/send-session", {
|
|
30853
|
-
file: (0,
|
|
30974
|
+
file: (0, import_node_fs14.readFileSync)(filePath).toString("base64"),
|
|
30854
30975
|
filename: (0, import_node_path16.basename)(filePath)
|
|
30855
30976
|
});
|
|
30856
30977
|
printCommandEnvelope(
|
|
@@ -30880,7 +31001,7 @@ async function handleSessionsSend(options) {
|
|
|
30880
31001
|
agent: options.agent
|
|
30881
31002
|
});
|
|
30882
31003
|
const built = targets.map((target) => {
|
|
30883
|
-
const upload = buildSessionUploadContent((0,
|
|
31004
|
+
const upload = buildSessionUploadContent((0, import_node_fs14.readFileSync)(target.filePath));
|
|
30884
31005
|
return { ...target, ...upload };
|
|
30885
31006
|
});
|
|
30886
31007
|
if (built.some((session) => session.needsChunking)) {
|
|
@@ -30962,10 +31083,10 @@ function loadViewerAssets() {
|
|
|
30962
31083
|
try {
|
|
30963
31084
|
const cssPath = (0, import_node_path16.join)(root, "viewer.css");
|
|
30964
31085
|
const jsPath = (0, import_node_path16.join)(root, "viewer.js");
|
|
30965
|
-
if (!(0,
|
|
31086
|
+
if (!(0, import_node_fs14.existsSync)(cssPath) || !(0, import_node_fs14.existsSync)(jsPath)) continue;
|
|
30966
31087
|
return {
|
|
30967
|
-
css: (0,
|
|
30968
|
-
js: (0,
|
|
31088
|
+
css: (0, import_node_fs14.readFileSync)(cssPath, "utf8"),
|
|
31089
|
+
js: (0, import_node_fs14.readFileSync)(jsPath, "utf8")
|
|
30969
31090
|
};
|
|
30970
31091
|
} catch {
|
|
30971
31092
|
continue;
|
|
@@ -30992,18 +31113,18 @@ async function handleSessionsRender(options) {
|
|
|
30992
31113
|
let outputPath = options.output ? (0, import_node_path16.resolve)(options.output) : "";
|
|
30993
31114
|
if (!outputPath) {
|
|
30994
31115
|
const outputDir = (0, import_node_path16.join)(process.cwd(), "deepline", "data");
|
|
30995
|
-
(0,
|
|
31116
|
+
(0, import_node_fs14.mkdirSync)(outputDir, { recursive: true });
|
|
30996
31117
|
outputPath = (0, import_node_path16.join)(
|
|
30997
31118
|
outputDir,
|
|
30998
31119
|
targets.length > 1 ? "session-viewer.html" : `session-${targets[0]?.sessionId}.html`
|
|
30999
31120
|
);
|
|
31000
31121
|
} else {
|
|
31001
|
-
(0,
|
|
31122
|
+
(0, import_node_fs14.mkdirSync)((0, import_node_path16.dirname)(outputPath), { recursive: true });
|
|
31002
31123
|
}
|
|
31003
31124
|
const sessions = targets.map((target) => ({
|
|
31004
31125
|
label: target.label,
|
|
31005
31126
|
events: parsePreparedEvents(
|
|
31006
|
-
prepareSessionBuffer((0,
|
|
31127
|
+
prepareSessionBuffer((0, import_node_fs14.readFileSync)(target.filePath))
|
|
31007
31128
|
)
|
|
31008
31129
|
}));
|
|
31009
31130
|
const { css, js } = loadViewerAssets();
|
|
@@ -31028,7 +31149,7 @@ ${refreshMeta}
|
|
|
31028
31149
|
<script>${js}</script>
|
|
31029
31150
|
</body>
|
|
31030
31151
|
</html>`;
|
|
31031
|
-
(0,
|
|
31152
|
+
(0, import_node_fs14.writeFileSync)(outputPath, html, "utf8");
|
|
31032
31153
|
printCommandEnvelope(
|
|
31033
31154
|
{
|
|
31034
31155
|
ok: true,
|
|
@@ -31237,7 +31358,7 @@ Examples:
|
|
|
31237
31358
|
|
|
31238
31359
|
// src/cli/commands/monitors.ts
|
|
31239
31360
|
var import_node_crypto8 = require("crypto");
|
|
31240
|
-
var
|
|
31361
|
+
var import_node_fs15 = require("fs");
|
|
31241
31362
|
var import_node_path17 = require("path");
|
|
31242
31363
|
var import_promises8 = require("readline/promises");
|
|
31243
31364
|
|
|
@@ -31677,8 +31798,8 @@ function parseJsonObjectArg(raw, argLabel) {
|
|
|
31677
31798
|
return parsed;
|
|
31678
31799
|
}
|
|
31679
31800
|
function resolveMonitorJsonBody(input2) {
|
|
31680
|
-
const readFile6 = input2.readFile ?? ((path) => (0,
|
|
31681
|
-
const readStdin = input2.readStdin ?? (() => (0,
|
|
31801
|
+
const readFile6 = input2.readFile ?? ((path) => (0, import_node_fs15.readFileSync)(path, "utf-8"));
|
|
31802
|
+
const readStdin = input2.readStdin ?? (() => (0, import_node_fs15.readFileSync)(0, "utf-8"));
|
|
31682
31803
|
if (input2.positional !== void 0 && input2.file !== void 0) {
|
|
31683
31804
|
throw new MonitorsUsageError(
|
|
31684
31805
|
`Pass exactly one source for ${input2.argLabel}: the positional JSON or --file, not both.`
|
|
@@ -32075,6 +32196,7 @@ function renderDeployedListText(payload, requestedStatus) {
|
|
|
32075
32196
|
if (!entry || !key) continue;
|
|
32076
32197
|
const status = asString(entry.status);
|
|
32077
32198
|
const tool = asString(entry.tool);
|
|
32199
|
+
const monitorType = asString(entry.type);
|
|
32078
32200
|
const name = asString(entry.name);
|
|
32079
32201
|
const outputTable = asString(entry.output_table);
|
|
32080
32202
|
const webhookState = asString(entry.webhook_state);
|
|
@@ -32085,10 +32207,11 @@ function renderDeployedListText(payload, requestedStatus) {
|
|
|
32085
32207
|
lines.push(
|
|
32086
32208
|
` ${key}${status ? ` ${status}` : ""}${tool ? ` ${tool}` : ""}${name ? ` (${name})` : ""}`
|
|
32087
32209
|
);
|
|
32088
|
-
if (outputTable || webhookState || executionType || boundPlays !== void 0) {
|
|
32210
|
+
if (outputTable || monitorType || webhookState || executionType || boundPlays !== void 0) {
|
|
32089
32211
|
lines.push(
|
|
32090
32212
|
` ${[
|
|
32091
32213
|
outputTable ? `table: ${outputTable}` : null,
|
|
32214
|
+
monitorType ? `type: ${monitorType}` : null,
|
|
32092
32215
|
webhookState ? `webhook: ${webhookState}` : null,
|
|
32093
32216
|
executionType ? `execution: ${executionType}` : null,
|
|
32094
32217
|
boundPlays !== void 0 ? `bound Plays: ${boundPlays}` : null
|
|
@@ -32581,7 +32704,7 @@ async function handleMonitorFleetsInit(fleetId, options) {
|
|
|
32581
32704
|
};
|
|
32582
32705
|
const definition = requireCompiledFleetDefinition(authoredDefinition);
|
|
32583
32706
|
const file = (0, import_node_path17.resolve)(out);
|
|
32584
|
-
(0,
|
|
32707
|
+
(0, import_node_fs15.writeFileSync)(file, `${JSON.stringify(definition, null, 2)}
|
|
32585
32708
|
`, "utf8");
|
|
32586
32709
|
const next = `deepline monitors fleets sync --file ${fleetShellArg(file)} --dry-run --json`;
|
|
32587
32710
|
printCommandEnvelope(
|
|
@@ -32913,6 +33036,7 @@ function renderMonitorGet(payload) {
|
|
|
32913
33036
|
const tool = asString(payload.tool);
|
|
32914
33037
|
if (!key || !tool) return void 0;
|
|
32915
33038
|
const status = asString(payload.status);
|
|
33039
|
+
const monitorType = asString(payload.type);
|
|
32916
33040
|
const hasLastReceivedEvent = "last_received_event" in payload;
|
|
32917
33041
|
const lastReceivedEvent = asString(payload.last_received_event);
|
|
32918
33042
|
const definition = asRecord2(payload.definition);
|
|
@@ -32930,8 +33054,9 @@ function renderMonitorGet(payload) {
|
|
|
32930
33054
|
const lines = [
|
|
32931
33055
|
`Monitor: ${key}`,
|
|
32932
33056
|
`Tool: ${tool}`,
|
|
33057
|
+
...monitorType ? [`Type: ${monitorType}`] : [],
|
|
32933
33058
|
...status ? [`Status: ${status}`] : [],
|
|
32934
|
-
...hasLastReceivedEvent ? [`
|
|
33059
|
+
...hasLastReceivedEvent ? [`Latest inbound event: ${lastReceivedEvent ?? "never"}`] : [],
|
|
32935
33060
|
...pricingLine ? [`Pricing: ${pricingLine}`] : [],
|
|
32936
33061
|
...nextRenewalAt ? [`Next renewal: ${nextRenewalAt}`] : []
|
|
32937
33062
|
];
|
|
@@ -32997,17 +33122,15 @@ function renderMonitorGet(payload) {
|
|
|
32997
33122
|
const name = asString(play.name) ?? "unnamed Play";
|
|
32998
33123
|
const listener = asString(play.listener_key);
|
|
32999
33124
|
const health = asRecord2(play.consumer_health);
|
|
33000
|
-
const
|
|
33125
|
+
const runStatus = asString(health?.last_run_status);
|
|
33001
33126
|
const lastDelivery = asFiniteNumber(health?.last_delivery_at);
|
|
33127
|
+
const runId = asString(health?.last_run_id);
|
|
33002
33128
|
const error = asString(health?.last_error);
|
|
33129
|
+
lines.push(` ${name}${listener ? ` (listener: ${listener})` : ""}:`);
|
|
33003
33130
|
lines.push(
|
|
33004
|
-
`
|
|
33131
|
+
` Latest delivered event: ${lastDelivery !== void 0 ? new Date(lastDelivery).toISOString() : "never"}`,
|
|
33132
|
+
` Latest consumer run: ${runId ?? "never"}${runStatus ? ` (${runStatus})` : ""}`
|
|
33005
33133
|
);
|
|
33006
|
-
if (lastDelivery !== void 0) {
|
|
33007
|
-
lines.push(
|
|
33008
|
-
` last delivery: ${new Date(lastDelivery).toISOString()}`
|
|
33009
|
-
);
|
|
33010
|
-
}
|
|
33011
33134
|
if (error) lines.push(` error: ${error}`);
|
|
33012
33135
|
}
|
|
33013
33136
|
}
|
|
@@ -34661,38 +34784,38 @@ Examples:
|
|
|
34661
34784
|
|
|
34662
34785
|
// src/cli/commands/setup.ts
|
|
34663
34786
|
var import_node_child_process4 = require("child_process");
|
|
34664
|
-
var
|
|
34787
|
+
var import_node_fs19 = require("fs");
|
|
34665
34788
|
var import_node_os13 = require("os");
|
|
34666
34789
|
var import_node_path21 = require("path");
|
|
34667
34790
|
|
|
34668
34791
|
// src/cli/installation-lifecycle.ts
|
|
34669
|
-
var
|
|
34792
|
+
var import_node_fs16 = require("fs");
|
|
34670
34793
|
var import_node_path18 = require("path");
|
|
34671
34794
|
var nodeFileSystem = {
|
|
34672
|
-
exists:
|
|
34795
|
+
exists: import_node_fs16.existsSync,
|
|
34673
34796
|
isSymbolicLink(path) {
|
|
34674
34797
|
try {
|
|
34675
|
-
return (0,
|
|
34798
|
+
return (0, import_node_fs16.lstatSync)(path).isSymbolicLink();
|
|
34676
34799
|
} catch {
|
|
34677
34800
|
return false;
|
|
34678
34801
|
}
|
|
34679
34802
|
},
|
|
34680
34803
|
read(path) {
|
|
34681
34804
|
try {
|
|
34682
|
-
return (0,
|
|
34805
|
+
return (0, import_node_fs16.readFileSync)(path, "utf8");
|
|
34683
34806
|
} catch {
|
|
34684
34807
|
return "";
|
|
34685
34808
|
}
|
|
34686
34809
|
},
|
|
34687
34810
|
realpath(path) {
|
|
34688
34811
|
try {
|
|
34689
|
-
return (0,
|
|
34812
|
+
return (0, import_node_fs16.realpathSync)(path);
|
|
34690
34813
|
} catch {
|
|
34691
34814
|
return null;
|
|
34692
34815
|
}
|
|
34693
34816
|
},
|
|
34694
34817
|
remove(path) {
|
|
34695
|
-
(0,
|
|
34818
|
+
(0, import_node_fs16.rmSync)(path, { force: true });
|
|
34696
34819
|
}
|
|
34697
34820
|
};
|
|
34698
34821
|
function inspectLauncher(path, fileSystem = nodeFileSystem) {
|
|
@@ -34789,7 +34912,7 @@ function isOwnedInstallerCommandPath(input2) {
|
|
|
34789
34912
|
|
|
34790
34913
|
// src/cli/commands/skills.ts
|
|
34791
34914
|
var import_node_child_process3 = require("child_process");
|
|
34792
|
-
var
|
|
34915
|
+
var import_node_fs18 = require("fs");
|
|
34793
34916
|
var import_node_os12 = require("os");
|
|
34794
34917
|
var import_node_path20 = require("path");
|
|
34795
34918
|
|
|
@@ -34901,7 +35024,7 @@ function buildSkillsAddArgs(baseUrl, skillName, options = {}) {
|
|
|
34901
35024
|
|
|
34902
35025
|
// src/cli/skills-sync.ts
|
|
34903
35026
|
var import_node_child_process2 = require("child_process");
|
|
34904
|
-
var
|
|
35027
|
+
var import_node_fs17 = require("fs");
|
|
34905
35028
|
var import_node_path19 = require("path");
|
|
34906
35029
|
|
|
34907
35030
|
// src/cli/windows-arg-escape.ts
|
|
@@ -35262,15 +35385,15 @@ function hasMarkedSkillsSyncVersion(path, version) {
|
|
|
35262
35385
|
}
|
|
35263
35386
|
function readMarkedSkillsSyncVersion(path) {
|
|
35264
35387
|
try {
|
|
35265
|
-
return (0,
|
|
35388
|
+
return (0, import_node_fs17.existsSync)(path) ? (0, import_node_fs17.readFileSync)(path, "utf-8").trim() : "";
|
|
35266
35389
|
} catch {
|
|
35267
35390
|
return "";
|
|
35268
35391
|
}
|
|
35269
35392
|
}
|
|
35270
35393
|
function writeMarkedSkillsSyncVersion(path, version) {
|
|
35271
35394
|
try {
|
|
35272
|
-
(0,
|
|
35273
|
-
(0,
|
|
35395
|
+
(0, import_node_fs17.mkdirSync)((0, import_node_path19.dirname)(path), { recursive: true });
|
|
35396
|
+
(0, import_node_fs17.writeFileSync)(path, `${version}
|
|
35274
35397
|
`, "utf-8");
|
|
35275
35398
|
return true;
|
|
35276
35399
|
} catch {
|
|
@@ -35289,7 +35412,7 @@ ${manualCommand}`
|
|
|
35289
35412
|
}
|
|
35290
35413
|
function clearUnavailableSkillsNotice(baseUrl) {
|
|
35291
35414
|
try {
|
|
35292
|
-
(0,
|
|
35415
|
+
(0, import_node_fs17.unlinkSync)(unavailableSkillsNoticePath(baseUrl));
|
|
35293
35416
|
} catch {
|
|
35294
35417
|
}
|
|
35295
35418
|
}
|
|
@@ -35300,7 +35423,7 @@ function hasFailedSkillsSync(baseUrl, remoteVersion, agents) {
|
|
|
35300
35423
|
);
|
|
35301
35424
|
}
|
|
35302
35425
|
function hasFailedAutomaticSkillsSync(baseUrl, agents) {
|
|
35303
|
-
return (0,
|
|
35426
|
+
return (0, import_node_fs17.existsSync)(failedSkillsSyncPath(baseUrl, agents));
|
|
35304
35427
|
}
|
|
35305
35428
|
function markFailedSkillsSync(baseUrl, remoteVersion, agents) {
|
|
35306
35429
|
return writeMarkedSkillsSyncVersion(
|
|
@@ -35310,7 +35433,7 @@ function markFailedSkillsSync(baseUrl, remoteVersion, agents) {
|
|
|
35310
35433
|
}
|
|
35311
35434
|
function clearFailedSkillsSync(baseUrl, agents) {
|
|
35312
35435
|
try {
|
|
35313
|
-
(0,
|
|
35436
|
+
(0, import_node_fs17.unlinkSync)(failedSkillsSyncPath(baseUrl, agents));
|
|
35314
35437
|
} catch {
|
|
35315
35438
|
}
|
|
35316
35439
|
}
|
|
@@ -35677,7 +35800,7 @@ function detectSkillsAgents(input2) {
|
|
|
35677
35800
|
];
|
|
35678
35801
|
const detected = AGENT_MARKERS.filter(
|
|
35679
35802
|
(marker) => roots.some(
|
|
35680
|
-
(root) => marker.paths.some((path) => (0,
|
|
35803
|
+
(root) => marker.paths.some((path) => (0, import_node_fs18.existsSync)((0, import_node_path20.join)(root, path)))
|
|
35681
35804
|
)
|
|
35682
35805
|
).map((marker) => marker.agent);
|
|
35683
35806
|
return detected.length > 0 ? detected : ["*"];
|
|
@@ -35750,7 +35873,7 @@ function isSkillsPlanCurrent(plan, state) {
|
|
|
35750
35873
|
}
|
|
35751
35874
|
function readSkillsInstallState(path) {
|
|
35752
35875
|
try {
|
|
35753
|
-
const parsed = JSON.parse((0,
|
|
35876
|
+
const parsed = JSON.parse((0, import_node_fs18.readFileSync)(path, "utf8"));
|
|
35754
35877
|
return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
35755
35878
|
} catch {
|
|
35756
35879
|
return null;
|
|
@@ -35903,8 +36026,8 @@ async function runSkillsCommand(options, dependencies = {}) {
|
|
|
35903
36026
|
`
|
|
35904
36027
|
);
|
|
35905
36028
|
}
|
|
35906
|
-
(0,
|
|
35907
|
-
(0,
|
|
36029
|
+
(0, import_node_fs18.mkdirSync)((0, import_node_path20.dirname)(plan.statePath), { recursive: true });
|
|
36030
|
+
(0, import_node_fs18.writeFileSync)(
|
|
35908
36031
|
plan.statePath,
|
|
35909
36032
|
`${JSON.stringify(
|
|
35910
36033
|
{
|
|
@@ -36042,7 +36165,7 @@ function phasesFromLegacyStatus(status) {
|
|
|
36042
36165
|
function readSetupState(input2) {
|
|
36043
36166
|
try {
|
|
36044
36167
|
const parsed = JSON.parse(
|
|
36045
|
-
(0,
|
|
36168
|
+
(0, import_node_fs19.readFileSync)(
|
|
36046
36169
|
setupStatePath(input2.baseUrl, input2.scope, input2.root),
|
|
36047
36170
|
"utf8"
|
|
36048
36171
|
)
|
|
@@ -36147,7 +36270,7 @@ function asRecord3(value) {
|
|
|
36147
36270
|
}
|
|
36148
36271
|
function safeRead(path) {
|
|
36149
36272
|
try {
|
|
36150
|
-
return (0,
|
|
36273
|
+
return (0, import_node_fs19.readFileSync)(path, "utf8");
|
|
36151
36274
|
} catch {
|
|
36152
36275
|
return "";
|
|
36153
36276
|
}
|
|
@@ -36176,7 +36299,7 @@ function resolvePathCommand(command) {
|
|
|
36176
36299
|
function isHomebrewFormulaCommand(path) {
|
|
36177
36300
|
let resolvedPath = path;
|
|
36178
36301
|
try {
|
|
36179
|
-
resolvedPath = (0,
|
|
36302
|
+
resolvedPath = (0, import_node_fs19.realpathSync)(path);
|
|
36180
36303
|
} catch {
|
|
36181
36304
|
return false;
|
|
36182
36305
|
}
|
|
@@ -36187,7 +36310,7 @@ function isHomebrewFormulaCommand(path) {
|
|
|
36187
36310
|
function resolvePersistentGlobalCommand(dependencies = {}) {
|
|
36188
36311
|
const platform3 = dependencies.platform ?? process.platform;
|
|
36189
36312
|
const run = dependencies.spawn ?? import_node_child_process4.spawnSync;
|
|
36190
|
-
const pathExists = dependencies.exists ??
|
|
36313
|
+
const pathExists = dependencies.exists ?? import_node_fs19.existsSync;
|
|
36191
36314
|
const pathClis = dependencies.pathClis ?? resolvePathCommands("deepline");
|
|
36192
36315
|
const homebrewCommand = pathClis.find(isHomebrewFormulaCommand);
|
|
36193
36316
|
if (homebrewCommand) return homebrewCommand;
|
|
@@ -36212,7 +36335,7 @@ function inspectGlobalCliAvailability(input2) {
|
|
|
36212
36335
|
}
|
|
36213
36336
|
function pathsResolveToSameFile(left, right) {
|
|
36214
36337
|
try {
|
|
36215
|
-
return (0,
|
|
36338
|
+
return (0, import_node_fs19.realpathSync)(left) === (0, import_node_fs19.realpathSync)(right);
|
|
36216
36339
|
} catch {
|
|
36217
36340
|
return (0, import_node_path21.resolve)(left) === (0, import_node_path21.resolve)(right);
|
|
36218
36341
|
}
|
|
@@ -36221,7 +36344,7 @@ function isKnownDeeplineCommand(path) {
|
|
|
36221
36344
|
const entrypoint = process.argv[1] ? (0, import_node_path21.resolve)(process.argv[1]) : "";
|
|
36222
36345
|
let resolvedPath = path;
|
|
36223
36346
|
try {
|
|
36224
|
-
resolvedPath = (0,
|
|
36347
|
+
resolvedPath = (0, import_node_fs19.realpathSync)(path);
|
|
36225
36348
|
} catch {
|
|
36226
36349
|
}
|
|
36227
36350
|
if (entrypoint && resolvedPath === entrypoint) return true;
|
|
@@ -36233,8 +36356,8 @@ function inspectPathConflict() {
|
|
|
36233
36356
|
const commandPath = resolvePathCommand("deepline");
|
|
36234
36357
|
if (!commandPath || isKnownDeeplineCommand(commandPath)) return null;
|
|
36235
36358
|
try {
|
|
36236
|
-
if ((0,
|
|
36237
|
-
const target = (0,
|
|
36359
|
+
if ((0, import_node_fs19.lstatSync)(commandPath).isSymbolicLink()) {
|
|
36360
|
+
const target = (0, import_node_fs19.realpathSync)(commandPath);
|
|
36238
36361
|
if (target.includes(`${(0, import_node_path21.join)("node_modules", "deepline")}`)) return null;
|
|
36239
36362
|
}
|
|
36240
36363
|
} catch {
|
|
@@ -36243,8 +36366,8 @@ function inspectPathConflict() {
|
|
|
36243
36366
|
}
|
|
36244
36367
|
function writeSetupState(input2) {
|
|
36245
36368
|
const path = setupStatePath(input2.baseUrl, input2.scope, input2.root);
|
|
36246
|
-
(0,
|
|
36247
|
-
(0,
|
|
36369
|
+
(0, import_node_fs19.mkdirSync)((0, import_node_path21.dirname)(path), { recursive: true });
|
|
36370
|
+
(0, import_node_fs19.writeFileSync)(
|
|
36248
36371
|
path,
|
|
36249
36372
|
`${JSON.stringify(
|
|
36250
36373
|
{
|
|
@@ -36908,7 +37031,7 @@ Examples:
|
|
|
36908
37031
|
}
|
|
36909
37032
|
|
|
36910
37033
|
// src/cli/update-preferences.ts
|
|
36911
|
-
var
|
|
37034
|
+
var import_node_fs20 = require("fs");
|
|
36912
37035
|
var import_node_os14 = require("os");
|
|
36913
37036
|
var import_node_path22 = require("path");
|
|
36914
37037
|
var UPDATE_PREFERENCES_SCHEMA_VERSION = 1;
|
|
@@ -36949,9 +37072,9 @@ function cliUpdatePreferencesPath(homeDir2 = (0, import_node_os14.homedir)()) {
|
|
|
36949
37072
|
}
|
|
36950
37073
|
function readCliUpdatePreferences(homeDir2 = (0, import_node_os14.homedir)()) {
|
|
36951
37074
|
const path = cliUpdatePreferencesPath(homeDir2);
|
|
36952
|
-
if (!(0,
|
|
37075
|
+
if (!(0, import_node_fs20.existsSync)(path)) return defaultPreferences();
|
|
36953
37076
|
try {
|
|
36954
|
-
const parsed = JSON.parse((0,
|
|
37077
|
+
const parsed = JSON.parse((0, import_node_fs20.readFileSync)(path, "utf8"));
|
|
36955
37078
|
return {
|
|
36956
37079
|
schemaVersion: UPDATE_PREFERENCES_SCHEMA_VERSION,
|
|
36957
37080
|
autoUpdateEnabled: typeof parsed.autoUpdateEnabled === "boolean" ? parsed.autoUpdateEnabled : true,
|
|
@@ -36967,16 +37090,16 @@ function readCliUpdatePreferences(homeDir2 = (0, import_node_os14.homedir)()) {
|
|
|
36967
37090
|
function writeCliUpdatePreferences(preferences, homeDir2 = (0, import_node_os14.homedir)()) {
|
|
36968
37091
|
const path = cliUpdatePreferencesPath(homeDir2);
|
|
36969
37092
|
const tempPath = `${path}.${process.pid}.tmp`;
|
|
36970
|
-
(0,
|
|
37093
|
+
(0, import_node_fs20.mkdirSync)((0, import_node_path22.dirname)(path), { recursive: true });
|
|
36971
37094
|
try {
|
|
36972
|
-
(0,
|
|
37095
|
+
(0, import_node_fs20.writeFileSync)(tempPath, `${JSON.stringify(preferences, null, 2)}
|
|
36973
37096
|
`, {
|
|
36974
37097
|
encoding: "utf8",
|
|
36975
37098
|
mode: 384
|
|
36976
37099
|
});
|
|
36977
|
-
(0,
|
|
37100
|
+
(0, import_node_fs20.renameSync)(tempPath, path);
|
|
36978
37101
|
} finally {
|
|
36979
|
-
(0,
|
|
37102
|
+
(0, import_node_fs20.rmSync)(tempPath, { force: true });
|
|
36980
37103
|
}
|
|
36981
37104
|
}
|
|
36982
37105
|
function setCliAutoUpdateEnabled(enabled, homeDir2 = (0, import_node_os14.homedir)()) {
|
|
@@ -37026,13 +37149,13 @@ function consumePendingCliUpdateMessages(homeDir2 = (0, import_node_os14.homedir
|
|
|
37026
37149
|
|
|
37027
37150
|
// src/cli/commands/update.ts
|
|
37028
37151
|
var import_node_child_process5 = require("child_process");
|
|
37029
|
-
var
|
|
37152
|
+
var import_node_fs22 = require("fs");
|
|
37030
37153
|
var import_node_os15 = require("os");
|
|
37031
37154
|
var import_node_path24 = require("path");
|
|
37032
37155
|
|
|
37033
37156
|
// src/cli/install-integrity.ts
|
|
37034
37157
|
var import_node_module2 = require("module");
|
|
37035
|
-
var
|
|
37158
|
+
var import_node_fs21 = require("fs");
|
|
37036
37159
|
var import_node_path23 = require("path");
|
|
37037
37160
|
var SDK_SIDECAR_CRITICAL_PACKAGE_FILES = [
|
|
37038
37161
|
"dist/cli/index.mjs",
|
|
@@ -37066,11 +37189,11 @@ function resolveContainedPath(root, value) {
|
|
|
37066
37189
|
return target;
|
|
37067
37190
|
}
|
|
37068
37191
|
function parseJson(path) {
|
|
37069
|
-
return JSON.parse((0,
|
|
37192
|
+
return JSON.parse((0, import_node_fs21.readFileSync)(path, "utf8"));
|
|
37070
37193
|
}
|
|
37071
37194
|
function isFile(path) {
|
|
37072
37195
|
try {
|
|
37073
|
-
return (0,
|
|
37196
|
+
return (0, import_node_fs21.statSync)(path).isFile();
|
|
37074
37197
|
} catch {
|
|
37075
37198
|
return false;
|
|
37076
37199
|
}
|
|
@@ -37084,7 +37207,7 @@ function readManifest(packageRoot) {
|
|
|
37084
37207
|
return {
|
|
37085
37208
|
mode: "manifest",
|
|
37086
37209
|
invalidReason: `invalid Deepline package metadata: ${error.message}`,
|
|
37087
|
-
missing: (0,
|
|
37210
|
+
missing: (0, import_node_fs21.existsSync)(packageJsonPath) ? [] : ["deepline/package.json"]
|
|
37088
37211
|
};
|
|
37089
37212
|
}
|
|
37090
37213
|
if (!packageJson || typeof packageJson !== "object" || Array.isArray(packageJson)) {
|
|
@@ -37276,7 +37399,7 @@ function publicNpmFallbackRegistryUrl(hostUrl) {
|
|
|
37276
37399
|
}
|
|
37277
37400
|
function readOptionalText(path) {
|
|
37278
37401
|
try {
|
|
37279
|
-
return (0,
|
|
37402
|
+
return (0, import_node_fs22.readFileSync)(path, "utf8").trim();
|
|
37280
37403
|
} catch {
|
|
37281
37404
|
return "";
|
|
37282
37405
|
}
|
|
@@ -37322,11 +37445,11 @@ function resolvePythonSidecarUpdatePlan(options) {
|
|
|
37322
37445
|
function findRepoBackedSdkRoot(startPath) {
|
|
37323
37446
|
let current = (0, import_node_path24.resolve)(startPath);
|
|
37324
37447
|
while (true) {
|
|
37325
|
-
if ((0,
|
|
37448
|
+
if ((0, import_node_fs22.existsSync)((0, import_node_path24.join)(current, "package.json")) && (0, import_node_fs22.existsSync)((0, import_node_path24.join)(current, "bin", "deepline-dev.ts"))) {
|
|
37326
37449
|
const parent2 = (0, import_node_path24.dirname)(current);
|
|
37327
37450
|
return (0, import_node_path24.basename)(parent2) === "packages" && (0, import_node_path24.basename)(current) === "sdk" ? (0, import_node_path24.dirname)(parent2) : parent2;
|
|
37328
37451
|
}
|
|
37329
|
-
if ((0,
|
|
37452
|
+
if ((0, import_node_fs22.existsSync)((0, import_node_path24.join)(current, "sdk", "package.json")) && (0, import_node_fs22.existsSync)((0, import_node_path24.join)(current, "sdk", "bin", "deepline-dev.ts"))) {
|
|
37330
37453
|
return current;
|
|
37331
37454
|
}
|
|
37332
37455
|
const parent = (0, import_node_path24.dirname)(current);
|
|
@@ -37337,7 +37460,7 @@ function findRepoBackedSdkRoot(startPath) {
|
|
|
37337
37460
|
function inferNpmGlobalPrefixFromEntrypoint(entrypoint, env) {
|
|
37338
37461
|
const normalized = (() => {
|
|
37339
37462
|
try {
|
|
37340
|
-
return (0,
|
|
37463
|
+
return (0, import_node_fs22.realpathSync)(entrypoint);
|
|
37341
37464
|
} catch {
|
|
37342
37465
|
return (0, import_node_path24.resolve)(entrypoint);
|
|
37343
37466
|
}
|
|
@@ -37370,7 +37493,7 @@ function normalizedNpmPrefix(value) {
|
|
|
37370
37493
|
if (!trimmed) return null;
|
|
37371
37494
|
const normalized = (() => {
|
|
37372
37495
|
try {
|
|
37373
|
-
return (0,
|
|
37496
|
+
return (0, import_node_fs22.realpathSync)((0, import_node_path24.resolve)(trimmed));
|
|
37374
37497
|
} catch {
|
|
37375
37498
|
return (0, import_node_path24.resolve)(trimmed);
|
|
37376
37499
|
}
|
|
@@ -37395,7 +37518,7 @@ function resolveNpmGlobalPrefix(env) {
|
|
|
37395
37518
|
function isHomebrewFormulaEntrypoint(entrypoint) {
|
|
37396
37519
|
const normalized = (() => {
|
|
37397
37520
|
try {
|
|
37398
|
-
return (0,
|
|
37521
|
+
return (0, import_node_fs22.realpathSync)(entrypoint);
|
|
37399
37522
|
} catch {
|
|
37400
37523
|
return (0, import_node_path24.resolve)(entrypoint);
|
|
37401
37524
|
}
|
|
@@ -37479,7 +37602,7 @@ function readAutoUpdateFailure(plan) {
|
|
|
37479
37602
|
if (!path) return null;
|
|
37480
37603
|
try {
|
|
37481
37604
|
const parsed = JSON.parse(
|
|
37482
|
-
(0,
|
|
37605
|
+
(0, import_node_fs22.readFileSync)(path, "utf8")
|
|
37483
37606
|
);
|
|
37484
37607
|
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") {
|
|
37485
37608
|
return parsed;
|
|
@@ -37500,8 +37623,8 @@ function writeAutoUpdateFailure(plan, exitCode) {
|
|
|
37500
37623
|
manualCommand: plan.manualCommand
|
|
37501
37624
|
};
|
|
37502
37625
|
try {
|
|
37503
|
-
(0,
|
|
37504
|
-
(0,
|
|
37626
|
+
(0, import_node_fs22.mkdirSync)((0, import_node_path24.dirname)(path), { recursive: true });
|
|
37627
|
+
(0, import_node_fs22.writeFileSync)(path, `${JSON.stringify(marker, null, 2)}
|
|
37505
37628
|
`, "utf8");
|
|
37506
37629
|
} catch {
|
|
37507
37630
|
}
|
|
@@ -37510,7 +37633,7 @@ function clearAutoUpdateFailure(plan) {
|
|
|
37510
37633
|
const path = autoUpdateFailurePath(plan);
|
|
37511
37634
|
if (!path) return;
|
|
37512
37635
|
try {
|
|
37513
|
-
(0,
|
|
37636
|
+
(0, import_node_fs22.unlinkSync)(path);
|
|
37514
37637
|
} catch {
|
|
37515
37638
|
}
|
|
37516
37639
|
}
|
|
@@ -37565,7 +37688,7 @@ function installedPackageVersion(versionDir) {
|
|
|
37565
37688
|
"package.json"
|
|
37566
37689
|
);
|
|
37567
37690
|
try {
|
|
37568
|
-
const parsed = JSON.parse((0,
|
|
37691
|
+
const parsed = JSON.parse((0, import_node_fs22.readFileSync)(packageJsonPath, "utf8"));
|
|
37569
37692
|
return typeof parsed.version === "string" ? safeVersionSegment(parsed.version) : "";
|
|
37570
37693
|
} catch {
|
|
37571
37694
|
return "";
|
|
@@ -37680,7 +37803,7 @@ async function runNpmInstallWithRegistryFallback(input2) {
|
|
|
37680
37803
|
return first.exitCode;
|
|
37681
37804
|
}
|
|
37682
37805
|
function writeSidecarLauncher(input2) {
|
|
37683
|
-
(0,
|
|
37806
|
+
(0, import_node_fs22.mkdirSync)((0, import_node_path24.dirname)(input2.path), { recursive: true });
|
|
37684
37807
|
const packageRoot = (0, import_node_path24.dirname)((0, import_node_path24.dirname)((0, import_node_path24.dirname)(input2.entryPath)));
|
|
37685
37808
|
const versionDir = (0, import_node_path24.dirname)((0, import_node_path24.dirname)(packageRoot));
|
|
37686
37809
|
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);";
|
|
@@ -37693,7 +37816,7 @@ function writeSidecarLauncher(input2) {
|
|
|
37693
37816
|
)
|
|
37694
37817
|
];
|
|
37695
37818
|
if (process.platform === "win32") {
|
|
37696
|
-
(0,
|
|
37819
|
+
(0, import_node_fs22.writeFileSync)(
|
|
37697
37820
|
input2.path,
|
|
37698
37821
|
[
|
|
37699
37822
|
`@set DEEPLINE_HOST_URL=${input2.hostUrl.replace(/\r?\n/g, "")}`,
|
|
@@ -37716,7 +37839,7 @@ function writeSidecarLauncher(input2) {
|
|
|
37716
37839
|
);
|
|
37717
37840
|
return;
|
|
37718
37841
|
}
|
|
37719
|
-
(0,
|
|
37842
|
+
(0, import_node_fs22.writeFileSync)(
|
|
37720
37843
|
input2.path,
|
|
37721
37844
|
[
|
|
37722
37845
|
"#!/usr/bin/env sh",
|
|
@@ -37748,9 +37871,9 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
37748
37871
|
versionsDir,
|
|
37749
37872
|
`.tmp-sdk-update-${process.pid}-${Date.now()}`
|
|
37750
37873
|
);
|
|
37751
|
-
(0,
|
|
37752
|
-
(0,
|
|
37753
|
-
(0,
|
|
37874
|
+
(0, import_node_fs22.rmSync)(tempDir, { recursive: true, force: true });
|
|
37875
|
+
(0, import_node_fs22.mkdirSync)(tempDir, { recursive: true });
|
|
37876
|
+
(0, import_node_fs22.writeFileSync)((0, import_node_path24.join)(tempDir, "package.json"), NPM_SDK_SIDECAR_PACKAGE_JSON);
|
|
37754
37877
|
const env = {
|
|
37755
37878
|
...process.env,
|
|
37756
37879
|
PATH: `${(0, import_node_path24.dirname)(plan.nodeBin)}${process.platform === "win32" ? ";" : ":"}${process.env.PATH ?? ""}`
|
|
@@ -37770,7 +37893,7 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
37770
37893
|
);
|
|
37771
37894
|
const installExitCode = installResult.exitCode;
|
|
37772
37895
|
if (installExitCode !== 0) {
|
|
37773
|
-
(0,
|
|
37896
|
+
(0, import_node_fs22.rmSync)(tempDir, { recursive: true, force: true });
|
|
37774
37897
|
return installExitCode;
|
|
37775
37898
|
}
|
|
37776
37899
|
const installedVersion = installedPackageVersion(tempDir);
|
|
@@ -37778,7 +37901,7 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
37778
37901
|
process.stderr.write(
|
|
37779
37902
|
"Updated Deepline SDK package did not report a version.\n"
|
|
37780
37903
|
);
|
|
37781
|
-
(0,
|
|
37904
|
+
(0, import_node_fs22.rmSync)(tempDir, { recursive: true, force: true });
|
|
37782
37905
|
return 1;
|
|
37783
37906
|
}
|
|
37784
37907
|
const stagedFailure = sidecarInstallFailure(tempDir);
|
|
@@ -37787,7 +37910,7 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
37787
37910
|
`Updated Deepline SDK package is incomplete: ${stagedFailure}.
|
|
37788
37911
|
`
|
|
37789
37912
|
);
|
|
37790
|
-
(0,
|
|
37913
|
+
(0, import_node_fs22.rmSync)(tempDir, { recursive: true, force: true });
|
|
37791
37914
|
return 1;
|
|
37792
37915
|
}
|
|
37793
37916
|
const finalDir = (0, import_node_path24.join)(versionsDir, installedVersion);
|
|
@@ -37795,24 +37918,24 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
37795
37918
|
const finalFailure = sidecarInstallFailure(finalDir);
|
|
37796
37919
|
let backupDir = null;
|
|
37797
37920
|
if (!finalFailure) {
|
|
37798
|
-
(0,
|
|
37921
|
+
(0, import_node_fs22.rmSync)(tempDir, { recursive: true, force: true });
|
|
37799
37922
|
} else {
|
|
37800
37923
|
let shouldPublishTemp = true;
|
|
37801
|
-
if ((0,
|
|
37924
|
+
if ((0, import_node_fs22.existsSync)(finalDir)) {
|
|
37802
37925
|
backupDir = (0, import_node_path24.join)(
|
|
37803
37926
|
versionsDir,
|
|
37804
37927
|
`.backup-${installedVersion}-${process.pid}-${Date.now()}`
|
|
37805
37928
|
);
|
|
37806
37929
|
try {
|
|
37807
|
-
(0,
|
|
37930
|
+
(0, import_node_fs22.renameSync)(finalDir, backupDir);
|
|
37808
37931
|
} catch (error) {
|
|
37809
37932
|
const concurrentlyPublishedFailure = sidecarInstallFailure(finalDir);
|
|
37810
37933
|
if (!concurrentlyPublishedFailure) {
|
|
37811
|
-
(0,
|
|
37934
|
+
(0, import_node_fs22.rmSync)(tempDir, { recursive: true, force: true });
|
|
37812
37935
|
backupDir = null;
|
|
37813
37936
|
shouldPublishTemp = false;
|
|
37814
37937
|
} else {
|
|
37815
|
-
(0,
|
|
37938
|
+
(0, import_node_fs22.rmSync)(tempDir, { recursive: true, force: true });
|
|
37816
37939
|
process.stderr.write(
|
|
37817
37940
|
`Failed to preserve the incomplete Deepline SDK sidecar before repair: ${error.message}.
|
|
37818
37941
|
`
|
|
@@ -37823,18 +37946,18 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
37823
37946
|
}
|
|
37824
37947
|
if (shouldPublishTemp) {
|
|
37825
37948
|
try {
|
|
37826
|
-
(0,
|
|
37949
|
+
(0, import_node_fs22.renameSync)(tempDir, finalDir);
|
|
37827
37950
|
} catch (error) {
|
|
37828
|
-
(0,
|
|
37951
|
+
(0, import_node_fs22.rmSync)(tempDir, { recursive: true, force: true });
|
|
37829
37952
|
const concurrentlyPublishedFailure = sidecarInstallFailure(finalDir);
|
|
37830
37953
|
if (!concurrentlyPublishedFailure) {
|
|
37831
|
-
if (backupDir) (0,
|
|
37954
|
+
if (backupDir) (0, import_node_fs22.rmSync)(backupDir, { recursive: true, force: true });
|
|
37832
37955
|
backupDir = null;
|
|
37833
37956
|
} else {
|
|
37834
37957
|
let restoreFailure = "";
|
|
37835
|
-
if (backupDir && (0,
|
|
37958
|
+
if (backupDir && (0, import_node_fs22.existsSync)(backupDir) && !(0, import_node_fs22.existsSync)(finalDir)) {
|
|
37836
37959
|
try {
|
|
37837
|
-
(0,
|
|
37960
|
+
(0, import_node_fs22.renameSync)(backupDir, finalDir);
|
|
37838
37961
|
backupDir = null;
|
|
37839
37962
|
} catch (restoreError) {
|
|
37840
37963
|
restoreFailure = `; failed to restore previous install: ${restoreError.message}`;
|
|
@@ -37851,10 +37974,10 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
37851
37974
|
}
|
|
37852
37975
|
const publishedFailure = sidecarStructureFailure(finalDir);
|
|
37853
37976
|
if (publishedFailure) {
|
|
37854
|
-
if (backupDir && (0,
|
|
37855
|
-
(0,
|
|
37977
|
+
if (backupDir && (0, import_node_fs22.existsSync)(backupDir)) {
|
|
37978
|
+
(0, import_node_fs22.rmSync)(finalDir, { recursive: true, force: true });
|
|
37856
37979
|
try {
|
|
37857
|
-
(0,
|
|
37980
|
+
(0, import_node_fs22.renameSync)(backupDir, finalDir);
|
|
37858
37981
|
backupDir = null;
|
|
37859
37982
|
} catch {
|
|
37860
37983
|
}
|
|
@@ -37865,7 +37988,7 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
37865
37988
|
);
|
|
37866
37989
|
return 1;
|
|
37867
37990
|
}
|
|
37868
|
-
if (backupDir) (0,
|
|
37991
|
+
if (backupDir) (0, import_node_fs22.rmSync)(backupDir, { recursive: true, force: true });
|
|
37869
37992
|
writeSidecarLauncher({
|
|
37870
37993
|
path: plan.sidecarPath,
|
|
37871
37994
|
hostUrl: plan.hostUrl,
|
|
@@ -37873,27 +37996,27 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
37873
37996
|
nodeBin: plan.nodeBin,
|
|
37874
37997
|
entryPath: finalEntryPath
|
|
37875
37998
|
});
|
|
37876
|
-
(0,
|
|
37999
|
+
(0, import_node_fs22.writeFileSync)(
|
|
37877
38000
|
(0, import_node_path24.join)(plan.stateDir, ".version"),
|
|
37878
38001
|
`${installedVersion}
|
|
37879
38002
|
`,
|
|
37880
38003
|
"utf8"
|
|
37881
38004
|
);
|
|
37882
|
-
(0,
|
|
38005
|
+
(0, import_node_fs22.writeFileSync)(
|
|
37883
38006
|
(0, import_node_path24.join)(plan.stateDir, ".install-method"),
|
|
37884
38007
|
"python-sidecar\n",
|
|
37885
38008
|
"utf8"
|
|
37886
38009
|
);
|
|
37887
|
-
(0,
|
|
38010
|
+
(0, import_node_fs22.writeFileSync)(
|
|
37888
38011
|
(0, import_node_path24.join)(plan.stateDir, ".command-path"),
|
|
37889
38012
|
`${plan.sidecarPath}
|
|
37890
38013
|
`,
|
|
37891
38014
|
"utf8"
|
|
37892
38015
|
);
|
|
37893
|
-
(0,
|
|
37894
|
-
(0,
|
|
38016
|
+
(0, import_node_fs22.writeFileSync)((0, import_node_path24.join)(plan.stateDir, ".runner"), "node\n", "utf8");
|
|
38017
|
+
(0, import_node_fs22.writeFileSync)((0, import_node_path24.join)(plan.stateDir, ".node-bin"), `${plan.nodeBin}
|
|
37895
38018
|
`, "utf8");
|
|
37896
|
-
(0,
|
|
38019
|
+
(0, import_node_fs22.writeFileSync)(
|
|
37897
38020
|
(0, import_node_path24.join)(plan.stateDir, ".entry-path"),
|
|
37898
38021
|
`${finalEntryPath}
|
|
37899
38022
|
`,
|
|
@@ -38821,12 +38944,12 @@ chooses the connected Slack channel or member and the events it receives.
|
|
|
38821
38944
|
|
|
38822
38945
|
// src/cli/commands/tools.ts
|
|
38823
38946
|
var import_commander3 = require("commander");
|
|
38824
|
-
var
|
|
38947
|
+
var import_node_fs24 = require("fs");
|
|
38825
38948
|
var import_node_os17 = require("os");
|
|
38826
38949
|
var import_node_path26 = require("path");
|
|
38827
38950
|
|
|
38828
38951
|
// src/tool-output.ts
|
|
38829
|
-
var
|
|
38952
|
+
var import_node_fs23 = require("fs");
|
|
38830
38953
|
var import_node_os16 = require("os");
|
|
38831
38954
|
var import_node_path25 = require("path");
|
|
38832
38955
|
function isPlainObject(value) {
|
|
@@ -38956,18 +39079,18 @@ function projectRowOutput(conversion) {
|
|
|
38956
39079
|
}
|
|
38957
39080
|
function ensureOutputDir() {
|
|
38958
39081
|
const outputDir = (0, import_node_path25.join)((0, import_node_os16.homedir)(), ".local", "share", "deepline", "data");
|
|
38959
|
-
(0,
|
|
39082
|
+
(0, import_node_fs23.mkdirSync)(outputDir, { recursive: true });
|
|
38960
39083
|
return outputDir;
|
|
38961
39084
|
}
|
|
38962
39085
|
function writeJsonOutputFile(payload, stem) {
|
|
38963
39086
|
const outputDir = ensureOutputDir();
|
|
38964
39087
|
const outputPath = (0, import_node_path25.join)(outputDir, `${stem}_${Date.now()}.json`);
|
|
38965
|
-
(0,
|
|
39088
|
+
(0, import_node_fs23.writeFileSync)(outputPath, JSON.stringify(payload, null, 2), "utf-8");
|
|
38966
39089
|
return outputPath;
|
|
38967
39090
|
}
|
|
38968
39091
|
function writeCsvOutputFile(rows, stem, options) {
|
|
38969
39092
|
const outputPath = options?.outPath ? options.outPath : (0, import_node_path25.join)(ensureOutputDir(), `${stem}_${Date.now()}.csv`);
|
|
38970
|
-
(0,
|
|
39093
|
+
(0, import_node_fs23.mkdirSync)((0, import_node_path25.dirname)(outputPath), { recursive: true });
|
|
38971
39094
|
const columns = columnsForRows(rows);
|
|
38972
39095
|
const escapeCell = (value) => {
|
|
38973
39096
|
const normalized = value == null ? "" : typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : JSON.stringify(value);
|
|
@@ -38976,19 +39099,19 @@ function writeCsvOutputFile(rows, stem, options) {
|
|
|
38976
39099
|
}
|
|
38977
39100
|
return normalized;
|
|
38978
39101
|
};
|
|
38979
|
-
const fd = (0,
|
|
39102
|
+
const fd = (0, import_node_fs23.openSync)(outputPath, "w");
|
|
38980
39103
|
try {
|
|
38981
|
-
(0,
|
|
39104
|
+
(0, import_node_fs23.writeSync)(fd, `${columns.map(escapeCell).join(",")}
|
|
38982
39105
|
`);
|
|
38983
39106
|
for (const row of rows) {
|
|
38984
|
-
(0,
|
|
39107
|
+
(0, import_node_fs23.writeSync)(
|
|
38985
39108
|
fd,
|
|
38986
39109
|
`${columns.map((column) => escapeCell(row[column])).join(",")}
|
|
38987
39110
|
`
|
|
38988
39111
|
);
|
|
38989
39112
|
}
|
|
38990
39113
|
} finally {
|
|
38991
|
-
(0,
|
|
39114
|
+
(0, import_node_fs23.closeSync)(fd);
|
|
38992
39115
|
}
|
|
38993
39116
|
const previewRows = rows.slice(0, 5);
|
|
38994
39117
|
const previewColumns = columns.slice(0, 5);
|
|
@@ -40928,10 +41051,10 @@ function normalizeOutputFormat(raw) {
|
|
|
40928
41051
|
function resolveAtFilePath(rawPath) {
|
|
40929
41052
|
const trimmed = rawPath.trim();
|
|
40930
41053
|
const resolved = (0, import_node_path26.resolve)(trimmed);
|
|
40931
|
-
if ((0,
|
|
41054
|
+
if ((0, import_node_fs24.existsSync)(resolved)) return resolved;
|
|
40932
41055
|
if (process.platform !== "win32" && trimmed.includes("\\")) {
|
|
40933
41056
|
const normalized = (0, import_node_path26.resolve)(trimmed.replace(/\\/g, "/"));
|
|
40934
|
-
if ((0,
|
|
41057
|
+
if ((0, import_node_fs24.existsSync)(normalized)) return normalized;
|
|
40935
41058
|
}
|
|
40936
41059
|
return resolved;
|
|
40937
41060
|
}
|
|
@@ -40942,7 +41065,7 @@ function readJsonArgument(raw, flagName) {
|
|
|
40942
41065
|
throw new Error(`Invalid ${flagName} value: empty @file path.`);
|
|
40943
41066
|
}
|
|
40944
41067
|
try {
|
|
40945
|
-
return (0,
|
|
41068
|
+
return (0, import_node_fs24.readFileSync)(resolveAtFilePath(filePath), "utf8").replace(
|
|
40946
41069
|
/^\uFEFF/,
|
|
40947
41070
|
""
|
|
40948
41071
|
);
|
|
@@ -41049,8 +41172,8 @@ function starterScriptJson(script) {
|
|
|
41049
41172
|
function seedToolListScript(input2) {
|
|
41050
41173
|
const stem = safeFileStem(input2.toolId);
|
|
41051
41174
|
const fileName = `${stem}-workflow-seed-${Date.now()}.play.ts`;
|
|
41052
|
-
const scriptDir = (0,
|
|
41053
|
-
(0,
|
|
41175
|
+
const scriptDir = (0, import_node_fs24.mkdtempSync)((0, import_node_path26.join)((0, import_node_os17.tmpdir)(), "deepline-workflow-seed-"));
|
|
41176
|
+
(0, import_node_fs24.chmodSync)(scriptDir, 448);
|
|
41054
41177
|
const scriptPath = (0, import_node_path26.join)(scriptDir, fileName);
|
|
41055
41178
|
const projectDir = `deepline/projects/${stem}-workflow`;
|
|
41056
41179
|
const playName = `${stem}-workflow`;
|
|
@@ -41094,7 +41217,7 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
|
|
|
41094
41217
|
description: ${JSON.stringify(`Seed ${input2.toolId} rows into a Deepline workflow-ready dataset.`)},
|
|
41095
41218
|
});
|
|
41096
41219
|
`;
|
|
41097
|
-
(0,
|
|
41220
|
+
(0, import_node_fs24.writeFileSync)(scriptPath, script, { encoding: "utf-8", mode: 384 });
|
|
41098
41221
|
return {
|
|
41099
41222
|
path: scriptPath,
|
|
41100
41223
|
sourceCode: script,
|