llama-web-bridge 0.1.92 → 0.1.93
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/llama_webgpu_bridge.d.ts +40 -0
- package/dist/llama_webgpu_bridge.js +7 -11188
- package/dist/llama_webgpu_bridge_worker.js +7 -11151
- package/dist/llama_webgpu_core.js +1 -1
- package/dist/llama_webgpu_core.wasm +0 -0
- package/dist/llama_webgpu_core_mem64.js +1 -1
- package/dist/llama_webgpu_core_mem64.wasm +0 -0
- package/dist/llama_webgpu_core_mem64_st.js +1 -1
- package/dist/llama_webgpu_core_mem64_st.wasm +0 -0
- package/dist/llama_webgpu_core_st.js +1 -1
- package/dist/llama_webgpu_core_st.wasm +0 -0
- package/dist/manifest.json +51 -51
- package/dist/sha256sums.txt +11 -11
- package/package.json +1 -1
|
@@ -552,6 +552,40 @@ export function enableBridgeWorkerHost(): void;
|
|
|
552
552
|
* remain out of band; disposal rejects queued/new work while active work settles
|
|
553
553
|
* first. See docs/api.md "Operation serialization".
|
|
554
554
|
*/
|
|
555
|
+
export type CoreMemoryVariant = 'wasm32' | 'memory64';
|
|
556
|
+
export type CoreThreadingMode = 'threaded' | 'single-thread';
|
|
557
|
+
export type CoreExecutionMode = 'worker' | 'main-thread';
|
|
558
|
+
export type CoreFallbackReason = 'unsupported' | 'timeout' | 'init_error';
|
|
559
|
+
|
|
560
|
+
export interface CorePreflightResult {
|
|
561
|
+
variant: CoreMemoryVariant;
|
|
562
|
+
threading: CoreThreadingMode;
|
|
563
|
+
execution: CoreExecutionMode;
|
|
564
|
+
fallback: boolean;
|
|
565
|
+
fallbackReason: CoreFallbackReason | null;
|
|
566
|
+
loaderUrl: string | null;
|
|
567
|
+
wasmUrl: string | null;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
export type CoreAssetErrorCode = 'CORE_ASSET_UNAVAILABLE' | 'CORE_PREFLIGHT_UNSUPPORTED';
|
|
571
|
+
export type CoreAssetKind = 'loader' | 'wasm' | 'worker';
|
|
572
|
+
|
|
573
|
+
export interface CoreAssetErrorDetails {
|
|
574
|
+
asset: CoreAssetKind;
|
|
575
|
+
url?: string | null;
|
|
576
|
+
httpStatus?: number | null;
|
|
577
|
+
variant?: CoreMemoryVariant | null;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
export class CoreAssetError extends Error {
|
|
581
|
+
readonly code: CoreAssetErrorCode;
|
|
582
|
+
readonly asset: CoreAssetKind;
|
|
583
|
+
readonly url: string | null;
|
|
584
|
+
readonly httpStatus: number | null;
|
|
585
|
+
readonly variant: CoreMemoryVariant | null;
|
|
586
|
+
constructor(code: CoreAssetErrorCode, message: string, details: CoreAssetErrorDetails);
|
|
587
|
+
}
|
|
588
|
+
|
|
555
589
|
export class LlamaWebGpuBridge {
|
|
556
590
|
static supportsSafariAdaptiveGpu: boolean;
|
|
557
591
|
/** `true` when `createCompletion` accepts `onUsage`. Bridges before v0.1.54 lack it; through v0.1.52 their worker mode rejects a function option with a `DataCloneError`. */
|
|
@@ -560,9 +594,15 @@ export class LlamaWebGpuBridge {
|
|
|
560
594
|
static supportsModelCacheQuery: boolean;
|
|
561
595
|
/** This bridge honors `jsBackedModelStaging` and validates worker/core staging support. */
|
|
562
596
|
static supportsJsBackedModelStaging: boolean;
|
|
597
|
+
static supportsCorePreflight: boolean;
|
|
563
598
|
|
|
564
599
|
constructor(config?: LlamaWebGpuBridgeConfig);
|
|
565
600
|
|
|
601
|
+
/**
|
|
602
|
+
* Initializes the selected core before model transfer. Wasm and transient core initialization failures can be retried.
|
|
603
|
+
* The browser caches a failed loader import by URL. To retry that import, reload the page or use a different loader URL.
|
|
604
|
+
*/
|
|
605
|
+
preflightCore(): Promise<CorePreflightResult>;
|
|
566
606
|
/** Can reject with `ModelTransferLengthError` if transfer length validation fails. */
|
|
567
607
|
loadModelFromUrl(url: string | string[], options?: LoadModelOptions): Promise<unknown>;
|
|
568
608
|
prefetchModelToCache(url: string | string[], options?: LoadModelOptions): Promise<unknown>;
|