create-principles-disciple 1.150.4 → 1.150.6

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 (457) hide show
  1. package/_release/product-identity.json +1 -1
  2. package/codex-adapter/dist/ingestion/ingestion.js +25 -4
  3. package/codex-adapter/dist/ingestion/transcript-decoder.d.ts +5 -3
  4. package/codex-adapter/dist/ingestion/transcript-decoder.js +61 -5
  5. package/codex-adapter/package.json +1 -1
  6. package/console/dist/server/index.js +14 -2
  7. package/console/dist/server/models/ActivationsConsoleModel.js +3 -2
  8. package/console/dist/server/models/ApprovalsConsoleModel.js +2 -1
  9. package/console/dist/server/models/ApprovalsGroupedConsoleModel.js +2 -1
  10. package/console/dist/server/models/EvidenceChainConsoleModel.d.ts +46 -0
  11. package/console/dist/server/models/EvidenceChainConsoleModel.js +121 -2
  12. package/console/dist/server/models/GovernanceConsoleModel.js +3 -2
  13. package/console/dist/server/models/GovernanceExperienceCollector.js +2 -1
  14. package/console/dist/server/models/GovernanceProjectionCollector.js +2 -1
  15. package/console/dist/server/models/IngestionHealthModel.d.ts +34 -0
  16. package/console/dist/server/models/IngestionHealthModel.js +254 -0
  17. package/console/dist/server/models/IntentDecisionModel.js +2 -2
  18. package/console/dist/server/models/IntentPageModel.js +2 -1
  19. package/console/dist/server/models/OwnerDecisionConsoleModel.js +3 -3
  20. package/console/dist/server/models/OwnerDecisionViewModel.js +2 -2
  21. package/console/dist/server/models/PrincipleTrajectoryModel.js +2 -1
  22. package/console/dist/server/models/ReceiptsConsoleModel.js +2 -2
  23. package/console/dist/server/models/RuleCandidateBindingConsoleModel.js +3 -2
  24. package/console/dist/server/routes/diagnostician.js +2 -1
  25. package/console/dist/server/routes/evidence-chain.d.ts +4 -0
  26. package/console/dist/server/routes/evidence-chain.js +22 -0
  27. package/console/dist/server/routes/failed-tasks.js +78 -2
  28. package/console/dist/server/routes/health.d.ts +8 -0
  29. package/console/dist/server/routes/health.js +72 -0
  30. package/console/dist/server/routes/owner-identity.d.ts +6 -0
  31. package/console/dist/server/routes/owner-identity.js +7 -3
  32. package/console/dist/server/routes/principles.js +3 -3
  33. package/console/dist/web/assets/app.css +3 -0
  34. package/console/dist/web/assets/app.js +33 -31
  35. package/core/dist/runtime/activation/adaptive-selection-output.d.ts +0 -21
  36. package/core/dist/runtime/activation/adaptive-selection-output.d.ts.map +1 -1
  37. package/core/dist/runtime/activation/adaptive-selection-output.js.map +1 -1
  38. package/core/dist/runtime/activation/index.d.ts +2 -6
  39. package/core/dist/runtime/activation/index.d.ts.map +1 -1
  40. package/core/dist/runtime/activation/index.js.map +1 -1
  41. package/core/dist/runtime/activation/production-gate-deps.d.ts +2 -1
  42. package/core/dist/runtime/activation/production-gate-deps.d.ts.map +1 -1
  43. package/core/dist/runtime/activation/prompt-activation-reader-contract.d.ts +2 -1
  44. package/core/dist/runtime/activation/prompt-activation-reader-contract.d.ts.map +1 -1
  45. package/core/dist/runtime/activation/writers/index.d.ts +0 -1
  46. package/core/dist/runtime/activation/writers/index.d.ts.map +1 -1
  47. package/core/dist/runtime/activation/writers/rule-host-writer.d.ts.map +1 -1
  48. package/core/dist/runtime/activation/writers/rule-host-writer.js +15 -6
  49. package/core/dist/runtime/activation/writers/rule-host-writer.js.map +1 -1
  50. package/core/dist/runtime/activation-compatibility-read-model.d.ts +3 -2
  51. package/core/dist/runtime/activation-compatibility-read-model.d.ts.map +1 -1
  52. package/core/dist/runtime/adapter/context-budget.d.ts +3 -14
  53. package/core/dist/runtime/adapter/context-budget.d.ts.map +1 -1
  54. package/core/dist/runtime/adapter/context-budget.js +2 -2
  55. package/core/dist/runtime/adapter/context-budget.js.map +1 -1
  56. package/core/dist/runtime/adapter/index.d.ts +1 -2
  57. package/core/dist/runtime/adapter/index.d.ts.map +1 -1
  58. package/core/dist/runtime/adapter/index.js +1 -1
  59. package/core/dist/runtime/adapter/index.js.map +1 -1
  60. package/core/dist/runtime/adapter/output-repair-contract.d.ts +18 -1
  61. package/core/dist/runtime/adapter/output-repair-contract.d.ts.map +1 -1
  62. package/core/dist/runtime/adapter/output-repair-contract.js +94 -0
  63. package/core/dist/runtime/adapter/output-repair-contract.js.map +1 -1
  64. package/core/dist/runtime/adapter/pi-ai-runtime-adapter.d.ts +2 -3
  65. package/core/dist/runtime/adapter/pi-ai-runtime-adapter.d.ts.map +1 -1
  66. package/core/dist/runtime/adapter/pi-ai-runtime-adapter.js +5 -2
  67. package/core/dist/runtime/adapter/pi-ai-runtime-adapter.js.map +1 -1
  68. package/core/dist/runtime/adapter/principle-tree-ledger-adapter.d.ts +1 -1
  69. package/core/dist/runtime/adapter/principle-tree-ledger-adapter.d.ts.map +1 -1
  70. package/core/dist/runtime/adapter/schema-prompt-adapter.d.ts +0 -1
  71. package/core/dist/runtime/adapter/schema-prompt-adapter.d.ts.map +1 -1
  72. package/core/dist/runtime/adapter/schema-prompt-adapter.js +43 -1
  73. package/core/dist/runtime/adapter/schema-prompt-adapter.js.map +1 -1
  74. package/core/dist/runtime/bridge-result-shaper.d.ts +1 -1
  75. package/core/dist/runtime/bridge-result-shaper.d.ts.map +1 -1
  76. package/core/dist/runtime/candidate-intake-service.d.ts +2 -1
  77. package/core/dist/runtime/candidate-intake-service.d.ts.map +1 -1
  78. package/core/dist/runtime/cli/diagnose.d.ts +4 -3
  79. package/core/dist/runtime/cli/diagnose.d.ts.map +1 -1
  80. package/core/dist/runtime/config/index.d.ts +2 -2
  81. package/core/dist/runtime/config/index.d.ts.map +1 -1
  82. package/core/dist/runtime/config/index.js +3 -3
  83. package/core/dist/runtime/config/index.js.map +1 -1
  84. package/core/dist/runtime/config/pd-config-defaults.d.ts +0 -2
  85. package/core/dist/runtime/config/pd-config-defaults.d.ts.map +1 -1
  86. package/core/dist/runtime/config/pd-config-defaults.js +2 -2
  87. package/core/dist/runtime/config/pd-config-defaults.js.map +1 -1
  88. package/core/dist/runtime/config/pd-config-types.d.ts +2 -0
  89. package/core/dist/runtime/config/pd-config-types.d.ts.map +1 -1
  90. package/core/dist/runtime/config/pd-config-types.js.map +1 -1
  91. package/core/dist/runtime/config/pd-config-validate.d.ts.map +1 -1
  92. package/core/dist/runtime/config/pd-config-validate.js +10 -1
  93. package/core/dist/runtime/config/pd-config-validate.js.map +1 -1
  94. package/core/dist/runtime/config/pd-profile-constants.d.ts +1 -7
  95. package/core/dist/runtime/config/pd-profile-constants.d.ts.map +1 -1
  96. package/core/dist/runtime/config/pd-profile-constants.js +5 -6
  97. package/core/dist/runtime/config/pd-profile-constants.js.map +1 -1
  98. package/core/dist/runtime/config/pd-validate-profile.d.ts +3 -2
  99. package/core/dist/runtime/config/pd-validate-profile.d.ts.map +1 -1
  100. package/core/dist/runtime/context-payload.d.ts +0 -7
  101. package/core/dist/runtime/context-payload.d.ts.map +1 -1
  102. package/core/dist/runtime/context-payload.js +1 -1
  103. package/core/dist/runtime/context-payload.js.map +1 -1
  104. package/core/dist/runtime/core-principles/index.d.ts +1 -1
  105. package/core/dist/runtime/core-principles/index.d.ts.map +1 -1
  106. package/core/dist/runtime/correction/correction-types.d.ts +0 -10
  107. package/core/dist/runtime/correction/correction-types.d.ts.map +1 -1
  108. package/core/dist/runtime/correction/correction-types.js.map +1 -1
  109. package/core/dist/runtime/diagnostician/diag-distiller-output.d.ts +0 -3
  110. package/core/dist/runtime/diagnostician/diag-distiller-output.d.ts.map +1 -1
  111. package/core/dist/runtime/diagnostician/diag-distiller-output.js +1 -1
  112. package/core/dist/runtime/diagnostician/diag-distiller-output.js.map +1 -1
  113. package/core/dist/runtime/diagnostician/diag-rootcause-output.d.ts +3 -11
  114. package/core/dist/runtime/diagnostician/diag-rootcause-output.d.ts.map +1 -1
  115. package/core/dist/runtime/diagnostician/diag-rootcause-output.js +3 -3
  116. package/core/dist/runtime/diagnostician/diag-rootcause-output.js.map +1 -1
  117. package/core/dist/runtime/diagnostician/distiller-prompt-builder.d.ts +5 -4
  118. package/core/dist/runtime/diagnostician/distiller-prompt-builder.d.ts.map +1 -1
  119. package/core/dist/runtime/diagnostician/evidence-ref-binding.d.ts +2 -1
  120. package/core/dist/runtime/diagnostician/evidence-ref-binding.d.ts.map +1 -1
  121. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.d.ts +2 -1
  122. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.d.ts.map +1 -1
  123. package/core/dist/runtime/diagnostician/router-prompt-builder.d.ts +22 -3
  124. package/core/dist/runtime/diagnostician/router-prompt-builder.d.ts.map +1 -1
  125. package/core/dist/runtime/diagnostician/router-prompt-builder.js +11 -1
  126. package/core/dist/runtime/diagnostician/router-prompt-builder.js.map +1 -1
  127. package/core/dist/runtime/diagnostician-association-shadow.d.ts +2 -2
  128. package/core/dist/runtime/diagnostician-association-shadow.d.ts.map +1 -1
  129. package/core/dist/runtime/diagnostician-association-validation.d.ts +3 -2
  130. package/core/dist/runtime/diagnostician-association-validation.d.ts.map +1 -1
  131. package/core/dist/runtime/diagnostician-output.d.ts +32 -5
  132. package/core/dist/runtime/diagnostician-output.d.ts.map +1 -1
  133. package/core/dist/runtime/diagnostician-output.js +47 -4
  134. package/core/dist/runtime/diagnostician-output.js.map +1 -1
  135. package/core/dist/runtime/diagnostician-prompt-builder.d.ts +2 -1
  136. package/core/dist/runtime/diagnostician-prompt-builder.d.ts.map +1 -1
  137. package/core/dist/runtime/error-categories.d.ts.map +1 -1
  138. package/core/dist/runtime/error-categories.js +10 -1
  139. package/core/dist/runtime/error-categories.js.map +1 -1
  140. package/core/dist/runtime/evidence-sanitizer.d.ts +8 -1
  141. package/core/dist/runtime/evidence-sanitizer.d.ts.map +1 -1
  142. package/core/dist/runtime/evidence-sanitizer.js +10 -3
  143. package/core/dist/runtime/evidence-sanitizer.js.map +1 -1
  144. package/core/dist/runtime/evolution/evolution-types.d.ts +0 -26
  145. package/core/dist/runtime/evolution/evolution-types.d.ts.map +1 -1
  146. package/core/dist/runtime/evolution/evolution-types.js.map +1 -1
  147. package/core/dist/runtime/feature-flags/index.d.ts +0 -1
  148. package/core/dist/runtime/feature-flags/index.d.ts.map +1 -1
  149. package/core/dist/runtime/feature-flags/index.js.map +1 -1
  150. package/core/dist/runtime/golden-trace.d.ts +9 -1
  151. package/core/dist/runtime/golden-trace.d.ts.map +1 -1
  152. package/core/dist/runtime/golden-trace.js +7 -0
  153. package/core/dist/runtime/golden-trace.js.map +1 -1
  154. package/core/dist/runtime/governance-projection-contract.d.ts +0 -6
  155. package/core/dist/runtime/governance-projection-contract.d.ts.map +1 -1
  156. package/core/dist/runtime/governance-projection-contract.js +3 -3
  157. package/core/dist/runtime/governance-projection-contract.js.map +1 -1
  158. package/core/dist/runtime/internalization/artifact-summary.d.ts +5 -4
  159. package/core/dist/runtime/internalization/artifact-summary.d.ts.map +1 -1
  160. package/core/dist/runtime/internalization/artifact-summary.js +1 -1
  161. package/core/dist/runtime/internalization/artifact-summary.js.map +1 -1
  162. package/core/dist/runtime/internalization/artificer-intent-preflight.d.ts +1 -1
  163. package/core/dist/runtime/internalization/artificer-intent-preflight.d.ts.map +1 -1
  164. package/core/dist/runtime/internalization/artificer-output.d.ts +0 -2
  165. package/core/dist/runtime/internalization/artificer-output.d.ts.map +1 -1
  166. package/core/dist/runtime/internalization/artificer-output.js +17 -0
  167. package/core/dist/runtime/internalization/artificer-output.js.map +1 -1
  168. package/core/dist/runtime/internalization/artificer-prompt-builder.d.ts +14 -3
  169. package/core/dist/runtime/internalization/artificer-prompt-builder.d.ts.map +1 -1
  170. package/core/dist/runtime/internalization/artificer-prompt-builder.js +13 -1
  171. package/core/dist/runtime/internalization/artificer-prompt-builder.js.map +1 -1
  172. package/core/dist/runtime/internalization/artificer-run-correlation.d.ts +3 -2
  173. package/core/dist/runtime/internalization/artificer-run-correlation.d.ts.map +1 -1
  174. package/core/dist/runtime/internalization/consumer-evidence-preflight.d.ts +2 -1
  175. package/core/dist/runtime/internalization/consumer-evidence-preflight.d.ts.map +1 -1
  176. package/core/dist/runtime/internalization/diag-distiller-runner.d.ts +1 -1
  177. package/core/dist/runtime/internalization/diag-distiller-runner.d.ts.map +1 -1
  178. package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts +1 -1
  179. package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts.map +1 -1
  180. package/core/dist/runtime/internalization/diag-router-runner.d.ts +11 -1
  181. package/core/dist/runtime/internalization/diag-router-runner.d.ts.map +1 -1
  182. package/core/dist/runtime/internalization/diag-router-runner.js +105 -1
  183. package/core/dist/runtime/internalization/diag-router-runner.js.map +1 -1
  184. package/core/dist/runtime/internalization/dreamer-output.d.ts +0 -9
  185. package/core/dist/runtime/internalization/dreamer-output.d.ts.map +1 -1
  186. package/core/dist/runtime/internalization/dreamer-output.js +1 -1
  187. package/core/dist/runtime/internalization/dreamer-output.js.map +1 -1
  188. package/core/dist/runtime/internalization/dreamer-prompt-builder.d.ts +3 -2
  189. package/core/dist/runtime/internalization/dreamer-prompt-builder.d.ts.map +1 -1
  190. package/core/dist/runtime/internalization/dreamer-runner.d.ts +1 -1
  191. package/core/dist/runtime/internalization/dreamer-runner.d.ts.map +1 -1
  192. package/core/dist/runtime/internalization/evaluator-output.d.ts +7 -17
  193. package/core/dist/runtime/internalization/evaluator-output.d.ts.map +1 -1
  194. package/core/dist/runtime/internalization/evaluator-output.js +2 -2
  195. package/core/dist/runtime/internalization/evaluator-output.js.map +1 -1
  196. package/core/dist/runtime/internalization/evaluator-prompt-builder.d.ts +3 -9
  197. package/core/dist/runtime/internalization/evaluator-prompt-builder.d.ts.map +1 -1
  198. package/core/dist/runtime/internalization/evaluator-prompt-builder.js +1 -1
  199. package/core/dist/runtime/internalization/evaluator-prompt-builder.js.map +1 -1
  200. package/core/dist/runtime/internalization/formation-context.d.ts +4 -6
  201. package/core/dist/runtime/internalization/formation-context.d.ts.map +1 -1
  202. package/core/dist/runtime/internalization/formation-context.js +3 -3
  203. package/core/dist/runtime/internalization/formation-context.js.map +1 -1
  204. package/core/dist/runtime/internalization/index.d.ts +2 -4
  205. package/core/dist/runtime/internalization/index.d.ts.map +1 -1
  206. package/core/dist/runtime/internalization/index.js +8 -1
  207. package/core/dist/runtime/internalization/index.js.map +1 -1
  208. package/core/dist/runtime/internalization/intake-to-internalization-bridge.d.ts +2 -1
  209. package/core/dist/runtime/internalization/intake-to-internalization-bridge.d.ts.map +1 -1
  210. package/core/dist/runtime/internalization/intent-contract.d.ts +2 -1
  211. package/core/dist/runtime/internalization/intent-contract.d.ts.map +1 -1
  212. package/core/dist/runtime/internalization/internalization-job-graph.d.ts +1 -1
  213. package/core/dist/runtime/internalization/internalization-job-graph.d.ts.map +1 -1
  214. package/core/dist/runtime/internalization/internalization-route.d.ts +2 -1
  215. package/core/dist/runtime/internalization/internalization-route.d.ts.map +1 -1
  216. package/core/dist/runtime/internalization/owner-decision-review.d.ts +3 -2
  217. package/core/dist/runtime/internalization/owner-decision-review.d.ts.map +1 -1
  218. package/core/dist/runtime/internalization/owner-resolution-service.d.ts +2 -1
  219. package/core/dist/runtime/internalization/owner-resolution-service.d.ts.map +1 -1
  220. package/core/dist/runtime/internalization/owner-retry.d.ts +2 -1
  221. package/core/dist/runtime/internalization/owner-retry.d.ts.map +1 -1
  222. package/core/dist/runtime/internalization/owner-review.d.ts +2 -21
  223. package/core/dist/runtime/internalization/owner-review.d.ts.map +1 -1
  224. package/core/dist/runtime/internalization/owner-review.js +2 -2
  225. package/core/dist/runtime/internalization/owner-review.js.map +1 -1
  226. package/core/dist/runtime/internalization/peer-runner-contracts.d.ts +2 -5
  227. package/core/dist/runtime/internalization/peer-runner-contracts.d.ts.map +1 -1
  228. package/core/dist/runtime/internalization/peer-runner-contracts.js +1 -1
  229. package/core/dist/runtime/internalization/peer-runner-contracts.js.map +1 -1
  230. package/core/dist/runtime/internalization/philosopher-output.d.ts +0 -8
  231. package/core/dist/runtime/internalization/philosopher-output.d.ts.map +1 -1
  232. package/core/dist/runtime/internalization/philosopher-output.js +1 -1
  233. package/core/dist/runtime/internalization/philosopher-output.js.map +1 -1
  234. package/core/dist/runtime/internalization/philosopher-prompt-builder.d.ts +3 -2
  235. package/core/dist/runtime/internalization/philosopher-prompt-builder.d.ts.map +1 -1
  236. package/core/dist/runtime/internalization/pitask-metadata.d.ts +1 -1
  237. package/core/dist/runtime/internalization/pitask-metadata.d.ts.map +1 -1
  238. package/core/dist/runtime/internalization/repair-replay-resolver.d.ts +4 -3
  239. package/core/dist/runtime/internalization/repair-replay-resolver.d.ts.map +1 -1
  240. package/core/dist/runtime/internalization/rollout-reviewer-output.d.ts +2 -3
  241. package/core/dist/runtime/internalization/rollout-reviewer-output.d.ts.map +1 -1
  242. package/core/dist/runtime/internalization/rollout-reviewer-output.js.map +1 -1
  243. package/core/dist/runtime/internalization/rollout-reviewer-prompt-builder.d.ts +0 -1
  244. package/core/dist/runtime/internalization/rollout-reviewer-prompt-builder.d.ts.map +1 -1
  245. package/core/dist/runtime/internalization/rollout-reviewer-prompt-builder.js +1 -1
  246. package/core/dist/runtime/internalization/rollout-reviewer-prompt-builder.js.map +1 -1
  247. package/core/dist/runtime/internalization/router-context-reconstruction.d.ts +3 -3
  248. package/core/dist/runtime/internalization/router-context-reconstruction.d.ts.map +1 -1
  249. package/core/dist/runtime/internalization/rule-activation-contract.d.ts +3 -2
  250. package/core/dist/runtime/internalization/rule-activation-contract.d.ts.map +1 -1
  251. package/core/dist/runtime/internalization/rule-reliability-validation.d.ts +13 -18
  252. package/core/dist/runtime/internalization/rule-reliability-validation.d.ts.map +1 -1
  253. package/core/dist/runtime/internalization/rule-reliability-validation.js +43 -1
  254. package/core/dist/runtime/internalization/rule-reliability-validation.js.map +1 -1
  255. package/core/dist/runtime/internalization/scribe-output.d.ts +2 -15
  256. package/core/dist/runtime/internalization/scribe-output.d.ts.map +1 -1
  257. package/core/dist/runtime/internalization/scribe-output.js +2 -2
  258. package/core/dist/runtime/internalization/scribe-output.js.map +1 -1
  259. package/core/dist/runtime/internalization/scribe-prompt-builder.d.ts +3 -3
  260. package/core/dist/runtime/internalization/scribe-prompt-builder.d.ts.map +1 -1
  261. package/core/dist/runtime/internalization/scribe-prompt-builder.js +0 -1
  262. package/core/dist/runtime/internalization/scribe-prompt-builder.js.map +1 -1
  263. package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts +17 -1
  264. package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts.map +1 -1
  265. package/core/dist/runtime/internalization/split-diagnostician-runner.js +98 -3
  266. package/core/dist/runtime/internalization/split-diagnostician-runner.js.map +1 -1
  267. package/core/dist/runtime/internalization/textual-basis-anchor.d.ts +3 -6
  268. package/core/dist/runtime/internalization/textual-basis-anchor.d.ts.map +1 -1
  269. package/core/dist/runtime/internalization/textual-basis-anchor.js +2 -2
  270. package/core/dist/runtime/internalization/textual-basis-anchor.js.map +1 -1
  271. package/core/dist/runtime/language-directive.d.ts +2 -1
  272. package/core/dist/runtime/language-directive.d.ts.map +1 -1
  273. package/core/dist/runtime/owner-decision/owner-decision-view-contract.d.ts +3 -29
  274. package/core/dist/runtime/owner-decision/owner-decision-view-contract.d.ts.map +1 -1
  275. package/core/dist/runtime/owner-decision/owner-decision-view-contract.js +4 -5
  276. package/core/dist/runtime/owner-decision/owner-decision-view-contract.js.map +1 -1
  277. package/core/dist/runtime/owner-decision/owner-decision-view.d.ts +0 -49
  278. package/core/dist/runtime/owner-decision/owner-decision-view.d.ts.map +1 -1
  279. package/core/dist/runtime/owner-decision/owner-decision-view.js +5 -5
  280. package/core/dist/runtime/owner-decision/owner-decision-view.js.map +1 -1
  281. package/core/dist/runtime/owner-decision/semantic-selector.d.ts +3 -2
  282. package/core/dist/runtime/owner-decision/semantic-selector.d.ts.map +1 -1
  283. package/core/dist/runtime/owner-identity.d.ts +12 -1
  284. package/core/dist/runtime/owner-identity.d.ts.map +1 -1
  285. package/core/dist/runtime/owner-identity.js +19 -1
  286. package/core/dist/runtime/owner-identity.js.map +1 -1
  287. package/core/dist/runtime/pain-ingress-payload.d.ts +0 -39
  288. package/core/dist/runtime/pain-ingress-payload.d.ts.map +1 -1
  289. package/core/dist/runtime/pain-ingress-payload.js +4 -4
  290. package/core/dist/runtime/pain-ingress-payload.js.map +1 -1
  291. package/core/dist/runtime/pain-ingress.d.ts +1 -1
  292. package/core/dist/runtime/pain-ingress.d.ts.map +1 -1
  293. package/core/dist/runtime/pain-ingress.js.map +1 -1
  294. package/core/dist/runtime/pain-signal-bridge.d.ts +0 -2
  295. package/core/dist/runtime/pain-signal-bridge.d.ts.map +1 -1
  296. package/core/dist/runtime/pain-signal-bridge.js +1 -1
  297. package/core/dist/runtime/pain-signal-bridge.js.map +1 -1
  298. package/core/dist/runtime/pain-signal-runtime-factory.d.ts +3 -3
  299. package/core/dist/runtime/pain-signal-runtime-factory.d.ts.map +1 -1
  300. package/core/dist/runtime/pain-signal-runtime-factory.js +1 -1
  301. package/core/dist/runtime/pain-signal-runtime-factory.js.map +1 -1
  302. package/core/dist/runtime/principle-reuse/reuse-proposal.d.ts +3 -2
  303. package/core/dist/runtime/principle-reuse/reuse-proposal.d.ts.map +1 -1
  304. package/core/dist/runtime/principle-reuse/reuse-retrieval.d.ts +0 -10
  305. package/core/dist/runtime/principle-reuse/reuse-retrieval.d.ts.map +1 -1
  306. package/core/dist/runtime/principle-reuse/reuse-retrieval.js +1 -1
  307. package/core/dist/runtime/principle-reuse/reuse-retrieval.js.map +1 -1
  308. package/core/dist/runtime/principle-reuse/reuse-shortlist.d.ts +1 -8
  309. package/core/dist/runtime/principle-reuse/reuse-shortlist.d.ts.map +1 -1
  310. package/core/dist/runtime/principle-reuse/reuse-shortlist.js +1 -1
  311. package/core/dist/runtime/principle-reuse/reuse-shortlist.js.map +1 -1
  312. package/core/dist/runtime/product-telemetry/snapshot-contract.d.ts +3 -2
  313. package/core/dist/runtime/product-telemetry/snapshot-contract.d.ts.map +1 -1
  314. package/core/dist/runtime/runner/base-peer-runner.d.ts +32 -0
  315. package/core/dist/runtime/runner/base-peer-runner.d.ts.map +1 -1
  316. package/core/dist/runtime/runner/base-peer-runner.js +168 -16
  317. package/core/dist/runtime/runner/base-peer-runner.js.map +1 -1
  318. package/core/dist/runtime/runner/default-validator.d.ts +0 -1
  319. package/core/dist/runtime/runner/default-validator.d.ts.map +1 -1
  320. package/core/dist/runtime/runner/default-validator.js +11 -3
  321. package/core/dist/runtime/runner/default-validator.js.map +1 -1
  322. package/core/dist/runtime/runner/peer-runner-types.d.ts +11 -0
  323. package/core/dist/runtime/runner/peer-runner-types.d.ts.map +1 -1
  324. package/core/dist/runtime/storage-paths.d.ts +15 -0
  325. package/core/dist/runtime/storage-paths.d.ts.map +1 -0
  326. package/core/dist/runtime/storage-paths.js +15 -0
  327. package/core/dist/runtime/storage-paths.js.map +1 -0
  328. package/core/dist/runtime/store/artifact/index.d.ts +1 -1
  329. package/core/dist/runtime/store/artifact/index.d.ts.map +1 -1
  330. package/core/dist/runtime/store/candidate/admission-document.d.ts +4 -3
  331. package/core/dist/runtime/store/candidate/admission-document.d.ts.map +1 -1
  332. package/core/dist/runtime/store/commit/index.d.ts +0 -1
  333. package/core/dist/runtime/store/commit/index.d.ts.map +1 -1
  334. package/core/dist/runtime/store/commit/index.js.map +1 -1
  335. package/core/dist/runtime/store/design-gate/sqlite-design-gate-store.d.ts +4 -3
  336. package/core/dist/runtime/store/design-gate/sqlite-design-gate-store.d.ts.map +1 -1
  337. package/core/dist/runtime/store/lifecycle/lease-manager.d.ts +2 -1
  338. package/core/dist/runtime/store/lifecycle/lease-manager.d.ts.map +1 -1
  339. package/core/dist/runtime/store/runtime-state-manager.d.ts +1 -2
  340. package/core/dist/runtime/store/runtime-state-manager.d.ts.map +1 -1
  341. package/core/dist/runtime/store/runtime-state-manager.js.map +1 -1
  342. package/core/dist/runtime/store/sqlite-connection.d.ts +2 -1
  343. package/core/dist/runtime/store/sqlite-connection.d.ts.map +1 -1
  344. package/core/dist/runtime/store/task/sqlite-family-reopen.d.ts +2 -1
  345. package/core/dist/runtime/store/task/sqlite-family-reopen.d.ts.map +1 -1
  346. package/core/dist/runtime/store/task/sqlite-task-store.d.ts +2 -1
  347. package/core/dist/runtime/store/task/sqlite-task-store.d.ts.map +1 -1
  348. package/core/dist/runtime/story-a-demo.d.ts.map +1 -1
  349. package/core/dist/runtime/story-a-demo.js +4 -1
  350. package/core/dist/runtime/story-a-demo.js.map +1 -1
  351. package/core/dist/runtime/tools/agent-tool-contract.d.ts +1 -2
  352. package/core/dist/runtime/tools/agent-tool-contract.d.ts.map +1 -1
  353. package/core/dist/runtime/tools/agent-tool-contract.js +0 -2
  354. package/core/dist/runtime/tools/agent-tool-contract.js.map +1 -1
  355. package/core/dist/runtime/tools/artificer-l2-tool-contract.d.ts +0 -2
  356. package/core/dist/runtime/tools/artificer-l2-tool-contract.d.ts.map +1 -1
  357. package/core/dist/runtime/tools/artificer-l2-tool-contract.js +0 -2
  358. package/core/dist/runtime/tools/artificer-l2-tool-contract.js.map +1 -1
  359. package/core/dist/runtime/types/event-payload.d.ts +0 -2
  360. package/core/dist/runtime/types/event-payload.d.ts.map +1 -1
  361. package/core/dist/runtime/types/event-payload.js.map +1 -1
  362. package/core/dist/runtime/types/evidence-chain-contract.d.ts +66 -2
  363. package/core/dist/runtime/types/evidence-chain-contract.d.ts.map +1 -1
  364. package/core/dist/runtime/types/evidence-chain-contract.js +69 -4
  365. package/core/dist/runtime/types/evidence-chain-contract.js.map +1 -1
  366. package/core/dist/runtime/types/hygiene-types.d.ts +0 -6
  367. package/core/dist/runtime/types/hygiene-types.d.ts.map +1 -1
  368. package/core/dist/runtime/types/hygiene-types.js.map +1 -1
  369. package/core/dist/runtime/types/index.d.ts +1 -1
  370. package/core/dist/runtime/types/index.d.ts.map +1 -1
  371. package/core/dist/runtime/types/index.js.map +1 -1
  372. package/core/dist/runtime/types/intervention-evidence-contract.d.ts +5 -5
  373. package/core/dist/runtime/types/intervention-evidence-contract.d.ts.map +1 -1
  374. package/core/dist/runtime/types/intervention-evidence-contract.js +0 -2
  375. package/core/dist/runtime/types/intervention-evidence-contract.js.map +1 -1
  376. package/core/dist/runtime/types/principle-dependency.d.ts +0 -2
  377. package/core/dist/runtime/types/principle-dependency.d.ts.map +1 -1
  378. package/core/dist/runtime/types/principle-dependency.js.map +1 -1
  379. package/core/dist/runtime/types/principle-lifecycle-event.d.ts +0 -2
  380. package/core/dist/runtime/types/principle-lifecycle-event.d.ts.map +1 -1
  381. package/core/dist/runtime/types/principle-lifecycle-event.js.map +1 -1
  382. package/core/dist/runtime/types/principle-schema.d.ts +0 -26
  383. package/core/dist/runtime/types/principle-schema.d.ts.map +1 -1
  384. package/core/dist/runtime/types/principle-schema.js +2 -2
  385. package/core/dist/runtime/types/principle-schema.js.map +1 -1
  386. package/core/dist/runtime/types/principle-tree-store.d.ts +0 -2
  387. package/core/dist/runtime/types/principle-tree-store.d.ts.map +1 -1
  388. package/core/dist/runtime/types/principle-tree-store.js.map +1 -1
  389. package/core/dist/runtime/types/principle-value-metrics.d.ts +0 -2
  390. package/core/dist/runtime/types/principle-value-metrics.d.ts.map +1 -1
  391. package/core/dist/runtime/types/principle-value-metrics.js.map +1 -1
  392. package/core/dist/runtime/types/rule-candidate-binding.d.ts +2 -1
  393. package/core/dist/runtime/types/rule-candidate-binding.d.ts.map +1 -1
  394. package/core/dist/telemetry-event.d.ts +2 -2
  395. package/core/dist/telemetry-event.d.ts.map +1 -1
  396. package/core/dist/telemetry-event.js +11 -0
  397. package/core/dist/telemetry-event.js.map +1 -1
  398. package/core/package.json +5 -1
  399. package/dist/installers/codex-host-installer.d.ts +9 -0
  400. package/dist/installers/codex-host-installer.d.ts.map +1 -1
  401. package/dist/installers/codex-host-installer.js +35 -1
  402. package/dist/installers/codex-host-installer.js.map +1 -1
  403. package/dist/update/product-identity.d.ts.map +1 -1
  404. package/dist/update/product-identity.js +5 -1
  405. package/dist/update/product-identity.js.map +1 -1
  406. package/host-runtime/dist/active-principle-prompt.d.ts +7 -2
  407. package/host-runtime/dist/active-principle-prompt.js +80 -13
  408. package/host-runtime/dist/adaptive-decision-protocol.d.ts +7 -20
  409. package/host-runtime/dist/adaptive-decision-protocol.js +10 -24
  410. package/host-runtime/dist/adaptive-priority-provider.d.ts +2 -1
  411. package/host-runtime/dist/adaptive-priority-provider.js +6 -5
  412. package/host-runtime/dist/adaptive-selection.d.ts +4 -0
  413. package/host-runtime/dist/adaptive-selection.js +6 -3
  414. package/host-runtime/dist/codex-disclosure.d.ts +12 -7
  415. package/host-runtime/dist/codex-disclosure.js +12 -7
  416. package/host-runtime/dist/conversation-ingestion/pipeline.d.ts +8 -0
  417. package/host-runtime/dist/conversation-ingestion/pipeline.js +6 -1
  418. package/host-runtime/dist/conversation-ingestion/text-policy.d.ts +3 -4
  419. package/host-runtime/dist/conversation-ingestion/text-policy.js +3 -4
  420. package/host-runtime/dist/governance-observation-store.d.ts +38 -5
  421. package/host-runtime/dist/governance-observation-store.js +63 -5
  422. package/host-runtime/dist/index.js +5 -2
  423. package/host-runtime/dist/production-rulehost-gate.d.ts +36 -1
  424. package/host-runtime/dist/production-rulehost-gate.js +91 -1
  425. package/host-runtime/package.json +1 -1
  426. package/package.json +2 -2
  427. package/pd-cli/dist/commands/diagnose.js +1 -1
  428. package/pd-cli/dist/commands/diagnose.js.map +1 -1
  429. package/pd-cli/dist/commands/health-ingestion.d.ts +96 -0
  430. package/pd-cli/dist/commands/health-ingestion.d.ts.map +1 -0
  431. package/pd-cli/dist/commands/health-ingestion.js +473 -0
  432. package/pd-cli/dist/commands/health-ingestion.js.map +1 -0
  433. package/pd-cli/dist/commands/health.d.ts.map +1 -1
  434. package/pd-cli/dist/commands/health.js +10 -0
  435. package/pd-cli/dist/commands/health.js.map +1 -1
  436. package/pd-cli/dist/services/demo-story-a-runner.js +1 -1
  437. package/pd-cli/dist/services/demo-story-a-runner.js.map +1 -1
  438. package/pd-cli/dist/services/version-report.d.ts.map +1 -1
  439. package/pd-cli/dist/services/version-report.js +5 -1
  440. package/pd-cli/dist/services/version-report.js.map +1 -1
  441. package/pd-cli/package.json +1 -1
  442. package/plugin/dist/bundle.js +506 -495
  443. package/plugin/dist/core/experiment-workspace-guard.d.ts +25 -0
  444. package/plugin/dist/index.d.ts +1 -1
  445. package/plugin/dist/openclaw.plugin.json +1 -1
  446. package/plugin/openclaw.plugin.json +1 -1
  447. package/plugin/package.json +1 -1
  448. package/release-manager/dist/installers/codex-host-installer.js +35 -1
  449. package/release-manager/dist/update/product-identity.js +5 -1
  450. package/release-manager/package.json +1 -1
  451. package/workbuddy-adapter/dist/index.d.ts +1 -1
  452. package/workbuddy-adapter/dist/index.js +1 -1
  453. package/workbuddy-adapter/dist/ingestion/catch-up.d.ts +11 -0
  454. package/workbuddy-adapter/dist/ingestion/catch-up.js +7 -2
  455. package/workbuddy-adapter/dist/ingestion/index.d.ts +1 -1
  456. package/workbuddy-adapter/dist/ingestion/index.js +1 -1
  457. package/workbuddy-adapter/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "productVersion": "2.8.6",
4
- "sourceCommit": "5c7389e72a6409efb00891327a63dfc01a2009cb"
4
+ "sourceCommit": "95d49f9eae5bf499fc8e4f36fecb0ad5a490f05b"
5
5
  }
@@ -1,4 +1,4 @@
1
- import { ingestGovernanceObservations, recordVerifiedToolOutcomes, runConversationIngestion, } from '@principles/host-runtime';
1
+ import { CODEX_INGESTION_DISCLOSURE_VERSION, ingestGovernanceObservations, readConversationIngestionConsent, recordVerifiedToolOutcomes, resolveTextPolicy, runConversationIngestion, } from '@principles/host-runtime';
2
2
  import { createNodeTranscriptPort } from './transcript-decoder.js';
3
3
  import { createCodexTranscriptSource } from './transcript-source.js';
4
4
  import { resolveCodexHome } from './codex-home.js';
@@ -13,6 +13,19 @@ export function setCodexTranscriptPortForTest(port) {
13
13
  function activeTranscriptPort(options) {
14
14
  return options.port ?? activePort ?? createNodeTranscriptPort();
15
15
  }
16
+ /**
17
+ * PRI-1179: the consent-tiered `visible_text` bound for Codex. The full tier is
18
+ * reachable ONLY from a record that is `granted` against the CURRENT frozen
19
+ * disclosure (`CODEX_INGESTION_DISCLOSURE_VERSION`); an absent, unreadable,
20
+ * revoked or older-disclosure record resolves to the bounded tier. An
21
+ * unreadable ledger resolves narrow on purpose — the health surface reports the
22
+ * malformed record loudly, and no content is lost by staying bounded.
23
+ */
24
+ function resolveCodexTextPolicy(workspaceDir) {
25
+ const read = readConversationIngestionConsent(workspaceDir, 'codex');
26
+ const record = read.ok ? read.record : null;
27
+ return resolveTextPolicy({ decision: record?.decision ?? 'not_present', disclosureVersion: record?.disclosureVersion ?? null }, CODEX_INGESTION_DISCLOSURE_VERSION);
28
+ }
16
29
  function ingestLiveObservation({ fields, rolloutIdentity, workspaceDir, now }) {
17
30
  const nowIso = now.toISOString();
18
31
  let observation = null;
@@ -54,6 +67,11 @@ function ingestLiveObservation({ fields, rolloutIdentity, workspaceDir, now }) {
54
67
  }
55
68
  const result = ingestGovernanceObservations({
56
69
  workspaceDir,
70
+ // PRI-1179 P1: the LIVE path must apply the same consent-tiered bound as
71
+ // the transcript replay. A narrower live bound stores a truncated
72
+ // user_turn, and the replay then sees a content mismatch on the same
73
+ // logical key — a lineage conflict that stalls the checkpoint forever.
74
+ maxVisibleTextChars: resolveCodexTextPolicy(workspaceDir).maxChars,
57
75
  observations: [observation],
58
76
  now,
59
77
  });
@@ -147,11 +165,14 @@ function ingestTranscriptDelta({ fallbackRootSessionId, transcriptPath, workspac
147
165
  // codex_conversation_ingestion) is checked by pd-hook / catch-up BEFORE
148
166
  // this module is entered, and the consent LEDGER remains the governance
149
167
  // record the setup flow enforces (v2 authority model — the runtime gate
150
- // reads only the flags). The pipeline's consent gate therefore receives
151
- // the setup-flow invariant 'granted' until the P3 full-text batch wires
152
- // the real v3 record + disclosureVersion tier.
168
+ // reads only the flags). The pipeline's consent gate therefore keeps
169
+ // receiving the setup-flow invariant 'granted'.
153
170
  flags: { ingestionEnabled: true },
154
171
  consent: { decision: 'granted' },
172
+ // PRI-1179: the STORED TEXT bound is a separate fact from the gate above —
173
+ // it comes from the recorded v3 consent record, so a stale disclosure or a
174
+ // revoke can only ever narrow what is stored, never widen it.
175
+ textPolicy: resolveCodexTextPolicy(workspaceDir),
155
176
  now,
156
177
  port,
157
178
  degradeTexts: CODEX_PIPELINE_DEGRADE_TEXTS,
@@ -10,9 +10,11 @@
10
10
  * execution facts anchored on the `event_msg item_completed
11
11
  * CommandExecution` record whose `item.id` IS the hook `tool_use_id` id
12
12
  * space (the G1-verified bridge; the model-level `call_id` is a different
13
- * space). Hidden reasoning, system/developer prompts, world_state,
14
- * host-injected context, and unknown record bodies are identified by shape
15
- * and dropped before persistence — never projected, logged, or emitted.
13
+ * space). Hidden reasoning BODIES (encrypted_content) are never read — only the
14
+ * optional plaintext `summary` is projected as a `reasoning` observation
15
+ * (PRI-1179). System/developer prompts, world_state, host-injected context,
16
+ * and unknown record bodies are identified by shape and dropped before
17
+ * persistence — never projected, logged, or emitted.
16
18
  *
17
19
  * Failure classes are distinct (SPEC §14): an incomplete final line (no
18
20
  * trailing newline at EOF) is a transient append/flush boundary — the
@@ -10,9 +10,11 @@
10
10
  * execution facts anchored on the `event_msg item_completed
11
11
  * CommandExecution` record whose `item.id` IS the hook `tool_use_id` id
12
12
  * space (the G1-verified bridge; the model-level `call_id` is a different
13
- * space). Hidden reasoning, system/developer prompts, world_state,
14
- * host-injected context, and unknown record bodies are identified by shape
15
- * and dropped before persistence — never projected, logged, or emitted.
13
+ * space). Hidden reasoning BODIES (encrypted_content) are never read — only the
14
+ * optional plaintext `summary` is projected as a `reasoning` observation
15
+ * (PRI-1179). System/developer prompts, world_state, host-injected context,
16
+ * and unknown record bodies are identified by shape and dropped before
17
+ * persistence — never projected, logged, or emitted.
16
18
  *
17
19
  * Failure classes are distinct (SPEC §14): an incomplete final line (no
18
20
  * trailing newline at EOF) is a transient append/flush boundary — the
@@ -123,6 +125,28 @@ function joinItemText(item) {
123
125
  }
124
126
  return parts.length > 0 ? parts.join('') : null;
125
127
  }
128
+ /**
129
+ * PRI-1179: the storable face of a Codex reasoning record. The rollout stores
130
+ * the reasoning body encrypted (`encrypted_content`, never read) and an
131
+ * optional `summary: [{ type: 'summary_text', text }]`. Only that summary text
132
+ * is evidence; no summary means nothing is stored (not a degradation).
133
+ */
134
+ function joinReasoningSummary(payload) {
135
+ const summary = own(payload, 'summary');
136
+ if (!Array.isArray(summary))
137
+ return null;
138
+ const parts = [];
139
+ for (const entry of summary) {
140
+ if (!isRecord(entry))
141
+ continue;
142
+ if (own(entry, 'type') !== 'summary_text')
143
+ continue;
144
+ const text = own(entry, 'text');
145
+ if (typeof text === 'string' && text.trim().length > 0)
146
+ parts.push(text);
147
+ }
148
+ return parts.length > 0 ? parts.join('\n') : null;
149
+ }
126
150
  function observationBase(context, turnId) {
127
151
  return {
128
152
  hostKind: 'codex',
@@ -156,8 +180,33 @@ function projectRecord(context, record) {
156
180
  }
157
181
  if (type === 'response_item') {
158
182
  const payloadType = own(payload, 'type');
159
- if (payloadType === 'reasoning')
160
- return; // hidden/encrypted reasoning — never projected
183
+ if (payloadType === 'reasoning') {
184
+ // PRI-1179: the rollout carries the hidden reasoning ONLY as
185
+ // `encrypted_content` plus an OPTIONAL plaintext `summary` array. The
186
+ // encrypted blob is never read; the summary is the one storable face.
187
+ const summaryText = joinReasoningSummary(payload);
188
+ if (summaryText === null)
189
+ return; // no summary → nothing to store
190
+ const itemId = own(payload, 'id');
191
+ const turnId = metadataTurnId(payload) ?? context.currentTurnId;
192
+ if (turnId === null || typeof itemId !== 'string' || itemId.length === 0) {
193
+ warnBounded(context, `observation_skipped_missing_identity:${ordinal}`);
194
+ return;
195
+ }
196
+ context.observations.push({
197
+ ...observationBase(context, turnId),
198
+ kind: 'reasoning',
199
+ logicalObservationKey: `codex|${context.rolloutIdentity}|${turnId}|reasoning:${itemId}`,
200
+ transcriptRecordKey: `codex|${context.rolloutIdentity}|${ordinal}`,
201
+ recordOrdinal: ordinal,
202
+ recordByteStart,
203
+ visibleText: summaryText,
204
+ source: 'transcript',
205
+ completeness: 'complete',
206
+ observedAt,
207
+ });
208
+ return;
209
+ }
161
210
  if (payloadType === 'custom_tool_call' || payloadType === 'function_call') {
162
211
  const turnId = metadataTurnId(payload);
163
212
  const callId = own(payload, 'call_id');
@@ -205,6 +254,12 @@ function projectRecord(context, record) {
205
254
  }
206
255
  if (type === 'event_msg') {
207
256
  const payloadType = own(payload, 'type');
257
+ // PRI-1179: turn identity for records that cannot carry their own (the
258
+ // reasoning response_item). Transcript order makes the latest event-level
259
+ // turn the enclosing one.
260
+ const eventTurnId = own(payload, 'turn_id');
261
+ if (typeof eventTurnId === 'string' && eventTurnId.length > 0)
262
+ context.currentTurnId = eventTurnId;
208
263
  if (payloadType === 'item_completed') {
209
264
  const item = own(payload, 'item');
210
265
  if (!isRecord(item))
@@ -367,6 +422,7 @@ export function decodeTranscriptWindow(input) {
367
422
  observations: [],
368
423
  meta: { rootSessionId: null, cliVersion: null, parentRolloutIdentity: null, agentIdentity: null, agentDepth: null },
369
424
  modelCallsByTurn: new Map(),
425
+ currentTurnId: null,
370
426
  compactionTimestamp: null,
371
427
  rollbackTurns: [],
372
428
  warnings: [],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principles/codex-adapter",
3
- "version": "0.8.12",
3
+ "version": "0.9.0",
4
4
  "description": "Codex CLI host adapter for Principles Disciple — implements HostAdapter interface for OpenAI Codex CLI's stdin/stdout JSON hook model (ADR-0020).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -16,7 +16,7 @@ import { handleFeedbackReportsRoute, handleFeedbackChannelsRoute, disposeFeedbac
16
16
  import { handleFailedTasksRoute, disposeFailedTasksModels } from './routes/failed-tasks.js';
17
17
  import { handleDiagnosticianRoute } from './routes/diagnostician.js';
18
18
  import { handleApprovalsRoute, disposeApprovalsModels } from './routes/approvals.js';
19
- import { handleHealthRoute, disposeHealthModels } from './routes/health.js';
19
+ import { handleHealthRoute, handleIngestionHealthRoute, disposeHealthModels } from './routes/health.js';
20
20
  import { handlePrinciplesRoute, handleCorePrinciplesRoute, disposePrinciplesModels } from './routes/principles.js';
21
21
  import { handleLifecycleRoute, disposeLifecycleModels } from './routes/lifecycle.js';
22
22
  import { handleExaminerRoute } from './routes/examiner.js';
@@ -584,7 +584,8 @@ export function handleRequest(services) {
584
584
  return;
585
585
  }
586
586
  // PRI-331: GET /api/evidence-chain
587
- if (routePath === '/api/evidence-chain') {
587
+ // P1-2: GET /api/evidence-chain/assistant-turn?id=&session= (verbatim turn)
588
+ if (routePath === '/api/evidence-chain' || routePath === '/api/evidence-chain/assistant-turn') {
588
589
  asyncHandler(() => handleEvidenceChainRoute(req, res, services.workspaceDir))(req, res);
589
590
  return;
590
591
  }
@@ -613,6 +614,17 @@ export function handleRequest(services) {
613
614
  }))(req, res);
614
615
  return;
615
616
  }
617
+ // GET /api/health/ingestion — PRI-1171 ticket ⑦: unified three-host
618
+ // conversation-ingestion health (verbatim CLI passthrough, read-only
619
+ // status, never trajectory browsing). The route budget must COVER the
620
+ // model's 30s CLI subprocess timeout — a 504 from the default timeout
621
+ // would render "unable to determine" while the CLI is still working.
622
+ if (routePath === '/api/health/ingestion') {
623
+ asyncHandler(() => handleIngestionHealthRoute(req, res, {
624
+ workspaceDir: services.workspaceDir,
625
+ }), 45_000)(req, res);
626
+ return;
627
+ }
616
628
  // 404 fallback for API routes
617
629
  sendNotFound(res, `Route ${routePath} not found`);
618
630
  return;
@@ -1,4 +1,5 @@
1
1
  import { SqliteConnection, SqliteActivationStateStore, SqlitePIArtifactStore, extractPrincipleId, extractEvidenceRefs, PromotionReadinessReader, RuleHostWriter, createProductionGateDeps, SqliteActivationSafetyStore, isFeatureEnabled, RuleCodeOwnerDecisionService, collectOpenClawPromotionChecks, summarizeRuleCodeShadowEvents, buildPromotionEvidenceSnapshot, createRuntimeStateHandle, PrincipleTreeLedgerAdapter, previewApprovedRuleRevision, reviseApprovedRuleOnce, } from '@principles/core/runtime';
2
+ import { resolveStateDbPath } from '@principles/core/runtime/storage-paths';
2
3
  import { resolvePromotionHostLiveness, resolveWorkspaceHostToolSemantics, readPromptActivationInjectionStatuses, operatorDeclaredBudgetResolution, runtimeBudgetObservationToResolution, selectConsoleRuntimeBudgetFacts, productionRouteRotationState, RUNTIME_BUDGET_OBSERVATION_STALE_REASON, RUNTIME_EVENT_LOG_CANDIDATE_DIRS, collectRuleCodeEventEntries } from '@principles/host-runtime';
3
4
  import { PROMPT_BUDGET_HOST_KINDS } from '@principles/core/runtime';
4
5
  import { loadPdConfig, computeFlagsFromLoadResult } from '../config/pd-config-store.js';
@@ -155,7 +156,7 @@ export class ActivationsConsoleModel {
155
156
  }
156
157
  }
157
158
  async getActivations(targetHost) {
158
- const stateDbPath = path.join(this.workspaceDir, '.pd', 'state.db');
159
+ const stateDbPath = resolveStateDbPath(this.workspaceDir);
159
160
  if (!fs.existsSync(stateDbPath)) {
160
161
  return { activations: [], status: 'degraded', reason: 'state.db not found — workspace may not be initialized', nextAction: 'Run pd runtime diagnostics to check workspace state' };
161
162
  }
@@ -809,7 +810,7 @@ export class ActivationsConsoleModel {
809
810
  throw new Error('feature_not_enabled: enable rulecode_owner_live_decision only after the rollout gate passes');
810
811
  }
811
812
  async deactivateActivation(activationId) {
812
- const stateDbPath = path.join(this.workspaceDir, '.pd', 'state.db');
813
+ const stateDbPath = resolveStateDbPath(this.workspaceDir);
813
814
  if (!fs.existsSync(stateDbPath)) {
814
815
  return { ok: false, reason: 'state.db not found — workspace may not be initialized', nextAction: 'Ensure the workspace has been initialized with PD before disabling activations.' };
815
816
  }
@@ -3,6 +3,7 @@ import { approvalReviewMaterial } from './approval-review-material.js';
3
3
  import * as fs from 'node:fs';
4
4
  import * as path from 'node:path';
5
5
  import { SqliteConnection, SqliteApprovalQueueStore, SqliteActivationStateStore, SqlitePIArtifactStore, ActivationDispatcher, PromptWriter, DeferArchiveWriter, RuleHostWriter, createProductionGateDeps, ApprovalCompletionService, ApprovalQueue, mapConfidenceToLabel, isArtifactRevisionOf, detectPromptReplacementTarget, detectRuleReplacementTarget, buildOwnerRevisionArtifact, PrincipleTreeLedgerAdapter, MVP_CHANNELS, computeArtifactDigest, } from '@principles/core/runtime';
6
+ import { resolveStateDbPath } from '@principles/core/runtime/storage-paths';
6
7
  import { resolveLedgerPrincipleId } from './principle-id-resolution.js';
7
8
  import { createArtifactPrincipleResolutionDeps } from './artifact-principle-resolver.js';
8
9
  import { loadPdConfig, computeFlagsFromLoadResult } from '../config/pd-config-store.js';
@@ -49,7 +50,7 @@ function describeBudgetBasis(hostKind, facts, declared) {
49
50
  return `budget basis=fixed_fallback (no runtime budget observation for ${hostKind})`;
50
51
  }
51
52
  function stateDbExists(workspaceDir) {
52
- return fs.existsSync(path.join(workspaceDir, '.pd', 'state.db'));
53
+ return fs.existsSync(resolveStateDbPath(workspaceDir));
53
54
  }
54
55
  export class ApprovalsConsoleModel {
55
56
  workspaceDir;
@@ -1,4 +1,5 @@
1
1
  import { SqliteConnection, SqliteApprovalQueueStore, SqlitePIArtifactStore, ApprovalQueue, RUNTIME_PRINCIPLE_BUDGET, detectPromptReplacementTarget, computeArtifactDigest, SqliteActivationStateStore, } from '@principles/core/runtime';
2
+ import { resolveStateDbPath } from '@principles/core/runtime/storage-paths';
2
3
  import { checkPromptArtifactDeliverability, hostRotationCapability, operatorDeclaredBudgetResolution, resolveLivePromptInjectionProjection, RUNTIME_BUDGET_OBSERVATION_STALE_REASON, runtimeBudgetObservationToResolution, selectConsoleRuntimeBudgetFacts, } from '@principles/host-runtime';
3
4
  import { PROMPT_BUDGET_HOST_KINDS } from '@principles/core/runtime';
4
5
  import { loadLedger } from '@principles/core/principle-tree-ledger';
@@ -167,7 +168,7 @@ export class ApprovalsGroupedConsoleModel {
167
168
  this.workspaceDir = workspaceDir;
168
169
  }
169
170
  async getApprovalsGrouped(targetHost) {
170
- const stateDbPath = path.join(this.workspaceDir, '.pd', 'state.db');
171
+ const stateDbPath = resolveStateDbPath(this.workspaceDir);
171
172
  if (!fs.existsSync(stateDbPath)) {
172
173
  return { groups: [], generatedAt: new Date().toISOString(), note: 'state.db not found — workspace may not be initialized' };
173
174
  }
@@ -15,6 +15,11 @@
15
15
  * - All summaries go through sanitizeString from evidence-sanitizer
16
16
  * - Degraded paths include structured reason + nextAction (ERR-002)
17
17
  *
18
+ * P1-2 exception: `getAssistantTurn()` returns ONE referenced assistant turn
19
+ * verbatim, on purpose — the Owner must be able to compare the recorded
20
+ * correction against exactly what the agent said. It is bounded to the turn id
21
+ * recorded in correction evidence and pinned to that turn's session.
22
+ *
18
23
  * ERR checklist:
19
24
  * - ERR-001/005: All DB rows treated as unknown, runtime validation with typeof guards
20
25
  * - ERR-002: Degraded paths include reason + nextAction, never silent fallback
@@ -24,9 +29,50 @@
24
29
  */
25
30
  import type { EvidenceChainState, EvidenceChainRecord, EvidenceChainResponse } from '@principles/core/runtime';
26
31
  export type { EvidenceChainState, EvidenceChainRecord, EvidenceChainResponse, };
32
+ /**
33
+ * P1-2: verbatim assistant output referenced by a correction record.
34
+ *
35
+ * This is the ONE place raw assistant text is returned to the Owner. It is not
36
+ * sanitized on purpose: the Owner must be able to compare the correction text
37
+ * with exactly what the agent said. Access is by turn id, optionally pinned to
38
+ * the session id recorded in the correction evidence, so a record can never
39
+ * pull an unrelated conversation.
40
+ */
41
+ export interface AssistantTurnLookup {
42
+ ok: true;
43
+ turn: {
44
+ id: number;
45
+ sessionId: string;
46
+ /** Verbatim assistant output (newlines, spaces and markdown preserved). */
47
+ text: string;
48
+ /**
49
+ * `raw` when the original text was persisted inline or in the overflow
50
+ * blob; `sanitized` when only the redacted copy survives (retention or
51
+ * write-path policy). The UI must label which one the Owner is reading.
52
+ */
53
+ textSource: 'raw' | 'sanitized';
54
+ createdAt: string;
55
+ };
56
+ }
57
+ export interface AssistantTurnLookupFailure {
58
+ ok: false;
59
+ reason: string;
60
+ nextAction: string;
61
+ }
27
62
  export declare class EvidenceChainConsoleModel {
28
63
  private readonly workspaceDir;
29
64
  constructor(workspaceDir: string);
30
65
  getEvidenceChain(): Promise<EvidenceChainResponse>;
66
+ /**
67
+ * P1-2: read the raw assistant turn referenced by correction evidence.
68
+ * Verbatim by contract — no sanitization, no markdown rendering.
69
+ *
70
+ * Uses the registered trajectory-store seam (`openTrajectoryDbReadonly`) so
71
+ * the read-only + path-contract rules have a single owner. The overflow blob
72
+ * directory is derived from the trajectory database location, never
73
+ * hardcoded, and a blob reference is confined to that directory before it is
74
+ * read.
75
+ */
76
+ getAssistantTurn(turnId: number, expectedSessionId?: string): Promise<AssistantTurnLookup | AssistantTurnLookupFailure>;
31
77
  dispose(): void;
32
78
  }
@@ -15,6 +15,11 @@
15
15
  * - All summaries go through sanitizeString from evidence-sanitizer
16
16
  * - Degraded paths include structured reason + nextAction (ERR-002)
17
17
  *
18
+ * P1-2 exception: `getAssistantTurn()` returns ONE referenced assistant turn
19
+ * verbatim, on purpose — the Owner must be able to compare the recorded
20
+ * correction against exactly what the agent said. It is bounded to the turn id
21
+ * recorded in correction evidence and pinned to that turn's session.
22
+ *
18
23
  * ERR checklist:
19
24
  * - ERR-001/005: All DB rows treated as unknown, runtime validation with typeof guards
20
25
  * - ERR-002: Degraded paths include reason + nextAction, never silent fallback
@@ -23,10 +28,46 @@
23
28
  * - ERR-013: Use Object.hasOwn() for untrusted object keys
24
29
  */
25
30
  import { SqliteConnection, sanitizeString, assembleEvidenceChain, } from '@principles/core/runtime';
31
+ import { openTrajectoryDbReadonly } from '@principles/core/trajectory-store';
32
+ import { resolveStateDbPath, resolveTrajectoryDbPath } from '@principles/core/runtime/storage-paths';
26
33
  import * as fs from 'node:fs';
27
34
  import * as path from 'node:path';
28
35
  import Database from 'better-sqlite3';
29
36
  import { errorMessage } from '../utils/response.js';
37
+ /**
38
+ * P1-2: restore the assistant turn text for verbatim display.
39
+ *
40
+ * Order of preference: inline `raw_text` → overflow blob (`blob_ref`) →
41
+ * `sanitized_text` (kept for retention cases where raw text was purged). The
42
+ * blob path is treated as untrusted: it must resolve inside `<state>/blobs`,
43
+ * otherwise it is ignored (rc-1 / rc-2).
44
+ */
45
+ function readVerbatimTurnText(row, stateDir) {
46
+ const inlineRaw = typeof row.raw_text === 'string' ? row.raw_text : '';
47
+ if (inlineRaw !== '')
48
+ return { text: inlineRaw, source: 'raw' };
49
+ const blobRef = typeof row.blob_ref === 'string' ? row.blob_ref : '';
50
+ if (blobRef !== '') {
51
+ const blobsDir = path.resolve(stateDir, 'blobs');
52
+ const blobPath = path.resolve(blobsDir, blobRef);
53
+ const relativeToBlobs = path.relative(blobsDir, blobPath);
54
+ const escapes = relativeToBlobs === '' || relativeToBlobs.startsWith('..') || path.isAbsolute(relativeToBlobs);
55
+ if (!escapes && fs.existsSync(blobPath)) {
56
+ try {
57
+ const blobText = fs.readFileSync(blobPath, 'utf8');
58
+ if (blobText !== '')
59
+ return { text: blobText, source: 'raw' };
60
+ }
61
+ catch {
62
+ // Unreadable blob: fall through to the sanitized copy below.
63
+ }
64
+ }
65
+ }
66
+ const sanitized = typeof row.sanitized_text === 'string' ? row.sanitized_text : '';
67
+ if (sanitized !== '')
68
+ return { text: sanitized, source: 'sanitized' };
69
+ return null;
70
+ }
30
71
  // ── Helpers ────────────────────────────────────────────────────────────────────
31
72
  function isRecord(value) {
32
73
  return typeof value === 'object' && value !== null && !Array.isArray(value);
@@ -136,7 +177,7 @@ export class EvidenceChainConsoleModel {
136
177
  const degradedReasons = [];
137
178
  const degradedNextActions = [];
138
179
  // ── 1. Read pain_events from trajectory.db ────────────────────────────
139
- const trajectoryDbPath = path.join(this.workspaceDir, '.state', 'trajectory.db');
180
+ const trajectoryDbPath = resolveTrajectoryDbPath(this.workspaceDir);
140
181
  let painEvents = [];
141
182
  let trajectoryDbAvailable = false;
142
183
  if (fs.existsSync(trajectoryDbPath)) {
@@ -190,7 +231,7 @@ export class EvidenceChainConsoleModel {
190
231
  degradedNextActions.push('PD has not recorded any pain signals in this workspace yet.');
191
232
  }
192
233
  // ── 2. Read tasks & candidates from state.db ──────────────────────
193
- const stateDbPath = path.join(this.workspaceDir, '.pd', 'state.db');
234
+ const stateDbPath = resolveStateDbPath(this.workspaceDir);
194
235
  let tasks = [];
195
236
  let dreamerTasks = [];
196
237
  let candidates = [];
@@ -340,6 +381,84 @@ export class EvidenceChainConsoleModel {
340
381
  }
341
382
  return response;
342
383
  }
384
+ /**
385
+ * P1-2: read the raw assistant turn referenced by correction evidence.
386
+ * Verbatim by contract — no sanitization, no markdown rendering.
387
+ *
388
+ * Uses the registered trajectory-store seam (`openTrajectoryDbReadonly`) so
389
+ * the read-only + path-contract rules have a single owner. The overflow blob
390
+ * directory is derived from the trajectory database location, never
391
+ * hardcoded, and a blob reference is confined to that directory before it is
392
+ * read.
393
+ */
394
+ async getAssistantTurn(turnId, expectedSessionId) {
395
+ if (!Number.isInteger(turnId) || turnId <= 0) {
396
+ return {
397
+ ok: false,
398
+ reason: 'Assistant turn id must be a positive integer',
399
+ nextAction: 'Reload the page and expand the original output again.',
400
+ };
401
+ }
402
+ const trajectoryDbPath = resolveTrajectoryDbPath(this.workspaceDir);
403
+ if (!fs.existsSync(trajectoryDbPath)) {
404
+ return {
405
+ ok: false,
406
+ reason: 'Trajectory database not found for this workspace',
407
+ nextAction: 'PD has not recorded any turns in this workspace yet.',
408
+ };
409
+ }
410
+ let db = null;
411
+ try {
412
+ db = openTrajectoryDbReadonly(this.workspaceDir);
413
+ // Untrusted DB row: narrow with a guard instead of an `as` cast (rc-2).
414
+ const row = db.prepare('SELECT id, session_id, raw_text, sanitized_text, blob_ref, created_at FROM assistant_turns WHERE id = ?').get(turnId);
415
+ if (!isRecord(row)) {
416
+ return {
417
+ ok: false,
418
+ reason: `Assistant turn ${turnId} was not found`,
419
+ nextAction: 'The trajectory database may have been rotated; the correction text is still shown above.',
420
+ };
421
+ }
422
+ const sessionId = typeof row.session_id === 'string' ? row.session_id : '';
423
+ if (expectedSessionId && sessionId !== expectedSessionId) {
424
+ // Safety: never expose a turn from a different session than the one the
425
+ // correction evidence recorded.
426
+ return {
427
+ ok: false,
428
+ reason: 'Assistant turn does not belong to the recorded session',
429
+ nextAction: 'The evidence link is inconsistent; treat the original output as unavailable.',
430
+ };
431
+ }
432
+ const restored = readVerbatimTurnText(row, path.dirname(trajectoryDbPath));
433
+ if (restored === null) {
434
+ return {
435
+ ok: false,
436
+ reason: 'Assistant turn has no recorded output',
437
+ nextAction: 'The turn exists but its text was not persisted.',
438
+ };
439
+ }
440
+ return {
441
+ ok: true,
442
+ turn: {
443
+ id: turnId,
444
+ sessionId,
445
+ text: restored.text,
446
+ textSource: restored.source,
447
+ createdAt: typeof row.created_at === 'string' ? row.created_at : '',
448
+ },
449
+ };
450
+ }
451
+ catch (err) {
452
+ return {
453
+ ok: false,
454
+ reason: `Failed to read assistant turn: ${errorMessage(err)}`,
455
+ nextAction: 'Check trajectory database integrity in the workspace .state directory.',
456
+ };
457
+ }
458
+ finally {
459
+ db?.close();
460
+ }
461
+ }
343
462
  // eslint-disable-next-line @typescript-eslint/class-methods-use-this -- lifecycle interface; connections are request-scoped
344
463
  dispose() {
345
464
  // Connections are opened and closed per-request; no persistent state.
@@ -1,4 +1,5 @@
1
1
  import { SqliteConnection, SqliteApprovalQueueStore, SqlitePIArtifactStore, ApprovalQueue, } from '@principles/core/runtime';
2
+ import { resolveStateDbPath, resolveTrajectoryDbPath } from '@principles/core/runtime/storage-paths';
2
3
  import * as fs from 'node:fs';
3
4
  import * as path from 'node:path';
4
5
  import { errorMessage } from '../utils/response.js';
@@ -51,7 +52,7 @@ export class GovernanceConsoleModel {
51
52
  this.workspaceDir = workspaceDir;
52
53
  }
53
54
  async getGovernanceQueue() {
54
- const stateDbPath = path.join(this.workspaceDir, '.pd', 'state.db');
55
+ const stateDbPath = resolveStateDbPath(this.workspaceDir);
55
56
  if (!fs.existsSync(stateDbPath)) {
56
57
  // Security audit run-1 (gate-failopen-allow-on-state-corruption): the
57
58
  // governed agent can delete state.db, and the gate then fails open —
@@ -293,7 +294,7 @@ export class GovernanceConsoleModel {
293
294
  }
294
295
  // PRI-380: Query trajectory.db for behavior evidence count
295
296
  let evidenceInProgressCount = 0;
296
- const trajectoryDbPath = path.join(this.workspaceDir, '.state', 'trajectory.db');
297
+ const trajectoryDbPath = resolveTrajectoryDbPath(this.workspaceDir);
297
298
  if (fs.existsSync(trajectoryDbPath)) {
298
299
  try {
299
300
  const Database = (await import('better-sqlite3')).default;
@@ -16,6 +16,7 @@ import * as path from 'node:path';
16
16
  import { createHash } from 'node:crypto';
17
17
  import { RUNTIME_CONTRACT_SCHEMA_VERSION } from '@principles/core/runtime';
18
18
  import { deriveGovernanceExperienceSnapshot, deriveOwnerGovernanceView, } from '@principles/core/runtime';
19
+ import { resolveStateDbPath } from '@principles/core/runtime/storage-paths';
19
20
  import { GovernanceProjectionCollector, isRecord, readOwnString, } from './GovernanceProjectionCollector.js';
20
21
  import { loadPdConfig } from '../config/pd-config-store.js';
21
22
  const EMPTY_TABLES = { artifactRows: [], taskRows: [], approvalRows: [], activationRows: [] };
@@ -59,7 +60,7 @@ export class GovernanceExperienceCollector {
59
60
  });
60
61
  }
61
62
  // ── state.db: existence check + one batched table read ───────────────────
62
- const dbPath = path.join(this.workspaceDir, '.pd', 'state.db');
63
+ const dbPath = resolveStateDbPath(this.workspaceDir);
63
64
  let tables = EMPTY_TABLES;
64
65
  let stateDbAvailable = true;
65
66
  let stateDbReasonCode;
@@ -3,6 +3,7 @@ import * as path from 'node:path';
3
3
  import { RUNTIME_CONTRACT_SCHEMA_VERSION } from '@principles/core/runtime';
4
4
  import { Value } from '@sinclair/typebox/value';
5
5
  import { GovernanceFactsSchema, SqliteConnection, isPDErrorCategory, parsePITaskMetadata, PD_TASK_STATUSES, PRINCIPLE_STATUSES, isPDTaskStatus, } from '@principles/core/runtime';
6
+ import { resolveStateDbPath } from '@principles/core/runtime/storage-paths';
6
7
  export const GOVERNANCE_TASK_KINDS = new Set([
7
8
  'dreamer', 'philosopher', 'scribe', 'artificer', 'evaluator', 'rollout_reviewer',
8
9
  ]);
@@ -55,7 +56,7 @@ export class GovernanceProjectionCollector {
55
56
  }
56
57
  const collectionIssues = [];
57
58
  const principle = this.readPrinciple(principleId, collectionIssues);
58
- const dbPath = path.join(this.workspaceDir, '.pd', 'state.db');
59
+ const dbPath = resolveStateDbPath(this.workspaceDir);
59
60
  if (!fs.existsSync(dbPath)) {
60
61
  return GovernanceProjectionCollector.factsForUnavailableSource({ principleId, asOf, principle, collectionIssues });
61
62
  }
@@ -0,0 +1,34 @@
1
+ /** The per-host row shape mirrors health-ingestion.ts structurally (review surface, not a projection). */
2
+ export interface IngestionHostRow {
3
+ status: 'monitored' | 'not_wired';
4
+ [field: string]: unknown;
5
+ }
6
+ export interface IngestionHealthSnapshot {
7
+ /** 'ok' = the CLI authority produced a real report (verbatim section passthrough). */
8
+ status: 'ok';
9
+ generatedAt: string;
10
+ workspace: string;
11
+ ingestion: {
12
+ codex: IngestionHostRow;
13
+ workbuddy: IngestionHostRow;
14
+ openclaw: IngestionHostRow;
15
+ };
16
+ }
17
+ export type IngestionHealthResult = {
18
+ status: 'ok';
19
+ snapshot: IngestionHealthSnapshot;
20
+ } | {
21
+ status: 'unknown';
22
+ reason: string;
23
+ nextAction: string;
24
+ productClaim: 'degraded';
25
+ };
26
+ export declare class IngestionHealthModel {
27
+ private readonly workspaceDir;
28
+ private readonly cliEntryOverride;
29
+ private readonly execTimeoutMs;
30
+ constructor(workspaceDir: string, cliEntryOverride?: string, options?: {
31
+ execTimeoutMs?: number;
32
+ });
33
+ collect(): Promise<IngestionHealthResult>;
34
+ }