@bendyline/gezel-inference 1.0.6 → 1.0.7

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 (142) hide show
  1. package/dist/cache/controller.d.ts +2 -0
  2. package/dist/cache/controller.js +38 -5
  3. package/dist/catalog/chat-models/index.json +1 -1
  4. package/dist/catalog/chat-models/lf/lfm3-1.7b-q4/manifest.json +114 -0
  5. package/dist/catalog/chat-models/lf/lfm3-1.7b-q4/versions/1.0.0/manifest.json +15 -0
  6. package/dist/catalog/chat-models/raw-index.json +1 -1
  7. package/dist/catalog/image-loras/index.json +1 -0
  8. package/dist/catalog/image-loras/kr/krea-2-ink-wash/manifest.json +31 -0
  9. package/dist/catalog/image-loras/kr/krea-2-ink-wash/versions/1.0.0/manifest.json +15 -0
  10. package/dist/catalog/image-loras/kr/krea-2-isometric-3d/manifest.json +32 -0
  11. package/dist/catalog/image-loras/kr/krea-2-isometric-3d/versions/1.0.0/manifest.json +15 -0
  12. package/dist/catalog/image-loras/kr/krea-2-kids-drawing/manifest.json +31 -0
  13. package/dist/catalog/image-loras/kr/krea-2-kids-drawing/versions/1.0.0/manifest.json +15 -0
  14. package/dist/catalog/image-loras/kr/krea-2-pixel-art/manifest.json +31 -0
  15. package/dist/catalog/image-loras/kr/krea-2-pixel-art/versions/1.0.0/manifest.json +15 -0
  16. package/dist/catalog/image-loras/kr/krea-2-soft-watercolor/manifest.json +31 -0
  17. package/dist/catalog/image-loras/kr/krea-2-soft-watercolor/versions/1.0.0/manifest.json +15 -0
  18. package/dist/catalog/image-loras/kr/krea-2-turbo-4step/manifest.json +31 -0
  19. package/dist/catalog/image-loras/kr/krea-2-turbo-4step/versions/1.0.0/manifest.json +15 -0
  20. package/dist/catalog/image-loras/mo/moss-image-gouache/manifest.json +29 -0
  21. package/dist/catalog/image-loras/mo/moss-image-gouache/versions/1.0.0/manifest.json +15 -0
  22. package/dist/catalog/image-loras/mo/moss-image-sft-4step/manifest.json +30 -0
  23. package/dist/catalog/image-loras/mo/moss-image-sft-4step/versions/1.0.0/manifest.json +15 -0
  24. package/dist/catalog/image-loras/qw/qwen-image-edit-2511-lightning/manifest.json +31 -0
  25. package/dist/catalog/image-loras/qw/qwen-image-edit-2511-lightning/versions/1.0.0/manifest.json +15 -0
  26. package/dist/catalog/image-loras/raw-index.json +1 -0
  27. package/dist/catalog/image-loras/sd/sdxl-3d-render/manifest.json +29 -0
  28. package/dist/catalog/image-loras/sd/sdxl-3d-render/versions/1.0.0/manifest.json +15 -0
  29. package/dist/catalog/image-loras/sd/sdxl-coloring-book/manifest.json +30 -0
  30. package/dist/catalog/image-loras/sd/sdxl-coloring-book/versions/1.0.0/manifest.json +15 -0
  31. package/dist/catalog/image-loras/sd/sdxl-papercut/manifest.json +29 -0
  32. package/dist/catalog/image-loras/sd/sdxl-papercut/versions/1.0.0/manifest.json +15 -0
  33. package/dist/catalog/image-loras/sd/sdxl-pixel-art/manifest.json +29 -0
  34. package/dist/catalog/image-loras/sd/sdxl-pixel-art/versions/1.0.0/manifest.json +15 -0
  35. package/dist/catalog/image-models/fl/flux-2-klein-4b-q4/manifest.json +3 -0
  36. package/dist/catalog/image-models/index.json +1 -1
  37. package/dist/catalog/image-models/qw/qwen-image-edit-2511-q4/manifest.json +44 -0
  38. package/dist/catalog/image-models/qw/qwen-image-edit-2511-q4/versions/1.0.0/manifest.json +36 -0
  39. package/dist/catalog/image-models/raw-index.json +1 -1
  40. package/dist/catalog/knowledge-catalogs/index.json +1 -1
  41. package/dist/catalog/knowledge-catalogs/raw-index.json +1 -1
  42. package/dist/catalog/knowledge-catalogs/wi/wikipedia-arts/versions/2026.10.2/manifest.json +181 -0
  43. package/dist/catalog/knowledge-catalogs/wi/wikipedia-astronomy/versions/2026.10.2/manifest.json +181 -0
  44. package/dist/catalog/knowledge-catalogs/wi/wikipedia-biology/versions/2026.10.2/manifest.json +217 -0
  45. package/dist/catalog/knowledge-catalogs/wi/wikipedia-business/versions/2026.10.2/manifest.json +197 -0
  46. package/dist/catalog/knowledge-catalogs/wi/wikipedia-film-tv/versions/2026.10.2/manifest.json +197 -0
  47. package/dist/catalog/knowledge-catalogs/wi/wikipedia-food-drink/versions/2026.10.2/manifest.json +185 -0
  48. package/dist/catalog/knowledge-catalogs/wi/wikipedia-games/versions/2026.10.2/manifest.json +181 -0
  49. package/dist/catalog/knowledge-catalogs/wi/wikipedia-general/manifest.json +55 -0
  50. package/dist/catalog/knowledge-catalogs/wi/wikipedia-general/versions/2026.10.2/manifest.json +165 -0
  51. package/dist/catalog/knowledge-catalogs/wi/wikipedia-geography/versions/2026.10.2/manifest.json +217 -0
  52. package/dist/catalog/knowledge-catalogs/wi/wikipedia-history/versions/2026.10.2/manifest.json +217 -0
  53. package/dist/catalog/knowledge-catalogs/wi/wikipedia-language/versions/2026.10.2/manifest.json +181 -0
  54. package/dist/catalog/knowledge-catalogs/wi/wikipedia-law/versions/2026.10.2/manifest.json +185 -0
  55. package/dist/catalog/knowledge-catalogs/wi/wikipedia-literature/versions/2026.10.2/manifest.json +193 -0
  56. package/dist/catalog/knowledge-catalogs/wi/wikipedia-mathematics/versions/2026.10.2/manifest.json +189 -0
  57. package/dist/catalog/knowledge-catalogs/wi/wikipedia-medicine/versions/2026.10.2/manifest.json +185 -0
  58. package/dist/catalog/knowledge-catalogs/wi/wikipedia-military/versions/2026.10.2/manifest.json +189 -0
  59. package/dist/catalog/knowledge-catalogs/wi/wikipedia-music/versions/2026.10.2/manifest.json +197 -0
  60. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-arts/versions/2026.10.2/manifest.json +209 -0
  61. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-business/versions/2026.10.2/manifest.json +189 -0
  62. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-entertainment/versions/2026.10.2/manifest.json +201 -0
  63. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-military/versions/2026.10.2/manifest.json +185 -0
  64. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-other/versions/2026.10.2/manifest.json +165 -0
  65. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-politics/versions/2026.10.2/manifest.json +197 -0
  66. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-religion/versions/2026.10.2/manifest.json +201 -0
  67. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-science/versions/2026.10.2/manifest.json +205 -0
  68. package/dist/catalog/knowledge-catalogs/wi/wikipedia-people-sports/versions/2026.10.2/manifest.json +237 -0
  69. package/dist/catalog/knowledge-catalogs/wi/wikipedia-politics/versions/2026.10.2/manifest.json +197 -0
  70. package/dist/catalog/knowledge-catalogs/wi/wikipedia-religion-philosophy/versions/2026.10.2/manifest.json +189 -0
  71. package/dist/catalog/knowledge-catalogs/wi/wikipedia-science/versions/2026.10.2/manifest.json +185 -0
  72. package/dist/catalog/knowledge-catalogs/wi/wikipedia-sports/versions/2026.10.2/manifest.json +193 -0
  73. package/dist/catalog/knowledge-catalogs/wi/wikipedia-technology/versions/2026.10.2/manifest.json +185 -0
  74. package/dist/catalog/knowledge-catalogs/wi/wikipedia-transportation/versions/2026.10.2/manifest.json +189 -0
  75. package/dist/catalog/provenance.json +2 -1
  76. package/dist/engine-components.js +2 -2
  77. package/dist/engines/electron-native-reuse.d.ts +7 -1
  78. package/dist/engines/electron-native-reuse.js +12 -4
  79. package/dist/engines/native-file-manifest.json +546 -406
  80. package/dist/engines/native-manifest.d.ts +4 -4
  81. package/dist/engines/native-manifest.js +36 -36
  82. package/dist/engines/resolver.js +1 -0
  83. package/dist/http/auth-context.d.ts +12 -0
  84. package/dist/http/routes/image-ensure-routes.d.ts +4 -0
  85. package/dist/http/routes/image-ensure-routes.js +102 -0
  86. package/dist/http/routes/v1-image-styles.d.ts +5 -0
  87. package/dist/http/routes/v1-image-styles.js +91 -0
  88. package/dist/http/routes/v1-images.d.ts +1 -0
  89. package/dist/http/routes/v1-images.js +15 -93
  90. package/dist/inference-service.js +2 -1
  91. package/dist/knowledge/worker-host.js +2 -0
  92. package/dist/machine-engine/inspect-runtime.js +12 -3
  93. package/dist/memory/embed-core.js +3 -0
  94. package/dist/memory/embeddings.js +2 -0
  95. package/dist/models/image-fit.js +2 -2
  96. package/dist/models/weight-facts.d.ts +5 -0
  97. package/dist/models/weight-facts.js +5 -2
  98. package/dist/providers/ds4/build-provider.js +1 -1
  99. package/dist/providers/ds4/residency.js +3 -3
  100. package/dist/providers/image/img2img-support.d.ts +36 -1
  101. package/dist/providers/image/img2img-support.js +30 -1
  102. package/dist/providers/image/local-engine.d.ts +1 -0
  103. package/dist/providers/image/local-engine.js +8 -2
  104. package/dist/providers/image/local-factory.d.ts +10 -1
  105. package/dist/providers/image/local-factory.js +33 -6
  106. package/dist/providers/image/mock.d.ts +8 -1
  107. package/dist/providers/image/mock.js +46 -1
  108. package/dist/providers/image/pull-registry.d.ts +25 -3
  109. package/dist/providers/image/pull-registry.js +96 -34
  110. package/dist/providers/image/sd-cpp.d.ts +63 -4
  111. package/dist/providers/image/sd-cpp.js +361 -38
  112. package/dist/providers/image/types.d.ts +76 -4
  113. package/dist/providers/image/types.js +8 -0
  114. package/dist/providers/llama-cpp/build-provider.js +3 -2
  115. package/dist/providers/llama-cpp/cache-adapter.d.ts +3 -0
  116. package/dist/providers/llama-cpp/cache-adapter.js +18 -4
  117. package/dist/providers/llama-cpp/devices.js +2 -2
  118. package/dist/providers/llama-cpp/engine-flags.d.ts +5 -0
  119. package/dist/providers/llama-cpp/engine-flags.js +5 -2
  120. package/dist/providers/mlx/provider.js +13 -4
  121. package/dist/providers/mlx/python/gezel_mlx_server.py +9 -2
  122. package/dist/providers/mlx/python/spec_decode.py +44 -5
  123. package/dist/providers/native/capacity-broker.d.ts +1 -1
  124. package/dist/providers/native/capacity-broker.js +8 -8
  125. package/dist/providers/native/capacity-budget.js +5 -4
  126. package/dist/providers/native/device-capacity-ledger.d.ts +2 -0
  127. package/dist/providers/native/device-capacity-ledger.js +36 -5
  128. package/dist/providers/native/device-capacity.js +4 -3
  129. package/dist/providers/native/local-engine-runtime.js +4 -4
  130. package/dist/providers/native/process-identity.d.ts +2 -0
  131. package/dist/providers/native/process-identity.js +70 -0
  132. package/dist/relevance/relevance-core.js +2 -0
  133. package/dist/relevance/relevance-model.js +2 -0
  134. package/dist/relevance/settings.js +2 -2
  135. package/dist/runtime-lock.d.ts +43 -5
  136. package/dist/runtime-lock.js +189 -26
  137. package/dist/system/host-memory.d.ts +46 -0
  138. package/dist/system/host-memory.js +89 -0
  139. package/dist/system/memory.js +5 -4
  140. package/dist/transformers-cache.js +2 -0
  141. package/dist/utils/download-common.d.ts +1 -1
  142. package/package.json +8 -8
@@ -15,10 +15,11 @@
15
15
  * catalog manifest (so local state is self-describing even if the
16
16
  * catalog entry later disappears).
17
17
  */
18
+ import { type ImageLoraPrompt, type ImageLoraPurpose, type ImageLoraRender } from '@bendyline/gezel';
18
19
  import { type ModelStorageRoots } from '../../models/storage-roots.js';
19
20
  import type { GpuArbiter } from '../gpu-arbiter.js';
20
21
  import type { NativeEngineSupervisor } from '../native/supervisor.js';
21
- import { type ImageEngineHealth, type ImageGenerationInput, type ImageGenerationOutput, type ImageGenerationProgress, type ImageModelPullEvent, type ImageModelPullSpec, type ImageProvider, type InstalledImageModelInfo } from './types.js';
22
+ import { type ImageEngineHealth, type ImageGenerationInput, type ImageGenerationOutput, type ImageGenerationProgress, type ImageLoraPullSpec, type ImageModelPullEvent, type ImageModelPullSpec, type ImageProvider, type InstalledImageLoraInfo, type InstalledImageModelInfo } from './types.js';
22
23
  export interface StableDiffusionCppProviderOptions {
23
24
  /** Base URL of the running sd-server (no trailing slash). */
24
25
  baseUrl: string;
@@ -26,6 +27,13 @@ export interface StableDiffusionCppProviderOptions {
26
27
  modelsRoot: string;
27
28
  /** Optional read-only machine-store overlay. */
28
29
  storageRoots?: ModelStorageRoots;
30
+ /**
31
+ * Where LoRAs install (`modelStorageRoots({ engine: 'sd-cpp-loras' })`).
32
+ * Only the writable root reaches the engine, which takes one
33
+ * `--lora-model-dir`. Absent when the engine is someone else's server
34
+ * (`GEZEL_SD_SERVER_URL`): renders then go without LoRAs, with a note.
35
+ */
36
+ loraRoots?: ModelStorageRoots;
29
37
  /** Awake-time budget for one render request, in ms. Defaults to 30 minutes. */
30
38
  timeoutMs?: number;
31
39
  /** Injected for tests. Defaults to global fetch. */
@@ -130,6 +138,8 @@ export interface SdServerLoadProfile {
130
138
  * measured not to change.
131
139
  */
132
140
  stepCache?: 'easycache';
141
+ /** `--model-args` key=value list. See MODEL_ARGS. */
142
+ modelArgs?: string;
133
143
  }
134
144
  export declare function sdServerLoadProfile(modelId: string): SdServerLoadProfile;
135
145
  export declare class StableDiffusionCppProvider implements ImageProvider {
@@ -137,6 +147,7 @@ export declare class StableDiffusionCppProvider implements ImageProvider {
137
147
  private readonly baseUrl;
138
148
  private readonly modelsRoot;
139
149
  private readonly storageRoots;
150
+ private readonly loraRoots?;
140
151
  private readonly timeoutMs;
141
152
  private readonly fetchImpl;
142
153
  private readonly supervisor?;
@@ -150,6 +161,28 @@ export declare class StableDiffusionCppProvider implements ImageProvider {
150
161
  generate(input: ImageGenerationInput): Promise<ImageGenerationOutput>;
151
162
  private generateInner;
152
163
  listInstalledModels(): Promise<InstalledImageModelInfo[]>;
164
+ /** Installed LoRAs, from the root the engine reads; none when this engine takes none. */
165
+ listLoras(): Promise<InstalledImageLoraInfo[]>;
166
+ /**
167
+ * Install one LoRA: a single safetensors file, sha256-checked like a model,
168
+ * beside a `manifest.json` that keeps the catalog's recipe so the engine can
169
+ * apply it without the catalog.
170
+ */
171
+ pullLora(id: string, spec: ImageLoraPullSpec, signal?: AbortSignal): AsyncIterable<ImageModelPullEvent>;
172
+ deleteLora(id: string): Promise<void>;
173
+ /**
174
+ * The LoRAs a render asked for that this engine can apply to `modelId`:
175
+ * installed in the root the engine reads and checked on that model. The
176
+ * rest are dropped with a note, never an error.
177
+ */
178
+ private resolveLoras;
179
+ /**
180
+ * Keep the LoRAs the running engine can see. sd-server fills its LoRA list
181
+ * only when it is asked for it, and answers `invalid lora path` for any LoRA
182
+ * named before then, so the list is read before every LoRA render.
183
+ */
184
+ private lorasTheEngineHas;
185
+ private readInstalledLora;
153
186
  pullModel(id: string, spec: ImageModelPullSpec, signal?: AbortSignal): AsyncIterable<ImageModelPullEvent>;
154
187
  /**
155
188
  * Stream a single URL to disk with sha256 verification, reporting cumulative
@@ -167,11 +200,13 @@ export declare class StableDiffusionCppProvider implements ImageProvider {
167
200
  health(): Promise<ImageEngineHealth>;
168
201
  shutdown(): Promise<void>;
169
202
  /**
170
- * The configured default when it is installed, else the first installed
171
- * model id, else undefined. Stable ordering matches
172
- * {@link listInstalledModels} so the default is deterministic.
203
+ * The model a fresh picture renders with: the configured default when it
204
+ * is installed and draws, else the first installed model that draws. Stable
205
+ * ordering matches {@link listInstalledModels} so the default is
206
+ * deterministic.
173
207
  */
174
208
  resolveDefaultModelId(): Promise<string | undefined>;
209
+ private chooseModel;
175
210
  private defaultSampleSteps;
176
211
  /**
177
212
  * Read the installed `manifest.json` fields that steer per-model
@@ -182,6 +217,30 @@ export declare class StableDiffusionCppProvider implements ImageProvider {
182
217
  */
183
218
  private readInstalledManifestFields;
184
219
  }
220
+ /**
221
+ * sd-server reads `<sd_cpp_extra_args>{json}</sd_cpp_extra_args>` out of a
222
+ * prompt and applies the JSON as generation parameters, including LoRA and
223
+ * ADetailer model paths it never checks. Prompts come from gezels reading
224
+ * untrusted content and from other apps, so the tag never reaches the engine.
225
+ * Repeated until stable: removing one tag can join the pieces around it into
226
+ * another.
227
+ */
228
+ export declare function withoutEngineDirectives(text: string): string;
229
+ /** An installed LoRA with the recipe its catalog entry gave it. */
230
+ export interface InstalledLora {
231
+ id: string;
232
+ name: string;
233
+ filename: string;
234
+ purpose: ImageLoraPurpose;
235
+ strength: number;
236
+ baseModels: string[];
237
+ prompt?: ImageLoraPrompt;
238
+ render?: ImageLoraRender;
239
+ approxSizeBytes: number;
240
+ installedAt: string;
241
+ }
242
+ /** Every LoRA installed under `loraRoot`, skipping malformed ones. */
243
+ export declare function readInstalledLoras(loraRoot: string): Promise<InstalledLora[]>;
185
244
  /**
186
245
  * Parse one line of sd-server's weight-load bar, which it prints inside the
187
246
  * first request after a launch because it loads weights lazily: