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.
Files changed (250) hide show
  1. package/README.md +22 -4
  2. package/cordis.patch.yml +7 -0
  3. package/docs/zh/README.md +14 -2
  4. package/dsh/client.js +4195 -4522
  5. package/package.json +28 -11
  6. package/packages/core/lib/adapter.d.ts +133 -9
  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 +44 -17
  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 +20 -9
  41. package/packages/core/lib/registrar.js +27 -7
  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 +92 -14
  59. package/packages/providers/lib/acquire.js +215 -37
  60. package/packages/providers/lib/adapters.d.ts +136 -12
  61. package/packages/providers/lib/adapters.js +597 -70
  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 +27 -230
  65. package/packages/providers/lib/deps.js +61 -214
  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/engines/{hyperqwen.d.ts → hyperqwen/hyperqwen.d.ts} +2 -2
  79. package/packages/providers/lib/engines/{hyperqwen.js → hyperqwen/hyperqwen.js} +14 -2
  80. package/packages/providers/lib/engines/{hyperqwenAdapter.d.ts → hyperqwen/hyperqwenAdapter.d.ts} +6 -6
  81. package/packages/providers/lib/engines/{hyperqwenAdapter.js → hyperqwen/hyperqwenAdapter.js} +24 -14
  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/engines/{infernix.d.ts → infernix/infernix.d.ts} +7 -4
  95. package/packages/providers/lib/engines/{infernix.js → infernix/infernix.js} +52 -7
  96. package/packages/providers/lib/engines/{infernixAdapter.d.ts → infernix/infernixAdapter.d.ts} +5 -6
  97. package/packages/providers/lib/engines/{infernixAdapter.js → infernix/infernixAdapter.js} +75 -42
  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/engines/{llamacpp.d.ts → llamacpp/llamacpp.d.ts} +2 -2
  111. package/packages/providers/lib/engines/{llamacpp.js → llamacpp/llamacpp.js} +12 -2
  112. package/packages/providers/lib/engines/{llamacppAdapter.d.ts → llamacpp/llamacppAdapter.d.ts} +5 -6
  113. package/packages/providers/lib/engines/{llamacppAdapter.js → llamacpp/llamacppAdapter.js} +87 -45
  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/engines/{ninfer.d.ts → ninfer/ninfer.d.ts} +2 -2
  127. package/packages/providers/lib/engines/{ninfer.js → ninfer/ninfer.js} +24 -2
  128. package/packages/providers/lib/engines/{ninferAdapter.d.ts → ninfer/ninferAdapter.d.ts} +5 -6
  129. package/packages/providers/lib/engines/{ninferAdapter.js → ninfer/ninferAdapter.js} +123 -55
  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.js → strata/strata.js} +70 -3
  144. package/packages/providers/lib/engines/{strataAdapter.d.ts → strata/strataAdapter.d.ts} +5 -6
  145. package/packages/providers/lib/engines/{strataAdapter.js → strata/strataAdapter.js} +147 -111
  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 +7 -5
  159. package/packages/providers/lib/engines.js +21 -10
  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 -29
  163. package/packages/providers/lib/index.js +45 -33
  164. package/packages/providers/lib/model-defaults.d.ts +5 -1
  165. package/packages/providers/lib/model-defaults.js +25 -1
  166. package/packages/providers/lib/platform.d.ts +8 -5
  167. package/packages/providers/lib/platform.js +23 -9
  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 +176 -21
  176. package/packages/service/lib/index.js +589 -86
  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 +163 -6
  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 +12 -2
  188. package/packages/ui/lib/config.js +18 -2
  189. package/packages/ui/lib/deps.d.ts +1 -1
  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 +142 -34
  198. package/packages/ui/lib/ops/engine.js +469 -265
  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 +26 -11
  202. package/packages/ui/lib/ops/hf.js +115 -25
  203. package/packages/ui/lib/ops/logs.d.ts +70 -15
  204. package/packages/ui/lib/ops/logs.js +96 -35
  205. package/packages/ui/lib/ops/model.d.ts +2 -10
  206. package/packages/ui/lib/ops/model.js +9 -16
  207. package/packages/ui/lib/request.d.ts +1 -1
  208. package/packages/ui/lib/request.js +1 -1
  209. package/packages/ui/lib/route.d.ts +22 -6
  210. package/packages/ui/lib/route.js +32 -9
  211. package/packages/ui/lib/routes/chat-template.d.ts +1 -14
  212. package/packages/ui/lib/routes/chat-template.js +1 -37
  213. package/packages/ui/lib/routes/deps.d.ts +1 -16
  214. package/packages/ui/lib/routes/deps.js +1 -27
  215. package/packages/ui/lib/routes/download.d.ts +1 -16
  216. package/packages/ui/lib/routes/download.js +1 -48
  217. package/packages/ui/lib/routes/get.d.ts +1 -18
  218. package/packages/ui/lib/routes/get.js +66 -17
  219. package/packages/ui/lib/routes/install.d.ts +1 -1
  220. package/packages/ui/lib/routes/install.js +1 -1
  221. package/packages/ui/lib/routes/launch.d.ts +13 -7
  222. package/packages/ui/lib/routes/launch.js +33 -9
  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 +1 -1
  226. package/packages/ui/lib/routes/provider-delete.js +1 -1
  227. package/packages/ui/lib/routes/register.d.ts +1 -1
  228. package/packages/ui/lib/routes/register.js +1 -1
  229. package/packages/ui/lib/routes/save.d.ts +1 -1
  230. package/packages/ui/lib/routes/save.js +22 -2
  231. package/packages/ui/lib/routes/stop.d.ts +7 -4
  232. package/packages/ui/lib/routes/stop.js +7 -4
  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 +1 -1
  236. package/packages/ui/lib/routes/summary.js +1 -1
  237. package/packages/ui/lib/routes/unregister.d.ts +1 -1
  238. package/packages/ui/lib/routes/unregister.js +1 -1
  239. package/packages/ui/lib/viewmodels/deps.d.ts +1 -31
  240. package/packages/ui/lib/viewmodels/deps.js +1 -89
  241. package/packages/ui/lib/viewmodels/depsHelpers.d.ts +1 -28
  242. package/packages/ui/lib/viewmodels/depsHelpers.js +72 -11
  243. package/packages/ui/lib/viewmodels/summary.d.ts +7 -2
  244. package/packages/ui/lib/viewmodels/summary.js +55 -35
  245. package/packages/ui/lib/viewmodels/summaryHelpers.d.ts +1 -1
  246. package/packages/ui/lib/viewmodels/summaryHelpers.js +1 -1
  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/engines/strata.d.ts +0 -53
@@ -5,29 +5,90 @@
5
5
  * re-check, so the "Get" gate opens only after a re-check passes.
6
6
  * @module dsh-plugin-local-infer/ui/viewmodels/depsHelpers
7
7
  */
8
+ import { SUDO_CLI_NOTE } from '../../../core/lib/index.js';
9
+ import { runLogKey } from '../../../service/lib/index.js';
8
10
  import { readConfig } from "../config.js";
11
+ import { captureRunBaseline, finishRunSection, INSTALL_RUN_SEED } from "../ops/logs.js";
12
+ import { registerSudoObserver } from "../ops/engine.js";
9
13
  import { RouteError } from "../route.js";
10
14
  import { buildDeps } from "./deps.js";
11
15
  /**
12
16
  * runInstallFor is the Play/Run path: it refuses with a 409 while the
13
17
  * trust gate is off (the copy/paste path is always the fallback), runs the
14
18
  * install through the service, and refreshes the deps model from the
15
- * re-check, so the "Get" gate opens only after a re-check passes.
19
+ * re-check, so the "Get" gate opens only after a re-check passes. A run that
20
+ * actually starts brackets one live hub run under the runLogKey rule (the
21
+ * stored entry matching the engine and model, else the engine id): the seed
22
+ * is the "Installing deps..." separator, the service writes each install
23
+ * command's `$ <command>` line into the run (through onLog) before its child
24
+ * spawns, each per-dep install result appends in the Get step's
25
+ * ` <id>: <status>` shape, and the run ends at settle, a throwing install
26
+ * included. The settle text also folds through the shared run-section persister
27
+ * (finishRunSection over the pre-run baseline), so the last install run
28
+ * survives a card reload in the stored last-run logs and the log file, like
29
+ * the other provider processes; the baseline close keeps the sudo note the
30
+ * observer persists mid-run from landing twice. The run registers the sudo
31
+ * hook the launch and Get paths register, so a guarded dependency install
32
+ * waiting for a password on the CLI lands the shared SUDO_CLI_NOTE line in
33
+ * the live run and the persisted run. A 409 refusal starts no run.
16
34
  */
17
35
  export async function runInstallFor(localInfer, request) {
18
- if (readConfig().allowRunDeps !== true) {
36
+ const stored = readConfig();
37
+ if (stored.allowRunDeps !== true) {
19
38
  throw new RouteError(409, 'one-click install is not allowed; copy the install string instead');
20
39
  }
21
40
  const model = await buildDeps(localInfer, request);
22
41
  const hardware = await localInfer.detectHardware();
23
- const result = await localInfer.runInstall(model.engineId, model.buildMode, hardware);
24
- const deps = model.deps.map((dep) => {
25
- const entry = result.results.find((entry) => entry.id === dep.id);
26
- return entry === undefined ? dep : { ...dep, status: entry.status };
27
- });
28
- return {
29
- result,
30
- deps: { ...model, deps, allSatisfied: result.ok },
42
+ const runKey = runLogKey(stored.providers, model.engineId, undefined, request.config ?? stored.config);
43
+ // The install run owns a sudo hook under its run key (the shared
44
+ // registerSudoObserver wiring): a guarded install waiting on the CLI writes
45
+ // the core CLI note into the live hub and, through persistProcessLog inside
46
+ // the helper, into the persisted run and log file, so a hung install reads
47
+ // where the prompt landed. The disposer clears only this run's slot.
48
+ // One append feeds both readers: the live hub run and the run's collected
49
+ // settle text (persisted at the finally), no second copy of the text.
50
+ let collected = '';
51
+ const append = (line) => {
52
+ collected += line;
53
+ localInfer.appendRunLog(runKey, line);
31
54
  };
55
+ const clearSudoObserver = registerSudoObserver(localInfer, runKey, `${SUDO_CLI_NOTE}\n`, append);
56
+ // The stored last-run logs as they stand before the run persists anything:
57
+ // the sudo observer persists its note while the run hangs on the prompt,
58
+ // and finishRunSection closes the run over the baseline so that provisional
59
+ // line and the collected run text persist once (the Get route's pattern).
60
+ const baseline = captureRunBaseline();
61
+ localInfer.beginRun(runKey, INSTALL_RUN_SEED);
62
+ try {
63
+ const result = await localInfer.runInstall(model.engineId, model.buildMode, hardware, {
64
+ // Each install command's `$ <command>` line reaches the live hub and the
65
+ // collected run before the guarded runner spawns the child, so the run
66
+ // reads the command ahead of the per-dep results below.
67
+ onLog: append,
68
+ });
69
+ // The per-dep results stream as the re-check reported them, in the same
70
+ // indented shape the Get step's dep block logs, so both readers (the
71
+ // live buffer and, later, a re-rendered Logs pane) say the same thing.
72
+ for (const entry of result.results) {
73
+ append(` ${entry.id}: ${entry.status}${entry.detail !== undefined ? ` (${entry.detail})` : ''}\n`);
74
+ }
75
+ const deps = model.deps.map((dep) => {
76
+ const entry = result.results.find((entry) => entry.id === dep.id);
77
+ return entry === undefined ? dep : { ...dep, status: entry.status };
78
+ });
79
+ return {
80
+ result,
81
+ deps: { ...model, deps, allSatisfied: result.ok },
82
+ };
83
+ }
84
+ finally {
85
+ clearSudoObserver();
86
+ // The settle fold: the run's text (seed, command lines, per-dep results,
87
+ // any sudo note) persists as one section so a card reload still shows the
88
+ // last install run. A throwing install persists the partial section (the
89
+ // commands that ran) before the error reaches the route.
90
+ finishRunSection(baseline, `${INSTALL_RUN_SEED}${collected}`);
91
+ localInfer.endRun(runKey);
92
+ }
32
93
  }
33
- //# sourceMappingURL=depsHelpers.js.map
94
+ //# sourceMappingURL=depsHelpers.js.map
@@ -33,6 +33,7 @@ export interface LocalInferSummary {
33
33
  };
34
34
  defaultBuildCommand?: string;
35
35
  defaultDockerTag?: string;
36
+ defaultEngineDirectory: string;
36
37
  }[];
37
38
  models: {
38
39
  id: string;
@@ -66,7 +67,10 @@ export interface LocalInferSummary {
66
67
  * ProviderSummaryEntry is the card-facing view of one saved provider config:
67
68
  * the stable id the card edits and deletes against, the engine and model the
68
69
  * title renders ("NInfer: <model>"), the running-state the status dot paints,
69
- * and the full config and platform the expanded form draws from.
70
+ * the per-provider Auto Rebuild checkbox value the edit form and the entry
71
+ * launch read, and the full config and platform the expanded form draws from.
72
+ * An entry saved before the autoRebuild key existed carries no key, so the
73
+ * card draws the checkbox unchecked.
70
74
  */
71
75
  export interface ProviderSummaryEntry {
72
76
  id: string;
@@ -75,6 +79,7 @@ export interface ProviderSummaryEntry {
75
79
  status: ProviderStatus;
76
80
  config: Config;
77
81
  platform: StoredPlatformConfig;
82
+ autoRebuild?: boolean;
78
83
  }
79
84
  /**
80
85
  * ModelDefaultModel is the card-facing view of one default model entry: the
@@ -137,4 +142,4 @@ export declare function buildSummary(localInfer: LocalInferService, request?: {
137
142
  engine?: string;
138
143
  config?: Config;
139
144
  }): Promise<LocalInferSummary>;
140
- //# sourceMappingURL=summary.d.ts.map
145
+ //# sourceMappingURL=summary.d.ts.map
@@ -8,9 +8,7 @@
8
8
  * are the single source the red banner and the inline warnings agree on.
9
9
  * @module dsh-plugin-local-infer/ui/viewmodels/summary
10
10
  */
11
- import { existsSync } from 'node:fs';
12
- import { join } from 'node:path';
13
- import { buildModelEntry, CHAT_TEMPLATE_FILE, hfChatTemplateCommand, hfDownloadCommand, modelArtifactPath, modelEntriesForEngine, } from '../../../core/lib/index.js';
11
+ import { buildModelEntry, chatTemplatePresent, dshEngineCacheDirectory, hfChatTemplateCommand, hfDownloadCommand, modelArtifactPresent, modelCacheEntriesForEngine, modelEntriesForEngine, resolveModelDirectory, } from '../../../core/lib/index.js';
14
12
  import { defaultModelFor, defaultModelsForEngine, ENGINES, enginePlatformDefaults, } from '../../../providers/lib/index.js';
15
13
  import { readConfig } from "../config.js";
16
14
  import { renderForm } from "../form.js";
@@ -33,16 +31,15 @@ export async function buildSummary(localInfer, request) {
33
31
  const engineId = request?.engine ?? stored.engine;
34
32
  // ENGINES is a known non-empty constant, so the fallback is always defined.
35
33
  const engine = ENGINES.find((entry) => entry.id === engineId) ?? ENGINES[0];
36
- // The Model Directory field defaults to the plugin's model download
37
- // directory (~/.dsh/models, created when absent), so the card always
38
- // seeds a real path the deploy step can target. A stored or requested
39
- // directory that is a non-blank string wins over the default.
40
- const modelDirectory = localInfer.defaultModelDirectory();
41
- const rawConfig = request?.config ?? stored.config;
42
- const config = typeof rawConfig.modelDirectory === 'string' && rawConfig.modelDirectory.trim() !== ''
43
- ? rawConfig
44
- : { ...rawConfig, modelDirectory };
45
- const modelDir = typeof config.modelDirectory === 'string' ? config.modelDirectory : modelDirectory;
34
+ // The config the card edits is exactly what is stored or requested: the
35
+ // summary never backfills a default modelDirectory into it, so a Save of a
36
+ // default install writes no `modelDirectory` override and the card's field
37
+ // stays blank (blank means the derived default).
38
+ const config = request?.config ?? stored.config;
39
+ // The hub cache root: the plugin's model download home (created when
40
+ // absent), the base the cache-layout presence checks join onto and the
41
+ // fallback directory when nothing is cached yet.
42
+ const hubCacheRoot = localInfer.defaultModelDirectory();
46
43
  const hardware = await localInfer.detectHardware();
47
44
  // The model value the card carries maps onto the VramModel registry key the
48
45
  // estimator prices: a default-model selection is already a registry key, a
@@ -64,17 +61,32 @@ export async function buildSummary(localInfer, request) {
64
61
  const defaults = await localInfer.resolveDefaults(engine.id, modelId, hardware, pricedConfig);
65
62
  const estimate = await localInfer.estimate(defaults.config, hardware, engine.id);
66
63
  const guidelineResults = await localInfer.guidelines(defaults.config, hardware, engine.id);
67
- // The directory scan lists the model files the selected engine can serve
68
- // straight from the model directory, so the card's Model dropdown offers
69
- // them beside the defaults. A missing directory reads as an empty list.
70
- const modelFiles = modelEntriesForEngine(localInfer.listModelDirectory(modelDir), engine.id);
64
+ // The selected default entry: the resolved directory, the model status, and
65
+ // the download commands all read it; undefined when no default names the
66
+ // model.
67
+ const entry = defaultModelFor(engine.id, modelId);
68
+ // The shared model-directory resolution reads the raw config field (never
69
+ // a backfilled copy): the override keeps the flat layout, and the hub-cache
70
+ // layout names the hf download result (the snapshot holding the selected
71
+ // artifact) or the hub cache root as the display directory, with the base
72
+ // the presence checks join onto. The display directory is never persisted
73
+ // back into the stored config.
74
+ const resolution = resolveModelDirectory(config.modelDirectory, entry, hubCacheRoot);
75
+ const modelDirectory = resolution.directory;
76
+ // The model scan lists the models the selected engine can serve: the hub
77
+ // cache's `models--*` directories (the repo ids, filtered by the engine's
78
+ // artifact types) when the model directory is the plugin default, else the
79
+ // flat directory's top-level entries. A missing directory reads as an empty
80
+ // list.
81
+ const modelFiles = resolution.useHubCache
82
+ ? modelCacheEntriesForEngine(localInfer.listModelCache(), engine.id)
83
+ : modelEntriesForEngine(localInfer.listModelDirectory(modelDirectory), engine.id);
71
84
  // The model status checks the selected model against the model directory
72
85
  // and probes the hf CLI, so the card shows its Download row (or the URL
73
86
  // row) only while the model is absent.
74
- const entry = defaultModelFor(engine.id, modelId);
75
87
  let modelStatus = null;
76
88
  if (entry !== undefined) {
77
- const present = existsSync(modelArtifactPath(entry, modelDir));
89
+ const present = modelArtifactPresent(entry, resolution.baseDir, resolution.useHubCache);
78
90
  const hfCli = (await localInfer.hfCliAvailable()) !== null;
79
91
  modelStatus = {
80
92
  modelId: entry.modelId,
@@ -82,7 +94,7 @@ export async function buildSummary(localInfer, request) {
82
94
  url: entry.url,
83
95
  present,
84
96
  hfCli,
85
- downloadCommand: hfDownloadCommand(entry, modelDir),
97
+ downloadCommand: hfDownloadCommand(entry, modelDirectory, resolution.useHubCache),
86
98
  };
87
99
  }
88
100
  // The chat-template status checks the selected template against the model
@@ -93,14 +105,14 @@ export async function buildSummary(localInfer, request) {
93
105
  const chatTemplateValue = typeof config.chatTemplate === 'string' ? config.chatTemplate : '';
94
106
  let chatTemplateStatus = null;
95
107
  if (isHfRepoReference(chatTemplateValue)) {
96
- const present = existsSync(join(modelDir, CHAT_TEMPLATE_FILE));
108
+ const present = chatTemplatePresent(chatTemplateValue, resolution.baseDir, resolution.useHubCache);
97
109
  const hfCli = (await localInfer.hfCliAvailable()) !== null;
98
110
  chatTemplateStatus = {
99
111
  repo: chatTemplateValue,
100
112
  label: chatTemplateLabel(chatTemplateValue),
101
113
  present,
102
114
  hfCli,
103
- downloadCommand: hfChatTemplateCommand(chatTemplateValue, modelDir),
115
+ downloadCommand: hfChatTemplateCommand(chatTemplateValue, modelDirectory, resolution.useHubCache),
104
116
  };
105
117
  }
106
118
  // The restart re-link: a provider entry whose launch record names a still-
@@ -134,12 +146,17 @@ export async function buildSummary(localInfer, request) {
134
146
  status: providerStatuses[provider.id] ?? 'unsure',
135
147
  config: provider.config,
136
148
  platform: provider.platform,
149
+ // exactOptionalPropertyTypes: carry the Auto Rebuild flag only when the
150
+ // stored entry has it, so an entry saved before the key existed carries
151
+ // no key and the card draws the checkbox unchecked.
152
+ ...(provider.autoRebuild !== undefined ? { autoRebuild: provider.autoRebuild } : {}),
137
153
  }));
138
154
  // The "unsure" banner: shown when no provider is confirmed running but at
139
155
  // least one reads as unsure (a foreign engine the detector saw but could
140
- // not tie to a model, or a busy card). The banner offers bash kill commands
141
- // for the engine processes the detector saw holding VRAM, so the user can
142
- // stop a provider launched in another session.
156
+ // not tie to a model, or a busy card). The banner offers the host-OS stop
157
+ // commands (Stop-Process on Windows, kill on Linux and macOS) for the engine
158
+ // processes the detector saw holding VRAM, so the user can stop a provider
159
+ // launched in another session.
143
160
  const anyRunning = providers.some((p) => p.status === 'running');
144
161
  const anyUnsure = providers.some((p) => p.status === 'unsure');
145
162
  const unsureBanner = !anyRunning && anyUnsure
@@ -148,6 +165,12 @@ export async function buildSummary(localInfer, request) {
148
165
  killCommands: await localInfer.unsureBannerKillCommands(),
149
166
  }
150
167
  : null;
168
+ // The "Unknown Engine(s)" readout shows the VRAM the detector's foreign
169
+ // engine programs are holding: the OS-reserve segment is the GPU's used
170
+ // VRAM when a foreign engine is detected, so the readout names the
171
+ // footprint a provider launched in another session is eating off the
172
+ // card. Absent when no provider reads as unsure.
173
+ const unknownEngines = anyUnsure ? { bytes: estimate.breakdown.reserve } : null;
151
174
  // The registered flag tells the card whether the current config's provider
152
175
  // and model are already in the DSH settings, so the Remove button shows
153
176
  // only when there is something to remove. A profile without the settings
@@ -172,8 +195,10 @@ export async function buildSummary(localInfer, request) {
172
195
  engines: ENGINES.map((entry) => {
173
196
  // The platform defaults ride the engine entry so the card's Engine
174
197
  // platform section seeds the build-command and docker-tag placeholders
175
- // from the same data the deploy step consumes.
176
- const defaults = enginePlatformDefaults(entry.id);
198
+ // from the same data the deploy step consumes. The build command is the
199
+ // engine's first build step for the detected host OS, so a Windows host
200
+ // seeds the vcpkg route and a Linux host seeds the cmake route.
201
+ const defaults = enginePlatformDefaults(entry.id, hardware.os);
177
202
  return {
178
203
  id: entry.id,
179
204
  label: entry.label,
@@ -184,6 +209,7 @@ export async function buildSummary(localInfer, request) {
184
209
  ...(defaults.defaultDockerTag !== undefined
185
210
  ? { defaultDockerTag: defaults.defaultDockerTag }
186
211
  : {}),
212
+ defaultEngineDirectory: dshEngineCacheDirectory(entry.id),
187
213
  };
188
214
  }),
189
215
  models: localInfer.registeredVramModels().map((model) => ({ id: model.id, source: model.source })),
@@ -193,13 +219,7 @@ export async function buildSummary(localInfer, request) {
193
219
  // host-KV slider cap), so the render model and the meter agree on the
194
220
  // machine they run on.
195
221
  formModel: renderForm(engine.parameters, config, hardware),
196
- meterModel: renderMeter(estimate.breakdown, estimate.verdict, hardware.gpu?.vramGiB ?? 0, estimate.source, estimate.reserveSource,
197
- // The "Unknown Engine(s)" readout shows the VRAM the detector's foreign
198
- // engine programs are holding: the OS-reserve segment is the GPU's used
199
- // VRAM when a foreign engine is detected, so the readout names the
200
- // footprint a provider launched in another session is eating off the
201
- // card. Absent when no provider reads as unsure.
202
- anyUnsure ? { bytes: estimate.breakdown.reserve } : null),
222
+ meterModel: renderMeter(estimate.breakdown, estimate.verdict, hardware.gpu?.vramGiB ?? 0, estimate.source, estimate.reserveSource, unknownEngines),
203
223
  verdict: estimate.verdict,
204
224
  warningsModel: renderWarnings(guidelineResults),
205
225
  config,
@@ -222,4 +242,4 @@ export async function buildSummary(localInfer, request) {
222
242
  registered,
223
243
  };
224
244
  }
225
- //# sourceMappingURL=summary.js.map
245
+ //# sourceMappingURL=summary.js.map
@@ -27,4 +27,4 @@ export declare function chatTemplateLabel(repo: string): string;
27
27
  * the engine's first default model.
28
28
  */
29
29
  export declare function resolveModelRegistryId(engineId: string, model: unknown): string;
30
- //# sourceMappingURL=summaryHelpers.d.ts.map
30
+ //# sourceMappingURL=summaryHelpers.d.ts.map
@@ -39,4 +39,4 @@ export function resolveModelRegistryId(engineId, model) {
39
39
  }
40
40
  return defaultModelsForEngine(engineId)[0]?.modelId ?? engineId;
41
41
  }
42
- //# sourceMappingURL=summaryHelpers.js.map
42
+ //# sourceMappingURL=summaryHelpers.js.map
@@ -53,4 +53,4 @@ export declare function toneFor(level: GuidelineLevel): WarningTone;
53
53
  * key so the form renders each warning next to the parameter it names.
54
54
  */
55
55
  export declare function renderWarnings(results: readonly GuidelineResult[]): WarningsModel;
56
- //# sourceMappingURL=warnings.d.ts.map
56
+ //# sourceMappingURL=warnings.d.ts.map
@@ -66,4 +66,4 @@ export function renderWarnings(results) {
66
66
  inline,
67
67
  };
68
68
  }
69
- //# sourceMappingURL=warnings.js.map
69
+ //# sourceMappingURL=warnings.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-local-infer-ui",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Web UI for the dsh local-inference plugin: the form-type-aware parameter form, the live VRAM Est. meter, the red hardware-warning banner, the engine lifecycle controls (build / deploy / stop), and the register-as-model confirmation",
5
5
  "keywords": [
6
6
  "dsh",
@@ -30,13 +30,13 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "dsh-plugin-local-infer-core": "workspace:^",
33
- "dsh-plugin-local-infer-service": "workspace:^",
34
- "dsh-plugin-local-infer-providers": "workspace:^"
33
+ "dsh-plugin-local-infer-providers": "workspace:^",
34
+ "dsh-plugin-local-infer-service": "workspace:^"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@deepseek-ai/cordis": ">=4.0.1"
38
38
  },
39
39
  "devDependencies": {
40
- "@deepseek-ai/cordis": "^4.0.1"
40
+ "@deepseek-ai/cordis": "^4.0.6-alpha.2"
41
41
  }
42
42
  }
@@ -1,53 +0,0 @@
1
- /**
2
- * Strata parameter surface. The declarative `ParameterSpec` data for the
3
- * Strata engine (https://github.com/Niko1221/Strata), sourced from the
4
- * repository's `docs/AI_SETUP.md` (the `strata launch` flags) and
5
- * `docs/DOCKER.md` (the container environment variables). Each spec carries
6
- * both a `toArgv` spelling (the `strata launch` flag the binary and source
7
- * build modes pass) and a `toEnv` spelling (the container variable the docker
8
- * mode passes), so the one surface renders every build mode.
9
- *
10
- * The data is the surface; the `StrataAdapter` composes it into a `LaunchPlan`.
11
- * Adding a flag here is a data edit, never an adapter rewire.
12
- * @module dsh-plugin-local-infer/providers/strata
13
- */
14
- import type { Config, EnumOption, ParameterSpec } from 'dsh-plugin-local-infer/core';
15
- /**
16
- * The model families Strata serves. `qwen` is the Qwen3.8-Flash-Next family
17
- * (the default); the others are the size-specific variants the README's
18
- * Models section names.
19
- */
20
- export declare const STRATA_FAMILY_OPTIONS: readonly EnumOption[];
21
- /**
22
- * The picture-reader modes. `on` lets the engine pick the CPU reader under a
23
- * 24 GB card and the GPU reader from 24 GB; `gpu` and `cpu` force a side.
24
- */
25
- export declare const STRATA_VISION_OPTIONS: readonly EnumOption[];
26
- /**
27
- * The tuning modes. `skip` is the engine default (no tuning run); `quick` is
28
- * a one-time run of up to about 20 minutes; `thorough` is a longer run.
29
- */
30
- export declare const STRATA_TUNE_OPTIONS: readonly EnumOption[];
31
- /**
32
- * The access modes. `local` listens on 127.0.0.1 only and needs no key; every
33
- * other mode makes a key for you, because the server is then reachable beyond
34
- * this machine.
35
- */
36
- export declare const STRATA_ACCESS_OPTIONS: readonly EnumOption[];
37
- /**
38
- * The Strata `ParameterSpec` surface, in form order. The `group` field is the
39
- * form section; specs without a group render under `General`. The `toArgv`
40
- * spelling is the `strata launch` flag the binary and source-build modes pass;
41
- * the `toEnv` spelling is the container variable the docker mode passes. A
42
- * spec with no `toEnv` (access, dataDir) has no docker counterpart, and a spec
43
- * with no `toArgv` (port) is spelled by the adapter from the value.
44
- */
45
- export declare const STRATA_PARAMETERS: readonly ParameterSpec[];
46
- /**
47
- * The Strata model key a config carries: the string model value, falling back
48
- * to an empty string so a bare config renders a plan the engine sizes for the
49
- * card (the engine picks the model when none is named). A value that names a
50
- * local artifact file passes through unchanged.
51
- */
52
- export declare function strataModelKey(config: Config): string;
53
- //# sourceMappingURL=strata.d.ts.map