@piagent/platform 1.3.1 → 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 (301) hide show
  1. package/CHANGELOG.md +39 -0
  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 +1 -0
  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 +7 -6
  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/runtime-integrity.js +143 -0
  140. package/packages/piagent-core/extensions/piagent-guard.ts +62 -37
  141. package/packages/piagent-core/extensions/redaction-core.d.ts +2 -0
  142. package/packages/piagent-core/extensions/task-journal.js +30 -1
  143. package/packages/piagent-core/extensions/task-state.js +33 -36
  144. package/packages/piagent-core/mcp/mcp-server-catalog.js +5 -5
  145. package/packages/piagent-core/package.json +1 -1
  146. package/packages/piagent-core/runtime/hooks/session-start-hook.ts +2 -2
  147. package/packages/piagent-core/runtime/hooks/tool-call-hook.ts +5 -2
  148. package/packages/piagent-core/runtime/hooks/tool-result-hook.ts +20 -19
  149. package/packages/piagent-core/runtime/hooks/tool-result-metadata.ts +13 -0
  150. package/packages/piagent-core/runtime/input/chat-images.ts +2 -2
  151. package/packages/piagent-core/runtime/inspection/activity-event-adapter.ts +94 -0
  152. package/packages/piagent-core/runtime/inspection/approval-broker.ts +318 -0
  153. package/packages/piagent-core/runtime/inspection/commit-summary-projection.ts +59 -0
  154. package/packages/piagent-core/runtime/inspection/context-telemetry-inspection.ts +37 -0
  155. package/packages/piagent-core/runtime/inspection/criteria-links.ts +295 -0
  156. package/packages/piagent-core/runtime/inspection/diff-projection.ts +499 -0
  157. package/packages/piagent-core/runtime/inspection/git-filter-safety.ts +38 -0
  158. package/packages/piagent-core/runtime/inspection/git-numstat-adapter.ts +71 -0
  159. package/packages/piagent-core/runtime/inspection/git-status-adapter.ts +493 -0
  160. package/packages/piagent-core/runtime/inspection/git-tree-adapter.ts +108 -0
  161. package/packages/piagent-core/runtime/inspection/mcp-control.ts +10 -0
  162. package/packages/piagent-core/runtime/inspection/mutation-provenance-contract.ts +131 -0
  163. package/packages/piagent-core/runtime/inspection/mutation-provenance-recorder.ts +48 -0
  164. package/packages/piagent-core/runtime/inspection/mutation-provenance-store.ts +161 -0
  165. package/packages/piagent-core/runtime/inspection/project-runtime-inspection.ts +36 -0
  166. package/packages/piagent-core/runtime/inspection/review-state-contract.ts +108 -0
  167. package/packages/piagent-core/runtime/inspection/review-state-projection.ts +93 -0
  168. package/packages/piagent-core/runtime/inspection/review-state-store.ts +112 -0
  169. package/packages/piagent-core/runtime/inspection/runtime-event-store.ts +262 -0
  170. package/packages/piagent-core/runtime/inspection/same-process-bridge-proof.ts +103 -0
  171. package/packages/piagent-core/runtime/inspection/source-change-projection.ts +471 -0
  172. package/packages/piagent-core/runtime/inspection/source-evidence-contract.ts +139 -0
  173. package/packages/piagent-core/runtime/inspection/source-evidence-store.ts +315 -0
  174. package/packages/piagent-core/runtime/inspection/source-handoff-store.ts +70 -0
  175. package/packages/piagent-core/runtime/inspection/source-inspection-plan.ts +34 -0
  176. package/packages/piagent-core/runtime/inspection/source-mutation-projection.ts +164 -0
  177. package/packages/piagent-core/runtime/inspection/source-mutation-store.ts +168 -0
  178. package/packages/piagent-core/runtime/inspection/source-open-target.ts +38 -0
  179. package/packages/piagent-core/runtime/inspection/source-revert-projection.ts +147 -0
  180. package/packages/piagent-core/runtime/inspection/task-baseline-start-capture.ts +22 -0
  181. package/packages/piagent-core/runtime/inspection/task-compaction-history.ts +160 -0
  182. package/packages/piagent-core/runtime/inspection/task-control-journal.ts +131 -0
  183. package/packages/piagent-core/runtime/inspection/task-handoff-history.ts +95 -0
  184. package/packages/piagent-core/runtime/inspection/task-provenance-projection.ts +60 -0
  185. package/packages/piagent-core/runtime/inspection/task-recovery-timeline.ts +88 -0
  186. package/packages/piagent-core/runtime/inspection/task-run-index.ts +87 -0
  187. package/packages/piagent-core/runtime/inspection/task-source-projection.ts +401 -0
  188. package/packages/piagent-core/runtime/inspection/task-subagent-tree.ts +101 -0
  189. package/packages/piagent-core/runtime/inspection/text-diff.ts +60 -0
  190. package/packages/piagent-core/runtime/inspection/verifier-snapshot-contract.ts +114 -0
  191. package/packages/piagent-core/runtime/inspection/verifier-snapshot-store.ts +189 -0
  192. package/packages/piagent-core/runtime/inspection/webui-snapshot.ts +320 -0
  193. package/packages/piagent-core/runtime/inspection/workspace-file-reader.ts +132 -0
  194. package/packages/piagent-core/runtime/inspection/workspace-source-projection.ts +96 -0
  195. package/packages/piagent-core/runtime/inspection/zero-turn-conformance.ts +175 -0
  196. package/packages/piagent-core/runtime/orchestration/owned-work-budget.ts +68 -4
  197. package/packages/piagent-core/runtime/policy/source-index-transaction.ts +173 -0
  198. package/packages/piagent-core/runtime/policy/source-mutation-guard-binding.ts +42 -0
  199. package/packages/piagent-core/runtime/policy/source-mutation-guard.ts +184 -0
  200. package/packages/piagent-core/runtime/policy/source-worktree-transaction.ts +105 -0
  201. package/packages/piagent-core/runtime/product/activity-inspector-footer.ts +5 -3
  202. package/packages/piagent-core/runtime/product/activity-inspector.ts +85 -343
  203. package/packages/piagent-core/runtime/recovery/resume-state.ts +38 -1
  204. package/packages/piagent-core/runtime/registration/activity-inspector-command.ts +68 -14
  205. package/packages/piagent-core/runtime/registration/task-start-tool.ts +13 -14
  206. package/packages/piagent-core/runtime/session/model-authorship-state.ts +31 -3
  207. package/packages/piagent-core/runtime/session/runtime-state.ts +11 -1
  208. package/packages/piagent-webui/dist/client/assets/index-DjMntaK5.js +172 -0
  209. package/packages/piagent-webui/dist/client/assets/index-DwKCWbwd.css +1 -0
  210. package/packages/piagent-webui/dist/client/index.html +16 -0
  211. package/packages/piagent-webui/extension/attachment-store.ts +323 -0
  212. package/packages/piagent-webui/extension/held-message-queue.ts +311 -0
  213. package/packages/piagent-webui/extension/lifecycle-controller.ts +408 -0
  214. package/packages/piagent-webui/extension/lifecycle-event-adapter.ts +23 -0
  215. package/packages/piagent-webui/extension/piagent-webui.ts +470 -0
  216. package/packages/piagent-webui/extension/review-controller.ts +160 -0
  217. package/packages/piagent-webui/extension/same-session-bridge.ts +500 -0
  218. package/packages/piagent-webui/extension/session-options-controller.ts +281 -0
  219. package/packages/piagent-webui/extension/session-stream-adapter.ts +249 -0
  220. package/packages/piagent-webui/extension/source-mutation-controller.ts +215 -0
  221. package/packages/piagent-webui/extension/source-open-controller.ts +136 -0
  222. package/packages/piagent-webui/extension/source-revert-controller.ts +189 -0
  223. package/packages/piagent-webui/extension/terminal-session-adapter.ts +73 -0
  224. package/packages/piagent-webui/extension/vscode-handoff.ts +51 -0
  225. package/packages/piagent-webui/gateway/control-socket.ts +92 -0
  226. package/packages/piagent-webui/gateway/gateway-events.ts +60 -0
  227. package/packages/piagent-webui/gateway/gateway-protocol-service.ts +64 -0
  228. package/packages/piagent-webui/gateway/gateway-service.ts +215 -0
  229. package/packages/piagent-webui/gateway/gateway-session-stream.ts +110 -0
  230. package/packages/piagent-webui/gateway/mcp-auth-broker.ts +158 -0
  231. package/packages/piagent-webui/gateway/native-project-picker.ts +29 -0
  232. package/packages/piagent-webui/gateway/pi-host.ts +41 -0
  233. package/packages/piagent-webui/gateway/profile-state.ts +1 -0
  234. package/packages/piagent-webui/gateway/project-registry.ts +108 -0
  235. package/packages/piagent-webui/gateway/provider-auth-broker.ts +172 -0
  236. package/packages/piagent-webui/gateway/session-catalog.ts +128 -0
  237. package/packages/piagent-webui/gateway/session-command-controller.ts +237 -0
  238. package/packages/piagent-webui/gateway/session-command-store.ts +224 -0
  239. package/packages/piagent-webui/gateway/session-inspection-registry.ts +204 -0
  240. package/packages/piagent-webui/gateway/session-lease-store.ts +1 -0
  241. package/packages/piagent-webui/gateway/session-metadata-store.ts +152 -0
  242. package/packages/piagent-webui/gateway/session-runtime-supervisor.ts +485 -0
  243. package/packages/piagent-webui/ownership/gateway-runtime-context.ts +8 -0
  244. package/packages/piagent-webui/ownership/profile-state.ts +117 -0
  245. package/packages/piagent-webui/ownership/session-lease-store.ts +329 -0
  246. package/packages/piagent-webui/ownership/session-refs.ts +8 -0
  247. package/packages/piagent-webui/package.json +33 -0
  248. package/packages/piagent-webui/server/README.md +4 -0
  249. package/packages/piagent-webui/server/benchmark-release-monitor.ts +230 -0
  250. package/packages/piagent-webui/server/core-inspection-provider.ts +403 -0
  251. package/packages/piagent-webui/server/gateway-websocket.ts +143 -0
  252. package/packages/piagent-webui/server/http-security.ts +27 -0
  253. package/packages/piagent-webui/server/ipc-read-model-client.ts +89 -0
  254. package/packages/piagent-webui/server/loopback-server.ts +368 -0
  255. package/packages/piagent-webui/server/read-model-provider.ts +37 -0
  256. package/packages/piagent-webui/server/read-only-router.ts +105 -0
  257. package/packages/piagent-webui/server/session-auth.ts +88 -0
  258. package/packages/piagent-webui/server/sidecar-main.ts +86 -0
  259. package/packages/piagent-webui/server/sse-hub.ts +76 -0
  260. package/packages/piagent-webui/server/static-bundle.ts +40 -0
  261. package/packages/piagent-webui/server/transcript-projection.ts +110 -0
  262. package/schemas/mutation-provenance-record.schema.json +100 -0
  263. package/schemas/piagent-webui/approval-v1.schema.json +654 -0
  264. package/schemas/piagent-webui/attachment-v1.schema.json +267 -0
  265. package/schemas/piagent-webui/capabilities-v1.schema.json +729 -0
  266. package/schemas/piagent-webui/catalog-v1.json +240 -0
  267. package/schemas/piagent-webui/commit-summary-v1.schema.json +63 -0
  268. package/schemas/piagent-webui/common-v1.schema.json +479 -0
  269. package/schemas/piagent-webui/control-command-v1.schema.json +1780 -0
  270. package/schemas/piagent-webui/diff-v1.schema.json +826 -0
  271. package/schemas/piagent-webui/gateway-capabilities-v1.schema.json +136 -0
  272. package/schemas/piagent-webui/gateway-protocol-v1.schema.json +456 -0
  273. package/schemas/piagent-webui/handoff-history-v1.schema.json +92 -0
  274. package/schemas/piagent-webui/model-catalog-v1.schema.json +95 -0
  275. package/schemas/piagent-webui/queue-v1.schema.json +99 -0
  276. package/schemas/piagent-webui/recovery-history-v1.schema.json +144 -0
  277. package/schemas/piagent-webui/release-monitor-v1.schema.json +173 -0
  278. package/schemas/piagent-webui/review-state-v1.schema.json +206 -0
  279. package/schemas/piagent-webui/runtime-event-v2.schema.json +5206 -0
  280. package/schemas/piagent-webui/session-catalog-v1.schema.json +222 -0
  281. package/schemas/piagent-webui/session-command-v1.schema.json +390 -0
  282. package/schemas/piagent-webui/snapshot-v1.schema.json +2622 -0
  283. package/schemas/piagent-webui/source-change-v1.schema.json +763 -0
  284. package/schemas/piagent-webui/source-mutation-v1.schema.json +96 -0
  285. package/schemas/piagent-webui/source-revert-v1.schema.json +130 -0
  286. package/schemas/piagent-webui/subagent-tree-v1.schema.json +88 -0
  287. package/schemas/piagent-webui/task-index-v1.schema.json +74 -0
  288. package/schemas/piagent-webui/task-timeline-v1.schema.json +49 -0
  289. package/schemas/piagent-webui/transcript-v1.schema.json +243 -0
  290. package/schemas/task-baseline-manifest.schema.json +122 -0
  291. package/schemas/verifier-file-snapshot.schema.json +81 -0
  292. package/scripts/check-architecture.mjs +1 -0
  293. package/scripts/check-doc-languages.mjs +19 -2
  294. package/scripts/check-third-party-neutrality.mjs +43 -0
  295. package/scripts/install-global.sh +1 -1
  296. package/scripts/piagent-cli.mjs +17 -3
  297. package/scripts/piagent-dashboard.mjs +208 -0
  298. package/scripts/piagent-webui-launcher.mjs +121 -0
  299. package/scripts/typescript-loader.mjs +26 -1
  300. package/scripts/verify-local.sh +253 -0
  301. package/scripts/verify-release-identity.mjs +4 -1
@@ -0,0 +1,96 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://piagent.io.vn/schemas/piagent-webui/source-mutation-v1.schema.json",
4
+ "title": "Piagent WebUI guarded selected-file source mutation preview v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "version", "generatedAt", "identity", "action", "state", "target", "reasonCode", "health"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "version": { "const": "piagent-webui-source-mutation-v1" },
11
+ "generatedAt": { "$ref": "common-v1.schema.json#/$defs/timestamp" },
12
+ "identity": { "$ref": "common-v1.schema.json#/$defs/identity" },
13
+ "action": { "enum": ["source.stage", "source.unstage"] },
14
+ "state": { "enum": ["ready", "unavailable"] },
15
+ "target": {
16
+ "anyOf": [
17
+ { "$ref": "#/$defs/mutationTarget" },
18
+ { "type": "null" }
19
+ ]
20
+ },
21
+ "reasonCode": { "$ref": "common-v1.schema.json#/$defs/nullableReasonCode" },
22
+ "health": { "$ref": "common-v1.schema.json#/$defs/health" }
23
+ },
24
+ "allOf": [
25
+ {
26
+ "properties": {
27
+ "identity": {
28
+ "type": "object",
29
+ "properties": {
30
+ "taskId": { "$ref": "common-v1.schema.json#/$defs/publicId" },
31
+ "taskRunId": { "$ref": "common-v1.schema.json#/$defs/publicId" },
32
+ "agentOperationId": { "type": "null" },
33
+ "toolCallId": { "type": "null" }
34
+ }
35
+ }
36
+ }
37
+ },
38
+ {
39
+ "if": { "properties": { "state": { "const": "ready" } }, "required": ["state"] },
40
+ "then": {
41
+ "properties": {
42
+ "target": { "$ref": "#/$defs/mutationTarget" },
43
+ "reasonCode": { "type": "null" },
44
+ "health": { "type": "object", "properties": { "state": { "const": "ok" } } }
45
+ }
46
+ },
47
+ "else": {
48
+ "properties": {
49
+ "target": { "type": "null" },
50
+ "reasonCode": { "$ref": "common-v1.schema.json#/$defs/reasonCode" },
51
+ "health": { "type": "object", "properties": { "state": { "enum": ["unavailable", "error"] } } }
52
+ }
53
+ }
54
+ },
55
+ {
56
+ "if": { "properties": { "action": { "const": "source.stage" } }, "required": ["action"] },
57
+ "then": { "properties": { "target": { "type": "object", "properties": { "view": { "const": "working-tree" }, "effect": { "const": "copy-worktree-to-index" } } } } }
58
+ },
59
+ {
60
+ "if": { "properties": { "action": { "const": "source.unstage" } }, "required": ["action"] },
61
+ "then": { "properties": { "target": { "type": "object", "properties": { "view": { "const": "staged" }, "effect": { "const": "restore-index-from-head" } } } } }
62
+ }
63
+ ],
64
+ "$defs": {
65
+ "mutationTarget": {
66
+ "type": "object",
67
+ "additionalProperties": false,
68
+ "required": ["view", "repoRef", "fileRef", "diffRef", "status", "path", "oldPath", "effect", "taskRevision", "workspaceRevision", "indexRevision", "viewRevision", "fileRevision", "workspacePreimage", "indexPreimage", "patchPreimage", "contentDigest", "hunkRefs"],
69
+ "properties": {
70
+ "view": { "enum": ["working-tree", "staged"] },
71
+ "repoRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
72
+ "fileRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
73
+ "diffRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
74
+ "status": { "enum": ["A", "M", "D", "R", "U"] },
75
+ "path": { "$ref": "common-v1.schema.json#/$defs/safeDisplayPath" },
76
+ "oldPath": { "$ref": "common-v1.schema.json#/$defs/nullableSafeDisplayPath" },
77
+ "effect": { "enum": ["copy-worktree-to-index", "restore-index-from-head"] },
78
+ "taskRevision": { "$ref": "common-v1.schema.json#/$defs/revisionToken" },
79
+ "workspaceRevision": { "$ref": "common-v1.schema.json#/$defs/revisionToken" },
80
+ "indexRevision": { "$ref": "common-v1.schema.json#/$defs/revisionToken" },
81
+ "viewRevision": { "$ref": "common-v1.schema.json#/$defs/revisionToken" },
82
+ "fileRevision": { "$ref": "common-v1.schema.json#/$defs/revisionToken" },
83
+ "workspacePreimage": { "$ref": "common-v1.schema.json#/$defs/workingTreeDigest" },
84
+ "indexPreimage": { "$ref": "common-v1.schema.json#/$defs/digest" },
85
+ "patchPreimage": { "$ref": "common-v1.schema.json#/$defs/digest" },
86
+ "contentDigest": { "$ref": "common-v1.schema.json#/$defs/digest" },
87
+ "hunkRefs": {
88
+ "type": "array",
89
+ "maxItems": 128,
90
+ "uniqueItems": true,
91
+ "items": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
@@ -0,0 +1,130 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://piagent.io.vn/schemas/piagent-webui/source-revert-v1.schema.json",
4
+ "title": "Piagent WebUI confirmed exact source revert preview v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "version", "generatedAt", "identity", "action", "state", "target", "preview", "reasonCode", "health"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "version": { "const": "piagent-webui-source-revert-v1" },
11
+ "generatedAt": { "$ref": "common-v1.schema.json#/$defs/timestamp" },
12
+ "identity": { "$ref": "common-v1.schema.json#/$defs/identity" },
13
+ "action": { "const": "source.revert" },
14
+ "state": { "enum": ["ready", "unavailable"] },
15
+ "target": { "anyOf": [{ "$ref": "#/$defs/revertTarget" }, { "type": "null" }] },
16
+ "preview": { "anyOf": [{ "$ref": "#/$defs/revertPreview" }, { "type": "null" }] },
17
+ "reasonCode": { "$ref": "common-v1.schema.json#/$defs/nullableReasonCode" },
18
+ "health": { "$ref": "common-v1.schema.json#/$defs/health" }
19
+ },
20
+ "allOf": [
21
+ {
22
+ "properties": {
23
+ "identity": {
24
+ "type": "object",
25
+ "properties": {
26
+ "taskId": { "$ref": "common-v1.schema.json#/$defs/publicId" },
27
+ "taskRunId": { "$ref": "common-v1.schema.json#/$defs/publicId" },
28
+ "agentOperationId": { "type": "null" },
29
+ "toolCallId": { "type": "null" }
30
+ }
31
+ }
32
+ }
33
+ },
34
+ {
35
+ "if": { "properties": { "state": { "const": "ready" } }, "required": ["state"] },
36
+ "then": {
37
+ "properties": {
38
+ "target": { "$ref": "#/$defs/revertTarget" },
39
+ "preview": { "$ref": "#/$defs/revertPreview" },
40
+ "reasonCode": { "type": "null" },
41
+ "health": { "type": "object", "properties": { "state": { "const": "ok" } } }
42
+ }
43
+ },
44
+ "else": {
45
+ "properties": {
46
+ "target": { "type": "null" },
47
+ "preview": { "type": "null" },
48
+ "reasonCode": { "$ref": "common-v1.schema.json#/$defs/reasonCode" },
49
+ "health": { "type": "object", "properties": { "state": { "enum": ["unavailable", "error"] } } }
50
+ }
51
+ }
52
+ }
53
+ ],
54
+ "$defs": {
55
+ "revertPreview": {
56
+ "type": "object", "additionalProperties": false,
57
+ "required": ["basis", "hunks", "truncated"],
58
+ "properties": {
59
+ "basis": { "const": "index-to-working-tree" },
60
+ "hunks": {
61
+ "type": "array", "minItems": 1, "maxItems": 128,
62
+ "items": {
63
+ "type": "object", "additionalProperties": false,
64
+ "required": ["hunkRef", "header", "lines"],
65
+ "properties": {
66
+ "hunkRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
67
+ "header": { "type": "string", "minLength": 1, "maxLength": 1024 },
68
+ "lines": {
69
+ "type": "array", "maxItems": 5000,
70
+ "items": {
71
+ "type": "object", "additionalProperties": false,
72
+ "required": ["kind", "marker", "text"],
73
+ "properties": {
74
+ "kind": { "enum": ["added", "deleted", "context", "meta"] },
75
+ "marker": { "enum": ["+", "-", " ", "\\"] },
76
+ "text": { "type": "string", "maxLength": 16384 }
77
+ }
78
+ }
79
+ }
80
+ }
81
+ }
82
+ },
83
+ "truncated": { "const": false }
84
+ }
85
+ },
86
+ "revertTarget": {
87
+ "type": "object",
88
+ "additionalProperties": false,
89
+ "required": ["view", "repoRef", "fileRef", "diffRef", "status", "path", "oldPath", "effect", "taskRevision", "workspaceRevision", "indexRevision", "viewRevision", "fileRevision", "workspacePreimage", "indexPreimage", "patchPreimage", "contentDigest", "hunkRefs", "previewRef", "confirmedPreviewDigest", "expiresAt", "summary"],
90
+ "properties": {
91
+ "view": { "const": "working-tree" },
92
+ "repoRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
93
+ "fileRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
94
+ "diffRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
95
+ "status": { "const": "M" },
96
+ "path": { "$ref": "common-v1.schema.json#/$defs/safeDisplayPath" },
97
+ "oldPath": { "type": "null" },
98
+ "effect": { "const": "restore-worktree-from-index" },
99
+ "taskRevision": { "$ref": "common-v1.schema.json#/$defs/revisionToken" },
100
+ "workspaceRevision": { "$ref": "common-v1.schema.json#/$defs/revisionToken" },
101
+ "indexRevision": { "$ref": "common-v1.schema.json#/$defs/revisionToken" },
102
+ "viewRevision": { "$ref": "common-v1.schema.json#/$defs/revisionToken" },
103
+ "fileRevision": { "$ref": "common-v1.schema.json#/$defs/revisionToken" },
104
+ "workspacePreimage": { "$ref": "common-v1.schema.json#/$defs/workingTreeDigest" },
105
+ "indexPreimage": { "$ref": "common-v1.schema.json#/$defs/digest" },
106
+ "patchPreimage": { "$ref": "common-v1.schema.json#/$defs/digest" },
107
+ "contentDigest": { "$ref": "common-v1.schema.json#/$defs/digest" },
108
+ "hunkRefs": {
109
+ "type": "array", "maxItems": 1, "uniqueItems": true,
110
+ "items": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" }
111
+ },
112
+ "previewRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
113
+ "confirmedPreviewDigest": { "$ref": "common-v1.schema.json#/$defs/digest" },
114
+ "expiresAt": { "$ref": "common-v1.schema.json#/$defs/timestamp" },
115
+ "summary": {
116
+ "type": "object", "additionalProperties": false,
117
+ "required": ["files", "hunks", "additionsDiscarded", "deletionsRestored", "effect", "recovery"],
118
+ "properties": {
119
+ "files": { "const": 1 },
120
+ "hunks": { "type": "integer", "minimum": 1, "maximum": 128 },
121
+ "additionsDiscarded": { "type": "integer", "minimum": 0, "maximum": 65536 },
122
+ "deletionsRestored": { "type": "integer", "minimum": 0, "maximum": 65536 },
123
+ "effect": { "const": "discard-unstaged-keep-index" },
124
+ "recovery": { "const": "not-guaranteed" }
125
+ }
126
+ }
127
+ }
128
+ }
129
+ }
130
+ }
@@ -0,0 +1,88 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://piagent.io.vn/schemas/piagent-webui/subagent-tree-v1.schema.json",
4
+ "title": "Piagent WebUI bounded subagent ownership tree v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "version", "generatedAt", "identity", "runRef", "state", "treeRevision", "evidenceState", "orchestration", "parent", "children", "writer", "nestedLineage", "summary", "warnings", "health"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "version": { "const": "piagent-webui-subagent-tree-v1" },
11
+ "generatedAt": { "$ref": "common-v1.schema.json#/$defs/timestamp" },
12
+ "identity": { "$ref": "common-v1.schema.json#/$defs/identity" },
13
+ "runRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
14
+ "state": { "enum": ["ready", "unavailable"] },
15
+ "treeRevision": { "$ref": "common-v1.schema.json#/$defs/nullableRevisionToken" },
16
+ "evidenceState": { "enum": ["complete", "partial", "aggregate-only", "missing", "unknown"] },
17
+ "orchestration": { "$ref": "#/$defs/orchestration" },
18
+ "parent": { "anyOf": [{ "$ref": "#/$defs/parent" }, { "type": "null" }] },
19
+ "children": { "type": "array", "maxItems": 64, "items": { "$ref": "#/$defs/child" } },
20
+ "writer": { "$ref": "#/$defs/writer" },
21
+ "nestedLineage": { "$ref": "#/$defs/nestedLineage" },
22
+ "summary": { "$ref": "#/$defs/summary" },
23
+ "warnings": { "type": "array", "maxItems": 8, "items": { "$ref": "#/$defs/warning" } },
24
+ "health": { "$ref": "common-v1.schema.json#/$defs/health" }
25
+ },
26
+ "allOf": [
27
+ { "properties": { "identity": { "type": "object", "properties": {
28
+ "taskId": { "$ref": "common-v1.schema.json#/$defs/publicId" }, "taskRunId": { "$ref": "common-v1.schema.json#/$defs/publicId" },
29
+ "agentOperationId": { "type": "null" }, "toolCallId": { "type": "null" }
30
+ } } } },
31
+ {
32
+ "if": { "properties": { "state": { "const": "ready" } }, "required": ["state"] },
33
+ "then": { "properties": {
34
+ "treeRevision": { "$ref": "common-v1.schema.json#/$defs/revisionToken" },
35
+ "evidenceState": { "enum": ["complete", "partial", "aggregate-only", "missing"] },
36
+ "parent": { "$ref": "#/$defs/parent" },
37
+ "health": { "type": "object", "properties": { "state": { "enum": ["ok", "degraded"] } } }
38
+ } },
39
+ "else": { "properties": {
40
+ "treeRevision": { "type": "null" }, "evidenceState": { "const": "unknown" }, "parent": { "type": "null" },
41
+ "children": { "type": "array", "maxItems": 0 },
42
+ "writer": { "type": "object", "properties": { "state": { "const": "unknown" }, "ownerNodeRef": { "type": "null" } } },
43
+ "summary": { "type": "object", "properties": { "total": { "const": 0 }, "active": { "const": 0 }, "completed": { "const": 0 }, "staleResults": { "const": 0 }, "readOnly": { "const": 0 }, "singleWriter": { "const": 0 } } },
44
+ "warnings": { "type": "array", "maxItems": 0 },
45
+ "health": { "type": "object", "properties": { "state": { "enum": ["unavailable", "error"] } } }
46
+ } }
47
+ }
48
+ ],
49
+ "$defs": {
50
+ "orchestration": { "type": "object", "additionalProperties": false, "required": ["mode", "subagents"], "properties": {
51
+ "mode": { "enum": ["solo-first", "bounded-subagents", "parallel-readonly", "unknown"] },
52
+ "subagents": { "enum": ["not-used", "optional", "used", "unknown"] }
53
+ } },
54
+ "parent": { "type": "object", "additionalProperties": false, "required": ["nodeRef", "lifecycleState", "budgetTerminal", "mergeOwner"], "properties": {
55
+ "nodeRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" }, "lifecycleState": { "enum": ["active", "terminal", "unknown"] },
56
+ "budgetTerminal": { "type": ["boolean", "null"] }, "mergeOwner": { "const": "parent" }
57
+ } },
58
+ "child": { "type": "object", "additionalProperties": false, "required": ["nodeRef", "parentRef", "role", "authority", "lifecycleState", "reservedAt", "expiresAt", "completedAt", "currentWriter", "result"], "properties": {
59
+ "nodeRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" }, "parentRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
60
+ "role": { "enum": ["retriever", "scout", "planner", "worker", "reviewer", "oracle", "researcher"] },
61
+ "authority": { "enum": ["read-only", "single-writer"] }, "lifecycleState": { "enum": ["active", "succeeded", "failed", "cancelled", "orphaned"] },
62
+ "reservedAt": { "$ref": "common-v1.schema.json#/$defs/timestamp" }, "expiresAt": { "$ref": "common-v1.schema.json#/$defs/timestamp" },
63
+ "completedAt": { "anyOf": [{ "$ref": "common-v1.schema.json#/$defs/timestamp" }, { "type": "null" }] }, "currentWriter": { "type": "boolean" },
64
+ "result": { "$ref": "#/$defs/result" }
65
+ } },
66
+ "result": { "type": "object", "additionalProperties": false, "required": ["state", "disposition", "calls", "tokens"], "properties": {
67
+ "state": { "enum": ["accepted", "rejected", "stale-result", "not-recorded"] },
68
+ "disposition": { "$ref": "common-v1.schema.json#/$defs/nullableDisplayText" },
69
+ "calls": { "type": ["integer", "null"], "minimum": 0, "maximum": 101 },
70
+ "tokens": { "type": ["integer", "null"], "minimum": 0, "maximum": 100001 }
71
+ } },
72
+ "writer": { "type": "object", "additionalProperties": false, "required": ["state", "ownerNodeRef"], "properties": {
73
+ "state": { "enum": ["parent", "helper", "unknown"] }, "ownerNodeRef": { "$ref": "common-v1.schema.json#/$defs/nullableOpaqueRef" }
74
+ } },
75
+ "nestedLineage": { "type": "object", "additionalProperties": false, "required": ["state", "reasonCode"], "properties": {
76
+ "state": { "const": "unavailable" }, "reasonCode": { "const": "no-durable-nested-lineage" }
77
+ } },
78
+ "summary": { "type": "object", "additionalProperties": false, "required": ["total", "active", "completed", "staleResults", "readOnly", "singleWriter"], "properties": {
79
+ "total": { "type": "integer", "minimum": 0, "maximum": 64 }, "active": { "type": "integer", "minimum": 0, "maximum": 64 },
80
+ "completed": { "type": "integer", "minimum": 0, "maximum": 64 }, "staleResults": { "type": "integer", "minimum": 0, "maximum": 64 },
81
+ "readOnly": { "type": "integer", "minimum": 0, "maximum": 64 }, "singleWriter": { "type": "integer", "minimum": 0, "maximum": 64 }
82
+ } },
83
+ "warning": { "type": "object", "additionalProperties": false, "required": ["code", "count", "message"], "properties": {
84
+ "code": { "enum": ["helper-budget-missing", "expired-helper-derived-orphan", "helper-receipt-unmatched"] },
85
+ "count": { "type": "integer", "minimum": 1, "maximum": 1000000 }, "message": { "$ref": "common-v1.schema.json#/$defs/nonEmptyDisplayText" }
86
+ } }
87
+ }
88
+ }
@@ -0,0 +1,74 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://piagent.io.vn/schemas/piagent-webui/task-index-v1.schema.json",
4
+ "title": "Piagent WebUI authoritative local task run index v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "version", "generatedAt", "identity", "state", "indexRevision", "activeRunRef", "runs", "page", "warnings", "health"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "version": { "const": "piagent-webui-task-index-v1" },
11
+ "generatedAt": { "$ref": "common-v1.schema.json#/$defs/timestamp" },
12
+ "identity": { "$ref": "common-v1.schema.json#/$defs/identity" },
13
+ "state": { "enum": ["ready", "unavailable"] },
14
+ "indexRevision": { "$ref": "common-v1.schema.json#/$defs/nullableRevisionToken" },
15
+ "activeRunRef": { "$ref": "common-v1.schema.json#/$defs/nullableOpaqueRef" },
16
+ "runs": { "type": "array", "maxItems": 200, "items": { "$ref": "#/$defs/run" } },
17
+ "page": { "$ref": "#/$defs/page" },
18
+ "warnings": { "type": "array", "maxItems": 8, "items": { "$ref": "#/$defs/warning" } },
19
+ "health": { "$ref": "common-v1.schema.json#/$defs/health" }
20
+ },
21
+ "allOf": [
22
+ {
23
+ "properties": { "identity": { "type": "object", "properties": { "agentOperationId": { "type": "null" }, "toolCallId": { "type": "null" } } } }
24
+ },
25
+ {
26
+ "if": { "properties": { "state": { "const": "ready" } }, "required": ["state"] },
27
+ "then": { "properties": { "indexRevision": { "$ref": "common-v1.schema.json#/$defs/revisionToken" },
28
+ "health": { "type": "object", "properties": { "state": { "enum": ["ok", "degraded"] } } } } },
29
+ "else": { "properties": { "indexRevision": { "type": "null" }, "activeRunRef": { "type": "null" }, "runs": { "type": "array", "maxItems": 0 },
30
+ "page": { "type": "object", "properties": { "total": { "const": 0 }, "returned": { "const": 0 }, "truncated": { "const": false } } },
31
+ "health": { "type": "object", "properties": { "state": { "enum": ["unavailable", "error"] } } } } }
32
+ }
33
+ ],
34
+ "$defs": {
35
+ "run": {
36
+ "type": "object",
37
+ "additionalProperties": false,
38
+ "required": ["runRef", "taskRef", "taskId", "taskRunId", "summary", "sessionLabel", "outcome", "terminal", "attempt", "maxAttempts", "changeMode", "riskLane", "createdAt", "updatedAt", "isCurrentSession", "isActive", "progress"],
39
+ "properties": {
40
+ "runRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
41
+ "taskRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
42
+ "taskId": { "$ref": "common-v1.schema.json#/$defs/publicId" },
43
+ "taskRunId": { "$ref": "common-v1.schema.json#/$defs/publicId" },
44
+ "summary": { "type": "string", "maxLength": 240, "pattern": "^[^\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F\\u007F]*$" },
45
+ "sessionLabel": { "$ref": "common-v1.schema.json#/$defs/nullableDisplayText" },
46
+ "outcome": { "enum": ["pending", "completed", "blocked", "partial", "failed", "unknown"] },
47
+ "terminal": { "type": "boolean" },
48
+ "attempt": { "type": "integer", "minimum": 1, "maximum": 100 },
49
+ "maxAttempts": { "type": "integer", "minimum": 1, "maximum": 10 },
50
+ "changeMode": { "enum": ["read-only", "source-change"] },
51
+ "riskLane": { "enum": ["tiny", "normal", "high-risk"] },
52
+ "createdAt": { "$ref": "common-v1.schema.json#/$defs/timestamp" },
53
+ "updatedAt": { "$ref": "common-v1.schema.json#/$defs/timestamp" },
54
+ "isCurrentSession": { "type": "boolean" },
55
+ "isActive": { "type": "boolean" },
56
+ "progress": { "type": "object", "additionalProperties": false, "required": ["completed", "total"],
57
+ "properties": { "completed": { "type": "integer", "minimum": 0, "maximum": 12 }, "total": { "type": "integer", "minimum": 0, "maximum": 12 } } }
58
+ },
59
+ "allOf": [
60
+ { "if": { "properties": { "outcome": { "const": "pending" } }, "required": ["outcome"] }, "then": { "properties": { "terminal": { "const": false } } }, "else": { "properties": { "terminal": { "const": true } } } },
61
+ { "if": { "properties": { "isActive": { "const": true } }, "required": ["isActive"] }, "then": { "properties": { "isCurrentSession": { "const": true }, "outcome": { "const": "pending" }, "terminal": { "const": false } } } }
62
+ ]
63
+ },
64
+ "page": {
65
+ "type": "object", "additionalProperties": false, "required": ["total", "returned", "truncated"],
66
+ "properties": { "total": { "type": "integer", "minimum": 0, "maximum": 100000 }, "returned": { "type": "integer", "minimum": 0, "maximum": 200 }, "truncated": { "type": "boolean" } }
67
+ },
68
+ "warning": {
69
+ "type": "object", "additionalProperties": false, "required": ["code", "count", "message"],
70
+ "properties": { "code": { "enum": ["corrupt-task-state", "legacy-task-state", "task-index-truncated"] },
71
+ "count": { "type": "integer", "minimum": 1, "maximum": 100000 }, "message": { "$ref": "common-v1.schema.json#/$defs/nonEmptyDisplayText" } }
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://piagent.io.vn/schemas/piagent-webui/task-timeline-v1.schema.json",
4
+ "title": "Piagent WebUI durable task recovery timeline v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "version", "generatedAt", "identity", "runRef", "state", "timelineRevision", "continuity", "events", "page", "warnings", "health"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "version": { "const": "piagent-webui-task-timeline-v1" },
11
+ "generatedAt": { "$ref": "common-v1.schema.json#/$defs/timestamp" },
12
+ "identity": { "$ref": "common-v1.schema.json#/$defs/identity" },
13
+ "runRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
14
+ "state": { "enum": ["ready", "unavailable"] },
15
+ "timelineRevision": { "$ref": "common-v1.schema.json#/$defs/nullableRevisionToken" },
16
+ "continuity": { "$ref": "#/$defs/continuity" },
17
+ "events": { "type": "array", "maxItems": 300, "items": { "$ref": "#/$defs/event" } },
18
+ "page": { "$ref": "#/$defs/page" },
19
+ "warnings": { "type": "array", "maxItems": 8, "items": { "$ref": "#/$defs/warning" } },
20
+ "health": { "$ref": "common-v1.schema.json#/$defs/health" }
21
+ },
22
+ "allOf": [
23
+ { "properties": { "identity": { "type": "object", "properties": { "taskId": { "$ref": "common-v1.schema.json#/$defs/publicId" }, "taskRunId": { "$ref": "common-v1.schema.json#/$defs/publicId" }, "agentOperationId": { "type": "null" }, "toolCallId": { "type": "null" } } } } },
24
+ {
25
+ "if": { "properties": { "state": { "const": "ready" } }, "required": ["state"] },
26
+ "then": { "properties": { "timelineRevision": { "$ref": "common-v1.schema.json#/$defs/revisionToken" }, "health": { "type": "object", "properties": { "state": { "enum": ["ok", "degraded"] } } } } },
27
+ "else": { "properties": { "timelineRevision": { "type": "null" }, "events": { "type": "array", "maxItems": 0 },
28
+ "continuity": { "type": "object", "properties": { "crashEvidence": { "const": "unknown" }, "recoveryDecision": { "const": "unknown" }, "latestCheckpointRef": { "type": "null" }, "reasonCode": { "$ref": "common-v1.schema.json#/$defs/reasonCode" } } },
29
+ "page": { "type": "object", "properties": { "total": { "const": 0 }, "returned": { "const": 0 }, "truncated": { "const": false } } },
30
+ "health": { "type": "object", "properties": { "state": { "enum": ["unavailable", "error"] } } } } }
31
+ }
32
+ ],
33
+ "$defs": {
34
+ "continuity": { "type": "object", "additionalProperties": false, "required": ["crashEvidence", "recoveryDecision", "latestCheckpointRef", "reasonCode"],
35
+ "properties": { "crashEvidence": { "enum": ["possible-interruption", "unknown"] }, "recoveryDecision": { "enum": ["resume", "retry", "paused", "terminal", "blocked", "unknown"] },
36
+ "latestCheckpointRef": { "$ref": "common-v1.schema.json#/$defs/nullableOpaqueRef" }, "reasonCode": { "$ref": "common-v1.schema.json#/$defs/nullableReasonCode" } } },
37
+ "event": { "type": "object", "additionalProperties": false, "required": ["eventRef", "evidenceRef", "sequence", "recordedAt", "kind", "state", "title", "detail", "checkpointRef"],
38
+ "properties": { "eventRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" }, "evidenceRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
39
+ "sequence": { "type": "integer", "minimum": 1, "maximum": 2147483647 }, "recordedAt": { "$ref": "common-v1.schema.json#/$defs/timestamp" },
40
+ "kind": { "enum": ["task-written", "session-bound", "checkpoint", "pause-requested", "paused", "pause-cancelled", "resume-requested", "resumed", "resume-rejected", "stop-requested", "stop-settled", "continuation", "digest-migrated"] },
41
+ "state": { "enum": ["observed", "requested", "settled", "failed", "unknown"] }, "title": { "$ref": "common-v1.schema.json#/$defs/nonEmptyDisplayText" },
42
+ "detail": { "$ref": "common-v1.schema.json#/$defs/nullableDisplayText" }, "checkpointRef": { "$ref": "common-v1.schema.json#/$defs/nullableOpaqueRef" } } },
43
+ "page": { "type": "object", "additionalProperties": false, "required": ["total", "returned", "truncated"], "properties": {
44
+ "total": { "type": "integer", "minimum": 0, "maximum": 100000 }, "returned": { "type": "integer", "minimum": 0, "maximum": 300 }, "truncated": { "type": "boolean" } } },
45
+ "warning": { "type": "object", "additionalProperties": false, "required": ["code", "count", "message"], "properties": {
46
+ "code": { "enum": ["journal-corrupt", "recoverable-tail", "timeline-truncated", "journal-input-truncated", "crash-not-observed"] }, "count": { "type": "integer", "minimum": 1, "maximum": 100000 },
47
+ "message": { "$ref": "common-v1.schema.json#/$defs/nonEmptyDisplayText" } } }
48
+ }
49
+ }