agent-intern 0.30.2__tar.gz → 0.30.3__tar.gz
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.
- {agent_intern-0.30.2 → agent_intern-0.30.3}/PKG-INFO +28 -15
- {agent_intern-0.30.2 → agent_intern-0.30.3}/README.md +27 -14
- {agent_intern-0.30.2 → agent_intern-0.30.3}/agent_intern.egg-info/PKG-INFO +28 -15
- {agent_intern-0.30.2 → agent_intern-0.30.3}/codex_bridge.py +1 -1
- {agent_intern-0.30.2 → agent_intern-0.30.3}/copilot_bridge.py +1 -1
- {agent_intern-0.30.2 → agent_intern-0.30.3}/cursor_bridge.py +75 -7
- {agent_intern-0.30.2 → agent_intern-0.30.3}/grok_bridge.py +1 -1
- {agent_intern-0.30.2 → agent_intern-0.30.3}/opencode_bridge.py +14 -4
- {agent_intern-0.30.2 → agent_intern-0.30.3}/proc_tree.py +94 -1
- {agent_intern-0.30.2 → agent_intern-0.30.3}/pyproject.toml +1 -1
- {agent_intern-0.30.2 → agent_intern-0.30.3}/server.py +4 -4
- {agent_intern-0.30.2 → agent_intern-0.30.3}/swarm.py +2 -2
- {agent_intern-0.30.2 → agent_intern-0.30.3}/swarm_watch.py +2 -1
- {agent_intern-0.30.2 → agent_intern-0.30.3}/LICENSE +0 -0
- {agent_intern-0.30.2 → agent_intern-0.30.3}/agent_intern.egg-info/SOURCES.txt +0 -0
- {agent_intern-0.30.2 → agent_intern-0.30.3}/agent_intern.egg-info/dependency_links.txt +0 -0
- {agent_intern-0.30.2 → agent_intern-0.30.3}/agent_intern.egg-info/entry_points.txt +0 -0
- {agent_intern-0.30.2 → agent_intern-0.30.3}/agent_intern.egg-info/requires.txt +0 -0
- {agent_intern-0.30.2 → agent_intern-0.30.3}/agent_intern.egg-info/top_level.txt +0 -0
- {agent_intern-0.30.2 → agent_intern-0.30.3}/kimi_bridge.py +0 -0
- {agent_intern-0.30.2 → agent_intern-0.30.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agent-intern
|
|
3
|
-
Version: 0.30.
|
|
3
|
+
Version: 0.30.3
|
|
4
4
|
Summary: MCP server bridging the Antigravity (agy), OpenAI Codex, GitHub Copilot, Cursor, opencode, Grok Build, and Kimi Code CLIs so Claude Code can drive them as sub-agents
|
|
5
5
|
Author: Sinan Tüfekçi
|
|
6
6
|
License: MIT
|
|
@@ -64,12 +64,17 @@ file path.
|
|
|
64
64
|
|
|
65
65
|
## Quick start
|
|
66
66
|
|
|
67
|
-
**1.
|
|
67
|
+
**1. Install it** (needs [uv](https://docs.astral.sh/uv/)). The plugin is the recommended way, because
|
|
68
|
+
it adds three slash commands on top of the server:
|
|
68
69
|
|
|
69
70
|
```bash
|
|
70
|
-
claude
|
|
71
|
+
claude plugin marketplace add SinanTufekci/agent-intern
|
|
72
|
+
claude plugin install agent-intern@agent-intern
|
|
71
73
|
```
|
|
72
74
|
|
|
75
|
+
Or register just the MCP server: `claude mcp add -s user agent-intern -- uvx agent-intern`. Pick
|
|
76
|
+
one or the other, since doing both gives Claude every tool twice.
|
|
77
|
+
|
|
73
78
|
**2. Install at least one backend CLI and sign in once.** Any one of them works on its own:
|
|
74
79
|
|
|
75
80
|
| If you have… | Install | Sign in |
|
|
@@ -83,11 +88,20 @@ claude mcp add -s user agent-intern -- uvx agent-intern
|
|
|
83
88
|
**3. Restart Claude Code and just ask.** The server ships its own routing guide as MCP instructions,
|
|
84
89
|
so Claude knows which tool fits — you don't have to name them:
|
|
85
90
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
- *"Ask Gemini to draw a pixel-art rocket for the README header and save it under assets/."*
|
|
92
|
+
- *"Have Copilot review the diff you just wrote — read-only — and tell me where it disagrees with you."*
|
|
93
|
+
- *"Summarise each of the six files in src/handlers in parallel with a swarm."*
|
|
94
|
+
|
|
95
|
+
With the plugin you also get three slash commands:
|
|
89
96
|
|
|
90
|
-
|
|
97
|
+
| Command | What it does |
|
|
98
|
+
|---|---|
|
|
99
|
+
| `/agent-intern:second-opinion [--council]` | Sends your diff to a reviewer from another model family, or to 2–3 of them in parallel. Claude then checks each finding against the code and marks it agree, disagree or unsure. |
|
|
100
|
+
| `/agent-intern:image <what to draw>` | Gemini draws it, the file is saved into your project, and Claude looks at the result. |
|
|
101
|
+
| `/agent-intern:doctor` | Shows which backends are installed and signed in, with the next step for any that aren't. Spends no quota. |
|
|
102
|
+
|
|
103
|
+
Without the plugin, any `*_status` tool (say, *"run antigravity_status"*) checks a backend without
|
|
104
|
+
spending quota.
|
|
91
105
|
|
|
92
106
|
> [!TIP]
|
|
93
107
|
> uvx pins the version it first caches, so nothing updates behind your back. Every `*_status` call
|
|
@@ -96,14 +110,12 @@ Any `*_status` tool (say, *"run antigravity_status"*) checks a backend's setup w
|
|
|
96
110
|
|
|
97
111
|
## What it's for
|
|
98
112
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
| 🆓 **No subscription? Still works** | opencode's free models answer with zero credentials — slow, but free. |
|
|
106
|
-
| 🔌 **Zero new auth** | Piggybacks the CLI logins you already have. The bridge manages no keys of its own. |
|
|
113
|
+
- 🎨 **Images, inside Claude Code.** `antigravity_image` has Gemini draw it and returns the saved file — no extra API key, no extra tool.
|
|
114
|
+
- 🧠 **A second opinion.** A different model family reviews what Claude just wrote. Their blind spots rarely overlap.
|
|
115
|
+
- 🐝 **Parallel fan-out.** `agent_swarm` runs N tasks at once and can mix backends in a single call (~2.8× at 3 Gemini workers).
|
|
116
|
+
- 💸 **Cheaper grunt work.** Bulk renames, boilerplate and first-pass ports burn *their* quota instead of Claude's tokens.
|
|
117
|
+
- 🆓 **No subscription? Still works.** opencode's free models answer with zero credentials — slow, but free.
|
|
118
|
+
- 🔌 **Zero new auth.** Piggybacks the CLI logins you already have. The bridge manages no keys of its own.
|
|
107
119
|
|
|
108
120
|
### Watch it work
|
|
109
121
|
|
|
@@ -203,6 +215,7 @@ the same thread. No private APIs, no token handling: it only bridges what the CL
|
|
|
203
215
|
|
|
204
216
|
The CLIs behind this bridge update themselves, so most breakage is upstream drift rather than a bug
|
|
205
217
|
in the bridge. A report that includes the relevant `*_status` output usually pins it down in one go.
|
|
218
|
+
[Contributing guide](https://github.com/SinanTufekci/agent-intern/blob/main/CONTRIBUTING.md) ·
|
|
206
219
|
[Open an issue](https://github.com/SinanTufekci/agent-intern/issues/new/choose) ·
|
|
207
220
|
[Start a discussion](https://github.com/SinanTufekci/agent-intern/discussions) · Developed on Windows —
|
|
208
221
|
confirmations from macOS and Linux are very welcome.
|
|
@@ -31,12 +31,17 @@ file path.
|
|
|
31
31
|
|
|
32
32
|
## Quick start
|
|
33
33
|
|
|
34
|
-
**1.
|
|
34
|
+
**1. Install it** (needs [uv](https://docs.astral.sh/uv/)). The plugin is the recommended way, because
|
|
35
|
+
it adds three slash commands on top of the server:
|
|
35
36
|
|
|
36
37
|
```bash
|
|
37
|
-
claude
|
|
38
|
+
claude plugin marketplace add SinanTufekci/agent-intern
|
|
39
|
+
claude plugin install agent-intern@agent-intern
|
|
38
40
|
```
|
|
39
41
|
|
|
42
|
+
Or register just the MCP server: `claude mcp add -s user agent-intern -- uvx agent-intern`. Pick
|
|
43
|
+
one or the other, since doing both gives Claude every tool twice.
|
|
44
|
+
|
|
40
45
|
**2. Install at least one backend CLI and sign in once.** Any one of them works on its own:
|
|
41
46
|
|
|
42
47
|
| If you have… | Install | Sign in |
|
|
@@ -50,11 +55,20 @@ claude mcp add -s user agent-intern -- uvx agent-intern
|
|
|
50
55
|
**3. Restart Claude Code and just ask.** The server ships its own routing guide as MCP instructions,
|
|
51
56
|
so Claude knows which tool fits — you don't have to name them:
|
|
52
57
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
- *"Ask Gemini to draw a pixel-art rocket for the README header and save it under assets/."*
|
|
59
|
+
- *"Have Copilot review the diff you just wrote — read-only — and tell me where it disagrees with you."*
|
|
60
|
+
- *"Summarise each of the six files in src/handlers in parallel with a swarm."*
|
|
61
|
+
|
|
62
|
+
With the plugin you also get three slash commands:
|
|
56
63
|
|
|
57
|
-
|
|
64
|
+
| Command | What it does |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `/agent-intern:second-opinion [--council]` | Sends your diff to a reviewer from another model family, or to 2–3 of them in parallel. Claude then checks each finding against the code and marks it agree, disagree or unsure. |
|
|
67
|
+
| `/agent-intern:image <what to draw>` | Gemini draws it, the file is saved into your project, and Claude looks at the result. |
|
|
68
|
+
| `/agent-intern:doctor` | Shows which backends are installed and signed in, with the next step for any that aren't. Spends no quota. |
|
|
69
|
+
|
|
70
|
+
Without the plugin, any `*_status` tool (say, *"run antigravity_status"*) checks a backend without
|
|
71
|
+
spending quota.
|
|
58
72
|
|
|
59
73
|
> [!TIP]
|
|
60
74
|
> uvx pins the version it first caches, so nothing updates behind your back. Every `*_status` call
|
|
@@ -63,14 +77,12 @@ Any `*_status` tool (say, *"run antigravity_status"*) checks a backend's setup w
|
|
|
63
77
|
|
|
64
78
|
## What it's for
|
|
65
79
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
| 🆓 **No subscription? Still works** | opencode's free models answer with zero credentials — slow, but free. |
|
|
73
|
-
| 🔌 **Zero new auth** | Piggybacks the CLI logins you already have. The bridge manages no keys of its own. |
|
|
80
|
+
- 🎨 **Images, inside Claude Code.** `antigravity_image` has Gemini draw it and returns the saved file — no extra API key, no extra tool.
|
|
81
|
+
- 🧠 **A second opinion.** A different model family reviews what Claude just wrote. Their blind spots rarely overlap.
|
|
82
|
+
- 🐝 **Parallel fan-out.** `agent_swarm` runs N tasks at once and can mix backends in a single call (~2.8× at 3 Gemini workers).
|
|
83
|
+
- 💸 **Cheaper grunt work.** Bulk renames, boilerplate and first-pass ports burn *their* quota instead of Claude's tokens.
|
|
84
|
+
- 🆓 **No subscription? Still works.** opencode's free models answer with zero credentials — slow, but free.
|
|
85
|
+
- 🔌 **Zero new auth.** Piggybacks the CLI logins you already have. The bridge manages no keys of its own.
|
|
74
86
|
|
|
75
87
|
### Watch it work
|
|
76
88
|
|
|
@@ -170,6 +182,7 @@ the same thread. No private APIs, no token handling: it only bridges what the CL
|
|
|
170
182
|
|
|
171
183
|
The CLIs behind this bridge update themselves, so most breakage is upstream drift rather than a bug
|
|
172
184
|
in the bridge. A report that includes the relevant `*_status` output usually pins it down in one go.
|
|
185
|
+
[Contributing guide](https://github.com/SinanTufekci/agent-intern/blob/main/CONTRIBUTING.md) ·
|
|
173
186
|
[Open an issue](https://github.com/SinanTufekci/agent-intern/issues/new/choose) ·
|
|
174
187
|
[Start a discussion](https://github.com/SinanTufekci/agent-intern/discussions) · Developed on Windows —
|
|
175
188
|
confirmations from macOS and Linux are very welcome.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agent-intern
|
|
3
|
-
Version: 0.30.
|
|
3
|
+
Version: 0.30.3
|
|
4
4
|
Summary: MCP server bridging the Antigravity (agy), OpenAI Codex, GitHub Copilot, Cursor, opencode, Grok Build, and Kimi Code CLIs so Claude Code can drive them as sub-agents
|
|
5
5
|
Author: Sinan Tüfekçi
|
|
6
6
|
License: MIT
|
|
@@ -64,12 +64,17 @@ file path.
|
|
|
64
64
|
|
|
65
65
|
## Quick start
|
|
66
66
|
|
|
67
|
-
**1.
|
|
67
|
+
**1. Install it** (needs [uv](https://docs.astral.sh/uv/)). The plugin is the recommended way, because
|
|
68
|
+
it adds three slash commands on top of the server:
|
|
68
69
|
|
|
69
70
|
```bash
|
|
70
|
-
claude
|
|
71
|
+
claude plugin marketplace add SinanTufekci/agent-intern
|
|
72
|
+
claude plugin install agent-intern@agent-intern
|
|
71
73
|
```
|
|
72
74
|
|
|
75
|
+
Or register just the MCP server: `claude mcp add -s user agent-intern -- uvx agent-intern`. Pick
|
|
76
|
+
one or the other, since doing both gives Claude every tool twice.
|
|
77
|
+
|
|
73
78
|
**2. Install at least one backend CLI and sign in once.** Any one of them works on its own:
|
|
74
79
|
|
|
75
80
|
| If you have… | Install | Sign in |
|
|
@@ -83,11 +88,20 @@ claude mcp add -s user agent-intern -- uvx agent-intern
|
|
|
83
88
|
**3. Restart Claude Code and just ask.** The server ships its own routing guide as MCP instructions,
|
|
84
89
|
so Claude knows which tool fits — you don't have to name them:
|
|
85
90
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
- *"Ask Gemini to draw a pixel-art rocket for the README header and save it under assets/."*
|
|
92
|
+
- *"Have Copilot review the diff you just wrote — read-only — and tell me where it disagrees with you."*
|
|
93
|
+
- *"Summarise each of the six files in src/handlers in parallel with a swarm."*
|
|
94
|
+
|
|
95
|
+
With the plugin you also get three slash commands:
|
|
89
96
|
|
|
90
|
-
|
|
97
|
+
| Command | What it does |
|
|
98
|
+
|---|---|
|
|
99
|
+
| `/agent-intern:second-opinion [--council]` | Sends your diff to a reviewer from another model family, or to 2–3 of them in parallel. Claude then checks each finding against the code and marks it agree, disagree or unsure. |
|
|
100
|
+
| `/agent-intern:image <what to draw>` | Gemini draws it, the file is saved into your project, and Claude looks at the result. |
|
|
101
|
+
| `/agent-intern:doctor` | Shows which backends are installed and signed in, with the next step for any that aren't. Spends no quota. |
|
|
102
|
+
|
|
103
|
+
Without the plugin, any `*_status` tool (say, *"run antigravity_status"*) checks a backend without
|
|
104
|
+
spending quota.
|
|
91
105
|
|
|
92
106
|
> [!TIP]
|
|
93
107
|
> uvx pins the version it first caches, so nothing updates behind your back. Every `*_status` call
|
|
@@ -96,14 +110,12 @@ Any `*_status` tool (say, *"run antigravity_status"*) checks a backend's setup w
|
|
|
96
110
|
|
|
97
111
|
## What it's for
|
|
98
112
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
| 🆓 **No subscription? Still works** | opencode's free models answer with zero credentials — slow, but free. |
|
|
106
|
-
| 🔌 **Zero new auth** | Piggybacks the CLI logins you already have. The bridge manages no keys of its own. |
|
|
113
|
+
- 🎨 **Images, inside Claude Code.** `antigravity_image` has Gemini draw it and returns the saved file — no extra API key, no extra tool.
|
|
114
|
+
- 🧠 **A second opinion.** A different model family reviews what Claude just wrote. Their blind spots rarely overlap.
|
|
115
|
+
- 🐝 **Parallel fan-out.** `agent_swarm` runs N tasks at once and can mix backends in a single call (~2.8× at 3 Gemini workers).
|
|
116
|
+
- 💸 **Cheaper grunt work.** Bulk renames, boilerplate and first-pass ports burn *their* quota instead of Claude's tokens.
|
|
117
|
+
- 🆓 **No subscription? Still works.** opencode's free models answer with zero credentials — slow, but free.
|
|
118
|
+
- 🔌 **Zero new auth.** Piggybacks the CLI logins you already have. The bridge manages no keys of its own.
|
|
107
119
|
|
|
108
120
|
### Watch it work
|
|
109
121
|
|
|
@@ -203,6 +215,7 @@ the same thread. No private APIs, no token handling: it only bridges what the CL
|
|
|
203
215
|
|
|
204
216
|
The CLIs behind this bridge update themselves, so most breakage is upstream drift rather than a bug
|
|
205
217
|
in the bridge. A report that includes the relevant `*_status` output usually pins it down in one go.
|
|
218
|
+
[Contributing guide](https://github.com/SinanTufekci/agent-intern/blob/main/CONTRIBUTING.md) ·
|
|
206
219
|
[Open an issue](https://github.com/SinanTufekci/agent-intern/issues/new/choose) ·
|
|
207
220
|
[Start a discussion](https://github.com/SinanTufekci/agent-intern/discussions) · Developed on Windows —
|
|
208
221
|
confirmations from macOS and Linux are very welcome.
|
|
@@ -497,7 +497,7 @@ def run_codex_streaming(
|
|
|
497
497
|
before = set() if continue_conv else _rollout_names()
|
|
498
498
|
args = build_args(prompt, workspace, sandbox, model, resume_session, out_path, json_stream=True)
|
|
499
499
|
try:
|
|
500
|
-
proc =
|
|
500
|
+
proc = proc_tree.popen(
|
|
501
501
|
args,
|
|
502
502
|
cwd=workspace,
|
|
503
503
|
stdin=subprocess.DEVNULL,
|
|
@@ -437,7 +437,7 @@ def run_copilot_streaming(
|
|
|
437
437
|
args = build_args(prompt, workspace, sandbox, model, session_id, json_stream=True)
|
|
438
438
|
|
|
439
439
|
state: dict = {"answer": "", "delta": ""}
|
|
440
|
-
proc =
|
|
440
|
+
proc = proc_tree.popen(
|
|
441
441
|
args,
|
|
442
442
|
cwd=workspace,
|
|
443
443
|
stdin=subprocess.DEVNULL,
|
|
@@ -99,6 +99,55 @@ def _resolve_bin() -> str:
|
|
|
99
99
|
|
|
100
100
|
CURSOR_BIN = _resolve_bin()
|
|
101
101
|
|
|
102
|
+
# A cursor-agent release directory under the install's versions/: YYYY.MM.DD, an
|
|
103
|
+
# optional -HH-MM-SS, then -<commit>. Copied from cursor-agent.ps1's own filter.
|
|
104
|
+
_VERSION_DIR_RE = re.compile(r"^(\d{4})\.(\d{1,2})\.(\d{1,2})(-\d{2}-\d{2}-\d{2})?-[a-f0-9]+$")
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def _launch_prefix(bin_path: str, windows: Optional[bool] = None) -> list[str]:
|
|
108
|
+
"""argv prefix that runs cursor-agent, bypassing cmd.exe when it is the Windows shim.
|
|
109
|
+
|
|
110
|
+
The installer's `cursor-agent.CMD` hands its arguments to cmd.exe (`%*`, with
|
|
111
|
+
delayed expansion on), which re-parses them — so a prompt containing `"` and `&`
|
|
112
|
+
runs a shell command on the host, whatever the sandbox says. See proc_tree's
|
|
113
|
+
batch-shim note. The shim only forwards to `cursor-agent.ps1`, which runs
|
|
114
|
+
`node.exe index.js` from the install dir if present, else from the newest
|
|
115
|
+
`versions/<YYYY.MM.DD>-<commit>/`. Doing that selection here and launching node
|
|
116
|
+
directly is the same program with cmd.exe and PowerShell taken out. Verified
|
|
117
|
+
live: `--version` and `status` answer identically both ways. Anything we can't
|
|
118
|
+
resolve falls back to the shim, where proc_tree.check_args refuses a dangerous
|
|
119
|
+
prompt instead of running it. `windows` defaults to the real platform; tests pass
|
|
120
|
+
it explicitly, since faking os.name breaks pathlib off Windows.
|
|
121
|
+
"""
|
|
122
|
+
if windows is None:
|
|
123
|
+
windows = os.name == "nt"
|
|
124
|
+
if not windows or not proc_tree.is_batch_file(bin_path):
|
|
125
|
+
return [bin_path]
|
|
126
|
+
base = Path(bin_path).parent
|
|
127
|
+
flat = (base / "node.exe", base / "index.js")
|
|
128
|
+
if all(f.is_file() for f in flat):
|
|
129
|
+
return [str(f) for f in flat]
|
|
130
|
+
best: Optional[tuple[int, str]] = None
|
|
131
|
+
versions = base / "versions"
|
|
132
|
+
for d in versions.iterdir() if versions.is_dir() else ():
|
|
133
|
+
m = _VERSION_DIR_RE.match(d.name)
|
|
134
|
+
if not m or not d.is_dir():
|
|
135
|
+
continue
|
|
136
|
+
key = (int(f"{m.group(1)}{int(m.group(2)):02d}{int(m.group(3)):02d}"), d.name)
|
|
137
|
+
if best is None or key > best:
|
|
138
|
+
best = key
|
|
139
|
+
if best is not None:
|
|
140
|
+
node, entry = versions / best[1] / "node.exe", versions / best[1] / "index.js"
|
|
141
|
+
if node.is_file() and entry.is_file():
|
|
142
|
+
return [str(node), str(entry)]
|
|
143
|
+
return [bin_path]
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def _launch() -> list[str]:
|
|
147
|
+
"""The argv prefix for every cursor-agent call (see _launch_prefix)."""
|
|
148
|
+
return _launch_prefix(CURSOR_BIN)
|
|
149
|
+
|
|
150
|
+
|
|
102
151
|
# cursor's state home. Chats live under ~/.cursor/chats/<workspace-hash>/<chat-id>/
|
|
103
152
|
# (each chat dir has meta.json + store.db). No documented override, so this is
|
|
104
153
|
# fixed to the home dir; we only READ these files (for the restart-proof continue
|
|
@@ -142,10 +191,29 @@ def _spawn_kwargs() -> dict:
|
|
|
142
191
|
shim doesn't flash a console; POSIX starts a new session.
|
|
143
192
|
"""
|
|
144
193
|
if os.name == "nt":
|
|
145
|
-
return {
|
|
194
|
+
return {
|
|
195
|
+
"creationflags": getattr(subprocess, "CREATE_NO_WINDOW", 0x08000000),
|
|
196
|
+
"env": _env(),
|
|
197
|
+
}
|
|
146
198
|
return {"start_new_session": True}
|
|
147
199
|
|
|
148
200
|
|
|
201
|
+
def _env() -> dict:
|
|
202
|
+
"""Process env carrying what cursor-agent.ps1 would have set.
|
|
203
|
+
|
|
204
|
+
Needed now that _launch_prefix runs node directly instead of the ps1: the
|
|
205
|
+
launcher records how it was invoked and points node's compile cache at a fixed
|
|
206
|
+
dir (without it every call recompiles). Both are setdefault, so a value the user
|
|
207
|
+
exported still wins.
|
|
208
|
+
"""
|
|
209
|
+
env = dict(os.environ)
|
|
210
|
+
env.setdefault("CURSOR_INVOKED_AS", os.path.basename(CURSOR_BIN))
|
|
211
|
+
local = env.get("LOCALAPPDATA")
|
|
212
|
+
if local:
|
|
213
|
+
env.setdefault("NODE_COMPILE_CACHE", os.path.join(local, "cursor-compile-cache"))
|
|
214
|
+
return env
|
|
215
|
+
|
|
216
|
+
|
|
149
217
|
def normalize_workspace(ws: Optional[str]) -> str:
|
|
150
218
|
"""Absolute path for `ws`, or the server's cwd when omitted."""
|
|
151
219
|
return os.path.abspath(ws) if ws else os.getcwd()
|
|
@@ -192,7 +260,7 @@ def create_chat(workspace: str) -> str:
|
|
|
192
260
|
good measure and let the subsequent ask create the workspace's chat dir.
|
|
193
261
|
"""
|
|
194
262
|
proc = proc_tree.run_captured(
|
|
195
|
-
[
|
|
263
|
+
[*_launch(), "create-chat"],
|
|
196
264
|
cwd=workspace,
|
|
197
265
|
stdin=subprocess.DEVNULL,
|
|
198
266
|
timeout=30,
|
|
@@ -319,7 +387,7 @@ def list_models() -> list[str]:
|
|
|
319
387
|
return _MODELS_CACHE
|
|
320
388
|
try:
|
|
321
389
|
proc = proc_tree.run_captured(
|
|
322
|
-
[
|
|
390
|
+
[*_launch(), "models"],
|
|
323
391
|
stdin=subprocess.DEVNULL,
|
|
324
392
|
timeout=20,
|
|
325
393
|
**_TEXT,
|
|
@@ -393,7 +461,7 @@ def build_args(
|
|
|
393
461
|
last.
|
|
394
462
|
"""
|
|
395
463
|
args = [
|
|
396
|
-
|
|
464
|
+
*_launch(),
|
|
397
465
|
"-p",
|
|
398
466
|
"--output-format",
|
|
399
467
|
"stream-json" if json_stream else "text",
|
|
@@ -503,7 +571,7 @@ def run_cursor_streaming(
|
|
|
503
571
|
args = build_args(prompt, workspace, sandbox, model, chat_id, json_stream=True)
|
|
504
572
|
|
|
505
573
|
state: dict = {"answer": "", "assistant": ""}
|
|
506
|
-
proc =
|
|
574
|
+
proc = proc_tree.popen(
|
|
507
575
|
args,
|
|
508
576
|
cwd=workspace,
|
|
509
577
|
stdin=subprocess.DEVNULL,
|
|
@@ -582,7 +650,7 @@ def cursor_version() -> Optional[str]:
|
|
|
582
650
|
"""`cursor-agent --version` first line, or None if cursor can't be run."""
|
|
583
651
|
try:
|
|
584
652
|
proc = proc_tree.run_captured(
|
|
585
|
-
[
|
|
653
|
+
[*_launch(), "--version"],
|
|
586
654
|
stdin=subprocess.DEVNULL,
|
|
587
655
|
timeout=15,
|
|
588
656
|
**_TEXT,
|
|
@@ -604,7 +672,7 @@ def auth_status() -> tuple[bool, str]:
|
|
|
604
672
|
"""
|
|
605
673
|
try:
|
|
606
674
|
proc = proc_tree.run_captured(
|
|
607
|
-
[
|
|
675
|
+
[*_launch(), "status"],
|
|
608
676
|
stdin=subprocess.DEVNULL,
|
|
609
677
|
timeout=20,
|
|
610
678
|
**_TEXT,
|
|
@@ -520,7 +520,7 @@ def run_grok_streaming(
|
|
|
520
520
|
args = build_args(prompt, workspace, sandbox, model, resume_id, use_continue, json_stream=True)
|
|
521
521
|
|
|
522
522
|
state: dict = {}
|
|
523
|
-
proc =
|
|
523
|
+
proc = proc_tree.popen(
|
|
524
524
|
args,
|
|
525
525
|
cwd=workspace,
|
|
526
526
|
stdin=subprocess.DEVNULL,
|
|
@@ -102,10 +102,20 @@ OPENCODE_BIN_ENV = os.environ.get("OPENCODE_BIN", "opencode")
|
|
|
102
102
|
|
|
103
103
|
|
|
104
104
|
def _resolve_bin() -> str:
|
|
105
|
-
"""Full path to the opencode executable (see OPENCODE_BIN_ENV note).
|
|
105
|
+
"""Full path to the opencode executable (see OPENCODE_BIN_ENV note).
|
|
106
|
+
|
|
107
|
+
On Windows the npm install is an `opencode.cmd` shim, and a shim hands its
|
|
108
|
+
arguments to cmd.exe — which re-parses them, so a prompt containing `"` and `&`
|
|
109
|
+
would run a shell command on the host (see proc_tree's batch-shim note). The npm
|
|
110
|
+
shim only forwards to `node_modules/opencode-ai/bin/opencode.exe`, a native
|
|
111
|
+
binary, so launch that directly: same program, no cmd.exe. If the shim can't be
|
|
112
|
+
resolved, proc_tree.check_args refuses a dangerous prompt instead of running it.
|
|
113
|
+
"""
|
|
106
114
|
if os.path.sep in OPENCODE_BIN_ENV or os.path.isfile(OPENCODE_BIN_ENV):
|
|
107
|
-
|
|
108
|
-
|
|
115
|
+
found = OPENCODE_BIN_ENV
|
|
116
|
+
else:
|
|
117
|
+
found = shutil.which(OPENCODE_BIN_ENV) or OPENCODE_BIN_ENV
|
|
118
|
+
return proc_tree.npm_shim_target(found) or found
|
|
109
119
|
|
|
110
120
|
|
|
111
121
|
OPENCODE_BIN = _resolve_bin()
|
|
@@ -543,7 +553,7 @@ def _run_impl(
|
|
|
543
553
|
args = build_args(prompt, workspace, sandbox, model, resume_id, use_continue, agent)
|
|
544
554
|
|
|
545
555
|
state: dict = {}
|
|
546
|
-
proc =
|
|
556
|
+
proc = proc_tree.popen(
|
|
547
557
|
args,
|
|
548
558
|
cwd=workspace,
|
|
549
559
|
stdin=subprocess.DEVNULL,
|
|
@@ -32,6 +32,7 @@ platform and its worse failure mode, completely unaddressed.
|
|
|
32
32
|
from __future__ import annotations
|
|
33
33
|
|
|
34
34
|
import os
|
|
35
|
+
import re
|
|
35
36
|
import signal
|
|
36
37
|
import subprocess
|
|
37
38
|
from typing import Optional
|
|
@@ -93,6 +94,98 @@ def kill_tree(proc: subprocess.Popen) -> None:
|
|
|
93
94
|
pass
|
|
94
95
|
|
|
95
96
|
|
|
97
|
+
# ----------------------------------------------------------------- Windows batch shims
|
|
98
|
+
#
|
|
99
|
+
# A `.cmd`/`.bat` file cannot be executed directly: `CreateProcess` runs it as
|
|
100
|
+
# `cmd.exe /c "<file> <args>"`, so every argument is re-parsed by cmd.exe — with
|
|
101
|
+
# `%var%` expansion, `!var!` expansion when the shim enables delayed expansion, and
|
|
102
|
+
# `&`/`|`/`<`/`>` as command separators. Python's `list2cmdline` quotes for the
|
|
103
|
+
# MSVCRT parser, not for cmd.exe, and cmd.exe does not honour its backslash-escaped
|
|
104
|
+
# quotes. So an argument such as `x" & calc & "` closes the quote early and the rest
|
|
105
|
+
# RUNS AS A COMMAND — verified live against a shim. The prompt is exactly such an
|
|
106
|
+
# argument, and it can carry text Claude read from an untrusted file or web page.
|
|
107
|
+
# That escapes every `sandbox` setting: the command runs in the shim's cmd.exe, on
|
|
108
|
+
# the host, before the agent (and its sandbox) ever starts.
|
|
109
|
+
#
|
|
110
|
+
# Correct escaping for cmd.exe is possible only for some inputs (Rust's fix for the
|
|
111
|
+
# same bug, CVE-2024-24576, refuses the rest). Two defences instead:
|
|
112
|
+
# 1. each bridge resolves its shim to the real executable where it can
|
|
113
|
+
# (`npm_shim_target` below; cursor and muse have their own launch paths), so
|
|
114
|
+
# cmd.exe is never involved;
|
|
115
|
+
# 2. `check_args` refuses to hand any metacharacter to a shim that is still left,
|
|
116
|
+
# turning a would-be injection into a clear error. Every spawn goes through
|
|
117
|
+
# `run_captured` / `popen` below, which call it — a test guards that.
|
|
118
|
+
BATCH_SUFFIXES = (".cmd", ".bat")
|
|
119
|
+
CMD_METACHARS = frozenset('"%!^&|<>\r\n')
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def is_batch_file(executable: str) -> bool:
|
|
123
|
+
"""True when `executable` is a .cmd/.bat file, which Windows runs via cmd.exe."""
|
|
124
|
+
return str(executable).lower().endswith(BATCH_SUFFIXES)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def check_args(args: list[str], windows: Optional[bool] = None) -> None:
|
|
128
|
+
"""Refuse to pass cmd.exe metacharacters to a batch-file shim. Never mutates.
|
|
129
|
+
|
|
130
|
+
A no-op off Windows and for real executables. Raises ValueError naming the
|
|
131
|
+
offending characters, so the caller fails loudly instead of running whatever the
|
|
132
|
+
argument smuggled in. See the note above for why escaping is not attempted.
|
|
133
|
+
`windows` defaults to the real platform; tests pass it rather than faking os.name.
|
|
134
|
+
"""
|
|
135
|
+
if windows is None:
|
|
136
|
+
windows = os.name == "nt"
|
|
137
|
+
if not windows or not args or not is_batch_file(args[0]):
|
|
138
|
+
return
|
|
139
|
+
for arg in args[1:]:
|
|
140
|
+
bad = sorted(set(str(arg)) & CMD_METACHARS)
|
|
141
|
+
if bad:
|
|
142
|
+
shown = ", ".join(repr(c) for c in bad)
|
|
143
|
+
raise ValueError(
|
|
144
|
+
f"refusing to run {args[0]!r}: it is a batch-file shim, which Windows runs "
|
|
145
|
+
f"through cmd.exe, and an argument contains characters cmd.exe would "
|
|
146
|
+
f"interpret ({shown}) — that is how a prompt injects a shell command. "
|
|
147
|
+
f"Point the backend's *_BIN env var at the real executable instead."
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def npm_shim_target(shim: str) -> Optional[str]:
|
|
152
|
+
"""The native .exe an npm cmd-shim launches, or None if it isn't one.
|
|
153
|
+
|
|
154
|
+
npm's generated shims end in a line like
|
|
155
|
+
"%dp0%\\node_modules\\opencode-ai\\bin\\opencode.exe" %*
|
|
156
|
+
where `%dp0%` is the shim's own directory. When the target is a real `.exe`,
|
|
157
|
+
launching it directly behaves identically minus cmd.exe — so the prompt never
|
|
158
|
+
meets cmd's parser. Shims that run `node script.js` are left alone (None): there
|
|
159
|
+
the correct target depends on npm's node-resolution logic, and guessing wrong is
|
|
160
|
+
worse than the loud refusal `check_args` gives.
|
|
161
|
+
"""
|
|
162
|
+
if not is_batch_file(shim):
|
|
163
|
+
return None
|
|
164
|
+
try:
|
|
165
|
+
with open(shim, encoding="utf-8", errors="replace") as f:
|
|
166
|
+
text = f.read()
|
|
167
|
+
except OSError:
|
|
168
|
+
return None
|
|
169
|
+
base = os.path.dirname(os.path.abspath(shim))
|
|
170
|
+
for quoted in reversed(re.findall(r'"([^"]+\.exe)"', text, flags=re.IGNORECASE)):
|
|
171
|
+
low = quoted.lower()
|
|
172
|
+
for token in ("%dp0%", "%~dp0"):
|
|
173
|
+
if low.startswith(token):
|
|
174
|
+
# The shim spells its path with backslashes; "/" joins correctly on
|
|
175
|
+
# every OS, so the resolution is testable off Windows too.
|
|
176
|
+
rel = quoted[len(token) :].replace("\\", "/").lstrip("/")
|
|
177
|
+
candidate = os.path.normpath(os.path.join(base, rel))
|
|
178
|
+
if os.path.isfile(candidate):
|
|
179
|
+
return candidate
|
|
180
|
+
return None
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def popen(args: list[str], **popen_kwargs) -> subprocess.Popen:
|
|
184
|
+
"""`subprocess.Popen` behind the batch-shim check. Use this, never Popen directly."""
|
|
185
|
+
check_args(args)
|
|
186
|
+
return subprocess.Popen(args, **popen_kwargs)
|
|
187
|
+
|
|
188
|
+
|
|
96
189
|
def run_captured(
|
|
97
190
|
args: list[str],
|
|
98
191
|
*,
|
|
@@ -112,7 +205,7 @@ def run_captured(
|
|
|
112
205
|
pipes open. Reading the pipes only *after* the tree is dead is what makes the
|
|
113
206
|
second read terminate; that ordering is the fix, not a detail of it.
|
|
114
207
|
"""
|
|
115
|
-
proc =
|
|
208
|
+
proc = popen(
|
|
116
209
|
args,
|
|
117
210
|
stdout=subprocess.PIPE,
|
|
118
211
|
stderr=subprocess.PIPE,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "agent-intern"
|
|
3
|
-
version = "0.30.
|
|
3
|
+
version = "0.30.3"
|
|
4
4
|
description = "MCP server bridging the Antigravity (agy), OpenAI Codex, GitHub Copilot, Cursor, opencode, Grok Build, and Kimi Code CLIs so Claude Code can drive them as sub-agents"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
@@ -564,7 +564,7 @@ mcp = FastMCP("agent-intern", instructions=SERVER_INSTRUCTIONS)
|
|
|
564
564
|
# installed package metadata, which goes stale on editable installs). Keep in
|
|
565
565
|
# sync with pyproject.toml's version. Compared at startup against the latest
|
|
566
566
|
# tag on GitHub so a long-lived clone learns when to `git pull`.
|
|
567
|
-
__version__ = "0.30.
|
|
567
|
+
__version__ = "0.30.3"
|
|
568
568
|
|
|
569
569
|
# Logs go to stderr (stdout is the MCP protocol channel). Quiet by default;
|
|
570
570
|
# set AGY_BRIDGE_DEBUG=1 for per-call diagnostics. See _configure_logging.
|
|
@@ -3035,7 +3035,7 @@ def _open_watch_window(url: str, rid: str = _MAIN) -> None:
|
|
|
3035
3035
|
return
|
|
3036
3036
|
for exe in _chromium_app_browsers():
|
|
3037
3037
|
try:
|
|
3038
|
-
|
|
3038
|
+
proc_tree.popen(
|
|
3039
3039
|
[exe, f"--app={url}", f"--window-size={_WATCH_WINDOW_SIZE}"],
|
|
3040
3040
|
stdin=subprocess.DEVNULL,
|
|
3041
3041
|
stdout=subprocess.DEVNULL,
|
|
@@ -3106,7 +3106,7 @@ def _run_agy_watched(
|
|
|
3106
3106
|
except Exception: # noqa: BLE001 - the viewer is best-effort, never fatal
|
|
3107
3107
|
pass
|
|
3108
3108
|
|
|
3109
|
-
proc =
|
|
3109
|
+
proc = proc_tree.popen(
|
|
3110
3110
|
args,
|
|
3111
3111
|
cwd=workspace,
|
|
3112
3112
|
stdin=subprocess.DEVNULL,
|
|
@@ -3247,7 +3247,7 @@ def _run_agy_image_watched(
|
|
|
3247
3247
|
except Exception: # noqa: BLE001 - viewer is best-effort
|
|
3248
3248
|
pass
|
|
3249
3249
|
|
|
3250
|
-
proc =
|
|
3250
|
+
proc = proc_tree.popen(
|
|
3251
3251
|
args,
|
|
3252
3252
|
cwd=workspace,
|
|
3253
3253
|
stdin=subprocess.DEVNULL,
|
|
@@ -502,7 +502,7 @@ def _run_text_worker_watched(
|
|
|
502
502
|
if model:
|
|
503
503
|
args += ["--model", model]
|
|
504
504
|
args += ["-p", prompt]
|
|
505
|
-
proc =
|
|
505
|
+
proc = proc_tree.popen(
|
|
506
506
|
args,
|
|
507
507
|
cwd=workspace,
|
|
508
508
|
stdin=subprocess.DEVNULL,
|
|
@@ -738,7 +738,7 @@ def _run_image_worker_watched(index, prompt, target, workspace, timeout_s) -> Wo
|
|
|
738
738
|
os.makedirs(workspace, exist_ok=True)
|
|
739
739
|
wrapped = server._wrap_image_prompt(prompt, target)
|
|
740
740
|
args = server._agy_base_args(timeout_s) + ["-p", wrapped]
|
|
741
|
-
proc =
|
|
741
|
+
proc = proc_tree.popen(
|
|
742
742
|
args,
|
|
743
743
|
cwd=workspace,
|
|
744
744
|
stdin=subprocess.DEVNULL,
|
|
@@ -24,6 +24,7 @@ import webbrowser
|
|
|
24
24
|
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
|
25
25
|
from typing import Optional
|
|
26
26
|
|
|
27
|
+
import proc_tree
|
|
27
28
|
import server
|
|
28
29
|
from server import (
|
|
29
30
|
_chromium_app_browsers,
|
|
@@ -209,7 +210,7 @@ def _launch(url: str, w: int, h: int, x: Optional[int] = None, y: Optional[int]
|
|
|
209
210
|
]
|
|
210
211
|
for exe in _chromium_app_browsers():
|
|
211
212
|
try:
|
|
212
|
-
|
|
213
|
+
proc_tree.popen(
|
|
213
214
|
[exe, *flags],
|
|
214
215
|
stdin=subprocess.DEVNULL,
|
|
215
216
|
stdout=subprocess.DEVNULL,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|