/** * Wasmi extensions (`docs/design/extensions.md`): the client half. * * Enough of the family for a client to say what is installed and to change * it — list, run, upload, control. Module identity is the BLAKE3 digest, and * the server verifies the bytes it receives against the digest the client * named, so a client never has to be trusted to hash correctly (and this one * cannot: the browser has no BLAKE3). * * All integers little-endian, tightly packed, as everywhere in the protocol. */ /** `S2C_HELLO` feature bit: the extension family. */ export declare const FEATURE_EXTENSION: number; /** Run or update a definition: [0x90][nonce:2][flags][restart][expect_id:8] * [expect_revision:8][hash:32][name_len:2][name][argc:2][(len:4)(arg)…] */ export declare const C2S_EXT_RUN = 144; /** Upload a chunk: [0x91][nonce:2][flags][hash:32][offset:8][total:8][data] */ export declare const C2S_EXT_PUT = 145; /** Lifecycle verb: [0x92][nonce:2][extension_id:8][action] */ export declare const C2S_EXT_CONTROL = 146; export declare const S2C_EXT_STATUS = 144; export declare const S2C_EXT_PUT_STATUS = 145; export declare const S2C_EXT_INFO = 146; export declare const EXT_INFO_LIST = 2; export declare const EXT_RUN_DETACH: number; export declare const EXT_RUN_PERSIST: number; export declare const EXT_RUN_UPDATE: number; export declare const EXT_FLAG_DETACH: number; export declare const EXT_FLAG_PERSIST: number; export declare const EXT_FLAG_ENABLED: number; export declare const EXT_FLAG_DESIRED_RUNNING: number; export declare const EXT_RESTART_NEVER = 0; export declare const EXT_RESTART_ON_FAILURE = 1; export declare const EXT_RESTART_ALWAYS = 2; export declare const EXT_CONTROL_CANCEL = 1; export declare const EXT_CONTROL_ATTACH = 2; export declare const EXT_CONTROL_UNFOLLOW = 3; export declare const EXT_CONTROL_STATUS = 4; export declare const EXT_CONTROL_RESTART = 5; export declare const EXT_CONTROL_ENABLE = 6; export declare const EXT_CONTROL_DISABLE = 7; export declare const EXT_CONTROL_REMOVE = 8; export declare const EXT_CONTROL_LIST = 9; export declare const EXT_PUT_BEGIN: number; export declare const EXT_PUT_FINAL: number; /** The server already has this object; stop uploading. */ export declare const EXT_PUT_STATUS_ALREADY_HAVE = 128; /** Phases, in the order a definition moves through them. */ export declare const EXT_PHASE_NONE = 0; export declare const EXT_PHASE_NEED_OBJECT = 1; export declare const EXT_PHASE_QUEUED = 2; export declare const EXT_PHASE_STARTING = 3; export declare const EXT_PHASE_RUNNING = 4; export declare const EXT_PHASE_BACKOFF = 5; export declare const EXT_PHASE_STOPPED = 6; export declare const EXT_PHASE_BLOCKED = 7; export declare const EXT_PHASE_STOPPING = 8; export declare const EXT_PHASE_NAMES: Readonly>; /** 64 MiB, and one upload chunk stays inside the frame limit. */ export declare const EXT_MAX_MODULE: number; export declare const EXT_UPLOAD_CHUNK: number; export declare const EXT_MAX_NAME = 255; /** One extension as the server describes it. */ export interface BlitExtensionRecord { /** Server-boot-scoped identity; `id:<16 hex>` addresses it. */ readonly extensionId: bigint; readonly definitionRevision: bigint; readonly phase: number; readonly flags: number; readonly restart: number; readonly attempt: bigint; readonly lastRunningAttempt: bigint; readonly nextStartUnixMs: bigint; /** BLAKE3 of the module, lowercase hex: the thing a registry can match. */ readonly hash: string; /** Durable name for a persistent definition, a label otherwise. */ readonly name: string; } export interface BlitExtensionStatus { readonly nonce: number; readonly status: number; readonly phase: number; readonly flags: number; readonly restart: number; readonly extensionId: bigint; readonly definitionRevision: bigint; readonly hash: string; readonly detail: string; } export interface BlitExtensionPutStatus { readonly nonce: number; readonly status: number; readonly hash: string; readonly received: bigint; readonly detail: string; } export type ExtensionMessage = { kind: "status"; status: BlitExtensionStatus; } | { kind: "put-status"; status: BlitExtensionPutStatus; } | { kind: "list"; nonce: number; status: number; records: BlitExtensionRecord[]; }; export interface ExtensionRunRequest { nonce: number; flags: number; restart: number; /** CAS token for an update; zero when creating. */ expectedExtensionId?: bigint; expectedDefinitionRevision?: bigint; /** 32 bytes. */ hash: Uint8Array; name: string; args?: readonly string[]; } /** Parse a 64-character BLAKE3 digest. Returns null on anything else. */ export declare function parseModuleDigest(text: string): Uint8Array | null; export declare function buildExtensionRunMessage(request: ExtensionRunRequest): Uint8Array; export declare function buildExtensionPutMessage(nonce: number, flags: number, hash: Uint8Array, offset: bigint, totalSize: bigint, data: Uint8Array): Uint8Array; export declare function buildExtensionControlMessage(nonce: number, extensionId: bigint, action: number): Uint8Array; /** Decode one server-to-client extension packet, or null if it is not one. */ export declare function parseExtensionMessage(bytes: Uint8Array): ExtensionMessage | null; /** `id:<16 hex>`, the form `blit ext` prints and accepts. */ export declare function formatExtensionId(extensionId: bigint): string; //# sourceMappingURL=extension.d.ts.map