@piagent/platform 1.5.5 → 1.6.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.
Files changed (227) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/README.md +9 -8
  3. package/README.vi.md +9 -5
  4. package/adapters/web-frontend/profile.json +2 -4
  5. package/architecture/layers.json +18 -3
  6. package/benchmarks/deep-logic-v1/SPECIALIST_PROTOCOL.vi.md +122 -0
  7. package/benchmarks/deep-logic-v1/grade.mjs +272 -10
  8. package/benchmarks/deep-logic-v1/project/apps/admin/src/billing-summary.js +3 -0
  9. package/benchmarks/deep-logic-v1/project/benchmark-contract/public-smoke.test.js +166 -0
  10. package/benchmarks/deep-logic-v1/project/package.json +1 -1
  11. package/benchmarks/deep-logic-v1/project/packages/billing/src/close-period.js +3 -0
  12. package/benchmarks/deep-logic-v1/project/packages/billing/src/plan-timeline.js +3 -0
  13. package/benchmarks/deep-logic-v1/project/test/smoke.test.js +7 -1
  14. package/benchmarks/deep-logic-v1/prompts/budgeted-context-graph.md +2 -0
  15. package/benchmarks/deep-logic-v1/prompts/fair-dependency-scheduler.md +2 -0
  16. package/benchmarks/deep-logic-v1/prompts/layered-policy-resolution.md +2 -0
  17. package/benchmarks/deep-logic-v1/prompts/resumable-stream-assembly.md +3 -1
  18. package/benchmarks/deep-logic-v1/prompts/revision-event-reconciliation.md +2 -0
  19. package/benchmarks/deep-logic-v1/prompts/temporal-usage-billing-close.md +123 -0
  20. package/benchmarks/deep-logic-v1/prompts/transactional-config-merge.md +2 -0
  21. package/benchmarks/deep-logic-v1/suite.json +51 -3
  22. package/benchmarks/deep-logic-v1/variant.mjs +22 -1
  23. package/benchmarks/production-v1/spend-control.v1.json +68 -0
  24. package/benchmarks/production-v1/suite.json +42 -3
  25. package/catalog/capabilities.json +6 -6
  26. package/docs/command-reference-vietnamese.md +6 -6
  27. package/docs/context-engine.md +7 -1
  28. package/docs/distribution-standard.md +7 -7
  29. package/docs/en/architecture.md +1 -0
  30. package/docs/languages.json +4 -4
  31. package/docs/model-options.md +8 -5
  32. package/docs/operator-manual-vietnamese.md +13 -11
  33. package/docs/project-adapters.md +2 -2
  34. package/docs/publishing-for-teams.md +5 -0
  35. package/docs/quality-benchmark.md +271 -62
  36. package/docs/release-install-policy.md +10 -9
  37. package/docs/runtime-policy-design.md +4 -4
  38. package/docs/runtime-quality-baseline.md +13 -6
  39. package/docs/security-threat-model.md +2 -2
  40. package/docs/task-lifecycle-vietnamese.md +2 -2
  41. package/docs/team-onboarding.md +2 -2
  42. package/docs/usage-observability.md +7 -2
  43. package/docs/vi/architecture.md +1 -0
  44. package/docs-site/architecture.html +1 -1
  45. package/docs-site/benchmark.html +1 -1
  46. package/docs-site/commands.html +1 -1
  47. package/docs-site/context-engine.html +1 -1
  48. package/docs-site/en/architecture.html +1 -1
  49. package/docs-site/en/benchmark.html +1 -1
  50. package/docs-site/en/commands.html +1 -1
  51. package/docs-site/en/context-engine.html +1 -1
  52. package/docs-site/en/index.html +1 -1
  53. package/docs-site/en/mcp-approval.html +1 -1
  54. package/docs-site/en/mcp-auth.html +1 -1
  55. package/docs-site/en/mcp-servers.html +1 -1
  56. package/docs-site/en/mcp.html +1 -1
  57. package/docs-site/en/permissions.html +1 -1
  58. package/docs-site/en/profiles.html +1 -1
  59. package/docs-site/en/quickstart.html +1 -1
  60. package/docs-site/en/runtime.html +1 -1
  61. package/docs-site/en/scope.html +1 -1
  62. package/docs-site/en/security.html +1 -1
  63. package/docs-site/en/team.html +1 -1
  64. package/docs-site/en/whats-new.html +1 -1
  65. package/docs-site/en/workflows.html +1 -1
  66. package/docs-site/index.html +1 -1
  67. package/docs-site/mcp-approval.html +1 -1
  68. package/docs-site/mcp-auth.html +1 -1
  69. package/docs-site/mcp-servers.html +1 -1
  70. package/docs-site/mcp.html +1 -1
  71. package/docs-site/permissions.html +1 -1
  72. package/docs-site/profiles.html +1 -1
  73. package/docs-site/quickstart.html +1 -1
  74. package/docs-site/runtime.html +1 -1
  75. package/docs-site/scope.html +1 -1
  76. package/docs-site/security.html +1 -1
  77. package/docs-site/team.html +1 -1
  78. package/docs-site/whats-new.html +1 -1
  79. package/docs-site/workflows.html +1 -1
  80. package/evals/fixtures/benchmark-assurance-evidence.invalid.json +1 -1
  81. package/evals/fixtures/benchmark-assurance-evidence.valid.json +1 -1
  82. package/evals/fixtures/piagent-webui/session-live-state-v1.invalid.json +18 -0
  83. package/evals/fixtures/piagent-webui/session-live-state-v1.valid.json +27 -0
  84. package/evals/fs4-readiness-matrix.v1.json +2 -2
  85. package/evals/fs5-causal-arm.v1.json +2 -2
  86. package/evals/fs5-pilot-protocol.v1.json +2 -2
  87. package/evals/fs5-pilot-protocol.v4.json +6 -5
  88. package/evals/fs5-pilot-protocol.v5.json +7 -6
  89. package/evals/private-holdout-v1/public-exposure.v1.json +1 -1
  90. package/package.json +3 -1
  91. package/packages/piagent-core/benchmark/benchmark-assurance.js +4 -1
  92. package/packages/piagent-core/benchmark/benchmark-bootstrap.js +91 -9
  93. package/packages/piagent-core/benchmark/benchmark-claim-restrictions.js +38 -7
  94. package/packages/piagent-core/benchmark/benchmark-cli.js +7 -7
  95. package/packages/piagent-core/benchmark/benchmark-codex.js +3 -1
  96. package/packages/piagent-core/benchmark/benchmark-comparison.js +271 -2
  97. package/packages/piagent-core/benchmark/benchmark-core.js +732 -661
  98. package/packages/piagent-core/benchmark/benchmark-execution-guard.js +7 -5
  99. package/packages/piagent-core/benchmark/benchmark-forensics.js +439 -4
  100. package/packages/piagent-core/benchmark/benchmark-host-readiness.js +639 -0
  101. package/packages/piagent-core/benchmark/benchmark-matrix.js +22 -4
  102. package/packages/piagent-core/benchmark/benchmark-normalized-cost.js +317 -0
  103. package/packages/piagent-core/benchmark/benchmark-preflight.js +3 -1
  104. package/packages/piagent-core/benchmark/benchmark-process.js +6 -5
  105. package/packages/piagent-core/benchmark/benchmark-provider-wire.js +126 -0
  106. package/packages/piagent-core/benchmark/benchmark-record-validation.js +183 -0
  107. package/packages/piagent-core/benchmark/benchmark-report.js +116 -12
  108. package/packages/piagent-core/benchmark/benchmark-resume-recovery.js +14 -0
  109. package/packages/piagent-core/benchmark/benchmark-runner-policy.js +26 -0
  110. package/packages/piagent-core/benchmark/benchmark-stage-diagnostic.js +782 -0
  111. package/packages/piagent-core/benchmark/benchmark-statistics.js +64 -0
  112. package/packages/piagent-core/benchmark/benchmark-stop-policy.js +8 -5
  113. package/packages/piagent-core/benchmark/benchmark-suite-identity.js +31 -0
  114. package/packages/piagent-core/benchmark/benchmark-suite-runtime.js +13 -9
  115. package/packages/piagent-core/benchmark/benchmark-suite.js +128 -2
  116. package/packages/piagent-core/benchmark/benchmark-summary-support.js +376 -0
  117. package/packages/piagent-core/benchmark/benchmark-timing-diagnostics.js +971 -0
  118. package/packages/piagent-core/benchmark/benchmark-usage.js +311 -0
  119. package/packages/piagent-core/benchmark/benchmark-workflow.js +166 -0
  120. package/packages/piagent-core/docs/context-efficiency-improvement-plan.md +1080 -0
  121. package/packages/piagent-core/extensions/acceptance-contract-semantics.js +83 -69
  122. package/packages/piagent-core/extensions/acceptance-error-classes.js +160 -0
  123. package/packages/piagent-core/extensions/acceptance-executable-evidence.js +12 -9
  124. package/packages/piagent-core/extensions/acceptance-receipt.js +34 -11
  125. package/packages/piagent-core/extensions/acceptance-state-machine-evidence.js +518 -0
  126. package/packages/piagent-core/extensions/acceptance-test-binding-evidence.js +60 -0
  127. package/packages/piagent-core/extensions/context-efficiency-metrics.js +302 -0
  128. package/packages/piagent-core/extensions/context-efficiency-report.js +167 -0
  129. package/packages/piagent-core/extensions/context-engine.js +148 -145
  130. package/packages/piagent-core/extensions/context-evidence.js +48 -0
  131. package/packages/piagent-core/extensions/context-import-links.js +296 -0
  132. package/packages/piagent-core/extensions/context-telemetry-integrity.js +65 -0
  133. package/packages/piagent-core/extensions/criterion-context-pack.js +422 -7
  134. package/packages/piagent-core/extensions/criterion-graph.js +78 -8
  135. package/packages/piagent-core/extensions/guard-types.ts +2 -0
  136. package/packages/piagent-core/extensions/javascript-regex-evidence.js +32 -0
  137. package/packages/piagent-core/extensions/piagent-guard.ts +233 -41
  138. package/packages/piagent-core/extensions/task-contract-view.js +17 -3
  139. package/packages/piagent-core/extensions/task-lifecycle.js +7 -2
  140. package/packages/piagent-core/extensions/task-state.js +40 -134
  141. package/packages/piagent-core/extensions/verification-intelligence.js +3 -1
  142. package/packages/piagent-core/extensions/workspace-evidence-roots.js +157 -0
  143. package/packages/piagent-core/package.json +1 -1
  144. package/packages/piagent-core/policies/base-policy.json +2 -0
  145. package/packages/piagent-core/runtime/context/context-delivery.ts +103 -0
  146. package/packages/piagent-core/runtime/context/context-delta-shadow.ts +53 -0
  147. package/packages/piagent-core/runtime/context/context-efficiency-format.ts +47 -0
  148. package/packages/piagent-core/runtime/context/context-evidence-qualification.ts +32 -0
  149. package/packages/piagent-core/runtime/context/prefix-telemetry.ts +47 -0
  150. package/packages/piagent-core/runtime/context/repository-memory-hints.ts +27 -0
  151. package/packages/piagent-core/runtime/hooks/agent-prompt-telemetry.ts +56 -0
  152. package/packages/piagent-core/runtime/hooks/agent-start-hook.ts +162 -102
  153. package/packages/piagent-core/runtime/hooks/completion-hook.ts +5 -6
  154. package/packages/piagent-core/runtime/hooks/input-hook.ts +11 -1
  155. package/packages/piagent-core/runtime/hooks/session-hooks.ts +22 -2
  156. package/packages/piagent-core/runtime/hooks/session-start-hook.ts +7 -2
  157. package/packages/piagent-core/runtime/hooks/tool-result-content-guards.ts +95 -0
  158. package/packages/piagent-core/runtime/hooks/tool-result-hook.ts +84 -102
  159. package/packages/piagent-core/runtime/inspection/activity-event-adapter.ts +4 -2
  160. package/packages/piagent-core/runtime/inspection/activity-recovery.ts +104 -0
  161. package/packages/piagent-core/runtime/inspection/task-compaction-history.ts +1 -1
  162. package/packages/piagent-core/runtime/inspection/task-handoff-history.ts +1 -1
  163. package/packages/piagent-core/runtime/inspection/tool-failure-classification.ts +53 -0
  164. package/packages/piagent-core/runtime/inspection/webui-snapshot.ts +34 -6
  165. package/packages/piagent-core/runtime/model/authenticated-catalog.ts +17 -9
  166. package/packages/piagent-core/runtime/model/openai-codex-reasoning.ts +83 -0
  167. package/packages/piagent-core/runtime/model/provider-wire-fingerprint.ts +238 -0
  168. package/packages/piagent-core/runtime/orchestration/role-policy.ts +1 -1
  169. package/packages/piagent-core/runtime/product/activity-inspector.ts +7 -2
  170. package/packages/piagent-core/runtime/product/efficiency-metrics.ts +4 -2
  171. package/packages/piagent-core/runtime/quality/exact-output-contract.ts +2 -1
  172. package/packages/piagent-core/runtime/quality/performance-assurance-signals.ts +23 -0
  173. package/packages/piagent-core/runtime/quality/performance-assurance.ts +6 -2
  174. package/packages/piagent-core/runtime/recovery/edit-recovery-context.ts +113 -0
  175. package/packages/piagent-core/runtime/recovery/edit-recovery-delivery.ts +42 -0
  176. package/packages/piagent-core/runtime/recovery/semantic-repair-handshake.ts +55 -2
  177. package/packages/piagent-core/runtime/recovery/semantic-repair-runtime.ts +55 -2
  178. package/packages/piagent-core/runtime/registration/context-commands.ts +66 -5
  179. package/packages/piagent-core/runtime/registration/policy-tools.ts +46 -11
  180. package/packages/piagent-core/runtime/registration/task-completion-tools.ts +49 -16
  181. package/packages/piagent-core/runtime/registration/task-start-guidance.ts +163 -0
  182. package/packages/piagent-core/runtime/registration/task-start-retry-helpers.ts +37 -0
  183. package/packages/piagent-core/runtime/registration/task-start-tool.ts +67 -62
  184. package/packages/piagent-core/runtime/session/runtime-state.ts +154 -2
  185. package/packages/piagent-core/runtime/session/system-prompt.ts +4 -4
  186. package/packages/piagent-core/runtime/tools/apply-patch-tool.ts +500 -0
  187. package/packages/piagent-core/runtime/trajectory/trajectory-runtime.ts +2 -1
  188. package/packages/piagent-core/runtime/workflows/task-intake.ts +43 -2
  189. package/packages/piagent-core/security/sensitive-data.js +13 -218
  190. package/packages/piagent-core/security/sensitive-project-file.js +42 -0
  191. package/packages/piagent-core/security/sensitive-source-expression.js +330 -0
  192. package/packages/piagent-core/security/sensitive-source-formats.js +394 -0
  193. package/packages/piagent-core/security/sensitive-text.js +234 -0
  194. package/packages/piagent-core/subagents/piagent-worker.md +1 -1
  195. package/packages/piagent-webui/dist/client/assets/{MarkdownMessage-rD9WJKxs.js → MarkdownMessage-CxeZqTte.js} +1 -1
  196. package/packages/piagent-webui/dist/client/assets/index-DynIMe8I.js +176 -0
  197. package/packages/piagent-webui/dist/client/index.html +1 -1
  198. package/packages/piagent-webui/gateway/gateway-events.ts +109 -5
  199. package/packages/piagent-webui/gateway/gateway-service.ts +3 -0
  200. package/packages/piagent-webui/gateway/gateway-session-stream.ts +93 -7
  201. package/packages/piagent-webui/gateway/session-command-controller.ts +18 -3
  202. package/packages/piagent-webui/gateway/session-effective-options.ts +47 -0
  203. package/packages/piagent-webui/gateway/session-live-state.ts +21 -0
  204. package/packages/piagent-webui/gateway/session-operation-start.ts +5 -1
  205. package/packages/piagent-webui/gateway/session-operation-watchdog.ts +158 -0
  206. package/packages/piagent-webui/gateway/session-runtime-factory.ts +45 -0
  207. package/packages/piagent-webui/gateway/session-runtime-supervisor.ts +139 -124
  208. package/packages/piagent-webui/server/loopback-server.ts +8 -0
  209. package/packages/piagent-webui/server/transcript-projection.ts +22 -4
  210. package/packages/piagent-webui/shared/text-visibility.ts +10 -0
  211. package/schemas/piagent-webui/catalog-v1.json +9 -0
  212. package/schemas/piagent-webui/gateway-protocol-v1.schema.json +53 -3
  213. package/schemas/piagent-webui/session-live-state-v1.schema.json +76 -0
  214. package/schemas/task-contract.schema.json +12 -1
  215. package/scripts/benchmark-runner-core.mjs +355 -359
  216. package/scripts/benchmark-runner-finalization.mjs +309 -0
  217. package/scripts/benchmark-runner-host-readiness.mjs +94 -0
  218. package/scripts/benchmark-runner-support.mjs +200 -0
  219. package/scripts/benchmark-session.mjs +95 -41
  220. package/scripts/configure-model-scope.sh +4 -3
  221. package/scripts/helper-evaluation.mjs +1 -1
  222. package/scripts/install-global.sh +2 -2
  223. package/scripts/pi-usage-history.mjs +37 -10
  224. package/scripts/setup.sh +2 -2
  225. package/scripts/verify-local.sh +5 -1
  226. package/templates/global/settings.json +2 -1
  227. package/packages/piagent-webui/dist/client/assets/index-BZRFw1u6.js +0 -174
package/CHANGELOG.md CHANGED
@@ -4,6 +4,123 @@ This file records release-facing changes for Pi Agent Platform. Copy the relevan
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## v1.6.0 - 2026-08-24
8
+
9
+ ### Context efficiency and source safety
10
+
11
+ - Replaced overlapping automatic discovery and criterion snapshots with one
12
+ criterion-aware initial pack. It prioritizes explicit targets and their
13
+ linked tests, excludes unrelated graph-only files, uses bounded snippets for
14
+ large files and records content/payload receipts for every injected item.
15
+ - Corrected context-efficiency accounting so exact repeated reads are measured
16
+ only within a session/task/model/thinking partition, missing evidence remains
17
+ visible as unavailable, fallback rereads do not reward retrieval ranking, and
18
+ tool-schema share is reported against the complete system-plus-tool prefix.
19
+ Duplicate-output and retrieval-confidence rates now exclude unclassified
20
+ historical rows and expose their partial coverage instead of treating them
21
+ as zero waste. The aggregate context-waste score is now `null` unless every
22
+ weighted telemetry lane is complete; partial data is labeled only as a
23
+ diagnostic estimate.
24
+ - Sanitized automatic source snapshots before provider injection while
25
+ preserving pure dynamic credential references. Sensitive literals, including
26
+ short values and numeric fallbacks, are redacted in common source syntax and
27
+ structured YAML, XML, HTML, CSS and Objective-C inputs with line-count-
28
+ preserving receipts. A redacted item retains only a digest of the sanitized
29
+ text; neither the raw-content digest nor another guessable verifier for the
30
+ original bytes is persisted. Sanitization of deeply nested calls is bounded.
31
+ - Preserved one planned criterion source and its focused test when retrieval is
32
+ unavailable or stale, and retained complete per-item receipts for automatic,
33
+ command and tool-delivered context packs.
34
+ - Cleared task identity, repeated-result state and pending context delivery at
35
+ terminal boundaries while preserving terminal-turn usage attribution. A new
36
+ request or workflow in the same session now starts clean, including after a
37
+ missing binding or terminal session restart.
38
+
39
+ ### Forty-percent benchmark contract and spend control
40
+
41
+ - Raised the canonical production-v1 contract to require a fixed-workload,
42
+ family-clustered fresh-token upper-95 ratio at or below `0.60`. The estimator
43
+ includes all three predeclared attempts per surface in every family, including
44
+ exact provider-started failed-attempt usage, and does not condition token
45
+ measurement on task outcome. Every declared scenario/repeat must still have
46
+ an exact finite grade pair with no Piagent quality regression, and all Piagent
47
+ sessions must satisfy the independent continuity gates.
48
+ - Added a separate GPT-5.6 Luna API-equivalent text-token cost diagnostic. It
49
+ prices exact text-token buckets, remains distinct from OAuth/provider billing,
50
+ and does not block the token-focused production claim.
51
+ - Added duration comparison globally, by workload band and by family as
52
+ observational evidence. The canonical contract allows Piagent to be slower
53
+ when fresh-token, paired-intelligence and task-continuity gates still pass.
54
+ - Froze production-v1 to Luna Medium and a ledger-bound S0/12/36/72/108 spend
55
+ sequence. Only S108 is claim-eligible; every earlier pause recomputes a
56
+ provider-free diagnostic and prints the exact bounded resume command.
57
+ - Bound seed, surfaces, model, thinking, repeats, zero retries, paired terminal
58
+ stop and clean source identity before paid work. Reserved built-in suite IDs
59
+ cannot be impersonated by external suites, including through direct report
60
+ summarization.
61
+ - Added a privacy-safe causal context receipt for every Piagent measurement.
62
+ The receipt binds telemetry provenance, current prompt/terminal order and the
63
+ exact offer/delivery/injection lifecycle before dropping paths, hashes and
64
+ identifiers. Missing, malformed, orphaned or mismatched evidence preserves
65
+ the paid ledger row but blocks S12 advancement and the final token claim.
66
+ S12 now reports aggregate pack tokens, zero-selection reasons, managed-prefix
67
+ compaction, successful direct fallback reads and shell-call exposure.
68
+ - Reconstructs a missing terminal stop from the accepted ledger before any paid
69
+ resume, so a crash between the durable append and stop marker cannot spend the
70
+ rest of an authorized window.
71
+ - Finalizes a complete ledger or valid final post-guard WAL without live auth,
72
+ provider preflight or installed Pi/Codex executables. Finalization rehashes the
73
+ current candidate, suite, runtime-dependency tree and ledger while reusing the
74
+ frozen command/auth/preflight identities bound to the accepted measurements.
75
+ - Preserved the completed 108-session r3 ledger as observational evidence under
76
+ its original successful-pair contract. It is not retroactively promoted: only
77
+ a new provider run on the exact final candidate, after this estimand and suite
78
+ digest are frozen, can approve a 40% claim.
79
+
80
+ ### Runtime intelligence and context integrity
81
+
82
+ - Bound context evidence to the exact turn, session and task run that observed
83
+ it. Planning selections no longer masquerade as delivered context, and stale
84
+ evidence cannot cross a task boundary or complete a later task.
85
+ - Added bounded context-efficiency telemetry, delivery qualification, prefix
86
+ accounting and provider-wire fingerprints without exposing prompts,
87
+ credentials or raw provider payloads.
88
+ - Preserved authenticated Codex model identifiers and supported reasoning
89
+ levels end to end. New installations default visibly to GPT-5.6 Sol with
90
+ High thinking while still allowing the user to choose another available
91
+ model for any message or session.
92
+ - Added one fail-closed CAP-12 correction after a current exact verifier when
93
+ the model discovers an omission in a file it already authored in the same
94
+ task/run/session. The runtime opens repair only after an exact structured
95
+ mutation succeeds, permits no second source edit, and requires the exact
96
+ verifier again before completion.
97
+
98
+ ### WebUI continuity and operator clarity
99
+
100
+ - Added a canonical live-state bootstrap and replay-gap recovery path so reloads
101
+ and multiple browser tabs agree on the running operation before reporting the
102
+ Gateway as live.
103
+ - Added inactivity, absolute-runtime, termination and projection watchdogs.
104
+ Concurrent Stop requests share one termination, and uncertain ownership is
105
+ quarantined instead of being projected as an idle session.
106
+ - Kept the conversation surface success-only: drafts, tool failures, retries,
107
+ completion-gate work in progress and abort details stay in Activity. Empty or
108
+ non-rendering provider output can no longer create a blank success bubble.
109
+ - Made operation settlement first-terminal-wins and retained recent failures
110
+ independently from high-volume event traffic, preventing a retry or catalog
111
+ refresh from presenting contradictory outcomes.
112
+
113
+ ### Deeper benchmark and assurance contracts
114
+
115
+ - Expanded the deep-logic benchmark with a multi-package temporal billing close
116
+ problem, stricter held-out variants, provider-wire checks, usage provenance,
117
+ statistical comparison gates and explicit Codex CLI controls.
118
+ - Hardened benchmark accounting so unknown usage, infrastructure retries or an
119
+ unmatched provider attempt cannot support a token or production claim.
120
+ - A provider-backed token-reduction claim is published only when a complete
121
+ zero-retry 108-session run passes on the exact clean tagged candidate. An
122
+ interrupted, historical or different-SHA run remains diagnostic evidence.
123
+
7
124
  ## v1.5.5 - 2026-08-21
8
125
 
9
126
  ### WebUI command execution hotfix
package/README.md CHANGED
@@ -112,12 +112,13 @@ Removal targets what is registered in Pi's settings rather than what the current
112
112
  data, platform, reliability, and security. It compares Piagent with Raw Pi or
113
113
  controlled `codex-cli`, grades hidden acceptance/safety/workflow evidence,
114
114
  reports category/lifecycle/profile bands and 95% token-ratio confidence, and
115
- reads exact JSONL usage plus privacy-safe tool histograms. Production runs
116
- retry only zero-usage startup failures and disclose every retry separately.
117
- - `deep-logic-v1` adds six large, generated-variant families for interacting
118
- state, orchestration, policy, context-graph, stream-recovery, and
119
- transactional-config invariants. It keeps the current Pi model by default
120
- and uses two repeats (24 paired sessions). A separate provider-free WebUI
115
+ reads exact JSONL usage plus privacy-safe tool histograms. Production claims
116
+ require zero retries; diagnostic retry overrides remain visible and fail the gate.
117
+ - `deep-logic-v1` adds seven large, generated-variant families for interacting
118
+ state, orchestration, policy, context-graph, stream-recovery,
119
+ transactional-config, and exact temporal-billing invariants. It locks
120
+ Piagent/`codex-cli` to Luna/medium and uses three repeats (42 paired sessions) with token, duration,
121
+ full-suite, and zero-retry gates. A separate provider-free WebUI
121
122
  parity gate proves the 10 workflow and 32 runtime-control paths before any
122
123
  model quota is used.
123
124
  - The v1.2.12 production snapshot resolved 54/54 Piagent tasks, scored 10.00 for
@@ -137,7 +138,7 @@ Project profiles can declare a runtime `permissionProfile`:
137
138
 
138
139
  | Profile | Use when | Guard behavior |
139
140
  |---|---|---|
140
- | `read-only` | Scout, audit, review | Allows `read`, `grep`, `find`, `ls`, and piagent state tools; blocks shell, write/edit, and unknown tools. |
141
+ | `read-only` | Scout, audit, review | Allows `read`, `grep`, `find`, `ls`, and piagent state tools; blocks shell, `write`/`edit`/`apply_patch`, and unknown tools. |
141
142
  | `workspace-write` | Normal implementation | Default profile. Keeps current protected-path, shell, capability, task, and verify gates. |
142
143
  | `trusted-full-access` | Trusted local automation | Expands workspace tool/scope autonomy, but still enforces protected paths, secret redaction, capability lock integrity, and destructive/external confirmation. |
143
144
 
@@ -359,7 +360,7 @@ This repository intentionally excludes:
359
360
 
360
361
  ## Maturity
361
362
 
362
- The current package version is read from package metadata and release tags. Personal machines may follow the unpinned package source when accepting ongoing updates; production/team quickstarts and committed project settings should pin an explicit tag such as `v1.5.5` or a reviewed commit.
363
+ The current package version is read from package metadata and release tags. Personal machines may follow the unpinned package source when accepting ongoing updates; production/team quickstarts and committed project settings should pin an explicit tag such as `v1.6.0` or a reviewed commit.
363
364
 
364
365
  Ready for:
365
366
 
package/README.vi.md CHANGED
@@ -29,6 +29,7 @@ Trong session Pi đầu tiên của project, chạy `/onboard`. Hằng ngày, d
29
29
  - Mỗi task dùng một session có tên rõ ràng.
30
30
  - Slash command chỉ chạy handler đã đăng ký; agent không phải scout lại command.
31
31
  - Prompt hướng dẫn model, còn policy quan trọng được enforce tại runtime.
32
+ - Permission `read-only` chỉ cho phép kiểm tra; shell và các tool ghi `write`/`edit`/`apply_patch` đều bị chặn.
32
33
  - MCP config không chứa token hoặc OAuth credential.
33
34
  - Task source-changing cần scope, verify evidence và final gate.
34
35
  - Local state nằm trong `.pi/piagent-state/`, có owner-only permission và bounded retention.
@@ -157,14 +158,17 @@ npm run benchmark:deep -- --dry-run
157
158
  npm run benchmark:deep
158
159
  ```
159
160
 
160
- `deep-logic-v1` có 6 scenario difficulty `large`, 2 repeat và 2 surface (24
161
- model session), phủ event reconciliation, fair dependency scheduling, layered
162
- policy, graph-aware context, resumable stream và transactional config. `--dry-run`
163
- chỉ validate kế hoạch, không dùng quota.
161
+ `deep-logic-v1` có 7 scenario difficulty `large`, khóa Piagent/`codex-cli` ở
162
+ Luna/medium và chạy 3 repeat trên 2 surface (42 model session). Suite phủ event
163
+ reconciliation, fair dependency scheduling, layered policy, graph-aware context,
164
+ resumable stream, transactional config và temporal usage billing chính xác; claim chỉ được phép khi đủ full suite,
165
+ token và duration gate, đồng thời không có retry. Retry diagnostic vẫn được ghi
166
+ rõ nhưng làm release gate fail. `--dry-run` chỉ validate kế hoạch, không dùng
167
+ quota.
164
168
 
165
169
  Gate này chạy architecture check, test, typecheck, capability validation, runtime smoke và docs consistency trước khi release.
166
170
 
167
- Bản phát hành hiện tại là `v1.5.5`. Với team hoặc production, hãy pin tag này
171
+ Bản phát hành hiện tại là `v1.6.0`. Với team hoặc production, hãy pin tag này
168
172
  hoặc một commit đã review thay vì dựa vào nguồn package không cố định.
169
173
 
170
174
  ## Security
@@ -42,12 +42,10 @@
42
42
  "test -s README.md"
43
43
  ],
44
44
  "source": [
45
- "npm run type-check",
46
- "npm run lint",
47
- "npm test"
45
+ "node -e \"const s=require('./package.json').scripts||{}; const n=['type-check','typecheck','lint','test']; if(!n.some(k=>s[k])){console.error('No Node source verifier is configured');process.exit(2)}\" && npm run type-check --if-present && npm run typecheck --if-present && npm run lint --if-present && npm test --if-present"
48
46
  ],
49
47
  "runtime": [
50
- "npm run test:e2e"
48
+ "node -e \"const s=require('./package.json').scripts||{}; if(!s['test:e2e']){console.error('No web frontend runtime verifier is configured');process.exit(2)}\" && npm run test:e2e"
51
49
  ]
52
50
  },
53
51
  "mcpCapabilities": [
@@ -79,6 +79,12 @@
79
79
  "packages/piagent-webui/ownership"
80
80
  ]
81
81
  },
82
+ {
83
+ "name": "webui-shared",
84
+ "roots": [
85
+ "packages/piagent-webui/shared"
86
+ ]
87
+ },
82
88
  {
83
89
  "name": "webui-build",
84
90
  "roots": [
@@ -133,11 +139,13 @@
133
139
  ],
134
140
  "webui-client": [
135
141
  "webui-client",
136
- "webui-contracts"
142
+ "webui-contracts",
143
+ "webui-shared"
137
144
  ],
138
145
  "webui-server": [
139
146
  "webui-server",
140
147
  "webui-contracts",
148
+ "webui-shared",
141
149
  "runtime",
142
150
  "core",
143
151
  "security",
@@ -156,6 +164,7 @@
156
164
  "webui-ownership",
157
165
  "webui-server",
158
166
  "webui-contracts",
167
+ "webui-shared",
159
168
  "runtime",
160
169
  "core",
161
170
  "security"
@@ -163,13 +172,17 @@
163
172
  "webui-ownership": [
164
173
  "webui-ownership"
165
174
  ],
175
+ "webui-shared": [
176
+ "webui-shared"
177
+ ],
166
178
  "webui-build": [
167
179
  "webui-build",
168
180
  "webui-contracts",
169
181
  "webui-client",
170
182
  "webui-server",
171
183
  "webui-gateway",
172
- "webui-ownership"
184
+ "webui-ownership",
185
+ "webui-shared"
173
186
  ],
174
187
  "entrypoints": [
175
188
  "entrypoints",
@@ -181,7 +194,8 @@
181
194
  "benchmark",
182
195
  "webui-gateway",
183
196
  "webui-ownership",
184
- "webui-server"
197
+ "webui-server",
198
+ "webui-shared"
185
199
  ]
186
200
  },
187
201
  "lineBudgets": {
@@ -199,6 +213,7 @@
199
213
  "webui-extension": 500,
200
214
  "webui-gateway": 500,
201
215
  "webui-ownership": 500,
216
+ "webui-shared": 200,
202
217
  "webui-build": 500,
203
218
  "entrypoints": 800
204
219
  },
@@ -0,0 +1,122 @@
1
+ # Deep Logic Specialist Protocol
2
+
3
+ ## Mục tiêu
4
+
5
+ `deep-logic-v1` là benchmark paired giữa Piagent và Codex CLI cho cùng model,
6
+ cùng effort, cùng fixture và cùng hidden variant. Suite dùng để đo ba điều cùng
7
+ lúc:
8
+
9
+ 1. logic cuối cùng phải đúng và không giảm so với baseline;
10
+ 2. tiến trình phải ổn định, không retry/unknown usage;
11
+ 3. Piagent chỉ được nhận lợi thế khi dùng ít fresh token hơn.
12
+
13
+ Benchmark không so với Raw Pi. Raw Pi chỉ là diagnostic ablation và không đủ
14
+ điều kiện tạo token-saving claim cho sản phẩm.
15
+
16
+ ## Execution contract cố định
17
+
18
+ | Thuộc tính | Giá trị bắt buộc |
19
+ |---|---|
20
+ | Candidate | `piagent` |
21
+ | Baseline | controlled `codex-cli` |
22
+ | Model | `openai-codex/gpt-5.6-luna` |
23
+ | Thinking | `medium` |
24
+ | Codex mode | `controlled` |
25
+ | Repeat | 3 mỗi family |
26
+ | Family | 7 |
27
+ | Tổng model session | 42 |
28
+ | Infrastructure retry | 0 |
29
+ | Timeout | 1.200 giây/session |
30
+
31
+ Suite từ chối model, thinking, surface hoặc Codex mode khác trước khi gọi
32
+ provider. Chạy chọn lẻ scenario chỉ dùng để chẩn đoán; không đủ full-suite claim.
33
+
34
+ ## Specialist family mới
35
+
36
+ `temporal-usage-billing-close` mô phỏng đóng kỳ cước usage thật, trải qua ba
37
+ module backend/UI. Nó buộc solver xử lý đồng thời:
38
+
39
+ - plan có hiệu lực theo timeline và boundary half-open;
40
+ - tier lũy tiến, reset đúng lúc đổi plan, cô lập tenant/meter;
41
+ - reversal độc lập thứ tự input và chống double/forward reversal;
42
+ - phép nhân/sum bằng `BigInt`, không mất chính xác trên `2^53`;
43
+ - round-half-to-even đúng một lần khi đóng invoice;
44
+ - canonical JSON và SHA-256 audit digest cho nested allocation;
45
+ - output Terminal/WebUI giống nhau;
46
+ - validation fail-closed, chống prototype pollution và không mutate input.
47
+
48
+ Hidden grader có 14 nhóm kiểm tra hành vi:
49
+
50
+ 1. period và timeline normalization;
51
+ 2. timeline validation fail-closed;
52
+ 3. exact tier boundary và một event đi qua nhiều tier;
53
+ 4. plan boundary và tier reset;
54
+ 5. tenant/meter isolation;
55
+ 6. reversal trước rating;
56
+ 7. reversal reference/tenant/time/cardinality;
57
+ 8. permutation-independent canonical output;
58
+ 9. `BigInt` exactness;
59
+ 10. round-half-to-even;
60
+ 11. invoice total, shape và nested digest;
61
+ 12. event validation và deep immutability;
62
+ 13. non-JSON/poison rejection;
63
+ 14. Terminal/WebUI summary parity.
64
+
65
+ Variant riêng cho từng repeat thay tenant, meter, plan id, tier boundary và
66
+ price. Grader kiểm tra hành vi, không kiểm tra regex/source shape.
67
+
68
+ ## Token accounting
69
+
70
+ Mỗi accepted hoặc failed attempt ghi các trường sau:
71
+
72
+ | Trường | Ý nghĩa |
73
+ |---|---|
74
+ | `input` | fresh input, đã loại cache read và cache write |
75
+ | `output` | toàn bộ output của provider |
76
+ | `reasoning` | phần nằm trong `output`, không cộng lần hai |
77
+ | `cacheRead` | input lấy từ provider cache |
78
+ | `cacheWrite` | input ghi vào provider cache |
79
+ | `fresh` | `input + output`, dùng làm tỷ lệ claim |
80
+ | `total` | `input + cacheRead + cacheWrite + output` |
81
+
82
+ Nguồn đo phải là `pi-session-jsonl` hoặc `codex-turn-completed`. Dòng JSON hỏng,
83
+ field token thiếu, tổng không khớp hoặc provider-started attempt không có usage
84
+ đều fail closed; số không biết dùng trạng thái unknown, không giả thành 0.
85
+
86
+ Report xuất:
87
+
88
+ - từng run: model, thinking, source, mọi token field, tool count và duration;
89
+ - median theo surface;
90
+ - tổng token accepted, failed và all attempts;
91
+ - exact/unknown attempt completeness;
92
+ - paired geometric-mean fresh-token ratio;
93
+ - 95% CI cluster theo scenario family, không giả repeat là family độc lập;
94
+ - failure-aware fresh tokens trên mỗi resolved outcome.
95
+
96
+ ## Gate
97
+
98
+ Piagent chỉ pass suite khi đồng thời:
99
+
100
+ - quality ≥ 9,5; safety = 10; reliability/workflow/category ≥ 9,5;
101
+ - mọi task/band score lớn hơn 9,5 và không có paired regression;
102
+ - đủ 7 family × 3 repeat trên cả hai surface;
103
+ - fresh-token ratio upper 95% CI ≤ 0,80;
104
+ - duration point ratio ≤ 1,00 và upper 95% CI ≤ 1,10;
105
+ - không retry, không unknown usage, provider-wire model/effort/prefix ổn định;
106
+ - source là exact clean Git commit.
107
+
108
+ ## Lệnh
109
+
110
+ Validate miễn phí, không gọi model:
111
+
112
+ ```bash
113
+ npm run benchmark:deep -- --dry-run
114
+ ```
115
+
116
+ Chạy paid benchmark đầy đủ sau khi operator xác nhận quota:
117
+
118
+ ```bash
119
+ npm run benchmark:deep
120
+ ```
121
+
122
+ Kết quả nằm trong `report.json`, `report.html`, `summary.txt` và `runs.jsonl`.