@flaxia/node 0.6.1 → 0.7.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/README.md +2 -0
- package/dist/assets/ai-inference.js +83 -183
- package/dist/assets/ai-model-registry.js +127 -0
- package/dist/assets/cc-extract.js +5166 -0
- package/dist/assets/container.js +59 -43
- package/dist/assets/decision.js +149 -0
- package/dist/assets/embed-gemma.js +105 -0
- package/dist/assets/image-process.js +78 -70
- package/dist/assets/nudenet.js +2 -2
- package/dist/assets/{VectorStoreEngine.js → sharedEngine.js} +67 -41
- package/dist/assets/transformers.web.js +2 -2
- package/dist/assets/vector-embed.js +148 -25
- package/dist/assets/vector-query.js +4 -4
- package/dist/assets/vector-store.js +4 -4
- package/dist/assets/webgpuProbe.js +127 -70
- package/dist/client/SignalingClient.d.ts.map +1 -1
- package/dist/client/light-preloader.d.ts +14 -1
- package/dist/client/light-preloader.d.ts.map +1 -1
- package/dist/consent/notice.d.ts +3 -1
- package/dist/consent/notice.d.ts.map +1 -1
- package/dist/executor/WorkerPool.d.ts +7 -0
- package/dist/executor/WorkerPool.d.ts.map +1 -1
- package/dist/executor/__tests__/resultLimits.test.d.ts +2 -0
- package/dist/executor/__tests__/resultLimits.test.d.ts.map +1 -0
- package/dist/executor/container-executor.d.ts +15 -0
- package/dist/executor/container-executor.d.ts.map +1 -1
- package/dist/executor/memoryProbe.d.ts +25 -1
- package/dist/executor/memoryProbe.d.ts.map +1 -1
- package/dist/executor/resultLimits.d.ts +19 -0
- package/dist/executor/resultLimits.d.ts.map +1 -0
- package/dist/index.js +357 -326
- package/dist/vector-store/HNSWIndex.d.ts +4 -1
- package/dist/vector-store/HNSWIndex.d.ts.map +1 -1
- package/dist/vector-store/VectorStoreEngine.d.ts +7 -1
- package/dist/vector-store/VectorStoreEngine.d.ts.map +1 -1
- package/dist/vector-store/__tests__/sharedEngine.test.d.ts +2 -0
- package/dist/vector-store/__tests__/sharedEngine.test.d.ts.map +1 -0
- package/dist/vector-store/sharedEngine.d.ts +13 -0
- package/dist/vector-store/sharedEngine.d.ts.map +1 -0
- package/dist/worker.js +187 -175
- package/dist/workloads/__tests__/cc-extract.test.d.ts +2 -0
- package/dist/workloads/__tests__/cc-extract.test.d.ts.map +1 -0
- package/dist/workloads/__tests__/decision.test.d.ts +2 -0
- package/dist/workloads/__tests__/decision.test.d.ts.map +1 -0
- package/dist/workloads/__tests__/embed-gemma.test.d.ts +2 -0
- package/dist/workloads/__tests__/embed-gemma.test.d.ts.map +1 -0
- package/dist/workloads/__tests__/nudenet-session-cache.test.d.ts +2 -0
- package/dist/workloads/__tests__/nudenet-session-cache.test.d.ts.map +1 -0
- package/dist/workloads/__tests__/wasm-threads.test.d.ts.map +1 -1
- package/dist/workloads/ai-inference.d.ts +21 -2
- package/dist/workloads/ai-inference.d.ts.map +1 -1
- package/dist/workloads/ai-model-registry.d.ts.map +1 -1
- package/dist/workloads/cc-extract.d.ts +11 -0
- package/dist/workloads/cc-extract.d.ts.map +1 -0
- package/dist/workloads/decision.d.ts +23 -0
- package/dist/workloads/decision.d.ts.map +1 -0
- package/dist/workloads/embed-gemma.d.ts +8 -0
- package/dist/workloads/embed-gemma.d.ts.map +1 -0
- package/dist/workloads/image-process.d.ts +8 -0
- package/dist/workloads/image-process.d.ts.map +1 -1
- package/dist/workloads/nudenet.d.ts.map +1 -1
- package/dist/workloads/vector-embed.d.ts +16 -0
- package/dist/workloads/vector-embed.d.ts.map +1 -1
- package/dist/workloads/vector-query.d.ts.map +1 -1
- package/dist/workloads/vector-store.d.ts.map +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cc-extract.test.d.ts","sourceRoot":"","sources":["../../../src/workloads/__tests__/cc-extract.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision.test.d.ts","sourceRoot":"","sources":["../../../src/workloads/__tests__/decision.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed-gemma.test.d.ts","sourceRoot":"","sources":["../../../src/workloads/__tests__/embed-gemma.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nudenet-session-cache.test.d.ts","sourceRoot":"","sources":["../../../src/workloads/__tests__/nudenet-session-cache.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasm-threads.test.d.ts","sourceRoot":"","sources":["../../../src/workloads/__tests__/wasm-threads.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wasm-threads.test.d.ts","sourceRoot":"","sources":["../../../src/workloads/__tests__/wasm-threads.test.ts"],"names":[],"mappings":"AAkCA,OAAO,iBAAiB,CAAC"}
|
|
@@ -1,15 +1,34 @@
|
|
|
1
1
|
import type { AiInferencePayload, AiInferenceResult } from '@flaxia/sdk';
|
|
2
|
-
import type { NodeModelCacheSnapshot } from '@flaxia/sdk';
|
|
2
|
+
import type { ModelCacheBackend, NodeModelCacheSnapshot } from '@flaxia/sdk';
|
|
3
3
|
export { DEFAULT_AI_MODEL_MAX_BYTES, MAX_AI_MODEL_MAX_BYTES, MAX_AI_INPUT_CHARS, MAX_AI_INPUT_ITEMS, ALLOWED_AI_DEVICES, ALLOWED_AI_DTYPES, listAiModels, registerAiModels, unregisterAiModel, type AiModelDefinition, } from './ai-model-registry';
|
|
4
4
|
/** Bound work queued behind TextStreamer's synchronous callback API. */
|
|
5
5
|
export declare const MAX_PENDING_TOKEN_CALLBACKS = 64;
|
|
6
6
|
export declare const MAX_PENDING_TOKEN_CHARS: number;
|
|
7
|
+
/**
|
|
8
|
+
* Full cache identity for one model pipeline. The executable cache is keyed
|
|
9
|
+
* by `task/modelId/revision/dtype/backend` (see `modelPipelineKey`), but the
|
|
10
|
+
* snapshot descriptor carries everything except `task`. Checking only
|
|
11
|
+
* `modelId` lets an `ondeviceOnly` task for the same repo with a different
|
|
12
|
+
* `dtype`/`backend` pass the gate and then miss the cache, downloading a
|
|
13
|
+
* second quantization despite the caller forbidding downloads.
|
|
14
|
+
*/
|
|
15
|
+
export interface AiModelCacheIdentity {
|
|
16
|
+
modelId: string;
|
|
17
|
+
revision: string;
|
|
18
|
+
dtype: string;
|
|
19
|
+
backend: ModelCacheBackend;
|
|
20
|
+
}
|
|
7
21
|
/**
|
|
8
22
|
* Whether the model already has a `ready` executable pipeline in memory.
|
|
9
23
|
* Guards `ondeviceOnly` tasks: they must fail before any download when the
|
|
10
24
|
* model is absent, so the check runs on the snapshot (no side effects).
|
|
25
|
+
*
|
|
26
|
+
* The string form is a model-only check kept for the public
|
|
27
|
+
* `FlaxiaNodeController.isAiModelPreloaded(model)` API and the Light
|
|
28
|
+
* Preloader dedup. The `ondeviceOnly` gate must use the identity form so a
|
|
29
|
+
* different `dtype`/`backend`/`revision` does not pass.
|
|
11
30
|
*/
|
|
12
|
-
export declare const isAiModelPreloaded: (model: string) => boolean;
|
|
31
|
+
export declare const isAiModelPreloaded: (model: string | AiModelCacheIdentity) => boolean;
|
|
13
32
|
/** Model preloaded by the Light Inference idle preloader (small enough for WASM). */
|
|
14
33
|
export declare const LIGHT_INFERENCE_TRANSLATE_MODEL = "Xenova/m2m100_418M";
|
|
15
34
|
export declare const LIGHT_INFERENCE_TRANSLATE_TASK = "translation";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-inference.d.ts","sourceRoot":"","sources":["../../src/workloads/ai-inference.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAsB,MAAM,aAAa,CAAC;AAC7F,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ai-inference.d.ts","sourceRoot":"","sources":["../../src/workloads/ai-inference.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAsB,MAAM,aAAa,CAA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GAAU,SAAS;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,KAAG,OAAO,CAAC,IAAI,CA6Bf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-model-registry.d.ts","sourceRoot":"","sources":["../../src/workloads/ai-model-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,iBAAiB;IAChC,0FAA0F;IAC1F,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B,QAAoB,CAAC;AAC5D,kDAAkD;AAClD,eAAO,MAAM,sBAAsB,QAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ai-model-registry.d.ts","sourceRoot":"","sources":["../../src/workloads/ai-model-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,iBAAiB;IAChC,0FAA0F;IAC1F,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B,QAAoB,CAAC;AAC5D,kDAAkD;AAClD,eAAO,MAAM,sBAAsB,QAAgB,CAAC;AAgEpD,sEAAsE;AACtE,eAAO,MAAM,kBAAkB,oCAAqC,CAAC;AACrE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MA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|
+
export declare const MAX_CC_WARC_DECOMPRESSED_BYTES: number;
|
|
4
|
+
/** Hard ceiling for the HTTP response body inside a WARC record. */
|
|
5
|
+
export declare const MAX_CC_HTTP_BODY_BYTES: number;
|
|
6
|
+
/** Per-record network timeout. The whole task is also bounded by the payload. */
|
|
7
|
+
export declare const CC_RECORD_TIMEOUT_MS = 20000;
|
|
8
|
+
/** Identifies Flaxia Crowd to Common Crawl's data host. */
|
|
9
|
+
export declare const CC_USER_AGENT = "FlaxiaCrowd/0.7 (+https://flaxia.app/crowd)";
|
|
10
|
+
export declare function handleCcExtract(payload: CcExtractPayload, allowedOrigins?: readonly string[]): Promise<CcExtractResult>;
|
|
11
|
+
//# sourceMappingURL=cc-extract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cc-extract.d.ts","sourceRoot":"","sources":["../../src/workloads/cc-extract.ts"],"names":[],"mappings":"AACA,OAAO,EAaL,KAAK,gBAAgB,EAErB,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB,kEAAkE;AAClE,eAAO,MAAM,8BAA8B,QAAkB,CAAC;AAC9D,oEAAoE;AACpE,eAAO,MAAM,sBAAsB,QAAkB,CAAC;AACtD,iFAAiF;AACjF,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAC3C,2DAA2D;AAC3D,eAAO,MAAM,aAAa,gDAAgD,CAAC;AA2c3E,wBAAsB,eAAe,CACnC,OAAO,EAAE,gBAAgB,EACzB,cAAc,GAAE,SAAS,MAAM,EAAO,GACrC,OAAO,CAAC,eAAe,CAAC,CAwE1B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AiInferencePayload, AiInferenceResult, DecisionAnswer } from '@flaxia/sdk';
|
|
2
|
+
/** d1-omni audio contract: 16kHz mono, one clip per call. */
|
|
3
|
+
export declare const DECISION_AUDIO_SAMPLE_RATE = 16000;
|
|
4
|
+
export declare const DECISION_AUDIO_MAX_SECONDS = 30;
|
|
5
|
+
/** Question/option bounds: keep one forward pass cheap and answers stable. */
|
|
6
|
+
export declare const DECISION_MAX_QUESTIONS = 8;
|
|
7
|
+
export declare const DECISION_MAX_OPTIONS = 64;
|
|
8
|
+
export declare const DECISION_MAX_STATE_CHARS = 20000;
|
|
9
|
+
export declare const DECISION_MAX_MEDIA_URLS = 8;
|
|
10
|
+
/** Per-file media caps (compressed bytes). */
|
|
11
|
+
export declare const MAX_DECISION_IMAGE_BYTES: number;
|
|
12
|
+
export declare const MAX_DECISION_AUDIO_BYTES: number;
|
|
13
|
+
/** Bound decoded pixels per image before the model sees it (RGBA ~4 bytes/pixel). */
|
|
14
|
+
export declare const MAX_DECISION_IMAGE_PIXELS: number;
|
|
15
|
+
export declare const releaseCache: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Normalise a single d1-omni answer into the SDK `DecisionAnswer` shape.
|
|
18
|
+
* The model's per-question payload is trusted as-is except for the generic
|
|
19
|
+
* {type}-discriminated fields; probabilities are passed through verbatim.
|
|
20
|
+
*/
|
|
21
|
+
export declare function normalizeDecisionAnswer(raw: any): DecisionAnswer;
|
|
22
|
+
export declare function handleDecision(payload: AiInferencePayload): Promise<AiInferenceResult>;
|
|
23
|
+
//# sourceMappingURL=decision.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision.d.ts","sourceRoot":"","sources":["../../src/workloads/decision.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EAEf,MAAM,aAAa,CAAC;AAoBrB,6DAA6D;AAC7D,eAAO,MAAM,0BAA0B,QAAS,CAAC;AACjD,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAG7C,8EAA8E;AAC9E,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAC/C,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,8CAA8C;AAC9C,eAAO,MAAM,wBAAwB,QAAkB,CAAC;AACxD,eAAO,MAAM,wBAAwB,QAAkB,CAAC;AACxD,qFAAqF;AACrF,eAAO,MAAM,yBAAyB,QAAmB,CAAC;AAO1D,eAAO,MAAM,YAAY,QAAO,IAU/B,CAAC;AA2HF;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,GAAG,GAAG,cAAc,CA0BhE;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA6F5F"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type EmbedGemmaPayload, type EmbedGemmaResult } from '@flaxia/sdk';
|
|
2
|
+
/** Texts passed to one model call. Four ~500-token texts stay under the 2,700-token WebGPU dispatch limit. */
|
|
3
|
+
export declare const EMBED_GEMMA_BATCH_SIZE = 4;
|
|
4
|
+
export declare const releaseCache: () => void;
|
|
5
|
+
export declare function handleEmbedGemma(payload: EmbedGemmaPayload,
|
|
6
|
+
/** Called between model calls so the worker can hold its CPU duty cycle. */
|
|
7
|
+
onBatch?: () => void | Promise<void>): Promise<EmbedGemmaResult>;
|
|
8
|
+
//# sourceMappingURL=embed-gemma.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed-gemma.d.ts","sourceRoot":"","sources":["../../src/workloads/embed-gemma.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,aAAa,CAAC;AAGrB,8GAA8G;AAC9G,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAWxC,eAAO,MAAM,YAAY,QAAO,IAU/B,CAAC;AA0IF,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,iBAAiB;AAC1B,4EAA4E;AAC5E,OAAO,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GACnC,OAAO,CAAC,gBAAgB,CAAC,CAkB3B"}
|
|
@@ -11,6 +11,14 @@ export declare const MAX_CANVAS_SIDE = 8192;
|
|
|
11
11
|
export declare const MAX_CANVAS_PIXELS: number;
|
|
12
12
|
/** Maximum encoded input before data-URL decoding or image bitmap allocation. */
|
|
13
13
|
export declare const MAX_IMAGE_PROCESS_INPUT_BYTES: number;
|
|
14
|
+
/**
|
|
15
|
+
* Maximum encoded output. A lossless PNG of a 32 M-pixel canvas can exceed
|
|
16
|
+
* 100 MB, which is enough to OOM a 4 GB phone when the result is cloned to the
|
|
17
|
+
* main thread and JSON-serialized for the orchestrator.
|
|
18
|
+
*/
|
|
19
|
+
export declare const MAX_IMAGE_PROCESS_OUTPUT_BYTES: number;
|
|
20
|
+
/** Encoders the payload may select; `png` is lossless and can be huge. */
|
|
21
|
+
export declare const ALLOWED_IMAGE_OUTPUT_FORMATS: readonly ["png", "jpeg", "webp"];
|
|
14
22
|
/**
|
|
15
23
|
* Resolve the output canvas size: validate the requested size against the hard
|
|
16
24
|
* caps, then clamp it to the source bitmap so a payload can never upscale (and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-process.d.ts","sourceRoot":"","sources":["../../src/workloads/image-process.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE3E;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,OAAO,CAAC;AACpC,eAAO,MAAM,iBAAiB,QAAmB,CAAC;AAClD,iFAAiF;AACjF,eAAO,MAAM,6BAA6B,QAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"image-process.d.ts","sourceRoot":"","sources":["../../src/workloads/image-process.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE3E;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,OAAO,CAAC;AACpC,eAAO,MAAM,iBAAiB,QAAmB,CAAC;AAClD,iFAAiF;AACjF,eAAO,MAAM,6BAA6B,QAAmB,CAAC;AAC9D;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,QAAkB,CAAC;AAC9D,0EAA0E;AAC1E,eAAO,MAAM,4BAA4B,kCAAmC,CAAC;AAkI7E;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,EAChD,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAenC;AAED,eAAO,MAAM,kBAAkB,GAAU,SAAS,mBAAmB,KAAG,OAAO,CAAC,kBAAkB,CA+EjG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nudenet.d.ts","sourceRoot":"","sources":["../../src/workloads/nudenet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAUnF,sDAAsD;AACtD,eAAO,MAAM,uBAAuB,QAAmB,CAAC;AACxD,2FAA2F;AAC3F,eAAO,MAAM,wBAAwB,QAAmB,CAAC;AACzD,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAC3C,eAAO,MAAM,uBAAuB,QAAoB,CAAC;AACzD,gEAAgE;AAChE,eAAO,MAAM,2BAA2B,kDAAmD,CAAC;AA+B5F,wBAAgB,YAAY,IAAI,IAAI,CAUnC;
|
|
1
|
+
{"version":3,"file":"nudenet.d.ts","sourceRoot":"","sources":["../../src/workloads/nudenet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAUnF,sDAAsD;AACtD,eAAO,MAAM,uBAAuB,QAAmB,CAAC;AACxD,2FAA2F;AAC3F,eAAO,MAAM,wBAAwB,QAAmB,CAAC;AACzD,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAC3C,eAAO,MAAM,uBAAuB,QAAoB,CAAC;AACzD,gEAAgE;AAChE,eAAO,MAAM,2BAA2B,kDAAmD,CAAC;AA+B5F,wBAAgB,YAAY,IAAI,IAAI,CAUnC;AAwLD,eAAO,MAAM,aAAa,GAAU,SAAS,cAAc,KAAG,OAAO,CAAC,aAAa,CAsClF,CAAC;AAEF,wBAAgB,YAAY,IAAI,IAAI,CAYnC"}
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import type { VectorEmbedPayload, VectorEmbedResult } from '@flaxia/sdk';
|
|
2
|
+
/** Per-file media caps (compressed bytes). */
|
|
3
|
+
export declare const MAX_VECTOR_EMBED_IMAGE_BYTES: number;
|
|
4
|
+
export declare const MAX_VECTOR_EMBED_AUDIO_BYTES: number;
|
|
5
|
+
export declare const MAX_VECTOR_EMBED_VIDEO_BYTES: number;
|
|
6
|
+
/** Bound decoded pixels per image (RGBA ~4 bytes/pixel). */
|
|
7
|
+
export declare const MAX_VECTOR_EMBED_IMAGE_PIXELS: number;
|
|
8
|
+
/** Bound decoded audio samples (30 s at 16 kHz). */
|
|
9
|
+
export declare const MAX_VECTOR_EMBED_AUDIO_SAMPLES: number;
|
|
10
|
+
/** Maximum frames sampled from a video, so the decoder never materializes a long clip. */
|
|
11
|
+
export declare const MAX_VECTOR_EMBED_VIDEO_FRAMES = 16;
|
|
2
12
|
export declare const releaseCache: () => void;
|
|
13
|
+
/** Append `<|image|>` / `<|video|>` / `<|audio|>` placeholders for any media whose placeholder is missing. */
|
|
14
|
+
export declare function buildInterleavedText(text: string, counts: {
|
|
15
|
+
images: number;
|
|
16
|
+
videos: number;
|
|
17
|
+
audio: number;
|
|
18
|
+
}): string;
|
|
3
19
|
export declare function handleVectorEmbed(payload: VectorEmbedPayload): Promise<VectorEmbedResult>;
|
|
4
20
|
//# sourceMappingURL=vector-embed.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-embed.d.ts","sourceRoot":"","sources":["../../src/workloads/vector-embed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"vector-embed.d.ts","sourceRoot":"","sources":["../../src/workloads/vector-embed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AA0BzE,8CAA8C;AAC9C,eAAO,MAAM,4BAA4B,QAAkB,CAAC;AAC5D,eAAO,MAAM,4BAA4B,QAAmB,CAAC;AAC7D,eAAO,MAAM,4BAA4B,QAAmB,CAAC;AAC7D,4DAA4D;AAC5D,eAAO,MAAM,6BAA6B,QAAmB,CAAC;AAC9D,oDAAoD;AACpD,eAAO,MAAM,8BAA8B,QAAmC,CAAC;AAC/E,0FAA0F;AAC1F,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAchD,eAAO,MAAM,YAAY,QAAO,IAW/B,CAAC;AAmGF,8GAA8G;AAC9G,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACxD,MAAM,CAOR;AA4ED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAiD/F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-query.d.ts","sourceRoot":"","sources":["../../src/workloads/vector-query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"vector-query.d.ts","sourceRoot":"","sources":["../../src/workloads/vector-query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAIzE,eAAO,MAAM,YAAY,QAAO,IAE/B,CAAC;AAMF,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAW/F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-store.d.ts","sourceRoot":"","sources":["../../src/workloads/vector-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"vector-store.d.ts","sourceRoot":"","sources":["../../src/workloads/vector-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAIzE,eAAO,MAAM,YAAY,QAAO,IAE/B,CAAC;AAMF,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAW/F;AAED,wBAAsB,4BAA4B,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGtG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flaxia/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -22,9 +22,10 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@bjorn3/browser_wasi_shim": "^0.4.2",
|
|
25
|
-
"@flaxia/sdk": "^0.
|
|
26
|
-
"@huggingface/transformers": "^4.2
|
|
25
|
+
"@flaxia/sdk": "^0.7.1",
|
|
26
|
+
"@huggingface/transformers": "^4.3.2",
|
|
27
27
|
"onnxruntime-web": "1.26.0",
|
|
28
|
+
"parse5": "^8.1.0",
|
|
28
29
|
"rollup": "^4.61.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|