mirror of
https://github.com/morluto/rea.git
synced 2026-11-17 04:04:25 +00:00
* refactor(native): bind producer_limits and max_input_bytes as the per-call controls of pwntools and Apple dispatch refusals producerLimitControl in src/domain/producerResourceLimits.ts names one producer budget as producer_limits.<field>; the shared provider outcome classifier now carries a resource signal's limit. Pwntools file-size, CPU and output refusals and the Apple dispatch input refusal bind their control, and their remediation no longer names CLI flags. * fix(native): report the selected output allowance as the omitted file_bytes default * fix(native): bind producer_limits.diagnostic_bytes as the pwntools command output-limit control * refactor(rust): bind producer_limits as the per-call control of Rust input and report refusals (#11458) * refactor(rust): bind producer_limits as the per-call control of Rust input and report refusals * test(rust): cover the complete-report refusal's producer_limits control * refactor(browser): bind caller-selectable browser deadlines as per-call controls instead of naming CLI flags (#11466) * refactor(rust): bind producer_limits as the per-call control of Rust input and report refusals * test(rust): cover the complete-report refusal's producer_limits control * refactor(browser): bind caller-selectable browser deadlines as per-call controls instead of naming CLI flags deadlineParameterLimit in src/domain/analysisResourceLimits.ts owns the millisecond deadline control that nativeDeadlineRecovery and the browser recoveries share. CDP command and discovery, web bundle per-script and total, network capture and source-map decode deadlines now carry it; browserDeadlineIncrease no longer takes CLI flag text. * fix(browser): record a per-script deadline's parameter control in partial web bundle results * refactor(providers): bind Wabt, SQLite, EVMole, Apktool and Go controls instead of naming CLI commands (#11472) * refactor(providers): bind Wabt, SQLite, EVMole and Apktool deadline and byte controls instead of naming CLI commands These remediation strings named rea commands and flags through template text the cli-option guard did not count. Wabt byte refusals and output limits bind max_input_bytes, max_tool_bytes or max_output_bytes while a larger value is selectable; SQLite worker_timeout_ms, EVMole timeout_ms and Apktool decode_timeout_ms bind through deadlineParameterLimit; the shared provider outcome classifier now carries an output limit's control. * refactor(go): bind Go analysis budgets as per-call controls instead of naming CLI flags * fix(providers): keep the typed primary when Wabt, EVMole or pwntools command cleanup fails * ci(guards): count template-built CLI option and command text outside the CLI layer (#11478) * refactor(providers): bind Wabt, SQLite, EVMole and Apktool deadline and byte controls instead of naming CLI commands These remediation strings named rea commands and flags through template text the cli-option guard did not count. Wabt byte refusals and output limits bind max_input_bytes, max_tool_bytes or max_output_bytes while a larger value is selectable; SQLite worker_timeout_ms, EVMole timeout_ms and Apktool decode_timeout_ms bind through deadlineParameterLimit; the shared provider outcome classifier now carries an output limit's control. * refactor(go): bind Go analysis budgets as per-call controls instead of naming CLI flags * fix(providers): keep the typed primary when Wabt, EVMole or pwntools command cleanup fails * ci(guards): count template-built CLI option and command text outside the CLI layer The cli-option-text-outside-cli pattern now also matches "(CLI ...", "on the CLI", "or use rea ..." and backticked `rea <command>` references, so remediation built from a template such as --${name} or rea inspect-... <path> is counted. Doctor.ts is exempt: setup and doctor run only through the CLI. The baseline records the newly counted pre-existing sites (22 -> 45 across 21 files). * ci(guards): extract the CLI text matcher, exempt host-only commands with written reasons, and test each spelling * ci(guards): exempt a host-only command and its own arguments in any matched CLI phrase * fix(native): bind producer_limits.output_bytes for oversized pwndbg debugger replies through one owner * fix(cli): name an Evidence target source failure's control by the source option that sets it * feat(cli): render the flags of result-recorded controls in the full-output envelope (#11507) * feat(cli): render the flags of result-recorded controls in the full-output envelope * fix(cli): collect result controls only for a full-output envelope, in its requested format, past undefined values * ci(guards): end a host-only command's arguments before the next CLI command * refactor(reverse): record the output budget that stopped a one-shot command as a parameter control (#11528) * fix(cli): read result controls only at positions the output schema declares as recorded controls * refactor(providers): record the controls that bounded Rust compiler paths and kernel module text instead of naming CLI options (#11532) * refactor(rust): record the control that bounded compiler-path coverage instead of naming CLI options * refactor(native): record the controls that omitted kernel module .modinfo text instead of naming CLI options (#11534) * fix(rust): describe compiler coverage from the retained result after report trimming * refactor(providers): record managed representation and JavaScript semantic ceiling controls instead of naming CLI options (#11537) * refactor(managed): record the representation budget on a resource-limit issue instead of naming its CLI option * refactor(javascript): record the semantic retention ceilings that stopped a graph instead of naming CLI options (#11540) * fix(cli): name a composed command's source options for the controls its result records * fix(cli): read result controls from the delivered Evidence when a summary wraps it * fix(rust): keep the report-byte control recorded when trimming omits every compiler path When the complete-report allowance left room for no compiler path, rustc_commit became null and its coverage.limit was lost, so --full-output could not name the option that raises the allowance. The report now records rustc_commit_omission { reason, limit } outside the dropped record, and the summary view carries it. * refactor(flutter): record the string-pool budgets that left a projection partial instead of naming the CLI option (#11541) * refactor(flutter): record the string-pool budgets that left a projection partial instead of naming the CLI option * test(flutter): assert the complete set of recorded string-pool budgets * feat(cli): name the options of controls a failure's partial Evidence records (#11557) meta.cli_controls was collected only from a successful result. A failure whose partial observation is Evidence of the command's own operation is now read the same way, at the positions the output schema declares as recorded controls; Evidence of another operation or a retained reference is not read. When --evidence_output publishes the partial, the delivery records it before replacing it. * refactor(javascript): record the evaluator budgets that limited sources instead of naming the CLI option (#11564) Per-value unknown reasons and the Electron wrapper limitation named --semantic-precision. The static examination now records the semantic_precision controls that limited a source (examination.controls), and analyze_javascript_application's semantic_graph.coverage.controls records every evaluator budget that limited any source (examination and semantic IR coverage), beside the retention ceilings. The CLI renders --semantic-precision from those records in meta.cli_controls; the reason texts name only the contract field.
165 lines
6.3 KiB
TypeScript
165 lines
6.3 KiB
TypeScript
import { deadlineParameterLimit } from "./analysisResourceLimits.js";
|
|
import {
|
|
localSourceMapLimitsSchema,
|
|
WEB_SOURCE_MAP_LIMITS,
|
|
} from "./sourceMapLimits.js";
|
|
import { z } from "zod";
|
|
import {
|
|
browserDeadlineIncrease,
|
|
type BrowserDeadlineRecovery,
|
|
browserDeadlineRetry,
|
|
optionalBrowserDeadlineMs,
|
|
} from "./browserDeadline.js";
|
|
import { digestSchema } from "./digests.js";
|
|
import { absoluteLocalPathStringSchema } from "./localPath.js";
|
|
import { exportedWebScriptSchema } from "./webScriptExport.js";
|
|
import {
|
|
capturedWebManifestIdentitySchema,
|
|
selectedWebScriptInputSchema,
|
|
webArtifactFileSchema,
|
|
} from "./webScriptArtifacts.js";
|
|
|
|
/** JavaScript source-map positions use UTF-16 columns and one-based lines. */
|
|
export const webSourcePositionSchema = z.strictObject({
|
|
line: z.int().min(1),
|
|
column: z.int().min(0),
|
|
});
|
|
|
|
/** Trace one explicit generated position through an explicitly paired local map. */
|
|
export const webSourceLocationInputSchema = selectedWebScriptInputSchema.extend(
|
|
{
|
|
source_map: z.strictObject({
|
|
path: absoluteLocalPathStringSchema.describe(
|
|
"Absolute local source-map path; no fetch",
|
|
),
|
|
url: z
|
|
.string()
|
|
.min(1)
|
|
.describe(
|
|
"Explicit source-map URL context used to resolve original source names",
|
|
),
|
|
}),
|
|
generated_position: webSourcePositionSchema,
|
|
source_map_limits: localSourceMapLimitsSchema
|
|
.exactOptional()
|
|
.describe(
|
|
"Per-call source-map admission, decoder and representation budgets. Omitted fields preserve existing defaults; changes apply on the next call without restart.",
|
|
),
|
|
decode_timeout_ms: optionalBrowserDeadlineMs(
|
|
"Source-map decode deadline in milliseconds (default 20000), for the owned codec process. Omitted means 20000 and applies on the next trace_web_source_location call. deadlineExpired returns no partial mapping. Byte, record and heap budgets are independent; select source_map_limits to change them.",
|
|
),
|
|
},
|
|
);
|
|
export type WebSourceLocationInput = z.output<
|
|
typeof webSourceLocationInputSchema
|
|
>;
|
|
|
|
const originalContentSchema = z.discriminatedUnion("state", [
|
|
z.strictObject({
|
|
state: z.literal("embedded"),
|
|
text: z.string(),
|
|
utf8_sha256: digestSchema,
|
|
utf8_bytes: z.int().min(0),
|
|
representation: z.literal("UTF-8 encoding of decoded sourcesContent text"),
|
|
}),
|
|
z.strictObject({
|
|
state: z.literal("unavailable"),
|
|
reason: z.literal("sourcesContent-not-retained"),
|
|
}),
|
|
]);
|
|
|
|
/** Keep every matching segment, including anonymous mappings and duplicate URLs. */
|
|
export const webSourceMapMatchSchema = z.discriminatedUnion("state", [
|
|
z.strictObject({ state: z.literal("generated-only") }),
|
|
z.strictObject({
|
|
state: z.literal("mapped"),
|
|
flattened_source_index: z.int().min(0),
|
|
section_path: z.array(z.int().min(0)),
|
|
source_index: z.int().min(0),
|
|
reported_source: z.string().nullable(),
|
|
reported_source_root: z.string().nullable(),
|
|
resolved_url: z.string().nullable(),
|
|
ignored: z.boolean(),
|
|
content: originalContentSchema,
|
|
original_position: webSourcePositionSchema.extend({
|
|
offset: z.int().min(0).nullable(),
|
|
content_position: z.enum([
|
|
"verified-in-embedded-text",
|
|
"outside-embedded-text",
|
|
"content-unavailable",
|
|
]),
|
|
}),
|
|
name: z.string().nullable(),
|
|
}),
|
|
]);
|
|
|
|
/** Codec observations; map association and deployment authenticity remain selected context. */
|
|
export const webSourceMapReportSchema = z.strictObject({
|
|
source_map_sha256: digestSchema,
|
|
url_context: z.string().min(1),
|
|
engine: z.strictObject({ id: z.string().min(1), version: z.string().min(1) }),
|
|
runtime: z.discriminatedUnion("id", [
|
|
z.strictObject({
|
|
id: z.literal("node-v8"),
|
|
version: z.string().min(1),
|
|
v8_heap_limit_bytes: z.int().min(1),
|
|
}),
|
|
// Bun reports V8-shaped heap statistics but does not enforce V8 heap flags.
|
|
// On Windows REA instead enforces a Job Object commit limit on the codec.
|
|
z.strictObject({
|
|
id: z.literal("bun"),
|
|
version: z.string().min(1),
|
|
node_compatibility_version: z.string().min(1),
|
|
v8_heap_limit_bytes: z.null(),
|
|
process_memory_limit_bytes: z.int().min(1).nullable(),
|
|
}),
|
|
]),
|
|
format: z.enum(["regular", "indexed"]),
|
|
reported_file: z.string().nullable(),
|
|
lookup: z.strictObject({
|
|
requested: webSourcePositionSchema,
|
|
matched_generated_position: webSourcePositionSchema.nullable(),
|
|
semantics: z.literal(
|
|
"greatest generated position <= requested, across lines; all equal-position segments",
|
|
),
|
|
location_units: z.literal("one-based lines; zero-based UTF-16 columns"),
|
|
}),
|
|
matches: z.array(webSourceMapMatchSchema),
|
|
diagnostics: z.array(z.string()),
|
|
});
|
|
|
|
/** Decode deadline used when decode_timeout_ms is omitted. */
|
|
export const DEFAULT_WEB_SOURCE_MAP_DECODE_TIMEOUT_MS =
|
|
WEB_SOURCE_MAP_LIMITS.decodeTimeoutMs;
|
|
|
|
/** Source-map decode deadlineExpired text for trace_web_source_location. */
|
|
export const webSourceMapDecodeTimeoutRecovery = (
|
|
timeoutMs: number,
|
|
): BrowserDeadlineRecovery => ({
|
|
userMessage: `trace_web_source_location reached its ${String(timeoutMs)} ms source-map decode deadline (deadlineExpired) for decode_timeout_ms. No partial mapping is returned. This is not the MCP client deadline.`,
|
|
limit: deadlineParameterLimit(
|
|
"decode_timeout_ms",
|
|
timeoutMs,
|
|
DEFAULT_WEB_SOURCE_MAP_DECODE_TIMEOUT_MS,
|
|
),
|
|
remediationAction: `${browserDeadlineIncrease("decode_timeout_ms", timeoutMs, DEFAULT_WEB_SOURCE_MAP_DECODE_TIMEOUT_MS)} ${browserDeadlineRetry} Byte, record and heap admission are separate per-call source_map_limits fields; changing the deadline does not raise them.`,
|
|
});
|
|
export type WebSourceMapReport = z.output<typeof webSourceMapReportSchema>;
|
|
|
|
/** Selected capture/map byte identities and complete point attribution inline. */
|
|
export const webSourceLocationResultSchema = webSourceMapReportSchema.extend({
|
|
manifest: capturedWebManifestIdentitySchema,
|
|
source: webArtifactFileSchema.extend({
|
|
script_index: z.int().min(0),
|
|
script: exportedWebScriptSchema,
|
|
}),
|
|
source_map: webArtifactFileSchema.extend({
|
|
url: z.string().min(1),
|
|
association: z.literal("caller-selected"),
|
|
}),
|
|
generated_offset: z.int().min(0),
|
|
source_authenticity: z.literal("unknown"),
|
|
execution: z.literal("unknown"),
|
|
limitations: z.array(z.string()),
|
|
});
|