@piagent/platform 1.5.4 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/CHANGELOG.md +136 -0
  2. package/README.md +9 -8
  3. package/README.vi.md +9 -5
  4. package/adapters/web-frontend/profile.json +2 -4
  5. package/architecture/layers.json +18 -3
  6. package/benchmarks/deep-logic-v1/SPECIALIST_PROTOCOL.vi.md +122 -0
  7. package/benchmarks/deep-logic-v1/grade.mjs +272 -10
  8. package/benchmarks/deep-logic-v1/project/apps/admin/src/billing-summary.js +3 -0
  9. package/benchmarks/deep-logic-v1/project/benchmark-contract/public-smoke.test.js +166 -0
  10. package/benchmarks/deep-logic-v1/project/package.json +1 -1
  11. package/benchmarks/deep-logic-v1/project/packages/billing/src/close-period.js +3 -0
  12. package/benchmarks/deep-logic-v1/project/packages/billing/src/plan-timeline.js +3 -0
  13. package/benchmarks/deep-logic-v1/project/test/smoke.test.js +7 -1
  14. package/benchmarks/deep-logic-v1/prompts/budgeted-context-graph.md +2 -0
  15. package/benchmarks/deep-logic-v1/prompts/fair-dependency-scheduler.md +2 -0
  16. package/benchmarks/deep-logic-v1/prompts/layered-policy-resolution.md +2 -0
  17. package/benchmarks/deep-logic-v1/prompts/resumable-stream-assembly.md +3 -1
  18. package/benchmarks/deep-logic-v1/prompts/revision-event-reconciliation.md +2 -0
  19. package/benchmarks/deep-logic-v1/prompts/temporal-usage-billing-close.md +123 -0
  20. package/benchmarks/deep-logic-v1/prompts/transactional-config-merge.md +2 -0
  21. package/benchmarks/deep-logic-v1/suite.json +51 -3
  22. package/benchmarks/deep-logic-v1/variant.mjs +22 -1
  23. package/benchmarks/production-v1/spend-control.v1.json +68 -0
  24. package/benchmarks/production-v1/suite.json +42 -3
  25. package/catalog/capabilities.json +6 -6
  26. package/docs/command-reference-vietnamese.md +6 -6
  27. package/docs/context-engine.md +7 -1
  28. package/docs/distribution-standard.md +7 -7
  29. package/docs/en/architecture.md +1 -0
  30. package/docs/languages.json +4 -4
  31. package/docs/model-options.md +8 -5
  32. package/docs/operator-manual-vietnamese.md +13 -11
  33. package/docs/project-adapters.md +2 -2
  34. package/docs/publishing-for-teams.md +9 -0
  35. package/docs/quality-benchmark.md +271 -62
  36. package/docs/release-install-policy.md +10 -9
  37. package/docs/runtime-policy-design.md +4 -4
  38. package/docs/runtime-quality-baseline.md +13 -6
  39. package/docs/security-threat-model.md +2 -2
  40. package/docs/task-lifecycle-vietnamese.md +2 -2
  41. package/docs/team-onboarding.md +2 -2
  42. package/docs/usage-observability.md +7 -2
  43. package/docs/vi/architecture.md +1 -0
  44. package/docs-site/architecture.html +1 -1
  45. package/docs-site/benchmark.html +1 -1
  46. package/docs-site/commands.html +1 -1
  47. package/docs-site/context-engine.html +1 -1
  48. package/docs-site/en/architecture.html +1 -1
  49. package/docs-site/en/benchmark.html +1 -1
  50. package/docs-site/en/commands.html +1 -1
  51. package/docs-site/en/context-engine.html +1 -1
  52. package/docs-site/en/index.html +1 -1
  53. package/docs-site/en/mcp-approval.html +1 -1
  54. package/docs-site/en/mcp-auth.html +1 -1
  55. package/docs-site/en/mcp-servers.html +1 -1
  56. package/docs-site/en/mcp.html +1 -1
  57. package/docs-site/en/permissions.html +1 -1
  58. package/docs-site/en/profiles.html +1 -1
  59. package/docs-site/en/quickstart.html +1 -1
  60. package/docs-site/en/runtime.html +1 -1
  61. package/docs-site/en/scope.html +1 -1
  62. package/docs-site/en/security.html +1 -1
  63. package/docs-site/en/team.html +1 -1
  64. package/docs-site/en/whats-new.html +1 -1
  65. package/docs-site/en/workflows.html +1 -1
  66. package/docs-site/index.html +1 -1
  67. package/docs-site/mcp-approval.html +1 -1
  68. package/docs-site/mcp-auth.html +1 -1
  69. package/docs-site/mcp-servers.html +1 -1
  70. package/docs-site/mcp.html +1 -1
  71. package/docs-site/permissions.html +1 -1
  72. package/docs-site/profiles.html +1 -1
  73. package/docs-site/quickstart.html +1 -1
  74. package/docs-site/runtime.html +1 -1
  75. package/docs-site/scope.html +1 -1
  76. package/docs-site/security.html +1 -1
  77. package/docs-site/team.html +1 -1
  78. package/docs-site/whats-new.html +1 -1
  79. package/docs-site/workflows.html +1 -1
  80. package/evals/fixtures/benchmark-assurance-evidence.invalid.json +1 -1
  81. package/evals/fixtures/benchmark-assurance-evidence.valid.json +1 -1
  82. package/evals/fixtures/piagent-webui/session-live-state-v1.invalid.json +18 -0
  83. package/evals/fixtures/piagent-webui/session-live-state-v1.valid.json +27 -0
  84. package/evals/fs4-readiness-matrix.v1.json +2 -2
  85. package/evals/fs5-causal-arm.v1.json +2 -2
  86. package/evals/fs5-pilot-protocol.v1.json +2 -2
  87. package/evals/fs5-pilot-protocol.v4.json +6 -5
  88. package/evals/fs5-pilot-protocol.v5.json +7 -6
  89. package/evals/private-holdout-v1/public-exposure.v1.json +1 -1
  90. package/package.json +3 -1
  91. package/packages/piagent-core/benchmark/benchmark-assurance.js +4 -1
  92. package/packages/piagent-core/benchmark/benchmark-bootstrap.js +91 -9
  93. package/packages/piagent-core/benchmark/benchmark-claim-restrictions.js +38 -7
  94. package/packages/piagent-core/benchmark/benchmark-cli.js +7 -7
  95. package/packages/piagent-core/benchmark/benchmark-codex.js +3 -1
  96. package/packages/piagent-core/benchmark/benchmark-comparison.js +271 -2
  97. package/packages/piagent-core/benchmark/benchmark-core.js +732 -661
  98. package/packages/piagent-core/benchmark/benchmark-execution-guard.js +7 -5
  99. package/packages/piagent-core/benchmark/benchmark-forensics.js +439 -4
  100. package/packages/piagent-core/benchmark/benchmark-host-readiness.js +639 -0
  101. package/packages/piagent-core/benchmark/benchmark-matrix.js +22 -4
  102. package/packages/piagent-core/benchmark/benchmark-normalized-cost.js +317 -0
  103. package/packages/piagent-core/benchmark/benchmark-preflight.js +3 -1
  104. package/packages/piagent-core/benchmark/benchmark-process.js +6 -5
  105. package/packages/piagent-core/benchmark/benchmark-provider-wire.js +126 -0
  106. package/packages/piagent-core/benchmark/benchmark-record-validation.js +183 -0
  107. package/packages/piagent-core/benchmark/benchmark-report.js +116 -12
  108. package/packages/piagent-core/benchmark/benchmark-resume-recovery.js +14 -0
  109. package/packages/piagent-core/benchmark/benchmark-runner-policy.js +26 -0
  110. package/packages/piagent-core/benchmark/benchmark-stage-diagnostic.js +782 -0
  111. package/packages/piagent-core/benchmark/benchmark-statistics.js +64 -0
  112. package/packages/piagent-core/benchmark/benchmark-stop-policy.js +8 -5
  113. package/packages/piagent-core/benchmark/benchmark-suite-identity.js +31 -0
  114. package/packages/piagent-core/benchmark/benchmark-suite-runtime.js +13 -9
  115. package/packages/piagent-core/benchmark/benchmark-suite.js +128 -2
  116. package/packages/piagent-core/benchmark/benchmark-summary-support.js +376 -0
  117. package/packages/piagent-core/benchmark/benchmark-timing-diagnostics.js +971 -0
  118. package/packages/piagent-core/benchmark/benchmark-usage.js +311 -0
  119. package/packages/piagent-core/benchmark/benchmark-workflow.js +166 -0
  120. package/packages/piagent-core/docs/context-efficiency-improvement-plan.md +1080 -0
  121. package/packages/piagent-core/extensions/acceptance-contract-semantics.js +83 -69
  122. package/packages/piagent-core/extensions/acceptance-error-classes.js +160 -0
  123. package/packages/piagent-core/extensions/acceptance-executable-evidence.js +12 -9
  124. package/packages/piagent-core/extensions/acceptance-receipt.js +34 -11
  125. package/packages/piagent-core/extensions/acceptance-state-machine-evidence.js +518 -0
  126. package/packages/piagent-core/extensions/acceptance-test-binding-evidence.js +60 -0
  127. package/packages/piagent-core/extensions/context-efficiency-metrics.js +302 -0
  128. package/packages/piagent-core/extensions/context-efficiency-report.js +167 -0
  129. package/packages/piagent-core/extensions/context-engine.js +148 -145
  130. package/packages/piagent-core/extensions/context-evidence.js +48 -0
  131. package/packages/piagent-core/extensions/context-import-links.js +296 -0
  132. package/packages/piagent-core/extensions/context-telemetry-integrity.js +65 -0
  133. package/packages/piagent-core/extensions/criterion-context-pack.js +422 -7
  134. package/packages/piagent-core/extensions/criterion-graph.js +78 -8
  135. package/packages/piagent-core/extensions/guard-types.ts +3 -0
  136. package/packages/piagent-core/extensions/javascript-regex-evidence.js +32 -0
  137. package/packages/piagent-core/extensions/piagent-guard.ts +250 -43
  138. package/packages/piagent-core/extensions/policy-core.js +1 -1
  139. package/packages/piagent-core/extensions/task-contract-view.js +17 -3
  140. package/packages/piagent-core/extensions/task-lifecycle.js +7 -2
  141. package/packages/piagent-core/extensions/task-state.js +40 -134
  142. package/packages/piagent-core/extensions/verification-intelligence.js +3 -1
  143. package/packages/piagent-core/extensions/workspace-evidence-roots.js +157 -0
  144. package/packages/piagent-core/package.json +1 -1
  145. package/packages/piagent-core/policies/base-policy.json +3 -0
  146. package/packages/piagent-core/runtime/context/context-delivery.ts +103 -0
  147. package/packages/piagent-core/runtime/context/context-delta-shadow.ts +53 -0
  148. package/packages/piagent-core/runtime/context/context-efficiency-format.ts +47 -0
  149. package/packages/piagent-core/runtime/context/context-evidence-qualification.ts +32 -0
  150. package/packages/piagent-core/runtime/context/prefix-telemetry.ts +47 -0
  151. package/packages/piagent-core/runtime/context/repository-memory-hints.ts +27 -0
  152. package/packages/piagent-core/runtime/hooks/agent-prompt-telemetry.ts +56 -0
  153. package/packages/piagent-core/runtime/hooks/agent-start-hook.ts +162 -102
  154. package/packages/piagent-core/runtime/hooks/completion-hook.ts +5 -6
  155. package/packages/piagent-core/runtime/hooks/input-hook.ts +11 -1
  156. package/packages/piagent-core/runtime/hooks/session-hooks.ts +22 -2
  157. package/packages/piagent-core/runtime/hooks/session-start-hook.ts +7 -2
  158. package/packages/piagent-core/runtime/hooks/tool-result-content-guards.ts +95 -0
  159. package/packages/piagent-core/runtime/hooks/tool-result-hook.ts +84 -102
  160. package/packages/piagent-core/runtime/inspection/activity-event-adapter.ts +9 -3
  161. package/packages/piagent-core/runtime/inspection/activity-recovery.ts +104 -0
  162. package/packages/piagent-core/runtime/inspection/approval-broker.ts +29 -5
  163. package/packages/piagent-core/runtime/inspection/task-compaction-history.ts +1 -1
  164. package/packages/piagent-core/runtime/inspection/task-handoff-history.ts +1 -1
  165. package/packages/piagent-core/runtime/inspection/tool-failure-classification.ts +53 -0
  166. package/packages/piagent-core/runtime/inspection/webui-snapshot.ts +34 -6
  167. package/packages/piagent-core/runtime/model/authenticated-catalog.ts +17 -9
  168. package/packages/piagent-core/runtime/model/openai-codex-reasoning.ts +83 -0
  169. package/packages/piagent-core/runtime/model/provider-wire-fingerprint.ts +238 -0
  170. package/packages/piagent-core/runtime/orchestration/role-policy.ts +1 -1
  171. package/packages/piagent-core/runtime/product/activity-inspector.ts +7 -2
  172. package/packages/piagent-core/runtime/product/efficiency-metrics.ts +4 -2
  173. package/packages/piagent-core/runtime/quality/exact-output-contract.ts +2 -1
  174. package/packages/piagent-core/runtime/quality/performance-assurance-signals.ts +23 -0
  175. package/packages/piagent-core/runtime/quality/performance-assurance.ts +6 -2
  176. package/packages/piagent-core/runtime/recovery/edit-recovery-context.ts +113 -0
  177. package/packages/piagent-core/runtime/recovery/edit-recovery-delivery.ts +42 -0
  178. package/packages/piagent-core/runtime/recovery/semantic-repair-handshake.ts +55 -2
  179. package/packages/piagent-core/runtime/recovery/semantic-repair-runtime.ts +55 -2
  180. package/packages/piagent-core/runtime/registration/context-commands.ts +66 -5
  181. package/packages/piagent-core/runtime/registration/policy-tools.ts +46 -11
  182. package/packages/piagent-core/runtime/registration/task-completion-tools.ts +49 -16
  183. package/packages/piagent-core/runtime/registration/task-start-guidance.ts +163 -0
  184. package/packages/piagent-core/runtime/registration/task-start-retry-helpers.ts +37 -0
  185. package/packages/piagent-core/runtime/registration/task-start-tool.ts +67 -62
  186. package/packages/piagent-core/runtime/session/runtime-state.ts +154 -2
  187. package/packages/piagent-core/runtime/session/system-prompt.ts +4 -4
  188. package/packages/piagent-core/runtime/tools/apply-patch-tool.ts +500 -0
  189. package/packages/piagent-core/runtime/trajectory/trajectory-runtime.ts +2 -1
  190. package/packages/piagent-core/runtime/workflows/task-intake.ts +43 -2
  191. package/packages/piagent-core/security/sensitive-data.js +13 -218
  192. package/packages/piagent-core/security/sensitive-project-file.js +42 -0
  193. package/packages/piagent-core/security/sensitive-source-expression.js +330 -0
  194. package/packages/piagent-core/security/sensitive-source-formats.js +394 -0
  195. package/packages/piagent-core/security/sensitive-text.js +234 -0
  196. package/packages/piagent-core/subagents/piagent-worker.md +1 -1
  197. package/packages/piagent-webui/dist/client/assets/{MarkdownMessage-rD9WJKxs.js → MarkdownMessage-CxeZqTte.js} +1 -1
  198. package/packages/piagent-webui/dist/client/assets/index-DynIMe8I.js +176 -0
  199. package/packages/piagent-webui/dist/client/index.html +1 -1
  200. package/packages/piagent-webui/gateway/gateway-events.ts +109 -5
  201. package/packages/piagent-webui/gateway/gateway-service.ts +3 -0
  202. package/packages/piagent-webui/gateway/gateway-session-stream.ts +93 -7
  203. package/packages/piagent-webui/gateway/session-command-controller.ts +18 -3
  204. package/packages/piagent-webui/gateway/session-effective-options.ts +47 -0
  205. package/packages/piagent-webui/gateway/session-live-state.ts +21 -0
  206. package/packages/piagent-webui/gateway/session-operation-start.ts +5 -1
  207. package/packages/piagent-webui/gateway/session-operation-watchdog.ts +158 -0
  208. package/packages/piagent-webui/gateway/session-runtime-factory.ts +45 -0
  209. package/packages/piagent-webui/gateway/session-runtime-supervisor.ts +139 -120
  210. package/packages/piagent-webui/server/loopback-server.ts +8 -0
  211. package/packages/piagent-webui/server/transcript-projection.ts +22 -4
  212. package/packages/piagent-webui/shared/text-visibility.ts +10 -0
  213. package/schemas/piagent-webui/catalog-v1.json +9 -0
  214. package/schemas/piagent-webui/gateway-protocol-v1.schema.json +53 -3
  215. package/schemas/piagent-webui/session-live-state-v1.schema.json +76 -0
  216. package/schemas/task-contract.schema.json +12 -1
  217. package/scripts/benchmark-runner-core.mjs +355 -359
  218. package/scripts/benchmark-runner-finalization.mjs +309 -0
  219. package/scripts/benchmark-runner-host-readiness.mjs +94 -0
  220. package/scripts/benchmark-runner-support.mjs +200 -0
  221. package/scripts/benchmark-session.mjs +95 -41
  222. package/scripts/configure-model-scope.sh +4 -3
  223. package/scripts/helper-evaluation.mjs +1 -1
  224. package/scripts/install-global.sh +2 -2
  225. package/scripts/pi-usage-history.mjs +37 -10
  226. package/scripts/piagent-dashboard.mjs +13 -1
  227. package/scripts/setup.sh +2 -2
  228. package/scripts/verify-local.sh +5 -1
  229. package/templates/global/settings.json +2 -1
  230. package/packages/piagent-webui/dist/client/assets/index-BZRFw1u6.js +0 -174
@@ -0,0 +1,10 @@
1
+ // Classification only: callers keep the original Unicode text unchanged.
2
+ // A response needs at least one rendering code point; whitespace, controls and
3
+ // Unicode default-ignorables alone cannot form a visible assistant answer.
4
+ const NON_RENDERING_CODE_POINT = /^(?:\p{White_Space}|\p{Cc}|\p{Default_Ignorable_Code_Point})$/u;
5
+ const ANSI_ESCAPE = /\u001b(?:\[[0-?]*[ -/]*[@-~]|[@-_])/g;
6
+
7
+ export function hasVisibleText(value: string): boolean {
8
+ for (const codePoint of value.replace(ANSI_ESCAPE, "")) if (!NON_RENDERING_CODE_POINT.test(codePoint)) return true;
9
+ return false;
10
+ }
@@ -218,6 +218,15 @@
218
218
  "supported": true,
219
219
  "current": true
220
220
  },
221
+ {
222
+ "name": "session-live-state-v1",
223
+ "file": "session-live-state-v1.schema.json",
224
+ "id": "https://piagent.io.vn/schemas/piagent-webui/session-live-state-v1.schema.json",
225
+ "documentVersion": 1,
226
+ "role": "read-model",
227
+ "supported": true,
228
+ "current": true
229
+ },
221
230
  {
222
231
  "name": "session-command-v1",
223
232
  "file": "session-command-v1.schema.json",
@@ -269,7 +269,7 @@
269
269
  "sequence": { "$ref": "#/$defs/stateVersion" },
270
270
  "stateVersion": { "$ref": "#/$defs/stateVersion" },
271
271
  "generatedAt": { "$ref": "common-v1.schema.json#/$defs/timestamp" },
272
- "kind": { "enum": ["catalog.changed", "session.changed", "runtime.changed", "resync.required", "message.delta", "message.completed", "tool.started", "tool.completed"] },
272
+ "kind": { "enum": ["catalog.changed", "session.changed", "runtime.changed", "resync.required", "message.delta", "message.completed", "operation.settled", "tool.started", "tool.completed"] },
273
273
  "payload": { "type": "object" }
274
274
  }
275
275
  },
@@ -411,6 +411,54 @@
411
411
  }
412
412
  ]
413
413
  },
414
+ "operationCompletedPayload": {
415
+ "type": "object",
416
+ "additionalProperties": false,
417
+ "required": ["sessionRef", "operationRef", "messageRef", "sessionRevision", "settlement", "reasonCode"],
418
+ "properties": {
419
+ "sessionRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
420
+ "operationRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
421
+ "messageRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
422
+ "sessionRevision": { "$ref": "common-v1.schema.json#/$defs/revisionToken" },
423
+ "settlement": { "const": "completed" },
424
+ "reasonCode": { "type": "null" }
425
+ }
426
+ },
427
+ "operationIncompletePayload": {
428
+ "type": "object",
429
+ "additionalProperties": false,
430
+ "required": ["sessionRef", "operationRef", "messageRef", "sessionRevision", "settlement", "reasonCode"],
431
+ "properties": {
432
+ "sessionRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
433
+ "operationRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
434
+ "messageRef": { "$ref": "common-v1.schema.json#/$defs/nullableOpaqueRef" },
435
+ "sessionRevision": {
436
+ "anyOf": [
437
+ { "$ref": "common-v1.schema.json#/$defs/revisionToken" },
438
+ { "type": "null" }
439
+ ]
440
+ },
441
+ "settlement": { "enum": ["blocked", "aborted", "error", "unknown"] },
442
+ "reasonCode": { "$ref": "common-v1.schema.json#/$defs/reasonCode" }
443
+ }
444
+ },
445
+ "operationSettledEvent": {
446
+ "allOf": [
447
+ { "$ref": "#/$defs/eventBase" },
448
+ {
449
+ "type": "object",
450
+ "properties": {
451
+ "kind": { "const": "operation.settled" },
452
+ "payload": {
453
+ "oneOf": [
454
+ { "$ref": "#/$defs/operationCompletedPayload" },
455
+ { "$ref": "#/$defs/operationIncompletePayload" }
456
+ ]
457
+ }
458
+ }
459
+ }
460
+ ]
461
+ },
414
462
  "toolEvent": {
415
463
  "allOf": [
416
464
  { "$ref": "#/$defs/eventBase" },
@@ -421,13 +469,14 @@
421
469
  "payload": {
422
470
  "type": "object",
423
471
  "additionalProperties": false,
424
- "required": ["sessionRef", "operationRef", "toolCallRef", "toolLabel", "isError"],
472
+ "required": ["sessionRef", "operationRef", "toolCallRef", "toolLabel", "isError", "reasonCode"],
425
473
  "properties": {
426
474
  "sessionRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
427
475
  "operationRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
428
476
  "toolCallRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
429
477
  "toolLabel": { "type": "string", "minLength": 1, "maxLength": 160, "pattern": "^[^\\u0000-\\u001F\\u007F]+$" },
430
- "isError": { "type": ["boolean", "null"] }
478
+ "isError": { "type": ["boolean", "null"] },
479
+ "reasonCode": { "$ref": "common-v1.schema.json#/$defs/nullableReasonCode" }
431
480
  }
432
481
  }
433
482
  },
@@ -449,6 +498,7 @@
449
498
  { "$ref": "#/$defs/resyncRequiredEvent" },
450
499
  { "$ref": "#/$defs/messageDeltaEvent" },
451
500
  { "$ref": "#/$defs/messageCompletedEvent" },
501
+ { "$ref": "#/$defs/operationSettledEvent" },
452
502
  { "$ref": "#/$defs/toolEvent" }
453
503
  ]
454
504
  }
@@ -0,0 +1,76 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://piagent.io.vn/schemas/piagent-webui/session-live-state-v1.schema.json",
4
+ "title": "Piagent WebUI canonical volatile session operation state v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "version", "generatedAt", "gatewayInstanceRef", "eventSequence", "state", "operations", "settlements", "reasonCode"],
8
+ "properties": {
9
+ "schemaVersion": { "const": 1 },
10
+ "version": { "const": "piagent-session-live-state-v1" },
11
+ "generatedAt": { "$ref": "common-v1.schema.json#/$defs/timestamp" },
12
+ "gatewayInstanceRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
13
+ "eventSequence": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
14
+ "state": { "enum": ["ready", "unavailable"] },
15
+ "operations": {
16
+ "type": "array",
17
+ "maxItems": 100,
18
+ "uniqueItems": true,
19
+ "items": { "$ref": "#/$defs/currentOperation" }
20
+ },
21
+ "settlements": {
22
+ "description": "Bounded, Gateway-epoch-local non-success terminal operation outcomes retained for Activity reconciliation.",
23
+ "type": "array",
24
+ "maxItems": 100,
25
+ "uniqueItems": true,
26
+ "items": { "$ref": "#/$defs/terminalSettlement" }
27
+ },
28
+ "reasonCode": { "$ref": "common-v1.schema.json#/$defs/nullableReasonCode" }
29
+ },
30
+ "allOf": [
31
+ {
32
+ "if": { "properties": { "state": { "const": "ready" } }, "required": ["state"] },
33
+ "then": { "properties": { "reasonCode": { "type": "null" } } },
34
+ "else": {
35
+ "properties": {
36
+ "operations": { "type": "array", "maxItems": 0 },
37
+ "settlements": { "type": "array", "maxItems": 0 },
38
+ "reasonCode": { "$ref": "common-v1.schema.json#/$defs/reasonCode" }
39
+ }
40
+ }
41
+ }
42
+ ],
43
+ "$defs": {
44
+ "currentOperation": {
45
+ "type": "object",
46
+ "additionalProperties": false,
47
+ "required": ["sessionRef", "operationRef", "state", "abortable"],
48
+ "properties": {
49
+ "sessionRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
50
+ "operationRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
51
+ "state": { "enum": ["running", "waiting-approval", "settling"] },
52
+ "abortable": { "type": "boolean" }
53
+ },
54
+ "allOf": [
55
+ {
56
+ "if": { "properties": { "state": { "const": "settling" } }, "required": ["state"] },
57
+ "then": { "properties": { "abortable": { "const": false } } },
58
+ "else": { "properties": { "abortable": { "const": true } } }
59
+ }
60
+ ]
61
+ },
62
+ "terminalSettlement": {
63
+ "type": "object",
64
+ "additionalProperties": false,
65
+ "required": ["sessionRef", "operationRef", "settlement", "reasonCode", "settledAt", "sequence"],
66
+ "properties": {
67
+ "sessionRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
68
+ "operationRef": { "$ref": "common-v1.schema.json#/$defs/opaqueRef" },
69
+ "settlement": { "enum": ["blocked", "aborted", "error", "unknown"] },
70
+ "reasonCode": { "$ref": "common-v1.schema.json#/$defs/reasonCode" },
71
+ "settledAt": { "$ref": "common-v1.schema.json#/$defs/timestamp" },
72
+ "sequence": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }
73
+ }
74
+ }
75
+ }
76
+ }
@@ -469,6 +469,12 @@
469
469
  "read-only"
470
470
  ]
471
471
  },
472
+ "mutationPolicy": {
473
+ "enum": [
474
+ "required",
475
+ "forbidden"
476
+ ]
477
+ },
472
478
  "attempt": {
473
479
  "type": "integer",
474
480
  "minimum": 1,
@@ -570,7 +576,8 @@
570
576
  "$ref": "#/$defs/stringList"
571
577
  },
572
578
  {
573
- "minItems": 1
579
+ "minItems": 1,
580
+ "maxItems": 2000
574
581
  }
575
582
  ]
576
583
  },
@@ -863,6 +870,10 @@
863
870
  }
864
871
  },
865
872
  "allOf": [
873
+ {
874
+ "if": { "properties": { "changeMode": { "const": "read-only" } }, "required": ["changeMode"] },
875
+ "then": { "properties": { "mutationPolicy": { "const": "forbidden" } } }
876
+ },
866
877
  {
867
878
  "if": { "properties": { "workingTreeDigestAlgorithm": { "const": "legacy-untrusted" } }, "required": ["workingTreeDigestAlgorithm"] },
868
879
  "then": {