dsh-plugin-local-infer 0.1.3 → 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 +22 -4
- package/cordis.patch.yml +7 -0
- package/docs/zh/README.md +14 -2
- package/dsh/client.js +4195 -4522
- package/package.json +28 -11
- package/packages/core/lib/adapter.d.ts +133 -9
- 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 +44 -17
- 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 +20 -9
- package/packages/core/lib/registrar.js +27 -7
- 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 +92 -14
- package/packages/providers/lib/acquire.js +215 -37
- package/packages/providers/lib/adapters.d.ts +136 -12
- package/packages/providers/lib/adapters.js +597 -70
- package/packages/providers/lib/debug.d.ts +1 -1
- package/packages/providers/lib/debug.js +1 -1
- package/packages/providers/lib/deps.d.ts +27 -230
- package/packages/providers/lib/deps.js +61 -214
- 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/engines/{hyperqwen.d.ts → hyperqwen/hyperqwen.d.ts} +2 -2
- package/packages/providers/lib/engines/{hyperqwen.js → hyperqwen/hyperqwen.js} +14 -2
- package/packages/providers/lib/engines/{hyperqwenAdapter.d.ts → hyperqwen/hyperqwenAdapter.d.ts} +6 -6
- package/packages/providers/lib/engines/{hyperqwenAdapter.js → hyperqwen/hyperqwenAdapter.js} +24 -14
- 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/engines/{infernix.d.ts → infernix/infernix.d.ts} +7 -4
- package/packages/providers/lib/engines/{infernix.js → infernix/infernix.js} +52 -7
- package/packages/providers/lib/engines/{infernixAdapter.d.ts → infernix/infernixAdapter.d.ts} +5 -6
- package/packages/providers/lib/engines/{infernixAdapter.js → infernix/infernixAdapter.js} +75 -42
- 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/engines/{llamacpp.d.ts → llamacpp/llamacpp.d.ts} +2 -2
- package/packages/providers/lib/engines/{llamacpp.js → llamacpp/llamacpp.js} +12 -2
- package/packages/providers/lib/engines/{llamacppAdapter.d.ts → llamacpp/llamacppAdapter.d.ts} +5 -6
- package/packages/providers/lib/engines/{llamacppAdapter.js → llamacpp/llamacppAdapter.js} +87 -45
- 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/engines/{ninfer.d.ts → ninfer/ninfer.d.ts} +2 -2
- package/packages/providers/lib/engines/{ninfer.js → ninfer/ninfer.js} +24 -2
- package/packages/providers/lib/engines/{ninferAdapter.d.ts → ninfer/ninferAdapter.d.ts} +5 -6
- package/packages/providers/lib/engines/{ninferAdapter.js → ninfer/ninferAdapter.js} +123 -55
- 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.js → strata/strata.js} +70 -3
- package/packages/providers/lib/engines/{strataAdapter.d.ts → strata/strataAdapter.d.ts} +5 -6
- package/packages/providers/lib/engines/{strataAdapter.js → strata/strataAdapter.js} +147 -111
- 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 +7 -5
- package/packages/providers/lib/engines.js +21 -10
- 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 -29
- package/packages/providers/lib/index.js +45 -33
- package/packages/providers/lib/model-defaults.d.ts +5 -1
- package/packages/providers/lib/model-defaults.js +25 -1
- package/packages/providers/lib/platform.d.ts +8 -5
- package/packages/providers/lib/platform.js +23 -9
- 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 +176 -21
- package/packages/service/lib/index.js +589 -86
- 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 +163 -6
- 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 +12 -2
- package/packages/ui/lib/config.js +18 -2
- package/packages/ui/lib/deps.d.ts +1 -1
- 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 +142 -34
- package/packages/ui/lib/ops/engine.js +469 -265
- 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 +26 -11
- package/packages/ui/lib/ops/hf.js +115 -25
- package/packages/ui/lib/ops/logs.d.ts +70 -15
- package/packages/ui/lib/ops/logs.js +96 -35
- package/packages/ui/lib/ops/model.d.ts +2 -10
- package/packages/ui/lib/ops/model.js +9 -16
- package/packages/ui/lib/request.d.ts +1 -1
- package/packages/ui/lib/request.js +1 -1
- package/packages/ui/lib/route.d.ts +22 -6
- package/packages/ui/lib/route.js +32 -9
- package/packages/ui/lib/routes/chat-template.d.ts +1 -14
- package/packages/ui/lib/routes/chat-template.js +1 -37
- package/packages/ui/lib/routes/deps.d.ts +1 -16
- package/packages/ui/lib/routes/deps.js +1 -27
- package/packages/ui/lib/routes/download.d.ts +1 -16
- package/packages/ui/lib/routes/download.js +1 -48
- package/packages/ui/lib/routes/get.d.ts +1 -18
- package/packages/ui/lib/routes/get.js +66 -17
- package/packages/ui/lib/routes/install.d.ts +1 -1
- package/packages/ui/lib/routes/install.js +1 -1
- package/packages/ui/lib/routes/launch.d.ts +13 -7
- package/packages/ui/lib/routes/launch.js +33 -9
- 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 +1 -1
- package/packages/ui/lib/routes/provider-delete.js +1 -1
- package/packages/ui/lib/routes/register.d.ts +1 -1
- package/packages/ui/lib/routes/register.js +1 -1
- package/packages/ui/lib/routes/save.d.ts +1 -1
- package/packages/ui/lib/routes/save.js +22 -2
- package/packages/ui/lib/routes/stop.d.ts +7 -4
- package/packages/ui/lib/routes/stop.js +7 -4
- 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 +1 -1
- package/packages/ui/lib/routes/summary.js +1 -1
- package/packages/ui/lib/routes/unregister.d.ts +1 -1
- package/packages/ui/lib/routes/unregister.js +1 -1
- package/packages/ui/lib/viewmodels/deps.d.ts +1 -31
- package/packages/ui/lib/viewmodels/deps.js +1 -89
- package/packages/ui/lib/viewmodels/depsHelpers.d.ts +1 -28
- package/packages/ui/lib/viewmodels/depsHelpers.js +72 -11
- package/packages/ui/lib/viewmodels/summary.d.ts +7 -2
- package/packages/ui/lib/viewmodels/summary.js +55 -35
- package/packages/ui/lib/viewmodels/summaryHelpers.d.ts +1 -1
- package/packages/ui/lib/viewmodels/summaryHelpers.js +1 -1
- 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/engines/strata.d.ts +0 -53
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The llama.cpp Windows build profile. llama.cpp carries no dedicated Windows
|
|
3
|
+
* build route, so a Windows host reads the shared Linux cmake steps and build
|
|
4
|
+
* directory; the binary is the .exe.
|
|
5
|
+
* @module dsh-plugin-local-infer/providers/engines/llamacpp/llamacppWindows
|
|
6
|
+
*/
|
|
7
|
+
import { LLAMACPP_LINUX } from "./llamacppLinux.js";
|
|
8
|
+
import { SYSTEM_DEPS } from "../../systemDeps.js";
|
|
9
|
+
export const LLAMACPP_WINDOWS = {
|
|
10
|
+
buildSteps: LLAMACPP_LINUX.buildSteps,
|
|
11
|
+
buildDir: 'build',
|
|
12
|
+
binary: 'llama-server.exe',
|
|
13
|
+
// llama.cpp carries no dedicated Windows build route, so a Windows host
|
|
14
|
+
// reads the shared Linux cmake steps; the local build deps are the same thin
|
|
15
|
+
// cmake-plus-hf list.
|
|
16
|
+
deps: [SYSTEM_DEPS.cmake, SYSTEM_DEPS.hfCli],
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* llamacppWindowsBinary returns the llama.cpp engine binary name on Windows:
|
|
20
|
+
* the `llama-server.exe` the Windows build leaves in the build tree. The name
|
|
21
|
+
* comes from the Windows profile, so the .exe spelling has one home.
|
|
22
|
+
*/
|
|
23
|
+
export function llamacppWindowsBinary() {
|
|
24
|
+
return LLAMACPP_WINDOWS.binary ?? 'llama-server.exe';
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=llamacppWindows.js.map
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* The data is the surface; the `NInferAdapter` (Phase 5) composes it into a
|
|
9
9
|
* `LaunchPlan`. Adding a flag here is a data edit, never a core rewire.
|
|
10
|
-
* @module dsh-plugin-local-infer/providers/ninfer
|
|
10
|
+
* @module dsh-plugin-local-infer/providers/engines/ninfer/ninfer
|
|
11
11
|
*/
|
|
12
12
|
import type { ComboOption, EnumOption, ParameterSpec } from 'dsh-plugin-local-infer/core';
|
|
13
13
|
/**
|
|
@@ -53,4 +53,4 @@ export declare const LM_HEAD_DRAFT_GATE_MESSAGE = "LM-head draft is only availab
|
|
|
53
53
|
* the field is disabled.
|
|
54
54
|
*/
|
|
55
55
|
export declare const NINFER_PARAMETERS: readonly ParameterSpec[];
|
|
56
|
-
//# sourceMappingURL=ninfer.d.ts.map
|
|
56
|
+
//# sourceMappingURL=ninfer.d.ts.map
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* The data is the surface; the `NInferAdapter` (Phase 5) composes it into a
|
|
9
9
|
* `LaunchPlan`. Adding a flag here is a data edit, never a core rewire.
|
|
10
|
-
* @module dsh-plugin-local-infer/providers/ninfer
|
|
10
|
+
* @module dsh-plugin-local-infer/providers/engines/ninfer/ninfer
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
13
|
* The KV cache quantization formats NInfer serves, in the order the form
|
|
@@ -94,6 +94,7 @@ export const NINFER_PARAMETERS = [
|
|
|
94
94
|
// The port contributes no flag of its own: renderLaunch spells the local
|
|
95
95
|
// `--port` and the docker host-port mapping from this value, and the
|
|
96
96
|
// health URL and container name derive from it too.
|
|
97
|
+
deploy: { target: 'cli' },
|
|
97
98
|
},
|
|
98
99
|
{
|
|
99
100
|
key: 'kvDtype',
|
|
@@ -115,6 +116,7 @@ export const NINFER_PARAMETERS = [
|
|
|
115
116
|
return { ok: true };
|
|
116
117
|
},
|
|
117
118
|
toArgv: (value) => ['--kv-dtype', String(value)],
|
|
119
|
+
deploy: { target: 'cli' },
|
|
118
120
|
},
|
|
119
121
|
{
|
|
120
122
|
key: 'maxContext',
|
|
@@ -124,6 +126,7 @@ export const NINFER_PARAMETERS = [
|
|
|
124
126
|
defaultValue: 32768,
|
|
125
127
|
group: 'Memory',
|
|
126
128
|
toArgv: (value) => ['--max-context', String(value)],
|
|
129
|
+
deploy: { target: 'cli' },
|
|
127
130
|
},
|
|
128
131
|
{
|
|
129
132
|
key: 'kvCapacity',
|
|
@@ -142,6 +145,7 @@ export const NINFER_PARAMETERS = [
|
|
|
142
145
|
},
|
|
143
146
|
group: 'Memory',
|
|
144
147
|
toArgv: (value) => ['--kv-capacity', String(value)],
|
|
148
|
+
deploy: { target: 'cli' },
|
|
145
149
|
},
|
|
146
150
|
{
|
|
147
151
|
key: 'hostKvMib',
|
|
@@ -159,6 +163,7 @@ export const NINFER_PARAMETERS = [
|
|
|
159
163
|
},
|
|
160
164
|
group: 'Memory',
|
|
161
165
|
toArgv: (value) => ['--host-kv-mib', String(value)],
|
|
166
|
+
deploy: { target: 'cli' },
|
|
162
167
|
},
|
|
163
168
|
{
|
|
164
169
|
key: 'hostStateSlots',
|
|
@@ -167,6 +172,7 @@ export const NINFER_PARAMETERS = [
|
|
|
167
172
|
form: { kind: 'number', min: 0, step: 1, unit: 'slots' },
|
|
168
173
|
group: 'Memory',
|
|
169
174
|
toArgv: (value) => ['--host-state-slots', String(value)],
|
|
175
|
+
deploy: { target: 'cli' },
|
|
170
176
|
},
|
|
171
177
|
{
|
|
172
178
|
key: 'mediaLiveMib',
|
|
@@ -175,6 +181,7 @@ export const NINFER_PARAMETERS = [
|
|
|
175
181
|
form: { kind: 'number', min: 0, step: 1024, unit: 'MiB' },
|
|
176
182
|
group: 'Memory',
|
|
177
183
|
toArgv: (value) => ['--media-live-mib', String(value)],
|
|
184
|
+
deploy: { target: 'cli' },
|
|
178
185
|
},
|
|
179
186
|
{
|
|
180
187
|
key: 'gdnStateFp16',
|
|
@@ -184,6 +191,7 @@ export const NINFER_PARAMETERS = [
|
|
|
184
191
|
defaultValue: false,
|
|
185
192
|
group: 'Memory',
|
|
186
193
|
toArgv: (value) => (value === true ? ['--gdn-state-fp16'] : []),
|
|
194
|
+
deploy: { target: 'cli' },
|
|
187
195
|
},
|
|
188
196
|
{
|
|
189
197
|
key: 'maxConcurrency',
|
|
@@ -193,6 +201,7 @@ export const NINFER_PARAMETERS = [
|
|
|
193
201
|
defaultValue: 1,
|
|
194
202
|
group: 'Concurrency',
|
|
195
203
|
toArgv: (value) => ['--max-concurrency', String(value)],
|
|
204
|
+
deploy: { target: 'cli' },
|
|
196
205
|
},
|
|
197
206
|
{
|
|
198
207
|
key: 'spec',
|
|
@@ -202,6 +211,7 @@ export const NINFER_PARAMETERS = [
|
|
|
202
211
|
defaultValue: 'none',
|
|
203
212
|
group: 'Speculation',
|
|
204
213
|
toArgv: (value) => (value === 'none' ? [] : ['--spec', String(value)]),
|
|
214
|
+
deploy: { target: 'cli' },
|
|
205
215
|
},
|
|
206
216
|
{
|
|
207
217
|
key: 'draftTokens',
|
|
@@ -212,6 +222,7 @@ export const NINFER_PARAMETERS = [
|
|
|
212
222
|
group: 'Speculation',
|
|
213
223
|
requires: (config) => config.spec && config.spec !== 'none' ? null : SPEC_GATE_MESSAGE,
|
|
214
224
|
toArgv: (value) => ['--draft-tokens', String(value)],
|
|
225
|
+
deploy: { target: 'cli' },
|
|
215
226
|
},
|
|
216
227
|
{
|
|
217
228
|
key: 'lmHeadDraft',
|
|
@@ -222,6 +233,7 @@ export const NINFER_PARAMETERS = [
|
|
|
222
233
|
group: 'Speculation',
|
|
223
234
|
requires: (config) => config.spec === 'mtp' ? null : LM_HEAD_DRAFT_GATE_MESSAGE,
|
|
224
235
|
toArgv: (value) => (value === true ? ['--lm-head-draft'] : []),
|
|
236
|
+
deploy: { target: 'cli' },
|
|
225
237
|
},
|
|
226
238
|
{
|
|
227
239
|
key: 'temperature',
|
|
@@ -231,6 +243,7 @@ export const NINFER_PARAMETERS = [
|
|
|
231
243
|
defaultValue: 0.9,
|
|
232
244
|
group: 'Sampling',
|
|
233
245
|
toArgv: (value) => ['--temperature', String(value)],
|
|
246
|
+
deploy: { target: 'cli' },
|
|
234
247
|
},
|
|
235
248
|
{
|
|
236
249
|
key: 'minP',
|
|
@@ -240,6 +253,7 @@ export const NINFER_PARAMETERS = [
|
|
|
240
253
|
defaultValue: 0.05,
|
|
241
254
|
group: 'Sampling',
|
|
242
255
|
toArgv: (value) => ['--min-p', String(value)],
|
|
256
|
+
deploy: { target: 'cli' },
|
|
243
257
|
},
|
|
244
258
|
{
|
|
245
259
|
key: 'defaultMaxTokens',
|
|
@@ -264,6 +278,7 @@ export const NINFER_PARAMETERS = [
|
|
|
264
278
|
},
|
|
265
279
|
group: 'Sampling',
|
|
266
280
|
toArgv: (value) => ['--default-max-tokens', String(value)],
|
|
281
|
+
deploy: { target: 'cli' },
|
|
267
282
|
},
|
|
268
283
|
{
|
|
269
284
|
key: 'defaultThinkingBudget',
|
|
@@ -272,6 +287,7 @@ export const NINFER_PARAMETERS = [
|
|
|
272
287
|
form: { kind: 'number', min: 0, step: 1, unit: 'tokens' },
|
|
273
288
|
group: 'Sampling',
|
|
274
289
|
toArgv: (value) => ['--default-thinking-budget', String(value)],
|
|
290
|
+
deploy: { target: 'cli' },
|
|
275
291
|
},
|
|
276
292
|
{
|
|
277
293
|
key: 'preserveThinking',
|
|
@@ -281,6 +297,7 @@ export const NINFER_PARAMETERS = [
|
|
|
281
297
|
defaultValue: false,
|
|
282
298
|
group: 'Sampling',
|
|
283
299
|
toArgv: (value) => (value === true ? ['--preserve-thinking'] : []),
|
|
300
|
+
deploy: { target: 'cli' },
|
|
284
301
|
},
|
|
285
302
|
{
|
|
286
303
|
key: 'prefillChunk',
|
|
@@ -310,6 +327,7 @@ export const NINFER_PARAMETERS = [
|
|
|
310
327
|
},
|
|
311
328
|
group: 'Engine',
|
|
312
329
|
toArgv: (value) => ['--prefill-chunk', String(value)],
|
|
330
|
+
deploy: { target: 'cli' },
|
|
313
331
|
},
|
|
314
332
|
{
|
|
315
333
|
key: 'vision',
|
|
@@ -319,6 +337,7 @@ export const NINFER_PARAMETERS = [
|
|
|
319
337
|
defaultValue: false,
|
|
320
338
|
group: 'Engine',
|
|
321
339
|
toArgv: (value) => (value === true ? ['--vision'] : []),
|
|
340
|
+
deploy: { target: 'cli' },
|
|
322
341
|
},
|
|
323
342
|
{
|
|
324
343
|
key: 'structuredOutput',
|
|
@@ -328,6 +347,7 @@ export const NINFER_PARAMETERS = [
|
|
|
328
347
|
defaultValue: false,
|
|
329
348
|
group: 'Engine',
|
|
330
349
|
toArgv: (value) => (value === true ? ['--structured-output'] : []),
|
|
350
|
+
deploy: { target: 'cli' },
|
|
331
351
|
},
|
|
332
352
|
{
|
|
333
353
|
key: 'deviceProfile',
|
|
@@ -337,6 +357,7 @@ export const NINFER_PARAMETERS = [
|
|
|
337
357
|
defaultValue: 'auto',
|
|
338
358
|
group: 'Engine',
|
|
339
359
|
toArgv: (value) => (value === 'auto' ? [] : ['--device-profile', String(value)]),
|
|
360
|
+
deploy: { target: 'cli' },
|
|
340
361
|
},
|
|
341
362
|
{
|
|
342
363
|
key: 'chatTemplate',
|
|
@@ -345,6 +366,7 @@ export const NINFER_PARAMETERS = [
|
|
|
345
366
|
form: { kind: 'combo', options: [...CHAT_TEMPLATE_OPTIONS] },
|
|
346
367
|
group: 'Engine',
|
|
347
368
|
toArgv: (value) => (value ? ['--chat-template', String(value)] : []),
|
|
369
|
+
deploy: { target: 'cli' },
|
|
348
370
|
},
|
|
349
371
|
];
|
|
350
|
-
//# sourceMappingURL=ninfer.js.map
|
|
372
|
+
//# sourceMappingURL=ninfer.js.map
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
* pulls the image), downloads the model into the model directory, and starts
|
|
10
10
|
* the engine; `healthCheck` polls the health URL; `stop` signals the tracked
|
|
11
11
|
* process and stops the named container.
|
|
12
|
-
* @module dsh-plugin-local-infer/providers/engines/ninferAdapter
|
|
12
|
+
* @module dsh-plugin-local-infer/providers/engines/ninfer/ninferAdapter
|
|
13
13
|
*/
|
|
14
|
-
import { EngineAdapter } from '
|
|
15
|
-
import type { Config, DeployOptions, DeployResult, EngineLaunchSignature, EnginePlatformConfig, HealthCheckOptions, HealthResult, HardwareProfile, LaunchPlan, LaunchProgress, LifecycleHost, ParameterSpec } from '
|
|
14
|
+
import { EngineAdapter } from '../../../../core/lib/index.js';
|
|
15
|
+
import type { CommandLogger, Config, DeployOptions, DeployResult, EngineLaunchSignature, EnginePlatformConfig, HealthCheckOptions, HealthResult, HardwareProfile, LaunchPlan, LaunchProgress, LifecycleHost, ParameterSpec } from '../../../../core/lib/index.js';
|
|
16
16
|
/**
|
|
17
17
|
* NInferModelArtifact is the per-model deploy data: the `.ninfer` artifact
|
|
18
18
|
* file, the Hugging Face repo the model download pulls it from, and the
|
|
@@ -63,10 +63,9 @@ export declare class NInferAdapter extends EngineAdapter {
|
|
|
63
63
|
renderLaunch(config: Config, _hw: HardwareProfile): LaunchPlan;
|
|
64
64
|
deploy(plan: LaunchPlan, platform?: EnginePlatformConfig, onProgress?: LaunchProgress, options?: DeployOptions): Promise<DeployResult>;
|
|
65
65
|
healthCheck(plan: LaunchPlan, options?: HealthCheckOptions): Promise<HealthResult>;
|
|
66
|
-
stop(plan: LaunchPlan): Promise<void>;
|
|
66
|
+
stop(plan: LaunchPlan, log?: CommandLogger): Promise<void>;
|
|
67
67
|
private buildMode;
|
|
68
68
|
private port;
|
|
69
|
-
private planKey;
|
|
70
69
|
private downloadModel;
|
|
71
70
|
/**
|
|
72
71
|
* resolveChatTemplate rewrites a --chat-template flag that carries an HF repo
|
|
@@ -79,4 +78,4 @@ export declare class NInferAdapter extends EngineAdapter {
|
|
|
79
78
|
*/
|
|
80
79
|
private resolveChatTemplate;
|
|
81
80
|
}
|
|
82
|
-
//# sourceMappingURL=ninferAdapter.d.ts.map
|
|
81
|
+
//# sourceMappingURL=ninferAdapter.d.ts.map
|
|
@@ -9,13 +9,28 @@
|
|
|
9
9
|
* pulls the image), downloads the model into the model directory, and starts
|
|
10
10
|
* the engine; `healthCheck` polls the health URL; `stop` signals the tracked
|
|
11
11
|
* process and stops the named container.
|
|
12
|
-
* @module dsh-plugin-local-infer/providers/engines/ninferAdapter
|
|
12
|
+
* @module dsh-plugin-local-infer/providers/engines/ninfer/ninferAdapter
|
|
13
13
|
*/
|
|
14
14
|
import { basename, dirname, join } from 'node:path';
|
|
15
|
-
import { EngineAdapter } from '
|
|
16
|
-
import { customArgFlags, flagsFromSpecs, nodeLifecycleHost, pollHealth, trackChild, } from "
|
|
17
|
-
import {
|
|
15
|
+
import { CHAT_TEMPLATE_FILE, EngineAdapter, autoRebuildEnabled, chatTemplateArtifactPath, chatTemplatePresent, hfChatTemplateCommand, hfDownloadCommand, hfHubCacheDirectory, hubCacheSnapshotFilePath, modelArtifactPresent, modelDownloadTarget, } from '../../../../core/lib/index.js';
|
|
16
|
+
import { auditRun, customArgFlags, flagsFromSpecs, nodeLifecycleHost, pollHealth, resolveLaunchArgv, stopProcessPlan, trackChild, } from "../../adapters.js";
|
|
17
|
+
import { syncEngineForDeploy } from "../../acquire.js";
|
|
18
18
|
import { NINFER_PARAMETERS } from "./ninfer.js";
|
|
19
|
+
import { ninferLinuxBinary } from "./ninferLinux.js";
|
|
20
|
+
import { ninferMacOSBinary } from "./ninferMacOS.js";
|
|
21
|
+
import { ninferWindowsBinary } from "./ninferWindows.js";
|
|
22
|
+
/**
|
|
23
|
+
* The NInfer engine binary is OS-specific (the .exe on Windows, where the
|
|
24
|
+
* vcpkg build-native route writes the Release binary), so the launch binary
|
|
25
|
+
* comes from the host OS's binary function. The adapter's renderLaunch reads
|
|
26
|
+
* this map by the hardware profile's os, keeping the per-OS name in its own OS
|
|
27
|
+
* file.
|
|
28
|
+
*/
|
|
29
|
+
const NINFER_BINARY = {
|
|
30
|
+
linux: ninferLinuxBinary,
|
|
31
|
+
macos: ninferMacOSBinary,
|
|
32
|
+
windows: ninferWindowsBinary,
|
|
33
|
+
};
|
|
19
34
|
/**
|
|
20
35
|
* The NInfer model artifacts, keyed by the model registry id. The 27B entry
|
|
21
36
|
* is the default the DEFAULT_MODELS list names; the 35B-A3B entries are the
|
|
@@ -149,15 +164,25 @@ export class NInferAdapter extends EngineAdapter {
|
|
|
149
164
|
...(modelDirectory === '' ? {} : { modelDirectory }),
|
|
150
165
|
port,
|
|
151
166
|
healthUrl: `http://127.0.0.1:${port}/health`,
|
|
167
|
+
os: _hw.os,
|
|
152
168
|
};
|
|
153
169
|
}
|
|
154
|
-
|
|
170
|
+
// The hub-cache layout (the model directory is the plugin default)
|
|
171
|
+
// resolves the concrete snapshot file the engine reads; a user override
|
|
172
|
+
// keeps the flat model-directory path. A not-yet-downloaded model falls
|
|
173
|
+
// back to the bare file name, the same as the flat layout's missing-file
|
|
174
|
+
// case.
|
|
175
|
+
const modelPath = modelDirectory === ''
|
|
176
|
+
? (hubCacheSnapshotFilePath(hfHubCacheDirectory(), artifact.repo, file) ?? file)
|
|
177
|
+
: join(modelDirectory, file);
|
|
155
178
|
const customArgs = customArgFlags(config);
|
|
156
179
|
return {
|
|
157
180
|
engineId: this.id,
|
|
158
181
|
kind: 'process',
|
|
159
182
|
argv: [
|
|
160
|
-
|
|
183
|
+
// The engine binary is OS-specific (the .exe on Windows), so the name
|
|
184
|
+
// comes from the host OS's binary function.
|
|
185
|
+
NINFER_BINARY[_hw.os](),
|
|
161
186
|
modelPath,
|
|
162
187
|
'--host',
|
|
163
188
|
'127.0.0.1',
|
|
@@ -173,6 +198,7 @@ export class NInferAdapter extends EngineAdapter {
|
|
|
173
198
|
...(modelDirectory === '' ? {} : { modelDirectory }),
|
|
174
199
|
port,
|
|
175
200
|
healthUrl: `http://127.0.0.1:${port}/health`,
|
|
201
|
+
os: _hw.os,
|
|
176
202
|
};
|
|
177
203
|
}
|
|
178
204
|
async deploy(plan, platform, onProgress, options) {
|
|
@@ -181,41 +207,30 @@ export class NInferAdapter extends EngineAdapter {
|
|
|
181
207
|
let buildLogs = '';
|
|
182
208
|
// Auto Rebuild off (the card's checkbox): the git sync (fetch, rebase,
|
|
183
209
|
// rebuild) is skipped and the checkout launches as-is.
|
|
184
|
-
if (engineDir !== undefined && options?.autoRebuild
|
|
185
|
-
// The git sync is the checkout download: the card's button reads
|
|
186
|
-
// "Downloading..." for it, not "Building...".
|
|
187
|
-
onProgress?.('download');
|
|
210
|
+
if (engineDir !== undefined && autoRebuildEnabled(options?.autoRebuild)) {
|
|
188
211
|
// The conditional rebuild fetches the checkout, prices it against the
|
|
189
212
|
// remote branch, and rebuilds only when it is behind (or a fresh
|
|
190
213
|
// clone). The decision, the build command, and its output are captured
|
|
191
214
|
// into buildLogs and threaded to the card's Logs section.
|
|
192
|
-
const sync = await
|
|
215
|
+
const sync = await syncEngineForDeploy(this.host, {
|
|
193
216
|
engineId: this.id,
|
|
194
217
|
directory: engineDir,
|
|
195
|
-
...(platform
|
|
196
|
-
...(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}, () => { });
|
|
205
|
-
buildLogs = sync.logs;
|
|
218
|
+
...(platform !== undefined ? { platform } : {}),
|
|
219
|
+
...(options !== undefined ? { options } : {}),
|
|
220
|
+
// The host OS the build steps pick for: a Windows host reads the
|
|
221
|
+
// engine's Windows build steps (the vcpkg route) when the user
|
|
222
|
+
// carries no build-command override.
|
|
223
|
+
...(plan.os !== undefined ? { os: plan.os } : {}),
|
|
224
|
+
...(onProgress !== undefined ? { onProgress } : {}),
|
|
225
|
+
});
|
|
226
|
+
buildLogs = sync.buildLogs;
|
|
206
227
|
if (!sync.ok) {
|
|
207
228
|
return { ok: false, detail: sync.detail ?? 'unknown', logs: buildLogs };
|
|
208
229
|
}
|
|
209
|
-
// The build output reads as a fresh Logs section: a "Building..."
|
|
210
|
-
// separator leads the build decision and output, the same line the
|
|
211
|
-
// card writes when the build step event lands.
|
|
212
|
-
if (sync.rebuilt && buildLogs !== '') {
|
|
213
|
-
buildLogs = `--- Building...\n${buildLogs}`;
|
|
214
|
-
}
|
|
215
230
|
}
|
|
216
231
|
const withLogs = (result) => buildLogs !== '' ? { ...result, logs: buildLogs } : result;
|
|
217
232
|
onProgress?.('download');
|
|
218
|
-
const download = await this.downloadModel(plan);
|
|
233
|
+
const download = await this.downloadModel(plan, options?.onLog);
|
|
219
234
|
if (!download.ok)
|
|
220
235
|
return withLogs(download);
|
|
221
236
|
// A chat template the user picked as an HF repo reference (the combo
|
|
@@ -223,20 +238,36 @@ export class NInferAdapter extends EngineAdapter {
|
|
|
223
238
|
// deploy step downloads it into the model directory and rewrites the
|
|
224
239
|
// --chat-template flag to the local file before the spawn.
|
|
225
240
|
onProgress?.('download');
|
|
226
|
-
const templateResult = await this.resolveChatTemplate(plan);
|
|
241
|
+
const templateResult = await this.resolveChatTemplate(plan, options?.onLog);
|
|
227
242
|
if (!templateResult.ok)
|
|
228
243
|
return withLogs(templateResult);
|
|
229
|
-
|
|
244
|
+
// A relative launch path (the NInfer Windows build tree,
|
|
245
|
+
// build-windows\apps\Release\ninfer-serve.exe) is joined against the
|
|
246
|
+
// engine directory the spawn runs in, so the spawn resolves an absolute
|
|
247
|
+
// path. A bare name (the Linux and macOS binaries, resolved against the
|
|
248
|
+
// path) is left as-is.
|
|
249
|
+
const resolvedArgv = resolveLaunchArgv(engineDir, plan.argv);
|
|
250
|
+
// The plan is the launch record's argv source (launchRecordFromPlan reads
|
|
251
|
+
// it), and the re-link rule substring-matches every record argv token
|
|
252
|
+
// against the live command line, so the record must name the spawn, not
|
|
253
|
+
// the build-tree relative binary.
|
|
254
|
+
plan.argv = resolvedArgv;
|
|
255
|
+
const handle = this.host.spawn(resolvedArgv, plan.env ?? {}, engineDir);
|
|
230
256
|
trackChild(this.children, this.planKey(plan), handle);
|
|
231
257
|
return withLogs({ ok: true, handle });
|
|
232
258
|
}
|
|
233
259
|
if (plan.kind === 'docker') {
|
|
234
|
-
//
|
|
235
|
-
//
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
260
|
+
// Auto Rebuild off (the card's checkbox): the image pull is skipped and
|
|
261
|
+
// the already-present image starts. The image pull is the docker build
|
|
262
|
+
// step: the card's button reads "Building..." for it, and its
|
|
263
|
+
// `$ <command>` line reaches the launch run's log sink before the child
|
|
264
|
+
// spawns.
|
|
265
|
+
if (autoRebuildEnabled(options?.autoRebuild)) {
|
|
266
|
+
onProgress?.('build');
|
|
267
|
+
const pull = await auditRun(this.host, `docker pull ${NINFER_DOCKER_IMAGE}`, options?.onLog);
|
|
268
|
+
if (!pull.ok) {
|
|
269
|
+
return { ok: false, detail: `docker pull failed: ${pull.detail ?? 'unknown'}` };
|
|
270
|
+
}
|
|
240
271
|
}
|
|
241
272
|
const handle = this.host.spawn(plan.argv ?? [], plan.env ?? {});
|
|
242
273
|
trackChild(this.children, this.planKey(plan), handle);
|
|
@@ -246,33 +277,56 @@ export class NInferAdapter extends EngineAdapter {
|
|
|
246
277
|
return { ok: true };
|
|
247
278
|
}
|
|
248
279
|
async healthCheck(plan, options) {
|
|
249
|
-
|
|
280
|
+
// The tracked handle rides into the poll, so a child that exits (a
|
|
281
|
+
// crash) ends the poll early with a failed result.
|
|
282
|
+
return pollHealth(this.host, plan, options, this.children.get(this.planKey(plan)));
|
|
250
283
|
}
|
|
251
|
-
async stop(plan) {
|
|
284
|
+
async stop(plan, log) {
|
|
252
285
|
if (plan.kind === 'docker' && plan.containerName !== undefined) {
|
|
253
|
-
await this.host
|
|
286
|
+
await auditRun(this.host, `docker stop ${plan.containerName}`, log);
|
|
254
287
|
}
|
|
255
288
|
const handle = this.children.get(this.planKey(plan));
|
|
256
289
|
if (handle !== undefined) {
|
|
257
290
|
handle.kill();
|
|
258
291
|
this.children.delete(this.planKey(plan));
|
|
292
|
+
return;
|
|
259
293
|
}
|
|
294
|
+
// No tracked child (an engine a DSH restart re-adopted): signal the pid
|
|
295
|
+
// the stored launch record stamped on the plan, so the stop reaches a
|
|
296
|
+
// process this adapter instance did not spawn.
|
|
297
|
+
await stopProcessPlan(this.host, plan, log);
|
|
260
298
|
}
|
|
261
299
|
buildMode(config) {
|
|
262
300
|
return config.buildMode === 'docker' ? 'docker' : 'local';
|
|
263
301
|
}
|
|
264
302
|
port(config) {
|
|
303
|
+
// 18020 is the port the ninfer-serve CLI binds by default, so a bare
|
|
304
|
+
// config launches on it.
|
|
265
305
|
return typeof config.port === 'number' ? config.port : 18020;
|
|
266
306
|
}
|
|
267
|
-
|
|
268
|
-
return `${plan.engineId}:${plan.port}`;
|
|
269
|
-
}
|
|
270
|
-
async downloadModel(plan) {
|
|
307
|
+
async downloadModel(plan, log) {
|
|
271
308
|
const artifact = plan.modelId !== undefined ? NINFER_MODEL_ARTIFACTS[plan.modelId] : undefined;
|
|
272
309
|
if (artifact === undefined)
|
|
273
310
|
return { ok: true };
|
|
274
|
-
|
|
275
|
-
|
|
311
|
+
// The hub-cache layout (no --local-dir) applies when the model directory is
|
|
312
|
+
// the plugin default; a user override keeps the flat --local-dir target.
|
|
313
|
+
const { baseDir, useHubCache } = modelDownloadTarget(plan.modelDirectory);
|
|
314
|
+
const entry = {
|
|
315
|
+
engineId: this.id,
|
|
316
|
+
modelId: plan.modelId ?? '',
|
|
317
|
+
label: artifact.modelId,
|
|
318
|
+
url: `https://huggingface.co/${artifact.repo}`,
|
|
319
|
+
file: artifact.file,
|
|
320
|
+
};
|
|
321
|
+
// A model the shared Get-steps routine already downloaded is on disk, so
|
|
322
|
+
// the deploy step skips the re-fetch and a launch after a Get does no
|
|
323
|
+
// duplicate download. Presence is the deterministic snapshot the resolved
|
|
324
|
+
// layout holds (modelArtifactPresent), never a bare blobs folder: a cache
|
|
325
|
+
// whose snapshot links are missing re-runs the cheap hf download, which
|
|
326
|
+
// reuses the blobs and writes the links.
|
|
327
|
+
if (modelArtifactPresent(entry, baseDir, useHubCache))
|
|
328
|
+
return { ok: true };
|
|
329
|
+
const download = await auditRun(this.host, hfDownloadCommand(entry, baseDir, useHubCache), log);
|
|
276
330
|
if (!download.ok) {
|
|
277
331
|
return { ok: false, detail: `model download failed: ${download.detail ?? 'unknown'}` };
|
|
278
332
|
}
|
|
@@ -287,7 +341,7 @@ export class NInferAdapter extends EngineAdapter {
|
|
|
287
341
|
* disk is used without a re-fetch, and a missing hf CLI leaves the flag
|
|
288
342
|
* untouched so the engine reports the missing template itself.
|
|
289
343
|
*/
|
|
290
|
-
async resolveChatTemplate(plan) {
|
|
344
|
+
async resolveChatTemplate(plan, log) {
|
|
291
345
|
const argv = plan.argv;
|
|
292
346
|
if (argv === undefined)
|
|
293
347
|
return { ok: true };
|
|
@@ -301,24 +355,38 @@ export class NInferAdapter extends EngineAdapter {
|
|
|
301
355
|
// is a bare file name the engine resolves against its own directory.
|
|
302
356
|
if (value.startsWith('/') || !value.includes('/'))
|
|
303
357
|
return { ok: true };
|
|
304
|
-
// An HF repo reference: download the template file
|
|
305
|
-
//
|
|
306
|
-
|
|
307
|
-
|
|
358
|
+
// An HF repo reference: download the template file and point the flag at
|
|
359
|
+
// the local copy. The hub-cache layout (the model directory is the plugin
|
|
360
|
+
// default) resolves the concrete snapshot file path the hf CLI writes; a
|
|
361
|
+
// user override keeps the flat model-directory path. The flat path is
|
|
362
|
+
// built with join (the host's path module normalizes the separators), so
|
|
363
|
+
// the flag the engine reads resolves on Windows, Linux, and macOS alike.
|
|
364
|
+
const { baseDir, useHubCache } = modelDownloadTarget(plan.modelDirectory);
|
|
365
|
+
// The hub-cache branch resolves the deterministic snapshot file; the flat
|
|
366
|
+
// branch asks the shared presence predicate for the template join.
|
|
367
|
+
const resolvePath = () => useHubCache
|
|
368
|
+
? hubCacheSnapshotFilePath(baseDir, value, CHAT_TEMPLATE_FILE)
|
|
369
|
+
: chatTemplatePresent(value, baseDir)
|
|
370
|
+
? chatTemplateArtifactPath(baseDir)
|
|
371
|
+
: null;
|
|
372
|
+
let localPath = resolvePath();
|
|
308
373
|
// A template already on disk skips the re-fetch; the hf CLI is optional,
|
|
309
374
|
// so a download failure is reported but does not abort the launch.
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
const download = await this.host.run(`hf download ${value} chat_template.jinja --local-dir ${target}`);
|
|
375
|
+
if (localPath === null) {
|
|
376
|
+
const download = await auditRun(this.host, hfChatTemplateCommand(value, baseDir, useHubCache), log);
|
|
313
377
|
if (!download.ok) {
|
|
314
378
|
return {
|
|
315
379
|
ok: false,
|
|
316
380
|
detail: `chat template download failed: ${download.detail ?? 'unknown'}`,
|
|
317
381
|
};
|
|
318
382
|
}
|
|
383
|
+
localPath = resolvePath();
|
|
384
|
+
if (localPath === null) {
|
|
385
|
+
return { ok: false, detail: 'chat template download failed' };
|
|
386
|
+
}
|
|
319
387
|
}
|
|
320
388
|
argv[index + 1] = localPath;
|
|
321
389
|
return { ok: true };
|
|
322
390
|
}
|
|
323
391
|
}
|
|
324
|
-
//# sourceMappingURL=ninferAdapter.js.map
|
|
392
|
+
//# sourceMappingURL=ninferAdapter.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The NInfer Arch Linux build profile. Arch builds NInfer through the shared
|
|
3
|
+
* Linux route (cmake with the Ninja generator), 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/ninfer/ninferArch
|
|
6
|
+
*/
|
|
7
|
+
import type { EngineOsProfile } from '../engineOs.ts';
|
|
8
|
+
export declare const NINFER_ARCH: EngineOsProfile;
|
|
9
|
+
//# sourceMappingURL=ninferArch.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The NInfer Arch Linux build profile. Arch builds NInfer through the shared
|
|
3
|
+
* Linux route (cmake with the Ninja generator), 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/ninfer/ninferArch
|
|
6
|
+
*/
|
|
7
|
+
import { NINFER_LINUX } from "./ninferLinux.js";
|
|
8
|
+
export const NINFER_ARCH = NINFER_LINUX;
|
|
9
|
+
//# sourceMappingURL=ninferArch.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The NInfer Debian build profile. Debian builds NInfer through the shared
|
|
3
|
+
* Linux route (cmake with the Ninja generator), 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/ninfer/ninferDebian
|
|
6
|
+
*/
|
|
7
|
+
import type { EngineOsProfile } from '../engineOs.ts';
|
|
8
|
+
export declare const NINFER_DEBIAN: EngineOsProfile;
|
|
9
|
+
//# sourceMappingURL=ninferDebian.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The NInfer Debian build profile. Debian builds NInfer through the shared
|
|
3
|
+
* Linux route (cmake with the Ninja generator), 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/ninfer/ninferDebian
|
|
6
|
+
*/
|
|
7
|
+
import { NINFER_LINUX } from "./ninferLinux.js";
|
|
8
|
+
export const NINFER_DEBIAN = NINFER_LINUX;
|
|
9
|
+
//# sourceMappingURL=ninferDebian.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The NInfer Fedora build profile. Fedora builds NInfer through the shared
|
|
3
|
+
* Linux route (cmake with the Ninja generator), 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/ninfer/ninferFedora
|
|
6
|
+
*/
|
|
7
|
+
import type { EngineOsProfile } from '../engineOs.ts';
|
|
8
|
+
export declare const NINFER_FEDORA: EngineOsProfile;
|
|
9
|
+
//# sourceMappingURL=ninferFedora.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The NInfer Fedora build profile. Fedora builds NInfer through the shared
|
|
3
|
+
* Linux route (cmake with the Ninja generator), 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/ninfer/ninferFedora
|
|
6
|
+
*/
|
|
7
|
+
import { NINFER_LINUX } from "./ninferLinux.js";
|
|
8
|
+
export const NINFER_FEDORA = NINFER_LINUX;
|
|
9
|
+
//# sourceMappingURL=ninferFedora.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The NInfer shared Linux build profile. Every Linux distro (Arch, Debian,
|
|
3
|
+
* Fedora) builds NInfer through this one route: cmake with the Ninja generator
|
|
4
|
+
* into the `build` directory, which is where the `ninfer-serve` binary lands.
|
|
5
|
+
* The distro profiles reuse this profile, so a distro carries no build steps of
|
|
6
|
+
* its own.
|
|
7
|
+
* @module dsh-plugin-local-infer/providers/engines/ninfer/ninferLinux
|
|
8
|
+
*/
|
|
9
|
+
import type { EngineOsProfile } from '../engineOs.ts';
|
|
10
|
+
export declare const NINFER_LINUX: EngineOsProfile;
|
|
11
|
+
/**
|
|
12
|
+
* ninferLinuxBinary returns the NInfer engine binary name on Linux: the plain
|
|
13
|
+
* `ninfer-serve` (no .exe). The name comes from the shared Linux profile, so
|
|
14
|
+
* the spelling has one home.
|
|
15
|
+
*/
|
|
16
|
+
export declare function ninferLinuxBinary(): string;
|
|
17
|
+
//# sourceMappingURL=ninferLinux.d.ts.map
|