references/connection-and-recovery.md
8.6 KB查看排版效果| 1 | # Connection and task recovery |
| 2 | |
| 3 | Read this guide only for an observed connection, command, approval or provider |
| 4 | blocker. Keep the user's target and question in view. Explain what prevented the |
| 5 | operation and the next useful step; after repair, continue the investigation. |
| 6 | |
| 7 | Commands below use an installed `rea`. If none is available, use the package |
| 8 | invocation in `SKILL.md` when acquiring REA is authorized. Follow the connected |
| 9 | server's schemas and the installed CLI's help rather than assuming repository |
| 10 | main and an older release expose the same arguments. |
| 11 | |
| 12 | ## Choose the remedy from the observed failure |
| 13 | |
| 14 | | Observation | Meaning and next step | |
| 15 | | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 16 | | No REA tools in the active session | Inspect registration with `rea doctor --client codex --json`. A skill installation alone does not register MCP. | |
| 17 | | Missing, malformed or stale registration | Prepare a scoped setup plan; apply only authorized changes with backups. | |
| 18 | | Aligned registration, but no connected tools | Restart/reconnect the client. Doctor checks registration; it cannot establish the current agent's connection. Inspect the client's launch error if reconnection fails. | |
| 19 | | `MCP tool call requires approval, but approval policy is never` | Codex rejected the call before REA executed it. Do not install an engine or repeat setup to solve this client-policy decision. See the approval section below. | |
| 20 | | REA returns `provider_unavailable` or an unavailable tool entry | Read that operation's provider diagnostics or `binary_session.result.tool_availability`. Expand each group's tool names and inherit the shared client requirements unless overridden. Use the operation's availability, reason, and remediation; a complete tool catalog does not imply every operation is available. | |
| 21 | | `rea` is missing in a child shell, or Node is incompatible | Inspect the actual shell PATH and launcher/runtime. A prefix installation may be absent from a login shell's PATH; this does not establish a broken MCP registration. | |
| 22 | |
| 23 | If the client cannot launch its shell/sandbox helper or read the installed skill, |
| 24 | inspect its launch diagnostic. For example, Codex can refuse helper aliases when |
| 25 | CODEX_HOME is under `/tmp`; use an authorized profile outside the OS temporary |
| 26 | directory. REA setup cannot repair the client's executor. Preserve the sandbox |
| 27 | instead of silently disabling it to make an analysis command work. |
| 28 | |
| 29 | Static JavaScript and ordinary ZIP inventory need neither Hopper nor Ghidra. |
| 30 | HAR inspection is offline and does not require a live browser. Native |
| 31 | decompilation, Android analysis and firmware extraction have their own |
| 32 | bring-your-own prerequisites. Use supported inventory/static evidence when it |
| 33 | answers part of the question, and name the unavailable evidence separately. |
| 34 | Do not substitute another target. Label observations from ordinary shell tools |
| 35 | as such; only actual REA output supplies REA Evidence. |
| 36 | |
| 37 | ## Repair registration when needed |
| 38 | |
| 39 | For Codex: |
| 40 | |
| 41 | ```bash |
| 42 | rea doctor --client codex --json |
| 43 | rea setup --client codex --dry-run --json |
| 44 | ``` |
| 45 | |
| 46 | Use the current supported client's ID: `claude_code`, `claude_desktop`, `codex`, |
| 47 | `cursor`, `gemini_cli`, `windsurf`, `devin`, `opencode`, `antigravity`, |
| 48 | `copilot_cli`, `commandcode`, `qwen_code`, `vscode`, `trae`, `grok_build`, `omp`, `pi`, |
| 49 | `hermes`, `qoder`, `droid`, `zcode`, `dsh`, or `grok_bot`. If unknown, inspect `doctor --json` before choosing a |
| 50 | scope. `grok_bot` uses a chat registration step rather than local `mcp.json`. |
| 51 | For unsupported clients, use version-pinned manual stdio registration or CLI. |
| 52 | |
| 53 | Show the plan's exact paths, backups, changes and bundled-skill replacement. |
| 54 | Obtain approval for writes when that concrete scope is not already authorized, |
| 55 | then apply the same scope with `rea setup --client codex --yes`. Add |
| 56 | `--install-hopper` only when separately needed and explicitly approved. Do not |
| 57 | install or upgrade unrelated prerequisites. Restart/reconnect, verify tools |
| 58 | actually appear, and resume the original task. If they remain absent, inspect |
| 59 | the launch failure rather than looping through setup. |
| 60 | |
| 61 | ## Codex tool approval is separate from REA readiness |
| 62 | |
| 63 | REA tools have no permission-grant handshake. Codex can still require approval |
| 64 | because an operation creates owned resources, launches a helper or has cleanup |
| 65 | effects. An advertised tool or successful doctor result does not override that |
| 66 | client policy. `workspace-write` alone does not resolve an MCP approval |
| 67 | rejection, and `approval_policy = "never"` does not mean every MCP tool is |
| 68 | preapproved. |
| 69 | |
| 70 | When interactive approval is available, use the client's approval flow for the |
| 71 | requested operation. In an unattended run, continue through an authorized CLI |
| 72 | workflow if the execution environment permits it, or report the blocked |
| 73 | operation and the approval needed to proceed. Do not retry the same rejected |
| 74 | call, silently broaden approvals, or rewrite MCP effects as read-only. |
| 75 | |
| 76 | For an operator who explicitly wants to preapprove named operations in a |
| 77 | disposable Codex profile, current Codex supports per-tool configuration. For |
| 78 | example, opening and closing an analysis session can be scoped independently: |
| 79 | |
| 80 | ```toml |
| 81 | [mcp_servers.rea.tools.open_binary] |
| 82 | approval_mode = "approve" |
| 83 | |
| 84 | [mcp_servers.rea.tools.close_binary] |
| 85 | approval_mode = "approve" |
| 86 | ``` |
| 87 | |
| 88 | Use the actual server ID and only the operations whose effects were approved; |
| 89 | this example does not approve inspection, extraction or runtime execution. |
| 90 | Show the proposed config edit and preserve unrelated entries and backups before |
| 91 | writing. Managed policy can constrain client settings. Consult the |
| 92 | [Codex configuration reference](https://learn.chatgpt.com/docs/config-file/config-reference) |
| 93 | for the installed client's supported settings. This is an optional recovery |
| 94 | choice, not a prerequisite for every REA task. |
| 95 | |
| 96 | ## Continue through an installed CLI |
| 97 | |
| 98 | Check the command environment only if the launcher fails: |
| 99 | |
| 100 | ```bash |
| 101 | command -v rea |
| 102 | command -v node |
| 103 | node --version |
| 104 | rea --version |
| 105 | ``` |
| 106 | |
| 107 | Use the public launcher at its known installation path with a supported existing |
| 108 | Node on PATH when the child shell loses a prefix installation. Avoid internal |
| 109 | `dist/cli.js` entrypoints or global toolchain changes. MCP may have its own valid |
| 110 | launcher even when a shell cannot resolve `rea`. |
| 111 | |
| 112 | For a user-supplied JavaScript tree or ASAR, select output files in the authorized |
| 113 | workspace and save complete Evidence before reading a view: |
| 114 | |
| 115 | ```bash |
| 116 | rea analyze-javascript-application /absolute/path/to/app --json > app-evidence.json |
| 117 | jq -c '{source: {kind: "inline", evidence: .}, view: {kind: "summary"}}' app-evidence.json > app-view.json |
| 118 | rea inspect-analysis-view app-view.json |
| 119 | ``` |
| 120 | |
| 121 | These commands do not register MCP or install an analysis engine. CLI JavaScript |
| 122 | JSON is complete and can be very large; redirect it rather than loading it into |
| 123 | context. Use an existing JSON processor if `jq` is absent, without installing |
| 124 | one just for this recipe. Inspect a module page or item using the same inline |
| 125 | source and the [JavaScript recipes](javascript-applications.md). Preserve graph |
| 126 | coverage, limitations and unknowns. Native CLI analysis still requires its |
| 127 | selected engine, and all CLI operations retain the host's execution permissions. |
文件内容是平台检查时读出的文本,只供查看。平台不会运行包里的任何脚本或程序。

