@piagent/platform 1.0.1 → 1.1.0
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.
- package/CHANGELOG.md +52 -23
- package/README.md +78 -333
- package/docs/command-reference-vietnamese.md +47 -4
- package/docs/distribution-standard.md +9 -9
- package/docs/herdr-workflow.md +22 -1
- package/docs/mcp-and-tools.md +27 -3
- package/docs/operator-manual-vietnamese.md +16 -12
- package/docs/publishing-for-teams.md +2 -1
- package/docs/quickstart-vietnamese.md +55 -222
- package/docs/release-install-policy.md +54 -10
- package/docs/security-threat-model.md +1 -1
- package/docs/task-lifecycle-vietnamese.md +139 -0
- package/docs/team-onboarding.md +22 -7
- package/docs-site/index.html +43 -65
- package/package.json +7 -5
- package/packages/piagent-core/README.md +2 -1
- package/packages/piagent-core/extensions/document-intake.ts +436 -0
- package/packages/piagent-core/extensions/guard-types.ts +1 -0
- package/packages/piagent-core/extensions/piagent-guard.ts +120 -0
- package/packages/piagent-core/package.json +2 -2
- package/schemas/project-profile.schema.json +8 -0
- package/scripts/check-published-site.mjs +189 -0
- package/scripts/configure-mcp.sh +34 -1
- package/scripts/init-project.sh +19 -0
- package/scripts/install-global.sh +26 -8
- package/scripts/piagent-cli.mjs +1 -0
- package/scripts/setup.sh +14 -0
- package/scripts/team-doctor.sh +1 -1
- package/scripts/uninstall-global.sh +231 -0
- package/scripts/verify-local.sh +131 -72
|
@@ -26,101 +26,29 @@ Support matrix của release hiện tại:
|
|
|
26
26
|
| Native Windows | Chưa phải target rollout team; helper/shell policy cần Bash/POSIX semantics. |
|
|
27
27
|
| WSL2 | Experimental, chưa release-gate. |
|
|
28
28
|
|
|
29
|
-
Node.js phải từ `22.19.0` trở lên
|
|
29
|
+
Node.js phải từ `22.19.0` trở lên. Hai lệnh:
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
npm install -g --ignore-scripts @piagent/platform@1.0.1
|
|
35
|
-
piagent-install --stable --dry-run
|
|
36
|
-
piagent-install --stable
|
|
32
|
+
npm install -g @piagent/platform
|
|
33
|
+
piagent-setup
|
|
37
34
|
```
|
|
38
35
|
|
|
39
|
-
|
|
36
|
+
Chạy `piagent-setup` ngay trong thư mục project. Nó tự cài đúng Pi Coding Agent `0.82.0` mà release này pin, cài Pi package, khởi tạo `.pi/`, rồi chạy doctor. Nó cũng cài MCP baseline, subagents, và Herdr Pi integration nếu `herdr` đã có sẵn trên `PATH`; thêm `--no-mcp`, `--no-subagents`, `--no-herdr` nếu không cần, hoặc `--global-only` nếu chưa muốn đụng project nào.
|
|
40
37
|
|
|
41
|
-
Nếu
|
|
38
|
+
Nếu dùng [Herdr](https://herdr.dev/docs/install/) thì cài Herdr **trước** `piagent-setup`:
|
|
42
39
|
|
|
43
40
|
```bash
|
|
44
|
-
|
|
41
|
+
brew install herdr # macOS
|
|
42
|
+
curl -fsSL https://herdr.dev/install.sh | sh # macOS hoặc Linux
|
|
45
43
|
```
|
|
46
44
|
|
|
47
|
-
|
|
45
|
+
Không có `herdr` trên `PATH` thì bước integration bị bỏ qua kèm cảnh báo, cài Herdr sau phải chạy lại `piagent-setup --global-only`. Bản `curl` chạy script tải về lúc cài; muốn kiểm tra được thì dùng `brew` hoặc tải từ [GitHub releases](https://github.com/ogulcancelik/herdr/releases). Herdr bản stable hỗ trợ macOS và Linux; Windows mới ở mức preview, mà cũng nằm ngoài runtime matrix của platform này.
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
bash scripts/install-global.sh --stable --dry-run
|
|
51
|
-
bash scripts/install-global.sh --stable
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Helper stable sẽ resolve tag release hiện tại thành commit SHA trước khi install, nên user vẫn dùng lệnh ngắn nhưng team nhận source bất biến hơn.
|
|
55
|
-
|
|
56
|
-
Khi update toàn bộ platform, cập nhật exact Pi host trước rồi dùng helper target để cài Pi package tương ứng:
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
|
|
60
|
-
npm install -g --ignore-scripts @piagent/platform@X.Y.Z
|
|
61
|
-
piagent-install --stable --dry-run
|
|
62
|
-
piagent-install --stable
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Rollback toàn bộ dùng cùng flow với `vPREVIOUS`, nhưng phải lấy exact host version từ release policy của target và đánh giá lại dependency risk trước khi hạ host. Nếu chủ ý chỉ đổi Pi package và giữ host/helper hiện tại:
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
piagent-install --version vX.Y.Z --resolve-tag --dry-run
|
|
69
|
-
piagent-install --version vX.Y.Z --resolve-tag
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
Checklist release canonical nằm tại [release-install-policy.md](release-install-policy.md).
|
|
73
|
-
|
|
74
|
-
Máy cá nhân hoặc sandbox có thể dùng latest nếu chấp nhận cập nhật nhanh:
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
bash scripts/install-global.sh --dev --dry-run
|
|
78
|
-
bash scripts/install-global.sh --dev
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
Sau bước này, project mới không cần chạy bash init profile. Chỉ cần:
|
|
47
|
+
Vì chạy từ package đã cài, source ghi vào `.pi/settings.json` là `npm:@piagent/platform@<version>` — portable, commit được.
|
|
82
48
|
|
|
83
|
-
|
|
84
|
-
cd /path/to/project
|
|
85
|
-
pi
|
|
86
|
-
```
|
|
49
|
+
Xong. Từ đây project nào cũng chỉ cần `cd` vào rồi gõ `pi`.
|
|
87
50
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
piagent-auto
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Read-only auto-run:
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
piagent-auto --read-only -p "Scout payment mapping. Do not edit source."
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Trusted full-access style run cho repo đã kiểm soát:
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
piagent-auto --full-access -p "Run the trusted local benchmark suite."
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
Wrapper này không bypass piagent guard; nó wrap `pi --approve` và set permission profile cho lần chạy. Dù dùng `--full-access`, protected paths, redaction, destructive shell checks, task gate, và verify evidence vẫn chạy.
|
|
107
|
-
|
|
108
|
-
Nếu đã ở trong Pi session, dùng slash command cho nhanh:
|
|
109
|
-
|
|
110
|
-
```text
|
|
111
|
-
/permission-status
|
|
112
|
-
/full-access Implement/refactor task trong repo trusted này.
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
`/full-access <task>` chỉ bật full-access cho session hiện tại, không tự ghi `.pi/piagent-profile.json`.
|
|
116
|
-
|
|
117
|
-
Nếu chat box/ảnh chụp trả về local path thay vì attachment ảnh, dán path đó trực tiếp vào prompt:
|
|
118
|
-
|
|
119
|
-
```text
|
|
120
|
-
/scout Check UI issue from screenshot /var/folders/.../screenshot.png
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
Platform sẽ tự attach ảnh và rewrite prompt thành `[image1]` trước khi model xử lý. Hỗ trợ `.png/.jpg/.jpeg/.gif/.webp/.bmp`, tối đa 4 ảnh, 8 MB mỗi ảnh.
|
|
51
|
+
Rollout team pin từng bước, update, rollback, và channel `--dev` cho máy cá nhân: [release-install-policy.md](release-install-policy.md).
|
|
124
52
|
|
|
125
53
|
## Bước 2 — login OAuth OpenAI Codex/ChatGPT hoặc Claude/Anthropic
|
|
126
54
|
|
|
@@ -146,47 +74,9 @@ Sau khi login và chọn model intended cho project understanding:
|
|
|
146
74
|
/memory-policy
|
|
147
75
|
```
|
|
148
76
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
```text
|
|
152
|
-
Ctrl+L # model selector
|
|
153
|
-
Ctrl+P # đổi model trong scope
|
|
154
|
-
Shift+Tab # đổi thinking
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
Nếu muốn xem/re-apply model scope từ terminal: `piagent-models` và `piagent-model-scope --preset full`.
|
|
158
|
-
|
|
159
|
-
Nếu muốn xem/re-apply MCP baseline từ terminal:
|
|
160
|
-
|
|
161
|
-
```bash
|
|
162
|
-
piagent-mcp --preset core --scope global --replace
|
|
163
|
-
piagent-mcp --preset popular --scope global --replace
|
|
164
|
-
piagent-mcp --list
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
Nếu clone repo GitHub và chưa link npm bin, dùng fallback:
|
|
168
|
-
|
|
169
|
-
```bash
|
|
170
|
-
bash /path/to/piagent/scripts/configure-mcp.sh --preset core --scope global --replace
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
Nếu muốn xem/re-apply subagents baseline từ terminal:
|
|
174
|
-
|
|
175
|
-
```bash
|
|
176
|
-
piagent-subagents --preset safe
|
|
177
|
-
# fallback:
|
|
178
|
-
bash /path/to/piagent/scripts/configure-subagents.sh --preset safe
|
|
179
|
-
```
|
|
77
|
+
`Ctrl+L` mở model selector, `Ctrl+P` đổi model trong scope, `Shift+Tab` đổi mức thinking. `piagent-setup` đã config sẵn `enabledModels`, MCP baseline preset `core`, và subagents preset `safe` — muốn xem hoặc đổi thì có [model-options.md](model-options.md), [mcp-and-tools.md](mcp-and-tools.md), [subagents-and-multiagent.md](subagents-and-multiagent.md).
|
|
180
78
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
```bash
|
|
184
|
-
pi install npm:pi-web-access@0.13.0
|
|
185
|
-
# hoặc setup từ đầu:
|
|
186
|
-
bash /path/to/piagent/scripts/setup.sh . --with-web-access
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
Lệnh này yêu cầu model đọc qua project theo phạm vi có kiểm soát, rồi ghi:
|
|
79
|
+
`/onboard-project` yêu cầu model đọc qua project theo phạm vi có kiểm soát, rồi ghi:
|
|
190
80
|
|
|
191
81
|
```text
|
|
192
82
|
.pi/piagent-profile.json
|
|
@@ -214,131 +104,74 @@ Nếu chưa có profile/tech stack, dùng select-style flow để tránh agent t
|
|
|
214
104
|
|
|
215
105
|
## Bước 4 — init thêm project khác
|
|
216
106
|
|
|
217
|
-
|
|
218
|
-
bash /path/to/piagent/scripts/setup.sh /path/to/project \
|
|
219
|
-
--project-only \
|
|
220
|
-
--profile auto \
|
|
221
|
-
--package-source git:github.com/Vt-mmm/piagent@v1.0.1 \
|
|
222
|
-
--mcp-preset core \
|
|
223
|
-
--subagents-preset safe
|
|
224
|
-
```
|
|
107
|
+
Global đã cài rồi nên project sau chỉ cần init:
|
|
225
108
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
/profile list
|
|
230
|
-
/profile setup
|
|
231
|
-
/profile tech setup
|
|
232
|
-
/profile be-readonly-fe
|
|
109
|
+
```bash
|
|
110
|
+
cd /path/to/project
|
|
111
|
+
piagent-setup --project-only
|
|
233
112
|
```
|
|
234
113
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
## Bước 5 — setup split/preseed nếu cần
|
|
114
|
+
Nó ghi `npm:@piagent/platform@<version>` vào `.pi/settings.json` — portable, commit được cho cả team.
|
|
238
115
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
```bash
|
|
242
|
-
bash /path/to/piagent/scripts/setup.sh /path/to/project \
|
|
243
|
-
--profile be-readonly-fe \
|
|
244
|
-
--package-source git:github.com/Vt-mmm/piagent@v1.0.1 \
|
|
245
|
-
--mcp-preset core \
|
|
246
|
-
--subagents-preset safe
|
|
247
|
-
```
|
|
116
|
+
Đổi profile sau này thì gõ `/profile setup` trong Pi. Profile built-in: `generic`, `web-frontend`, `backend-api`, `be-readonly-fe`, `fullstack`, `node-typescript`, `python`, `data`, `devops`, `mobile`, `docs`.
|
|
248
117
|
|
|
249
|
-
## Bước
|
|
118
|
+
## Bước 5 — chạy hằng ngày
|
|
250
119
|
|
|
251
120
|
```bash
|
|
252
|
-
herdr
|
|
253
121
|
cd <project>
|
|
254
122
|
pi
|
|
255
123
|
```
|
|
256
124
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
```text
|
|
260
|
-
/discuss Cải tiến workflow onboarding cho team mới. Chưa implement, chỉ hỏi lại phần còn thiếu và đề xuất plan.
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
Prompt mẫu khi đã rõ task:
|
|
264
|
-
|
|
265
|
-
```text
|
|
266
|
-
/task Implement this request. Use piagent_context, piagent_task_start, piagent_context_budget, piagent_exec_policy_check when shell is needed, piagent_verify_record, piagent_trace_record, and piagent_task_gate_check before done.
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
Prompt mẫu khi chỉ cần scout/read-only:
|
|
270
|
-
|
|
271
|
-
```text
|
|
272
|
-
/scout Scout payment FE mapping vs BE contract. Backend read-only. Do not edit source.
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
Nếu session đang nặng hoặc gặp context overflow:
|
|
276
|
-
|
|
277
|
-
```text
|
|
278
|
-
/fresh-scout Scout payment FE mapping vs BE contract. Backend read-only. Do not edit source.
|
|
279
|
-
/fresh-task Implement <bounded task>.
|
|
280
|
-
/fresh-be-to-fe Implement FE support from <BE contract>. Backend read-only.
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
Không paste full mandatory flow hằng ngày. Từ `v0.3.21`, input guard tự collapse mandatory-flow boilerplate và fresh workflow tự mở session mới khi cần.
|
|
125
|
+
Rồi mô tả việc cần làm bằng tiếng Việt hoặc tiếng Anh. Không cần paste checklist — input guard tự collapse boilerplate, và `/task` tự cân nhắc gọi scout/planner/reviewer khi task đủ lớn.
|
|
284
126
|
|
|
285
|
-
|
|
127
|
+
Muốn chạy nhiều agent song song thì gõ `herdr` thay vì `pi`, rồi mở mỗi pane một vai: implement, review read-only, verify, notes. Herdr chỉ điều phối terminal/session, không phải security boundary — gate vẫn nằm ở Pi extension và OAuth vẫn `/login` trong Pi. Chi tiết: [herdr-workflow.md](herdr-workflow.md).
|
|
286
128
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
129
|
+
| Gõ | Khi nào |
|
|
130
|
+
|---|---|
|
|
131
|
+
| `/discuss <ý tưởng>` | Requirement chưa rõ, muốn hỏi lại trước. |
|
|
132
|
+
| `/task <việc>` | Đã rõ, làm luôn. |
|
|
133
|
+
| `/scout <việc>` | Chỉ đọc, không sửa — map payment/auth/BE contract. |
|
|
134
|
+
| `/plan <mục tiêu>` | Muốn có plan trước khi đụng code. |
|
|
135
|
+
| `/review current diff` | Review việc vừa làm. |
|
|
136
|
+
| `/be-to-fe <việc>` | Backend read-only, làm FE. |
|
|
137
|
+
| `/commit <message>` | Commit local có kiểm soát, không push. |
|
|
138
|
+
| `/pr <title>` | Tạo PR, hỏi xác nhận trước khi push. |
|
|
139
|
+
| `/fresh-task`, `/fresh-scout`, `/fresh-be-to-fe` | Session đang nặng hoặc tràn context. |
|
|
140
|
+
|
|
141
|
+
`/piagent-commands` liệt kê hết. Giải thích từng lệnh: [command-reference-vietnamese.md](command-reference-vietnamese.md). Các workflow ép shape rõ (`/parallel-review`, `/review-loop`, `/parallel-research`, `/parallel-context-build`): [subagents-and-multiagent.md](subagents-and-multiagent.md). Runtime gate tools và cách agent tự dùng chúng: [operator-manual-vietnamese.md](operator-manual-vietnamese.md).
|
|
295
142
|
|
|
296
|
-
|
|
143
|
+
## Việc user vẫn phải làm thủ công
|
|
297
144
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
/run piagent-scout "Map target area read-only before planning."
|
|
305
|
-
/run piagent-reviewer "Review current diff before final handoff."
|
|
306
|
-
```
|
|
145
|
+
- Login OAuth lần đầu trong browser.
|
|
146
|
+
- Chọn provider/model intended cho project.
|
|
147
|
+
- Chạy `/onboard-project` lần đầu để tạo `.pi/project-context.md` và `.pi/context-index.json`.
|
|
148
|
+
- Chạy `/memory-policy` nếu muốn kiểm tra hoặc dùng project memory.
|
|
149
|
+
- Approve project trust nếu Pi hỏi. Sau khi hiểu rõ repo, có thể dùng `piagent-auto` hoặc Pi native `--approve` cho từng lần chạy.
|
|
150
|
+
- Approve khi extension guard hỏi destructive/high-risk action.
|
|
307
151
|
|
|
308
|
-
|
|
152
|
+
Các việc này là credential/trust boundary, không nên automation mù.
|
|
309
153
|
|
|
310
|
-
|
|
311
|
-
Use piagent_source_checkout for github.com/org/repo, inspect only relevant files, then summarize applicable patterns.
|
|
312
|
-
```
|
|
154
|
+
## Gỡ cài đặt
|
|
313
155
|
|
|
314
|
-
|
|
156
|
+
`piagent-uninstall` mặc định là dry run: nó in ra sẽ gỡ những gì rồi thoát, không đụng vào đâu cả. Thêm `--apply` mới thực hiện.
|
|
315
157
|
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
piagent_tool_policy_check # check tool capability
|
|
320
|
-
piagent_task_gate_check # check before final DONE
|
|
158
|
+
```bash
|
|
159
|
+
piagent-uninstall
|
|
160
|
+
piagent-uninstall --apply
|
|
321
161
|
```
|
|
322
162
|
|
|
323
|
-
|
|
163
|
+
Mặc định chỉ gỡ Pi package của platform khỏi Pi settings global. Muốn gỡ rộng hơn:
|
|
324
164
|
|
|
325
165
|
```bash
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
166
|
+
piagent-uninstall --apply --with-addons # + pi-mcp-adapter, pi-subagents, pi-web-access
|
|
167
|
+
piagent-uninstall --apply --with-host # + Pi Coding Agent host
|
|
168
|
+
piagent-uninstall --apply --project /path/to/project # + profile, lock, piagent-state/ của project
|
|
169
|
+
npm uninstall -g @piagent/platform # helper npm-global, gỡ riêng
|
|
330
170
|
```
|
|
331
171
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
- Login OAuth lần đầu trong browser.
|
|
335
|
-
- Chọn provider/model intended cho project.
|
|
336
|
-
- Chạy `/onboard-project` lần đầu để tạo `.pi/project-context.md` và `.pi/context-index.json`.
|
|
337
|
-
- Chạy `/memory-policy` nếu muốn kiểm tra hoặc dùng project memory.
|
|
338
|
-
- Approve project trust nếu Pi hỏi. Sau khi hiểu rõ repo, có thể dùng `piagent-auto` hoặc Pi native `--approve` cho từng lần chạy.
|
|
339
|
-
- Approve khi extension guard hỏi destructive/high-risk action.
|
|
172
|
+
Có những thứ nó **không bao giờ** xoá, kể cả khi bật hết cờ: `auth.json`, `trust.json`, `sessions/`, `todos/`, và `.pi/memory/`. Đó là dữ liệu của anh chứ không phải state của platform. `AGENTS.md`, `.pi/settings.json`, `project-context.md` cũng được giữ vì sinh ra từ template rồi anh sửa tiếp — script liệt kê chúng ra để anh tự quyết.
|
|
340
173
|
|
|
341
|
-
|
|
174
|
+
Với `.pi/settings.json` nó chỉ bỏ đúng entry trỏ tới platform trong `packages`, phần còn lại giữ nguyên.
|
|
342
175
|
|
|
343
176
|
## Tài liệu chính
|
|
344
177
|
|
|
@@ -8,9 +8,9 @@ This file is the canonical install, update, rollback, and release checklist. Oth
|
|
|
8
8
|
|
|
9
9
|
## Supported runtime matrix
|
|
10
10
|
|
|
11
|
-
All supported environments require Node.js `>=22.19.0` and Pi Coding Agent `0.
|
|
11
|
+
All supported environments require Node.js `>=22.19.0` and Pi Coding Agent `0.82.0`. The Pi host is installed as a Node CLI; Pi Agent Platform still defines its own release matrix because the terminal helpers and shell policy rely on Bash/POSIX behavior.
|
|
12
12
|
|
|
13
|
-
| Surface | Status for v1.0
|
|
13
|
+
| Surface | Status for v1.1.0 | Rollout guidance |
|
|
14
14
|
|---|---|---|
|
|
15
15
|
| macOS Apple Silicon (`darwin/arm64`) + Bash | Verified for this release. | Safe default for team rollout after normal project smoke tests. |
|
|
16
16
|
| Linux x64 + Bash | Verified in GitHub Actions. | Safe default for CI/server usage after normal project smoke tests. |
|
|
@@ -33,7 +33,7 @@ These three components are versioned independently. A full install, update, or r
|
|
|
33
33
|
|
|
34
34
|
| Channel | Source shape | Mutability | Use when |
|
|
35
35
|
|---|---|---:|---|
|
|
36
|
-
| `stable` | `git:github.com/Vt-mmm/piagent@<resolved-commit-sha>` from `v1.0
|
|
36
|
+
| `stable` | `git:github.com/Vt-mmm/piagent@<resolved-commit-sha>` from `v1.1.0` | Fixed after resolution | Default for team rollout. |
|
|
37
37
|
| `exact` | Tag, reviewed commit, or a tag resolved with `--resolve-tag` | Fixed when using a commit SHA | Pi-package-only roll forward, rollback, or reproduction. |
|
|
38
38
|
| `dev` | `git:github.com/Vt-mmm/piagent` | Moving | Personal machine or sandbox only. |
|
|
39
39
|
| `local` | `/path/to/piagent` | Local workspace | Platform development and dry-run validation. |
|
|
@@ -52,8 +52,8 @@ Use this flow when the team needs both terminal commands and the Pi package:
|
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
54
|
node --version # >= 22.19.0
|
|
55
|
-
npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.
|
|
56
|
-
npm install -g --ignore-scripts @piagent/platform@1.0
|
|
55
|
+
npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.82.0
|
|
56
|
+
npm install -g --ignore-scripts @piagent/platform@1.1.0
|
|
57
57
|
piagent-install --stable --dry-run
|
|
58
58
|
piagent-install --stable
|
|
59
59
|
```
|
|
@@ -61,8 +61,8 @@ piagent-install --stable
|
|
|
61
61
|
The stable preview and apply output includes:
|
|
62
62
|
|
|
63
63
|
```text
|
|
64
|
-
currentRelease: v1.0
|
|
65
|
-
tag: v1.0
|
|
64
|
+
currentRelease: v1.1.0 (helper package version)
|
|
65
|
+
tag: v1.1.0
|
|
66
66
|
resolvedCommit: <40-char-sha>
|
|
67
67
|
source: git:github.com/Vt-mmm/piagent@<40-char-sha>
|
|
68
68
|
```
|
|
@@ -79,7 +79,7 @@ bash scripts/install-global.sh --stable
|
|
|
79
79
|
Use this only when terminal commands are not needed:
|
|
80
80
|
|
|
81
81
|
```bash
|
|
82
|
-
pi install git:github.com/Vt-mmm/piagent@v1.0
|
|
82
|
+
pi install git:github.com/Vt-mmm/piagent@v1.1.0
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
Direct `pi install` does not create `piagent-*` commands on `PATH`.
|
|
@@ -89,7 +89,7 @@ Direct `pi install` does not create `piagent-*` commands on `PATH`.
|
|
|
89
89
|
Update the exact supported Pi host first, then the npm-global helper, then let that target helper resolve and install its matching stable Pi package:
|
|
90
90
|
|
|
91
91
|
```bash
|
|
92
|
-
npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.
|
|
92
|
+
npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.82.0
|
|
93
93
|
npm install -g --ignore-scripts @piagent/platform@X.Y.Z
|
|
94
94
|
piagent-install --stable --dry-run
|
|
95
95
|
piagent-install --stable
|
|
@@ -141,6 +141,44 @@ piagent-install --version vPREVIOUS --resolve-tag
|
|
|
141
141
|
piagent-doctor /path/to/project --strict-share
|
|
142
142
|
```
|
|
143
143
|
|
|
144
|
+
## Uninstall
|
|
145
|
+
|
|
146
|
+
Rollback moves between releases. Uninstall leaves entirely, and it is the flow a team member or an external user reaches for when this platform is no longer wanted on their machine.
|
|
147
|
+
|
|
148
|
+
`piagent-uninstall` reports and exits; `--apply` performs the removal. The default is a report because the command edits Pi's global settings, which other tools also write to.
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
piagent-uninstall
|
|
152
|
+
piagent-uninstall --apply
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Each additional layer is opt-in, so leaving the platform never takes the Pi host or a project's history with it by surprise:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
piagent-uninstall --apply --with-addons # pi-mcp-adapter, pi-subagents, pi-web-access
|
|
159
|
+
piagent-uninstall --apply --with-host # the exact Pi Coding Agent host
|
|
160
|
+
piagent-uninstall --apply --project /path/to/project # a project's profile, lock, and runtime state
|
|
161
|
+
npm uninstall -g @piagent/platform # the npm-global helper, removed separately
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Removal reads the package entries registered in Pi's settings rather than assuming what the running version installs. A machine that first installed the platform before the namespace rename still has that older entry removed.
|
|
165
|
+
|
|
166
|
+
### What uninstall will not remove
|
|
167
|
+
|
|
168
|
+
These are operator data, not platform state, and no flag combination deletes them:
|
|
169
|
+
|
|
170
|
+
| Kept | Why |
|
|
171
|
+
|---|---|
|
|
172
|
+
| `.pi/auth.json`, `.pi/trust.json` | Credentials and trust decisions. Re-earning them is not a cleanup step. |
|
|
173
|
+
| `.pi/sessions/`, `.pi/todos/` | Work history that predates and outlives the platform. |
|
|
174
|
+
| `.pi/memory/` | Accumulated project memory. Deleting it destroys work the platform only stored. |
|
|
175
|
+
|
|
176
|
+
Files written from a template and then edited in place — `AGENTS.md`, `REVIEW_GUIDELINES.md`, `.mcp.json`, `.pi/settings.json`, `.pi/mcp.json`, `.pi/project-context.md`, `.pi/context-index.json`, `.pi/tech-stack.json` — are listed rather than deleted, because by the time uninstall runs they hold project content rather than template content.
|
|
177
|
+
|
|
178
|
+
`.pi/settings.json` is Pi's file, not this platform's. Uninstall drops only the `packages` entry pointing here and leaves every other setting untouched.
|
|
179
|
+
|
|
180
|
+
The global MCP baseline at `$PI_CODING_AGENT_DIR/mcp.json` and the subagent config beside it are shared files that may have been edited after install. `--with-addons` reports their paths instead of resetting them.
|
|
181
|
+
|
|
144
182
|
## Canonical release checklist
|
|
145
183
|
|
|
146
184
|
Production docs must never advertise a tag that cannot yet be installed.
|
|
@@ -226,7 +264,13 @@ Re-running the workflow from a branch instead skips publishing, because the publ
|
|
|
226
264
|
```
|
|
227
265
|
|
|
228
266
|
The open release pull request should then resolve against the same commit history. This bypass exists only to reconcile reviewed PR checks with tag-first Vercel promotion; it must never be used for an unreviewed commit or a force-push. If Vercel auto-deploys `main`, this exact fast-forward is the production promotion. For an explicit CLI deploy instead, check out the exact tag, run `vercel link --cwd docs-site --project pi-agent`, require `npm run vercel:preflight` to pass, then deploy with `vercel --cwd docs-site --prod`.
|
|
229
|
-
8. Verify the live docs
|
|
267
|
+
8. Verify the live docs site at every address it resolves to, then read the page for links and install commands.
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
npm run site:check
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Opening the site in a browser does not answer this. The domain has several address records, so one can be dead or looping while every manual look lands on a healthy one. This resolves both hosts, asks each address directly with the right `Host` header and SNI, and requires each to return the released version. A redirect from an address back to its own host is reported as a loop rather than followed. An address the machine has no route to is reported as unverified, not as a pass.
|
|
230
274
|
9. Publish the already-reviewed draft only after production verification passes:
|
|
231
275
|
|
|
232
276
|
```bash
|
|
@@ -21,7 +21,7 @@ This document covers the packaged guard, project profiles, capability locks, ins
|
|
|
21
21
|
- The operator, operating-system account, Pi host, and explicitly trusted project repository are trusted to execute code.
|
|
22
22
|
- Project-local Pi resources are loaded only after Pi project trust or an explicit operator override.
|
|
23
23
|
- A human remains available to approve destructive and external-provider actions.
|
|
24
|
-
- Supported release verification covers macOS Apple Silicon + Bash, Linux x64 + Bash, Node.js `>=22.19.0`, and the exact Pi host version declared by the release. macOS Intel + Bash and Linux ARM64 + Bash are supported targets that need local smoke verification before broad rollout. Native Windows is not a team-rollout target for v1.0
|
|
24
|
+
- Supported release verification covers macOS Apple Silicon + Bash, Linux x64 + Bash, Node.js `>=22.19.0`, and the exact Pi host version declared by the release. macOS Intel + Bash and Linux ARM64 + Bash are supported targets that need local smoke verification before broad rollout. Native Windows is not a team-rollout target for v1.1.0, and WSL2 is experimental/unverified.
|
|
25
25
|
- Registry, GitHub, model-provider, MCP-provider, and Vercel controls are external dependencies. Their account security and platform guarantees are not replaced by this repository.
|
|
26
26
|
|
|
27
27
|
## Threat actors and failure modes
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Vòng đời một task: research → plan → execute → verify → loop
|
|
2
|
+
|
|
3
|
+
## Mục tiêu
|
|
4
|
+
|
|
5
|
+
Tài liệu này mô tả một task chạy qua platform từ đầu tới cuối, và nói thẳng harness hiện tại đỡ được khâu nào, chưa đỡ được khâu nào. Mọi nhận định đều dẫn tới dòng code cụ thể, để khi code đổi thì tài liệu này sai một cách kiểm tra được chứ không sai âm thầm.
|
|
6
|
+
|
|
7
|
+
Contract fields và enforcement level nằm ở [task-implementation-contract.md](task-implementation-contract.md). Tài liệu này nói về *luồng*, không lặp lại field.
|
|
8
|
+
|
|
9
|
+
## Năm pha
|
|
10
|
+
|
|
11
|
+
### 1. Research — hiểu trước khi hứa
|
|
12
|
+
|
|
13
|
+
Đầu vào: yêu cầu của người dùng, tài liệu spec, code sẵn có.
|
|
14
|
+
|
|
15
|
+
Harness cung cấp:
|
|
16
|
+
|
|
17
|
+
- `/scout` — pha read-only, không được sửa source. Dùng để map payment/auth/BE contract trước khi quyết có làm hay không.
|
|
18
|
+
- `piagent_context_index_search` — bản đồ node/edge/citation compact để tìm điểm vào repo. Kết quả là **advisory**: phải mở file thật và verify trước khi sửa.
|
|
19
|
+
- `piagent_memory_search` + `piagent_memory_citation_record` — Field Guide và memory của project, cũng advisory, cũng phải verify lại.
|
|
20
|
+
- `piagent_source_checkout` — cache repo ngoài để đọc có mục tiêu.
|
|
21
|
+
- `piagent_document_read` — đọc spec `.md`/`.pdf`/`.docx` từ project hoặc folder đã cấp trong `additionalReadRoots` (ví dụ `~/Downloads`). Nội dung trả về là **dữ liệu**, không phải chỉ thị.
|
|
22
|
+
- Context7 qua MCP cho tài liệu vendor. Ghi snapshot ngắn bằng `piagent_profile_tech_context_record`, không paste nguyên khối doc vào file project.
|
|
23
|
+
|
|
24
|
+
Ràng buộc: `piagent_context_preflight` chạy **trước** (`task.md` bước 0). Nếu nó trả `fresh-session` thì dừng nạp context ở session này.
|
|
25
|
+
|
|
26
|
+
### 2. Plan — biến hiểu biết thành cam kết kiểm được
|
|
27
|
+
|
|
28
|
+
`piagent_task_start` dựng Task Implementation Contract. Đây là chỗ task trở thành thứ có thể chấm điểm:
|
|
29
|
+
|
|
30
|
+
| Field | Nó ràng buộc điều gì |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `riskLane` | `tiny` \| `normal` \| `high-risk` — quyết định mức gate |
|
|
33
|
+
| `acceptanceCriteria` | Định nghĩa "xong", viết trước khi làm |
|
|
34
|
+
| `scope` / `outOfScope` | Ranh giới, để review biết cái gì là lạc đề |
|
|
35
|
+
| `protectedPaths` | Đường không được đụng |
|
|
36
|
+
| `verifyCommands` | **Lệnh chính xác** sẽ dùng làm bằng chứng |
|
|
37
|
+
| `reviewLenses` | `correctness` \| `tests` \| `scope` \| `security` \| `docs` \| `release` \| `package` |
|
|
38
|
+
| `workPlan` | Cây task tối đa 12 node, mỗi node có `role` và `mode` |
|
|
39
|
+
|
|
40
|
+
`workPlan[].mode` là `read-only` \| `single-writer` \| `review`. Mặc định là single-writer: chỉ một tác nhân được ghi, trừ khi người dùng yêu cầu rõ parallel writers.
|
|
41
|
+
|
|
42
|
+
`piagent_orchestration_policy` quyết định có gọi subagent không. Chính sách là solo-first — subagent chỉ dùng khi việc đó độc lập và nặng phần đọc.
|
|
43
|
+
|
|
44
|
+
### 3. Execute — làm trong hàng rào
|
|
45
|
+
|
|
46
|
+
Trong lúc làm, guard chặn trước khi thực thi, không phải sau:
|
|
47
|
+
|
|
48
|
+
- Protected path: chặn ở `read`, `write`, `edit`, `grep`, `find`, `ls`, tool MCP, và cả đường vòng qua shell.
|
|
49
|
+
- `piagent_exec_policy_check` — bắt buộc trước lệnh shell vượt quá read/list/test.
|
|
50
|
+
- `piagent_tool_policy_check` — bắt buộc trước tool MCP/app ngoài piagent.
|
|
51
|
+
- `piagent_context_budget` — kiểm trước khi nạp file lớn hoặc lạ.
|
|
52
|
+
- `piagent_context_record` — ghi lại đọc file nào, vì lý do gì.
|
|
53
|
+
|
|
54
|
+
### 4. Verify — chỗ mạnh nhất của harness
|
|
55
|
+
|
|
56
|
+
Đây là phần được thiết kế kỹ nhất, và đáng để hiểu chính xác.
|
|
57
|
+
|
|
58
|
+
Bằng chứng verify **không phải** thứ agent tự khai. Guard nghe `tool_result` của Pi và ghi vào sổ `.pi/piagent-state/observed-bash.jsonl` ([`piagent-guard.ts:1378`](../packages/piagent-core/extensions/piagent-guard.ts)). `piagent_verify_record` chỉ nhận bằng chứng khớp được với một quan sát thật, sau thời điểm task bắt đầu.
|
|
59
|
+
|
|
60
|
+
`evaluateTaskGate` ([`piagent-guard.ts:3125`](../packages/piagent-core/extensions/piagent-guard.ts)) đòi ba điều kiện cộng dồn để một bằng chứng được tính là **pass**:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
evidence.exitCode === 0
|
|
64
|
+
&& evidence.observed === true // đã quan sát được, không phải khai báo
|
|
65
|
+
&& evidence.matchedProfileCommand === true // khớp đúng verifyCommands của task
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Thiếu bất kỳ điều nào thì bằng chứng vẫn được ghi, nhưng chỉ ở mức advisory và gate không tính. Cụ thể:
|
|
69
|
+
|
|
70
|
+
- `observed !== true` → cảnh báo "Unobserved verify evidence is ignored by the passing verify gate."
|
|
71
|
+
- `observed === true` nhưng lệnh không khớp `verifyCommands` → "advisory only".
|
|
72
|
+
|
|
73
|
+
Nghĩa là `true`, `echo ok`, `npm test || true` không mua được chữ "done". Đó là chủ ý: một cổng có thể lách được thì tệ hơn không có cổng, vì nó vẫn hiện màu xanh.
|
|
74
|
+
|
|
75
|
+
`piagent_task_gate_check` trả `pass` hoặc `fail` kèm danh sách `missing`. `task.md` bước 16: gate fail thì outcome là `blocked`/`partial`, **không phải** `done`.
|
|
76
|
+
|
|
77
|
+
### 5. Fail → loop lại
|
|
78
|
+
|
|
79
|
+
Đây là chỗ đứt. Xem mục [Chỗ đứt, nói chính xác](#chỗ-đứt-nói-chính-xác).
|
|
80
|
+
|
|
81
|
+
## Pi hiện tại xử lý tới đâu
|
|
82
|
+
|
|
83
|
+
| Pha | Trạng thái | Căn cứ |
|
|
84
|
+
|---|---|---|
|
|
85
|
+
| Research | **Đủ** | `/scout`, context index, memory, Context7, source checkout |
|
|
86
|
+
| Plan | **Đủ** | `piagent_task_start` + 19 field contract + `workPlan` |
|
|
87
|
+
| Execute | **Đủ** | Chặn trước thực thi ở mọi đường: tool, MCP, shell |
|
|
88
|
+
| Verify | **Mạnh** | Bằng chứng phải quan sát được và khớp lệnh, không tự khai được |
|
|
89
|
+
| Fail → loop | **Nửa vời** | Phát hiện được, từ chối nhận done được, nhưng không mang được state qua lần sau |
|
|
90
|
+
|
|
91
|
+
### Chỗ đứt, nói chính xác
|
|
92
|
+
|
|
93
|
+
Harness **phát hiện** thất bại tốt:
|
|
94
|
+
|
|
95
|
+
- `trace.outcome` có `failed`, `blocked`, `partial` bên cạnh `completed`.
|
|
96
|
+
- `task.md` bước 18: verify không chạy được thì dừng và báo blocker chính xác, không được gọi là done.
|
|
97
|
+
- Gate trả `missing` liệt kê đúng thứ còn thiếu.
|
|
98
|
+
|
|
99
|
+
Nhưng nó **không mang được gì sang lần thử sau**:
|
|
100
|
+
|
|
101
|
+
1. **Contract không có bộ đếm lần thử.** Không có `attempt`, không có `previousAttempts`. Lần thử thứ hai bắt đầu như thể chưa từng có lần một.
|
|
102
|
+
2. **`workPlan[].status` không có giá trị `failed`.** Enum chỉ là `pending` \| `in-progress` \| `done` \| `skipped` ([`schemas/task-contract.schema.json`](../schemas/task-contract.schema.json)). Một node đã thử và hỏng chỉ có thể ghi là `skipped` — mất nghĩa.
|
|
103
|
+
3. **Không có chỗ ghi giả thuyết đã loại.** Verify fail vì lý do gì, đã thử cách nào, tại sao không được — không field nào giữ. Lần sau agent rất dễ thử lại đúng cách đã hỏng.
|
|
104
|
+
4. **Không có trần số vòng.** Không có gì chặn loop vô hạn ngoài sự kiên nhẫn của người dùng.
|
|
105
|
+
|
|
106
|
+
`/review-loop` có tồn tại và đúng là loop, nhưng nó đến từ add-on `pi-subagents` chứ không phải platform này, và nó lặp vòng review→fix, không phải vòng research→plan→execute→verify.
|
|
107
|
+
|
|
108
|
+
### Đề xuất để khép vòng
|
|
109
|
+
|
|
110
|
+
Thêm vào contract, không đổi thứ đang có:
|
|
111
|
+
|
|
112
|
+
```jsonc
|
|
113
|
+
{
|
|
114
|
+
"attempt": 2, // lần thử hiện tại
|
|
115
|
+
"maxAttempts": 3, // trần, gate fail cứng khi vượt
|
|
116
|
+
"previousAttempts": [
|
|
117
|
+
{
|
|
118
|
+
"attempt": 1,
|
|
119
|
+
"failedAt": "verify", // research | plan | execute | verify
|
|
120
|
+
"reason": "npm test — 3 test đỏ ở auth/session",
|
|
121
|
+
"ruledOut": "Không phải do token expiry; đã kiểm bằng fixture cố định giờ."
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Và mở `workPlan[].status` thêm giá trị `failed`.
|
|
128
|
+
|
|
129
|
+
Chi phí: một field mảng trong schema, một nhánh trong `evaluateTaskGate`, một bước trong `task.md`. Đổi lại, lần thử thứ hai đọc được lần thứ nhất đã loại trừ gì — đó là toàn bộ giá trị của việc loop thay vì làm lại.
|
|
130
|
+
|
|
131
|
+
Đây là đề xuất, chưa implement. Cần chốt trước khi làm.
|
|
132
|
+
|
|
133
|
+
## Liên quan
|
|
134
|
+
|
|
135
|
+
- [task-implementation-contract.md](task-implementation-contract.md) — field và enforcement level
|
|
136
|
+
- [workflow-recipes.md](workflow-recipes.md) — công thức cho từng loại việc
|
|
137
|
+
- [runtime-policy-design.md](runtime-policy-design.md) — thiết kế lớp policy
|
|
138
|
+
- [security-threat-model.md](security-threat-model.md) — giả định, vector, và rủi ro còn lại
|
|
139
|
+
- [command-reference-vietnamese.md](command-reference-vietnamese.md) — giải thích từng lệnh
|