Skip to content

Commit 7250ad4

Browse files
rebelrebel
authored andcommitted
Add local handoff executor
1 parent 6396644 commit 7250ad4

7 files changed

Lines changed: 578 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.28.0
4+
5+
- Added `codexpro execute-handoff` as an opt-in local executor for `.ai-bridge/current-plan.md`.
6+
- Added built-in local adapters for `opencode`, `pi`, and `codex`, plus a restricted `--command` template path for custom agents.
7+
- Added `--dry-run`, `--yes`, timeout handling, stdout/stderr capture, `agent-status.md`, `implementation-diff.patch`, and `execution-log.jsonl` output.
8+
- Kept `handoff_to_agent` planning-only; local execution is not exposed as a remote MCP tool.
9+
- Added smoke coverage for dry-run previews, custom command validation, execution status, diff collection, and structured execution logging.
10+
311
## 0.27.2
412

513
- Added `handoff_to_agent` for file-based handoffs to Codex, OpenCode, Pi, or custom local implementation agents without executing local commands.

README.md

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ CodexPro does not bypass, increase, or modify ChatGPT, Codex, or OpenAI rate lim
113113
- `handoff_to_agent` — write `.ai-bridge/current-plan.md` for Codex, OpenCode, Pi, or a custom local implementation agent without executing local commands.
114114
- `handoff_to_codex` — compatibility wrapper for `handoff_to_agent` with `agent=codex`.
115115

116+
Local-only companion command:
117+
118+
- `codexpro execute-handoff` — run a previously written `.ai-bridge/current-plan.md` through a local agent, then collect status, logs, and git diff. This is intentionally a CLI command, not a remote MCP tool.
119+
116120
## Visual ChatGPT cards
117121

118122
v0.8+ registers a reusable Apps SDK widget resource:
@@ -446,13 +450,58 @@ In handoff mode, ChatGPT can create a plan for a local implementation agent with
446450
.ai-bridge/execution-log.jsonl
447451
```
448452

449-
Then run your local agent manually against `.ai-bridge/current-plan.md`, for example:
453+
Then run the implementation locally with `codexpro execute-handoff`:
450454

451455
```bash
452-
opencode run --model provider/cheap-model "$(cat .ai-bridge/current-plan.md)"
456+
codexpro execute-handoff --agent opencode --model provider/cheap-model
457+
```
458+
459+
Dry-run first if you want to inspect the exact command:
460+
461+
```bash
462+
codexpro execute-handoff --agent opencode --model provider/cheap-model --dry-run
463+
```
464+
465+
Pi adapter:
466+
467+
```bash
468+
codexpro execute-handoff --agent pi --model provider/cheap-model
469+
```
470+
471+
Custom adapter:
472+
473+
```bash
474+
codexpro execute-handoff \
475+
--agent custom \
476+
--command "my-agent --model {{model}} --task-file {{plan_file}}" \
477+
--model provider/cheap-model
453478
```
454479

455-
Have the implementation agent update `.ai-bridge/agent-status.md`, write the final review diff to `.ai-bridge/implementation-diff.patch` when practical, and then let ChatGPT review those files through `read_handoff` or `codex_context`.
480+
Template placeholders:
481+
482+
```text
483+
{{model}} model passed with --model
484+
{{plan_file}} absolute path to .ai-bridge/current-plan.md
485+
{{plan_text}} full plan text as one argument
486+
{{root}} workspace root
487+
```
488+
489+
By default, `execute-handoff` asks for local confirmation before running. Use `--yes` only in trusted scripts. After execution, CodexPro writes:
490+
491+
```text
492+
.ai-bridge/agent-status.md
493+
.ai-bridge/implementation-diff.patch
494+
.ai-bridge/execution-log.jsonl
495+
```
496+
497+
Then let ChatGPT review those files through `read_handoff` or `codex_context`.
498+
499+
Manual fallback:
500+
501+
```bash
502+
opencode run --model provider/cheap-model "$(cat .ai-bridge/current-plan.md)"
503+
git diff --no-ext-diff -- > .ai-bridge/implementation-diff.patch
504+
```
456505

457506
For debugging whether ChatGPT is actually reaching the local server, add:
458507

SECURITY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ CodexPro can expose:
2121
- `.ai-bridge` planning files
2222
- optional shell command execution through the `bash` tool
2323
- optional write/edit capability depending on `CODEXPRO_WRITE_MODE`
24+
- optional local handoff execution through `codexpro execute-handoff`, run from the user's terminal only
2425

2526
The main risks are:
2627

2728
- connecting an untrusted MCP client
2829
- exposing the server through a public tunnel without auth
2930
- running with `CODEXPRO_BASH_MODE=full`
3031
- running with `CODEXPRO_WRITE_MODE=workspace` on an important repo
32+
- executing an untrusted `.ai-bridge/current-plan.md` or custom `execute-handoff --command`
3133
- adding overly broad allowed roots
3234
- leaking a `codexpro_token` or Cloudflare tunnel token
3335
- trusting a downloaded `cloudflared` binary without understanding where it came from
@@ -72,6 +74,8 @@ codexpro start \
7274
- Do not commit printed connector URLs that include `codexpro_token`.
7375
- Do not commit Cloudflare tunnel tokens.
7476
- Use `--mode handoff` for planning workflows where ChatGPT should not edit source files.
77+
- Preview local handoff execution with `codexpro execute-handoff --dry-run` before running an unfamiliar adapter or custom command.
78+
- Keep `execute-handoff` local. Do not wrap it in a remote MCP tool unless you add a stronger approval and sandbox story.
7579
- Use default agent mode only with trusted ChatGPT sessions and repo-specific roots.
7680
- Use `--bash full` only for trusted local repos.
7781
- Prefer a repo-specific `--root` instead of `--allow-home`.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codexpro",
3-
"version": "0.27.2",
3+
"version": "0.28.0",
44
"description": "A local MCP/App SDK-style connector that lets ChatGPT inspect, edit, and hand off work to Codex inside a local dev workspace.",
55
"type": "module",
66
"license": "MIT",
@@ -58,7 +58,7 @@
5858
"start:http": "node dist/http.js",
5959
"dev:stdio": "tsx src/stdio.ts",
6060
"dev:http": "tsx src/http.ts",
61-
"smoke": "node scripts/smoke.mjs && node scripts/http-smoke.mjs && node scripts/pro-smoke.mjs && node scripts/doctor-smoke.mjs && node scripts/settings-smoke.mjs",
61+
"smoke": "node scripts/smoke.mjs && node scripts/http-smoke.mjs && node scripts/pro-smoke.mjs && node scripts/doctor-smoke.mjs && node scripts/settings-smoke.mjs && node scripts/execute-handoff-smoke.mjs",
6262
"doctor": "node scripts/codexpro.mjs doctor",
6363
"connect": "node scripts/codexpro.mjs",
6464
"connect:setup": "node scripts/codexpro.mjs setup",

0 commit comments

Comments
 (0)