From f29f6834230fd0d3850c558c28af8a43746533c5 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Fri, 24 Jul 2026 13:19:34 +0000 Subject: [PATCH] docs: document roadmap analysis workflows --- AGENTS.md | 15 +- README.md | 77 ++++- README_ar.md | 23 +- README_ja.md | 23 +- README_ko.md | 23 +- README_zh.md | 23 +- docs/browser-observation.md | 8 +- docs/browser-scenario-contract.md | 80 ++++++ docs/javascript-application-workflows.md | 50 +++- docs/javascript-runtime-observation.md | 101 +++++++ docs/javascript-runtime-reconciliation.md | 19 +- docs/mcp-contracts.md | 10 +- docs/reconstruction-obligation-ledgers.md | 333 ++++++++++++++++++++++ docs/reconstruction-readiness.md | 99 +++++++ skills/reverse-engineer-anything/SKILL.md | 4 +- tests/conformance/README.md | 6 + 16 files changed, 811 insertions(+), 83 deletions(-) create mode 100644 docs/browser-scenario-contract.md create mode 100644 docs/javascript-runtime-observation.md create mode 100644 docs/reconstruction-obligation-ledgers.md create mode 100644 docs/reconstruction-readiness.md diff --git a/AGENTS.md b/AGENTS.md index 262217f08..7bd6207be 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -29,7 +29,7 @@ See [docs/architecture.mermaid](docs/architecture.mermaid) for a visual architec - `src/contracts/`: caller-visible tool schemas and catalog metadata; `toolContracts.ts` owns the canonical inventory and `enhancedInputs.ts` owns enhanced input parsing. - `src/process/`: provider-neutral process ownership and lifecycle primitives. It owns private runtime roots, session-assigned run identity and token-verified lineage, absolute startup deadlines, correlated request waits, bounded output capture, and TERM-to-KILL cleanup without defining any provider wire protocol. - `src/replay/`: Linux x64 controlled-JavaScript-replay adapter. It owns exact runtime closure inspection, Bubblewrap/seccomp/cgroup admission, the disposable worker, strict parent/worker protocol validation, and complete cleanup observation. -- `src/browser/`: loopback CDP discovery, bounded WebSocket transport, exact-origin target authorization, and passive browser observation normalization. +- `src/browser/`: loopback CDP/Inspector discovery, bounded WebSocket transport, exact-origin or canonical-root target authorization, passive browser/Electron and attach-only Node/Electron V8 observation, plus controlled Playwright scenarios with explicit launch/attach ownership and cleanup. - `src/hopper/`: Hopper launch and Unix-socket protocol mechanics. `BridgeLauncher.ts` spawns the Hopper app with the in-process bridge, `HopperClient.ts` correlates request/response over the socket with timeouts and cancellation, `protocol.ts` frames bridge messages. - `bridge/hopper_bridge.py`: runs inside Hopper and adapts declared operations to Hopper's public Python API. Hopper's bundled MCP server is not used. - `src/ghidra/`: exact Ghidra 12.1.2/JDK 21 inspection, analysis-profile commitment, digest-bound target snapshots, isolated `analyzeHeadless` launch, authenticated Unix-socket or Windows loopback transport, bounded serial request queue, and strict inventory/function boundaries. @@ -74,7 +74,8 @@ See [docs/architecture.mermaid](docs/architecture.mermaid) for a visual architec - `npm run verify:hopper`: build and run the real-Hopper verifier with two distinct binaries. - `npm run verify:ghidra`: build and run the real-Ghidra verifier against `GHIDRA_INSTALL_DIR` and optional `GHIDRA_TARGET_PATH`. - `npm run verify:ghidra:windows`: build and run the real Windows Ghidra verifier against `GHIDRA_INSTALL_DIR` and the source-owned x64 PE fixture. -- `npm run verify:browser`: build and run the real Chrome verifier against `REA_BROWSER_EXECUTABLE` or a platform-default Chrome-family executable. +- `npm run verify:browser`: build and run the real Chrome verifier against `REA_BROWSER_EXECUTABLE` or a platform-default Chrome-family executable, including browser-scenario CLI parity, attach disconnect-only ownership, launched-process termination, and temporary-profile cleanup. +- `npm run verify:inspector`: build and run the real attach-only Node Inspector verifier through the public CLI. - `npm run verify:managed`: build and run the source-owned managed PE/CLI conformance verifier for artifact triage, member inspection, managed/native boundary declarations, token drift comparison, malformed metadata, non-managed degradation, managed application-graph projection, manifest-verifier self-test, and optional BYO ILSpy oracle checks; set `REA_MANAGED_APP_MANIFEST_PATH` to verify an operator-local managed app manifest, including optional graph/trace assertions, and set `REA_ILSPY_CMD_PATH` to an absolute `ilspycmd` path to run the real ILSpy reconstruction oracle. - `npm run evidence:generate`: regenerate the managed conformance manifest and Evidence v2 completion ledger from live verifier output. - `npm run evidence:check`: rerun managed conformance and fail on generated manifest, completion ledger, or bundled skill drift. @@ -102,9 +103,19 @@ Pre-commit hooks via Husky format then lint staged source files. Pre-push runs ` - `REA_BROWSER_OBSERVE_ENABLED` (optional, default `false`): add browser observation authority to the administrator ceiling. - `REA_BROWSER_CDP_ENDPOINTS_JSON` (optional): approved literal loopback CDP HTTP endpoints. - `REA_BROWSER_ALLOWED_ORIGINS_JSON` (optional): exact HTTP(S) page origins approved for passive observation. +- `REA_BROWSER_SCENARIO_ENABLED` (optional, default `false`): add controlled browser automation to the administrator ceiling. +- `REA_BROWSER_SCENARIO_AUTO_GRANT` (optional, default `false`): issue the exact configured browser-automation ceiling as an administrator grant for trusted unattended use. +- `REA_BROWSER_SCENARIO_EXECUTABLE_ROOTS_JSON` (optional): canonical executable roots approved for provider-owned browser launch. +- `REA_BROWSER_SCENARIO_CDP_ENDPOINTS_JSON` (optional): literal-loopback CDP endpoints approved for external-browser attachment. +- `REA_BROWSER_SCENARIO_ALLOWED_ORIGINS_JSON` (optional): exact HTTP(S) page origins approved for browser scenarios. +- `REA_BROWSER_SCENARIO_ALLOWED_ENV_JSON` (optional): environment-variable names that scenario secret references may resolve. - `REA_ELECTRON_OBSERVE_ENABLED` (optional, default `false`): add passive Electron file-page observation authority to the administrator ceiling. - `REA_ELECTRON_CDP_ENDPOINTS_JSON` (optional): approved literal loopback Electron CDP HTTP endpoints. - `REA_ELECTRON_FILE_ROOTS_JSON` (optional): canonical filesystem roots approved for passive Electron page observation. +- `REA_V8_INSPECTOR_OBSERVE_ENABLED` (optional, default `false`): add passive attach-only Node/Electron Inspector observation authority to the administrator ceiling. +- `REA_V8_INSPECTOR_ENDPOINTS_JSON` (optional): approved literal-loopback Node/Electron Inspector HTTP endpoints. +- `REA_V8_INSPECTOR_FILE_ROOTS_JSON` (optional): canonical filesystem roots approved for Inspector targets and script locations. +- `REA_V8_INSPECTOR_ALLOWED_ORIGINS_JSON` (optional): exact HTTP(S) origins approved for Electron renderer Inspector targets and scripts. - `REA_INVESTIGATION_INPUT_ROOTS_JSON` (optional): canonical filesystem roots approved for static JavaScript/Electron application analysis and other investigation inputs. - `REA_JAVASCRIPT_REPLAY_ENABLED` (optional, default `false`): add controlled extracted-module execution authority to the administrator ceiling. - `REA_JAVASCRIPT_REPLAY_ROOTS_JSON` (optional): exact canonical source roots approved for controlled replay. diff --git a/README.md b/README.md index 13d10fdb4..9fbc95697 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ See a feature in an app that you want in your own product? Give the app to your agent—even without its source code. With REA, the agent can investigate the feature, explain how it works, show its evidence, and build a version adapted to your stack and requirements. -REA gives agents one consistent way to investigate software. Today that includes deep native analysis and function dossiers through Hopper or bring-your-own Ghidra on Linux, plus an experimental Windows x64 Ghidra P0 for approved native PE applications; execution-free managed PE/CLI triage; reproducible Evidence v2 records; controlled process capture; passive website and Electron observation; bounded JavaScript/source-map reconstruction; and a versioned domain graph for connecting JavaScript application layers without confusing static inference with runtime observation. The longer-term toolkit extends the same agent workflow to APIs, protocols, mobile artifacts, firmware, richer runtime behavior, and differences between versions. +REA gives agents one consistent way to investigate software. Today that includes deep native analysis and function dossiers through Hopper or bring-your-own Ghidra on Linux, plus an experimental Windows x64 Ghidra P0 for approved native PE applications; execution-free managed PE/CLI triage; reproducible Evidence v2 records; controlled process capture; passive website, Electron page, and Node/Electron V8 Inspector observation; bounded JavaScript/source-map reconstruction; and a versioned domain graph for connecting JavaScript application layers without confusing static inference with runtime observation. The longer-term toolkit extends the same agent workflow to APIs, protocols, mobile artifacts, firmware, richer runtime behavior, and differences between versions. Reverse engineering normally makes the operator choose a tool, learn its API, move evidence between programs, and decide what to inspect next. REA gives that work to the agent through commands, skills, structured results, and repeatable investigation workflows. @@ -371,17 +371,18 @@ REA handles the app analysis in steps 1–5. The agent performs step 6 with its ## Tool catalog for investigation -| Tool family | Count | Examples | -| ------------------------- | ----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Native inspection | 34 | procedures, pseudocode, assembly, strings, names, segments, callers, callees, xrefs, annotations | -| Investigation workflows | 10 | `binary_overview`, `analyze_function`, `batch_decompile`, `trace_feature`, call graphs, Swift and Objective-C discovery | -| Native macOS utilities | 5 | Mach-O metadata, code signatures, plists, architectures, Swift demangling; Hopper-free and provenance-bearing | -| Artifact graph | 2 | deterministic directory, ZIP/APK/IPA/MSIX/AppX, and ASAR inventory; explicitly selected extraction into an absent owned tree | -| Managed PE/CLI | 8 | PE/CLI identity, metadata members, CIL hashes, P/Invoke/native-boundary declarations and verification, application-graph projection, decompiler reconstruction import, token remapping, runtime-correlation plans, and version comparison | -| Browser observation | 8 | exact-origin CDP capture, bundle and source-map analysis, WebMCP discovery, session timelines, capture diff, and visual evidence | -| Electron analysis | 4 | passive root-confined observation, bounded static application mapping, and evidence-backed static/runtime reconciliation | -| Application workflows | 9 | bounded cross-layer traces, unique-only version matching, static export return-shape comparison, approved Linux-isolated extracted-module replay, managed-runtime characterization, and reconstruction coverage closure | -| Workspace and observation | 19 | target lifecycle, Evidence v2 bundles, direct finite replay-machine evaluation, process/artifact/function comparison, evidence-linked residual-unknown lifecycle | +| Tool family | Count | Examples | +| ------------------------- | ----: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Native inspection | 36 | procedures, pseudocode, assembly, strings, names, segments, callers, callees, xrefs, annotations, bounded byte reads, file-offset translation | +| Investigation workflows | 12 | `binary_overview`, `analyze_function`, `batch_decompile`, `trace_feature`, exact string-to-code lookup, bounded call paths, call graphs, Swift and Objective-C discovery | +| Native macOS utilities | 5 | Mach-O metadata, code signatures, plists, architectures, Swift demangling; Hopper-free and provenance-bearing | +| Artifact graph | 3 | bounded provider-neutral inspection, deterministic directory/ZIP/APK/IPA/MSIX/AppX/ASAR inventory, and explicitly selected extraction into an absent owned tree | +| Managed PE/CLI | 8 | PE/CLI identity, metadata members, CIL hashes, P/Invoke/native-boundary declarations and verification, application-graph projection, decompiler reconstruction import, token remapping, runtime-correlation plans, and version comparison | +| Browser observation | 9 | exact-origin passive CDP capture, bundle and source-map analysis, WebMCP discovery, session timelines, capture diff, visual evidence, and bounded Playwright scenarios | +| Electron analysis | 4 | passive root-confined observation, bounded static application mapping, and evidence-backed static/runtime reconciliation | +| JavaScript runtime | 2 | approved attach-only Node/Electron Inspector target discovery plus bounded script and execution-context observation without evaluation or instrumentation | +| Application workflows | 12 | bounded cross-layer traces, unique-only version matching, historical-source to bundle mapping, static export return-shape comparison, approved Linux-isolated extracted-module replay, managed-runtime characterization, reconstruction coverage closure, deterministic obligation ledgers, and end-to-end readiness conformance | +| Workspace and observation | 19 | target lifecycle, Evidence v2 bundles, direct finite replay-machine evaluation, process/artifact/function comparison, evidence-linked residual-unknown lifecycle | The public interface describes what the agent is trying to learn. Providers decide how to answer. macOS utilities handle common semantic inspection without launching Hopper; Hopper handles deeper native analysis; the process harness implements controlled behavioral capture. @@ -393,10 +394,11 @@ REA is already useful for native application, browser, and Electron investigatio - Discover deep-analysis candidates without starting them, choose deterministically, and retain one immutable provider/profile binding until an explicit switch or close; provider failures never trigger transparent fallback. - Attach to a user-owned Chrome-family browser over a configured loopback CDP endpoint; capture exact-origin web structure, safe metadata, approved value-free payload shapes, bundle/source-map evidence, WebMCP declarations, user-action timelines, capture diffs, and explicitly approved screenshots without navigation or JavaScript evaluation. - Inspect Electron `file://` renderer pages through a separate canonical-root permission boundary without invoking Electron APIs; script contents remain separately approved and byte bounded. +- Attach to one exact approved Node or Electron V8 Inspector target and retain bounded `scriptParsed` plus execution-context lifecycle metadata without evaluation, breakpoints, resume, source reads, or instrumentation. require/import edges, EventEmitter activity, Electron IPC, PID identity, and role identity remain unknown. See [passive Node and Electron runtime observation](docs/javascript-runtime-observation.md). - Validate and canonically serialize a provider-neutral [JavaScript Application Graph v1](docs/javascript-application-graph.md) spanning packages, ASAR entries, Electron roles, JavaScript/source-map entities, browser/runtime instances, IPC, endpoints, storage, and native add-ons. This shipped domain contract performs no extraction or I/O by itself. - Reconstruct bounded static package, entrypoint, Webpack/Rspack module, import, worker, endpoint, storage, source-map, BrowserWindow, preload, contextBridge, IPC, utility-process, and native-add-on structure from an approved local directory or ASAR through `analyze_javascript_application` or `rea analyze-javascript-application`. The AST-only [application service](docs/javascript-artifact-reconstruction.md) never executes bootstrap code, pairs only unique exact literal IPC channels, and reports dynamic or ambiguous channels as unresolved. - Reconcile that static graph with existing passive web or Electron Evidence through `reconcile_javascript_runtime` or `rea reconcile-javascript-runtime`. Exact captured bytes outrank caller-declared file/URL mappings; target, frame, script, worker, cache, and asset ambiguity stays explicit, source-map authority stays separate, and a module resident in an observed bundle is never reported as executed. See [JavaScript static/runtime reconciliation](docs/javascript-runtime-reconciliation.md). -- Trace a literal route, string, API, IPC channel, module, or native export through authenticated application Evidence with explicit traversal bounds, then hand exact native artifact digests and requested exports to retained Ghidra or Hopper Evidence without automatic provider switching. Compare application versions using unique-only digest, source-map, structural, and semantic tiers; compare one exact JavaScript export's static return shapes through unique literal discriminants and bounded JSON Pointer changes. Duplicate, dynamic, incomplete, and truncated facts stay unknown. See [cross-layer JavaScript application workflows](docs/javascript-application-workflows.md). +- Trace a literal route, string, API, IPC channel, module, or native export through authenticated application Evidence with explicit traversal bounds, then hand exact native artifact digests and requested exports to retained Ghidra or Hopper Evidence without automatic provider switching. Compare application versions using unique-only digest, source-map, structural, and semantic tiers; map a committed historical source inventory to bundle nodes with explicit digest and path scores; compare one exact JavaScript export's static return shapes through unique literal discriminants and bounded JSON Pointer changes. Duplicate, dynamic, incomplete, ambiguous, and truncated facts stay unknown. See [cross-layer JavaScript application workflows](docs/javascript-application-workflows.md). - Classify PE/CLI managed artifacts with `inspect_managed_artifact` / `rea inspect-managed-artifact`, inspect bounded metadata members, signatures, raw CIL hashes, limited decoded-instruction-tuple v1 hashes, separately reported exception regions, call edges, and field-access anchors with `inspect_managed_members` / `rea inspect-managed-members`, inventory declared ModuleRef/ImplMap/PInvoke and non-IL method boundary indicators with `inspect_managed_native_boundaries` / `rea inspect-managed-native-boundaries`, then compare two authenticated member observations with `compare_managed_members` / `rea compare-managed-members`. `verify_managed_native_boundaries` / `rea verify-managed-native-boundaries` checks managed P/Invoke declarations against authenticated native export or function Evidence while keeping verified, inferred, contradicted, and unresolved states distinct. The comparison treats build-local tokens as build-local and uses unique decoded-CIL/signature and structural method-shape tiers, never names alone; the v1 tuple hash does not itself resolve tokens or fully commit control flow. `project_managed_application_graph` / `rea project-managed-application-graph` projects authenticated managed artifact/member/native-boundary Evidence into the existing application graph for cross-layer feature tracing. `import_managed_reconstruction` / `rea import-managed-reconstruction` admits user-supplied decompiler C#/IL/pseudocode as analyst inference only after exact artifact SHA-256, MVID, signature, and the shipped v1 decoded-IL commitment match. Separately, `plan_managed_runtime_correlation` / `rea plan-managed-runtime-correlation` can admit a default-disabled, permission-gated runtime-correlation plan locked to the same build evidence. These paths never load the assembly, resolve CLR dependencies, execute target code, run a decompiler, or translate managed tokens into native addresses; full normalized-CIL v2 semantics, native-body bridge mapping, and an actual runtime executor remain future managed-code contracts. - Configure `REA_ILSPY_CMD_PATH=/absolute/path/to/ilspycmd` only when you want doctor and `verify:managed` to inspect a bring-your-own ILSpy command as a @@ -438,6 +440,55 @@ rea inspect-web-page http://127.0.0.1:9222 TARGET_ID --approved --json All eight browser tools expose the same Evidence v2 contracts over CLI and MCP. Inspection is passive: REA does not evaluate page JavaScript, navigate, click, close the page, or close the browser. Query values, credentials, cookies, authorization headers, storage values, and raw JSON or WebSocket values are never retained. Separately approved captures can retain bounded redacted console primitives, value-free JSON/WebSocket shapes, script sources, accessibility text, or screenshot pixels. Existing activity before attach is explicitly unavailable. See [Website observation with CDP](docs/browser-observation.md) for browser startup, schemas, limits, and the threat model. +### Controlled browser scenarios + +`capture_browser_scenario` is a separate, explicitly mutating browser boundary. +It runs only the fixed, versioned scenario vocabulary through Playwright and +returns step-indexed Evidence for screenshots, DOM, accessibility, URL/history, +storage, console/errors, network, WebSockets, frames, workers, popups, and +cancelled downloads. Missing or truncated sections can never support equality +claims. + +```bash +export REA_BROWSER_SCENARIO_ENABLED=true +export REA_BROWSER_SCENARIO_EXECUTABLE_ROOTS_JSON='["/usr/bin"]' +export REA_BROWSER_SCENARIO_CDP_ENDPOINTS_JSON='["http://127.0.0.1:9222"]' +export REA_BROWSER_SCENARIO_ALLOWED_ORIGINS_JSON='["http://127.0.0.1:3000"]' +export REA_BROWSER_SCENARIO_ALLOWED_ENV_JSON='["REA_TEST_PASSWORD"]' + +rea capture-browser-scenario ./scenario.json --json +``` + +Launch mode owns a temporary browser profile and removes it after terminating +the launched browser. Connect mode accepts one exact loopback CDP target and +disconnects without closing the external browser. Automation has no default +grant: use the shared project/session policy, or set +`REA_BROWSER_SCENARIO_AUTO_GRANT=true` only for a trusted unattended +environment. Scenario JSON contains secret references and environment-variable +names, never secret values. See the +[browser scenario contract](docs/browser-scenario-contract.md). + +### Node and Electron V8 Inspector observation + +Attach-only JavaScript runtime observation is separately disabled by default: + +```bash +export REA_V8_INSPECTOR_OBSERVE_ENABLED=true +export REA_V8_INSPECTOR_ENDPOINTS_JSON='["http://127.0.0.1:9229"]' +export REA_V8_INSPECTOR_FILE_ROOTS_JSON='["/absolute/path/to/app"]' +export REA_V8_INSPECTOR_ALLOWED_ORIGINS_JSON='[]' + +rea list-javascript-runtime-targets http://127.0.0.1:9229 --approved --json +rea observe-javascript-runtime http://127.0.0.1:9229 TARGET_ID \ + --runtime-kind node --approved --json +``` + +REA sends only `Runtime.enable` and `Debugger.enable`. It retains bounded, +scope-authorized script locations and execution-context lifecycle events; +require/import edges, EventEmitter activity, Electron IPC, PID identity, and +Electron role identity stay explicit unknowns. See +[passive Node and Electron runtime observation](docs/javascript-runtime-observation.md). + Exact package, tool-family, provider, setup-client, public schema-version, and CLI facts are generated from source in [`docs/product-catalog.json`](docs/product-catalog.json). PR CI verifies this catalog, narrative documentation, generated schemas, and a clean TypeDoc render. ## Roadmap diff --git a/README_ar.md b/README_ar.md index 007a83ba2..154386e3b 100644 --- a/README_ar.md +++ b/README_ar.md @@ -159,17 +159,18 @@ rea uninstall --purge-data ## منصة أدوات التحقيق -| عائلة الأدوات | العدد | أمثلة | -| --------------------- | ----: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| فحص الملفات التنفيذية | 34 | الدوال، والشيفرة شبه المصدرية، والتعليمات، والسلاسل، والأسماء، والمراجع، والتعليقات | -| التحليل المركب | 10 | النظرة العامة، وفك الترجمة الدفعي، ومخططات الاستدعاء، والمراجع، واكتشاف الأنواع | -| أدوات macOS الأصلية | 5 | بيانات Mach-O والتوقيعات وملفات plist والمعماريات وفك رموز Swift دون تشغيل Hopper | -| رسم القطع الأثرية | 2 | جرد حتمي للدلائل وZIP/APK/IPA وASAR واستخراج معاملاتي محدد صراحة | -| Managed PE/CLI | 8 | هوية PE/CLI، أعضاء البيانات الوصفية، بصمات CIL، تصريحات P/Invoke/الحدود الأصلية والتحقق منها، إسقاط رسم التطبيق، استيراد إعادة البناء من فك الترجمة، إعادة ربط الرموز، خطط ترابط وقت التشغيل ومقارنة الإصدارات | -| مراقبة المتصفح | 8 | التقاط CDP محدود الأصل وتحليل الحزم وخرائط المصدر واكتشاف WebMCP والفروق والأدلة المرئية | -| تحليل Electron | 4 | مراقبة سلبية ضمن جذور canonical، ورسم ثابت ومحدود للتطبيق، ومطابقة ثابتة/وقت تشغيل قائمة على Evidence | -| سير عمل التطبيقات | 9 | تتبع محدود ومقارنة إصدارات فريدة ومقارنة ثابتة لأشكال قيم إرجاع الصادرات وإعادة تشغيل وحدات معزولة ومعتمدة على Linux وتوصيف وقت التشغيل المُدار وإغلاق تغطية إعادة البناء | -| جلسة الملف التنفيذي | 19 | فتح الأهداف وحزم الأدلة وتشغيل آلة إعادة محدودة ومقارنة العمليات والقطع والدوال وسجل المجهولات المتبقية | +| عائلة الأدوات | العدد | أمثلة | +| --------------------- | ----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| فحص الملفات التنفيذية | 36 | الدوال، والشيفرة شبه المصدرية، والتعليمات، والسلاسل، والأسماء، والمراجع، والتعليقات | +| التحليل المركب | 12 | النظرة العامة، وفك الترجمة الدفعي، ومخططات الاستدعاء، والمراجع، واكتشاف الأنواع | +| أدوات macOS الأصلية | 5 | بيانات Mach-O والتوقيعات وملفات plist والمعماريات وفك رموز Swift دون تشغيل Hopper | +| رسم القطع الأثرية | 3 | جرد حتمي للدلائل وZIP/APK/IPA وASAR واستخراج معاملاتي محدد صراحة | +| Managed PE/CLI | 8 | هوية PE/CLI، أعضاء البيانات الوصفية، بصمات CIL، تصريحات P/Invoke/الحدود الأصلية والتحقق منها، إسقاط رسم التطبيق، استيراد إعادة البناء من فك الترجمة، إعادة ربط الرموز، خطط ترابط وقت التشغيل ومقارنة الإصدارات | +| مراقبة المتصفح | 9 | التقاط CDP محدود الأصل وتحليل الحزم وخرائط المصدر واكتشاف WebMCP والفروق والأدلة المرئية | +| تحليل Electron | 4 | مراقبة سلبية ضمن جذور canonical، ورسم ثابت ومحدود للتطبيق، ومطابقة ثابتة/وقت تشغيل قائمة على Evidence | +| وقت تشغيل JavaScript | 2 | اكتشاف أهداف Node/Electron Inspector المعتمدة للاتصال فقط، ومراقبة محدودة للبرامج النصية وسياقات التنفيذ دون تقييم أو تجهيز | +| سير عمل التطبيقات | 12 | تتبع محدود ومقارنة إصدارات فريدة ومقارنة ثابتة لأشكال قيم إرجاع الصادرات وإعادة تشغيل وحدات معزولة ومعتمدة على Linux وتوصيف وقت التشغيل المُدار وإغلاق تغطية إعادة البناء ودفاتر التزامات حتمية والتحقق الشامل من جاهزية إعادة البناء | +| جلسة الملف التنفيذي | 19 | فتح الأهداف وحزم الأدلة وتشغيل آلة إعادة محدودة ومقارنة العمليات والقطع والدوال وسجل المجهولات المتبقية | ## استخدام REA مع وكلاء برمجة آخرين diff --git a/README_ja.md b/README_ja.md index 5c68b6053..d7d814ed2 100644 --- a/README_ja.md +++ b/README_ja.md @@ -149,17 +149,18 @@ REA は手順 1〜5 のバイナリ解析を処理し、手順 6 はエージェ ## 調査ツールカタログ -| ツール群 | 数 | 例 | -| ---------------------- | --: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| バイナリ調査 | 34 | プロシージャ、疑似コード、アセンブリ、文字列、名前、セグメント、callers、callees、xrefs、注釈 | -| 合成解析 | 10 | `binary_overview`, `analyze_function`, `batch_decompile`, `get_call_graph`, `find_xrefs_to_name`, Swift / ObjC 検出 | -| macOS ネイティブ | 5 | Mach-O メタデータ、署名、plist、アーキテクチャ、Swift デマングル。Hopper 起動不要 | -| アーティファクトグラフ | 2 | ディレクトリ、ZIP/APK/IPA、ASAR の決定的一覧と明示選択されたトランザクション抽出 | -| Managed PE/CLI | 8 | PE/CLI 識別、メタデータメンバー、CIL ハッシュ、P/Invoke/ネイティブ境界宣言と検証、アプリケーショングラフ投影、逆コンパイル再構成インポート、構造的 token 再マッピング、ランタイム相関計画、バージョン比較 | -| ブラウザ観察 | 8 | origin 限定 CDP 取得、bundle/source map 解析、WebMCP 検出、セッション、capture diff、視覚証拠 | -| Electron 解析 | 4 | canonical ファイルルート内の受動観察、有界な静的アプリマッピング、Evidence に基づく静的/実行時の照合 | -| アプリケーション | 9 | 有界なクロスレイヤー追跡、一意限定のバージョン比較、静的なエクスポート戻り値形状比較、承認済み Linux 隔離 extracted-module replay、マネージドランタイム特性評価、再構築カバレッジ閉包 | -| バイナリセッション | 19 | `open_binary`、`binary_session`、証拠バンドル、有限リプレイ状態機械、プロセス/成果物/関数比較、残余未知レジストリ | +| ツール群 | 数 | 例 | +| ---------------------- | --: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| バイナリ調査 | 36 | プロシージャ、疑似コード、アセンブリ、文字列、名前、セグメント、callers、callees、xrefs、注釈 | +| 合成解析 | 12 | `binary_overview`, `analyze_function`, `batch_decompile`, `get_call_graph`, `find_xrefs_to_name`, Swift / ObjC 検出 | +| macOS ネイティブ | 5 | Mach-O メタデータ、署名、plist、アーキテクチャ、Swift デマングル。Hopper 起動不要 | +| アーティファクトグラフ | 3 | ディレクトリ、ZIP/APK/IPA、ASAR の決定的一覧と明示選択されたトランザクション抽出 | +| Managed PE/CLI | 8 | PE/CLI 識別、メタデータメンバー、CIL ハッシュ、P/Invoke/ネイティブ境界宣言と検証、アプリケーショングラフ投影、逆コンパイル再構成インポート、構造的 token 再マッピング、ランタイム相関計画、バージョン比較 | +| ブラウザ観察 | 9 | origin 限定 CDP 取得、bundle/source map 解析、WebMCP 検出、セッション、capture diff、視覚証拠 | +| Electron 解析 | 4 | canonical ファイルルート内の受動観察、有界な静的アプリマッピング、Evidence に基づく静的/実行時の照合 | +| JavaScript ランタイム | 2 | 承認済みのアタッチ専用 Node/Electron Inspector ターゲット検出と、評価や計装を行わない有界なスクリプト/実行コンテキスト観察 | +| アプリケーション | 12 | 有界なクロスレイヤー追跡、一意限定のバージョン比較、静的なエクスポート戻り値形状比較、承認済み Linux 隔離 extracted-module replay、マネージドランタイム特性評価、再構築カバレッジ閉包、決定論的な義務台帳、エンドツーエンドの準備適合性検証 | +| バイナリセッション | 19 | `open_binary`、`binary_session`、証拠バンドル、有限リプレイ状態機械、プロセス/成果物/関数比較、残余未知レジストリ | ## 他のコーディングエージェントで使う diff --git a/README_ko.md b/README_ko.md index 6709261d3..647eabb46 100644 --- a/README_ko.md +++ b/README_ko.md @@ -149,17 +149,18 @@ REA는 1–5단계의 바이너리 분석을 처리합니다. 6단계는 에이 ## 조사 도구 카탈로그 -| 도구 그룹 | 수 | 예시 | -| ------------------- | --: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 바이너리 검사 | 34 | 프로시저, 의사 코드, 어셈블리, 문자열, 이름, 세그먼트, callers, callees, xrefs, 주석 | -| 합성 분석 | 10 | `binary_overview`, `analyze_function`, `batch_decompile`, `get_call_graph`, `find_xrefs_to_name`, Swift 및 ObjC 탐색 | -| macOS 네이티브 도구 | 5 | Mach-O 메타데이터, 코드 서명, plist, 아키텍처, Swift 디맹글링. Hopper 실행 불필요 | -| 아티팩트 그래프 | 2 | 디렉터리, ZIP/APK/IPA, ASAR 결정적 인벤토리와 명시적으로 선택한 트랜잭션 추출 | -| Managed PE/CLI | 8 | PE/CLI ID, 메타데이터 멤버, CIL 해시, P/Invoke/네이티브 경계 선언 및 검증, 애플리케이션 그래프 투영, 디컴파일 재구성 가져오기, 구조적 token 재매핑, 런타임 상관 계획, 버전 비교 | -| 브라우저 관찰 | 8 | origin 제한 CDP 캡처, bundle/source map 분석, WebMCP 검색, 세션 타임라인, capture diff 및 시각 증거 | -| Electron 분석 | 4 | canonical 파일 루트 내 수동 관찰, 제한된 정적 앱 매핑, Evidence 기반 정적/런타임 조정 | -| 애플리케이션 | 9 | 제한된 교차 계층 추적, 고유 일치 버전 비교, 정적 export 반환 형태 비교, 승인된 Linux 격리 extracted-module replay, 관리형 런타임 특성화, 재구성 커버리지 폐쇄 | -| 바이너리 세션 | 19 | `open_binary`, `binary_session`, 증거 번들, 유한 replay 상태 머신, 프로세스·아티팩트·함수 비교, 잔여 미지수 레지스트리 | +| 도구 그룹 | 수 | 예시 | +| ------------------- | --: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 바이너리 검사 | 36 | 프로시저, 의사 코드, 어셈블리, 문자열, 이름, 세그먼트, callers, callees, xrefs, 주석 | +| 합성 분석 | 12 | `binary_overview`, `analyze_function`, `batch_decompile`, `get_call_graph`, `find_xrefs_to_name`, Swift 및 ObjC 탐색 | +| macOS 네이티브 도구 | 5 | Mach-O 메타데이터, 코드 서명, plist, 아키텍처, Swift 디맹글링. Hopper 실행 불필요 | +| 아티팩트 그래프 | 3 | 디렉터리, ZIP/APK/IPA, ASAR 결정적 인벤토리와 명시적으로 선택한 트랜잭션 추출 | +| Managed PE/CLI | 8 | PE/CLI ID, 메타데이터 멤버, CIL 해시, P/Invoke/네이티브 경계 선언 및 검증, 애플리케이션 그래프 투영, 디컴파일 재구성 가져오기, 구조적 token 재매핑, 런타임 상관 계획, 버전 비교 | +| 브라우저 관찰 | 9 | origin 제한 CDP 캡처, bundle/source map 분석, WebMCP 검색, 세션 타임라인, capture diff 및 시각 증거 | +| Electron 분석 | 4 | canonical 파일 루트 내 수동 관찰, 제한된 정적 앱 매핑, Evidence 기반 정적/런타임 조정 | +| JavaScript 런타임 | 2 | 승인된 연결 전용 Node/Electron Inspector 대상 탐색과 평가·계측 없는 제한된 스크립트 및 실행 컨텍스트 관찰 | +| 애플리케이션 | 12 | 제한된 교차 계층 추적, 고유 일치 버전 비교, 정적 export 반환 형태 비교, 승인된 Linux 격리 extracted-module replay, 관리형 런타임 특성화, 재구성 커버리지 폐쇄, 결정론적 의무 원장, 엔드투엔드 준비 적합성 검증 | +| 바이너리 세션 | 19 | `open_binary`, `binary_session`, 증거 번들, 유한 replay 상태 머신, 프로세스·아티팩트·함수 비교, 잔여 미지수 레지스트리 | ## 다른 코딩 에이전트에서 사용하기 diff --git a/README_zh.md b/README_zh.md index c621bf066..62e6048f9 100644 --- a/README_zh.md +++ b/README_zh.md @@ -149,17 +149,18 @@ REA 负责第 1–5 步中的二进制分析。第 6 步由智能体使用其常 ## 调查工具目录 -| 工具类别 | 数量 | 示例 | -| -------------- | ---: | --------------------------------------------------------------------------------------------------------------------------------------------- | -| 二进制检查 | 34 | 过程、伪代码、汇编、字符串、名称、段、调用者、被调用者、交叉引用、注释 | -| 组合分析 | 10 | `binary_overview`, `analyze_function`, `batch_decompile`, `get_call_graph`, `find_xrefs_to_name`、Swift 与 ObjC 发现 | -| macOS 原生工具 | 5 | Mach-O 元数据、代码签名、plist、架构与 Swift 符号还原,无需启动 Hopper | -| 制品图谱 | 2 | 确定性目录、ZIP/APK/IPA 与 ASAR 清单,以及显式选择的事务式提取 | -| Managed PE/CLI | 8 | PE/CLI 身份、元数据成员、CIL 哈希、P/Invoke/原生边界声明与验证、应用图谱投影、反编译重建导入、结构化 token 重映射、运行时关联计划与跨版本比较 | -| 浏览器观察 | 8 | 精确来源 CDP 抓取、bundle/source map 分析、WebMCP 发现、会话时间线、capture diff 与视觉证据 | -| Electron 分析 | 4 | 限定 canonical 文件根的被动观察、有界静态应用映射,以及基于 Evidence 的静态/运行时对账 | -| 应用工作流 | 9 | 有界跨层追踪、唯一匹配跨版本图比较、静态导出返回形状比较、经批准的 Linux 隔离 extracted-module replay、托管运行时表征和重建覆盖闭合 | -| 二进制会话 | 19 | `open_binary`、`binary_session`、证据包、有限重放状态机、进程、制品与函数比较、残余未知项注册表 | +| 工具类别 | 数量 | 示例 | +| ----------------- | ---: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 二进制检查 | 36 | 过程、伪代码、汇编、字符串、名称、段、调用者、被调用者、交叉引用、注释 | +| 组合分析 | 12 | `binary_overview`, `analyze_function`, `batch_decompile`, `get_call_graph`, `find_xrefs_to_name`、Swift 与 ObjC 发现 | +| macOS 原生工具 | 5 | Mach-O 元数据、代码签名、plist、架构与 Swift 符号还原,无需启动 Hopper | +| 制品图谱 | 3 | 确定性目录、ZIP/APK/IPA 与 ASAR 清单,以及显式选择的事务式提取 | +| Managed PE/CLI | 8 | PE/CLI 身份、元数据成员、CIL 哈希、P/Invoke/原生边界声明与验证、应用图谱投影、反编译重建导入、结构化 token 重映射、运行时关联计划与跨版本比较 | +| 浏览器观察 | 9 | 精确来源 CDP 抓取、bundle/source map 分析、WebMCP 发现、会话时间线、capture diff 与视觉证据 | +| Electron 分析 | 4 | 限定 canonical 文件根的被动观察、有界静态应用映射,以及基于 Evidence 的静态/运行时对账 | +| JavaScript 运行时 | 2 | 经批准的只附加 Node/Electron Inspector 目标发现,以及不执行求值或插桩的有界脚本和执行上下文观察 | +| 应用工作流 | 12 | 有界跨层追踪、唯一匹配跨版本图比较、静态导出返回形状比较、经批准的 Linux 隔离 extracted-module replay、托管运行时表征、重建覆盖闭合、确定性义务账本和端到端就绪性一致性验证 | +| 二进制会话 | 19 | `open_binary`、`binary_session`、证据包、有限重放状态机、进程、制品与函数比较、残余未知项注册表 | ## 与其他编程智能体一起使用 diff --git a/docs/browser-observation.md b/docs/browser-observation.md index 9b4717616..5bd036170 100644 --- a/docs/browser-observation.md +++ b/docs/browser-observation.md @@ -5,11 +5,11 @@ REA can attach to a user-owned Chrome-family browser through the Chrome DevTools ## Shipped surfaces - `list_browser_targets` / `rea list-browser-targets` discovers page targets whose current URL matches an approved exact origin. -- `inspect_web_page` / `rea inspect-web-page` captures bounded DOM structure, accessibility nodes, scripts, resources, safe response/DOM metadata, attach-window network and console metadata, WebSocket frame sizes, workers, quota, and optionally storage key names or script sources. +- `inspect_web_page` / `rea inspect-web-page` captures bounded DOM structure, accessibility nodes, scripts, resources, safe response/DOM metadata, attach-window network and console metadata, WebSocket frame sizes, workers, quota, and optionally storage key names, redacted storage-content fingerprints, or script sources. - `analyze_web_bundle` / `rea analyze-web-bundle` parses approved script artifacts without execution and derives chunk edges, route and endpoint candidates, vendor fingerprints, static WebMCP declarations, and optionally approved source-map/original-source evidence. - `observe_web_session` / `rea observe-web-session` arms a bounded window for an external user action and records ordered reload, SPA navigation, redirect, failure, lifecycle, and target-termination metadata. - `discover_webmcp_tools` / `rea discover-webmcp-tools` uses the experimental CDP WebMCP domain to inventory page registrations. REA never exposes `WebMCP.invokeTool`. -- `compare_web_captures` / `rea compare-web-captures` compares stable DOM, script, resource, network, metadata, and optional WebMCP identities without treating incomplete absence as equivalence. +- `compare_web_captures` / `rea compare-web-captures` compares passive captures or exact-step-aligned browser scenarios. Scenario results commit reproducible literal normalization and expose alignment failures plus artifact-level action, screenshot, DOM, accessibility, URL, history, storage, and event differences. Missing or truncated evidence is never treated as equivalence. - `capture_web_screenshot` / `rea capture-web-screenshot` returns an explicitly approved, bounded, content-addressed visible-viewport PNG. - `compare_web_screenshots` / `rea compare-web-screenshots` performs bounded local PNG pixel comparison without OCR or external services. - Every surface has equivalent CLI and MCP contracts and returns Evidence v2 provenance. @@ -96,7 +96,7 @@ rea inspect-web-page http://127.0.0.1:9222 TARGET_ID \ --json ``` -Accessibility text and script content may contain application secrets and become part of the returned Evidence. Accessibility and console text have independent per-field and aggregate UTF-8 byte limits; credential-shaped console substrings are redacted. JSON and WebSocket captures retain paths, types, counts, and truncation only, never values or examples. Storage values remain redacted even when key-name capture is approved. +Accessibility text and script content may contain application secrets and become part of the returned Evidence. Accessibility and console text have independent per-field and aggregate UTF-8 byte limits; credential-shaped console substrings are redacted. JSON and WebSocket captures retain paths, types, counts, and truncation only, never values or examples. Storage values remain redacted even when key-name capture is approved; SHA-256 identity/value fingerprints support comparison only when cookies, DOM storage, IndexedDB, and Cache Storage were all captured completely. Screenshot pixels require both `--approved` and `--screenshot-approved`: @@ -141,7 +141,7 @@ REA removes sensitive values before normalized event data is retained: - Request/response bodies are not requested or parsed by default. With independent approval, only allowed-origin JSON media types are read within per-body and aggregate budgets, converted immediately to value-free property paths/types, and discarded. `Network.getResponseBody` is never sent without that approval. - Console observations with an approved stack source retain call type, argument types, timestamp, and redacted source location. With independent approval, only already-delivered primitive values are retained after credential redaction and byte bounds; objects, getters, and remote properties are never expanded. - WebSocket observations retain direction, opcode, and payload byte length. With independent approval, bounded text frames are classified as text or value-free JSON shape; binary bytes, hashes, prefixes, and raw frames are never retained. -- Storage observations always redact values. Key names, IndexedDB names, and cache names are omitted unless explicitly requested. +- Storage observations always redact values. Key names, IndexedDB names, cache names, and stable content fingerprints are omitted unless explicitly requested. Cache bodies above 64 KiB and partial IndexedDB remote objects make fingerprint coverage incomplete, so identical observations remain `unknown`. - Script metadata is included only when CDP supplies a URL on an allowed origin. Stable keys exclude transient CDP script IDs, and exact transient raw URLs are used only during script/resource reconciliation. URL-less scripts are excluded because their origin cannot be established. When CDP supplies an execution-context association, the accepted script retains its authorized frame ID for later attribution. Source content is omitted unless explicitly requested and becomes a self-verifying `rea://web-content/sha256/...` artifact subject to per-script and aggregate byte limits. Cross-origin frames, resources, scripts, events, and workers are excluded unless their exact origins are also approved. Excluded target details are counted without being exposed. diff --git a/docs/browser-scenario-contract.md b/docs/browser-scenario-contract.md new file mode 100644 index 000000000..27065775d --- /dev/null +++ b/docs/browser-scenario-contract.md @@ -0,0 +1,80 @@ +# Browser scenario contract + +`capture_browser_scenario` accepts the versioned provider-neutral +`browserScenarioSchema` through both MCP and the +`capture-browser-scenario INPUT_JSON` CLI command. Version 1 is declarative and +bounded: it admits a fixed action vocabulary, exact HTTP(S) origins, +deterministic browser settings, explicit storage and request replay, and finite +capture limits. `INPUT_JSON` may be inline JSON or a JSON file path. + +The browser boundary is part of the contract. Launch mode requires a +caller-selected absolute executable, a provider-owned temporary profile, +headless operation, and close-plus-delete cleanup. Connect mode accepts only an +explicit-port loopback CDP endpoint, declares the browser externally owned, and +permits disconnect-only cleanup. The Playwright driver preserves this +distinction: it closes and deletes provider-owned profiles, but only disconnects +from an external CDP browser. Real-browser verification checks both outcomes and +confirms that an attached external browser remains alive. + +URLs contain a query-free HTTP(S) base plus ordered query entries. Every query, +form, storage, cookie, and replay value is either an explicitly public literal +or a reference to a declared environment-backed secret. Raw credentials in +URLs and literal credential headers are rejected. Secret query names must also +appear in the redaction policy, and the required credential headers cannot be +removed from that policy. Durable results must replace resolved secret values +with their secret references. + +Every start, navigation, storage, replay, and redirect origin must be listed in +`allowed_origins`. Unsupported action tags, unknown fields, duplicate step or +route IDs, undeclared or unused secrets, and provider-owned replay headers fail +validation. HTTP and WebSocket routing enforces the same declared scope. Exact +replay may abort unmatched requests or pass through only approved origins. + +The result is Evidence v2 with an initial state followed by one record per +declared action. Each step reports action status, elapsed time, sanitized URLs, +event bounds, and independently typed capture states for screenshot, DOM, +accessibility, URL, history, and storage. Console, page-error, network, +WebSocket, frame, worker, popup, and cancelled-download events are attributed to +steps and bounded by the scenario limits. Missing and truncated sections remain +explicit and make the capture ineligible for equality claims. Attach-mode +captures also declare the unavoidable pre-attach event gap. + +Browser automation is disabled by default. The administrator ceiling is +configured with: + +- `REA_BROWSER_SCENARIO_ENABLED` +- `REA_BROWSER_SCENARIO_EXECUTABLE_ROOTS_JSON` +- `REA_BROWSER_SCENARIO_CDP_ENDPOINTS_JSON` +- `REA_BROWSER_SCENARIO_ALLOWED_ORIGINS_JSON` +- `REA_BROWSER_SCENARIO_ALLOWED_ENV_JSON` + +Unlike passive observation, browser automation is not granted automatically. +Use an explicit project/session grant, or opt into the administrator grant with +`REA_BROWSER_SCENARIO_AUTO_GRANT=true` for a trusted unattended environment. +Authorization commits the exact executable or CDP endpoint, origins, environment +variable names, network class, and scenario digest before any browser side +effect. + +## Scenario comparison + +`compare_web_captures` and `compare-web-captures` also accept two complete +browser scenario captures. Steps align only by exact, unique `step_id`. +Duplicate IDs, missing counterparts, changed action kinds, and incompatible +browser/origin capture context are returned as alignment failures. They prevent +an unchanged claim; observed differences may still prove a changed result. + +The comparison records its full normalization commitment and SHA-256 digest. +Built-in rules exclude step elapsed time and event sequence/index fields, +compare screenshots by content digest, and compare DOM/accessibility captures +by normalized text. Optional caller rules are bounded exact-literal +replacements over named artifact kinds. Rules and artifact-kind lists are +sorted canonically before application, making the same policy reproducible +regardless of input order. Rules operate only on already-redacted durable +capture fields and are preserved in the result. + +Each aligned step reports changed, unchanged, or unknown. Changed and unknown +action, screenshot, DOM, accessibility, URL, history, storage, and event +artifacts carry their normalized before/after digests and capture states. +`max_changes` bounds retained artifact records while total and omitted counts +remain visible. Missing, truncated, or mismatched capture coverage remains +unknown instead of being treated as equality. diff --git a/docs/javascript-application-workflows.md b/docs/javascript-application-workflows.md index f23e1e713..371467ddc 100644 --- a/docs/javascript-application-workflows.md +++ b/docs/javascript-application-workflows.md @@ -3,8 +3,9 @@ REA derives a bounded feature trace from one authenticated JavaScript Application Graph and compares two authenticated graph versions. The MCP tools are `trace_application_feature`, `trace_javascript_semantics`, -`compare_application_versions`, and `compare_javascript_export_shapes`; their -CLI equivalents use the same names with hyphens. +`compare_application_versions`, `compare_source_to_bundle`, and +`compare_javascript_export_shapes`; their CLI equivalents use the same names +with hyphens. Both workflows consume Evidence v2 produced by `analyze_javascript_application` or `reconcile_javascript_runtime`. They do not @@ -46,14 +47,22 @@ function, module, seed-match, and page limits are validated against exact published ranges. A committed cursor returns the next deterministic relation page only for the same graph, query, and limits. -The initial extractor covers lexical definitions and reads, closure captures, -and uniquely resolved local calls with argument-to-parameter and direct -return-to-call candidates. Dynamic calls/properties, parser recovery, and bound -frontiers stay explicit. Promise, event, timer, child-process, request, -configuration, boundary, resource, and fingerprint families are represented by -the versioned schema but report unsupported or unknown coverage until their -extractors supply facts. Missing relations in those families are never reported -as proven absence. +The extractor covers lexical definitions and reads, literal seeds, static +property slots, object reads/writes/spreads/destructuring, closure captures, +uniquely resolved local calls, argument/return flow, and explicit Promise +construction, chaining, aggregation, await, return, assignment, and +detachment. It also recovers bounded static candidates for EventEmitter +registrations/removals and dispatch, Node timers and cancellation handles, asynchronous +`node:child_process` creation and ownership, configuration sources and direct +defaults, request construction and response consumers, parse/coercion/ +validation boundaries, and built-in resource acquisition/release. + +Function fingerprints commit normalized syntax, control-flow shape, relation +shape, literal sets, arity, and detected effects without using local names or +source offsets. Equal duplicate fingerprints remain ambiguous. Dynamic +calls/properties/names, parser recovery, unresolved handles, unsupported API +shapes, and every reached bound stay explicit unknowns; a missing relation is +never reported as proven behavioral absence. Semantic relations use static-inference authority. `resolved` means the static target identity was unique within admitted analysis; it does not mean the path @@ -83,6 +92,25 @@ items, candidate references, graph nodes, edges, and observations. With `unknown_registry_approved: true`, unresolved comparison items can be retained as a residual unknown in a live session. +## Historical source-to-bundle comparison + +`compare_source_to_bundle` compares one cryptographically committed +`HistoricalSourceGraph/v1` with authenticated application-graph Evidence. The +stable scoring model reports every admitted signal and weight: exact source +digest, source-map original path, exact current path, path suffix, basename, and +language extension. Exact digest wins over location inference; weak basename +or extension evidence never forces a mapping. + +Each historical source file is classified as `unchanged`, `modified`, +`removed`, `split`, `merged`, `duplicated`, or `unknown`. Multiple equally +scored path mappings form a bounded static split inference. Multiple current +nodes with the exact historical digest are duplicated; multiple historical +paths with exact identity to one current node are merged. `removed` requires +complete historical and application inventories with no relevant comparison +truncation. Ambiguous candidates, partial inventories, and exhausted limits +remain unknown. These static mappings do not claim runtime loading or semantic +equivalence. + ## Export return-shape comparison `compare_javascript_export_shapes` selects exactly one module path and export @@ -108,7 +136,7 @@ replay recommendation; it does not execute JavaScript. ## CLI and verification -All four CLI commands accept inline JSON or a JSON file up to 64 MiB. The input +All five CLI commands accept inline JSON or a JSON file up to 64 MiB. The input is the same object used by the corresponding MCP tool. For two operator-provided directories or ASARs, run: diff --git a/docs/javascript-runtime-observation.md b/docs/javascript-runtime-observation.md new file mode 100644 index 000000000..39ab5a48d --- /dev/null +++ b/docs/javascript-runtime-observation.md @@ -0,0 +1,101 @@ +# Passive Node and Electron runtime observation + +REA can attach to an already-running Node.js or Electron V8 Inspector target +and retain bounded script-load and execution-context metadata. The +`list_javascript_runtime_targets` and `observe_javascript_runtime` MCP tools +have equivalent `rea list-javascript-runtime-targets` and +`rea observe-javascript-runtime` commands. Successful calls return +deterministic Evidence v2. + +This authority is disabled by default and is separate from browser CDP, +Electron file-page inspection, Process Capture, and controlled JavaScript +replay: + +```bash +export REA_V8_INSPECTOR_OBSERVE_ENABLED=true +export REA_V8_INSPECTOR_ENDPOINTS_JSON='["http://127.0.0.1:9229"]' +export REA_V8_INSPECTOR_FILE_ROOTS_JSON='["/absolute/path/to/app"]' +export REA_V8_INSPECTOR_ALLOWED_ORIGINS_JSON='[]' + +rea list-javascript-runtime-targets http://127.0.0.1:9229 \ + --approved --json +rea observe-javascript-runtime http://127.0.0.1:9229 TARGET_ID \ + --runtime-kind node --approved --json +``` + +At least one canonical file root or exact HTTP(S) origin is required. +Discovery is restricted to a literal-loopback HTTP endpoint. A target must +match the exact requested target ID, expose a same-port WebSocket reported by +the approved discovery endpoint, and remain inside the requested file or +origin scope. Targets already marked attached are rejected rather than +displacing another debugger. Canonical file paths are checked after symlink resolution. +Excluded locations are counted but never retained. + +## Passive protocol boundary + +The provider sends exactly two protocol commands: + +- `Runtime.enable` +- `Debugger.enable` + +It never sends `Runtime.evaluate`, reads script source, installs breakpoints, +pauses or resumes execution, calls `Runtime.runIfWaitingForDebugger`, launches +the target, instruments JavaScript, or invokes Electron APIs. Closing a call +closes only REA's WebSocket. + +The direct observations are: + +- `Debugger.scriptParsed`, establishing that a bounded script location was + parsed in the observed execution context; +- `Debugger.scriptFailedToParse`, retained only as a bounded invalid-script + count; +- `Runtime.executionContextCreated`, + `Runtime.executionContextDestroyed`, and + `Runtime.executionContextsCleared`, establishing context lifecycle within + the capture window. + +The Inspector protocol does not directly expose require/import caller edges, +EventEmitter emissions or listener invocation, Electron IPC messages or +handlers, or script-unload events. Those facts remain explicit unknowns. +`scriptParsed` proves script presence, not the importing module, feature +execution, initialization order, or causality. + +## Node and Electron roles + +The caller declares one role: `node`, `electron-main`, `electron-preload`, or +`electron-renderer`. Node and Electron-main declarations require a protocol +target of type `node`; preload and renderer declarations require `page`. +Inspector does not authenticate the operating-system PID or distinguish an +Electron role, so Evidence records the role authority as +`caller-declared-unverified`. + +Electron main, preload, and renderer behavior can therefore be observed only +as separate approved Inspector targets. The provider does not infer that two +targets belong to the same Electron application. + +## Bounds and determinism + +Every observation commits the window and exact limits for events, scripts, +execution contexts, per-location bytes, and total retained metadata bytes. +Limit hits increment dropped-event counts and set `capture.truncated`; they +never become completeness claims. Scripts are authorized after capture, +deduplicated by stable metadata, and canonically sorted. Wall-clock timestamps +and protocol script IDs are excluded from the durable result, so identical +inputs and captured metadata produce the same Evidence ID. + +Inspector attach is inherently incomplete. Enabling `Debugger` reports known +and uncollected scripts, but scripts collected before attachment may be +missing. Absence from a bounded capture never proves that a script or behavior +does not occur. + +## Static correlation + +Pass the resulting observation Evidence and an +`analyze_javascript_application` Evidence record to +`reconcile_javascript_runtime`. The reconciliation accepts this provider +alongside passive web and Electron page captures. Exact approved file or URL +mappings can correlate script presence with JavaScript Application Graph +assets. Because this provider never reads source bytes, matches normally use a +unique authorized location and remain weaker than captured-byte identity. +Builtin `node:` scripts remain runtime-only nodes unless a future explicit +static authority models them. diff --git a/docs/javascript-runtime-reconciliation.md b/docs/javascript-runtime-reconciliation.md index 00c0f0a88..80dfa7536 100644 --- a/docs/javascript-runtime-reconciliation.md +++ b/docs/javascript-runtime-reconciliation.md @@ -1,7 +1,7 @@ # JavaScript static/runtime reconciliation REA can combine an existing static JavaScript Application Graph with one or -more passive browser or Electron captures without collapsing their different +more passive browser, Electron page, or Node/Electron V8 Inspector captures without collapsing their different authorities. The `reconcile_javascript_runtime` MCP tool and `rea reconcile-javascript-runtime` CLI command accept Evidence v2 records and return derived Evidence v2 containing a combined JavaScript Application Graph @@ -9,7 +9,8 @@ and explicit match, ambiguity, mismatch, and unknown classifications. The operation performs no filesystem, browser, or Electron I/O. It accepts only semantically verified Evidence produced by `analyze_javascript_application`, -`inspect_web_page`, or `inspect_electron_page`; matching operation names alone +`inspect_web_page`, `inspect_electron_page`, or +`observe_javascript_runtime`; matching operation names alone is insufficient. Provider identity, predicate version, subject digest, target parameters, and normalized-result schemas are checked before reconciliation. @@ -18,12 +19,13 @@ parameters, and normalized-result schemas are checked before reconciliation. 1. Run `analyze_javascript_application` against exactly one application layer. Optional cache or assets directories can be analyzed independently and supplied as additional layers. -2. Run `inspect_web_page` or `inspect_electron_page`. Capturing script sources +2. Run `inspect_web_page`, `inspect_electron_page`, or the attach-only + `observe_javascript_runtime`. Capturing script sources is optional, but an approved source capture provides the strongest byte identity. 3. Pass the resulting Evidence records to `reconcile_javascript_runtime`. Browser URLs normally need an explicit URL-prefix mapping. Extracted - Electron directories are mapped automatically when runtime files remain + Electron and V8 Inspector file locations are mapped automatically when runtime files remain beneath the analyzed input root; relocated files, ASAR projections, caches, and asset roots need explicit mappings. @@ -134,12 +136,19 @@ globally unloaded. ## Frames, workers, and source maps -Passive inspection now retains the execution-context frame ID supplied by CDP +Passive inspection retains the execution-context frame ID supplied by CDP for each accepted script. Electron captures also inventory authorized worker, service-worker, and shared-worker targets, including bounded opener-target and parent-frame relationships. These fields improve attribution while preserving the original exact-origin or canonical-root filter. +V8 Inspector observations expose execution-context IDs but no authenticated +frame relationship, so their scripts attach to the exact runtime target in the +combined graph. They never supply source bytes, require/import caller edges, +EventEmitter activity, Electron IPC, or script-unload evidence. A unique +authorized file or URL location can still correlate script presence with a +static asset, but it does not prove module initialization or feature execution. + Source-map declarations and approved original-source reads stay under static source-map authority. They are reported in `source_map_authority` but never used as primary runtime byte matches. A source name or `sourcesContent` digest is not diff --git a/docs/mcp-contracts.md b/docs/mcp-contracts.md index 45cca53e1..26f12c902 100644 --- a/docs/mcp-contracts.md +++ b/docs/mcp-contracts.md @@ -11,8 +11,14 @@ expected package version, catalog digest, or registered server path to reports their command vectors as aligned, stale, missing, or invalid, and keeps live-server state `unknown` unless the active connection supplies identity. -Tool names remain stable. `binary_session.tool_availability` explains each -operation with a stable availability reason instead of silently hiding it. +Canonical tool names remain stable, while `tools/list` advertises only the +operations callable for the current target, provider, policy, host, and +negotiated client capabilities. `binary_session.tool_availability` remains the +complete inventory: it explains advertised and hidden operations with stable +availability reasons and remediation. Each entry also reports required and +optional negotiated client features plus the currently missing features. Form elicitation is optional for +`capture_process_scenario`: an existing grant remains usable without it, while +a missing grant cannot be elicited by a client that does not advertise it. Opening or closing a target, reloading policy, or observing a provider health transition emits `notifications/tools/list_changed`. diff --git a/docs/reconstruction-obligation-ledgers.md b/docs/reconstruction-obligation-ledgers.md new file mode 100644 index 000000000..3f682e78e --- /dev/null +++ b/docs/reconstruction-obligation-ledgers.md @@ -0,0 +1,333 @@ +# Reconstruction obligation ledgers + +`build_reconstruction_obligation_ledger` turns authenticated Evidence v2 records +into a versioned, deterministic list of reconstruction claims. The same workflow +is available as: + +- MCP tool: `build_reconstruction_obligation_ledger` +- CLI command: `rea build-reconstruction-obligation-ledger` +- MCP resource: + `rea://evidence/{evidenceId}/reconstruction-obligation-ledger` + +The ledger is conservative by design. Static Application Graph facts create +candidate obligations; they do not prove runtime or process behavior. A required +obligation closes only when one manifest binding supplies a unique owner, any +required parser/schema/domain type, every required case fixture, and a passing +verifier whose authority is comparable to the original observation. The +verifier must enumerate the obligation ID and its result must be present in the +input Evidence bundle. Contradictions, duplicate definitions or owners, +residual unknowns, missing dependencies, and unavailable authority keep closure +open or failed. + +## Complete CLI request + +This empty request is useful for checking client integration. It is valid and +returns an `unknown` ledger with zero obligations; absence of source Evidence +never claims closure: + +```sh +rea build-reconstruction-obligation-ledger \ + '{ + "evidence_bundle": { + "bundle_version": 2, + "artifacts": [], + "providers": [], + "environments": [], + "scenarios": [], + "captures": [], + "unknowns": [], + "records": [] + }, + "reviewed_obligations": [], + "manifest": { + "schema_version": 1, + "bindings": [], + "contradictions": [] + }, + "limits": { "max_obligations": 100 }, + "page": { "offset": 0, "limit": 50 } + }' \ + --json +``` + +For a real investigation, export an Evidence bundle from the session and replace +the empty bundle. Application Graph and Process Capture v4 records generate +conservative candidates automatically. Add reviewed obligations when a required +claim is not represented by those sources. + +## Reviewed obligation examples + +Each example below is a complete `reviewed_obligations` element. Replace the +sample Evidence ID with an authenticated review record already present in +`evidence_bundle.records`. Stable IDs and versions make changes reviewable. + +### CLI parsing + +```json +{ + "obligation_id": "cli.config.invalid-option", + "obligation_version": 1, + "title": "Reject an invalid configuration option with the supported CLI error", + "application_layer": "cli", + "family": "argument-parsing", + "target": { + "artifact_sha256": null, + "application_node_id": null, + "semantic_node_id": null, + "location": "rea --unknown-option" + }, + "required": true, + "required_case_kinds": ["positive", "negative", "malformed"], + "required_original_authority": "process", + "required_fixture_authority": "packaged-process", + "required_verifier_authority": "packaged-process", + "requires_parser_type": true, + "dependency_obligation_ids": [], + "residual_unknown_ids": [], + "unavailable_authority": [], + "required_next_evidence": ["Capture the installed CLI for all three cases."], + "disposition": "active", + "review_evidence_ids": [ + "ev_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + ] +} +``` + +### Protocol handler + +```json +{ + "obligation_id": "protocol.rpc.cancel", + "obligation_version": 1, + "title": "Cancel an in-flight request and emit one terminal response", + "application_layer": "protocol", + "family": "request-response", + "target": { + "artifact_sha256": null, + "application_node_id": null, + "semantic_node_id": null, + "location": "JSON-RPC request cancellation" + }, + "required": true, + "required_case_kinds": ["positive", "negative", "malformed", "cancellation"], + "required_original_authority": "external", + "required_fixture_authority": "protocol", + "required_verifier_authority": "protocol", + "requires_parser_type": true, + "dependency_obligation_ids": [], + "residual_unknown_ids": [], + "unavailable_authority": [], + "required_next_evidence": [ + "Record request, cancellation, and terminal response IDs." + ], + "disposition": "active", + "review_evidence_ids": [ + "ev_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" + ] +} +``` + +### Electron startup and background behavior + +```json +{ + "obligation_id": "electron.background.startup", + "obligation_version": 1, + "title": "Start the background process before exposing the renderer bridge", + "application_layer": "electron", + "family": "startup", + "target": { + "artifact_sha256": null, + "application_node_id": null, + "semantic_node_id": null, + "location": "main process startup" + }, + "required": true, + "required_case_kinds": ["positive", "negative", "teardown"], + "required_original_authority": "runtime", + "required_fixture_authority": "renderer", + "required_verifier_authority": "renderer", + "requires_parser_type": false, + "dependency_obligation_ids": [], + "residual_unknown_ids": [], + "unavailable_authority": [], + "required_next_evidence": [ + "Observe main/renderer ordering and application shutdown." + ], + "disposition": "active", + "review_evidence_ids": [ + "ev_cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" + ] +} +``` + +### Persistence migration + +```json +{ + "obligation_id": "persistence.profile.migrate-v2", + "obligation_version": 1, + "title": "Migrate a version-one profile without losing unknown fields", + "application_layer": "persistence", + "family": "migration", + "target": { + "artifact_sha256": null, + "application_node_id": null, + "semantic_node_id": null, + "location": "profile schema v1 to v2" + }, + "required": true, + "required_case_kinds": ["positive", "negative", "malformed"], + "required_original_authority": "runtime", + "required_fixture_authority": "integration", + "required_verifier_authority": "integration", + "requires_parser_type": true, + "dependency_obligation_ids": [], + "residual_unknown_ids": [], + "unavailable_authority": [], + "required_next_evidence": [ + "Compare pre-migration and committed storage snapshots." + ], + "disposition": "active", + "review_evidence_ids": [ + "ev_dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" + ] +} +``` + +### Native ABI + +```json +{ + "obligation_id": "native-abi.helper.status", + "obligation_version": 1, + "title": "Preserve the helper status-code and output-buffer contract", + "application_layer": "native-abi", + "family": "ffi", + "target": { + "artifact_sha256": null, + "application_node_id": null, + "semantic_node_id": null, + "location": "helper_status(const uint8_t *, size_t, uint8_t *, size_t *)" + }, + "required": true, + "required_case_kinds": ["positive", "negative", "malformed"], + "required_original_authority": "process", + "required_fixture_authority": "native-abi", + "required_verifier_authority": "native-abi", + "requires_parser_type": true, + "dependency_obligation_ids": [], + "residual_unknown_ids": [], + "unavailable_authority": [], + "required_next_evidence": [ + "Run the ABI harness against the shipped and reconstructed libraries." + ], + "disposition": "active", + "review_evidence_ids": [ + "ev_eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" + ] +} +``` + +## Manifest and closure + +A manifest binding names one owner and its exact implementation digest. Both +`original_cases` and the reconstruction fixture list must cover every +`required_case_kinds` value with authenticated, comparable Evidence. +`parser_type` is mandatory when `requires_parser_type` is true. + +```json +{ + "obligation_id": "protocol.rpc.cancel", + "owner": { + "module_path": "src/protocol/requestRouter.ts", + "symbol": "cancelRequest", + "owner_sha256": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + }, + "parser_type": { + "parser": "parseCancelRequest", + "schema": "cancelRequestSchema", + "domain_type": "CancelRequest" + }, + "original_cases": [ + { + "kind": "positive", + "evidence_id": "ev_6666666666666666666666666666666666666666666666666666666666666666", + "location": "/captures/positive" + }, + { + "kind": "negative", + "evidence_id": "ev_7777777777777777777777777777777777777777777777777777777777777777", + "location": "/captures/negative" + }, + { + "kind": "malformed", + "evidence_id": "ev_8888888888888888888888888888888888888888888888888888888888888888", + "location": "/captures/malformed" + }, + { + "kind": "cancellation", + "evidence_id": "ev_9999999999999999999999999999999999999999999999999999999999999999", + "location": "/captures/cancellation" + } + ], + "fixtures": [ + { + "fixture_id": "rpc.cancel.positive", + "case_kind": "positive", + "authority": "protocol", + "evidence_ids": [ + "ev_1111111111111111111111111111111111111111111111111111111111111111" + ] + }, + { + "fixture_id": "rpc.cancel.negative", + "case_kind": "negative", + "authority": "protocol", + "evidence_ids": [ + "ev_2222222222222222222222222222222222222222222222222222222222222222" + ] + }, + { + "fixture_id": "rpc.cancel.malformed", + "case_kind": "malformed", + "authority": "protocol", + "evidence_ids": [ + "ev_3333333333333333333333333333333333333333333333333333333333333333" + ] + }, + { + "fixture_id": "rpc.cancel.cancellation", + "case_kind": "cancellation", + "authority": "protocol", + "evidence_ids": [ + "ev_4444444444444444444444444444444444444444444444444444444444444444" + ] + } + ], + "verifier": { + "verifier_id": "rpc.cancel.conformance", + "claim_id": "protocol.rpc.cancel.v1", + "command": "npm run test:protocol -- cancel", + "authority": "protocol", + "status": "pass", + "result_evidence_id": "ev_5555555555555555555555555555555555555555555555555555555555555555", + "enumerated_obligation_ids": ["protocol.rpc.cancel"], + "nondeterminism": { + "mode": "partial-order", + "specification": "cancel precedes the single terminal response" + } + } +} +``` + +All referenced Evidence IDs must exist in the bundle. A green unit test cannot +close a `packaged-process` obligation. A static-only source cannot close a +runtime or process claim. Marking a claim `blocked` or `out-of-scope` records the +disposition but does not silently count it as verified. + +Pagination changes only `page` and the returned `obligations` slice. Every page +retains the same `ledger_id`, `closure_digest`, full-ledger summaries, reports, +ownership graph, dependency graph, Evidence links, and limitations. Consumers +should follow `next_offset` until it is `null`, and should reject pages whose +identity or closure digest changes mid-read. diff --git a/docs/reconstruction-readiness.md b/docs/reconstruction-readiness.md new file mode 100644 index 000000000..40d649116 --- /dev/null +++ b/docs/reconstruction-readiness.md @@ -0,0 +1,99 @@ +# Reconstruction readiness conformance + +Run the complete source-owned native, JavaScript CLI, Electron, Evidence, +comparison, obligation, replay, CLI, and MCP journey from a clean checkout: + +```sh +npm ci +npm run verify:readiness +``` + +The command builds the redistributable native conformance fixtures, inventories +the native executable through the public CLI, analyzes the generated JavaScript +CLI and Electron fixture through both CLI and MCP, verifies exact advertised +limits, evaluates the same nine-stage report through both surfaces, reads the +full MCP report resource, and proves stale/tampered replay rejection. It prints +one compact JSON summary. + +Set `REA_READINESS_REPORT_PATH` to retain the complete machine-readable report: + +```sh +REA_READINESS_REPORT_PATH=readiness-report.json npm run verify:readiness +``` + +CI runs this command on Linux, publishes the compact summary, and retains the +full report as the `reconstruction-readiness` artifact. + +## Public contracts + +- CLI: `rea evaluate-reconstruction-readiness --json` +- MCP tool: `evaluate_reconstruction_readiness` +- Full MCP resource: + `rea://evidence/{evidenceId}/reconstruction-readiness-report` + +The MCP tool result contains only report identity, status, summary, metrics, and +the resource URI. The full Evidence bundle, stage records, comparisons, +contradictions, obligation ledger, and replay inputs stay in the retained +resource instead of consuming the tool-response context. + +## Required stages + +| Stage | Required proof | +| ------------------------------- | --------------------------------------------------------------------------------------------------------------------- | +| `discover-classify` | target-free startup, artifact inventory, compatible workflow selection, and exact visible limits | +| `diagnose-environment` | broken runtime separated from analysis failure, version skew detected, and revision changed after recovery | +| `acquire-authority` | exact missing scope, narrow grant, expansion re-prompt, and no launch after denial/cancellation | +| `static-analysis` | native and JavaScript routing plus preserved ambiguity, truncation, unsupported syntax, and residual unknowns | +| `reactive-scenarios` | predicate-driven interaction, descendant settlement, Electron correlation, and cancellation cleanup Evidence | +| `compare-authority-candidate` | explicit partial-order/finite-trace semantics, primary divergence localization, and unknown for incomplete comparison | +| `preserve-contradictions` | record-and-continue, affected equivalence blocked, and unaffected comparison retained | +| `verify-reconstruction-closure` | incomplete reconstruction detected, incremental verifier closure, and authority-delegating candidates rejected | +| `export-replay` | CLI/MCP parity, process/structured failure parity, deterministic replay, tamper rejection, and stale-input rejection | + +Every stage and required check must occur exactly once and link to Evidence in +the embedded Evidence v2 bundle. `fail`, `unknown`, `unsupported`, `truncated`, +and `skipped` never aggregate to `pass`. + +## Fail-closed rules + +The evaluator rejects or withholds readiness when: + +- a bounded capability omits its effective numeric limits; +- a fixture lacks exactly one compatible selected workflow; +- an incompatible or unavailable provider was invoked; +- a typed CLI failure exits zero, or an MCP failure reports success; +- concurrent behavior uses total-order comparison; +- truncation, instability, unavailable authority, or contradiction is labeled + equivalent; +- a deliberate primary divergence is not localized; +- contradiction Evidence or its affected comparison is missing; +- the reconstruction obligation ledger is not `ready`, has no required + obligation, or retains an unowned/unverified required obligation; +- denied authority launches a process, cancellation loses diagnostics, or owned + resources remain; +- replay is nondeterministic, tampering/staleness is not detected, or the + expected source digest differs. + +Each finding names its stage, stable reason code, Evidence IDs, and detail. +Stage `capability_issue` and `next_action` fields map unsupported or failing +work to the responsible capability and remediation without claiming that the +requested analysis ran. + +## Fixtures + +The verifier uses only source-owned, redistributable fixtures: + +- `tests/conformance` native executables with stable symbols and deliberate + version divergence; +- `tests/conformance/readiness/javascript-cli`, which exposes prompts, + alternate-screen behavior, configuration precedence, child process, + persistence, loopback HTTP, and signal teardown to static reconstruction; +- `tests/conformance/readiness/electron`, which exposes main, preload, + renderer, utility, IPC, renderer restart, blocked shell effect, and deep-link + surfaces; +- the shared incomplete reconstruction and broken-runtime observations in + `RECONSTRUCTION_READINESS_EXAMPLE`. + +The synthetic example is a public typed input, not a global equivalence claim. +It demonstrates that every deliberate fault remains represented in the final +report and that only comparable Evidence can close the associated obligation. diff --git a/skills/reverse-engineer-anything/SKILL.md b/skills/reverse-engineer-anything/SKILL.md index ffb62f967..ba3a5a2aa 100644 --- a/skills/reverse-engineer-anything/SKILL.md +++ b/skills/reverse-engineer-anything/SKILL.md @@ -3,8 +3,8 @@ name: reverse-engineer-anything description: Reverse engineer native, managed, Electron/JavaScript, packaged, and browser applications with REA. Use shipped-artifact or approved runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. metadata: version: "23" - tool_count: 99 - catalog_digest: "e787c57af8337f17b9da72745fcb328634af3b39be1d9ca8bfe1836274351f92" + tool_count: 110 + catalog_digest: "e66efaf38bba145c4899bbc65eddb3ff983e49c0193ae536f8e9d68f36c4b063" --- # REA diff --git a/tests/conformance/README.md b/tests/conformance/README.md index 8805402bf..60baa45b2 100644 --- a/tests/conformance/README.md +++ b/tests/conformance/README.md @@ -27,3 +27,9 @@ large fixture contains 1,205 uniquely named functions and strings so provider pagination can be checked at boundaries of 500, 1,000, and 1,205. Objective-C, Swift, and N-API-like fixtures provide metadata-oriented inputs without package or network dependencies. + +`readiness/` adds source-only generated JavaScript CLI and Electron fixtures for +the public reconstruction-readiness journey. `npm run verify:readiness` combines +them with the compiled native fixtures, exercises CLI and MCP parity, and emits +the versioned machine-readable readiness report documented in +`docs/reconstruction-readiness.md`.