@dsh-plus/agent-preset-rea 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +637 -0
- package/lib/index.d.ts +145 -0
- package/lib/index.js +422 -0
- package/package.json +60 -3
- package/skills/reverse-engineer-anything/LICENSE +21 -0
- package/skills/reverse-engineer-anything/SKILL.md +342 -0
- package/skills/reverse-engineer-anything/references/android-applications.md +34 -0
- package/skills/reverse-engineer-anything/references/connection-and-recovery.md +127 -0
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +71 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +175 -0
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +277 -0
- package/skills/reverse-engineer-anything/references/runtime-observation.md +78 -0
- package/src/client/card.tsx +120 -0
- package/src/client/client.ts +51 -0
- package/src/client/draft.ts +28 -0
- package/src/client/i18n.ts +43 -0
- package/src/client/styles.ts +32 -0
- package/src/config.ts +110 -0
- package/src/definition.ts +188 -0
- package/src/index.ts +95 -0
- package/src/mcp.ts +42 -0
- package/src/ns.ts +9 -0
- package/src/prompt.ts +25 -0
- package/src/registration.ts +86 -0
- package/src/skill.ts +24 -0
- package/README.md +0 -3
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# JavaScript and Electron application artifacts
|
|
2
|
+
|
|
3
|
+
For captured or bundled JavaScript that needs readable source recovery, use
|
|
4
|
+
`recover_javascript_sources` with an absolute `path` and absent
|
|
5
|
+
`output_directory`. Supply related runtime/shared/lazy files in
|
|
6
|
+
`additional_paths` when advertised, then analyze the returned `analysis_input`
|
|
7
|
+
directory together. Each input retains its own snapshot, digest and byte-range
|
|
8
|
+
provenance; inputs and recovered code are never executed. Recovery requires a
|
|
9
|
+
caller-supplied Wakaru on Linux x64; see [the recovery guide](https://github.com/morluto/rea/blob/main/docs/javascript-recovery.md).
|
|
10
|
+
|
|
11
|
+
Use `analyze_javascript_application` directly on the operator-supplied ASAR or
|
|
12
|
+
extracted tree. When the question concerns known source paths and the connected
|
|
13
|
+
schema advertises `source_paths`, select exact inventoried paths such as
|
|
14
|
+
`["package.json", "main.js", "preload.js"]`. Include supporting manifests or
|
|
15
|
+
source maps explicitly; dependencies are not implicitly analyzed. REA retains
|
|
16
|
+
the complete artifact inventory and identity but reads source text and analyzes
|
|
17
|
+
only selected files. The result and summary record `source_selection`; files
|
|
18
|
+
outside scope and their relationships remain unknown, so partial application
|
|
19
|
+
coverage does not mean the selected source failed. Use repeated `--source-path`
|
|
20
|
+
on either static application CLI route. Omit the selection when the question
|
|
21
|
+
requires complete application analysis. `detail: "summary"` reduces delivery
|
|
22
|
+
and does not by itself reduce analysis work.
|
|
23
|
+
|
|
24
|
+
Exact `#alias` specifiers resolve through the importer's
|
|
25
|
+
enclosing package `imports` map to package-local files; nested `node_modules`
|
|
26
|
+
packages use their own map. Wildcard, recursive, and external-package import
|
|
27
|
+
targets stay unresolved with that limitation. When size is unknown or large and the connected schema advertises
|
|
28
|
+
`detail`, request `detail: "summary"`. This returns an `inspect_analysis_view`
|
|
29
|
+
Evidence record with a distinct ID and a `normalized_result.parent_evidence_id`
|
|
30
|
+
for the complete retained application analysis. Source-map contents are part of
|
|
31
|
+
that static analysis. Read findings, coverage, limitations and unknowns, then
|
|
32
|
+
follow a specific unanswered question. Older servers without `detail` return
|
|
33
|
+
the complete application Evidence inline when it fits.
|
|
34
|
+
|
|
35
|
+
When the connected schema advertises `max_heap_mb` and `analysis_timeout_ms`,
|
|
36
|
+
these select the isolated source analyzer's old-space heap and per-source
|
|
37
|
+
deadline. Defaults are 1024 MiB and 300000 ms. They do not change the MCP
|
|
38
|
+
process heap. A Bun-hosted REA does not enforce the heap choice; on Windows it
|
|
39
|
+
instead limits the analyzer's committed memory to that choice plus a 512 MiB
|
|
40
|
+
runtime reserve.
|
|
41
|
+
Resource-limited analyses preserve completed static facts and
|
|
42
|
+
report partial semantic coverage with specific unknown scopes; this does not
|
|
43
|
+
mean the source is malformed. Inspect those limits before retrying a source.
|
|
44
|
+
When expanded relationships exceed the parent's available memory, inspect the
|
|
45
|
+
file's modules item view for retained `static_analysis` and
|
|
46
|
+
`semantic_module_analysis`. Their facts remain available even when graph links
|
|
47
|
+
are unknown. Cumulative result exhaustion can stop analysis before every file
|
|
48
|
+
is examined; the inventory and remaining unknown scopes distinguish that case.
|
|
49
|
+
Timeout or cancellation after source analysis begins retains partial Evidence
|
|
50
|
+
in the same session. A returned `error.details.partial_observation` reference
|
|
51
|
+
can be supplied directly to `inspect_analysis_view`. If the SDK cancels locally, retrieve its recorded ID from
|
|
52
|
+
the Evidence bundle before inspecting the partial analysis.
|
|
53
|
+
|
|
54
|
+
## Read a module without repeating analysis
|
|
55
|
+
|
|
56
|
+
Use the actual returned parent ID, on the same connection, as `source.evidence_id`.
|
|
57
|
+
The following IDs are placeholders to replace with returned values. When the
|
|
58
|
+
module's node ID is not already known, page identities before selecting an item.
|
|
59
|
+
Pages return only node IDs, paths and roles; choose a useful page size and follow
|
|
60
|
+
`coverage.next_offset` when another page matters:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"source": {
|
|
65
|
+
"kind": "retained-evidence",
|
|
66
|
+
"evidence_id": "ev_ACTUAL_PARENT_ID"
|
|
67
|
+
},
|
|
68
|
+
"view": { "kind": "page", "collection": "modules", "offset": 0, "limit": 16 }
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Select the relevant page entry by its exact `node_id` and recorded role:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"source": {
|
|
77
|
+
"kind": "retained-evidence",
|
|
78
|
+
"evidence_id": "ev_ACTUAL_PARENT_ID"
|
|
79
|
+
},
|
|
80
|
+
"view": {
|
|
81
|
+
"kind": "item",
|
|
82
|
+
"collection": "modules",
|
|
83
|
+
"selector": { "node_id": "jag_node_ACTUAL_NODE_ID" }
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Module pages include asset, bundled and source module roles, so one path can
|
|
89
|
+
identify several entries. Use `selector.path` only when uniqueness is established;
|
|
90
|
+
the returned node ID avoids needing a complete inventory to prove uniqueness. On ambiguity,
|
|
91
|
+
select the matching node ID from the page or the error's candidates. Follow
|
|
92
|
+
`next_offset` when another page matters. An item exposes that module node's
|
|
93
|
+
recorded observations, identity, hashes, exports and source ranges; it does not
|
|
94
|
+
include every child syntax observation, related edge or original source file.
|
|
95
|
+
An absent item fact is not evidence of absence from the whole application.
|
|
96
|
+
|
|
97
|
+
## Trace only the remaining question
|
|
98
|
+
|
|
99
|
+
Use `trace_application_feature` on the parent application Evidence for one
|
|
100
|
+
literal node ID, route, string, API, IPC channel, module, or native export.
|
|
101
|
+
Select `incoming` for relationships leading to the seed, `outgoing` for those
|
|
102
|
+
leaving it, and `both` when the question needs both. Trace traversal includes
|
|
103
|
+
containment relationships, so even a narrow seed can expand many nodes; a
|
|
104
|
+
bidirectional trace can reach unrelated sibling modules. A module item or page
|
|
105
|
+
is preferable when its observations already answer the question. Do not treat
|
|
106
|
+
all reached nodes as participants in the feature.
|
|
107
|
+
|
|
108
|
+
Reuse retained parent Evidence when the server advertises it, or supply complete
|
|
109
|
+
Evidence inline. Include Hopper or Ghidra Evidence only when its artifact digest
|
|
110
|
+
matches exactly.
|
|
111
|
+
|
|
112
|
+
## Recover an oversized display
|
|
113
|
+
|
|
114
|
+
An oversized response reports `resource_constraint` and
|
|
115
|
+
`details.resource: "transport"`. Reuse
|
|
116
|
+
`details.reported_limits.evidence_reference` with `inspect_analysis_view` for a
|
|
117
|
+
summary, one module, or a stable page of module identities.
|
|
118
|
+
`export_evidence_bundle` writes the complete canonical session to a
|
|
119
|
+
caller-selected file. These workflows keep the original Evidence and coverage;
|
|
120
|
+
a broad follow-up can also exceed framing.
|
|
121
|
+
|
|
122
|
+
A client can truncate a successful result inside its text envelope without a
|
|
123
|
+
REA `resource_constraint`. Treat a truncation notice or incomplete JSON as a
|
|
124
|
+
display limitation; do not claim the full record was examined. Reuse the known
|
|
125
|
+
parent ID for smaller views, or export complete Evidence to a selected file
|
|
126
|
+
while the session remains open. If the parent ID was lost from the preview,
|
|
127
|
+
use the prior analysis summary or explicit ledger entries to recover it; do
|
|
128
|
+
not invent an ID or rerun analysis just to reproduce the same display.
|
|
129
|
+
|
|
130
|
+
BrowserWindow preferences, preload and contextBridge surfaces, IPC
|
|
131
|
+
registrations, utility processes, and native binding requests are static syntax
|
|
132
|
+
observations. Only a unique exact literal IPC channel match supports an inferred
|
|
133
|
+
pairing. Dynamic or ambiguous channels remain unresolved. A requested `.node`
|
|
134
|
+
member is not a verified native export. Never claim runtime reachability,
|
|
135
|
+
registration, defaults, or policy enforcement from static analysis.
|
|
136
|
+
|
|
137
|
+
For version comparison, analyze each version once, then call
|
|
138
|
+
`compare_application_versions`. Accept only its digest, source-map, structural
|
|
139
|
+
fingerprint, or non-module semantic matches. Module ordinals and minified names
|
|
140
|
+
are not persistent identity. Report added or removed only with complete
|
|
141
|
+
opposite-side coverage; otherwise report unknown.
|
|
142
|
+
|
|
143
|
+
When the question asks how one exact exported callable's returned object shape
|
|
144
|
+
changed, analyze each version once and then call
|
|
145
|
+
`compare_javascript_export_shapes` with explicit module paths and export names.
|
|
146
|
+
Use the returned IDs on the same connection, or complete inline Evidence
|
|
147
|
+
records, from both analysis calls. Accept variant
|
|
148
|
+
pairing only through the tool's unique exact literal discriminant. Read
|
|
149
|
+
`property_inventories` and each change's `presence` before treating `unknown` as
|
|
150
|
+
"the name was not observed": inventories list observed property names even when
|
|
151
|
+
values stay unknown, with a `source_range` for each paired or unpaired variant.
|
|
152
|
+
Array holes and mutation-invalidated slots are not observed properties.
|
|
153
|
+
Complete parent coverage reports presence-only
|
|
154
|
+
`added`/`removed` independently of unresolved values. Cite the
|
|
155
|
+
comparison Evidence and report JSON Pointer changes; dynamic values, ambiguous
|
|
156
|
+
variants, and incomplete parent-property coverage stay unknown. This is static
|
|
157
|
+
inference, not runtime behavior. When runtime semantics are needed, run
|
|
158
|
+
behavioral probes against the relevant application versions and capture them
|
|
159
|
+
through the available browser, Electron, or process workflows.
|
|
160
|
+
|
|
161
|
+
## Reusing application Evidence
|
|
162
|
+
|
|
163
|
+
When advertised by the connected server, application trace and compare tools
|
|
164
|
+
accept complete inline Evidence or
|
|
165
|
+
`{"kind":"retained-evidence","evidence_id":"ev_<64 lowercase hex characters>"}`
|
|
166
|
+
for their application input (`application`, or `left`/`right`). `inspect_analysis_view`
|
|
167
|
+
uses the same retained-reference form in `source`, or portable inline Evidence,
|
|
168
|
+
to project a summary, module page, or one module with its recorded observations. This notation is
|
|
169
|
+
a template: replace it with the actual returned ID. Versions before 4.1.0 accept only full
|
|
170
|
+
inline Evidence. Use the exact ID
|
|
171
|
+
returned by the producer on the same MCP connection. Resolution does not run
|
|
172
|
+
analysis or select a provider; findings remain inline. Native observation
|
|
173
|
+
arrays still take full Evidence. `close_binary` clears retained references;
|
|
174
|
+
export a bundle before closing, or supply portable inline Evidence in another
|
|
175
|
+
connection. A missing reference includes its ID and recovery guidance.
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# Native, managed, and packaged artifacts
|
|
2
|
+
|
|
3
|
+
## Go build metadata
|
|
4
|
+
|
|
5
|
+
Use `inspect_go_binary` for an explicit local ELF, PE or thin Mach-O when the
|
|
6
|
+
question concerns the embedded compiler version, module/dependency versions,
|
|
7
|
+
local replacements or build settings. No `open_binary`, Go installation or
|
|
8
|
+
target execution is required. The CLI equivalent is `inspect-go-binary PATH`.
|
|
9
|
+
Preserve artifact SHA-256, original file ranges, framed module bytes and every
|
|
10
|
+
unparsed module-text line. A missing record is an unknown, not proof of a
|
|
11
|
+
non-Go binary; observed metadata does not authenticate its claims. Function,
|
|
12
|
+
source and type recovery remain a separate native-analysis question.
|
|
13
|
+
|
|
14
|
+
## Rust dependency metadata
|
|
15
|
+
|
|
16
|
+
Use `inspect_rust_binary` for an explicit local ELF, PE, or thin Mach-O when
|
|
17
|
+
the question concerns the cargo-auditable crate list embedded in `.dep-v0`
|
|
18
|
+
(Mach-O: `__DATA,.dep-v0`). No `open_binary`, Rust installation, or target
|
|
19
|
+
execution is required. The CLI equivalent is `inspect-rust-binary PATH`.
|
|
20
|
+
Preserve artifact SHA-256, package order, dependency indices, and the section
|
|
21
|
+
file range. A missing section is null metadata, not proof the binary has no
|
|
22
|
+
dependencies. An omitted package kind stays null. A rustc commit hash is
|
|
23
|
+
inferred from a read-only `/rustc/<40-hex>/` path and does not by itself
|
|
24
|
+
identify the compiler. See [Rust binaries](https://github.com/morluto/rea/blob/main/docs/rust-binaries.md).
|
|
25
|
+
|
|
26
|
+
## SQLite snapshots
|
|
27
|
+
|
|
28
|
+
Use `inspect_sqlite_database` with an explicit local database snapshot for its
|
|
29
|
+
schema and optional rows from one exact ordinary table. It requires Node.js
|
|
30
|
+
24.x >=24.15 or 26+ with the native `DatabaseSync.limits` API. It also consumes the
|
|
31
|
+
existing sibling `-wal`; retain both original digests when citing its result.
|
|
32
|
+
Default output is a compact inventory; a selected table expands only its own
|
|
33
|
+
schema and samples 20 rows. Select `columns` to avoid irrelevant or large cells,
|
|
34
|
+
and request `schema_scope: "database"` only for complete schema details.
|
|
35
|
+
Choose `row_limit` when a finite sample is useful and keep truncation and
|
|
36
|
+
unspecified row order explicit. Virtual tables, shadow tables and views are
|
|
37
|
+
schema facts, not row-read targets. REA inspects private copies and leaves
|
|
38
|
+
the source files untouched; obtain a coherent quiescent database/WAL snapshot
|
|
39
|
+
before inspection. See [SQLite snapshots](https://github.com/morluto/rea/blob/main/docs/sqlite-databases.md).
|
|
40
|
+
|
|
41
|
+
## Recorded Linux crashes
|
|
42
|
+
|
|
43
|
+
Use `inspect_recorded_crash` with an explicit Linux x86-64 ELF core path to
|
|
44
|
+
inspect historical thread registers, signals, raw notes and original file
|
|
45
|
+
ranges. It is independent of the active disassembler target. Source-bound
|
|
46
|
+
register values and note bytes are observations; missing notes, signal-thread
|
|
47
|
+
association and current executable/library identity remain unknown. PIDs are
|
|
48
|
+
historical metadata and never authorize live attach or control.
|
|
49
|
+
|
|
50
|
+
The optional `include_debugger_context` facet adds mapping candidates through
|
|
51
|
+
caller-supplied GDB/pwndbg in an owned core-only session. Display names do not
|
|
52
|
+
establish current file identity; zero reported flags leave permissions unknown.
|
|
53
|
+
Requested unavailable context fails with setup guidance. See
|
|
54
|
+
[recorded crashes](https://github.com/morluto/rea/blob/main/docs/recorded-crashes.md)
|
|
55
|
+
for exact upstream profiles, bounds and verification coverage.
|
|
56
|
+
|
|
57
|
+
## Offline ELF layout
|
|
58
|
+
|
|
59
|
+
Use `inspect_binary_layout` with an explicit local ELF path for file-backed
|
|
60
|
+
sections, symbols, relocations, linkage names, and static mitigation inferences
|
|
61
|
+
without opening a disassembler target. When that complete record is already
|
|
62
|
+
retained, call `inspect_analysis_view` for a summary, mitigations or linkage
|
|
63
|
+
facet, one section or symbol, or a stable page. Do not re-run the decoder to
|
|
64
|
+
read a single object.
|
|
65
|
+
|
|
66
|
+
## Offline WASM
|
|
67
|
+
|
|
68
|
+
Use `inspect_wasm_artifact` with caller-supplied WABT for selected local bytes.
|
|
69
|
+
For counts, validation and WAT identity, select `detail: "summary"` on the first
|
|
70
|
+
MCP call. The complete original Evidence stays retained; use
|
|
71
|
+
`normalized_result.parent_evidence_id` for exact exports or text pages. Omitted
|
|
72
|
+
or complete detail keeps the existing complete result.
|
|
73
|
+
For a completed result, use `inspect_analysis_view` with its reported retained
|
|
74
|
+
reference for a summary or `view: {kind: "wasm", facet: "exports", offset: 0, limit: 32}`.
|
|
75
|
+
Facets also include sections, imports, candidates, glue, WAT, headers, details
|
|
76
|
+
and tool profile. Text offsets count UTF-16 code units; follow `next_offset`.
|
|
77
|
+
The complete source remains retained after an oversized MCP reply. No target
|
|
78
|
+
execution or network acquisition is implied, and WAT is decoded representation.
|
|
79
|
+
|
|
80
|
+
## Native targets
|
|
81
|
+
|
|
82
|
+
After `open_binary`, use focused search, procedure, or function tools directly.
|
|
83
|
+
Use `binary_overview` when target metadata or inventory context helps answer the
|
|
84
|
+
question. Prefer literal search, names, decompilation, callers, callees, and
|
|
85
|
+
cross-references. Addresses and recovered pseudocode are analysis observations,
|
|
86
|
+
not original source. Provider unavailability and unsupported metadata remain
|
|
87
|
+
unknown rather than false.
|
|
88
|
+
|
|
89
|
+
For a completed `analyze_function` dossier, use `inspect_analysis_view` with
|
|
90
|
+
`view: {kind: "native", facet: "value_flow_operations", offset: 0, limit: 32}`
|
|
91
|
+
and the exact retained Evidence ID to read selected facts without reanalysis.
|
|
92
|
+
Native facets also include procedure, pseudocode, assembly, basic blocks,
|
|
93
|
+
comments, callers/callees, references, unresolved calls, referenced strings and
|
|
94
|
+
names, the native API record, and value-flow summaries. Pseudocode offsets and limits count UTF-16
|
|
95
|
+
code units; use the returned `next_offset` for continuation. Provider limitations
|
|
96
|
+
and unavailable facts remain explicit; the complete parent Evidence is retained.
|
|
97
|
+
|
|
98
|
+
`inspect_macho` on a large framework returns megabytes of imports and exports.
|
|
99
|
+
Select `detail: "summary"` for slice identity, UUID and per-collection counts,
|
|
100
|
+
then page rows with `view: {kind: "macho", facet: "exports", offset: 0, limit: 64}`
|
|
101
|
+
and `normalized_result.parent_evidence_id`. Facets are entrypoints,
|
|
102
|
+
architectures, build_metadata, load_commands, dependencies, imports, exports,
|
|
103
|
+
segments and provenance. `source_exhaustive: false` means unreturned symbols
|
|
104
|
+
may exist.
|
|
105
|
+
|
|
106
|
+
To see which functions or Objective-C methods a Mach-O actually calls in one
|
|
107
|
+
run, use `observe_native_calls` with explicit breakpoints and a bounded
|
|
108
|
+
`duration_ms`/`max_events`. It launches a new process under LLDB, so the target
|
|
109
|
+
runs and may change files or use the network. Hardened-runtime targets need the
|
|
110
|
+
`get-task-allow` entitlement.
|
|
111
|
+
|
|
112
|
+
Use `binary_session` with no arguments to check the open target, selected
|
|
113
|
+
provider, and alignment. Its default `result.tool_availability` carries a
|
|
114
|
+
complete inventory grouped by shared facts. Expand each group's `names` and
|
|
115
|
+
inherit the inventory-level client requirements unless a group overrides them;
|
|
116
|
+
availability, reasons, remediation, modes, and flags remain inline. The
|
|
117
|
+
`effects` and `annotations` arrays name true flags from fixed vocabularies, so an
|
|
118
|
+
omitted known flag is false. `tools/list` remains the canonical source for full
|
|
119
|
+
tool schemas when target or provider state changes.
|
|
120
|
+
|
|
121
|
+
Provider capability groups carry provider identity and ordered limitations.
|
|
122
|
+
Prepend each set's `shared_limitations` to a group's `limitations` to recover the
|
|
123
|
+
operation's full ordered list. Candidate capabilities describe possible
|
|
124
|
+
providers. Top-level session capabilities describe the current route, and
|
|
125
|
+
`analysis_provider_binding` identifies the selected provider.
|
|
126
|
+
|
|
127
|
+
## DOS MZ with Ghidra
|
|
128
|
+
|
|
129
|
+
For an admitted DOS MZ target, use `inspect_native_load_image` to check measured
|
|
130
|
+
loaded bytes, file mappings, relocations and the entry against the immutable
|
|
131
|
+
snapshot. Keep `mismatch` and `unsupported` explicit. Verified import covers the
|
|
132
|
+
reported static image, not runtime DOS or PC-98 hardware behavior.
|
|
133
|
+
|
|
134
|
+
For Ghidra decompilation, `procedure_pseudo_code` also accepts `procedure: "file-offset:0x..."`; CLI `rea decompile <path> --file-offset=0x... --provider ghidra` resolves the source byte offset internally. An unresolved 0x-prefixed numeric procedure selector also falls back to a unique file mapping. Existing symbols and analysis addresses win; multiple mappings fail as ambiguous. Preserve the returned file-offset and address locations and raw selection observations. ELF virtual addresses are distinct from file offsets; never assume an arbitrary offset plus image base is an analysis address.
|
|
135
|
+
|
|
136
|
+
Use `read_bytes` for initialized analysis memory and `address_to_file_offset` to
|
|
137
|
+
anchor one observed address to original file bytes. Loader fixups can change a
|
|
138
|
+
word; a source offset does not imply byte equality. Complete function body ranges
|
|
139
|
+
use inclusive ends and can contain gaps. Do not treat the enclosing span as code.
|
|
140
|
+
For packed targets, retain the original and separately derived artifact identities;
|
|
141
|
+
decompiling an unpacking stub does not recover the unpacked program.
|
|
142
|
+
|
|
143
|
+
When reading Objective-C dispatch metadata, distinguish class implementation
|
|
144
|
+
methods from protocol requirements: class methods report null requirement
|
|
145
|
+
flags, while decoded protocol declarations retain required and optional facts.
|
|
146
|
+
Property attributes remain raw name/value tokens; use the property's
|
|
147
|
+
`atomicity` field for the decoded `N` marker or the default atomic behavior.
|
|
148
|
+
Null class/meta flags, ivar counts, atomicity, or read-only values mean the
|
|
149
|
+
selected provider did not establish that fact. Symbol names alone do not prove
|
|
150
|
+
that a class is a root class or has no ivars.
|
|
151
|
+
|
|
152
|
+
## Managed PE/CLI
|
|
153
|
+
|
|
154
|
+
Start with `inspect_managed_artifact`. REA's canonical managed inspection is
|
|
155
|
+
execution-free: do not claim it loaded, reflected, executed, or resolved the
|
|
156
|
+
assembly. Keep managed/native boundaries and unavailable reconstruction facts
|
|
157
|
+
explicit. A bring-your-own reconstruction oracle is separate from the canonical
|
|
158
|
+
parser and must not become an implicit setup dependency.
|
|
159
|
+
|
|
160
|
+
For identity/classification questions, `inspect_managed_artifact` can explicitly
|
|
161
|
+
select `detail: "summary"` on the first MCP call. It retains complete metadata
|
|
162
|
+
and returns a linked overview with full classification/evidence, nullable
|
|
163
|
+
module/MVID, frameworks, metadata coverage/issues/limitations and returned-row
|
|
164
|
+
counts. Default complete requests remain unchanged. Read original rows with
|
|
165
|
+
`inspect_analysis_view`, source `normalized_result.parent_evidence_id`, and
|
|
166
|
+
`view: {kind: "managed", collection: "attributes", offset: 0, limit: 16}`.
|
|
167
|
+
Collections are `references`, `resources` and `attributes`. Paging does not
|
|
168
|
+
repeat parsing. Returned-row exhaustion
|
|
169
|
+
does not prove complete metadata or absence under partial/unavailable coverage;
|
|
170
|
+
preserve build-local tokens and their artifact/MVID scope.
|
|
171
|
+
|
|
172
|
+
`inspect_managed_members` always returns the assembly-wide `member_refs`, even
|
|
173
|
+
for one selected type. For questions about a selected type, select
|
|
174
|
+
`detail: "summary"` with `type_names`; it returns the selection (with unmatched
|
|
175
|
+
names), coverage and per-collection counts. Page rows with
|
|
176
|
+
`view: {kind: "managed-members", collection: "call_edges", offset: 0, limit: 64}`
|
|
177
|
+
over `types`, `exported_types`, `fields`, `methods`, `member_refs`, `call_edges`,
|
|
178
|
+
`field_accesses` or `user_strings`.
|
|
179
|
+
|
|
180
|
+
### .NET NativeAOT
|
|
181
|
+
|
|
182
|
+
NativeAOT binaries contain native machine code, so ordinary CIL decompilers
|
|
183
|
+
cannot recover the original method bodies. When managed metadata/CIL is absent,
|
|
184
|
+
classify that as a native-analysis route rather than claiming source recovery.
|
|
185
|
+
Open the native image with the selected deep provider and inspect functions,
|
|
186
|
+
strings, calls, and references; describe decompiler output as pseudocode and
|
|
187
|
+
inference.
|
|
188
|
+
|
|
189
|
+
NativeAOT images can be PE/COFF, ELF, or Mach-O executables and shared
|
|
190
|
+
libraries. Use file bytes and loader metadata rather than suffixes to identify
|
|
191
|
+
them. For packaged apps, inventory/extract with REA's artifact tools and retain
|
|
192
|
+
the exact contained image identity. PDB, ELF debug, or dSYM sidecars are
|
|
193
|
+
additional evidence only when the provider accepts and matches them.
|
|
194
|
+
|
|
195
|
+
REA has a built-in read-only snapshot parser for x64 PE targets with .NET 8 RTR
|
|
196
|
+
9.1 metadata. An optional headless Ghidra adapter adds database annotations and
|
|
197
|
+
broader metadata recovery on Linux; it requires an explicitly configured
|
|
198
|
+
NativeAOT JAR. These are separate routes. The built-in parser also runs on
|
|
199
|
+
Windows Ghidra P0; read frozen literals from its report, because
|
|
200
|
+
`search_strings` does not include them. See the
|
|
201
|
+
[NativeAOT guide](https://github.com/morluto/rea/blob/main/docs/ghidra-nativeaot.md)
|
|
202
|
+
for setup, supported layouts, and host restrictions. Preserve binary identity
|
|
203
|
+
and distinguish derived metadata from Ghidra database observations. Recovered
|
|
204
|
+
types and native pseudocode are not original C# source. Windows Ghidra P0 has
|
|
205
|
+
no database mutation authority.
|
|
206
|
+
|
|
207
|
+
## Packages and extraction
|
|
208
|
+
|
|
209
|
+
Use `inspect_artifact` for application bundles, archives, ZIP/APK/IPA/MSIX/AppX,
|
|
210
|
+
ASAR, or DMG inputs when the artifact graph and findings help answer the
|
|
211
|
+
question. It returns the complete artifact graph inline. Cite graph manifest
|
|
212
|
+
IDs when using them.
|
|
213
|
+
|
|
214
|
+
For an IPA or a macOS `.app`, ZIP, or DMG, pass the inventory Evidence to
|
|
215
|
+
`project_apple_application_graph`. It reports application roots and nested
|
|
216
|
+
bundles by path convention: app extensions, XPC services, frameworks, login
|
|
217
|
+
items, system and driver extensions, and plug-ins. It also lists privileged
|
|
218
|
+
helpers, launchd plists, symlinks, and each bundle's `info_plist_path` and
|
|
219
|
+
executable candidates. Roles are path conventions, not parsed plists; read the
|
|
220
|
+
listed plists with `inspect_plist`.
|
|
221
|
+
|
|
222
|
+
After `open_binary` on a `.app` or Mach-O, use `trace_dylib_resolution` to see
|
|
223
|
+
which file each `@rpath`, `@loader_path` and `@executable_path` load reaches for
|
|
224
|
+
every executable in the bundle. It also lists missing or weak loads and earlier
|
|
225
|
+
`@rpath` candidates that are absent. Narrow large bundles with `roots` or
|
|
226
|
+
`architecture`. System paths stay undetermined because the dyld shared cache
|
|
227
|
+
provides them.
|
|
228
|
+
|
|
229
|
+
Use `extract_artifact` when materialized files are needed. It extracts the active
|
|
230
|
+
target and accepts optional `integrity_policy`; see the [MCP contracts](https://github.com/morluto/rea/blob/main/docs/mcp-contracts.md).
|
|
231
|
+
It materializes all regular files into a fresh temporary directory chosen by
|
|
232
|
+
REA. Symlinks and encrypted entries are inventory facts, not extractable files.
|
|
233
|
+
The result reports the materialized directory; callers do not choose the
|
|
234
|
+
destination. No separate permission grant is needed.
|
|
235
|
+
|
|
236
|
+
Native DMG traversal automatically uses a read-only mount on supported macOS
|
|
237
|
+
hosts, with an owned temporary mount directory and cleanup. It needs no approval
|
|
238
|
+
flag. Unsupported hosts or mount failures remain explicit limitations; do not
|
|
239
|
+
claim child inventory when only root identity is available. Extraction is a
|
|
240
|
+
separate filesystem-writing operation.
|
|
241
|
+
|
|
242
|
+
For headerless DOS COM, explicitly open with `format: "dos-com"` (CLI
|
|
243
|
+
`--target-format dos-com`). Inspect the load image before trusting function
|
|
244
|
+
analysis: the entry is `0x10100`, file offset zero, with imposed real-mode segment
|
|
245
|
+
context. PSP/stack/device state remains unmodeled. See [DOS guide](https://github.com/morluto/rea/blob/main/docs/ghidra-dos.md).
|
|
246
|
+
|
|
247
|
+
For other headerless images (embedded firmware without ELF/Mach-O/PE/MZ
|
|
248
|
+
headers), open with `format: "raw-binary"`, `architecture` (`x86`, `x86_64`,
|
|
249
|
+
`arm`, `arm64`, or `6502`), and `entry_point` (`0x` hex). File offset 0 is mapped at
|
|
250
|
+
that address. Hopper and IDA refuse this interpretation; Ghidra uses
|
|
251
|
+
`BinaryLoader` with a little-endian generic language. Big-endian, Thumb-only,
|
|
252
|
+
and Cortex-M variants are unsupported. `6502` selects NMOS 6502; the entry and
|
|
253
|
+
complete file mapping must fit within `0x0000..0xffff`. 65C02, 65816, cartridge
|
|
254
|
+
containers, bank switching, and mapper semantics are unsupported. Windows
|
|
255
|
+
Ghidra P0 admits raw images only for `6502`. See [raw binary guide](https://github.com/morluto/rea/blob/main/docs/raw-binary.md).
|
|
256
|
+
|
|
257
|
+
### Function annotations in Ghidra
|
|
258
|
+
|
|
259
|
+
Use `annotate_native_function` for one function name and/or entry comments, with at least one explicit change. Review its annotation readback and refreshed dossier inline. Changes are atomic and session-scoped; empty comments clear them, omitted fields preserve them. Later MCP calls observe edits until close. CLI `annotate-native-function` returns the updated analysis before discarding the session. Original executable bytes are unchanged; edits invalidate immutable snapshots. Windows P0 does not admit database mutations. For naming only, `set_address_name` / `set_addresses_names` also work with Ghidra: they name function entries or data addresses (primary labels) and return compact per-address success booleans instead of a dossier.
|
|
260
|
+
|
|
261
|
+
## Offline PE resource inventory
|
|
262
|
+
|
|
263
|
+
Use `inspect_pe_resources` with an absolute `path`, or
|
|
264
|
+
`rea inspect-pe-resources ./selected.exe --json`, for portable PE32/PE32+
|
|
265
|
+
resource inspection without opening a native target. Preserve returned Evidence:
|
|
266
|
+
type/name/language IDs and UTF-16 names, original directory/data/payload ranges,
|
|
267
|
+
code pages, payload hashes and static icon-group references. Same-language icon
|
|
268
|
+
resolution is explicit; missing references and size mismatch remain visible.
|
|
269
|
+
Other payloads are opaque, and this operation does not decode images or simulate
|
|
270
|
+
Windows resource loading. Consult the budgets and supported tree profile in
|
|
271
|
+
[offline binary diagnostics](https://github.com/morluto/rea/blob/main/docs/binary-diagnostics.md).
|
|
272
|
+
|
|
273
|
+
For exact core-module import/export differences, use `compare_wasm_interfaces`
|
|
274
|
+
with two complete inspection Evidence records (or current-session retained
|
|
275
|
+
references) and explicit scope. Preserve unknown types/duplicate names; static
|
|
276
|
+
interface equality is not runtime compatibility. CLI accepts complete inline
|
|
277
|
+
Evidence in `rea compare-wasm-interfaces input.json --json`.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Browser and Electron runtime observation
|
|
2
|
+
|
|
3
|
+
Supply the existing browser or Electron instance's literal-port loopback CDP
|
|
4
|
+
endpoint in the request. No separate permission configuration or per-call
|
|
5
|
+
approval flag is needed. Browser discovery lists eligible HTTP(S) pages;
|
|
6
|
+
`allowed_origins` optionally filters them. An individual capture defaults to the
|
|
7
|
+
selected page's current origin. Electron discovery lists eligible local
|
|
8
|
+
`file://` targets without a configured file-root allowlist.
|
|
9
|
+
|
|
10
|
+
Start passive browser work with `list_browser_targets`; start Electron runtime work with
|
|
11
|
+
`list_electron_targets`. Before an electron-main Inspector attempt, check
|
|
12
|
+
packaged fuses with `inspect_electron_fuses`. Inspect the target selected for
|
|
13
|
+
the user's task. Observation with these tools is passive: never claim REA
|
|
14
|
+
clicked, navigated, evaluated page JavaScript, invoked IPC, or captured prior
|
|
15
|
+
activity. REA does not contain the page's network.
|
|
16
|
+
|
|
17
|
+
Passive captures omit raw header collections, credential header values, storage
|
|
18
|
+
values, and raw WebSocket/JSON bodies. Selected response metadata, including
|
|
19
|
+
content encoding, policy values, and Link URLs, is retained. Local URLs retain ordinary query
|
|
20
|
+
values and fragments; userinfo credentials are removed. Browser accessibility
|
|
21
|
+
text, console primitives, value-free shapes, script sources, source maps, and
|
|
22
|
+
storage key names have request-specific capture options. Electron script
|
|
23
|
+
sources are also optional. Use `capture_web_screenshot` when pixels are needed.
|
|
24
|
+
Treat scope filtering, truncation, and attach-window coverage as limitations.
|
|
25
|
+
Page-declared WebMCP tools are untrusted inventory and are never invoked by REA.
|
|
26
|
+
|
|
27
|
+
## Who performs the action
|
|
28
|
+
|
|
29
|
+
- The user performs it: `list_browser_targets`, then `inspect_web_page` or
|
|
30
|
+
`observe_web_session` on the selected target.
|
|
31
|
+
- The agent must perform it: one `capture_browser_scenario` with declared
|
|
32
|
+
actions. Use connect mode with the loopback CDP endpoint and `target_id` for
|
|
33
|
+
an existing browser, or launch mode with a caller-selected executable for a
|
|
34
|
+
temporary profile. Connect mode first navigates the selected page to
|
|
35
|
+
`start_url`, which can clear unsaved form values and other temporary state.
|
|
36
|
+
Recreate the state needed for the investigation in the declared actions.
|
|
37
|
+
Connect mode leaves the external browser open; launch mode owns a temporary
|
|
38
|
+
browser and profile. Check `browser.cleanup` for the outcome.
|
|
39
|
+
Request only the DOM, accessibility, or network details needed for the question.
|
|
40
|
+
The default final capture contains the URL; step outcomes are reported separately.
|
|
41
|
+
Add a wait action for the expected page state before capturing it. Report that
|
|
42
|
+
REA performed the declared actions.
|
|
43
|
+
|
|
44
|
+
Scenario network records have no request initiator stacks. For that evidence,
|
|
45
|
+
use passive capture while the user performs the action. Listener source locations
|
|
46
|
+
identify candidate handlers; they do not establish which script sent a particular
|
|
47
|
+
request. Avoid overlapping passive capture and scenario actions on the same target.
|
|
48
|
+
|
|
49
|
+
Focused follow-up tools:
|
|
50
|
+
|
|
51
|
+
- `observe_web_execution`: execution coverage during a window; it resets
|
|
52
|
+
counters and temporarily disables optimization.
|
|
53
|
+
- `inspect_web_event_listeners`: source locations for listeners registered
|
|
54
|
+
directly on the first CSS match, without dispatching an event.
|
|
55
|
+
- `compare_web_captures`: two normalized passive captures or recorded scenarios.
|
|
56
|
+
- `discover_webmcp_tools`: inspect page-declared WebMCP inventory; never invoke
|
|
57
|
+
the discovered tools.
|
|
58
|
+
|
|
59
|
+
Use `reconcile_javascript_runtime` only after static application Evidence and
|
|
60
|
+
passive browser/Electron Evidence exist. Prefer captured-source digest identity;
|
|
61
|
+
report path/digest disagreement as a mismatch and preserve ambiguity. Explicit
|
|
62
|
+
path mappings are inference inputs and never broaden filesystem or CDP authority.
|
|
63
|
+
A bundle observed at runtime does not prove every contained module executed.
|
|
64
|
+
|
|
65
|
+
## Fiddler Everywhere traffic debugging
|
|
66
|
+
|
|
67
|
+
For large saved captures, request `detail: "summary"`, then page retained Evidence
|
|
68
|
+
with `inspect_analysis_view` and `view: {kind: "capture", detail: "preview", offset: 0, limit: 20}`.
|
|
69
|
+
Select complete record pages only for needed headers, metadata or payloads; views
|
|
70
|
+
read the historical parent without repeating capture decoding.
|
|
71
|
+
|
|
72
|
+
Inspect native `.saz` snapshots with `inspect_web_network_capture` and
|
|
73
|
+
`format: "saz"`; encrypted archives are unsupported. For live
|
|
74
|
+
traffic analysis, connect Everywhere's separate MCP server and use its
|
|
75
|
+
advertised session tools with an explicit `sessionsSource` (`LiveTraffic` or
|
|
76
|
+
`AgentCalls`). Preserve existing sessions and filters when inspecting a
|
|
77
|
+
recorded run. See the [capture and MCP guide](https://github.com/morluto/rea/blob/main/docs/web-network-captures.md)
|
|
78
|
+
for the workflow and Telerik's public setup and traffic-debugging skills.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 「逆向工程」预设配置卡片:唯一字段是 persona 提示词。
|
|
3
|
+
*
|
|
4
|
+
* 经 injectPluginConfigCard 注册(插件页 plugins.row.config / plugins.bundle.config,
|
|
5
|
+
* view 分发 summary/page);外壳与草稿语义走 @dsh-plus/shared/client 套件
|
|
6
|
+
* (CardChrome + useNamespaceDraft:staged 草稿、脏判定、revision fencing、
|
|
7
|
+
* Host 更新不覆盖在途编辑)。
|
|
8
|
+
*
|
|
9
|
+
* 为什么只有这一个字段:`Config` 里只有 `personaPrefix` 标了 `.volatile()`
|
|
10
|
+
* (对用户的承诺=必须给编辑器);MCP 参数、超时、附加 skill 根等属部署方平面,
|
|
11
|
+
* 由 profile 的 cordis.patch.yml 行级配置覆盖,因此卡片底部只作说明。
|
|
12
|
+
* 保存后 loader 原位提交活动引用并广播 `loader/volatile-update`,宿主半据此换代
|
|
13
|
+
* 注册预设声明——新建会话即用新提示词,已存在会话保持原装配。
|
|
14
|
+
* @module agent-preset-rea/client/card
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
type CardAction,
|
|
19
|
+
CardChrome,
|
|
20
|
+
CardLoading,
|
|
21
|
+
type NamespaceSettingsApi,
|
|
22
|
+
type PluginConfigViewProps,
|
|
23
|
+
type Scope,
|
|
24
|
+
useNamespaceDraft,
|
|
25
|
+
} from '@dsh-plus/shared/client'
|
|
26
|
+
import type { ReactElement } from 'react'
|
|
27
|
+
import { type ConfigValue, type Draft, draftFromValue, toPatch } from './draft.ts'
|
|
28
|
+
import type { Translate } from './i18n.ts'
|
|
29
|
+
|
|
30
|
+
export interface CardProps extends PluginConfigViewProps {
|
|
31
|
+
t: Translate
|
|
32
|
+
scope: Scope
|
|
33
|
+
api: NamespaceSettingsApi
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** 卡片动作:放弃 / 保存(仅脏且可写时可用)。 */
|
|
37
|
+
function cardActions(options: {
|
|
38
|
+
t: Translate
|
|
39
|
+
dirty: boolean
|
|
40
|
+
saving: boolean
|
|
41
|
+
disabled: boolean
|
|
42
|
+
onDiscard(): void
|
|
43
|
+
onSave(): void
|
|
44
|
+
}): CardAction[] {
|
|
45
|
+
return [
|
|
46
|
+
{
|
|
47
|
+
key: 'discard',
|
|
48
|
+
label: options.t('discard'),
|
|
49
|
+
disabled: !options.dirty || options.saving,
|
|
50
|
+
onClick: options.onDiscard,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
key: 'save',
|
|
54
|
+
label: options.t(options.saving ? 'saving' : 'save'),
|
|
55
|
+
variant: 'primary',
|
|
56
|
+
disabled: !options.dirty || options.saving || options.disabled,
|
|
57
|
+
onClick: options.onSave,
|
|
58
|
+
},
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function ReaCard(props: CardProps): ReactElement | string | null {
|
|
63
|
+
const { t, scope, api } = props
|
|
64
|
+
const state = useNamespaceDraft<ConfigValue, Draft>({
|
|
65
|
+
scope,
|
|
66
|
+
api,
|
|
67
|
+
from: draftFromValue,
|
|
68
|
+
patch: toPatch,
|
|
69
|
+
saveFailedLabel: t('saveFailed'),
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
// 插件页 summary 视图只出一行简介(hooks 已全部落定,可安全提前返回)。
|
|
73
|
+
if (props.view === 'summary') return t('summaryLine')
|
|
74
|
+
|
|
75
|
+
const draft = state.draft
|
|
76
|
+
if (state.value === undefined || draft === null) {
|
|
77
|
+
return <CardLoading prefix="apr" text={t('loading')} />
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const disabled = state.disabled
|
|
81
|
+
return (
|
|
82
|
+
<CardChrome
|
|
83
|
+
prefix="apr"
|
|
84
|
+
title={t('title')}
|
|
85
|
+
description={t('description')}
|
|
86
|
+
dirty={state.dirty}
|
|
87
|
+
dirtyLabel={t('unsaved')}
|
|
88
|
+
readOnlyNotice={disabled ? t('readOnly') : undefined}
|
|
89
|
+
status={state.status}
|
|
90
|
+
actions={cardActions({
|
|
91
|
+
t,
|
|
92
|
+
dirty: state.dirty,
|
|
93
|
+
saving: state.saving,
|
|
94
|
+
disabled,
|
|
95
|
+
onDiscard: state.reset,
|
|
96
|
+
onSave: state.save,
|
|
97
|
+
})}
|
|
98
|
+
>
|
|
99
|
+
<div className="apr-field">
|
|
100
|
+
<div className="apr-head">
|
|
101
|
+
<label className="apr-label" htmlFor="apr-prompt">
|
|
102
|
+
{t('prompt')}
|
|
103
|
+
</label>
|
|
104
|
+
</div>
|
|
105
|
+
<textarea
|
|
106
|
+
id="apr-prompt"
|
|
107
|
+
className="apr-textarea"
|
|
108
|
+
rows={10}
|
|
109
|
+
spellCheck={false}
|
|
110
|
+
placeholder={t('promptPlaceholder')}
|
|
111
|
+
value={draft.personaPrefix}
|
|
112
|
+
disabled={disabled}
|
|
113
|
+
onChange={(event) => state.edit({ personaPrefix: event.target.value })}
|
|
114
|
+
/>
|
|
115
|
+
<p className="apr-hint">{t('promptHint')}</p>
|
|
116
|
+
{draft.personaPrefix.trim() === '' ? <p className="apr-hint">{t('promptEmpty')}</p> : null}
|
|
117
|
+
</div>
|
|
118
|
+
</CardChrome>
|
|
119
|
+
)
|
|
120
|
+
}
|