pocket-coding 0.1.1__tar.gz → 0.2.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.
- pocket_coding-0.2.1/.gitignore +16 -0
- pocket_coding-0.2.1/PKG-INFO +231 -0
- pocket_coding-0.2.1/README.md +210 -0
- pocket_coding-0.2.1/README.zh-CN.md +211 -0
- {pocket_coding-0.1.1 → pocket_coding-0.2.1}/poco/__init__.py +1 -1
- pocket_coding-0.2.1/poco/app.py +104 -0
- pocket_coding-0.2.1/poco/bootstrap/__init__.py +5 -0
- pocket_coding-0.2.1/poco/bootstrap/feishu.py +393 -0
- pocket_coding-0.2.1/poco/config/__init__.py +39 -0
- pocket_coding-0.2.1/poco/config/store.py +315 -0
- pocket_coding-0.2.1/poco/providers/__init__.py +42 -0
- pocket_coding-0.2.1/poco/providers/base.py +54 -0
- pocket_coding-0.2.1/poco/providers/claude.py +400 -0
- pocket_coding-0.2.1/poco/providers/codex.py +367 -0
- pocket_coding-0.2.1/poco/providers/models.py +63 -0
- pocket_coding-0.2.1/poco/relay/__init__.py +39 -0
- pocket_coding-0.2.1/poco/relay/app.py +1320 -0
- pocket_coding-0.2.1/poco/relay/cards.py +1441 -0
- pocket_coding-0.2.1/poco/relay/messenger.py +450 -0
- pocket_coding-0.2.1/poco/relay/models.py +106 -0
- pocket_coding-0.2.1/poco/relay/runtime.py +442 -0
- pocket_coding-0.2.1/poco/relay/stores.py +308 -0
- pocket_coding-0.2.1/poco/relay/utils.py +116 -0
- pocket_coding-0.2.1/poco/runtime.py +210 -0
- pocket_coding-0.2.1/poco/tui/__init__.py +5 -0
- pocket_coding-0.2.1/poco/tui/app.py +787 -0
- pocket_coding-0.2.1/poco/tui/menus/__init__.py +9 -0
- pocket_coding-0.2.1/poco/tui/menus/config/__init__.py +37 -0
- pocket_coding-0.2.1/poco/tui/menus/config/claude.py +513 -0
- pocket_coding-0.2.1/poco/tui/menus/config/controller.py +233 -0
- pocket_coding-0.2.1/poco/tui/menus/config/render_base.py +119 -0
- pocket_coding-0.2.1/poco/tui/menus/config/render_forms.py +56 -0
- pocket_coding-0.2.1/poco/tui/menus/config/sections.py +194 -0
- pocket_coding-0.2.1/poco/tui/menus/config/types.py +117 -0
- pocket_coding-0.2.1/poco/tui/menus/root.py +34 -0
- pocket_coding-0.2.1/poco/tui/resources.py +276 -0
- {pocket_coding-0.1.1 → pocket_coding-0.2.1}/pyproject.toml +1 -1
- pocket_coding-0.1.1/PKG-INFO +0 -183
- pocket_coding-0.1.1/README.md +0 -162
- pocket_coding-0.1.1/README.zh-CN.md +0 -162
- pocket_coding-0.1.1/poco/app.py +0 -639
- pocket_coding-0.1.1/poco/bridge.py +0 -1402
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pocket-coding
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: PoCo: Pocket Coding for Feishu
|
|
5
|
+
Author: PoCo contributors
|
|
6
|
+
Keywords: bot,codex,feishu,lark,tui
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Environment :: Console
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Communications :: Chat
|
|
16
|
+
Classifier: Topic :: Software Development :: User Interfaces
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Requires-Dist: lark-oapi==1.5.3
|
|
19
|
+
Requires-Dist: textual<1,>=0.75
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# PoCo
|
|
23
|
+
|
|
24
|
+
[中文说明](README.zh-CN.md)
|
|
25
|
+
|
|
26
|
+
`PoCo` is the product name. The Python package name is `pocket-coding`.
|
|
27
|
+
|
|
28
|
+
PoCo is a local TUI for running coding-agent providers behind a Feishu bot. Codex is fully wired through `app-server`; Claude Code is wired through a CLI-backed provider with streamed output, session discovery, and session attach.
|
|
29
|
+
|
|
30
|
+
- DM the bot for management
|
|
31
|
+
- Use Feishu groups as project workspaces
|
|
32
|
+
- Run one provider-backed worker per project group
|
|
33
|
+
- Stream progress back by creating and editing Feishu messages
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
Install PoCo:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install pocket-coding
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Or from source:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Then follow this flow:
|
|
50
|
+
|
|
51
|
+
1. Create one Feishu self-built bot app, then bootstrap it with PoCo.
|
|
52
|
+
|
|
53
|
+
Create the app manually in the Feishu developer console first. After you get
|
|
54
|
+
the `App ID` and `App Secret`, run:
|
|
55
|
+
|
|
56
|
+
Before running bootstrap, open this auth page and grant either
|
|
57
|
+
`application:application` or `admin:app.category:update`:
|
|
58
|
+
|
|
59
|
+
<https://open.feishu.cn/app/cli_a92032ebc97cdbcc/auth?q=application:application,admin:app.category:update&op_from=openapi&token_type=tenant>
|
|
60
|
+
|
|
61
|
+
Then run:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
poco feishu-bootstrap
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
PoCo will rewrite the app into the state it needs, including scopes, event
|
|
68
|
+
subscriptions, and callback subscriptions.
|
|
69
|
+
|
|
70
|
+
After bootstrap finishes, create and publish a new app version manually in the
|
|
71
|
+
Feishu Open Platform. PoCo will print the suggested next semantic version in
|
|
72
|
+
the bootstrap log.
|
|
73
|
+
|
|
74
|
+
2. Make sure the machine running PoCo already has `codex` or `claude` / Claude
|
|
75
|
+
Code installed and working.
|
|
76
|
+
|
|
77
|
+
PoCo does not install these tools for you. If they are missing or broken, fix
|
|
78
|
+
that first on your machine, then continue.
|
|
79
|
+
|
|
80
|
+
3. Start PoCo, then open a DM with the bot.
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
poco
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
In the DM, send any message. For example:
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
poco
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
This opens the DM control card. Use `New Project` to create a project group.
|
|
93
|
+
PoCo will create a group named `Pocket-Project: <project_id>`, add you, add the
|
|
94
|
+
bot, and start the default runtime:
|
|
95
|
+
|
|
96
|
+
- Agent: `codex`
|
|
97
|
+
- Provider: `openai`
|
|
98
|
+
- Model: `gpt-5.4`
|
|
99
|
+
- Reply Mode: `all`
|
|
100
|
+
|
|
101
|
+
To send images to the current agent, send one Feishu post message that includes
|
|
102
|
+
both the image and the text prompt. PoCo will forward them together.
|
|
103
|
+
|
|
104
|
+
PoCo also ships with predefined model catalogs. For the Claude provider, the built-in list currently includes:
|
|
105
|
+
|
|
106
|
+
- `sonnet`
|
|
107
|
+
- `opus`
|
|
108
|
+
- `haiku`
|
|
109
|
+
- `deepseek-chat`
|
|
110
|
+
- `deepseek-reasoner`
|
|
111
|
+
- `kimi-k2.5`
|
|
112
|
+
- `kimi-k2-0905-preview`
|
|
113
|
+
- `kimi-k2-0711-preview`
|
|
114
|
+
- `kimi-k2-turbo-preview`
|
|
115
|
+
- `kimi-k2-thinking`
|
|
116
|
+
- `kimi-k2-thinking-turbo`
|
|
117
|
+
- `moonshot-v1-8k`
|
|
118
|
+
- `moonshot-v1-32k`
|
|
119
|
+
- `moonshot-v1-128k`
|
|
120
|
+
- `moonshot-v1-8k-vision-preview`
|
|
121
|
+
- `moonshot-v1-32k-vision-preview`
|
|
122
|
+
- `moonshot-v1-128k-vision-preview`
|
|
123
|
+
- `MiniMax-M2.1`
|
|
124
|
+
- `MiniMax-M2.5`
|
|
125
|
+
- `MiniMax-M2.7`
|
|
126
|
+
|
|
127
|
+
Built-in Claude backends currently include:
|
|
128
|
+
|
|
129
|
+
- `anthropic`
|
|
130
|
+
- `deepseek`
|
|
131
|
+
- `kimi`
|
|
132
|
+
- `minimax`
|
|
133
|
+
|
|
134
|
+
After that, the default workflow is simple:
|
|
135
|
+
|
|
136
|
+
- DM the bot with `poco`
|
|
137
|
+
- use the DM console card for project create / status / remove
|
|
138
|
+
- in the project group, just talk to the agent
|
|
139
|
+
|
|
140
|
+
## How It Works
|
|
141
|
+
|
|
142
|
+
- DM with the bot: management console
|
|
143
|
+
- Group chat with the bot: project workspace
|
|
144
|
+
- Each project group gets its own worker process
|
|
145
|
+
- Each project is configured from the DM console card
|
|
146
|
+
- PoCo connects to Feishu in long-connection mode, so no public callback URL is required
|
|
147
|
+
|
|
148
|
+
## Usage
|
|
149
|
+
|
|
150
|
+
DM console:
|
|
151
|
+
|
|
152
|
+
- send `poco`
|
|
153
|
+
- use the card UI to create a project, inspect a worker, or remove a worker
|
|
154
|
+
|
|
155
|
+
Project group:
|
|
156
|
+
|
|
157
|
+
- just talk to the agent
|
|
158
|
+
- send one Feishu post message that contains both the image and the text prompt
|
|
159
|
+
- no setup or lifecycle commands are needed in the group
|
|
160
|
+
|
|
161
|
+
## Providers
|
|
162
|
+
|
|
163
|
+
- `codex`: fully implemented through `codex app-server`
|
|
164
|
+
- `claude`: implemented through the Claude Code CLI with streamed JSON output
|
|
165
|
+
|
|
166
|
+
Current provider notes:
|
|
167
|
+
|
|
168
|
+
- Codex is the default runtime path
|
|
169
|
+
- Claude currently supports session attach, image input, and streamed replies
|
|
170
|
+
|
|
171
|
+
## TUI
|
|
172
|
+
|
|
173
|
+
Views:
|
|
174
|
+
|
|
175
|
+
The TUI is a two-panel terminal UI:
|
|
176
|
+
|
|
177
|
+
- left panel: logo and runtime summary
|
|
178
|
+
- right panel: the current menu or interaction view
|
|
179
|
+
- bottom: an input line that is only enabled when a config field needs text input
|
|
180
|
+
|
|
181
|
+
Shortcuts:
|
|
182
|
+
|
|
183
|
+
- `Ctrl+R`: Save and restart
|
|
184
|
+
- `q`: go back one level
|
|
185
|
+
- `Up` / `Down`: move in the main menu or config menu
|
|
186
|
+
- `Enter`: open the selected item
|
|
187
|
+
- `Esc`: go back one level
|
|
188
|
+
|
|
189
|
+
The default home screen is menu-driven:
|
|
190
|
+
|
|
191
|
+
- the right panel shows a menu with `Config`, `Restart`, and `Quit`
|
|
192
|
+
- use `Up` / `Down` to select an item
|
|
193
|
+
- press `Enter` to open it
|
|
194
|
+
|
|
195
|
+
`Config` enters config mode. In that mode:
|
|
196
|
+
|
|
197
|
+
- the right panel turns into a selection menu
|
|
198
|
+
- `Up` / `Down` moves between sections or fields
|
|
199
|
+
- `Enter` opens the current selection
|
|
200
|
+
- `Esc` returns to the previous level
|
|
201
|
+
- `Language` lets you switch between English and Chinese
|
|
202
|
+
- `Bot` contains `feishu` settings such as `App ID` and `App Secret`
|
|
203
|
+
- `Agent & Model` contains `codex` and `claude`
|
|
204
|
+
- `claude` opens a backend menu first
|
|
205
|
+
- choose a backend such as `anthropic`, `minimax`, or a user-added custom backend
|
|
206
|
+
- the backend marked with `(default)` is the current global Claude default
|
|
207
|
+
- then edit that backend's `base_url`, `auth_token`, `model`, and `extra_env`
|
|
208
|
+
- `model` opens another menu; pick a model first, then run `set_as_default`
|
|
209
|
+
- `extra_env` also opens a submenu; manage env entries one by one instead of editing raw JSON
|
|
210
|
+
- `set_as_default` on the backend page marks that backend as the global Claude default
|
|
211
|
+
- `show` opens the current config in a scrollable view
|
|
212
|
+
- the bottom input line is only active while editing a text field
|
|
213
|
+
|
|
214
|
+
## Files
|
|
215
|
+
|
|
216
|
+
- Config: `~/.config/poco/config.json`
|
|
217
|
+
- State: `~/.local/state/poco/`
|
|
218
|
+
|
|
219
|
+
## Development
|
|
220
|
+
|
|
221
|
+
Build packages:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
uv build
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Quick syntax check:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
uv run python -m py_compile poco/__init__.py poco/app.py poco/runtime.py poco/relay/app.py poco/config/store.py poco/tui/app.py
|
|
231
|
+
```
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# PoCo
|
|
2
|
+
|
|
3
|
+
[中文说明](README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
`PoCo` is the product name. The Python package name is `pocket-coding`.
|
|
6
|
+
|
|
7
|
+
PoCo is a local TUI for running coding-agent providers behind a Feishu bot. Codex is fully wired through `app-server`; Claude Code is wired through a CLI-backed provider with streamed output, session discovery, and session attach.
|
|
8
|
+
|
|
9
|
+
- DM the bot for management
|
|
10
|
+
- Use Feishu groups as project workspaces
|
|
11
|
+
- Run one provider-backed worker per project group
|
|
12
|
+
- Stream progress back by creating and editing Feishu messages
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
Install PoCo:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install pocket-coding
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Or from source:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install .
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Then follow this flow:
|
|
29
|
+
|
|
30
|
+
1. Create one Feishu self-built bot app, then bootstrap it with PoCo.
|
|
31
|
+
|
|
32
|
+
Create the app manually in the Feishu developer console first. After you get
|
|
33
|
+
the `App ID` and `App Secret`, run:
|
|
34
|
+
|
|
35
|
+
Before running bootstrap, open this auth page and grant either
|
|
36
|
+
`application:application` or `admin:app.category:update`:
|
|
37
|
+
|
|
38
|
+
<https://open.feishu.cn/app/cli_a92032ebc97cdbcc/auth?q=application:application,admin:app.category:update&op_from=openapi&token_type=tenant>
|
|
39
|
+
|
|
40
|
+
Then run:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
poco feishu-bootstrap
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
PoCo will rewrite the app into the state it needs, including scopes, event
|
|
47
|
+
subscriptions, and callback subscriptions.
|
|
48
|
+
|
|
49
|
+
After bootstrap finishes, create and publish a new app version manually in the
|
|
50
|
+
Feishu Open Platform. PoCo will print the suggested next semantic version in
|
|
51
|
+
the bootstrap log.
|
|
52
|
+
|
|
53
|
+
2. Make sure the machine running PoCo already has `codex` or `claude` / Claude
|
|
54
|
+
Code installed and working.
|
|
55
|
+
|
|
56
|
+
PoCo does not install these tools for you. If they are missing or broken, fix
|
|
57
|
+
that first on your machine, then continue.
|
|
58
|
+
|
|
59
|
+
3. Start PoCo, then open a DM with the bot.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
poco
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
In the DM, send any message. For example:
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
poco
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
This opens the DM control card. Use `New Project` to create a project group.
|
|
72
|
+
PoCo will create a group named `Pocket-Project: <project_id>`, add you, add the
|
|
73
|
+
bot, and start the default runtime:
|
|
74
|
+
|
|
75
|
+
- Agent: `codex`
|
|
76
|
+
- Provider: `openai`
|
|
77
|
+
- Model: `gpt-5.4`
|
|
78
|
+
- Reply Mode: `all`
|
|
79
|
+
|
|
80
|
+
To send images to the current agent, send one Feishu post message that includes
|
|
81
|
+
both the image and the text prompt. PoCo will forward them together.
|
|
82
|
+
|
|
83
|
+
PoCo also ships with predefined model catalogs. For the Claude provider, the built-in list currently includes:
|
|
84
|
+
|
|
85
|
+
- `sonnet`
|
|
86
|
+
- `opus`
|
|
87
|
+
- `haiku`
|
|
88
|
+
- `deepseek-chat`
|
|
89
|
+
- `deepseek-reasoner`
|
|
90
|
+
- `kimi-k2.5`
|
|
91
|
+
- `kimi-k2-0905-preview`
|
|
92
|
+
- `kimi-k2-0711-preview`
|
|
93
|
+
- `kimi-k2-turbo-preview`
|
|
94
|
+
- `kimi-k2-thinking`
|
|
95
|
+
- `kimi-k2-thinking-turbo`
|
|
96
|
+
- `moonshot-v1-8k`
|
|
97
|
+
- `moonshot-v1-32k`
|
|
98
|
+
- `moonshot-v1-128k`
|
|
99
|
+
- `moonshot-v1-8k-vision-preview`
|
|
100
|
+
- `moonshot-v1-32k-vision-preview`
|
|
101
|
+
- `moonshot-v1-128k-vision-preview`
|
|
102
|
+
- `MiniMax-M2.1`
|
|
103
|
+
- `MiniMax-M2.5`
|
|
104
|
+
- `MiniMax-M2.7`
|
|
105
|
+
|
|
106
|
+
Built-in Claude backends currently include:
|
|
107
|
+
|
|
108
|
+
- `anthropic`
|
|
109
|
+
- `deepseek`
|
|
110
|
+
- `kimi`
|
|
111
|
+
- `minimax`
|
|
112
|
+
|
|
113
|
+
After that, the default workflow is simple:
|
|
114
|
+
|
|
115
|
+
- DM the bot with `poco`
|
|
116
|
+
- use the DM console card for project create / status / remove
|
|
117
|
+
- in the project group, just talk to the agent
|
|
118
|
+
|
|
119
|
+
## How It Works
|
|
120
|
+
|
|
121
|
+
- DM with the bot: management console
|
|
122
|
+
- Group chat with the bot: project workspace
|
|
123
|
+
- Each project group gets its own worker process
|
|
124
|
+
- Each project is configured from the DM console card
|
|
125
|
+
- PoCo connects to Feishu in long-connection mode, so no public callback URL is required
|
|
126
|
+
|
|
127
|
+
## Usage
|
|
128
|
+
|
|
129
|
+
DM console:
|
|
130
|
+
|
|
131
|
+
- send `poco`
|
|
132
|
+
- use the card UI to create a project, inspect a worker, or remove a worker
|
|
133
|
+
|
|
134
|
+
Project group:
|
|
135
|
+
|
|
136
|
+
- just talk to the agent
|
|
137
|
+
- send one Feishu post message that contains both the image and the text prompt
|
|
138
|
+
- no setup or lifecycle commands are needed in the group
|
|
139
|
+
|
|
140
|
+
## Providers
|
|
141
|
+
|
|
142
|
+
- `codex`: fully implemented through `codex app-server`
|
|
143
|
+
- `claude`: implemented through the Claude Code CLI with streamed JSON output
|
|
144
|
+
|
|
145
|
+
Current provider notes:
|
|
146
|
+
|
|
147
|
+
- Codex is the default runtime path
|
|
148
|
+
- Claude currently supports session attach, image input, and streamed replies
|
|
149
|
+
|
|
150
|
+
## TUI
|
|
151
|
+
|
|
152
|
+
Views:
|
|
153
|
+
|
|
154
|
+
The TUI is a two-panel terminal UI:
|
|
155
|
+
|
|
156
|
+
- left panel: logo and runtime summary
|
|
157
|
+
- right panel: the current menu or interaction view
|
|
158
|
+
- bottom: an input line that is only enabled when a config field needs text input
|
|
159
|
+
|
|
160
|
+
Shortcuts:
|
|
161
|
+
|
|
162
|
+
- `Ctrl+R`: Save and restart
|
|
163
|
+
- `q`: go back one level
|
|
164
|
+
- `Up` / `Down`: move in the main menu or config menu
|
|
165
|
+
- `Enter`: open the selected item
|
|
166
|
+
- `Esc`: go back one level
|
|
167
|
+
|
|
168
|
+
The default home screen is menu-driven:
|
|
169
|
+
|
|
170
|
+
- the right panel shows a menu with `Config`, `Restart`, and `Quit`
|
|
171
|
+
- use `Up` / `Down` to select an item
|
|
172
|
+
- press `Enter` to open it
|
|
173
|
+
|
|
174
|
+
`Config` enters config mode. In that mode:
|
|
175
|
+
|
|
176
|
+
- the right panel turns into a selection menu
|
|
177
|
+
- `Up` / `Down` moves between sections or fields
|
|
178
|
+
- `Enter` opens the current selection
|
|
179
|
+
- `Esc` returns to the previous level
|
|
180
|
+
- `Language` lets you switch between English and Chinese
|
|
181
|
+
- `Bot` contains `feishu` settings such as `App ID` and `App Secret`
|
|
182
|
+
- `Agent & Model` contains `codex` and `claude`
|
|
183
|
+
- `claude` opens a backend menu first
|
|
184
|
+
- choose a backend such as `anthropic`, `minimax`, or a user-added custom backend
|
|
185
|
+
- the backend marked with `(default)` is the current global Claude default
|
|
186
|
+
- then edit that backend's `base_url`, `auth_token`, `model`, and `extra_env`
|
|
187
|
+
- `model` opens another menu; pick a model first, then run `set_as_default`
|
|
188
|
+
- `extra_env` also opens a submenu; manage env entries one by one instead of editing raw JSON
|
|
189
|
+
- `set_as_default` on the backend page marks that backend as the global Claude default
|
|
190
|
+
- `show` opens the current config in a scrollable view
|
|
191
|
+
- the bottom input line is only active while editing a text field
|
|
192
|
+
|
|
193
|
+
## Files
|
|
194
|
+
|
|
195
|
+
- Config: `~/.config/poco/config.json`
|
|
196
|
+
- State: `~/.local/state/poco/`
|
|
197
|
+
|
|
198
|
+
## Development
|
|
199
|
+
|
|
200
|
+
Build packages:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
uv build
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Quick syntax check:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
uv run python -m py_compile poco/__init__.py poco/app.py poco/runtime.py poco/relay/app.py poco/config/store.py poco/tui/app.py
|
|
210
|
+
```
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# PoCo
|
|
2
|
+
|
|
3
|
+
[English](README.md)
|
|
4
|
+
|
|
5
|
+
`PoCo` 是产品名,Python 包名是 `pocket-coding`。
|
|
6
|
+
|
|
7
|
+
PoCo 是一个本地 TUI,用来把不同的 coding-agent provider 接到飞书机器人后面。当前 Codex 已通过 `app-server` 完整接通;Claude Code 也已经通过 CLI 适配接入,支持流式输出、session 发现和 attach。
|
|
8
|
+
|
|
9
|
+
- 和机器人单聊时,把它当作管理控制台
|
|
10
|
+
- 把飞书群当作项目工作区
|
|
11
|
+
- 每个项目群对应一个独立的 provider worker
|
|
12
|
+
- 通过飞书消息创建和编辑,把进度持续回推到群里
|
|
13
|
+
|
|
14
|
+
## 快速开始
|
|
15
|
+
|
|
16
|
+
先安装 PoCo:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install pocket-coding
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
如果你是从源码运行:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install .
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
然后按下面三步来:
|
|
29
|
+
|
|
30
|
+
1. 先创建一个飞书企业自建机器人应用,然后用 PoCo 一键补齐配置。
|
|
31
|
+
|
|
32
|
+
飞书应用本身必须先在开发者后台手动创建。拿到 `App ID` 和
|
|
33
|
+
`App Secret` 之后,运行:
|
|
34
|
+
|
|
35
|
+
在运行 bootstrap 之前,请先打开下面这个授权页,手动开通以下任意一个权限:
|
|
36
|
+
|
|
37
|
+
- `application:application`
|
|
38
|
+
- `admin:app.category:update`
|
|
39
|
+
|
|
40
|
+
授权页:
|
|
41
|
+
|
|
42
|
+
<https://open.feishu.cn/app/cli_a92032ebc97cdbcc/auth?q=application:application,admin:app.category:update&op_from=openapi&token_type=tenant>
|
|
43
|
+
|
|
44
|
+
然后再运行:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
poco feishu-bootstrap
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
PoCo 会把这个应用改写成它需要的状态,包括权限、事件订阅、回调订阅,
|
|
51
|
+
不包括版本自动发布。
|
|
52
|
+
|
|
53
|
+
bootstrap 完成后,请你回到飞书开放平台,手动创建并发布一个新版本。
|
|
54
|
+
PoCo 会在 bootstrap 日志里打印建议使用的下一个语义版本号。
|
|
55
|
+
|
|
56
|
+
2. 确认运行 PoCo 的机器上已经装好并能正常使用 `codex` 或 `claude`
|
|
57
|
+
/ Claude Code。
|
|
58
|
+
|
|
59
|
+
PoCo 不负责帮你安装这些工具。如果它们不存在或者本机不能正常运行,
|
|
60
|
+
请先自己处理好,再继续。
|
|
61
|
+
|
|
62
|
+
3. 启动 PoCo,然后去飞书里和机器人单聊。
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
poco
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
在 DM 里发任意一条消息即可,例如:
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
poco
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
这会打开 DM 控制台卡片。点击 `New Project` 创建一个项目群。
|
|
75
|
+
PoCo 会自动创建名为 `Pocket-Project: <project_id>` 的群,把你和机器人拉进去,
|
|
76
|
+
并启动默认 runtime:
|
|
77
|
+
|
|
78
|
+
- Agent:`codex`
|
|
79
|
+
- Provider:`openai`
|
|
80
|
+
- Model:`gpt-5.4`
|
|
81
|
+
- Reply Mode:`all`
|
|
82
|
+
|
|
83
|
+
如果要给当前 agent 发图片,请用一条飞书图文消息同时发送图片和文字说明。
|
|
84
|
+
|
|
85
|
+
PoCo 还自带一份预定义模型目录。当前 Claude provider 内置了这些模型:
|
|
86
|
+
|
|
87
|
+
- `sonnet`
|
|
88
|
+
- `opus`
|
|
89
|
+
- `haiku`
|
|
90
|
+
- `deepseek-chat`
|
|
91
|
+
- `deepseek-reasoner`
|
|
92
|
+
- `kimi-k2.5`
|
|
93
|
+
- `kimi-k2-0905-preview`
|
|
94
|
+
- `kimi-k2-0711-preview`
|
|
95
|
+
- `kimi-k2-turbo-preview`
|
|
96
|
+
- `kimi-k2-thinking`
|
|
97
|
+
- `kimi-k2-thinking-turbo`
|
|
98
|
+
- `moonshot-v1-8k`
|
|
99
|
+
- `moonshot-v1-32k`
|
|
100
|
+
- `moonshot-v1-128k`
|
|
101
|
+
- `moonshot-v1-8k-vision-preview`
|
|
102
|
+
- `moonshot-v1-32k-vision-preview`
|
|
103
|
+
- `moonshot-v1-128k-vision-preview`
|
|
104
|
+
- `MiniMax-M2.1`
|
|
105
|
+
- `MiniMax-M2.5`
|
|
106
|
+
- `MiniMax-M2.7`
|
|
107
|
+
|
|
108
|
+
当前内置的 Claude backend 包括:
|
|
109
|
+
|
|
110
|
+
- `anthropic`
|
|
111
|
+
- `deepseek`
|
|
112
|
+
- `kimi`
|
|
113
|
+
- `minimax`
|
|
114
|
+
|
|
115
|
+
之后默认就按这条路径用:
|
|
116
|
+
|
|
117
|
+
- 在单聊里发 `poco`
|
|
118
|
+
- 用 DM 控制台卡片做项目创建 / 状态查看 / 删除
|
|
119
|
+
- 在项目群里直接和 agent 聊天
|
|
120
|
+
|
|
121
|
+
## 工作方式
|
|
122
|
+
|
|
123
|
+
- 单聊机器人:管理控制台
|
|
124
|
+
- 群聊机器人:项目工作区
|
|
125
|
+
- 每个项目群会启动一个独立的 worker 进程
|
|
126
|
+
- 每个项目都通过 DM 控制台卡片配置
|
|
127
|
+
- PoCo 使用飞书长连接模式,不需要公网回调地址
|
|
128
|
+
|
|
129
|
+
## 使用方式
|
|
130
|
+
|
|
131
|
+
单聊控制台:
|
|
132
|
+
|
|
133
|
+
- 发 `poco`
|
|
134
|
+
- 用卡片完成新建项目、查看状态、删除项目
|
|
135
|
+
|
|
136
|
+
项目群:
|
|
137
|
+
|
|
138
|
+
- 直接聊天即可
|
|
139
|
+
- 如果要发图片,请发送一条同时包含图片和文字说明的飞书图文消息
|
|
140
|
+
|
|
141
|
+
## Provider
|
|
142
|
+
|
|
143
|
+
- `codex`:已通过 `codex app-server` 完整接通
|
|
144
|
+
- `claude`:已通过 Claude Code CLI 接通,支持流式 JSON 输出
|
|
145
|
+
|
|
146
|
+
当前 provider 能力说明:
|
|
147
|
+
|
|
148
|
+
- Codex 是默认运行路径
|
|
149
|
+
- Claude 当前支持 session attach、图片输入和流式回复
|
|
150
|
+
|
|
151
|
+
## TUI
|
|
152
|
+
|
|
153
|
+
页面:
|
|
154
|
+
|
|
155
|
+
当前 TUI 是一个双栏终端界面:
|
|
156
|
+
|
|
157
|
+
- 左侧:logo 和运行状态摘要
|
|
158
|
+
- 右侧:当前交互面板
|
|
159
|
+
- 底部:一个输入栏,但只有在需要输入配置值时才会启用
|
|
160
|
+
|
|
161
|
+
快捷键:
|
|
162
|
+
|
|
163
|
+
- `Ctrl+R`:保存并重启
|
|
164
|
+
- `q`:返回上一级
|
|
165
|
+
- `↑ / ↓`:在主菜单或 config 菜单中移动
|
|
166
|
+
- `Enter`:进入当前选项
|
|
167
|
+
- `Esc`:返回上一级
|
|
168
|
+
|
|
169
|
+
默认首页是菜单驱动的:
|
|
170
|
+
|
|
171
|
+
- 右侧会显示 `Config`、`Restart`、`Quit`
|
|
172
|
+
- 用 `↑ / ↓` 选择项目
|
|
173
|
+
- 按 `Enter` 进入
|
|
174
|
+
|
|
175
|
+
进入 `Config` 后:
|
|
176
|
+
|
|
177
|
+
- 右侧面板会变成选择菜单
|
|
178
|
+
- `↑ / ↓` 可以切换 section 或字段
|
|
179
|
+
- `Enter` 进入当前项
|
|
180
|
+
- `Esc` 返回上一级
|
|
181
|
+
- `Language` 可以切换英文和中文
|
|
182
|
+
- `Bot` 里包含 `feishu` 相关设置,比如 `App ID`、`App Secret`
|
|
183
|
+
- `Agent & Model` 里包含 `codex` 和 `claude`
|
|
184
|
+
- `claude` 会先进入 backend 菜单
|
|
185
|
+
- 先选一个 backend,例如 `anthropic`、`minimax`,或用户新增的 custom backend
|
|
186
|
+
- 带 `(default)` 标记的就是当前全局默认 Claude backend
|
|
187
|
+
- 再编辑这个 backend 的 `base_url`、`auth_token`、`model`、`extra_env`
|
|
188
|
+
- `model` 会再进入一个模型菜单;先选模型,再执行 `set_as_default`
|
|
189
|
+
- `extra_env` 也会进入子菜单;按项管理环境变量,不再直接编辑原始 JSON
|
|
190
|
+
- backend 页面里的 `set_as_default` 会把当前 backend 设为全局默认 Claude backend
|
|
191
|
+
- `show` 会打开当前配置文件的滚动视图
|
|
192
|
+
- 只有在编辑文本字段时,底部输入栏才会启用
|
|
193
|
+
|
|
194
|
+
## 文件位置
|
|
195
|
+
|
|
196
|
+
- 配置文件:`~/.config/poco/config.json`
|
|
197
|
+
- 状态目录:`~/.local/state/poco/`
|
|
198
|
+
|
|
199
|
+
## 开发
|
|
200
|
+
|
|
201
|
+
构建安装包:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
uv build
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
快速语法检查:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
uv run python -m py_compile poco/__init__.py poco/app.py poco/runtime.py poco/relay/app.py poco/config/store.py poco/tui/app.py
|
|
211
|
+
```
|