aicodeman 1.49.0 → 1.50.1

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 (324) hide show
  1. package/README.md +30 -4
  2. package/dist/cli-install-runner.d.ts +112 -0
  3. package/dist/cli-install-runner.d.ts.map +1 -0
  4. package/dist/cli-install-runner.js +289 -0
  5. package/dist/cli-install-runner.js.map +1 -0
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +2 -2
  8. package/dist/cli.js.map +1 -1
  9. package/dist/config/attachment-guard.d.ts +11 -0
  10. package/dist/config/attachment-guard.d.ts.map +1 -1
  11. package/dist/config/attachment-guard.js +21 -1
  12. package/dist/config/attachment-guard.js.map +1 -1
  13. package/dist/config/local-model-catalog.d.ts +188 -0
  14. package/dist/config/local-model-catalog.d.ts.map +1 -0
  15. package/dist/config/local-model-catalog.js +556 -0
  16. package/dist/config/local-model-catalog.js.map +1 -0
  17. package/dist/config-backup.js +1 -1
  18. package/dist/config-backup.js.map +1 -1
  19. package/dist/custom-model-hosts-writer.d.ts +50 -0
  20. package/dist/custom-model-hosts-writer.d.ts.map +1 -0
  21. package/dist/custom-model-hosts-writer.js +110 -0
  22. package/dist/custom-model-hosts-writer.js.map +1 -0
  23. package/dist/git-clone.d.ts.map +1 -1
  24. package/dist/git-clone.js +21 -1
  25. package/dist/git-clone.js.map +1 -1
  26. package/dist/git-fetch.d.ts.map +1 -1
  27. package/dist/git-fetch.js +6 -0
  28. package/dist/git-fetch.js.map +1 -1
  29. package/dist/git-workspace-status.d.ts.map +1 -1
  30. package/dist/git-workspace-status.js +4 -0
  31. package/dist/git-workspace-status.js.map +1 -1
  32. package/dist/git-worktrees.d.ts.map +1 -1
  33. package/dist/git-worktrees.js +6 -0
  34. package/dist/git-worktrees.js.map +1 -1
  35. package/dist/hooks-config.d.ts +15 -3
  36. package/dist/hooks-config.d.ts.map +1 -1
  37. package/dist/hooks-config.js +108 -4
  38. package/dist/hooks-config.js.map +1 -1
  39. package/dist/live-worktree.d.ts +73 -15
  40. package/dist/live-worktree.d.ts.map +1 -1
  41. package/dist/live-worktree.js +200 -32
  42. package/dist/live-worktree.js.map +1 -1
  43. package/dist/local-model/connect.d.ts +155 -0
  44. package/dist/local-model/connect.d.ts.map +1 -0
  45. package/dist/local-model/connect.js +243 -0
  46. package/dist/local-model/connect.js.map +1 -0
  47. package/dist/local-model/developer-tools.d.ts +45 -0
  48. package/dist/local-model/developer-tools.d.ts.map +1 -0
  49. package/dist/local-model/developer-tools.js +105 -0
  50. package/dist/local-model/developer-tools.js.map +1 -0
  51. package/dist/local-model/format.d.ts +39 -0
  52. package/dist/local-model/format.d.ts.map +1 -0
  53. package/dist/local-model/format.js +48 -0
  54. package/dist/local-model/format.js.map +1 -0
  55. package/dist/local-model/hardware.d.ts +125 -0
  56. package/dist/local-model/hardware.d.ts.map +1 -0
  57. package/dist/local-model/hardware.js +336 -0
  58. package/dist/local-model/hardware.js.map +1 -0
  59. package/dist/local-model/harness-facts.d.ts +77 -0
  60. package/dist/local-model/harness-facts.d.ts.map +1 -0
  61. package/dist/local-model/harness-facts.js +145 -0
  62. package/dist/local-model/harness-facts.js.map +1 -0
  63. package/dist/local-model/install-job.d.ts +431 -0
  64. package/dist/local-model/install-job.d.ts.map +1 -0
  65. package/dist/local-model/install-job.js +1822 -0
  66. package/dist/local-model/install-job.js.map +1 -0
  67. package/dist/local-model/ollama-client.d.ts +216 -0
  68. package/dist/local-model/ollama-client.d.ts.map +1 -0
  69. package/dist/local-model/ollama-client.js +636 -0
  70. package/dist/local-model/ollama-client.js.map +1 -0
  71. package/dist/local-model/paths.d.ts +64 -0
  72. package/dist/local-model/paths.d.ts.map +1 -0
  73. package/dist/local-model/paths.js +75 -0
  74. package/dist/local-model/paths.js.map +1 -0
  75. package/dist/local-model/recommend.d.ts +118 -0
  76. package/dist/local-model/recommend.d.ts.map +1 -0
  77. package/dist/local-model/recommend.js +430 -0
  78. package/dist/local-model/recommend.js.map +1 -0
  79. package/dist/local-model/runtime.d.ts +339 -0
  80. package/dist/local-model/runtime.d.ts.map +1 -0
  81. package/dist/local-model/runtime.js +1240 -0
  82. package/dist/local-model/runtime.js.map +1 -0
  83. package/dist/local-model/state-store.d.ts +45 -0
  84. package/dist/local-model/state-store.d.ts.map +1 -0
  85. package/dist/local-model/state-store.js +261 -0
  86. package/dist/local-model/state-store.js.map +1 -0
  87. package/dist/readmymind-collectors.d.ts.map +1 -1
  88. package/dist/readmymind-collectors.js +4 -0
  89. package/dist/readmymind-collectors.js.map +1 -1
  90. package/dist/reboot-restore.d.ts +3 -1
  91. package/dist/reboot-restore.d.ts.map +1 -1
  92. package/dist/reboot-restore.js.map +1 -1
  93. package/dist/session.d.ts +29 -7
  94. package/dist/session.d.ts.map +1 -1
  95. package/dist/session.js +63 -10
  96. package/dist/session.js.map +1 -1
  97. package/dist/types/common.d.ts +5 -0
  98. package/dist/types/common.d.ts.map +1 -1
  99. package/dist/types/index.d.ts +4 -0
  100. package/dist/types/index.d.ts.map +1 -1
  101. package/dist/types/index.js +4 -0
  102. package/dist/types/index.js.map +1 -1
  103. package/dist/types/local-model-install.d.ts +533 -0
  104. package/dist/types/local-model-install.d.ts.map +1 -0
  105. package/dist/types/local-model-install.js +169 -0
  106. package/dist/types/local-model-install.js.map +1 -0
  107. package/dist/types/local-model.d.ts +551 -0
  108. package/dist/types/local-model.d.ts.map +1 -0
  109. package/dist/types/local-model.js +115 -0
  110. package/dist/types/local-model.js.map +1 -0
  111. package/dist/types/session.d.ts +17 -6
  112. package/dist/types/session.d.ts.map +1 -1
  113. package/dist/types/session.js.map +1 -1
  114. package/dist/utils/cli-executable-resolver.d.ts +18 -0
  115. package/dist/utils/cli-executable-resolver.d.ts.map +1 -1
  116. package/dist/utils/cli-executable-resolver.js +34 -2
  117. package/dist/utils/cli-executable-resolver.js.map +1 -1
  118. package/dist/utils/git-availability.d.ts +65 -0
  119. package/dist/utils/git-availability.d.ts.map +1 -0
  120. package/dist/utils/git-availability.js +134 -0
  121. package/dist/utils/git-availability.js.map +1 -0
  122. package/dist/web/agent-skill-default-migration.d.ts +60 -0
  123. package/dist/web/agent-skill-default-migration.d.ts.map +1 -0
  124. package/dist/web/agent-skill-default-migration.js +97 -0
  125. package/dist/web/agent-skill-default-migration.js.map +1 -0
  126. package/dist/web/approval-inbox.d.ts +10 -0
  127. package/dist/web/approval-inbox.d.ts.map +1 -1
  128. package/dist/web/approval-inbox.js +15 -0
  129. package/dist/web/approval-inbox.js.map +1 -1
  130. package/dist/web/case-state-sync.d.ts +28 -0
  131. package/dist/web/case-state-sync.d.ts.map +1 -0
  132. package/dist/web/case-state-sync.js +41 -0
  133. package/dist/web/case-state-sync.js.map +1 -0
  134. package/dist/web/ports/config-port.d.ts +1 -1
  135. package/dist/web/ports/config-port.d.ts.map +1 -1
  136. package/dist/web/public/admin-ui.js.gz +0 -0
  137. package/dist/web/public/api-client.c9b1cddc.js.gz +0 -0
  138. package/dist/web/public/{app.9ea37070.js → app.07398d90.js} +1 -1
  139. package/dist/web/public/app.07398d90.js.br +0 -0
  140. package/dist/web/public/app.07398d90.js.gz +0 -0
  141. package/dist/web/public/approvals-ui.js.gz +0 -0
  142. package/dist/web/public/constants.782170e1.js.gz +0 -0
  143. package/dist/web/public/cron-ui.js.gz +0 -0
  144. package/dist/web/public/edit-history-ui.js.gz +0 -0
  145. package/dist/web/public/entrance-animations.js.gz +0 -0
  146. package/dist/web/public/foreign-sessions.js.gz +0 -0
  147. package/dist/web/public/git-status-ui.js.gz +0 -0
  148. package/dist/web/public/header-divider.eb2d2463.js.gz +0 -0
  149. package/dist/web/public/home-sessions.js +38 -18
  150. package/dist/web/public/home-sessions.js.br +0 -0
  151. package/dist/web/public/home-sessions.js.gz +0 -0
  152. package/dist/web/public/host-wake-ui.js.gz +0 -0
  153. package/dist/web/public/{i18n.a5e82c95.js → i18n.519d025e.js} +2 -2
  154. package/dist/web/public/i18n.519d025e.js.br +0 -0
  155. package/dist/web/public/i18n.519d025e.js.gz +0 -0
  156. package/dist/web/public/image-input.a5d0f8f3.js.gz +0 -0
  157. package/dist/web/public/index.html +88 -13
  158. package/dist/web/public/index.html.br +0 -0
  159. package/dist/web/public/index.html.gz +0 -0
  160. package/dist/web/public/input-cjk.8bc46081.js.gz +0 -0
  161. package/dist/web/public/{keyboard-accessory.b941676c.js → keyboard-accessory.0800fc44.js} +160 -2
  162. package/dist/web/public/keyboard-accessory.0800fc44.js.br +0 -0
  163. package/dist/web/public/keyboard-accessory.0800fc44.js.gz +0 -0
  164. package/dist/web/public/local-model-ui.js +1735 -0
  165. package/dist/web/public/local-model-ui.js.br +0 -0
  166. package/dist/web/public/local-model-ui.js.gz +0 -0
  167. package/dist/web/public/mobile-handlers.f7c3f692.js.gz +0 -0
  168. package/dist/web/public/mobile-ime-preview.2dbaf262.js.gz +0 -0
  169. package/dist/web/public/mobile-overview.js +30 -14
  170. package/dist/web/public/mobile-overview.js.br +0 -0
  171. package/dist/web/public/mobile-overview.js.gz +0 -0
  172. package/dist/web/public/mobile.4dfd5c55.css +1 -0
  173. package/dist/web/public/mobile.4dfd5c55.css.br +0 -0
  174. package/dist/web/public/mobile.4dfd5c55.css.gz +0 -0
  175. package/dist/web/public/notification-manager.feb82c04.js.gz +0 -0
  176. package/dist/web/public/orchestrator-panel.js.gz +0 -0
  177. package/dist/web/public/{panels-ui.8bcd4473.js → panels-ui.9ba2683e.js} +100 -98
  178. package/dist/web/public/panels-ui.9ba2683e.js.br +0 -0
  179. package/dist/web/public/panels-ui.9ba2683e.js.gz +0 -0
  180. package/dist/web/public/ralph-panel.b350e2ef.js.gz +0 -0
  181. package/dist/web/public/ralph-wizard.b6c0dd19.js.gz +0 -0
  182. package/dist/web/public/readmymind-ui.js.gz +0 -0
  183. package/dist/web/public/reboot-restore-ui.js +2 -0
  184. package/dist/web/public/reboot-restore-ui.js.br +0 -0
  185. package/dist/web/public/reboot-restore-ui.js.gz +0 -0
  186. package/dist/web/public/respawn-ui.304ba0d4.js.gz +0 -0
  187. package/dist/web/public/sanitize-html.e7147e76.js.gz +0 -0
  188. package/dist/web/public/session-lineage.js.gz +0 -0
  189. package/dist/web/public/{session-ui.a7c8c095.js → session-ui.8f300b14.js} +21 -21
  190. package/dist/web/public/session-ui.8f300b14.js.br +0 -0
  191. package/dist/web/public/session-ui.8f300b14.js.gz +0 -0
  192. package/dist/web/public/{settings-ui.18f92052.js → settings-ui.8b37cf07.js} +14 -14
  193. package/dist/web/public/settings-ui.8b37cf07.js.br +0 -0
  194. package/dist/web/public/settings-ui.8b37cf07.js.gz +0 -0
  195. package/dist/web/public/spreadsheet-preview-worker.js.gz +0 -0
  196. package/dist/web/public/spreadsheet-preview.75c751de.js.gz +0 -0
  197. package/dist/web/public/spreadsheet-xlsx-core.js.gz +0 -0
  198. package/dist/web/public/styles.21b93520.css +1 -0
  199. package/dist/web/public/styles.21b93520.css.br +0 -0
  200. package/dist/web/public/styles.21b93520.css.gz +0 -0
  201. package/dist/web/public/subagent-windows.07277a58.js.gz +0 -0
  202. package/dist/web/public/sw.js +2 -2
  203. package/dist/web/public/sw.js.br +0 -0
  204. package/dist/web/public/sw.js.gz +0 -0
  205. package/dist/web/public/tab-layout-browser.2d6189f7.js.gz +0 -0
  206. package/dist/web/public/tab-rail-resize.b5cdceaf.js.gz +0 -0
  207. package/dist/web/public/terminal-keycode229-recovery.98843069.js.gz +0 -0
  208. package/dist/web/public/terminal-split.js.gz +0 -0
  209. package/dist/web/public/terminal-tile.js.gz +0 -0
  210. package/dist/web/public/{terminal-ui.a7883640.js → terminal-ui.f92eae28.js} +2 -2
  211. package/dist/web/public/terminal-ui.f92eae28.js.br +0 -0
  212. package/dist/web/public/terminal-ui.f92eae28.js.gz +0 -0
  213. package/dist/web/public/tile-grid.js.gz +0 -0
  214. package/dist/web/public/ultracode-panel.js.gz +0 -0
  215. package/dist/web/public/ultracode-windows.js.gz +0 -0
  216. package/dist/web/public/vendor/dompurify.min.js.gz +0 -0
  217. package/dist/web/public/vendor/exceljs.min.js.gz +0 -0
  218. package/dist/web/public/vendor/fflate.min.js.gz +0 -0
  219. package/dist/web/public/vendor/marked.min.js.gz +0 -0
  220. package/dist/web/public/vendor/xterm-addon-fit.min.js.gz +0 -0
  221. package/dist/web/public/vendor/xterm-addon-serialize.min.js.gz +0 -0
  222. package/dist/web/public/vendor/xterm-addon-unicode11.min.js.gz +0 -0
  223. package/dist/web/public/vendor/xterm-addon-webgl.min.js.gz +0 -0
  224. package/dist/web/public/vendor/xterm-predictive-echo.276b11d9.js.gz +0 -0
  225. package/dist/web/public/vendor/xterm-zerolag-input.1be42307.js.gz +0 -0
  226. package/dist/web/public/vendor/xterm.css.gz +0 -0
  227. package/dist/web/public/vendor/xterm.min.js.gz +0 -0
  228. package/dist/web/public/{voice-input.2342c37b.js → voice-input.d0580528.js} +232 -137
  229. package/dist/web/public/voice-input.d0580528.js.br +0 -0
  230. package/dist/web/public/voice-input.d0580528.js.gz +0 -0
  231. package/dist/web/public/voice-pcm-worklet.js.gz +0 -0
  232. package/dist/web/public/webview-tabs.js.gz +0 -0
  233. package/dist/web/public/whats-new.json +9 -9
  234. package/dist/web/repo-status.d.ts.map +1 -1
  235. package/dist/web/repo-status.js +4 -0
  236. package/dist/web/repo-status.js.map +1 -1
  237. package/dist/web/route-helpers.d.ts +29 -0
  238. package/dist/web/route-helpers.d.ts.map +1 -1
  239. package/dist/web/route-helpers.js +37 -0
  240. package/dist/web/route-helpers.js.map +1 -1
  241. package/dist/web/routes/approval-routes.d.ts.map +1 -1
  242. package/dist/web/routes/approval-routes.js +3 -2
  243. package/dist/web/routes/approval-routes.js.map +1 -1
  244. package/dist/web/routes/case-routes.d.ts.map +1 -1
  245. package/dist/web/routes/case-routes.js +31 -5
  246. package/dist/web/routes/case-routes.js.map +1 -1
  247. package/dist/web/routes/cli-registry-routes.d.ts +1 -27
  248. package/dist/web/routes/cli-registry-routes.d.ts.map +1 -1
  249. package/dist/web/routes/cli-registry-routes.js +11 -202
  250. package/dist/web/routes/cli-registry-routes.js.map +1 -1
  251. package/dist/web/routes/custom-model-routes.d.ts +15 -0
  252. package/dist/web/routes/custom-model-routes.d.ts.map +1 -1
  253. package/dist/web/routes/custom-model-routes.js +114 -33
  254. package/dist/web/routes/custom-model-routes.js.map +1 -1
  255. package/dist/web/routes/file-routes.d.ts +4 -2
  256. package/dist/web/routes/file-routes.d.ts.map +1 -1
  257. package/dist/web/routes/file-routes.js +160 -24
  258. package/dist/web/routes/file-routes.js.map +1 -1
  259. package/dist/web/routes/html-view-routes.d.ts.map +1 -1
  260. package/dist/web/routes/html-view-routes.js +12 -3
  261. package/dist/web/routes/html-view-routes.js.map +1 -1
  262. package/dist/web/routes/index.d.ts +1 -0
  263. package/dist/web/routes/index.d.ts.map +1 -1
  264. package/dist/web/routes/index.js +1 -0
  265. package/dist/web/routes/index.js.map +1 -1
  266. package/dist/web/routes/local-model-routes.d.ts +103 -0
  267. package/dist/web/routes/local-model-routes.d.ts.map +1 -0
  268. package/dist/web/routes/local-model-routes.js +210 -0
  269. package/dist/web/routes/local-model-routes.js.map +1 -0
  270. package/dist/web/routes/reboot-restore-routes.d.ts.map +1 -1
  271. package/dist/web/routes/reboot-restore-routes.js +16 -0
  272. package/dist/web/routes/reboot-restore-routes.js.map +1 -1
  273. package/dist/web/routes/session-routes.d.ts.map +1 -1
  274. package/dist/web/routes/session-routes.js +22 -27
  275. package/dist/web/routes/session-routes.js.map +1 -1
  276. package/dist/web/routes/system-routes.d.ts +2 -2
  277. package/dist/web/routes/system-routes.d.ts.map +1 -1
  278. package/dist/web/routes/system-routes.js +23 -4
  279. package/dist/web/routes/system-routes.js.map +1 -1
  280. package/dist/web/schemas.d.ts +30 -0
  281. package/dist/web/schemas.d.ts.map +1 -1
  282. package/dist/web/schemas.js +52 -5
  283. package/dist/web/schemas.js.map +1 -1
  284. package/dist/web/self-update.d.ts.map +1 -1
  285. package/dist/web/self-update.js +4 -0
  286. package/dist/web/self-update.js.map +1 -1
  287. package/dist/web/sensitive-path.d.ts.map +1 -1
  288. package/dist/web/sensitive-path.js +5 -0
  289. package/dist/web/sensitive-path.js.map +1 -1
  290. package/dist/web/server.d.ts +20 -0
  291. package/dist/web/server.d.ts.map +1 -1
  292. package/dist/web/server.js +83 -7
  293. package/dist/web/server.js.map +1 -1
  294. package/dist/web/voice-stream.d.ts +4 -3
  295. package/dist/web/voice-stream.d.ts.map +1 -1
  296. package/dist/web/voice-stream.js +5 -4
  297. package/dist/web/voice-stream.js.map +1 -1
  298. package/package.json +2 -1
  299. package/skills/codeman/SKILL.md +318 -24
  300. package/skills/codeman/preamble.sh +242 -16
  301. package/skills/codeman/reference/recipes.md +1 -1
  302. package/skills/codeman/reference/verbs.md +101 -1
  303. package/dist/web/public/app.9ea37070.js.br +0 -0
  304. package/dist/web/public/app.9ea37070.js.gz +0 -0
  305. package/dist/web/public/i18n.a5e82c95.js.br +0 -0
  306. package/dist/web/public/i18n.a5e82c95.js.gz +0 -0
  307. package/dist/web/public/keyboard-accessory.b941676c.js.br +0 -0
  308. package/dist/web/public/keyboard-accessory.b941676c.js.gz +0 -0
  309. package/dist/web/public/mobile.67c8eb5b.css +0 -1
  310. package/dist/web/public/mobile.67c8eb5b.css.br +0 -0
  311. package/dist/web/public/mobile.67c8eb5b.css.gz +0 -0
  312. package/dist/web/public/panels-ui.8bcd4473.js.br +0 -0
  313. package/dist/web/public/panels-ui.8bcd4473.js.gz +0 -0
  314. package/dist/web/public/session-ui.a7c8c095.js.br +0 -0
  315. package/dist/web/public/session-ui.a7c8c095.js.gz +0 -0
  316. package/dist/web/public/settings-ui.18f92052.js.br +0 -0
  317. package/dist/web/public/settings-ui.18f92052.js.gz +0 -0
  318. package/dist/web/public/styles.6a718331.css +0 -1
  319. package/dist/web/public/styles.6a718331.css.br +0 -0
  320. package/dist/web/public/styles.6a718331.css.gz +0 -0
  321. package/dist/web/public/terminal-ui.a7883640.js.br +0 -0
  322. package/dist/web/public/terminal-ui.a7883640.js.gz +0 -0
  323. package/dist/web/public/voice-input.2342c37b.js.br +0 -0
  324. package/dist/web/public/voice-input.2342c37b.js.gz +0 -0
@@ -0,0 +1,145 @@
1
+ /**
2
+ * @fileoverview What the server knows about each catalogue harness on this machine, for the
3
+ * local model recommendation. Server side: this is the one module of src/local-model/ that
4
+ * reads the CLI registry, so `recommend()` can stay pure and name no CLI.
5
+ *
6
+ * `buildHarnessFacts()` walks the catalogue's `harnesses` rows and, for every row:
7
+ * - resolves its `cli` in the CLI registry AT CALL TIME (never in a module-level constant),
8
+ * and leaves the row out when the CLI is unknown, disabled, or has no custom model
9
+ * mechanism (`capabilities.customModelInjection.kind` is `unsupported`);
10
+ * - reports `label` from the registry entry and `installed` from the same probe the page
11
+ * render and `GET /api/clis` use (`utils/cli-installed-probes.ts`), asked once per build;
12
+ * - reports `installable` only for a STOCK CLI that is not installed and whose install
13
+ * command for this platform needs no administrator rights (`installCommandNeedsAdmin()`),
14
+ * and then carries that command as `installCommand`, so the consent screen can print the
15
+ * literal text. The command is the COMPILED stock one (`stockInstallCommand()`), never the
16
+ * one a `clis.json` override supplies: it is exactly what the install job would run, and
17
+ * an override file must not be able to change that;
18
+ * - supplies `acceptsModelId` (`cliAcceptsCustomModelId()`), the test a custom model launch
19
+ * applies to the model id before anything is written.
20
+ *
21
+ * Rules:
22
+ * - No CLI id is compared with a literal here or anywhere: the id comes from the catalogue
23
+ * row and everything else from the registry entry it resolves to.
24
+ * - Read-only: nothing is installed, written or spawned beyond the existing availability
25
+ * probe. An install command is only read as text, never run.
26
+ * - Never throws: a probe that fails reads as "not installed" (with a warning in the log),
27
+ * and the registry's install data still answers `installable`.
28
+ *
29
+ * `cliAcceptsCustomModelId()` composes the two pure pieces the launch path itself calls
30
+ * (`buildCustomModelInjection()` and `matchesPattern()` on the entry's `model` launch param).
31
+ * The launch path keeps that composition inline at two sites in
32
+ * src/web/routes/session-routes.ts (the quick-start `customModel` branch and
33
+ * `POST /api/sessions/:id/custom-model`). A change to the rule there must be made here too,
34
+ * until the three share one helper.
35
+ */
36
+ import { matchesPattern } from '../config/cli-registry/patterns.js';
37
+ import { stockInstallCommand } from '../cli-install-runner.js';
38
+ import { getCli } from '../config/cli-registry/registry.js';
39
+ import { buildCustomModelInjection } from '../custom-model-injection.js';
40
+ import { isCliEntryInstalled, probeStockCliAvailability } from '../utils/cli-installed-probes.js';
41
+ import { getErrorMessage } from '../types.js';
42
+ export const defaultHarnessFactsDeps = {
43
+ getCli,
44
+ probeInstalled: async () => {
45
+ const stockAvailability = await probeStockCliAvailability();
46
+ return (entry) => isCliEntryInstalled(entry, stockAvailability);
47
+ },
48
+ installCommandFor: (entry) => stockInstallCommand(entry.id),
49
+ };
50
+ /**
51
+ * A command segment that starts with `sudo` or `brew`: at the start of the text, or after a
52
+ * pipe, `&&`, `||`, `;`, a line break or an opening parenthesis.
53
+ */
54
+ const ADMIN_COMMAND = /(?:^|[;&|(\n])\s*(?:sudo|brew)(?=\s|$)/;
55
+ /**
56
+ * Whether an install command needs administrator rights, read off its text.
57
+ * - `sudo ...` asks for an administrator password.
58
+ * - `brew ...` needs Homebrew, and installing Homebrew needs an administrator (the same rule
59
+ * the installer's no-admin route applies to the CLI menu).
60
+ * `curl ... | bash` installers write into the home directory, and the install runner points an
61
+ * `npm install -g` at a prefix the server user can write, so neither counts.
62
+ */
63
+ export function installCommandNeedsAdmin(command) {
64
+ return ADMIN_COMMAND.test(command);
65
+ }
66
+ /** Stands in for a configured endpoint: the launch id a recipe forces depends on the model id alone. */
67
+ const PROBE_ENDPOINT = {
68
+ id: 'local-model-probe',
69
+ label: 'local model probe',
70
+ baseUrl: 'http://127.0.0.1',
71
+ };
72
+ /**
73
+ * Whether a custom model launch of this CLI would accept `modelId`.
74
+ *
75
+ * A CLI whose config alone cannot select the model gets the id forced onto its `model` launch
76
+ * param (the recipe's `launchModel` template). The argv engine DROPS a token that fails the
77
+ * param's pattern, which would start the CLI on its own default provider, so the launch path
78
+ * refuses such an id up front. This is that test: false when the forced value does not match
79
+ * the pattern, and false for a CLI with no custom model mechanism at all.
80
+ */
81
+ export function cliAcceptsCustomModelId(entry, modelId) {
82
+ try {
83
+ const injection = buildCustomModelInjection(entry, PROBE_ENDPOINT, modelId);
84
+ if (injection.kind === 'unsupported')
85
+ return false;
86
+ const forcedLaunchModel = injection.launchModel;
87
+ const modelSpec = entry.launch.params.model;
88
+ return !(forcedLaunchModel !== undefined &&
89
+ modelSpec?.type === 'token' &&
90
+ !matchesPattern(modelSpec.pattern, forcedLaunchModel));
91
+ }
92
+ catch {
93
+ // A recipe that cannot be rendered cannot be launched either.
94
+ return false;
95
+ }
96
+ }
97
+ /** One fact per catalogue harness that resolves in the CLI registry, in catalogue order. */
98
+ export async function buildHarnessFacts(catalog, deps = {}) {
99
+ const resolved = { ...defaultHarnessFactsDeps, ...deps };
100
+ let isInstalled;
101
+ try {
102
+ isInstalled = await resolved.probeInstalled();
103
+ }
104
+ catch (err) {
105
+ console.warn(`[local-model] The CLI availability probe failed, reading every harness as not installed: ${getErrorMessage(err)}`);
106
+ isInstalled = () => false;
107
+ }
108
+ const facts = [];
109
+ const seen = new Set();
110
+ for (const row of catalog.harnesses) {
111
+ // The catalogue lists a CLI once; a second row for it adds nothing a fact could carry.
112
+ if (seen.has(row.cli))
113
+ continue;
114
+ seen.add(row.cli);
115
+ const entry = resolved.getCli(row.cli);
116
+ if (!entry || !entry.enabled)
117
+ continue;
118
+ if (entry.capabilities.customModelInjection.kind === 'unsupported')
119
+ continue;
120
+ let installed = false;
121
+ try {
122
+ installed = isInstalled(entry);
123
+ }
124
+ catch (err) {
125
+ console.warn(`[local-model] Probing ${entry.label} failed, reading it as not installed: ${getErrorMessage(err)}`);
126
+ }
127
+ let installCommand;
128
+ if (!installed && entry.stock) {
129
+ const command = resolved.installCommandFor(entry);
130
+ if (command !== undefined && command.trim() !== '' && !installCommandNeedsAdmin(command)) {
131
+ installCommand = command;
132
+ }
133
+ }
134
+ facts.push({
135
+ cli: row.cli,
136
+ label: entry.label,
137
+ installed,
138
+ installable: installCommand !== undefined,
139
+ ...(installCommand !== undefined ? { installCommand } : {}),
140
+ acceptsModelId: (modelId) => cliAcceptsCustomModelId(entry, modelId),
141
+ });
142
+ }
143
+ return facts;
144
+ }
145
+ //# sourceMappingURL=harness-facts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness-facts.js","sourceRoot":"","sources":["../../src/local-model/harness-facts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAA4B,MAAM,8BAA8B,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAClG,OAAO,EAAE,eAAe,EAA4C,MAAM,aAAa,CAAC;AAoBxF,MAAM,CAAC,MAAM,uBAAuB,GAAqB;IACvD,MAAM;IACN,cAAc,EAAE,KAAK,IAAI,EAAE;QACzB,MAAM,iBAAiB,GAAG,MAAM,yBAAyB,EAAE,CAAC;QAC5D,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,mBAAmB,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;IAClE,CAAC;IACD,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAY,CAAC;CACtE,CAAC;AAEF;;;GAGG;AACH,MAAM,aAAa,GAAG,wCAAwC,CAAC;AAE/D;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAe;IACtD,OAAO,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACrC,CAAC;AAED,wGAAwG;AACxG,MAAM,cAAc,GAAwB;IAC1C,EAAE,EAAE,mBAAmB;IACvB,KAAK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,CAAC;YAC3D,cAAc,EAAE,CAAC,OAAe,EAAE,EAAE,CAAC,uBAAuB,CAAC,KAAK,EAAE,OAAO,CAAC;SAC7E,CAAC,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,431 @@
1
+ /**
2
+ * @fileoverview The local model install job: its state table, the pure reducer over it, the
3
+ * pure view of it, and the service that drives it.
4
+ *
5
+ * ONE job at a time. The job is five steps in a fixed order (`LOCAL_MODEL_INSTALL_STEPS`:
6
+ * runtime, model, verify, agent, connect; `agent` is left out when the coding agent is
7
+ * installed). Its state is one of five (`LocalModelInstallState`), stored in the state file.
8
+ *
9
+ * The state table. "On disk" names what lies under the local model folder; the two writes
10
+ * outside it belong to the `connect` step.
11
+ *
12
+ * | State | On disk | A server restart | Cancel | Allowed next actions |
13
+ * |--------------|-------------------------------------------|-----------------------------|------------------------|---------------------------------|
14
+ * | `idle` | nothing, or leftovers a Remove could not | stays `idle` | refused (409) | install |
15
+ * | | delete (never read back) | | | |
16
+ * | `installing` | what the finished steps wrote, plus what | becomes `paused` at the | becomes `paused` at | cancel |
17
+ * | | the current step has written so far | same step; nothing resumes | the same step | |
18
+ * | | (see the step table) | without a click | | |
19
+ * | `paused` | as `installing` at that step, nothing in | stays `paused` | refused (409) | resume, install (another |
20
+ * | | flight | | | choice), remove |
21
+ * | `failed` | as `installing` at that step, nothing in | stays `failed`, same error | refused (409) | resume (try again), install |
22
+ * | | flight | | | (another choice), remove |
23
+ * | `installed` | the runtime, the private home, the model | stays `installed`; the | refused (409) | start a session, start or stop |
24
+ * | | | runtime is started again | | the runtime, remove |
25
+ * | | | when it was not stopped | | |
26
+ *
27
+ * The step table. Every step is IDEMPOTENT, so Resume and "Try again" re-enter the step the
28
+ * job stopped in; they first make sure the runtime runs when the step needs it.
29
+ *
30
+ * | Step | Adds to disk | Cancel | Resume |
31
+ * |-----------|---------------------------------------|------------------------------------------|------------------------------------------------|
32
+ * | `runtime` | the archive's partial file, then the | aborts the download, the partial file | continues the partial file with a Range |
33
+ * | | unpacked runtime, then the private | stays | request, or skips what is already unpacked |
34
+ * | | home once the runtime started | | |
35
+ * | `model` | the model store: partial blobs, then | aborts the pull request, which stops the | pulls again; the runtime continues its partial |
36
+ * | | the model | download; the partial blobs stay | blobs |
37
+ * | `verify` | nothing (the model is loaded into | aborts the request in flight | runs the three checks again from the first |
38
+ * | | memory) | | |
39
+ * | `agent` | whatever the coding agent's own | kills the installer's process group | looks for the binary first and runs the |
40
+ * | | installer writes, outside our folder; | | installer only when it is still missing |
41
+ * | | never removed by us | | |
42
+ * | `connect` | our endpoint record and the settings | honoured before the first write; once | writes both again |
43
+ * | | flag: the two writes outside our | the writes began they finish and the job | |
44
+ * | | folder. The state file claims them | ends `installed` | |
45
+ * | | first | | |
46
+ *
47
+ * How the memory budget gets measured before a model is downloaded (ONE consent, bound to the
48
+ * size shown): the person confirms `Candidate.installBytes` once. The `runtime` step then
49
+ * gets and starts the runtime, reads the device total from its log and judges the choice
50
+ * again with it (`modelFitsBudget()`; `recommend()` with the same options names the next
51
+ * model). When the chosen model at the chosen context no longer fits, the job fails right
52
+ * there with `does-not-fit` and the next model that fits, BEFORE the model download starts. When it fits, the job goes on without a second question: the sizes that were
53
+ * confirmed did not change. From then on the GET reports `budgetSource: 'measured'`.
54
+ *
55
+ * Rules:
56
+ * - `reduceInstallJob()` is PURE and total: an event the transition table does not list for
57
+ * the current state is refused by returning the SAME object, which the service answers
58
+ * with 409 `wrong-state`.
59
+ * - The reducer moves the state, the step, the error and the progress. The FACTS a step
60
+ * learns (the port and pid, the measured total, the pull's total, the digest, what the
61
+ * runtime loaded, the previous settings flag) are written by the service through
62
+ * `mutateLocalModelState()` and never change the state.
63
+ * - A job read as `installing` at boot was interrupted by the restart: the service applies
64
+ * the event `restart` before anything else, so it is `paused` and waits for a click.
65
+ * - A new install from `paused` or `failed` REPLACES the job. When it names another model,
66
+ * what the old job left of its model is deleted from the store first: the model through the
67
+ * runtime when it was downloaded whole, and the partial blobs of a download that was
68
+ * interrupted (the runtime knows no model for those, so they are deleted as files).
69
+ * - Install is checked before anything is downloaded: admin only in multi-user mode; the
70
+ * model, the context and the coding agent must be a row the current recommendation offers;
71
+ * the coding agent must be a harness row of the catalogue; `acknowledgedBytes` must be the
72
+ * server's own total.
73
+ * - No CLI id is compared with a literal here: the coding agent is a catalogue row plus a
74
+ * `HarnessFact`.
75
+ *
76
+ * The service (`createLocalModelService()`), beyond the reducer:
77
+ * - Verbs run one at a time on one queue, so two installs sent together cannot both find the
78
+ * state free. The view is not on that queue: the window polls it every second.
79
+ * - An interrupted step is never recorded as failed, whatever its last call answered (an
80
+ * aborted request looks like a network error): the job looks at its own signal before it
81
+ * writes `failed`. Cancel writes `paused` itself; a server that is stopping writes nothing,
82
+ * so the file still says `installing` and the next start reads that as a paused job.
83
+ * - A download's progress is kept in memory, written to the state file every few seconds and
84
+ * when the job pauses or fails. The view shows the live figure and its speed.
85
+ * - What blocks a session on an installed model (another program on the port, a runtime that
86
+ * keeps stopping or did not start, a model whose digest changed) is found live and shown as
87
+ * `error` on the view. It is never stored, and the state stays `installed`.
88
+ * - `launchRefusalMessage()` is what every path that STARTS a coding agent on the managed
89
+ * endpoint asks first: a new session with the model, a model applied to a session, the
90
+ * attach that starts an agent in a session that has none, and the rebuild after a reboot.
91
+ * The digest is read again for every one of them. Two things are not launches and are not
92
+ * asked: a pane that survived a server restart (its agent is already running), and a
93
+ * respawn cycle (it types into the agent that runs).
94
+ * - With a model installed, `boot()` puts the saved endpoint record back when it is gone (a
95
+ * config-backup restore can take it away), starts the runtime unless it was stopped, and
96
+ * reads the digest again.
97
+ * - A runtime an earlier server left behind (a crash, a forced quit) is never left running
98
+ * under a deleted folder or beside a second one: its pid is stored the moment it is
99
+ * spawned, a start adopts or replaces it, and Stop, Remove and the boot of anything that
100
+ * is not a running installation end it (`RuntimeSupervisor.stop({ previousPid })`).
101
+ * - An installed model keeps the runtime VERSION it was installed with: when a later build
102
+ * pins another version, the stored one is started for as long as its folder is unpacked.
103
+ * - A job whose end could not be written to the state file (a full disk) is not lost: the
104
+ * outcome is kept in memory, the view shows it, Resume and a new install start from it, and
105
+ * the next verb writes it. The same holds for any `installing` in the file while this
106
+ * process runs no job, which is what a restart leaves too.
107
+ * - Stop and "Use another port" are refused (409 `sessions-open`) while live sessions use
108
+ * the model: their coding agents were given the address when they started.
109
+ */
110
+ import { type CliInstallResult, type RunInstallCommandOptions } from '../cli-install-runner.js';
111
+ import { type HardwareFacts, type HarnessFact, type LocalModelAction, type LocalModelCatalog, type LocalModelConflict, type LocalModelDeveloperTools, type LocalModelErrorCode, type LocalModelInstallError, type LocalModelInstallMessage, type LocalModelInstallRequest, type LocalModelInstallState, type LocalModelInstallStep, type LocalModelInstallView, type LocalModelNextStep, type LocalModelRemoveRequest, type LocalModelResumeRequest, type LocalModelRuntimePin, type LocalModelRuntimeRequest, type LocalModelStateFile, type Recommendation, type RecommendOptions } from '../types.js';
112
+ import { type ConnectLocalModelInput, type ConnectResult, type LocalEndpointInput, type LocalEndpointInspection } from './connect.js';
113
+ import { type OllamaPsModel, type OllamaTarget, type PullOptions, type PullResult, type VerifyResult } from './ollama-client.js';
114
+ import { type LocalModelPaths } from './paths.js';
115
+ import { type ChooseRuntimePortOptions, type RemoveLocalModelFilesOptions, type RuntimeInstallOptions, type RuntimeInstallResult, type RuntimeStatus, type RuntimeSupervisor } from './runtime.js';
116
+ /** One row of the state table. */
117
+ export interface InstallStateRow {
118
+ /** What lies on disk in this state, in words. */
119
+ onDisk: string;
120
+ /** The state a server restart turns this one into. */
121
+ afterRestart: LocalModelInstallState;
122
+ /** What the restart does, in words. */
123
+ restart: string;
124
+ /** The state Cancel turns this one into, or `null` when Cancel is refused (409 `wrong-state`). */
125
+ afterCancel: LocalModelInstallState | null;
126
+ /** What Cancel does, in words. */
127
+ cancel: string;
128
+ /**
129
+ * Every action a client may take in this state. The view's `actions` is this list narrowed
130
+ * by what is live (`allowedActions()`): `start` only while the runtime is down, `stop` and
131
+ * `start-session` only while it runs, `start-session` only when nothing blocks a session.
132
+ */
133
+ actions: readonly LocalModelAction[];
134
+ }
135
+ /** The state table of the file header, as data. */
136
+ export declare const INSTALL_STATE_TABLE: Readonly<Record<LocalModelInstallState, InstallStateRow>>;
137
+ /** One row of the step table. */
138
+ export interface InstallStepRow {
139
+ /** What the step does, in words. */
140
+ does: string;
141
+ /** What it adds to disk (possibly partly, when it is interrupted). */
142
+ onDisk: string;
143
+ /** How Cancel interrupts it. */
144
+ cancel: string;
145
+ /** What Resume, and "Try again" after a failure, does: every step is idempotent and is entered again. */
146
+ resume: string;
147
+ /** Whether the step reports byte progress (`LocalModelProgress`). */
148
+ progress: boolean;
149
+ /** Whether the runtime must run before the step is entered (the service starts it first, idempotently). */
150
+ needsRuntime: boolean;
151
+ /** Every error code the step can fail with. `internal` and `disk-full` can come from any step that writes. */
152
+ errors: readonly LocalModelErrorCode[];
153
+ }
154
+ /** The step table of the file header, as data. */
155
+ export declare const INSTALL_STEP_TABLE: Readonly<Record<LocalModelInstallStep, InstallStepRow>>;
156
+ /** What moves the job. */
157
+ export type InstallJobEvent =
158
+ /** A new job: `POST /api/local-model/install` passed its checks. From `idle`, `paused` or `failed`. */
159
+ {
160
+ type: 'install';
161
+ model: {
162
+ id: string;
163
+ label: string;
164
+ context: number;
165
+ };
166
+ cli: {
167
+ id: string;
168
+ label: string;
169
+ };
170
+ /** The steps of this job in order (`jobSteps()`). */
171
+ steps: LocalModelInstallStep[];
172
+ }
173
+ /** A download moved. Changes `progress` only. */
174
+ | {
175
+ type: 'progress';
176
+ completedBytes: number;
177
+ totalBytes: number;
178
+ }
179
+ /** The current step finished: the next step of `steps`, or `installed` after the last. Clears `progress`. */
180
+ | {
181
+ type: 'step-done';
182
+ }
183
+ /** The current step failed. */
184
+ | {
185
+ type: 'fail';
186
+ code: LocalModelErrorCode;
187
+ vars?: Record<string, string>;
188
+ detail?: string;
189
+ nextModelId?: string;
190
+ }
191
+ /** `POST /api/local-model/cancel`. */
192
+ | {
193
+ type: 'cancel';
194
+ }
195
+ /** The server started and found this state in the file. */
196
+ | {
197
+ type: 'restart';
198
+ }
199
+ /** `POST /api/local-model/resume`: the same step again. Clears `error`. */
200
+ | {
201
+ type: 'resume';
202
+ }
203
+ /** `DELETE /api/local-model` finished: back to `idle`, every other member dropped. */
204
+ | {
205
+ type: 'remove';
206
+ };
207
+ export type InstallJobEventType = InstallJobEvent['type'];
208
+ /**
209
+ * Which state an event leads to, by current state. A pair that is not listed is REFUSED: the
210
+ * reducer returns the object it was given. One entry needs a word: `step-done` in
211
+ * `installing` leads to `installing` at the next step, and to `installed` when the step that
212
+ * finished was the last of the job's `steps`.
213
+ */
214
+ export declare const INSTALL_TRANSITIONS: Readonly<Record<LocalModelInstallState, Readonly<Partial<Record<InstallJobEventType, LocalModelInstallState>>>>>;
215
+ /** The steps a job runs, in order: all of `LOCAL_MODEL_INSTALL_STEPS`, without `agent` when the coding agent is installed. Pure. */
216
+ export declare function jobSteps(input: {
217
+ agentInstalled: boolean;
218
+ }): LocalModelInstallStep[];
219
+ /**
220
+ * The state file after `event`. Pure: no IO, no clock (`updatedAt` is the state store's
221
+ * business). Refuses an event the transition table does not list for the current state by
222
+ * returning `current` itself. Keeps `runtime` and `connection` across a new install, because
223
+ * what they record is still on disk; `remove` drops everything.
224
+ *
225
+ * An event that is listed but cannot be applied is refused the same way: an `install` whose
226
+ * steps are not a job's, a `progress` that is not two byte counts, a `step-done` on a state
227
+ * without a step, and a last `step-done` on a job that has no runtime recorded.
228
+ */
229
+ export declare function reduceInstallJob(current: LocalModelStateFile, event: InstallJobEvent): LocalModelStateFile;
230
+ /** What is live and not in the state file, for the view. Gathered by the service on every GET. */
231
+ export interface InstallLiveFacts {
232
+ /** The runtime child is alive (`RuntimeStatus.running`). */
233
+ running: boolean;
234
+ /** The supervisor stopped restarting the runtime (`RuntimeStatus.gaveUp`): the error `runtime-stopped` in state `installed`. */
235
+ gaveUp: boolean;
236
+ /** Another program holds the stored port: the error `port-in-use` in state `installed`. */
237
+ portInUse: boolean;
238
+ /** The last start of the runtime failed for another reason: the error `runtime-start-failed` in state `installed`, with what the runtime said. */
239
+ startFailed?: {
240
+ detail?: string;
241
+ };
242
+ /** The stored digest against the runtime's current one (`compareModelDigest()`). `changed` is the error `model-changed`. Absent while not installed. */
243
+ digest?: 'same' | 'changed' | 'unknown';
244
+ developerTools: LocalModelDeveloperTools;
245
+ /** The pinned runtime is unpacked on disk. */
246
+ runtimeInstalled: boolean;
247
+ /** The current download speed. Not stored, so absent after a restart. */
248
+ bytesPerSecond?: number;
249
+ /** For an error whose next step is `next-model`: the model to offer, from the current recommendation. */
250
+ nextModel?: {
251
+ modelId: string;
252
+ modelLabel: string;
253
+ };
254
+ pin: LocalModelRuntimePin;
255
+ /** `LocalModelPaths.root`, for the "where it goes" line. */
256
+ folder: string;
257
+ }
258
+ /** An error code with its sentence, its slots and its one next step. Pure. */
259
+ export declare function buildInstallError(code: LocalModelErrorCode, extra?: {
260
+ vars?: Record<string, string>;
261
+ detail?: string;
262
+ nextModel?: {
263
+ modelId: string;
264
+ modelLabel: string;
265
+ };
266
+ /** The next step in the state the error is shown in, when it is not the code's default. */
267
+ next?: LocalModelNextStep;
268
+ }): LocalModelInstallError;
269
+ /**
270
+ * What blocks a session in state `installed`, found live and never stored: another program
271
+ * on the port, a runtime that keeps stopping, a runtime that did not start, a model that
272
+ * changed. `undefined` when nothing does, which includes a runtime the person stopped. Pure.
273
+ */
274
+ export declare function installedBlocker(state: LocalModelStateFile, live: InstallLiveFacts): LocalModelInstallError | undefined;
275
+ /** The actions the server accepts right now: the state row's list narrowed by what is live. Pure. */
276
+ export declare function allowedActions(state: LocalModelStateFile, live: InstallLiveFacts): LocalModelAction[];
277
+ /** The `install` object of the GET. Pure: every size text comes from `formatGb()`, every sentence from `LOCAL_MODEL_INSTALL_LABELS`. */
278
+ export declare function buildInstallView(state: LocalModelStateFile, live: InstallLiveFacts): LocalModelInstallView;
279
+ /** A sentence of the install as plain English text, its slots filled. For an API error message and the log. Pure. */
280
+ export declare function formatInstallMessage(message: LocalModelInstallMessage): string;
281
+ /** Who asked, for the admin audit entry of the coding agent install. */
282
+ export interface LocalModelActor {
283
+ username: string;
284
+ ip?: string;
285
+ }
286
+ /** How a verb ended: the view after it, a refusal with its sentence, or a 409 with its conflict. */
287
+ export type LocalModelVerbResult = {
288
+ ok: true;
289
+ view: LocalModelInstallView;
290
+ }
291
+ /** 400: the request is not something the server offers. 507: nothing could be started because the disk is full. */
292
+ | {
293
+ ok: false;
294
+ status: 400 | 507;
295
+ message: LocalModelInstallMessage;
296
+ } | {
297
+ ok: false;
298
+ status: 409;
299
+ conflict: LocalModelConflict;
300
+ };
301
+ /**
302
+ * Everything the service calls, so a test spawns, fetches and downloads nothing. Each member
303
+ * defaults to the real module. The members named like a function of another module have
304
+ * exactly that function's signature.
305
+ */
306
+ export interface LocalModelServiceDeps {
307
+ readHardware: () => Promise<HardwareFacts>;
308
+ getCatalog: () => LocalModelCatalog;
309
+ buildHarnessFacts: (catalog: LocalModelCatalog) => Promise<HarnessFact[]>;
310
+ recommend: (hw: HardwareFacts, catalog: LocalModelCatalog, harnessFacts: readonly HarnessFact[], options?: RecommendOptions) => Recommendation;
311
+ /** `modelFitsBudget()` of src/local-model/recommend.ts: the judgement of the `runtime` step, with the measured budget. */
312
+ modelFitsBudget: (hw: HardwareFacts, catalog: LocalModelCatalog, modelId: string, context: number, options?: RecommendOptions) => boolean;
313
+ isRuntimeInstalled: (pin?: LocalModelRuntimePin, paths?: LocalModelPaths) => Promise<boolean>;
314
+ ensureRuntimeInstalled: (options?: RuntimeInstallOptions) => Promise<RuntimeInstallResult>;
315
+ chooseRuntimePort: (options?: ChooseRuntimePortOptions) => Promise<number | undefined>;
316
+ removeLocalModelFiles: (options: RemoveLocalModelFilesOptions) => Promise<void>;
317
+ supervisor: RuntimeSupervisor;
318
+ pullModel: (target: OllamaTarget, modelId: string, options?: PullOptions) => Promise<PullResult>;
319
+ verifyModel: (target: OllamaTarget, modelId: string, context: number, signal?: AbortSignal) => Promise<VerifyResult>;
320
+ readModelDigest: (target: OllamaTarget, modelId: string, signal?: AbortSignal) => Promise<string | undefined>;
321
+ listOpenAiModels: (target: OllamaTarget, signal?: AbortSignal) => Promise<string[]>;
322
+ listRunning: (target: OllamaTarget, signal?: AbortSignal) => Promise<OllamaPsModel[]>;
323
+ getRuntimeVersion: (target: OllamaTarget, signal?: AbortSignal) => Promise<string | undefined>;
324
+ deleteModel: (target: OllamaTarget, modelId: string, signal?: AbortSignal) => Promise<boolean>;
325
+ /** `removePartialModelBlobs()` of src/local-model/runtime.ts: what an interrupted download left in the model store. Resolves with the bytes freed. */
326
+ removePartialModelBlobs: (paths?: LocalModelPaths) => Promise<number>;
327
+ checkDeveloperTools: () => Promise<LocalModelDeveloperTools>;
328
+ stockInstallCommand: (id: string) => string | undefined;
329
+ tryBeginCliInstall: (id: string) => (() => void) | null;
330
+ runInstallCommand: (command: string, options?: RunInstallCommandOptions) => Promise<CliInstallResult>;
331
+ /** Forgets the cached lookups of the CLI's binaries, then says whether its binary is found now. */
332
+ recheckCliInstalled: (cli: string) => Promise<boolean>;
333
+ /** Writes one admin audit line (`appendAdminAudit()`). */
334
+ audit: (entry: {
335
+ admin: string;
336
+ action: string;
337
+ target: string;
338
+ ip?: string;
339
+ detail?: unknown;
340
+ }) => Promise<void>;
341
+ /** What is saved under the reserved id and what the settings flag is, read before the connection is claimed. Writes nothing. */
342
+ inspectLocalEndpoint: (input: LocalEndpointInput) => Promise<LocalEndpointInspection>;
343
+ connectLocalModel: (input: ConnectLocalModelInput) => Promise<ConnectResult>;
344
+ moveLocalEndpoint: (port: number) => Promise<void>;
345
+ /** Puts our endpoint record back when it is gone (after a config-backup restore). True when it was added. */
346
+ ensureLocalEndpoint: (input: LocalEndpointInput) => Promise<boolean>;
347
+ disconnectLocalModel: (input: {
348
+ flagWasEnabled: boolean;
349
+ }) => Promise<void>;
350
+ /** Whether a saved endpoint already has the reserved id (asked before a first install, so the answer comes before the download). */
351
+ isEndpointIdTaken: () => Promise<boolean>;
352
+ readState: () => Promise<LocalModelStateFile>;
353
+ mutateState: (fn: (current: LocalModelStateFile) => LocalModelStateFile | undefined) => Promise<{
354
+ before: LocalModelStateFile;
355
+ after: LocalModelStateFile | undefined;
356
+ }>;
357
+ pin: LocalModelRuntimePin;
358
+ /** Default `localModelPaths(pin.version)`, built when it is first needed. */
359
+ paths?: LocalModelPaths;
360
+ /** The clock of the progress throttle and the digest re-read, in milliseconds. */
361
+ now: () => number;
362
+ }
363
+ /** The install as the routes and the server see it. One per process. */
364
+ export interface LocalModelService {
365
+ /** The `install` object of the GET. Never throws. */
366
+ view(): Promise<LocalModelInstallView>;
367
+ /**
368
+ * Whether a session may be started on the saved endpoint `endpointId` right now. `undefined`:
369
+ * yes, which is also the answer for every endpoint that is not this feature's. Otherwise the
370
+ * error that refuses the launch. While the runtime child Codeman started is not alive
371
+ * (whatever answers on the port then is not ours), the reason is the one that is known:
372
+ * `port-in-use`, `runtime-stopped`, `runtime-start-failed`, else `runtime-not-running`.
373
+ * While it runs, the digest is read again: `model-changed` when it is not the stored one or
374
+ * the model is gone. Every path that starts a coding agent on the managed endpoint asks
375
+ * this first (see the file header for the list). Never throws.
376
+ */
377
+ launchRefusal(endpointId: string): Promise<LocalModelInstallError | undefined>;
378
+ /**
379
+ * `launchRefusal()` as one plain English sentence, plus the one check it does not make: on
380
+ * the managed endpoint only the model that was installed and checked may be started, so a
381
+ * model somebody pulled through the runtime's port is not launched. `undefined`: start it.
382
+ * What the session launch paths call. Never throws.
383
+ */
384
+ launchRefusalMessage(endpointId: string, modelId: string): Promise<string | undefined>;
385
+ /** What the GET passes to `recommend()`: the stored measured total and the runtime download that is still needed. */
386
+ recommendOptions(): Promise<RecommendOptions>;
387
+ /** `POST /api/local-model/install`. Answers once the job is STARTED; the job runs on in the server. */
388
+ install(request: LocalModelInstallRequest, actor: LocalModelActor): Promise<LocalModelVerbResult>;
389
+ /** `POST /api/local-model/cancel`. Answers once the step in flight was interrupted. */
390
+ cancel(): Promise<LocalModelVerbResult>;
391
+ /**
392
+ * `POST /api/local-model/resume`. `liveSessionNames` as for `remove()`: with `newPort` and a
393
+ * connection of ours, not empty answers 409 `sessions-open`.
394
+ */
395
+ resume(request: LocalModelResumeRequest, actor: LocalModelActor, liveSessionNames?: readonly string[]): Promise<LocalModelVerbResult>;
396
+ /**
397
+ * `POST /api/local-model/runtime`. `liveSessionNames` as for `remove()`: Stop and a start on
398
+ * another port answer 409 `sessions-open` while one of them uses the model, because their
399
+ * coding agents keep calling the address they were started with.
400
+ */
401
+ runtime(request: LocalModelRuntimeRequest, liveSessionNames?: readonly string[]): Promise<LocalModelVerbResult>;
402
+ /**
403
+ * `DELETE /api/local-model`. `liveSessionNames` is what `sessionNamesUsingEndpoint()` found:
404
+ * not empty answers 409 `sessions-open` while a connection of ours exists. Else: stop the
405
+ * runtime, remove our endpoint record, restore the settings flag when this feature switched
406
+ * it on and no other endpoint is left, delete the runtime and the private home and (when
407
+ * asked) the models. The coding agent stays. A refused write of the endpoint store or of the
408
+ * settings REJECTS, before any file is deleted.
409
+ */
410
+ remove(request: LocalModelRemoveRequest, liveSessionNames: readonly string[], actor?: LocalModelActor): Promise<LocalModelVerbResult>;
411
+ /**
412
+ * Called once when the server starts. An interrupted job becomes `paused`. With a model
413
+ * installed: the saved endpoint record is put back when it is gone, a runtime that was not
414
+ * stopped is started (an own orphan on the port is adopted or replaced, another listener is
415
+ * `port-in-use`) and the digest is read again. In every other case a runtime an earlier
416
+ * server left behind is ended: nothing would use it, and it holds the model's memory.
417
+ * Never throws, and never keeps the server from starting.
418
+ */
419
+ boot(): Promise<void>;
420
+ /** Called when the server stops, beside `stopDeepSeekWeb()`: aborts a job in flight (it reads `paused` at the next boot) and stops the runtime. */
421
+ shutdown(): Promise<void>;
422
+ /** What the runtime supervisor reports through `onChange`: the pid of a child the moment it is spawned, a new pid after a restart, the budget line. Stored, never thrown. */
423
+ onRuntimeChange(status: RuntimeStatus): void;
424
+ /** Resolves once no job is in flight. For `shutdown()` and for tests. */
425
+ idle(): Promise<void>;
426
+ }
427
+ /** A service over `deps`. A test builds its own with fakes. */
428
+ export declare function createLocalModelService(deps?: Partial<LocalModelServiceDeps>): LocalModelService;
429
+ /** The one service of this process, built on first use with the real modules. What the routes and server.ts call. */
430
+ export declare function getLocalModelService(): LocalModelService;
431
+ //# sourceMappingURL=install-job.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-job.d.ts","sourceRoot":"","sources":["../../src/local-model/install-job.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4GG;AAGH,OAAO,EAML,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC9B,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAQL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EAEvB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,aAAa,CAAC;AAErB,OAAO,EASL,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC7B,MAAM,cAAc,CAAC;AAKtB,OAAO,EAQL,KAAK,aAAa,EA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