deepline 0.1.112 → 0.1.113

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
@@ -183,7 +183,7 @@ configureProxyFromEnv();
183
183
  // src/cli/index.ts
184
184
  var import_promises7 = require("fs/promises");
185
185
  var import_node_path22 = require("path");
186
- var import_node_os15 = require("os");
186
+ var import_node_os16 = require("os");
187
187
  var import_commander3 = require("commander");
188
188
 
189
189
  // src/config.ts
@@ -403,10 +403,10 @@ var SDK_RELEASE = {
403
403
  // skill on the sdk sync surface, and the people-search-to-email prebuilt.
404
404
  // 0.1.108 ships explicit dataset column/tool recompute policy and removes
405
405
  // the SDK enrich generator's one-second stale policy.
406
- version: "0.1.112",
406
+ version: "0.1.113",
407
407
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
408
408
  supportPolicy: {
409
- latest: "0.1.112",
409
+ latest: "0.1.113",
410
410
  minimumSupported: "0.1.53",
411
411
  deprecatedBelow: "0.1.53",
412
412
  commandMinimumSupported: [
@@ -22357,6 +22357,7 @@ Notes:
22357
22357
  // src/cli/commands/update.ts
22358
22358
  var import_node_child_process2 = require("child_process");
22359
22359
  var import_node_fs16 = require("fs");
22360
+ var import_node_os13 = require("os");
22360
22361
  var import_node_path20 = require("path");
22361
22362
  function posixShellQuote(value) {
22362
22363
  return `'${value.replace(/'/g, `'\\''`)}'`;
@@ -22375,6 +22376,55 @@ function buildSourceUpdateCommand(sourceRoot) {
22375
22376
  const cdCommand = process.platform === "win32" ? `cd /d ${quotedRoot}` : `cd ${quotedRoot}`;
22376
22377
  return `${cdCommand} && git fetch origin main --tags && git merge --ff-only origin/main`;
22377
22378
  }
22379
+ function sidecarStateDir(input2) {
22380
+ const scope = input2.env.DEEPLINE_CONFIG_SCOPE?.trim();
22381
+ if (!scope || scope.includes("/") || scope.includes("\\")) {
22382
+ return null;
22383
+ }
22384
+ return (0, import_node_path20.join)(input2.homeDir, ".local", "deepline", scope, "sdk-cli");
22385
+ }
22386
+ function readOptionalText(path) {
22387
+ try {
22388
+ return (0, import_node_fs16.readFileSync)(path, "utf8").trim();
22389
+ } catch {
22390
+ return "";
22391
+ }
22392
+ }
22393
+ function resolvePythonSidecarUpdatePlan(options) {
22394
+ const stateDir = sidecarStateDir(options);
22395
+ if (!stateDir) return null;
22396
+ const relativeEntrypoint = (0, import_node_path20.relative)(
22397
+ (0, import_node_path20.resolve)(stateDir),
22398
+ (0, import_node_path20.resolve)(options.entrypoint)
22399
+ );
22400
+ if (!relativeEntrypoint || relativeEntrypoint.startsWith("..") || (0, import_node_path20.isAbsolute)(relativeEntrypoint)) {
22401
+ return null;
22402
+ }
22403
+ const installMethod = readOptionalText((0, import_node_path20.join)(stateDir, ".install-method"));
22404
+ if (installMethod !== "python-sidecar") return null;
22405
+ const scope = options.env.DEEPLINE_CONFIG_SCOPE?.trim() || "";
22406
+ const hostUrl = options.env.DEEPLINE_HOST_URL?.trim() || "";
22407
+ const nodeBin = readOptionalText((0, import_node_path20.join)(stateDir, ".node-bin")) || process.execPath;
22408
+ const sidecarPath = readOptionalText((0, import_node_path20.join)(stateDir, ".command-path")) || (0, import_node_path20.join)(
22409
+ stateDir,
22410
+ "bin",
22411
+ process.platform === "win32" ? "deepline-sdk.cmd" : "deepline-sdk"
22412
+ );
22413
+ const packageSpec = options.packageSpec || "deepline@latest";
22414
+ const npmCommand = "npm";
22415
+ const manualCommand = `${npmCommand} install --prefix ${shellQuote3((0, import_node_path20.join)(stateDir, "versions", "<version>"))} --no-audit --no-fund ${shellQuote3(packageSpec)}`;
22416
+ return {
22417
+ kind: "python-sidecar",
22418
+ stateDir,
22419
+ sidecarPath,
22420
+ nodeBin,
22421
+ npmCommand,
22422
+ scope,
22423
+ hostUrl,
22424
+ packageSpec,
22425
+ manualCommand
22426
+ };
22427
+ }
22378
22428
  function findRepoBackedSdkRoot(startPath) {
22379
22429
  let current = (0, import_node_path20.resolve)(startPath);
22380
22430
  while (true) {
@@ -22386,8 +22436,10 @@ function findRepoBackedSdkRoot(startPath) {
22386
22436
  current = parent;
22387
22437
  }
22388
22438
  }
22389
- function resolveUpdatePlan() {
22390
- const entrypoint = process.argv[1] ? (0, import_node_path20.resolve)(process.argv[1]) : "";
22439
+ function resolveUpdatePlan(options = {}) {
22440
+ const env = options.env ?? process.env;
22441
+ const homeDir2 = options.homeDir ?? (0, import_node_os13.homedir)();
22442
+ const entrypoint = options.entrypoint ?? (process.argv[1] ? (0, import_node_path20.resolve)(process.argv[1]) : "");
22391
22443
  const sourceRoot = entrypoint ? findRepoBackedSdkRoot((0, import_node_path20.dirname)(entrypoint)) : null;
22392
22444
  if (sourceRoot) {
22393
22445
  return {
@@ -22396,8 +22448,16 @@ function resolveUpdatePlan() {
22396
22448
  manualCommand: buildSourceUpdateCommand(sourceRoot)
22397
22449
  };
22398
22450
  }
22451
+ const sidecarPlan = resolvePythonSidecarUpdatePlan({
22452
+ entrypoint,
22453
+ env,
22454
+ homeDir: homeDir2,
22455
+ packageSpec: options.packageSpec
22456
+ });
22457
+ if (sidecarPlan) return sidecarPlan;
22399
22458
  const command = "npm";
22400
- const args = ["install", "-g", "deepline@latest"];
22459
+ const packageSpec = options.packageSpec || "deepline@latest";
22460
+ const args = ["install", "-g", packageSpec];
22401
22461
  return {
22402
22462
  kind: "npm-global",
22403
22463
  command,
@@ -22405,12 +22465,40 @@ function resolveUpdatePlan() {
22405
22465
  manualCommand: `${command} ${args.map(shellQuote3).join(" ")}`
22406
22466
  };
22407
22467
  }
22408
- function runCommand(command, args) {
22468
+ function safeVersionSegment(value) {
22469
+ const normalized = value.trim();
22470
+ return /^[0-9A-Za-z._-]+$/.test(normalized) ? normalized : "";
22471
+ }
22472
+ function entryPathInVersionDir(versionDir) {
22473
+ return (0, import_node_path20.join)(
22474
+ versionDir,
22475
+ "node_modules",
22476
+ "deepline",
22477
+ "dist",
22478
+ "cli",
22479
+ "index.mjs"
22480
+ );
22481
+ }
22482
+ function installedPackageVersion(versionDir) {
22483
+ const packageJsonPath = (0, import_node_path20.join)(
22484
+ versionDir,
22485
+ "node_modules",
22486
+ "deepline",
22487
+ "package.json"
22488
+ );
22489
+ try {
22490
+ const parsed = JSON.parse((0, import_node_fs16.readFileSync)(packageJsonPath, "utf8"));
22491
+ return typeof parsed.version === "string" ? safeVersionSegment(parsed.version) : "";
22492
+ } catch {
22493
+ return "";
22494
+ }
22495
+ }
22496
+ function runCommand(command, args, env = process.env) {
22409
22497
  return new Promise((resolveExitCode) => {
22410
22498
  const child = (0, import_node_child_process2.spawn)(command, args, {
22411
22499
  stdio: "inherit",
22412
22500
  shell: process.platform === "win32",
22413
- env: process.env
22501
+ env
22414
22502
  });
22415
22503
  child.on("error", (error) => {
22416
22504
  process.stderr.write(`Failed to start ${command}: ${error.message}
@@ -22422,11 +22510,137 @@ function runCommand(command, args) {
22422
22510
  });
22423
22511
  });
22424
22512
  }
22425
- async function runNpmGlobalUpdatePlan(plan) {
22426
- if (plan.kind !== "npm-global") {
22513
+ function writeSidecarLauncher(input2) {
22514
+ (0, import_node_fs16.mkdirSync)((0, import_node_path20.dirname)(input2.path), { recursive: true });
22515
+ if (process.platform === "win32") {
22516
+ (0, import_node_fs16.writeFileSync)(
22517
+ input2.path,
22518
+ [
22519
+ `@set DEEPLINE_HOST_URL=${input2.hostUrl.replace(/\r?\n/g, "")}`,
22520
+ `@set DEEPLINE_CONFIG_SCOPE=${input2.scope.replace(/\r?\n/g, "")}`,
22521
+ `@"${input2.nodeBin}" "${input2.entryPath}" %*`,
22522
+ ""
22523
+ ].join("\r\n"),
22524
+ "utf8"
22525
+ );
22526
+ return;
22527
+ }
22528
+ (0, import_node_fs16.writeFileSync)(
22529
+ input2.path,
22530
+ [
22531
+ "#!/usr/bin/env sh",
22532
+ `export DEEPLINE_HOST_URL=${shellQuote3(input2.hostUrl)}`,
22533
+ `export DEEPLINE_CONFIG_SCOPE=${shellQuote3(input2.scope)}`,
22534
+ `exec ${shellQuote3(input2.nodeBin)} ${shellQuote3(input2.entryPath)} "$@"`,
22535
+ ""
22536
+ ].join("\n"),
22537
+ { encoding: "utf8", mode: 493 }
22538
+ );
22539
+ }
22540
+ async function runPythonSidecarUpdatePlan(plan) {
22541
+ const versionsDir = (0, import_node_path20.join)(plan.stateDir, "versions");
22542
+ const tempDir = (0, import_node_path20.join)(
22543
+ versionsDir,
22544
+ `.tmp-sdk-update-${process.pid}-${Date.now()}`
22545
+ );
22546
+ (0, import_node_fs16.rmSync)(tempDir, { recursive: true, force: true });
22547
+ (0, import_node_fs16.mkdirSync)(tempDir, { recursive: true });
22548
+ (0, import_node_fs16.writeFileSync)((0, import_node_path20.join)(tempDir, "package.json"), '{"private":true}\n', "utf8");
22549
+ const env = {
22550
+ ...process.env,
22551
+ PATH: `${(0, import_node_path20.dirname)(plan.nodeBin)}${process.platform === "win32" ? ";" : ":"}${process.env.PATH ?? ""}`
22552
+ };
22553
+ const installExitCode = await runCommand(
22554
+ plan.npmCommand,
22555
+ [
22556
+ "install",
22557
+ "--prefix",
22558
+ tempDir,
22559
+ "--no-audit",
22560
+ "--no-fund",
22561
+ plan.packageSpec
22562
+ ],
22563
+ env
22564
+ );
22565
+ if (installExitCode !== 0) {
22566
+ (0, import_node_fs16.rmSync)(tempDir, { recursive: true, force: true });
22567
+ return installExitCode;
22568
+ }
22569
+ const installedVersion = installedPackageVersion(tempDir);
22570
+ if (!installedVersion) {
22571
+ process.stderr.write(
22572
+ "Updated Deepline SDK package did not report a version.\n"
22573
+ );
22574
+ (0, import_node_fs16.rmSync)(tempDir, { recursive: true, force: true });
22427
22575
  return 1;
22428
22576
  }
22429
- return runCommand(plan.command, plan.args);
22577
+ const finalDir = (0, import_node_path20.join)(versionsDir, installedVersion);
22578
+ const finalEntryPath = entryPathInVersionDir(finalDir);
22579
+ if ((0, import_node_fs16.existsSync)(finalEntryPath)) {
22580
+ (0, import_node_fs16.rmSync)(tempDir, { recursive: true, force: true });
22581
+ } else {
22582
+ (0, import_node_fs16.rmSync)(finalDir, { recursive: true, force: true });
22583
+ try {
22584
+ (0, import_node_fs16.renameSync)(tempDir, finalDir);
22585
+ } catch (error) {
22586
+ (0, import_node_fs16.rmSync)(tempDir, { recursive: true, force: true });
22587
+ process.stderr.write(
22588
+ `Failed to publish Deepline SDK sidecar update: ${error.message}
22589
+ `
22590
+ );
22591
+ return 1;
22592
+ }
22593
+ }
22594
+ if (!(0, import_node_fs16.existsSync)(finalEntryPath)) {
22595
+ process.stderr.write(
22596
+ `Updated Deepline SDK CLI entrypoint missing: ${finalEntryPath}
22597
+ `
22598
+ );
22599
+ return 1;
22600
+ }
22601
+ writeSidecarLauncher({
22602
+ path: plan.sidecarPath,
22603
+ hostUrl: plan.hostUrl,
22604
+ scope: plan.scope,
22605
+ nodeBin: plan.nodeBin,
22606
+ entryPath: finalEntryPath
22607
+ });
22608
+ (0, import_node_fs16.writeFileSync)(
22609
+ (0, import_node_path20.join)(plan.stateDir, ".version"),
22610
+ `${installedVersion}
22611
+ `,
22612
+ "utf8"
22613
+ );
22614
+ (0, import_node_fs16.writeFileSync)(
22615
+ (0, import_node_path20.join)(plan.stateDir, ".install-method"),
22616
+ "python-sidecar\n",
22617
+ "utf8"
22618
+ );
22619
+ (0, import_node_fs16.writeFileSync)(
22620
+ (0, import_node_path20.join)(plan.stateDir, ".command-path"),
22621
+ `${plan.sidecarPath}
22622
+ `,
22623
+ "utf8"
22624
+ );
22625
+ (0, import_node_fs16.writeFileSync)((0, import_node_path20.join)(plan.stateDir, ".runner"), "node\n", "utf8");
22626
+ (0, import_node_fs16.writeFileSync)((0, import_node_path20.join)(plan.stateDir, ".node-bin"), `${plan.nodeBin}
22627
+ `, "utf8");
22628
+ (0, import_node_fs16.writeFileSync)(
22629
+ (0, import_node_path20.join)(plan.stateDir, ".entry-path"),
22630
+ `${finalEntryPath}
22631
+ `,
22632
+ "utf8"
22633
+ );
22634
+ return 0;
22635
+ }
22636
+ async function runUpdatePlan(plan) {
22637
+ if (plan.kind === "npm-global") {
22638
+ return runCommand(plan.command, plan.args);
22639
+ }
22640
+ if (plan.kind === "python-sidecar") {
22641
+ return runPythonSidecarUpdatePlan(plan);
22642
+ }
22643
+ return 1;
22430
22644
  }
22431
22645
  async function handleUpdate(options) {
22432
22646
  const plan = resolveUpdatePlan();
@@ -22437,6 +22651,9 @@ async function handleUpdate(options) {
22437
22651
  lines: plan.kind === "source" ? [
22438
22652
  "This Deepline CLI is running from SDK source, so it cannot safely update itself like an npm global.",
22439
22653
  `Update the backing checkout with: ${plan.manualCommand}`
22654
+ ] : plan.kind === "python-sidecar" ? [
22655
+ "This Deepline CLI is running from the Python-managed SDK sidecar.",
22656
+ "Updating will refresh that sidecar, not a global npm binary."
22440
22657
  ] : [`Updating Deepline SDK/CLI with: ${plan.manualCommand}`]
22441
22658
  }
22442
22659
  ]
@@ -22466,7 +22683,7 @@ async function handleUpdate(options) {
22466
22683
  `Updating Deepline SDK/CLI with: ${plan.manualCommand}
22467
22684
  `
22468
22685
  );
22469
- return runCommand(plan.command, plan.args);
22686
+ return runUpdatePlan(plan);
22470
22687
  }
22471
22688
  function registerUpdateCommand(program) {
22472
22689
  program.command("update").description("Update the Deepline SDK/CLI.").addHelpText(
@@ -22474,6 +22691,8 @@ function registerUpdateCommand(program) {
22474
22691
  `
22475
22692
  Notes:
22476
22693
  For the published npm CLI, this runs npm install -g deepline@latest.
22694
+ For Python-managed SDK sidecars, this refreshes the sidecar that launched
22695
+ the current SDK CLI instead of changing a global npm binary.
22477
22696
  For repo-backed SDK wrappers such as cli-env sdk-prod or sdk-worktree, this
22478
22697
  prints the exact git command to update the checkout that provides the CLI.
22479
22698
 
@@ -22687,10 +22906,13 @@ function isCi() {
22687
22906
  function shouldSkipSelfUpdate() {
22688
22907
  return envTruthy("DEEPLINE_SKIP_SELF_UPDATE") || envTruthy("DEEPLINE_NO_AUTO_UPDATE") || envTruthy("DEEPLINE_SKIP_SDK_AUTO_UPDATE") || envTruthy("DEEPLINE_DISABLE_AUTO_UPDATE") || isCi();
22689
22908
  }
22690
- function relaunchCurrentCommand() {
22909
+ function relaunchCurrentCommand(plan) {
22691
22910
  return new Promise((resolve16) => {
22692
- const child = (0, import_node_child_process3.spawn)(process.execPath, process.argv.slice(1), {
22911
+ const command = plan.kind === "python-sidecar" ? plan.sidecarPath : process.execPath;
22912
+ const args = plan.kind === "python-sidecar" ? process.argv.slice(2) : process.argv.slice(1);
22913
+ const child = (0, import_node_child_process3.spawn)(command, args, {
22693
22914
  stdio: "inherit",
22915
+ shell: process.platform === "win32",
22694
22916
  env: {
22695
22917
  ...process.env,
22696
22918
  DEEPLINE_NO_AUTO_UPDATE: "1"
@@ -22711,8 +22933,9 @@ async function maybeAutoUpdateAndRelaunch(response) {
22711
22933
  if (!response || !autoUpdate?.should_auto_update || shouldSkipSelfUpdate()) {
22712
22934
  return false;
22713
22935
  }
22714
- const plan = resolveUpdatePlan();
22715
- if (plan.kind !== "npm-global") {
22936
+ const packageSpec = response.latest ? `deepline@${response.latest}` : void 0;
22937
+ const plan = resolveUpdatePlan({ packageSpec });
22938
+ if (plan.kind === "source") {
22716
22939
  return false;
22717
22940
  }
22718
22941
  const label = autoUpdate.reason === "rollback_forced" ? "has a server rollback pending and needs the latest rollback-aware CLI" : autoUpdate.required ? "requires an update" : "is more than the supported auto-update lag behind";
@@ -22720,7 +22943,7 @@ async function maybeAutoUpdateAndRelaunch(response) {
22720
22943
  `Deepline SDK/CLI ${label}; running ${plan.manualCommand}
22721
22944
  `
22722
22945
  );
22723
- const updateExitCode = await runNpmGlobalUpdatePlan(plan);
22946
+ const updateExitCode = await runUpdatePlan(plan);
22724
22947
  if (updateExitCode !== 0) {
22725
22948
  if (autoUpdate.required) {
22726
22949
  throw new Error(
@@ -22734,7 +22957,7 @@ async function maybeAutoUpdateAndRelaunch(response) {
22734
22957
  return false;
22735
22958
  }
22736
22959
  process.stderr.write("Deepline SDK/CLI updated; rerunning command.\n");
22737
- const exitCode = await relaunchCurrentCommand();
22960
+ const exitCode = await relaunchCurrentCommand(plan);
22738
22961
  process.exit(exitCode);
22739
22962
  return true;
22740
22963
  }
@@ -22742,7 +22965,7 @@ async function maybeAutoUpdateAndRelaunch(response) {
22742
22965
  // src/cli/skills-sync.ts
22743
22966
  var import_node_child_process4 = require("child_process");
22744
22967
  var import_node_fs17 = require("fs");
22745
- var import_node_os13 = require("os");
22968
+ var import_node_os14 = require("os");
22746
22969
  var import_node_path21 = require("path");
22747
22970
  var CHECK_TIMEOUT_MS2 = 3e3;
22748
22971
  var SDK_PLAY_SKILL_NAME = "deepline-plays";
@@ -22769,7 +22992,7 @@ function readPluginSkillsVersion() {
22769
22992
  }
22770
22993
  }
22771
22994
  function sdkSkillsVersionPath(baseUrl) {
22772
- const home = process.env.HOME?.trim() || (0, import_node_os13.homedir)();
22995
+ const home = process.env.HOME?.trim() || (0, import_node_os14.homedir)();
22773
22996
  return (0, import_node_path21.join)(
22774
22997
  home,
22775
22998
  ".local",
@@ -22972,7 +23195,7 @@ async function syncSdkSkillsIfNeeded(baseUrl) {
22972
23195
  }
22973
23196
 
22974
23197
  // src/cli/failure-reporting.ts
22975
- var import_node_os14 = require("os");
23198
+ var import_node_os15 = require("os");
22976
23199
  var FAILURE_REPORT_DISABLE_ENV = "DEEPLINE_DISABLE_FAILURE_REPORTING";
22977
23200
  var REPORT_FAILURE_TIMEOUT_MS = 1e4;
22978
23201
  var MAX_FAILURE_TEXT_CHARS = 4e3;
@@ -23094,12 +23317,12 @@ function detectAgentRuntime3() {
23094
23317
  }
23095
23318
  function buildEnvironmentContext() {
23096
23319
  const context = {
23097
- os: (0, import_node_os14.platform)(),
23098
- os_release: (0, import_node_os14.release)(),
23099
- platform: `${(0, import_node_os14.platform)()}-${(0, import_node_os14.release)()}-${process.arch}`,
23320
+ os: (0, import_node_os15.platform)(),
23321
+ os_release: (0, import_node_os15.release)(),
23322
+ platform: `${(0, import_node_os15.platform)()}-${(0, import_node_os15.release)()}-${process.arch}`,
23100
23323
  node_version: process.version,
23101
23324
  runtime: "Node.js",
23102
- hostname: (0, import_node_os14.hostname)(),
23325
+ hostname: (0, import_node_os15.hostname)(),
23103
23326
  agent_runtime: detectAgentRuntime3()
23104
23327
  };
23105
23328
  for (const key of ["CLAUDE_CODE_REMOTE", "DEEPLINE_PLUGIN_MODE"]) {
@@ -23279,7 +23502,7 @@ function topLevelCommandKnown(program, commandName) {
23279
23502
  );
23280
23503
  }
23281
23504
  async function runPlayRunnerHealthCheck() {
23282
- const dir = await (0, import_promises7.mkdtemp)((0, import_node_path22.join)((0, import_node_os15.tmpdir)(), "deepline-health-play-"));
23505
+ const dir = await (0, import_promises7.mkdtemp)((0, import_node_path22.join)((0, import_node_os16.tmpdir)(), "deepline-health-play-"));
23283
23506
  const file = (0, import_node_path22.join)(dir, "health-check.play.ts");
23284
23507
  try {
23285
23508
  await (0, import_promises7.writeFile)(
@@ -380,10 +380,10 @@ var SDK_RELEASE = {
380
380
  // skill on the sdk sync surface, and the people-search-to-email prebuilt.
381
381
  // 0.1.108 ships explicit dataset column/tool recompute policy and removes
382
382
  // the SDK enrich generator's one-second stale policy.
383
- version: "0.1.112",
383
+ version: "0.1.113",
384
384
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
385
385
  supportPolicy: {
386
- latest: "0.1.112",
386
+ latest: "0.1.113",
387
387
  minimumSupported: "0.1.53",
388
388
  deprecatedBelow: "0.1.53",
389
389
  commandMinimumSupported: [
@@ -22387,8 +22387,16 @@ Notes:
22387
22387
 
22388
22388
  // src/cli/commands/update.ts
22389
22389
  import { spawn as spawn2 } from "child_process";
22390
- import { existsSync as existsSync12 } from "fs";
22391
- import { dirname as dirname13, join as join15, resolve as resolve15 } from "path";
22390
+ import {
22391
+ existsSync as existsSync12,
22392
+ mkdirSync as mkdirSync8,
22393
+ readFileSync as readFileSync11,
22394
+ renameSync,
22395
+ rmSync as rmSync3,
22396
+ writeFileSync as writeFileSync13
22397
+ } from "fs";
22398
+ import { homedir as homedir9 } from "os";
22399
+ import { dirname as dirname13, isAbsolute as isAbsolute4, join as join15, relative as relative4, resolve as resolve15 } from "path";
22392
22400
  function posixShellQuote(value) {
22393
22401
  return `'${value.replace(/'/g, `'\\''`)}'`;
22394
22402
  }
@@ -22406,6 +22414,55 @@ function buildSourceUpdateCommand(sourceRoot) {
22406
22414
  const cdCommand = process.platform === "win32" ? `cd /d ${quotedRoot}` : `cd ${quotedRoot}`;
22407
22415
  return `${cdCommand} && git fetch origin main --tags && git merge --ff-only origin/main`;
22408
22416
  }
22417
+ function sidecarStateDir(input2) {
22418
+ const scope = input2.env.DEEPLINE_CONFIG_SCOPE?.trim();
22419
+ if (!scope || scope.includes("/") || scope.includes("\\")) {
22420
+ return null;
22421
+ }
22422
+ return join15(input2.homeDir, ".local", "deepline", scope, "sdk-cli");
22423
+ }
22424
+ function readOptionalText(path) {
22425
+ try {
22426
+ return readFileSync11(path, "utf8").trim();
22427
+ } catch {
22428
+ return "";
22429
+ }
22430
+ }
22431
+ function resolvePythonSidecarUpdatePlan(options) {
22432
+ const stateDir = sidecarStateDir(options);
22433
+ if (!stateDir) return null;
22434
+ const relativeEntrypoint = relative4(
22435
+ resolve15(stateDir),
22436
+ resolve15(options.entrypoint)
22437
+ );
22438
+ if (!relativeEntrypoint || relativeEntrypoint.startsWith("..") || isAbsolute4(relativeEntrypoint)) {
22439
+ return null;
22440
+ }
22441
+ const installMethod = readOptionalText(join15(stateDir, ".install-method"));
22442
+ if (installMethod !== "python-sidecar") return null;
22443
+ const scope = options.env.DEEPLINE_CONFIG_SCOPE?.trim() || "";
22444
+ const hostUrl = options.env.DEEPLINE_HOST_URL?.trim() || "";
22445
+ const nodeBin = readOptionalText(join15(stateDir, ".node-bin")) || process.execPath;
22446
+ const sidecarPath = readOptionalText(join15(stateDir, ".command-path")) || join15(
22447
+ stateDir,
22448
+ "bin",
22449
+ process.platform === "win32" ? "deepline-sdk.cmd" : "deepline-sdk"
22450
+ );
22451
+ const packageSpec = options.packageSpec || "deepline@latest";
22452
+ const npmCommand = "npm";
22453
+ const manualCommand = `${npmCommand} install --prefix ${shellQuote3(join15(stateDir, "versions", "<version>"))} --no-audit --no-fund ${shellQuote3(packageSpec)}`;
22454
+ return {
22455
+ kind: "python-sidecar",
22456
+ stateDir,
22457
+ sidecarPath,
22458
+ nodeBin,
22459
+ npmCommand,
22460
+ scope,
22461
+ hostUrl,
22462
+ packageSpec,
22463
+ manualCommand
22464
+ };
22465
+ }
22409
22466
  function findRepoBackedSdkRoot(startPath) {
22410
22467
  let current = resolve15(startPath);
22411
22468
  while (true) {
@@ -22417,8 +22474,10 @@ function findRepoBackedSdkRoot(startPath) {
22417
22474
  current = parent;
22418
22475
  }
22419
22476
  }
22420
- function resolveUpdatePlan() {
22421
- const entrypoint = process.argv[1] ? resolve15(process.argv[1]) : "";
22477
+ function resolveUpdatePlan(options = {}) {
22478
+ const env = options.env ?? process.env;
22479
+ const homeDir2 = options.homeDir ?? homedir9();
22480
+ const entrypoint = options.entrypoint ?? (process.argv[1] ? resolve15(process.argv[1]) : "");
22422
22481
  const sourceRoot = entrypoint ? findRepoBackedSdkRoot(dirname13(entrypoint)) : null;
22423
22482
  if (sourceRoot) {
22424
22483
  return {
@@ -22427,8 +22486,16 @@ function resolveUpdatePlan() {
22427
22486
  manualCommand: buildSourceUpdateCommand(sourceRoot)
22428
22487
  };
22429
22488
  }
22489
+ const sidecarPlan = resolvePythonSidecarUpdatePlan({
22490
+ entrypoint,
22491
+ env,
22492
+ homeDir: homeDir2,
22493
+ packageSpec: options.packageSpec
22494
+ });
22495
+ if (sidecarPlan) return sidecarPlan;
22430
22496
  const command = "npm";
22431
- const args = ["install", "-g", "deepline@latest"];
22497
+ const packageSpec = options.packageSpec || "deepline@latest";
22498
+ const args = ["install", "-g", packageSpec];
22432
22499
  return {
22433
22500
  kind: "npm-global",
22434
22501
  command,
@@ -22436,12 +22503,40 @@ function resolveUpdatePlan() {
22436
22503
  manualCommand: `${command} ${args.map(shellQuote3).join(" ")}`
22437
22504
  };
22438
22505
  }
22439
- function runCommand(command, args) {
22506
+ function safeVersionSegment(value) {
22507
+ const normalized = value.trim();
22508
+ return /^[0-9A-Za-z._-]+$/.test(normalized) ? normalized : "";
22509
+ }
22510
+ function entryPathInVersionDir(versionDir) {
22511
+ return join15(
22512
+ versionDir,
22513
+ "node_modules",
22514
+ "deepline",
22515
+ "dist",
22516
+ "cli",
22517
+ "index.mjs"
22518
+ );
22519
+ }
22520
+ function installedPackageVersion(versionDir) {
22521
+ const packageJsonPath = join15(
22522
+ versionDir,
22523
+ "node_modules",
22524
+ "deepline",
22525
+ "package.json"
22526
+ );
22527
+ try {
22528
+ const parsed = JSON.parse(readFileSync11(packageJsonPath, "utf8"));
22529
+ return typeof parsed.version === "string" ? safeVersionSegment(parsed.version) : "";
22530
+ } catch {
22531
+ return "";
22532
+ }
22533
+ }
22534
+ function runCommand(command, args, env = process.env) {
22440
22535
  return new Promise((resolveExitCode) => {
22441
22536
  const child = spawn2(command, args, {
22442
22537
  stdio: "inherit",
22443
22538
  shell: process.platform === "win32",
22444
- env: process.env
22539
+ env
22445
22540
  });
22446
22541
  child.on("error", (error) => {
22447
22542
  process.stderr.write(`Failed to start ${command}: ${error.message}
@@ -22453,11 +22548,137 @@ function runCommand(command, args) {
22453
22548
  });
22454
22549
  });
22455
22550
  }
22456
- async function runNpmGlobalUpdatePlan(plan) {
22457
- if (plan.kind !== "npm-global") {
22551
+ function writeSidecarLauncher(input2) {
22552
+ mkdirSync8(dirname13(input2.path), { recursive: true });
22553
+ if (process.platform === "win32") {
22554
+ writeFileSync13(
22555
+ input2.path,
22556
+ [
22557
+ `@set DEEPLINE_HOST_URL=${input2.hostUrl.replace(/\r?\n/g, "")}`,
22558
+ `@set DEEPLINE_CONFIG_SCOPE=${input2.scope.replace(/\r?\n/g, "")}`,
22559
+ `@"${input2.nodeBin}" "${input2.entryPath}" %*`,
22560
+ ""
22561
+ ].join("\r\n"),
22562
+ "utf8"
22563
+ );
22564
+ return;
22565
+ }
22566
+ writeFileSync13(
22567
+ input2.path,
22568
+ [
22569
+ "#!/usr/bin/env sh",
22570
+ `export DEEPLINE_HOST_URL=${shellQuote3(input2.hostUrl)}`,
22571
+ `export DEEPLINE_CONFIG_SCOPE=${shellQuote3(input2.scope)}`,
22572
+ `exec ${shellQuote3(input2.nodeBin)} ${shellQuote3(input2.entryPath)} "$@"`,
22573
+ ""
22574
+ ].join("\n"),
22575
+ { encoding: "utf8", mode: 493 }
22576
+ );
22577
+ }
22578
+ async function runPythonSidecarUpdatePlan(plan) {
22579
+ const versionsDir = join15(plan.stateDir, "versions");
22580
+ const tempDir = join15(
22581
+ versionsDir,
22582
+ `.tmp-sdk-update-${process.pid}-${Date.now()}`
22583
+ );
22584
+ rmSync3(tempDir, { recursive: true, force: true });
22585
+ mkdirSync8(tempDir, { recursive: true });
22586
+ writeFileSync13(join15(tempDir, "package.json"), '{"private":true}\n', "utf8");
22587
+ const env = {
22588
+ ...process.env,
22589
+ PATH: `${dirname13(plan.nodeBin)}${process.platform === "win32" ? ";" : ":"}${process.env.PATH ?? ""}`
22590
+ };
22591
+ const installExitCode = await runCommand(
22592
+ plan.npmCommand,
22593
+ [
22594
+ "install",
22595
+ "--prefix",
22596
+ tempDir,
22597
+ "--no-audit",
22598
+ "--no-fund",
22599
+ plan.packageSpec
22600
+ ],
22601
+ env
22602
+ );
22603
+ if (installExitCode !== 0) {
22604
+ rmSync3(tempDir, { recursive: true, force: true });
22605
+ return installExitCode;
22606
+ }
22607
+ const installedVersion = installedPackageVersion(tempDir);
22608
+ if (!installedVersion) {
22609
+ process.stderr.write(
22610
+ "Updated Deepline SDK package did not report a version.\n"
22611
+ );
22612
+ rmSync3(tempDir, { recursive: true, force: true });
22613
+ return 1;
22614
+ }
22615
+ const finalDir = join15(versionsDir, installedVersion);
22616
+ const finalEntryPath = entryPathInVersionDir(finalDir);
22617
+ if (existsSync12(finalEntryPath)) {
22618
+ rmSync3(tempDir, { recursive: true, force: true });
22619
+ } else {
22620
+ rmSync3(finalDir, { recursive: true, force: true });
22621
+ try {
22622
+ renameSync(tempDir, finalDir);
22623
+ } catch (error) {
22624
+ rmSync3(tempDir, { recursive: true, force: true });
22625
+ process.stderr.write(
22626
+ `Failed to publish Deepline SDK sidecar update: ${error.message}
22627
+ `
22628
+ );
22629
+ return 1;
22630
+ }
22631
+ }
22632
+ if (!existsSync12(finalEntryPath)) {
22633
+ process.stderr.write(
22634
+ `Updated Deepline SDK CLI entrypoint missing: ${finalEntryPath}
22635
+ `
22636
+ );
22458
22637
  return 1;
22459
22638
  }
22460
- return runCommand(plan.command, plan.args);
22639
+ writeSidecarLauncher({
22640
+ path: plan.sidecarPath,
22641
+ hostUrl: plan.hostUrl,
22642
+ scope: plan.scope,
22643
+ nodeBin: plan.nodeBin,
22644
+ entryPath: finalEntryPath
22645
+ });
22646
+ writeFileSync13(
22647
+ join15(plan.stateDir, ".version"),
22648
+ `${installedVersion}
22649
+ `,
22650
+ "utf8"
22651
+ );
22652
+ writeFileSync13(
22653
+ join15(plan.stateDir, ".install-method"),
22654
+ "python-sidecar\n",
22655
+ "utf8"
22656
+ );
22657
+ writeFileSync13(
22658
+ join15(plan.stateDir, ".command-path"),
22659
+ `${plan.sidecarPath}
22660
+ `,
22661
+ "utf8"
22662
+ );
22663
+ writeFileSync13(join15(plan.stateDir, ".runner"), "node\n", "utf8");
22664
+ writeFileSync13(join15(plan.stateDir, ".node-bin"), `${plan.nodeBin}
22665
+ `, "utf8");
22666
+ writeFileSync13(
22667
+ join15(plan.stateDir, ".entry-path"),
22668
+ `${finalEntryPath}
22669
+ `,
22670
+ "utf8"
22671
+ );
22672
+ return 0;
22673
+ }
22674
+ async function runUpdatePlan(plan) {
22675
+ if (plan.kind === "npm-global") {
22676
+ return runCommand(plan.command, plan.args);
22677
+ }
22678
+ if (plan.kind === "python-sidecar") {
22679
+ return runPythonSidecarUpdatePlan(plan);
22680
+ }
22681
+ return 1;
22461
22682
  }
22462
22683
  async function handleUpdate(options) {
22463
22684
  const plan = resolveUpdatePlan();
@@ -22468,6 +22689,9 @@ async function handleUpdate(options) {
22468
22689
  lines: plan.kind === "source" ? [
22469
22690
  "This Deepline CLI is running from SDK source, so it cannot safely update itself like an npm global.",
22470
22691
  `Update the backing checkout with: ${plan.manualCommand}`
22692
+ ] : plan.kind === "python-sidecar" ? [
22693
+ "This Deepline CLI is running from the Python-managed SDK sidecar.",
22694
+ "Updating will refresh that sidecar, not a global npm binary."
22471
22695
  ] : [`Updating Deepline SDK/CLI with: ${plan.manualCommand}`]
22472
22696
  }
22473
22697
  ]
@@ -22497,7 +22721,7 @@ async function handleUpdate(options) {
22497
22721
  `Updating Deepline SDK/CLI with: ${plan.manualCommand}
22498
22722
  `
22499
22723
  );
22500
- return runCommand(plan.command, plan.args);
22724
+ return runUpdatePlan(plan);
22501
22725
  }
22502
22726
  function registerUpdateCommand(program) {
22503
22727
  program.command("update").description("Update the Deepline SDK/CLI.").addHelpText(
@@ -22505,6 +22729,8 @@ function registerUpdateCommand(program) {
22505
22729
  `
22506
22730
  Notes:
22507
22731
  For the published npm CLI, this runs npm install -g deepline@latest.
22732
+ For Python-managed SDK sidecars, this refreshes the sidecar that launched
22733
+ the current SDK CLI instead of changing a global npm binary.
22508
22734
  For repo-backed SDK wrappers such as cli-env sdk-prod or sdk-worktree, this
22509
22735
  prints the exact git command to update the checkout that provides the CLI.
22510
22736
 
@@ -22718,10 +22944,13 @@ function isCi() {
22718
22944
  function shouldSkipSelfUpdate() {
22719
22945
  return envTruthy("DEEPLINE_SKIP_SELF_UPDATE") || envTruthy("DEEPLINE_NO_AUTO_UPDATE") || envTruthy("DEEPLINE_SKIP_SDK_AUTO_UPDATE") || envTruthy("DEEPLINE_DISABLE_AUTO_UPDATE") || isCi();
22720
22946
  }
22721
- function relaunchCurrentCommand() {
22947
+ function relaunchCurrentCommand(plan) {
22722
22948
  return new Promise((resolve16) => {
22723
- const child = spawn3(process.execPath, process.argv.slice(1), {
22949
+ const command = plan.kind === "python-sidecar" ? plan.sidecarPath : process.execPath;
22950
+ const args = plan.kind === "python-sidecar" ? process.argv.slice(2) : process.argv.slice(1);
22951
+ const child = spawn3(command, args, {
22724
22952
  stdio: "inherit",
22953
+ shell: process.platform === "win32",
22725
22954
  env: {
22726
22955
  ...process.env,
22727
22956
  DEEPLINE_NO_AUTO_UPDATE: "1"
@@ -22742,8 +22971,9 @@ async function maybeAutoUpdateAndRelaunch(response) {
22742
22971
  if (!response || !autoUpdate?.should_auto_update || shouldSkipSelfUpdate()) {
22743
22972
  return false;
22744
22973
  }
22745
- const plan = resolveUpdatePlan();
22746
- if (plan.kind !== "npm-global") {
22974
+ const packageSpec = response.latest ? `deepline@${response.latest}` : void 0;
22975
+ const plan = resolveUpdatePlan({ packageSpec });
22976
+ if (plan.kind === "source") {
22747
22977
  return false;
22748
22978
  }
22749
22979
  const label = autoUpdate.reason === "rollback_forced" ? "has a server rollback pending and needs the latest rollback-aware CLI" : autoUpdate.required ? "requires an update" : "is more than the supported auto-update lag behind";
@@ -22751,7 +22981,7 @@ async function maybeAutoUpdateAndRelaunch(response) {
22751
22981
  `Deepline SDK/CLI ${label}; running ${plan.manualCommand}
22752
22982
  `
22753
22983
  );
22754
- const updateExitCode = await runNpmGlobalUpdatePlan(plan);
22984
+ const updateExitCode = await runUpdatePlan(plan);
22755
22985
  if (updateExitCode !== 0) {
22756
22986
  if (autoUpdate.required) {
22757
22987
  throw new Error(
@@ -22765,15 +22995,15 @@ async function maybeAutoUpdateAndRelaunch(response) {
22765
22995
  return false;
22766
22996
  }
22767
22997
  process.stderr.write("Deepline SDK/CLI updated; rerunning command.\n");
22768
- const exitCode = await relaunchCurrentCommand();
22998
+ const exitCode = await relaunchCurrentCommand(plan);
22769
22999
  process.exit(exitCode);
22770
23000
  return true;
22771
23001
  }
22772
23002
 
22773
23003
  // src/cli/skills-sync.ts
22774
23004
  import { spawn as spawn4, spawnSync as spawnSync2 } from "child_process";
22775
- import { existsSync as existsSync13, mkdirSync as mkdirSync8, readFileSync as readFileSync11, writeFileSync as writeFileSync13 } from "fs";
22776
- import { homedir as homedir9 } from "os";
23005
+ import { existsSync as existsSync13, mkdirSync as mkdirSync9, readFileSync as readFileSync12, writeFileSync as writeFileSync14 } from "fs";
23006
+ import { homedir as homedir10 } from "os";
22777
23007
  import { dirname as dirname14, join as join16 } from "path";
22778
23008
  var CHECK_TIMEOUT_MS2 = 3e3;
22779
23009
  var SDK_PLAY_SKILL_NAME = "deepline-plays";
@@ -22794,13 +23024,13 @@ function readPluginSkillsVersion() {
22794
23024
  const dir = activePluginSkillsDir();
22795
23025
  if (!dir) return "";
22796
23026
  try {
22797
- return readFileSync11(join16(dir, ".version"), "utf-8").trim();
23027
+ return readFileSync12(join16(dir, ".version"), "utf-8").trim();
22798
23028
  } catch {
22799
23029
  return "";
22800
23030
  }
22801
23031
  }
22802
23032
  function sdkSkillsVersionPath(baseUrl) {
22803
- const home = process.env.HOME?.trim() || homedir9();
23033
+ const home = process.env.HOME?.trim() || homedir10();
22804
23034
  return join16(
22805
23035
  home,
22806
23036
  ".local",
@@ -22816,15 +23046,15 @@ function readLocalSkillsVersion(baseUrl) {
22816
23046
  const path = sdkSkillsVersionPath(baseUrl);
22817
23047
  if (!existsSync13(path)) return "";
22818
23048
  try {
22819
- return readFileSync11(path, "utf-8").trim();
23049
+ return readFileSync12(path, "utf-8").trim();
22820
23050
  } catch {
22821
23051
  return "";
22822
23052
  }
22823
23053
  }
22824
23054
  function writeLocalSkillsVersion(baseUrl, version) {
22825
23055
  const path = sdkSkillsVersionPath(baseUrl);
22826
- mkdirSync8(dirname14(path), { recursive: true });
22827
- writeFileSync13(path, `${version}
23056
+ mkdirSync9(dirname14(path), { recursive: true });
23057
+ writeFileSync14(path, `${version}
22828
23058
  `, "utf-8");
22829
23059
  }
22830
23060
  function sortedUniqueSkillNames(names) {
package/dist/index.js CHANGED
@@ -274,10 +274,10 @@ var SDK_RELEASE = {
274
274
  // skill on the sdk sync surface, and the people-search-to-email prebuilt.
275
275
  // 0.1.108 ships explicit dataset column/tool recompute policy and removes
276
276
  // the SDK enrich generator's one-second stale policy.
277
- version: "0.1.112",
277
+ version: "0.1.113",
278
278
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
279
279
  supportPolicy: {
280
- latest: "0.1.112",
280
+ latest: "0.1.113",
281
281
  minimumSupported: "0.1.53",
282
282
  deprecatedBelow: "0.1.53",
283
283
  commandMinimumSupported: [
package/dist/index.mjs CHANGED
@@ -196,10 +196,10 @@ var SDK_RELEASE = {
196
196
  // skill on the sdk sync surface, and the people-search-to-email prebuilt.
197
197
  // 0.1.108 ships explicit dataset column/tool recompute policy and removes
198
198
  // the SDK enrich generator's one-second stale policy.
199
- version: "0.1.112",
199
+ version: "0.1.113",
200
200
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
201
201
  supportPolicy: {
202
- latest: "0.1.112",
202
+ latest: "0.1.113",
203
203
  minimumSupported: "0.1.53",
204
204
  deprecatedBelow: "0.1.53",
205
205
  commandMinimumSupported: [
@@ -99,10 +99,10 @@ export const SDK_RELEASE = {
99
99
  // skill on the sdk sync surface, and the people-search-to-email prebuilt.
100
100
  // 0.1.108 ships explicit dataset column/tool recompute policy and removes
101
101
  // the SDK enrich generator's one-second stale policy.
102
- version: '0.1.112',
102
+ version: '0.1.113',
103
103
  apiContract: '2026-06-dataset-column-cell-stale-hard-cutover',
104
104
  supportPolicy: {
105
- latest: '0.1.112',
105
+ latest: '0.1.113',
106
106
  minimumSupported: '0.1.53',
107
107
  deprecatedBelow: '0.1.53',
108
108
  commandMinimumSupported: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.1.112",
3
+ "version": "0.1.113",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {