@zerogpu/browser-extension-sdk 0.4.0 → 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.
- package/README.md +75 -0
- package/bin/zerogpu.mjs +6 -0
- package/dist/assets/zerogpu-assets.json +2 -2
- package/dist/assets/zerogpu-worker.js +1 -1
- package/dist/extension/zerogpu-background.js +1 -1
- package/dist/extension/zerogpu-offscreen.js +1 -1
- package/dist/loader.js +1 -1
- package/dist/manifest.json +5 -5
- package/dist/types/adapters/kinds.d.ts +8 -0
- package/dist/types/adapters/onnx/executor.d.ts +26 -1
- package/dist/types/adapters/onnx/runtime.d.ts +10 -4
- package/dist/types/adapters/types.d.ts +15 -1
- package/dist/types/appinference/eligible.d.ts +12 -0
- package/dist/types/appinference/store.d.ts +42 -0
- package/dist/types/appinference/types.d.ts +118 -0
- package/dist/types/config/types.d.ts +1 -0
- package/dist/types/device/telemetry.d.ts +6 -0
- package/dist/types/extension/background.d.ts +36 -0
- package/dist/types/extension/offscreen.d.ts +25 -3
- package/dist/types/loader.d.ts +1 -0
- package/dist/types/public-api.d.ts +41 -7
- package/dist/types/runtime/app-identity.d.ts +24 -0
- package/dist/types/runtime/app-inference.d.ts +60 -0
- package/dist/types/runtime/guardrails.d.ts +10 -0
- package/dist/types/runtime/host-api.d.ts +13 -1
- package/dist/types/runtime/init-guard.d.ts +7 -0
- package/dist/types/runtime/lifecycle-options.d.ts +12 -0
- package/dist/types/runtime/lifecycle.d.ts +21 -8
- package/dist/types/runtime/restart.d.ts +11 -0
- package/dist/types/runtime/router.d.ts +13 -0
- package/dist/types/runtime/sdk-state.d.ts +24 -0
- package/dist/types/runtime/shutdown.d.ts +21 -3
- package/dist/types/storage/cached-model.d.ts +31 -2
- package/dist/types/telemetry/event-reporter.d.ts +1 -0
- package/dist/types/transport/http.d.ts +67 -0
- package/dist/v/zerogpu-browser-sdk.5f140942519b.umd.js +1 -0
- package/dist/zerogpu-browser-sdk.cjs +1 -1
- package/dist/zerogpu-browser-sdk.esm.js +1 -1
- package/dist/zerogpu-browser-sdk.umd.js +1 -1
- package/dist/zerogpu-worker.js +1 -1
- package/docs/APP_INFERENCE_E2E_2026-11-06_DEV.md +855 -0
- package/docs/app-side-inference.md +537 -0
- package/docs/extension-developer-guide.md +31 -0
- package/docs/multi-model-support.md +5 -1
- package/package.json +2 -1
- package/dist/v/zerogpu-browser-sdk.87efe0d8c5ba.umd.js +0 -1
|
@@ -5,17 +5,29 @@
|
|
|
5
5
|
* consumers get the same signals as `zerogpu:*` window events.
|
|
6
6
|
*/
|
|
7
7
|
export type SdkLifecycleStatus = 'starting' | 'running' | 'degraded' | 'shutdown' | 'error';
|
|
8
|
-
export type HostEventName = 'degraded' | 'recovered' | 'shutdown'
|
|
8
|
+
export type HostEventName = 'degraded' | 'recovered' | 'shutdown'
|
|
9
|
+
/** The device now holds `modelId` for the network and for local calls. */
|
|
10
|
+
| 'activeModelChanged'
|
|
11
|
+
/** The app's chosen model was not kept; the device holds the default. */
|
|
12
|
+
| 'modelChoiceRefused';
|
|
9
13
|
export interface HostEventDetail {
|
|
10
14
|
code?: string;
|
|
11
15
|
message?: string;
|
|
16
|
+
modelId?: string;
|
|
17
|
+
reason?: string;
|
|
18
|
+
/** On a guardrail `shutdown`: the SDK restarts itself after this many ms. */
|
|
19
|
+
restartInMs?: number;
|
|
12
20
|
}
|
|
13
21
|
type HostEventListener = (detail: HostEventDetail) => void;
|
|
22
|
+
export declare const setGuardrailStopped: (stopped: boolean) => void;
|
|
23
|
+
export declare const isGuardrailStopped: () => boolean;
|
|
14
24
|
export declare const getLifecycleStatus: () => SdkLifecycleStatus;
|
|
15
25
|
export declare const setLifecycleStatus: (status: SdkLifecycleStatus) => void;
|
|
16
26
|
export declare const isShutdown: () => boolean;
|
|
17
27
|
/** Degraded and shutting-down SDKs finish in-flight work but accept nothing new. */
|
|
18
28
|
export declare const isTaskGateActive: () => boolean;
|
|
29
|
+
/** Test-only. */
|
|
30
|
+
export declare const __resetHostApi: () => void;
|
|
19
31
|
export declare const onHostEvent: (name: HostEventName, listener: HostEventListener) => (() => void);
|
|
20
32
|
export declare const emitHostEvent: (name: HostEventName, detail?: HostEventDetail) => void;
|
|
21
33
|
export {};
|
|
@@ -53,6 +53,13 @@ export declare const beginInitAttempt: (now?: number) => InitGuardDecision;
|
|
|
53
53
|
export declare const markInitSuccess: () => void;
|
|
54
54
|
/** Written before every dangerous step so an unclean death is attributable. */
|
|
55
55
|
export declare const setInitPhase: (phase: InitPhase, modelId?: string, modelVersion?: string) => void;
|
|
56
|
+
/**
|
|
57
|
+
* A dangerous step ended in a handled failure (the download or load failed and
|
|
58
|
+
* the SDK is moving on): the marker must not survive, or the next boot would
|
|
59
|
+
* read it as a death mid-step, count a crash, and after two blocklist the
|
|
60
|
+
* model for a day (the "never reconnects after a load failure" gotcha).
|
|
61
|
+
*/
|
|
62
|
+
export declare const clearInitPhase: () => void;
|
|
56
63
|
/** The graceful shutdown sequence ran — the next boot must not count a crash. */
|
|
57
64
|
export declare const markCleanShutdown: (code: string) => void;
|
|
58
65
|
/** Blocklisted models are refused before any I/O (breaker, Layer 4). */
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SdkConfig } from '../config/types';
|
|
2
|
+
/**
|
|
3
|
+
* What `startLifecycle` was started with. Kept apart from the lifecycle module
|
|
4
|
+
* so the modules that restart it later (a model switch, a guardrail restart)
|
|
5
|
+
* can hold the options without importing the lifecycle itself.
|
|
6
|
+
*/
|
|
7
|
+
export interface LifecycleOptions {
|
|
8
|
+
config: SdkConfig;
|
|
9
|
+
appUserId?: string;
|
|
10
|
+
edgeOperatorKey?: string;
|
|
11
|
+
deviceId?: string;
|
|
12
|
+
}
|
|
@@ -1,10 +1,23 @@
|
|
|
1
|
-
import { SdkConfig } from '../config/types';
|
|
2
1
|
import { SampleTestResult } from '../adapters/types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
appUserId?: string;
|
|
6
|
-
edgeOperatorKey?: string;
|
|
7
|
-
deviceId?: string;
|
|
8
|
-
}
|
|
2
|
+
import { LifecycleOptions } from './lifecycle-options';
|
|
3
|
+
export type { LifecycleOptions } from './lifecycle-options';
|
|
9
4
|
export declare function warmUpFailed(sample: Pick<SampleTestResult, 'ok' | 'error' | 'processingTimeMs'>, latencyBudgetMs?: number): boolean;
|
|
10
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The warm-up gate (design §2, rule 6) re-registers at once after a model it
|
|
7
|
+
* cannot run, so the registry walks on. Bounded per page: after this many in a
|
|
8
|
+
* row the slow refusal cadence applies, so a broken list cannot loop.
|
|
9
|
+
*/
|
|
10
|
+
export declare const MAX_UNFIT_REREGISTERS = 4;
|
|
11
|
+
/**
|
|
12
|
+
* Runs the lifecycle again, keeping the loop alive on transient failures
|
|
13
|
+
* (register/network/model errors). Auth failures and crash-loop cool-downs
|
|
14
|
+
* return cleanly from startLifecycle without throwing. A pending switch
|
|
15
|
+
* cannot wait out a transient failure: it ends with the failure's code while
|
|
16
|
+
* the choice stays remembered for the retry.
|
|
17
|
+
*/
|
|
18
|
+
export declare const runLifecycleNow: (options: LifecycleOptions, reason: string) => void;
|
|
19
|
+
/** Download and network failures pass; a model the runtime cannot load does not. */
|
|
20
|
+
export declare const isTransientLoadFailure: (message: string) => boolean;
|
|
21
|
+
export declare const startLifecycle: (options: LifecycleOptions) => Promise<void>;
|
|
22
|
+
/** Test-only. */
|
|
23
|
+
export declare const __resetLifecycleState: () => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one way to run the lifecycle again from outside it. The lifecycle
|
|
3
|
+
* registers itself here at module load; a model switch and a guardrail
|
|
4
|
+
* restart ask through it, so neither module imports the lifecycle (which
|
|
5
|
+
* imports both of them).
|
|
6
|
+
*/
|
|
7
|
+
type RestartHandler = (reason: string) => void;
|
|
8
|
+
export declare const setLifecycleRestartHandler: (next: RestartHandler | null) => void;
|
|
9
|
+
/** Runs the lifecycle again with the options it was last started with. No-op before the first start. */
|
|
10
|
+
export declare const requestLifecycleRestart: (reason: string) => boolean;
|
|
11
|
+
export {};
|
|
@@ -1,2 +1,15 @@
|
|
|
1
1
|
import { ServerTaskBatchMessage } from '../transport/protocol';
|
|
2
|
+
/** True while a network task or an app call holds (or waits for) the engine. */
|
|
3
|
+
export declare const isEngineBusy: () => boolean;
|
|
4
|
+
/** Resolves once nothing holds the engine (a switch waits for the in-flight task this way). */
|
|
5
|
+
export declare const awaitEngineIdle: () => Promise<void>;
|
|
6
|
+
/** While set, network batches are answered busy: the session is being torn down for a switch. */
|
|
7
|
+
export declare const setSwitchingGate: (on: boolean) => void;
|
|
8
|
+
/** Runs an app call ahead of network work: waits only for the task in flight. */
|
|
9
|
+
export declare const runForApp: <T>(block: () => Promise<T>) => Promise<{
|
|
10
|
+
value: T;
|
|
11
|
+
queueWaitMs: number;
|
|
12
|
+
}>;
|
|
13
|
+
/** Test-only. */
|
|
14
|
+
export declare const __resetRouterState: () => void;
|
|
2
15
|
export declare const handleIncomingMessage: (msg: ServerTaskBatchMessage) => Promise<void>;
|
|
@@ -3,6 +3,14 @@ import { DeviceInfo } from '../device/types';
|
|
|
3
3
|
import { ModelAdapter, TaskSample } from '../adapters/types';
|
|
4
4
|
import { ConnectionStatus } from '../transport/status';
|
|
5
5
|
import { WebSocketClient } from '../transport/websocket';
|
|
6
|
+
import { LifecycleOptions } from './lifecycle-options';
|
|
7
|
+
/**
|
|
8
|
+
* Where the lifecycle is, for the host-facing contribution state: `idle`
|
|
9
|
+
* (not started / stopped), `registering` (register in flight or a retry
|
|
10
|
+
* pending), `declined` (the registry refused the device), `preparing`
|
|
11
|
+
* (download / load / warm-up), `running` (session open).
|
|
12
|
+
*/
|
|
13
|
+
export type LifecyclePhase = 'idle' | 'registering' | 'declined' | 'preparing' | 'running';
|
|
6
14
|
export interface AssignedModelInfo {
|
|
7
15
|
modelId: string;
|
|
8
16
|
modelVersion?: string;
|
|
@@ -42,6 +50,11 @@ export interface SdkState {
|
|
|
42
50
|
status: ConnectionStatus;
|
|
43
51
|
ws?: WebSocketClient;
|
|
44
52
|
registrationSettings?: RegistrationSettings | null;
|
|
53
|
+
phase?: LifecyclePhase;
|
|
54
|
+
declinedReason?: string | null;
|
|
55
|
+
lifecycleOptions?: LifecycleOptions;
|
|
56
|
+
/** The registry acknowledged this session's hello: the device is listed under its model. */
|
|
57
|
+
sessionAcked?: boolean;
|
|
45
58
|
}
|
|
46
59
|
export declare const setConfig: (config: SdkConfig) => void;
|
|
47
60
|
export declare const setDeviceContext: (deviceId: string, deviceInfo: DeviceInfo) => void;
|
|
@@ -54,8 +67,19 @@ export declare const setSample: (sample?: TaskSample) => void;
|
|
|
54
67
|
export declare const setCachedModelId: (cachedModelId?: string | null) => void;
|
|
55
68
|
export declare const setSessionKey: (sessionKey?: string) => void;
|
|
56
69
|
export declare const setWebSocket: (ws?: WebSocketClient) => void;
|
|
70
|
+
export declare const setSessionAcked: (acked: boolean) => void;
|
|
71
|
+
export declare const isSessionAcked: () => boolean;
|
|
57
72
|
export declare const getWebSocket: () => WebSocketClient | undefined;
|
|
58
73
|
export declare const setRegistrationSettings: (settings?: RegistrationSettings | null) => void;
|
|
59
74
|
export declare const getRegistrationSettings: () => RegistrationSettings | null;
|
|
60
75
|
export declare const setStatus: (status: ConnectionStatus) => void;
|
|
61
76
|
export declare const getState: () => SdkState;
|
|
77
|
+
/** Like getState, null before init instead of throwing. */
|
|
78
|
+
export declare const tryGetState: () => SdkState | null;
|
|
79
|
+
export declare const setPhase: (phase: LifecyclePhase, declinedReason?: string | null) => void;
|
|
80
|
+
export declare const getPhase: () => LifecyclePhase;
|
|
81
|
+
export declare const getDeclinedReason: () => string | null;
|
|
82
|
+
export declare const setLifecycleOptions: (options: LifecycleOptions | undefined) => void;
|
|
83
|
+
export declare const getLifecycleOptions: () => LifecycleOptions | undefined;
|
|
84
|
+
/** Test-only: forget everything (a fresh page). */
|
|
85
|
+
export declare const __resetSdkState: () => void;
|
|
@@ -9,14 +9,32 @@ export declare const CLOSE_GUARDRAIL = 4002;
|
|
|
9
9
|
export declare const sendStatusUpdate: (status: "idle" | "error") => void;
|
|
10
10
|
export interface ShutdownOptions {
|
|
11
11
|
reason: string;
|
|
12
|
-
/** True for guardrail-triggered shutdowns: close 4002 + guardrail.shutdown. */
|
|
12
|
+
/** True for guardrail-triggered shutdowns: close 4002 + guardrail.shutdown, then a scheduled restart. */
|
|
13
13
|
guardrail?: boolean;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* How long a guardrail-stopped SDK waits before it comes back: 1 min, then
|
|
17
|
+
* 5, then 15, then every 30 — the ladder bounds a device that keeps failing
|
|
18
|
+
* without ever leaving it dead for the page's lifetime (ZGA-677: a laptop
|
|
19
|
+
* that woke from sleep into a RangeError stayed offline until the extension
|
|
20
|
+
* was reloaded; 53 of 69 production devices with a 4002 close on 2026-10-28
|
|
21
|
+
* never came back). A run that stays healthy for HEALTHY_RUN_RESET_MS resets
|
|
22
|
+
* the ladder.
|
|
23
|
+
*/
|
|
24
|
+
export declare const GUARDRAIL_RESTART_DELAYS_MS: readonly number[];
|
|
25
|
+
export declare const HEALTHY_RUN_RESET_MS: number;
|
|
26
|
+
export declare const nextGuardrailRestartDelayMs: (now?: number) => number;
|
|
15
27
|
/**
|
|
16
28
|
* The ordered shutdown sequence (GRACEFUL_SHUTDOWN_IMPLEMENTATION.md §5):
|
|
17
29
|
* mark terminal + kill the re-register loop → gate input → tell the server →
|
|
18
30
|
* report + beacon-flush → free memory largest-first → mark the exit clean →
|
|
19
|
-
* notify the host. Every step individually guarded; target ≤ 1 s.
|
|
20
|
-
*
|
|
31
|
+
* notify the host. Every step individually guarded; target ≤ 1 s.
|
|
32
|
+
*
|
|
33
|
+
* A host stop is terminal: `startLifecycle` refuses to run again until the
|
|
34
|
+
* page restarts the SDK. A guardrail stop is not: the runtime is freed the
|
|
35
|
+
* same way (the inference worker goes with its last model), and the SDK
|
|
36
|
+
* registers again after the ladder's delay with a fresh one.
|
|
21
37
|
*/
|
|
22
38
|
export declare const runShutdownSequence: ({ reason, guardrail }: ShutdownOptions) => Promise<void>;
|
|
39
|
+
/** Test-only. */
|
|
40
|
+
export declare const __resetGuardrailRestartLadder: () => void;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { RequiredFileSpec, TaskType } from '../config/types';
|
|
2
|
+
/**
|
|
3
|
+
* What the SDK remembers about each model whose files sit in the IndexedDB
|
|
4
|
+
* store (storage/model-store.ts): enough to rebuild its SlmConfig, claim it in
|
|
5
|
+
* `cachedModels` at register and resolve its adapter factory on boot. One
|
|
6
|
+
* localStorage key holds the whole list, most recently used first; the
|
|
7
|
+
* lifecycle bounds it (guardrails.maxCachedModels) and deletes the files of
|
|
8
|
+
* whatever it evicts.
|
|
9
|
+
*
|
|
10
|
+
* Until 0.4.0 one model was remembered under `zerogpu_cached_model_id` plus a
|
|
11
|
+
* key named after the model; `migrateLegacyCachedModel` folds that into the list.
|
|
12
|
+
*/
|
|
2
13
|
export interface CachedModelInfo {
|
|
3
14
|
modelId: string;
|
|
4
15
|
modelVersion?: string;
|
|
@@ -22,9 +33,27 @@ export interface CachedModelInfo {
|
|
|
22
33
|
schema?: unknown;
|
|
23
34
|
mask?: string;
|
|
24
35
|
usecase?: string;
|
|
36
|
+
[key: string]: unknown;
|
|
25
37
|
};
|
|
38
|
+
/** Epoch ms of the last load; the eviction order. */
|
|
39
|
+
lastUsedAt?: number;
|
|
26
40
|
}
|
|
27
|
-
export declare const
|
|
41
|
+
export declare const CACHED_MODELS_KEY = "zerogpu_cached_models";
|
|
42
|
+
/** Every remembered model, most recently used first. */
|
|
43
|
+
export declare const listCachedModels: () => CachedModelInfo[];
|
|
28
44
|
export declare const getCachedModelInfo: (modelId: string) => CachedModelInfo | null;
|
|
29
|
-
|
|
45
|
+
/** The most recently used model's id (what one cached model meant before the list). */
|
|
46
|
+
export declare const getCachedModelId: () => string | null;
|
|
47
|
+
/** Remembers (or refreshes) a model and makes it the most recently used. */
|
|
48
|
+
export declare const setCachedModelInfo: (info: CachedModelInfo, now?: number) => void;
|
|
49
|
+
export declare const touchCachedModel: (modelId: string, now?: number) => void;
|
|
50
|
+
export declare const removeCachedModel: (modelId: string) => CachedModelInfo | null;
|
|
51
|
+
/** Forgets `modelId`, or the most recently used model when none is given. */
|
|
30
52
|
export declare const clearCachedModelInfo: (modelId?: string | null) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Drops the least recently used entries beyond `cap` (0 = unbounded), never
|
|
55
|
+
* `keepModelId`. Returns what was dropped; the caller deletes the files.
|
|
56
|
+
*/
|
|
57
|
+
export declare const evictCachedModelsBeyond: (cap: number, keepModelId?: string) => CachedModelInfo[];
|
|
58
|
+
/** Folds the pre-0.5.0 single-model keys into the list. Idempotent. */
|
|
59
|
+
export declare const migrateLegacyCachedModel: () => void;
|
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
import { RegistrationSettings, RequiredFileSpec, SdkConfig } from '../config/types';
|
|
2
2
|
import { DeviceInfo } from '../device/types';
|
|
3
|
+
/** A model this device tried and could not run (app-side inference, rule 6). */
|
|
4
|
+
export interface UnfitModelRef {
|
|
5
|
+
modelId: string;
|
|
6
|
+
modelVersion?: string;
|
|
7
|
+
reason?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The registry's answer to `requestedModelId` (docs/SDK_APP_INFERENCE_DESIGN.md
|
|
11
|
+
* §2.3): granted, or refused with the reason while the default walk decided.
|
|
12
|
+
*/
|
|
13
|
+
export interface RequestedModelOutcome {
|
|
14
|
+
modelId: string;
|
|
15
|
+
granted: boolean;
|
|
16
|
+
reason?: string;
|
|
17
|
+
rule?: string;
|
|
18
|
+
detail?: Record<string, string | number | boolean>;
|
|
19
|
+
}
|
|
20
|
+
/** One line of POST /models/eligible (design §2.2). */
|
|
21
|
+
export interface EligibleModelLine {
|
|
22
|
+
modelId: string;
|
|
23
|
+
modelVersion: string;
|
|
24
|
+
modelDisplayName?: string;
|
|
25
|
+
taskType?: string;
|
|
26
|
+
inferenceKind?: string;
|
|
27
|
+
inferenceFramework?: string;
|
|
28
|
+
sizeBytes?: number;
|
|
29
|
+
maxTokens?: number;
|
|
30
|
+
eligible: boolean;
|
|
31
|
+
reason?: string;
|
|
32
|
+
rule?: string;
|
|
33
|
+
detail?: Record<string, string | number | boolean>;
|
|
34
|
+
reportOnly?: {
|
|
35
|
+
reason: string;
|
|
36
|
+
rule: string;
|
|
37
|
+
detail: Record<string, string | number | boolean>;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export interface EligibleModelsResponse {
|
|
41
|
+
deviceId: string;
|
|
42
|
+
edgeSdkType: string;
|
|
43
|
+
guardMode?: string;
|
|
44
|
+
models: EligibleModelLine[];
|
|
45
|
+
/** The polite envelope: this sdk type has no list here (e.g. `edge_sdk_type_not_allowed`). */
|
|
46
|
+
refusalReason?: string;
|
|
47
|
+
}
|
|
48
|
+
export declare const ELIGIBLE_MODELS_PATH = "/models/eligible";
|
|
3
49
|
export interface RegisterRequest {
|
|
4
50
|
deviceId: string;
|
|
5
51
|
sdkVersion: string;
|
|
@@ -8,9 +54,16 @@ export interface RegisterRequest {
|
|
|
8
54
|
modelVersion: string;
|
|
9
55
|
}[];
|
|
10
56
|
device: DeviceInfo;
|
|
57
|
+
/** Models whose warm-up failed on this device; the registry walks past them. */
|
|
58
|
+
unfitModels?: UnfitModelRef[];
|
|
59
|
+
/** The model the host app chose from the eligible list; absent → the default walk. */
|
|
60
|
+
requestedModelId?: string;
|
|
11
61
|
cust_param1?: string;
|
|
12
62
|
cust_param2?: string;
|
|
13
63
|
cust_param3?: string;
|
|
64
|
+
app_id?: string;
|
|
65
|
+
app_name?: string;
|
|
66
|
+
external_app_id?: string;
|
|
14
67
|
}
|
|
15
68
|
export interface RegisterResponse {
|
|
16
69
|
deviceId: string;
|
|
@@ -25,6 +78,8 @@ export interface RegisterResponse {
|
|
|
25
78
|
*/
|
|
26
79
|
refusalReason?: string;
|
|
27
80
|
configSettings?: Record<string, RegistrationSettings>;
|
|
81
|
+
/** Present when the request carried `requestedModelId`. */
|
|
82
|
+
requestedModel?: RequestedModelOutcome;
|
|
28
83
|
slmConfig?: {
|
|
29
84
|
modelId: string;
|
|
30
85
|
modelType?: string;
|
|
@@ -50,6 +105,7 @@ export interface RegisterResponse {
|
|
|
50
105
|
schema?: unknown;
|
|
51
106
|
mask?: string;
|
|
52
107
|
usecase?: string;
|
|
108
|
+
[key: string]: unknown;
|
|
53
109
|
};
|
|
54
110
|
}[];
|
|
55
111
|
}
|
|
@@ -69,4 +125,15 @@ export declare class RegisterError extends Error {
|
|
|
69
125
|
*/
|
|
70
126
|
export declare const detectSoftRefusal: (payload: unknown) => string | null;
|
|
71
127
|
export declare const isEdgeSdkTypeNotAllowedResponse: (payload: unknown) => boolean;
|
|
128
|
+
export declare class EligibleModelsError extends Error {
|
|
129
|
+
status: number;
|
|
130
|
+
body?: string;
|
|
131
|
+
constructor(status: number, body?: string);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* POST /models/eligible: the same header and body as /register, answered with
|
|
135
|
+
* every model of this sdk type's list judged for this device. Read-only on the
|
|
136
|
+
* registry side: nothing is assigned, no session is opened.
|
|
137
|
+
*/
|
|
138
|
+
export declare const requestEligibleModels: (config: SdkConfig, payload: RegisterRequest, auth?: RegisterAuthHeaders) => Promise<EligibleModelsResponse>;
|
|
72
139
|
export declare const registerDevice: (config: SdkConfig, payload: RegisterRequest, auth?: RegisterAuthHeaders) => Promise<RegisterResponse>;
|