#!/usr/bin/env node /** * Starts the compression proxy and prints the URL to point a client at. * * WHY A SEPARATE ENTRYPOINT. `startProxy` was reachable only as a library * function, so nothing could actually run it: not a user, not `doctor`, and not * the THOL rig, which launches a client inside a container and has nowhere to * call a TypeScript function from. The compression work therefore had no * end-to-end measurement available at all -- a gap that reads like "not * measured yet" and is really "cannot be measured yet". * * The output contract is deliberately narrow so a launcher can consume it: * * STDOUT is exactly one line, the base URL. * STDERR carries the banner and the per-request summaries. * * Nothing else is ever written to stdout, so a shell can capture it without * filtering, and a summary line can never be mistaken for the URL. */ interface Args { readonly port: number; readonly upstream?: string; readonly preset?: string; readonly posture?: string; readonly projectRoot?: string; readonly quiet: boolean; readonly spill: boolean; readonly help: boolean; /** * Print what the named posture sets and exit, instead of listening. * * NOT A MODE OF THE PROXY, A QUESTION ABOUT A POSTURE. An operator who runs * their agent under their own launcher still wants the posture's dials; with * no way to read them out, the only way to get them is to run our proxy, and * a posture would be a setting you cannot adopt without adopting the channel. */ readonly printEnv: boolean; /** Print that set as a JSON object rather than shell exports. */ readonly json: boolean; } /** * Whether the environment asks for spilling. * * SPILL WAS FLAG-ONLY, and that meant only a hand-started proxy could withhold * anything: the SUPERVISED proxy -- the one a client's base URL actually points * at -- had no way to be told, so measuring the fetch rate on real traffic * would have needed every client repointed at an ad-hoc port that dies with * the shell that started it. * * IT IS CONSENT-BEARING and must never be seeded by a posture. Withholding * takes content out of a request and buys it back with a round trip, which is * a decision about someone's traffic rather than a dial -- the same reason * TOKEN_OPTIMIZER_PROXY_CAPTURE and ..._ACCOUNTING are operator-set only. * * Unset is off, and the words an operator reaches for to mean off are honoured * rather than read as a truthy string. */ export declare function spillFromEnv(env?: NodeJS.ProcessEnv): boolean; export declare function parseArgs(argv: readonly string[]): Args; /** * One value, quoted so a shell hands it back unchanged. * * SINGLE QUOTES, NOT JSON. A JSON string is double-quoted, and a double-quoted * shell word still expands `$`, a backtick and a backslash -- so the moment a * posture carried a value with one of those in it, `eval` would adopt something * other than what we printed. Inside single quotes a shell expands nothing; the * only character that needs handling is the quote itself, which closes the * string, is escaped outside it, and is reopened after. * * Exported for its own test: no posture carries a quote today, so a test that * only read real postures would pass with no quoting at all. */ export declare function shellQuote(value: string): string; export declare function run(argv: readonly string[]): Promise; export {}; //# sourceMappingURL=cli.d.ts.map