UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

60 lines • 3.04 kB
import { type HttpResponse } from '../utils/http.ts'; /** * Opt in by assigning a debug sink, as Python's module logger is off until * configured: a cookie file curl cannot read or write is skipped silently. */ export declare const logger: { debug?: (message: string) => void; }; /** * The headers -H sends, and every name it mentions. * * curl's reading of each line: `Name: value` sends the header, `Name:` with * nothing after it sends nothing and still stops curl adding its own of that * name, `Name;` sends it empty, and a line with neither separator is * dropped. The value loses its leading blanks only. A name given twice in any * case is one header whose values are joined with `, `, a deliberate * divergence from curl, which sends two lines: fetch merges them so, and RFC * 9110 reads the two forms alike. */ export declare function headerLines(values: readonly string[]): [[string, string][], Set<string>]; /** * The request curl -v shows, as far as mirage can see it. * * Only what leaves mirage is dumped: the request line, Host, the headers in * curl's order, and the two a -d body adds. curl's `*` transport lines * (resolving, connecting, TLS) have no source here and are omitted, as are * the headers the HTTP stack appends on its own and a -F body's encoding, * which the client builds. `headers` is every header between Host and the * body's own, in the order curl sends them; `bodyType` is the Content-Type * curl added for the body itself, null when the line named one or there is * no body. */ export declare function requestLines(url: string, method: string, headers: readonly [string, string][], bodyLen: number | null, bodyType: string | null): string[]; /** * curl's escaping for --data-urlencode: everything but letters, digits and * `-._~` becomes `%XX`, and a space then becomes `+` (curl 8.14.1). */ export declare function urlEncoded(data: Uint8Array): string; /** * The Authorization value -u sends, and the prompt it costs. A user without * a `:` has curl ask for the password on stderr and read it from stdin, * which is all a workspace has: the bytes it read minus the last one, which * curl takes to be the newline. */ export declare function basicAuth(user: string, stdin: Uint8Array): [string, Uint8Array]; /** * The status line and headers -i, -I and -v print. * * Three deliberate divergences from curl, which prints the bytes as * received: names render lowercase, because fetch never exposes the wire * casing; they come sorted by name, because the Headers class iterates * that way and wire order is gone by then; and the version always reads * HTTP/1.1, because fetch cannot observe it. Both hosts therefore print * one shape. */ export declare function responseLines(resp: HttpResponse): string[]; /** A message curl or wget prints, nothing when the line silenced it. */ export declare function said(quiet: boolean, text: string): Uint8Array; export declare const GENERAL_CURL: import("../../config.ts").Command[]; //# sourceMappingURL=curl.d.ts.map