chore(release): harden package artifacts
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
const MAX_LINE_BYTES = 10 * 1024 * 1024;
|
||||
const SESSION_ROOT = process.platform === "darwin" ? "/tmp" : tmpdir();
|
||||
|
||||
/** Dependencies, deadlines, and redacted diagnostics for one bridge client. */
|
||||
export interface HopperClientOptions {
|
||||
readonly launcher: BridgeLauncher;
|
||||
readonly requestTimeoutMs?: number;
|
||||
@@ -30,6 +31,7 @@ export interface HopperClientOptions {
|
||||
readonly onDiagnostic?: (event: HopperDiagnostic) => void;
|
||||
}
|
||||
|
||||
/** Safe launcher telemetry; stderr content is intentionally never exposed. */
|
||||
export type HopperDiagnostic =
|
||||
| { readonly type: "launcher-stderr"; readonly bytes: number }
|
||||
| { readonly type: "launcher-exit"; readonly code: number | null };
|
||||
@@ -46,7 +48,14 @@ interface PendingRequest {
|
||||
readonly onAbort: (() => void) | undefined;
|
||||
}
|
||||
|
||||
/** Owned client for the repository's authenticated in-Hopper bridge. */
|
||||
/**
|
||||
* Owns one authenticated NDJSON-over-Unix-socket bridge session.
|
||||
*
|
||||
* Each instance creates a private directory and random bearer token, correlates
|
||||
* concurrent requests by numeric id, and removes its artifacts on close. It
|
||||
* only terminates launch processes explicitly marked as owned; the normal
|
||||
* Hopper launcher does not confer ownership of the GUI application.
|
||||
*/
|
||||
export class HopperClient {
|
||||
readonly #options: Required<
|
||||
Pick<HopperClientOptions, "requestTimeoutMs" | "startupTimeoutMs">
|
||||
@@ -71,7 +80,7 @@ export class HopperClient {
|
||||
};
|
||||
}
|
||||
|
||||
/** Launch Hopper's owned bridge and complete its health handshake. */
|
||||
/** Launch the bridge once and complete its authenticated health handshake. */
|
||||
start(): Promise<Result<HopperServerInfo, HopperError>> {
|
||||
this.#startPromise ??= this.#start();
|
||||
return this.#startPromise;
|
||||
@@ -82,7 +91,7 @@ export class HopperClient {
|
||||
return err(new HopperProtocolError("Hopper client is already started"));
|
||||
}
|
||||
try {
|
||||
this.#directory = await mkdtemp(join(SESSION_ROOT, "bbm-"));
|
||||
this.#directory = await mkdtemp(join(SESSION_ROOT, "rea-"));
|
||||
} catch (cause: unknown) {
|
||||
return err(new HopperStartError({ cause }));
|
||||
}
|
||||
@@ -120,7 +129,7 @@ export class HopperClient {
|
||||
return parsed;
|
||||
}
|
||||
|
||||
/** Invoke one declared Hopper operation through the bridge. */
|
||||
/** Invoke one declared operation, returning timeout and cancellation as values. */
|
||||
async callTool(
|
||||
name: string,
|
||||
arguments_: Readonly<Record<string, JsonValue>> = {},
|
||||
|
||||
Reference in New Issue
Block a user