@flaxia/node 0.3.7 → 0.5.0

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 (93) hide show
  1. package/README.md +43 -19
  2. package/dist/__tests__/consent-policy.test.d.ts +2 -0
  3. package/dist/__tests__/consent-policy.test.d.ts.map +1 -0
  4. package/dist/assets/VectorStoreEngine.js +140 -85
  5. package/dist/assets/ai-inference.js +173 -33
  6. package/dist/assets/container.js +368 -260
  7. package/dist/assets/dist.js +209 -0
  8. package/dist/assets/egress-guard.js +174 -0
  9. package/dist/assets/image-process.js +184 -19
  10. package/dist/assets/nudenet.js +2 -2
  11. package/dist/client/SignalingClient.d.ts +6 -0
  12. package/dist/client/SignalingClient.d.ts.map +1 -1
  13. package/dist/consent/ConsentUI.d.ts +44 -5
  14. package/dist/consent/ConsentUI.d.ts.map +1 -1
  15. package/dist/consent/notice.d.ts +29 -0
  16. package/dist/consent/notice.d.ts.map +1 -0
  17. package/dist/consent/storage.d.ts +91 -7
  18. package/dist/consent/storage.d.ts.map +1 -1
  19. package/dist/executor/WorkerPool.d.ts +35 -1
  20. package/dist/executor/WorkerPool.d.ts.map +1 -1
  21. package/dist/executor/__tests__/WorkerPool.swarm.test.d.ts +13 -0
  22. package/dist/executor/__tests__/WorkerPool.swarm.test.d.ts.map +1 -0
  23. package/dist/executor/__tests__/container-executor.test.d.ts +2 -0
  24. package/dist/executor/__tests__/container-executor.test.d.ts.map +1 -0
  25. package/dist/executor/__tests__/egress-guard.test.d.ts +2 -0
  26. package/dist/executor/__tests__/egress-guard.test.d.ts.map +1 -0
  27. package/dist/executor/__tests__/webgpuProbe.test.d.ts +2 -0
  28. package/dist/executor/__tests__/webgpuProbe.test.d.ts.map +1 -0
  29. package/dist/executor/container-executor.d.ts +49 -1
  30. package/dist/executor/container-executor.d.ts.map +1 -1
  31. package/dist/executor/egress-guard.d.ts +105 -0
  32. package/dist/executor/egress-guard.d.ts.map +1 -0
  33. package/dist/executor/memoryProbe.d.ts +25 -0
  34. package/dist/executor/memoryProbe.d.ts.map +1 -1
  35. package/dist/executor/throttle.d.ts +62 -4
  36. package/dist/executor/throttle.d.ts.map +1 -1
  37. package/dist/executor/webgpuProbe.d.ts +9 -0
  38. package/dist/executor/webgpuProbe.d.ts.map +1 -0
  39. package/dist/index.d.ts +2 -0
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +766 -230
  42. package/dist/swarm/__tests__/adapter.test.d.ts +2 -0
  43. package/dist/swarm/__tests__/adapter.test.d.ts.map +1 -0
  44. package/dist/swarm/__tests__/controller.test.d.ts +2 -0
  45. package/dist/swarm/__tests__/controller.test.d.ts.map +1 -0
  46. package/dist/swarm/__tests__/defects.test.d.ts +16 -0
  47. package/dist/swarm/__tests__/defects.test.d.ts.map +1 -0
  48. package/dist/swarm/__tests__/hardening.test.d.ts +2 -0
  49. package/dist/swarm/__tests__/hardening.test.d.ts.map +1 -0
  50. package/dist/swarm/__tests__/runtime.test.d.ts +2 -0
  51. package/dist/swarm/__tests__/runtime.test.d.ts.map +1 -0
  52. package/dist/swarm/__tests__/session.test.d.ts +2 -0
  53. package/dist/swarm/__tests__/session.test.d.ts.map +1 -0
  54. package/dist/swarm/adapter.d.ts +115 -0
  55. package/dist/swarm/adapter.d.ts.map +1 -0
  56. package/dist/swarm/controller.d.ts +87 -0
  57. package/dist/swarm/controller.d.ts.map +1 -0
  58. package/dist/swarm/messages.d.ts +41 -0
  59. package/dist/swarm/messages.d.ts.map +1 -0
  60. package/dist/swarm/runtime.d.ts +16 -0
  61. package/dist/swarm/runtime.d.ts.map +1 -0
  62. package/dist/swarm/session.d.ts +73 -0
  63. package/dist/swarm/session.d.ts.map +1 -0
  64. package/dist/swarm-engine.js +7477 -0
  65. package/dist/vector-store/HNSWIndex.d.ts +30 -0
  66. package/dist/vector-store/HNSWIndex.d.ts.map +1 -1
  67. package/dist/vector-store/VectorStoreEngine.d.ts +43 -0
  68. package/dist/vector-store/VectorStoreEngine.d.ts.map +1 -1
  69. package/dist/vector-store/__tests__/HNSWIndex.test.d.ts +2 -0
  70. package/dist/vector-store/__tests__/HNSWIndex.test.d.ts.map +1 -0
  71. package/dist/vector-store/__tests__/VectorStoreEngine.test.d.ts +2 -0
  72. package/dist/vector-store/__tests__/VectorStoreEngine.test.d.ts.map +1 -0
  73. package/dist/worker/__tests__/main.worker.abort.test.d.ts +2 -0
  74. package/dist/worker/__tests__/main.worker.abort.test.d.ts.map +1 -0
  75. package/dist/worker/__tests__/main.worker.control.test.d.ts +2 -0
  76. package/dist/worker/__tests__/main.worker.control.test.d.ts.map +1 -0
  77. package/dist/worker.js +643 -67
  78. package/dist/workloads/__tests__/nudenet.test.d.ts +2 -0
  79. package/dist/workloads/__tests__/nudenet.test.d.ts.map +1 -0
  80. package/dist/workloads/ai-inference.d.ts +2 -1
  81. package/dist/workloads/ai-inference.d.ts.map +1 -1
  82. package/dist/workloads/ai-model-registry.d.ts +72 -0
  83. package/dist/workloads/ai-model-registry.d.ts.map +1 -0
  84. package/dist/workloads/container.d.ts +1 -1
  85. package/dist/workloads/container.d.ts.map +1 -1
  86. package/dist/workloads/image-process.d.ts +27 -0
  87. package/dist/workloads/image-process.d.ts.map +1 -1
  88. package/dist/workloads/nudenet.d.ts +8 -0
  89. package/dist/workloads/nudenet.d.ts.map +1 -1
  90. package/package.json +3 -2
  91. package/dist/assets/memoryProbe.js +0 -28
  92. package/dist/client/WebRTCPeer.d.ts +0 -8
  93. package/dist/client/WebRTCPeer.d.ts.map +0 -1
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=nudenet.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nudenet.test.d.ts","sourceRoot":"","sources":["../../../src/workloads/__tests__/nudenet.test.ts"],"names":[],"mappings":""}
@@ -1,9 +1,10 @@
1
1
  import type { AiInferencePayload, AiInferenceResult } from '@flaxia/sdk';
2
+ 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';
2
3
  /**
3
4
  * Drops all cached model pipelines so the (potentially hundreds of MB of)
4
5
  * transformers/onnxruntime memory can be garbage-collected. Called by the
5
6
  * worker after an idle period so a node does not pin every model it ever saw.
6
7
  */
7
8
  export declare const releaseCache: () => void;
8
- export declare const handleAiInference: (payload: AiInferencePayload, onToken?: (token: string) => void) => Promise<AiInferenceResult>;
9
+ export declare const handleAiInference: (payload: AiInferencePayload, onToken?: (token: string) => void | Promise<void>) => Promise<AiInferenceResult>;
9
10
  //# sourceMappingURL=ai-inference.d.ts.map
@@ -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;AAe7F;;;;GAIG;AACH,eAAO,MAAM,YAAY,QAAO,IAE/B,CAAC;AAuCF,eAAO,MAAM,iBAAiB,GAC5B,SAAS,kBAAkB,EAC3B,UAAU,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,KAChC,OAAO,CAAC,iBAAiB,CAoE3B,CAAC"}
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;AAa7F,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,iBAAiB,GACvB,MAAM,qBAAqB,CAAC;AAe7B;;;;GAIG;AACH,eAAO,MAAM,YAAY,QAAO,IAE/B,CAAC;AA0FF,eAAO,MAAM,iBAAiB,GAC5B,SAAS,kBAAkB,EAC3B,UAAU,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAChD,OAAO,CAAC,iBAAiB,CAqF3B,CAAC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Node-side model registry for the `ai-inference` workload.
3
+ *
4
+ * A task payload's `model` field is unvalidated API input, and in
5
+ * transformers.js it is both the repository id *and* the download source. Left
6
+ * unchecked, any API key holder could make the whole volunteer fleet download
7
+ * an arbitrary Hugging Face repository (bandwidth, storage, memory) or pin the
8
+ * node to a revision of their choosing. Only models registered here are ever
9
+ * loaded; an unknown id is rejected before any network request happens.
10
+ *
11
+ * Hosts extend the registry explicitly (and only at start-up) via
12
+ * `registerAiModels`. The registry is process-wide: it is the node operator's
13
+ * decision which repositories run on volunteers.
14
+ */
15
+ export interface AiModelDefinition {
16
+ /** Hugging Face repository id, e.g. `Xenova/bert-base-multilingual-uncased-sentiment`. */
17
+ repo: string;
18
+ /** Immutable revision (commit sha or tag) to pin the download to. */
19
+ revision: string;
20
+ /** Optional sha256 of the main weight file, for out-of-band integrity checks. */
21
+ sha256?: string;
22
+ /** Upper bound for a single model file download, in bytes. */
23
+ maxBytes: number;
24
+ }
25
+ /** Default per-file download cap: 512 MiB. */
26
+ export declare const DEFAULT_AI_MODEL_MAX_BYTES: number;
27
+ /** Hard ceiling for any registry entry: 4 GiB. */
28
+ export declare const MAX_AI_MODEL_MAX_BYTES: number;
29
+ /** Execution devices a node is willing to run. `webgpu` is opt-in. */
30
+ export declare const ALLOWED_AI_DEVICES: readonly ["wasm", "cpu", "webgpu"];
31
+ export type AllowedAiDevice = (typeof ALLOWED_AI_DEVICES)[number];
32
+ /**
33
+ * Quantization formats that keep a task inside the memory the node promised.
34
+ * `fp32` and `fp16` are deliberately absent: a task could otherwise select the
35
+ * largest possible weights for a model the node already accepted.
36
+ */
37
+ export declare const ALLOWED_AI_DTYPES: readonly ["q4", "q4f16", "q8", "int8", "uint8"];
38
+ export type AllowedAiDtype = (typeof ALLOWED_AI_DTYPES)[number];
39
+ /** Maximum characters accepted for a single text input (and array length). */
40
+ export declare const MAX_AI_INPUT_CHARS = 100000;
41
+ export declare const MAX_AI_INPUT_ITEMS = 64;
42
+ /**
43
+ * Register (or replace) allowed models. Called by a host at start-up; entries
44
+ * are validated here so a bad entry cannot widen the download limits.
45
+ */
46
+ export declare function registerAiModels(definitions: Record<string, AiModelDefinition>): void;
47
+ /** Remove a previously registered model (mostly useful for tests/hosts). */
48
+ export declare function unregisterAiModel(id: string): void;
49
+ /** All registered model ids, for diagnostics and operator tooling. */
50
+ export declare function listAiModels(): string[];
51
+ /**
52
+ * Resolve a payload's `model` to its registry entry, or throw a clear error.
53
+ * This is the fail-closed gate: the returned `repo` is what gets passed to
54
+ * transformers.js, never the raw payload value.
55
+ */
56
+ export declare function resolveAiModel(model: unknown): AiModelDefinition;
57
+ /** Validate `options.device` against the node's allowlist. */
58
+ export declare function resolveAiDevice(device: unknown): AllowedAiDevice | undefined;
59
+ /** Validate `options.dtype` against the node's allowlist. */
60
+ export declare function resolveAiDtype(dtype: unknown): AllowedAiDtype | undefined;
61
+ /**
62
+ * Validate the task input: a bounded string or a bounded array of strings.
63
+ * Anything else (objects, numbers, huge arrays) is rejected before the model
64
+ * is loaded so a malformed payload cannot waste a download.
65
+ */
66
+ export declare function assertAiInput(input: unknown): string | string[];
67
+ /**
68
+ * Copy the numeric generation options into `target`, rejecting out-of-range or
69
+ * non-numeric values instead of handing them to onnxruntime.
70
+ */
71
+ export declare function applyGenerationOptions(target: Record<string, unknown>, options: Record<string, unknown>): void;
72
+ //# sourceMappingURL=ai-model-registry.d.ts.map
@@ -0,0 +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;AAwBpD,sEAAsE;AACtE,eAAO,MAAM,kBAAkB,oCAAqC,CAAC;AACrE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,iDAAkD,CAAC;AACjF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAWhE,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,SAAU,CAAC;AAC1C,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,IAAI,CAkBrF;AAED,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAElD;AAED,sEAAsE;AACtE,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAEvC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,CAWhE;AAED,8DAA8D;AAC9D,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,eAAe,GAAG,SAAS,CAQ5E;AAED,6DAA6D;AAC7D,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAQzE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,EAAE,CAsB/D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,IAAI,CAyBN"}
@@ -1,3 +1,3 @@
1
1
  import type { ContainerPayload, ContainerResult } from '@flaxia/sdk';
2
- export declare const handleContainer: (payload: ContainerPayload) => Promise<ContainerResult>;
2
+ export declare const handleContainer: (payload: ContainerPayload, fileSourceOrigins?: readonly string[], containerImageOrigins?: readonly string[]) => Promise<ContainerResult>;
3
3
  //# sourceMappingURL=container.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/workloads/container.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAErE,eAAO,MAAM,eAAe,GAAU,SAAS,gBAAgB,KAAG,OAAO,CAAC,eAAe,CAYxF,CAAC"}
1
+ {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/workloads/container.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAErE,eAAO,MAAM,eAAe,GAC1B,SAAS,gBAAgB,EACzB,oBAAmB,SAAS,MAAM,EAAO,EACzC,wBAAwB,SAAS,MAAM,EAAE,KACxC,OAAO,CAAC,eAAe,CAYzB,CAAC"}
@@ -1,3 +1,30 @@
1
1
  import type { ImageProcessPayload, ImageProcessResult } from '@flaxia/sdk';
2
+ /**
3
+ * Hard canvas limits for customer-supplied resize requests.
4
+ *
5
+ * `options.width`/`options.height` come straight from the task payload, so
6
+ * without caps `{ width: 100000, height: 100000 }` asks the volunteer's renderer
7
+ * for a terabyte-scale allocation. Each side is capped at 8192px and the total
8
+ * at 32M pixels (a 8192x4096 canvas, ~128MB of RGBA backing store).
9
+ */
10
+ export declare const MAX_CANVAS_SIDE = 8192;
11
+ export declare const MAX_CANVAS_PIXELS: number;
12
+ /** Maximum encoded input before data-URL decoding or image bitmap allocation. */
13
+ export declare const MAX_IMAGE_PROCESS_INPUT_BYTES: number;
14
+ /**
15
+ * Resolve the output canvas size: validate the requested size against the hard
16
+ * caps, then clamp it to the source bitmap so a payload can never upscale (and
17
+ * therefore never allocate more than the decoded source needs).
18
+ */
19
+ export declare function resolveCanvasSize(requested: {
20
+ width?: unknown;
21
+ height?: unknown;
22
+ }, source: {
23
+ width: number;
24
+ height: number;
25
+ }): {
26
+ width: number;
27
+ height: number;
28
+ };
2
29
  export declare const handleImageProcess: (payload: ImageProcessPayload) => Promise<ImageProcessResult>;
3
30
  //# sourceMappingURL=image-process.d.ts.map
@@ -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,eAAO,MAAM,kBAAkB,GAAU,SAAS,mBAAmB,KAAG,OAAO,CAAC,kBAAkB,CAwDjG,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;AAgH9D;;;;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,CA6EjG,CAAC"}
@@ -1,4 +1,12 @@
1
1
  import type { NudeNetPayload, NudeNetResult } from '@flaxia/sdk';
2
+ /** Hard caps for the inputs this workload accepts. */
3
+ export declare const MAX_NUDENET_IMAGE_BYTES: number;
4
+ /** Bound decoded pixels before allocating preprocessing canvases (RGBA ~4 bytes/pixel). */
5
+ export declare const MAX_NUDENET_IMAGE_PIXELS: number;
6
+ export declare const MAX_NUDENET_IMAGE_SIDE = 8192;
7
+ export declare const MAX_NUDENET_MODEL_BYTES: number;
8
+ /** Content types accepted for a customer-supplied image URL. */
9
+ export declare const NUDENET_IMAGE_CONTENT_TYPES: readonly ["image/*", "application/octet-stream"];
2
10
  export declare function configureOrt(): void;
3
11
  export declare const handleNudeNet: (payload: NudeNetPayload) => Promise<NudeNetResult>;
4
12
  export declare function releaseCache(): void;
@@ -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;AAoCnF,wBAAgB,YAAY,IAAI,IAAI,CAUnC;AAuID,eAAO,MAAM,aAAa,GAAU,SAAS,cAAc,KAAG,OAAO,CAAC,aAAa,CA6BlF,CAAC;AAEF,wBAAgB,YAAY,IAAI,IAAI,CAEnC"}
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;AAoLD,eAAO,MAAM,aAAa,GAAU,SAAS,cAAc,KAAG,OAAO,CAAC,aAAa,CA6BlF,CAAC;AAEF,wBAAgB,YAAY,IAAI,IAAI,CAEnC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flaxia/node",
3
- "version": "0.3.7",
3
+ "version": "0.5.0",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -17,11 +17,12 @@
17
17
  "scripts": {
18
18
  "build": "rm -f tsconfig.tsbuildinfo && vite build && tsc -b",
19
19
  "dev": "vite",
20
+ "typecheck": "tsc --noEmit",
20
21
  "test": "vitest"
21
22
  },
22
23
  "dependencies": {
23
24
  "@bjorn3/browser_wasi_shim": "^0.4.2",
24
- "@flaxia/sdk": "^0.4.0",
25
+ "@flaxia/sdk": "^0.5.0",
25
26
  "@huggingface/transformers": "^4.2.0",
26
27
  "onnxruntime-web": "1.26.0",
27
28
  "rollup": "^4.61.0"
@@ -1,28 +0,0 @@
1
- //#region src/executor/memoryProbe.ts
2
- var e = 2 * 1024 ** 3, t = 65536, n = 16 * 1024 * 1024;
3
- function r(r = e, i = n) {
4
- let a;
5
- try {
6
- a = new WebAssembly.Memory({ initial: 0 });
7
- } catch {
8
- return 0;
9
- }
10
- let o = 0;
11
- for (; o < r;) {
12
- let e = r - o, n = Math.ceil(Math.min(i, e) / t);
13
- try {
14
- a.grow(n);
15
- } catch {
16
- break;
17
- }
18
- let s = new Uint8Array(a.buffer);
19
- for (let e = 0; e < n; e++) s[o + e * t] = 0;
20
- o += n * t;
21
- }
22
- return o;
23
- }
24
- function i() {
25
- return r() >= e;
26
- }
27
- //#endregion
28
- export { i as n, r, e as t };
@@ -1,8 +0,0 @@
1
- export declare class WebRTCPeer {
2
- private peerConnection;
3
- private onTaskResult;
4
- constructor(onTaskResult: (result: any) => void);
5
- handleOffer(offer: RTCSessionDescriptionInit, sendAnswer: (answer: RTCSessionDescriptionInit) => void): Promise<void>;
6
- addIceCandidate(candidate: RTCIceCandidateInit): Promise<void>;
7
- }
8
- //# sourceMappingURL=WebRTCPeer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebRTCPeer.d.ts","sourceRoot":"","sources":["../../src/client/WebRTCPeer.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;IACrB,OAAO,CAAC,cAAc,CAAoB;IAC1C,OAAO,CAAC,YAAY,CAAwB;gBAEhC,YAAY,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI;IAOzC,WAAW,CAAC,KAAK,EAAE,yBAAyB,EAAE,UAAU,EAAE,CAAC,MAAM,EAAE,yBAAyB,KAAK,IAAI;IAOrG,eAAe,CAAC,SAAS,EAAE,mBAAmB;CAGrD"}