mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 19:53:50 +00:00
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:
1 parent
55b6d2ca20
commit
cb4e5cfbff
515 files changed
+21066
-3637
No files matched your search
@@ -1,3 +1,6 @@
|
||||
import { desktopLibraryPolicyInputSchema } from "../domain/desktop/libraryPolicy.js";
|
||||
import { desktopViewPolicyInputSchema } from "../domain/desktop/desktopViewPolicy.js";
|
||||
import { safeParseJson } from "../domain/safeJson.js";
|
||||
import { createInterface } from "node:readline";
|
||||
|
||||
import { z } from "incur";
|
||||
@@ -27,11 +30,52 @@ import { SessionRequestQueue } from "../desktop/DesktopSessionRequests.js";
|
||||
import { withCommandCancellation } from "./commandCancellation.js";
|
||||
import type { CliInstance } from "./types.js";
|
||||
|
||||
/** One coherent view policy; invalid JSON and unknown controls fail at admission. */
|
||||
const viewPolicyOption = z
|
||||
.string()
|
||||
.transform((text, context) => {
|
||||
const parsed = safeParseJson(text);
|
||||
if (!parsed.ok) {
|
||||
context.addIssue({
|
||||
code: "custom",
|
||||
message: "view-policy must be a JSON object",
|
||||
});
|
||||
return z.NEVER;
|
||||
}
|
||||
return parsed.value;
|
||||
})
|
||||
.pipe(desktopViewPolicyInputSchema)
|
||||
.optional()
|
||||
.describe(
|
||||
"JSON budget overrides: file_bytes, sqlite_tables, sqlite_rows, sqlite_view_bytes, text_lines, xml_nodes, xml_depth, parsed_bytes, json_depth, zip_entries, zip_entry_bytes, zip_bytes, zip_ratio. Positive safe integers. Applies on this call and to exported readers; no restart. Does not recover bytes the capture never retained or raise Evidence/worker limits.",
|
||||
);
|
||||
|
||||
/** Caller-selected inventory headroom; does not raise content-retention budgets. */
|
||||
const libraryPolicyOption = z
|
||||
.string()
|
||||
.transform((text, context) => {
|
||||
const parsed = safeParseJson(text);
|
||||
if (!parsed.ok) {
|
||||
context.addIssue({
|
||||
code: "custom",
|
||||
message: "library-policy must be a JSON object",
|
||||
});
|
||||
return z.NEVER;
|
||||
}
|
||||
return parsed.value;
|
||||
})
|
||||
.pipe(desktopLibraryPolicyInputSchema)
|
||||
.optional()
|
||||
.describe(
|
||||
"JSON dependency inventory budgets: libraries (default 512, also per-image DT_NEEDED entries), search_path_entries (16 distinct offsets per DT_RUNPATH/DT_RPATH kind), string_bytes (4096 per string including NUL), table_bytes (1048576 per ELF program/dynamic table). Positive safe integers; applies to this capture without restart. Does not raise content or query-output budgets.",
|
||||
);
|
||||
|
||||
const positive = (fallback: number) =>
|
||||
cliDecimalField(z.int().positive().default(fallback));
|
||||
|
||||
/** Options of `capture-desktop-application`. */
|
||||
const captureOptions = z.object({
|
||||
libraryPolicy: libraryPolicyOption,
|
||||
desktopEntry: z
|
||||
.string()
|
||||
.min(1)
|
||||
@@ -150,8 +194,8 @@ const withStateReaders = async (
|
||||
return finishAnalysisCommand(
|
||||
async () => {
|
||||
const result = await run({
|
||||
sqlite: (database, readSignal) =>
|
||||
readSqliteStateView(sqlite, database, readSignal),
|
||||
sqlite: (database, readSignal, policy) =>
|
||||
readSqliteStateView(sqlite, database, readSignal, policy),
|
||||
dconf: (database, readSignal) =>
|
||||
dumpDconfDatabase(database, environment, readSignal),
|
||||
});
|
||||
@@ -271,6 +315,7 @@ const registerDesktopExportCommand = (
|
||||
),
|
||||
}),
|
||||
options: z.object({
|
||||
viewPolicy: viewPolicyOption,
|
||||
name: z
|
||||
.string()
|
||||
.optional()
|
||||
@@ -351,6 +396,7 @@ const registerDesktopExportCommand = (
|
||||
? undefined
|
||||
: absoluteCallerPath(options.screens),
|
||||
...withheldRequestOf(options),
|
||||
viewPolicy: options.viewPolicy,
|
||||
},
|
||||
readers,
|
||||
signal,
|
||||
@@ -376,7 +422,7 @@ const registerDesktopTaskCommand = (
|
||||
"Folder written by capture-desktop-application",
|
||||
),
|
||||
}),
|
||||
options: z.object(checkpointOptions),
|
||||
options: z.object({ ...checkpointOptions, viewPolicy: viewPolicyOption }),
|
||||
run: ({ args, options }) =>
|
||||
withCommandCancellation((signal) =>
|
||||
logCliCommand(
|
||||
@@ -399,6 +445,7 @@ const registerDesktopTaskCommand = (
|
||||
end: options.endCheckpoint,
|
||||
withhold: withholdOf(options),
|
||||
},
|
||||
options.viewPolicy,
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -421,7 +468,16 @@ const registerDesktopStateCommand = (
|
||||
"Folder written by capture-desktop-application",
|
||||
),
|
||||
}),
|
||||
run: ({ args }) =>
|
||||
options: z.object({
|
||||
viewPolicy: viewPolicyOption,
|
||||
statePath: z
|
||||
.array(z.string().min(1))
|
||||
.optional()
|
||||
.describe(
|
||||
"Exact original captured path to inspect (repeatable); omission examines every path",
|
||||
),
|
||||
}),
|
||||
run: ({ args, options }) =>
|
||||
withCommandCancellation((signal) =>
|
||||
logCliCommand(
|
||||
logger,
|
||||
@@ -438,6 +494,7 @@ const registerDesktopStateCommand = (
|
||||
absoluteCallerPath(args.capture),
|
||||
readers,
|
||||
signal,
|
||||
{ viewPolicy: options.viewPolicy, paths: options.statePath },
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -477,6 +534,9 @@ export const registerDesktopCaptureCommands = (
|
||||
output: options.output,
|
||||
statePaths: options.statePath ?? [],
|
||||
excludes: options.exclude ?? [],
|
||||
...(options.libraryPolicy === undefined
|
||||
? {}
|
||||
: { libraryPolicy: options.libraryPolicy }),
|
||||
maxDurationSeconds: options.maxDurationSeconds,
|
||||
maxEntries: options.maxEntries,
|
||||
maxFileBytes: options.maxFileBytes,
|
||||
|
||||
Reference in new issue
Block a user