deepline 0.1.111 → 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.111",
406
+ version: "0.1.113",
407
407
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
408
408
  supportPolicy: {
409
- latest: "0.1.111",
409
+ latest: "0.1.113",
410
410
  minimumSupported: "0.1.53",
411
411
  deprecatedBelow: "0.1.53",
412
412
  commandMinimumSupported: [
@@ -20142,6 +20142,9 @@ function writeActiveFamily(family) {
20142
20142
  `, "utf-8");
20143
20143
  return path;
20144
20144
  }
20145
+ function forcePythonCliFamily() {
20146
+ return writeActiveFamily("python");
20147
+ }
20145
20148
  function handleSwitch(action, options) {
20146
20149
  const normalized = (action || "status").trim().toLowerCase();
20147
20150
  if (normalized === "status") {
@@ -22354,6 +22357,7 @@ Notes:
22354
22357
  // src/cli/commands/update.ts
22355
22358
  var import_node_child_process2 = require("child_process");
22356
22359
  var import_node_fs16 = require("fs");
22360
+ var import_node_os13 = require("os");
22357
22361
  var import_node_path20 = require("path");
22358
22362
  function posixShellQuote(value) {
22359
22363
  return `'${value.replace(/'/g, `'\\''`)}'`;
@@ -22372,6 +22376,55 @@ function buildSourceUpdateCommand(sourceRoot) {
22372
22376
  const cdCommand = process.platform === "win32" ? `cd /d ${quotedRoot}` : `cd ${quotedRoot}`;
22373
22377
  return `${cdCommand} && git fetch origin main --tags && git merge --ff-only origin/main`;
22374
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
+ }
22375
22428
  function findRepoBackedSdkRoot(startPath) {
22376
22429
  let current = (0, import_node_path20.resolve)(startPath);
22377
22430
  while (true) {
@@ -22383,8 +22436,10 @@ function findRepoBackedSdkRoot(startPath) {
22383
22436
  current = parent;
22384
22437
  }
22385
22438
  }
22386
- function resolveUpdatePlan() {
22387
- 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]) : "");
22388
22443
  const sourceRoot = entrypoint ? findRepoBackedSdkRoot((0, import_node_path20.dirname)(entrypoint)) : null;
22389
22444
  if (sourceRoot) {
22390
22445
  return {
@@ -22393,8 +22448,16 @@ function resolveUpdatePlan() {
22393
22448
  manualCommand: buildSourceUpdateCommand(sourceRoot)
22394
22449
  };
22395
22450
  }
22451
+ const sidecarPlan = resolvePythonSidecarUpdatePlan({
22452
+ entrypoint,
22453
+ env,
22454
+ homeDir: homeDir2,
22455
+ packageSpec: options.packageSpec
22456
+ });
22457
+ if (sidecarPlan) return sidecarPlan;
22396
22458
  const command = "npm";
22397
- const args = ["install", "-g", "deepline@latest"];
22459
+ const packageSpec = options.packageSpec || "deepline@latest";
22460
+ const args = ["install", "-g", packageSpec];
22398
22461
  return {
22399
22462
  kind: "npm-global",
22400
22463
  command,
@@ -22402,12 +22465,40 @@ function resolveUpdatePlan() {
22402
22465
  manualCommand: `${command} ${args.map(shellQuote3).join(" ")}`
22403
22466
  };
22404
22467
  }
22405
- 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) {
22406
22497
  return new Promise((resolveExitCode) => {
22407
22498
  const child = (0, import_node_child_process2.spawn)(command, args, {
22408
22499
  stdio: "inherit",
22409
22500
  shell: process.platform === "win32",
22410
- env: process.env
22501
+ env
22411
22502
  });
22412
22503
  child.on("error", (error) => {
22413
22504
  process.stderr.write(`Failed to start ${command}: ${error.message}
@@ -22419,11 +22510,137 @@ function runCommand(command, args) {
22419
22510
  });
22420
22511
  });
22421
22512
  }
22422
- async function runNpmGlobalUpdatePlan(plan) {
22423
- 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 });
22575
+ return 1;
22576
+ }
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
+ );
22424
22599
  return 1;
22425
22600
  }
22426
- return runCommand(plan.command, plan.args);
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;
22427
22644
  }
22428
22645
  async function handleUpdate(options) {
22429
22646
  const plan = resolveUpdatePlan();
@@ -22434,6 +22651,9 @@ async function handleUpdate(options) {
22434
22651
  lines: plan.kind === "source" ? [
22435
22652
  "This Deepline CLI is running from SDK source, so it cannot safely update itself like an npm global.",
22436
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."
22437
22657
  ] : [`Updating Deepline SDK/CLI with: ${plan.manualCommand}`]
22438
22658
  }
22439
22659
  ]
@@ -22463,7 +22683,7 @@ async function handleUpdate(options) {
22463
22683
  `Updating Deepline SDK/CLI with: ${plan.manualCommand}
22464
22684
  `
22465
22685
  );
22466
- return runCommand(plan.command, plan.args);
22686
+ return runUpdatePlan(plan);
22467
22687
  }
22468
22688
  function registerUpdateCommand(program) {
22469
22689
  program.command("update").description("Update the Deepline SDK/CLI.").addHelpText(
@@ -22471,6 +22691,8 @@ function registerUpdateCommand(program) {
22471
22691
  `
22472
22692
  Notes:
22473
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.
22474
22696
  For repo-backed SDK wrappers such as cli-env sdk-prod or sdk-worktree, this
22475
22697
  prints the exact git command to update the checkout that provides the CLI.
22476
22698
 
@@ -22684,10 +22906,13 @@ function isCi() {
22684
22906
  function shouldSkipSelfUpdate() {
22685
22907
  return envTruthy("DEEPLINE_SKIP_SELF_UPDATE") || envTruthy("DEEPLINE_NO_AUTO_UPDATE") || envTruthy("DEEPLINE_SKIP_SDK_AUTO_UPDATE") || envTruthy("DEEPLINE_DISABLE_AUTO_UPDATE") || isCi();
22686
22908
  }
22687
- function relaunchCurrentCommand() {
22909
+ function relaunchCurrentCommand(plan) {
22688
22910
  return new Promise((resolve16) => {
22689
- 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, {
22690
22914
  stdio: "inherit",
22915
+ shell: process.platform === "win32",
22691
22916
  env: {
22692
22917
  ...process.env,
22693
22918
  DEEPLINE_NO_AUTO_UPDATE: "1"
@@ -22708,16 +22933,17 @@ async function maybeAutoUpdateAndRelaunch(response) {
22708
22933
  if (!response || !autoUpdate?.should_auto_update || shouldSkipSelfUpdate()) {
22709
22934
  return false;
22710
22935
  }
22711
- const plan = resolveUpdatePlan();
22712
- 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") {
22713
22939
  return false;
22714
22940
  }
22715
- const label = autoUpdate.required ? "requires an update" : "is more than the supported auto-update lag behind";
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";
22716
22942
  process.stderr.write(
22717
22943
  `Deepline SDK/CLI ${label}; running ${plan.manualCommand}
22718
22944
  `
22719
22945
  );
22720
- const updateExitCode = await runNpmGlobalUpdatePlan(plan);
22946
+ const updateExitCode = await runUpdatePlan(plan);
22721
22947
  if (updateExitCode !== 0) {
22722
22948
  if (autoUpdate.required) {
22723
22949
  throw new Error(
@@ -22731,7 +22957,7 @@ async function maybeAutoUpdateAndRelaunch(response) {
22731
22957
  return false;
22732
22958
  }
22733
22959
  process.stderr.write("Deepline SDK/CLI updated; rerunning command.\n");
22734
- const exitCode = await relaunchCurrentCommand();
22960
+ const exitCode = await relaunchCurrentCommand(plan);
22735
22961
  process.exit(exitCode);
22736
22962
  return true;
22737
22963
  }
@@ -22739,7 +22965,7 @@ async function maybeAutoUpdateAndRelaunch(response) {
22739
22965
  // src/cli/skills-sync.ts
22740
22966
  var import_node_child_process4 = require("child_process");
22741
22967
  var import_node_fs17 = require("fs");
22742
- var import_node_os13 = require("os");
22968
+ var import_node_os14 = require("os");
22743
22969
  var import_node_path21 = require("path");
22744
22970
  var CHECK_TIMEOUT_MS2 = 3e3;
22745
22971
  var SDK_PLAY_SKILL_NAME = "deepline-plays";
@@ -22766,7 +22992,7 @@ function readPluginSkillsVersion() {
22766
22992
  }
22767
22993
  }
22768
22994
  function sdkSkillsVersionPath(baseUrl) {
22769
- const home = process.env.HOME?.trim() || (0, import_node_os13.homedir)();
22995
+ const home = process.env.HOME?.trim() || (0, import_node_os14.homedir)();
22770
22996
  return (0, import_node_path21.join)(
22771
22997
  home,
22772
22998
  ".local",
@@ -22969,7 +23195,7 @@ async function syncSdkSkillsIfNeeded(baseUrl) {
22969
23195
  }
22970
23196
 
22971
23197
  // src/cli/failure-reporting.ts
22972
- var import_node_os14 = require("os");
23198
+ var import_node_os15 = require("os");
22973
23199
  var FAILURE_REPORT_DISABLE_ENV = "DEEPLINE_DISABLE_FAILURE_REPORTING";
22974
23200
  var REPORT_FAILURE_TIMEOUT_MS = 1e4;
22975
23201
  var MAX_FAILURE_TEXT_CHARS = 4e3;
@@ -23091,12 +23317,12 @@ function detectAgentRuntime3() {
23091
23317
  }
23092
23318
  function buildEnvironmentContext() {
23093
23319
  const context = {
23094
- os: (0, import_node_os14.platform)(),
23095
- os_release: (0, import_node_os14.release)(),
23096
- 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}`,
23097
23323
  node_version: process.version,
23098
23324
  runtime: "Node.js",
23099
- hostname: (0, import_node_os14.hostname)(),
23325
+ hostname: (0, import_node_os15.hostname)(),
23100
23326
  agent_runtime: detectAgentRuntime3()
23101
23327
  };
23102
23328
  for (const key of ["CLAUDE_CODE_REMOTE", "DEEPLINE_PLUGIN_MODE"]) {
@@ -23276,7 +23502,7 @@ function topLevelCommandKnown(program, commandName) {
23276
23502
  );
23277
23503
  }
23278
23504
  async function runPlayRunnerHealthCheck() {
23279
- 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-"));
23280
23506
  const file = (0, import_node_path22.join)(dir, "health-check.play.ts");
23281
23507
  try {
23282
23508
  await (0, import_promises7.writeFile)(
@@ -23515,6 +23741,18 @@ Exit codes:
23515
23741
  if (relaunched) {
23516
23742
  return;
23517
23743
  }
23744
+ if (compatibility.response?.cli_family?.action === "force_python") {
23745
+ forcePythonCliFamily();
23746
+ process.stderr.write(
23747
+ "Deepline SDK CLI rollback is active; switched installer-managed `deepline` back to the Python CLI. Re-run your command.\n"
23748
+ );
23749
+ const error = new Error(
23750
+ "SDK CLI rollback is active"
23751
+ );
23752
+ error.code = "deepline.sdk_cli_rollback";
23753
+ error.exitCode = 7;
23754
+ throw error;
23755
+ }
23518
23756
  enforceSdkCompatibilityResponse(compatibility.response);
23519
23757
  if (printStartupPhase) {
23520
23758
  progress?.phase("checking sdk skills");
@@ -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.111",
383
+ version: "0.1.113",
384
384
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
385
385
  supportPolicy: {
386
- latest: "0.1.111",
386
+ latest: "0.1.113",
387
387
  minimumSupported: "0.1.53",
388
388
  deprecatedBelow: "0.1.53",
389
389
  commandMinimumSupported: [
@@ -20167,6 +20167,9 @@ function writeActiveFamily(family) {
20167
20167
  `, "utf-8");
20168
20168
  return path;
20169
20169
  }
20170
+ function forcePythonCliFamily() {
20171
+ return writeActiveFamily("python");
20172
+ }
20170
20173
  function handleSwitch(action, options) {
20171
20174
  const normalized = (action || "status").trim().toLowerCase();
20172
20175
  if (normalized === "status") {
@@ -22384,8 +22387,16 @@ Notes:
22384
22387
 
22385
22388
  // src/cli/commands/update.ts
22386
22389
  import { spawn as spawn2 } from "child_process";
22387
- import { existsSync as existsSync12 } from "fs";
22388
- 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";
22389
22400
  function posixShellQuote(value) {
22390
22401
  return `'${value.replace(/'/g, `'\\''`)}'`;
22391
22402
  }
@@ -22403,6 +22414,55 @@ function buildSourceUpdateCommand(sourceRoot) {
22403
22414
  const cdCommand = process.platform === "win32" ? `cd /d ${quotedRoot}` : `cd ${quotedRoot}`;
22404
22415
  return `${cdCommand} && git fetch origin main --tags && git merge --ff-only origin/main`;
22405
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
+ }
22406
22466
  function findRepoBackedSdkRoot(startPath) {
22407
22467
  let current = resolve15(startPath);
22408
22468
  while (true) {
@@ -22414,8 +22474,10 @@ function findRepoBackedSdkRoot(startPath) {
22414
22474
  current = parent;
22415
22475
  }
22416
22476
  }
22417
- function resolveUpdatePlan() {
22418
- 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]) : "");
22419
22481
  const sourceRoot = entrypoint ? findRepoBackedSdkRoot(dirname13(entrypoint)) : null;
22420
22482
  if (sourceRoot) {
22421
22483
  return {
@@ -22424,8 +22486,16 @@ function resolveUpdatePlan() {
22424
22486
  manualCommand: buildSourceUpdateCommand(sourceRoot)
22425
22487
  };
22426
22488
  }
22489
+ const sidecarPlan = resolvePythonSidecarUpdatePlan({
22490
+ entrypoint,
22491
+ env,
22492
+ homeDir: homeDir2,
22493
+ packageSpec: options.packageSpec
22494
+ });
22495
+ if (sidecarPlan) return sidecarPlan;
22427
22496
  const command = "npm";
22428
- const args = ["install", "-g", "deepline@latest"];
22497
+ const packageSpec = options.packageSpec || "deepline@latest";
22498
+ const args = ["install", "-g", packageSpec];
22429
22499
  return {
22430
22500
  kind: "npm-global",
22431
22501
  command,
@@ -22433,12 +22503,40 @@ function resolveUpdatePlan() {
22433
22503
  manualCommand: `${command} ${args.map(shellQuote3).join(" ")}`
22434
22504
  };
22435
22505
  }
22436
- 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) {
22437
22535
  return new Promise((resolveExitCode) => {
22438
22536
  const child = spawn2(command, args, {
22439
22537
  stdio: "inherit",
22440
22538
  shell: process.platform === "win32",
22441
- env: process.env
22539
+ env
22442
22540
  });
22443
22541
  child.on("error", (error) => {
22444
22542
  process.stderr.write(`Failed to start ${command}: ${error.message}
@@ -22450,11 +22548,137 @@ function runCommand(command, args) {
22450
22548
  });
22451
22549
  });
22452
22550
  }
22453
- async function runNpmGlobalUpdatePlan(plan) {
22454
- 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
+ );
22455
22637
  return 1;
22456
22638
  }
22457
- 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;
22458
22682
  }
22459
22683
  async function handleUpdate(options) {
22460
22684
  const plan = resolveUpdatePlan();
@@ -22465,6 +22689,9 @@ async function handleUpdate(options) {
22465
22689
  lines: plan.kind === "source" ? [
22466
22690
  "This Deepline CLI is running from SDK source, so it cannot safely update itself like an npm global.",
22467
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."
22468
22695
  ] : [`Updating Deepline SDK/CLI with: ${plan.manualCommand}`]
22469
22696
  }
22470
22697
  ]
@@ -22494,7 +22721,7 @@ async function handleUpdate(options) {
22494
22721
  `Updating Deepline SDK/CLI with: ${plan.manualCommand}
22495
22722
  `
22496
22723
  );
22497
- return runCommand(plan.command, plan.args);
22724
+ return runUpdatePlan(plan);
22498
22725
  }
22499
22726
  function registerUpdateCommand(program) {
22500
22727
  program.command("update").description("Update the Deepline SDK/CLI.").addHelpText(
@@ -22502,6 +22729,8 @@ function registerUpdateCommand(program) {
22502
22729
  `
22503
22730
  Notes:
22504
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.
22505
22734
  For repo-backed SDK wrappers such as cli-env sdk-prod or sdk-worktree, this
22506
22735
  prints the exact git command to update the checkout that provides the CLI.
22507
22736
 
@@ -22715,10 +22944,13 @@ function isCi() {
22715
22944
  function shouldSkipSelfUpdate() {
22716
22945
  return envTruthy("DEEPLINE_SKIP_SELF_UPDATE") || envTruthy("DEEPLINE_NO_AUTO_UPDATE") || envTruthy("DEEPLINE_SKIP_SDK_AUTO_UPDATE") || envTruthy("DEEPLINE_DISABLE_AUTO_UPDATE") || isCi();
22717
22946
  }
22718
- function relaunchCurrentCommand() {
22947
+ function relaunchCurrentCommand(plan) {
22719
22948
  return new Promise((resolve16) => {
22720
- 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, {
22721
22952
  stdio: "inherit",
22953
+ shell: process.platform === "win32",
22722
22954
  env: {
22723
22955
  ...process.env,
22724
22956
  DEEPLINE_NO_AUTO_UPDATE: "1"
@@ -22739,16 +22971,17 @@ async function maybeAutoUpdateAndRelaunch(response) {
22739
22971
  if (!response || !autoUpdate?.should_auto_update || shouldSkipSelfUpdate()) {
22740
22972
  return false;
22741
22973
  }
22742
- const plan = resolveUpdatePlan();
22743
- 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") {
22744
22977
  return false;
22745
22978
  }
22746
- const label = autoUpdate.required ? "requires an update" : "is more than the supported auto-update lag behind";
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";
22747
22980
  process.stderr.write(
22748
22981
  `Deepline SDK/CLI ${label}; running ${plan.manualCommand}
22749
22982
  `
22750
22983
  );
22751
- const updateExitCode = await runNpmGlobalUpdatePlan(plan);
22984
+ const updateExitCode = await runUpdatePlan(plan);
22752
22985
  if (updateExitCode !== 0) {
22753
22986
  if (autoUpdate.required) {
22754
22987
  throw new Error(
@@ -22762,15 +22995,15 @@ async function maybeAutoUpdateAndRelaunch(response) {
22762
22995
  return false;
22763
22996
  }
22764
22997
  process.stderr.write("Deepline SDK/CLI updated; rerunning command.\n");
22765
- const exitCode = await relaunchCurrentCommand();
22998
+ const exitCode = await relaunchCurrentCommand(plan);
22766
22999
  process.exit(exitCode);
22767
23000
  return true;
22768
23001
  }
22769
23002
 
22770
23003
  // src/cli/skills-sync.ts
22771
23004
  import { spawn as spawn4, spawnSync as spawnSync2 } from "child_process";
22772
- import { existsSync as existsSync13, mkdirSync as mkdirSync8, readFileSync as readFileSync11, writeFileSync as writeFileSync13 } from "fs";
22773
- 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";
22774
23007
  import { dirname as dirname14, join as join16 } from "path";
22775
23008
  var CHECK_TIMEOUT_MS2 = 3e3;
22776
23009
  var SDK_PLAY_SKILL_NAME = "deepline-plays";
@@ -22791,13 +23024,13 @@ function readPluginSkillsVersion() {
22791
23024
  const dir = activePluginSkillsDir();
22792
23025
  if (!dir) return "";
22793
23026
  try {
22794
- return readFileSync11(join16(dir, ".version"), "utf-8").trim();
23027
+ return readFileSync12(join16(dir, ".version"), "utf-8").trim();
22795
23028
  } catch {
22796
23029
  return "";
22797
23030
  }
22798
23031
  }
22799
23032
  function sdkSkillsVersionPath(baseUrl) {
22800
- const home = process.env.HOME?.trim() || homedir9();
23033
+ const home = process.env.HOME?.trim() || homedir10();
22801
23034
  return join16(
22802
23035
  home,
22803
23036
  ".local",
@@ -22813,15 +23046,15 @@ function readLocalSkillsVersion(baseUrl) {
22813
23046
  const path = sdkSkillsVersionPath(baseUrl);
22814
23047
  if (!existsSync13(path)) return "";
22815
23048
  try {
22816
- return readFileSync11(path, "utf-8").trim();
23049
+ return readFileSync12(path, "utf-8").trim();
22817
23050
  } catch {
22818
23051
  return "";
22819
23052
  }
22820
23053
  }
22821
23054
  function writeLocalSkillsVersion(baseUrl, version) {
22822
23055
  const path = sdkSkillsVersionPath(baseUrl);
22823
- mkdirSync8(dirname14(path), { recursive: true });
22824
- writeFileSync13(path, `${version}
23056
+ mkdirSync9(dirname14(path), { recursive: true });
23057
+ writeFileSync14(path, `${version}
22825
23058
  `, "utf-8");
22826
23059
  }
22827
23060
  function sortedUniqueSkillNames(names) {
@@ -23546,6 +23779,18 @@ Exit codes:
23546
23779
  if (relaunched) {
23547
23780
  return;
23548
23781
  }
23782
+ if (compatibility.response?.cli_family?.action === "force_python") {
23783
+ forcePythonCliFamily();
23784
+ process.stderr.write(
23785
+ "Deepline SDK CLI rollback is active; switched installer-managed `deepline` back to the Python CLI. Re-run your command.\n"
23786
+ );
23787
+ const error = new Error(
23788
+ "SDK CLI rollback is active"
23789
+ );
23790
+ error.code = "deepline.sdk_cli_rollback";
23791
+ error.exitCode = 7;
23792
+ throw error;
23793
+ }
23549
23794
  enforceSdkCompatibilityResponse(compatibility.response);
23550
23795
  if (printStartupPhase) {
23551
23796
  progress?.phase("checking sdk skills");
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.111",
277
+ version: "0.1.113",
278
278
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
279
279
  supportPolicy: {
280
- latest: "0.1.111",
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.111",
199
+ version: "0.1.113",
200
200
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
201
201
  supportPolicy: {
202
- latest: "0.1.111",
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.111',
102
+ version: '0.1.113',
103
103
  apiContract: '2026-06-dataset-column-cell-stale-hard-cutover',
104
104
  supportPolicy: {
105
- latest: '0.1.111',
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.111",
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": {