feat(analysis): add bounded memory and call tracing

This commit is contained in:
morluto
2026-07-24 13:14:01 +00:00
parent 205bf1529b
commit 8e7709d35a
21 changed files with 1025 additions and 188 deletions
+15 -2
View File
@@ -5,11 +5,13 @@ import { tmpdir } from "node:os";
import { join } from "node:path";
import {
AnalysisCapabilityUnavailableError,
HopperCancelledError,
type AnalysisError,
type HopperError,
HopperProcessError,
HopperProtocolError,
HopperRemoteError,
HopperStartError,
hopperStartupFailure,
HopperTimeoutError,
@@ -279,10 +281,21 @@ export class HopperClient {
readonly timeoutMs?: number;
readonly progress?: ProgressReporter;
} = {},
): Promise<Result<JsonValue, HopperError>> {
): Promise<Result<JsonValue, AnalysisError>> {
const started = await this.start(options.signal);
if (!started.ok) return started;
return this.#request(name, arguments_, options);
const result = await this.#request(name, arguments_, options);
return !result.ok &&
result.error instanceof HopperRemoteError &&
result.error.diagnosticType === "capability_unavailable"
? err(
new AnalysisCapabilityUnavailableError(
"hopper",
name,
result.error.safeMessage,
),
)
: result;
}
/** Stop the bridge, settle outstanding requests, and remove session artifacts. */