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
@@ -1,38 +1,31 @@
1
1
  /**
2
- * The concrete engine adapters: NInfer (docker and local) and Hyper-Qwen
3
- * (compose). Each composes the provider `ParameterSpec` data into a
4
- * `LaunchPlan` and drives its deploy, health-check, and stop steps through an
5
- * injectable `LifecycleHost`, so the tests stub the host and never run a real
6
- * build, docker, or network in CI. The node implementation
7
- * (`nodeLifecycleHost`) is what the service wires in on a live host.
2
+ * The shared engine-adapter helpers: the spec-to-argv and spec-to-env
3
+ * translators the concrete adapters (the `engines/<engine>/<engine>Adapter.ts`
4
+ * files) compose
5
+ * into a `LaunchPlan`, the card's Custom Arguments translators, the
6
+ * `LifecycleHost` the deploy, health-check, and stop steps drive, and the
7
+ * health poll. The node implementation (`nodeLifecycleHost`) is what the
8
+ * service wires in on a live host.
8
9
  * @module dsh-plugin-local-infer/providers/adapters
9
10
  */
10
- import { EngineAdapter } from '../../core/lib/index.js';
11
- import type { Config, DebugLogger, DeployOptions, DeployResult, EngineLaunchSignature, EnginePlatformConfig, HealthCheckOptions, HealthResult, HardwareProfile, LaunchPlan, LaunchProgress, LifecycleHost, ParameterSpec } from '../../core/lib/index.js';
12
- export { INFERNIX_MODEL_ARTIFACTS } from './infernix.ts';
11
+ import type { CommandLogger, CommandOutcome, Config, DebugLogger, HealthCheckOptions, HealthResult, LaunchPlan, LifecycleHost, ParameterDeploy, ParameterSpec, ProcessHandle, RunOptions } from '../../core/lib/index.js';
13
12
  /**
14
- * NInferModelArtifact is the per-model deploy data: the `.ninfer` artifact
15
- * file, the Hugging Face repo the model download pulls it from, and the
16
- * `--model-id` alias the server advertises. The data is the surface; adding a
17
- * model is a data edit here, never an adapter rewire.
13
+ * deployTargets normalizes a spec's `deploy` declaration into a target list: a
14
+ * single target wraps in a one-element list, a list passes through, and an
15
+ * absent `deploy` reads as an empty list (the un-migrated fallback). The
16
+ * spec-to-spelling helpers key off this list, so a multi-target spec
17
+ * (cli + env, the Strata shared specs) contributes to every matching helper.
18
18
  */
19
- export interface NInferModelArtifact {
20
- file: string;
21
- repo: string;
22
- modelId: string;
23
- }
24
- /**
25
- * The NInfer model artifacts, keyed by the model registry id. The 27B entry
26
- * is the default the DEFAULT_MODELS list names; the 35B-A3B entries are the
27
- * Qwen3.8 measured artifact (`qwen3-35b`) and the Qwen3.6 default
28
- * (`qwen36-35b`).
29
- */
30
- export declare const NINFER_MODEL_ARTIFACTS: Record<string, NInferModelArtifact>;
19
+ export declare function deployTargets(spec: ParameterSpec): readonly ParameterDeploy[];
31
20
  /**
32
21
  * flagsFromSpecs turns a spec surface and a config into the CLI flag list: each
33
22
  * spec's `toArgv` runs over the config value (falling back to the spec
34
23
  * default), and empty results are skipped. A spec with no `toArgv` contributes
35
- * nothing.
24
+ * nothing. A declared `deploy` target gates the spelling: a `cli` target in the
25
+ * spec's target list (or no target, the un-migrated fallback that reads the
26
+ * `toArgv` presence) spells CLI flags, so a spec that deploys only to the env
27
+ * or a config file contributes no flag even when it carries a `toArgv`
28
+ * spelling.
36
29
  */
37
30
  export declare function flagsFromSpecs(specs: readonly ParameterSpec[], config: Config): string[];
38
31
  /**
@@ -55,20 +48,72 @@ export declare function customArgFlags(config: Config): string[];
55
48
  export declare function customArgEnv(config: Config): Record<string, string>;
56
49
  /**
57
50
  * envFromSpecs turns a spec surface and a config into the environment map: each
58
- * spec's `toEnv` runs over the config value (falling back to the spec
59
- * default). A spec with no `toEnv` contributes nothing.
51
+ * spec's `toEnv` runs over the config value (falling back to the spec default).
52
+ * A spec with no `toEnv` contributes nothing. A declared `deploy` target gates
53
+ * the spelling: an `env` target in the spec's target list (or no target, the
54
+ * un-migrated fallback that reads the `toEnv` presence) spells env vars, so a
55
+ * spec that deploys only to the CLI or a config file contributes no var even
56
+ * when it carries a `toEnv` spelling.
60
57
  */
61
58
  export declare function envFromSpecs(specs: readonly ParameterSpec[], config: Config): Record<string, string>;
59
+ /**
60
+ * ConfigFileFormat is the on-disk format a `config` deploy target renders to:
61
+ * JSON (the built-in stringify), a flat `.env` file, or YAML.
62
+ */
63
+ export type ConfigFileFormat = 'json' | 'yaml' | 'env';
64
+ /**
65
+ * configFileFromSpecs turns a spec surface and a config into the content of the
66
+ * config file the deploy step writes: every spec whose target list carries a
67
+ * `config` target resolves its value (`toConfig(value) ?? value`, falling back
68
+ * to the spec default) and nests it under that target's `block` / `key` (the
69
+ * key defaults to the spec key), then the result renders in the requested
70
+ * format. A spec with no `deploy`, or no `config` target, contributes nothing.
71
+ *
72
+ * A `block` ending in `[]` (e.g. `models[]`) follows the array-entry
73
+ * convention: the key lands inside the single object of a one-element array
74
+ * named by the prefix, and every spec sharing that block merges into that one
75
+ * entry. A plain block name nests as before, into one top-level object.
76
+ *
77
+ * A spec that carries both a `config` and a `cli` target contributes nothing
78
+ * here: the launch spells the CLI flag and leaves the on-disk config file (and
79
+ * any hand edits in it) untouched. Only a spec whose sole deploy path is the
80
+ * config file writes it.
81
+ *
82
+ * The YAML format loads the `yaml` package lazily (a root devDependency, so the
83
+ * JSON and env paths never touch it at runtime); a missing package throws only
84
+ * when the YAML format is requested.
85
+ */
86
+ export declare function configFileFromSpecs(specs: readonly ParameterSpec[], config: Config, format: ConfigFileFormat): string;
87
+ /**
88
+ * SudoHook is the optional sudo wiring createNodeLifecycleHost takes: `notify`
89
+ * announces a guarded command the probe found waiting for a password on the
90
+ * launching CLI (the service's sudo observer turns it into the Logs note), and
91
+ * `timeoutMs` overrides the 60 s password deadline. A host built without the
92
+ * hook never probes, announces, or caps a run.
93
+ */
94
+ export interface SudoHook {
95
+ notify: (command: string) => void;
96
+ timeoutMs?: number;
97
+ }
62
98
  /**
63
99
  * createNodeLifecycleHost builds the node `LifecycleHost`: `run` through the
64
100
  * system shell (a 10-minute cap, so a hung CUDA build cannot hang the panel),
65
- * `spawn` a detached child the stop step can signal, and `fetch` the health
66
- * URL. A fetch that throws (no route, connection refused) reads as status 0,
101
+ * `spawn` a detached child the stop step can signal, `writeFile` the config
102
+ * file the deploy step renders (creating the parent directory), and `fetch`
103
+ * the health URL. A fetch that throws (no route, connection refused) reads as status 0,
67
104
  * which the poll treats as not-ready. When `debug` is provided, the host logs
68
105
  * every command it issues (each `run` line and each `spawn` argv) through it,
69
- * so a DSH debug-mode host captures the full build-to-launch sequence.
70
- */
71
- export declare function createNodeLifecycleHost(debug?: DebugLogger): LifecycleHost;
106
+ * so a DSH debug-mode host captures the full build-to-launch sequence. A
107
+ * `RunOptions.shell` (the engine OS profile's shell, e.g. pwsh.exe for
108
+ * the Windows vcpkg route) runs the command line in that shell instead of the
109
+ * system default. A `RunOptions.graceMs` overrides the 5 s SIGTERM escalation
110
+ * window of the abort path for that run. The optional `sudo` hook wires the
111
+ * sudo-prompt rule: a run whose `RunOptions.needsSudo` declares sudo probes
112
+ * cached credentials first, announces a waiting prompt through the hook once,
113
+ * and dies at the password deadline with the `sudoFailureDetail` outcome. A
114
+ * host built without the hook never probes, announces, or caps a run.
115
+ */
116
+ export declare function createNodeLifecycleHost(debug?: DebugLogger, sudo?: SudoHook): LifecycleHost;
72
117
  /**
73
118
  * nodeLifecycleHost is the default live host the service wires in: the node
74
119
  * implementation with no debug logger, so a normal (non-debug) run logs no
@@ -76,194 +121,83 @@ export declare function createNodeLifecycleHost(debug?: DebugLogger): LifecycleH
76
121
  * in debug mode.
77
122
  */
78
123
  export declare const nodeLifecycleHost: LifecycleHost;
124
+ /**
125
+ * trackChild stores a spawned handle in the adapter's children map and ties
126
+ * the entry's lifetime to the child's: when the child ends (a crash, a pkill,
127
+ * or the adapter's own stop kill) the entry is dropped, so a later stop never
128
+ * signals a pid a recycled process has taken over. A handle whose host cannot
129
+ * watch (onExit absent) stays tracked until stop removes it.
130
+ */
131
+ export declare function trackChild(children: Map<string, ProcessHandle>, key: string, handle: ProcessHandle): void;
132
+ /**
133
+ * resolveLaunchArgv resolves a plan's launch argv against the engine
134
+ * directory the spawn runs in: a relative path that carries a separator (a
135
+ * build-tree binary, the NInfer Windows tree) is joined into an absolute
136
+ * path, and a bare name (a binary on the path after the rebuild's symlink
137
+ * step) is left as-is, so the spawn resolves the right command on every
138
+ * platform.
139
+ */
140
+ export declare function resolveLaunchArgv(engineDir: string | undefined, argv: readonly string[] | undefined): string[];
141
+ /**
142
+ * auditRun runs one mutating host command through the run's log sink: the
143
+ * `$ <command>` line reaches the sink before the child spawns, and the
144
+ * outcome's success output tail reaches it after the child settles, so the
145
+ * launch or stop run reads the command ahead of its result (the URL-query
146
+ * rule applied to execs: line first, settled outcome after). No sink (a
147
+ * headless call) and the command runs as before. A failed outcome lands no
148
+ * output here: the caller's own failure line carries the detail's output
149
+ * tail. The deploy and stop steps share this one audit rule for their direct
150
+ * `host.run` calls; the git and build steps run through the acquire step's
151
+ * own command-first echo.
152
+ */
153
+ export declare function auditRun(host: LifecycleHost, command: string, log?: CommandLogger, options?: RunOptions): Promise<CommandOutcome>;
154
+ /**
155
+ * stopProcessPlan signals the engine process a stop targets when the adapter
156
+ * tracks no child handle for it: an engine a DSH restart re-adopted from a
157
+ * stored launch record carries no in-memory handle, so the stop signals the
158
+ * pid the record stamped on the plan (kill on Linux and macOS, taskkill on a
159
+ * Windows plan). The optional `log` is the stop run's log sink: the signal
160
+ * command's `$ <command>` line reaches it before the child runs. A plan that
161
+ * names no pid is a no-op (nothing to signal), and a kill the host reports as
162
+ * failed throws with the host's detail, so the stop route names the broken
163
+ * step in the card's Logs section.
164
+ */
165
+ export declare function stopProcessPlan(host: LifecycleHost, plan: LaunchPlan, log?: CommandLogger): Promise<void>;
166
+ /**
167
+ * The health poll's defaults: the interval between attempts in ms and the
168
+ * attempt cap. The service passes the config's healthPollMs and
169
+ * healthMaxAttempts through, and an adapter that polls without options (or
170
+ * with a partial one) reads these, so the defaults have one home.
171
+ */
172
+ export declare const HEALTH_POLL_DEFAULT_MS = 1000;
173
+ export declare const HEALTH_POLL_MAX_ATTEMPTS = 120;
174
+ /**
175
+ * logHealthPoll brackets a health poll with the URL-query logging rule (the
176
+ * exec rule's URL twin): the one `> GET <url>` line reaches the run's log
177
+ * sink before the first request, the retries stay silent, and the settled
178
+ * verdict line (`> GET <url> ready`, Strata's still-downloading line, or the
179
+ * `!!` failure with the last detail) lands after the poll returns. The
180
+ * shared poll and the Strata poll both wrap their loop in this, so the rule
181
+ * has one home. `log` absent (a headless poll) runs the poll unlogged.
182
+ */
183
+ export declare function logHealthPoll(log: CommandLogger | undefined, url: string, poll: () => Promise<HealthResult>): Promise<HealthResult>;
79
184
  /**
80
185
  * pollHealth polls a plan's health URL until a 200 or the attempt cap, the
81
186
  * same loop the qwen-ninfer launcher runs. A poll interval of 0 skips the
82
- * delay, which the tests use to run the loop without a real sleep.
83
- */
84
- export declare function pollHealth(host: LifecycleHost, plan: LaunchPlan, options?: HealthCheckOptions): Promise<HealthResult>;
85
- /**
86
- * The NInfer docker image the adapter pulls and runs. The engineFork platform
87
- * config overrides the git source for a local build; the image stays the
88
- * upstream ghcr artifact.
89
- */
90
- export declare const NINFER_DOCKER_IMAGE = "ghcr.io/iamwavecut/ninfer-all";
91
- /**
92
- * NInferAdapter is the canonical both-capable engine. `renderLaunch` renders a
93
- * local `ninfer-serve` process or a `docker run` of the ghcr image from the
94
- * same spec surface; `deploy` builds the engine in the engine directory (or
95
- * pulls the image), downloads the model into the model directory, and starts
96
- * the engine; `healthCheck` polls the health URL; `stop` signals the tracked
97
- * process and stops the named container.
98
- */
99
- export declare class NInferAdapter extends EngineAdapter {
100
- readonly id = "ninfer";
101
- readonly supports: {
102
- docker: boolean;
103
- local: boolean;
104
- };
105
- private readonly host;
106
- private readonly children;
107
- constructor(host?: LifecycleHost);
108
- parameters(): readonly ParameterSpec[];
109
- modelRef(config: Config): {
110
- id: string;
111
- name: string;
112
- };
113
- launchSignature(config?: Config): EngineLaunchSignature;
114
- renderLaunch(config: Config, _hw: HardwareProfile): LaunchPlan;
115
- deploy(plan: LaunchPlan, platform?: EnginePlatformConfig, onProgress?: LaunchProgress, options?: DeployOptions): Promise<DeployResult>;
116
- healthCheck(plan: LaunchPlan, options?: HealthCheckOptions): Promise<HealthResult>;
117
- stop(plan: LaunchPlan): Promise<void>;
118
- private buildMode;
119
- private port;
120
- private planKey;
121
- private downloadModel;
122
- /**
123
- * resolveChatTemplate rewrites a --chat-template flag that carries an HF repo
124
- * reference into the local file the engine reads. A value with a slash that
125
- * is not an absolute path (the combo control's known choices) is a repo the
126
- * deploy step downloads into the model directory; an already-local path is
127
- * left as-is. The download is best-effort: a template that is already on
128
- * disk is used without a re-fetch, and a missing hf CLI leaves the flag
129
- * untouched so the engine reports the missing template itself.
130
- */
131
- private resolveChatTemplate;
132
- }
133
- /**
134
- * HyperQwenAdapter is the docker-compose engine. `renderLaunch` renders a
135
- * compose plan (the compose file, the profile, and the `.env` the spec surface
136
- * maps to); `deploy` runs `docker compose up`; `healthCheck` polls the health
137
- * URL; `stop` runs `docker compose down`.
138
- */
139
- export declare class HyperQwenAdapter extends EngineAdapter {
140
- readonly id = "hyperqwen";
141
- readonly supports: {
142
- docker: boolean;
143
- local: boolean;
144
- };
145
- private readonly host;
146
- constructor(host?: LifecycleHost);
147
- parameters(): readonly ParameterSpec[];
148
- modelRef(_config: Config): {
149
- id: string;
150
- name: string;
151
- };
152
- launchSignature(config?: Config): EngineLaunchSignature;
153
- renderLaunch(config: Config, _hw: HardwareProfile): LaunchPlan;
154
- deploy(plan: LaunchPlan, platform?: EnginePlatformConfig, onProgress?: LaunchProgress, _options?: DeployOptions): Promise<DeployResult>;
155
- healthCheck(plan: LaunchPlan, options?: HealthCheckOptions): Promise<HealthResult>;
156
- stop(plan: LaunchPlan): Promise<void>;
157
- private port;
158
- private profile;
159
- }
160
- /**
161
- * The llama.cpp docker image the adapter pulls and runs. The engineFork
162
- * platform config overrides the git source for a local build; the image stays
163
- * the upstream ggml artifact.
164
- */
165
- export declare const LLAMACPP_DOCKER_IMAGE = "ghcr.io/ggml-org/llama.cpp";
166
- /**
167
- * LlamaCppAdapter is the llama.cpp engine, both-capable like NInfer.
168
- * `renderLaunch` renders a local `llama-server` process or a `docker run` of the
169
- * ggml image from the same `LLAMACPP_PARAMETERS` surface; `deploy` builds the
170
- * engine in the engine directory (or pulls the image), downloads the GGUF model
171
- * into the model directory, and starts the engine; `healthCheck` polls the health
172
- * URL; `stop` signals the tracked process and stops the named container.
173
- */
174
- export declare class LlamaCppAdapter extends EngineAdapter {
175
- readonly id = "llamacpp";
176
- readonly supports: {
177
- docker: boolean;
178
- local: boolean;
179
- };
180
- private readonly host;
181
- private readonly children;
182
- constructor(host?: LifecycleHost);
183
- parameters(): readonly ParameterSpec[];
184
- modelRef(config: Config): {
185
- id: string;
186
- name: string;
187
- };
188
- launchSignature(config?: Config): EngineLaunchSignature;
189
- renderLaunch(config: Config, _hw: HardwareProfile): LaunchPlan;
190
- deploy(plan: LaunchPlan, platform?: EnginePlatformConfig, onProgress?: LaunchProgress, options?: DeployOptions): Promise<DeployResult>;
191
- healthCheck(plan: LaunchPlan, options?: HealthCheckOptions): Promise<HealthResult>;
192
- stop(plan: LaunchPlan): Promise<void>;
193
- private buildMode;
194
- private port;
195
- private planKey;
196
- private downloadModel;
197
- }
198
- /**
199
- * The Strata docker image the adapter pulls and runs. Strata is the
200
- * placeholder engine: the image and the parameter data land when the engine
201
- * is available, and the adapter renders a bare docker plan until then.
202
- */
203
- export declare const STRATA_DOCKER_IMAGE = "ghcr.io/strata/strata";
204
- /**
205
- * StrataAdapter is the placeholder docker-only engine. `renderLaunch` renders
206
- * a `docker run` of the Strata image (no spec surface yet, so no flags);
207
- * `deploy` pulls the image and starts the container; `healthCheck` polls the
208
- * health URL; `stop` stops the named container. The parameter surface and the
209
- * per-model data land with the engine, as data edits, never an adapter rewire.
210
- */
211
- export declare class StrataAdapter extends EngineAdapter {
212
- readonly id = "strata";
213
- readonly supports: {
214
- docker: boolean;
215
- local: boolean;
216
- };
217
- private readonly host;
218
- private readonly children;
219
- constructor(host?: LifecycleHost);
220
- parameters(): readonly ParameterSpec[];
221
- modelRef(_config: Config): {
222
- id: string;
223
- name: string;
224
- };
225
- launchSignature(config?: Config): EngineLaunchSignature;
226
- renderLaunch(config: Config, _hw: HardwareProfile): LaunchPlan;
227
- deploy(plan: LaunchPlan, _platform?: EnginePlatformConfig, onProgress?: LaunchProgress, _options?: DeployOptions): Promise<DeployResult>;
228
- healthCheck(plan: LaunchPlan, options?: HealthCheckOptions): Promise<HealthResult>;
229
- stop(plan: LaunchPlan): Promise<void>;
230
- private port;
231
- private planKey;
232
- }
233
- /**
234
- * InfernixAdapter is the local-only engine for Infernix, the C++/CUDA fork
235
- * of NInfer (https://github.com/wallawalla47/infernix) tuned for Qwen models
236
- * on a single RTX 50-series GPU. `renderLaunch` renders a local
237
- * `infernix-serve` process from the `INFERNIX_PARAMETERS` surface (the
238
- * Infernix-only fields, from `--ngram-volume` to the quality routes, spell
239
- * onto the argv only for this engine); `deploy` builds the engine in the
240
- * engine directory (the engine's own cmake preset), downloads the model
241
- * artifact (and the n-gram volume, for the multi-file Flash-Next repo) into
242
- * the model directory, and starts the engine; `healthCheck` polls the health
243
- * URL; `stop` signals the tracked process. The engine ships no docker image,
244
- * so the adapter supports the local build mode only.
245
- */
246
- export declare class InfernixAdapter extends EngineAdapter {
247
- readonly id = "infernix";
248
- readonly supports: {
249
- docker: boolean;
250
- local: boolean;
251
- };
252
- private readonly host;
253
- private readonly children;
254
- constructor(host?: LifecycleHost);
255
- parameters(): readonly ParameterSpec[];
256
- modelRef(config: Config): {
257
- id: string;
258
- name: string;
259
- };
260
- launchSignature(config?: Config): EngineLaunchSignature;
261
- renderLaunch(config: Config, _hw: HardwareProfile): LaunchPlan;
262
- deploy(plan: LaunchPlan, platform?: EnginePlatformConfig, onProgress?: LaunchProgress, options?: DeployOptions): Promise<DeployResult>;
263
- healthCheck(plan: LaunchPlan, options?: HealthCheckOptions): Promise<HealthResult>;
264
- stop(plan: LaunchPlan): Promise<void>;
265
- private port;
266
- private planKey;
267
- private downloadModel;
268
- }
269
- //# sourceMappingURL=adapters.d.ts.map
187
+ * delay, which the tests use to run the loop without a real sleep. `handle`
188
+ * is the tracked child the deploy step spawned: when it reports it has
189
+ * exited (hasExited true), the poll ends immediately with a failed result
190
+ * instead of running the full attempt cap, so a crash reports at once. A
191
+ * handle that cannot report its exit state (a stub) keeps the full poll.
192
+ * The poll's URL logging (the one `> GET` line ahead of the settled verdict)
193
+ * rides the shared logHealthPoll wrap when options.onLog carries the run's
194
+ * log sink.
195
+ */
196
+ export declare function pollHealth(host: LifecycleHost, plan: LaunchPlan, options?: HealthCheckOptions, handle?: ProcessHandle): Promise<HealthResult>;
197
+ /**
198
+ * delay waits `ms` milliseconds. The health polls use it between attempts; a
199
+ * poll interval of 0 skips the wait, which the tests use to run the loop
200
+ * without a real sleep.
201
+ */
202
+ export declare function delay(ms: number): Promise<void>;
203
+ //# sourceMappingURL=adapters.d.ts.map