deepline 0.3.68 → 0.3.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js 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.68",
1217
+ version: "0.3.69",
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
@@ -18154,12 +18154,20 @@ async function publishImportedPlayDependencies(client2, graph) {
18154
18154
  };
18155
18155
  await publishNode(graph.root.filePath, true);
18156
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
+ }
18157
18163
  function formatTimestamp(value) {
18158
- if (!value) return "\u2014";
18159
- const date = typeof value === "number" ? new Date(value) : new Date(value);
18160
- if (Number.isNaN(date.getTime())) return "\u2014";
18164
+ const date = timestampDate(value);
18165
+ if (!date) return "\u2014";
18161
18166
  return date.toISOString();
18162
18167
  }
18168
+ function isoTimestamp(value) {
18169
+ return timestampDate(value)?.toISOString() ?? null;
18170
+ }
18163
18171
  function formatRunLine(run) {
18164
18172
  const credits = typeof run.billingTotalCredits === "number" && Number.isFinite(run.billingTotalCredits) ? `${formatCreditAmount(run.billingTotalCredits)} credits` : "\u2014";
18165
18173
  return `${run.workflowId} ${run.status} ${formatTimestamp(run.startTime)} ${credits}`;
@@ -22585,13 +22593,22 @@ async function handleRunsList(args) {
22585
22593
  ...offset !== void 0 ? { offset } : {}
22586
22594
  })).map((run) => ({
22587
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.
22588
22599
  workflowId: run.workflowId,
22589
- temporalRunId: run.runId,
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,
22590
22603
  parentRunId: run.parentRunId ?? null,
22591
22604
  rootRunId: run.rootRunId ?? null,
22592
22605
  status: String(run.status ?? "").toLowerCase(),
22606
+ createdAt: run.createdAt ?? null,
22607
+ createdAtIso: isoTimestamp(run.createdAt),
22593
22608
  startedAt: run.startTime ?? run.startedAt ?? null,
22609
+ startedAtIso: isoTimestamp(run.startTime ?? run.startedAt ?? null),
22594
22610
  finishedAt: run.closeTime ?? run.finishedAt ?? null,
22611
+ finishedAtIso: isoTimestamp(run.closeTime ?? run.finishedAt ?? null),
22595
22612
  executionTime: run.executionTime,
22596
22613
  billingTotalCredits: run.billingTotalCredits,
22597
22614
  billingMaxCreditsPerRun: run.billingMaxCreditsPerRun,
@@ -22599,9 +22616,19 @@ async function handleRunsList(args) {
22599
22616
  }));
22600
22617
  const lines = runs.length === 0 ? [
22601
22618
  playName ? `No runs found for ${playName}.` : `No runs found for status ${statusFilter}.`
22602
- ] : runs.map(
22603
- (run) => `${run.runId} ${run.status} ${formatTimestamp(run.startedAt)} ${typeof run.billingTotalCredits === "number" && Number.isFinite(run.billingTotalCredits) ? `${formatCreditAmount(run.billingTotalCredits)} credits` : "\u2014"}${run.parentRunId ? ` parent=${run.parentRunId}` : ""}`
22604
- );
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
+ });
22605
22632
  printCommandEnvelope(
22606
22633
  {
22607
22634
  runs,
@@ -30407,10 +30434,12 @@ function registerEnrichCommand(program) {
30407
30434
  }
30408
30435
 
30409
30436
  // src/cli/commands/feedback.ts
30437
+ var import_node_fs13 = require("fs");
30410
30438
  async function handleFeedback(text, options) {
30439
+ const message = resolveFeedbackText(text, options.file);
30411
30440
  const { http } = getAuthedHttpClient();
30412
30441
  const response = await http.post("/api/v2/cli/feedback", {
30413
- text,
30442
+ text: message,
30414
30443
  requested: options.requested === true,
30415
30444
  environment: collectLocalEnvInfo(),
30416
30445
  ...options.command ? { command: options.command } : {},
@@ -30428,6 +30457,35 @@ async function handleFeedback(text, options) {
30428
30457
  { json: options.json }
30429
30458
  );
30430
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
+ }
30431
30489
  function registerFeedbackCommands(program) {
30432
30490
  const feedback = program.command("feedback").description("Submit CLI feedback to Deepline.").addHelpText(
30433
30491
  "after",
@@ -30447,17 +30505,19 @@ Examples:
30447
30505
  `
30448
30506
  Examples:
30449
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
30450
30510
  deepline feedback send "tools search returned stale results" --requested --json
30451
30511
  deepline feedback send "plays run failed after upload" --command "deepline plays run my.play.ts --watch"
30452
30512
  `
30453
- ).argument("<text>", "Feedback text").option("--command <command>", "Command that reproduced the issue").option("--payload <payload>", "JSON or plain-text payload for the repro").option(
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(
30454
30514
  "--requested",
30455
30515
  "Mark the report as explicitly requested by the user"
30456
30516
  ).option("--json", "Emit JSON output").action(handleFeedback);
30457
30517
  }
30458
30518
 
30459
30519
  // src/cli/commands/sessions.ts
30460
- var import_node_fs13 = require("fs");
30520
+ var import_node_fs14 = require("fs");
30461
30521
  var import_node_os10 = require("os");
30462
30522
  var import_node_path16 = require("path");
30463
30523
  var import_node_zlib = require("zlib");
@@ -30492,7 +30552,7 @@ function codexSessionsRoot() {
30492
30552
  }
30493
30553
  function listClaudeSessionFiles() {
30494
30554
  const root = claudeProjectsRoot();
30495
- if (!(0, import_node_fs13.existsSync)(root)) return [];
30555
+ if (!(0, import_node_fs14.existsSync)(root)) return [];
30496
30556
  const projectDirs = readDirectoryNames(root);
30497
30557
  const files = [];
30498
30558
  for (const projectDir of projectDirs) {
@@ -30517,7 +30577,7 @@ function listClaudeSessionFiles() {
30517
30577
  }
30518
30578
  function listCodexSessionFiles() {
30519
30579
  const root = codexSessionsRoot();
30520
- if (!(0, import_node_fs13.existsSync)(root)) return [];
30580
+ if (!(0, import_node_fs14.existsSync)(root)) return [];
30521
30581
  const files = [];
30522
30582
  for (const filePath of listJsonlFilesRecursive(root, 5)) {
30523
30583
  const stat4 = statIfReadable(filePath);
@@ -30540,7 +30600,7 @@ function listSessionFiles(agent) {
30540
30600
  }
30541
30601
  function readDirectoryNames(dir) {
30542
30602
  try {
30543
- return (0, import_node_fs13.readdirSync)(dir);
30603
+ return (0, import_node_fs14.readdirSync)(dir);
30544
30604
  } catch {
30545
30605
  return [];
30546
30606
  }
@@ -30551,7 +30611,7 @@ function listJsonlFilesRecursive(root, maxDepth) {
30551
30611
  if (depth > maxDepth) return;
30552
30612
  let entries;
30553
30613
  try {
30554
- entries = (0, import_node_fs13.readdirSync)(dir, { withFileTypes: true });
30614
+ entries = (0, import_node_fs14.readdirSync)(dir, { withFileTypes: true });
30555
30615
  } catch {
30556
30616
  return;
30557
30617
  }
@@ -30569,7 +30629,7 @@ function listJsonlFilesRecursive(root, maxDepth) {
30569
30629
  }
30570
30630
  function statIfReadable(filePath) {
30571
30631
  try {
30572
- return (0, import_node_fs13.statSync)(filePath);
30632
+ return (0, import_node_fs14.statSync)(filePath);
30573
30633
  } catch {
30574
30634
  return null;
30575
30635
  }
@@ -30592,7 +30652,7 @@ function sessionIdFromCodexFilePath(filePath) {
30592
30652
  }
30593
30653
  function readCodexSessionId(filePath) {
30594
30654
  try {
30595
- for (const line of normalizedJsonLines((0, import_node_fs13.readFileSync)(filePath)).slice(
30655
+ for (const line of normalizedJsonLines((0, import_node_fs14.readFileSync)(filePath)).slice(
30596
30656
  0,
30597
30657
  20
30598
30658
  )) {
@@ -30907,11 +30967,11 @@ async function uploadChunkedSessions(sessions, options) {
30907
30967
  async function handleSessionsSend(options) {
30908
30968
  if (options.file) {
30909
30969
  const filePath = (0, import_node_path16.resolve)(options.file);
30910
- if (!(0, import_node_fs13.existsSync)(filePath)) {
30970
+ if (!(0, import_node_fs14.existsSync)(filePath)) {
30911
30971
  throw new Error(`File not found: ${options.file}`);
30912
30972
  }
30913
30973
  const response2 = await uploadPayload("/api/v2/cli/send-session", {
30914
- file: (0, import_node_fs13.readFileSync)(filePath).toString("base64"),
30974
+ file: (0, import_node_fs14.readFileSync)(filePath).toString("base64"),
30915
30975
  filename: (0, import_node_path16.basename)(filePath)
30916
30976
  });
30917
30977
  printCommandEnvelope(
@@ -30941,7 +31001,7 @@ async function handleSessionsSend(options) {
30941
31001
  agent: options.agent
30942
31002
  });
30943
31003
  const built = targets.map((target) => {
30944
- const upload = buildSessionUploadContent((0, import_node_fs13.readFileSync)(target.filePath));
31004
+ const upload = buildSessionUploadContent((0, import_node_fs14.readFileSync)(target.filePath));
30945
31005
  return { ...target, ...upload };
30946
31006
  });
30947
31007
  if (built.some((session) => session.needsChunking)) {
@@ -31023,10 +31083,10 @@ function loadViewerAssets() {
31023
31083
  try {
31024
31084
  const cssPath = (0, import_node_path16.join)(root, "viewer.css");
31025
31085
  const jsPath = (0, import_node_path16.join)(root, "viewer.js");
31026
- if (!(0, import_node_fs13.existsSync)(cssPath) || !(0, import_node_fs13.existsSync)(jsPath)) continue;
31086
+ if (!(0, import_node_fs14.existsSync)(cssPath) || !(0, import_node_fs14.existsSync)(jsPath)) continue;
31027
31087
  return {
31028
- css: (0, import_node_fs13.readFileSync)(cssPath, "utf8"),
31029
- js: (0, import_node_fs13.readFileSync)(jsPath, "utf8")
31088
+ css: (0, import_node_fs14.readFileSync)(cssPath, "utf8"),
31089
+ js: (0, import_node_fs14.readFileSync)(jsPath, "utf8")
31030
31090
  };
31031
31091
  } catch {
31032
31092
  continue;
@@ -31053,18 +31113,18 @@ async function handleSessionsRender(options) {
31053
31113
  let outputPath = options.output ? (0, import_node_path16.resolve)(options.output) : "";
31054
31114
  if (!outputPath) {
31055
31115
  const outputDir = (0, import_node_path16.join)(process.cwd(), "deepline", "data");
31056
- (0, import_node_fs13.mkdirSync)(outputDir, { recursive: true });
31116
+ (0, import_node_fs14.mkdirSync)(outputDir, { recursive: true });
31057
31117
  outputPath = (0, import_node_path16.join)(
31058
31118
  outputDir,
31059
31119
  targets.length > 1 ? "session-viewer.html" : `session-${targets[0]?.sessionId}.html`
31060
31120
  );
31061
31121
  } else {
31062
- (0, import_node_fs13.mkdirSync)((0, import_node_path16.dirname)(outputPath), { recursive: true });
31122
+ (0, import_node_fs14.mkdirSync)((0, import_node_path16.dirname)(outputPath), { recursive: true });
31063
31123
  }
31064
31124
  const sessions = targets.map((target) => ({
31065
31125
  label: target.label,
31066
31126
  events: parsePreparedEvents(
31067
- prepareSessionBuffer((0, import_node_fs13.readFileSync)(target.filePath))
31127
+ prepareSessionBuffer((0, import_node_fs14.readFileSync)(target.filePath))
31068
31128
  )
31069
31129
  }));
31070
31130
  const { css, js } = loadViewerAssets();
@@ -31089,7 +31149,7 @@ ${refreshMeta}
31089
31149
  <script>${js}</script>
31090
31150
  </body>
31091
31151
  </html>`;
31092
- (0, import_node_fs13.writeFileSync)(outputPath, html, "utf8");
31152
+ (0, import_node_fs14.writeFileSync)(outputPath, html, "utf8");
31093
31153
  printCommandEnvelope(
31094
31154
  {
31095
31155
  ok: true,
@@ -31298,7 +31358,7 @@ Examples:
31298
31358
 
31299
31359
  // src/cli/commands/monitors.ts
31300
31360
  var import_node_crypto8 = require("crypto");
31301
- var import_node_fs14 = require("fs");
31361
+ var import_node_fs15 = require("fs");
31302
31362
  var import_node_path17 = require("path");
31303
31363
  var import_promises8 = require("readline/promises");
31304
31364
 
@@ -31738,8 +31798,8 @@ function parseJsonObjectArg(raw, argLabel) {
31738
31798
  return parsed;
31739
31799
  }
31740
31800
  function resolveMonitorJsonBody(input2) {
31741
- const readFile6 = input2.readFile ?? ((path) => (0, import_node_fs14.readFileSync)(path, "utf-8"));
31742
- const readStdin = input2.readStdin ?? (() => (0, import_node_fs14.readFileSync)(0, "utf-8"));
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"));
31743
31803
  if (input2.positional !== void 0 && input2.file !== void 0) {
31744
31804
  throw new MonitorsUsageError(
31745
31805
  `Pass exactly one source for ${input2.argLabel}: the positional JSON or --file, not both.`
@@ -32136,6 +32196,7 @@ function renderDeployedListText(payload, requestedStatus) {
32136
32196
  if (!entry || !key) continue;
32137
32197
  const status = asString(entry.status);
32138
32198
  const tool = asString(entry.tool);
32199
+ const monitorType = asString(entry.type);
32139
32200
  const name = asString(entry.name);
32140
32201
  const outputTable = asString(entry.output_table);
32141
32202
  const webhookState = asString(entry.webhook_state);
@@ -32146,10 +32207,11 @@ function renderDeployedListText(payload, requestedStatus) {
32146
32207
  lines.push(
32147
32208
  ` ${key}${status ? ` ${status}` : ""}${tool ? ` ${tool}` : ""}${name ? ` (${name})` : ""}`
32148
32209
  );
32149
- if (outputTable || webhookState || executionType || boundPlays !== void 0) {
32210
+ if (outputTable || monitorType || webhookState || executionType || boundPlays !== void 0) {
32150
32211
  lines.push(
32151
32212
  ` ${[
32152
32213
  outputTable ? `table: ${outputTable}` : null,
32214
+ monitorType ? `type: ${monitorType}` : null,
32153
32215
  webhookState ? `webhook: ${webhookState}` : null,
32154
32216
  executionType ? `execution: ${executionType}` : null,
32155
32217
  boundPlays !== void 0 ? `bound Plays: ${boundPlays}` : null
@@ -32642,7 +32704,7 @@ async function handleMonitorFleetsInit(fleetId, options) {
32642
32704
  };
32643
32705
  const definition = requireCompiledFleetDefinition(authoredDefinition);
32644
32706
  const file = (0, import_node_path17.resolve)(out);
32645
- (0, import_node_fs14.writeFileSync)(file, `${JSON.stringify(definition, null, 2)}
32707
+ (0, import_node_fs15.writeFileSync)(file, `${JSON.stringify(definition, null, 2)}
32646
32708
  `, "utf8");
32647
32709
  const next = `deepline monitors fleets sync --file ${fleetShellArg(file)} --dry-run --json`;
32648
32710
  printCommandEnvelope(
@@ -32974,6 +33036,7 @@ function renderMonitorGet(payload) {
32974
33036
  const tool = asString(payload.tool);
32975
33037
  if (!key || !tool) return void 0;
32976
33038
  const status = asString(payload.status);
33039
+ const monitorType = asString(payload.type);
32977
33040
  const hasLastReceivedEvent = "last_received_event" in payload;
32978
33041
  const lastReceivedEvent = asString(payload.last_received_event);
32979
33042
  const definition = asRecord2(payload.definition);
@@ -32991,8 +33054,9 @@ function renderMonitorGet(payload) {
32991
33054
  const lines = [
32992
33055
  `Monitor: ${key}`,
32993
33056
  `Tool: ${tool}`,
33057
+ ...monitorType ? [`Type: ${monitorType}`] : [],
32994
33058
  ...status ? [`Status: ${status}`] : [],
32995
- ...hasLastReceivedEvent ? [`Last received: ${lastReceivedEvent ?? "never"}`] : [],
33059
+ ...hasLastReceivedEvent ? [`Latest inbound event: ${lastReceivedEvent ?? "never"}`] : [],
32996
33060
  ...pricingLine ? [`Pricing: ${pricingLine}`] : [],
32997
33061
  ...nextRenewalAt ? [`Next renewal: ${nextRenewalAt}`] : []
32998
33062
  ];
@@ -33058,17 +33122,15 @@ function renderMonitorGet(payload) {
33058
33122
  const name = asString(play.name) ?? "unnamed Play";
33059
33123
  const listener = asString(play.listener_key);
33060
33124
  const health = asRecord2(play.consumer_health);
33061
- const status2 = asString(health?.last_run_status) ?? "no delivery yet";
33125
+ const runStatus = asString(health?.last_run_status);
33062
33126
  const lastDelivery = asFiniteNumber(health?.last_delivery_at);
33127
+ const runId = asString(health?.last_run_id);
33063
33128
  const error = asString(health?.last_error);
33129
+ lines.push(` ${name}${listener ? ` (listener: ${listener})` : ""}:`);
33064
33130
  lines.push(
33065
- ` ${name}${listener ? ` (listener: ${listener})` : ""}: ${status2}`
33131
+ ` Latest delivered event: ${lastDelivery !== void 0 ? new Date(lastDelivery).toISOString() : "never"}`,
33132
+ ` Latest consumer run: ${runId ?? "never"}${runStatus ? ` (${runStatus})` : ""}`
33066
33133
  );
33067
- if (lastDelivery !== void 0) {
33068
- lines.push(
33069
- ` last delivery: ${new Date(lastDelivery).toISOString()}`
33070
- );
33071
- }
33072
33134
  if (error) lines.push(` error: ${error}`);
33073
33135
  }
33074
33136
  }
@@ -34722,38 +34784,38 @@ Examples:
34722
34784
 
34723
34785
  // src/cli/commands/setup.ts
34724
34786
  var import_node_child_process4 = require("child_process");
34725
- var import_node_fs18 = require("fs");
34787
+ var import_node_fs19 = require("fs");
34726
34788
  var import_node_os13 = require("os");
34727
34789
  var import_node_path21 = require("path");
34728
34790
 
34729
34791
  // src/cli/installation-lifecycle.ts
34730
- var import_node_fs15 = require("fs");
34792
+ var import_node_fs16 = require("fs");
34731
34793
  var import_node_path18 = require("path");
34732
34794
  var nodeFileSystem = {
34733
- exists: import_node_fs15.existsSync,
34795
+ exists: import_node_fs16.existsSync,
34734
34796
  isSymbolicLink(path) {
34735
34797
  try {
34736
- return (0, import_node_fs15.lstatSync)(path).isSymbolicLink();
34798
+ return (0, import_node_fs16.lstatSync)(path).isSymbolicLink();
34737
34799
  } catch {
34738
34800
  return false;
34739
34801
  }
34740
34802
  },
34741
34803
  read(path) {
34742
34804
  try {
34743
- return (0, import_node_fs15.readFileSync)(path, "utf8");
34805
+ return (0, import_node_fs16.readFileSync)(path, "utf8");
34744
34806
  } catch {
34745
34807
  return "";
34746
34808
  }
34747
34809
  },
34748
34810
  realpath(path) {
34749
34811
  try {
34750
- return (0, import_node_fs15.realpathSync)(path);
34812
+ return (0, import_node_fs16.realpathSync)(path);
34751
34813
  } catch {
34752
34814
  return null;
34753
34815
  }
34754
34816
  },
34755
34817
  remove(path) {
34756
- (0, import_node_fs15.rmSync)(path, { force: true });
34818
+ (0, import_node_fs16.rmSync)(path, { force: true });
34757
34819
  }
34758
34820
  };
34759
34821
  function inspectLauncher(path, fileSystem = nodeFileSystem) {
@@ -34850,7 +34912,7 @@ function isOwnedInstallerCommandPath(input2) {
34850
34912
 
34851
34913
  // src/cli/commands/skills.ts
34852
34914
  var import_node_child_process3 = require("child_process");
34853
- var import_node_fs17 = require("fs");
34915
+ var import_node_fs18 = require("fs");
34854
34916
  var import_node_os12 = require("os");
34855
34917
  var import_node_path20 = require("path");
34856
34918
 
@@ -34962,7 +35024,7 @@ function buildSkillsAddArgs(baseUrl, skillName, options = {}) {
34962
35024
 
34963
35025
  // src/cli/skills-sync.ts
34964
35026
  var import_node_child_process2 = require("child_process");
34965
- var import_node_fs16 = require("fs");
35027
+ var import_node_fs17 = require("fs");
34966
35028
  var import_node_path19 = require("path");
34967
35029
 
34968
35030
  // src/cli/windows-arg-escape.ts
@@ -35323,15 +35385,15 @@ function hasMarkedSkillsSyncVersion(path, version) {
35323
35385
  }
35324
35386
  function readMarkedSkillsSyncVersion(path) {
35325
35387
  try {
35326
- return (0, import_node_fs16.existsSync)(path) ? (0, import_node_fs16.readFileSync)(path, "utf-8").trim() : "";
35388
+ return (0, import_node_fs17.existsSync)(path) ? (0, import_node_fs17.readFileSync)(path, "utf-8").trim() : "";
35327
35389
  } catch {
35328
35390
  return "";
35329
35391
  }
35330
35392
  }
35331
35393
  function writeMarkedSkillsSyncVersion(path, version) {
35332
35394
  try {
35333
- (0, import_node_fs16.mkdirSync)((0, import_node_path19.dirname)(path), { recursive: true });
35334
- (0, import_node_fs16.writeFileSync)(path, `${version}
35395
+ (0, import_node_fs17.mkdirSync)((0, import_node_path19.dirname)(path), { recursive: true });
35396
+ (0, import_node_fs17.writeFileSync)(path, `${version}
35335
35397
  `, "utf-8");
35336
35398
  return true;
35337
35399
  } catch {
@@ -35350,7 +35412,7 @@ ${manualCommand}`
35350
35412
  }
35351
35413
  function clearUnavailableSkillsNotice(baseUrl) {
35352
35414
  try {
35353
- (0, import_node_fs16.unlinkSync)(unavailableSkillsNoticePath(baseUrl));
35415
+ (0, import_node_fs17.unlinkSync)(unavailableSkillsNoticePath(baseUrl));
35354
35416
  } catch {
35355
35417
  }
35356
35418
  }
@@ -35361,7 +35423,7 @@ function hasFailedSkillsSync(baseUrl, remoteVersion, agents) {
35361
35423
  );
35362
35424
  }
35363
35425
  function hasFailedAutomaticSkillsSync(baseUrl, agents) {
35364
- return (0, import_node_fs16.existsSync)(failedSkillsSyncPath(baseUrl, agents));
35426
+ return (0, import_node_fs17.existsSync)(failedSkillsSyncPath(baseUrl, agents));
35365
35427
  }
35366
35428
  function markFailedSkillsSync(baseUrl, remoteVersion, agents) {
35367
35429
  return writeMarkedSkillsSyncVersion(
@@ -35371,7 +35433,7 @@ function markFailedSkillsSync(baseUrl, remoteVersion, agents) {
35371
35433
  }
35372
35434
  function clearFailedSkillsSync(baseUrl, agents) {
35373
35435
  try {
35374
- (0, import_node_fs16.unlinkSync)(failedSkillsSyncPath(baseUrl, agents));
35436
+ (0, import_node_fs17.unlinkSync)(failedSkillsSyncPath(baseUrl, agents));
35375
35437
  } catch {
35376
35438
  }
35377
35439
  }
@@ -35738,7 +35800,7 @@ function detectSkillsAgents(input2) {
35738
35800
  ];
35739
35801
  const detected = AGENT_MARKERS.filter(
35740
35802
  (marker) => roots.some(
35741
- (root) => marker.paths.some((path) => (0, import_node_fs17.existsSync)((0, import_node_path20.join)(root, path)))
35803
+ (root) => marker.paths.some((path) => (0, import_node_fs18.existsSync)((0, import_node_path20.join)(root, path)))
35742
35804
  )
35743
35805
  ).map((marker) => marker.agent);
35744
35806
  return detected.length > 0 ? detected : ["*"];
@@ -35811,7 +35873,7 @@ function isSkillsPlanCurrent(plan, state) {
35811
35873
  }
35812
35874
  function readSkillsInstallState(path) {
35813
35875
  try {
35814
- const parsed = JSON.parse((0, import_node_fs17.readFileSync)(path, "utf8"));
35876
+ const parsed = JSON.parse((0, import_node_fs18.readFileSync)(path, "utf8"));
35815
35877
  return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
35816
35878
  } catch {
35817
35879
  return null;
@@ -35964,8 +36026,8 @@ async function runSkillsCommand(options, dependencies = {}) {
35964
36026
  `
35965
36027
  );
35966
36028
  }
35967
- (0, import_node_fs17.mkdirSync)((0, import_node_path20.dirname)(plan.statePath), { recursive: true });
35968
- (0, import_node_fs17.writeFileSync)(
36029
+ (0, import_node_fs18.mkdirSync)((0, import_node_path20.dirname)(plan.statePath), { recursive: true });
36030
+ (0, import_node_fs18.writeFileSync)(
35969
36031
  plan.statePath,
35970
36032
  `${JSON.stringify(
35971
36033
  {
@@ -36103,7 +36165,7 @@ function phasesFromLegacyStatus(status) {
36103
36165
  function readSetupState(input2) {
36104
36166
  try {
36105
36167
  const parsed = JSON.parse(
36106
- (0, import_node_fs18.readFileSync)(
36168
+ (0, import_node_fs19.readFileSync)(
36107
36169
  setupStatePath(input2.baseUrl, input2.scope, input2.root),
36108
36170
  "utf8"
36109
36171
  )
@@ -36208,7 +36270,7 @@ function asRecord3(value) {
36208
36270
  }
36209
36271
  function safeRead(path) {
36210
36272
  try {
36211
- return (0, import_node_fs18.readFileSync)(path, "utf8");
36273
+ return (0, import_node_fs19.readFileSync)(path, "utf8");
36212
36274
  } catch {
36213
36275
  return "";
36214
36276
  }
@@ -36237,7 +36299,7 @@ function resolvePathCommand(command) {
36237
36299
  function isHomebrewFormulaCommand(path) {
36238
36300
  let resolvedPath = path;
36239
36301
  try {
36240
- resolvedPath = (0, import_node_fs18.realpathSync)(path);
36302
+ resolvedPath = (0, import_node_fs19.realpathSync)(path);
36241
36303
  } catch {
36242
36304
  return false;
36243
36305
  }
@@ -36248,7 +36310,7 @@ function isHomebrewFormulaCommand(path) {
36248
36310
  function resolvePersistentGlobalCommand(dependencies = {}) {
36249
36311
  const platform3 = dependencies.platform ?? process.platform;
36250
36312
  const run = dependencies.spawn ?? import_node_child_process4.spawnSync;
36251
- const pathExists = dependencies.exists ?? import_node_fs18.existsSync;
36313
+ const pathExists = dependencies.exists ?? import_node_fs19.existsSync;
36252
36314
  const pathClis = dependencies.pathClis ?? resolvePathCommands("deepline");
36253
36315
  const homebrewCommand = pathClis.find(isHomebrewFormulaCommand);
36254
36316
  if (homebrewCommand) return homebrewCommand;
@@ -36273,7 +36335,7 @@ function inspectGlobalCliAvailability(input2) {
36273
36335
  }
36274
36336
  function pathsResolveToSameFile(left, right) {
36275
36337
  try {
36276
- return (0, import_node_fs18.realpathSync)(left) === (0, import_node_fs18.realpathSync)(right);
36338
+ return (0, import_node_fs19.realpathSync)(left) === (0, import_node_fs19.realpathSync)(right);
36277
36339
  } catch {
36278
36340
  return (0, import_node_path21.resolve)(left) === (0, import_node_path21.resolve)(right);
36279
36341
  }
@@ -36282,7 +36344,7 @@ function isKnownDeeplineCommand(path) {
36282
36344
  const entrypoint = process.argv[1] ? (0, import_node_path21.resolve)(process.argv[1]) : "";
36283
36345
  let resolvedPath = path;
36284
36346
  try {
36285
- resolvedPath = (0, import_node_fs18.realpathSync)(path);
36347
+ resolvedPath = (0, import_node_fs19.realpathSync)(path);
36286
36348
  } catch {
36287
36349
  }
36288
36350
  if (entrypoint && resolvedPath === entrypoint) return true;
@@ -36294,8 +36356,8 @@ function inspectPathConflict() {
36294
36356
  const commandPath = resolvePathCommand("deepline");
36295
36357
  if (!commandPath || isKnownDeeplineCommand(commandPath)) return null;
36296
36358
  try {
36297
- if ((0, import_node_fs18.lstatSync)(commandPath).isSymbolicLink()) {
36298
- const target = (0, import_node_fs18.realpathSync)(commandPath);
36359
+ if ((0, import_node_fs19.lstatSync)(commandPath).isSymbolicLink()) {
36360
+ const target = (0, import_node_fs19.realpathSync)(commandPath);
36299
36361
  if (target.includes(`${(0, import_node_path21.join)("node_modules", "deepline")}`)) return null;
36300
36362
  }
36301
36363
  } catch {
@@ -36304,8 +36366,8 @@ function inspectPathConflict() {
36304
36366
  }
36305
36367
  function writeSetupState(input2) {
36306
36368
  const path = setupStatePath(input2.baseUrl, input2.scope, input2.root);
36307
- (0, import_node_fs18.mkdirSync)((0, import_node_path21.dirname)(path), { recursive: true });
36308
- (0, import_node_fs18.writeFileSync)(
36369
+ (0, import_node_fs19.mkdirSync)((0, import_node_path21.dirname)(path), { recursive: true });
36370
+ (0, import_node_fs19.writeFileSync)(
36309
36371
  path,
36310
36372
  `${JSON.stringify(
36311
36373
  {
@@ -36969,7 +37031,7 @@ Examples:
36969
37031
  }
36970
37032
 
36971
37033
  // src/cli/update-preferences.ts
36972
- var import_node_fs19 = require("fs");
37034
+ var import_node_fs20 = require("fs");
36973
37035
  var import_node_os14 = require("os");
36974
37036
  var import_node_path22 = require("path");
36975
37037
  var UPDATE_PREFERENCES_SCHEMA_VERSION = 1;
@@ -37010,9 +37072,9 @@ function cliUpdatePreferencesPath(homeDir2 = (0, import_node_os14.homedir)()) {
37010
37072
  }
37011
37073
  function readCliUpdatePreferences(homeDir2 = (0, import_node_os14.homedir)()) {
37012
37074
  const path = cliUpdatePreferencesPath(homeDir2);
37013
- if (!(0, import_node_fs19.existsSync)(path)) return defaultPreferences();
37075
+ if (!(0, import_node_fs20.existsSync)(path)) return defaultPreferences();
37014
37076
  try {
37015
- const parsed = JSON.parse((0, import_node_fs19.readFileSync)(path, "utf8"));
37077
+ const parsed = JSON.parse((0, import_node_fs20.readFileSync)(path, "utf8"));
37016
37078
  return {
37017
37079
  schemaVersion: UPDATE_PREFERENCES_SCHEMA_VERSION,
37018
37080
  autoUpdateEnabled: typeof parsed.autoUpdateEnabled === "boolean" ? parsed.autoUpdateEnabled : true,
@@ -37028,16 +37090,16 @@ function readCliUpdatePreferences(homeDir2 = (0, import_node_os14.homedir)()) {
37028
37090
  function writeCliUpdatePreferences(preferences, homeDir2 = (0, import_node_os14.homedir)()) {
37029
37091
  const path = cliUpdatePreferencesPath(homeDir2);
37030
37092
  const tempPath = `${path}.${process.pid}.tmp`;
37031
- (0, import_node_fs19.mkdirSync)((0, import_node_path22.dirname)(path), { recursive: true });
37093
+ (0, import_node_fs20.mkdirSync)((0, import_node_path22.dirname)(path), { recursive: true });
37032
37094
  try {
37033
- (0, import_node_fs19.writeFileSync)(tempPath, `${JSON.stringify(preferences, null, 2)}
37095
+ (0, import_node_fs20.writeFileSync)(tempPath, `${JSON.stringify(preferences, null, 2)}
37034
37096
  `, {
37035
37097
  encoding: "utf8",
37036
37098
  mode: 384
37037
37099
  });
37038
- (0, import_node_fs19.renameSync)(tempPath, path);
37100
+ (0, import_node_fs20.renameSync)(tempPath, path);
37039
37101
  } finally {
37040
- (0, import_node_fs19.rmSync)(tempPath, { force: true });
37102
+ (0, import_node_fs20.rmSync)(tempPath, { force: true });
37041
37103
  }
37042
37104
  }
37043
37105
  function setCliAutoUpdateEnabled(enabled, homeDir2 = (0, import_node_os14.homedir)()) {
@@ -37087,13 +37149,13 @@ function consumePendingCliUpdateMessages(homeDir2 = (0, import_node_os14.homedir
37087
37149
 
37088
37150
  // src/cli/commands/update.ts
37089
37151
  var import_node_child_process5 = require("child_process");
37090
- var import_node_fs21 = require("fs");
37152
+ var import_node_fs22 = require("fs");
37091
37153
  var import_node_os15 = require("os");
37092
37154
  var import_node_path24 = require("path");
37093
37155
 
37094
37156
  // src/cli/install-integrity.ts
37095
37157
  var import_node_module2 = require("module");
37096
- var import_node_fs20 = require("fs");
37158
+ var import_node_fs21 = require("fs");
37097
37159
  var import_node_path23 = require("path");
37098
37160
  var SDK_SIDECAR_CRITICAL_PACKAGE_FILES = [
37099
37161
  "dist/cli/index.mjs",
@@ -37127,11 +37189,11 @@ function resolveContainedPath(root, value) {
37127
37189
  return target;
37128
37190
  }
37129
37191
  function parseJson(path) {
37130
- return JSON.parse((0, import_node_fs20.readFileSync)(path, "utf8"));
37192
+ return JSON.parse((0, import_node_fs21.readFileSync)(path, "utf8"));
37131
37193
  }
37132
37194
  function isFile(path) {
37133
37195
  try {
37134
- return (0, import_node_fs20.statSync)(path).isFile();
37196
+ return (0, import_node_fs21.statSync)(path).isFile();
37135
37197
  } catch {
37136
37198
  return false;
37137
37199
  }
@@ -37145,7 +37207,7 @@ function readManifest(packageRoot) {
37145
37207
  return {
37146
37208
  mode: "manifest",
37147
37209
  invalidReason: `invalid Deepline package metadata: ${error.message}`,
37148
- missing: (0, import_node_fs20.existsSync)(packageJsonPath) ? [] : ["deepline/package.json"]
37210
+ missing: (0, import_node_fs21.existsSync)(packageJsonPath) ? [] : ["deepline/package.json"]
37149
37211
  };
37150
37212
  }
37151
37213
  if (!packageJson || typeof packageJson !== "object" || Array.isArray(packageJson)) {
@@ -37337,7 +37399,7 @@ function publicNpmFallbackRegistryUrl(hostUrl) {
37337
37399
  }
37338
37400
  function readOptionalText(path) {
37339
37401
  try {
37340
- return (0, import_node_fs21.readFileSync)(path, "utf8").trim();
37402
+ return (0, import_node_fs22.readFileSync)(path, "utf8").trim();
37341
37403
  } catch {
37342
37404
  return "";
37343
37405
  }
@@ -37383,11 +37445,11 @@ function resolvePythonSidecarUpdatePlan(options) {
37383
37445
  function findRepoBackedSdkRoot(startPath) {
37384
37446
  let current = (0, import_node_path24.resolve)(startPath);
37385
37447
  while (true) {
37386
- if ((0, import_node_fs21.existsSync)((0, import_node_path24.join)(current, "package.json")) && (0, import_node_fs21.existsSync)((0, import_node_path24.join)(current, "bin", "deepline-dev.ts"))) {
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"))) {
37387
37449
  const parent2 = (0, import_node_path24.dirname)(current);
37388
37450
  return (0, import_node_path24.basename)(parent2) === "packages" && (0, import_node_path24.basename)(current) === "sdk" ? (0, import_node_path24.dirname)(parent2) : parent2;
37389
37451
  }
37390
- if ((0, import_node_fs21.existsSync)((0, import_node_path24.join)(current, "sdk", "package.json")) && (0, import_node_fs21.existsSync)((0, import_node_path24.join)(current, "sdk", "bin", "deepline-dev.ts"))) {
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"))) {
37391
37453
  return current;
37392
37454
  }
37393
37455
  const parent = (0, import_node_path24.dirname)(current);
@@ -37398,7 +37460,7 @@ function findRepoBackedSdkRoot(startPath) {
37398
37460
  function inferNpmGlobalPrefixFromEntrypoint(entrypoint, env) {
37399
37461
  const normalized = (() => {
37400
37462
  try {
37401
- return (0, import_node_fs21.realpathSync)(entrypoint);
37463
+ return (0, import_node_fs22.realpathSync)(entrypoint);
37402
37464
  } catch {
37403
37465
  return (0, import_node_path24.resolve)(entrypoint);
37404
37466
  }
@@ -37431,7 +37493,7 @@ function normalizedNpmPrefix(value) {
37431
37493
  if (!trimmed) return null;
37432
37494
  const normalized = (() => {
37433
37495
  try {
37434
- return (0, import_node_fs21.realpathSync)((0, import_node_path24.resolve)(trimmed));
37496
+ return (0, import_node_fs22.realpathSync)((0, import_node_path24.resolve)(trimmed));
37435
37497
  } catch {
37436
37498
  return (0, import_node_path24.resolve)(trimmed);
37437
37499
  }
@@ -37456,7 +37518,7 @@ function resolveNpmGlobalPrefix(env) {
37456
37518
  function isHomebrewFormulaEntrypoint(entrypoint) {
37457
37519
  const normalized = (() => {
37458
37520
  try {
37459
- return (0, import_node_fs21.realpathSync)(entrypoint);
37521
+ return (0, import_node_fs22.realpathSync)(entrypoint);
37460
37522
  } catch {
37461
37523
  return (0, import_node_path24.resolve)(entrypoint);
37462
37524
  }
@@ -37540,7 +37602,7 @@ function readAutoUpdateFailure(plan) {
37540
37602
  if (!path) return null;
37541
37603
  try {
37542
37604
  const parsed = JSON.parse(
37543
- (0, import_node_fs21.readFileSync)(path, "utf8")
37605
+ (0, import_node_fs22.readFileSync)(path, "utf8")
37544
37606
  );
37545
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") {
37546
37608
  return parsed;
@@ -37561,8 +37623,8 @@ function writeAutoUpdateFailure(plan, exitCode) {
37561
37623
  manualCommand: plan.manualCommand
37562
37624
  };
37563
37625
  try {
37564
- (0, import_node_fs21.mkdirSync)((0, import_node_path24.dirname)(path), { recursive: true });
37565
- (0, import_node_fs21.writeFileSync)(path, `${JSON.stringify(marker, null, 2)}
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)}
37566
37628
  `, "utf8");
37567
37629
  } catch {
37568
37630
  }
@@ -37571,7 +37633,7 @@ function clearAutoUpdateFailure(plan) {
37571
37633
  const path = autoUpdateFailurePath(plan);
37572
37634
  if (!path) return;
37573
37635
  try {
37574
- (0, import_node_fs21.unlinkSync)(path);
37636
+ (0, import_node_fs22.unlinkSync)(path);
37575
37637
  } catch {
37576
37638
  }
37577
37639
  }
@@ -37626,7 +37688,7 @@ function installedPackageVersion(versionDir) {
37626
37688
  "package.json"
37627
37689
  );
37628
37690
  try {
37629
- const parsed = JSON.parse((0, import_node_fs21.readFileSync)(packageJsonPath, "utf8"));
37691
+ const parsed = JSON.parse((0, import_node_fs22.readFileSync)(packageJsonPath, "utf8"));
37630
37692
  return typeof parsed.version === "string" ? safeVersionSegment(parsed.version) : "";
37631
37693
  } catch {
37632
37694
  return "";
@@ -37741,7 +37803,7 @@ async function runNpmInstallWithRegistryFallback(input2) {
37741
37803
  return first.exitCode;
37742
37804
  }
37743
37805
  function writeSidecarLauncher(input2) {
37744
- (0, import_node_fs21.mkdirSync)((0, import_node_path24.dirname)(input2.path), { recursive: true });
37806
+ (0, import_node_fs22.mkdirSync)((0, import_node_path24.dirname)(input2.path), { recursive: true });
37745
37807
  const packageRoot = (0, import_node_path24.dirname)((0, import_node_path24.dirname)((0, import_node_path24.dirname)(input2.entryPath)));
37746
37808
  const versionDir = (0, import_node_path24.dirname)((0, import_node_path24.dirname)(packageRoot));
37747
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);";
@@ -37754,7 +37816,7 @@ function writeSidecarLauncher(input2) {
37754
37816
  )
37755
37817
  ];
37756
37818
  if (process.platform === "win32") {
37757
- (0, import_node_fs21.writeFileSync)(
37819
+ (0, import_node_fs22.writeFileSync)(
37758
37820
  input2.path,
37759
37821
  [
37760
37822
  `@set DEEPLINE_HOST_URL=${input2.hostUrl.replace(/\r?\n/g, "")}`,
@@ -37777,7 +37839,7 @@ function writeSidecarLauncher(input2) {
37777
37839
  );
37778
37840
  return;
37779
37841
  }
37780
- (0, import_node_fs21.writeFileSync)(
37842
+ (0, import_node_fs22.writeFileSync)(
37781
37843
  input2.path,
37782
37844
  [
37783
37845
  "#!/usr/bin/env sh",
@@ -37809,9 +37871,9 @@ async function runPythonSidecarUpdatePlan(plan) {
37809
37871
  versionsDir,
37810
37872
  `.tmp-sdk-update-${process.pid}-${Date.now()}`
37811
37873
  );
37812
- (0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
37813
- (0, import_node_fs21.mkdirSync)(tempDir, { recursive: true });
37814
- (0, import_node_fs21.writeFileSync)((0, import_node_path24.join)(tempDir, "package.json"), NPM_SDK_SIDECAR_PACKAGE_JSON);
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);
37815
37877
  const env = {
37816
37878
  ...process.env,
37817
37879
  PATH: `${(0, import_node_path24.dirname)(plan.nodeBin)}${process.platform === "win32" ? ";" : ":"}${process.env.PATH ?? ""}`
@@ -37831,7 +37893,7 @@ async function runPythonSidecarUpdatePlan(plan) {
37831
37893
  );
37832
37894
  const installExitCode = installResult.exitCode;
37833
37895
  if (installExitCode !== 0) {
37834
- (0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
37896
+ (0, import_node_fs22.rmSync)(tempDir, { recursive: true, force: true });
37835
37897
  return installExitCode;
37836
37898
  }
37837
37899
  const installedVersion = installedPackageVersion(tempDir);
@@ -37839,7 +37901,7 @@ async function runPythonSidecarUpdatePlan(plan) {
37839
37901
  process.stderr.write(
37840
37902
  "Updated Deepline SDK package did not report a version.\n"
37841
37903
  );
37842
- (0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
37904
+ (0, import_node_fs22.rmSync)(tempDir, { recursive: true, force: true });
37843
37905
  return 1;
37844
37906
  }
37845
37907
  const stagedFailure = sidecarInstallFailure(tempDir);
@@ -37848,7 +37910,7 @@ async function runPythonSidecarUpdatePlan(plan) {
37848
37910
  `Updated Deepline SDK package is incomplete: ${stagedFailure}.
37849
37911
  `
37850
37912
  );
37851
- (0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
37913
+ (0, import_node_fs22.rmSync)(tempDir, { recursive: true, force: true });
37852
37914
  return 1;
37853
37915
  }
37854
37916
  const finalDir = (0, import_node_path24.join)(versionsDir, installedVersion);
@@ -37856,24 +37918,24 @@ async function runPythonSidecarUpdatePlan(plan) {
37856
37918
  const finalFailure = sidecarInstallFailure(finalDir);
37857
37919
  let backupDir = null;
37858
37920
  if (!finalFailure) {
37859
- (0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
37921
+ (0, import_node_fs22.rmSync)(tempDir, { recursive: true, force: true });
37860
37922
  } else {
37861
37923
  let shouldPublishTemp = true;
37862
- if ((0, import_node_fs21.existsSync)(finalDir)) {
37924
+ if ((0, import_node_fs22.existsSync)(finalDir)) {
37863
37925
  backupDir = (0, import_node_path24.join)(
37864
37926
  versionsDir,
37865
37927
  `.backup-${installedVersion}-${process.pid}-${Date.now()}`
37866
37928
  );
37867
37929
  try {
37868
- (0, import_node_fs21.renameSync)(finalDir, backupDir);
37930
+ (0, import_node_fs22.renameSync)(finalDir, backupDir);
37869
37931
  } catch (error) {
37870
37932
  const concurrentlyPublishedFailure = sidecarInstallFailure(finalDir);
37871
37933
  if (!concurrentlyPublishedFailure) {
37872
- (0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
37934
+ (0, import_node_fs22.rmSync)(tempDir, { recursive: true, force: true });
37873
37935
  backupDir = null;
37874
37936
  shouldPublishTemp = false;
37875
37937
  } else {
37876
- (0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
37938
+ (0, import_node_fs22.rmSync)(tempDir, { recursive: true, force: true });
37877
37939
  process.stderr.write(
37878
37940
  `Failed to preserve the incomplete Deepline SDK sidecar before repair: ${error.message}.
37879
37941
  `
@@ -37884,18 +37946,18 @@ async function runPythonSidecarUpdatePlan(plan) {
37884
37946
  }
37885
37947
  if (shouldPublishTemp) {
37886
37948
  try {
37887
- (0, import_node_fs21.renameSync)(tempDir, finalDir);
37949
+ (0, import_node_fs22.renameSync)(tempDir, finalDir);
37888
37950
  } catch (error) {
37889
- (0, import_node_fs21.rmSync)(tempDir, { recursive: true, force: true });
37951
+ (0, import_node_fs22.rmSync)(tempDir, { recursive: true, force: true });
37890
37952
  const concurrentlyPublishedFailure = sidecarInstallFailure(finalDir);
37891
37953
  if (!concurrentlyPublishedFailure) {
37892
- if (backupDir) (0, import_node_fs21.rmSync)(backupDir, { recursive: true, force: true });
37954
+ if (backupDir) (0, import_node_fs22.rmSync)(backupDir, { recursive: true, force: true });
37893
37955
  backupDir = null;
37894
37956
  } else {
37895
37957
  let restoreFailure = "";
37896
- if (backupDir && (0, import_node_fs21.existsSync)(backupDir) && !(0, import_node_fs21.existsSync)(finalDir)) {
37958
+ if (backupDir && (0, import_node_fs22.existsSync)(backupDir) && !(0, import_node_fs22.existsSync)(finalDir)) {
37897
37959
  try {
37898
- (0, import_node_fs21.renameSync)(backupDir, finalDir);
37960
+ (0, import_node_fs22.renameSync)(backupDir, finalDir);
37899
37961
  backupDir = null;
37900
37962
  } catch (restoreError) {
37901
37963
  restoreFailure = `; failed to restore previous install: ${restoreError.message}`;
@@ -37912,10 +37974,10 @@ async function runPythonSidecarUpdatePlan(plan) {
37912
37974
  }
37913
37975
  const publishedFailure = sidecarStructureFailure(finalDir);
37914
37976
  if (publishedFailure) {
37915
- if (backupDir && (0, import_node_fs21.existsSync)(backupDir)) {
37916
- (0, import_node_fs21.rmSync)(finalDir, { recursive: true, force: true });
37977
+ if (backupDir && (0, import_node_fs22.existsSync)(backupDir)) {
37978
+ (0, import_node_fs22.rmSync)(finalDir, { recursive: true, force: true });
37917
37979
  try {
37918
- (0, import_node_fs21.renameSync)(backupDir, finalDir);
37980
+ (0, import_node_fs22.renameSync)(backupDir, finalDir);
37919
37981
  backupDir = null;
37920
37982
  } catch {
37921
37983
  }
@@ -37926,7 +37988,7 @@ async function runPythonSidecarUpdatePlan(plan) {
37926
37988
  );
37927
37989
  return 1;
37928
37990
  }
37929
- if (backupDir) (0, import_node_fs21.rmSync)(backupDir, { recursive: true, force: true });
37991
+ if (backupDir) (0, import_node_fs22.rmSync)(backupDir, { recursive: true, force: true });
37930
37992
  writeSidecarLauncher({
37931
37993
  path: plan.sidecarPath,
37932
37994
  hostUrl: plan.hostUrl,
@@ -37934,27 +37996,27 @@ async function runPythonSidecarUpdatePlan(plan) {
37934
37996
  nodeBin: plan.nodeBin,
37935
37997
  entryPath: finalEntryPath
37936
37998
  });
37937
- (0, import_node_fs21.writeFileSync)(
37999
+ (0, import_node_fs22.writeFileSync)(
37938
38000
  (0, import_node_path24.join)(plan.stateDir, ".version"),
37939
38001
  `${installedVersion}
37940
38002
  `,
37941
38003
  "utf8"
37942
38004
  );
37943
- (0, import_node_fs21.writeFileSync)(
38005
+ (0, import_node_fs22.writeFileSync)(
37944
38006
  (0, import_node_path24.join)(plan.stateDir, ".install-method"),
37945
38007
  "python-sidecar\n",
37946
38008
  "utf8"
37947
38009
  );
37948
- (0, import_node_fs21.writeFileSync)(
38010
+ (0, import_node_fs22.writeFileSync)(
37949
38011
  (0, import_node_path24.join)(plan.stateDir, ".command-path"),
37950
38012
  `${plan.sidecarPath}
37951
38013
  `,
37952
38014
  "utf8"
37953
38015
  );
37954
- (0, import_node_fs21.writeFileSync)((0, import_node_path24.join)(plan.stateDir, ".runner"), "node\n", "utf8");
37955
- (0, import_node_fs21.writeFileSync)((0, import_node_path24.join)(plan.stateDir, ".node-bin"), `${plan.nodeBin}
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}
37956
38018
  `, "utf8");
37957
- (0, import_node_fs21.writeFileSync)(
38019
+ (0, import_node_fs22.writeFileSync)(
37958
38020
  (0, import_node_path24.join)(plan.stateDir, ".entry-path"),
37959
38021
  `${finalEntryPath}
37960
38022
  `,
@@ -38882,12 +38944,12 @@ chooses the connected Slack channel or member and the events it receives.
38882
38944
 
38883
38945
  // src/cli/commands/tools.ts
38884
38946
  var import_commander3 = require("commander");
38885
- var import_node_fs23 = require("fs");
38947
+ var import_node_fs24 = require("fs");
38886
38948
  var import_node_os17 = require("os");
38887
38949
  var import_node_path26 = require("path");
38888
38950
 
38889
38951
  // src/tool-output.ts
38890
- var import_node_fs22 = require("fs");
38952
+ var import_node_fs23 = require("fs");
38891
38953
  var import_node_os16 = require("os");
38892
38954
  var import_node_path25 = require("path");
38893
38955
  function isPlainObject(value) {
@@ -39017,18 +39079,18 @@ function projectRowOutput(conversion) {
39017
39079
  }
39018
39080
  function ensureOutputDir() {
39019
39081
  const outputDir = (0, import_node_path25.join)((0, import_node_os16.homedir)(), ".local", "share", "deepline", "data");
39020
- (0, import_node_fs22.mkdirSync)(outputDir, { recursive: true });
39082
+ (0, import_node_fs23.mkdirSync)(outputDir, { recursive: true });
39021
39083
  return outputDir;
39022
39084
  }
39023
39085
  function writeJsonOutputFile(payload, stem) {
39024
39086
  const outputDir = ensureOutputDir();
39025
39087
  const outputPath = (0, import_node_path25.join)(outputDir, `${stem}_${Date.now()}.json`);
39026
- (0, import_node_fs22.writeFileSync)(outputPath, JSON.stringify(payload, null, 2), "utf-8");
39088
+ (0, import_node_fs23.writeFileSync)(outputPath, JSON.stringify(payload, null, 2), "utf-8");
39027
39089
  return outputPath;
39028
39090
  }
39029
39091
  function writeCsvOutputFile(rows, stem, options) {
39030
39092
  const outputPath = options?.outPath ? options.outPath : (0, import_node_path25.join)(ensureOutputDir(), `${stem}_${Date.now()}.csv`);
39031
- (0, import_node_fs22.mkdirSync)((0, import_node_path25.dirname)(outputPath), { recursive: true });
39093
+ (0, import_node_fs23.mkdirSync)((0, import_node_path25.dirname)(outputPath), { recursive: true });
39032
39094
  const columns = columnsForRows(rows);
39033
39095
  const escapeCell = (value) => {
39034
39096
  const normalized = value == null ? "" : typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : JSON.stringify(value);
@@ -39037,19 +39099,19 @@ function writeCsvOutputFile(rows, stem, options) {
39037
39099
  }
39038
39100
  return normalized;
39039
39101
  };
39040
- const fd = (0, import_node_fs22.openSync)(outputPath, "w");
39102
+ const fd = (0, import_node_fs23.openSync)(outputPath, "w");
39041
39103
  try {
39042
- (0, import_node_fs22.writeSync)(fd, `${columns.map(escapeCell).join(",")}
39104
+ (0, import_node_fs23.writeSync)(fd, `${columns.map(escapeCell).join(",")}
39043
39105
  `);
39044
39106
  for (const row of rows) {
39045
- (0, import_node_fs22.writeSync)(
39107
+ (0, import_node_fs23.writeSync)(
39046
39108
  fd,
39047
39109
  `${columns.map((column) => escapeCell(row[column])).join(",")}
39048
39110
  `
39049
39111
  );
39050
39112
  }
39051
39113
  } finally {
39052
- (0, import_node_fs22.closeSync)(fd);
39114
+ (0, import_node_fs23.closeSync)(fd);
39053
39115
  }
39054
39116
  const previewRows = rows.slice(0, 5);
39055
39117
  const previewColumns = columns.slice(0, 5);
@@ -40989,10 +41051,10 @@ function normalizeOutputFormat(raw) {
40989
41051
  function resolveAtFilePath(rawPath) {
40990
41052
  const trimmed = rawPath.trim();
40991
41053
  const resolved = (0, import_node_path26.resolve)(trimmed);
40992
- if ((0, import_node_fs23.existsSync)(resolved)) return resolved;
41054
+ if ((0, import_node_fs24.existsSync)(resolved)) return resolved;
40993
41055
  if (process.platform !== "win32" && trimmed.includes("\\")) {
40994
41056
  const normalized = (0, import_node_path26.resolve)(trimmed.replace(/\\/g, "/"));
40995
- if ((0, import_node_fs23.existsSync)(normalized)) return normalized;
41057
+ if ((0, import_node_fs24.existsSync)(normalized)) return normalized;
40996
41058
  }
40997
41059
  return resolved;
40998
41060
  }
@@ -41003,7 +41065,7 @@ function readJsonArgument(raw, flagName) {
41003
41065
  throw new Error(`Invalid ${flagName} value: empty @file path.`);
41004
41066
  }
41005
41067
  try {
41006
- return (0, import_node_fs23.readFileSync)(resolveAtFilePath(filePath), "utf8").replace(
41068
+ return (0, import_node_fs24.readFileSync)(resolveAtFilePath(filePath), "utf8").replace(
41007
41069
  /^\uFEFF/,
41008
41070
  ""
41009
41071
  );
@@ -41110,8 +41172,8 @@ function starterScriptJson(script) {
41110
41172
  function seedToolListScript(input2) {
41111
41173
  const stem = safeFileStem(input2.toolId);
41112
41174
  const fileName = `${stem}-workflow-seed-${Date.now()}.play.ts`;
41113
- const scriptDir = (0, import_node_fs23.mkdtempSync)((0, import_node_path26.join)((0, import_node_os17.tmpdir)(), "deepline-workflow-seed-"));
41114
- (0, import_node_fs23.chmodSync)(scriptDir, 448);
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);
41115
41177
  const scriptPath = (0, import_node_path26.join)(scriptDir, fileName);
41116
41178
  const projectDir = `deepline/projects/${stem}-workflow`;
41117
41179
  const playName = `${stem}-workflow`;
@@ -41155,7 +41217,7 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
41155
41217
  description: ${JSON.stringify(`Seed ${input2.toolId} rows into a Deepline workflow-ready dataset.`)},
41156
41218
  });
41157
41219
  `;
41158
- (0, import_node_fs23.writeFileSync)(scriptPath, script, { encoding: "utf-8", mode: 384 });
41220
+ (0, import_node_fs24.writeFileSync)(scriptPath, script, { encoding: "utf-8", mode: 384 });
41159
41221
  return {
41160
41222
  path: scriptPath,
41161
41223
  sourceCode: script,