@piagent/platform 1.3.0 → 1.4.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 (304) hide show
  1. package/CHANGELOG.md +56 -3
  2. package/README.md +3 -3
  3. package/architecture/layers.json +96 -1
  4. package/docs/README.md +1 -0
  5. package/docs/architecture.md +1 -0
  6. package/docs/authority-manifest.md +1 -0
  7. package/docs/auto-delegation-policy.md +1 -0
  8. package/docs/capability-packs.md +10 -2
  9. package/docs/command-reference-vietnamese.md +5 -4
  10. package/docs/context-engine.md +1 -0
  11. package/docs/context-window-policy.md +1 -0
  12. package/docs/distribution-standard.md +8 -7
  13. package/docs/herdr-workflow.md +1 -0
  14. package/docs/mcp-and-tools.md +14 -9
  15. package/docs/memory-policy.md +1 -0
  16. package/docs/model-options.md +1 -0
  17. package/docs/oauth-providers.md +1 -0
  18. package/docs/operator-manual-vietnamese.md +15 -12
  19. package/docs/package-architecture-notes.md +1 -0
  20. package/docs/project-adapters.md +1 -0
  21. package/docs/project-onboarding.md +1 -0
  22. package/docs/publishing-for-teams.md +1 -0
  23. package/docs/quality-benchmark.md +1 -0
  24. package/docs/quickstart-vietnamese.md +3 -2
  25. package/docs/release-install-policy.md +11 -7
  26. package/docs/runtime-harness-standard.md +1 -0
  27. package/docs/runtime-policy-design.md +1 -0
  28. package/docs/runtime-quality-baseline.md +1 -0
  29. package/docs/security-redaction-benchmark.md +1 -0
  30. package/docs/security-threat-model.md +2 -1
  31. package/docs/subagent-orchestration-capabilities.md +1 -0
  32. package/docs/subagents-and-multiagent.md +1 -0
  33. package/docs/task-implementation-contract.md +1 -0
  34. package/docs/task-lifecycle-vietnamese.md +1 -0
  35. package/docs/team-onboarding.md +3 -2
  36. package/docs/third-party-neutrality.md +26 -0
  37. package/docs/usage-observability.md +1 -0
  38. package/docs/vercel-docs-site.md +1 -0
  39. package/docs/workflow-recipes.md +1 -0
  40. package/docs-site/architecture.html +1 -1
  41. package/docs-site/benchmark.html +1 -1
  42. package/docs-site/commands.html +1 -1
  43. package/docs-site/context-engine.html +1 -1
  44. package/docs-site/en/architecture.html +1 -1
  45. package/docs-site/en/benchmark.html +1 -1
  46. package/docs-site/en/commands.html +1 -1
  47. package/docs-site/en/context-engine.html +1 -1
  48. package/docs-site/en/index.html +1 -1
  49. package/docs-site/en/mcp-approval.html +1 -1
  50. package/docs-site/en/mcp-auth.html +1 -1
  51. package/docs-site/en/mcp-servers.html +1 -1
  52. package/docs-site/en/mcp.html +1 -1
  53. package/docs-site/en/permissions.html +1 -1
  54. package/docs-site/en/profiles.html +1 -1
  55. package/docs-site/en/quickstart.html +1 -1
  56. package/docs-site/en/runtime.html +1 -1
  57. package/docs-site/en/scope.html +1 -1
  58. package/docs-site/en/security.html +1 -1
  59. package/docs-site/en/team.html +1 -1
  60. package/docs-site/en/whats-new.html +1 -1
  61. package/docs-site/en/workflows.html +1 -1
  62. package/docs-site/index.html +1 -1
  63. package/docs-site/mcp-approval.html +1 -1
  64. package/docs-site/mcp-auth.html +1 -1
  65. package/docs-site/mcp-servers.html +1 -1
  66. package/docs-site/mcp.html +1 -1
  67. package/docs-site/permissions.html +1 -1
  68. package/docs-site/profiles.html +1 -1
  69. package/docs-site/quickstart.html +1 -1
  70. package/docs-site/runtime.html +1 -1
  71. package/docs-site/scope.html +1 -1
  72. package/docs-site/security.html +1 -1
  73. package/docs-site/team.html +1 -1
  74. package/docs-site/whats-new.html +1 -1
  75. package/docs-site/workflows.html +1 -1
  76. package/evals/fixtures/mutation-provenance-record.invalid.json +17 -0
  77. package/evals/fixtures/mutation-provenance-record.valid.json +27 -0
  78. package/evals/fixtures/piagent-webui/approval-v1.invalid.json +54 -0
  79. package/evals/fixtures/piagent-webui/approval-v1.valid.json +58 -0
  80. package/evals/fixtures/piagent-webui/attachment-v1.invalid.json +25 -0
  81. package/evals/fixtures/piagent-webui/attachment-v1.valid.json +25 -0
  82. package/evals/fixtures/piagent-webui/capabilities-v1.invalid.json +51 -0
  83. package/evals/fixtures/piagent-webui/capabilities-v1.valid.json +122 -0
  84. package/evals/fixtures/piagent-webui/commit-summary-v1.invalid.json +10 -0
  85. package/evals/fixtures/piagent-webui/commit-summary-v1.valid.json +25 -0
  86. package/evals/fixtures/piagent-webui/control-command-v1.invalid.json +37 -0
  87. package/evals/fixtures/piagent-webui/control-command-v1.valid.json +35 -0
  88. package/evals/fixtures/piagent-webui/diff-v1.invalid.json +13 -0
  89. package/evals/fixtures/piagent-webui/diff-v1.valid.json +141 -0
  90. package/evals/fixtures/piagent-webui/gateway-capabilities-v1.invalid.json +35 -0
  91. package/evals/fixtures/piagent-webui/gateway-capabilities-v1.valid.json +35 -0
  92. package/evals/fixtures/piagent-webui/gateway-protocol-v1.invalid.json +14 -0
  93. package/evals/fixtures/piagent-webui/gateway-protocol-v1.valid.json +14 -0
  94. package/evals/fixtures/piagent-webui/handoff-history-v1.invalid.json +16 -0
  95. package/evals/fixtures/piagent-webui/handoff-history-v1.valid.json +16 -0
  96. package/evals/fixtures/piagent-webui/model-catalog-v1.invalid.json +31 -0
  97. package/evals/fixtures/piagent-webui/model-catalog-v1.valid.json +43 -0
  98. package/evals/fixtures/piagent-webui/queue-v1.invalid.json +29 -0
  99. package/evals/fixtures/piagent-webui/queue-v1.valid.json +44 -0
  100. package/evals/fixtures/piagent-webui/recovery-history-v1.invalid.json +17 -0
  101. package/evals/fixtures/piagent-webui/recovery-history-v1.valid.json +20 -0
  102. package/evals/fixtures/piagent-webui/release-monitor-v1.invalid.json +12 -0
  103. package/evals/fixtures/piagent-webui/release-monitor-v1.valid.json +29 -0
  104. package/evals/fixtures/piagent-webui/review-state-v1.invalid.json +25 -0
  105. package/evals/fixtures/piagent-webui/review-state-v1.valid.json +38 -0
  106. package/evals/fixtures/piagent-webui/runtime-event-v2.invalid.json +49 -0
  107. package/evals/fixtures/piagent-webui/runtime-event-v2.valid.json +49 -0
  108. package/evals/fixtures/piagent-webui/session-catalog-v1.invalid.json +17 -0
  109. package/evals/fixtures/piagent-webui/session-catalog-v1.valid.json +58 -0
  110. package/evals/fixtures/piagent-webui/session-command-v1.invalid.json +19 -0
  111. package/evals/fixtures/piagent-webui/session-command-v1.valid.json +19 -0
  112. package/evals/fixtures/piagent-webui/snapshot-v1.invalid.json +5 -0
  113. package/evals/fixtures/piagent-webui/snapshot-v1.valid.json +191 -0
  114. package/evals/fixtures/piagent-webui/source-change-v1.invalid.json +57 -0
  115. package/evals/fixtures/piagent-webui/source-change-v1.valid.json +98 -0
  116. package/evals/fixtures/piagent-webui/source-mutation-v1.invalid.json +19 -0
  117. package/evals/fixtures/piagent-webui/source-mutation-v1.valid.json +38 -0
  118. package/evals/fixtures/piagent-webui/source-revert-v1.invalid.json +20 -0
  119. package/evals/fixtures/piagent-webui/source-revert-v1.valid.json +62 -0
  120. package/evals/fixtures/piagent-webui/subagent-tree-v1.invalid.json +26 -0
  121. package/evals/fixtures/piagent-webui/subagent-tree-v1.valid.json +39 -0
  122. package/evals/fixtures/piagent-webui/task-index-v1.invalid.json +15 -0
  123. package/evals/fixtures/piagent-webui/task-index-v1.valid.json +15 -0
  124. package/evals/fixtures/piagent-webui/task-timeline-v1.invalid.json +14 -0
  125. package/evals/fixtures/piagent-webui/task-timeline-v1.valid.json +16 -0
  126. package/evals/fixtures/piagent-webui/transcript-v1.invalid.json +35 -0
  127. package/evals/fixtures/piagent-webui/transcript-v1.valid.json +55 -0
  128. package/evals/fixtures/task-baseline-manifest.invalid.json +16 -0
  129. package/evals/fixtures/task-baseline-manifest.valid.json +41 -0
  130. package/evals/fixtures/verifier-file-snapshot.invalid.json +21 -0
  131. package/evals/fixtures/verifier-file-snapshot.valid.json +21 -0
  132. package/package.json +30 -3
  133. package/packages/piagent-core/benchmark/benchmark-candidate.d.ts +1 -0
  134. package/packages/piagent-core/benchmark/benchmark-forensics.d.ts +1 -0
  135. package/packages/piagent-core/benchmark/benchmark-ledger.d.ts +4 -0
  136. package/packages/piagent-core/benchmark/benchmark-record-validation.d.ts +1 -0
  137. package/packages/piagent-core/benchmark/benchmark-runtime.d.ts +1 -0
  138. package/packages/piagent-core/capabilities/capability-core.js +2 -2
  139. package/packages/piagent-core/capabilities/capability-verification-cache.js +280 -0
  140. package/packages/piagent-core/capabilities/runtime-integrity.js +153 -1
  141. package/packages/piagent-core/extensions/document-intake.ts +24 -10
  142. package/packages/piagent-core/extensions/piagent-guard.ts +90 -73
  143. package/packages/piagent-core/extensions/redaction-core.d.ts +2 -0
  144. package/packages/piagent-core/extensions/state-retention.js +77 -44
  145. package/packages/piagent-core/extensions/task-journal.js +30 -1
  146. package/packages/piagent-core/extensions/task-state.js +33 -36
  147. package/packages/piagent-core/mcp/mcp-server-catalog.js +5 -5
  148. package/packages/piagent-core/package.json +1 -1
  149. package/packages/piagent-core/runtime/hooks/session-start-hook.ts +2 -2
  150. package/packages/piagent-core/runtime/hooks/tool-call-hook.ts +5 -2
  151. package/packages/piagent-core/runtime/hooks/tool-result-hook.ts +20 -19
  152. package/packages/piagent-core/runtime/hooks/tool-result-metadata.ts +13 -0
  153. package/packages/piagent-core/runtime/input/chat-images.ts +2 -2
  154. package/packages/piagent-core/runtime/inspection/activity-event-adapter.ts +94 -0
  155. package/packages/piagent-core/runtime/inspection/approval-broker.ts +318 -0
  156. package/packages/piagent-core/runtime/inspection/commit-summary-projection.ts +59 -0
  157. package/packages/piagent-core/runtime/inspection/context-telemetry-inspection.ts +37 -0
  158. package/packages/piagent-core/runtime/inspection/criteria-links.ts +295 -0
  159. package/packages/piagent-core/runtime/inspection/diff-projection.ts +499 -0
  160. package/packages/piagent-core/runtime/inspection/git-filter-safety.ts +38 -0
  161. package/packages/piagent-core/runtime/inspection/git-numstat-adapter.ts +71 -0
  162. package/packages/piagent-core/runtime/inspection/git-status-adapter.ts +493 -0
  163. package/packages/piagent-core/runtime/inspection/git-tree-adapter.ts +108 -0
  164. package/packages/piagent-core/runtime/inspection/mcp-control.ts +10 -0
  165. package/packages/piagent-core/runtime/inspection/mutation-provenance-contract.ts +131 -0
  166. package/packages/piagent-core/runtime/inspection/mutation-provenance-recorder.ts +48 -0
  167. package/packages/piagent-core/runtime/inspection/mutation-provenance-store.ts +161 -0
  168. package/packages/piagent-core/runtime/inspection/project-runtime-inspection.ts +36 -0
  169. package/packages/piagent-core/runtime/inspection/review-state-contract.ts +108 -0
  170. package/packages/piagent-core/runtime/inspection/review-state-projection.ts +93 -0
  171. package/packages/piagent-core/runtime/inspection/review-state-store.ts +112 -0
  172. package/packages/piagent-core/runtime/inspection/runtime-event-store.ts +262 -0
  173. package/packages/piagent-core/runtime/inspection/same-process-bridge-proof.ts +103 -0
  174. package/packages/piagent-core/runtime/inspection/source-change-projection.ts +471 -0
  175. package/packages/piagent-core/runtime/inspection/source-evidence-contract.ts +139 -0
  176. package/packages/piagent-core/runtime/inspection/source-evidence-store.ts +315 -0
  177. package/packages/piagent-core/runtime/inspection/source-handoff-store.ts +70 -0
  178. package/packages/piagent-core/runtime/inspection/source-inspection-plan.ts +34 -0
  179. package/packages/piagent-core/runtime/inspection/source-mutation-projection.ts +164 -0
  180. package/packages/piagent-core/runtime/inspection/source-mutation-store.ts +168 -0
  181. package/packages/piagent-core/runtime/inspection/source-open-target.ts +38 -0
  182. package/packages/piagent-core/runtime/inspection/source-revert-projection.ts +147 -0
  183. package/packages/piagent-core/runtime/inspection/task-baseline-start-capture.ts +22 -0
  184. package/packages/piagent-core/runtime/inspection/task-compaction-history.ts +160 -0
  185. package/packages/piagent-core/runtime/inspection/task-control-journal.ts +131 -0
  186. package/packages/piagent-core/runtime/inspection/task-handoff-history.ts +95 -0
  187. package/packages/piagent-core/runtime/inspection/task-provenance-projection.ts +60 -0
  188. package/packages/piagent-core/runtime/inspection/task-recovery-timeline.ts +88 -0
  189. package/packages/piagent-core/runtime/inspection/task-run-index.ts +87 -0
  190. package/packages/piagent-core/runtime/inspection/task-source-projection.ts +401 -0
  191. package/packages/piagent-core/runtime/inspection/task-subagent-tree.ts +101 -0
  192. package/packages/piagent-core/runtime/inspection/text-diff.ts +60 -0
  193. package/packages/piagent-core/runtime/inspection/verifier-snapshot-contract.ts +114 -0
  194. package/packages/piagent-core/runtime/inspection/verifier-snapshot-store.ts +189 -0
  195. package/packages/piagent-core/runtime/inspection/webui-snapshot.ts +320 -0
  196. package/packages/piagent-core/runtime/inspection/workspace-file-reader.ts +132 -0
  197. package/packages/piagent-core/runtime/inspection/workspace-source-projection.ts +96 -0
  198. package/packages/piagent-core/runtime/inspection/zero-turn-conformance.ts +175 -0
  199. package/packages/piagent-core/runtime/orchestration/owned-work-budget.ts +68 -4
  200. package/packages/piagent-core/runtime/policy/source-index-transaction.ts +173 -0
  201. package/packages/piagent-core/runtime/policy/source-mutation-guard-binding.ts +42 -0
  202. package/packages/piagent-core/runtime/policy/source-mutation-guard.ts +184 -0
  203. package/packages/piagent-core/runtime/policy/source-worktree-transaction.ts +105 -0
  204. package/packages/piagent-core/runtime/product/activity-inspector-footer.ts +5 -3
  205. package/packages/piagent-core/runtime/product/activity-inspector.ts +85 -343
  206. package/packages/piagent-core/runtime/recovery/resume-state.ts +38 -1
  207. package/packages/piagent-core/runtime/registration/activity-inspector-command.ts +68 -14
  208. package/packages/piagent-core/runtime/registration/task-start-tool.ts +13 -14
  209. package/packages/piagent-core/runtime/session/model-authorship-state.ts +31 -3
  210. package/packages/piagent-core/runtime/session/runtime-state.ts +11 -1
  211. package/packages/piagent-webui/dist/client/assets/index-DjMntaK5.js +172 -0
  212. package/packages/piagent-webui/dist/client/assets/index-DwKCWbwd.css +1 -0
  213. package/packages/piagent-webui/dist/client/index.html +16 -0
  214. package/packages/piagent-webui/extension/attachment-store.ts +323 -0
  215. package/packages/piagent-webui/extension/held-message-queue.ts +311 -0
  216. package/packages/piagent-webui/extension/lifecycle-controller.ts +408 -0
  217. package/packages/piagent-webui/extension/lifecycle-event-adapter.ts +23 -0
  218. package/packages/piagent-webui/extension/piagent-webui.ts +470 -0
  219. package/packages/piagent-webui/extension/review-controller.ts +160 -0
  220. package/packages/piagent-webui/extension/same-session-bridge.ts +500 -0
  221. package/packages/piagent-webui/extension/session-options-controller.ts +281 -0
  222. package/packages/piagent-webui/extension/session-stream-adapter.ts +249 -0
  223. package/packages/piagent-webui/extension/source-mutation-controller.ts +215 -0
  224. package/packages/piagent-webui/extension/source-open-controller.ts +136 -0
  225. package/packages/piagent-webui/extension/source-revert-controller.ts +189 -0
  226. package/packages/piagent-webui/extension/terminal-session-adapter.ts +73 -0
  227. package/packages/piagent-webui/extension/vscode-handoff.ts +51 -0
  228. package/packages/piagent-webui/gateway/control-socket.ts +92 -0
  229. package/packages/piagent-webui/gateway/gateway-events.ts +60 -0
  230. package/packages/piagent-webui/gateway/gateway-protocol-service.ts +64 -0
  231. package/packages/piagent-webui/gateway/gateway-service.ts +215 -0
  232. package/packages/piagent-webui/gateway/gateway-session-stream.ts +110 -0
  233. package/packages/piagent-webui/gateway/mcp-auth-broker.ts +158 -0
  234. package/packages/piagent-webui/gateway/native-project-picker.ts +29 -0
  235. package/packages/piagent-webui/gateway/pi-host.ts +41 -0
  236. package/packages/piagent-webui/gateway/profile-state.ts +1 -0
  237. package/packages/piagent-webui/gateway/project-registry.ts +108 -0
  238. package/packages/piagent-webui/gateway/provider-auth-broker.ts +172 -0
  239. package/packages/piagent-webui/gateway/session-catalog.ts +128 -0
  240. package/packages/piagent-webui/gateway/session-command-controller.ts +237 -0
  241. package/packages/piagent-webui/gateway/session-command-store.ts +224 -0
  242. package/packages/piagent-webui/gateway/session-inspection-registry.ts +204 -0
  243. package/packages/piagent-webui/gateway/session-lease-store.ts +1 -0
  244. package/packages/piagent-webui/gateway/session-metadata-store.ts +152 -0
  245. package/packages/piagent-webui/gateway/session-runtime-supervisor.ts +485 -0
  246. package/packages/piagent-webui/ownership/gateway-runtime-context.ts +8 -0
  247. package/packages/piagent-webui/ownership/profile-state.ts +117 -0
  248. package/packages/piagent-webui/ownership/session-lease-store.ts +329 -0
  249. package/packages/piagent-webui/ownership/session-refs.ts +8 -0
  250. package/packages/piagent-webui/package.json +33 -0
  251. package/packages/piagent-webui/server/README.md +4 -0
  252. package/packages/piagent-webui/server/benchmark-release-monitor.ts +230 -0
  253. package/packages/piagent-webui/server/core-inspection-provider.ts +403 -0
  254. package/packages/piagent-webui/server/gateway-websocket.ts +143 -0
  255. package/packages/piagent-webui/server/http-security.ts +27 -0
  256. package/packages/piagent-webui/server/ipc-read-model-client.ts +89 -0
  257. package/packages/piagent-webui/server/loopback-server.ts +368 -0
  258. package/packages/piagent-webui/server/read-model-provider.ts +37 -0
  259. package/packages/piagent-webui/server/read-only-router.ts +105 -0
  260. package/packages/piagent-webui/server/session-auth.ts +88 -0
  261. package/packages/piagent-webui/server/sidecar-main.ts +86 -0
  262. package/packages/piagent-webui/server/sse-hub.ts +76 -0
  263. package/packages/piagent-webui/server/static-bundle.ts +40 -0
  264. package/packages/piagent-webui/server/transcript-projection.ts +110 -0
  265. package/schemas/mutation-provenance-record.schema.json +100 -0
  266. package/schemas/piagent-webui/approval-v1.schema.json +654 -0
  267. package/schemas/piagent-webui/attachment-v1.schema.json +267 -0
  268. package/schemas/piagent-webui/capabilities-v1.schema.json +729 -0
  269. package/schemas/piagent-webui/catalog-v1.json +240 -0
  270. package/schemas/piagent-webui/commit-summary-v1.schema.json +63 -0
  271. package/schemas/piagent-webui/common-v1.schema.json +479 -0
  272. package/schemas/piagent-webui/control-command-v1.schema.json +1780 -0
  273. package/schemas/piagent-webui/diff-v1.schema.json +826 -0
  274. package/schemas/piagent-webui/gateway-capabilities-v1.schema.json +136 -0
  275. package/schemas/piagent-webui/gateway-protocol-v1.schema.json +456 -0
  276. package/schemas/piagent-webui/handoff-history-v1.schema.json +92 -0
  277. package/schemas/piagent-webui/model-catalog-v1.schema.json +95 -0
  278. package/schemas/piagent-webui/queue-v1.schema.json +99 -0
  279. package/schemas/piagent-webui/recovery-history-v1.schema.json +144 -0
  280. package/schemas/piagent-webui/release-monitor-v1.schema.json +173 -0
  281. package/schemas/piagent-webui/review-state-v1.schema.json +206 -0
  282. package/schemas/piagent-webui/runtime-event-v2.schema.json +5206 -0
  283. package/schemas/piagent-webui/session-catalog-v1.schema.json +222 -0
  284. package/schemas/piagent-webui/session-command-v1.schema.json +390 -0
  285. package/schemas/piagent-webui/snapshot-v1.schema.json +2622 -0
  286. package/schemas/piagent-webui/source-change-v1.schema.json +763 -0
  287. package/schemas/piagent-webui/source-mutation-v1.schema.json +96 -0
  288. package/schemas/piagent-webui/source-revert-v1.schema.json +130 -0
  289. package/schemas/piagent-webui/subagent-tree-v1.schema.json +88 -0
  290. package/schemas/piagent-webui/task-index-v1.schema.json +74 -0
  291. package/schemas/piagent-webui/task-timeline-v1.schema.json +49 -0
  292. package/schemas/piagent-webui/transcript-v1.schema.json +243 -0
  293. package/schemas/task-baseline-manifest.schema.json +122 -0
  294. package/schemas/verifier-file-snapshot.schema.json +81 -0
  295. package/scripts/check-architecture.mjs +1 -0
  296. package/scripts/check-doc-languages.mjs +19 -2
  297. package/scripts/check-third-party-neutrality.mjs +43 -0
  298. package/scripts/install-global.sh +1 -1
  299. package/scripts/piagent-cli.mjs +17 -3
  300. package/scripts/piagent-dashboard.mjs +208 -0
  301. package/scripts/piagent-webui-launcher.mjs +121 -0
  302. package/scripts/typescript-loader.mjs +26 -1
  303. package/scripts/verify-local.sh +253 -0
  304. package/scripts/verify-release-identity.mjs +4 -1
@@ -0,0 +1,243 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://piagent.io.vn/schemas/piagent-webui/transcript-v1.schema.json",
4
+ "title": "Piagent WebUI bounded transcript projection v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion",
9
+ "version",
10
+ "generatedAt",
11
+ "identity",
12
+ "revision",
13
+ "eventCursor",
14
+ "state",
15
+ "items",
16
+ "page",
17
+ "reasonCode"
18
+ ],
19
+ "properties": {
20
+ "schemaVersion": { "const": 1 },
21
+ "version": { "const": "piagent-webui-transcript-v1" },
22
+ "generatedAt": { "$ref": "common-v1.schema.json#/$defs/timestamp" },
23
+ "identity": { "$ref": "#/$defs/identity" },
24
+ "revision": { "$ref": "common-v1.schema.json#/$defs/domainRevision" },
25
+ "eventCursor": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
26
+ "state": { "enum": ["ready", "unavailable"] },
27
+ "items": {
28
+ "type": "array",
29
+ "maxItems": 200,
30
+ "uniqueItems": true,
31
+ "items": { "$ref": "#/$defs/transcriptItem" }
32
+ },
33
+ "page": { "$ref": "#/$defs/page" },
34
+ "reasonCode": { "$ref": "common-v1.schema.json#/$defs/nullableReasonCode" }
35
+ },
36
+ "allOf": [
37
+ {
38
+ "if": { "properties": { "state": { "const": "ready" } }, "required": ["state"] },
39
+ "then": { "properties": { "reasonCode": { "type": "null" } } }
40
+ },
41
+ {
42
+ "if": { "properties": { "state": { "const": "unavailable" } }, "required": ["state"] },
43
+ "then": {
44
+ "properties": {
45
+ "items": { "type": "array", "maxItems": 0 },
46
+ "reasonCode": { "$ref": "common-v1.schema.json#/$defs/reasonCode" },
47
+ "page": {
48
+ "type": "object",
49
+ "properties": {
50
+ "nextBeforeCursor": { "type": "null" },
51
+ "hasOlder": { "const": false }
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+ ],
58
+ "$defs": {
59
+ "identity": {
60
+ "type": "object",
61
+ "additionalProperties": false,
62
+ "required": ["projectRef", "runtimeInstanceId", "sessionRef", "taskId", "taskRunId", "agentOperationId", "toolCallId"],
63
+ "properties": {
64
+ "projectRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
65
+ "runtimeInstanceId": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
66
+ "sessionRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
67
+ "taskId": { "$ref": "common-v1.schema.json#/$defs/nullablePublicId" },
68
+ "taskRunId": { "$ref": "common-v1.schema.json#/$defs/nullablePublicId" },
69
+ "agentOperationId": { "type": "null" },
70
+ "toolCallId": { "type": "null" }
71
+ },
72
+ "allOf": [
73
+ {
74
+ "if": { "properties": { "taskRunId": { "type": "string" } }, "required": ["taskRunId"] },
75
+ "then": { "properties": { "taskId": { "$ref": "common-v1.schema.json#/$defs/publicId" } } }
76
+ }
77
+ ]
78
+ },
79
+ "nullableCount": {
80
+ "anyOf": [
81
+ { "type": "integer", "minimum": 0, "maximum": 1000000000 },
82
+ { "type": "null" }
83
+ ]
84
+ },
85
+ "safeTranscriptText": {
86
+ "type": "string",
87
+ "maxLength": 16384,
88
+ "pattern": "^[^\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F\\u007F]*$"
89
+ },
90
+ "nullableSafeTranscriptText": {
91
+ "anyOf": [
92
+ { "$ref": "#/$defs/safeTranscriptText" },
93
+ { "type": "null" }
94
+ ]
95
+ },
96
+ "content": {
97
+ "type": "object",
98
+ "additionalProperties": false,
99
+ "required": ["state", "text", "textChars", "digest", "truncated", "redacted", "imageCount", "reasonCode"],
100
+ "properties": {
101
+ "state": { "enum": ["available", "redacted", "unavailable"] },
102
+ "text": { "$ref": "#/$defs/nullableSafeTranscriptText" },
103
+ "textChars": { "$ref": "#/$defs/nullableCount" },
104
+ "digest": {
105
+ "anyOf": [
106
+ { "$ref": "common-v1.schema.json#/$defs/digest" },
107
+ { "type": "null" }
108
+ ]
109
+ },
110
+ "truncated": { "type": "boolean" },
111
+ "redacted": { "type": "boolean" },
112
+ "imageCount": { "type": "integer", "minimum": 0, "maximum": 32 },
113
+ "reasonCode": { "$ref": "common-v1.schema.json#/$defs/nullableReasonCode" }
114
+ },
115
+ "allOf": [
116
+ {
117
+ "if": { "properties": { "state": { "const": "available" } }, "required": ["state"] },
118
+ "then": {
119
+ "properties": {
120
+ "text": { "$ref": "#/$defs/safeTranscriptText" },
121
+ "textChars": { "type": "integer", "minimum": 0, "maximum": 1000000000 },
122
+ "digest": { "$ref": "common-v1.schema.json#/$defs/digest" },
123
+ "redacted": { "const": false },
124
+ "reasonCode": { "type": "null" }
125
+ }
126
+ }
127
+ },
128
+ {
129
+ "if": { "properties": { "state": { "const": "redacted" } }, "required": ["state"] },
130
+ "then": {
131
+ "properties": {
132
+ "text": { "$ref": "#/$defs/safeTranscriptText" },
133
+ "textChars": { "type": "integer", "minimum": 0, "maximum": 1000000000 },
134
+ "digest": { "$ref": "common-v1.schema.json#/$defs/digest" },
135
+ "redacted": { "const": true },
136
+ "reasonCode": { "const": "sensitive-values-redacted" }
137
+ }
138
+ }
139
+ },
140
+ {
141
+ "if": { "properties": { "state": { "const": "unavailable" } }, "required": ["state"] },
142
+ "then": {
143
+ "properties": {
144
+ "text": { "type": "null" },
145
+ "textChars": { "type": "null" },
146
+ "digest": { "type": "null" },
147
+ "truncated": { "const": false },
148
+ "redacted": { "const": false },
149
+ "reasonCode": { "$ref": "common-v1.schema.json#/$defs/reasonCode" }
150
+ }
151
+ }
152
+ }
153
+ ]
154
+ },
155
+ "toolCall": {
156
+ "type": "object",
157
+ "additionalProperties": false,
158
+ "required": ["toolCallRef", "toolName", "state"],
159
+ "properties": {
160
+ "toolCallRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
161
+ "toolName": {
162
+ "type": "string",
163
+ "minLength": 1,
164
+ "maxLength": 80,
165
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@~-]{0,79}$"
166
+ },
167
+ "state": { "enum": ["requested", "completed", "failed", "unknown"] }
168
+ }
169
+ },
170
+ "transcriptItem": {
171
+ "type": "object",
172
+ "additionalProperties": false,
173
+ "required": [
174
+ "messageRef",
175
+ "parentMessageRef",
176
+ "role",
177
+ "recordedAt",
178
+ "agentOperationId",
179
+ "turnIndex",
180
+ "content",
181
+ "toolCalls"
182
+ ],
183
+ "properties": {
184
+ "messageRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
185
+ "parentMessageRef": { "$ref": "common-v1.schema.json#/$defs/nullableOpaqueRef" },
186
+ "role": { "enum": ["user", "assistant", "tool-result"] },
187
+ "recordedAt": { "$ref": "common-v1.schema.json#/$defs/timestamp" },
188
+ "agentOperationId": { "$ref": "common-v1.schema.json#/$defs/nullableOpaqueRef" },
189
+ "turnIndex": { "$ref": "#/$defs/nullableCount" },
190
+ "content": { "$ref": "#/$defs/content" },
191
+ "toolCalls": {
192
+ "type": "array",
193
+ "maxItems": 64,
194
+ "uniqueItems": true,
195
+ "items": { "$ref": "#/$defs/toolCall" }
196
+ }
197
+ },
198
+ "allOf": [
199
+ {
200
+ "if": { "properties": { "turnIndex": { "type": "integer" } }, "required": ["turnIndex"] },
201
+ "then": { "properties": { "agentOperationId": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" } } }
202
+ },
203
+ {
204
+ "if": { "properties": { "role": { "const": "tool-result" } }, "required": ["role"] },
205
+ "then": {
206
+ "properties": {
207
+ "content": {
208
+ "type": "object",
209
+ "properties": {
210
+ "state": { "const": "unavailable" },
211
+ "reasonCode": { "const": "tool-output-in-activity-preview" }
212
+ }
213
+ },
214
+ "toolCalls": { "type": "array", "minItems": 1, "maxItems": 1 }
215
+ }
216
+ }
217
+ }
218
+ ]
219
+ },
220
+ "page": {
221
+ "type": "object",
222
+ "additionalProperties": false,
223
+ "required": ["beforeCursor", "nextBeforeCursor", "hasOlder", "limit", "truncated"],
224
+ "properties": {
225
+ "beforeCursor": { "$ref": "common-v1.schema.json#/$defs/nullableOpaqueRef" },
226
+ "nextBeforeCursor": { "$ref": "common-v1.schema.json#/$defs/nullableOpaqueRef" },
227
+ "hasOlder": { "type": "boolean" },
228
+ "limit": { "type": "integer", "minimum": 1, "maximum": 200 },
229
+ "truncated": { "type": "boolean" }
230
+ },
231
+ "allOf": [
232
+ {
233
+ "if": { "properties": { "hasOlder": { "const": false } }, "required": ["hasOlder"] },
234
+ "then": { "properties": { "nextBeforeCursor": { "type": "null" } } }
235
+ },
236
+ {
237
+ "if": { "properties": { "hasOlder": { "const": true } }, "required": ["hasOlder"] },
238
+ "then": { "properties": { "nextBeforeCursor": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" } } }
239
+ }
240
+ ]
241
+ }
242
+ }
243
+ }
@@ -0,0 +1,122 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://piagent.io.vn/schemas/task-baseline-manifest.schema.json",
4
+ "title": "Piagent task baseline manifest v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion", "version", "taskId", "taskRunId", "sessionIdentityHash",
9
+ "capturedAt", "retentionUntil", "baselineDigestAlgorithm", "baselineTreeDigest",
10
+ "captureState", "reasonCode", "limits", "roots", "integrityDigest"
11
+ ],
12
+ "properties": {
13
+ "schemaVersion": { "const": 1 },
14
+ "version": { "const": "piagent-task-baseline-manifest-v1" },
15
+ "taskId": { "$ref": "#/$defs/publicId" },
16
+ "taskRunId": { "$ref": "#/$defs/publicId" },
17
+ "sessionIdentityHash": { "$ref": "#/$defs/digest" },
18
+ "capturedAt": { "$ref": "#/$defs/timestamp" },
19
+ "retentionUntil": { "$ref": "#/$defs/timestamp" },
20
+ "baselineDigestAlgorithm": { "const": "wt-content-v2" },
21
+ "baselineTreeDigest": { "type": "string", "pattern": "^wt-content-v2:[a-f0-9]{64}$" },
22
+ "captureState": { "enum": ["current", "degraded", "unavailable"] },
23
+ "reasonCode": { "$ref": "#/$defs/nullableReasonCode" },
24
+ "limits": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["maxEntries", "maxFileBytes", "maxTotalBytes", "capturedBytes"],
28
+ "properties": {
29
+ "maxEntries": { "type": "integer", "minimum": 1, "maximum": 2000 },
30
+ "maxFileBytes": { "type": "integer", "minimum": 1024, "maximum": 16777216 },
31
+ "maxTotalBytes": { "type": "integer", "minimum": 1048576, "maximum": 268435456 },
32
+ "capturedBytes": { "type": "integer", "minimum": 0, "maximum": 268435456 }
33
+ }
34
+ },
35
+ "roots": {
36
+ "type": "array",
37
+ "minItems": 1,
38
+ "maxItems": 32,
39
+ "items": { "$ref": "#/$defs/root" }
40
+ },
41
+ "integrityDigest": { "$ref": "#/$defs/digest" }
42
+ },
43
+ "allOf": [
44
+ {
45
+ "if": { "properties": { "captureState": { "const": "current" } }, "required": ["captureState"] },
46
+ "then": { "properties": { "reasonCode": { "type": "null" } } },
47
+ "else": { "properties": { "reasonCode": { "$ref": "#/$defs/reasonCode" } } }
48
+ }
49
+ ],
50
+ "$defs": {
51
+ "publicId": { "type": "string", "minLength": 1, "maxLength": 160, "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@~-]{0,159}$" },
52
+ "opaqueRef": { "type": "string", "minLength": 1, "maxLength": 160, "pattern": "^[A-Za-z0-9][A-Za-z0-9._~-]{0,159}$" },
53
+ "digest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
54
+ "timestamp": { "type": "string", "format": "date-time", "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$" },
55
+ "reasonCode": { "type": "string", "minLength": 1, "maxLength": 96, "pattern": "^[a-z0-9][a-z0-9.-]{0,95}$" },
56
+ "nullableReasonCode": { "anyOf": [{ "$ref": "#/$defs/reasonCode" }, { "type": "null" }] },
57
+ "oid": { "anyOf": [{ "type": "string", "pattern": "^[a-f0-9]{40,64}$" }, { "type": "null" }] },
58
+ "entry": {
59
+ "type": "object",
60
+ "additionalProperties": false,
61
+ "required": [
62
+ "pathRef", "pathDigest", "repoPathBase64", "state", "reasonCode", "contentRef",
63
+ "byteLength", "mode", "headObject", "indexObject"
64
+ ],
65
+ "properties": {
66
+ "pathRef": { "$ref": "#/$defs/opaqueRef" },
67
+ "pathDigest": { "$ref": "#/$defs/digest" },
68
+ "repoPathBase64": { "anyOf": [{ "type": "string", "maxLength": 4096, "pattern": "^[A-Za-z0-9_-]*$" }, { "type": "null" }] },
69
+ "state": { "enum": ["blob", "absent", "symlink", "submodule", "protected", "oversized", "unavailable"] },
70
+ "reasonCode": { "$ref": "#/$defs/nullableReasonCode" },
71
+ "contentRef": { "anyOf": [{ "$ref": "#/$defs/digest" }, { "type": "null" }] },
72
+ "byteLength": { "type": "integer", "minimum": 0, "maximum": 16777216 },
73
+ "mode": { "type": "string", "pattern": "^[0-7]{6}$" },
74
+ "headObject": { "$ref": "#/$defs/oid" },
75
+ "indexObject": { "$ref": "#/$defs/oid" }
76
+ },
77
+ "allOf": [
78
+ {
79
+ "if": { "properties": { "state": { "enum": ["blob", "symlink"] } }, "required": ["state"] },
80
+ "then": { "properties": { "contentRef": { "$ref": "#/$defs/digest" }, "reasonCode": { "type": "null" } } },
81
+ "else": { "properties": { "contentRef": { "type": "null" } } }
82
+ },
83
+ {
84
+ "if": { "properties": { "state": { "enum": ["protected", "oversized", "unavailable"] } }, "required": ["state"] },
85
+ "then": { "properties": { "reasonCode": { "$ref": "#/$defs/reasonCode" } } },
86
+ "else": { "properties": { "reasonCode": { "type": "null" } } }
87
+ }
88
+ ]
89
+ },
90
+ "root": {
91
+ "type": "object",
92
+ "additionalProperties": false,
93
+ "required": [
94
+ "repoRef", "projectPath", "headState", "headOid", "workspaceRevision",
95
+ "indexRevision", "state", "reasonCode", "entries"
96
+ ],
97
+ "properties": {
98
+ "repoRef": { "$ref": "#/$defs/opaqueRef" },
99
+ "projectPath": { "type": "string", "maxLength": 1024, "pattern": "^(?:\\.|(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))[^\\u0000-\\u001F\\u007F\\\\]+)$" },
100
+ "headState": { "enum": ["head", "unborn", "unavailable"] },
101
+ "headOid": { "$ref": "#/$defs/oid" },
102
+ "workspaceRevision": { "$ref": "#/$defs/opaqueRef" },
103
+ "indexRevision": { "$ref": "#/$defs/opaqueRef" },
104
+ "state": { "enum": ["current", "unavailable"] },
105
+ "reasonCode": { "$ref": "#/$defs/nullableReasonCode" },
106
+ "entries": { "type": "array", "maxItems": 2000, "items": { "$ref": "#/$defs/entry" } }
107
+ },
108
+ "allOf": [
109
+ {
110
+ "if": { "properties": { "headState": { "const": "head" } }, "required": ["headState"] },
111
+ "then": { "properties": { "headOid": { "type": "string", "pattern": "^[a-f0-9]{40,64}$" } } },
112
+ "else": { "properties": { "headOid": { "type": "null" } } }
113
+ },
114
+ {
115
+ "if": { "properties": { "state": { "const": "current" } }, "required": ["state"] },
116
+ "then": { "properties": { "reasonCode": { "type": "null" } } },
117
+ "else": { "properties": { "reasonCode": { "$ref": "#/$defs/reasonCode" } } }
118
+ }
119
+ ]
120
+ }
121
+ }
122
+ }
@@ -0,0 +1,81 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://piagent.io.vn/schemas/verifier-file-snapshot.schema.json",
4
+ "title": "Piagent verifier file snapshot v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion", "version", "attemptId", "attemptRef", "taskId", "taskRunId",
9
+ "sessionIdentityHash", "toolCallIdentityHash", "commandDigest", "observedAt", "capturedAt",
10
+ "retentionUntil", "exitCode", "outcome", "treeDigest", "fileCount", "exposedPathCount",
11
+ "files", "integrityDigest"
12
+ ],
13
+ "properties": {
14
+ "schemaVersion": { "const": 1 },
15
+ "version": { "const": "piagent-verifier-file-snapshot-v1" },
16
+ "attemptId": { "type": "string", "pattern": "^verifier\\.[a-f0-9]{64}$" },
17
+ "attemptRef": { "type": "string", "pattern": "^verifier-evidence\\.[a-f0-9]{64}$" },
18
+ "taskId": { "$ref": "#/$defs/publicId" },
19
+ "taskRunId": { "$ref": "#/$defs/publicId" },
20
+ "sessionIdentityHash": { "$ref": "#/$defs/digest" },
21
+ "toolCallIdentityHash": { "$ref": "#/$defs/digest" },
22
+ "commandDigest": { "$ref": "#/$defs/digest" },
23
+ "observedAt": { "$ref": "#/$defs/timestamp" },
24
+ "capturedAt": { "$ref": "#/$defs/timestamp" },
25
+ "retentionUntil": { "$ref": "#/$defs/timestamp" },
26
+ "exitCode": { "type": "integer", "minimum": -2147483648, "maximum": 2147483647 },
27
+ "outcome": { "enum": ["passed", "failed"] },
28
+ "treeDigest": { "$ref": "#/$defs/treeDigest" },
29
+ "fileCount": { "type": "integer", "minimum": 0, "maximum": 2000 },
30
+ "exposedPathCount": { "type": "integer", "minimum": 0, "maximum": 2000 },
31
+ "files": {
32
+ "type": "array",
33
+ "maxItems": 2000,
34
+ "items": { "$ref": "#/$defs/file" }
35
+ },
36
+ "integrityDigest": { "$ref": "#/$defs/digest" }
37
+ },
38
+ "allOf": [
39
+ {
40
+ "if": { "properties": { "outcome": { "const": "passed" } }, "required": ["outcome"] },
41
+ "then": { "properties": { "exitCode": { "const": 0 } } },
42
+ "else": { "properties": { "exitCode": { "not": { "const": 0 } } } }
43
+ }
44
+ ],
45
+ "$defs": {
46
+ "publicId": { "type": "string", "minLength": 1, "maxLength": 160, "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@~-]*$" },
47
+ "digest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
48
+ "treeDigest": { "type": "string", "pattern": "^wt-content-v2:[a-f0-9]{64}$" },
49
+ "carrierDigest": { "type": "string", "pattern": "^wt-content-v2:[a-f0-9]{64}$" },
50
+ "timestamp": { "type": "string", "format": "date-time", "maxLength": 32 },
51
+ "file": {
52
+ "type": "object",
53
+ "additionalProperties": false,
54
+ "required": ["pathDigest", "repoPathBase64", "state", "reasonCode", "carrierDigest"],
55
+ "properties": {
56
+ "pathDigest": { "$ref": "#/$defs/digest" },
57
+ "repoPathBase64": {
58
+ "oneOf": [
59
+ { "type": "null" },
60
+ { "type": "string", "minLength": 1, "maxLength": 2048, "pattern": "^[A-Za-z0-9_-]+$" }
61
+ ]
62
+ },
63
+ "state": { "enum": ["exact", "protected", "unavailable"] },
64
+ "reasonCode": {
65
+ "oneOf": [
66
+ { "type": "null" },
67
+ { "type": "string", "minLength": 1, "maxLength": 96, "pattern": "^[a-z0-9][a-z0-9.-]*$" }
68
+ ]
69
+ },
70
+ "carrierDigest": { "$ref": "#/$defs/carrierDigest" }
71
+ },
72
+ "allOf": [
73
+ {
74
+ "if": { "properties": { "state": { "const": "exact" } }, "required": ["state"] },
75
+ "then": { "properties": { "repoPathBase64": { "type": "string" }, "reasonCode": { "type": "null" } } },
76
+ "else": { "properties": { "repoPathBase64": { "type": "null" }, "reasonCode": { "type": "string" } } }
77
+ }
78
+ ]
79
+ }
80
+ }
81
+ }
@@ -67,6 +67,7 @@ function inspectArchitecture({ root = repoRoot, config = readConfig() } = {}) {
67
67
  const errors = [];
68
68
  const files = [
69
69
  ...walkSources(path.join(root, "packages", "piagent-core")),
70
+ ...walkSources(path.join(root, "packages", "piagent-webui")),
70
71
  ...walkSources(path.join(root, "scripts"))
71
72
  ];
72
73
  const counts = {};
@@ -35,7 +35,23 @@ function inspectDocLanguages(root = repoRoot) {
35
35
  if (!viText.includes(enLink)) errors.push(`${pair.topic}: Vietnamese file does not link to ${enLink}`);
36
36
  if (!/[À-ỹĐđ]/u.test(viText)) errors.push(`${pair.topic}: Vietnamese file has no Vietnamese diacritics`);
37
37
  }
38
- return { ok: errors.length === 0, errors, pairs: manifest.pairs.length, terms: manifest.preservedTechnicalTerms };
38
+ const rootDocs = fs.readdirSync(path.join(root, "docs"), { withFileTypes: true })
39
+ .filter((entry) => entry.isFile() && entry.name.endsWith(".md"))
40
+ .map((entry) => path.join(root, "docs", entry.name));
41
+ const languageCounts = { en: 0, vi: 0, "en+vi": 0 };
42
+ for (const file of rootDocs) {
43
+ const text = fs.readFileSync(file, "utf8"), relative = path.relative(root, file).split(path.sep).join("/");
44
+ const match = text.slice(0, 1_024).match(/<!--\s*language:\s*(en\+vi|en|vi)(?:;\s*english-index:\s*([^\s]+))?\s*-->/i);
45
+ if (!match) { errors.push(`${relative}: missing explicit language marker`); continue; }
46
+ const language = match[1].toLowerCase(); languageCounts[language] += 1;
47
+ if (language === "vi") {
48
+ const index = match[2];
49
+ if (!index) errors.push(`${relative}: Vietnamese document has no English index`);
50
+ else if (!fs.existsSync(path.join(root, index))) errors.push(`${relative}: missing English index ${index}`);
51
+ }
52
+ }
53
+ return { ok: errors.length === 0, errors, pairs: manifest.pairs.length, rootDocuments: rootDocs.length,
54
+ languages: languageCounts, terms: manifest.preservedTechnicalTerms };
39
55
  }
40
56
 
41
57
  function main(argv = process.argv.slice(2)) {
@@ -56,7 +72,8 @@ function main(argv = process.argv.slice(2)) {
56
72
  process.stderr.write(`FAIL: documentation language check found ${result.errors.length} problem(s)\n${result.errors.map((error) => `- ${error}`).join("\n")}\n`);
57
73
  return 1;
58
74
  }
59
- process.stdout.write(json ? `${JSON.stringify(result)}\n` : `PASS: ${result.pairs} EN/VI documentation pairs are complete\n`);
75
+ process.stdout.write(json ? `${JSON.stringify(result)}\n`
76
+ : `PASS: ${result.pairs} EN/VI pairs and ${result.rootDocuments} explicitly classified root documents are complete\n`);
60
77
  return 0;
61
78
  }
62
79
 
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env node
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+
6
+ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
7
+ const exactFiles = [
8
+ "governance/piagent-webui/10-master-plan.md",
9
+ "governance/piagent-webui/40-session-hub-master-plan.md",
10
+ "governance/piagent-webui/STATUS.md"
11
+ ];
12
+ const directories = ["governance/piagent-webui/decisions", "packages/piagent-webui/client/src"];
13
+ const comparisonBrands = /\b(?:ChatGPT|OpenClaw|Open WebUI|Claude Desktop|9Router)\b/g;
14
+
15
+ function filesIn(repositoryRoot, directory) {
16
+ return fs.readdirSync(path.join(repositoryRoot, directory), { withFileTypes: true })
17
+ .filter((entry) => entry.isFile() && /\.(?:md|tsx?|css)$/.test(entry.name))
18
+ .map((entry) => path.join(directory, entry.name));
19
+ }
20
+
21
+ export function inspectThirdPartyNeutrality(repositoryRoot = root) {
22
+ const candidates = [...exactFiles, ...directories.flatMap((directory) => filesIn(repositoryRoot, directory))]
23
+ .filter((file) => !file.includes("/decisions/WUI") || /\/decisions\/WUI5-/.test(file));
24
+ const violations = [];
25
+ for (const file of candidates) {
26
+ const text = fs.readFileSync(path.join(repositoryRoot, file), "utf8");
27
+ for (const match of text.matchAll(comparisonBrands)) {
28
+ const line = text.slice(0, match.index).split("\n").length;
29
+ violations.push({ file, line, keyword: match[0] });
30
+ }
31
+ }
32
+ return { ok: violations.length === 0, checkedFiles: candidates.length, violations };
33
+ }
34
+
35
+ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
36
+ const result = inspectThirdPartyNeutrality();
37
+ if (!result.ok) {
38
+ process.stderr.write(`FAIL: third-party comparison branding found\n${result.violations
39
+ .map((item) => `- ${item.file}:${item.line} ${item.keyword}`).join("\n")}\n`);
40
+ process.exit(1);
41
+ }
42
+ process.stdout.write(`PASS: ${result.checkedFiles} active WebUI files use provider-neutral product language\n`);
43
+ }
@@ -677,7 +677,7 @@ echo " /login"
677
677
  echo " /model # or Ctrl+L: select provider/model from Pi selector"
678
678
  echo " /scoped-models # optional: edit Ctrl+P model cycle scope"
679
679
  if [[ "$WITH_MCP" == true ]]; then
680
- echo " /mcp # inspect MCP servers; authenticate Figma/GitHub only when needed"
680
+ echo " /mcp # inspect MCP servers; authenticate approved remote servers only when needed"
681
681
  fi
682
682
  echo " /subagents-doctor"
683
683
  echo " /workflow task Implement <task> # parent may auto-delegate scout/planner/reviewer"
@@ -23,12 +23,26 @@ const scriptByCommand = {
23
23
  "piagent-migrate": "scripts/migrate-project-state.mjs",
24
24
  "piagent-import-instructions": "scripts/import-agent-instructions.mjs",
25
25
  "piagent-auto": "scripts/pi-auto.sh",
26
- "piagent-context": "scripts/context-engine.mjs"
26
+ "piagent-context": "scripts/context-engine.mjs",
27
+ "piagent-webui": "scripts/piagent-webui-launcher.mjs",
28
+ "piagent-dashboard": "scripts/piagent-dashboard.mjs"
27
29
  };
28
30
 
29
31
  const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
30
32
  const invokedAs = path.basename(process.argv[1] ?? "");
31
- const script = scriptByCommand[invokedAs];
33
+ let forwardedArgs = process.argv.slice(2);
34
+ let script = scriptByCommand[invokedAs];
35
+
36
+ if (invokedAs === "piagent") {
37
+ const subcommand = forwardedArgs[0];
38
+ if (subcommand === "dashboard") {
39
+ script = "scripts/piagent-dashboard.mjs";
40
+ forwardedArgs = forwardedArgs.slice(1);
41
+ } else if ([undefined, "help", "--help", "-h"].includes(subcommand)) {
42
+ console.log("Usage: piagent dashboard [open|status|stop|restart|doctor] [--no-open] [--json]");
43
+ process.exit(0);
44
+ }
45
+ }
32
46
 
33
47
  if (!script) {
34
48
  console.error(`Unknown Pi Agent command: ${invokedAs || "(unknown)"}`);
@@ -58,7 +72,7 @@ const runner = target.endsWith(".mjs") ? process.execPath : "bash";
58
72
  const runnerArgs = target.endsWith(".mjs")
59
73
  ? ["--disable-warning=ExperimentalWarning", "--import", path.join(sourceRoot, "scripts", "register-typescript-loader.mjs"), target]
60
74
  : [target];
61
- const child = spawn(runner, [...runnerArgs, ...process.argv.slice(2)], {
75
+ const child = spawn(runner, [...runnerArgs, ...forwardedArgs], {
62
76
  cwd: process.cwd(),
63
77
  env: process.env,
64
78
  stdio: "inherit"