@bendyline/gezel-inference 1.0.3 → 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.
- package/dist/catalog/chat-models/index.json +1 -1
- package/dist/catalog/chat-models/na/nanbeige4.2-3b-q4/manifest.json +1 -1
- package/dist/catalog/chat-models/ne/nemotron3.5-bolt-e4b-q4/manifest.json +142 -0
- package/dist/catalog/chat-models/ne/nemotron3.5-bolt-e4b-q4/versions/1.0.0/manifest.json +14 -0
- package/dist/catalog/chat-models/ne/nemotron3.5-bolt-e4b-q4/versions/1.0.1/manifest.json +14 -0
- package/dist/catalog/chat-models/raw-index.json +1 -1
- package/dist/catalog/image-models/an/animagine-xl-4/manifest.json +40 -0
- package/dist/catalog/image-models/an/animagine-xl-4/versions/4.0.0/manifest.json +10 -0
- package/dist/catalog/image-models/an/animagine-xl-4/versions/4.0.1/manifest.json +16 -0
- package/dist/catalog/image-models/fl/flux-2-klein-4b-q4/manifest.json +44 -0
- package/dist/catalog/image-models/fl/flux-2-klein-4b-q4/versions/1.0.0/manifest.json +23 -0
- package/dist/catalog/image-models/fl/flux-2-klein-4b-q4/versions/1.0.1/manifest.json +29 -0
- package/dist/catalog/image-models/index.json +1 -0
- package/dist/catalog/image-models/ir/iris-3b-f32/manifest.json +41 -0
- package/dist/catalog/image-models/ir/iris-3b-f32/versions/1.0.0/manifest.json +19 -0
- package/dist/catalog/image-models/ir/iris-3b-f32/versions/1.0.1/manifest.json +25 -0
- package/dist/catalog/image-models/ir/iris-3b-f32/versions/1.0.2/manifest.json +25 -0
- package/dist/catalog/image-models/kr/krea-2-turbo-q4/manifest.json +42 -0
- package/dist/catalog/image-models/kr/krea-2-turbo-q4/versions/1.0.0/manifest.json +23 -0
- package/dist/catalog/image-models/kr/krea-2-turbo-q4/versions/1.0.1/manifest.json +29 -0
- package/dist/catalog/image-models/kr/krea-2-turbo-q6/manifest.json +42 -0
- package/dist/catalog/image-models/kr/krea-2-turbo-q6/versions/1.0.0/manifest.json +23 -0
- package/dist/catalog/image-models/kr/krea-2-turbo-q6/versions/1.0.1/manifest.json +29 -0
- package/dist/catalog/image-models/kr/krea-2-turbo-q8/manifest.json +42 -0
- package/dist/catalog/image-models/kr/krea-2-turbo-q8/versions/1.0.0/manifest.json +23 -0
- package/dist/catalog/image-models/kr/krea-2-turbo-q8/versions/1.0.1/manifest.json +29 -0
- package/dist/catalog/image-models/mi/ming-image-0.1-design-bf16/manifest.json +41 -0
- package/dist/catalog/image-models/mi/ming-image-0.1-design-bf16/versions/1.0.0/manifest.json +31 -0
- package/dist/catalog/image-models/mi/ming-image-0.1-design-bf16/versions/1.0.1/manifest.json +50 -0
- package/dist/catalog/image-models/mi/ming-image-0.1-design-bf16/versions/1.0.2/manifest.json +50 -0
- package/dist/catalog/image-models/mo/moss-image-sft-q4/manifest.json +40 -0
- package/dist/catalog/image-models/mo/moss-image-sft-q4/versions/1.0.0/manifest.json +37 -0
- package/dist/catalog/image-models/mo/moss-image-sft-q4/versions/1.0.1/manifest.json +37 -0
- package/dist/catalog/image-models/raw-index.json +1 -0
- package/dist/catalog/image-models/sd/sd-1.5/manifest.json +40 -0
- package/dist/catalog/image-models/sd/sd-1.5/versions/1.0.0/manifest.json +10 -0
- package/dist/catalog/image-models/sd/sd-1.5/versions/1.0.1/manifest.json +16 -0
- package/dist/catalog/image-models/sd/sd-turbo/manifest.json +40 -0
- package/dist/catalog/image-models/sd/sd-turbo/versions/1.0.0/manifest.json +10 -0
- package/dist/catalog/image-models/sd/sd-turbo/versions/1.0.1/manifest.json +16 -0
- package/dist/catalog/image-models/sd/sdxl-base-1.0/manifest.json +39 -0
- package/dist/catalog/image-models/sd/sdxl-base-1.0/versions/1.0.0/manifest.json +10 -0
- package/dist/catalog/image-models/sd/sdxl-base-1.0/versions/1.0.1/manifest.json +16 -0
- package/dist/catalog/image-models/sd/sdxl-lightning-4step/manifest.json +40 -0
- package/dist/catalog/image-models/sd/sdxl-lightning-4step/versions/1.0.0/manifest.json +10 -0
- package/dist/catalog/image-models/sd/sdxl-lightning-4step/versions/1.0.1/manifest.json +16 -0
- package/dist/catalog/image-models/sd/sdxl-turbo/manifest.json +41 -0
- package/dist/catalog/image-models/sd/sdxl-turbo/versions/1.0.0/manifest.json +10 -0
- package/dist/catalog/image-models/sd/sdxl-turbo/versions/1.0.1/manifest.json +16 -0
- package/dist/catalog/provenance.json +2 -1
- package/dist/engines/native-file-manifest.json +129 -119
- package/dist/engines/native-manifest.d.ts +4 -4
- package/dist/engines/native-manifest.js +36 -36
- package/dist/engines/resolver.js +9 -0
- package/dist/http/openai-compat/engine-failure.js +7 -2
- package/dist/http/routes/v1-images.d.ts +44 -0
- package/dist/http/routes/v1-images.js +370 -0
- package/dist/inference-service.d.ts +3 -0
- package/dist/inference-service.js +24 -2
- package/dist/kokoro-lexicon/manifest.json +6 -3
- package/dist/models/image-fit.d.ts +83 -0
- package/dist/models/image-fit.js +163 -0
- package/dist/models/weight-facts.d.ts +36 -0
- package/dist/models/weight-facts.js +171 -0
- package/dist/providers/ds4/build-provider.js +28 -21
- package/dist/providers/ds4/dspark.d.ts +23 -5
- package/dist/providers/ds4/dspark.js +36 -8
- package/dist/providers/image/img2img-support.d.ts +40 -0
- package/dist/providers/image/img2img-support.js +74 -0
- package/dist/providers/image/local-engine.d.ts +31 -0
- package/dist/providers/image/local-engine.js +47 -0
- package/dist/providers/image/local-factory.d.ts +95 -0
- package/dist/providers/image/local-factory.js +270 -0
- package/dist/providers/image/mock.d.ts +23 -0
- package/dist/providers/image/mock.js +151 -0
- package/dist/providers/image/pull-registry.d.ts +106 -0
- package/dist/providers/image/pull-registry.js +227 -0
- package/dist/providers/image/sd-cpp.d.ts +200 -0
- package/dist/providers/image/sd-cpp.js +845 -0
- package/dist/providers/image/types.d.ts +235 -0
- package/dist/providers/image/types.js +20 -0
- package/dist/providers/llama-cpp/backend-health.d.ts +7 -0
- package/dist/providers/llama-cpp/backend-health.js +41 -1
- package/dist/providers/mlx/provider.js +13 -3
- package/dist/providers/native/supervisor.d.ts +8 -0
- package/dist/providers/native/supervisor.js +52 -4
- package/dist/providers/project-macro-loop-bail.js +5 -3
- package/dist/providers/provider-lifecycle.d.ts +21 -0
- package/dist/providers/provider-lifecycle.js +83 -0
- package/dist/providers/retirement-gate.d.ts +20 -0
- package/dist/providers/retirement-gate.js +55 -0
- package/dist/system/memory.js +6 -0
- package/dist/utils/image-meta.d.ts +12 -0
- package/dist/utils/image-meta.js +77 -0
- package/package.json +6 -6
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tracks long-running provider operations while a machine-engine adoption is
|
|
3
|
+
* retiring the user daemon's local provider. The gate closes before draining:
|
|
4
|
+
* callers that already hold a provider reference cannot start a second local
|
|
5
|
+
* operation after the broker has become authoritative.
|
|
6
|
+
*/
|
|
7
|
+
export class ProviderRetirementGate {
|
|
8
|
+
retiring = false;
|
|
9
|
+
retirementMessage = 'local provider retired after machine engine adoption';
|
|
10
|
+
active = 0;
|
|
11
|
+
idleWaiters = new Set();
|
|
12
|
+
beginRetirement(message) {
|
|
13
|
+
this.retiring = true;
|
|
14
|
+
if (message)
|
|
15
|
+
this.retirementMessage = message;
|
|
16
|
+
}
|
|
17
|
+
async run(operation) {
|
|
18
|
+
if (this.retiring) {
|
|
19
|
+
throw new Error(this.retirementMessage);
|
|
20
|
+
}
|
|
21
|
+
this.active += 1;
|
|
22
|
+
try {
|
|
23
|
+
return await operation();
|
|
24
|
+
}
|
|
25
|
+
finally {
|
|
26
|
+
this.active -= 1;
|
|
27
|
+
if (this.active === 0) {
|
|
28
|
+
for (const resolve of this.idleWaiters)
|
|
29
|
+
resolve();
|
|
30
|
+
this.idleWaiters.clear();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async waitForIdle() {
|
|
35
|
+
if (this.active === 0)
|
|
36
|
+
return;
|
|
37
|
+
await new Promise((resolve) => this.idleWaiters.add(resolve));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Wrap only the operations which can own a native engine. Management calls
|
|
42
|
+
* remain direct, and shutdown is deliberately not counted as user work.
|
|
43
|
+
*/
|
|
44
|
+
export function trackProviderOperations(provider, gate, operationNames) {
|
|
45
|
+
return new Proxy(provider, {
|
|
46
|
+
get(target, property) {
|
|
47
|
+
const value = Reflect.get(target, property, target);
|
|
48
|
+
if (typeof value !== 'function')
|
|
49
|
+
return value;
|
|
50
|
+
if (!operationNames.has(property))
|
|
51
|
+
return value.bind(target);
|
|
52
|
+
return (...args) => gate.run(() => Promise.resolve(Reflect.apply(value, target, args)));
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}
|
package/dist/system/memory.js
CHANGED
|
@@ -541,6 +541,12 @@ export function parseNvidiaMemoryProbe(stdout, systemRamBytes = totalmem()) {
|
|
|
541
541
|
deviceNames: devices.map((device) => device.name),
|
|
542
542
|
};
|
|
543
543
|
}
|
|
544
|
+
/**
|
|
545
|
+
* RTX Spark (N1X) is GB10-class silicon but deliberately not in this list.
|
|
546
|
+
* Windows splits its memory at boot into a fixed GPU share and the OS's RAM
|
|
547
|
+
* (32 + 32 GB on a 64 GB machine, changed only by a reboot), so nvidia-smi's
|
|
548
|
+
* figure is a pool of its own and the card is budgeted as discrete.
|
|
549
|
+
*/
|
|
544
550
|
function isKnownUnifiedNvidiaDevice(name) {
|
|
545
551
|
const normalized = name.toLowerCase();
|
|
546
552
|
return /\bgb10\b/.test(normalized) || normalized.includes('dgx spark');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image dimensions from the file header alone, with no image library: PNG,
|
|
3
|
+
* GIF, JPEG and WebP. The service's photo index and the image engines both
|
|
4
|
+
* read through this one parser, so a rendered image's reported size is the
|
|
5
|
+
* size its own header states.
|
|
6
|
+
*/
|
|
7
|
+
export interface ImageMeta {
|
|
8
|
+
format: 'png' | 'jpeg' | 'gif' | 'webp';
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function readImageMeta(buf: Buffer): ImageMeta | null;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image dimensions from the file header alone, with no image library: PNG,
|
|
3
|
+
* GIF, JPEG and WebP. The service's photo index and the image engines both
|
|
4
|
+
* read through this one parser, so a rendered image's reported size is the
|
|
5
|
+
* size its own header states.
|
|
6
|
+
*/
|
|
7
|
+
export function readImageMeta(buf) {
|
|
8
|
+
if (buf.length < 24)
|
|
9
|
+
return null;
|
|
10
|
+
// PNG: 8-byte signature, then IHDR (width @16, height @20, big-endian).
|
|
11
|
+
if (buf[0] === 0x89 && buf[1] === 0x50 && buf[2] === 0x4e && buf[3] === 0x47) {
|
|
12
|
+
return { format: 'png', width: buf.readUInt32BE(16), height: buf.readUInt32BE(20) };
|
|
13
|
+
}
|
|
14
|
+
// GIF: "GIF87a"/"GIF89a", width/height little-endian @6/@8.
|
|
15
|
+
if (buf[0] === 0x47 && buf[1] === 0x49 && buf[2] === 0x46) {
|
|
16
|
+
return { format: 'gif', width: buf.readUInt16LE(6), height: buf.readUInt16LE(8) };
|
|
17
|
+
}
|
|
18
|
+
// JPEG: scan segments for a Start-Of-Frame marker (0xFFC0–C3, C5–C7, C9–CB).
|
|
19
|
+
if (buf[0] === 0xff && buf[1] === 0xd8) {
|
|
20
|
+
let off = 2;
|
|
21
|
+
while (off + 9 < buf.length) {
|
|
22
|
+
if (buf[off] !== 0xff) {
|
|
23
|
+
off++;
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
const marker = buf[off + 1];
|
|
27
|
+
const isSof = (marker >= 0xc0 && marker <= 0xc3) ||
|
|
28
|
+
(marker >= 0xc5 && marker <= 0xc7) ||
|
|
29
|
+
(marker >= 0xc9 && marker <= 0xcb);
|
|
30
|
+
if (isSof) {
|
|
31
|
+
const height = buf.readUInt16BE(off + 5);
|
|
32
|
+
const width = buf.readUInt16BE(off + 7);
|
|
33
|
+
return { format: 'jpeg', width, height };
|
|
34
|
+
}
|
|
35
|
+
// Skip this segment using its length field.
|
|
36
|
+
const len = buf.readUInt16BE(off + 2);
|
|
37
|
+
if (len < 2)
|
|
38
|
+
break;
|
|
39
|
+
off += 2 + len;
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
// WebP: "RIFF"...."WEBP" then a VP8 / VP8L / VP8X chunk.
|
|
44
|
+
if (buf[0] === 0x52 &&
|
|
45
|
+
buf[1] === 0x49 &&
|
|
46
|
+
buf[2] === 0x46 &&
|
|
47
|
+
buf[3] === 0x46 &&
|
|
48
|
+
buf[8] === 0x57 &&
|
|
49
|
+
buf[9] === 0x45 &&
|
|
50
|
+
buf[10] === 0x42 &&
|
|
51
|
+
buf[11] === 0x50) {
|
|
52
|
+
const fourcc = buf.toString('ascii', 12, 16);
|
|
53
|
+
if (fourcc === 'VP8 ' && buf.length >= 30) {
|
|
54
|
+
// Lossy: dimensions are 14-bit at offset 26/28 (mask off the top bits).
|
|
55
|
+
const width = buf.readUInt16LE(26) & 0x3fff;
|
|
56
|
+
const height = buf.readUInt16LE(28) & 0x3fff;
|
|
57
|
+
return { format: 'webp', width, height };
|
|
58
|
+
}
|
|
59
|
+
if (fourcc === 'VP8L' && buf.length >= 25) {
|
|
60
|
+
// Lossless: 1 signature byte then 14+14 bits packed.
|
|
61
|
+
const b0 = buf[21];
|
|
62
|
+
const b1 = buf[22];
|
|
63
|
+
const b2 = buf[23];
|
|
64
|
+
const b3 = buf[24];
|
|
65
|
+
const width = 1 + (((b1 & 0x3f) << 8) | b0);
|
|
66
|
+
const height = 1 + (((b3 & 0x0f) << 10) | (b2 << 2) | ((b1 & 0xc0) >> 6));
|
|
67
|
+
return { format: 'webp', width, height };
|
|
68
|
+
}
|
|
69
|
+
if (fourcc === 'VP8X' && buf.length >= 30) {
|
|
70
|
+
// Extended: 24-bit (value+1) at 24/27.
|
|
71
|
+
const width = 1 + (buf[24] | (buf[25] << 8) | (buf[26] << 16));
|
|
72
|
+
const height = 1 + (buf[27] | (buf[28] << 8) | (buf[29] << 16));
|
|
73
|
+
return { format: 'webp', width, height };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/gezel-inference",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Gezel's on-device inference runtime: native engines, local model management, embeddings, knowledge search, and OpenAI-compatible routes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
"!dist/**/__pycache__"
|
|
74
74
|
],
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@bendyline/gezel": "1.2.
|
|
77
|
-
"@bendyline/gezel-catalog": "1.2.
|
|
78
|
-
"@bendyline/gezel-client": "1.2.
|
|
79
|
-
"@bendyline/gezel-knowledge": "1.2.
|
|
76
|
+
"@bendyline/gezel": "1.2.9",
|
|
77
|
+
"@bendyline/gezel-catalog": "1.2.9",
|
|
78
|
+
"@bendyline/gezel-client": "1.2.9",
|
|
79
|
+
"@bendyline/gezel-knowledge": "1.2.9",
|
|
80
80
|
"hono": "4.13.9",
|
|
81
81
|
"tar": "7.5.21",
|
|
82
82
|
"undici": "8.11.2",
|
|
@@ -105,6 +105,6 @@
|
|
|
105
105
|
"dev": "node scripts/stage-assets.mjs && tsc -p tsconfig.build.json --watch --preserveWatchOutput",
|
|
106
106
|
"typecheck": "tsc --noEmit",
|
|
107
107
|
"test": "vitest run",
|
|
108
|
-
"clean": "
|
|
108
|
+
"clean": "node scripts/clean.mjs"
|
|
109
109
|
}
|
|
110
110
|
}
|