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,14 +1,30 @@
1
+ /**
2
+ * osLabel is the friendly OS name the install string's header and the card's
3
+ * System dependencies section show: WSL on a WSL2 kernel, Windows on Windows,
4
+ * OSX on macOS, and Linux on every other Linux host.
5
+ */
6
+ export function osLabel(hw) {
7
+ if (hw.os === 'windows')
8
+ return 'Windows';
9
+ if (hw.os === 'macos')
10
+ return 'OSX';
11
+ return hw.wsl2 === true ? 'WSL' : 'Linux';
12
+ }
1
13
  /**
2
14
  * detectPackageManager picks the single package manager the install commands
3
- * key against, from the which-probe results. macOS keys on brew. Linux tries
4
- * the distro-native manager in the order the plan lists them (apt, dnf,
5
- * pacman); a distro that ships two keeps the first. Windows has no command
6
- * set yet and reads as undetected, which the renderer degrades to.
15
+ * key against, from the which-probe results. macOS keys on brew. Windows keys
16
+ * on winget, the package manager that ships with the OS. Linux tries the
17
+ * distro-native manager in the order the plan lists them (apt, dnf, pacman);
18
+ * a distro that ships two keeps the first. A host whose manager probe reads
19
+ * absent reads as undetected, which the renderer degrades to.
7
20
  */
8
21
  export function detectPackageManager(probes) {
9
22
  if (probes.os === 'macos') {
10
23
  return probes.brew ? 'brew' : undefined;
11
24
  }
25
+ if (probes.os === 'windows') {
26
+ return probes.winget ? 'winget' : undefined;
27
+ }
12
28
  if (probes.os === 'linux') {
13
29
  if (probes.apt)
14
30
  return 'apt';
@@ -46,7 +62,7 @@ export async function checkDeps(deps, hw) {
46
62
  * in. It is the order the plan lists them, so the block the user's host
47
63
  * would have picked sits at the top.
48
64
  */
49
- const MANAGER_ORDER = ['apt', 'dnf', 'pacman', 'brew'];
65
+ const MANAGER_ORDER = ['apt', 'dnf', 'pacman', 'brew', 'winget'];
50
66
  /**
51
67
  * renderInstallString emits the copy/paste block for the user's detected OS
52
68
  * and package manager, mirroring the qwen-ninfer header: the apt and CUDA-
@@ -59,7 +75,7 @@ const MANAGER_ORDER = ['apt', 'dnf', 'pacman', 'brew'];
59
75
  export function renderInstallString(deps, hw) {
60
76
  const pm = hw.packageManager;
61
77
  const lines = [];
62
- lines.push(`# System dependencies on ${hw.os}`);
78
+ lines.push(`# System dependencies on ${osLabel(hw)}`);
63
79
  if (pm === undefined) {
64
80
  lines.push('# No package manager detected; blocks are grouped by manager.');
65
81
  }
@@ -131,7 +147,7 @@ export async function runInstall(deps, hw, runCommand) {
131
147
  }
132
148
  let failure;
133
149
  for (const command of commands.commands) {
134
- const outcome = await runCommand(command);
150
+ const outcome = await runCommand(command, { needsSudo: dep.requiresSudo });
135
151
  if (!outcome.ok) {
136
152
  failure = outcome;
137
153
  break;
@@ -165,4 +181,4 @@ export async function runInstall(deps, hw, runCommand) {
165
181
  async function isSatisfied(dep, hw) {
166
182
  return dep.detect === undefined ? false : await dep.detect(hw);
167
183
  }
168
- //# sourceMappingURL=deps.js.map
184
+ //# sourceMappingURL=deps.js.map
@@ -135,4 +135,4 @@ export declare const DEFAULT_OS_RESERVE_MIB: number;
135
135
  * no reserve of its own.
136
136
  */
137
137
  export declare function estimateVram(model: VramModel | undefined, config: Config, hw: HardwareProfile, specs?: readonly ParameterSpec[], options?: EstimateOptions): VramEstimate;
138
- //# sourceMappingURL=estimator.d.ts.map
138
+ //# sourceMappingURL=estimator.d.ts.map
@@ -235,4 +235,4 @@ export function estimateVram(model, config, hw, specs, options) {
235
235
  };
236
236
  return { breakdown, verdict, source: model.source };
237
237
  }
238
- //# sourceMappingURL=estimator.js.map
238
+ //# sourceMappingURL=estimator.js.map
@@ -61,4 +61,4 @@ export declare function evaluateGuidelines(guidelines: readonly Guideline[], spe
61
61
  * OS reserve, so the rule prices the same usable budget the meter does.
62
62
  */
63
63
  export declare function modelGuidelines(model: VramModel, config: Config, hw: HardwareProfile, options?: EstimateOptions): GuidelineResult[];
64
- //# sourceMappingURL=guideline.d.ts.map
64
+ //# sourceMappingURL=guideline.d.ts.map
@@ -115,4 +115,4 @@ export function modelGuidelines(model, config, hw, options) {
115
115
  }
116
116
  return results;
117
117
  }
118
- //# sourceMappingURL=guideline.js.map
118
+ //# sourceMappingURL=guideline.js.map
@@ -64,4 +64,4 @@ export declare function parseNvidiaSmiGpu(output: string): GpuProbe | null;
64
64
  * formats off.
65
65
  */
66
66
  export declare function detectHardware(probes: HardwareProbes): HardwareProfile;
67
- //# sourceMappingURL=hardware.d.ts.map
67
+ //# sourceMappingURL=hardware.d.ts.map
@@ -57,4 +57,4 @@ export function detectHardware(probes) {
57
57
  }
58
58
  return profile;
59
59
  }
60
- //# sourceMappingURL=hardware.js.map
60
+ //# sourceMappingURL=hardware.js.map
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Hf cache directory resolution: the default Hugging Face cache locations the
3
+ * plugin's model and dataset downloads target. The precedence mirrors
4
+ * huggingface_hub, so a download through the plugin lands where the hf CLI
5
+ * and the Python libraries look: the per-store override wins, then the
6
+ * HF_HOME global, then the platform default under the user home.
7
+ * @module dsh-plugin-local-infer/core/hf-cache
8
+ */
9
+ import type { ModelDownloadSource } from './models.ts';
10
+ /**
11
+ * hfHubCacheDirectory resolves the Hugging Face hub cache directory (models,
12
+ * tokenizers, and hub spaces): HF_HUB_CACHE when set, else $HF_HOME/hub when
13
+ * HF_HOME is set, else ~/.cache/huggingface/hub.
14
+ */
15
+ export declare function hfHubCacheDirectory(): string;
16
+ /**
17
+ * ModelDownloadTarget is the resolved download target for one model
18
+ * directory: the base directory the hf CLI writes into and whether the
19
+ * hub-cache layout (no --local-dir, the models--{ns}--{name} directories)
20
+ * applies. The rule is the single source the adapters' deploy steps and the
21
+ * download routes share: it reads the raw model-directory field through the
22
+ * shared override predicate (isModelDirectoryOverridden), so a named
23
+ * directory keeps the flat --local-dir target and an absent or blank one
24
+ * downloads into the hub cache.
25
+ */
26
+ export interface ModelDownloadTarget {
27
+ baseDir: string;
28
+ useHubCache: boolean;
29
+ }
30
+ /**
31
+ * modelDownloadTarget resolves the download target for a raw model-directory
32
+ * field: a named directory is the flat --local-dir base, and an absent or
33
+ * blank directory is the hub-cache layout (the hf CLI writes its
34
+ * models--{ns}--{name} directories into the hub cache root). `hubCache` is
35
+ * the hub cache root to fall back onto; the default reads the core
36
+ * resolution, and a caller that owns the value (the service seam, which also
37
+ * creates the directory when absent) passes it.
38
+ */
39
+ export declare function modelDownloadTarget(modelDirectory: unknown, hubCache?: string): ModelDownloadTarget;
40
+ /**
41
+ * ModelDirectoryResolution is the full model-directory read for one raw
42
+ * config field: the ModelDownloadTarget (the download and presence-join base
43
+ * plus the layout flag) extended with the concrete `directory` a read shows
44
+ * and lists. Under the hub-cache layout that directory is the hf download
45
+ * result: the snapshot holding the selected artifact when it is cached, else
46
+ * the hub cache root.
47
+ */
48
+ export interface ModelDirectoryResolution extends ModelDownloadTarget {
49
+ directory: string;
50
+ }
51
+ /**
52
+ * resolveModelDirectory resolves the model directory a read names for a
53
+ * model: the raw field's override when it names a path; else, when the
54
+ * selected entry resolves and its artifact is already in the hub cache, the
55
+ * hf download result (the snapshot directory holding it); else the hub cache
56
+ * root, the base the hf CLI downloads into. The result is derived on every
57
+ * read and never written back into the config, so a default install never
58
+ * materializes a fake `modelDirectory` override. `hubCache` is the hub cache
59
+ * root to resolve over; the service seam names it when it owns the value (it
60
+ * also creates the directory when absent), and the default reads the core
61
+ * resolution.
62
+ */
63
+ export declare function resolveModelDirectory(modelDirectory: unknown, source?: ModelDownloadSource, hubCache?: string): ModelDirectoryResolution;
64
+ /**
65
+ * hfDatasetsCacheDirectory resolves the Hugging Face datasets cache
66
+ * directory: HF_DATASETS_CACHE when set, else $HF_HOME/datasets when HF_HOME
67
+ * is set, else ~/.cache/huggingface/datasets.
68
+ */
69
+ export declare function hfDatasetsCacheDirectory(): string;
70
+ //# sourceMappingURL=hf-cache.d.ts.map
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Hf cache directory resolution: the default Hugging Face cache locations the
3
+ * plugin's model and dataset downloads target. The precedence mirrors
4
+ * huggingface_hub, so a download through the plugin lands where the hf CLI
5
+ * and the Python libraries look: the per-store override wins, then the
6
+ * HF_HOME global, then the platform default under the user home.
7
+ * @module dsh-plugin-local-infer/core/hf-cache
8
+ */
9
+ import { homedir } from 'node:os';
10
+ import { join } from 'node:path';
11
+ import { hfDownloadResultDirectory } from "./infer-cache.js";
12
+ import { isModelDirectoryOverridden, repoIdFromUrl } from "./models.js";
13
+ // The platform default HF home: ~/.cache/huggingface on Linux and macOS,
14
+ // C:\Users\<user>\.cache\huggingface on Windows. homedir() names the right
15
+ // base on every host.
16
+ function defaultHfHome() {
17
+ return join(homedir(), '.cache', 'huggingface');
18
+ }
19
+ // A set env var that is blank (an empty string or whitespace only) reads as
20
+ // unset, the same rule huggingface_hub applies.
21
+ function envValue(name) {
22
+ const value = process.env[name];
23
+ return typeof value === 'string' && value.trim() !== '' ? value : undefined;
24
+ }
25
+ /**
26
+ * hfHubCacheDirectory resolves the Hugging Face hub cache directory (models,
27
+ * tokenizers, and hub spaces): HF_HUB_CACHE when set, else $HF_HOME/hub when
28
+ * HF_HOME is set, else ~/.cache/huggingface/hub.
29
+ */
30
+ export function hfHubCacheDirectory() {
31
+ const hub = envValue('HF_HUB_CACHE');
32
+ if (hub !== undefined)
33
+ return hub;
34
+ const home = envValue('HF_HOME');
35
+ return join(home ?? defaultHfHome(), 'hub');
36
+ }
37
+ /**
38
+ * modelDownloadTarget resolves the download target for a raw model-directory
39
+ * field: a named directory is the flat --local-dir base, and an absent or
40
+ * blank directory is the hub-cache layout (the hf CLI writes its
41
+ * models--{ns}--{name} directories into the hub cache root). `hubCache` is
42
+ * the hub cache root to fall back onto; the default reads the core
43
+ * resolution, and a caller that owns the value (the service seam, which also
44
+ * creates the directory when absent) passes it.
45
+ */
46
+ export function modelDownloadTarget(modelDirectory, hubCache = hfHubCacheDirectory()) {
47
+ const useHubCache = !isModelDirectoryOverridden(modelDirectory);
48
+ return { baseDir: useHubCache ? hubCache : modelDirectory, useHubCache };
49
+ }
50
+ /**
51
+ * resolveModelDirectory resolves the model directory a read names for a
52
+ * model: the raw field's override when it names a path; else, when the
53
+ * selected entry resolves and its artifact is already in the hub cache, the
54
+ * hf download result (the snapshot directory holding it); else the hub cache
55
+ * root, the base the hf CLI downloads into. The result is derived on every
56
+ * read and never written back into the config, so a default install never
57
+ * materializes a fake `modelDirectory` override. `hubCache` is the hub cache
58
+ * root to resolve over; the service seam names it when it owns the value (it
59
+ * also creates the directory when absent), and the default reads the core
60
+ * resolution.
61
+ */
62
+ export function resolveModelDirectory(modelDirectory, source, hubCache = hfHubCacheDirectory()) {
63
+ const target = modelDownloadTarget(modelDirectory, hubCache);
64
+ if (!target.useHubCache)
65
+ return { ...target, directory: target.baseDir };
66
+ const snapshot = source === undefined
67
+ ? null
68
+ : hfDownloadResultDirectory(hubCache, repoIdFromUrl(source.url), source.file ?? '');
69
+ return { ...target, directory: snapshot ?? hubCache };
70
+ }
71
+ /**
72
+ * hfDatasetsCacheDirectory resolves the Hugging Face datasets cache
73
+ * directory: HF_DATASETS_CACHE when set, else $HF_HOME/datasets when HF_HOME
74
+ * is set, else ~/.cache/huggingface/datasets.
75
+ */
76
+ export function hfDatasetsCacheDirectory() {
77
+ const datasets = envValue('HF_DATASETS_CACHE');
78
+ if (datasets !== undefined)
79
+ return datasets;
80
+ const home = envValue('HF_HOME');
81
+ return join(home ?? defaultHfHome(), 'datasets');
82
+ }
83
+ //# sourceMappingURL=hf-cache.js.map
@@ -8,7 +8,7 @@
8
8
  export type { Config, CustomArg } from './config.ts';
9
9
  export { detectHardware, parseNvidiaSmiGpu, } from './hardware.ts';
10
10
  export type { GpuProfile, GpuProbe, HardwareProfile, HardwareProbes, } from './hardware.ts';
11
- export type { ComboOption, ConstraintResult, EnumOption, ParameterForm, ParameterSpec, } from './parameter.ts';
11
+ export type { ComboOption, ConstraintResult, EnumOption, ParameterDeploy, ParameterForm, ParameterSpec, } from './parameter.ts';
12
12
  export { DEFAULT_OS_RESERVE_MIB, estimateVram, KV_PAGE_TOKENS, pageRoundUp, TIGHT_HEADROOM_BYTES, } from './estimator.ts';
13
13
  export type { EstimateContext, EstimateOptions, SpeculationTerms, VramBreakdown, VramContribution, VramEstimate, VramModel, VramVerdict, } from './estimator.ts';
14
14
  export { GPU_USAGE_BUSY_THRESHOLD, matchLaunchSignature, parseNvidiaSmiGpuUsage, resolveOsReserve, } from './reserve.ts';
@@ -18,19 +18,26 @@ export type { ProviderLaunchRecord, ReLinkInput, ReLinkOutcome, } from './launch
18
18
  export type { EngineLaunchSignature, GpuUsageProbe, ProcessLine, ReserveResolution, ReserveSource, } from './reserve.ts';
19
19
  export { computeProviderStatuses, isGpuBusy, } from './status.ts';
20
20
  export type { ProviderRef, ProviderStatus, ProviderStatusInput, RunningEngineRef, } from './status.ts';
21
- export { DEFAULT_LOG_PATH_TEMPLATE, LOG_FILE_NAME_TEMPLATE, LOG_TEMPLATE_ENGINE, LOG_TEMPLATE_HOME, LOG_TEMPLATE_MODEL, LOG_TEMPLATE_TIMESTAMP, formatLogTimestamp, resolveLogPath, slugifyModelName, } from './logs.ts';
22
- export { EngineAdapter } from './adapter.ts';
23
- export type { DeployOptions, DeployResult, EnginePlatformConfig, FetchResult, HealthCheckOptions, HealthResult, LaunchPlan, LaunchProgress, LaunchStep, LifecycleHost, ProcessExitInfo, ProcessHandle, } from './adapter.ts';
21
+ export { DEFAULT_LOG_PATH_TEMPLATE, LOG_FILE_NAME_TEMPLATE, LOG_TAIL_BYTES, LOG_TEMPLATE_ENGINE, LOG_TEMPLATE_HOME, LOG_TEMPLATE_MODEL, LOG_TEMPLATE_TIMESTAMP, formatLogTimestamp, resolveLogPath, slugifyModelName, } from './logs.ts';
22
+ export { COMMAND_LOG_PREFIX, EngineAdapter, LAUNCH_STEPS, URL_LOG_PREFIX, autoRebuildEnabled, commandLogLine, urlLogLine, } from './adapter.ts';
23
+ export type { BuildMode, CommandLogger, DeployOptions, DeployResult, EngineLaunchState, EnginePlatformConfig, FetchResult, HealthCheckOptions, HealthResult, LaunchPlan, LaunchProgress, LaunchStep, LifecycleHost, ProcessExitInfo, ProcessHandle, RunOptions, } from './adapter.ts';
24
24
  export { NOOP_DEBUG_LOGGER, createCommandDebugLogger, isHarnessLogDebug, } from './debug.ts';
25
25
  export type { CreateCommandDebugLoggerArgs, DebugLogger, } from './debug.ts';
26
26
  export { constraintId, evaluateGuidelines, modelGuidelines } from './guideline.ts';
27
27
  export type { Guideline, GuidelineLevel, GuidelineResult } from './guideline.ts';
28
28
  export { hardwareClass, presetFromFetch, resolveDefaults, WILDCARD_HARDWARE_CLASS, } from './defaults.ts';
29
29
  export type { DefaultProvenance, DefaultsResolver, HardwareClass, Preset, PresetSource, ResolvedDefaults, } from './defaults.ts';
30
- export { AGENT_DEFAULT_MODEL_NAMESPACE, agentDefaultOps, agentDefaultPointsAt, agentDefaultUnsetOps, apiKeyEnvFor, buildModelEntry, LLM_PI_AI_NAMESPACE, modelRowsFrom, modelSlug, providerIdFor, providerRegistrationOps, providerRemovalOps, removeModelRow, upsertModelRow, } from './registrar.ts';
30
+ export { AGENT_DEFAULT_MODEL_NAMESPACE, agentDefaultOps, agentDefaultPointsAt, agentDefaultUnsetOps, apiKeyEnvFor, buildModelEntry, defaultApiKeyFor, LLM_PI_AI_NAMESPACE, modelRowsFrom, modelSlug, providerIdFor, providerRegistrationOps, providerRemovalOps, removeModelRow, upsertModelRow, } from './registrar.ts';
31
31
  export type { DshModelEntry, DshModelRegistrar, ModelRow, RegisterResult, SettingsOp, } from './registrar.ts';
32
- export { checkDeps, detectPackageManager, planDeps, renderInstallString, runInstall, } from './deps.ts';
33
- export { CHAT_TEMPLATE_FILE, hfChatTemplateCommand, hfDownloadCommand, modelArtifactPath, modelEntriesForEngine, repoIdFromUrl, repoNameFromUrl, } from './models.ts';
34
- export type { DefaultModel, ModelDirectoryEntry } from './models.ts';
32
+ export { checkDeps, detectPackageManager, osLabel, planDeps, renderInstallString, runInstall, } from './deps.ts';
33
+ export { guardSudoCommand, sudoFailureDetail, SUDO_CLI_NOTE, SUDO_PASSWORD_TIMEOUT_MS, SUDO_PROBE_COMMAND, } from './sudo.ts';
34
+ export type { SudoGuard, SudoGuardOptions, SudoTimer } from './sudo.ts';
35
+ export { CHAT_TEMPLATE_FILE, chatTemplateArtifactPath, chatTemplatePresent, hfChatTemplateCommand, hfDownloadCommand, hfDownloadFileCommand, hubCacheModelDirectory, hubCacheSnapshotFilePath, isModelDirectoryOverridden, modelArtifactPath, modelArtifactPresent, modelCacheEntriesForEngine, modelEntriesForEngine, repoIdFromUrl, repoNameFromUrl, } from './models.ts';
36
+ export type { DefaultModel, ModelCacheEntry, ModelDirectoryEntry, ModelDownloadSource, } from './models.ts';
37
+ export { hfDatasetsCacheDirectory, hfHubCacheDirectory, modelDownloadTarget, resolveModelDirectory, } from './hf-cache.ts';
38
+ export type { ModelDirectoryResolution, ModelDownloadTarget } from './hf-cache.ts';
39
+ export { dshConfigCacheDirectory, dshEngineCacheDirectory, dshInferCacheDirectory, hfDownloadResultDirectory, } from './infer-cache.ts';
40
+ export { foldHfProgressChunk, parseHfProgressLine } from './progress.ts';
41
+ export type { HfProgress } from './progress.ts';
35
42
  export type { CommandOutcome, CommandRunner, DepCheck, DepStatus, EngineDepPlan, InstallCommands, InstallResult, PackageManager, PackageManagerProbes, SystemDep, SystemDepProvisioner, } from './deps.ts';
36
- //# sourceMappingURL=index.d.ts.map
43
+ //# sourceMappingURL=index.d.ts.map
@@ -11,12 +11,16 @@ export { GPU_USAGE_BUSY_THRESHOLD, matchLaunchSignature, parseNvidiaSmiGpuUsage,
11
11
  export { commandMatchesArgv, launchRecordFromPlan, reLinkRecord, } from "./launch-record.js";
12
12
  export { formatLaunchCommand } from "./launch-command.js";
13
13
  export { computeProviderStatuses, isGpuBusy, } from "./status.js";
14
- export { DEFAULT_LOG_PATH_TEMPLATE, LOG_FILE_NAME_TEMPLATE, LOG_TEMPLATE_ENGINE, LOG_TEMPLATE_HOME, LOG_TEMPLATE_MODEL, LOG_TEMPLATE_TIMESTAMP, formatLogTimestamp, resolveLogPath, slugifyModelName, } from "./logs.js";
15
- export { EngineAdapter } from "./adapter.js";
14
+ export { DEFAULT_LOG_PATH_TEMPLATE, LOG_FILE_NAME_TEMPLATE, LOG_TAIL_BYTES, LOG_TEMPLATE_ENGINE, LOG_TEMPLATE_HOME, LOG_TEMPLATE_MODEL, LOG_TEMPLATE_TIMESTAMP, formatLogTimestamp, resolveLogPath, slugifyModelName, } from "./logs.js";
15
+ export { COMMAND_LOG_PREFIX, EngineAdapter, LAUNCH_STEPS, URL_LOG_PREFIX, autoRebuildEnabled, commandLogLine, urlLogLine, } from "./adapter.js";
16
16
  export { NOOP_DEBUG_LOGGER, createCommandDebugLogger, isHarnessLogDebug, } from "./debug.js";
17
17
  export { constraintId, evaluateGuidelines, modelGuidelines } from "./guideline.js";
18
18
  export { hardwareClass, presetFromFetch, resolveDefaults, WILDCARD_HARDWARE_CLASS, } from "./defaults.js";
19
- export { AGENT_DEFAULT_MODEL_NAMESPACE, agentDefaultOps, agentDefaultPointsAt, agentDefaultUnsetOps, apiKeyEnvFor, buildModelEntry, LLM_PI_AI_NAMESPACE, modelRowsFrom, modelSlug, providerIdFor, providerRegistrationOps, providerRemovalOps, removeModelRow, upsertModelRow, } from "./registrar.js";
20
- export { checkDeps, detectPackageManager, planDeps, renderInstallString, runInstall, } from "./deps.js";
21
- export { CHAT_TEMPLATE_FILE, hfChatTemplateCommand, hfDownloadCommand, modelArtifactPath, modelEntriesForEngine, repoIdFromUrl, repoNameFromUrl, } from "./models.js";
22
- //# sourceMappingURL=index.js.map
19
+ export { AGENT_DEFAULT_MODEL_NAMESPACE, agentDefaultOps, agentDefaultPointsAt, agentDefaultUnsetOps, apiKeyEnvFor, buildModelEntry, defaultApiKeyFor, LLM_PI_AI_NAMESPACE, modelRowsFrom, modelSlug, providerIdFor, providerRegistrationOps, providerRemovalOps, removeModelRow, upsertModelRow, } from "./registrar.js";
20
+ export { checkDeps, detectPackageManager, osLabel, planDeps, renderInstallString, runInstall, } from "./deps.js";
21
+ export { guardSudoCommand, sudoFailureDetail, SUDO_CLI_NOTE, SUDO_PASSWORD_TIMEOUT_MS, SUDO_PROBE_COMMAND, } from "./sudo.js";
22
+ export { CHAT_TEMPLATE_FILE, chatTemplateArtifactPath, chatTemplatePresent, hfChatTemplateCommand, hfDownloadCommand, hfDownloadFileCommand, hubCacheModelDirectory, hubCacheSnapshotFilePath, isModelDirectoryOverridden, modelArtifactPath, modelArtifactPresent, modelCacheEntriesForEngine, modelEntriesForEngine, repoIdFromUrl, repoNameFromUrl, } from "./models.js";
23
+ export { hfDatasetsCacheDirectory, hfHubCacheDirectory, modelDownloadTarget, resolveModelDirectory, } from "./hf-cache.js";
24
+ export { dshConfigCacheDirectory, dshEngineCacheDirectory, dshInferCacheDirectory, hfDownloadResultDirectory, } from "./infer-cache.js";
25
+ export { foldHfProgressChunk, parseHfProgressLine } from "./progress.js";
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Infer cache directory resolution: the plugin-owned locations under the user
3
+ * home where engine checkouts live and engine config files land. One module
4
+ * owns every `~/.cache/dsh/infer` path so adapters, routes, and view models
5
+ * consume these builders instead of restating the literal. Models stay
6
+ * outside it: the hub cache remains the model download home.
7
+ * @module dsh-plugin-local-infer/core/infer-cache
8
+ */
9
+ /**
10
+ * dshInferCacheDirectory is the plugin's cache root:
11
+ * `~/.cache/dsh/infer`. Engine checkouts and engine config files live under
12
+ * it; model downloads do not.
13
+ */
14
+ export declare function dshInferCacheDirectory(): string;
15
+ /**
16
+ * dshEngineCacheDirectory is the default checkout home for one engine:
17
+ * `~/.cache/dsh/infer/{engineId}` (e.g. `~/.cache/dsh/infer/basalt`). One
18
+ * checkout per engine, never a subfolder of a model directory.
19
+ */
20
+ export declare function dshEngineCacheDirectory(engineId: string): string;
21
+ /**
22
+ * dshConfigCacheDirectory is the default home for engine config files the
23
+ * plugin writes: `~/.cache/dsh/infer/config`. Engines that require a
24
+ * specific placement are the exception; every other config file lands here
25
+ * (in a per-engine subdirectory, which the caller composes).
26
+ */
27
+ export declare function dshConfigCacheDirectory(): string;
28
+ /**
29
+ * hfDownloadResultDirectory is the directory the hf CLI's hub-cache download
30
+ * of one repo file lands in: the snapshot directory under
31
+ * `models--{ns}--{name}/snapshots/` that holds the artifact, resolved
32
+ * through hubCacheSnapshotFilePath. Returns null when the artifact is not in
33
+ * the cache, which the caller reads as "fall back to the hub cache root as
34
+ * the download base". A blank `file` names no artifact (a whole-repo
35
+ * download has no single snapshot directory to name), so it resolves to null
36
+ * for the same fallback.
37
+ */
38
+ export declare function hfDownloadResultDirectory(hubCache: string, repoId: string, file: string): string | null;
39
+ //# sourceMappingURL=infer-cache.d.ts.map
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Infer cache directory resolution: the plugin-owned locations under the user
3
+ * home where engine checkouts live and engine config files land. One module
4
+ * owns every `~/.cache/dsh/infer` path so adapters, routes, and view models
5
+ * consume these builders instead of restating the literal. Models stay
6
+ * outside it: the hub cache remains the model download home.
7
+ * @module dsh-plugin-local-infer/core/infer-cache
8
+ */
9
+ import { homedir } from 'node:os';
10
+ import { dirname, join } from 'node:path';
11
+ import { hubCacheSnapshotFilePath } from "./models.js";
12
+ /**
13
+ * dshInferCacheDirectory is the plugin's cache root:
14
+ * `~/.cache/dsh/infer`. Engine checkouts and engine config files live under
15
+ * it; model downloads do not.
16
+ */
17
+ export function dshInferCacheDirectory() {
18
+ return join(homedir(), '.cache', 'dsh', 'infer');
19
+ }
20
+ /**
21
+ * dshEngineCacheDirectory is the default checkout home for one engine:
22
+ * `~/.cache/dsh/infer/{engineId}` (e.g. `~/.cache/dsh/infer/basalt`). One
23
+ * checkout per engine, never a subfolder of a model directory.
24
+ */
25
+ export function dshEngineCacheDirectory(engineId) {
26
+ return join(dshInferCacheDirectory(), engineId);
27
+ }
28
+ /**
29
+ * dshConfigCacheDirectory is the default home for engine config files the
30
+ * plugin writes: `~/.cache/dsh/infer/config`. Engines that require a
31
+ * specific placement are the exception; every other config file lands here
32
+ * (in a per-engine subdirectory, which the caller composes).
33
+ */
34
+ export function dshConfigCacheDirectory() {
35
+ return join(dshInferCacheDirectory(), 'config');
36
+ }
37
+ /**
38
+ * hfDownloadResultDirectory is the directory the hf CLI's hub-cache download
39
+ * of one repo file lands in: the snapshot directory under
40
+ * `models--{ns}--{name}/snapshots/` that holds the artifact, resolved
41
+ * through hubCacheSnapshotFilePath. Returns null when the artifact is not in
42
+ * the cache, which the caller reads as "fall back to the hub cache root as
43
+ * the download base". A blank `file` names no artifact (a whole-repo
44
+ * download has no single snapshot directory to name), so it resolves to null
45
+ * for the same fallback.
46
+ */
47
+ export function hfDownloadResultDirectory(hubCache, repoId, file) {
48
+ if (file === '')
49
+ return null;
50
+ const path = hubCacheSnapshotFilePath(hubCache, repoId, file);
51
+ return path === null ? null : dirname(path);
52
+ }
53
+ //# sourceMappingURL=infer-cache.js.map
@@ -6,8 +6,12 @@ import type { LaunchPlan } from './adapter.ts';
6
6
  * card's Logs section shows the line above the engine's own output, so a
7
7
  * user can read and copy the exact binary and arguments a launch started
8
8
  * with. The Hyper-Qwen deploy runs this same string, so the printed line and
9
- * the host command cannot drift. Returns undefined when the plan names no
10
- * command (a non-compose plan with no argv).
9
+ * the host command cannot drift. The optional autoRebuild is the card's Auto
10
+ * Rebuild checkbox as the deploy reads it: absent or true renders the
11
+ * default `--pull always` (the up step re-pulls the image), false renders
12
+ * `--pull missing` (the up step starts the already-present image), the same
13
+ * skip rule the pull-guarded docker adapters follow. Returns undefined when
14
+ * the plan names no command (a non-compose plan with no argv).
11
15
  */
12
- export declare function formatLaunchCommand(plan: LaunchPlan): string | undefined;
13
- //# sourceMappingURL=launch-command.d.ts.map
16
+ export declare function formatLaunchCommand(plan: LaunchPlan, autoRebuild?: boolean): string | undefined;
17
+ //# sourceMappingURL=launch-command.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { autoRebuildEnabled } from "./adapter.js";
1
2
  /**
2
3
  * formatLaunchCommand renders a launch plan as the shell command string the
3
4
  * deploy step runs to start the engine: the quoted argv joined for a process
@@ -5,10 +6,14 @@
5
6
  * card's Logs section shows the line above the engine's own output, so a
6
7
  * user can read and copy the exact binary and arguments a launch started
7
8
  * with. The Hyper-Qwen deploy runs this same string, so the printed line and
8
- * the host command cannot drift. Returns undefined when the plan names no
9
- * command (a non-compose plan with no argv).
9
+ * the host command cannot drift. The optional autoRebuild is the card's Auto
10
+ * Rebuild checkbox as the deploy reads it: absent or true renders the
11
+ * default `--pull always` (the up step re-pulls the image), false renders
12
+ * `--pull missing` (the up step starts the already-present image), the same
13
+ * skip rule the pull-guarded docker adapters follow. Returns undefined when
14
+ * the plan names no command (a non-compose plan with no argv).
10
15
  */
11
- export function formatLaunchCommand(plan) {
16
+ export function formatLaunchCommand(plan, autoRebuild) {
12
17
  if (plan.kind === 'compose') {
13
18
  // The user's compose arguments (the card's docker-tag field) override the
14
19
  // default profile: the flags the up step runs before the required `up -d`.
@@ -29,7 +34,9 @@ export function formatLaunchCommand(plan) {
29
34
  .join(' ');
30
35
  }
31
36
  // The compose defaults match the adapter's renderLaunch fallbacks, so a
32
- // plan built from a bare config still spells a runnable command.
37
+ // plan built from a bare config still spells a runnable command. Auto
38
+ // Rebuild off keeps the image acquisition out of the up step: compose
39
+ // starts the already-present image with the plan's parameters.
33
40
  return [
34
41
  'docker',
35
42
  'compose',
@@ -39,7 +46,7 @@ export function formatLaunchCommand(plan) {
39
46
  plan.profile ?? 'single',
40
47
  'up',
41
48
  '--pull',
42
- 'always',
49
+ autoRebuildEnabled(autoRebuild) ? 'always' : 'missing',
43
50
  '-d',
44
51
  ]
45
52
  .map(quoteArg)
@@ -61,4 +68,4 @@ function quoteArg(token) {
61
68
  return token;
62
69
  return `'${token.replaceAll("'", "'\\''")}'`;
63
70
  }
64
- //# sourceMappingURL=launch-command.js.map
71
+ //# sourceMappingURL=launch-command.js.map
@@ -80,4 +80,4 @@ export declare function commandMatchesArgv(command: string, argv: readonly strin
80
80
  * restart, and the cap keeps the record bounded).
81
81
  */
82
82
  export declare function launchRecordFromPlan(plan: LaunchPlan, pid: number, parentPid: number | undefined, previousPids: readonly number[]): ProviderLaunchRecord;
83
- //# sourceMappingURL=launch-record.d.ts.map
83
+ //# sourceMappingURL=launch-record.d.ts.map
@@ -77,4 +77,4 @@ export function launchRecordFromPlan(plan, pid, parentPid, previousPids) {
77
77
  }
78
78
  return record;
79
79
  }
80
- //# sourceMappingURL=launch-record.js.map
80
+ //# sourceMappingURL=launch-record.js.map
@@ -5,6 +5,13 @@
5
5
  * not a shell expansion the plugin performs.
6
6
  */
7
7
  export declare const DEFAULT_LOG_PATH_TEMPLATE = "${HOME}/.dsh/local-infer/logs";
8
+ /**
9
+ * LOG_TAIL_BYTES is the tail cap on captured log text: the stored last-run
10
+ * logs, a spawned engine's accumulated output, and an appended run all keep
11
+ * only the last 64 KiB, so a chatty engine or a long build cannot grow the
12
+ * config file or the host's memory without bound.
13
+ */
14
+ export declare const LOG_TAIL_BYTES = 65536;
8
15
  /**
9
16
  * LOG_FILE_NAME_TEMPLATE is the fixed file name a launch's log file carries,
10
17
  * inside the user-edited log directory. The placeholders resolve against the
@@ -41,4 +48,4 @@ export declare function formatLogTimestamp(date: Date): string;
41
48
  * its own file inside the directory. A directory with no ${HOME} is used as-is.
42
49
  */
43
50
  export declare function resolveLogPath(directory: string, engineId: string, modelId: string | undefined, date: Date, home: string): string;
44
- //# sourceMappingURL=logs.d.ts.map
51
+ //# sourceMappingURL=logs.d.ts.map
@@ -4,7 +4,15 @@
4
4
  * from the fixed file-name template below. ${HOME} is the host home directory,
5
5
  * not a shell expansion the plugin performs.
6
6
  */
7
+ import { join } from 'node:path';
7
8
  export const DEFAULT_LOG_PATH_TEMPLATE = '${HOME}/.dsh/local-infer/logs';
9
+ /**
10
+ * LOG_TAIL_BYTES is the tail cap on captured log text: the stored last-run
11
+ * logs, a spawned engine's accumulated output, and an appended run all keep
12
+ * only the last 64 KiB, so a chatty engine or a long build cannot grow the
13
+ * config file or the host's memory without bound.
14
+ */
15
+ export const LOG_TAIL_BYTES = 65_536;
8
16
  /**
9
17
  * LOG_FILE_NAME_TEMPLATE is the fixed file name a launch's log file carries,
10
18
  * inside the user-edited log directory. The placeholders resolve against the
@@ -64,8 +72,8 @@ export function resolveLogPath(directory, engineId, modelId, date, home) {
64
72
  .replace(LOG_TEMPLATE_ENGINE, engineId)
65
73
  .replace(LOG_TEMPLATE_MODEL, slugifyModelName(modelId))
66
74
  .replace(LOG_TEMPLATE_TIMESTAMP, formatLogTimestamp(date));
67
- // A directory that already ends in a separator does not double it.
68
- const dir = resolvedDir.endsWith('/') ? resolvedDir : `${resolvedDir}/`;
69
- return `${dir}${fileName}`;
75
+ // join normalizes the separators and does not double a trailing one, so the
76
+ // result is a clean path on every platform.
77
+ return join(resolvedDir, fileName);
70
78
  }
71
- //# sourceMappingURL=logs.js.map
79
+ //# sourceMappingURL=logs.js.map