feat(analysis): make resource budgets recoverable across CLI and MCP (#9706)

* refactor(analysis): centralize resource budgets and recovery facts

* feat(analysis): expose ASAR and Ghidra runtime admission controls

* feat(artifacts): expose reader admission and preserve limited recognition

* feat(javascript): expose recoverable semantic precision budgets

* feat(web): add recoverable source-map budgets and compact retained views

* feat(web): make historical capture decoding budgets recoverable

* fix(desktop): enforce selected view policies across capture and export

* feat(runtime): make Frida and LLDB retention budgets selectable

* feat(native): expose diagnostic budgets and preserve exhaustion causes

* feat(managed): expose recoverable snapshot and representation budgets

* feat(metadata): make Go and Rust inspection budgets recoverable

* feat(wasm): expose representation and producer admissions

* feat(evm): expose per-call worker resource budgets

* feat(android): make resource and string-pool omissions recoverable

* feat(producers): expose command and recorded-capture budgets

* docs(analysis): record recovery contracts and integrated validation

* fix(docs): link calibration oracle from published verification pages

* fix(docs): restore desktop task anchors and receipt links

* test(analysis): align fixtures with selectable budget contracts

* fix(analysis): remove source-location projector dependency cycle

* test(analysis): refresh budget recovery and verifier regressions

* test(analysis): preserve format and publication recovery expectations

* test(windows): align conformance with owned runtime admission

* fix(desktop): preserve selected alias kinds in exported state

* test(analysis): align provider fixtures with recoverable budgets

* test(desktop): validate emitted alias metadata structurally

* fix(ghidra): classify bounded Windows endpoint refusals

* test(cli): assert selectable artifact admission recovery

* fix(cli): preserve capture provenance in environment builds
This commit is contained in:
morluto authored and GitHub committed 2026-11-10 05:11:20 -05:00
1 parent 55b6d2ca20
commit cb4e5cfbff
515 files changed
+21066 -3637

No files matched your search

+53 -21
View File
@@ -39,6 +39,8 @@ import { inspectManagedMembersBytes } from "./ManagedMemberInspector.js";
import { inspectManagedNativeBoundariesBytes } from "./ManagedNativeBoundaryInspector.js";
import { RegularFileCleanupFailure } from "../filesystem/OwnedRegularFile.js";
import { managedInspectionInputFailure } from "./ManagedReaderFailure.js";
import { analysisInputErrorFromIssues } from "../domain/inputIssueProjection.js";
import type { z } from "zod";
import {
hashManagedSource,
managedCleanupError,
@@ -96,6 +98,26 @@ class ManagedStaticClient implements AnalysisClient {
),
);
try {
const input =
operation === "inspect_managed_members"
? managedMembersInputSchema.safeParse(parameters)
: managedTargetInputSchema.safeParse(parameters);
if (!input.success)
return err(
analysisInputErrorFromIssues(
operation,
input.error.issues,
parameters,
),
);
const snapshotOptions = {
expectedSha256: this.target.sha256,
signal: options?.signal,
resources: this.#resources,
...(input.data.max_snapshot_bytes === undefined
? {}
: { maxBytes: input.data.max_snapshot_bytes }),
};
if (options?.signal?.aborted === true)
return err(
new AnalysisCancelledError(operation, {
@@ -105,16 +127,16 @@ class ManagedStaticClient implements AnalysisClient {
const snapshot = this.#snapshotBytes;
const observed =
snapshot === undefined
? await readManagedSnapshot(this.target.path, operation, {
expectedSha256: this.target.sha256,
signal: options?.signal,
resources: this.#resources,
})
: await hashManagedSource(this.target.path, operation, {
expectedSha256: this.target.sha256,
signal: options?.signal,
resources: this.#resources,
});
? await readManagedSnapshot(
this.target.path,
operation,
snapshotOptions,
)
: await hashManagedSource(
this.target.path,
operation,
snapshotOptions,
);
const admitted = verifyManagedSourceIdentity(
this.target,
observed,
@@ -127,7 +149,7 @@ class ManagedStaticClient implements AnalysisClient {
this.#snapshotBytes = bytes;
const result = inspectManagedOperation(
operation,
parameters,
input.data,
bytes,
this.target,
);
@@ -202,7 +224,7 @@ const isManagedOperation = (
const inspectManagedOperation = (
operation: ManagedToolName,
parameters: Readonly<Record<string, JsonValue>>,
parameters: Omit<z.output<typeof managedMembersInputSchema>, "detail">,
bytes: Buffer,
target: BinaryTarget,
):
@@ -210,19 +232,29 @@ const inspectManagedOperation = (
| ManagedMemberInspection
| ManagedNativeBoundaryInspection => {
if (operation === "inspect_managed_members") {
const { type_names: typeNames } =
managedMembersInputSchema.parse(parameters);
return inspectManagedMembersBytes(
const { type_names: typeNames } = parameters;
return inspectManagedMembersBytes(bytes, target, {
...(typeNames === undefined ? {} : { typeNames }),
...(parameters.max_metadata_representation_bytes === undefined
? {}
: {
maxRepresentationBytes:
parameters.max_metadata_representation_bytes,
}),
});
}
if (operation === "inspect_managed_artifact") {
return inspectManagedArtifactBytes(
bytes,
target,
typeNames === undefined ? {} : { typeNames },
parameters.max_metadata_representation_bytes,
);
}
managedTargetInputSchema.parse(parameters);
if (operation === "inspect_managed_artifact") {
return inspectManagedArtifactBytes(bytes, target);
}
return inspectManagedNativeBoundariesBytes(bytes, target);
return inspectManagedNativeBoundariesBytes(
bytes,
target,
parameters.max_metadata_representation_bytes,
);
};
const managedLocations = (