pocketcoder-a1 0.1.0__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.
- pocketcoder_a1-0.1.0/LICENSE +21 -0
- pocketcoder_a1-0.1.0/PKG-INFO +230 -0
- pocketcoder_a1-0.1.0/README.md +194 -0
- pocketcoder_a1-0.1.0/a1/__init__.py +6 -0
- pocketcoder_a1-0.1.0/a1/checkpoint.py +146 -0
- pocketcoder_a1-0.1.0/a1/cli.py +368 -0
- pocketcoder_a1-0.1.0/a1/config.py +126 -0
- pocketcoder_a1-0.1.0/a1/dashboard.py +2589 -0
- pocketcoder_a1-0.1.0/a1/loop.py +1151 -0
- pocketcoder_a1-0.1.0/a1/tasks.py +211 -0
- pocketcoder_a1-0.1.0/a1/tester/__init__.py +6 -0
- pocketcoder_a1-0.1.0/a1/tester/analyzer.py +142 -0
- pocketcoder_a1-0.1.0/a1/tester/browser.py +124 -0
- pocketcoder_a1-0.1.0/a1/tester/report.py +193 -0
- pocketcoder_a1-0.1.0/a1/tester/runner.py +419 -0
- pocketcoder_a1-0.1.0/a1/tester/scenarios.py +203 -0
- pocketcoder_a1-0.1.0/a1/validator.py +361 -0
- pocketcoder_a1-0.1.0/pocketcoder_a1.egg-info/PKG-INFO +230 -0
- pocketcoder_a1-0.1.0/pocketcoder_a1.egg-info/SOURCES.txt +23 -0
- pocketcoder_a1-0.1.0/pocketcoder_a1.egg-info/dependency_links.txt +1 -0
- pocketcoder_a1-0.1.0/pocketcoder_a1.egg-info/entry_points.txt +2 -0
- pocketcoder_a1-0.1.0/pocketcoder_a1.egg-info/requires.txt +13 -0
- pocketcoder_a1-0.1.0/pocketcoder_a1.egg-info/top_level.txt +1 -0
- pocketcoder_a1-0.1.0/pyproject.toml +65 -0
- pocketcoder_a1-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dmitry Chashchin
|
|
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,230 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pocketcoder-a1
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Autonomous Coding Agent — The Autonomous Gnome
|
|
5
|
+
Author-email: Dmitry Chashchin <chashchin.dmitry@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Chashchin-Dmitry/pocketcoder-a1
|
|
8
|
+
Project-URL: Repository, https://github.com/Chashchin-Dmitry/pocketcoder-a1
|
|
9
|
+
Keywords: ai,coding,agent,autonomous,claude,llm
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Software Development
|
|
22
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
23
|
+
Requires-Python: >=3.8
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
28
|
+
Requires-Dist: ruff>=0.1; extra == "dev"
|
|
29
|
+
Provides-Extra: api
|
|
30
|
+
Requires-Dist: anthropic>=0.18; extra == "api"
|
|
31
|
+
Provides-Extra: ollama
|
|
32
|
+
Requires-Dist: ollama>=0.1; extra == "ollama"
|
|
33
|
+
Provides-Extra: test
|
|
34
|
+
Requires-Dist: playwright>=1.40; extra == "test"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# PocketCoder-A1
|
|
38
|
+
|
|
39
|
+
**Autonomous Coding Agent with Web Dashboard**
|
|
40
|
+
|
|
41
|
+
A1 works on your tasks autonomously — you add tasks, start the agent, watch progress in the dashboard.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Quick Start (5 steps)
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# 1. Clone and install
|
|
49
|
+
git clone https://github.com/Chashchin-Dmitry/pocketcoder-a1.git
|
|
50
|
+
cd pocketcoder-a1
|
|
51
|
+
python3 -m venv .venv
|
|
52
|
+
source .venv/bin/activate
|
|
53
|
+
pip install -e .
|
|
54
|
+
|
|
55
|
+
# 2. Install browser for E2E tests (optional)
|
|
56
|
+
pip install playwright requests
|
|
57
|
+
playwright install chromium
|
|
58
|
+
|
|
59
|
+
# 3. Initialize in any project
|
|
60
|
+
pca init /path/to/your-project
|
|
61
|
+
|
|
62
|
+
# 4. Add tasks
|
|
63
|
+
pca task add "Add login page" -d /path/to/your-project
|
|
64
|
+
pca task add "Write unit tests" -d /path/to/your-project
|
|
65
|
+
|
|
66
|
+
# 5. Launch dashboard
|
|
67
|
+
pca ui -d /path/to/your-project
|
|
68
|
+
# Opens http://localhost:7331
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Requirements:** Python 3.10+, [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) installed (`npm i -g @anthropic-ai/claude-code`)
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Web Dashboard
|
|
76
|
+
|
|
77
|
+
Open `http://localhost:7331` after running `pca ui`. 7 pages:
|
|
78
|
+
|
|
79
|
+
| Page | What it does |
|
|
80
|
+
|------|-------------|
|
|
81
|
+
| **Dashboard** | Status cards, task list, Quick Add form, Start/Stop agent, Live Log |
|
|
82
|
+
| **Tasks** | All tasks with priority badges (#1 #2 #3), drag-and-drop reorder, Add Task + Add Thought forms |
|
|
83
|
+
| **Sessions** | Current and previous session details |
|
|
84
|
+
| **Activity Log** | Timeline of all actions (started, stopped, task added) |
|
|
85
|
+
| **Commits** | Git commit history |
|
|
86
|
+
| **Transform** | Paste raw text -> AI breaks it into structured tasks |
|
|
87
|
+
| **Settings** | Theme toggle (dark/light), provider info |
|
|
88
|
+
|
|
89
|
+
### Key features:
|
|
90
|
+
- **Live Agent Log** — see what Claude is doing in real-time (action icons + raw log)
|
|
91
|
+
- **Queue Message** — send instructions to running agent (appears when agent is Running)
|
|
92
|
+
- **Drag-and-Drop** — reorder task priorities on Tasks page
|
|
93
|
+
- **Dark Theme** — click moon icon top-right
|
|
94
|
+
- **Transform** — paste messy notes, AI creates structured tasks with checkboxes
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## How to Test (step by step)
|
|
99
|
+
|
|
100
|
+
### Option A: Use the dashboard (recommended)
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
source .venv/bin/activate
|
|
104
|
+
|
|
105
|
+
# Start dashboard on any project
|
|
106
|
+
pca ui -d /path/to/your-project
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Then in browser at `http://localhost:7331`:
|
|
110
|
+
|
|
111
|
+
1. **Add tasks** — Quick Add form on Dashboard, or Tasks page
|
|
112
|
+
2. **Start Agent** — green button, watch status change to "Running"
|
|
113
|
+
3. **Watch Live Log** — "Agent Live Log" panel shows what Claude does
|
|
114
|
+
4. **Send message** — "Message to Agent" form appears when running
|
|
115
|
+
5. **Stop** — red "Stop Agent" button
|
|
116
|
+
6. **Transform** — go to Transform page, paste text, click "AI Transform"
|
|
117
|
+
7. **Check results** — Tasks page shows green checkmarks for completed tasks
|
|
118
|
+
|
|
119
|
+
### Option B: CLI only
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
source .venv/bin/activate
|
|
123
|
+
|
|
124
|
+
pca init ./my-project
|
|
125
|
+
pca task add "Create hello.py with greet function" -d ./my-project
|
|
126
|
+
pca start -d ./my-project # Runs agent in terminal
|
|
127
|
+
pca status -d ./my-project # Check progress
|
|
128
|
+
pca tasks -d ./my-project # See task list
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Option C: Run E2E tests
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
source .venv/bin/activate
|
|
135
|
+
|
|
136
|
+
# Start dashboard in background
|
|
137
|
+
pca ui -d ./my-project --no-browser &
|
|
138
|
+
|
|
139
|
+
# Run vision-based tests (7 scenarios)
|
|
140
|
+
pca test -d ./my-project --no-vision
|
|
141
|
+
|
|
142
|
+
# Reports saved to .a1/test-reports/
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## CLI Commands
|
|
148
|
+
|
|
149
|
+
| Command | Description |
|
|
150
|
+
|---------|-------------|
|
|
151
|
+
| `pca init <dir>` | Initialize .a1/ in project |
|
|
152
|
+
| `pca task add "..."` | Add task with optional description |
|
|
153
|
+
| `pca think "..."` | Add raw thought/idea |
|
|
154
|
+
| `pca tasks` | Show all tasks |
|
|
155
|
+
| `pca start` | Start autonomous agent (CLI mode) |
|
|
156
|
+
| `pca status` | Show current status |
|
|
157
|
+
| `pca validate` | Run validation (syntax, tests, lint) |
|
|
158
|
+
| `pca ui` | Launch web dashboard on :7331 |
|
|
159
|
+
| `pca test` | Run E2E vision tests |
|
|
160
|
+
| `pca log` | Show session history |
|
|
161
|
+
|
|
162
|
+
Add `-d /path/to/project` to any command to specify project directory.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Dashboard API (17 endpoints)
|
|
167
|
+
|
|
168
|
+
| Method | Endpoint | What it does |
|
|
169
|
+
|--------|----------|-------------|
|
|
170
|
+
| GET | `/` | Dashboard page |
|
|
171
|
+
| GET | `/tasks` | Tasks page |
|
|
172
|
+
| GET | `/sessions` | Sessions page |
|
|
173
|
+
| GET | `/log` | Activity log page |
|
|
174
|
+
| GET | `/commits` | Git commits page |
|
|
175
|
+
| GET | `/transform` | Transform page |
|
|
176
|
+
| GET | `/settings` | Settings page |
|
|
177
|
+
| GET | `/api/status` | JSON: checkpoint + tasks + progress + running |
|
|
178
|
+
| GET | `/api/log?since=N` | JSON: agent log entries since index N |
|
|
179
|
+
| POST | `/add-task` | Add task (form: task, description) |
|
|
180
|
+
| POST | `/add-thought` | Add thought (form: thought) |
|
|
181
|
+
| POST | `/start` | Start agent |
|
|
182
|
+
| POST | `/stop` | Stop agent |
|
|
183
|
+
| POST | `/queue-message` | Message to agent (form: message) |
|
|
184
|
+
| POST | `/api/reorder` | Reorder tasks (JSON: {order: [ids]}) |
|
|
185
|
+
| POST | `/transform` | AI transform text to tasks (form: text) |
|
|
186
|
+
| POST | `/transform-confirm` | Confirm transformed tasks (JSON: {tasks}) |
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Project Structure
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
pocketcoder-a1/
|
|
194
|
+
├── a1/ # Main code
|
|
195
|
+
│ ├── checkpoint.py # State between sessions
|
|
196
|
+
│ ├── tasks.py # Task management (priorities, reorder)
|
|
197
|
+
│ ├── validator.py # Validation (syntax, tests, lint)
|
|
198
|
+
│ ├── loop.py # Agent session loop (Claude CLI subprocess)
|
|
199
|
+
│ ├── dashboard.py # Web UI (17 endpoints, inline HTML/CSS/JS)
|
|
200
|
+
│ ├── cli.py # CLI commands (pca)
|
|
201
|
+
│ └── tester/ # Vision-based QA agent
|
|
202
|
+
├── .a1/ # Data (created on pca init)
|
|
203
|
+
│ ├── checkpoint.json # Current state
|
|
204
|
+
│ ├── tasks.json # Task list with priorities
|
|
205
|
+
│ ├── queue.json # Message queue for agent
|
|
206
|
+
│ ├── sessions/ # Session logs
|
|
207
|
+
│ └── checkpoints/ # Checkpoint archive
|
|
208
|
+
├── sandbox/ # Test projects
|
|
209
|
+
│ ├── test-e2e/ # E2E test (3/3 tasks passed)
|
|
210
|
+
│ └── epotos-templates/ # Real project test (3/3 tasks passed)
|
|
211
|
+
├── CLAUDE.md # Agent instructions
|
|
212
|
+
├── CURRENT_STAGE.md # Status with cause-effect chains
|
|
213
|
+
└── pyproject.toml # pip install -e .
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Providers
|
|
219
|
+
|
|
220
|
+
| Provider | Command | Requires |
|
|
221
|
+
|----------|---------|----------|
|
|
222
|
+
| claude-max | `pca start` | Claude Code CLI + Max subscription |
|
|
223
|
+
| claude-api | `pca start --provider claude-api` | ANTHROPIC_API_KEY |
|
|
224
|
+
| ollama | `pca start --provider ollama` | Local Ollama server |
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## License
|
|
229
|
+
|
|
230
|
+
MIT
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# PocketCoder-A1
|
|
2
|
+
|
|
3
|
+
**Autonomous Coding Agent with Web Dashboard**
|
|
4
|
+
|
|
5
|
+
A1 works on your tasks autonomously — you add tasks, start the agent, watch progress in the dashboard.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Quick Start (5 steps)
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# 1. Clone and install
|
|
13
|
+
git clone https://github.com/Chashchin-Dmitry/pocketcoder-a1.git
|
|
14
|
+
cd pocketcoder-a1
|
|
15
|
+
python3 -m venv .venv
|
|
16
|
+
source .venv/bin/activate
|
|
17
|
+
pip install -e .
|
|
18
|
+
|
|
19
|
+
# 2. Install browser for E2E tests (optional)
|
|
20
|
+
pip install playwright requests
|
|
21
|
+
playwright install chromium
|
|
22
|
+
|
|
23
|
+
# 3. Initialize in any project
|
|
24
|
+
pca init /path/to/your-project
|
|
25
|
+
|
|
26
|
+
# 4. Add tasks
|
|
27
|
+
pca task add "Add login page" -d /path/to/your-project
|
|
28
|
+
pca task add "Write unit tests" -d /path/to/your-project
|
|
29
|
+
|
|
30
|
+
# 5. Launch dashboard
|
|
31
|
+
pca ui -d /path/to/your-project
|
|
32
|
+
# Opens http://localhost:7331
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Requirements:** Python 3.10+, [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) installed (`npm i -g @anthropic-ai/claude-code`)
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Web Dashboard
|
|
40
|
+
|
|
41
|
+
Open `http://localhost:7331` after running `pca ui`. 7 pages:
|
|
42
|
+
|
|
43
|
+
| Page | What it does |
|
|
44
|
+
|------|-------------|
|
|
45
|
+
| **Dashboard** | Status cards, task list, Quick Add form, Start/Stop agent, Live Log |
|
|
46
|
+
| **Tasks** | All tasks with priority badges (#1 #2 #3), drag-and-drop reorder, Add Task + Add Thought forms |
|
|
47
|
+
| **Sessions** | Current and previous session details |
|
|
48
|
+
| **Activity Log** | Timeline of all actions (started, stopped, task added) |
|
|
49
|
+
| **Commits** | Git commit history |
|
|
50
|
+
| **Transform** | Paste raw text -> AI breaks it into structured tasks |
|
|
51
|
+
| **Settings** | Theme toggle (dark/light), provider info |
|
|
52
|
+
|
|
53
|
+
### Key features:
|
|
54
|
+
- **Live Agent Log** — see what Claude is doing in real-time (action icons + raw log)
|
|
55
|
+
- **Queue Message** — send instructions to running agent (appears when agent is Running)
|
|
56
|
+
- **Drag-and-Drop** — reorder task priorities on Tasks page
|
|
57
|
+
- **Dark Theme** — click moon icon top-right
|
|
58
|
+
- **Transform** — paste messy notes, AI creates structured tasks with checkboxes
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## How to Test (step by step)
|
|
63
|
+
|
|
64
|
+
### Option A: Use the dashboard (recommended)
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
source .venv/bin/activate
|
|
68
|
+
|
|
69
|
+
# Start dashboard on any project
|
|
70
|
+
pca ui -d /path/to/your-project
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Then in browser at `http://localhost:7331`:
|
|
74
|
+
|
|
75
|
+
1. **Add tasks** — Quick Add form on Dashboard, or Tasks page
|
|
76
|
+
2. **Start Agent** — green button, watch status change to "Running"
|
|
77
|
+
3. **Watch Live Log** — "Agent Live Log" panel shows what Claude does
|
|
78
|
+
4. **Send message** — "Message to Agent" form appears when running
|
|
79
|
+
5. **Stop** — red "Stop Agent" button
|
|
80
|
+
6. **Transform** — go to Transform page, paste text, click "AI Transform"
|
|
81
|
+
7. **Check results** — Tasks page shows green checkmarks for completed tasks
|
|
82
|
+
|
|
83
|
+
### Option B: CLI only
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
source .venv/bin/activate
|
|
87
|
+
|
|
88
|
+
pca init ./my-project
|
|
89
|
+
pca task add "Create hello.py with greet function" -d ./my-project
|
|
90
|
+
pca start -d ./my-project # Runs agent in terminal
|
|
91
|
+
pca status -d ./my-project # Check progress
|
|
92
|
+
pca tasks -d ./my-project # See task list
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Option C: Run E2E tests
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
source .venv/bin/activate
|
|
99
|
+
|
|
100
|
+
# Start dashboard in background
|
|
101
|
+
pca ui -d ./my-project --no-browser &
|
|
102
|
+
|
|
103
|
+
# Run vision-based tests (7 scenarios)
|
|
104
|
+
pca test -d ./my-project --no-vision
|
|
105
|
+
|
|
106
|
+
# Reports saved to .a1/test-reports/
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## CLI Commands
|
|
112
|
+
|
|
113
|
+
| Command | Description |
|
|
114
|
+
|---------|-------------|
|
|
115
|
+
| `pca init <dir>` | Initialize .a1/ in project |
|
|
116
|
+
| `pca task add "..."` | Add task with optional description |
|
|
117
|
+
| `pca think "..."` | Add raw thought/idea |
|
|
118
|
+
| `pca tasks` | Show all tasks |
|
|
119
|
+
| `pca start` | Start autonomous agent (CLI mode) |
|
|
120
|
+
| `pca status` | Show current status |
|
|
121
|
+
| `pca validate` | Run validation (syntax, tests, lint) |
|
|
122
|
+
| `pca ui` | Launch web dashboard on :7331 |
|
|
123
|
+
| `pca test` | Run E2E vision tests |
|
|
124
|
+
| `pca log` | Show session history |
|
|
125
|
+
|
|
126
|
+
Add `-d /path/to/project` to any command to specify project directory.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Dashboard API (17 endpoints)
|
|
131
|
+
|
|
132
|
+
| Method | Endpoint | What it does |
|
|
133
|
+
|--------|----------|-------------|
|
|
134
|
+
| GET | `/` | Dashboard page |
|
|
135
|
+
| GET | `/tasks` | Tasks page |
|
|
136
|
+
| GET | `/sessions` | Sessions page |
|
|
137
|
+
| GET | `/log` | Activity log page |
|
|
138
|
+
| GET | `/commits` | Git commits page |
|
|
139
|
+
| GET | `/transform` | Transform page |
|
|
140
|
+
| GET | `/settings` | Settings page |
|
|
141
|
+
| GET | `/api/status` | JSON: checkpoint + tasks + progress + running |
|
|
142
|
+
| GET | `/api/log?since=N` | JSON: agent log entries since index N |
|
|
143
|
+
| POST | `/add-task` | Add task (form: task, description) |
|
|
144
|
+
| POST | `/add-thought` | Add thought (form: thought) |
|
|
145
|
+
| POST | `/start` | Start agent |
|
|
146
|
+
| POST | `/stop` | Stop agent |
|
|
147
|
+
| POST | `/queue-message` | Message to agent (form: message) |
|
|
148
|
+
| POST | `/api/reorder` | Reorder tasks (JSON: {order: [ids]}) |
|
|
149
|
+
| POST | `/transform` | AI transform text to tasks (form: text) |
|
|
150
|
+
| POST | `/transform-confirm` | Confirm transformed tasks (JSON: {tasks}) |
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Project Structure
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
pocketcoder-a1/
|
|
158
|
+
├── a1/ # Main code
|
|
159
|
+
│ ├── checkpoint.py # State between sessions
|
|
160
|
+
│ ├── tasks.py # Task management (priorities, reorder)
|
|
161
|
+
│ ├── validator.py # Validation (syntax, tests, lint)
|
|
162
|
+
│ ├── loop.py # Agent session loop (Claude CLI subprocess)
|
|
163
|
+
│ ├── dashboard.py # Web UI (17 endpoints, inline HTML/CSS/JS)
|
|
164
|
+
│ ├── cli.py # CLI commands (pca)
|
|
165
|
+
│ └── tester/ # Vision-based QA agent
|
|
166
|
+
├── .a1/ # Data (created on pca init)
|
|
167
|
+
│ ├── checkpoint.json # Current state
|
|
168
|
+
│ ├── tasks.json # Task list with priorities
|
|
169
|
+
│ ├── queue.json # Message queue for agent
|
|
170
|
+
│ ├── sessions/ # Session logs
|
|
171
|
+
│ └── checkpoints/ # Checkpoint archive
|
|
172
|
+
├── sandbox/ # Test projects
|
|
173
|
+
│ ├── test-e2e/ # E2E test (3/3 tasks passed)
|
|
174
|
+
│ └── epotos-templates/ # Real project test (3/3 tasks passed)
|
|
175
|
+
├── CLAUDE.md # Agent instructions
|
|
176
|
+
├── CURRENT_STAGE.md # Status with cause-effect chains
|
|
177
|
+
└── pyproject.toml # pip install -e .
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Providers
|
|
183
|
+
|
|
184
|
+
| Provider | Command | Requires |
|
|
185
|
+
|----------|---------|----------|
|
|
186
|
+
| claude-max | `pca start` | Claude Code CLI + Max subscription |
|
|
187
|
+
| claude-api | `pca start --provider claude-api` | ANTHROPIC_API_KEY |
|
|
188
|
+
| ollama | `pca start --provider ollama` | Local Ollama server |
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## License
|
|
193
|
+
|
|
194
|
+
MIT
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Checkpoint Manager — сохранение состояния между сессиями
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Any, Dict, List, Optional
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class CheckpointManager:
|
|
12
|
+
"""Управление checkpoint'ами для автономной работы"""
|
|
13
|
+
|
|
14
|
+
def __init__(self, project_dir: Path):
|
|
15
|
+
self.project_dir = Path(project_dir)
|
|
16
|
+
self.a1_dir = self.project_dir / ".a1"
|
|
17
|
+
self.checkpoint_file = self.a1_dir / "checkpoint.json"
|
|
18
|
+
self.checkpoints_dir = self.a1_dir / "checkpoints"
|
|
19
|
+
|
|
20
|
+
# Создаём структуру если не существует
|
|
21
|
+
self.a1_dir.mkdir(parents=True, exist_ok=True)
|
|
22
|
+
self.checkpoints_dir.mkdir(exist_ok=True)
|
|
23
|
+
|
|
24
|
+
def load(self) -> Dict[str, Any]:
|
|
25
|
+
"""Загрузить текущий checkpoint"""
|
|
26
|
+
if not self.checkpoint_file.exists():
|
|
27
|
+
return self._create_initial()
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
with open(self.checkpoint_file, "r") as f:
|
|
31
|
+
return json.load(f)
|
|
32
|
+
except (json.JSONDecodeError, IOError):
|
|
33
|
+
return self._create_initial()
|
|
34
|
+
|
|
35
|
+
def save(self, checkpoint: Dict[str, Any]) -> None:
|
|
36
|
+
"""Сохранить checkpoint"""
|
|
37
|
+
checkpoint["updated_at"] = datetime.now().isoformat()
|
|
38
|
+
|
|
39
|
+
# Сохраняем текущий
|
|
40
|
+
with open(self.checkpoint_file, "w") as f:
|
|
41
|
+
json.dump(checkpoint, f, indent=2, ensure_ascii=False)
|
|
42
|
+
|
|
43
|
+
# Архивируем копию
|
|
44
|
+
session = checkpoint.get("session", 0)
|
|
45
|
+
archive_file = self.checkpoints_dir / f"session_{session:03d}.json"
|
|
46
|
+
with open(archive_file, "w") as f:
|
|
47
|
+
json.dump(checkpoint, f, indent=2, ensure_ascii=False)
|
|
48
|
+
|
|
49
|
+
def _create_initial(self) -> Dict[str, Any]:
|
|
50
|
+
"""Создать начальный checkpoint"""
|
|
51
|
+
return {
|
|
52
|
+
"status": "STARTING",
|
|
53
|
+
"session": 0,
|
|
54
|
+
"current_task": None,
|
|
55
|
+
"context_percent": 0,
|
|
56
|
+
"files_modified": [],
|
|
57
|
+
"decisions": [],
|
|
58
|
+
"next_steps": [],
|
|
59
|
+
"last_action": None,
|
|
60
|
+
"created_at": datetime.now().isoformat(),
|
|
61
|
+
"updated_at": datetime.now().isoformat(),
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
def start_session(self) -> Dict[str, Any]:
|
|
65
|
+
"""Начать новую сессию"""
|
|
66
|
+
checkpoint = self.load()
|
|
67
|
+
checkpoint["session"] += 1
|
|
68
|
+
checkpoint["status"] = "WORKING"
|
|
69
|
+
checkpoint["session_started_at"] = datetime.now().isoformat()
|
|
70
|
+
self.save(checkpoint)
|
|
71
|
+
return checkpoint
|
|
72
|
+
|
|
73
|
+
def end_session(
|
|
74
|
+
self,
|
|
75
|
+
current_task: Optional[str] = None,
|
|
76
|
+
files_modified: Optional[List[str]] = None,
|
|
77
|
+
decisions: Optional[List[str]] = None,
|
|
78
|
+
next_steps: Optional[List[str]] = None,
|
|
79
|
+
last_action: Optional[str] = None,
|
|
80
|
+
context_percent: int = 0,
|
|
81
|
+
) -> None:
|
|
82
|
+
"""Завершить сессию с сохранением состояния"""
|
|
83
|
+
checkpoint = self.load()
|
|
84
|
+
|
|
85
|
+
if current_task:
|
|
86
|
+
checkpoint["current_task"] = current_task
|
|
87
|
+
if files_modified:
|
|
88
|
+
# Добавляем к существующим, убираем дубли
|
|
89
|
+
existing = set(checkpoint.get("files_modified", []))
|
|
90
|
+
existing.update(files_modified)
|
|
91
|
+
checkpoint["files_modified"] = list(existing)
|
|
92
|
+
if decisions:
|
|
93
|
+
checkpoint["decisions"].extend(decisions)
|
|
94
|
+
checkpoint["decisions"] = checkpoint["decisions"][-20:]
|
|
95
|
+
if next_steps:
|
|
96
|
+
checkpoint["next_steps"] = next_steps
|
|
97
|
+
if last_action:
|
|
98
|
+
checkpoint["last_action"] = last_action
|
|
99
|
+
|
|
100
|
+
checkpoint["context_percent"] = context_percent
|
|
101
|
+
checkpoint["session_ended_at"] = datetime.now().isoformat()
|
|
102
|
+
|
|
103
|
+
self.save(checkpoint)
|
|
104
|
+
|
|
105
|
+
def mark_completed(self) -> None:
|
|
106
|
+
"""Отметить всю работу как завершённую"""
|
|
107
|
+
checkpoint = self.load()
|
|
108
|
+
checkpoint["status"] = "COMPLETED"
|
|
109
|
+
checkpoint["completed_at"] = datetime.now().isoformat()
|
|
110
|
+
self.save(checkpoint)
|
|
111
|
+
|
|
112
|
+
def is_completed(self) -> bool:
|
|
113
|
+
"""Проверить завершена ли работа"""
|
|
114
|
+
checkpoint = self.load()
|
|
115
|
+
return checkpoint.get("status") == "COMPLETED"
|
|
116
|
+
|
|
117
|
+
def get_session_number(self) -> int:
|
|
118
|
+
"""Получить номер текущей сессии"""
|
|
119
|
+
checkpoint = self.load()
|
|
120
|
+
return checkpoint.get("session", 0)
|
|
121
|
+
|
|
122
|
+
def get_summary(self) -> str:
|
|
123
|
+
"""Получить текстовое резюме для промпта"""
|
|
124
|
+
cp = self.load()
|
|
125
|
+
|
|
126
|
+
lines = [
|
|
127
|
+
f"## Checkpoint (Session #{cp['session']})",
|
|
128
|
+
f"Status: {cp['status']}",
|
|
129
|
+
f"Current task: {cp.get('current_task', 'None')}",
|
|
130
|
+
f"Last action: {cp.get('last_action', 'None')}",
|
|
131
|
+
]
|
|
132
|
+
|
|
133
|
+
if cp.get("files_modified"):
|
|
134
|
+
lines.append(f"Files modified: {', '.join(cp['files_modified'][-10:])}")
|
|
135
|
+
|
|
136
|
+
if cp.get("decisions"):
|
|
137
|
+
lines.append("Recent decisions:")
|
|
138
|
+
for d in cp["decisions"][-5:]:
|
|
139
|
+
lines.append(f" - {d}")
|
|
140
|
+
|
|
141
|
+
if cp.get("next_steps"):
|
|
142
|
+
lines.append("Next steps:")
|
|
143
|
+
for s in cp["next_steps"]:
|
|
144
|
+
lines.append(f" - {s}")
|
|
145
|
+
|
|
146
|
+
return "\n".join(lines)
|