@aryacode/dsh-local-llm 0.8.3 → 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 +15 -0
- package/lib/index.js +46 -8
- package/package.json +1 -1
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
|
@@ -2657,6 +2657,18 @@ function libraryAdapter(controller, ensure, gate, checkIdle, attachments, strata
|
|
|
2657
2657
|
originalModel: model
|
|
2658
2658
|
});
|
|
2659
2659
|
/**
|
|
2660
|
+
* The label the other Arya engines show: `qwen3.8-27b` becomes `Arya - Qwen3.8 27B`.
|
|
2661
|
+
*
|
|
2662
|
+
* The model list is what a person reads in the picker, so a bare artifact id is
|
|
2663
|
+
* a poor label next to the existing `Arya - …` entries. Each segment is
|
|
2664
|
+
* capitalised, and a lowercase letter that follows a trailing digit — a size or
|
|
2665
|
+
* quantisation suffix such as `27b` — is uppercased the way these artifacts are
|
|
2666
|
+
* written on the tin.
|
|
2667
|
+
*/
|
|
2668
|
+
const aryaLabel = (name) => "Arya - " + name.split(/[-_]/u).filter((part) => part !== "").map((part) => {
|
|
2669
|
+
return (part.charAt(0).toUpperCase() + part.slice(1)).replace(/(\d)([a-z])$/u, (_match, digit, letter) => digit + letter.toUpperCase());
|
|
2670
|
+
}).join(" ");
|
|
2671
|
+
/**
|
|
2660
2672
|
* Every model this installation has, loaded or not.
|
|
2661
2673
|
*
|
|
2662
2674
|
* The engine serves one model at a time, but it can switch: `POST
|
|
@@ -2713,7 +2725,7 @@ function libraryAdapter(controller, ensure, gate, checkIdle, attachments, strata
|
|
|
2713
2725
|
const state = await ninfer.status();
|
|
2714
2726
|
if (typeof state.modelName === "string" && state.modelName !== "") {
|
|
2715
2727
|
const model = {
|
|
2716
|
-
...info("ninfer:" + state.modelName,
|
|
2728
|
+
...info("ninfer:" + state.modelName, aryaLabel(state.modelName), Number(state.context) || 8192, state.vision === true, "ninfer", state.modelName),
|
|
2717
2729
|
defaultMaxTokens: outputDefault(Number(state.context) || 8192, ninfer.outputTokens()),
|
|
2718
2730
|
reasoning: ninferReasoning
|
|
2719
2731
|
};
|
|
@@ -3088,6 +3100,23 @@ var NInferController = class {
|
|
|
3088
3100
|
}));
|
|
3089
3101
|
});
|
|
3090
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
|
+
}
|
|
3091
3120
|
/** A container this Host may reclaim; a missing Docker or an unrelated one is no takeover. */
|
|
3092
3121
|
async external() {
|
|
3093
3122
|
try {
|
|
@@ -3253,9 +3282,16 @@ var NInferController = class {
|
|
|
3253
3282
|
this.changing = false;
|
|
3254
3283
|
}
|
|
3255
3284
|
}
|
|
3256
|
-
|
|
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) {
|
|
3257
3292
|
if (this.config.wsl) {
|
|
3258
3293
|
await this.callWsl("stop");
|
|
3294
|
+
if (terminate && this.config.wsl.terminateOnStop !== false) await this.terminateDistro();
|
|
3259
3295
|
return;
|
|
3260
3296
|
}
|
|
3261
3297
|
const container = await this.container();
|
|
@@ -3301,17 +3337,19 @@ var NInferController = class {
|
|
|
3301
3337
|
await this.takeOver();
|
|
3302
3338
|
takenOver = "Stopped the external NInfer container. ";
|
|
3303
3339
|
}
|
|
3304
|
-
if (action === "stop"
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3340
|
+
if (action === "stop") {
|
|
3341
|
+
await this.stop();
|
|
3342
|
+
return {
|
|
3343
|
+
ok: true,
|
|
3344
|
+
detail: takenOver + "NInfer stopped."
|
|
3345
|
+
};
|
|
3346
|
+
}
|
|
3309
3347
|
if (action === "start" && ["running", "starting"].includes(status.phase)) return {
|
|
3310
3348
|
ok: true,
|
|
3311
3349
|
detail: "NInfer is already started."
|
|
3312
3350
|
};
|
|
3313
3351
|
if (!this.complete()) throw Error("Wait for the model checksum verification.");
|
|
3314
|
-
await this.stop();
|
|
3352
|
+
await this.stop(false);
|
|
3315
3353
|
if (this.config.wsl) {
|
|
3316
3354
|
const started = await this.callWsl("start");
|
|
3317
3355
|
return {
|