subagent-cli 0.1.1__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.1/.github/workflows/publish-pypi.yml +56 -0
- subagent_cli-0.1.1/.gitignore +25 -0
- subagent_cli-0.1.1/.python-version +1 -0
- subagent_cli-0.1.1/CONTRIBUTING.md +40 -0
- subagent_cli-0.1.1/LICENSE +21 -0
- subagent_cli-0.1.1/PKG-INFO +98 -0
- subagent_cli-0.1.1/README.md +55 -0
- subagent_cli-0.1.1/config.example.yaml +52 -0
- subagent_cli-0.1.1/docs/ARCHITECTURE.md +34 -0
- subagent_cli-0.1.1/docs/examples/checkpoint.json +14 -0
- subagent_cli-0.1.1/docs/examples/handoff.md +36 -0
- subagent_cli-0.1.1/docs/examples/normalized-event.ndjson +4 -0
- subagent_cli-0.1.1/docs/examples/worker-continue-flow.md +13 -0
- subagent_cli-0.1.1/pyproject.toml +44 -0
- subagent_cli-0.1.1/src/subagent/__init__.py +7 -0
- subagent_cli-0.1.1/src/subagent/acp_client.py +366 -0
- subagent_cli-0.1.1/src/subagent/approval_utils.py +57 -0
- subagent_cli-0.1.1/src/subagent/cli.py +1125 -0
- subagent_cli-0.1.1/src/subagent/config.py +305 -0
- subagent_cli-0.1.1/src/subagent/constants.py +21 -0
- subagent_cli-0.1.1/src/subagent/controller_service.py +267 -0
- subagent_cli-0.1.1/src/subagent/daemon.py +133 -0
- subagent_cli-0.1.1/src/subagent/errors.py +24 -0
- subagent_cli-0.1.1/src/subagent/handoff_service.py +354 -0
- subagent_cli-0.1.1/src/subagent/hints.py +36 -0
- subagent_cli-0.1.1/src/subagent/input_contract.py +121 -0
- subagent_cli-0.1.1/src/subagent/launcher_service.py +30 -0
- subagent_cli-0.1.1/src/subagent/output.py +41 -0
- subagent_cli-0.1.1/src/subagent/paths.py +63 -0
- subagent_cli-0.1.1/src/subagent/prompt_service.py +114 -0
- subagent_cli-0.1.1/src/subagent/runtime_service.py +342 -0
- subagent_cli-0.1.1/src/subagent/simple_yaml.py +202 -0
- subagent_cli-0.1.1/src/subagent/state.py +1049 -0
- subagent_cli-0.1.1/src/subagent/turn_service.py +558 -0
- subagent_cli-0.1.1/src/subagent/worker_runtime.py +758 -0
- subagent_cli-0.1.1/src/subagent/worker_service.py +362 -0
- subagent_cli-0.1.1/tests/fixtures/fake_acp_agent.py +264 -0
- subagent_cli-0.1.1/tests/test_acp_backend_integration.py +307 -0
- subagent_cli-0.1.1/tests/test_cli_phase1.py +120 -0
- subagent_cli-0.1.1/tests/test_daemon_phase1.py +43 -0
- subagent_cli-0.1.1/tests/test_handoff_phase4.py +222 -0
- subagent_cli-0.1.1/tests/test_polish_phase5.py +196 -0
- subagent_cli-0.1.1/tests/test_turn_phase3.py +284 -0
- subagent_cli-0.1.1/tests/test_worker_phase2.py +159 -0
- subagent_cli-0.1.1/uv.lock +617 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
name: Build distributions
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout source
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.11"
|
|
23
|
+
|
|
24
|
+
- name: Build artifacts
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
python -m pip install build twine
|
|
28
|
+
python -m build
|
|
29
|
+
python -m twine check dist/*
|
|
30
|
+
|
|
31
|
+
- name: Upload distributions
|
|
32
|
+
uses: actions/upload-artifact@v4
|
|
33
|
+
with:
|
|
34
|
+
name: python-package-distributions
|
|
35
|
+
path: dist/
|
|
36
|
+
|
|
37
|
+
publish:
|
|
38
|
+
name: Publish to PyPI
|
|
39
|
+
needs: [build]
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
environment:
|
|
42
|
+
name: pypi
|
|
43
|
+
url: https://pypi.org/project/subagent-cli/
|
|
44
|
+
permissions:
|
|
45
|
+
id-token: write
|
|
46
|
+
steps:
|
|
47
|
+
- name: Download distributions
|
|
48
|
+
uses: actions/download-artifact@v4
|
|
49
|
+
with:
|
|
50
|
+
name: python-package-distributions
|
|
51
|
+
path: dist/
|
|
52
|
+
|
|
53
|
+
- name: Publish package
|
|
54
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
55
|
+
with:
|
|
56
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Python-generated files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
.pytest_cache/
|
|
9
|
+
|
|
10
|
+
# Virtual environments
|
|
11
|
+
.venv
|
|
12
|
+
|
|
13
|
+
# Local runtime artifacts
|
|
14
|
+
.subagent/
|
|
15
|
+
subagentd-status.json
|
|
16
|
+
*.pid
|
|
17
|
+
|
|
18
|
+
# Local AI agent work logs (not tracked)
|
|
19
|
+
.agent-logs/
|
|
20
|
+
.ai-worklog/
|
|
21
|
+
worklog.local.md
|
|
22
|
+
.internal/
|
|
23
|
+
|
|
24
|
+
# Packaging / publishing local files
|
|
25
|
+
.pypirc
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for contributing to `subagent-cli`.
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
1. Install Python 3.11+ and `uv`.
|
|
7
|
+
2. Sync dependencies:
|
|
8
|
+
`uv sync`
|
|
9
|
+
3. Run tests:
|
|
10
|
+
`PYTHONPATH=src uv run python -m unittest discover -s tests -v`
|
|
11
|
+
|
|
12
|
+
## Pull Request Checklist
|
|
13
|
+
- Add or update tests for behavior changes.
|
|
14
|
+
- Keep CLI/user-facing docs in sync (`README.md`, `docs/`).
|
|
15
|
+
- Confirm all tests pass locally.
|
|
16
|
+
|
|
17
|
+
## Release (Maintainers)
|
|
18
|
+
### Trusted Publishing (recommended)
|
|
19
|
+
1. Ensure version is updated (`pyproject.toml`, and package version if needed).
|
|
20
|
+
2. Push the release commit and tag (for example `v0.1.1`).
|
|
21
|
+
3. Create a GitHub Release from that tag.
|
|
22
|
+
4. The workflow `.github/workflows/publish-pypi.yml` builds and publishes to PyPI via OIDC.
|
|
23
|
+
|
|
24
|
+
PyPI trusted publisher settings should match:
|
|
25
|
+
- Owner: `otakumesi`
|
|
26
|
+
- Repository: `subagent-cli`
|
|
27
|
+
- Workflow: `publish-pypi.yml`
|
|
28
|
+
- Environment: `pypi`
|
|
29
|
+
|
|
30
|
+
### Manual token-based publish (fallback)
|
|
31
|
+
1. Build artifacts:
|
|
32
|
+
`uv build`
|
|
33
|
+
2. Validate package metadata:
|
|
34
|
+
`uv run --group release python -m twine check dist/*`
|
|
35
|
+
3. Upload to PyPI:
|
|
36
|
+
`uv run --group release python -m twine upload dist/*`
|
|
37
|
+
|
|
38
|
+
Notes:
|
|
39
|
+
- Python requirement is 3.11+.
|
|
40
|
+
- Keep PyPI credentials/tokens in local config (for example `.pypirc`, gitignored).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 niitsuma-t
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: subagent-cli
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Protocol-agnostic worker orchestration CLI
|
|
5
|
+
Author: niitsuma-t
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 niitsuma-t
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Keywords: acp,agent,automation,cli,orchestration
|
|
29
|
+
Classifier: Development Status :: 3 - Alpha
|
|
30
|
+
Classifier: Environment :: Console
|
|
31
|
+
Classifier: Intended Audience :: Developers
|
|
32
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
33
|
+
Classifier: Operating System :: OS Independent
|
|
34
|
+
Classifier: Programming Language :: Python :: 3
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
38
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
39
|
+
Classifier: Topic :: Utilities
|
|
40
|
+
Requires-Python: >=3.11
|
|
41
|
+
Requires-Dist: typer>=0.24.1
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
|
|
44
|
+
# subagent-cli
|
|
45
|
+
|
|
46
|
+
`subagent-cli` is a protocol-agnostic CLI for orchestrating worker agents from a parent controller.
|
|
47
|
+
In practice, it is a control-plane CLI that a manager agent (for example Codex or Claude Code) can use to launch and coordinate other worker agents.
|
|
48
|
+
The CLI surface is protocol-agnostic, while the current runtime implementation is ACP-based (`acp-stdio`).
|
|
49
|
+
|
|
50
|
+
## Status
|
|
51
|
+
- Alpha (`v0.1.x`)
|
|
52
|
+
- Local single-host focused
|
|
53
|
+
- Python 3.11+
|
|
54
|
+
|
|
55
|
+
## Features
|
|
56
|
+
- Worker lifecycle: start, list, show, inspect, stop
|
|
57
|
+
- Turn operations: send, watch, wait, approve, cancel
|
|
58
|
+
- Handoff workflow: `worker handoff` and `worker continue`
|
|
59
|
+
- Strict approval flow with structured events
|
|
60
|
+
- ACP runtime integration (`acp-stdio`) with runtime restart + session resume (`session/load`)
|
|
61
|
+
|
|
62
|
+
## Install
|
|
63
|
+
- From PyPI:
|
|
64
|
+
`pip install subagent-cli`
|
|
65
|
+
- From local artifacts:
|
|
66
|
+
`pip install dist/subagent_cli-*.whl`
|
|
67
|
+
|
|
68
|
+
## Quick Start
|
|
69
|
+
1. Prepare config:
|
|
70
|
+
`mkdir -p ~/.config/subagent && cp config.example.yaml ~/.config/subagent/config.yaml`
|
|
71
|
+
2. Initialize a controller in your workspace:
|
|
72
|
+
`subagent controller init --cwd .`
|
|
73
|
+
3. Start a worker:
|
|
74
|
+
`subagent worker start --cwd .`
|
|
75
|
+
4. Send an instruction:
|
|
76
|
+
`subagent send --worker <worker-id> --text "Investigate failing tests"`
|
|
77
|
+
5. Watch events:
|
|
78
|
+
`subagent watch --worker <worker-id> --ndjson`
|
|
79
|
+
|
|
80
|
+
For local simulation/testing without a real ACP launcher:
|
|
81
|
+
`subagent worker start --cwd . --debug-mode`
|
|
82
|
+
|
|
83
|
+
## Configuration
|
|
84
|
+
- Default config path: `~/.config/subagent/config.yaml`
|
|
85
|
+
- Override config path: `SUBAGENT_CONFIG=/path/to/config.yaml`
|
|
86
|
+
- Example config: [config.example.yaml](config.example.yaml)
|
|
87
|
+
|
|
88
|
+
## State
|
|
89
|
+
- Default state DB: `~/.local/share/subagent/state.db`
|
|
90
|
+
- Project hint file: `<workspace>/.subagent/controller.json`
|
|
91
|
+
|
|
92
|
+
## Documentation
|
|
93
|
+
- Architecture note: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)
|
|
94
|
+
- Examples: [docs/examples](docs/examples)
|
|
95
|
+
- Contributing and release process: [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
MIT ([LICENSE](LICENSE))
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# subagent-cli
|
|
2
|
+
|
|
3
|
+
`subagent-cli` is a protocol-agnostic CLI for orchestrating worker agents from a parent controller.
|
|
4
|
+
In practice, it is a control-plane CLI that a manager agent (for example Codex or Claude Code) can use to launch and coordinate other worker agents.
|
|
5
|
+
The CLI surface is protocol-agnostic, while the current runtime implementation is ACP-based (`acp-stdio`).
|
|
6
|
+
|
|
7
|
+
## Status
|
|
8
|
+
- Alpha (`v0.1.x`)
|
|
9
|
+
- Local single-host focused
|
|
10
|
+
- Python 3.11+
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
- Worker lifecycle: start, list, show, inspect, stop
|
|
14
|
+
- Turn operations: send, watch, wait, approve, cancel
|
|
15
|
+
- Handoff workflow: `worker handoff` and `worker continue`
|
|
16
|
+
- Strict approval flow with structured events
|
|
17
|
+
- ACP runtime integration (`acp-stdio`) with runtime restart + session resume (`session/load`)
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
- From PyPI:
|
|
21
|
+
`pip install subagent-cli`
|
|
22
|
+
- From local artifacts:
|
|
23
|
+
`pip install dist/subagent_cli-*.whl`
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
1. Prepare config:
|
|
27
|
+
`mkdir -p ~/.config/subagent && cp config.example.yaml ~/.config/subagent/config.yaml`
|
|
28
|
+
2. Initialize a controller in your workspace:
|
|
29
|
+
`subagent controller init --cwd .`
|
|
30
|
+
3. Start a worker:
|
|
31
|
+
`subagent worker start --cwd .`
|
|
32
|
+
4. Send an instruction:
|
|
33
|
+
`subagent send --worker <worker-id> --text "Investigate failing tests"`
|
|
34
|
+
5. Watch events:
|
|
35
|
+
`subagent watch --worker <worker-id> --ndjson`
|
|
36
|
+
|
|
37
|
+
For local simulation/testing without a real ACP launcher:
|
|
38
|
+
`subagent worker start --cwd . --debug-mode`
|
|
39
|
+
|
|
40
|
+
## Configuration
|
|
41
|
+
- Default config path: `~/.config/subagent/config.yaml`
|
|
42
|
+
- Override config path: `SUBAGENT_CONFIG=/path/to/config.yaml`
|
|
43
|
+
- Example config: [config.example.yaml](config.example.yaml)
|
|
44
|
+
|
|
45
|
+
## State
|
|
46
|
+
- Default state DB: `~/.local/share/subagent/state.db`
|
|
47
|
+
- Project hint file: `<workspace>/.subagent/controller.json`
|
|
48
|
+
|
|
49
|
+
## Documentation
|
|
50
|
+
- Architecture note: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)
|
|
51
|
+
- Examples: [docs/examples](docs/examples)
|
|
52
|
+
- Contributing and release process: [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
MIT ([LICENSE](LICENSE))
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
launchers:
|
|
2
|
+
codex:
|
|
3
|
+
backend:
|
|
4
|
+
kind: acp-stdio
|
|
5
|
+
command: codex-acp
|
|
6
|
+
args: []
|
|
7
|
+
env: {}
|
|
8
|
+
|
|
9
|
+
claude-code:
|
|
10
|
+
backend:
|
|
11
|
+
kind: acp-stdio
|
|
12
|
+
command: claude-code-acp
|
|
13
|
+
args: []
|
|
14
|
+
env: {}
|
|
15
|
+
|
|
16
|
+
profiles:
|
|
17
|
+
worker-default:
|
|
18
|
+
promptLanguage: en
|
|
19
|
+
responseLanguage: same_as_manager
|
|
20
|
+
autoHandoff: turn_end
|
|
21
|
+
policyPreset: safe-default
|
|
22
|
+
defaultPacks:
|
|
23
|
+
- repo-conventions
|
|
24
|
+
bootstrap: |
|
|
25
|
+
You are a worker subagent.
|
|
26
|
+
Use STATUS:, ASK:, BLOCKED:, and DONE: prefixes when helpful.
|
|
27
|
+
Keep messages concise and actionable.
|
|
28
|
+
|
|
29
|
+
packs:
|
|
30
|
+
repo-conventions:
|
|
31
|
+
description: Follow repository coding conventions and keep diffs small.
|
|
32
|
+
prompt: |
|
|
33
|
+
Read existing conventions before editing.
|
|
34
|
+
Prefer minimal, explicit changes.
|
|
35
|
+
|
|
36
|
+
python-test-fix:
|
|
37
|
+
description: Fix flaky Python tests with minimal change scope.
|
|
38
|
+
prompt: |
|
|
39
|
+
Reproduce failing tests first.
|
|
40
|
+
Add regression coverage where practical.
|
|
41
|
+
|
|
42
|
+
policyPresets:
|
|
43
|
+
safe-default:
|
|
44
|
+
filesystem: workspace-write
|
|
45
|
+
network: ask
|
|
46
|
+
dangerousCommands: deny
|
|
47
|
+
|
|
48
|
+
defaults:
|
|
49
|
+
launcher: codex
|
|
50
|
+
profile: worker-default
|
|
51
|
+
packs:
|
|
52
|
+
- repo-conventions
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# subagent v1 Architecture Memo
|
|
2
|
+
|
|
3
|
+
## Layers
|
|
4
|
+
- CLI surface: `subagent` Typer commands for controller/config operations.
|
|
5
|
+
- Local control plane: `subagentd` minimal bootstrap/status process.
|
|
6
|
+
- Runtime state: sqlite-backed `StateStore` for controller ownership.
|
|
7
|
+
- Config registry: loader for `launchers` / `profiles` / `packs` from config.
|
|
8
|
+
|
|
9
|
+
## Current v1 Scope (Implemented)
|
|
10
|
+
- `launcher/profile/pack`: `list`, `show`
|
|
11
|
+
- `launcher`: `probe`
|
|
12
|
+
- `prompt`: `render` (manager/worker)
|
|
13
|
+
- `controller`: `init`, `attach`, `status`, `recover`, `release`
|
|
14
|
+
- `worker`: `start`, `list`, `show`, `inspect`, `stop`, `handoff`, `continue`
|
|
15
|
+
- turn operations: `send`, `watch`, `wait`, `approve`, `cancel`
|
|
16
|
+
- normalized event journal and approval queue
|
|
17
|
+
- persistent `acp-stdio` worker runtime:
|
|
18
|
+
- `worker start` launches runtime (`initialize` -> `session/new`)
|
|
19
|
+
- restart path attempts `session/load` using stored `sessionId`, then falls back to `session/new`
|
|
20
|
+
- `send` uses runtime IPC to execute `session/prompt`
|
|
21
|
+
- `cancel` propagates to runtime (`session/cancel`)
|
|
22
|
+
- live permission flow pauses on `session/request_permission` and resumes via `approve`
|
|
23
|
+
- runtime IPC retries once with auto-restart when runtime socket is unreachable
|
|
24
|
+
- explicit local simulation mode (`--debug-mode` or `--request-approval`)
|
|
25
|
+
- handoff store with `handoff.md` + `checkpoint.json`
|
|
26
|
+
- `--input` JSON contract (major commands) with duplicate-field rejection
|
|
27
|
+
- owner handle model: `controllerId + epoch + token`
|
|
28
|
+
- project-local hint: `<workspace>/.subagent/controller.json`
|
|
29
|
+
- versioned envelope for JSON responses
|
|
30
|
+
|
|
31
|
+
## Current Limitations
|
|
32
|
+
- local single-host control plane only (`subagentd` is minimal bootstrap/status)
|
|
33
|
+
- no queued turn execution; `send` is rejected while worker is busy
|
|
34
|
+
- resume strategy is handoff-first (no bit-perfect backend session resurrection)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "v1",
|
|
3
|
+
"sourceWorkerId": "w_123",
|
|
4
|
+
"createdAt": "2026-03-01T22:10:00Z",
|
|
5
|
+
"summary": {
|
|
6
|
+
"task": "Investigate flaky payments retry test",
|
|
7
|
+
"state": "idle",
|
|
8
|
+
"lastCompletedTurnId": "turn_07"
|
|
9
|
+
},
|
|
10
|
+
"artifacts": {
|
|
11
|
+
"handoff": "handoff.md",
|
|
12
|
+
"eventsPath": "events/w_123.ndjson"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Handoff
|
|
2
|
+
|
|
3
|
+
## Task
|
|
4
|
+
Investigate flaky payments retry test and implement a minimal safe fix.
|
|
5
|
+
|
|
6
|
+
## Goal
|
|
7
|
+
Stabilize retry test behavior and add regression coverage.
|
|
8
|
+
|
|
9
|
+
## Current Status
|
|
10
|
+
Root cause identified in retry backoff clock handling.
|
|
11
|
+
|
|
12
|
+
## Completed
|
|
13
|
+
- Reproduced flaky test locally.
|
|
14
|
+
- Isolated nondeterministic timestamp calculation.
|
|
15
|
+
|
|
16
|
+
## Pending
|
|
17
|
+
- Patch retry timing comparison.
|
|
18
|
+
- Add deterministic regression test.
|
|
19
|
+
- Re-run targeted test suite.
|
|
20
|
+
|
|
21
|
+
## Files of Interest
|
|
22
|
+
- `payments/retry.py`
|
|
23
|
+
- `tests/payments/test_retry.py`
|
|
24
|
+
|
|
25
|
+
## Commands Run
|
|
26
|
+
- `uv run pytest tests/payments/test_retry.py -k flaky_case`
|
|
27
|
+
|
|
28
|
+
## Risks / Notes
|
|
29
|
+
- Retry logic is shared by multiple payment flows.
|
|
30
|
+
- Validate no behavior regression for max retry cap.
|
|
31
|
+
|
|
32
|
+
## Recommended Next Step
|
|
33
|
+
Implement deterministic clock injection in retry calculation and add focused regression test.
|
|
34
|
+
|
|
35
|
+
## Artifacts
|
|
36
|
+
- `checkpoint.json`
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
{"schemaVersion":"v1","eventId":"ev_01","ts":"2026-03-01T22:00:00Z","workerId":"w_123","type":"worker.started","data":{"launcher":"codex","profile":"worker-default","state":"idle"}}
|
|
2
|
+
{"schemaVersion":"v1","eventId":"ev_02","ts":"2026-03-01T22:00:05Z","workerId":"w_123","type":"turn.started","data":{"turnId":"turn_01"}}
|
|
3
|
+
{"schemaVersion":"v1","eventId":"ev_03","ts":"2026-03-01T22:00:12Z","workerId":"w_123","type":"progress.message","data":{"role":"assistant","text":"STATUS: Investigating flaky payments retry test."}}
|
|
4
|
+
{"schemaVersion":"v1","eventId":"ev_04","ts":"2026-03-01T22:00:20Z","workerId":"w_123","type":"turn.completed","data":{"turnId":"turn_01","state":"idle"}}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Worker Continue Flow (v1)
|
|
2
|
+
|
|
3
|
+
1. Create handoff from previous worker:
|
|
4
|
+
`subagent worker handoff --worker w_123`
|
|
5
|
+
|
|
6
|
+
2. Start a new worker from the handoff artifact:
|
|
7
|
+
`subagent worker continue --from-worker w_123 --launcher codex --profile worker-default`
|
|
8
|
+
|
|
9
|
+
3. Watch normalized events from the new worker:
|
|
10
|
+
`subagent watch --worker w_456 --follow --ndjson`
|
|
11
|
+
|
|
12
|
+
4. Continue by sending a new instruction:
|
|
13
|
+
`subagent send --worker w_456 --text "Proceed with the minimal fix and add regression coverage."`
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "subagent-cli"
|
|
3
|
+
version = "0.1.1"
|
|
4
|
+
description = "Protocol-agnostic worker orchestration CLI"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
license = { file = "LICENSE" }
|
|
8
|
+
authors = [{ name = "niitsuma-t" }]
|
|
9
|
+
keywords = ["cli", "agent", "orchestration", "acp", "automation"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 3 - Alpha",
|
|
12
|
+
"Environment :: Console",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Topic :: Software Development :: Build Tools",
|
|
21
|
+
"Topic :: Utilities",
|
|
22
|
+
]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"typer>=0.24.1",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.scripts]
|
|
28
|
+
subagent = "subagent.cli:main"
|
|
29
|
+
subagentd = "subagent.daemon:main"
|
|
30
|
+
|
|
31
|
+
[build-system]
|
|
32
|
+
requires = ["hatchling>=1.26.0"]
|
|
33
|
+
build-backend = "hatchling.build"
|
|
34
|
+
|
|
35
|
+
[tool.hatch.build.targets.wheel]
|
|
36
|
+
packages = ["src/subagent"]
|
|
37
|
+
|
|
38
|
+
[dependency-groups]
|
|
39
|
+
dev = [
|
|
40
|
+
"pytest>=9.0.2",
|
|
41
|
+
]
|
|
42
|
+
release = [
|
|
43
|
+
"twine>=6.2.0",
|
|
44
|
+
]
|