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,64 @@
1
+ /**
2
+ * @fileoverview Where everything of the local model lives on disk. One pure function, so the
3
+ * runtime, the install job and uninstall all name the same folders.
4
+ *
5
+ * Layout, all under the data dir (`dataPath()`, so a second Codeman instance has its own):
6
+ *
7
+ * ```
8
+ * local-model.json the state file (mode 0600)
9
+ * local-model/
10
+ * runtime/ollama-<version>.tgz.partial the runtime archive while it downloads
11
+ * runtime/ollama-<version>.unpack/ where the archive is unpacked, before the rename
12
+ * runtime/ollama-<version>/ the unpacked runtime; its binary is `ollama`
13
+ * models/ the runtime's model store
14
+ * home/ the runtime's private HOME (its key pair lands here)
15
+ * ```
16
+ *
17
+ * Rules:
18
+ * - `root` is the ONE folder this feature owns. Nothing is written or deleted outside it,
19
+ * except the state file beside it and the two writes of the connect step (the endpoint
20
+ * record and the settings flag), which have their own writers.
21
+ * - Every path comes from here. None is ever read back from the state file, so a state file
22
+ * cannot point a delete anywhere else. `isInsideLocalModelRoot()` is the check a delete
23
+ * makes before it runs.
24
+ * - Pure apart from `dataPath()`, which resolves (and creates) the data dir.
25
+ */
26
+ export interface LocalModelPaths {
27
+ /** `<data dir>/local-model`: the one folder this feature owns. */
28
+ root: string;
29
+ /** `<root>/runtime`: the archive and every unpacked version. */
30
+ runtimeRoot: string;
31
+ /** `<root>/runtime/ollama-<version>`: the unpacked runtime. */
32
+ runtimeDir: string;
33
+ /** The runtime's binary: `<runtimeDir>/ollama`. */
34
+ binary: string;
35
+ /** `<root>/runtime/ollama-<version>.tgz.partial`: the archive while it downloads. */
36
+ archivePartial: string;
37
+ /** `<root>/runtime/ollama-<version>.unpack`: the temporary folder the archive is unpacked into. */
38
+ unpackDir: string;
39
+ /** `<root>/models`: the runtime's model store. */
40
+ modelsDir: string;
41
+ /** `<root>/home`: the runtime's private HOME. */
42
+ homeDir: string;
43
+ /** `<data dir>/local-model.json`: the state file. */
44
+ stateFile: string;
45
+ }
46
+ /**
47
+ * The paths of the local model for one runtime version. Throws on a version that is not
48
+ * digits and dots, so a version string can never add a path segment.
49
+ */
50
+ export declare function localModelPaths(version: string): LocalModelPaths;
51
+ /**
52
+ * The binary of another unpacked runtime version beside the pinned one: `<runtimeRoot>/
53
+ * ollama-<version>/ollama`. For an installed model whose runtime was unpacked by an earlier
54
+ * build with another pin: it keeps running the version it was installed with. Throws on a
55
+ * version that is not digits and dots, like `localModelPaths()`. Pure.
56
+ */
57
+ export declare function runtimeBinaryForVersion(paths: LocalModelPaths, version: string): string;
58
+ /**
59
+ * Whether `path` is the local model folder itself or lies inside it, judged on the resolved
60
+ * text (no filesystem access, so a symlink is not followed: a caller that deletes checks the
61
+ * real path first). `..` segments are resolved before the comparison.
62
+ */
63
+ export declare function isInsideLocalModelRoot(path: string, root?: string): boolean;
64
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/local-model/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAQH,MAAM,WAAW,eAAe;IAC9B,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,qFAAqF;IACrF,cAAc,EAAE,MAAM,CAAC;IACvB,mGAAmG;IACnG,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAkBhE;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAKvF;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAgC,GAAG,OAAO,CAIpG"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * @fileoverview Where everything of the local model lives on disk. One pure function, so the
3
+ * runtime, the install job and uninstall all name the same folders.
4
+ *
5
+ * Layout, all under the data dir (`dataPath()`, so a second Codeman instance has its own):
6
+ *
7
+ * ```
8
+ * local-model.json the state file (mode 0600)
9
+ * local-model/
10
+ * runtime/ollama-<version>.tgz.partial the runtime archive while it downloads
11
+ * runtime/ollama-<version>.unpack/ where the archive is unpacked, before the rename
12
+ * runtime/ollama-<version>/ the unpacked runtime; its binary is `ollama`
13
+ * models/ the runtime's model store
14
+ * home/ the runtime's private HOME (its key pair lands here)
15
+ * ```
16
+ *
17
+ * Rules:
18
+ * - `root` is the ONE folder this feature owns. Nothing is written or deleted outside it,
19
+ * except the state file beside it and the two writes of the connect step (the endpoint
20
+ * record and the settings flag), which have their own writers.
21
+ * - Every path comes from here. None is ever read back from the state file, so a state file
22
+ * cannot point a delete anywhere else. `isInsideLocalModelRoot()` is the check a delete
23
+ * makes before it runs.
24
+ * - Pure apart from `dataPath()`, which resolves (and creates) the data dir.
25
+ */
26
+ import { join, resolve, sep } from 'node:path';
27
+ import { dataPath } from '../config/instance.js';
28
+ /** A runtime version as it may appear in a folder name: digits and dots only ('0.40.15'). */
29
+ const VERSION_PATTERN = /^\d+(?:\.\d+){1,3}$/;
30
+ /**
31
+ * The paths of the local model for one runtime version. Throws on a version that is not
32
+ * digits and dots, so a version string can never add a path segment.
33
+ */
34
+ export function localModelPaths(version) {
35
+ if (!VERSION_PATTERN.test(version)) {
36
+ throw new Error(`Not a runtime version: ${JSON.stringify(version)}`);
37
+ }
38
+ const root = dataPath('local-model');
39
+ const runtimeRoot = join(root, 'runtime');
40
+ const runtimeDir = join(runtimeRoot, `ollama-${version}`);
41
+ return {
42
+ root,
43
+ runtimeRoot,
44
+ runtimeDir,
45
+ binary: join(runtimeDir, 'ollama'),
46
+ archivePartial: join(runtimeRoot, `ollama-${version}.tgz.partial`),
47
+ unpackDir: join(runtimeRoot, `ollama-${version}.unpack`),
48
+ modelsDir: join(root, 'models'),
49
+ homeDir: join(root, 'home'),
50
+ stateFile: dataPath('local-model.json'),
51
+ };
52
+ }
53
+ /**
54
+ * The binary of another unpacked runtime version beside the pinned one: `<runtimeRoot>/
55
+ * ollama-<version>/ollama`. For an installed model whose runtime was unpacked by an earlier
56
+ * build with another pin: it keeps running the version it was installed with. Throws on a
57
+ * version that is not digits and dots, like `localModelPaths()`. Pure.
58
+ */
59
+ export function runtimeBinaryForVersion(paths, version) {
60
+ if (!VERSION_PATTERN.test(version)) {
61
+ throw new Error(`Not a runtime version: ${JSON.stringify(version)}`);
62
+ }
63
+ return join(paths.runtimeRoot, `ollama-${version}`, 'ollama');
64
+ }
65
+ /**
66
+ * Whether `path` is the local model folder itself or lies inside it, judged on the resolved
67
+ * text (no filesystem access, so a symlink is not followed: a caller that deletes checks the
68
+ * real path first). `..` segments are resolved before the comparison.
69
+ */
70
+ export function isInsideLocalModelRoot(path, root = dataPath('local-model')) {
71
+ const base = resolve(root);
72
+ const target = resolve(path);
73
+ return target === base || target.startsWith(base + sep);
74
+ }
75
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/local-model/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,6FAA6F;AAC7F,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAuB9C;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IACrC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,OAAO,EAAE,CAAC,CAAC;IAC1D,OAAO;QACL,IAAI;QACJ,WAAW;QACX,UAAU;QACV,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC;QAClC,cAAc,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,OAAO,cAAc,CAAC;QAClE,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,OAAO,SAAS,CAAC;QACxD,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC;QAC/B,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;QAC3B,SAAS,EAAE,QAAQ,CAAC,kBAAkB,CAAC;KACxC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAsB,EAAE,OAAe;IAC7E,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,UAAU,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;AAChE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAY,EAAE,OAAe,QAAQ,CAAC,aAAa,CAAC;IACzF,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * @fileoverview The recommendation itself: which model, at which context, with which harness
3
+ * fits this Mac. Pure: no IO, no clock, no CLI registry, no data dir.
4
+ *
5
+ * The math, in the order it runs:
6
+ * - `deviceBudget()`. ESTIMATED (all there is before the runtime ran): L is the wired limit
7
+ * when it is above 0, else 2/3 of memory below 36 GB and 3/4 from 36 GB, and
8
+ * B = min(L - 1 GiB, memory - reserve), with a reserve of 6 GiB up to 18 GB, 8 GiB up to
9
+ * 48 GB and 12 GiB above. MEASURED (`RecommendOptions.measuredTotalBytes`, the device total
10
+ * the runtime printed when it started): L is that total and B = min(L, memory - reserve),
11
+ * without the 1 GiB, because the figure is already what the runtime will really use.
12
+ * - `needBytes()`: the PEAK, `bytes + heldBytesPerToken * ctx + overheadBytes +
13
+ * peakExtraBytes` of the catalogue row: the weights, what stays held per token of context,
14
+ * what the runner holds beside both, and what it takes for a moment while a long prompt is
15
+ * processed. Measured for one model on one Mac; every other row's figures are computed from
16
+ * its own model's architecture for its runner and say `estimated` (see the catalogue
17
+ * header, MEMORY).
18
+ * - Fit: need over budget up to 0.85 is good, up to 0.98 is tight, above is out. The grade
19
+ * decides whether a model is offered at all and what its row says. It does NOT sort: the
20
+ * need is the worst moment at the full context, so a tight fit is a model that runs, and a
21
+ * Mac whose best model is tight should be offered that model, not a smaller one.
22
+ * - Speed: a candidate that matches a `tested` entry with a measured speed reports that
23
+ * speed. Every other one is estimated: the model's `speedPer100Gbps` x the chip's bandwidth
24
+ * / 100. Below 10 is slow, decided on the unrounded figure (9.96 is slow although it prints
25
+ * as 10). A chip that is in no chips row, or a model without a speed figure, is UNKNOWN: a
26
+ * bandwidth is never guessed.
27
+ * - Candidates: (model, context, harness) with `ctx >= harness.minContext`, the harness not
28
+ * gated, installed or installable, and accepting the model id.
29
+ * - Ranking, lexicographic: tested on a Mac like this before not tested (a measurement beats
30
+ * a formula); ok before unknown before slow; the higher model rank; the higher harness
31
+ * rank; the larger context. The pick is the first candidate, the alternatives are the next
32
+ * four MODELS, each at its own best context and harness, so a model is always offered at
33
+ * the largest context it fits at.
34
+ * - Disk: a model whose download would leave less than 10 GiB free is not offered. It is not
35
+ * dropped in silence: the best-ranked model left out that way is named in `noteDiskDropped`
36
+ * with what is missing.
37
+ *
38
+ * Verdict `none`, in this order (the first that applies is the reason):
39
+ * 1. `not-macos`: the server does not run on macOS.
40
+ * 2. `intel`: a Mac without Apple silicon.
41
+ * 3. `macos`: macOS is older than the catalogue's minimum (an unknown version does not block).
42
+ * 4. `memory`: no model fits the budget at any of its contexts, whatever the harness
43
+ * (`noneMemory`, or `noneMemoryUnknown` when the memory size could not be read).
44
+ * 5. `no-harness`: no harness row is usable (not gated, known to the caller, installed or
45
+ * installable).
46
+ * 6. `memory`: models fit, but none at a context a usable harness needs. Its own sentence
47
+ * (`noneMemoryContext`) with the budget and the smallest need at such a context, because
48
+ * "too little memory" would hide that a model does fit at a smaller context and that the
49
+ * answer rests on estimates.
50
+ * 7. `no-harness`: models fit at such a context, but no usable harness accepts their id.
51
+ * 8. `disk`: for every remaining model, free disk minus the download is below 10 GiB (an
52
+ * unknown free disk does not block).
53
+ *
54
+ * Rules:
55
+ * - Verdict `limited` when NO model with 12 billion parameters or more fits this Mac's memory
56
+ * at a context a usable harness works at. It is a statement about the Mac ("This Mac can run
57
+ * a small model"), so it is judged on everything that fits, BEFORE the disk filter and
58
+ * whatever the pick is: a 36 GB Mac whose pick is a 9B model while a 20B is listed under it
59
+ * is not a small-model Mac, and a 48 GB Mac does not become one because its disk is full. A
60
+ * small pick under verdict `ok` carries `noteSmallPick` instead.
61
+ * - The word "Recommended" (`LOCAL_MODEL_LABELS.headlineTested`) only for verdict `ok` with a
62
+ * pick whose model has a `tested` entry for exactly this chip, this memory size and this
63
+ * harness. Otherwise `headlineOk` (or `headlineLimited`) plus `noteUntested`.
64
+ * - Every row carries what the chooser needs and nothing the browser must work out: its one
65
+ * tag (`tagFor()`), every harness it can run with (`Candidate.harnesses`, the flat harness
66
+ * fields first), and the whole download of an install (`installBytes`: the model plus
67
+ * `RecommendOptions.runtimeDownloadBytes`).
68
+ * - Every label in the result comes from `LOCAL_MODEL_LABELS` or `LOCAL_MODEL_TAG_LABELS`,
69
+ * every computed size text from `formatGb()`. The one size that is not decimal GB is the
70
+ * installed memory in `noneMemory`: `HardwareFacts.memClassGb`, the size the Mac is sold
71
+ * as. No number is spliced into a sentence here.
72
+ * - No CLI id is ever compared with a literal: a harness is a catalogue row plus a
73
+ * `HarnessFact`.
74
+ */
75
+ import { type DeviceBudget, type HardwareFacts, type HarnessFact, type LocalModelCatalog, type LocalModelEntry, type Recommendation, type RecommendOptions } from '../types.js';
76
+ /** Need over budget up to this share is a `good` fit. */
77
+ export declare const FIT_GOOD_MAX_SHARE = 0.85;
78
+ /** Need over budget up to this share is a `tight` fit; above it the model is out. */
79
+ export declare const FIT_TIGHT_MAX_SHARE = 0.98;
80
+ /** A speed below this many tokens per second is `slow`. */
81
+ export declare const SLOW_BELOW_TOKENS_PER_SECOND = 10;
82
+ /** When no model that fits has at least this many billion parameters, the verdict is `limited`. A pick below it is a "small model". */
83
+ export declare const LIMITED_BELOW_PARAMS_B = 12;
84
+ /** What must stay free on the disk after the model download. */
85
+ export declare const DISK_HEADROOM_BYTES: number;
86
+ /** How many other models are listed under the pick. */
87
+ export declare const MAX_ALTERNATIVES = 4;
88
+ /**
89
+ * The memory a model may use on this Mac: the device limit L, the budget B and where L came
90
+ * from. With `options.measuredTotalBytes` the limit is what the runtime itself reported and
91
+ * the 1 GiB the estimate keeps back is not subtracted; the reserve bounds both.
92
+ */
93
+ export declare function deviceBudget(hw: HardwareFacts, options?: RecommendOptions): DeviceBudget;
94
+ /**
95
+ * The bytes `model` needs in memory at a context of `ctx` tokens, at its PEAK: the weights,
96
+ * what stays held for the context, what the runner holds beside them, and what it takes for a
97
+ * moment while a long prompt is processed. It does not depend on the Mac.
98
+ */
99
+ export declare function needBytes(model: LocalModelEntry, ctx: number): number;
100
+ /**
101
+ * Whether the catalogue model `modelId` at `context` tokens fits this Mac's budget (a `good`
102
+ * or a `tight` fit). The install job asks this right after the runtime started, with the
103
+ * budget the runtime measured (`options.measuredTotalBytes`), BEFORE it downloads the model: a
104
+ * `false` ends the job with `does-not-fit`. It is the same judgement `recommend()` makes for a
105
+ * candidate, without the ranking, so a model that fits is never ruled out for being listed
106
+ * sixth. False for a model the catalogue does not have.
107
+ */
108
+ export declare function modelFitsBudget(hw: HardwareFacts, catalog: LocalModelCatalog, modelId: string, context: number, options?: RecommendOptions): boolean;
109
+ /**
110
+ * The recommendation for this Mac. `harnessFacts` holds one fact per catalogue harness the
111
+ * caller could resolve; a catalogue harness without a fact is not offered.
112
+ *
113
+ * `options` is what the caller knows beyond the probe: the budget the runtime measured (the
114
+ * answer then says `budgetSource: 'measured'`), and the runtime download an install still
115
+ * needs (it is added to every row's `installBytes`).
116
+ */
117
+ export declare function recommend(hw: HardwareFacts, catalog: LocalModelCatalog, harnessFacts: readonly HarnessFact[], options?: RecommendOptions): Recommendation;
118
+ //# sourceMappingURL=recommend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recommend.d.ts","sourceRoot":"","sources":["../../src/local-model/recommend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AAEH,OAAO,EAQL,KAAK,YAAY,EAEjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAEhB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EAIpB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EAGtB,MAAM,aAAa,CAAC;AAIrB,yDAAyD;AACzD,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC,qFAAqF;AACrF,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,2DAA2D;AAC3D,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAC/C,uIAAuI;AACvI,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,gEAAgE;AAChE,eAAO,MAAM,mBAAmB,QAAW,CAAC;AAC5C,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAiBlC;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,aAAa,EAAE,OAAO,GAAE,gBAAqB,GAAG,YAAY,CAc5F;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErE;AAUD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,aAAa,EACjB,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAIT;AAqLD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,EAAE,EAAE,aAAa,EACjB,OAAO,EAAE,iBAAiB,EAC1B,YAAY,EAAE,SAAS,WAAW,EAAE,EACpC,OAAO,GAAE,gBAAqB,GAC7B,cAAc,CA+IhB"}