@aryacode/dsh-local-llm 0.8.4 → 0.8.5

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/lib/index.d.ts CHANGED
@@ -1731,11 +1731,20 @@ declare class NInferController {
1731
1731
  distribution: string;
1732
1732
  binary: string;
1733
1733
  libraryPath: string;
1734
+ terminateOnStop?: boolean;
1734
1735
  };
1735
1736
  });
1736
1737
  /** Resolve saved tuning or validated deployment defaults. */
1737
1738
  settings(): NInferSettings;
1738
1739
  private callWsl;
1740
+ /**
1741
+ * Shut the distro down after the engine stops, so the WSL VM gives its memory back.
1742
+ *
1743
+ * `wsl --terminate` is the only lever that returns the distro's RAM: stopping
1744
+ * the binary leaves systemd and the utility VM resident. A distro that is
1745
+ * already stopped makes the call a no-op, so a failure here is not an error.
1746
+ */
1747
+ private terminateDistro;
1739
1748
  /** A container this Host may reclaim; a missing Docker or an unrelated one is no takeover. */
1740
1749
  private external;
1741
1750
  private wslStatus;
@@ -1792,6 +1801,12 @@ declare class NInferController {
1792
1801
  ok: boolean;
1793
1802
  detail: string;
1794
1803
  }>;
1804
+ /**
1805
+ * Stop the engine, and by default hand the WSL distro's memory back.
1806
+ *
1807
+ * @param terminate - terminate the WSL distro after the engine stops; a start
1808
+ * or restart passes `false` because it is about to use that distro again.
1809
+ */
1795
1810
  private stop;
1796
1811
  /** Stop the external container that is provably this installation's engine. */
1797
1812
  private takeOver;
package/lib/index.js CHANGED
@@ -3100,6 +3100,23 @@ var NInferController = class {
3100
3100
  }));
3101
3101
  });
3102
3102
  }
3103
+ /**
3104
+ * Shut the distro down after the engine stops, so the WSL VM gives its memory back.
3105
+ *
3106
+ * `wsl --terminate` is the only lever that returns the distro's RAM: stopping
3107
+ * the binary leaves systemd and the utility VM resident. A distro that is
3108
+ * already stopped makes the call a no-op, so a failure here is not an error.
3109
+ */
3110
+ async terminateDistro() {
3111
+ const distribution = this.config.wsl?.distribution;
3112
+ if (distribution === void 0) return;
3113
+ try {
3114
+ await execute$1("wsl.exe", ["--terminate", distribution], {
3115
+ windowsHide: true,
3116
+ timeout: 3e4
3117
+ });
3118
+ } catch (error) {}
3119
+ }
3103
3120
  /** A container this Host may reclaim; a missing Docker or an unrelated one is no takeover. */
3104
3121
  async external() {
3105
3122
  try {
@@ -3265,9 +3282,16 @@ var NInferController = class {
3265
3282
  this.changing = false;
3266
3283
  }
3267
3284
  }
3268
- async stop() {
3285
+ /**
3286
+ * Stop the engine, and by default hand the WSL distro's memory back.
3287
+ *
3288
+ * @param terminate - terminate the WSL distro after the engine stops; a start
3289
+ * or restart passes `false` because it is about to use that distro again.
3290
+ */
3291
+ async stop(terminate = true) {
3269
3292
  if (this.config.wsl) {
3270
3293
  await this.callWsl("stop");
3294
+ if (terminate && this.config.wsl.terminateOnStop !== false) await this.terminateDistro();
3271
3295
  return;
3272
3296
  }
3273
3297
  const container = await this.container();
@@ -3313,17 +3337,19 @@ var NInferController = class {
3313
3337
  await this.takeOver();
3314
3338
  takenOver = "Stopped the external NInfer container. ";
3315
3339
  }
3316
- if (action === "stop" || action === "restart") await this.stop();
3317
- if (action === "stop") return {
3318
- ok: true,
3319
- detail: takenOver + "NInfer stopped."
3320
- };
3340
+ if (action === "stop") {
3341
+ await this.stop();
3342
+ return {
3343
+ ok: true,
3344
+ detail: takenOver + "NInfer stopped."
3345
+ };
3346
+ }
3321
3347
  if (action === "start" && ["running", "starting"].includes(status.phase)) return {
3322
3348
  ok: true,
3323
3349
  detail: "NInfer is already started."
3324
3350
  };
3325
3351
  if (!this.complete()) throw Error("Wait for the model checksum verification.");
3326
- await this.stop();
3352
+ await this.stop(false);
3327
3353
  if (this.config.wsl) {
3328
3354
  const started = await this.callWsl("start");
3329
3355
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aryacode/dsh-local-llm",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
4
4
  "description": "AryaStrata engine controls with the local NInfer Qwen3.8 dense model for AryaAI",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",