@piagent/platform 1.2.10 → 1.2.12
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 +174 -0
- package/README.md +29 -4
- package/adapters/backend-api/profile.json +1 -1
- package/adapters/be-readonly-fe/profile.json +2 -2
- package/adapters/data/profile.json +1 -1
- package/adapters/devops/profile.json +1 -3
- package/adapters/docs/profile.json +1 -1
- package/adapters/fullstack/profile.json +2 -4
- package/adapters/generic/profile.json +1 -1
- package/adapters/mobile/profile.json +1 -2
- package/adapters/node-typescript/profile.json +1 -3
- package/benchmarks/core-v1/suite.json +51 -0
- package/benchmarks/core-v1/tasks/discount-order/grade.mjs +17 -0
- package/benchmarks/core-v1/tasks/discount-order/project/package.json +8 -0
- package/benchmarks/core-v1/tasks/discount-order/project/src/discount.js +3 -0
- package/benchmarks/core-v1/tasks/discount-order/project/src/order.js +6 -0
- package/benchmarks/core-v1/tasks/discount-order/project/test/order.test.js +7 -0
- package/benchmarks/core-v1/tasks/discount-order/prompt.md +4 -0
- package/benchmarks/core-v1/tasks/invoice-quantity/grade.mjs +17 -0
- package/benchmarks/core-v1/tasks/invoice-quantity/project/package.json +8 -0
- package/benchmarks/core-v1/tasks/invoice-quantity/project/src/invoice.js +3 -0
- package/benchmarks/core-v1/tasks/invoice-quantity/project/test/invoice.test.js +7 -0
- package/benchmarks/core-v1/tasks/invoice-quantity/prompt.md +3 -0
- package/benchmarks/core-v1/tasks/protected-env-refusal/grade.mjs +11 -0
- package/benchmarks/core-v1/tasks/protected-env-refusal/project/README.md +4 -0
- package/benchmarks/core-v1/tasks/protected-env-refusal/project/package.json +8 -0
- package/benchmarks/core-v1/tasks/protected-env-refusal/project/test/smoke.test.js +4 -0
- package/benchmarks/core-v1/tasks/protected-env-refusal/prompt.md +4 -0
- package/benchmarks/core-v1/tasks/targeted-session/grade.mjs +14 -0
- package/benchmarks/core-v1/tasks/targeted-session/project/package.json +8 -0
- package/benchmarks/core-v1/tasks/targeted-session/project/src/auth/session.js +3 -0
- package/benchmarks/core-v1/tasks/targeted-session/project/src/billing/currency.js +3 -0
- package/benchmarks/core-v1/tasks/targeted-session/project/src/catalog/search.js +3 -0
- package/benchmarks/core-v1/tasks/targeted-session/project/src/notifications/channel.js +3 -0
- package/benchmarks/core-v1/tasks/targeted-session/project/src/search/tokenize.js +3 -0
- package/benchmarks/core-v1/tasks/targeted-session/project/test/session.test.js +7 -0
- package/benchmarks/core-v1/tasks/targeted-session/prompt.md +4 -0
- package/benchmarks/production-v1/grade.mjs +220 -0
- package/benchmarks/production-v1/project/README.md +7 -0
- package/benchmarks/production-v1/project/config/service.json +4 -0
- package/benchmarks/production-v1/project/data/audit-ledger.jsonl +1 -0
- package/benchmarks/production-v1/project/docs/ops.md +3 -0
- package/benchmarks/production-v1/project/logs/incident.log +2 -0
- package/benchmarks/production-v1/project/package.json +11 -0
- package/benchmarks/production-v1/project/scripts/check.mjs +21 -0
- package/benchmarks/production-v1/project/src/backend/auth.js +3 -0
- package/benchmarks/production-v1/project/src/backend/cache.js +15 -0
- package/benchmarks/production-v1/project/src/backend/invoice.js +4 -0
- package/benchmarks/production-v1/project/src/data/csv.js +3 -0
- package/benchmarks/production-v1/project/src/data/dedup.js +5 -0
- package/benchmarks/production-v1/project/src/data/migration.js +9 -0
- package/benchmarks/production-v1/project/src/frontend/pagination.js +8 -0
- package/benchmarks/production-v1/project/src/frontend/search-state.js +8 -0
- package/benchmarks/production-v1/project/src/frontend/unicode-search.js +7 -0
- package/benchmarks/production-v1/project/src/platform/args.js +10 -0
- package/benchmarks/production-v1/project/src/platform/config.js +7 -0
- package/benchmarks/production-v1/project/src/platform/workspace.js +13 -0
- package/benchmarks/production-v1/project/src/reliability/expiry.js +5 -0
- package/benchmarks/production-v1/project/src/reliability/retry.js +15 -0
- package/benchmarks/production-v1/project/test/smoke.test.js +12 -0
- package/benchmarks/production-v1/project/vendor/README.md +1 -0
- package/benchmarks/production-v1/prompts/bounded-retry.md +7 -0
- package/benchmarks/production-v1/prompts/cli-double-dash.md +7 -0
- package/benchmarks/production-v1/prompts/config-precedence.md +6 -0
- package/benchmarks/production-v1/prompts/destructive-history-refusal.md +3 -0
- package/benchmarks/production-v1/prompts/expiry-boundary.md +7 -0
- package/benchmarks/production-v1/prompts/incident-diagnosis.md +4 -0
- package/benchmarks/production-v1/prompts/invoice-rounding.md +9 -0
- package/benchmarks/production-v1/prompts/pagination-boundary.md +7 -0
- package/benchmarks/production-v1/prompts/protected-env-refusal.md +2 -0
- package/benchmarks/production-v1/prompts/quoted-csv.md +6 -0
- package/benchmarks/production-v1/prompts/repository-prompt-injection.md +5 -0
- package/benchmarks/production-v1/prompts/schema-migration.md +6 -0
- package/benchmarks/production-v1/prompts/stable-dedup.md +6 -0
- package/benchmarks/production-v1/prompts/stale-search-response.md +6 -0
- package/benchmarks/production-v1/prompts/tenant-cache-isolation.md +6 -0
- package/benchmarks/production-v1/prompts/tenant-role-authorization.md +6 -0
- package/benchmarks/production-v1/prompts/unicode-search.md +6 -0
- package/benchmarks/production-v1/prompts/workspace-order.md +7 -0
- package/benchmarks/production-v1/suite.json +284 -0
- package/benchmarks/production-v1/variant.mjs +112 -0
- package/catalog/capabilities.json +10 -10
- package/docs/command-reference-vietnamese.md +19 -6
- package/docs/context-engine.md +33 -11
- package/docs/distribution-standard.md +11 -8
- package/docs/mcp-and-tools.md +13 -7
- package/docs/model-options.md +7 -10
- package/docs/operator-manual-vietnamese.md +98 -33
- package/docs/package-architecture-notes.md +3 -1
- package/docs/publishing-for-teams.md +4 -0
- package/docs/quality-benchmark.md +336 -58
- package/docs/quickstart-vietnamese.md +5 -0
- package/docs/release-install-policy.md +45 -7
- package/docs/runtime-harness-standard.md +47 -29
- package/docs/runtime-policy-design.md +24 -12
- package/docs/runtime-quality-baseline.md +42 -17
- package/docs/security-threat-model.md +1 -1
- package/docs/task-implementation-contract.md +113 -177
- package/docs/task-lifecycle-vietnamese.md +129 -125
- package/docs/team-onboarding.md +12 -4
- package/docs/usage-observability.md +15 -8
- package/docs-site/architecture.html +1 -1
- package/docs-site/commands.html +1 -1
- package/docs-site/content/runtime.html +16 -0
- package/docs-site/context-engine.html +1 -1
- package/docs-site/index.html +1 -1
- package/docs-site/mcp-approval.html +1 -1
- package/docs-site/mcp-auth.html +1 -1
- package/docs-site/mcp-servers.html +1 -1
- package/docs-site/mcp.html +1 -1
- package/docs-site/permissions.html +1 -1
- package/docs-site/profiles.html +1 -1
- package/docs-site/quickstart.html +1 -1
- package/docs-site/runtime.html +17 -1
- package/docs-site/scope.html +1 -1
- package/docs-site/security.html +1 -1
- package/docs-site/team.html +1 -1
- package/docs-site/workflows.html +1 -1
- package/evals/fixtures/task-contract.invalid.json +15 -1
- package/evals/fixtures/task-contract.valid.json +18 -2
- package/package.json +3 -2
- package/packages/piagent-core/README.md +37 -3
- package/packages/piagent-core/benchmark/benchmark-core.js +975 -0
- package/packages/piagent-core/extensions/context-engine.js +81 -57
- package/packages/piagent-core/extensions/guard-types.ts +35 -3
- package/packages/piagent-core/extensions/local-state-path.js +59 -0
- package/packages/piagent-core/extensions/piagent-guard.ts +1904 -175
- package/packages/piagent-core/extensions/policy-core.js +11 -1
- package/packages/piagent-core/extensions/runtime-evidence.js +39 -19
- package/packages/piagent-core/extensions/state-retention.js +218 -0
- package/packages/piagent-core/extensions/task-lifecycle.js +138 -0
- package/packages/piagent-core/extensions/task-state.js +630 -0
- package/packages/piagent-core/package.json +1 -1
- package/packages/piagent-core/policies/base-policy.json +1 -0
- package/packages/piagent-core/prompts/be-to-fe.md +14 -22
- package/packages/piagent-core/prompts/platform-improve.md +12 -17
- package/packages/piagent-core/prompts/review.md +7 -11
- package/packages/piagent-core/prompts/scout.md +6 -10
- package/packages/piagent-core/prompts/task.md +11 -17
- package/packages/piagent-core/skills/piagent-ops/SKILL.md +12 -15
- package/schemas/task-contract.schema.json +267 -104
- package/scripts/benchmark-runner.mjs +1432 -0
- package/scripts/install-global.sh +1 -1
- package/scripts/migrate-project-state.mjs +94 -3
- package/scripts/piagent-cli.mjs +1 -1
- package/scripts/update-global.mjs +36 -3
- package/scripts/verify-local.sh +19 -0
- package/templates/project/.pi/task-contract.template.json +19 -2
- package/templates/project/AGENTS.md +10 -20
|
@@ -14,9 +14,9 @@ Repo này phải chạy được cho nhiều project/domain khác nhau. Vì vậ
|
|
|
14
14
|
|
|
15
15
|
| Use case | Package source |
|
|
16
16
|
|---|---|
|
|
17
|
-
| Team pinned release | `git:github.com/Vt-mmm/piagent@v1.2.
|
|
17
|
+
| Team pinned release | `git:github.com/Vt-mmm/piagent@v1.2.12` |
|
|
18
18
|
| Personal/sandbox dev | `git:github.com/Vt-mmm/piagent` |
|
|
19
|
-
| Registry distribution | `npm:@piagent/platform@1.2.
|
|
19
|
+
| Registry distribution | `npm:@piagent/platform@1.2.12` |
|
|
20
20
|
| Enterprise npm (fork under another scope) | `npm:@your-scope/platform@x.y.z` |
|
|
21
21
|
| Local platform dev | `/path/to/piagent` |
|
|
22
22
|
|
|
@@ -26,7 +26,7 @@ Latest tiện cho máy cá nhân muốn nhận cập nhật nhanh. Pin tag/commi
|
|
|
26
26
|
|
|
27
27
|
| Channel | Command | Target | Policy |
|
|
28
28
|
|---|---|---|---|
|
|
29
|
-
| `stable` | `bash scripts/install-global.sh --stable` | Helper release tag resolved to commit SHA, currently `v1.2.
|
|
29
|
+
| `stable` | `bash scripts/install-global.sh --stable` | Helper release tag resolved to commit SHA, currently `v1.2.12` | Install the Pi package matching the helper. |
|
|
30
30
|
| `exact` | `bash scripts/install-global.sh --version vX.Y.Z --resolve-tag` | Requested tag resolved to commit SHA | Pi-package-only rollout, rollback, and incident recovery. |
|
|
31
31
|
| `dev` | `bash scripts/install-global.sh --dev` | Moving Git source | Personal/sandbox only; do not commit into project settings. |
|
|
32
32
|
| `local` | `bash scripts/install-global.sh --local` | Current checkout path | Platform development only. |
|
|
@@ -53,7 +53,7 @@ Root `package.json` có `pi` manifest trỏ tới:
|
|
|
53
53
|
Do đó team có thể:
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
|
-
pi install git:github.com/Vt-mmm/piagent@v1.2.
|
|
56
|
+
pi install git:github.com/Vt-mmm/piagent@v1.2.12
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
Không cần biết internal folder `packages/piagent-core`. Source không pin chỉ dành cho personal/sandbox như bảng channel ở trên.
|
|
@@ -65,12 +65,12 @@ Team nên install global package một lần:
|
|
|
65
65
|
```bash
|
|
66
66
|
node --version # >= 22.19.0
|
|
67
67
|
npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.82.0
|
|
68
|
-
npm install -g --ignore-scripts @piagent/platform@1.2.
|
|
68
|
+
npm install -g --ignore-scripts @piagent/platform@1.2.12
|
|
69
69
|
piagent-install --stable --dry-run
|
|
70
70
|
piagent-install --stable
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
`pi install git:github.com/Vt-mmm/piagent@v1.2.
|
|
73
|
+
`pi install git:github.com/Vt-mmm/piagent@v1.2.12` vẫn hợp lệ nếu chỉ cần cài Pi package. Lệnh đó không tự tạo các binary terminal `piagent-*`; muốn có helper global thì dùng `npm install -g --ignore-scripts @piagent/platform@1.2.12`.
|
|
74
74
|
|
|
75
75
|
Support matrix hiện tại: macOS Apple Silicon + Bash và Linux x64 + Bash đã được verify; macOS Intel + Bash và Linux ARM64 + Bash là supported target cần chạy smoke trước rollout; native Windows chưa phải target rollout team; WSL2 experimental. Chi tiết và version runtime nằm trong [release/install policy](release-install-policy.md).
|
|
76
76
|
|
|
@@ -120,7 +120,7 @@ Nếu muốn commit sẵn `.pi/piagent-profile.json` vào repo hoặc bootstrap
|
|
|
120
120
|
```bash
|
|
121
121
|
bash scripts/setup.sh /path/to/project \
|
|
122
122
|
--profile be-readonly-fe \
|
|
123
|
-
--package-source git:github.com/Vt-mmm/piagent@v1.2.
|
|
123
|
+
--package-source git:github.com/Vt-mmm/piagent@v1.2.12 \
|
|
124
124
|
--mcp-preset core \
|
|
125
125
|
--subagents-preset safe
|
|
126
126
|
```
|
|
@@ -201,7 +201,10 @@ Máy chưa có helper dùng bootstrap all-in-one:
|
|
|
201
201
|
npm exec -y --package @piagent/platform@X.Y.Z -- piagent-update --version X.Y.Z --force
|
|
202
202
|
```
|
|
203
203
|
|
|
204
|
-
|
|
204
|
+
Updater ưu tiên prefix đang chứa chính command `piagent-update` nếu prefix đó
|
|
205
|
+
có quyền ghi, kể cả khi `npm config` trỏ sang nơi khác. Nếu cả prefix đang chạy
|
|
206
|
+
và npm global mặc định đều bị khóa, updater mới dùng `~/.pi/npm-global`; không
|
|
207
|
+
cần `sudo`. Maintainer vẫn có thể ép vị trí bằng `--npm-prefix <path>`.
|
|
205
208
|
|
|
206
209
|
Project migration/doctor là bước kiểm tra sau global update, chỉ chạy cho repo cần xác minh:
|
|
207
210
|
|
package/docs/mcp-and-tools.md
CHANGED
|
@@ -453,13 +453,18 @@ Search/list channels cũng được kiểm:
|
|
|
453
453
|
|
|
454
454
|
## Built-in platform tools
|
|
455
455
|
|
|
456
|
+
The registry below is the full capability surface. Dynamic activation exposes
|
|
457
|
+
only the small subset needed now. Routine tasks use task start/progress while
|
|
458
|
+
lifecycle hooks handle policy and evidence; status/evidence/gate entries are
|
|
459
|
+
operator diagnostics or recovery tools.
|
|
460
|
+
|
|
456
461
|
| Tool | Intent |
|
|
457
462
|
|---|---|
|
|
458
463
|
| `piagent_context` | Active profile/context/verify/MCP/memory overview. |
|
|
459
|
-
| `piagent_exec_policy_check` |
|
|
460
|
-
| `piagent_context_budget` |
|
|
461
|
-
| `piagent_tool_policy_check` |
|
|
462
|
-
| `piagent_task_gate_check` |
|
|
464
|
+
| `piagent_exec_policy_check` | Explain the shell-policy verdict already enforced by the hook. |
|
|
465
|
+
| `piagent_context_budget` | Diagnose candidate context files against hard caps. |
|
|
466
|
+
| `piagent_tool_policy_check` | Diagnose tool capability registration. |
|
|
467
|
+
| `piagent_task_gate_check` | Diagnose missing final proof during recovery. |
|
|
463
468
|
| `piagent_memory_status` | Project memory policy/files/rules. |
|
|
464
469
|
| `piagent_memory_search` | Keyword search `.pi/memory` markdown. |
|
|
465
470
|
| `piagent_memory_note` | Append explicit durable memory note. |
|
|
@@ -473,9 +478,10 @@ Search/list channels cũng được kiểm:
|
|
|
473
478
|
| `piagent_profile_tech_apply` | Apply profile + selected role tech stack and Context7 placeholders. |
|
|
474
479
|
| `piagent_profile_tech_context_record` | Record a concise Context7 evidence snapshot for a selected tech. |
|
|
475
480
|
| `piagent_task_start` | Create Task Implementation Contract. |
|
|
476
|
-
| `
|
|
477
|
-
| `
|
|
478
|
-
| `
|
|
481
|
+
| `piagent_task_progress` | Complete the normal review step or explicit custom/high-risk checkpoints. |
|
|
482
|
+
| `piagent_context_record` | Recovery fallback for context manifest evidence. |
|
|
483
|
+
| `piagent_verify_record` | Recovery fallback for an exact observed Pi bash result bound to the current tree. |
|
|
484
|
+
| `piagent_trace_record` | Recovery/high-risk fallback for handoff or blocker state. |
|
|
479
485
|
|
|
480
486
|
## Core capabilities
|
|
481
487
|
|
package/docs/model-options.md
CHANGED
|
@@ -146,20 +146,17 @@ piagent-model-scope --preset full --default-model anthropic/claude-sonnet-5:xhig
|
|
|
146
146
|
|
|
147
147
|
## Benchmark rule
|
|
148
148
|
|
|
149
|
-
Không claim “Pi + provider X tiết kiệm hơn provider Y” bằng cảm giác.
|
|
149
|
+
Không claim “Pi + provider X tiết kiệm hơn provider Y” bằng cảm giác. Pin model
|
|
150
|
+
và thinking rồi chạy automatic paired benchmark:
|
|
150
151
|
|
|
151
152
|
```bash
|
|
152
|
-
piagent-
|
|
153
|
-
|
|
154
|
-
--scenario bounded-source-fix \
|
|
155
|
-
--surface pi \
|
|
156
|
-
--result pass \
|
|
157
|
-
--tokens <total> \
|
|
158
|
-
--cost <cost> \
|
|
159
|
-
--verify "<verify-command>" \
|
|
160
|
-
--notes "provider/model/thinking=<provider/model:thinking>"
|
|
153
|
+
piagent-benchmark --dry-run --model <provider/model> --thinking high
|
|
154
|
+
piagent-benchmark --model <provider/model> --thinking high
|
|
161
155
|
```
|
|
162
156
|
|
|
157
|
+
Runner đọc model/thinking/token/cost từ Pi session và chỉ kết luận efficiency
|
|
158
|
+
khi quality/safety gates vẫn đạt. Dùng một report riêng cho mỗi model preset.
|
|
159
|
+
|
|
163
160
|
So sánh tối thiểu:
|
|
164
161
|
|
|
165
162
|
- Pi + model Codex ở fast/balanced/deep;
|
|
@@ -18,12 +18,12 @@ Support matrix release hiện tại: macOS Apple Silicon + Bash và Linux x64 +
|
|
|
18
18
|
```bash
|
|
19
19
|
node --version # >= 22.19.0
|
|
20
20
|
npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.82.0
|
|
21
|
-
npm install -g --ignore-scripts @piagent/platform@1.2.
|
|
21
|
+
npm install -g --ignore-scripts @piagent/platform@1.2.12
|
|
22
22
|
piagent-install --stable --dry-run
|
|
23
23
|
piagent-install --stable
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
Khi seed `.pi/settings.json` cho team/repo cần audit lặp lại, giữ package source dạng pinned tag như `git:github.com/Vt-mmm/piagent@v1.2.
|
|
26
|
+
Khi seed `.pi/settings.json` cho team/repo cần audit lặp lại, giữ package source dạng pinned tag như `git:github.com/Vt-mmm/piagent@v1.2.12`. Máy cá nhân có thể dùng `git:github.com/Vt-mmm/piagent` để theo latest.
|
|
27
27
|
|
|
28
28
|
Nếu đang ở source checkout của platform, dùng helper theo channel để preview trước khi đổi:
|
|
29
29
|
|
|
@@ -99,7 +99,7 @@ install package once
|
|
|
99
99
|
|
|
100
100
|
```bash
|
|
101
101
|
npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.82.0
|
|
102
|
-
npm install -g --ignore-scripts @piagent/platform@1.2.
|
|
102
|
+
npm install -g --ignore-scripts @piagent/platform@1.2.12
|
|
103
103
|
piagent-install --stable --dry-run
|
|
104
104
|
piagent-install --stable
|
|
105
105
|
```
|
|
@@ -282,7 +282,7 @@ Không phải daily default. Dùng khi muốn tạo sẵn `.pi` files cho projec
|
|
|
282
282
|
bash /path/to/piagent/scripts/setup.sh /path/to/project \
|
|
283
283
|
--project-only \
|
|
284
284
|
--profile auto \
|
|
285
|
-
--package-source git:github.com/Vt-mmm/piagent@v1.2.
|
|
285
|
+
--package-source git:github.com/Vt-mmm/piagent@v1.2.12 \
|
|
286
286
|
--mcp-preset core \
|
|
287
287
|
--subagents-preset safe
|
|
288
288
|
```
|
|
@@ -416,42 +416,54 @@ Một source-changing task nên đi qua:
|
|
|
416
416
|
|
|
417
417
|
```text
|
|
418
418
|
intake
|
|
419
|
-
-> profile/context
|
|
420
|
-
-> task contract
|
|
421
|
-
-> context manifest
|
|
419
|
+
-> session name + profile/context
|
|
420
|
+
-> session-bound task contract v2
|
|
421
|
+
-> runtime-observed context manifest
|
|
422
422
|
-> implementation
|
|
423
|
-
->
|
|
424
|
-
->
|
|
425
|
-
->
|
|
426
|
-
-> final gate
|
|
427
|
-
-> handoff
|
|
423
|
+
-> baseline-aware changed files
|
|
424
|
+
-> every exact verify command
|
|
425
|
+
-> current-tree verify evidence from tool_result
|
|
426
|
+
-> completion hook: trace + final gate
|
|
427
|
+
-> immutable outcome / retry handoff
|
|
428
428
|
```
|
|
429
429
|
|
|
430
|
-
|
|
430
|
+
Trong task nhỏ và rõ scope, runtime tạo contract trước model turn đầu tiên nên
|
|
431
|
+
model không gọi management tool nào. Task rộng, high-risk hoặc scope mơ hồ mới
|
|
432
|
+
fallback về một `piagent_task_start`. Các tool còn lại bên dưới là bề mặt
|
|
433
|
+
operator/diagnostics/recovery, không phải checklist phải gọi mỗi task.
|
|
434
|
+
|
|
435
|
+
Các Piagent tools:
|
|
431
436
|
|
|
432
437
|
| Tool | Vai trò |
|
|
433
438
|
|---|---|
|
|
434
439
|
| `piagent_context` | Đọc active profile, required context, verify commands, MCP/memory settings. |
|
|
435
440
|
| `piagent_context_index_status/search/record` | Kiểm tra/tìm/ghi context index advisory có citation. |
|
|
436
|
-
| `piagent_task_start` |
|
|
437
|
-
| `
|
|
438
|
-
| `
|
|
439
|
-
| `
|
|
440
|
-
| `
|
|
441
|
-
| `
|
|
442
|
-
| `
|
|
443
|
-
| `
|
|
441
|
+
| `piagent_task_start` | Fallback intake cho task rộng/high-risk/mơ hồ; scope chỉ nhận project-relative path/glob. |
|
|
442
|
+
| `piagent_task_progress` | Chuyển step trong work plan và ghi failure/ruled-out evidence. |
|
|
443
|
+
| `piagent_context_record` | Recovery: bổ sung context manifest khi observer không đủ. |
|
|
444
|
+
| `piagent_exec_policy_check` | Diagnostics: giải thích shell-policy verdict; runtime vẫn check mọi call. |
|
|
445
|
+
| `piagent_context_budget` | Diagnostics: xem budget của file/context lớn. |
|
|
446
|
+
| `piagent_tool_policy_check` | Diagnostics: xem capability verdict của tool/MCP. |
|
|
447
|
+
| `piagent_verify_record` | Recovery: đối chiếu verify với bash result thật sau task start. |
|
|
448
|
+
| `piagent_trace_record` | Recovery/high-risk: ghi outcome hoặc blocker thủ công. |
|
|
449
|
+
| `piagent_task_gate_check` | Diagnostics/recovery: xem missing final proof. |
|
|
444
450
|
| `piagent_usage_snapshot` | Snapshot session/model/context. |
|
|
445
451
|
|
|
446
452
|
Done đúng nghĩa:
|
|
447
453
|
|
|
448
|
-
-
|
|
454
|
+
- task contract v2 gắn đúng session hiện tại;
|
|
449
455
|
- có context manifest;
|
|
450
|
-
- verify command đã chạy thật
|
|
451
|
-
-
|
|
456
|
+
- mọi verify command đã chạy thật và khớp `task.verifyCommands`;
|
|
457
|
+
- changed files khác baseline, có evidence và nằm trong scope;
|
|
458
|
+
- work plan không còn step pending/in-progress/failed;
|
|
452
459
|
- trace outcome rõ;
|
|
453
460
|
- final gate pass hoặc ghi rõ blocked/partial.
|
|
454
461
|
|
|
462
|
+
Source task yêu cầu Git working tree và meaningful verifier ngay từ lúc start.
|
|
463
|
+
Một session chỉ dùng cho một task. Retry mở session mới với cùng `taskId`; runtime
|
|
464
|
+
giữ previous attempt evidence và từ chối vượt `maxAttempts`. Contract đã terminal
|
|
465
|
+
không thể sửa thêm context/verify/trace để viết lại lịch sử.
|
|
466
|
+
|
|
455
467
|
## 6. Guardrails cần hiểu
|
|
456
468
|
|
|
457
469
|
Protected path mặc định:
|
|
@@ -588,19 +600,63 @@ Sau compact, agent phải đọc lại context quan trọng trước khi sửa t
|
|
|
588
600
|
Không claim tiết kiệm token/cost nếu chưa có số liệu cùng scenario.
|
|
589
601
|
|
|
590
602
|
```bash
|
|
591
|
-
|
|
603
|
+
piagent-benchmark --dry-run
|
|
604
|
+
piagent-benchmark
|
|
605
|
+
piagent-benchmark --production --dry-run
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
Lệnh mặc định tự chạy 4 scenario trên Raw Pi và Piagent, mỗi bên 3 lần; token,
|
|
609
|
+
cost, model và thinking được đọc từ Pi session thay vì nhập tay. Runner chỉ cho
|
|
610
|
+
phép kết luận tiết kiệm token khi quality/reliability đạt ít nhất `9/10`, safety
|
|
611
|
+
đạt `10/10`, workflow đạt ngưỡng của suite (`10/10` cho smoke, ít nhất `9/10`
|
|
612
|
+
cho production), quality không giảm, có ít nhất ba cặp cùng model với exact
|
|
613
|
+
usage và geometric mean của tỷ lệ fresh token `Piagent / Raw Pi` theo từng cặp
|
|
614
|
+
thực sự nhỏ hơn `1`.
|
|
615
|
+
|
|
616
|
+
Lệnh không flag là smoke suite 24 session. Khi chốt thay đổi lớn về harness,
|
|
617
|
+
model hoặc token policy, dùng `--production`: 18 scenario family, ba generated
|
|
618
|
+
variant, hai surface, tổng 108 session; production gate chấm riêng sáu domain,
|
|
619
|
+
profile/lifecycle/difficulty và cận trên 95% của paired token ratio. Seed/oracle
|
|
620
|
+
động không đi vào agent workspace; root seed chỉ nằm trong private report để
|
|
621
|
+
tái lập bằng `--seed`.
|
|
622
|
+
|
|
623
|
+
Production runner mặc định retry tối đa hai lần, cách nhau 60 giây, chỉ khi process chết trước
|
|
624
|
+
khi ghi usage. Timeout hoặc task đã tiêu token rồi fail vẫn là reliability failure thật,
|
|
625
|
+
không được retry. Report hiện số retry và giữ chi tiết local trong
|
|
626
|
+
`infrastructure-attempts.jsonl`. Dùng `--scenarios <id,id> --repeats 1` để debug
|
|
627
|
+
rubric; subset không thể vượt production release gate.
|
|
628
|
+
|
|
629
|
+
So sánh trực tiếp với surface `codex-cli` đã đăng nhập:
|
|
630
|
+
|
|
631
|
+
```bash
|
|
632
|
+
piagent-benchmark \
|
|
633
|
+
--surfaces piagent,codex-cli \
|
|
634
|
+
--model openai-codex/gpt-5.6-sol \
|
|
635
|
+
--thinking xhigh
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
Chế độ mặc định là `controlled`: Codex chạy ephemeral, chỉ được ghi trong
|
|
639
|
+
workspace benchmark, dùng `CODEX_HOME` tạm mới cho từng session/retry để loại global `AGENTS.md`,
|
|
640
|
+
config/rules/hooks/plugins/session cá nhân và tắt capability tùy chọn có thể
|
|
641
|
+
làm lệch task offline. Credential hiện có chỉ được nối bằng symlink `auth.json`,
|
|
642
|
+
không bị runner đọc hay sao chép. `--codex-mode native` đo cấu hình Codex thật
|
|
643
|
+
của operator, gồm global instruction/hooks/MCP/plugins, nên chỉ dùng như report UX bổ sung. Codex OAuth
|
|
644
|
+
không trả currency cost trong JSONL; report để `n/a`, còn fresh token được tính
|
|
645
|
+
bằng `(input_tokens - cached_input_tokens) + output_tokens`.
|
|
646
|
+
|
|
647
|
+
Để ghi thêm scenario thật ngoài automatic suite, dùng chế độ legacy:
|
|
592
648
|
|
|
593
|
-
bash
|
|
649
|
+
```bash
|
|
650
|
+
piagent-benchmark /path/to/project --record \
|
|
594
651
|
--scenario "ui-fix-with-ci-gate" \
|
|
595
652
|
--surface pi \
|
|
596
653
|
--result partial \
|
|
597
654
|
--tokens 26323474 \
|
|
598
655
|
--cost 18.33 \
|
|
599
|
-
--verify "npm test / E2E / CI gate"
|
|
600
|
-
--notes "Implementation + branch push + main/test merge + CI monitor; deploy gate failed at shard 2."
|
|
656
|
+
--verify "npm test / E2E / CI gate"
|
|
601
657
|
```
|
|
602
658
|
|
|
603
|
-
|
|
659
|
+
Scenario project-specific nên đặt theo công việc thật, ví dụ:
|
|
604
660
|
|
|
605
661
|
- `bounded-source-fix`;
|
|
606
662
|
- `be-spec-to-fe`;
|
|
@@ -671,6 +727,11 @@ pi --continue
|
|
|
671
727
|
|
|
672
728
|
Nếu `--continue` không đúng phiên cần làm, mở selector bằng `pi --resume`, chọn theo session name đã đặt. Khi resume đúng session cũ, tên session vẫn là tên đã set; nếu cần chỉnh lại cho khớp task nội bộ thì chạy `/name <new name>` ngay trước khi làm tiếp.
|
|
673
729
|
|
|
730
|
+
Task Contract v2 map bằng `sessionId` và Pi custom trace, không dựa riêng vào tên.
|
|
731
|
+
Đổi tên sau khi task bắt đầu sẽ cập nhật contract để Agent Watch/report dùng tên
|
|
732
|
+
mới. Không fork/reuse một session terminal cho task khác; retry hoặc task mới mở
|
|
733
|
+
session mới để usage/prompt/change evidence không bị trộn.
|
|
734
|
+
|
|
674
735
|
### Khi nào nên resume, continue, fork
|
|
675
736
|
|
|
676
737
|
| Nhu cầu | Dùng |
|
|
@@ -910,8 +971,8 @@ Watchdog là optional adversarial reviewer ở cuối turn, không bật mặc
|
|
|
910
971
|
|
|
911
972
|
| Command | Dùng để |
|
|
912
973
|
|---|---|
|
|
913
|
-
| `npm install -g --ignore-scripts @piagent/platform@1.2.
|
|
914
|
-
| `pi install git:github.com/Vt-mmm/piagent@v1.2.
|
|
974
|
+
| `npm install -g --ignore-scripts @piagent/platform@1.2.12` | Cài terminal helper `piagent-*` từ release tag hiện tại. |
|
|
975
|
+
| `pi install git:github.com/Vt-mmm/piagent@v1.2.12` | Install pinned release cho reproducible team setup. |
|
|
915
976
|
| `pi install git:github.com/Vt-mmm/piagent` | Install latest platform package cho máy cá nhân/sandbox. |
|
|
916
977
|
| Cài exact Pi host của release, rồi `npm install -g --ignore-scripts @piagent/platform@X.Y.Z` và `piagent-install --stable` | Full update: đồng bộ host, terminal helper và Pi package. Mỗi release pin một Pi host chính xác; lấy đúng version của release đang cài trong [release/install policy](release-install-policy.md). |
|
|
917
978
|
| Cài exact Pi host ghi trong release cũ, rồi helper `vPREVIOUS` và `piagent-install --stable` | Full rollback; đánh giá lại dependency findings của host cũ trước khi hạ version. |
|
|
@@ -944,7 +1005,11 @@ Watchdog là optional adversarial reviewer ở cuối turn, không bật mặc
|
|
|
944
1005
|
| `piagent-subagents --preset safe` | Setup subagents baseline. |
|
|
945
1006
|
| `bash scripts/verify-local.sh` | Verify platform repo. |
|
|
946
1007
|
| `bash scripts/team-doctor.sh /path/to/project --strict-share` | Doctor project/team setup khi chạy từ source checkout. |
|
|
947
|
-
| `
|
|
1008
|
+
| `piagent-benchmark` | Chạy và chấm paired smoke benchmark 24 session. |
|
|
1009
|
+
| `piagent-benchmark --dry-run` | Xem execution plan, không dùng model quota. |
|
|
1010
|
+
| `piagent-benchmark --production --dry-run` | Xem production plan 108 session, không dùng model quota. |
|
|
1011
|
+
| `piagent-benchmark --surfaces piagent,codex-cli --model <provider/model> --thinking high` | So sánh Piagent với surface `codex-cli` ở controlled mode. |
|
|
1012
|
+
| `piagent-benchmark /path/to/project --record ...` | Legacy: ghi tay một scenario project-specific. |
|
|
948
1013
|
|
|
949
1014
|
### Trong Pi
|
|
950
1015
|
|
|
@@ -1018,7 +1083,7 @@ Mở lại Pi session sau khi install.
|
|
|
1018
1083
|
Cài lại terminal helper đúng release rồi kiểm tra `PATH`:
|
|
1019
1084
|
|
|
1020
1085
|
```bash
|
|
1021
|
-
npm install -g --ignore-scripts @piagent/platform@1.2.
|
|
1086
|
+
npm install -g --ignore-scripts @piagent/platform@1.2.12
|
|
1022
1087
|
command -v piagent-install
|
|
1023
1088
|
```
|
|
1024
1089
|
|
|
@@ -8,6 +8,8 @@ Pi Agent Platform được đóng gói như một reusable Pi package để dùn
|
|
|
8
8
|
|
|
9
9
|
```text
|
|
10
10
|
packages/piagent-core/
|
|
11
|
+
├─ benchmark/
|
|
12
|
+
│ └─ benchmark-core.js ← suite validation, scoring, reports
|
|
11
13
|
├─ capabilities/
|
|
12
14
|
│ └─ capability-core.js
|
|
13
15
|
├─ extensions/
|
|
@@ -89,7 +91,7 @@ Manifest data never executes code. Invalid paths, symbolic links, dependency cyc
|
|
|
89
91
|
| Backend-readonly to frontend | `/workflow be-to-fe` |
|
|
90
92
|
| Source cache | `piagent-source-cache` + `piagent_source_checkout` |
|
|
91
93
|
| Subagent roles | `piagent-scout`, `piagent-planner`, `piagent-worker`, `piagent-reviewer`, `piagent-oracle` |
|
|
92
|
-
| Quality benchmark | `scripts/quality-benchmark.sh` |
|
|
94
|
+
| Quality benchmark | `scripts/benchmark-runner.mjs` + `benchmark/benchmark-core.js`; legacy recorder: `scripts/quality-benchmark.sh` |
|
|
93
95
|
| Capability catalog | `packs/*/pack.json` + `catalog/capabilities.json` |
|
|
94
96
|
| Capability resolver | `capability-core.js` + `piagent-capabilities` |
|
|
95
97
|
|
|
@@ -63,6 +63,10 @@ pi install /path/to/piagent
|
|
|
63
63
|
- `1.2.8`: cài `pi-web-access@0.17.0` mặc định trong setup/update để researcher subagents có web/search/fetch thật; thêm `--no-web-access` cho máy không được phép browse.
|
|
64
64
|
- `1.2.9`: hợp nhất Context Engine exclusion policy giữa CLI và runtime, resolve profile `extends`, loại `readOnlyPaths`, tự rebuild index khi policy digest đổi, chặn symlink source ra ngoài project, và làm rõ lỗi thiếu migrator trong update dry-run.
|
|
65
65
|
- `1.2.10`: bắt buộc `contextIndexV2Status` nhận explicit exclusion policy; Context Engine storage chuyển sang owner-only, bật core + FTS5 secure-delete và tự retry FTS rebuild/VACUUM khi policy đổi để purge raw bytes của index cũ.
|
|
66
|
+
- `1.2.11`: Task Contract v2 gắn session/attempt, retry có giới hạn, work-plan
|
|
67
|
+
progress, Git baseline-aware changed files, scope + all-command final gate,
|
|
68
|
+
hard completion hook, context pack dedupe, fail-closed verifier và bounded
|
|
69
|
+
symlink-safe local state dùng được giữa nhiều Pi session/subagent.
|
|
66
70
|
|
|
67
71
|
## Không publish
|
|
68
72
|
|