@bendyline/gezel-inference 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/dist/catalog/chat-models/de/deepseek-v4.1-flash-552b-q2/manifest.json +120 -0
  2. package/dist/catalog/chat-models/de/deepseek-v4.1-flash-552b-q2/versions/1.0.0/manifest.json +21 -0
  3. package/dist/catalog/chat-models/gl/glm-5.3-flash-320b-q2/manifest.json +6 -5
  4. package/dist/catalog/chat-models/gl/glm-5.3-flash-320b-q2/versions/1.0.2/manifest.json +27 -0
  5. package/dist/catalog/chat-models/gl/glm-5.3-flash-320b-q2/versions/1.0.3/manifest.json +27 -0
  6. package/dist/catalog/chat-models/index.json +1 -1
  7. package/dist/catalog/chat-models/na/nanbeige4.2-3b-q4/manifest.json +1 -1
  8. package/dist/catalog/chat-models/ne/nemotron3.5-bolt-74b-iq2/manifest.json +157 -0
  9. package/dist/catalog/chat-models/ne/nemotron3.5-bolt-74b-iq2/versions/1.0.0/manifest.json +30 -0
  10. package/dist/catalog/chat-models/ne/nemotron3.5-bolt-e4b-q4/manifest.json +142 -0
  11. package/dist/catalog/chat-models/ne/nemotron3.5-bolt-e4b-q4/versions/1.0.0/manifest.json +14 -0
  12. package/dist/catalog/chat-models/ne/nemotron3.5-bolt-e4b-q4/versions/1.0.1/manifest.json +14 -0
  13. package/dist/catalog/chat-models/ne/nemotron3.5-super-vl-120b-nvfp4/manifest.json +156 -0
  14. package/dist/catalog/chat-models/ne/nemotron3.5-super-vl-120b-nvfp4/versions/1.0.0/manifest.json +28 -0
  15. package/dist/catalog/chat-models/raw-index.json +1 -1
  16. package/dist/catalog/image-models/an/animagine-xl-4/manifest.json +40 -0
  17. package/dist/catalog/image-models/an/animagine-xl-4/versions/4.0.0/manifest.json +10 -0
  18. package/dist/catalog/image-models/an/animagine-xl-4/versions/4.0.1/manifest.json +16 -0
  19. package/dist/catalog/image-models/fl/flux-2-klein-4b-q4/manifest.json +44 -0
  20. package/dist/catalog/image-models/fl/flux-2-klein-4b-q4/versions/1.0.0/manifest.json +23 -0
  21. package/dist/catalog/image-models/fl/flux-2-klein-4b-q4/versions/1.0.1/manifest.json +29 -0
  22. package/dist/catalog/image-models/index.json +1 -0
  23. package/dist/catalog/image-models/ir/iris-3b-f32/manifest.json +41 -0
  24. package/dist/catalog/image-models/ir/iris-3b-f32/versions/1.0.0/manifest.json +19 -0
  25. package/dist/catalog/image-models/ir/iris-3b-f32/versions/1.0.1/manifest.json +25 -0
  26. package/dist/catalog/image-models/ir/iris-3b-f32/versions/1.0.2/manifest.json +25 -0
  27. package/dist/catalog/image-models/kr/krea-2-turbo-q4/manifest.json +42 -0
  28. package/dist/catalog/image-models/kr/krea-2-turbo-q4/versions/1.0.0/manifest.json +23 -0
  29. package/dist/catalog/image-models/kr/krea-2-turbo-q4/versions/1.0.1/manifest.json +29 -0
  30. package/dist/catalog/image-models/kr/krea-2-turbo-q6/manifest.json +42 -0
  31. package/dist/catalog/image-models/kr/krea-2-turbo-q6/versions/1.0.0/manifest.json +23 -0
  32. package/dist/catalog/image-models/kr/krea-2-turbo-q6/versions/1.0.1/manifest.json +29 -0
  33. package/dist/catalog/image-models/kr/krea-2-turbo-q8/manifest.json +42 -0
  34. package/dist/catalog/image-models/kr/krea-2-turbo-q8/versions/1.0.0/manifest.json +23 -0
  35. package/dist/catalog/image-models/kr/krea-2-turbo-q8/versions/1.0.1/manifest.json +29 -0
  36. package/dist/catalog/image-models/mi/ming-image-0.1-design-bf16/manifest.json +41 -0
  37. package/dist/catalog/image-models/mi/ming-image-0.1-design-bf16/versions/1.0.0/manifest.json +31 -0
  38. package/dist/catalog/image-models/mi/ming-image-0.1-design-bf16/versions/1.0.1/manifest.json +50 -0
  39. package/dist/catalog/image-models/mi/ming-image-0.1-design-bf16/versions/1.0.2/manifest.json +50 -0
  40. package/dist/catalog/image-models/mo/moss-image-sft-q4/manifest.json +40 -0
  41. package/dist/catalog/image-models/mo/moss-image-sft-q4/versions/1.0.0/manifest.json +37 -0
  42. package/dist/catalog/image-models/mo/moss-image-sft-q4/versions/1.0.1/manifest.json +37 -0
  43. package/dist/catalog/image-models/raw-index.json +1 -0
  44. package/dist/catalog/image-models/sd/sd-1.5/manifest.json +40 -0
  45. package/dist/catalog/image-models/sd/sd-1.5/versions/1.0.0/manifest.json +10 -0
  46. package/dist/catalog/image-models/sd/sd-1.5/versions/1.0.1/manifest.json +16 -0
  47. package/dist/catalog/image-models/sd/sd-turbo/manifest.json +40 -0
  48. package/dist/catalog/image-models/sd/sd-turbo/versions/1.0.0/manifest.json +10 -0
  49. package/dist/catalog/image-models/sd/sd-turbo/versions/1.0.1/manifest.json +16 -0
  50. package/dist/catalog/image-models/sd/sdxl-base-1.0/manifest.json +39 -0
  51. package/dist/catalog/image-models/sd/sdxl-base-1.0/versions/1.0.0/manifest.json +10 -0
  52. package/dist/catalog/image-models/sd/sdxl-base-1.0/versions/1.0.1/manifest.json +16 -0
  53. package/dist/catalog/image-models/sd/sdxl-lightning-4step/manifest.json +40 -0
  54. package/dist/catalog/image-models/sd/sdxl-lightning-4step/versions/1.0.0/manifest.json +10 -0
  55. package/dist/catalog/image-models/sd/sdxl-lightning-4step/versions/1.0.1/manifest.json +16 -0
  56. package/dist/catalog/image-models/sd/sdxl-turbo/manifest.json +41 -0
  57. package/dist/catalog/image-models/sd/sdxl-turbo/versions/1.0.0/manifest.json +10 -0
  58. package/dist/catalog/image-models/sd/sdxl-turbo/versions/1.0.1/manifest.json +16 -0
  59. package/dist/catalog/knowledge-catalogs/be/bendyline-how-to-books/keywords.json +56 -0
  60. package/dist/catalog/knowledge-catalogs/ca/caselaw-alaska-part-0001/keywords.json +12 -0
  61. package/dist/catalog/knowledge-catalogs/ca/caselaw-nevada-part-0001/keywords.json +13 -0
  62. package/dist/catalog/knowledge-catalogs/ca/caselaw-us-300-399-part-0001/keywords.json +14 -0
  63. package/dist/catalog/knowledge-catalogs/ca/caselaw-us-347-349/keywords.json +17 -0
  64. package/dist/catalog/knowledge-catalogs/ca/caselaw-utah-part-0001/keywords.json +12 -0
  65. package/dist/catalog/knowledge-catalogs/ca/caselaw-utah-part-0002/keywords.json +12 -0
  66. package/dist/catalog/knowledge-catalogs/ca/caselaw-washington-part-0001/keywords.json +12 -0
  67. package/dist/catalog/knowledge-catalogs/ca/caselaw-washington-part-0002/keywords.json +12 -0
  68. package/dist/catalog/knowledge-catalogs/ca/caselaw-washington-part-0003/keywords.json +12 -0
  69. package/dist/catalog/knowledge-catalogs/ca/caselaw-washington-part-0004/keywords.json +12 -0
  70. package/dist/catalog/knowledge-catalogs/ca/caselaw-washington-part-0005/keywords.json +12 -0
  71. package/dist/catalog/knowledge-catalogs/ca/caselaw-wyoming-part-0001/keywords.json +12 -0
  72. package/dist/catalog/knowledge-catalogs/index.json +1 -1
  73. package/dist/catalog/knowledge-catalogs/mi/microsoftdocs-aspnet-core-en/keywords.json +21 -0
  74. package/dist/catalog/knowledge-catalogs/mi/microsoftdocs-azure-ai-platform-en/keywords.json +27 -0
  75. package/dist/catalog/knowledge-catalogs/mi/microsoftdocs-azure-apps-compute-en/keywords.json +23 -0
  76. package/dist/catalog/knowledge-catalogs/mi/microsoftdocs-azure-data-aiot-en/keywords.json +26 -0
  77. package/dist/catalog/knowledge-catalogs/mi/microsoftdocs-azure-management-hybrid-en/keywords.json +28 -0
  78. package/dist/catalog/knowledge-catalogs/mi/microsoftdocs-azure-network-security-en/keywords.json +29 -0
  79. package/dist/catalog/knowledge-catalogs/mi/microsoftdocs-dotnet-en/keywords.json +21 -0
  80. package/dist/catalog/knowledge-catalogs/mi/microsoftdocs-entity-framework-en/keywords.json +14 -0
  81. package/dist/catalog/knowledge-catalogs/mi/microsoftdocs-microsoft-365-en/keywords.json +20 -0
  82. package/dist/catalog/knowledge-catalogs/mi/microsoftdocs-powershell-en/keywords.json +24 -0
  83. package/dist/catalog/knowledge-catalogs/mi/microsoftdocs-sql-server-en/keywords.json +27 -0
  84. package/dist/catalog/knowledge-catalogs/mi/microsoftdocs-windows-apps-en/keywords.json +18 -0
  85. package/dist/catalog/knowledge-catalogs/mi/microsoftdocs-windows-server-en/keywords.json +28 -0
  86. package/dist/catalog/knowledge-catalogs/raw-index.json +1 -1
  87. package/dist/catalog/knowledge-catalogs/re/regional-american-south/keywords.json +1700 -0
  88. package/dist/catalog/knowledge-catalogs/re/regional-american-south/versions/2026.10.5/manifest.json +133 -0
  89. package/dist/catalog/knowledge-catalogs/re/regional-andes-amazon/keywords.json +750 -0
  90. package/dist/catalog/knowledge-catalogs/re/regional-andes-amazon/versions/2026.10.5/manifest.json +133 -0
  91. package/dist/catalog/knowledge-catalogs/re/regional-australia-nz/keywords.json +1281 -0
  92. package/dist/catalog/knowledge-catalogs/re/regional-australia-nz/versions/2026.10.5/manifest.json +133 -0
  93. package/dist/catalog/knowledge-catalogs/re/regional-brazil/keywords.json +1125 -0
  94. package/dist/catalog/knowledge-catalogs/re/regional-brazil/versions/2026.10.5/manifest.json +133 -0
  95. package/dist/catalog/knowledge-catalogs/re/regional-britain-ireland/keywords.json +3287 -0
  96. package/dist/catalog/knowledge-catalogs/re/regional-britain-ireland/versions/2026.10.5/manifest.json +133 -0
  97. package/dist/catalog/knowledge-catalogs/re/regional-california-southwest/keywords.json +1835 -0
  98. package/dist/catalog/knowledge-catalogs/re/regional-california-southwest/versions/2026.10.5/manifest.json +133 -0
  99. package/dist/catalog/knowledge-catalogs/re/regional-canada-alaska/keywords.json +1184 -0
  100. package/dist/catalog/knowledge-catalogs/re/regional-canada-alaska/versions/2026.10.5/manifest.json +133 -0
  101. package/dist/catalog/knowledge-catalogs/re/regional-central-eastern-europe/keywords.json +1503 -0
  102. package/dist/catalog/knowledge-catalogs/re/regional-central-eastern-europe/versions/2026.10.5/manifest.json +133 -0
  103. package/dist/catalog/knowledge-catalogs/re/regional-east-asia/keywords.json +2836 -0
  104. package/dist/catalog/knowledge-catalogs/re/regional-east-asia/versions/2026.10.5/manifest.json +133 -0
  105. package/dist/catalog/knowledge-catalogs/re/regional-east-southern-africa/keywords.json +813 -0
  106. package/dist/catalog/knowledge-catalogs/re/regional-east-southern-africa/versions/2026.10.5/manifest.json +133 -0
  107. package/dist/catalog/knowledge-catalogs/re/regional-mediterranean/keywords.json +2082 -0
  108. package/dist/catalog/knowledge-catalogs/re/regional-mediterranean/versions/2026.10.5/manifest.json +133 -0
  109. package/dist/catalog/knowledge-catalogs/re/regional-mexico-central-america/keywords.json +1481 -0
  110. package/dist/catalog/knowledge-catalogs/re/regional-mexico-central-america/versions/2026.10.5/manifest.json +133 -0
  111. package/dist/catalog/knowledge-catalogs/re/regional-middle-east/keywords.json +1272 -0
  112. package/dist/catalog/knowledge-catalogs/re/regional-middle-east/versions/2026.10.5/manifest.json +133 -0
  113. package/dist/catalog/knowledge-catalogs/re/regional-midwest/keywords.json +758 -0
  114. package/dist/catalog/knowledge-catalogs/re/regional-midwest/versions/2026.10.5/manifest.json +133 -0
  115. package/dist/catalog/knowledge-catalogs/re/regional-north-africa/keywords.json +896 -0
  116. package/dist/catalog/knowledge-catalogs/re/regional-north-africa/versions/2026.10.5/manifest.json +133 -0
  117. package/dist/catalog/knowledge-catalogs/re/regional-northeast/keywords.json +1281 -0
  118. package/dist/catalog/knowledge-catalogs/re/regional-northeast/versions/2026.10.5/manifest.json +133 -0
  119. package/dist/catalog/knowledge-catalogs/re/regional-northern-eurasia/keywords.json +346 -0
  120. package/dist/catalog/knowledge-catalogs/re/regional-northern-eurasia/versions/2026.10.5/manifest.json +133 -0
  121. package/dist/catalog/knowledge-catalogs/re/regional-northern-europe/keywords.json +2688 -0
  122. package/dist/catalog/knowledge-catalogs/re/regional-northern-europe/versions/2026.10.5/manifest.json +133 -0
  123. package/dist/catalog/knowledge-catalogs/re/regional-pacific-islands/keywords.json +973 -0
  124. package/dist/catalog/knowledge-catalogs/re/regional-pacific-islands/versions/2026.10.5/manifest.json +133 -0
  125. package/dist/catalog/knowledge-catalogs/re/regional-pacific-northwest/keywords.json +937 -0
  126. package/dist/catalog/knowledge-catalogs/re/regional-pacific-northwest/versions/2026.10.5/manifest.json +133 -0
  127. package/dist/catalog/knowledge-catalogs/re/regional-rockies-plains/keywords.json +608 -0
  128. package/dist/catalog/knowledge-catalogs/re/regional-rockies-plains/versions/2026.10.5/manifest.json +133 -0
  129. package/dist/catalog/knowledge-catalogs/re/regional-south-asia/keywords.json +633 -0
  130. package/dist/catalog/knowledge-catalogs/re/regional-south-asia/versions/2026.10.5/manifest.json +133 -0
  131. package/dist/catalog/knowledge-catalogs/re/regional-southeast-asia/keywords.json +2697 -0
  132. package/dist/catalog/knowledge-catalogs/re/regional-southeast-asia/versions/2026.10.5/manifest.json +133 -0
  133. package/dist/catalog/knowledge-catalogs/re/regional-southern-cone/keywords.json +606 -0
  134. package/dist/catalog/knowledge-catalogs/re/regional-southern-cone/versions/2026.10.5/manifest.json +133 -0
  135. package/dist/catalog/knowledge-catalogs/re/regional-west-central-africa/keywords.json +564 -0
  136. package/dist/catalog/knowledge-catalogs/re/regional-west-central-africa/versions/2026.10.5/manifest.json +133 -0
  137. package/dist/catalog/knowledge-catalogs/re/regional-western-europe/keywords.json +3247 -0
  138. package/dist/catalog/knowledge-catalogs/re/regional-western-europe-east/manifest.json +47 -0
  139. package/dist/catalog/knowledge-catalogs/re/regional-western-europe-east/versions/2026.10.5/manifest.json +133 -0
  140. package/dist/catalog/knowledge-catalogs/re/regional-western-europe-west/manifest.json +47 -0
  141. package/dist/catalog/knowledge-catalogs/re/regional-western-europe-west/versions/2026.10.5/manifest.json +133 -0
  142. package/dist/catalog/knowledge-catalogs/wi/wikipedia-arts/keywords.json +5437 -0
  143. package/dist/catalog/knowledge-catalogs/wi/wikipedia-arts/manifest.json +1 -1
  144. package/dist/catalog/knowledge-catalogs/wi/wikipedia-arts/versions/2026.10.1/manifest.json +181 -0
  145. package/dist/catalog/knowledge-catalogs/wi/wikipedia-astronomy/keywords.json +4009 -0
  146. package/dist/catalog/knowledge-catalogs/wi/wikipedia-astronomy/manifest.json +1 -1
  147. package/dist/catalog/knowledge-catalogs/wi/wikipedia-astronomy/versions/2026.10.1/manifest.json +181 -0
  148. package/dist/catalog/knowledge-catalogs/wi/wikipedia-biology/keywords.json +4009 -0
  149. package/dist/catalog/knowledge-catalogs/wi/wikipedia-biology/manifest.json +1 -1
  150. package/dist/catalog/knowledge-catalogs/wi/wikipedia-biology/versions/2026.10.1/manifest.json +217 -0
  151. package/dist/catalog/knowledge-catalogs/wi/wikipedia-business/keywords.json +5583 -0
  152. package/dist/catalog/knowledge-catalogs/wi/wikipedia-business/manifest.json +1 -1
  153. package/dist/catalog/knowledge-catalogs/wi/wikipedia-business/versions/2026.10.1/manifest.json +197 -0
  154. package/dist/catalog/knowledge-catalogs/wi/wikipedia-film-tv/keywords.json +6386 -0
  155. package/dist/catalog/knowledge-catalogs/wi/wikipedia-film-tv/manifest.json +2 -2
  156. package/dist/catalog/knowledge-catalogs/wi/wikipedia-film-tv/versions/2026.10.1/manifest.json +197 -0
  157. package/dist/catalog/knowledge-catalogs/wi/wikipedia-food-drink/keywords.json +4009 -0
  158. package/dist/catalog/knowledge-catalogs/wi/wikipedia-food-drink/manifest.json +1 -1
  159. package/dist/catalog/knowledge-catalogs/wi/wikipedia-food-drink/versions/2026.10.1/manifest.json +185 -0
  160. package/dist/catalog/knowledge-catalogs/wi/wikipedia-games/keywords.json +5672 -0
  161. package/dist/catalog/knowledge-catalogs/wi/wikipedia-games/manifest.json +1 -1
  162. package/dist/catalog/knowledge-catalogs/wi/wikipedia-games/versions/2026.10.1/manifest.json +137 -0
  163. package/dist/catalog/knowledge-catalogs/wi/wikipedia-geography/manifest.json +68 -0
  164. package/dist/catalog/knowledge-catalogs/wi/wikipedia-geography/versions/2026.10.1/manifest.json +217 -0
  165. package/dist/catalog/knowledge-catalogs/wi/wikipedia-history/manifest.json +68 -0
  166. package/dist/catalog/knowledge-catalogs/wi/wikipedia-history/versions/2026.10.1/manifest.json +217 -0
  167. package/dist/catalog/knowledge-catalogs/wi/wikipedia-language/keywords.json +4009 -0
  168. package/dist/catalog/knowledge-catalogs/wi/wikipedia-language/manifest.json +1 -1
  169. package/dist/catalog/knowledge-catalogs/wi/wikipedia-language/versions/2026.10.1/manifest.json +141 -0
  170. package/dist/catalog/knowledge-catalogs/wi/wikipedia-law/keywords.json +4009 -0
  171. package/dist/catalog/knowledge-catalogs/wi/wikipedia-law/manifest.json +1 -1
  172. package/dist/catalog/knowledge-catalogs/wi/wikipedia-law/versions/2026.10.1/manifest.json +185 -0
  173. package/dist/catalog/knowledge-catalogs/wi/wikipedia-literature/keywords.json +5719 -0
  174. package/dist/catalog/knowledge-catalogs/wi/wikipedia-literature/manifest.json +1 -1
  175. package/dist/catalog/knowledge-catalogs/wi/wikipedia-literature/versions/2026.10.1/manifest.json +193 -0
  176. package/dist/catalog/knowledge-catalogs/wi/wikipedia-mathematics/keywords.json +4009 -0
  177. package/dist/catalog/knowledge-catalogs/wi/wikipedia-mathematics/manifest.json +1 -1
  178. package/dist/catalog/knowledge-catalogs/wi/wikipedia-mathematics/versions/2026.10.1/manifest.json +189 -0
  179. package/dist/catalog/knowledge-catalogs/wi/wikipedia-medicine/keywords.json +16009 -0
  180. package/dist/catalog/knowledge-catalogs/wi/wikipedia-medicine/manifest.json +1 -1
  181. package/dist/catalog/knowledge-catalogs/wi/wikipedia-medicine/versions/2026.10.1/manifest.json +185 -0
  182. package/dist/catalog/knowledge-catalogs/wi/wikipedia-military/keywords.json +5843 -0
  183. package/dist/catalog/knowledge-catalogs/wi/wikipedia-military/manifest.json +1 -1
  184. package/dist/catalog/knowledge-catalogs/wi/wikipedia-military/versions/2026.10.1/manifest.json +189 -0
  185. package/dist/catalog/knowledge-catalogs/wi/wikipedia-music/keywords.json +6264 -0
  186. package/dist/catalog/knowledge-catalogs/wi/wikipedia-music/manifest.json +1 -1
  187. package/dist/catalog/knowledge-catalogs/wi/wikipedia-music/versions/2026.10.1/manifest.json +197 -0
  188. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-arts/manifest.json +66 -0
  189. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-arts/versions/2026.10.1/manifest.json +209 -0
  190. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-business/manifest.json +61 -0
  191. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-business/versions/2026.10.1/manifest.json +189 -0
  192. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-entertainment/manifest.json +64 -0
  193. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-entertainment/versions/2026.10.1/manifest.json +201 -0
  194. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-military/manifest.json +60 -0
  195. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-military/versions/2026.10.1/manifest.json +185 -0
  196. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-other/manifest.json +55 -0
  197. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-other/versions/2026.10.1/manifest.json +165 -0
  198. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-politics/manifest.json +63 -0
  199. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-politics/versions/2026.10.1/manifest.json +197 -0
  200. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-religion/manifest.json +64 -0
  201. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-religion/versions/2026.10.1/manifest.json +201 -0
  202. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-science/manifest.json +65 -0
  203. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-science/versions/2026.10.1/manifest.json +205 -0
  204. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-sports/manifest.json +73 -0
  205. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-sports/versions/2026.10.1/manifest.json +237 -0
  206. package/dist/catalog/knowledge-catalogs/wi/wikipedia-politics/keywords.json +5447 -0
  207. package/dist/catalog/knowledge-catalogs/wi/wikipedia-politics/manifest.json +1 -1
  208. package/dist/catalog/knowledge-catalogs/wi/wikipedia-politics/versions/2026.10.1/manifest.json +197 -0
  209. package/dist/catalog/knowledge-catalogs/wi/wikipedia-religion-philosophy/keywords.json +4009 -0
  210. package/dist/catalog/knowledge-catalogs/wi/wikipedia-religion-philosophy/manifest.json +1 -1
  211. package/dist/catalog/knowledge-catalogs/wi/wikipedia-religion-philosophy/versions/2026.10.1/manifest.json +189 -0
  212. package/dist/catalog/knowledge-catalogs/wi/wikipedia-science/keywords.json +4009 -0
  213. package/dist/catalog/knowledge-catalogs/wi/wikipedia-science/manifest.json +1 -1
  214. package/dist/catalog/knowledge-catalogs/wi/wikipedia-science/versions/2026.10.1/manifest.json +185 -0
  215. package/dist/catalog/knowledge-catalogs/wi/wikipedia-sports/keywords.json +5209 -0
  216. package/dist/catalog/knowledge-catalogs/wi/wikipedia-sports/manifest.json +1 -1
  217. package/dist/catalog/knowledge-catalogs/wi/wikipedia-sports/versions/2026.10.1/manifest.json +193 -0
  218. package/dist/catalog/knowledge-catalogs/wi/wikipedia-technology/keywords.json +6537 -0
  219. package/dist/catalog/knowledge-catalogs/wi/wikipedia-technology/manifest.json +1 -1
  220. package/dist/catalog/knowledge-catalogs/wi/wikipedia-technology/versions/2026.10.1/manifest.json +185 -0
  221. package/dist/catalog/knowledge-catalogs/wi/wikipedia-transportation/keywords.json +5989 -0
  222. package/dist/catalog/knowledge-catalogs/wi/wikipedia-transportation/manifest.json +1 -1
  223. package/dist/catalog/knowledge-catalogs/wi/wikipedia-transportation/versions/2026.10.1/manifest.json +189 -0
  224. package/dist/catalog/provenance.json +2 -1
  225. package/dist/engines/native-file-manifest.json +198 -118
  226. package/dist/engines/native-manifest.d.ts +4 -4
  227. package/dist/engines/native-manifest.js +36 -34
  228. package/dist/engines/resolver.js +12 -1
  229. package/dist/fs/atomic.d.ts +4 -1
  230. package/dist/fs/atomic.js +7 -1
  231. package/dist/http/openai-compat/chat-target.d.ts +1 -1
  232. package/dist/http/openai-compat/chat-target.js +1 -1
  233. package/dist/http/openai-compat/engine-failure.js +7 -2
  234. package/dist/http/routes/v1-chat.js +1 -1
  235. package/dist/http/routes/v1-images.d.ts +44 -0
  236. package/dist/http/routes/v1-images.js +370 -0
  237. package/dist/http/routes/v1-knowledge.js +4 -0
  238. package/dist/http/routes/v1-responses.d.ts +1 -1
  239. package/dist/inference-service.d.ts +9 -1
  240. package/dist/inference-service.js +44 -11
  241. package/dist/knowledge/manager.d.ts +7 -0
  242. package/dist/knowledge/manager.js +32 -1
  243. package/dist/kokoro-lexicon/manifest.json +6 -3
  244. package/dist/models/image-fit.d.ts +83 -0
  245. package/dist/models/image-fit.js +163 -0
  246. package/dist/models/weight-facts.d.ts +36 -0
  247. package/dist/models/weight-facts.js +171 -0
  248. package/dist/perf/responsiveness.js +4 -3
  249. package/dist/providers/audio/kokoro-frontend.js +1 -1
  250. package/dist/providers/ds4/build-provider.js +34 -21
  251. package/dist/providers/ds4/dspark.d.ts +23 -5
  252. package/dist/providers/ds4/dspark.js +36 -8
  253. package/dist/providers/image/img2img-support.d.ts +40 -0
  254. package/dist/providers/image/img2img-support.js +74 -0
  255. package/dist/providers/image/local-engine.d.ts +31 -0
  256. package/dist/providers/image/local-engine.js +47 -0
  257. package/dist/providers/image/local-factory.d.ts +95 -0
  258. package/dist/providers/image/local-factory.js +270 -0
  259. package/dist/providers/image/mock.d.ts +23 -0
  260. package/dist/providers/image/mock.js +151 -0
  261. package/dist/providers/image/pull-registry.d.ts +106 -0
  262. package/dist/providers/image/pull-registry.js +227 -0
  263. package/dist/providers/image/sd-cpp.d.ts +200 -0
  264. package/dist/providers/image/sd-cpp.js +845 -0
  265. package/dist/providers/image/types.d.ts +235 -0
  266. package/dist/providers/image/types.js +20 -0
  267. package/dist/providers/llama-cpp/backend-health.d.ts +7 -0
  268. package/dist/providers/llama-cpp/backend-health.js +41 -1
  269. package/dist/providers/llama-cpp/build-provider.js +107 -56
  270. package/dist/providers/llama-cpp/cache-adapter.d.ts +7 -1
  271. package/dist/providers/llama-cpp/cache-adapter.js +9 -0
  272. package/dist/providers/llama-cpp/devices.d.ts +13 -2
  273. package/dist/providers/llama-cpp/devices.js +43 -6
  274. package/dist/providers/llama-cpp/models.js +4 -1
  275. package/dist/providers/llama-cpp/offload-planner.d.ts +23 -0
  276. package/dist/providers/llama-cpp/offload-planner.js +27 -0
  277. package/dist/providers/llama-cpp/provider.d.ts +14 -3
  278. package/dist/providers/llama-cpp/provider.js +35 -2
  279. package/dist/providers/mlx/provider.js +15 -5
  280. package/dist/providers/mlx/reasoning-stream.d.ts +15 -0
  281. package/dist/providers/mlx/reasoning-stream.js +35 -0
  282. package/dist/providers/native/capacity-broker.js +9 -3
  283. package/dist/providers/native/local-engine-runtime.js +15 -12
  284. package/dist/providers/native/supervisor.d.ts +8 -0
  285. package/dist/providers/native/supervisor.js +55 -5
  286. package/dist/providers/project-macro-loop-bail.js +5 -3
  287. package/dist/providers/provider-lifecycle.d.ts +21 -0
  288. package/dist/providers/provider-lifecycle.js +83 -0
  289. package/dist/providers/queue.d.ts +9 -2
  290. package/dist/providers/queue.js +17 -2
  291. package/dist/providers/retirement-gate.d.ts +20 -0
  292. package/dist/providers/retirement-gate.js +55 -0
  293. package/dist/providers/session-hooks.d.ts +4 -1
  294. package/dist/system/memory.js +6 -0
  295. package/dist/utils/image-meta.d.ts +12 -0
  296. package/dist/utils/image-meta.js +77 -0
  297. package/package.json +6 -6
@@ -0,0 +1,270 @@
1
+ /**
2
+ * The local image provider: stable-diffusion.cpp's `sd-server` on this
3
+ * machine. Shared by the full service (behind its cloud and remote routing)
4
+ * and by hosted inference, which serves only this.
5
+ *
6
+ * Selection rules (first-match):
7
+ * 1. `GEZEL_MOCK_PROVIDER=1` → `MockImageProvider` (tests, CI).
8
+ * 2. `GEZEL_SD_SERVER_URL` present → `StableDiffusionCppProvider`
9
+ * pointed at that URL, no supervisor ("user runs their own
10
+ * server" mode — useful during development).
11
+ * 3. `GEZEL_SD_SERVER_BIN` present → `StableDiffusionCppProvider`
12
+ * backed by a `NativeEngineSupervisor` that spawns the binary
13
+ * on-demand at an ephemeral port.
14
+ * 4. Fallback: `StableDiffusionCppProvider` with the default
15
+ * base URL (127.0.0.1:9081) and no supervisor. `health()` reports
16
+ * `not-configured` so the UI can say the engine is not installed.
17
+ */
18
+ import { readFile } from 'node:fs/promises';
19
+ import { join } from 'node:path';
20
+ import { imageMediaPool, sdServerLedgerClaim, sdServerRequirement, } from '../../models/image-fit.js';
21
+ import { findModelRoot, listOverlayModelIds, modelStorageRoots, verifyReadOnlyModelPayload, } from '../../models/storage-roots.js';
22
+ import { localSdCppWeightFiles } from '../../models/weight-facts.js';
23
+ import { pressureIdleGraceMs } from '../native/capacity-broker.js';
24
+ import { measuredCapacityBudget } from '../native/measured-budget.js';
25
+ import { pickFreePort } from '../native/port.js';
26
+ import { NativeEngineSupervisor } from '../native/supervisor.js';
27
+ import { patientFetch } from '../patient-fetch.js';
28
+ import { MockImageProvider } from './mock.js';
29
+ import { MODEL_SAMPLE_STEP_DEFAULTS, StableDiffusionCppProvider, sdServerLoadProfile, } from './sd-cpp.js';
30
+ /**
31
+ * Nothing to generate with: the person has to download a model first. Its
32
+ * own type so a route can answer with the fix, not a bare 500, which reads
33
+ * to an outside app as "something went wrong inside Gezel".
34
+ */
35
+ export class NoLocalImageModelError extends Error {
36
+ code = 'no_local_image_model';
37
+ constructor() {
38
+ super('No image model is available locally. Download one from Settings → Image generation before generating.');
39
+ this.name = 'NoLocalImageModelError';
40
+ }
41
+ }
42
+ /**
43
+ * How sd-server is admitted to the device memory ledger: by bytes, like any
44
+ * other engine, never exclusively. The ledger already refuses co-residency
45
+ * where the byte or GPU budget cannot hold both, and `detectGpuPolicy` states
46
+ * the rule: automatic heuristics must not serialize models that fit.
47
+ * Exclusive admission did exactly that. On a DGX Spark with gemma4-31b
48
+ * resident (95 GB of a 128 GB machine), a 4-second SDXL render waited up to
49
+ * 89 s for the chat engine to go idle, then was evicted as soon as the next
50
+ * chat turn asked for memory, so every render paid a fresh load.
51
+ */
52
+ export function sdServerCapacity(home) {
53
+ return { home };
54
+ }
55
+ export async function createLocalImageProvider(opts) {
56
+ const env = opts.env ?? process.env;
57
+ const storageRoots = modelStorageRoots({ home: opts.home, engine: 'sd-cpp', env });
58
+ const modelsRoot = storageRoots.writableRoot;
59
+ const defaultLocalModelId = opts.defaultModelId;
60
+ if (env.GEZEL_MOCK_PROVIDER === '1') {
61
+ return new MockImageProvider();
62
+ }
63
+ if (env.GEZEL_SD_SERVER_URL) {
64
+ return new StableDiffusionCppProvider({
65
+ baseUrl: env.GEZEL_SD_SERVER_URL,
66
+ modelsRoot,
67
+ storageRoots,
68
+ fetchImpl: patientFetch(),
69
+ ...(defaultLocalModelId ? { defaultModelId: defaultLocalModelId } : {}),
70
+ });
71
+ }
72
+ if (env.GEZEL_SD_SERVER_BIN) {
73
+ const binary = env.GEZEL_SD_SERVER_BIN;
74
+ // Track the most-recently-resolved launch so the provider can point
75
+ // fetch() at the right port without the supervisor exposing state.
76
+ let cachedPort;
77
+ // Shared with the provider: which installed model to launch
78
+ // sd-server with. sd-server is single-model per process, so the
79
+ // provider sets this to the requested model and stops the server
80
+ // when it changes; resolveLaunch reads it on the next start.
81
+ const launchState = { modelId: undefined };
82
+ let launchedModel;
83
+ const supervisor = new NativeEngineSupervisor({
84
+ capacity: {
85
+ ...sdServerCapacity(opts.home),
86
+ // Price the launched model from its own weight files — the same
87
+ // pricing the download page used — and claim what the render
88
+ // actually holds on the card (see sdServerLedgerClaim).
89
+ requirement: async () => {
90
+ if (!launchedModel)
91
+ return undefined;
92
+ const budget = await measuredCapacityBudget();
93
+ const requirement = sdServerRequirement({
94
+ modelId: launchedModel.id,
95
+ weightsKind: launchedModel.weightsKind,
96
+ files: await localSdCppWeightFiles(launchedModel),
97
+ pool: imageMediaPool(budget.kind),
98
+ });
99
+ return sdServerLedgerClaim(requirement, budget.fastBytes);
100
+ },
101
+ },
102
+ logPrefix: '[sd-server]',
103
+ // sd-server has no `/health`. It answers the root with an HTML file
104
+ // (with --serve-html-path) or a 404, and starts listening only once
105
+ // it has read the model's metadata — the weights themselves load
106
+ // inside the first request. Any HTTP response is the signal.
107
+ readinessPath: '/',
108
+ readyOnAnyResponse: true,
109
+ // Cold start can take a while: metadata for a 49 GB model, backend
110
+ // init, first kernel compile. Give the readiness probe generous
111
+ // headroom so first launch doesn't trip the restart-budget guard.
112
+ startupTimeoutMs: 5 * 60 * 1000,
113
+ // An idle image engine gives its memory back when a chat model is
114
+ // waiting for it, the same way the chat engines yield to a render.
115
+ ...(opts.arbiter
116
+ ? {
117
+ memoryPressure: () => opts.arbiter.getMemoryPressureStatus(),
118
+ pressureIdleTimeoutMs: pressureIdleGraceMs(),
119
+ }
120
+ : {}),
121
+ resolveLaunch: async () => {
122
+ const port = cachedPort ?? (await pickFreePort());
123
+ cachedPort = port;
124
+ // Prefer the model the provider asked for, then the configured
125
+ // default, then the first installed — covering a generate with no
126
+ // explicit model, and a requested (or configured) model having
127
+ // since been deleted.
128
+ const requestedId = launchState.modelId ?? defaultLocalModelId;
129
+ const model = (requestedId ? await findInstalledModel(storageRoots, requestedId) : undefined) ??
130
+ (await findFirstInstalledModel(storageRoots));
131
+ if (!model)
132
+ throw new NoLocalImageModelError();
133
+ launchedModel = model;
134
+ return {
135
+ command: binary,
136
+ args: buildSdServerArgs(model, port),
137
+ baseUrl: `http://127.0.0.1:${port}`,
138
+ };
139
+ },
140
+ });
141
+ return new StableDiffusionCppProvider({
142
+ // The baseUrl here is only the fallback when the supervisor is
143
+ // not yet resolved; generate() overrides from `ensureRunning()`.
144
+ baseUrl: 'http://127.0.0.1:9081',
145
+ modelsRoot,
146
+ storageRoots,
147
+ supervisor,
148
+ launchState,
149
+ fetchImpl: patientFetch(),
150
+ ...(defaultLocalModelId ? { defaultModelId: defaultLocalModelId } : {}),
151
+ ...(opts.arbiter ? { arbiter: opts.arbiter } : {}),
152
+ });
153
+ }
154
+ return new StableDiffusionCppProvider({
155
+ baseUrl: 'http://127.0.0.1:9081',
156
+ modelsRoot,
157
+ storageRoots,
158
+ ...(defaultLocalModelId ? { defaultModelId: defaultLocalModelId } : {}),
159
+ // Nothing was wired up. Flag the provider so `health()` can return
160
+ // `not-configured` (distinct UI guidance) rather than making the user
161
+ // wait for a generic "unreachable" probe to fail.
162
+ configured: false,
163
+ });
164
+ }
165
+ /**
166
+ * Read one installed model's resolved launch info from its on-disk
167
+ * `manifest.json`, or undefined if absent / malformed / incomplete.
168
+ */
169
+ async function resolveInstalledModel(modelsRoot, id, storageRoots) {
170
+ try {
171
+ const itemDir = join(modelsRoot, id);
172
+ const raw = await readFile(join(itemDir, 'manifest.json'), 'utf8');
173
+ const parsed = JSON.parse(raw);
174
+ if (!parsed.id || !parsed.name || !parsed.weightsFilename)
175
+ return undefined;
176
+ if (storageRoots &&
177
+ !(await verifyReadOnlyModelPayload(storageRoots, modelsRoot, id, parsed.fileSha256))) {
178
+ return undefined;
179
+ }
180
+ const aux = [];
181
+ for (const a of parsed.auxiliaryFiles ?? []) {
182
+ if (a.role && a.filename)
183
+ aux.push({ role: a.role, path: join(itemDir, a.filename) });
184
+ }
185
+ return {
186
+ id: parsed.id,
187
+ name: parsed.name,
188
+ approxSizeBytes: parsed.approxSizeBytes ?? 0,
189
+ installedAt: parsed.installedAt ?? new Date().toISOString(),
190
+ weightsPath: join(itemDir, parsed.weightsFilename),
191
+ weightsKind: parsed.weightsKind ?? 'checkpoint',
192
+ auxiliaryFiles: aux,
193
+ };
194
+ }
195
+ catch {
196
+ return undefined;
197
+ }
198
+ }
199
+ /** Resolve a specific installed model by id (the one a request targets). */
200
+ async function findInstalledModel(storageRoots, id) {
201
+ const root = await findModelRoot(storageRoots, id);
202
+ return root ? resolveInstalledModel(root, id, storageRoots) : undefined;
203
+ }
204
+ async function findFirstInstalledModel(storageRoots) {
205
+ const entries = await listOverlayModelIds(storageRoots);
206
+ entries.sort();
207
+ for (const id of entries) {
208
+ const model = await findInstalledModel(storageRoots, id);
209
+ if (model)
210
+ return model;
211
+ }
212
+ return undefined;
213
+ }
214
+ /**
215
+ * Translate a resolved on-disk model into stable-diffusion.cpp's `sd-server`
216
+ * launch flags. `checkpoint` weights load via `--model`; `diffusion-model`
217
+ * weights are unet-only and ride alongside `--vae`/`--clip_l`/`--clip_g`/
218
+ * `--t5xxl` from the auxiliary files. Aux roles map 1:1 to flag names.
219
+ *
220
+ * Bind flags use `--listen-ip` / `--listen-port` (NOT `--host` / `--port`)
221
+ * — that's the upstream stable-diffusion.cpp server CLI as of master-587;
222
+ * earlier llama.cpp-style `--host` / `--port` will be rejected with
223
+ * `error: unknown argument: --host` and the supervisor restart-loops.
224
+ *
225
+ * `--vae-tiling` is the default because SDXL/Flux-class VAE decode at
226
+ * 800–1024px wants a single ~7 GB Vulkan buffer, which exceeds the
227
+ * per-allocation cap most consumer drivers enforce (~25–50% of total
228
+ * VRAM). The OOM lands at the very last step (sampling completes, then
229
+ * VAE blows up), wasting the entire generation. Tiled decode splits
230
+ * that buffer into chunks at ~10–20% decode-speed cost; on a 12 GB
231
+ * card it's the difference between succeeding and dying on `vae alloc
232
+ * compute buffer failed`. Quality difference is imperceptible for the
233
+ * tile sizes sd.cpp picks.
234
+ *
235
+ * The text encoder never takes flash attention. ggml's CPU kernel sums the
236
+ * attention values in FP16, which a Qwen-family encoder overflows: FLUX.2
237
+ * klein on a Windows-on-ARM CPU rendered unrelated shapes with a 200
238
+ * (native-v0.1.53). It bites wherever the encoder lands on the CPU, and the
239
+ * encoder runs once per image, so GPUs lose nothing. `--diffusion-fa` means
240
+ * `--flash-attn off,diffusion=on`, so that branch already leaves it off.
241
+ */
242
+ export function buildSdServerArgs(model, port) {
243
+ const args = [];
244
+ if (model.weightsKind === 'diffusion-model') {
245
+ args.push('--diffusion-model', model.weightsPath);
246
+ }
247
+ else {
248
+ args.push('--model', model.weightsPath);
249
+ }
250
+ for (const aux of model.auxiliaryFiles) {
251
+ args.push(`--${aux.role}`, aux.path);
252
+ }
253
+ const steps = MODEL_SAMPLE_STEP_DEFAULTS.get(model.id);
254
+ if (steps)
255
+ args.push('--steps', String(steps));
256
+ const profile = sdServerLoadProfile(model.id);
257
+ if (profile.diffusionFlashAttention)
258
+ args.push('--diffusion-fa');
259
+ else
260
+ args.push('--flash-attn', 'auto,te=off');
261
+ if (profile.bf16TensorPattern) {
262
+ args.push('--tensor-type-rules', `${profile.bf16TensorPattern}=bf16`);
263
+ }
264
+ if (profile.vaeDecode === 'tiled')
265
+ args.push('--vae-tiling');
266
+ if (profile.stepCache)
267
+ args.push('--cache-mode', profile.stepCache);
268
+ args.push('--listen-ip', '127.0.0.1', '--listen-port', String(port));
269
+ return args;
270
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * MockImageProvider — deterministic image generation for tests and for the
3
+ * `GEZEL_MOCK_PROVIDER=1` flow. Produces a tiny, valid PNG whose pixel
4
+ * colour is derived from a hash of the prompt so different prompts yield
5
+ * visually different (but still trivially small) outputs.
6
+ */
7
+ import type { ImageEngineHealth, ImageGenerationInput, ImageGenerationOutput, ImageModelPullEvent, ImageModelPullSpec, ImageProvider, InstalledImageModelInfo } from './types.js';
8
+ export declare class MockImageProvider implements ImageProvider {
9
+ readonly name = "mock";
10
+ private readonly installed;
11
+ /** Internal counter driving deterministic seed generation on "random" seeds. */
12
+ private nextSeed;
13
+ constructor(opts?: {
14
+ preinstalled?: InstalledImageModelInfo[];
15
+ });
16
+ /** Number of input images received on the most recent generate(). Tests use this. */
17
+ lastInputImageCount: number;
18
+ generate(input: ImageGenerationInput): Promise<ImageGenerationOutput>;
19
+ listInstalledModels(): Promise<InstalledImageModelInfo[]>;
20
+ pullModel(id: string, spec: ImageModelPullSpec, signal?: AbortSignal): AsyncIterable<ImageModelPullEvent>;
21
+ deleteModel(id: string): Promise<void>;
22
+ health(): Promise<ImageEngineHealth>;
23
+ }
@@ -0,0 +1,151 @@
1
+ /**
2
+ * MockImageProvider — deterministic image generation for tests and for the
3
+ * `GEZEL_MOCK_PROVIDER=1` flow. Produces a tiny, valid PNG whose pixel
4
+ * colour is derived from a hash of the prompt so different prompts yield
5
+ * visually different (but still trivially small) outputs.
6
+ */
7
+ import { deflateSync } from 'node:zlib';
8
+ export class MockImageProvider {
9
+ name = 'mock';
10
+ installed = new Map();
11
+ /** Internal counter driving deterministic seed generation on "random" seeds. */
12
+ nextSeed = 1;
13
+ constructor(opts = {}) {
14
+ for (const m of opts.preinstalled ?? []) {
15
+ this.installed.set(m.id, m);
16
+ }
17
+ }
18
+ /** Number of input images received on the most recent generate(). Tests use this. */
19
+ lastInputImageCount = 0;
20
+ async generate(input) {
21
+ this.lastInputImageCount = input.inputImages?.length ?? 0;
22
+ const width = clamp(input.width ?? 16, 1, 512);
23
+ const height = clamp(input.height ?? 16, 1, 512);
24
+ const steps = clamp(input.steps ?? 1, 1, 100);
25
+ const seed = input.seed ?? this.nextSeed++;
26
+ const model = input.model ?? [...this.installed.keys()][0] ?? 'mock-model';
27
+ const rgba = solidFill(width, height, colourForPrompt(input.prompt));
28
+ const png = encodePng(rgba, width, height);
29
+ return {
30
+ png,
31
+ meta: {
32
+ model,
33
+ seed,
34
+ steps,
35
+ widthPx: width,
36
+ heightPx: height,
37
+ durationMs: 1,
38
+ },
39
+ };
40
+ }
41
+ async listInstalledModels() {
42
+ return [...this.installed.values()];
43
+ }
44
+ async *pullModel(id, spec, signal) {
45
+ const total = spec.approxSizeBytes;
46
+ for (const step of [0.25, 0.5, 0.75, 1]) {
47
+ if (signal?.aborted) {
48
+ yield { type: 'error', error: 'download aborted' };
49
+ yield { type: 'done', id };
50
+ return;
51
+ }
52
+ // Tiny tick so tests can observe a mid-pull state between steps.
53
+ await new Promise((resolve) => {
54
+ const t = setTimeout(resolve, 5);
55
+ t.unref?.();
56
+ });
57
+ yield { type: 'progress', bytesWritten: Math.round(total * step), totalBytes: total };
58
+ }
59
+ this.installed.set(id, {
60
+ id,
61
+ name: spec.name,
62
+ approxSizeBytes: total,
63
+ installedAt: new Date().toISOString(),
64
+ });
65
+ yield { type: 'done', id };
66
+ }
67
+ async deleteModel(id) {
68
+ this.installed.delete(id);
69
+ }
70
+ async health() {
71
+ return { status: 'ok', baseUrl: 'mock://image' };
72
+ }
73
+ }
74
+ function clamp(n, min, max) {
75
+ if (n < min)
76
+ return min;
77
+ if (n > max)
78
+ return max;
79
+ return n;
80
+ }
81
+ /** Hash the prompt to an `[r, g, b]` tuple so different prompts paint different pixels. */
82
+ function colourForPrompt(prompt) {
83
+ let h = 2166136261;
84
+ for (let i = 0; i < prompt.length; i++) {
85
+ h ^= prompt.charCodeAt(i);
86
+ h = Math.imul(h, 16777619);
87
+ }
88
+ return [h & 0xff, (h >>> 8) & 0xff, (h >>> 16) & 0xff];
89
+ }
90
+ function solidFill(width, height, rgb) {
91
+ const rgba = new Uint8Array(width * height * 4);
92
+ for (let i = 0; i < width * height; i++) {
93
+ rgba[i * 4] = rgb[0];
94
+ rgba[i * 4 + 1] = rgb[1];
95
+ rgba[i * 4 + 2] = rgb[2];
96
+ rgba[i * 4 + 3] = 0xff;
97
+ }
98
+ return rgba;
99
+ }
100
+ // ── Minimal PNG encoder (RGBA, no filter) ──────────────────────────
101
+ const CRC_TABLE = (() => {
102
+ const table = new Uint32Array(256);
103
+ for (let n = 0; n < 256; n++) {
104
+ let c = n;
105
+ for (let k = 0; k < 8; k++)
106
+ c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
107
+ table[n] = c >>> 0;
108
+ }
109
+ return table;
110
+ })();
111
+ function crc32(bytes) {
112
+ let crc = 0xffffffff;
113
+ for (let i = 0; i < bytes.length; i++)
114
+ crc = CRC_TABLE[(crc ^ bytes[i]) & 0xff] ^ (crc >>> 8);
115
+ return (crc ^ 0xffffffff) >>> 0;
116
+ }
117
+ function chunk(type, data) {
118
+ const typeBytes = Buffer.from(type, 'ascii');
119
+ const buf = Buffer.alloc(8 + data.length + 4);
120
+ buf.writeUInt32BE(data.length, 0);
121
+ typeBytes.copy(buf, 4);
122
+ Buffer.from(data).copy(buf, 8);
123
+ const crcInput = new Uint8Array(typeBytes.length + data.length);
124
+ crcInput.set(typeBytes, 0);
125
+ crcInput.set(data, typeBytes.length);
126
+ buf.writeUInt32BE(crc32(crcInput), 8 + data.length);
127
+ return buf;
128
+ }
129
+ function encodePng(rgba, width, height) {
130
+ const sig = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
131
+ const ihdr = Buffer.alloc(13);
132
+ ihdr.writeUInt32BE(width, 0);
133
+ ihdr.writeUInt32BE(height, 4);
134
+ ihdr[8] = 8;
135
+ ihdr[9] = 6;
136
+ ihdr[10] = 0;
137
+ ihdr[11] = 0;
138
+ ihdr[12] = 0;
139
+ const raw = new Uint8Array(height * (1 + width * 4));
140
+ for (let y = 0; y < height; y++) {
141
+ raw[y * (1 + width * 4)] = 0;
142
+ raw.set(rgba.subarray(y * width * 4, (y + 1) * width * 4), y * (1 + width * 4) + 1);
143
+ }
144
+ const idat = deflateSync(raw);
145
+ return Buffer.concat([
146
+ sig,
147
+ chunk('IHDR', ihdr),
148
+ chunk('IDAT', idat),
149
+ chunk('IEND', new Uint8Array(0)),
150
+ ]);
151
+ }
@@ -0,0 +1,106 @@
1
+ import { type ImageModelPullEvent } from '@bendyline/gezel';
2
+ import type { CatalogService } from '@bendyline/gezel-catalog';
3
+ import type { ImageProvider } from './types.js';
4
+ /**
5
+ * Snapshot of one in-flight (or recently-finished) image-model pull.
6
+ * Exposed to the UI via `GET /api/image-gen/pulls` so a client that
7
+ * mounted after the pull started can still render an accurate
8
+ * progress bar without subscribing to the live SSE.
9
+ */
10
+ export interface ActiveImagePull {
11
+ id: string;
12
+ startedAt: string;
13
+ bytesWritten: number;
14
+ /** Best-known total. Zero until the first `progress` event arrives. */
15
+ totalBytes: number;
16
+ /** Present when the shared downloader is between retry attempts. */
17
+ retrying?: {
18
+ attempt: number;
19
+ maxAttempts: number;
20
+ delayMs: number;
21
+ reason: string;
22
+ };
23
+ /** Set once a terminal event has been observed (done or error). */
24
+ finished: boolean;
25
+ /** Set when the pull errored — kept on the snapshot so reconnecting clients see the failure. */
26
+ error?: string;
27
+ }
28
+ type Listener = (event: ImageModelPullEvent) => void;
29
+ /**
30
+ * Where pulls get their provider: the service's routing manager, or the
31
+ * hosted inference's local provider. Read on every pull so a provider reset
32
+ * (an engine binary swap) is picked up.
33
+ */
34
+ export interface ImageProviderSource {
35
+ current(): Promise<Pick<ImageProvider, 'pullModel'>>;
36
+ }
37
+ /**
38
+ * Owns the lifecycle of every in-flight image-model pull.
39
+ *
40
+ * Pulls used to be tied 1:1 to the HTTP request that started them — when
41
+ * the client disconnected (navigated away from Settings → Image
42
+ * generation), the SSE loop exited, the async generator closed, and the
43
+ * download was aborted by the .partial-leaves-resumable code path. A
44
+ * returning client had no record the pull ever existed.
45
+ *
46
+ * The registry decouples those two: the pull runs in the background owned
47
+ * by this object, and HTTP requests are just consumers that subscribe to
48
+ * the live event stream + the cached snapshot. Disconnect detaches the
49
+ * consumer; the pull keeps going. Cancel is now an explicit `DELETE
50
+ * /pulls/:id` rather than a side-effect of closing the fetch.
51
+ */
52
+ export declare class ImageModelPullRegistry {
53
+ private readonly entries;
54
+ private readonly controllers;
55
+ private readonly imageProvider;
56
+ private readonly catalog;
57
+ constructor(opts: {
58
+ imageProvider: ImageProviderSource;
59
+ catalog: CatalogService;
60
+ });
61
+ /**
62
+ * Start a pull for `id`. Idempotent — when a pull is already in flight
63
+ * for this id, returns the existing snapshot and does not kick off a
64
+ * second download. Throws if the catalog id is unknown.
65
+ *
66
+ * The pull itself runs in a detached `void` task; this method returns
67
+ * synchronously-claimed state so callers can immediately subscribe
68
+ * without racing the first event.
69
+ */
70
+ start(id: string): Promise<{
71
+ snapshot: ActiveImagePull;
72
+ alreadyRunning: boolean;
73
+ }>;
74
+ list(): ActiveImagePull[];
75
+ get(id: string): ActiveImagePull | null;
76
+ /**
77
+ * Subscribe to live events for an in-flight pull. On subscribe, the
78
+ * registry immediately delivers a synthetic event reflecting the last
79
+ * known snapshot — without it, a late subscriber to a paused (between
80
+ * retry attempts) or just-started pull would see nothing until the
81
+ * next real event, leaving the UI's progress bar blank.
82
+ *
83
+ * Returns `null` when no entry exists for `id` so the caller can
84
+ * 404. Returns an unsubscribe function otherwise; calling it removes
85
+ * the listener but does NOT cancel the pull — disconnect ≠ cancel.
86
+ */
87
+ subscribe(id: string, listener: Listener): (() => void) | null;
88
+ /**
89
+ * Cancel an in-flight pull. The shared downloader observes the abort,
90
+ * leaves the `.partial` in place for resume, and surfaces an `error`
91
+ * event whose snapshot stays in the registry for `FINISHED_TTL_MS`.
92
+ * Returns true when a live entry was aborted.
93
+ */
94
+ cancel(id: string): boolean;
95
+ /** Test-only: drop everything so a fresh test starts clean. */
96
+ clear(): void;
97
+ private replaySnapshot;
98
+ private consume;
99
+ private applyEvent;
100
+ private broadcast;
101
+ }
102
+ export declare class UnknownImageModelError extends Error {
103
+ readonly id: string;
104
+ constructor(id: string);
105
+ }
106
+ export {};