/** * Sprite filesystem activities (#848) — imperative file-I/O primitives over the * Sprites filesystem API (`/v1/sprites/{id}/fs/*`). Same category as the * lifecycle activities in `sprites.ts`: runtime-orchestration primitives, no * desired state. They let an Op stage an input file into a sprite and read a * result out without shelling it through `spriteExec` + `cat`/`tee`. * * read/write move raw file bytes in the body (not JSON), so these use a small * raw HTTP client (`SpritesRawHttp`) rather than the JSON `SpritesHttp` the * lifecycle activities use; path/mode/mkdir/recursive ride as query params. * Endpoint + bearer resolution mirror `sprites.ts` — an explicit `endpoint` / * `token` wins, then `SPRITES_BASE_URL` / `SPRITES_API_TOKEN`. */ /** * Build a `/v1/sprites/{id}/fs/{op}?...` URL. `params` values that are undefined * or empty are dropped so the query only carries what the caller set. Pure. */ export declare function spriteFsUrl(base: string, id: string, op: "read" | "write" | "list" | "delete", params: Record): string; /** * Injectable raw HTTP client — like `SpritesHttp` but the body is sent verbatim * (a file's bytes as a string), not JSON-encoded, and the response `text` is the * raw body. Tests inject a fake; the default hits `fetch`. */ export type SpritesRawHttp = (method: string, url: string, body?: string, headers?: Record, signal?: AbortSignal) => Promise<{ status: number; text: string; }>; /** * Default `fetch`-based raw client. Sends the body as-is with an * `application/octet-stream` content-type and `Authorization: Bearer ` * when a token is set (real Sprites); the fake ignores the token. The token * defaults to `SPRITES_API_TOKEN` at call time. `fetchImpl` is injectable. */ export declare function defaultSpritesRawHttp(token?: string, fetchImpl?: typeof fetch): SpritesRawHttp; export interface SpriteWriteFileArgs { /** Target sprite id (the `name` passed to `spriteCreate`). */ id: string; /** Absolute path (or relative to `workingDir`) to write. */ path: string; /** File contents. */ content: string; /** Octal file mode, e.g. `"0644"`. */ mode?: string; /** Create missing parent directories. */ mkdir?: boolean; /** Base directory for a relative `path`. */ workingDir?: string; endpoint?: string; token?: string; } export interface SpriteReadFileArgs { id: string; path: string; workingDir?: string; endpoint?: string; token?: string; } export interface SpriteReadFileResult { content: string; } export interface SpriteListDirArgs { id: string; path: string; workingDir?: string; endpoint?: string; token?: string; } /** One directory entry. `type` is `file` or `dir`. */ export interface SpriteDirEntry { name: string; type: "file" | "dir"; size?: number; } export interface SpriteRemoveArgs { id: string; path: string; /** Remove a directory and its contents. */ recursive?: boolean; /** Perform the delete as root. */ asRoot?: boolean; workingDir?: string; endpoint?: string; token?: string; } /** Write a file into the sprite. `PUT /v1/sprites/{id}/fs/write` with raw body. */ export declare function spriteWriteFile(args: SpriteWriteFileArgs, signal?: AbortSignal, http?: SpritesRawHttp): Promise>; /** Read a file from the sprite. `GET /v1/sprites/{id}/fs/read` → raw body. */ export declare function spriteReadFile(args: SpriteReadFileArgs, signal?: AbortSignal, http?: SpritesRawHttp): Promise; /** List a directory in the sprite. `GET /v1/sprites/{id}/fs/list` → entry array. */ export declare function spriteListDir(args: SpriteListDirArgs, signal?: AbortSignal, http?: SpritesRawHttp): Promise; /** * Remove a path in the sprite. `DELETE /v1/sprites/{id}/fs/delete`. Idempotent: * a 404 (already gone) is a no-op, matching `rm -f` and the destroy activity. */ export declare function spriteRemove(args: SpriteRemoveArgs, signal?: AbortSignal, http?: SpritesRawHttp): Promise>; //# sourceMappingURL=sprite-fs.d.ts.map