subagent-cli 0.1.3__tar.gz → 0.1.4__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.
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/PKG-INFO +39 -19
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/README.md +38 -18
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/config.example.yaml +8 -4
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/docs/ARCHITECTURE.md +2 -0
- subagent_cli-0.1.4/docs/examples/checkpoint.json +14 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/pyproject.toml +1 -1
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/__init__.py +1 -1
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/cli.py +172 -33
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/constants.py +4 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/daemon.py +9 -3
- subagent_cli-0.1.4/src/subagent/launcher_service.py +82 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/paths.py +35 -15
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/prompt_service.py +9 -6
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/runtime_service.py +19 -12
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/turn_service.py +119 -5
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/worker_service.py +18 -11
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/tests/test_acp_backend_integration.py +7 -1
- subagent_cli-0.1.3/tests/test_cli_phase1.py → subagent_cli-0.1.4/tests/test_cli_commands.py +118 -10
- subagent_cli-0.1.3/tests/test_daemon_phase1.py → subagent_cli-0.1.4/tests/test_daemon.py +1 -1
- subagent_cli-0.1.3/tests/test_handoff_phase4.py → subagent_cli-0.1.4/tests/test_handoff_commands.py +1 -1
- subagent_cli-0.1.4/tests/test_paths.py +80 -0
- subagent_cli-0.1.3/tests/test_polish_phase5.py → subagent_cli-0.1.4/tests/test_prompt_and_contracts.py +3 -1
- subagent_cli-0.1.3/tests/test_turn_phase3.py → subagent_cli-0.1.4/tests/test_turn_commands.py +202 -3
- subagent_cli-0.1.3/tests/test_worker_phase2.py → subagent_cli-0.1.4/tests/test_worker_lifecycle.py +1 -1
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/uv.lock +1 -1
- subagent_cli-0.1.3/docs/examples/checkpoint.json +0 -14
- subagent_cli-0.1.3/src/subagent/launcher_service.py +0 -30
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/.github/workflows/publish-pypi.yml +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/.gitignore +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/.python-version +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/CONTRIBUTING.md +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/LICENSE +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/docs/examples/handoff.md +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/docs/examples/normalized-event.ndjson +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/docs/examples/worker-continue-flow.md +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/acp_client.py +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/approval_utils.py +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/config.py +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/controller_service.py +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/errors.py +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/handoff_service.py +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/hints.py +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/input_contract.py +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/output.py +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/simple_yaml.py +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/state.py +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/src/subagent/worker_runtime.py +0 -0
- {subagent_cli-0.1.3 → subagent_cli-0.1.4}/tests/fixtures/fake_acp_agent.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: subagent-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: Protocol-agnostic worker orchestration CLI
|
|
5
5
|
Author: niitsuma-t
|
|
6
6
|
License: MIT License
|
|
@@ -49,8 +49,8 @@ Description-Content-Type: text/markdown
|
|
|
49
49
|
[](https://github.com/otakumesi/subagent-cli/actions/workflows/publish-pypi.yml)
|
|
50
50
|
[](https://pypi.org/project/subagent-cli/)
|
|
51
51
|
|
|
52
|
-
Orchestrate
|
|
53
|
-
`subagent-cli`
|
|
52
|
+
Orchestrate coding agents from another coding agent, cleanly and safely.
|
|
53
|
+
`subagent-cli` turns a manager coding agent (for example Codex or Claude Code) into a practical control plane for starting worker coding agents, sending turns, handling approvals, and continuing handoffs. 🤖
|
|
54
54
|
|
|
55
55
|
The command interface is protocol-agnostic, and the current runtime backend is ACP-based (`acp-stdio`).
|
|
56
56
|
|
|
@@ -96,38 +96,52 @@ subagent config init --scope user
|
|
|
96
96
|
|
|
97
97
|
2. Set launcher command/args/env in `~/.config/subagent/config.yaml`.
|
|
98
98
|
|
|
99
|
-
3. Initialize a controller in your workspace.
|
|
99
|
+
3. Initialize a controller in your workspace (run once per workspace, by you or your manager agent).
|
|
100
100
|
```bash
|
|
101
101
|
subagent controller init --cwd .
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
4.
|
|
105
|
-
|
|
106
|
-
subagent prompt render --target manager
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
5. Hand off from here to your manager agent (Codex / Claude Code).
|
|
104
|
+
4. Hand off from here to your manager agent (Codex / Claude Code).
|
|
105
|
+
Ask the manager agent to run `subagent prompt render --target manager` as its first step.
|
|
110
106
|
Use this instruction template:
|
|
111
107
|
|
|
112
108
|
```text
|
|
113
109
|
Act as the project manager for this repository.
|
|
114
110
|
Use subagent-cli as the control plane and progress this task by delegating to worker agents.
|
|
111
|
+
If worker startup or turn operations fail due to sandbox limits, request approval for out-of-sandbox execution and retry.
|
|
115
112
|
|
|
116
113
|
Required workflow:
|
|
117
|
-
1)
|
|
114
|
+
1) First, run `subagent prompt render --target manager` and follow that output.
|
|
118
115
|
2) Check command help before execution (for example `subagent worker --help`, `subagent send --help`, `subagent approve --help`).
|
|
119
116
|
3) Break the task into small executable chunks.
|
|
120
117
|
4) Start/coordinate workers with subagent-cli.
|
|
121
|
-
5) Use send
|
|
122
|
-
6)
|
|
123
|
-
7)
|
|
118
|
+
5) Use `send` as the default turn driver (`send` waits by default).
|
|
119
|
+
6) If `matchedEvent.type` is `approval.requested`, run `approve` and continue with `send`.
|
|
120
|
+
7) Use `watch` only when detailed event streaming/debugging is needed.
|
|
121
|
+
8) Use handoff/continue when context gets large.
|
|
122
|
+
9) Verify results (tests or checks) before reporting completion.
|
|
124
123
|
|
|
125
124
|
Task to execute:
|
|
126
125
|
<your task here>
|
|
127
126
|
```
|
|
128
127
|
|
|
129
|
-
After handoff, the manager agent
|
|
130
|
-
`worker start` -> `send` -> `
|
|
128
|
+
After handoff, the manager agent's standard lifecycle is:
|
|
129
|
+
`worker start` -> `send` -> (`approve` -> `send` as needed) -> `handoff` -> `continue`
|
|
130
|
+
|
|
131
|
+
For a single command that sends and waits for terminal-or-approval events:
|
|
132
|
+
```bash
|
|
133
|
+
subagent send --worker <worker-id> --text "<instruction>" --json
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Opt out of waiting when needed:
|
|
137
|
+
```bash
|
|
138
|
+
subagent send --worker <worker-id> --text "<instruction>" --no-wait --json
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Manual wait mode (advanced cursor control) still exists:
|
|
142
|
+
```bash
|
|
143
|
+
subagent wait --worker <worker-id> --until turn_end --timeout-seconds 60 --json
|
|
144
|
+
```
|
|
131
145
|
|
|
132
146
|
For local simulation/testing without a real ACP launcher:
|
|
133
147
|
```bash
|
|
@@ -135,12 +149,14 @@ subagent worker start --cwd . --debug-mode
|
|
|
135
149
|
```
|
|
136
150
|
|
|
137
151
|
## Troubleshooting 🛠️
|
|
138
|
-
- Ensure the runtime
|
|
152
|
+
- Ensure both the runtime and your manager/worker agent sandbox allow what your launcher needs.
|
|
153
|
+
- Some launchers require outbound network access, but agent sandbox policies can block network even when the host machine itself has connectivity.
|
|
154
|
+
- If state path resolution fails, run commands from inside your workspace root (or set `SUBAGENT_STATE_DIR` explicitly).
|
|
139
155
|
- Preflight launcher availability:
|
|
140
156
|
```bash
|
|
141
157
|
subagent launcher probe <launcher-name> --json
|
|
142
158
|
```
|
|
143
|
-
- If `worker start` fails with `BACKEND_UNAVAILABLE`, inspect runtime logs under
|
|
159
|
+
- If `worker start` fails with `BACKEND_UNAVAILABLE`, inspect runtime logs under `<workspace>/.subagent/state/runtimes/` (default) or `$SUBAGENT_STATE_DIR/runtimes/` (when overridden).
|
|
144
160
|
- For cut-down local testing without backend connectivity:
|
|
145
161
|
```bash
|
|
146
162
|
subagent worker start --cwd . --debug-mode
|
|
@@ -150,11 +166,15 @@ subagent worker start --cwd . --debug-mode
|
|
|
150
166
|
- Resolution order: `--config` > `SUBAGENT_CONFIG` > nearest `<cwd-or-parent>/.subagent/config.yaml` > `~/.config/subagent/config.yaml`
|
|
151
167
|
- Generate user config: `subagent config init --scope user`
|
|
152
168
|
- Generate project config: `subagent config init --scope project --cwd .`
|
|
169
|
+
- `config init` defaults: `codex` -> `npx -y @zed-industries/codex-acp`, `claude-code` -> `npx -y @zed-industries/claude-agent-acp`
|
|
153
170
|
- Override config path: `SUBAGENT_CONFIG=/path/to/config.yaml`
|
|
154
171
|
- Example config: [config.example.yaml](config.example.yaml)
|
|
172
|
+
- Launchers support either split style (`command: npx`, `args: ["-y", "..."]`) or inline style (`command: "npx -y ..."`) for probe/start/restart.
|
|
155
173
|
|
|
156
174
|
## State 💾
|
|
157
|
-
- Default state DB:
|
|
175
|
+
- Default state DB: `<workspace>/.subagent/state/state.db`
|
|
176
|
+
- Override state dir: `SUBAGENT_STATE_DIR=/path/to/state-dir`
|
|
177
|
+
- If workspace root cannot be detected and no override is set, commands fail with `WORKSPACE_ROOT_NOT_FOUND`
|
|
158
178
|
- Project hint file: `<workspace>/.subagent/controller.json`
|
|
159
179
|
|
|
160
180
|
## Documentation 📚
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
[](https://github.com/otakumesi/subagent-cli/actions/workflows/publish-pypi.yml)
|
|
7
7
|
[](https://pypi.org/project/subagent-cli/)
|
|
8
8
|
|
|
9
|
-
Orchestrate
|
|
10
|
-
`subagent-cli`
|
|
9
|
+
Orchestrate coding agents from another coding agent, cleanly and safely.
|
|
10
|
+
`subagent-cli` turns a manager coding agent (for example Codex or Claude Code) into a practical control plane for starting worker coding agents, sending turns, handling approvals, and continuing handoffs. 🤖
|
|
11
11
|
|
|
12
12
|
The command interface is protocol-agnostic, and the current runtime backend is ACP-based (`acp-stdio`).
|
|
13
13
|
|
|
@@ -53,38 +53,52 @@ subagent config init --scope user
|
|
|
53
53
|
|
|
54
54
|
2. Set launcher command/args/env in `~/.config/subagent/config.yaml`.
|
|
55
55
|
|
|
56
|
-
3. Initialize a controller in your workspace.
|
|
56
|
+
3. Initialize a controller in your workspace (run once per workspace, by you or your manager agent).
|
|
57
57
|
```bash
|
|
58
58
|
subagent controller init --cwd .
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
4.
|
|
62
|
-
|
|
63
|
-
subagent prompt render --target manager
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
5. Hand off from here to your manager agent (Codex / Claude Code).
|
|
61
|
+
4. Hand off from here to your manager agent (Codex / Claude Code).
|
|
62
|
+
Ask the manager agent to run `subagent prompt render --target manager` as its first step.
|
|
67
63
|
Use this instruction template:
|
|
68
64
|
|
|
69
65
|
```text
|
|
70
66
|
Act as the project manager for this repository.
|
|
71
67
|
Use subagent-cli as the control plane and progress this task by delegating to worker agents.
|
|
68
|
+
If worker startup or turn operations fail due to sandbox limits, request approval for out-of-sandbox execution and retry.
|
|
72
69
|
|
|
73
70
|
Required workflow:
|
|
74
|
-
1)
|
|
71
|
+
1) First, run `subagent prompt render --target manager` and follow that output.
|
|
75
72
|
2) Check command help before execution (for example `subagent worker --help`, `subagent send --help`, `subagent approve --help`).
|
|
76
73
|
3) Break the task into small executable chunks.
|
|
77
74
|
4) Start/coordinate workers with subagent-cli.
|
|
78
|
-
5) Use send
|
|
79
|
-
6)
|
|
80
|
-
7)
|
|
75
|
+
5) Use `send` as the default turn driver (`send` waits by default).
|
|
76
|
+
6) If `matchedEvent.type` is `approval.requested`, run `approve` and continue with `send`.
|
|
77
|
+
7) Use `watch` only when detailed event streaming/debugging is needed.
|
|
78
|
+
8) Use handoff/continue when context gets large.
|
|
79
|
+
9) Verify results (tests or checks) before reporting completion.
|
|
81
80
|
|
|
82
81
|
Task to execute:
|
|
83
82
|
<your task here>
|
|
84
83
|
```
|
|
85
84
|
|
|
86
|
-
After handoff, the manager agent
|
|
87
|
-
`worker start` -> `send` -> `
|
|
85
|
+
After handoff, the manager agent's standard lifecycle is:
|
|
86
|
+
`worker start` -> `send` -> (`approve` -> `send` as needed) -> `handoff` -> `continue`
|
|
87
|
+
|
|
88
|
+
For a single command that sends and waits for terminal-or-approval events:
|
|
89
|
+
```bash
|
|
90
|
+
subagent send --worker <worker-id> --text "<instruction>" --json
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Opt out of waiting when needed:
|
|
94
|
+
```bash
|
|
95
|
+
subagent send --worker <worker-id> --text "<instruction>" --no-wait --json
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Manual wait mode (advanced cursor control) still exists:
|
|
99
|
+
```bash
|
|
100
|
+
subagent wait --worker <worker-id> --until turn_end --timeout-seconds 60 --json
|
|
101
|
+
```
|
|
88
102
|
|
|
89
103
|
For local simulation/testing without a real ACP launcher:
|
|
90
104
|
```bash
|
|
@@ -92,12 +106,14 @@ subagent worker start --cwd . --debug-mode
|
|
|
92
106
|
```
|
|
93
107
|
|
|
94
108
|
## Troubleshooting 🛠️
|
|
95
|
-
- Ensure the runtime
|
|
109
|
+
- Ensure both the runtime and your manager/worker agent sandbox allow what your launcher needs.
|
|
110
|
+
- Some launchers require outbound network access, but agent sandbox policies can block network even when the host machine itself has connectivity.
|
|
111
|
+
- If state path resolution fails, run commands from inside your workspace root (or set `SUBAGENT_STATE_DIR` explicitly).
|
|
96
112
|
- Preflight launcher availability:
|
|
97
113
|
```bash
|
|
98
114
|
subagent launcher probe <launcher-name> --json
|
|
99
115
|
```
|
|
100
|
-
- If `worker start` fails with `BACKEND_UNAVAILABLE`, inspect runtime logs under
|
|
116
|
+
- If `worker start` fails with `BACKEND_UNAVAILABLE`, inspect runtime logs under `<workspace>/.subagent/state/runtimes/` (default) or `$SUBAGENT_STATE_DIR/runtimes/` (when overridden).
|
|
101
117
|
- For cut-down local testing without backend connectivity:
|
|
102
118
|
```bash
|
|
103
119
|
subagent worker start --cwd . --debug-mode
|
|
@@ -107,11 +123,15 @@ subagent worker start --cwd . --debug-mode
|
|
|
107
123
|
- Resolution order: `--config` > `SUBAGENT_CONFIG` > nearest `<cwd-or-parent>/.subagent/config.yaml` > `~/.config/subagent/config.yaml`
|
|
108
124
|
- Generate user config: `subagent config init --scope user`
|
|
109
125
|
- Generate project config: `subagent config init --scope project --cwd .`
|
|
126
|
+
- `config init` defaults: `codex` -> `npx -y @zed-industries/codex-acp`, `claude-code` -> `npx -y @zed-industries/claude-agent-acp`
|
|
110
127
|
- Override config path: `SUBAGENT_CONFIG=/path/to/config.yaml`
|
|
111
128
|
- Example config: [config.example.yaml](config.example.yaml)
|
|
129
|
+
- Launchers support either split style (`command: npx`, `args: ["-y", "..."]`) or inline style (`command: "npx -y ..."`) for probe/start/restart.
|
|
112
130
|
|
|
113
131
|
## State 💾
|
|
114
|
-
- Default state DB:
|
|
132
|
+
- Default state DB: `<workspace>/.subagent/state/state.db`
|
|
133
|
+
- Override state dir: `SUBAGENT_STATE_DIR=/path/to/state-dir`
|
|
134
|
+
- If workspace root cannot be detected and no override is set, commands fail with `WORKSPACE_ROOT_NOT_FOUND`
|
|
115
135
|
- Project hint file: `<workspace>/.subagent/controller.json`
|
|
116
136
|
|
|
117
137
|
## Documentation 📚
|
|
@@ -2,15 +2,19 @@ launchers:
|
|
|
2
2
|
codex:
|
|
3
3
|
backend:
|
|
4
4
|
kind: acp-stdio
|
|
5
|
-
command:
|
|
6
|
-
args:
|
|
5
|
+
command: npx
|
|
6
|
+
args:
|
|
7
|
+
- -y
|
|
8
|
+
- "@zed-industries/codex-acp"
|
|
7
9
|
env: {}
|
|
8
10
|
|
|
9
11
|
claude-code:
|
|
10
12
|
backend:
|
|
11
13
|
kind: acp-stdio
|
|
12
|
-
command:
|
|
13
|
-
args:
|
|
14
|
+
command: npx
|
|
15
|
+
args:
|
|
16
|
+
- -y
|
|
17
|
+
- "@zed-industries/claude-agent-acp"
|
|
14
18
|
env: {}
|
|
15
19
|
|
|
16
20
|
profiles:
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
- handoff store with `handoff.md` + `checkpoint.json`
|
|
26
26
|
- `--input` JSON contract (major commands) with duplicate-field rejection
|
|
27
27
|
- owner handle model: `controllerId + epoch + token`
|
|
28
|
+
- workspace-scoped runtime state by default: `<workspace-root>/.subagent/state` (or `SUBAGENT_STATE_DIR` override)
|
|
28
29
|
- project-local hint: `<workspace>/.subagent/controller.json`
|
|
29
30
|
- versioned envelope for JSON responses
|
|
30
31
|
|
|
@@ -32,3 +33,4 @@
|
|
|
32
33
|
- local single-host control plane only (`subagentd` is minimal bootstrap/status)
|
|
33
34
|
- no queued turn execution; `send` is rejected while worker is busy
|
|
34
35
|
- resume strategy is handoff-first (no bit-perfect backend session resurrection)
|
|
36
|
+
- commands that need implicit state path fail with `WORKSPACE_ROOT_NOT_FOUND` when workspace root cannot be inferred
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "v1",
|
|
3
|
+
"workerId": "w_123",
|
|
4
|
+
"controllerId": "ctl_abc123",
|
|
5
|
+
"launcher": "codex",
|
|
6
|
+
"profile": "worker-default",
|
|
7
|
+
"packs": ["repo-conventions"],
|
|
8
|
+
"cwd": "/path/to/workspace",
|
|
9
|
+
"state": "handoff_ready",
|
|
10
|
+
"sourceTurnId": "turn_07",
|
|
11
|
+
"handoffPath": "/path/to/workspace/.subagent/state/handoffs/w_123/hs_abc123/handoff.md",
|
|
12
|
+
"artifacts": ["/path/to/workspace/.subagent/state/handoffs/w_123/hs_abc123/handoff.md"],
|
|
13
|
+
"filesChanged": []
|
|
14
|
+
}
|