feat(analysis): add bounded memory and call tracing
This commit is contained in:
@@ -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. */
|
||||
|
||||
@@ -75,7 +75,7 @@ const CAPABILITIES: readonly CapabilityDescriptor[] = Object.freeze(
|
||||
}),
|
||||
limits: Object.freeze({
|
||||
maxResults: null,
|
||||
maxPayloadBytes: null,
|
||||
maxPayloadBytes: contract.name === "read_bytes" ? 4_096 : null,
|
||||
timeoutMs: null,
|
||||
}),
|
||||
limitations: Object.freeze([
|
||||
|
||||
@@ -19,6 +19,7 @@ const responseSchema = z.union([
|
||||
"remote",
|
||||
"authorization",
|
||||
"invalid_request",
|
||||
"capability_unavailable",
|
||||
"bridge_exception",
|
||||
])
|
||||
.default("remote"),
|
||||
|
||||
Reference in New Issue
Block a user