@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
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"schemaVersion": 2,
|
|
3
|
+
"taskRunId": "task-0001-20260731120000-a1b2c3d4e5",
|
|
4
|
+
"taskId": "task-0001",
|
|
5
|
+
"sessionId": "pi-session-example",
|
|
6
|
+
"sessionName": "TASK-0001 Example task",
|
|
7
|
+
"changeMode": "source-change",
|
|
8
|
+
"attempt": 1,
|
|
9
|
+
"maxAttempts": 3,
|
|
10
|
+
"previousAttempts": [],
|
|
3
11
|
"summary": "Replace with one-sentence task outcome.",
|
|
4
12
|
"riskLane": "normal",
|
|
5
13
|
"expectedOutput": "Replace with exact artifact or behavior expected.",
|
|
@@ -17,6 +25,7 @@
|
|
|
17
25
|
"contextManifest": [],
|
|
18
26
|
"memoryCitations": [],
|
|
19
27
|
"mcpCapabilities": [],
|
|
28
|
+
"verifyGroup": "source",
|
|
20
29
|
"verifyCommands": [
|
|
21
30
|
"Replace with verify command."
|
|
22
31
|
],
|
|
@@ -66,9 +75,16 @@
|
|
|
66
75
|
"watchdog": "Use a strong model only for final risk review, security, release, or high-impact changes."
|
|
67
76
|
}
|
|
68
77
|
},
|
|
78
|
+
"baselineChangedFiles": [],
|
|
79
|
+
"baselineFileDigests": {},
|
|
80
|
+
"observedChangedFiles": [],
|
|
81
|
+
"finalWorkingTreeFiles": [],
|
|
82
|
+
"finalFileDigests": {},
|
|
69
83
|
"changedFiles": [],
|
|
70
84
|
"verifyEvidence": [],
|
|
71
85
|
"trace": {
|
|
72
86
|
"outcome": "pending"
|
|
73
|
-
}
|
|
87
|
+
},
|
|
88
|
+
"createdAt": "2026-07-31T12:00:00.000Z",
|
|
89
|
+
"updatedAt": "2026-07-31T12:00:00.000Z"
|
|
74
90
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@piagent/platform",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"SECURITY.md",
|
|
31
31
|
".gitattributes",
|
|
32
32
|
"adapters/",
|
|
33
|
+
"benchmarks/",
|
|
33
34
|
"catalog/",
|
|
34
35
|
"docs/",
|
|
35
36
|
"!docs/journals/",
|
|
@@ -113,7 +114,7 @@
|
|
|
113
114
|
"install-global": "bash scripts/install-global.sh",
|
|
114
115
|
"init-project": "bash scripts/init-project.sh",
|
|
115
116
|
"doctor": "bash scripts/team-doctor.sh",
|
|
116
|
-
"benchmark": "
|
|
117
|
+
"benchmark": "node scripts/benchmark-runner.mjs",
|
|
117
118
|
"benchmark:redaction": "node scripts/redaction-benchmark.mjs",
|
|
118
119
|
"audit:runtime": "bash scripts/audit-runtime-host.sh",
|
|
119
120
|
"release:identity": "node scripts/verify-release-identity.mjs",
|
|
@@ -6,13 +6,23 @@ Shared Pi package for reusable project workflows.
|
|
|
6
6
|
|
|
7
7
|
- `extensions/piagent-guard.ts`: runtime guard tools and policy hooks.
|
|
8
8
|
- `prompts/*.md`: workflow aliases that intentionally launch an agent turn.
|
|
9
|
-
- `skills/piagent-ops/SKILL.md`:
|
|
9
|
+
- `skills/piagent-ops/SKILL.md`: operator-invoked reference for manual intake, recovery, and high-risk controls; routine runtime-managed tasks do not advertise or load it.
|
|
10
10
|
- `skills/piagent-source-cache/`: local cache for user-provided external source repositories.
|
|
11
11
|
- `subagents/*.md`: piagent roles for `pi-subagents`.
|
|
12
|
+
- `benchmark/benchmark-core.js`: deterministic suite validation, evidence scoring, usage comparison, and report rendering for `piagent-benchmark`.
|
|
12
13
|
- `policies/base-policy.json`: default runtime policy, including protected path and shell protected path defaults.
|
|
13
14
|
- input hook support for local screenshot/image paths pasted into chat; supported images are attached as `[image1]`, `[image2]`, ...
|
|
14
15
|
- compact tool-result rendering: oversized redacted output is previewed in Pi and captured under `.pi/piagent-state/tool-results/` for offline audit/reporting.
|
|
15
|
-
- local Context Engine v2: incremental FTS5/symbol/import index, hybrid retrieval, token-budgeted packs, test-impact mapping, dynamic Piagent tools, and Agent Watch compatible telemetry.
|
|
16
|
+
- local Context Engine v2: incremental FTS5/symbol/import index, hybrid retrieval, token-budgeted packs, bounded current-turn source/test snapshots, test-impact mapping, dynamic Piagent tools, and Agent Watch compatible telemetry.
|
|
17
|
+
|
|
18
|
+
The root package exposes `piagent-benchmark` for an automatic paired Piagent
|
|
19
|
+
steady-state benchmark against Raw Pi or the `codex-cli` surface. Treatment
|
|
20
|
+
onboarding/context preparation happens before measured model usage;
|
|
21
|
+
post-baseline mutations remain scope violations. Codex runs through a strict
|
|
22
|
+
streaming JSONL adapter and defaults to controlled ephemeral execution with an
|
|
23
|
+
isolated temporary Codex home. Run
|
|
24
|
+
`piagent-benchmark --dry-run` before starting billed model sessions; see
|
|
25
|
+
`docs/quality-benchmark.md` for score and verdict rules.
|
|
16
26
|
|
|
17
27
|
## Trusted run wrapper
|
|
18
28
|
|
|
@@ -70,12 +80,20 @@ Legacy aliases still work: `/permission-status`, `/read-only`, `/workspace-write
|
|
|
70
80
|
- `piagent_profile_tech_context_record`
|
|
71
81
|
- `piagent_project_onboarding_record`
|
|
72
82
|
- `piagent_task_start`
|
|
83
|
+
- `piagent_task_progress`
|
|
73
84
|
- `piagent_source_checkout`
|
|
74
85
|
- `piagent_document_read` — reads `.md`/`.txt`/`.csv`/`.json`/`.yaml`/`.pdf`/`.docx` from the project or a granted `additionalReadRoots` directory; read-only, and `protectedPaths` still wins
|
|
75
86
|
- `piagent_context_record`
|
|
76
87
|
- `piagent_verify_record` — records verify evidence only after matching an observed bash tool result after task start
|
|
77
88
|
- `piagent_trace_record`
|
|
78
89
|
|
|
90
|
+
These tools are registered capabilities, not a per-task call sequence. Runtime
|
|
91
|
+
starts bounded source tasks directly and exposes no Piagent management schema
|
|
92
|
+
to the model. Broad, high-risk, or ambiguous intake activates
|
|
93
|
+
`piagent_task_start`; lifecycle hooks still collect context, changes,
|
|
94
|
+
current-tree verification, trace and final-gate evidence. Diagnostic/recovery
|
|
95
|
+
groups load only when requested.
|
|
96
|
+
|
|
79
97
|
## Runtime commands and workflow recipes
|
|
80
98
|
|
|
81
99
|
- `/commands`: runtime menu/help for terminal, Pi, MCP, model, memory, session, context, permission, and subagent commands.
|
|
@@ -132,6 +150,7 @@ If no trusted profile is available, the extension still applies baseline secret
|
|
|
132
150
|
Runtime task tools write local state to:
|
|
133
151
|
|
|
134
152
|
- `.pi/piagent-state/tasks/*.json`
|
|
153
|
+
- `.pi/piagent-state/session-tasks/*.json`
|
|
135
154
|
- `.pi/project-context.md`
|
|
136
155
|
- `.pi/tech-stack.json`
|
|
137
156
|
- `.pi/tech-context/*.json`
|
|
@@ -147,12 +166,27 @@ Runtime task tools write local state to:
|
|
|
147
166
|
|
|
148
167
|
Project-local state belongs in `.pi/.gitignore`.
|
|
149
168
|
|
|
169
|
+
Task files use schema v2 and bind one unique `taskRunId` to one Pi `sessionId`.
|
|
170
|
+
They record attempt/max-attempt history, dependency-safe work-plan progress,
|
|
171
|
+
Git baseline/final digests, observed changes, all exact verify results and final
|
|
172
|
+
trace. A terminal task is immutable; retry starts in a fresh session and carries
|
|
173
|
+
the prior failure/ruled-out evidence. Legacy v1 state is migrated and archived
|
|
174
|
+
without requiring project onboarding again.
|
|
175
|
+
|
|
176
|
+
Local state directories are owner-only. Task state, context telemetry, trace,
|
|
177
|
+
bash evidence and captures refuse ancestor symlinks out of the project. JSONL
|
|
178
|
+
files rotate under a cross-process lock; compacted tool captures are pruned by
|
|
179
|
+
age, count and aggregate bytes.
|
|
180
|
+
|
|
150
181
|
The Context Engine SQLite index contains allowed source bodies. Its directory is
|
|
151
182
|
kept at mode `0700`, with database/WAL/SHM at `0600`; core and FTS5 secure-delete
|
|
152
183
|
cover normal refreshes, while exclusion-policy changes trigger a retryable FTS
|
|
153
184
|
rebuild and database vacuum before the new policy is considered clean.
|
|
154
185
|
|
|
155
|
-
Passing final gates require an observed exit `0`
|
|
186
|
+
Passing source final gates require an observed exit `0` result for every
|
|
187
|
+
meaningful entry in `task.verifyCommands`. Other observed commands are traceable
|
|
188
|
+
but advisory. Declared changed files must also differ from the task baseline,
|
|
189
|
+
match observed tool results and remain inside `task.scope`.
|
|
156
190
|
|
|
157
191
|
Raw path-like tool access to protected paths is blocked before execution. This includes Pi built-ins (`read`, `write`, `edit`, `grep`, `find`, `ls`) and custom/MCP tools with nested path-like strings, arrays, or `file://` URIs. Path-like strings are percent-decoded once, and input nesting above `MAX_TOOL_INPUT_INSPECTION_DEPTH=32` fails closed. Known content fields such as `content`, `query`, `pattern`, `text`, and `command` are excluded from generic extraction. `grep.glob` and `find.pattern` are checked when they explicitly target protected paths, while broad `grep`, `find`, and `ls` results are filtered so protected content lines or path metadata are redacted before reaching the model.
|
|
158
192
|
|