@camstack/types 1.2.34 → 1.2.35
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/addon.js +3 -2
- package/dist/addon.mjs +3 -2
- package/dist/capabilities/index.d.ts +14 -11
- package/dist/capabilities/vector-store.cap.d.ts +223 -0
- package/dist/generated/addon-api.d.ts +54 -4
- package/dist/generated/cap-input-defaults.d.ts +1 -1
- package/dist/generated/capability-router-map.d.ts +5 -2
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/index.d.ts +166 -165
- package/dist/index.js +25622 -25360
- package/dist/index.mjs +25604 -25361
- package/dist/{sleep-NRXhq0dh.mjs → sleep-BeLSE-Rr.mjs} +517 -517
- package/dist/utils/vector-codec.d.ts +28 -0
- package/package.json +1 -1
- package/dist/{sleep-CJ-cpJTN.js → sleep-C6W2qcHX.js} +516 -516
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vector wire codec — base64 of little-endian Float32.
|
|
3
|
+
*
|
|
4
|
+
* The `vector-store` capability carries vectors as base64 rather than
|
|
5
|
+
* `number[]` or a typed array, and both rejected alternatives have a scar here:
|
|
6
|
+
*
|
|
7
|
+
* - a `Float32Array` does NOT survive msgpack across the UDS transport (it
|
|
8
|
+
* arrived as an empty object and froze audio dBFS until the payload was
|
|
9
|
+
* changed to carry bytes);
|
|
10
|
+
* - `number[]` is the ~5x-larger encoding the capability exists to stop paying
|
|
11
|
+
* — a 512-dim vector is 2,048 bytes raw and 2,732 as base64, against roughly
|
|
12
|
+
* 10-12 KB rendered as JSON text.
|
|
13
|
+
*
|
|
14
|
+
* Endianness is pinned to little-endian explicitly instead of inheriting the
|
|
15
|
+
* platform's, so a vector written on one node decodes correctly on another.
|
|
16
|
+
*/
|
|
17
|
+
/** Encode a vector as base64 of little-endian Float32. */
|
|
18
|
+
export declare function encodeVectorBase64(vector: Float32Array | readonly number[]): string;
|
|
19
|
+
/**
|
|
20
|
+
* Decode base64 little-endian Float32 back into a vector.
|
|
21
|
+
*
|
|
22
|
+
* Throws on a byte length that is not a multiple of 4 — a truncated vector
|
|
23
|
+
* would otherwise silently rank against a shorter one and produce a plausible
|
|
24
|
+
* score, which is worse than an error.
|
|
25
|
+
*/
|
|
26
|
+
export declare function decodeVectorBase64(encoded: string): Float32Array;
|
|
27
|
+
/** Vector length implied by a base64 payload, without decoding it. */
|
|
28
|
+
export declare function vectorDimFromBase64(encoded: string): number;
|