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,551 @@
1
+ /**
2
+ * @fileoverview Types of the hardware-aware local model recommendation: what the server sees of
3
+ * this Mac, the catalogue of models and harnesses, and the recommendation part of the answer of
4
+ * `GET /api/local-model`.
5
+ *
6
+ * Everything here is the READ side: Codeman looks at the Mac and recommends. The types of the
7
+ * install (the job states, the progress, the `install` object of the GET, the request bodies,
8
+ * the state file, the runtime pin) and `LocalModelStatus`, the whole `data` of the GET, are in
9
+ * src/types/local-model-install.ts. Both files go out through the barrel (`../types.js`).
10
+ *
11
+ * Who produces what:
12
+ * - `HardwareFacts`: src/local-model/hardware.ts (one bounded `sysctl` spawn, never throws).
13
+ * - `LocalModelCatalog` and its rows: src/config/local-model-catalog.ts (a compiled constant).
14
+ * - `HarnessFact`: src/local-model/harness-facts.ts (server only, read from the CLI registry at
15
+ * call time; it holds a function, so it never goes over HTTP).
16
+ * - `Recommendation`, `Candidate`, `DeviceBudget`: src/local-model/recommend.ts (pure).
17
+ *
18
+ * A field that is optional here is optional by meaning, and its comment says when it is
19
+ * absent (a tested entry without a measured speed, a harness that needs no install command, a
20
+ * row without a tag). Everything else is always there, so the chooser window and the install
21
+ * job may rely on it.
22
+ *
23
+ * Three rules every producer and consumer follows:
24
+ *
25
+ * 1. ONE unit for a computed size a person reads: decimal GB, computed from bytes by
26
+ * `formatGb()` in src/local-model/format.ts. Every such size travels twice, as bytes
27
+ * (`needBytes`) and as the text to show (`needGb`, a number without the unit, such as
28
+ * '25.5'). The browser prints the text and never divides bytes itself. GiB appears only
29
+ * inside the budget math. The one exception is the NAME of the installed memory: the card
30
+ * says `HardwareFacts.memClassGb` (48 for a Mac sold with 48 GB), see that field.
31
+ * 2. Every sentence or label the SERVER chooses comes from `LOCAL_MODEL_LABELS` below, so the
32
+ * browser can translate it (`codemanT(text, vars)`) and its i18n test can list every string.
33
+ * Numbers are never spliced into a sentence here: they travel in `vars` and fill the
34
+ * `{placeholder}` slots.
35
+ * 3. A CLI id is DATA (`LocalHarnessEntry.cli`, `Candidate.cli`). No code compares one with a
36
+ * literal: what differs between harnesses is a catalogue field or a `HarnessFact`.
37
+ */
38
+ /**
39
+ * How `HardwareFacts` was obtained.
40
+ * - `sysctl`: the spawn answered and `hw.memsize` parsed.
41
+ * - `os-fallback`: on macOS, but the spawn failed or timed out; memory, architecture and the chip
42
+ * string come from `node:os` and the free disk from `statfs`. What only sysctl knows (`arm64`,
43
+ * `translated`, `model`, `macosVersion`, `macosMajor`, `wiredLimitMb`) is absent.
44
+ * - `not-probed`: not macOS, so `sysctl` was never spawned.
45
+ */
46
+ export type HardwareProbeSource = 'sysctl' | 'os-fallback' | 'not-probed';
47
+ /**
48
+ * What the server knows about the machine it runs on. Plain JSON (it is part of the GET payload),
49
+ * and always an answer: a failed probe yields the `os-fallback` or `not-probed` shape, never an
50
+ * exception.
51
+ */
52
+ export interface HardwareFacts {
53
+ /** `process.platform` of the server. Anything but `darwin` ends in verdict `none`, reason `not-macos`. */
54
+ platform: string;
55
+ /** `os.arch()` of the server process. `x64` on Apple silicon means Node runs under Rosetta. */
56
+ arch: string;
57
+ /** `hw.optional.arm64` is 1: the MACHINE is Apple silicon whatever `arch` says. Absent when the key was not read. */
58
+ arm64?: boolean;
59
+ /** `sysctl.proc_translated` is 1: this process runs under Rosetta. Absent when the key was not read (Intel Macs lack it). */
60
+ translated?: boolean;
61
+ /** Installed memory in bytes (`hw.memsize`, else `os.totalmem()`). The ONLY memory input of the budget math. */
62
+ memBytes: number;
63
+ /**
64
+ * `memBytes` in the unit of every computed size: decimal GB from `formatGb()`, without the unit
65
+ * ('17.2' for a Mac sold as 16 GB). NOT what the card calls the installed memory: that is
66
+ * `memClassGb`, see there.
67
+ */
68
+ memGb: string;
69
+ /**
70
+ * The memory size the Mac is sold as: whole binary gigabytes (16, 32, 48), 0 when the size is
71
+ * unknown. Tier rules and `TestedOn.memGb` use it, and it is the ONE size a person reads that
72
+ * is not decimal GB: the hardware line and the `memory` slot of `noneMemory` print it, because
73
+ * it is the number on the box and in About This Mac ("48 GB"), and '51.5 GB memory' reads as a
74
+ * different machine. Every computed size (need, budget, download, free disk) stays decimal GB.
75
+ */
76
+ memClassGb: number;
77
+ /** `machdep.cpu.brand_string` ('Apple M4 Pro'), else `os.cpus()[0].model`. */
78
+ chip?: string;
79
+ /** `hw.model` ('Mac16,10'). */
80
+ model?: string;
81
+ /** `kern.osproductversion` ('27.2'). */
82
+ macosVersion?: string;
83
+ /** The leading number of `macosVersion` (27). */
84
+ macosMajor?: number;
85
+ /** `iogpu.wired_limit_mb` exactly as reported. 0 means "not set" (both test Macs report 0); only a value above 0 is a limit. */
86
+ wiredLimitMb?: number;
87
+ /** Free bytes on the filesystem of Codeman's data dir (`statfs`: `bavail * bsize`). */
88
+ freeDiskBytes?: number;
89
+ /** `freeDiskBytes` as a person reads it (decimal GB, no unit). Present exactly when `freeDiskBytes` is. */
90
+ freeDiskGb?: string;
91
+ source: HardwareProbeSource;
92
+ }
93
+ /**
94
+ * One Mac a model and harness pair was really run on by us. A candidate that matches an entry
95
+ * (the same chip string, the same memory size as sold, the same harness) is `tested`: it ranks
96
+ * before every candidate that is not, and as the pick it may be called "Recommended".
97
+ */
98
+ export interface TestedOn {
99
+ /** The chip, as `machdep.cpu.brand_string` reports it ('Apple M4'). */
100
+ chip: string;
101
+ /** The Mac's memory as it is sold (`HardwareFacts.memClassGb`: 16, 32, 48). */
102
+ memGb: number;
103
+ /** The harness it was tested with: a CLI registry id, as data. */
104
+ cli: string;
105
+ /** ISO date of the test ('2026-11-06'). */
106
+ date: string;
107
+ /**
108
+ * The generation speed measured in that test, in tokens per second (67.7 for the
109
+ * 2026-11-06 run on an Apple M5 Pro with 48 GB). A candidate that matches this entry reports
110
+ * this figure as `Candidate.tokensPerSecond` in place of the estimate from the chip's memory
111
+ * bandwidth: a measurement on the same Mac beats a formula.
112
+ */
113
+ tokensPerSecond?: number;
114
+ }
115
+ /** The runner of the model runtime that runs a model on a Mac, by the registry's name for it. See `LocalModelEntry.runner`. */
116
+ export type LocalModelRunner = 'mlx' | 'llamacpp';
117
+ /** One model of the catalogue. */
118
+ export interface LocalModelEntry {
119
+ /** `name:tag` exactly as the model registry lists it. Lowercase, one colon, no slash (`LOCAL_MODEL_ID_PATTERN`). */
120
+ id: string;
121
+ /** The name a person reads ('Qwen3.8 27B'). */
122
+ label: string;
123
+ /** SPDX id of the license ('Apache-2.0'). */
124
+ license: string;
125
+ /** Parameter count in billions. When no model that fits has 12 or more, the verdict is `limited`, never `ok`. */
126
+ paramsB: number;
127
+ /**
128
+ * The runner the runtime uses for this tag ON A MAC, as the registry names it: `mlx` (a
129
+ * safetensors build, or a manifest list with an MLX child, which a Mac always takes) or
130
+ * `llamacpp` (a GGUF build, run by llama-server on Metal). The two spend memory in different
131
+ * ways, so a row's memory figures are only meaningful together with its runner: llama.cpp
132
+ * allocates the whole K/V cache for the context when the model loads (in the runtime's
133
+ * `OLLAMA_KV_CACHE_TYPE`), MLX grows it with the tokens actually used and keeps snapshots of
134
+ * it besides.
135
+ */
136
+ runner: LocalModelRunner;
137
+ /**
138
+ * Size of the weights in bytes: both the download and what they take in memory.
139
+ *
140
+ * It is the size of the build the runtime really downloads ON A MAC: the build of `runner`,
141
+ * every layer of its manifest plus its config, which is the `total` a real pull reports.
142
+ * That is not always the first manifest the registry answers with: `qwen3.6:35b-a3b` is an
143
+ * MLX build of 23,105,798,956 bytes on Apple silicon, 2% more than its GGUF build of
144
+ * 22,621,314,381.
145
+ */
146
+ bytes: number;
147
+ /**
148
+ * Bytes that stay HELD in memory per token of context. For a `llamacpp` row: the K/V cache
149
+ * of its attention layers in the runtime's cache type, which llama.cpp allocates for the
150
+ * whole context at load (a multi-token-prediction layer's in f16). For an `mlx` row: the K/V cache in bf16 plus the snapshots of the
151
+ * recurrent state the runner keeps every 8,192 tokens, which it grows with use. Measured
152
+ * on one row (36,000 to 38,000 on the MLX runner, so about 37,000); computed from the
153
+ * model's config for the others, see `figures` and the catalogue header.
154
+ */
155
+ heldBytesPerToken: number;
156
+ /**
157
+ * What the runner holds beside the weights and the context, whatever the context: its own
158
+ * buffers, the live recurrent or sliding-window caches, and the caches it keeps of earlier
159
+ * prompts (for `llamacpp` the 1024 MiB host prompt cache `LLAMA_ARG_CACHE_RAM` allows and
160
+ * the copies of the recurrent or sliding-window state in its `LLAMA_ARG_CTX_CHECKPOINTS`
161
+ * context checkpoints, for an estimated `mlx` row the 8 GiB of prefix snapshots the runner
162
+ * may keep). Measured on one row (about 3 GB); see the catalogue header for the others.
163
+ */
164
+ overheadBytes: number;
165
+ /**
166
+ * The TRANSIENT extra the runner takes while it processes a long prompt, on top of
167
+ * what stays held (measured on the MLX runner: about 5 GB; 0 for `llamacpp`, which
168
+ * allocates its buffers at load). The fit is judged on the peak:
169
+ * `bytes + heldBytesPerToken * context + overheadBytes + peakExtraBytes`. For
170
+ * `qwen3.6:35b-a3b` at 131072 tokens that is about 36 GB, which is tight on a 48 GB Mac.
171
+ */
172
+ peakExtraBytes: number;
173
+ /**
174
+ * Where the three memory figures above come from: `measured` on a Mac by us, or
175
+ * `estimated` (computed from the model's architecture for its runner, see the catalogue
176
+ * header). `bytes` is the registry's size of the build a Mac pulls in both cases.
177
+ */
178
+ figures: 'measured' | 'estimated';
179
+ /** Context lengths (tokens) the model may be run at, largest first. */
180
+ contexts: number[];
181
+ /** Preference among models that fit: the HIGHER rank wins. A judgement, not a measurement. */
182
+ rank: number;
183
+ /** Measured tokens per second per 100 GB/s of memory bandwidth. Absent: the speed of this model is unknown. */
184
+ speedPer100Gbps?: number;
185
+ /** Macs this model was really run on. Empty for every row but one. */
186
+ tested: TestedOn[];
187
+ }
188
+ /** One harness (coding agent CLI) that can be connected to a local model. All of it is data. */
189
+ export interface LocalHarnessEntry {
190
+ /** A CLI registry id. Data only: never compared with a literal anywhere. */
191
+ cli: string;
192
+ /** The smallest context (tokens) at which this harness works. */
193
+ minContext: number;
194
+ /** Preference among harnesses: the HIGHER rank wins. */
195
+ rank: number;
196
+ /** True: listed in the catalogue but never offered yet (its use with a local model is unverified). */
197
+ gated?: boolean;
198
+ /** True: the first answer takes minutes, because the harness sends a very large fixed prompt. */
199
+ slowFirstTurn?: boolean;
200
+ }
201
+ /**
202
+ * Memory bandwidth of one chip family. `LocalModelCatalog.chips` is ordered most specific first
203
+ * ('M4 Max' before 'M4') and the first row that names `HardwareFacts.chip` wins. A row names a
204
+ * chip when the chip string ENDS with its `match`, starting at the beginning or after a space,
205
+ * case ignored (`chipNameMatches()` in src/config/local-model-catalog.ts): 'M4' is not the chip
206
+ * of 'Apple M4 Pro', and a variant the table has never heard of ('Apple M6 Pro') matches no row.
207
+ * A chip that matches no row has an UNKNOWN speed: a bandwidth is never guessed.
208
+ */
209
+ export interface ChipEntry {
210
+ /** The chip name the chip string must end with ('M4 Max'). */
211
+ match: string;
212
+ /** Memory bandwidth in GB/s. */
213
+ gbps: number;
214
+ }
215
+ /** The catalogue: a compiled constant, validated by `LocalModelCatalogSchema`. No override file, no download data. */
216
+ export interface LocalModelCatalog {
217
+ schema: 1;
218
+ /** ISO date the rows were last checked ('2026-11-06'). Reported as `LocalModelStatus.catalogUpdated`. */
219
+ updated: string;
220
+ /** Oldest macOS major version a local model runs on. Below it: verdict `none`, reason `macos`. */
221
+ minMacosMajor: number;
222
+ models: LocalModelEntry[];
223
+ harnesses: LocalHarnessEntry[];
224
+ chips: ChipEntry[];
225
+ }
226
+ /**
227
+ * What the server knows about one catalogue harness on this machine. Built from the CLI registry
228
+ * at call time, so `recommend()` names no CLI. NOT serializable (it holds a function): it never
229
+ * leaves the server. `Candidate` carries the parts a browser needs.
230
+ */
231
+ export interface HarnessFact {
232
+ /** The CLI registry id. */
233
+ cli: string;
234
+ /** The registry's display label ('OpenCode'). */
235
+ label: string;
236
+ /** The CLI's binary was found on this machine. */
237
+ installed: boolean;
238
+ /** Not installed, but the registry has an install command for this platform that needs no administrator rights. */
239
+ installable: boolean;
240
+ /**
241
+ * The literal install command the install job would run for this CLI: the STOCK
242
+ * command of the CLI registry for this platform, never one a `clis.json` override supplies.
243
+ * Present exactly when `installable` is true. The consent screen prints it
244
+ * (`CandidateHarness.installCommand`).
245
+ */
246
+ installCommand?: string;
247
+ /** Whether this CLI can be launched with that model id (its command-line pattern accepts it). */
248
+ acceptsModelId: (modelId: string) => boolean;
249
+ }
250
+ /**
251
+ * Need over budget: up to 0.85 is `good`, up to 0.98 is `tight`, above is `out`. The need is
252
+ * the PEAK, so the grade says how much room is left at the worst moment. It decides whether a
253
+ * model is offered at all (`out` never is) and what its row says (`tight`). It does not sort
254
+ * the list.
255
+ */
256
+ export type FitGrade = 'good' | 'tight' | 'out';
257
+ /**
258
+ * Expected generation speed. `unknown` when the chip is in no `ChipEntry` or the model has no
259
+ * `speedPer100Gbps`. In the ranking `unknown` sits between `ok` and `slow`.
260
+ */
261
+ export type SpeedGrade = 'ok' | 'slow' | 'unknown';
262
+ /**
263
+ * Why the verdict is `none`.
264
+ * - `not-macos`: the server does not run on macOS (the card is hidden).
265
+ * - `intel`: a Mac without Apple silicon.
266
+ * - `memory`: no model fits the memory budget at a context a usable harness needs. Three
267
+ * headlines share this reason: `noneMemory` (nothing fits at any context), `noneMemoryContext`
268
+ * (a model fits, but only below the context a harness needs: the sentence carries the budget
269
+ * and the need) and `noneMemoryUnknown` (the memory size could not be read).
270
+ * - `disk`: models fit the memory, but for every one of them free disk minus the download is below 10 GiB.
271
+ * - `macos`: macOS is older than `LocalModelCatalog.minMacosMajor`.
272
+ * - `no-harness`: no catalogue harness is installed or installable and accepts a model.
273
+ */
274
+ export type NoneReason = 'not-macos' | 'intel' | 'memory' | 'disk' | 'macos' | 'no-harness';
275
+ /**
276
+ * Where the device budget came from.
277
+ * - `estimated`: a formula over the installed memory. All there is before the runtime ran.
278
+ * - `wired-limit`: `iogpu.wired_limit_mb` above 0.
279
+ * - `measured`: the device total the runtime itself printed when it started
280
+ * (`RecommendOptions.measuredTotalBytes`). The chooser says "estimated" next to the memory
281
+ * bar for the first value only.
282
+ */
283
+ export type BudgetSource = 'estimated' | 'wired-limit' | 'measured';
284
+ /** The memory a model may use on this Mac. */
285
+ export interface DeviceBudget {
286
+ /**
287
+ * L: the measured device total when there is one, else the wired limit when above 0, else
288
+ * 2/3 of memory below 36 GB and 3/4 from 36 GB.
289
+ */
290
+ limitBytes: number;
291
+ /**
292
+ * What `Candidate.budgetShare` is measured against. Estimated or from the wired limit:
293
+ * B = min(L - 1 GiB, memory - reserve). Measured: B = min(L, memory - reserve), without the
294
+ * 1 GiB, because the runtime's figure is already what it will really use (37.4 GiB on the
295
+ * 48 GB test Mac, which reads '40.2').
296
+ */
297
+ budgetBytes: number;
298
+ source: BudgetSource;
299
+ }
300
+ /**
301
+ * What the caller of `recommend()` knows beyond the hardware probe. Both members are optional:
302
+ * an empty object means the budget is the estimate and an install downloads the model alone.
303
+ */
304
+ export interface RecommendOptions {
305
+ /**
306
+ * The device total the runtime reported in its log line "inference compute"
307
+ * (`total="37.4 GiB"`), in bytes: `parseInferenceComputeTotal()` in
308
+ * src/local-model/runtime.ts. Present: the budget is `measured`. The install job passes it
309
+ * right after the runtime started, before the model is downloaded, and the GET passes the
310
+ * stored figure from then on.
311
+ */
312
+ measuredTotalBytes?: number;
313
+ /**
314
+ * What an install adds to every candidate's download beside the model: the size of the
315
+ * pinned runtime archive while the runtime is not installed, 0 once it is. It is the
316
+ * difference between `Candidate.installBytes` and `Candidate.downloadBytes`. Default 0.
317
+ */
318
+ runtimeDownloadBytes?: number;
319
+ }
320
+ /**
321
+ * Every sentence and label the server may put into the payload, in English (the i18n source
322
+ * language). The zh-CN dictionary in src/web/public/i18n.js has one entry per value, keyed by
323
+ * this exact text, and test/local-model-i18n.test.ts imports this constant to list them. Adding
324
+ * a key is fine; changing a text means changing its zh-CN key too.
325
+ *
326
+ * `{placeholder}` slots are filled by the browser from `LocalModelMessage.vars`. `{name}` is
327
+ * taken (the translator fills it with the display name), so no slot here is called `name`.
328
+ *
329
+ * | Key | Slots (all text; sizes are decimal GB without the unit) |
330
+ * |---------------------|---------------------------------------------------------------------------|
331
+ * | `noteDiskDropped` | `model`: label of the best model left out for disk space; `missing`: its |
332
+ * | | download + the disk reserve - free |
333
+ * | `noneMemory` | `memory`: `HardwareFacts.memClassGb`, the size the Mac is sold as |
334
+ * | `noneMemoryContext` | `budget`: `Recommendation.budgetGb`; `need`: the smallest need of any |
335
+ * | | model at a context a usable harness works at |
336
+ * | `noneDisk` | `download`: smallest download among the models that fit the memory; |
337
+ * | | `reserve`: what must stay free after it (10 GiB, as decimal GB); `free`: |
338
+ * | | `HardwareFacts.freeDiskGb`; `missing`: download + reserve - free |
339
+ * | `noneMacos` | `version`: `HardwareFacts.macosVersion`; `minimum`: the catalogue minimum |
340
+ *
341
+ * The word "Recommended" exists only in `headlineTested`, which may be used only when the
342
+ * pick's `tested` is true: one catalogue row has a tested entry (`qwen3.6:35b-a3b` on an Apple
343
+ * M5 Pro with 48 GB), so one kind of Mac is told so.
344
+ */
345
+ export declare const LOCAL_MODEL_LABELS: {
346
+ /** Verdict `ok`, pick not tested by us on a Mac like this one. */
347
+ readonly headlineOk: "Best fit for this Mac";
348
+ /** Verdict `ok`, pick tested by us on a Mac like this one. */
349
+ readonly headlineTested: "Recommended for this Mac";
350
+ /** Verdict `limited`: no model with 12 billion parameters or more fits this Mac. */
351
+ readonly headlineLimited: "This Mac can run a small model. It handles small edits and questions. It does not replace a cloud model.";
352
+ /** A note under an `ok` or `limited` pick whose `tested` is false. */
353
+ readonly noteUntested: "Codeman has not run this on a Mac like this yet.";
354
+ /** A note under an `ok` pick that is itself a small model: larger ones fit this Mac, but rank lower or have no room on the disk. */
355
+ readonly noteSmallPick: "The best fit is a small model. It handles small edits and questions. It does not replace a cloud model.";
356
+ /** A note when a model that fits the memory was left out because its download would not leave the disk reserve. */
357
+ readonly noteDiskDropped: "{model} fits the memory of this Mac too, but its download needs about {missing} GB more free disk space.";
358
+ readonly fitGood: "Good";
359
+ readonly fitTight: "Tight";
360
+ readonly speedSlow: "Slow";
361
+ readonly speedUnknown: "Speed unknown";
362
+ readonly noneNotMacos: "Codeman recommends a local model only on a Mac with Apple silicon.";
363
+ readonly noneIntel: "Local coding models need Apple silicon, and this Mac has an Intel processor.";
364
+ /** Reason `memory`: nothing fits at any context. */
365
+ readonly noneMemory: "With {memory} GB of memory, this Mac cannot run a model that can drive a coding agent.";
366
+ /** Reason `memory`: a model fits, but only below the context a harness needs. Says both numbers, and ("about") that they are estimates. */
367
+ readonly noneMemoryContext: "This Mac can give a model about {budget} GB of memory, and the smallest model a coding agent can work with needs about {need} GB.";
368
+ /** Reason `memory`: the memory size could not be read, so no size is stated. */
369
+ readonly noneMemoryUnknown: "Codeman could not read how much memory this Mac has, so it recommends no model here.";
370
+ /** Reason `disk`. One number: what to do. The other sizes travel in `vars` for a client that wants them. */
371
+ readonly noneDisk: "Free up about {missing} GB of disk space to install the smallest model that fits this Mac.";
372
+ readonly noneMacos: "Local models need macOS {minimum} or newer, and this Mac runs macOS {version}.";
373
+ readonly noneNoHarness: "No coding agent that Codeman can connect to a local model is available on this Mac.";
374
+ };
375
+ /** One of the texts in `LOCAL_MODEL_LABELS`. The payload's label fields are typed with it, so an off-list string does not compile. */
376
+ export type LocalModelLabel = (typeof LOCAL_MODEL_LABELS)[keyof typeof LOCAL_MODEL_LABELS];
377
+ /** The headline of each `none` reason. `memory` has two more (`noneMemoryContext`, `noneMemoryUnknown`), see `NoneReason`. */
378
+ export declare const LOCAL_MODEL_NONE_LABELS: Record<NoneReason, LocalModelLabel>;
379
+ /** A sentence for the card: a text from `LOCAL_MODEL_LABELS` plus the values of its `{placeholder}` slots. */
380
+ export interface LocalModelMessage {
381
+ text: LocalModelLabel;
382
+ /** Slot values, already formatted as text. Absent when the text has no slot. */
383
+ vars?: Record<string, string>;
384
+ }
385
+ /**
386
+ * The one tag a model row of the chooser carries, by what it says.
387
+ * - `tested`: `Candidate.tested` is true. Replaces every other tag.
388
+ * - `best-tight`: the pick, when its `fit` is `tight`. The words must not say less than the
389
+ * memory bar beside them, which is nearly full for such a row.
390
+ * - `best`: the pick.
391
+ * - `tight`: `Candidate.fit` is `tight`.
392
+ * - `slow`: `Candidate.speed` is `slow`.
393
+ * - `small`: the model has fewer than 12 billion parameters.
394
+ * A row gets the FIRST kind of this list that applies and no tag when none does. `tested`,
395
+ * `best` and `best-tight` are the tags of the row the window opens on, drawn in the accent
396
+ * colour.
397
+ */
398
+ export type CandidateTagKind = 'tested' | 'best-tight' | 'best' | 'tight' | 'slow' | 'small';
399
+ /**
400
+ * The text of each tag, in English (the i18n source language), like `LOCAL_MODEL_LABELS`. A
401
+ * constant of its own so that a consumer can list the tag texts apart from the sentences.
402
+ */
403
+ export declare const LOCAL_MODEL_TAG_LABELS: {
404
+ readonly tested: "Tested on a Mac like this";
405
+ readonly 'best-tight': "Best fit, tight";
406
+ readonly best: "Best fit";
407
+ readonly tight: "Tight";
408
+ readonly slow: "Slow";
409
+ readonly small: "Small model";
410
+ };
411
+ /** One of the texts in `LOCAL_MODEL_TAG_LABELS`. */
412
+ export type LocalModelTagLabel = (typeof LOCAL_MODEL_TAG_LABELS)[CandidateTagKind];
413
+ /** The tag of a model row: what kind it is (for the styling) and the text to print. */
414
+ export interface CandidateTag {
415
+ kind: CandidateTagKind;
416
+ /** `LOCAL_MODEL_TAG_LABELS[kind]`. */
417
+ label: LocalModelTagLabel;
418
+ }
419
+ /**
420
+ * One coding agent a candidate's model can be run with on this Mac, for the "Runs
421
+ * with" select of the chooser. Everything a browser needs is here, so it compares no CLI id.
422
+ */
423
+ export interface CandidateHarness {
424
+ /** The CLI registry id, as data: what `POST /api/local-model/install` is sent as `cli`. */
425
+ cli: string;
426
+ /** The registry's display label ('OpenCode'). */
427
+ cliLabel: string;
428
+ /** False: the install job installs it first (it is installable, or it would not be listed). */
429
+ installed: boolean;
430
+ /**
431
+ * The literal command the install job would run to install it (`HarnessFact.installCommand`).
432
+ * Present exactly when `installed` is false. The consent screen prints it as it is.
433
+ */
434
+ installCommand?: string;
435
+ /** The harness row's `slowFirstTurn`. */
436
+ slowFirstTurn?: boolean;
437
+ }
438
+ /** One model at one context with one harness, measured against this Mac. Plain JSON. */
439
+ export interface Candidate {
440
+ /** `LocalModelEntry.id`. */
441
+ modelId: string;
442
+ /** `LocalModelEntry.label`. */
443
+ modelLabel: string;
444
+ license: string;
445
+ paramsB: number;
446
+ /** Context length in tokens. */
447
+ context: number;
448
+ /** The harness: a CLI registry id, as data. */
449
+ cli: string;
450
+ /** The harness's display label, from the CLI registry. */
451
+ cliLabel: string;
452
+ /** False: the harness is not on this machine yet (it is installable, or it would not be a candidate). */
453
+ cliInstalled: boolean;
454
+ /** The harness row's `slowFirstTurn`. */
455
+ slowFirstTurn?: boolean;
456
+ /**
457
+ * What the model needs in memory at this context: the PEAK, `bytes + heldBytesPerToken *
458
+ * context + overheadBytes + peakExtraBytes` of the catalogue row. The memory bar of the
459
+ * chooser is filled to `budgetShare`, which is this over the budget.
460
+ */
461
+ needBytes: number;
462
+ /** `needBytes` as decimal GB text, no unit. */
463
+ needGb: string;
464
+ /**
465
+ * What `needBytes` is made of, for the chooser's memory map: the model (`bytes +
466
+ * overheadBytes`), its context in use (`heldBytesPerToken * context`) and the brief peaks
467
+ * (`peakExtraBytes`). The three add up to `needBytes`.
468
+ */
469
+ memory?: {
470
+ modelBytes: number;
471
+ contextBytes: number;
472
+ peakBytes: number;
473
+ };
474
+ /** The model download in bytes (`LocalModelEntry.bytes`). */
475
+ downloadBytes: number;
476
+ /** `downloadBytes` as decimal GB text, no unit. */
477
+ downloadGb: string;
478
+ /** `needBytes / Recommendation.budgetBytes`, rounded to three decimals (0.83). The fit grade is decided on the unrounded ratio. */
479
+ budgetShare: number;
480
+ /** A candidate in a `Recommendation` is never `out`. */
481
+ fit: Exclude<FitGrade, 'out'>;
482
+ /** `fitGood` or `fitTight`. */
483
+ fitLabel: LocalModelLabel;
484
+ speed: SpeedGrade;
485
+ /** `speedSlow` or `speedUnknown`. Absent when `speed` is `ok`. */
486
+ speedLabel?: LocalModelLabel;
487
+ /**
488
+ * Generation speed in tokens per second, rounded to one decimal. Present exactly when `speed`
489
+ * is not `unknown`; `speed` is decided on the unrounded figure. An estimate from the chip's
490
+ * memory bandwidth, except for a candidate that is `tested`, which reports the
491
+ * speed measured in that test (`TestedOn.tokensPerSecond`).
492
+ */
493
+ tokensPerSecond?: number;
494
+ /**
495
+ * A `TestedOn` entry of the model matches this Mac (same chip, same `memClassGb`) and this
496
+ * harness. Such a candidate ranks first, and its `tag` says so in place of any other tag.
497
+ */
498
+ tested: boolean;
499
+ /** `LocalModelEntry.figures` of the model: whether `needBytes` rests on a measurement of this model. */
500
+ needSource: 'measured' | 'estimated';
501
+ /** The row's one tag, see `CandidateTagKind`. Absent when no kind applies. */
502
+ tag?: CandidateTag;
503
+ /**
504
+ * Every coding agent this model can be run with at `context` on this Mac, best
505
+ * first. The first entry is the one the flat fields above name (`cli`, `cliLabel`,
506
+ * `cliInstalled`, `slowFirstTurn`). Never empty.
507
+ */
508
+ harnesses: CandidateHarness[];
509
+ /**
510
+ * The whole download a click on Install starts for this row: `downloadBytes` plus
511
+ * `RecommendOptions.runtimeDownloadBytes`. It is the server's own total, and exactly the
512
+ * number `POST /api/local-model/install` must be sent as `acknowledgedBytes`.
513
+ */
514
+ installBytes: number;
515
+ /** `installBytes` as decimal GB text, no unit. */
516
+ installGb: string;
517
+ }
518
+ /**
519
+ * The answer of `recommend()`.
520
+ * - `ok`: `pick` is the best candidate, and at least one model with 12 billion parameters or
521
+ * more fits this Mac's memory at a context a usable harness works at. The pick itself can be
522
+ * smaller (a larger model may fit only tightly, have no speed figure, or have no room on the
523
+ * disk): `notes` then carries `noteSmallPick`.
524
+ * - `limited`: `pick` is the best candidate, and NO model with 12 billion parameters or more
525
+ * fits. The card says so and never says "Recommended".
526
+ * - `none`: no pick; `reason` says why.
527
+ */
528
+ export interface Recommendation {
529
+ verdict: 'ok' | 'limited' | 'none';
530
+ /** Present exactly when `verdict` is `none`. */
531
+ reason?: NoneReason;
532
+ /** What the card says first: `headlineOk`, `headlineTested`, `headlineLimited` or a `none` sentence. */
533
+ headline: LocalModelMessage;
534
+ /** Further sentences under the pick, in this order: `noteSmallPick`, `noteDiskDropped`, `noteUntested`. May be empty. */
535
+ notes: LocalModelMessage[];
536
+ /** Present exactly when `verdict` is `ok` or `limited`. */
537
+ pick?: Candidate;
538
+ /**
539
+ * The next models that fit and have room on the disk (at most four), best first: tested
540
+ * before not tested, then ok before unknown before slow speed, then the higher model rank.
541
+ * Each is at the largest context it fits at, with the best harness that can run it there.
542
+ * Empty when `verdict` is `none`.
543
+ */
544
+ alternatives: Candidate[];
545
+ /** `DeviceBudget.budgetBytes`. 0 when no budget is computed: not macOS, or a Mac without Apple silicon. */
546
+ budgetBytes: number;
547
+ /** `budgetBytes` as decimal GB text, no unit. */
548
+ budgetGb: string;
549
+ budgetSource: BudgetSource;
550
+ }
551
+ //# sourceMappingURL=local-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-model.d.ts","sourceRoot":"","sources":["../../src/types/local-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAIH;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,aAAa,GAAG,YAAY,CAAC;AAE1E;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,0GAA0G;IAC1G,QAAQ,EAAE,MAAM,CAAC;IACjB,+FAA+F;IAC/F,IAAI,EAAE,MAAM,CAAC;IACb,qHAAqH;IACrH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6HAA6H;IAC7H,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gHAAgH;IAChH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,CAAC;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