@qvac/sdk 0.17.1 → 0.18.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.
- package/NOTICE +124 -64
- package/README.md +19 -0
- package/dist/client/api/audio-gen.d.ts +17 -0
- package/dist/client/api/audio-gen.js +17 -0
- package/dist/client/api/finetune.d.ts +2 -0
- package/dist/client/api/finetune.js +7 -1
- package/dist/client/api/index.d.ts +1 -1
- package/dist/client/api/index.js +1 -1
- package/dist/client/api/load-model.d.ts +8 -0
- package/dist/client/api/transcribe.d.ts +19 -2
- package/dist/client/api/transcribe.js +66 -27
- package/dist/client/api/translate.d.ts +1 -0
- package/dist/client/api/translate.js +40 -19
- package/dist/client/api/vla.d.ts +42 -1
- package/dist/client/api/vla.js +50 -1
- package/dist/commands/bundle/entry-gen.d.ts +4 -0
- package/dist/commands/bundle/entry-gen.js +6 -0
- package/dist/commands/bundle/index.js +19 -12
- package/dist/examples/asr/parakeet-indic-conformer-filesystem.d.ts +2 -0
- package/dist/examples/asr/parakeet-indic-conformer-filesystem.js +52 -0
- package/dist/examples/audiogen/generate-cover.d.ts +2 -0
- package/dist/examples/audiogen/generate-cover.js +100 -0
- package/dist/examples/llamacpp-fallback.d.ts +2 -0
- package/dist/examples/llamacpp-fallback.js +34 -0
- package/dist/examples/multi-job-completion.d.ts +28 -0
- package/dist/examples/multi-job-completion.js +128 -0
- package/dist/examples/profiling/basic.js +32 -1
- package/dist/examples/system-resources.d.ts +2 -0
- package/dist/examples/system-resources.js +86 -0
- package/dist/examples/tts/audio8.d.ts +2 -0
- package/dist/examples/tts/audio8.js +54 -0
- package/dist/examples/tts/cosyvoice3.d.ts +2 -0
- package/dist/examples/tts/cosyvoice3.js +52 -0
- package/dist/examples/vla-groot.js +92 -49
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/models/registry/models.d.ts +782 -6
- package/dist/models/registry/models.js +2664 -1859
- package/dist/schemas/audio-gen.d.ts +103 -0
- package/dist/schemas/audio-gen.js +135 -4
- package/dist/schemas/common.d.ts +550 -11
- package/dist/schemas/constants-registry.d.ts +18 -4
- package/dist/schemas/constants-registry.js +16 -3
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/llamacpp-config.d.ts +10 -10
- package/dist/schemas/llamacpp-config.js +168 -82
- package/dist/schemas/load-model.d.ts +3678 -323
- package/dist/schemas/load-model.js +21 -3
- package/dist/schemas/public.d.ts +3 -0
- package/dist/schemas/public.js +6 -0
- package/dist/schemas/sdk-config.d.ts +60 -24
- package/dist/schemas/sdk-errors-server.d.ts +1 -0
- package/dist/schemas/sdk-errors-server.js +5 -0
- package/dist/schemas/text-to-speech.d.ts +1086 -110
- package/dist/schemas/text-to-speech.js +194 -4
- package/dist/schemas/tools.d.ts +0 -16
- package/dist/schemas/tools.js +0 -15
- package/dist/schemas/transcription-config.d.ts +2 -0
- package/dist/schemas/transcription-config.js +10 -4
- package/dist/schemas/transcription.d.ts +3 -0
- package/dist/schemas/vla.d.ts +83 -0
- package/dist/schemas/vla.js +105 -2
- package/dist/scripts/link-workspace-inference.d.ts +2 -0
- package/dist/scripts/link-workspace-inference.js +31 -0
- package/dist/server/bare/ops/cancel.d.ts +1 -1
- package/dist/server/bare/ops/cancel.js +1 -1
- package/dist/server/bare/ops/kv-cache-retention.js +11 -0
- package/dist/server/bare/ops/kv-cache-utils.d.ts +1 -1
- package/dist/server/bare/ops/kv-cache-utils.js +40 -12
- package/dist/server/bare/ops/transcribe.d.ts +2 -2
- package/dist/server/bare/ops/transcribe.js +54 -48
- package/dist/server/bare/ops/translate-stats.d.ts +5 -0
- package/dist/server/bare/ops/translate-stats.js +11 -0
- package/dist/server/bare/ops/translate.js +66 -38
- package/dist/server/bare/ops/unload-model.js +30 -24
- package/dist/server/bare/plugins/audiogen-ggml/ops/audio-gen-input.d.ts +20 -0
- package/dist/server/bare/plugins/audiogen-ggml/ops/audio-gen-input.js +153 -0
- package/dist/server/bare/plugins/audiogen-ggml/ops/audio-gen-stream.js +52 -1
- package/dist/server/bare/plugins/audiogen-ggml/plugin.d.ts +28 -0
- package/dist/server/bare/plugins/ggml-ocr/plugin.js +3 -1
- package/dist/server/bare/plugins/ggml-vla/ops/vla-set-embodiment.d.ts +3 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-set-embodiment.js +9 -0
- package/dist/server/bare/plugins/ggml-vla/plugin.d.ts +37 -0
- package/dist/server/bare/plugins/ggml-vla/plugin.js +21 -4
- package/dist/server/bare/plugins/llamacpp-completion/ops/batch-completion-stream.js +16 -15
- package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.d.ts +1 -1
- package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.js +2 -2
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stats.d.ts +6 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stats.js +10 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.d.ts +1 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +131 -123
- package/dist/server/bare/plugins/llamacpp-completion/ops/finetune.js +110 -20
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-session.d.ts +49 -23
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-session.js +308 -143
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.d.ts +1 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.js +2 -2
- package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +6 -6
- package/dist/server/bare/plugins/llamacpp-completion/plugin.js +55 -36
- package/dist/server/bare/plugins/llamacpp-completion/transform.js +1 -7
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +2 -3
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.js +6 -5
- package/dist/server/bare/plugins/parakeet-transcription/plugin.js +27 -16
- package/dist/server/bare/plugins/tts-ggml/ops/parler-options.js +23 -3
- package/dist/server/bare/plugins/tts-ggml/plugin.d.ts +302 -4
- package/dist/server/bare/plugins/tts-ggml/plugin.js +131 -0
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +48 -39
- package/dist/server/bare/registry/model-registry.d.ts +1 -0
- package/dist/server/bare/runtime/request-registry-singleton.js +29 -15
- package/dist/server/bare/runtime/request-registry.d.ts +27 -0
- package/dist/server/bare/runtime/request-registry.js +246 -76
- package/dist/server/bare/types/addon-responses.d.ts +4 -12
- package/dist/server/rpc/handlers/load-model/handler.js +2 -2
- package/dist/server/rpc/handlers/load-model/resolve-session.d.ts +1 -1
- package/dist/server/rpc/handlers/load-model/resolve-session.js +3 -3
- package/dist/server/rpc/handlers/load-model/resolve.d.ts +12 -2
- package/dist/server/rpc/handlers/load-model/resolve.js +90 -12
- package/dist/server/utils/audio/decoder.d.ts +37 -1
- package/dist/server/utils/audio/decoder.js +81 -51
- package/dist/server/utils/config-transform.d.ts +3 -0
- package/dist/server/utils/config-transform.js +6 -0
- package/dist/server/utils/index.d.ts +0 -1
- package/dist/server/utils/index.js +0 -1
- package/dist/server/utils/shard-utils.d.ts +1 -0
- package/dist/server/utils/shard-utils.js +14 -0
- package/dist/server/utils/tool-integration.d.ts +3 -10
- package/dist/server/utils/tool-integration.js +3 -12
- package/dist/utils/errors-server.d.ts +3 -0
- package/dist/utils/errors-server.js +5 -0
- package/package.json +17 -14
- package/dist/examples/llamacpp-dynamic-tools.d.ts +0 -2
- package/dist/examples/llamacpp-dynamic-tools.js +0 -152
- package/dist/models/update-models/codegen.d.ts +0 -3
- package/dist/models/update-models/codegen.js +0 -196
- package/dist/models/update-models/companions.d.ts +0 -30
- package/dist/models/update-models/companions.js +0 -296
- package/dist/models/update-models/history.d.ts +0 -24
- package/dist/models/update-models/history.js +0 -107
- package/dist/models/update-models/index.d.ts +0 -2
- package/dist/models/update-models/index.js +0 -123
- package/dist/models/update-models/naming.d.ts +0 -4
- package/dist/models/update-models/naming.js +0 -396
- package/dist/models/update-models/processing.d.ts +0 -8
- package/dist/models/update-models/processing.js +0 -65
- package/dist/models/update-models/registry.d.ts +0 -5
- package/dist/models/update-models/registry.js +0 -87
- package/dist/models/update-models/shards.d.ts +0 -4
- package/dist/models/update-models/shards.js +0 -57
- package/dist/models/update-models/types.d.ts +0 -88
- package/dist/models/update-models/types.js +0 -1
- package/dist/models/update-models/utils.d.ts +0 -3
- package/dist/models/update-models/utils.js +0 -21
- package/dist/server/bare/plugins/llamacpp-completion/ops/batch-cancelled.d.ts +0 -23
- package/dist/server/bare/plugins/llamacpp-completion/ops/batch-cancelled.js +0 -30
- package/dist/server/utils/expand-gguf-shards.d.ts +0 -3
- package/dist/server/utils/expand-gguf-shards.js +0 -22
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { getAddonFromEngine, resolveCanonicalEngine } from '../../schemas/engine-addon-map.js';
|
|
2
|
-
import { detectShardedModel } from './shards.js';
|
|
3
|
-
export function toHexString(value) {
|
|
4
|
-
if (!value)
|
|
5
|
-
return '';
|
|
6
|
-
if (Buffer.isBuffer(value))
|
|
7
|
-
return value.toString('hex');
|
|
8
|
-
if (typeof value === 'string')
|
|
9
|
-
return value;
|
|
10
|
-
if (typeof value === 'object' && 'data' in value) {
|
|
11
|
-
return Buffer.from(value.data).toString('hex');
|
|
12
|
-
}
|
|
13
|
-
return '';
|
|
14
|
-
}
|
|
15
|
-
export function extractModelName(registryPath) {
|
|
16
|
-
const parts = registryPath.split('/');
|
|
17
|
-
if (parts.length >= 2) {
|
|
18
|
-
return parts[1] || parts[0] || '';
|
|
19
|
-
}
|
|
20
|
-
return (registryPath
|
|
21
|
-
.split('/')
|
|
22
|
-
.pop()
|
|
23
|
-
?.replace(/\.\w+$/, '') || '');
|
|
24
|
-
}
|
|
25
|
-
export function processRegistryModel(model) {
|
|
26
|
-
const engine = resolveCanonicalEngine(model.engine);
|
|
27
|
-
if (!engine) {
|
|
28
|
-
console.warn(`⚠️ Skipping model with unknown engine "${model.engine}": ${model.path}`);
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
const filename = model.path.split('/').pop() || model.path;
|
|
32
|
-
const blobBinding = model.blobBinding;
|
|
33
|
-
const blobCoreKey = toHexString(blobBinding?.coreKey);
|
|
34
|
-
const blobBlockOffset = blobBinding?.blockOffset ?? 0;
|
|
35
|
-
const blobBlockLength = blobBinding?.blockLength ?? 0;
|
|
36
|
-
const blobByteOffset = blobBinding?.byteOffset ?? 0;
|
|
37
|
-
const expectedSize = blobBinding?.byteLength ?? 0;
|
|
38
|
-
// The sha256 lives on blobBinding at runtime (per the hyperschema),
|
|
39
|
-
// even though the TS types define it on QVACModelEntry. Try blobBinding first.
|
|
40
|
-
const sha256Checksum = blobBinding?.['sha256'] || model.sha256 || '';
|
|
41
|
-
const addon = getAddonFromEngine(engine);
|
|
42
|
-
const result = {
|
|
43
|
-
registryPath: model.path,
|
|
44
|
-
registrySource: model.source,
|
|
45
|
-
blobCoreKey,
|
|
46
|
-
blobBlockOffset,
|
|
47
|
-
blobBlockLength,
|
|
48
|
-
blobByteOffset,
|
|
49
|
-
modelId: filename,
|
|
50
|
-
addon,
|
|
51
|
-
expectedSize,
|
|
52
|
-
sha256Checksum,
|
|
53
|
-
engine,
|
|
54
|
-
modelName: extractModelName(model.path),
|
|
55
|
-
quantization: model.quantization || '',
|
|
56
|
-
params: model.params || '',
|
|
57
|
-
tags: model.tags || []
|
|
58
|
-
};
|
|
59
|
-
const shardDetection = detectShardedModel(filename);
|
|
60
|
-
if (shardDetection.isSharded) {
|
|
61
|
-
result.isShardPart = true;
|
|
62
|
-
result.shardInfo = shardDetection;
|
|
63
|
-
}
|
|
64
|
-
return result;
|
|
65
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { CollectOptions, ProcessedModel } from './types.js';
|
|
2
|
-
export { processRegistryModel, extractModelName, toHexString } from './processing.js';
|
|
3
|
-
export declare function collectModels(options?: CollectOptions): Promise<ProcessedModel[]>;
|
|
4
|
-
export declare function deduplicateModels(models: ProcessedModel[], showDuplicates: boolean): ProcessedModel[];
|
|
5
|
-
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { QVACRegistryClient } from '@qvac/registry-client';
|
|
2
|
-
import { groupShardedModels } from './shards.js';
|
|
3
|
-
import { groupCompanionSets } from './companions.js';
|
|
4
|
-
import { processRegistryModel } from './processing.js';
|
|
5
|
-
import { DEFAULT_REGISTRY_CORE_KEY } from '../../constants/index.js';
|
|
6
|
-
// Re-export for backward compat
|
|
7
|
-
export { processRegistryModel, extractModelName, toHexString } from './processing.js';
|
|
8
|
-
export async function collectModels(options = {}) {
|
|
9
|
-
const { showDuplicates = false, noDedup = false } = options;
|
|
10
|
-
const models = [];
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
12
|
-
const registryCoreKey = process.env['QVAC_REGISTRY_CORE_KEY'] ?? DEFAULT_REGISTRY_CORE_KEY;
|
|
13
|
-
const client = new QVACRegistryClient({ registryCoreKey });
|
|
14
|
-
try {
|
|
15
|
-
await client.ready();
|
|
16
|
-
const registryModels = await client.findModels({});
|
|
17
|
-
console.log(`📦 Found ${registryModels.length} entries in registry`);
|
|
18
|
-
for (const registryModel of registryModels) {
|
|
19
|
-
const processed = processRegistryModel(registryModel);
|
|
20
|
-
if (processed)
|
|
21
|
-
models.push(processed);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
finally {
|
|
25
|
-
await client.close();
|
|
26
|
-
}
|
|
27
|
-
const groupedModels = groupShardedModels(models);
|
|
28
|
-
const withCompanions = groupCompanionSets(groupedModels);
|
|
29
|
-
if (noDedup) {
|
|
30
|
-
console.log(`\n⏭️ Skipping deduplication (--no-dedup flag set)`);
|
|
31
|
-
return withCompanions;
|
|
32
|
-
}
|
|
33
|
-
return deduplicateModels(withCompanions, showDuplicates);
|
|
34
|
-
}
|
|
35
|
-
export function deduplicateModels(models, showDuplicates) {
|
|
36
|
-
// Paths referenced as companion files in any companion set. Dropping one of
|
|
37
|
-
// these on sha256 collision would leave its companion set without a
|
|
38
|
-
// standalone RegistryItem that `getModelByPath()` can resolve, causing
|
|
39
|
-
// recursive registry resolutions (e.g. the Bergamot shared vocab) to fall
|
|
40
|
-
// into the metadata-less fallback where `expectedSize` is `0`.
|
|
41
|
-
const companionReferencedPaths = new Set();
|
|
42
|
-
for (const m of models) {
|
|
43
|
-
if (!m.companionSet)
|
|
44
|
-
continue;
|
|
45
|
-
for (const f of m.companionSet.files) {
|
|
46
|
-
companionReferencedPaths.add(`${f.registrySource}:${f.registryPath}`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
const seenChecksums = new Map();
|
|
50
|
-
const dedupedModels = [];
|
|
51
|
-
const skipped = [];
|
|
52
|
-
for (const model of models) {
|
|
53
|
-
if (!model.sha256Checksum || model.sha256Checksum === '') {
|
|
54
|
-
dedupedModels.push(model);
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (seenChecksums.has(model.sha256Checksum)) {
|
|
58
|
-
const pathKey = `${model.registrySource}:${model.registryPath}`;
|
|
59
|
-
if (companionReferencedPaths.has(pathKey)) {
|
|
60
|
-
dedupedModels.push(model);
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
skipped.push({
|
|
64
|
-
name: model.registryPath,
|
|
65
|
-
checksum: model.sha256Checksum,
|
|
66
|
-
reason: `Duplicate of ${seenChecksums.get(model.sha256Checksum)}`
|
|
67
|
-
});
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
seenChecksums.set(model.sha256Checksum, model.registryPath);
|
|
71
|
-
dedupedModels.push(model);
|
|
72
|
-
}
|
|
73
|
-
if (skipped.length > 0) {
|
|
74
|
-
console.log(`\n🧹 Removed ${skipped.length} duplicate model(s)`);
|
|
75
|
-
if (showDuplicates) {
|
|
76
|
-
skipped.forEach(({ name, checksum, reason }) => {
|
|
77
|
-
console.log(` - ${name}`);
|
|
78
|
-
console.log(` Checksum: ${checksum}`);
|
|
79
|
-
console.log(` ${reason}`);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
console.log(` Use --show-duplicates to see details`);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return dedupedModels;
|
|
87
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ProcessedModel, ShardDetection } from './types.js';
|
|
2
|
-
export declare function detectShardedModel(filename: string): ShardDetection;
|
|
3
|
-
export declare function groupShardedModels(models: ProcessedModel[]): ProcessedModel[];
|
|
4
|
-
//# sourceMappingURL=shards.d.ts.map
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
export function detectShardedModel(filename) {
|
|
2
|
-
const shardPattern = /^(.+)-(\d{5})-of-(\d{5})(\.\w+)$/;
|
|
3
|
-
const match = filename.match(shardPattern);
|
|
4
|
-
if (match) {
|
|
5
|
-
return {
|
|
6
|
-
isSharded: true,
|
|
7
|
-
baseFilename: match[1],
|
|
8
|
-
currentShard: parseInt(match[2], 10),
|
|
9
|
-
totalShards: parseInt(match[3], 10),
|
|
10
|
-
extension: match[4]
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
return { isSharded: false };
|
|
14
|
-
}
|
|
15
|
-
export function groupShardedModels(models) {
|
|
16
|
-
const shardGroups = new Map();
|
|
17
|
-
const nonShardedModels = [];
|
|
18
|
-
for (const model of models) {
|
|
19
|
-
if (model.isShardPart && model.shardInfo) {
|
|
20
|
-
const baseKey = `${model.registrySource}:${model.shardInfo.baseFilename}`;
|
|
21
|
-
if (!shardGroups.has(baseKey)) {
|
|
22
|
-
shardGroups.set(baseKey, []);
|
|
23
|
-
}
|
|
24
|
-
shardGroups.get(baseKey).push(model);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
nonShardedModels.push(model);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
const processedShards = [];
|
|
31
|
-
for (const [baseKey, shards] of shardGroups) {
|
|
32
|
-
shards.sort((a, b) => (a.shardInfo?.currentShard ?? 0) - (b.shardInfo?.currentShard ?? 0));
|
|
33
|
-
const firstShard = shards[0];
|
|
34
|
-
const totalExpectedShards = firstShard.shardInfo?.totalShards ?? 0;
|
|
35
|
-
if (shards.length !== totalExpectedShards) {
|
|
36
|
-
console.warn(`⚠️ Expected ${totalExpectedShards} shards but found ${shards.length} for ${baseKey}`);
|
|
37
|
-
}
|
|
38
|
-
const totalSize = shards.reduce((sum, s) => sum + s.expectedSize, 0);
|
|
39
|
-
const shardMetadata = shards.map((s) => ({
|
|
40
|
-
filename: s.modelId,
|
|
41
|
-
expectedSize: s.expectedSize,
|
|
42
|
-
sha256Checksum: s.sha256Checksum,
|
|
43
|
-
blobCoreKey: s.blobCoreKey,
|
|
44
|
-
blobBlockOffset: s.blobBlockOffset,
|
|
45
|
-
blobBlockLength: s.blobBlockLength,
|
|
46
|
-
blobByteOffset: s.blobByteOffset
|
|
47
|
-
}));
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
49
|
-
const { isShardPart: _shard, shardInfo: _info, ...rest } = firstShard;
|
|
50
|
-
processedShards.push({
|
|
51
|
-
...rest,
|
|
52
|
-
expectedSize: totalSize,
|
|
53
|
-
shardMetadata
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
return [...nonShardedModels, ...processedShards];
|
|
57
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import type { ModelRegistryEntryAddon, ModelRegistryEngine } from '../../schemas/registry.js';
|
|
2
|
-
export interface ShardInfo {
|
|
3
|
-
isSharded: true;
|
|
4
|
-
baseFilename: string;
|
|
5
|
-
currentShard: number;
|
|
6
|
-
totalShards: number;
|
|
7
|
-
extension: string;
|
|
8
|
-
}
|
|
9
|
-
export interface NotSharded {
|
|
10
|
-
isSharded: false;
|
|
11
|
-
}
|
|
12
|
-
export type ShardDetection = ShardInfo | NotSharded;
|
|
13
|
-
export interface BlobRef {
|
|
14
|
-
expectedSize: number;
|
|
15
|
-
sha256Checksum: string;
|
|
16
|
-
blobCoreKey: string;
|
|
17
|
-
blobBlockOffset: number;
|
|
18
|
-
blobBlockLength: number;
|
|
19
|
-
blobByteOffset: number;
|
|
20
|
-
}
|
|
21
|
-
export interface ShardMetadataEntry extends BlobRef {
|
|
22
|
-
filename: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* A single file within a companion set (e.g., an `.onnx` model or its `_data` file).
|
|
26
|
-
*
|
|
27
|
-
* @property key - Identifier for this file within the set
|
|
28
|
-
* Used by plugins to look up resolved paths from the download artifacts.
|
|
29
|
-
* @property targetName - Filename used when writing to the cache directory.
|
|
30
|
-
* @property primary - When true, this is the main file whose resolved path is returned to
|
|
31
|
-
* the addon. Exactly one file per set should be primary.
|
|
32
|
-
*/
|
|
33
|
-
export interface CompanionSetMetadataEntry extends BlobRef {
|
|
34
|
-
key: string;
|
|
35
|
-
registryPath: string;
|
|
36
|
-
registrySource: string;
|
|
37
|
-
targetName: string;
|
|
38
|
-
primary?: boolean;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Describes a group of files that must be downloaded and cached together
|
|
42
|
-
*
|
|
43
|
-
* @property setKey - Deterministic hash identifying this set. Used as the cache
|
|
44
|
-
* subdirectory: `<cacheDir>/sets/<setKey>/`.
|
|
45
|
-
* @property primaryKey - The `key` value of the primary file in the `files` array.
|
|
46
|
-
* The resolver returns this file's path to the addon after download.
|
|
47
|
-
* @property files - All files in the set, including the primary.
|
|
48
|
-
*/
|
|
49
|
-
export interface CompanionSetMetadata {
|
|
50
|
-
setKey: string;
|
|
51
|
-
primaryKey: string;
|
|
52
|
-
files: readonly CompanionSetMetadataEntry[];
|
|
53
|
-
}
|
|
54
|
-
export interface ProcessedModel extends BlobRef {
|
|
55
|
-
registryPath: string;
|
|
56
|
-
registrySource: string;
|
|
57
|
-
modelId: string;
|
|
58
|
-
addon: ModelRegistryEntryAddon;
|
|
59
|
-
engine: ModelRegistryEngine;
|
|
60
|
-
modelName: string;
|
|
61
|
-
quantization: string;
|
|
62
|
-
params: string;
|
|
63
|
-
tags: string[];
|
|
64
|
-
isShardPart?: boolean;
|
|
65
|
-
shardInfo?: ShardInfo;
|
|
66
|
-
shardMetadata?: ShardMetadataEntry[];
|
|
67
|
-
companionSet?: CompanionSetMetadata;
|
|
68
|
-
isCompanionOnly?: boolean;
|
|
69
|
-
name?: string;
|
|
70
|
-
}
|
|
71
|
-
export interface CurrentModel {
|
|
72
|
-
name: string;
|
|
73
|
-
registryPath: string;
|
|
74
|
-
}
|
|
75
|
-
export interface CollectOptions {
|
|
76
|
-
showDuplicates?: boolean;
|
|
77
|
-
noDedup?: boolean;
|
|
78
|
-
}
|
|
79
|
-
export interface ExportNameInput {
|
|
80
|
-
path: string;
|
|
81
|
-
engine: ModelRegistryEngine;
|
|
82
|
-
name: string;
|
|
83
|
-
quantization: string;
|
|
84
|
-
params: string;
|
|
85
|
-
tags: string[];
|
|
86
|
-
usedNames: Set<string>;
|
|
87
|
-
}
|
|
88
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { execSync } from 'child_process';
|
|
2
|
-
export function formatSize(bytes) {
|
|
3
|
-
if (bytes < 1024)
|
|
4
|
-
return `${bytes}B`;
|
|
5
|
-
if (bytes < 1024 * 1024)
|
|
6
|
-
return `${(bytes / 1024).toFixed(1)}KB`;
|
|
7
|
-
if (bytes < 1024 * 1024 * 1024)
|
|
8
|
-
return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
|
|
9
|
-
return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)}GB`;
|
|
10
|
-
}
|
|
11
|
-
export function getCommitHash(short = false) {
|
|
12
|
-
try {
|
|
13
|
-
const cmd = short ? 'git rev-parse --short HEAD' : 'git rev-parse HEAD';
|
|
14
|
-
return execSync(cmd, { encoding: 'utf-8' }).trim();
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
throw new Error('Git is required to generate history file', {
|
|
18
|
-
cause: error
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Helper for detecting the llama.cpp addon's `Cancelled` status error
|
|
3
|
-
* (`LlmErrors.hpp::Cancelled = 27`) on the continuous-batching path.
|
|
4
|
-
*
|
|
5
|
-
* When a batch is cancelled while it still has prompts queued behind the
|
|
6
|
-
* `parallel` slot limit, `ContinuousBatchScheduler::cancelPendingLocked`
|
|
7
|
-
* fails the whole batch group with a `Cancelled` `StatusError`, which
|
|
8
|
-
* `processBatch` rethrows — so `model.run(prompts)` rejects rather than
|
|
9
|
-
* resolving with partial outputs (see
|
|
10
|
-
* `packages/llm-llamacpp/docs/continuous-batching.md` "Cancellation
|
|
11
|
-
* semantics"). In-flight slots are still cancelled gracefully, but the
|
|
12
|
-
* shared group carries the error.
|
|
13
|
-
*
|
|
14
|
-
* The addon's JS-facing throw goes through `js_throw_error(env, code,
|
|
15
|
-
* msg)` (see `JsUtils.hpp::JSCATCH`) where `code` comes from
|
|
16
|
-
* `qvac_errors::StatusError::codeString()` and formats as
|
|
17
|
-
* `"[ <addonId> :: Cancelled ]"`. This helper lets the batch handler
|
|
18
|
-
* recognise that rejection so it can complete the run with cancelled
|
|
19
|
-
* terminal events (matching the SDK's graceful cancel semantics) instead
|
|
20
|
-
* of surfacing a generic `CompletionFailedError`.
|
|
21
|
-
*/
|
|
22
|
-
export declare function isAddonCancelledError(err: unknown): boolean;
|
|
23
|
-
//# sourceMappingURL=batch-cancelled.d.ts.map
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Helper for detecting the llama.cpp addon's `Cancelled` status error
|
|
3
|
-
* (`LlmErrors.hpp::Cancelled = 27`) on the continuous-batching path.
|
|
4
|
-
*
|
|
5
|
-
* When a batch is cancelled while it still has prompts queued behind the
|
|
6
|
-
* `parallel` slot limit, `ContinuousBatchScheduler::cancelPendingLocked`
|
|
7
|
-
* fails the whole batch group with a `Cancelled` `StatusError`, which
|
|
8
|
-
* `processBatch` rethrows — so `model.run(prompts)` rejects rather than
|
|
9
|
-
* resolving with partial outputs (see
|
|
10
|
-
* `packages/llm-llamacpp/docs/continuous-batching.md` "Cancellation
|
|
11
|
-
* semantics"). In-flight slots are still cancelled gracefully, but the
|
|
12
|
-
* shared group carries the error.
|
|
13
|
-
*
|
|
14
|
-
* The addon's JS-facing throw goes through `js_throw_error(env, code,
|
|
15
|
-
* msg)` (see `JsUtils.hpp::JSCATCH`) where `code` comes from
|
|
16
|
-
* `qvac_errors::StatusError::codeString()` and formats as
|
|
17
|
-
* `"[ <addonId> :: Cancelled ]"`. This helper lets the batch handler
|
|
18
|
-
* recognise that rejection so it can complete the run with cancelled
|
|
19
|
-
* terminal events (matching the SDK's graceful cancel semantics) instead
|
|
20
|
-
* of surfacing a generic `CompletionFailedError`.
|
|
21
|
-
*/
|
|
22
|
-
export function isAddonCancelledError(err) {
|
|
23
|
-
if (typeof err !== 'object' || err === null)
|
|
24
|
-
return false;
|
|
25
|
-
const code = err.code;
|
|
26
|
-
// Anchor to the codeString tail (`[ <addonId> :: Cancelled ]`) so a
|
|
27
|
-
// hypothetical sibling like `CancelledByPolicy` after an addon-side
|
|
28
|
-
// rename doesn't false-positive here.
|
|
29
|
-
return typeof code === 'string' && /::\s*Cancelled\s*\]/.test(code);
|
|
30
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const SHARD_PATTERN = /^(.+)-(\d{5})-of-(\d{5})\.gguf$/;
|
|
2
|
-
/** Expand a sharded GGUF path into `.tensors.txt` plus all shards. */
|
|
3
|
-
export function expandGGUFIntoShards(modelPath) {
|
|
4
|
-
const lastSep = Math.max(modelPath.lastIndexOf('/'), modelPath.lastIndexOf('\\'));
|
|
5
|
-
const dir = lastSep >= 0 ? modelPath.slice(0, lastSep) : '';
|
|
6
|
-
const sep = lastSep >= 0 ? modelPath.charAt(lastSep) : '/';
|
|
7
|
-
const filename = lastSep >= 0 ? modelPath.slice(lastSep + 1) : modelPath;
|
|
8
|
-
const match = filename.match(SHARD_PATTERN);
|
|
9
|
-
if (!match || !match[1] || !match[3])
|
|
10
|
-
return [modelPath];
|
|
11
|
-
const baseFilename = match[1];
|
|
12
|
-
const totalDigits = match[3];
|
|
13
|
-
const totalShards = Number.parseInt(totalDigits, 10);
|
|
14
|
-
if (totalShards <= 0)
|
|
15
|
-
return [modelPath];
|
|
16
|
-
const join = (name) => (dir ? `${dir}${sep}${name}` : name);
|
|
17
|
-
const shards = [join(`${baseFilename}.tensors.txt`)];
|
|
18
|
-
for (let i = 1; i <= totalShards; i++) {
|
|
19
|
-
shards.push(join(`${baseFilename}-${String(i).padStart(5, '0')}-of-${totalDigits}.gguf`));
|
|
20
|
-
}
|
|
21
|
-
return shards;
|
|
22
|
-
}
|