dsh-plugin-local-infer 0.1.2 → 0.1.4
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/README.md +32 -6
- package/cordis.patch.yml +7 -0
- package/docs/zh/README.md +24 -4
- package/dsh/client.js +4200 -4049
- package/package.json +33 -11
- package/packages/core/lib/adapter.d.ts +177 -11
- package/packages/core/lib/adapter.js +74 -1
- package/packages/core/lib/config.d.ts +1 -1
- package/packages/core/lib/config.js +1 -1
- package/packages/core/lib/debug.d.ts +1 -1
- package/packages/core/lib/debug.js +1 -1
- package/packages/core/lib/defaults.d.ts +1 -1
- package/packages/core/lib/defaults.js +1 -1
- package/packages/core/lib/deps.d.ts +48 -20
- package/packages/core/lib/deps.js +24 -8
- package/packages/core/lib/estimator.d.ts +1 -1
- package/packages/core/lib/estimator.js +1 -1
- package/packages/core/lib/guideline.d.ts +1 -1
- package/packages/core/lib/guideline.js +1 -1
- package/packages/core/lib/hardware.d.ts +1 -1
- package/packages/core/lib/hardware.js +1 -1
- package/packages/core/lib/hf-cache.d.ts +70 -0
- package/packages/core/lib/hf-cache.js +83 -0
- package/packages/core/lib/index.d.ts +16 -9
- package/packages/core/lib/index.js +10 -6
- package/packages/core/lib/infer-cache.d.ts +39 -0
- package/packages/core/lib/infer-cache.js +53 -0
- package/packages/core/lib/launch-command.d.ts +8 -4
- package/packages/core/lib/launch-command.js +13 -6
- package/packages/core/lib/launch-record.d.ts +1 -1
- package/packages/core/lib/launch-record.js +1 -1
- package/packages/core/lib/logs.d.ts +8 -1
- package/packages/core/lib/logs.js +12 -4
- package/packages/core/lib/models.d.ts +120 -14
- package/packages/core/lib/models.js +209 -17
- package/packages/core/lib/parameter.d.ts +31 -3
- package/packages/core/lib/parameter.js +1 -1
- package/packages/core/lib/progress.d.ts +54 -0
- package/packages/core/lib/progress.js +120 -0
- package/packages/core/lib/registrar.d.ts +25 -14
- package/packages/core/lib/registrar.js +30 -10
- package/packages/core/lib/reserve.d.ts +11 -3
- package/packages/core/lib/reserve.js +6 -4
- package/packages/core/lib/status.d.ts +12 -6
- package/packages/core/lib/status.js +21 -10
- package/packages/core/lib/sudo.d.ts +80 -0
- package/packages/core/lib/sudo.js +78 -0
- package/packages/core/package.json +1 -1
- package/packages/orchestrator/lib/config.d.ts +63 -0
- package/packages/orchestrator/lib/config.js +111 -0
- package/packages/orchestrator/lib/index.d.ts +51 -0
- package/packages/orchestrator/lib/index.js +73 -0
- package/packages/orchestrator/lib/route.d.ts +60 -0
- package/packages/orchestrator/lib/route.js +159 -0
- package/packages/orchestrator/locale/en.json +6 -0
- package/packages/orchestrator/package.json +39 -0
- package/packages/orchestrator/prompt.md +87 -0
- package/packages/providers/lib/acquire.d.ts +95 -15
- package/packages/providers/lib/acquire.js +239 -40
- package/packages/providers/lib/adapters.d.ts +155 -221
- package/packages/providers/lib/adapters.js +589 -935
- package/packages/providers/lib/debug.d.ts +1 -1
- package/packages/providers/lib/debug.js +1 -1
- package/packages/providers/lib/deps.d.ts +31 -212
- package/packages/providers/lib/deps.js +71 -205
- package/packages/providers/lib/engines/basalt/basalt.d.ts +130 -0
- package/packages/providers/lib/engines/basalt/basalt.js +304 -0
- package/packages/providers/lib/engines/basalt/basaltAdapter.d.ts +85 -0
- package/packages/providers/lib/engines/basalt/basaltAdapter.js +439 -0
- package/packages/providers/lib/engines/basalt/basaltLinux.d.ts +23 -0
- package/packages/providers/lib/engines/basalt/basaltLinux.js +47 -0
- package/packages/providers/lib/engines/basalt/basaltMacOS.d.ts +17 -0
- package/packages/providers/lib/engines/basalt/basaltMacOS.js +19 -0
- package/packages/providers/lib/engines/basalt/basaltWindows.d.ts +24 -0
- package/packages/providers/lib/engines/basalt/basaltWindows.js +49 -0
- package/packages/providers/lib/engines/engineOs.d.ts +24 -0
- package/packages/providers/lib/engines/engineOs.js +17 -0
- package/packages/providers/lib/{hyperqwen.d.ts → engines/hyperqwen/hyperqwen.d.ts} +2 -2
- package/packages/providers/lib/{hyperqwen.js → engines/hyperqwen/hyperqwen.js} +14 -2
- package/packages/providers/lib/engines/hyperqwen/hyperqwenAdapter.d.ts +38 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenAdapter.js +115 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenArch.d.ts +9 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenArch.js +9 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenDebian.d.ts +9 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenDebian.js +9 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenFedora.d.ts +9 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenFedora.js +9 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenLinux.d.ts +10 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenLinux.js +14 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenMacOS.d.ts +9 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenMacOS.js +9 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenWindows.d.ts +9 -0
- package/packages/providers/lib/engines/hyperqwen/hyperqwenWindows.js +9 -0
- package/packages/providers/lib/{infernix.d.ts → engines/infernix/infernix.d.ts} +7 -4
- package/packages/providers/lib/{infernix.js → engines/infernix/infernix.js} +53 -8
- package/packages/providers/lib/engines/infernix/infernixAdapter.d.ts +52 -0
- package/packages/providers/lib/engines/infernix/infernixAdapter.js +235 -0
- package/packages/providers/lib/engines/infernix/infernixArch.d.ts +9 -0
- package/packages/providers/lib/engines/infernix/infernixArch.js +9 -0
- package/packages/providers/lib/engines/infernix/infernixDebian.d.ts +9 -0
- package/packages/providers/lib/engines/infernix/infernixDebian.js +9 -0
- package/packages/providers/lib/engines/infernix/infernixFedora.d.ts +9 -0
- package/packages/providers/lib/engines/infernix/infernixFedora.js +9 -0
- package/packages/providers/lib/engines/infernix/infernixLinux.d.ts +17 -0
- package/packages/providers/lib/engines/infernix/infernixLinux.js +35 -0
- package/packages/providers/lib/engines/infernix/infernixMacOS.d.ts +16 -0
- package/packages/providers/lib/engines/infernix/infernixMacOS.js +18 -0
- package/packages/providers/lib/engines/infernix/infernixWindows.d.ts +16 -0
- package/packages/providers/lib/engines/infernix/infernixWindows.js +34 -0
- package/packages/providers/lib/{llamacpp.d.ts → engines/llamacpp/llamacpp.d.ts} +2 -2
- package/packages/providers/lib/{llamacpp.js → engines/llamacpp/llamacpp.js} +12 -2
- package/packages/providers/lib/engines/llamacpp/llamacppAdapter.d.ts +50 -0
- package/packages/providers/lib/engines/llamacpp/llamacppAdapter.js +274 -0
- package/packages/providers/lib/engines/llamacpp/llamacppArch.d.ts +9 -0
- package/packages/providers/lib/engines/llamacpp/llamacppArch.js +9 -0
- package/packages/providers/lib/engines/llamacpp/llamacppDebian.d.ts +9 -0
- package/packages/providers/lib/engines/llamacpp/llamacppDebian.js +9 -0
- package/packages/providers/lib/engines/llamacpp/llamacppFedora.d.ts +9 -0
- package/packages/providers/lib/engines/llamacpp/llamacppFedora.js +9 -0
- package/packages/providers/lib/engines/llamacpp/llamacppLinux.d.ts +17 -0
- package/packages/providers/lib/engines/llamacpp/llamacppLinux.js +28 -0
- package/packages/providers/lib/engines/llamacpp/llamacppMacOS.d.ts +15 -0
- package/packages/providers/lib/engines/llamacpp/llamacppMacOS.js +17 -0
- package/packages/providers/lib/engines/llamacpp/llamacppWindows.d.ts +15 -0
- package/packages/providers/lib/engines/llamacpp/llamacppWindows.js +26 -0
- package/packages/providers/lib/{ninfer.d.ts → engines/ninfer/ninfer.d.ts} +2 -2
- package/packages/providers/lib/{ninfer.js → engines/ninfer/ninfer.js} +25 -3
- package/packages/providers/lib/engines/ninfer/ninferAdapter.d.ts +81 -0
- package/packages/providers/lib/engines/ninfer/ninferAdapter.js +392 -0
- package/packages/providers/lib/engines/ninfer/ninferArch.d.ts +9 -0
- package/packages/providers/lib/engines/ninfer/ninferArch.js +9 -0
- package/packages/providers/lib/engines/ninfer/ninferDebian.d.ts +9 -0
- package/packages/providers/lib/engines/ninfer/ninferDebian.js +9 -0
- package/packages/providers/lib/engines/ninfer/ninferFedora.d.ts +9 -0
- package/packages/providers/lib/engines/ninfer/ninferFedora.js +9 -0
- package/packages/providers/lib/engines/ninfer/ninferLinux.d.ts +17 -0
- package/packages/providers/lib/engines/ninfer/ninferLinux.js +37 -0
- package/packages/providers/lib/engines/ninfer/ninferMacOS.d.ts +15 -0
- package/packages/providers/lib/engines/ninfer/ninferMacOS.js +17 -0
- package/packages/providers/lib/engines/ninfer/ninferWindows.d.ts +29 -0
- package/packages/providers/lib/engines/ninfer/ninferWindows.js +59 -0
- package/packages/providers/lib/engines/strata/strata.d.ts +1 -0
- package/packages/providers/lib/engines/strata/strata.js +264 -0
- package/packages/providers/lib/engines/strata/strataAdapter.d.ts +97 -0
- package/packages/providers/lib/engines/strata/strataAdapter.js +463 -0
- package/packages/providers/lib/engines/strata/strataArch.d.ts +9 -0
- package/packages/providers/lib/engines/strata/strataArch.js +9 -0
- package/packages/providers/lib/engines/strata/strataDebian.d.ts +9 -0
- package/packages/providers/lib/engines/strata/strataDebian.js +9 -0
- package/packages/providers/lib/engines/strata/strataFedora.d.ts +9 -0
- package/packages/providers/lib/engines/strata/strataFedora.js +9 -0
- package/packages/providers/lib/engines/strata/strataLinux.d.ts +21 -0
- package/packages/providers/lib/engines/strata/strataLinux.js +30 -0
- package/packages/providers/lib/engines/strata/strataMacOS.d.ts +16 -0
- package/packages/providers/lib/engines/strata/strataMacOS.js +17 -0
- package/packages/providers/lib/engines/strata/strataWindows.d.ts +27 -0
- package/packages/providers/lib/engines/strata/strataWindows.js +37 -0
- package/packages/providers/lib/engines.d.ts +8 -5
- package/packages/providers/lib/engines.js +22 -11
- package/packages/providers/lib/guidelines.d.ts +5 -4
- package/packages/providers/lib/guidelines.js +18 -5
- package/packages/providers/lib/index.d.ts +33 -24
- package/packages/providers/lib/index.js +46 -24
- package/packages/providers/lib/model-defaults.d.ts +10 -5
- package/packages/providers/lib/model-defaults.js +47 -5
- package/packages/providers/lib/platform.d.ts +8 -5
- package/packages/providers/lib/platform.js +27 -7
- package/packages/providers/lib/presets.d.ts +6 -4
- package/packages/providers/lib/presets.js +53 -5
- package/packages/providers/lib/systemDeps.d.ts +313 -0
- package/packages/providers/lib/systemDeps.js +284 -0
- package/packages/providers/lib/vram.d.ts +34 -8
- package/packages/providers/lib/vram.js +81 -8
- package/packages/providers/package.json +2 -2
- package/packages/service/lib/index.d.ts +187 -23
- package/packages/service/lib/index.js +667 -90
- package/packages/service/lib/launch-target.d.ts +19 -0
- package/packages/service/lib/launch-target.js +28 -0
- package/packages/service/lib/run-logs.d.ts +72 -0
- package/packages/service/lib/run-logs.js +125 -0
- package/packages/service/lib/types.d.ts +166 -8
- package/packages/service/lib/types.js +1 -1
- package/packages/service/package.json +2 -2
- package/packages/tool/lib/index.d.ts +1 -1
- package/packages/tool/lib/index.js +1 -1
- package/packages/tool/package.json +2 -2
- package/packages/ui/lib/config.d.ts +89 -0
- package/packages/ui/lib/config.js +251 -0
- package/packages/ui/lib/deps.d.ts +4 -4
- package/packages/ui/lib/deps.js +1 -1
- package/packages/ui/lib/form.d.ts +1 -1
- package/packages/ui/lib/form.js +1 -1
- package/packages/ui/lib/index.d.ts +7 -1
- package/packages/ui/lib/index.js +12 -2
- package/packages/ui/lib/meter.d.ts +1 -1
- package/packages/ui/lib/meter.js +1 -1
- package/packages/ui/lib/ops/engine.d.ts +216 -0
- package/packages/ui/lib/ops/engine.js +697 -0
- package/packages/ui/lib/ops/get-steps.d.ts +98 -0
- package/packages/ui/lib/ops/get-steps.js +359 -0
- package/packages/ui/lib/ops/hf.d.ts +42 -0
- package/packages/ui/lib/ops/hf.js +150 -0
- package/packages/ui/lib/ops/logs.d.ts +78 -0
- package/packages/ui/lib/ops/logs.js +119 -0
- package/packages/ui/lib/ops/model.d.ts +71 -0
- package/packages/ui/lib/ops/model.js +123 -0
- package/packages/ui/lib/request.d.ts +106 -0
- package/packages/ui/lib/request.js +80 -0
- package/packages/ui/lib/route.d.ts +106 -422
- package/packages/ui/lib/route.js +136 -1845
- package/packages/ui/lib/routes/chat-template.d.ts +1 -0
- package/packages/ui/lib/routes/chat-template.js +1 -0
- package/packages/ui/lib/routes/deps.d.ts +1 -0
- package/packages/ui/lib/routes/deps.js +1 -0
- package/packages/ui/lib/routes/download.d.ts +1 -0
- package/packages/ui/lib/routes/download.js +1 -0
- package/packages/ui/lib/routes/get.d.ts +1 -0
- package/packages/ui/lib/routes/get.js +106 -0
- package/packages/ui/lib/routes/install.d.ts +16 -0
- package/packages/ui/lib/routes/install.js +36 -0
- package/packages/ui/lib/routes/launch.d.ts +24 -0
- package/packages/ui/lib/routes/launch.js +74 -0
- package/packages/ui/lib/routes/logs.d.ts +57 -0
- package/packages/ui/lib/routes/logs.js +117 -0
- package/packages/ui/lib/routes/provider-delete.d.ts +15 -0
- package/packages/ui/lib/routes/provider-delete.js +37 -0
- package/packages/ui/lib/routes/register.d.ts +16 -0
- package/packages/ui/lib/routes/register.js +28 -0
- package/packages/ui/lib/routes/save.d.ts +18 -0
- package/packages/ui/lib/routes/save.js +159 -0
- package/packages/ui/lib/routes/stop.d.ts +19 -0
- package/packages/ui/lib/routes/stop.js +32 -0
- package/packages/ui/lib/routes/stream.d.ts +40 -0
- package/packages/ui/lib/routes/stream.js +68 -0
- package/packages/ui/lib/routes/summary.d.ts +15 -0
- package/packages/ui/lib/routes/summary.js +26 -0
- package/packages/ui/lib/routes/unregister.d.ts +14 -0
- package/packages/ui/lib/routes/unregister.js +26 -0
- package/packages/ui/lib/viewmodels/deps.d.ts +1 -0
- package/packages/ui/lib/viewmodels/deps.js +1 -0
- package/packages/ui/lib/viewmodels/depsHelpers.d.ts +1 -0
- package/packages/ui/lib/viewmodels/depsHelpers.js +94 -0
- package/packages/ui/lib/viewmodels/summary.d.ts +145 -0
- package/packages/ui/lib/viewmodels/summary.js +245 -0
- package/packages/ui/lib/viewmodels/summaryHelpers.d.ts +30 -0
- package/packages/ui/lib/viewmodels/summaryHelpers.js +42 -0
- package/packages/ui/lib/warnings.d.ts +1 -1
- package/packages/ui/lib/warnings.js +1 -1
- package/packages/ui/package.json +4 -4
- package/packages/providers/lib/strata.d.ts +0 -15
- package/packages/providers/lib/strata.js +0 -14
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Infernix Fedora build profile. Fedora builds Infernix through the shared
|
|
3
|
+
* Linux route (the engine's own cmake preset), so this profile reuses the
|
|
4
|
+
* shared Linux profile and carries no build steps of its own.
|
|
5
|
+
* @module dsh-plugin-local-infer/providers/engines/infernix/infernixFedora
|
|
6
|
+
*/
|
|
7
|
+
import type { EngineOsProfile } from '../engineOs.ts';
|
|
8
|
+
export declare const INFERNIX_FEDORA: EngineOsProfile;
|
|
9
|
+
//# sourceMappingURL=infernixFedora.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Infernix Fedora build profile. Fedora builds Infernix through the shared
|
|
3
|
+
* Linux route (the engine's own cmake preset), so this profile reuses the
|
|
4
|
+
* shared Linux profile and carries no build steps of its own.
|
|
5
|
+
* @module dsh-plugin-local-infer/providers/engines/infernix/infernixFedora
|
|
6
|
+
*/
|
|
7
|
+
import { INFERNIX_LINUX } from "./infernixLinux.js";
|
|
8
|
+
export const INFERNIX_FEDORA = INFERNIX_LINUX;
|
|
9
|
+
//# sourceMappingURL=infernixFedora.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Infernix shared Linux build profile. Every Linux distro (Arch, Debian,
|
|
3
|
+
* Fedora) builds Infernix through the engine's own cmake preset: configure the
|
|
4
|
+
* release preset, then build into the `build` directory, which is where the
|
|
5
|
+
* `infernix-serve` binary lands. The distro profiles reuse this profile, so a
|
|
6
|
+
* distro carries no build steps of its own.
|
|
7
|
+
* @module dsh-plugin-local-infer/providers/engines/infernix/infernixLinux
|
|
8
|
+
*/
|
|
9
|
+
import type { EngineOsProfile } from '../engineOs.ts';
|
|
10
|
+
export declare const INFERNIX_LINUX: EngineOsProfile;
|
|
11
|
+
/**
|
|
12
|
+
* infernixLinuxBinary returns the Infernix engine binary name on Linux: the
|
|
13
|
+
* plain `infernix-serve` (no .exe). The name comes from the shared Linux
|
|
14
|
+
* profile, so the spelling has one home.
|
|
15
|
+
*/
|
|
16
|
+
export declare function infernixLinuxBinary(): string;
|
|
17
|
+
//# sourceMappingURL=infernixLinux.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Infernix shared Linux build profile. Every Linux distro (Arch, Debian,
|
|
3
|
+
* Fedora) builds Infernix through the engine's own cmake preset: configure the
|
|
4
|
+
* release preset, then build into the `build` directory, which is where the
|
|
5
|
+
* `infernix-serve` binary lands. The distro profiles reuse this profile, so a
|
|
6
|
+
* distro carries no build steps of its own.
|
|
7
|
+
* @module dsh-plugin-local-infer/providers/engines/infernix/infernixLinux
|
|
8
|
+
*/
|
|
9
|
+
import { SYSTEM_DEPS } from "../../systemDeps.js";
|
|
10
|
+
export const INFERNIX_LINUX = {
|
|
11
|
+
buildSteps: ['cd {dir} && cmake --preset release && cmake --build build -j'],
|
|
12
|
+
buildDir: 'build',
|
|
13
|
+
binary: 'infernix-serve',
|
|
14
|
+
// Infernix builds through the engine's own cmake preset, so its local list
|
|
15
|
+
// is the same toolchain as NInfer's: the compile toolchain, the ffmpeg and
|
|
16
|
+
// curl dev libraries, the CUDA toolkit, and the hf CLI.
|
|
17
|
+
deps: [
|
|
18
|
+
SYSTEM_DEPS.cmake,
|
|
19
|
+
SYSTEM_DEPS.ninja,
|
|
20
|
+
SYSTEM_DEPS.pkgConfig,
|
|
21
|
+
SYSTEM_DEPS.ffmpeg,
|
|
22
|
+
SYSTEM_DEPS.curl,
|
|
23
|
+
SYSTEM_DEPS.cudaToolkit,
|
|
24
|
+
SYSTEM_DEPS.hfCli,
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* infernixLinuxBinary returns the Infernix engine binary name on Linux: the
|
|
29
|
+
* plain `infernix-serve` (no .exe). The name comes from the shared Linux
|
|
30
|
+
* profile, so the spelling has one home.
|
|
31
|
+
*/
|
|
32
|
+
export function infernixLinuxBinary() {
|
|
33
|
+
return INFERNIX_LINUX.binary ?? 'infernix-serve';
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=infernixLinux.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Infernix macOS build profile. macOS builds Infernix through the engine's
|
|
3
|
+
* own cmake preset, the same route as Linux, so this profile reuses the shared
|
|
4
|
+
* Linux build steps and build directory; the binary keeps its plain name (no
|
|
5
|
+
* .exe on macOS).
|
|
6
|
+
* @module dsh-plugin-local-infer/providers/engines/infernix/infernixMacOS
|
|
7
|
+
*/
|
|
8
|
+
import type { EngineOsProfile } from '../engineOs.ts';
|
|
9
|
+
export declare const INFERNIX_MACOS: EngineOsProfile;
|
|
10
|
+
/**
|
|
11
|
+
* infernixMacOSBinary returns the Infernix engine binary name on macOS: the
|
|
12
|
+
* plain `infernix-serve` (no .exe on macOS). The name comes from the shared
|
|
13
|
+
* Linux profile the macOS profile reuses, so the spelling has one home.
|
|
14
|
+
*/
|
|
15
|
+
export declare function infernixMacOSBinary(): string;
|
|
16
|
+
//# sourceMappingURL=infernixMacOS.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Infernix macOS build profile. macOS builds Infernix through the engine's
|
|
3
|
+
* own cmake preset, the same route as Linux, so this profile reuses the shared
|
|
4
|
+
* Linux build steps and build directory; the binary keeps its plain name (no
|
|
5
|
+
* .exe on macOS).
|
|
6
|
+
* @module dsh-plugin-local-infer/providers/engines/infernix/infernixMacOS
|
|
7
|
+
*/
|
|
8
|
+
import { INFERNIX_LINUX } from "./infernixLinux.js";
|
|
9
|
+
export const INFERNIX_MACOS = INFERNIX_LINUX;
|
|
10
|
+
/**
|
|
11
|
+
* infernixMacOSBinary returns the Infernix engine binary name on macOS: the
|
|
12
|
+
* plain `infernix-serve` (no .exe on macOS). The name comes from the shared
|
|
13
|
+
* Linux profile the macOS profile reuses, so the spelling has one home.
|
|
14
|
+
*/
|
|
15
|
+
export function infernixMacOSBinary() {
|
|
16
|
+
return INFERNIX_MACOS.binary ?? 'infernix-serve';
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=infernixMacOS.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Infernix Windows build profile. Infernix builds through the engine's own
|
|
3
|
+
* cmake preset on every platform, so the Windows host reads the same preset
|
|
4
|
+
* route as Linux; the published release zip ships the server and its DLLs, so
|
|
5
|
+
* the binary is the .exe.
|
|
6
|
+
* @module dsh-plugin-local-infer/providers/engines/infernix/infernixWindows
|
|
7
|
+
*/
|
|
8
|
+
import type { EngineOsProfile } from '../engineOs.ts';
|
|
9
|
+
export declare const INFERNIX_WINDOWS: EngineOsProfile;
|
|
10
|
+
/**
|
|
11
|
+
* infernixWindowsBinary returns the Infernix engine binary name on Windows:
|
|
12
|
+
* the `infernix-serve.exe` the published release zip ships with its DLLs. The
|
|
13
|
+
* name comes from the Windows profile, so the .exe spelling has one home.
|
|
14
|
+
*/
|
|
15
|
+
export declare function infernixWindowsBinary(): string;
|
|
16
|
+
//# sourceMappingURL=infernixWindows.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Infernix Windows build profile. Infernix builds through the engine's own
|
|
3
|
+
* cmake preset on every platform, so the Windows host reads the same preset
|
|
4
|
+
* route as Linux; the published release zip ships the server and its DLLs, so
|
|
5
|
+
* the binary is the .exe.
|
|
6
|
+
* @module dsh-plugin-local-infer/providers/engines/infernix/infernixWindows
|
|
7
|
+
*/
|
|
8
|
+
import { INFERNIX_LINUX } from "./infernixLinux.js";
|
|
9
|
+
import { SYSTEM_DEPS } from "../../systemDeps.js";
|
|
10
|
+
export const INFERNIX_WINDOWS = {
|
|
11
|
+
buildSteps: INFERNIX_LINUX.buildSteps,
|
|
12
|
+
buildDir: 'build',
|
|
13
|
+
binary: 'infernix-serve.exe',
|
|
14
|
+
// Infernix builds through the engine's own cmake preset, so its Windows
|
|
15
|
+
// local list is the same winget toolchain as NInfer's: CMake, Ninja, the
|
|
16
|
+
// MSVC compiler, the CUDA toolkit, the hf CLI, and git.
|
|
17
|
+
deps: [
|
|
18
|
+
SYSTEM_DEPS.cmake,
|
|
19
|
+
SYSTEM_DEPS.ninja,
|
|
20
|
+
SYSTEM_DEPS.visualStudio,
|
|
21
|
+
SYSTEM_DEPS.cudaToolkit,
|
|
22
|
+
SYSTEM_DEPS.hfCli,
|
|
23
|
+
SYSTEM_DEPS.git,
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* infernixWindowsBinary returns the Infernix engine binary name on Windows:
|
|
28
|
+
* the `infernix-serve.exe` the published release zip ships with its DLLs. The
|
|
29
|
+
* name comes from the Windows profile, so the .exe spelling has one home.
|
|
30
|
+
*/
|
|
31
|
+
export function infernixWindowsBinary() {
|
|
32
|
+
return INFERNIX_WINDOWS.binary ?? 'infernix-serve.exe';
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=infernixWindows.js.map
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* `LaunchPlan`. Adding a flag here is a data edit, never a core rewire. The
|
|
10
10
|
* engine is not present on the reference host, so the surface is the
|
|
11
11
|
* specified set the plan names, verified when the binary lands.
|
|
12
|
-
* @module dsh-plugin-local-infer/providers/llamacpp
|
|
12
|
+
* @module dsh-plugin-local-infer/providers/engines/llamacpp/llamacpp
|
|
13
13
|
*/
|
|
14
14
|
import type { Config, EnumOption, ParameterSpec } from 'dsh-plugin-local-infer/core';
|
|
15
15
|
/**
|
|
@@ -49,4 +49,4 @@ export declare const LLAMACPP_PARAMETERS: readonly ParameterSpec[];
|
|
|
49
49
|
* 27B artifact key. A config that names neither renders a bare plan.
|
|
50
50
|
*/
|
|
51
51
|
export declare function llamaCppModelKey(config: Config): string;
|
|
52
|
-
//# sourceMappingURL=llamacpp.d.ts.map
|
|
52
|
+
//# sourceMappingURL=llamacpp.d.ts.map
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* `LaunchPlan`. Adding a flag here is a data edit, never a core rewire. The
|
|
10
10
|
* engine is not present on the reference host, so the surface is the
|
|
11
11
|
* specified set the plan names, verified when the binary lands.
|
|
12
|
-
* @module dsh-plugin-local-infer/providers/llamacpp
|
|
12
|
+
* @module dsh-plugin-local-infer/providers/engines/llamacpp/llamacpp
|
|
13
13
|
*/
|
|
14
14
|
/**
|
|
15
15
|
* The KV cache quantization formats llama.cpp serves. `f16` is the full-
|
|
@@ -57,6 +57,7 @@ export const LLAMACPP_PARAMETERS = [
|
|
|
57
57
|
defaultValue: 4096,
|
|
58
58
|
group: 'Memory',
|
|
59
59
|
toArgv: (value) => ['--ctx-size', String(value)],
|
|
60
|
+
deploy: { target: 'cli' },
|
|
60
61
|
},
|
|
61
62
|
{
|
|
62
63
|
key: 'gpuLayers',
|
|
@@ -66,6 +67,7 @@ export const LLAMACPP_PARAMETERS = [
|
|
|
66
67
|
defaultValue: 99,
|
|
67
68
|
group: 'Memory',
|
|
68
69
|
toArgv: (value) => ['--n-gpu-layers', String(value)],
|
|
70
|
+
deploy: { target: 'cli' },
|
|
69
71
|
},
|
|
70
72
|
{
|
|
71
73
|
key: 'kvCacheType',
|
|
@@ -77,6 +79,7 @@ export const LLAMACPP_PARAMETERS = [
|
|
|
77
79
|
// llama.cpp prices the key and value caches separately; the engine serves
|
|
78
80
|
// both from the same tier, so one value spells both flags.
|
|
79
81
|
toArgv: (value) => ['--cache-type-k', String(value), '--cache-type-v', String(value)],
|
|
82
|
+
deploy: { target: 'cli' },
|
|
80
83
|
},
|
|
81
84
|
{
|
|
82
85
|
key: 'threads',
|
|
@@ -85,6 +88,7 @@ export const LLAMACPP_PARAMETERS = [
|
|
|
85
88
|
form: { kind: 'number', min: 1, step: 1, unit: 'threads' },
|
|
86
89
|
group: 'Engine',
|
|
87
90
|
toArgv: (value) => ['--threads', String(value)],
|
|
91
|
+
deploy: { target: 'cli' },
|
|
88
92
|
},
|
|
89
93
|
{
|
|
90
94
|
key: 'batchSize',
|
|
@@ -93,6 +97,7 @@ export const LLAMACPP_PARAMETERS = [
|
|
|
93
97
|
form: { kind: 'number', min: 32, step: 32, unit: 'tokens' },
|
|
94
98
|
group: 'Engine',
|
|
95
99
|
toArgv: (value) => ['--batch-size', String(value)],
|
|
100
|
+
deploy: { target: 'cli' },
|
|
96
101
|
},
|
|
97
102
|
{
|
|
98
103
|
key: 'parallel',
|
|
@@ -102,6 +107,7 @@ export const LLAMACPP_PARAMETERS = [
|
|
|
102
107
|
defaultValue: 1,
|
|
103
108
|
group: 'Concurrency',
|
|
104
109
|
toArgv: (value) => ['--parallel', String(value)],
|
|
110
|
+
deploy: { target: 'cli' },
|
|
105
111
|
},
|
|
106
112
|
{
|
|
107
113
|
key: 'temp',
|
|
@@ -111,6 +117,7 @@ export const LLAMACPP_PARAMETERS = [
|
|
|
111
117
|
defaultValue: 0.9,
|
|
112
118
|
group: 'Sampling',
|
|
113
119
|
toArgv: (value) => ['--temp', String(value)],
|
|
120
|
+
deploy: { target: 'cli' },
|
|
114
121
|
},
|
|
115
122
|
{
|
|
116
123
|
key: 'topP',
|
|
@@ -120,6 +127,7 @@ export const LLAMACPP_PARAMETERS = [
|
|
|
120
127
|
defaultValue: 0.95,
|
|
121
128
|
group: 'Sampling',
|
|
122
129
|
toArgv: (value) => ['--top-p', String(value)],
|
|
130
|
+
deploy: { target: 'cli' },
|
|
123
131
|
},
|
|
124
132
|
{
|
|
125
133
|
key: 'flashAttn',
|
|
@@ -129,6 +137,7 @@ export const LLAMACPP_PARAMETERS = [
|
|
|
129
137
|
defaultValue: false,
|
|
130
138
|
group: 'Engine',
|
|
131
139
|
toArgv: (value) => (value === true ? ['--flash-attn'] : []),
|
|
140
|
+
deploy: { target: 'cli' },
|
|
132
141
|
},
|
|
133
142
|
{
|
|
134
143
|
key: 'jinja',
|
|
@@ -138,6 +147,7 @@ export const LLAMACPP_PARAMETERS = [
|
|
|
138
147
|
defaultValue: true,
|
|
139
148
|
group: 'Engine',
|
|
140
149
|
toArgv: (value) => (value === true ? ['--jinja'] : []),
|
|
150
|
+
deploy: { target: 'cli' },
|
|
141
151
|
},
|
|
142
152
|
];
|
|
143
153
|
/**
|
|
@@ -148,4 +158,4 @@ export const LLAMACPP_PARAMETERS = [
|
|
|
148
158
|
export function llamaCppModelKey(config) {
|
|
149
159
|
return typeof config.model === 'string' ? config.model : 'qwen3-27b';
|
|
150
160
|
}
|
|
151
|
-
//# sourceMappingURL=llamacpp.js.map
|
|
161
|
+
//# sourceMappingURL=llamacpp.js.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The llama.cpp engine adapter. LlamaCppAdapter is the llama.cpp engine,
|
|
3
|
+
* both-capable like NInfer. `renderLaunch` renders a local `llama-server`
|
|
4
|
+
* process or a `docker run` of the ggml image from the same
|
|
5
|
+
* `LLAMACPP_PARAMETERS` surface; `deploy` builds the engine in the engine
|
|
6
|
+
* directory (or pulls the image), downloads the GGUF model into the model
|
|
7
|
+
* directory, and starts the engine; `healthCheck` polls the health URL;
|
|
8
|
+
* `stop` signals the tracked process and stops the named container.
|
|
9
|
+
* @module dsh-plugin-local-infer/providers/engines/llamacpp/llamacppAdapter
|
|
10
|
+
*/
|
|
11
|
+
import { EngineAdapter } from '../../../../core/lib/index.js';
|
|
12
|
+
import type { CommandLogger, Config, DeployOptions, DeployResult, EngineLaunchSignature, EnginePlatformConfig, HealthCheckOptions, HealthResult, HardwareProfile, LaunchPlan, LaunchProgress, LifecycleHost, ParameterSpec } from '../../../../core/lib/index.js';
|
|
13
|
+
/**
|
|
14
|
+
* The llama.cpp docker image the adapter pulls and runs. The engineFork
|
|
15
|
+
* platform config overrides the git source for a local build; the image stays
|
|
16
|
+
* the upstream ggml artifact.
|
|
17
|
+
*/
|
|
18
|
+
export declare const LLAMACPP_DOCKER_IMAGE = "ghcr.io/ggml-org/llama.cpp";
|
|
19
|
+
/**
|
|
20
|
+
* LlamaCppAdapter is the llama.cpp engine, both-capable like NInfer.
|
|
21
|
+
* `renderLaunch` renders a local `llama-server` process or a `docker run` of the
|
|
22
|
+
* ggml image from the same `LLAMACPP_PARAMETERS` surface; `deploy` builds the
|
|
23
|
+
* engine in the engine directory (or pulls the image), downloads the GGUF model
|
|
24
|
+
* into the model directory, and starts the engine; `healthCheck` polls the health
|
|
25
|
+
* URL; `stop` signals the tracked process and stops the named container.
|
|
26
|
+
*/
|
|
27
|
+
export declare class LlamaCppAdapter extends EngineAdapter {
|
|
28
|
+
readonly id = "llamacpp";
|
|
29
|
+
readonly supports: {
|
|
30
|
+
docker: boolean;
|
|
31
|
+
local: boolean;
|
|
32
|
+
};
|
|
33
|
+
private readonly host;
|
|
34
|
+
private readonly children;
|
|
35
|
+
constructor(host?: LifecycleHost);
|
|
36
|
+
parameters(): readonly ParameterSpec[];
|
|
37
|
+
modelRef(config: Config): {
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
};
|
|
41
|
+
launchSignature(config?: Config): EngineLaunchSignature;
|
|
42
|
+
renderLaunch(config: Config, _hw: HardwareProfile): LaunchPlan;
|
|
43
|
+
deploy(plan: LaunchPlan, platform?: EnginePlatformConfig, onProgress?: LaunchProgress, options?: DeployOptions): Promise<DeployResult>;
|
|
44
|
+
healthCheck(plan: LaunchPlan, options?: HealthCheckOptions): Promise<HealthResult>;
|
|
45
|
+
stop(plan: LaunchPlan, log?: CommandLogger): Promise<void>;
|
|
46
|
+
private buildMode;
|
|
47
|
+
private port;
|
|
48
|
+
private downloadModel;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=llamacppAdapter.d.ts.map
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The llama.cpp engine adapter. LlamaCppAdapter is the llama.cpp engine,
|
|
3
|
+
* both-capable like NInfer. `renderLaunch` renders a local `llama-server`
|
|
4
|
+
* process or a `docker run` of the ggml image from the same
|
|
5
|
+
* `LLAMACPP_PARAMETERS` surface; `deploy` builds the engine in the engine
|
|
6
|
+
* directory (or pulls the image), downloads the GGUF model into the model
|
|
7
|
+
* directory, and starts the engine; `healthCheck` polls the health URL;
|
|
8
|
+
* `stop` signals the tracked process and stops the named container.
|
|
9
|
+
* @module dsh-plugin-local-infer/providers/engines/llamacpp/llamacppAdapter
|
|
10
|
+
*/
|
|
11
|
+
import { basename, dirname, join } from 'node:path';
|
|
12
|
+
import { EngineAdapter, autoRebuildEnabled, hfDownloadCommand, hfHubCacheDirectory, hubCacheSnapshotFilePath, modelArtifactPresent, modelDownloadTarget, } from '../../../../core/lib/index.js';
|
|
13
|
+
import { auditRun, customArgFlags, flagsFromSpecs, nodeLifecycleHost, pollHealth, stopProcessPlan, trackChild, } from "../../adapters.js";
|
|
14
|
+
import { syncEngineForDeploy } from "../../acquire.js";
|
|
15
|
+
import { LLAMACPP_MODEL_ARTIFACTS, LLAMACPP_PARAMETERS, llamaCppModelKey, } from "./llamacpp.js";
|
|
16
|
+
import { llamacppLinuxBinary } from "./llamacppLinux.js";
|
|
17
|
+
import { llamacppMacOSBinary } from "./llamacppMacOS.js";
|
|
18
|
+
import { llamacppWindowsBinary } from "./llamacppWindows.js";
|
|
19
|
+
/**
|
|
20
|
+
* The llama.cpp engine binary is OS-specific (the .exe on Windows), so the
|
|
21
|
+
* launch binary comes from the host OS's binary function. The adapter's
|
|
22
|
+
* renderLaunch reads this map by the hardware profile's os, keeping the per-OS
|
|
23
|
+
* name in its own OS file.
|
|
24
|
+
*/
|
|
25
|
+
const LLAMACPP_BINARY = {
|
|
26
|
+
linux: llamacppLinuxBinary,
|
|
27
|
+
macos: llamacppMacOSBinary,
|
|
28
|
+
windows: llamacppWindowsBinary,
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The llama.cpp docker image the adapter pulls and runs. The engineFork
|
|
32
|
+
* platform config overrides the git source for a local build; the image stays
|
|
33
|
+
* the upstream ggml artifact.
|
|
34
|
+
*/
|
|
35
|
+
export const LLAMACPP_DOCKER_IMAGE = 'ghcr.io/ggml-org/llama.cpp';
|
|
36
|
+
/**
|
|
37
|
+
* llamaCppArtifact resolves the artifact a model key deploys. A key no entry
|
|
38
|
+
* names falls back to the 27B artifact, so a bare config always renders a plan.
|
|
39
|
+
*/
|
|
40
|
+
function llamaCppArtifact(modelKey) {
|
|
41
|
+
const artifact = modelKey !== undefined ? LLAMACPP_MODEL_ARTIFACTS[modelKey] : undefined;
|
|
42
|
+
return artifact ?? LLAMACPP_MODEL_ARTIFACTS['qwen3-27b'];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* LlamaCppAdapter is the llama.cpp engine, both-capable like NInfer.
|
|
46
|
+
* `renderLaunch` renders a local `llama-server` process or a `docker run` of the
|
|
47
|
+
* ggml image from the same `LLAMACPP_PARAMETERS` surface; `deploy` builds the
|
|
48
|
+
* engine in the engine directory (or pulls the image), downloads the GGUF model
|
|
49
|
+
* into the model directory, and starts the engine; `healthCheck` polls the health
|
|
50
|
+
* URL; `stop` signals the tracked process and stops the named container.
|
|
51
|
+
*/
|
|
52
|
+
export class LlamaCppAdapter extends EngineAdapter {
|
|
53
|
+
id = 'llamacpp';
|
|
54
|
+
supports = { docker: true, local: true };
|
|
55
|
+
host;
|
|
56
|
+
children = new Map();
|
|
57
|
+
constructor(host = nodeLifecycleHost) {
|
|
58
|
+
super();
|
|
59
|
+
this.host = host;
|
|
60
|
+
}
|
|
61
|
+
parameters() {
|
|
62
|
+
return LLAMACPP_PARAMETERS;
|
|
63
|
+
}
|
|
64
|
+
modelRef(config) {
|
|
65
|
+
// The engine serves the model under the artifact's advertised id, so the
|
|
66
|
+
// registrar publishes that alias and a chat turn routes to it.
|
|
67
|
+
const artifact = llamaCppArtifact(llamaCppModelKey(config));
|
|
68
|
+
return { id: artifact.modelId, name: artifact.modelId };
|
|
69
|
+
}
|
|
70
|
+
launchSignature(config = {}) {
|
|
71
|
+
// The local plan runs the llama-server binary; the docker plan's host
|
|
72
|
+
// process is docker run of the ggml image, so the image name is the
|
|
73
|
+
// command-line marker the reserve probe matches on.
|
|
74
|
+
const port = this.port(config);
|
|
75
|
+
if (this.buildMode(config) === 'docker') {
|
|
76
|
+
return { binary: LLAMACPP_DOCKER_IMAGE, port };
|
|
77
|
+
}
|
|
78
|
+
return { binary: 'llama-server', port };
|
|
79
|
+
}
|
|
80
|
+
renderLaunch(config, _hw) {
|
|
81
|
+
const port = this.port(config);
|
|
82
|
+
const modelId = llamaCppModelKey(config);
|
|
83
|
+
const artifact = llamaCppArtifact(modelId);
|
|
84
|
+
// A model key that names a local GGUF file (a directory-scanned model)
|
|
85
|
+
// overrides the artifact map's file, so a file the user has on disk
|
|
86
|
+
// launches as-is.
|
|
87
|
+
const file = modelId.endsWith('.gguf') ? modelId : artifact.file;
|
|
88
|
+
const modelDirectory = typeof config.modelDirectory === 'string' ? config.modelDirectory : '';
|
|
89
|
+
const flags = flagsFromSpecs(LLAMACPP_PARAMETERS, config);
|
|
90
|
+
if (this.buildMode(config) === 'docker') {
|
|
91
|
+
const modelPath = modelDirectory === '' ? file : join(modelDirectory, file);
|
|
92
|
+
const containerModelPath = `/models/${basename(file)}`;
|
|
93
|
+
const modelMount = modelDirectory === ''
|
|
94
|
+
? `${file}:${containerModelPath}`
|
|
95
|
+
: `${dirname(modelPath)}:/models`;
|
|
96
|
+
const containerName = `llamacpp-${port}`;
|
|
97
|
+
const customArgs = customArgFlags(config);
|
|
98
|
+
return {
|
|
99
|
+
engineId: this.id,
|
|
100
|
+
kind: 'docker',
|
|
101
|
+
argv: [
|
|
102
|
+
'docker',
|
|
103
|
+
'run',
|
|
104
|
+
'--rm',
|
|
105
|
+
'--gpus',
|
|
106
|
+
'all',
|
|
107
|
+
'--name',
|
|
108
|
+
containerName,
|
|
109
|
+
'-p',
|
|
110
|
+
`127.0.0.1:${port}:8080`,
|
|
111
|
+
'-v',
|
|
112
|
+
modelMount,
|
|
113
|
+
LLAMACPP_DOCKER_IMAGE,
|
|
114
|
+
'--model',
|
|
115
|
+
containerModelPath,
|
|
116
|
+
...flags,
|
|
117
|
+
...customArgs,
|
|
118
|
+
],
|
|
119
|
+
env: {},
|
|
120
|
+
containerName,
|
|
121
|
+
modelId,
|
|
122
|
+
...(modelDirectory === '' ? {} : { modelDirectory }),
|
|
123
|
+
port,
|
|
124
|
+
healthUrl: `http://127.0.0.1:${port}/health`,
|
|
125
|
+
os: _hw.os,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
// The hub-cache layout (the model directory is the plugin default)
|
|
129
|
+
// resolves the concrete snapshot file the engine reads; a user override
|
|
130
|
+
// keeps the flat model-directory path. A not-yet-downloaded model falls
|
|
131
|
+
// back to the bare file name, the same as the flat layout's missing-file
|
|
132
|
+
// case.
|
|
133
|
+
const modelPath = modelDirectory === ''
|
|
134
|
+
? (hubCacheSnapshotFilePath(hfHubCacheDirectory(), artifact.repo, file) ?? file)
|
|
135
|
+
: join(modelDirectory, file);
|
|
136
|
+
const customArgs = customArgFlags(config);
|
|
137
|
+
return {
|
|
138
|
+
engineId: this.id,
|
|
139
|
+
kind: 'process',
|
|
140
|
+
argv: [
|
|
141
|
+
// The engine binary is OS-specific (the .exe on Windows), so the name
|
|
142
|
+
// comes from the host OS's binary function.
|
|
143
|
+
LLAMACPP_BINARY[_hw.os](),
|
|
144
|
+
'--model',
|
|
145
|
+
modelPath,
|
|
146
|
+
'--host',
|
|
147
|
+
'127.0.0.1',
|
|
148
|
+
'--port',
|
|
149
|
+
String(port),
|
|
150
|
+
...flags,
|
|
151
|
+
...customArgs,
|
|
152
|
+
],
|
|
153
|
+
env: {},
|
|
154
|
+
modelId,
|
|
155
|
+
...(modelDirectory === '' ? {} : { modelDirectory }),
|
|
156
|
+
port,
|
|
157
|
+
healthUrl: `http://127.0.0.1:${port}/health`,
|
|
158
|
+
os: _hw.os,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
async deploy(plan, platform, onProgress, options) {
|
|
162
|
+
if (plan.kind === 'process') {
|
|
163
|
+
const engineDir = platform?.engineDirectory;
|
|
164
|
+
let buildLogs = '';
|
|
165
|
+
// Auto Rebuild off (the card's checkbox): the git sync (fetch, rebase,
|
|
166
|
+
// rebuild) is skipped and the checkout launches as-is.
|
|
167
|
+
if (engineDir !== undefined && autoRebuildEnabled(options?.autoRebuild)) {
|
|
168
|
+
// The conditional rebuild fetches the checkout, prices it against the
|
|
169
|
+
// remote branch, and rebuilds only when it is behind (or a fresh
|
|
170
|
+
// clone). The decision, the build command, and its output are captured
|
|
171
|
+
// into buildLogs and threaded to the card's Logs section.
|
|
172
|
+
const sync = await syncEngineForDeploy(this.host, {
|
|
173
|
+
engineId: this.id,
|
|
174
|
+
directory: engineDir,
|
|
175
|
+
...(platform !== undefined ? { platform } : {}),
|
|
176
|
+
...(options !== undefined ? { options } : {}),
|
|
177
|
+
// The host OS the build steps pick for: a Windows host reads the
|
|
178
|
+
// engine's Windows build steps when the user carries no build-
|
|
179
|
+
// command override.
|
|
180
|
+
...(plan.os !== undefined ? { os: plan.os } : {}),
|
|
181
|
+
...(onProgress !== undefined ? { onProgress } : {}),
|
|
182
|
+
});
|
|
183
|
+
buildLogs = sync.buildLogs;
|
|
184
|
+
if (!sync.ok) {
|
|
185
|
+
return { ok: false, detail: sync.detail ?? 'unknown', logs: buildLogs };
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
const withLogs = (result) => buildLogs !== '' ? { ...result, logs: buildLogs } : result;
|
|
189
|
+
onProgress?.('download');
|
|
190
|
+
const download = await this.downloadModel(plan, options?.onLog);
|
|
191
|
+
if (!download.ok)
|
|
192
|
+
return withLogs(download);
|
|
193
|
+
const handle = this.host.spawn(plan.argv ?? [], plan.env ?? {}, engineDir);
|
|
194
|
+
trackChild(this.children, this.planKey(plan), handle);
|
|
195
|
+
return withLogs({ ok: true, handle });
|
|
196
|
+
}
|
|
197
|
+
if (plan.kind === 'docker') {
|
|
198
|
+
// Auto Rebuild off (the card's checkbox): the image pull is skipped and
|
|
199
|
+
// the already-present image starts. The image pull is the docker build
|
|
200
|
+
// step: the card's button reads "Building..." for it, and its
|
|
201
|
+
// `$ <command>` line reaches the launch run's log sink before the child
|
|
202
|
+
// spawns.
|
|
203
|
+
if (autoRebuildEnabled(options?.autoRebuild)) {
|
|
204
|
+
onProgress?.('build');
|
|
205
|
+
const pull = await auditRun(this.host, `docker pull ${LLAMACPP_DOCKER_IMAGE}`, options?.onLog);
|
|
206
|
+
if (!pull.ok) {
|
|
207
|
+
return { ok: false, detail: `docker pull failed: ${pull.detail ?? 'unknown'}` };
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const handle = this.host.spawn(plan.argv ?? [], plan.env ?? {});
|
|
211
|
+
trackChild(this.children, this.planKey(plan), handle);
|
|
212
|
+
return { ok: true, handle };
|
|
213
|
+
}
|
|
214
|
+
// llama.cpp renders process and docker plans; a compose plan is a no-op.
|
|
215
|
+
return { ok: true };
|
|
216
|
+
}
|
|
217
|
+
async healthCheck(plan, options) {
|
|
218
|
+
// The tracked handle rides into the poll, so a child that exits (a
|
|
219
|
+
// crash) ends the poll early with a failed result.
|
|
220
|
+
return pollHealth(this.host, plan, options, this.children.get(this.planKey(plan)));
|
|
221
|
+
}
|
|
222
|
+
async stop(plan, log) {
|
|
223
|
+
if (plan.kind === 'docker' && plan.containerName !== undefined) {
|
|
224
|
+
await auditRun(this.host, `docker stop ${plan.containerName}`, log);
|
|
225
|
+
}
|
|
226
|
+
const handle = this.children.get(this.planKey(plan));
|
|
227
|
+
if (handle !== undefined) {
|
|
228
|
+
handle.kill();
|
|
229
|
+
this.children.delete(this.planKey(plan));
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
// No tracked child (an engine a DSH restart re-adopted): signal the pid
|
|
233
|
+
// the stored launch record stamped on the plan, so the stop reaches a
|
|
234
|
+
// process this adapter instance did not spawn.
|
|
235
|
+
await stopProcessPlan(this.host, plan, log);
|
|
236
|
+
}
|
|
237
|
+
buildMode(config) {
|
|
238
|
+
return config.buildMode === 'docker' ? 'docker' : 'local';
|
|
239
|
+
}
|
|
240
|
+
port(config) {
|
|
241
|
+
// 8080 is the port the llama-server CLI binds by default, so a bare
|
|
242
|
+
// config launches on it.
|
|
243
|
+
return typeof config.port === 'number' ? config.port : 8080;
|
|
244
|
+
}
|
|
245
|
+
async downloadModel(plan, log) {
|
|
246
|
+
const artifact = plan.modelId !== undefined ? LLAMACPP_MODEL_ARTIFACTS[plan.modelId] : undefined;
|
|
247
|
+
if (artifact === undefined)
|
|
248
|
+
return { ok: true };
|
|
249
|
+
// The hub-cache layout (no --local-dir) applies when the model directory is
|
|
250
|
+
// the plugin default; a user override keeps the flat --local-dir target.
|
|
251
|
+
const { baseDir, useHubCache } = modelDownloadTarget(plan.modelDirectory);
|
|
252
|
+
const entry = {
|
|
253
|
+
engineId: this.id,
|
|
254
|
+
modelId: plan.modelId ?? '',
|
|
255
|
+
label: artifact.modelId,
|
|
256
|
+
url: `https://huggingface.co/${artifact.repo}`,
|
|
257
|
+
file: artifact.file,
|
|
258
|
+
};
|
|
259
|
+
// A model the shared Get-steps routine already downloaded is on disk, so
|
|
260
|
+
// the deploy step skips the re-fetch and a launch after a Get does no
|
|
261
|
+
// duplicate download. Presence is the deterministic snapshot the resolved
|
|
262
|
+
// layout holds (modelArtifactPresent), never a bare blobs folder: a cache
|
|
263
|
+
// whose snapshot links are missing re-runs the cheap hf download, which
|
|
264
|
+
// reuses the blobs and writes the links.
|
|
265
|
+
if (modelArtifactPresent(entry, baseDir, useHubCache))
|
|
266
|
+
return { ok: true };
|
|
267
|
+
const download = await auditRun(this.host, hfDownloadCommand(entry, baseDir, useHubCache), log);
|
|
268
|
+
if (!download.ok) {
|
|
269
|
+
return { ok: false, detail: `model download failed: ${download.detail ?? 'unknown'}` };
|
|
270
|
+
}
|
|
271
|
+
return { ok: true };
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
//# sourceMappingURL=llamacppAdapter.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The llama.cpp Arch Linux build profile. Arch builds llama.cpp through the
|
|
3
|
+
* shared Linux route (cmake with the Ninja generator), so this profile reuses
|
|
4
|
+
* the shared Linux profile and carries no build steps of its own.
|
|
5
|
+
* @module dsh-plugin-local-infer/providers/engines/llamacpp/llamacppArch
|
|
6
|
+
*/
|
|
7
|
+
import type { EngineOsProfile } from '../engineOs.ts';
|
|
8
|
+
export declare const LLAMACPP_ARCH: EngineOsProfile;
|
|
9
|
+
//# sourceMappingURL=llamacppArch.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The llama.cpp Arch Linux build profile. Arch builds llama.cpp through the
|
|
3
|
+
* shared Linux route (cmake with the Ninja generator), so this profile reuses
|
|
4
|
+
* the shared Linux profile and carries no build steps of its own.
|
|
5
|
+
* @module dsh-plugin-local-infer/providers/engines/llamacpp/llamacppArch
|
|
6
|
+
*/
|
|
7
|
+
import { LLAMACPP_LINUX } from "./llamacppLinux.js";
|
|
8
|
+
export const LLAMACPP_ARCH = LLAMACPP_LINUX;
|
|
9
|
+
//# sourceMappingURL=llamacppArch.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The llama.cpp Debian build profile. Debian builds llama.cpp through the
|
|
3
|
+
* shared Linux route (cmake with the Ninja generator), so this profile reuses
|
|
4
|
+
* the shared Linux profile and carries no build steps of its own.
|
|
5
|
+
* @module dsh-plugin-local-infer/providers/engines/llamacpp/llamacppDebian
|
|
6
|
+
*/
|
|
7
|
+
import type { EngineOsProfile } from '../engineOs.ts';
|
|
8
|
+
export declare const LLAMACPP_DEBIAN: EngineOsProfile;
|
|
9
|
+
//# sourceMappingURL=llamacppDebian.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The llama.cpp Debian build profile. Debian builds llama.cpp through the
|
|
3
|
+
* shared Linux route (cmake with the Ninja generator), so this profile reuses
|
|
4
|
+
* the shared Linux profile and carries no build steps of its own.
|
|
5
|
+
* @module dsh-plugin-local-infer/providers/engines/llamacpp/llamacppDebian
|
|
6
|
+
*/
|
|
7
|
+
import { LLAMACPP_LINUX } from "./llamacppLinux.js";
|
|
8
|
+
export const LLAMACPP_DEBIAN = LLAMACPP_LINUX;
|
|
9
|
+
//# sourceMappingURL=llamacppDebian.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The llama.cpp Fedora build profile. Fedora builds llama.cpp through the
|
|
3
|
+
* shared Linux route (cmake with the Ninja generator), so this profile reuses
|
|
4
|
+
* the shared Linux profile and carries no build steps of its own.
|
|
5
|
+
* @module dsh-plugin-local-infer/providers/engines/llamacpp/llamacppFedora
|
|
6
|
+
*/
|
|
7
|
+
import type { EngineOsProfile } from '../engineOs.ts';
|
|
8
|
+
export declare const LLAMACPP_FEDORA: EngineOsProfile;
|
|
9
|
+
//# sourceMappingURL=llamacppFedora.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The llama.cpp Fedora build profile. Fedora builds llama.cpp through the
|
|
3
|
+
* shared Linux route (cmake with the Ninja generator), so this profile reuses
|
|
4
|
+
* the shared Linux profile and carries no build steps of its own.
|
|
5
|
+
* @module dsh-plugin-local-infer/providers/engines/llamacpp/llamacppFedora
|
|
6
|
+
*/
|
|
7
|
+
import { LLAMACPP_LINUX } from "./llamacppLinux.js";
|
|
8
|
+
export const LLAMACPP_FEDORA = LLAMACPP_LINUX;
|
|
9
|
+
//# sourceMappingURL=llamacppFedora.js.map
|