dsh-plugin-local-infer 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. package/README.md +32 -6
  2. package/cordis.patch.yml +7 -0
  3. package/docs/zh/README.md +24 -4
  4. package/dsh/client.js +4200 -4049
  5. package/package.json +33 -11
  6. package/packages/core/lib/adapter.d.ts +177 -11
  7. package/packages/core/lib/adapter.js +74 -1
  8. package/packages/core/lib/config.d.ts +1 -1
  9. package/packages/core/lib/config.js +1 -1
  10. package/packages/core/lib/debug.d.ts +1 -1
  11. package/packages/core/lib/debug.js +1 -1
  12. package/packages/core/lib/defaults.d.ts +1 -1
  13. package/packages/core/lib/defaults.js +1 -1
  14. package/packages/core/lib/deps.d.ts +48 -20
  15. package/packages/core/lib/deps.js +24 -8
  16. package/packages/core/lib/estimator.d.ts +1 -1
  17. package/packages/core/lib/estimator.js +1 -1
  18. package/packages/core/lib/guideline.d.ts +1 -1
  19. package/packages/core/lib/guideline.js +1 -1
  20. package/packages/core/lib/hardware.d.ts +1 -1
  21. package/packages/core/lib/hardware.js +1 -1
  22. package/packages/core/lib/hf-cache.d.ts +70 -0
  23. package/packages/core/lib/hf-cache.js +83 -0
  24. package/packages/core/lib/index.d.ts +16 -9
  25. package/packages/core/lib/index.js +10 -6
  26. package/packages/core/lib/infer-cache.d.ts +39 -0
  27. package/packages/core/lib/infer-cache.js +53 -0
  28. package/packages/core/lib/launch-command.d.ts +8 -4
  29. package/packages/core/lib/launch-command.js +13 -6
  30. package/packages/core/lib/launch-record.d.ts +1 -1
  31. package/packages/core/lib/launch-record.js +1 -1
  32. package/packages/core/lib/logs.d.ts +8 -1
  33. package/packages/core/lib/logs.js +12 -4
  34. package/packages/core/lib/models.d.ts +120 -14
  35. package/packages/core/lib/models.js +209 -17
  36. package/packages/core/lib/parameter.d.ts +31 -3
  37. package/packages/core/lib/parameter.js +1 -1
  38. package/packages/core/lib/progress.d.ts +54 -0
  39. package/packages/core/lib/progress.js +120 -0
  40. package/packages/core/lib/registrar.d.ts +25 -14
  41. package/packages/core/lib/registrar.js +30 -10
  42. package/packages/core/lib/reserve.d.ts +11 -3
  43. package/packages/core/lib/reserve.js +6 -4
  44. package/packages/core/lib/status.d.ts +12 -6
  45. package/packages/core/lib/status.js +21 -10
  46. package/packages/core/lib/sudo.d.ts +80 -0
  47. package/packages/core/lib/sudo.js +78 -0
  48. package/packages/core/package.json +1 -1
  49. package/packages/orchestrator/lib/config.d.ts +63 -0
  50. package/packages/orchestrator/lib/config.js +111 -0
  51. package/packages/orchestrator/lib/index.d.ts +51 -0
  52. package/packages/orchestrator/lib/index.js +73 -0
  53. package/packages/orchestrator/lib/route.d.ts +60 -0
  54. package/packages/orchestrator/lib/route.js +159 -0
  55. package/packages/orchestrator/locale/en.json +6 -0
  56. package/packages/orchestrator/package.json +39 -0
  57. package/packages/orchestrator/prompt.md +87 -0
  58. package/packages/providers/lib/acquire.d.ts +95 -15
  59. package/packages/providers/lib/acquire.js +239 -40
  60. package/packages/providers/lib/adapters.d.ts +155 -221
  61. package/packages/providers/lib/adapters.js +589 -935
  62. package/packages/providers/lib/debug.d.ts +1 -1
  63. package/packages/providers/lib/debug.js +1 -1
  64. package/packages/providers/lib/deps.d.ts +31 -212
  65. package/packages/providers/lib/deps.js +71 -205
  66. package/packages/providers/lib/engines/basalt/basalt.d.ts +130 -0
  67. package/packages/providers/lib/engines/basalt/basalt.js +304 -0
  68. package/packages/providers/lib/engines/basalt/basaltAdapter.d.ts +85 -0
  69. package/packages/providers/lib/engines/basalt/basaltAdapter.js +439 -0
  70. package/packages/providers/lib/engines/basalt/basaltLinux.d.ts +23 -0
  71. package/packages/providers/lib/engines/basalt/basaltLinux.js +47 -0
  72. package/packages/providers/lib/engines/basalt/basaltMacOS.d.ts +17 -0
  73. package/packages/providers/lib/engines/basalt/basaltMacOS.js +19 -0
  74. package/packages/providers/lib/engines/basalt/basaltWindows.d.ts +24 -0
  75. package/packages/providers/lib/engines/basalt/basaltWindows.js +49 -0
  76. package/packages/providers/lib/engines/engineOs.d.ts +24 -0
  77. package/packages/providers/lib/engines/engineOs.js +17 -0
  78. package/packages/providers/lib/{hyperqwen.d.ts → engines/hyperqwen/hyperqwen.d.ts} +2 -2
  79. package/packages/providers/lib/{hyperqwen.js → engines/hyperqwen/hyperqwen.js} +14 -2
  80. package/packages/providers/lib/engines/hyperqwen/hyperqwenAdapter.d.ts +38 -0
  81. package/packages/providers/lib/engines/hyperqwen/hyperqwenAdapter.js +115 -0
  82. package/packages/providers/lib/engines/hyperqwen/hyperqwenArch.d.ts +9 -0
  83. package/packages/providers/lib/engines/hyperqwen/hyperqwenArch.js +9 -0
  84. package/packages/providers/lib/engines/hyperqwen/hyperqwenDebian.d.ts +9 -0
  85. package/packages/providers/lib/engines/hyperqwen/hyperqwenDebian.js +9 -0
  86. package/packages/providers/lib/engines/hyperqwen/hyperqwenFedora.d.ts +9 -0
  87. package/packages/providers/lib/engines/hyperqwen/hyperqwenFedora.js +9 -0
  88. package/packages/providers/lib/engines/hyperqwen/hyperqwenLinux.d.ts +10 -0
  89. package/packages/providers/lib/engines/hyperqwen/hyperqwenLinux.js +14 -0
  90. package/packages/providers/lib/engines/hyperqwen/hyperqwenMacOS.d.ts +9 -0
  91. package/packages/providers/lib/engines/hyperqwen/hyperqwenMacOS.js +9 -0
  92. package/packages/providers/lib/engines/hyperqwen/hyperqwenWindows.d.ts +9 -0
  93. package/packages/providers/lib/engines/hyperqwen/hyperqwenWindows.js +9 -0
  94. package/packages/providers/lib/{infernix.d.ts → engines/infernix/infernix.d.ts} +7 -4
  95. package/packages/providers/lib/{infernix.js → engines/infernix/infernix.js} +53 -8
  96. package/packages/providers/lib/engines/infernix/infernixAdapter.d.ts +52 -0
  97. package/packages/providers/lib/engines/infernix/infernixAdapter.js +235 -0
  98. package/packages/providers/lib/engines/infernix/infernixArch.d.ts +9 -0
  99. package/packages/providers/lib/engines/infernix/infernixArch.js +9 -0
  100. package/packages/providers/lib/engines/infernix/infernixDebian.d.ts +9 -0
  101. package/packages/providers/lib/engines/infernix/infernixDebian.js +9 -0
  102. package/packages/providers/lib/engines/infernix/infernixFedora.d.ts +9 -0
  103. package/packages/providers/lib/engines/infernix/infernixFedora.js +9 -0
  104. package/packages/providers/lib/engines/infernix/infernixLinux.d.ts +17 -0
  105. package/packages/providers/lib/engines/infernix/infernixLinux.js +35 -0
  106. package/packages/providers/lib/engines/infernix/infernixMacOS.d.ts +16 -0
  107. package/packages/providers/lib/engines/infernix/infernixMacOS.js +18 -0
  108. package/packages/providers/lib/engines/infernix/infernixWindows.d.ts +16 -0
  109. package/packages/providers/lib/engines/infernix/infernixWindows.js +34 -0
  110. package/packages/providers/lib/{llamacpp.d.ts → engines/llamacpp/llamacpp.d.ts} +2 -2
  111. package/packages/providers/lib/{llamacpp.js → engines/llamacpp/llamacpp.js} +12 -2
  112. package/packages/providers/lib/engines/llamacpp/llamacppAdapter.d.ts +50 -0
  113. package/packages/providers/lib/engines/llamacpp/llamacppAdapter.js +274 -0
  114. package/packages/providers/lib/engines/llamacpp/llamacppArch.d.ts +9 -0
  115. package/packages/providers/lib/engines/llamacpp/llamacppArch.js +9 -0
  116. package/packages/providers/lib/engines/llamacpp/llamacppDebian.d.ts +9 -0
  117. package/packages/providers/lib/engines/llamacpp/llamacppDebian.js +9 -0
  118. package/packages/providers/lib/engines/llamacpp/llamacppFedora.d.ts +9 -0
  119. package/packages/providers/lib/engines/llamacpp/llamacppFedora.js +9 -0
  120. package/packages/providers/lib/engines/llamacpp/llamacppLinux.d.ts +17 -0
  121. package/packages/providers/lib/engines/llamacpp/llamacppLinux.js +28 -0
  122. package/packages/providers/lib/engines/llamacpp/llamacppMacOS.d.ts +15 -0
  123. package/packages/providers/lib/engines/llamacpp/llamacppMacOS.js +17 -0
  124. package/packages/providers/lib/engines/llamacpp/llamacppWindows.d.ts +15 -0
  125. package/packages/providers/lib/engines/llamacpp/llamacppWindows.js +26 -0
  126. package/packages/providers/lib/{ninfer.d.ts → engines/ninfer/ninfer.d.ts} +2 -2
  127. package/packages/providers/lib/{ninfer.js → engines/ninfer/ninfer.js} +25 -3
  128. package/packages/providers/lib/engines/ninfer/ninferAdapter.d.ts +81 -0
  129. package/packages/providers/lib/engines/ninfer/ninferAdapter.js +392 -0
  130. package/packages/providers/lib/engines/ninfer/ninferArch.d.ts +9 -0
  131. package/packages/providers/lib/engines/ninfer/ninferArch.js +9 -0
  132. package/packages/providers/lib/engines/ninfer/ninferDebian.d.ts +9 -0
  133. package/packages/providers/lib/engines/ninfer/ninferDebian.js +9 -0
  134. package/packages/providers/lib/engines/ninfer/ninferFedora.d.ts +9 -0
  135. package/packages/providers/lib/engines/ninfer/ninferFedora.js +9 -0
  136. package/packages/providers/lib/engines/ninfer/ninferLinux.d.ts +17 -0
  137. package/packages/providers/lib/engines/ninfer/ninferLinux.js +37 -0
  138. package/packages/providers/lib/engines/ninfer/ninferMacOS.d.ts +15 -0
  139. package/packages/providers/lib/engines/ninfer/ninferMacOS.js +17 -0
  140. package/packages/providers/lib/engines/ninfer/ninferWindows.d.ts +29 -0
  141. package/packages/providers/lib/engines/ninfer/ninferWindows.js +59 -0
  142. package/packages/providers/lib/engines/strata/strata.d.ts +1 -0
  143. package/packages/providers/lib/engines/strata/strata.js +264 -0
  144. package/packages/providers/lib/engines/strata/strataAdapter.d.ts +97 -0
  145. package/packages/providers/lib/engines/strata/strataAdapter.js +463 -0
  146. package/packages/providers/lib/engines/strata/strataArch.d.ts +9 -0
  147. package/packages/providers/lib/engines/strata/strataArch.js +9 -0
  148. package/packages/providers/lib/engines/strata/strataDebian.d.ts +9 -0
  149. package/packages/providers/lib/engines/strata/strataDebian.js +9 -0
  150. package/packages/providers/lib/engines/strata/strataFedora.d.ts +9 -0
  151. package/packages/providers/lib/engines/strata/strataFedora.js +9 -0
  152. package/packages/providers/lib/engines/strata/strataLinux.d.ts +21 -0
  153. package/packages/providers/lib/engines/strata/strataLinux.js +30 -0
  154. package/packages/providers/lib/engines/strata/strataMacOS.d.ts +16 -0
  155. package/packages/providers/lib/engines/strata/strataMacOS.js +17 -0
  156. package/packages/providers/lib/engines/strata/strataWindows.d.ts +27 -0
  157. package/packages/providers/lib/engines/strata/strataWindows.js +37 -0
  158. package/packages/providers/lib/engines.d.ts +8 -5
  159. package/packages/providers/lib/engines.js +22 -11
  160. package/packages/providers/lib/guidelines.d.ts +5 -4
  161. package/packages/providers/lib/guidelines.js +18 -5
  162. package/packages/providers/lib/index.d.ts +33 -24
  163. package/packages/providers/lib/index.js +46 -24
  164. package/packages/providers/lib/model-defaults.d.ts +10 -5
  165. package/packages/providers/lib/model-defaults.js +47 -5
  166. package/packages/providers/lib/platform.d.ts +8 -5
  167. package/packages/providers/lib/platform.js +27 -7
  168. package/packages/providers/lib/presets.d.ts +6 -4
  169. package/packages/providers/lib/presets.js +53 -5
  170. package/packages/providers/lib/systemDeps.d.ts +313 -0
  171. package/packages/providers/lib/systemDeps.js +284 -0
  172. package/packages/providers/lib/vram.d.ts +34 -8
  173. package/packages/providers/lib/vram.js +81 -8
  174. package/packages/providers/package.json +2 -2
  175. package/packages/service/lib/index.d.ts +187 -23
  176. package/packages/service/lib/index.js +667 -90
  177. package/packages/service/lib/launch-target.d.ts +19 -0
  178. package/packages/service/lib/launch-target.js +28 -0
  179. package/packages/service/lib/run-logs.d.ts +72 -0
  180. package/packages/service/lib/run-logs.js +125 -0
  181. package/packages/service/lib/types.d.ts +166 -8
  182. package/packages/service/lib/types.js +1 -1
  183. package/packages/service/package.json +2 -2
  184. package/packages/tool/lib/index.d.ts +1 -1
  185. package/packages/tool/lib/index.js +1 -1
  186. package/packages/tool/package.json +2 -2
  187. package/packages/ui/lib/config.d.ts +89 -0
  188. package/packages/ui/lib/config.js +251 -0
  189. package/packages/ui/lib/deps.d.ts +4 -4
  190. package/packages/ui/lib/deps.js +1 -1
  191. package/packages/ui/lib/form.d.ts +1 -1
  192. package/packages/ui/lib/form.js +1 -1
  193. package/packages/ui/lib/index.d.ts +7 -1
  194. package/packages/ui/lib/index.js +12 -2
  195. package/packages/ui/lib/meter.d.ts +1 -1
  196. package/packages/ui/lib/meter.js +1 -1
  197. package/packages/ui/lib/ops/engine.d.ts +216 -0
  198. package/packages/ui/lib/ops/engine.js +697 -0
  199. package/packages/ui/lib/ops/get-steps.d.ts +98 -0
  200. package/packages/ui/lib/ops/get-steps.js +359 -0
  201. package/packages/ui/lib/ops/hf.d.ts +42 -0
  202. package/packages/ui/lib/ops/hf.js +150 -0
  203. package/packages/ui/lib/ops/logs.d.ts +78 -0
  204. package/packages/ui/lib/ops/logs.js +119 -0
  205. package/packages/ui/lib/ops/model.d.ts +71 -0
  206. package/packages/ui/lib/ops/model.js +123 -0
  207. package/packages/ui/lib/request.d.ts +106 -0
  208. package/packages/ui/lib/request.js +80 -0
  209. package/packages/ui/lib/route.d.ts +106 -422
  210. package/packages/ui/lib/route.js +136 -1845
  211. package/packages/ui/lib/routes/chat-template.d.ts +1 -0
  212. package/packages/ui/lib/routes/chat-template.js +1 -0
  213. package/packages/ui/lib/routes/deps.d.ts +1 -0
  214. package/packages/ui/lib/routes/deps.js +1 -0
  215. package/packages/ui/lib/routes/download.d.ts +1 -0
  216. package/packages/ui/lib/routes/download.js +1 -0
  217. package/packages/ui/lib/routes/get.d.ts +1 -0
  218. package/packages/ui/lib/routes/get.js +106 -0
  219. package/packages/ui/lib/routes/install.d.ts +16 -0
  220. package/packages/ui/lib/routes/install.js +36 -0
  221. package/packages/ui/lib/routes/launch.d.ts +24 -0
  222. package/packages/ui/lib/routes/launch.js +74 -0
  223. package/packages/ui/lib/routes/logs.d.ts +57 -0
  224. package/packages/ui/lib/routes/logs.js +117 -0
  225. package/packages/ui/lib/routes/provider-delete.d.ts +15 -0
  226. package/packages/ui/lib/routes/provider-delete.js +37 -0
  227. package/packages/ui/lib/routes/register.d.ts +16 -0
  228. package/packages/ui/lib/routes/register.js +28 -0
  229. package/packages/ui/lib/routes/save.d.ts +18 -0
  230. package/packages/ui/lib/routes/save.js +159 -0
  231. package/packages/ui/lib/routes/stop.d.ts +19 -0
  232. package/packages/ui/lib/routes/stop.js +32 -0
  233. package/packages/ui/lib/routes/stream.d.ts +40 -0
  234. package/packages/ui/lib/routes/stream.js +68 -0
  235. package/packages/ui/lib/routes/summary.d.ts +15 -0
  236. package/packages/ui/lib/routes/summary.js +26 -0
  237. package/packages/ui/lib/routes/unregister.d.ts +14 -0
  238. package/packages/ui/lib/routes/unregister.js +26 -0
  239. package/packages/ui/lib/viewmodels/deps.d.ts +1 -0
  240. package/packages/ui/lib/viewmodels/deps.js +1 -0
  241. package/packages/ui/lib/viewmodels/depsHelpers.d.ts +1 -0
  242. package/packages/ui/lib/viewmodels/depsHelpers.js +94 -0
  243. package/packages/ui/lib/viewmodels/summary.d.ts +145 -0
  244. package/packages/ui/lib/viewmodels/summary.js +245 -0
  245. package/packages/ui/lib/viewmodels/summaryHelpers.d.ts +30 -0
  246. package/packages/ui/lib/viewmodels/summaryHelpers.js +42 -0
  247. package/packages/ui/lib/warnings.d.ts +1 -1
  248. package/packages/ui/lib/warnings.js +1 -1
  249. package/packages/ui/package.json +4 -4
  250. package/packages/providers/lib/strata.d.ts +0 -15
  251. package/packages/providers/lib/strata.js +0 -14
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The stored provider entry a launch, stop, or run-log write targets. The
3
+ * rule the ui's launch-record paths carried privately moves here so the
4
+ * record persistence and the run-log key rule share one matcher.
5
+ * @module dsh-plugin-local-infer/service/launch-target
6
+ */
7
+ import type { Config } from 'dsh-plugin-local-infer/core';
8
+ import type { LaunchTargetEntry } from './types.ts';
9
+ /**
10
+ * findLaunchTarget resolves the stored provider entry a launch, stop, or
11
+ * run targets: the entry the request names by id, or (an id the card does
12
+ * not send, a launch of the active config) the stored entry with the same
13
+ * engine and model. A request with no resolvable entry reads as undefined,
14
+ * which the launch-record paths take as "no provider config to re-link" and
15
+ * the run-log key rule takes as "key on the engine id". The entry type
16
+ * stays generic so each caller keeps its own stored entry shape.
17
+ */
18
+ export declare function findLaunchTarget<T extends LaunchTargetEntry>(providers: readonly T[], engineId: string, providerId: string | undefined, config: Config): T | undefined;
19
+ //# sourceMappingURL=launch-target.d.ts.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The stored provider entry a launch, stop, or run-log write targets. The
3
+ * rule the ui's launch-record paths carried privately moves here so the
4
+ * record persistence and the run-log key rule share one matcher.
5
+ * @module dsh-plugin-local-infer/service/launch-target
6
+ */
7
+ /**
8
+ * findLaunchTarget resolves the stored provider entry a launch, stop, or
9
+ * run targets: the entry the request names by id, or (an id the card does
10
+ * not send, a launch of the active config) the stored entry with the same
11
+ * engine and model. A request with no resolvable entry reads as undefined,
12
+ * which the launch-record paths take as "no provider config to re-link" and
13
+ * the run-log key rule takes as "key on the engine id". The entry type
14
+ * stays generic so each caller keeps its own stored entry shape.
15
+ */
16
+ export function findLaunchTarget(providers, engineId, providerId, config) {
17
+ if (providerId !== undefined) {
18
+ const byId = providers.find((entry) => entry.id === providerId);
19
+ if (byId !== undefined)
20
+ return byId;
21
+ }
22
+ const model = typeof config.model === 'string' ? config.model : undefined;
23
+ if (model === undefined)
24
+ return undefined;
25
+ return providers.find((entry) => entry.engine === engineId &&
26
+ (typeof entry.config.model === 'string' ? entry.config.model : undefined) === model);
27
+ }
28
+ //# sourceMappingURL=launch-target.js.map
@@ -0,0 +1,72 @@
1
+ /**
2
+ * The per-key live run-log hub: one bounded buffer per run key with fan-out
3
+ * to subscribers, so every provider process (Get, Launch, Prereqs, Download,
4
+ * Install, Stop) writes its output to one place the streaming web route
5
+ * serves. The LocalInfer facade publishes the five operations (begin,
6
+ * append, read, subscribe, end); runLogKey names the key rule every caller
7
+ * shares.
8
+ * @module dsh-plugin-local-infer/service/run-logs
9
+ */
10
+ import type { Config } from 'dsh-plugin-local-infer/core';
11
+ import type { LaunchTargetEntry, RunLogListener, RunLogSnapshot } from './types.ts';
12
+ /**
13
+ * RunLogStore holds one RunBuffer per run key and fans RunLogEvents out to
14
+ * the key's subscribers. A throwing listener is isolated per notify, so a
15
+ * broken stream connection never blocks a writer or another subscriber.
16
+ */
17
+ export declare class RunLogStore {
18
+ private readonly buffers;
19
+ /**
20
+ * begin resets the key's buffer to the seed line, restarts the seq at 0,
21
+ * marks the run running, and notifies subscribers with the reset event so
22
+ * a mid-run attached reader replaces its display instead of appending
23
+ * onto the previous run.
24
+ */
25
+ begin(key: string, seed: string): void;
26
+ /**
27
+ * append grows the key's text (tail-capped to LOG_TAIL_BYTES, the same
28
+ * rule the stored last-run logs use), counts the append, and notifies
29
+ * subscribers with the chunk. A key with no open run opens one lazily
30
+ * without a seed, and an append to a settled run reopens it, so a note
31
+ * that lands after the run (an engine-death line) still streams; the
32
+ * caller that opens a run this way closes it with its own end.
33
+ */
34
+ append(key: string, chunk: string): void;
35
+ /**
36
+ * read answers the key's catch-up snapshot. A key that never ran reads as
37
+ * an empty stopped snapshot.
38
+ */
39
+ read(key: string): RunLogSnapshot;
40
+ /**
41
+ * subscribe registers a listener for the key's events and returns the
42
+ * disposer. Registering the same function twice delivers once (Set
43
+ * semantics); each connection registers its own closure.
44
+ */
45
+ subscribe(key: string, listener: RunLogListener): () => void;
46
+ /**
47
+ * end clears the running flag and emits the end event; the text stays
48
+ * readable until the next begin. A key with no open run is a no-op, so a
49
+ * repeated end never emits a second end event.
50
+ */
51
+ end(key: string): void;
52
+ /**
53
+ * bufferFor reads the key's buffer, starting an empty stopped one for a
54
+ * key that has none.
55
+ */
56
+ private bufferFor;
57
+ /**
58
+ * notify hands one event to each listener of one buffer. It iterates a
59
+ * copy so a disposer running inside a listener cannot disturb the pass,
60
+ * and it swallows listener throws: a broken connection must never fail
61
+ * the writer.
62
+ */
63
+ private notify;
64
+ }
65
+ /**
66
+ * runLogKey names the run key every run path and the logs route share, so
67
+ * the client can always predict the key for its request: the request's
68
+ * providerId when it names one, else the stored entry findLaunchTarget
69
+ * matches by engine and model, else the engine id.
70
+ */
71
+ export declare function runLogKey(providers: readonly LaunchTargetEntry[], engineId: string, providerId: string | undefined, config: Config): string;
72
+ //# sourceMappingURL=run-logs.d.ts.map
@@ -0,0 +1,125 @@
1
+ /**
2
+ * The per-key live run-log hub: one bounded buffer per run key with fan-out
3
+ * to subscribers, so every provider process (Get, Launch, Prereqs, Download,
4
+ * Install, Stop) writes its output to one place the streaming web route
5
+ * serves. The LocalInfer facade publishes the five operations (begin,
6
+ * append, read, subscribe, end); runLogKey names the key rule every caller
7
+ * shares.
8
+ * @module dsh-plugin-local-infer/service/run-logs
9
+ */
10
+ import { LOG_TAIL_BYTES } from '../../core/lib/index.js';
11
+ import { findLaunchTarget } from "./launch-target.js";
12
+ /**
13
+ * RunLogStore holds one RunBuffer per run key and fans RunLogEvents out to
14
+ * the key's subscribers. A throwing listener is isolated per notify, so a
15
+ * broken stream connection never blocks a writer or another subscriber.
16
+ */
17
+ export class RunLogStore {
18
+ buffers = new Map();
19
+ /**
20
+ * begin resets the key's buffer to the seed line, restarts the seq at 0,
21
+ * marks the run running, and notifies subscribers with the reset event so
22
+ * a mid-run attached reader replaces its display instead of appending
23
+ * onto the previous run.
24
+ */
25
+ begin(key, seed) {
26
+ const buffer = this.bufferFor(key);
27
+ buffer.text = seed;
28
+ buffer.seq = 0;
29
+ buffer.running = true;
30
+ this.notify(buffer, { kind: 'reset', seq: 0, text: seed });
31
+ }
32
+ /**
33
+ * append grows the key's text (tail-capped to LOG_TAIL_BYTES, the same
34
+ * rule the stored last-run logs use), counts the append, and notifies
35
+ * subscribers with the chunk. A key with no open run opens one lazily
36
+ * without a seed, and an append to a settled run reopens it, so a note
37
+ * that lands after the run (an engine-death line) still streams; the
38
+ * caller that opens a run this way closes it with its own end.
39
+ */
40
+ append(key, chunk) {
41
+ const buffer = this.bufferFor(key);
42
+ buffer.text += chunk;
43
+ if (buffer.text.length > LOG_TAIL_BYTES) {
44
+ buffer.text = buffer.text.slice(-LOG_TAIL_BYTES);
45
+ }
46
+ buffer.running = true;
47
+ buffer.seq += 1;
48
+ this.notify(buffer, { kind: 'log', seq: buffer.seq, text: chunk });
49
+ }
50
+ /**
51
+ * read answers the key's catch-up snapshot. A key that never ran reads as
52
+ * an empty stopped snapshot.
53
+ */
54
+ read(key) {
55
+ const buffer = this.buffers.get(key);
56
+ if (buffer === undefined)
57
+ return { seq: 0, text: '', running: false };
58
+ return { seq: buffer.seq, text: buffer.text, running: buffer.running };
59
+ }
60
+ /**
61
+ * subscribe registers a listener for the key's events and returns the
62
+ * disposer. Registering the same function twice delivers once (Set
63
+ * semantics); each connection registers its own closure.
64
+ */
65
+ subscribe(key, listener) {
66
+ const buffer = this.bufferFor(key);
67
+ buffer.listeners.add(listener);
68
+ return () => {
69
+ buffer.listeners.delete(listener);
70
+ };
71
+ }
72
+ /**
73
+ * end clears the running flag and emits the end event; the text stays
74
+ * readable until the next begin. A key with no open run is a no-op, so a
75
+ * repeated end never emits a second end event.
76
+ */
77
+ end(key) {
78
+ const buffer = this.buffers.get(key);
79
+ if (buffer === undefined || !buffer.running)
80
+ return;
81
+ buffer.running = false;
82
+ this.notify(buffer, { kind: 'end', seq: buffer.seq });
83
+ }
84
+ /**
85
+ * bufferFor reads the key's buffer, starting an empty stopped one for a
86
+ * key that has none.
87
+ */
88
+ bufferFor(key) {
89
+ let buffer = this.buffers.get(key);
90
+ if (buffer === undefined) {
91
+ buffer = { text: '', seq: 0, running: false, listeners: new Set() };
92
+ this.buffers.set(key, buffer);
93
+ }
94
+ return buffer;
95
+ }
96
+ /**
97
+ * notify hands one event to each listener of one buffer. It iterates a
98
+ * copy so a disposer running inside a listener cannot disturb the pass,
99
+ * and it swallows listener throws: a broken connection must never fail
100
+ * the writer.
101
+ */
102
+ notify(buffer, event) {
103
+ for (const listener of [...buffer.listeners]) {
104
+ try {
105
+ listener(event);
106
+ }
107
+ catch {
108
+ // The connection is broken; its own route tears it down.
109
+ }
110
+ }
111
+ }
112
+ }
113
+ /**
114
+ * runLogKey names the run key every run path and the logs route share, so
115
+ * the client can always predict the key for its request: the request's
116
+ * providerId when it names one, else the stored entry findLaunchTarget
117
+ * matches by engine and model, else the engine id.
118
+ */
119
+ export function runLogKey(providers, engineId, providerId, config) {
120
+ if (providerId !== undefined && providerId.trim() !== '')
121
+ return providerId;
122
+ const target = findLaunchTarget(providers, engineId, undefined, config);
123
+ return target?.id ?? engineId;
124
+ }
125
+ //# sourceMappingURL=run-logs.js.map
@@ -1,4 +1,4 @@
1
- import type { CommandOutcome, Config, DefaultModel, ModelDirectoryEntry, EngineAdapter, EngineDepPlan, EnginePlatformConfig, Guideline, GuidelineResult, GpuUsageProbe, HardwareProfile, InstallResult, LaunchPlan, LaunchProgress, ModelRow, Preset, PresetSource, ProcessLine, ProviderLaunchRecord, ProviderRef, ProviderStatus, ReLinkOutcome, RegisterResult, ReserveResolution, ReserveSource, ResolvedDefaults, SettingsOp, SystemDep, VramBreakdown, VramModel, VramVerdict } from 'dsh-plugin-local-infer/core';
1
+ import type { BuildMode, CommandLogger, CommandOutcome, CommandRunner, Config, DefaultModel, ModelCacheEntry, ModelDirectoryEntry, EngineAdapter, EngineDepPlan, EngineLaunchState, EnginePlatformConfig, Guideline, GuidelineResult, GpuUsageProbe, HardwareProfile, InstallResult, LaunchPlan, LaunchProgress, ModelRow, Preset, PresetSource, ProcessLine, ProviderLaunchRecord, ProviderRef, ProviderStatus, ReLinkOutcome, RegisterResult, ReserveResolution, ReserveSource, ResolvedDefaults, SettingsOp, SystemDep, VramBreakdown, VramModel, VramVerdict } from 'dsh-plugin-local-infer/core';
2
2
  /**
3
3
  * EstimateResult is the answer to an estimate call: the full VRAM breakdown,
4
4
  * the one-word verdict the meter renders, the source the numbers came from,
@@ -79,6 +79,7 @@ export interface LaunchResult {
79
79
  buildLogs?: string;
80
80
  pid?: number;
81
81
  parentPid?: number;
82
+ state?: EngineLaunchState;
82
83
  }
83
84
  /**
84
85
  * LaunchOptions tunes the launch health poll: the interval between attempts
@@ -92,7 +93,11 @@ export interface LaunchResult {
92
93
  * (on) or is written to the card's Logs section (off). `autoRebuild` is the
93
94
  * card's "Auto Rebuild" checkbox: when false, the deploy step skips the git
94
95
  * sync (fetch, rebase, rebuild) and launches the checkout as-is. Absent reads
95
- * as true (the rebuild runs).
96
+ * as true (the rebuild runs). `onLog` is the launch run's log sink: the
97
+ * deploy step writes the `$ <command>` line of every mutating command it runs
98
+ * (image pull, model download) through it before the child spawns, and the
99
+ * health poll (these options ride straight into the adapter's HealthCheckOptions)
100
+ * writes its `> GET <healthUrl>` line and settled verdict through it.
96
101
  */
97
102
  export interface LaunchOptions {
98
103
  pollMs?: number;
@@ -100,6 +105,7 @@ export interface LaunchOptions {
100
105
  onProgress?: LaunchProgress;
101
106
  allowRunDeps?: boolean;
102
107
  autoRebuild?: boolean;
108
+ onLog?: CommandLogger;
103
109
  }
104
110
  /**
105
111
  * RegisterModelOptions tunes the model registration: agentDefault points the
@@ -109,6 +115,18 @@ export interface LaunchOptions {
109
115
  export interface RegisterModelOptions {
110
116
  agentDefault?: boolean;
111
117
  }
118
+ /**
119
+ * RunInstallOptions tunes the Play/Run install: `onLog` is the install run's
120
+ * log sink, and the service writes each command the runner is about to
121
+ * execute as a `$ <command>` line through it before the child spawns, so the
122
+ * run reads command first and per-dep results after. `runner` injects the
123
+ * command runner, so a test captures the command lines without spawning a
124
+ * real shell (the way downloadModel injects its download runner).
125
+ */
126
+ export interface RunInstallOptions {
127
+ onLog?: CommandLogger;
128
+ runner?: CommandRunner;
129
+ }
112
130
  /**
113
131
  * FetchPresetResult is the answer to a mod-search preset fetch: the tagged
114
132
  * preset when the bridge fetched and extracted it, a storage flag, and a
@@ -148,9 +166,27 @@ export interface DownloadResult {
148
166
  /**
149
167
  * DownloadModelOptions tunes the model download: runner injects the command
150
168
  * runner, so a test captures the rendered hf CLI command without a live hf.
169
+ * onChunk is the callback the runner hands each streamed stdout and stderr
170
+ * chunk to, so the card's Logs pane reads the hf CLI's progress live while a
171
+ * long download runs. useHubCache selects the hub-cache layout (no
172
+ * `--local-dir`, the `models--{ns}--{name}` directories) when the model
173
+ * directory is the plugin default; a user-overridden directory keeps the flat
174
+ * `--local-dir` target. signal is the card's cancel: an abort interrupts the
175
+ * in-flight hf child (SIGINT, then SIGTERM). Resume is within-invocation only
176
+ * (the hf CLI resumes a network blip via HTTP Range inside one run); a killed
177
+ * run re-downloads from zero on the re-run, and the orphaned `.incomplete`
178
+ * blob lingers until `hf cache prune`.
179
+ * onLog is the run's log-text sink: the service writes the rendered command's
180
+ * `$ <hf download ...>` line through it before the runner spawns the child,
181
+ * so every download path (Get step, launch, download route) logs the command
182
+ * exactly once, from the exec site, ahead of its output.
151
183
  */
152
184
  export interface DownloadModelOptions {
153
- runner?: (command: string) => Promise<CommandOutcome>;
185
+ runner?: (command: string, signal?: AbortSignal, onChunk?: (chunk: string) => void) => Promise<CommandOutcome>;
186
+ onChunk?: (chunk: string) => void;
187
+ onLog?: CommandLogger;
188
+ useHubCache?: boolean;
189
+ signal?: AbortSignal;
154
190
  }
155
191
  /**
156
192
  * SettingsNamespaceDescriptor is the structural view of one profile plugin
@@ -209,6 +245,71 @@ export interface SettingsForms {
209
245
  }): Promise<SettingsDescribeAnswer>;
210
246
  mutate(ns: string, ops: readonly SettingsOp[], expectedRevision?: number): Promise<SettingsRemoteResponse<unknown> | undefined>;
211
247
  }
248
+ /**
249
+ * LaunchTargetEntry is the stored provider entry shape findLaunchTarget
250
+ * reads: the entry id, the engine id, and the config whose model field the
251
+ * engine-and-model match prices. The ui store's StoredProviderConfig
252
+ * satisfies it structurally, so the matcher stays free of the store shape.
253
+ */
254
+ export interface LaunchTargetEntry {
255
+ id: string;
256
+ engine: string;
257
+ config: Config;
258
+ }
259
+ /**
260
+ * RunLogSnapshot is the catch-up read of one run key's live log: the append
261
+ * count reached (the `seq` every later stream event continues), the bounded
262
+ * tail text (LOG_TAIL_BYTES), and whether a run is still writing. A mid-run
263
+ * page refresh or a late-opened Logs pane renders from this snapshot and
264
+ * then follows the live events, so it shows the same text a continuously
265
+ * attached reader has.
266
+ */
267
+ export interface RunLogSnapshot {
268
+ seq: number;
269
+ text: string;
270
+ running: boolean;
271
+ }
272
+ /**
273
+ * RunLogResetEvent announces a beginRun for the subscribed key: the buffer
274
+ * restarted at the seed text with seq 0, so a reader replaces its display
275
+ * instead of appending onto the previous run's text.
276
+ */
277
+ export interface RunLogResetEvent {
278
+ kind: 'reset';
279
+ seq: number;
280
+ text: string;
281
+ }
282
+ /**
283
+ * RunLogAppendEvent carries one live log append: `text` is the appended
284
+ * chunk (not the buffer), and `seq` is the buffer's append count after the
285
+ * chunk landed, so a reader that caught up from a snapshot can drop events
286
+ * it already holds.
287
+ */
288
+ export interface RunLogAppendEvent {
289
+ kind: 'log';
290
+ seq: number;
291
+ text: string;
292
+ }
293
+ /**
294
+ * RunLogEndEvent announces endRun for the subscribed key: the run stopped
295
+ * writing at `seq`. The text stays readable (readRunLog) until the next
296
+ * beginRun for that key.
297
+ */
298
+ export interface RunLogEndEvent {
299
+ kind: 'end';
300
+ seq: number;
301
+ }
302
+ /**
303
+ * RunLogEvent is one live update on a subscribed run key: the buffer reset
304
+ * by a begin, one appended chunk, or the run's end.
305
+ */
306
+ export type RunLogEvent = RunLogResetEvent | RunLogAppendEvent | RunLogEndEvent;
307
+ /**
308
+ * RunLogListener receives a subscribed key's RunLogEvents. Listeners are
309
+ * independent per connection: a throwing or removed listener never blocks
310
+ * the writer or another subscriber.
311
+ */
312
+ export type RunLogListener = (event: RunLogEvent) => void;
212
313
  /**
213
314
  * LocalInferService is the surface the service publishes on ctx.localInfer.
214
315
  * Providers register engines, presets, and guidelines against the registries;
@@ -239,11 +340,11 @@ export interface LocalInferService {
239
340
  gpuUsage?: GpuUsageProbe | null;
240
341
  }): Promise<string[]>;
241
342
  guidelines(config: Config, hw: HardwareProfile, engineId?: string): Promise<GuidelineResult[]>;
242
- deps(engineId: string, buildMode: 'docker' | 'local', hw: HardwareProfile): Promise<readonly SystemDep[]>;
243
- installString(engineId: string, buildMode: 'docker' | 'local', hw: HardwareProfile): Promise<string>;
244
- runInstall(engineId: string, buildMode: 'docker' | 'local', hw: HardwareProfile): Promise<InstallResult>;
343
+ deps(engineId: string, buildMode: BuildMode, hw: HardwareProfile): Promise<readonly SystemDep[]>;
344
+ installString(engineId: string, buildMode: BuildMode, hw: HardwareProfile): Promise<string>;
345
+ runInstall(engineId: string, buildMode: BuildMode, hw: HardwareProfile, options?: RunInstallOptions): Promise<InstallResult>;
245
346
  launch(plan: LaunchPlan, options?: LaunchOptions): Promise<LaunchResult>;
246
- stop(plan: LaunchPlan): Promise<void>;
347
+ stop(plan: LaunchPlan, log?: CommandLogger): Promise<void>;
247
348
  reLinkProviders(entries: readonly {
248
349
  id: string;
249
350
  record: ProviderLaunchRecord;
@@ -258,15 +359,72 @@ export interface LocalInferService {
258
359
  * clears it, which the route's effect does on dispose.
259
360
  */
260
361
  setEngineDeathObserver(observer: ((event: EngineDeathEvent) => void) | undefined): void;
362
+ /**
363
+ * registerSudoObserver reserves `key`'s slot (the runLogKey rule every run
364
+ * path shares) for the callback one run registers to hear that a sudo
365
+ * command is waiting for the user's password on the CLI: the observer
366
+ * writes the note line into its own run's Logs so the card user learns
367
+ * where the prompt landed. Registering a key that is taken replaces the
368
+ * old hook, and the returned disposer removes only its own hook, so
369
+ * concurrent runs never clobber each other's note routing and a settle
370
+ * never clears another run's slot.
371
+ */
372
+ registerSudoObserver(key: string, observer: (command: string) => void): () => void;
373
+ /**
374
+ * notifySudoNeeded is the seam a command runner reports a waiting sudo
375
+ * prompt through: a guarded runner calls it when its probe finds no cached
376
+ * credentials, and the service forwards the command to every observer the
377
+ * runs registered (the shared CLI password wait can block any run, and
378
+ * the announce seam does not name the triggering run). No observer, or a
379
+ * throwing one, never fails the run that is already racing the sudo
380
+ * deadline.
381
+ */
382
+ notifySudoNeeded(command: string): void;
383
+ /**
384
+ * beginRun starts one provider process's run under `key` (the runLogKey
385
+ * rule every run path shares): the live buffer resets to the `seed` line
386
+ * (the `--- <process>...` separator), the running flag goes true, the
387
+ * monotone seq restarts, and subscribers get a reset notice so a mid-run
388
+ * attached reader replaces rather than appends.
389
+ */
390
+ beginRun(key: string, seed: string): void;
391
+ /**
392
+ * appendRunLog appends one chunk to `key`'s live buffer (tail-capped to
393
+ * LOG_TAIL_BYTES) and notifies subscribers with the chunk. Appending with
394
+ * no open run opens one lazily without a seed, so a note that lands after
395
+ * a settled run (an engine-death line, for example) still reaches the
396
+ * Logs.
397
+ */
398
+ appendRunLog(key: string, text: string): void;
399
+ /**
400
+ * readRunLog answers `key`'s catch-up snapshot (mid-run page refresh,
401
+ * late pane open): the seq reached, the bounded tail text, and the
402
+ * running flag. A key that never ran reads as an empty stopped snapshot.
403
+ */
404
+ readRunLog(key: string): RunLogSnapshot;
405
+ /**
406
+ * subscribeRunLog registers a listener for `key`'s RunLogEvents (appends,
407
+ * run begin, run end) and returns the disposer. Listeners are independent
408
+ * per connection; a slow or closed connection never blocks a writer.
409
+ */
410
+ subscribeRunLog(key: string, listener: RunLogListener): () => void;
411
+ /**
412
+ * endRun clears `key`'s running flag and emits the end event. The text
413
+ * stays readable (readRunLog) until the next beginRun for that key. An
414
+ * end on a key with no open run is a no-op.
415
+ */
416
+ endRun(key: string): void;
261
417
  registerModel(plan: LaunchPlan, model: ModelRow, options?: RegisterModelOptions): Promise<RegisterResult>;
262
418
  removeModel(providerId: string, modelId: string): Promise<void>;
263
419
  resolveDefaults(engineId: string, modelId: string, hw: HardwareProfile, explicit?: Config): Promise<ResolvedDefaults>;
264
420
  fetchPreset(source: PresetSource, options?: FetchPresetOptions): Promise<FetchPresetResult>;
265
421
  defaultModelDirectory(): string;
422
+ defaultDatasetDirectory(): string;
266
423
  hfCliAvailable(options?: HfCliOptions): Promise<string | null>;
267
424
  downloadModel(entry: DefaultModel, directory: string, options?: DownloadModelOptions): Promise<DownloadResult>;
268
425
  downloadChatTemplate(repo: string, directory: string, options?: DownloadModelOptions): Promise<DownloadResult>;
269
426
  modelIsRegistered(providerId: string, modelId: string): Promise<boolean>;
270
427
  listModelDirectory(directory: string): ModelDirectoryEntry[];
428
+ listModelCache(): ModelCacheEntry[];
271
429
  }
272
- //# sourceMappingURL=types.d.ts.map
430
+ //# sourceMappingURL=types.d.ts.map
@@ -1,2 +1,2 @@
1
1
  export {};
2
- //# sourceMappingURL=types.js.map
2
+ //# sourceMappingURL=types.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-local-infer-service",
3
- "version": "0.1.0",
3
+ "version": "0.1.4",
4
4
  "description": "Service Definition for the dsh local-inference capability seam (ctx.localInfer): the engine, preset, and guideline registries plus the orchestration entry points (estimate, guidelines, deps, installString, runInstall, launch, registerModel). Carries no store of its own.",
5
5
  "keywords": [
6
6
  "dsh",
@@ -36,6 +36,6 @@
36
36
  "@deepseek-ai/cordis": ">=4.0.1"
37
37
  },
38
38
  "devDependencies": {
39
- "@deepseek-ai/cordis": "^4.0.1"
39
+ "@deepseek-ai/cordis": "^4.0.6-alpha.2"
40
40
  }
41
41
  }
@@ -24,4 +24,4 @@ declare const plugin: {
24
24
  apply: typeof apply;
25
25
  };
26
26
  export default plugin;
27
- //# sourceMappingURL=index.d.ts.map
27
+ //# sourceMappingURL=index.d.ts.map
@@ -22,4 +22,4 @@ export function apply(ctx) {
22
22
  }
23
23
  const plugin = { name, inject, apply };
24
24
  export default plugin;
25
- //# sourceMappingURL=index.js.map
25
+ //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-local-infer-tool",
3
- "version": "0.1.0",
3
+ "version": "0.1.4",
4
4
  "description": "Model-facing tools for the dsh local-inference plugin: local_infer_estimate, local_infer_launch, local_infer_status, and local_infer_register, each on its own timeout budget, plus the system-prompt section that tells the agent when to use them",
5
5
  "keywords": [
6
6
  "dsh",
@@ -36,6 +36,6 @@
36
36
  "@deepseek-ai/cordis": ">=4.0.1"
37
37
  },
38
38
  "devDependencies": {
39
- "@deepseek-ai/cordis": "^4.0.1"
39
+ "@deepseek-ai/cordis": "^4.0.6-alpha.2"
40
40
  }
41
41
  }
@@ -0,0 +1,89 @@
1
+ /**
2
+ * The stored-config persistence the routes and ops share. The values live in
3
+ * ~/.dsh/local-infer/config.json, shared with the CLI, so the browser never
4
+ * sees a secret it did not store. Every read sanitizes the file field by
5
+ * field, so a by-hand edit never poisons the deploy step or the re-link rule.
6
+ * @module dsh-plugin-local-infer/ui/config
7
+ */
8
+ import type { Config, ProviderLaunchRecord } from 'dsh-plugin-local-infer/core';
9
+ /**
10
+ * The config file the route owns. It sits under the dsh home so a web user and
11
+ * a CLI user share one file, the way modsearch shares ~/.modsearch.
12
+ */
13
+ export declare function localInferConfigPath(): string;
14
+ /**
15
+ * StoredPlatformConfig is the per-engine platform config the deploy step
16
+ * consumes (§3.10): where the engine platform lives locally and the git repo
17
+ * that overrides the engine's default upstream. The map is keyed by engine id,
18
+ * so the stored entry carries no id of its own; the route adds it when it
19
+ * builds the EnginePlatformConfig the service registry stores.
20
+ */
21
+ export interface StoredPlatformConfig {
22
+ engineDirectory?: string;
23
+ engineFork?: string;
24
+ buildCommands?: string;
25
+ dockerTag?: string;
26
+ }
27
+ /**
28
+ * StoredProviderConfig is one saved provider model+engine config the card
29
+ * lists: a stable id the card edits and deletes against, the engine and the
30
+ * full parameter config it serves, the per-engine platform config the deploy
31
+ * step consumes, the per-provider Auto Rebuild flag the card's checkbox
32
+ * stores, and the launch record the launch step persists when it
33
+ * starts the entry's engine (the engine pid, start time, launch arguments,
34
+ * and the DSH process pid that launched it). The record is what a DSH
35
+ * restart re-links a surviving engine to its config; a stop clears it.
36
+ */
37
+ export interface StoredProviderConfig {
38
+ id: string;
39
+ engine: string;
40
+ config: Config;
41
+ platform: StoredPlatformConfig;
42
+ autoRebuild?: boolean;
43
+ launch?: ProviderLaunchRecord;
44
+ }
45
+ export interface StoredConfig {
46
+ engine: string;
47
+ config: Config;
48
+ allowRunDeps: boolean;
49
+ platform: Record<string, StoredPlatformConfig>;
50
+ showHelp: boolean;
51
+ providers: StoredProviderConfig[];
52
+ logPath: string;
53
+ lastLogs: string;
54
+ }
55
+ /**
56
+ * readConfig reads the stored engine, config, trust gate, and per-engine
57
+ * platform configs. A missing or broken file reads as the scaffold default
58
+ * (NInfer, empty config, gate off, no platform configs) so the card always has
59
+ * a form to draw. A platform entry that is not an object (or whose fields are
60
+ * not strings) is dropped, so a by-hand edit never poisons the deploy step.
61
+ */
62
+ export declare function readConfig(): StoredConfig;
63
+ /**
64
+ * writeConfig persists the engine, config, trust gate, per-engine platform
65
+ * configs, and the help toggle, creating the directory tree on first write.
66
+ */
67
+ export declare function writeConfig(engine: string, config: Config, allowRunDeps: boolean, platform?: Record<string, StoredPlatformConfig>, showHelp?: boolean, providers?: StoredProviderConfig[], logPath?: string, lastLogs?: string): void;
68
+ /**
69
+ * writeStored persists a read StoredConfig with a patch over one or more of
70
+ * its fields, leaving every unpatched field as the read returned it. The
71
+ * eight stored fields travel as one value through the ops, so a caller names
72
+ * only the field it changes (the providers list, the last-run logs) instead
73
+ * of re-passing every field the read returned.
74
+ */
75
+ export declare function writeStored(stored: StoredConfig, patch?: Partial<StoredConfig>): void;
76
+ /**
77
+ * parsePlatformConfigs reads the stored platform map, keeping only entries
78
+ * whose fields are strings. A non-object map or a non-object entry reads as
79
+ * absent, so the deploy step never sees a platform config it cannot price.
80
+ */
81
+ export declare function parsePlatformConfigs(raw: unknown): Record<string, StoredPlatformConfig>;
82
+ /**
83
+ * parseStoredPlatformConfig reads one engine's platform config (the launch
84
+ * request's `platform` key), keeping only string fields. A non-object or an
85
+ * object with no string fields reads as absent, so the launch keeps the stored
86
+ * entry the save route synced.
87
+ */
88
+ export declare function parseStoredPlatformConfig(raw: unknown): StoredPlatformConfig | undefined;
89
+ //# sourceMappingURL=config.d.ts.map