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.
Files changed (251) hide show
  1. package/README.md +32 -6
  2. package/cordis.patch.yml +7 -0
  3. package/docs/zh/README.md +24 -4
  4. package/dsh/client.js +4200 -4049
  5. package/package.json +33 -11
  6. package/packages/core/lib/adapter.d.ts +177 -11
  7. package/packages/core/lib/adapter.js +74 -1
  8. package/packages/core/lib/config.d.ts +1 -1
  9. package/packages/core/lib/config.js +1 -1
  10. package/packages/core/lib/debug.d.ts +1 -1
  11. package/packages/core/lib/debug.js +1 -1
  12. package/packages/core/lib/defaults.d.ts +1 -1
  13. package/packages/core/lib/defaults.js +1 -1
  14. package/packages/core/lib/deps.d.ts +48 -20
  15. package/packages/core/lib/deps.js +24 -8
  16. package/packages/core/lib/estimator.d.ts +1 -1
  17. package/packages/core/lib/estimator.js +1 -1
  18. package/packages/core/lib/guideline.d.ts +1 -1
  19. package/packages/core/lib/guideline.js +1 -1
  20. package/packages/core/lib/hardware.d.ts +1 -1
  21. package/packages/core/lib/hardware.js +1 -1
  22. package/packages/core/lib/hf-cache.d.ts +70 -0
  23. package/packages/core/lib/hf-cache.js +83 -0
  24. package/packages/core/lib/index.d.ts +16 -9
  25. package/packages/core/lib/index.js +10 -6
  26. package/packages/core/lib/infer-cache.d.ts +39 -0
  27. package/packages/core/lib/infer-cache.js +53 -0
  28. package/packages/core/lib/launch-command.d.ts +8 -4
  29. package/packages/core/lib/launch-command.js +13 -6
  30. package/packages/core/lib/launch-record.d.ts +1 -1
  31. package/packages/core/lib/launch-record.js +1 -1
  32. package/packages/core/lib/logs.d.ts +8 -1
  33. package/packages/core/lib/logs.js +12 -4
  34. package/packages/core/lib/models.d.ts +120 -14
  35. package/packages/core/lib/models.js +209 -17
  36. package/packages/core/lib/parameter.d.ts +31 -3
  37. package/packages/core/lib/parameter.js +1 -1
  38. package/packages/core/lib/progress.d.ts +54 -0
  39. package/packages/core/lib/progress.js +120 -0
  40. package/packages/core/lib/registrar.d.ts +25 -14
  41. package/packages/core/lib/registrar.js +30 -10
  42. package/packages/core/lib/reserve.d.ts +11 -3
  43. package/packages/core/lib/reserve.js +6 -4
  44. package/packages/core/lib/status.d.ts +12 -6
  45. package/packages/core/lib/status.js +21 -10
  46. package/packages/core/lib/sudo.d.ts +80 -0
  47. package/packages/core/lib/sudo.js +78 -0
  48. package/packages/core/package.json +1 -1
  49. package/packages/orchestrator/lib/config.d.ts +63 -0
  50. package/packages/orchestrator/lib/config.js +111 -0
  51. package/packages/orchestrator/lib/index.d.ts +51 -0
  52. package/packages/orchestrator/lib/index.js +73 -0
  53. package/packages/orchestrator/lib/route.d.ts +60 -0
  54. package/packages/orchestrator/lib/route.js +159 -0
  55. package/packages/orchestrator/locale/en.json +6 -0
  56. package/packages/orchestrator/package.json +39 -0
  57. package/packages/orchestrator/prompt.md +87 -0
  58. package/packages/providers/lib/acquire.d.ts +95 -15
  59. package/packages/providers/lib/acquire.js +239 -40
  60. package/packages/providers/lib/adapters.d.ts +155 -221
  61. package/packages/providers/lib/adapters.js +589 -935
  62. package/packages/providers/lib/debug.d.ts +1 -1
  63. package/packages/providers/lib/debug.js +1 -1
  64. package/packages/providers/lib/deps.d.ts +31 -212
  65. package/packages/providers/lib/deps.js +71 -205
  66. package/packages/providers/lib/engines/basalt/basalt.d.ts +130 -0
  67. package/packages/providers/lib/engines/basalt/basalt.js +304 -0
  68. package/packages/providers/lib/engines/basalt/basaltAdapter.d.ts +85 -0
  69. package/packages/providers/lib/engines/basalt/basaltAdapter.js +439 -0
  70. package/packages/providers/lib/engines/basalt/basaltLinux.d.ts +23 -0
  71. package/packages/providers/lib/engines/basalt/basaltLinux.js +47 -0
  72. package/packages/providers/lib/engines/basalt/basaltMacOS.d.ts +17 -0
  73. package/packages/providers/lib/engines/basalt/basaltMacOS.js +19 -0
  74. package/packages/providers/lib/engines/basalt/basaltWindows.d.ts +24 -0
  75. package/packages/providers/lib/engines/basalt/basaltWindows.js +49 -0
  76. package/packages/providers/lib/engines/engineOs.d.ts +24 -0
  77. package/packages/providers/lib/engines/engineOs.js +17 -0
  78. package/packages/providers/lib/{hyperqwen.d.ts → engines/hyperqwen/hyperqwen.d.ts} +2 -2
  79. package/packages/providers/lib/{hyperqwen.js → engines/hyperqwen/hyperqwen.js} +14 -2
  80. package/packages/providers/lib/engines/hyperqwen/hyperqwenAdapter.d.ts +38 -0
  81. package/packages/providers/lib/engines/hyperqwen/hyperqwenAdapter.js +115 -0
  82. package/packages/providers/lib/engines/hyperqwen/hyperqwenArch.d.ts +9 -0
  83. package/packages/providers/lib/engines/hyperqwen/hyperqwenArch.js +9 -0
  84. package/packages/providers/lib/engines/hyperqwen/hyperqwenDebian.d.ts +9 -0
  85. package/packages/providers/lib/engines/hyperqwen/hyperqwenDebian.js +9 -0
  86. package/packages/providers/lib/engines/hyperqwen/hyperqwenFedora.d.ts +9 -0
  87. package/packages/providers/lib/engines/hyperqwen/hyperqwenFedora.js +9 -0
  88. package/packages/providers/lib/engines/hyperqwen/hyperqwenLinux.d.ts +10 -0
  89. package/packages/providers/lib/engines/hyperqwen/hyperqwenLinux.js +14 -0
  90. package/packages/providers/lib/engines/hyperqwen/hyperqwenMacOS.d.ts +9 -0
  91. package/packages/providers/lib/engines/hyperqwen/hyperqwenMacOS.js +9 -0
  92. package/packages/providers/lib/engines/hyperqwen/hyperqwenWindows.d.ts +9 -0
  93. package/packages/providers/lib/engines/hyperqwen/hyperqwenWindows.js +9 -0
  94. package/packages/providers/lib/{infernix.d.ts → engines/infernix/infernix.d.ts} +7 -4
  95. package/packages/providers/lib/{infernix.js → engines/infernix/infernix.js} +53 -8
  96. package/packages/providers/lib/engines/infernix/infernixAdapter.d.ts +52 -0
  97. package/packages/providers/lib/engines/infernix/infernixAdapter.js +235 -0
  98. package/packages/providers/lib/engines/infernix/infernixArch.d.ts +9 -0
  99. package/packages/providers/lib/engines/infernix/infernixArch.js +9 -0
  100. package/packages/providers/lib/engines/infernix/infernixDebian.d.ts +9 -0
  101. package/packages/providers/lib/engines/infernix/infernixDebian.js +9 -0
  102. package/packages/providers/lib/engines/infernix/infernixFedora.d.ts +9 -0
  103. package/packages/providers/lib/engines/infernix/infernixFedora.js +9 -0
  104. package/packages/providers/lib/engines/infernix/infernixLinux.d.ts +17 -0
  105. package/packages/providers/lib/engines/infernix/infernixLinux.js +35 -0
  106. package/packages/providers/lib/engines/infernix/infernixMacOS.d.ts +16 -0
  107. package/packages/providers/lib/engines/infernix/infernixMacOS.js +18 -0
  108. package/packages/providers/lib/engines/infernix/infernixWindows.d.ts +16 -0
  109. package/packages/providers/lib/engines/infernix/infernixWindows.js +34 -0
  110. package/packages/providers/lib/{llamacpp.d.ts → engines/llamacpp/llamacpp.d.ts} +2 -2
  111. package/packages/providers/lib/{llamacpp.js → engines/llamacpp/llamacpp.js} +12 -2
  112. package/packages/providers/lib/engines/llamacpp/llamacppAdapter.d.ts +50 -0
  113. package/packages/providers/lib/engines/llamacpp/llamacppAdapter.js +274 -0
  114. package/packages/providers/lib/engines/llamacpp/llamacppArch.d.ts +9 -0
  115. package/packages/providers/lib/engines/llamacpp/llamacppArch.js +9 -0
  116. package/packages/providers/lib/engines/llamacpp/llamacppDebian.d.ts +9 -0
  117. package/packages/providers/lib/engines/llamacpp/llamacppDebian.js +9 -0
  118. package/packages/providers/lib/engines/llamacpp/llamacppFedora.d.ts +9 -0
  119. package/packages/providers/lib/engines/llamacpp/llamacppFedora.js +9 -0
  120. package/packages/providers/lib/engines/llamacpp/llamacppLinux.d.ts +17 -0
  121. package/packages/providers/lib/engines/llamacpp/llamacppLinux.js +28 -0
  122. package/packages/providers/lib/engines/llamacpp/llamacppMacOS.d.ts +15 -0
  123. package/packages/providers/lib/engines/llamacpp/llamacppMacOS.js +17 -0
  124. package/packages/providers/lib/engines/llamacpp/llamacppWindows.d.ts +15 -0
  125. package/packages/providers/lib/engines/llamacpp/llamacppWindows.js +26 -0
  126. package/packages/providers/lib/{ninfer.d.ts → engines/ninfer/ninfer.d.ts} +2 -2
  127. package/packages/providers/lib/{ninfer.js → engines/ninfer/ninfer.js} +25 -3
  128. package/packages/providers/lib/engines/ninfer/ninferAdapter.d.ts +81 -0
  129. package/packages/providers/lib/engines/ninfer/ninferAdapter.js +392 -0
  130. package/packages/providers/lib/engines/ninfer/ninferArch.d.ts +9 -0
  131. package/packages/providers/lib/engines/ninfer/ninferArch.js +9 -0
  132. package/packages/providers/lib/engines/ninfer/ninferDebian.d.ts +9 -0
  133. package/packages/providers/lib/engines/ninfer/ninferDebian.js +9 -0
  134. package/packages/providers/lib/engines/ninfer/ninferFedora.d.ts +9 -0
  135. package/packages/providers/lib/engines/ninfer/ninferFedora.js +9 -0
  136. package/packages/providers/lib/engines/ninfer/ninferLinux.d.ts +17 -0
  137. package/packages/providers/lib/engines/ninfer/ninferLinux.js +37 -0
  138. package/packages/providers/lib/engines/ninfer/ninferMacOS.d.ts +15 -0
  139. package/packages/providers/lib/engines/ninfer/ninferMacOS.js +17 -0
  140. package/packages/providers/lib/engines/ninfer/ninferWindows.d.ts +29 -0
  141. package/packages/providers/lib/engines/ninfer/ninferWindows.js +59 -0
  142. package/packages/providers/lib/engines/strata/strata.d.ts +1 -0
  143. package/packages/providers/lib/engines/strata/strata.js +264 -0
  144. package/packages/providers/lib/engines/strata/strataAdapter.d.ts +97 -0
  145. package/packages/providers/lib/engines/strata/strataAdapter.js +463 -0
  146. package/packages/providers/lib/engines/strata/strataArch.d.ts +9 -0
  147. package/packages/providers/lib/engines/strata/strataArch.js +9 -0
  148. package/packages/providers/lib/engines/strata/strataDebian.d.ts +9 -0
  149. package/packages/providers/lib/engines/strata/strataDebian.js +9 -0
  150. package/packages/providers/lib/engines/strata/strataFedora.d.ts +9 -0
  151. package/packages/providers/lib/engines/strata/strataFedora.js +9 -0
  152. package/packages/providers/lib/engines/strata/strataLinux.d.ts +21 -0
  153. package/packages/providers/lib/engines/strata/strataLinux.js +30 -0
  154. package/packages/providers/lib/engines/strata/strataMacOS.d.ts +16 -0
  155. package/packages/providers/lib/engines/strata/strataMacOS.js +17 -0
  156. package/packages/providers/lib/engines/strata/strataWindows.d.ts +27 -0
  157. package/packages/providers/lib/engines/strata/strataWindows.js +37 -0
  158. package/packages/providers/lib/engines.d.ts +8 -5
  159. package/packages/providers/lib/engines.js +22 -11
  160. package/packages/providers/lib/guidelines.d.ts +5 -4
  161. package/packages/providers/lib/guidelines.js +18 -5
  162. package/packages/providers/lib/index.d.ts +33 -24
  163. package/packages/providers/lib/index.js +46 -24
  164. package/packages/providers/lib/model-defaults.d.ts +10 -5
  165. package/packages/providers/lib/model-defaults.js +47 -5
  166. package/packages/providers/lib/platform.d.ts +8 -5
  167. package/packages/providers/lib/platform.js +27 -7
  168. package/packages/providers/lib/presets.d.ts +6 -4
  169. package/packages/providers/lib/presets.js +53 -5
  170. package/packages/providers/lib/systemDeps.d.ts +313 -0
  171. package/packages/providers/lib/systemDeps.js +284 -0
  172. package/packages/providers/lib/vram.d.ts +34 -8
  173. package/packages/providers/lib/vram.js +81 -8
  174. package/packages/providers/package.json +2 -2
  175. package/packages/service/lib/index.d.ts +187 -23
  176. package/packages/service/lib/index.js +667 -90
  177. package/packages/service/lib/launch-target.d.ts +19 -0
  178. package/packages/service/lib/launch-target.js +28 -0
  179. package/packages/service/lib/run-logs.d.ts +72 -0
  180. package/packages/service/lib/run-logs.js +125 -0
  181. package/packages/service/lib/types.d.ts +166 -8
  182. package/packages/service/lib/types.js +1 -1
  183. package/packages/service/package.json +2 -2
  184. package/packages/tool/lib/index.d.ts +1 -1
  185. package/packages/tool/lib/index.js +1 -1
  186. package/packages/tool/package.json +2 -2
  187. package/packages/ui/lib/config.d.ts +89 -0
  188. package/packages/ui/lib/config.js +251 -0
  189. package/packages/ui/lib/deps.d.ts +4 -4
  190. package/packages/ui/lib/deps.js +1 -1
  191. package/packages/ui/lib/form.d.ts +1 -1
  192. package/packages/ui/lib/form.js +1 -1
  193. package/packages/ui/lib/index.d.ts +7 -1
  194. package/packages/ui/lib/index.js +12 -2
  195. package/packages/ui/lib/meter.d.ts +1 -1
  196. package/packages/ui/lib/meter.js +1 -1
  197. package/packages/ui/lib/ops/engine.d.ts +216 -0
  198. package/packages/ui/lib/ops/engine.js +697 -0
  199. package/packages/ui/lib/ops/get-steps.d.ts +98 -0
  200. package/packages/ui/lib/ops/get-steps.js +359 -0
  201. package/packages/ui/lib/ops/hf.d.ts +42 -0
  202. package/packages/ui/lib/ops/hf.js +150 -0
  203. package/packages/ui/lib/ops/logs.d.ts +78 -0
  204. package/packages/ui/lib/ops/logs.js +119 -0
  205. package/packages/ui/lib/ops/model.d.ts +71 -0
  206. package/packages/ui/lib/ops/model.js +123 -0
  207. package/packages/ui/lib/request.d.ts +106 -0
  208. package/packages/ui/lib/request.js +80 -0
  209. package/packages/ui/lib/route.d.ts +106 -422
  210. package/packages/ui/lib/route.js +136 -1845
  211. package/packages/ui/lib/routes/chat-template.d.ts +1 -0
  212. package/packages/ui/lib/routes/chat-template.js +1 -0
  213. package/packages/ui/lib/routes/deps.d.ts +1 -0
  214. package/packages/ui/lib/routes/deps.js +1 -0
  215. package/packages/ui/lib/routes/download.d.ts +1 -0
  216. package/packages/ui/lib/routes/download.js +1 -0
  217. package/packages/ui/lib/routes/get.d.ts +1 -0
  218. package/packages/ui/lib/routes/get.js +106 -0
  219. package/packages/ui/lib/routes/install.d.ts +16 -0
  220. package/packages/ui/lib/routes/install.js +36 -0
  221. package/packages/ui/lib/routes/launch.d.ts +24 -0
  222. package/packages/ui/lib/routes/launch.js +74 -0
  223. package/packages/ui/lib/routes/logs.d.ts +57 -0
  224. package/packages/ui/lib/routes/logs.js +117 -0
  225. package/packages/ui/lib/routes/provider-delete.d.ts +15 -0
  226. package/packages/ui/lib/routes/provider-delete.js +37 -0
  227. package/packages/ui/lib/routes/register.d.ts +16 -0
  228. package/packages/ui/lib/routes/register.js +28 -0
  229. package/packages/ui/lib/routes/save.d.ts +18 -0
  230. package/packages/ui/lib/routes/save.js +159 -0
  231. package/packages/ui/lib/routes/stop.d.ts +19 -0
  232. package/packages/ui/lib/routes/stop.js +32 -0
  233. package/packages/ui/lib/routes/stream.d.ts +40 -0
  234. package/packages/ui/lib/routes/stream.js +68 -0
  235. package/packages/ui/lib/routes/summary.d.ts +15 -0
  236. package/packages/ui/lib/routes/summary.js +26 -0
  237. package/packages/ui/lib/routes/unregister.d.ts +14 -0
  238. package/packages/ui/lib/routes/unregister.js +26 -0
  239. package/packages/ui/lib/viewmodels/deps.d.ts +1 -0
  240. package/packages/ui/lib/viewmodels/deps.js +1 -0
  241. package/packages/ui/lib/viewmodels/depsHelpers.d.ts +1 -0
  242. package/packages/ui/lib/viewmodels/depsHelpers.js +94 -0
  243. package/packages/ui/lib/viewmodels/summary.d.ts +145 -0
  244. package/packages/ui/lib/viewmodels/summary.js +245 -0
  245. package/packages/ui/lib/viewmodels/summaryHelpers.d.ts +30 -0
  246. package/packages/ui/lib/viewmodels/summaryHelpers.js +42 -0
  247. package/packages/ui/lib/warnings.d.ts +1 -1
  248. package/packages/ui/lib/warnings.js +1 -1
  249. package/packages/ui/package.json +4 -4
  250. package/packages/providers/lib/strata.d.ts +0 -15
  251. package/packages/providers/lib/strata.js +0 -14
@@ -0,0 +1,392 @@
1
+ /**
2
+ * The NInfer engine adapter. NInferModelArtifact is the per-model deploy data:
3
+ * the `.ninfer` artifact file, the Hugging Face repo the model download pulls
4
+ * it from, and the `--model-id` alias the server advertises. The data is the
5
+ * surface; adding a model is a data edit here, never an adapter rewire.
6
+ * NInferAdapter is the canonical both-capable engine. `renderLaunch` renders a
7
+ * local `ninfer-serve` process or a `docker run` of the ghcr image from the
8
+ * same spec surface; `deploy` builds the engine in the engine directory (or
9
+ * pulls the image), downloads the model into the model directory, and starts
10
+ * the engine; `healthCheck` polls the health URL; `stop` signals the tracked
11
+ * process and stops the named container.
12
+ * @module dsh-plugin-local-infer/providers/engines/ninfer/ninferAdapter
13
+ */
14
+ import { basename, dirname, join } from 'node:path';
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
+ 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
+ };
34
+ /**
35
+ * The NInfer model artifacts, keyed by the model registry id. The 27B entry
36
+ * is the default the DEFAULT_MODELS list names; the 35B-A3B entries are the
37
+ * Qwen3.8 measured artifact (`qwen3-35b`) and the Qwen3.6 default
38
+ * (`qwen36-35b`).
39
+ */
40
+ export const NINFER_MODEL_ARTIFACTS = {
41
+ 'qwen3-27b': {
42
+ file: 'qwen3_8_27b_nvfp4.ninfer',
43
+ repo: 'neroued/Qwen3.8-27B-nvfp4-NInfer',
44
+ modelId: 'Qwen3.8-27B',
45
+ },
46
+ // The Swift 1.5 ablated 27B the local launcher bootstraps: the nvfp4-full
47
+ // DFlash2 artifact the qwen-ninfer script serves. It reuses the 27B model id
48
+ // the engine advertises, so a chat turn routes to the same alias.
49
+ 'qwen3-27b-swift15': {
50
+ file: 'qwen3_8_27b_swift15abl_nvfp4full-dflash2.ninfer',
51
+ repo: 'kaushikvira/Qwen3.8-27B-swift15-uncensored-ajgazin-nvfp4full-dflash2-NInfer-v3',
52
+ modelId: 'Qwen3.8-27B',
53
+ },
54
+ 'qwen3-35b': {
55
+ file: 'qwen3_8_35b_a3b.ninfer',
56
+ repo: 'Neroued/Qwen3.8-35B-A3B-NInfer',
57
+ modelId: 'Qwen3.8-35B-A3B',
58
+ },
59
+ 'qwen36-35b': {
60
+ file: 'qwen3_6_35b_a3b.ninfer',
61
+ repo: 'neroued/Qwen3.6-35B-A3B-NInfer',
62
+ modelId: 'Qwen3.6-35B-A3B',
63
+ },
64
+ };
65
+ /**
66
+ * artifactFor resolves the artifact a model id deploys. An id no entry names
67
+ * falls back to the 27B artifact, so a bare config always renders a plan.
68
+ */
69
+ function artifactFor(modelId) {
70
+ const artifact = modelId !== undefined ? NINFER_MODEL_ARTIFACTS[modelId] : undefined;
71
+ return artifact ?? NINFER_MODEL_ARTIFACTS['qwen3-27b'];
72
+ }
73
+ /**
74
+ * The NInfer docker image the adapter pulls and runs. The engineFork platform
75
+ * config overrides the git source for a local build; the image stays the
76
+ * upstream ghcr artifact.
77
+ */
78
+ export const NINFER_DOCKER_IMAGE = 'ghcr.io/iamwavecut/ninfer-all';
79
+ /**
80
+ * NInferAdapter is the canonical both-capable engine. `renderLaunch` renders a
81
+ * local `ninfer-serve` process or a `docker run` of the ghcr image from the
82
+ * same spec surface; `deploy` builds the engine in the engine directory (or
83
+ * pulls the image), downloads the model into the model directory, and starts
84
+ * the engine; `healthCheck` polls the health URL; `stop` signals the tracked
85
+ * process and stops the named container.
86
+ */
87
+ export class NInferAdapter extends EngineAdapter {
88
+ id = 'ninfer';
89
+ supports = { docker: true, local: true };
90
+ host;
91
+ children = new Map();
92
+ constructor(host = nodeLifecycleHost) {
93
+ super();
94
+ this.host = host;
95
+ }
96
+ parameters() {
97
+ return NINFER_PARAMETERS;
98
+ }
99
+ modelRef(config) {
100
+ // The id the engine advertises on its OpenAI endpoint is the artifact's
101
+ // --model-id alias, not the VramModel registry key the config names, so
102
+ // the registrar publishes the alias and a chat turn routes to it.
103
+ const artifact = artifactFor(typeof config.model === 'string' ? config.model : 'qwen3-27b');
104
+ return { id: artifact.modelId, name: artifact.modelId };
105
+ }
106
+ launchSignature(config = {}) {
107
+ // The local plan runs the ninfer-serve binary; the docker plan's host
108
+ // process is docker run of the ghcr image, so the image name is the
109
+ // command-line marker the reserve probe matches on.
110
+ const port = this.port(config);
111
+ if (this.buildMode(config) === 'docker') {
112
+ return { binary: NINFER_DOCKER_IMAGE, port };
113
+ }
114
+ return { binary: 'ninfer-serve', port };
115
+ }
116
+ renderLaunch(config, _hw) {
117
+ const port = this.port(config);
118
+ const modelId = typeof config.model === 'string' ? config.model : 'qwen3-27b';
119
+ const artifact = artifactFor(modelId);
120
+ // A model key that names a local artifact file (a directory-scanned
121
+ // model) overrides the artifact map's file, so a file the user has on
122
+ // disk launches as-is.
123
+ const file = modelId.endsWith('.ninfer') ? modelId : artifact.file;
124
+ const modelDirectory = typeof config.modelDirectory === 'string' ? config.modelDirectory : '';
125
+ const flags = flagsFromSpecs(NINFER_PARAMETERS, config);
126
+ if (this.buildMode(config) === 'docker') {
127
+ const modelPath = modelDirectory === '' ? file : join(modelDirectory, file);
128
+ const containerModelPath = `/models/${basename(file)}`;
129
+ const modelMount = modelDirectory === ''
130
+ ? `${file}:${containerModelPath}`
131
+ : `${dirname(modelPath)}:/models`;
132
+ const containerName = `ninfer-${port}`;
133
+ const customArgs = customArgFlags(config);
134
+ return {
135
+ engineId: this.id,
136
+ kind: 'docker',
137
+ argv: [
138
+ 'docker',
139
+ 'run',
140
+ '--rm',
141
+ '--gpus',
142
+ 'all',
143
+ '--name',
144
+ containerName,
145
+ '-p',
146
+ `127.0.0.1:${port}:8080`,
147
+ '--ulimit',
148
+ 'memlock=-1',
149
+ '-v',
150
+ 'ninfer-cache:/cache',
151
+ '-v',
152
+ modelMount,
153
+ NINFER_DOCKER_IMAGE,
154
+ 'serve',
155
+ containerModelPath,
156
+ '--model-id',
157
+ artifact.modelId,
158
+ ...flags,
159
+ ...customArgs,
160
+ ],
161
+ env: {},
162
+ containerName,
163
+ modelId,
164
+ ...(modelDirectory === '' ? {} : { modelDirectory }),
165
+ port,
166
+ healthUrl: `http://127.0.0.1:${port}/health`,
167
+ os: _hw.os,
168
+ };
169
+ }
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);
178
+ const customArgs = customArgFlags(config);
179
+ return {
180
+ engineId: this.id,
181
+ kind: 'process',
182
+ argv: [
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](),
186
+ modelPath,
187
+ '--host',
188
+ '127.0.0.1',
189
+ '--port',
190
+ String(port),
191
+ '--model-id',
192
+ artifact.modelId,
193
+ ...flags,
194
+ ...customArgs,
195
+ ],
196
+ env: {},
197
+ modelId,
198
+ ...(modelDirectory === '' ? {} : { modelDirectory }),
199
+ port,
200
+ healthUrl: `http://127.0.0.1:${port}/health`,
201
+ os: _hw.os,
202
+ };
203
+ }
204
+ async deploy(plan, platform, onProgress, options) {
205
+ if (plan.kind === 'process') {
206
+ const engineDir = platform?.engineDirectory;
207
+ let buildLogs = '';
208
+ // Auto Rebuild off (the card's checkbox): the git sync (fetch, rebase,
209
+ // rebuild) is skipped and the checkout launches as-is.
210
+ if (engineDir !== undefined && autoRebuildEnabled(options?.autoRebuild)) {
211
+ // The conditional rebuild fetches the checkout, prices it against the
212
+ // remote branch, and rebuilds only when it is behind (or a fresh
213
+ // clone). The decision, the build command, and its output are captured
214
+ // into buildLogs and threaded to the card's Logs section.
215
+ const sync = await syncEngineForDeploy(this.host, {
216
+ engineId: this.id,
217
+ directory: engineDir,
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;
227
+ if (!sync.ok) {
228
+ return { ok: false, detail: sync.detail ?? 'unknown', logs: buildLogs };
229
+ }
230
+ }
231
+ const withLogs = (result) => buildLogs !== '' ? { ...result, logs: buildLogs } : result;
232
+ onProgress?.('download');
233
+ const download = await this.downloadModel(plan, options?.onLog);
234
+ if (!download.ok)
235
+ return withLogs(download);
236
+ // A chat template the user picked as an HF repo reference (the combo
237
+ // control's known choices) is not a path the engine can read, so the
238
+ // deploy step downloads it into the model directory and rewrites the
239
+ // --chat-template flag to the local file before the spawn.
240
+ onProgress?.('download');
241
+ const templateResult = await this.resolveChatTemplate(plan, options?.onLog);
242
+ if (!templateResult.ok)
243
+ return withLogs(templateResult);
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);
256
+ trackChild(this.children, this.planKey(plan), handle);
257
+ return withLogs({ ok: true, handle });
258
+ }
259
+ if (plan.kind === 'docker') {
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
+ }
271
+ }
272
+ const handle = this.host.spawn(plan.argv ?? [], plan.env ?? {});
273
+ trackChild(this.children, this.planKey(plan), handle);
274
+ return { ok: true, handle };
275
+ }
276
+ // NInfer renders process and docker plans; a compose plan is a no-op.
277
+ return { ok: true };
278
+ }
279
+ async healthCheck(plan, options) {
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)));
283
+ }
284
+ async stop(plan, log) {
285
+ if (plan.kind === 'docker' && plan.containerName !== undefined) {
286
+ await auditRun(this.host, `docker stop ${plan.containerName}`, log);
287
+ }
288
+ const handle = this.children.get(this.planKey(plan));
289
+ if (handle !== undefined) {
290
+ handle.kill();
291
+ this.children.delete(this.planKey(plan));
292
+ return;
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);
298
+ }
299
+ buildMode(config) {
300
+ return config.buildMode === 'docker' ? 'docker' : 'local';
301
+ }
302
+ port(config) {
303
+ // 18020 is the port the ninfer-serve CLI binds by default, so a bare
304
+ // config launches on it.
305
+ return typeof config.port === 'number' ? config.port : 18020;
306
+ }
307
+ async downloadModel(plan, log) {
308
+ const artifact = plan.modelId !== undefined ? NINFER_MODEL_ARTIFACTS[plan.modelId] : undefined;
309
+ if (artifact === undefined)
310
+ return { ok: true };
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);
330
+ if (!download.ok) {
331
+ return { ok: false, detail: `model download failed: ${download.detail ?? 'unknown'}` };
332
+ }
333
+ return { ok: true };
334
+ }
335
+ /**
336
+ * resolveChatTemplate rewrites a --chat-template flag that carries an HF repo
337
+ * reference into the local file the engine reads. A value with a slash that
338
+ * is not an absolute path (the combo control's known choices) is a repo the
339
+ * deploy step downloads into the model directory; an already-local path is
340
+ * left as-is. The download is best-effort: a template that is already on
341
+ * disk is used without a re-fetch, and a missing hf CLI leaves the flag
342
+ * untouched so the engine reports the missing template itself.
343
+ */
344
+ async resolveChatTemplate(plan, log) {
345
+ const argv = plan.argv;
346
+ if (argv === undefined)
347
+ return { ok: true };
348
+ const index = argv.indexOf('--chat-template');
349
+ if (index === -1)
350
+ return { ok: true };
351
+ const value = argv[index + 1];
352
+ if (value === undefined)
353
+ return { ok: true };
354
+ // An absolute path (a leading /) is already local; a value with no slash
355
+ // is a bare file name the engine resolves against its own directory.
356
+ if (value.startsWith('/') || !value.includes('/'))
357
+ return { ok: true };
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();
373
+ // A template already on disk skips the re-fetch; the hf CLI is optional,
374
+ // so a download failure is reported but does not abort the launch.
375
+ if (localPath === null) {
376
+ const download = await auditRun(this.host, hfChatTemplateCommand(value, baseDir, useHubCache), log);
377
+ if (!download.ok) {
378
+ return {
379
+ ok: false,
380
+ detail: `chat template download failed: ${download.detail ?? 'unknown'}`,
381
+ };
382
+ }
383
+ localPath = resolvePath();
384
+ if (localPath === null) {
385
+ return { ok: false, detail: 'chat template download failed' };
386
+ }
387
+ }
388
+ argv[index + 1] = localPath;
389
+ return { ok: true };
390
+ }
391
+ }
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
@@ -0,0 +1,37 @@
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 { SYSTEM_DEPS } from "../../systemDeps.js";
10
+ export const NINFER_LINUX = {
11
+ buildSteps: [
12
+ 'cmake -S {dir} -B {dir}/build -G Ninja -DCMAKE_BUILD_TYPE=Release && cmake --build {dir}/build -j',
13
+ ],
14
+ buildDir: 'build',
15
+ binary: 'ninfer-serve',
16
+ // The Linux local build needs the compile toolchain (cmake, ninja), the
17
+ // ffmpeg and curl dev libraries (pkg-config, ffmpeg, curl), the CUDA
18
+ // toolkit, and the hf CLI to download the model.
19
+ deps: [
20
+ SYSTEM_DEPS.cmake,
21
+ SYSTEM_DEPS.ninja,
22
+ SYSTEM_DEPS.pkgConfig,
23
+ SYSTEM_DEPS.ffmpeg,
24
+ SYSTEM_DEPS.curl,
25
+ SYSTEM_DEPS.cudaToolkit,
26
+ SYSTEM_DEPS.hfCli,
27
+ ],
28
+ };
29
+ /**
30
+ * ninferLinuxBinary returns the NInfer engine binary name on Linux: the plain
31
+ * `ninfer-serve` (no .exe). The name comes from the shared Linux profile, so
32
+ * the spelling has one home.
33
+ */
34
+ export function ninferLinuxBinary() {
35
+ return NINFER_LINUX.binary ?? 'ninfer-serve';
36
+ }
37
+ //# sourceMappingURL=ninferLinux.js.map
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The NInfer macOS build profile. macOS builds NInfer through the same cmake
3
+ * route as Linux, so this profile reuses the shared Linux build steps and
4
+ * build directory; the binary keeps its plain name (no .exe on macOS).
5
+ * @module dsh-plugin-local-infer/providers/engines/ninfer/ninferMacOS
6
+ */
7
+ import type { EngineOsProfile } from '../engineOs.ts';
8
+ export declare const NINFER_MACOS: EngineOsProfile;
9
+ /**
10
+ * ninferMacOSBinary returns the NInfer engine binary name on macOS: the plain
11
+ * `ninfer-serve` (no .exe on macOS). The name comes from the shared Linux
12
+ * profile the macOS profile reuses, so the spelling has one home.
13
+ */
14
+ export declare function ninferMacOSBinary(): string;
15
+ //# sourceMappingURL=ninferMacOS.d.ts.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The NInfer macOS build profile. macOS builds NInfer through the same cmake
3
+ * route as Linux, so this profile reuses the shared Linux build steps and
4
+ * build directory; the binary keeps its plain name (no .exe on macOS).
5
+ * @module dsh-plugin-local-infer/providers/engines/ninfer/ninferMacOS
6
+ */
7
+ import { NINFER_LINUX } from "./ninferLinux.js";
8
+ export const NINFER_MACOS = NINFER_LINUX;
9
+ /**
10
+ * ninferMacOSBinary returns the NInfer engine binary name on macOS: the plain
11
+ * `ninfer-serve` (no .exe on macOS). The name comes from the shared Linux
12
+ * profile the macOS profile reuses, so the spelling has one home.
13
+ */
14
+ export function ninferMacOSBinary() {
15
+ return NINFER_MACOS.binary ?? 'ninfer-serve';
16
+ }
17
+ //# sourceMappingURL=ninferMacOS.js.map
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The NInfer Windows build profile. The Windows route is the ninfer-all fork's
3
+ * vcpkg build: the manifest pulls the dev libraries, then the engine's own
4
+ * build-native.bat configures and builds. The step cds into the checkout first
5
+ * (the {dir} placeholder), because vcpkg install and the relative script path
6
+ * both resolve against the checkout root.
7
+ *
8
+ * The build leaves the engine binary in the Windows build tree, not the Linux
9
+ * build directory: the vcpkg route writes ninfer-serve.exe into
10
+ * build-windows\apps\Release, so the launch step reads the binary from that
11
+ * directory, not from the shared Linux build directory. The launch binary is
12
+ * the path relative to the checkout root (the engine directory the spawn runs
13
+ * in), so the spawn resolves it against the default or override engine dir.
14
+ * @module dsh-plugin-local-infer/providers/engines/ninfer/ninferWindows
15
+ */
16
+ import type { EngineOsProfile } from '../engineOs.ts';
17
+ export declare const NINFER_WINDOWS: EngineOsProfile;
18
+ /**
19
+ * ninferWindowsBinary returns the NInfer launch binary on Windows: the path
20
+ * relative to the checkout root (the engine directory the spawn runs in) where
21
+ * the vcpkg build-native route writes the Release binary,
22
+ * `build-windows/apps/Release/ninfer-serve.exe`. The directory and the .exe
23
+ * name both come from the Windows profile, so the build tree and the spelling
24
+ * have one home. `join` keeps the result cross-platform: the host's path module
25
+ * normalizes the separators, so the spawn resolves it on Windows, Linux, and
26
+ * macOS alike.
27
+ */
28
+ export declare function ninferWindowsBinary(): string;
29
+ //# sourceMappingURL=ninferWindows.d.ts.map
@@ -0,0 +1,59 @@
1
+ /**
2
+ * The NInfer Windows build profile. The Windows route is the ninfer-all fork's
3
+ * vcpkg build: the manifest pulls the dev libraries, then the engine's own
4
+ * build-native.bat configures and builds. The step cds into the checkout first
5
+ * (the {dir} placeholder), because vcpkg install and the relative script path
6
+ * both resolve against the checkout root.
7
+ *
8
+ * The build leaves the engine binary in the Windows build tree, not the Linux
9
+ * build directory: the vcpkg route writes ninfer-serve.exe into
10
+ * build-windows\apps\Release, so the launch step reads the binary from that
11
+ * directory, not from the shared Linux build directory. The launch binary is
12
+ * the path relative to the checkout root (the engine directory the spawn runs
13
+ * in), so the spawn resolves it against the default or override engine dir.
14
+ * @module dsh-plugin-local-infer/providers/engines/ninfer/ninferWindows
15
+ */
16
+ import { join } from 'node:path';
17
+ import { SYSTEM_DEPS } from "../../systemDeps.js";
18
+ export const NINFER_WINDOWS = {
19
+ buildSteps: [
20
+ '$env:PATH="C:\\Program Files\\Microsoft Visual Studio\\18\\Community\\VC\\vcpkg;$env:PATH"; $env:NINFER_VCPKG_ROOT="C:\\Program Files\\Microsoft Visual Studio\\18\\Community\\VC\\vcpkg"; cd {dir} && vcpkg install && .\\scripts\\build-native.bat configure && .\\scripts\\build-native.bat build && .\\scripts\\build-native.bat build',
21
+ ],
22
+ // The vcpkg build-native route writes the Release binary into the Windows
23
+ // build tree, not the Linux build directory the shared route uses. The
24
+ // separators are forward slashes (valid on every platform) so the directory
25
+ // joins cross-platform; the host's path module normalizes them on use.
26
+ buildDir: 'build-windows/apps/Release',
27
+ binary: 'ninfer-serve.exe',
28
+ // pwsh.exe (PowerShell 7+) is the modern shell the vcpkg build tooling
29
+ // expects; the legacy powershell.exe (Windows PowerShell 5.1) lacks it.
30
+ shell: 'pwsh.exe',
31
+ // The Windows local build is the vcpkg route: the winget toolchain (CMake,
32
+ // Ninja, the MSVC compiler, the CUDA toolkit) plus the hf CLI and git. The
33
+ // vcpkg manifest pulls the ffmpeg and curl dev libraries, so the Linux
34
+ // pkg-config/ffmpeg/curl deps do not ride the Windows list.
35
+ deps: [
36
+ SYSTEM_DEPS.cmake,
37
+ SYSTEM_DEPS.ninja,
38
+ SYSTEM_DEPS.visualStudio,
39
+ SYSTEM_DEPS.cudaToolkit,
40
+ SYSTEM_DEPS.hfCli,
41
+ SYSTEM_DEPS.git,
42
+ ],
43
+ };
44
+ /**
45
+ * ninferWindowsBinary returns the NInfer launch binary on Windows: the path
46
+ * relative to the checkout root (the engine directory the spawn runs in) where
47
+ * the vcpkg build-native route writes the Release binary,
48
+ * `build-windows/apps/Release/ninfer-serve.exe`. The directory and the .exe
49
+ * name both come from the Windows profile, so the build tree and the spelling
50
+ * have one home. `join` keeps the result cross-platform: the host's path module
51
+ * normalizes the separators, so the spawn resolves it on Windows, Linux, and
52
+ * macOS alike.
53
+ */
54
+ export function ninferWindowsBinary() {
55
+ const binary = NINFER_WINDOWS.binary ?? 'ninfer-serve.exe';
56
+ const buildDir = NINFER_WINDOWS.buildDir;
57
+ return buildDir !== undefined ? join(buildDir, binary) : binary;
58
+ }
59
+ //# sourceMappingURL=ninferWindows.js.map